|
1 |
| -function Base.show(io::IO, mime::MIME"text/latex", |
2 |
| - p::Union{AbstractPolynomialLike, RationalPoly}) |
| 1 | +const TypesWithShow = Union{AbstractVariable, AbstractMonomial, AbstractTerm, |
| 2 | + AbstractPolynomial, RationalPoly} |
| 3 | +function Base.show(io::IO, mime::MIME"text/latex", p::TypesWithShow) |
3 | 4 | print(io, "\$\$ ")
|
4 | 5 | _show(io, mime, p)
|
5 | 6 | print(io, " \$\$")
|
|
8 | 9 | # If the MIME is not specified, IJulia thinks that it supports images, ...
|
9 | 10 | # and then use the result of show and tries to interpret it as an svg, ...
|
10 | 11 | # We need the two methods to avoid ambiguity
|
11 |
| -function Base.show(io::IO, mime::MIME"text/plain", |
12 |
| - p::Union{AbstractPolynomialLike, RationalPoly}) |
| 12 | +function Base.show(io::IO, mime::MIME"text/plain", p::TypesWithShow) |
13 | 13 | _show(io, mime, p)
|
14 | 14 | end
|
15 |
| -function Base.show(io::IO, mime::MIME"text/print", |
16 |
| - p::Union{AbstractPolynomialLike, RationalPoly}) |
| 15 | +function Base.show(io::IO, mime::MIME"text/print", p::TypesWithShow) |
17 | 16 | _show(io, mime, p)
|
18 | 17 | end
|
19 | 18 |
|
20 |
| -Base.print(io::IO, p::Union{AbstractPolynomialLike, RationalPoly}) = show(io, MIME"text/print"(), p) |
21 |
| -Base.show(io::IO, p::Union{AbstractPolynomialLike, RationalPoly}) = show(io, MIME"text/plain"(), p) |
| 19 | +Base.print(io::IO, p::TypesWithShow) = show(io, MIME"text/print"(), p) |
| 20 | +Base.show(io::IO, p::TypesWithShow) = show(io, MIME"text/plain"(), p) |
22 | 21 |
|
23 | 22 | # VARIABLES
|
24 | 23 | function _show(io::IO, mime::MIME, var::AbstractVariable)
|
|
0 commit comments