Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress identity transformation in Latexified expressions #1255

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading