From 01371f9ad227662048efbcee037cd7f459caf94c Mon Sep 17 00:00:00 2001 From: Herman Sletmoen Date: Fri, 13 Dec 2024 15:19:24 +0100 Subject: [PATCH] Preserve latex variable metadata for callable variables --- src/latexify_recipes.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/latexify_recipes.jl b/src/latexify_recipes.jl index 7b0cd762a..a9a49d4e7 100644 --- a/src/latexify_recipes.jl +++ b/src/latexify_recipes.jl @@ -244,6 +244,10 @@ function _toexpr(O) end return Expr(:call, :_integral, _toexpr(lower), _toexpr(upper), vars, _toexpr(integrand)) elseif symtype(op) <: FnType + # Preserve latex metadata field when `x(t)` becomes `x` + if hasmetadata(O, VariableLatex) + op = setmetadata(op, VariableLatex, getmetadata(O, VariableLatex)) + end isempty(args) && return nameof(op) return Expr(:call, _toexpr(op), _toexpr(args)...) elseif op === getindex && symtype(args[1]) <: AbstractArray