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

Fix Unicode NAMESPACE_SEPARATOR and subscripts in latex output #1303

Merged
merged 2 commits into from
Oct 11, 2024
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
7 changes: 6 additions & 1 deletion src/latexify_recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ recipe(n) = latexify_derivatives(cleanup_exprs(_toexpr(n)))
cdot --> false
fmt --> FancyNumberFormatter(5)
index --> :subscript
snakecase --> true
safescripts --> true

return recipe(n)
end
Expand Down Expand Up @@ -189,7 +191,10 @@ function _toexpr(O)
return frac_expr
end
end
issym(O) && return nameof(O)
if issym(O)
sym = string(nameof(O))
return Symbol(replace(sym, NAMESPACE_SEPARATOR => "."))
end
!iscall(O) && return O

op = operation(O)
Expand Down
4 changes: 2 additions & 2 deletions src/rewrite-helpers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ end

"""
hasnode(c, x)
Returns true if any part of `x` fufills the condition given in c. c can be a function or an expression.
Returns true if any part of `x` fulfills the condition given in c. c can be a function or an expression.
If it is a function, returns true if x is true for any part of x. If c is an expression, returns
true if x contains c.

Expand Down Expand Up @@ -76,7 +76,7 @@ end

"""
filterchildren(c, x)
Returns all parts of `x` that fufills the condition given in c. c can be a function or an expression.
Returns all parts of `x` that fulfills the condition given in c. c can be a function or an expression.
If it is a function, returns everything for which the function is `true`. If c is an expression, returns
all expressions that matches it.

Expand Down
Loading