From ba4dab56055674ab0dbfe71a80ae63a0ff7c679e Mon Sep 17 00:00:00 2001 From: Kenneth Knox Date: Thu, 19 Sep 2024 12:55:46 +0100 Subject: [PATCH] Fix processing of multiline expressions --- src/latexify_function.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/latexify_function.jl b/src/latexify_function.jl index 768c7167..574f6fa2 100644 --- a/src/latexify_function.jl +++ b/src/latexify_function.jl @@ -37,10 +37,18 @@ function latexify(args...; kwargs...) return result end +function process_multiline(args...) + ## Test if argument contains LineNumberNode, and if true return as array of expressions with LineNumberNodes stripped + map(x -> x isa Expr && LineNumberNode in typeof.(x.args) ? filter(y -> !(y isa LineNumberNode), x.args) : x, args) +end + function process_latexify(args...; kwargs...) ## Let potential recipes transform the arguments. args, kwargs = apply_recipe(args...; kwargs...) + ## Split multiline quotes before processing + args = process_multiline(args...) + ## If the environment is unspecified, use auto inference. env = get(kwargs, :env, :auto)