Skip to content

Commit

Permalink
Merge pull request #1255 from hersle/latexify_suppress_identity
Browse files Browse the repository at this point in the history
Suppress identity transformation in Latexified expressions
  • Loading branch information
ChrisRackauckas authored Sep 2, 2024
2 parents fd56b13 + 2759c1b commit b75c55c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/latexify_recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ function _toexpr(O)
return :(solve($(_toexpr(args[1])), $(_toexpr(args[2]))))
elseif issym(op) && symtype(op) <: AbstractArray
return :(_textbf($(nameof(op))))
elseif op === identity
return _toexpr(only(args)) # suppress identity transformations (e.g. "identity(π)" -> "π")
end
return Expr(:call, Symbol(op), _toexpr(args)...)
end
Expand Down
2 changes: 2 additions & 0 deletions test/latexify.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ Dy = Differential(y)

@test_reference "latexify_refs/indices1.txt" latexify(h[10,10])
@test_reference "latexify_refs/indices2.txt" latexify(h[10,10], index=:bracket)

@test !occursin("identity", latexify(Num(π))) # issue #1254

0 comments on commit b75c55c

Please sign in to comment.