Skip to content
Open
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: 7 additions & 0 deletions src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ __needs_parens(a::AlgebraElement) = true
# We could add a check with `showable` if a `Real` subtype supports it and
# the feature is requested.
print_coefficient(io::IO, ::MIME, coeff::Real) = print(io, coeff)
function print_coefficient(io::IO, ::MIME"text/latex", coeff::Rational)
print(io, "\\frac{")
print(io, coeff.num)
print(io, "}{")
print(io, coeff.den)
print(io, "}")
end
# Scientific notation does not display well in LaTeX so we rewrite it
function print_coefficient(io::IO, ::MIME"text/latex", coeff::AbstractFloat)
s = string(coeff)
Expand Down