Skip to content

Commit

Permalink
Use Lowercase in some show methods (#1726)
Browse files Browse the repository at this point in the history
* Use Lowercase in some show methods

Also tweak how the bases are printed (print basis vector as
`[x, y]` instead of `T[x,y]`)
  • Loading branch information
fingolfin authored Feb 2, 2025
1 parent 429d727 commit 2bb83e9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ julia> K, a = number_field(f, "a");
julia> O = maximal_order(K);
julia> O
Maximal order of Number field of degree 3 over QQ
with basis AbsSimpleNumFieldElem[1, a, a^2]
Maximal order of number field of degree 3 over QQ
with basis [1, a, a^2]
```

## Documentation
Expand Down
8 changes: 4 additions & 4 deletions src/AlgAss/AlgGrp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,24 +169,24 @@ function show(io::IO, ::MIME"text/plain", A::GroupAlgebra)
end

function show(io::IO, A::GroupAlgebra)
io = pretty(io)
if is_terse(io)
print(io, "Group algebra of ")
if is_finite(group(A))
print(io, "dimension ", order(group(A)))
print(io, "dimension ", order(group(A)), " ")
else
print(io, "infinite dimension ")
end
print(io, " over ", base_ring(A))
else
print(io, "Group algebra of group ")
if is_finite(group(A))
print(io, "of order ", order(group(A)), " ")
else
print(io, "of infinite order ")
end
print(io, "over ")
print(terse(io), base_ring(A))
io = terse(io)
end
print(io, "over ", Lowercase(), base_ring(A))
end

################################################################################
Expand Down
2 changes: 1 addition & 1 deletion src/GenOrd/GenOrd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ julia> k, a = quadratic_field(12);
julia> integral_closure(ZZ, k)
Maximal order of Real quadratic field defined by x^2 - 12
Maximal order of real quadratic field defined by x^2 - 12
with basis AbsSimpleNumFieldElem[1, 1//2*sqrt(12)]
```
"""
Expand Down
20 changes: 16 additions & 4 deletions src/NumFieldOrd/NfOrd/NfOrd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ end
################################################################################

function show(io::IO, S::AbsNumFieldOrderSet)
io = pretty(io)
print(io, "Set of orders of the number field ")
print(io, S.nf)
print(io, Lowercase(), S.nf)
end

function extra_name(O::AbsNumFieldOrder)
Expand All @@ -217,14 +218,25 @@ function show(io::IO, O::AbsNumFieldOrder)
end

function show_gen(io::IO, O::AbsNumFieldOrder)
io = pretty(io)
print(io, "Order of ")
println(io, nf(O))
println(io, Lowercase(), nf(O))
print(io, "with Z-basis ")
print(io, basis(O, copy = false))
b = basis(O, copy = false)
# use `typeinfo` in IOContext to change e.g. `AbsSimpleNumFieldElem[1, a, a^2]`
# to `[1, a, a^2]` when printing the base
print(IOContext(terse(io), :typeinfo=>typeof(b)), b)
end

function show_maximal(io::IO, O::AbsNumFieldOrder)
print(io, "Maximal order of $(nf(O)) \nwith basis $(O.basis_nf)")
io = pretty(io)
print(io, "Maximal order of ")
println(io, Lowercase(), nf(O))
print(io, "with basis ")
b = O.basis_nf
# use `typeinfo` in IOContext to change e.g. `AbsSimpleNumFieldElem[1, a, a^2]`
# to `[1, a, a^2]` when printing the base
print(IOContext(terse(io), :typeinfo=>typeof(b)), b)
end

################################################################################
Expand Down
3 changes: 2 additions & 1 deletion src/NumFieldOrd/NfOrd/ResidueRing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ Base.deepcopy_internal(x::AbsOrdQuoRingElem, dict::IdDict) =
################################################################################

function show(io::IO, Q::AbsOrdQuoRing)
print(io, "Quotient of $(Q.base_ring)")
io = pretty(io)
print(io, "Quotient of ", Lowercase(), Q.base_ring)
end

function AbstractAlgebra.expressify(x::AbsOrdQuoRingElem; context = nothing)
Expand Down

0 comments on commit 2bb83e9

Please sign in to comment.