From cd65801871e6de700f373835b83c43a53b609bf4 Mon Sep 17 00:00:00 2001 From: Maximilian HUEBL Date: Tue, 27 Aug 2024 15:58:47 +0200 Subject: [PATCH] render cbrt and fourthroot functions --- src/latexoperation.jl | 4 ++-- test/latexraw_test.jl | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/latexoperation.jl b/src/latexoperation.jl index 6eb244ba..0f50f01c 100644 --- a/src/latexoperation.jl +++ b/src/latexoperation.jl @@ -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])}" diff --git a/test/latexraw_test.jl b/test/latexraw_test.jl index b6c81dd2..0e471a90 100644 --- a/test/latexraw_test.jl +++ b/test/latexraw_test.jl @@ -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}"