Skip to content

Commit

Permalink
Merge pull request #305 from mxhbl/master
Browse files Browse the repository at this point in the history
render cbrt and fourthroot functions
  • Loading branch information
gustaphe authored Aug 27, 2024
2 parents 219b5d1 + cd65801 commit 16e29ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/latexoperation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ function latexoperation(ex::Expr, prevOp::AbstractArray; kwargs...)::String
end
op == :exp && return "e^{$(args[2])}"
op in (:sqrt, :) && return "\\sqrt{$(args[2])}"
op == : && return "\\sqrt[3]{$(args[2])}"
op == : && return "\\sqrt[4]{$(args[2])}"
op in (:cbrt, :) && return "\\sqrt[3]{$(args[2])}"
op in (:fourthroot, :) && return "\\sqrt[4]{$(args[2])}"
op in (:sum, :prod) && return "\\$(op) $(args[2])"
op == :binomial && return "\\binom{$(args[2])}{$(args[3])}"

Expand Down
2 changes: 2 additions & 0 deletions test/latexraw_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ array_test = [ex, str]
@test latexraw(:(sqrt(x))) == raw"\sqrt{x}"
@test latexraw(:((x))) == raw"\sqrt{x}"
@test latexraw(:(+ 1))) == raw"\sqrt{\pi + 1}"
@test latexraw(:(cbrt(x))) == raw"\sqrt[3]{x}"
@test latexraw(:((x))) == raw"\sqrt[3]{x}"
@test latexraw(:(+ 1))) == raw"\sqrt[3]{\pi + 1}"
@test latexraw(:(fourthroot(x))) == raw"\sqrt[4]{x}"
@test latexraw(:((x))) == raw"\sqrt[4]{x}"
@test latexraw(:(+ 1))) == raw"\sqrt[4]{\pi + 1}"
@test latexraw(complex(1,-1)) == raw"1-1\mathit{i}"
Expand Down

0 comments on commit 16e29ef

Please sign in to comment.