Unicode Art¶
This module implements ascii art using unicode characters. It is a
strict superset of ascii_art
.
-
class
sage.typeset.unicode_art.
UnicodeArt
(lines=[], breakpoints=[], baseline=None)¶ Bases:
sage.typeset.character_art.CharacterArt
An Ascii art object is an object with some specific representation for printing.
INPUT:
lines
– the list of lines of the representation of the ascii art objectbreakpoints
– the list of points where the representation can be splitbaseline
– the reference line (from the bottom)
EXAMPLES:
sage: i = var('i') sage: unicode_art(sum(pi^i/factorial(i)*x^i, i, 0, oo)) π⋅x ℯ
-
sage.typeset.unicode_art.
unicode_art
(*obj, **kwds)¶ Return an unicode art representation
INPUT:
*obj
– any number of positional arguments, of arbitrary type. The objects whose ascii art representation we want.sep
– optional'sep=...'
keyword argument (or'separator'
). Anything that can be converted to unicode art (default: empty unicode art). The separator in-between a list of objects. Only used if more than one object given.baseline
– (default: 0) the baseline for the objectsep_baseline
– (default: 0) the baseline for the separator
OUTPUT:
UnicodeArt
instance.EXAMPLES:
sage: unicode_art(integral(exp(sqrt(x))/(x+pi), x)) ⌠ ⎮ √x ⎮ ℯ ⎮ ───── dx ⎮ x + π ⌡ sage: ident = lambda n: identity_matrix(ZZ, n) sage: unicode_art(ident(1), ident(2), ident(3), sep=' : ') ⎛1 0 0⎞ ⎛1 0⎞ ⎜0 1 0⎟ (1) : ⎝0 1⎠ : ⎝0 0 1⎠
If specified, the
sep_baseline
overrides the baseline of an unicode art separator:sage: sep_line = unicode_art('\n'.join(u' ⎟ ' for _ in range(5)), baseline=5) sage: unicode_art(*AlternatingSignMatrices(3), ....: separator=sep_line, sep_baseline=1) ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎛1 0 0⎞ ⎟ ⎛0 1 0⎞ ⎟ ⎛1 0 0⎞ ⎟ ⎛ 0 1 0⎞ ⎟ ⎛0 0 1⎞ ⎟ ⎛0 1 0⎞ ⎟ ⎛0 0 1⎞ ⎜0 1 0⎟ ⎟ ⎜1 0 0⎟ ⎟ ⎜0 0 1⎟ ⎟ ⎜ 1 -1 1⎟ ⎟ ⎜1 0 0⎟ ⎟ ⎜0 0 1⎟ ⎟ ⎜0 1 0⎟ ⎝0 0 1⎠ ⎟ ⎝0 0 1⎠ ⎟ ⎝0 1 0⎠ ⎟ ⎝ 0 1 0⎠ ⎟ ⎝0 1 0⎠ ⎟ ⎝1 0 0⎠ ⎟ ⎝1 0 0⎠ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟