width of pretty_print() text output

asked 2024-09-12 21:34:54 +0100

Max Alekseyev gravatar image

updated 2024-09-12 21:37:35 +0100

Consider a code example:

sage: L = [Matrix(ZZ,4,4)]*10
sage: pretty_print(L)
[
[0 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]
[0 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]
[0 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]
[0 0 0 0], [0 0 0 0], [0 0 0 0], [0 0 0 0], [0 0 0 0], [0 0 0 0],

[0 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]
[0 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]
[0 0 0 0]  [0 0 0 0]  [0 0 0 0]  [0 0 0 0]
[0 0 0 0], [0 0 0 0], [0 0 0 0], [0 0 0 0]
]

It wraps up this list of matrices after 6 in a row, not matter how wide is my terminal window. How I can change this - e.g. specify the window width at which wrap the lines, or turn off wrapping at all?

edit retag flag offensive close merge delete

Comments

2

You may use unicode_art(L)

FrédéricC gravatar imageFrédéricC ( 2024-09-13 07:59:13 +0100 )edit
2

An alternative is

sage: %display unicode_art
sage: L

To revert to standard display mode, use

sage: %display plain
eric_g gravatar imageeric_g ( 2024-09-13 11:29:40 +0100 )edit