From 2e44d2be3f881a02f66297815a389bebc6ad4f68 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Tue, 21 Nov 2023 09:21:56 +0100 Subject: [PATCH] Revert "Revert "Fix printing multivariate polynomial ring with many variables (#1476)"" (#1489) --- docs/src/mpolynomial.md | 4 ++++ docs/src/mseries.md | 2 +- src/AbsMSeries.jl | 4 ++-- src/FreeAssAlgebra.jl | 2 +- src/LaurentMPoly.jl | 4 ++-- src/MPoly.jl | 6 +++--- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/src/mpolynomial.md b/docs/src/mpolynomial.md index 56f3761b99..09d859daa0 100644 --- a/docs/src/mpolynomial.md +++ b/docs/src/mpolynomial.md @@ -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 diff --git a/docs/src/mseries.md b/docs/src/mseries.md index b1d975b3be..c2d9121061 100644 --- a/docs/src/mseries.md +++ b/docs/src/mseries.md @@ -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) diff --git a/src/AbsMSeries.jl b/src/AbsMSeries.jl index 33782bf973..be73175c7f 100644 --- a/src/AbsMSeries.jl +++ b/src/AbsMSeries.jl @@ -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) diff --git a/src/FreeAssAlgebra.jl b/src/FreeAssAlgebra.jl index c5e152b8a6..bf3a759a06 100644 --- a/src/FreeAssAlgebra.jl +++ b/src/FreeAssAlgebra.jl @@ -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) diff --git a/src/LaurentMPoly.jl b/src/LaurentMPoly.jl index 93516b5261..08b4aa1d06 100644 --- a/src/LaurentMPoly.jl +++ b/src/LaurentMPoly.jl @@ -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) diff --git a/src/MPoly.jl b/src/MPoly.jl index 5b1811c797..000fbdc909 100644 --- a/src/MPoly.jl +++ b/src/MPoly.jl @@ -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 @@ -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