Symbols for Character Art#
This module defines single- and multi-line symbols.
EXAMPLES:
sage: from sage.typeset.symbols import *
sage: symbols = ascii_art('')
sage: for i in range(1, 5):
....: symbols += ascii_left_parenthesis.character_art(i)
....: symbols += ascii_art(' ')
....: symbols += ascii_right_parenthesis.character_art(i)
....: symbols += ascii_art(' ')
sage: for i in range(1, 5):
....: symbols += ascii_left_square_bracket.character_art(i)
....: symbols += ascii_art(' ')
....: symbols += ascii_right_square_bracket.character_art(i)
....: symbols += ascii_art(' ')
sage: for i in range(1, 5):
....: symbols += ascii_left_curly_brace.character_art(i)
....: symbols += ascii_art(' ')
....: symbols += ascii_right_curly_brace.character_art(i)
....: symbols += ascii_art(' ')
sage: symbols
( ) [ ] { }
( ) ( ) [ ] [ ] { } { }
( ) ( ) ( ) [ ] [ ] [ ] { } { } { }
( ) ( ) ( ) ( ) [ ] [ ] [ ] [ ] { } { } { } { }
sage: symbols = unicode_art('')
sage: for i in range(1, 5):
....: symbols += unicode_left_parenthesis.character_art(i)
....: symbols += unicode_art(' ')
....: symbols += unicode_right_parenthesis.character_art(i)
....: symbols += unicode_art(' ')
sage: for i in range(1, 5):
....: symbols += unicode_left_square_bracket.character_art(i)
....: symbols += unicode_art(' ')
....: symbols += unicode_right_square_bracket.character_art(i)
....: symbols += unicode_art(' ')
sage: for i in range(1, 5):
....: symbols += unicode_left_curly_brace.character_art(i)
....: symbols += unicode_art(' ')
....: symbols += unicode_right_curly_brace.character_art(i)
....: symbols += unicode_art(' ')
sage: symbols
⎛ ⎞ ⎡ ⎤ ⎧ ⎫
⎛ ⎞ ⎜ ⎟ ⎡ ⎤ ⎢ ⎥ ⎧ ⎫ ⎭ ⎩
⎛ ⎞ ⎜ ⎟ ⎜ ⎟ ⎡ ⎤ ⎢ ⎥ ⎢ ⎥ ⎰ ⎱ ⎨ ⎬ ⎫ ⎧
( ) ⎝ ⎠ ⎝ ⎠ ⎝ ⎠ [ ] ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ { } ⎱ ⎰ ⎩ ⎭ ⎩ ⎭
- class sage.typeset.symbols.CompoundAsciiSymbol(character, top, extension, bottom, middle=None, middle_top=None, middle_bottom=None, top_2=None, bottom_2=None)#
Bases:
sage.typeset.symbols.CompoundSymbol
- character_art(num_lines)#
Return the ASCII art of the symbol
EXAMPLES:
sage: from sage.typeset.symbols import * sage: ascii_left_curly_brace.character_art(3) { { {
- class sage.typeset.symbols.CompoundSymbol(character, top, extension, bottom, middle=None, middle_top=None, middle_bottom=None, top_2=None, bottom_2=None)#
Bases:
sage.structure.sage_object.SageObject
A multi-character (ascii/unicode art) symbol
INPUT:
Instead of string, each of these can be unicode in Python 2:
character
– string. The single-line version of the symbol.top
– string. The top line of a multi-line symbol.extension
– string. The extension line of a multi-line symbol (will be repeated).bottom
– string. The bottom line of a multi-line symbol.middle
– optional string. The middle part, for example in curly braces. Will be used only once for the symbol, and only if its height is odd.middle_top
– optional string. The upper half of the 2-line middle part if the height of the symbol is even. Will be used only once for the symbol.middle_bottom
– optional string. The lower half of the 2-line middle part if the height of the symbol is even. Will be used only once for the symbol.top_2
– optional string. The upper half of a 2-line symbol.bottom_2
– optional string. The lower half of a 2-line symbol.
EXAMPLES:
sage: from sage.typeset.symbols import CompoundSymbol sage: i = CompoundSymbol('I', '+', '|', '+', '|') sage: i.print_to_stdout(1) I sage: i.print_to_stdout(3) + | +
- print_to_stdout(num_lines)#
Print the multi-line symbol
This method is for testing purposes.
INPUT:
num_lines
– integer. The total number of lines.
EXAMPLES:
sage: from sage.typeset.symbols import * sage: unicode_integral.print_to_stdout(1) ∫ sage: unicode_integral.print_to_stdout(2) ⌠ ⌡ sage: unicode_integral.print_to_stdout(3) ⌠ ⎮ ⌡ sage: unicode_integral.print_to_stdout(4) ⌠ ⎮ ⎮ ⌡
- class sage.typeset.symbols.CompoundUnicodeSymbol(character, top, extension, bottom, middle=None, middle_top=None, middle_bottom=None, top_2=None, bottom_2=None)#
Bases:
sage.typeset.symbols.CompoundSymbol
- character_art(num_lines)#
Return the unicode art of the symbol
EXAMPLES:
sage: from sage.typeset.symbols import * sage: unicode_left_curly_brace.character_art(3) ⎧ ⎨ ⎩