Skip to content

Commit 14bbacc

Browse files
committed
print imaginary unit as if mimetype is latex
1 parent 97665ee commit 14bbacc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/show.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,10 @@ function printcoefficient(io::IO, a::Rational{T}, j, mimetype::MIME"text/latex")
202202
abs(a.den) == one(T) ? print(io, a.num) : print(io, "\\frac{$(a.num)}{$(a.den)}")
203203
end
204204

205-
# print complex numbers with parentheses as needed. `imagsymbol` can be given to print the imaginary unit as some other string than `"im"`
206-
function printcoefficient(io::IO, pj::Complex{T}, j, mimetype; imagsymbol::String="im") where {T}
205+
# print complex numbers with parentheses as needed. Pretty print complex numbers in latex
206+
function printcoefficient(io::IO, pj::Complex{T}, j, mimetype) where {T}
207207

208+
imagsymbol = isa(mimetype::MIME"text/latex") ? "i" : "im"
208209
a = real(pj)
209210
b = imag(pj)
210211

0 commit comments

Comments
 (0)