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, atomic=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. 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.
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⎠
TESTS:
sage: n = var('n') sage: unicode_art(sum(binomial(2 * n, n + 1) * x^n, n, 0, oo)) ⎛ __________ ⎞ -⎝2⋅x + ╲╱ -4⋅x + 1 - 1⎠ ────────────────────────── __________ 2⋅x⋅╲╱ -4⋅x + 1 sage: unicode_art(list(DyckWords(3))) ⎡ ╱╲ ⎤ ⎢ ╱╲ ╱╲ ╱╲╱╲ ╱ ╲ ⎥ ⎣ ╱╲╱╲╱╲, ╱╲╱ ╲, ╱ ╲╱╲, ╱ ╲, ╱ ╲ ⎦ sage: unicode_art(1) 1