Skip to content

Commit

Permalink
Revert "Revert "Fix printing multivariate polynomial ring with many v…
Browse files Browse the repository at this point in the history
…ariables (#1476)"" (#1489)
  • Loading branch information
thofma authored Nov 21, 2023
1 parent c27ec5d commit 2e44d2b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions docs/src/mpolynomial.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ julia> derivative(k, 1)
julia> derivative(k, 2)
0
julia> R, x = polynomial_ring(ZZ, 10); R
Multivariate polynomial ring in 10 variables x1, x2, x3, x4, ..., x10
over integers
```

## Polynomial constructors
Expand Down
2 changes: 1 addition & 1 deletion docs/src/mseries.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ julia> v = symbols(R)
:x
julia> T = parent(x + 1)
Multivariate power series ringin 1 variable x
Multivariate power series ring in 1 variable x
over integers
julia> f == deepcopy(f)
Expand Down
4 changes: 2 additions & 2 deletions src/AbsMSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ function show(io::IO, ::MIME"text/plain", p::MSeriesRing)
max_vars = 5 # largest number of variables to print
n = nvars(p)
print(io, "Multivariate power series ring")
print(io, "in ", ItemQuantity(nvars(p), "variable"), " ")
print(io, " in ", ItemQuantity(nvars(p), "variable"), " ")
if n > max_vars
join(io, symbols(p)[1:max_vars - 1], ", ")
println(io, "..., ", symbols(p)[n])
println(io, ", ..., ", symbols(a)[n])
else
join(io, symbols(p), ", ")
println(io)
Expand Down
2 changes: 1 addition & 1 deletion src/FreeAssAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function show(io::IO, ::MIME"text/plain", a::FreeAssAlgebra)
print(io, " on ", ItemQuantity(nvars(a), "indeterminate"), " ")
if n > max_vars
join(io, symbols(a)[1:max_vars - 1], ", ")
println(io, "..., ", symbols(a)[n])
println(io, ", ..., ", symbols(a)[n])
else
join(io, symbols(a), ", ")
println(io)
Expand Down
4 changes: 2 additions & 2 deletions src/LaurentMPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ function show(io::IO, ::MIME"text/plain", p::LaurentMPolyRing)
max_vars = 5 # largest number of variables to print
n = nvars(p)
print(io, "Multivariate Laurent polynomial ring")
print(io, "in ", ItemQuantity(nvars(p), "variable"), " ")
print(io, " in ", ItemQuantity(nvars(p), "variable"), " ")
if n > max_vars
join(io, symbols(p)[1:max_vars - 1], ", ")
println(io, "..., ", symbols(p)[n])
println(io, ", ..., ", symbols(a)[n])
else
join(io, symbols(p), ", ")
println(io)
Expand Down
6 changes: 3 additions & 3 deletions src/MPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -570,12 +570,12 @@ function show(io::IO, ::MIME"text/plain", p::MPolyRing)
print(io, " in ", ItemQuantity(nvars(p), "variable"), " ")
if n > max_vars
join(io, symbols(p)[1:max_vars - 1], ", ")
println(io, "..., ", symbols(p)[n])
println(io, ", ..., ", symbols(p)[n])
else
join(io, symbols(p), ", ")
println(io)
end
io = pretty(io) # we need this to allow indented and lowercase printing
io = pretty(io)
print(io, Indent(), "over ", Lowercase(), base_ring(p))
print(io, Dedent())
end
Expand All @@ -585,8 +585,8 @@ function show(io::IO, p::MPolyRing)
# no nested printing
print(io, "Multivariate polynomial ring")
else
io = pretty(io) # we need this to allow printing lowercase
# nested printing allowed, preferably supercompact
io = pretty(io)
print(io, "Multivariate polynomial ring in ", ItemQuantity(nvars(p), "variable"))
print(IOContext(io, :supercompact => true), " over ", Lowercase(), base_ring(p))
end
Expand Down

0 comments on commit 2e44d2b

Please sign in to comment.