Skip to content

Commit

Permalink
Merge pull request #1375 from karlwessel/patch-1
Browse files Browse the repository at this point in the history
fix latexify_recipes.jl for real values of type Complex
  • Loading branch information
ChrisRackauckas authored Dec 1, 2024
2 parents 3afdcac + 91b5dd9 commit fdce599
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/latexify_recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function _toexpr(O)
frac_expr = Expr(:call, :/, numer_expr, denom_expr)
end

if isreal(m.coeff) && m.coeff < 0
if isreal(m.coeff) && real(m.coeff) < 0
return Expr(:call, :-, frac_expr)
else
return frac_expr
Expand Down
3 changes: 3 additions & 0 deletions test/latexify.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ Dy = Differential(y)
@test_reference "latexify_refs/complex3.txt" latexify(1 - x + (1+2x)*im; imaginary_unit="\\mathbb{i}")
@test_reference "latexify_refs/complex4.txt" latexify(im * Symbolics.Term(sqrt, [2]))

@syms c
@test_reference "latexify_refs/complex5.txt" latexify((3+im/im)c)

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

Expand Down
3 changes: 3 additions & 0 deletions test/latexify_refs/complex5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
\begin{equation}
4.0 c
\end{equation}

0 comments on commit fdce599

Please sign in to comment.