Output functions¶
These are the output functions for latexing and ascii/unicode art versions of partitions and tableaux.
AUTHORS:
Mike Hansen (?): initial version
Andrew Mathas (2013-02-14): Added support for displaying conventions and lines, and tableaux of skew partition, composition, and skew/composition/partition/tableaux tuple shape.
Travis Scrimshaw (2020-08): Added support for ascii/unicode art
- sage.combinat.output.ascii_art_table(data, use_unicode=False, convention='English')[source]¶
Return an ascii art table of
data
.EXAMPLES:
sage: from sage.combinat.output import ascii_art_table sage: data = [[None, None, 1], [2, 2], [3,4,5], [None, None, 10], [], [6]] sage: print(ascii_art_table(data)) +----+ | 1 | +---+---+----+ | 2 | 2 | +---+---+----+ | 3 | 4 | 5 | +---+---+----+ | 10 | +----+ +---+ | 6 | +---+ sage: print(ascii_art_table(data, use_unicode=True)) ┌────┐ │ 1 │ ┌───┬───┼────┘ │ 2 │ 2 │ ├───┼───┼────┐ │ 3 │ 4 │ 5 │ └───┴───┼────┤ │ 10 │ └────┘ ┌───┐ │ 6 │ └───┘ sage: data = [[1, None, 2], [None, 2]] sage: print(ascii_art_table(data)) +---+ +---+ | 1 | | 2 | +---+---+---+ | 2 | +---+ sage: print(ascii_art_table(data, use_unicode=True)) ┌───┐ ┌───┐ │ 1 │ │ 2 │ └───┼───┼───┘ │ 2 │ └───┘
>>> from sage.all import * >>> from sage.combinat.output import ascii_art_table >>> data = [[None, None, Integer(1)], [Integer(2), Integer(2)], [Integer(3),Integer(4),Integer(5)], [None, None, Integer(10)], [], [Integer(6)]] >>> print(ascii_art_table(data)) +----+ | 1 | +---+---+----+ | 2 | 2 | +---+---+----+ | 3 | 4 | 5 | +---+---+----+ | 10 | +----+ <BLANKLINE> +---+ | 6 | +---+ >>> print(ascii_art_table(data, use_unicode=True)) ┌────┐ │ 1 │ ┌───┬───┼────┘ │ 2 │ 2 │ ├───┼───┼────┐ │ 3 │ 4 │ 5 │ └───┴───┼────┤ │ 10 │ └────┘ <BLANKLINE> ┌───┐ │ 6 │ └───┘ >>> data = [[Integer(1), None, Integer(2)], [None, Integer(2)]] >>> print(ascii_art_table(data)) +---+ +---+ | 1 | | 2 | +---+---+---+ | 2 | +---+ >>> print(ascii_art_table(data, use_unicode=True)) ┌───┐ ┌───┐ │ 1 │ │ 2 │ └───┼───┼───┘ │ 2 │ └───┘
- sage.combinat.output.ascii_art_table_russian(data, use_unicode=False, compact=False)[source]¶
Return an ascii art table of
data
for the russian convention.EXAMPLES:
sage: from sage.combinat.output import ascii_art_table_russian sage: data = [[None, None, 1], [2, 2], [3,4,5], [None, None, 10], [], [6]] sage: print(ascii_art_table_russian(data)) / \ / \ / \ / \ \ 6 / \ 10 \ \ / \ / \ \ / \ / \ X 5 / / \ / / \ / / 4 X / \ / \ / \ / \ / \ / \ \ 3 X 2 X 1 / \ / \ / \ / \ / \ / \ / \ 2 / \ / \ / sage: print(ascii_art_table_russian(data, use_unicode=True)) ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╲ 6 ╱ ╲ 10 ╲ ╲ ╱ ╲ ╱ ╲ ╲ ╱ ╲ ╱ ╲ ╳ 5 ╱ ╱ ╲ ╱ ╱ ╲ ╱ ╱ 4 ╳ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╲ 3 ╳ 2 ╳ 1 ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ 2 ╱ ╲ ╱ ╲ ╱ sage: data = [[1, None, 2], [None, 2]] sage: print(ascii_art_table_russian(data)) / \ / \ \ 2 X 2 / \ / \ / X / \ \ 1 / \ / sage: print(ascii_art_table_russian(data, use_unicode=True)) ╱ ╲ ╱ ╲ ╲ 2 ╳ 2 ╱ ╲ ╱ ╲ ╱ ╳ ╱ ╲ ╲ 1 ╱ ╲ ╱
>>> from sage.all import * >>> from sage.combinat.output import ascii_art_table_russian >>> data = [[None, None, Integer(1)], [Integer(2), Integer(2)], [Integer(3),Integer(4),Integer(5)], [None, None, Integer(10)], [], [Integer(6)]] >>> print(ascii_art_table_russian(data)) / \ / \ / \ / \ \ 6 / \ 10 \ \ / \ / \ \ / \ / \ X 5 / / \ / / \ / / 4 X / \ / \ / \ / \ / \ / \ \ 3 X 2 X 1 / \ / \ / \ / \ / \ / \ / \ 2 / \ / \ / >>> print(ascii_art_table_russian(data, use_unicode=True)) ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╲ 6 ╱ ╲ 10 ╲ ╲ ╱ ╲ ╱ ╲ ╲ ╱ ╲ ╱ ╲ ╳ 5 ╱ ╱ ╲ ╱ ╱ ╲ ╱ ╱ 4 ╳ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╲ 3 ╳ 2 ╳ 1 ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ 2 ╱ ╲ ╱ ╲ ╱ >>> data = [[Integer(1), None, Integer(2)], [None, Integer(2)]] >>> print(ascii_art_table_russian(data)) / \ / \ \ 2 X 2 / \ / \ / X / \ \ 1 / \ / >>> print(ascii_art_table_russian(data, use_unicode=True)) ╱ ╲ ╱ ╲ ╲ 2 ╳ 2 ╱ ╲ ╱ ╲ ╱ ╳ ╱ ╲ ╲ 1 ╱ ╲ ╱
- sage.combinat.output.box_exists(tab, i, j)[source]¶
Return
True
iftab[i][j]
exists and is notNone
; in particular this allows for \(tab[i][j]\) to be''
or0
.INPUT:
tab
– list of listsi
– first coordinatej
– second coordinate
- sage.combinat.output.tex_from_array(array, with_lines=True)[source]¶
Return a latex string for a two dimensional array of partition, composition or skew composition shape.
INPUT:
array
– list of listwith_lines
– boolean (default:True
); whether to draw a line to separate the entries in the array
Empty rows are allowed; however, such rows should be given as
[None]
rather than[]
.The array is drawn using either the English or French convention following
Tableaux.options()
.See also
EXAMPLES:
sage: from sage.combinat.output import tex_from_array sage: print(tex_from_array([[1,2,3],[4,5]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{1-3} \lr{1}&\lr{2}&\lr{3}\\\cline{1-3} \lr{4}&\lr{5}\\\cline{1-2} \end{array}$} } sage: print(tex_from_array([[1,2,3],[4,5]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\\ \lr{1}&\lr{2}&\lr{3}\\ \lr{4}&\lr{5}\\ \end{array}$} } sage: print(tex_from_array([[1,2,3],[4,5,6,7],[8]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\cline{1-3} \lr{1}&\lr{2}&\lr{3}\\\cline{1-4} \lr{4}&\lr{5}&\lr{6}&\lr{7}\\\cline{1-4} \lr{8}\\\cline{1-1} \end{array}$} } sage: print(tex_from_array([[1,2,3],[4,5,6,7],[8]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\\ \lr{1}&\lr{2}&\lr{3}\\ \lr{4}&\lr{5}&\lr{6}&\lr{7}\\ \lr{8}\\ \end{array}$} } sage: print(tex_from_array([[None,None,3],[None,5,6,7],[8]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\cline{3-3} &&\lr{3}\\\cline{2-4} &\lr{5}&\lr{6}&\lr{7}\\\cline{1-4} \lr{8}\\\cline{1-1} \end{array}$} } sage: print(tex_from_array([[None,None,3],[None,5,6,7],[None,8]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\cline{3-3} &&\lr{3}\\\cline{2-4} &\lr{5}&\lr{6}&\lr{7}\\\cline{2-4} &\lr{8}\\\cline{2-2} \end{array}$} } sage: print(tex_from_array([[None,None,3],[None,5,6,7],[8]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\\ &&\lr{3}\\ &\lr{5}&\lr{6}&\lr{7}\\ \lr{8}\\ \end{array}$} } sage: print(tex_from_array([[None,None,3],[None,5,6,7],[None,8]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\\ &&\lr{3}\\ &\lr{5}&\lr{6}&\lr{7}\\ &\lr{8}\\ \end{array}$} } sage: Tableaux.options.convention="french" sage: print(tex_from_array([[1,2,3],[4,5]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\cline{1-2} \lr{4}&\lr{5}\\\cline{1-3} \lr{1}&\lr{2}&\lr{3}\\\cline{1-3} \end{array}$} } sage: print(tex_from_array([[1,2,3],[4,5]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\\ \lr{4}&\lr{5}\\ \lr{1}&\lr{2}&\lr{3}\\ \end{array}$} } sage: print(tex_from_array([[1,2,3],[4,5,6,7],[8]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\cline{1-1} \lr{8}\\\cline{1-4} \lr{4}&\lr{5}&\lr{6}&\lr{7}\\\cline{1-4} \lr{1}&\lr{2}&\lr{3}\\\cline{1-3} \end{array}$} } sage: print(tex_from_array([[1,2,3],[4,5,6,7],[8]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\\ \lr{8}\\ \lr{4}&\lr{5}&\lr{6}&\lr{7}\\ \lr{1}&\lr{2}&\lr{3}\\ \end{array}$} } sage: print(tex_from_array([[None,None,3],[None,5,6,7],[8]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\cline{1-1} \lr{8}\\\cline{1-4} &\lr{5}&\lr{6}&\lr{7}\\\cline{2-4} &&\lr{3}\\\cline{3-3} \end{array}$} } sage: print(tex_from_array([[None,None,3],[None,5,6,7],[None,8]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\cline{2-2} &\lr{8}\\\cline{2-4} &\lr{5}&\lr{6}&\lr{7}\\\cline{2-4} &&\lr{3}\\\cline{3-3} \end{array}$} } sage: print(tex_from_array([[None,None,3],[None,5,6,7],[8]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\\ \lr{8}\\ &\lr{5}&\lr{6}&\lr{7}\\ &&\lr{3}\\ \end{array}$} } sage: print(tex_from_array([[None,None,3],[None,5,6,7],[None,8]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\\ &\lr{8}\\ &\lr{5}&\lr{6}&\lr{7}\\ &&\lr{3}\\ \end{array}$} } sage: Tableaux.options.convention="russian" sage: print(tex_from_array([[1,2,3],[4,5]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\cline{1-2} \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}\\\cline{1-3} \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\\cline{1-3} \end{array}$}} } sage: print(tex_from_array([[1,2,3],[4,5]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\\ \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}\\ \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\ \end{array}$}} } sage: print(tex_from_array([[1,2,3],[4,5,6,7],[8]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\cline{1-1} \lr{\rotatebox{-45}{8}}\\\cline{1-4} \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\\cline{1-4} \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\\cline{1-3} \end{array}$}} } sage: print(tex_from_array([[1,2,3],[4,5,6,7],[8]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\\ \lr{\rotatebox{-45}{8}}\\ \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\ \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\ \end{array}$}} } sage: print(tex_from_array([[None,None,3],[None,5,6,7],[8]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\cline{1-1} \lr{\rotatebox{-45}{8}}\\\cline{1-4} &\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\\cline{2-4} &&\lr{\rotatebox{-45}{3}}\\\cline{3-3} \end{array}$}} } sage: print(tex_from_array([[None,None,3],[None,5,6,7],[None,8]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\cline{2-2} &\lr{\rotatebox{-45}{8}}\\\cline{2-4} &\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\\cline{2-4} &&\lr{\rotatebox{-45}{3}}\\\cline{3-3} \end{array}$}} } sage: print(tex_from_array([[None,None,3],[None,5,6,7],[8]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\\ \lr{\rotatebox{-45}{8}}\\ &\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\ &&\lr{\rotatebox{-45}{3}}\\ \end{array}$}} } sage: print(tex_from_array([[None,None,3],[None,5,6,7],[None,8]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\\ &\lr{\rotatebox{-45}{8}}\\ &\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\ &&\lr{\rotatebox{-45}{3}}\\ \end{array}$}} } sage: Tableaux.options._reset()
>>> from sage.all import * >>> from sage.combinat.output import tex_from_array >>> print(tex_from_array([[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5)]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{1-3} \lr{1}&\lr{2}&\lr{3}\\\cline{1-3} \lr{4}&\lr{5}\\\cline{1-2} \end{array}$} } >>> print(tex_from_array([[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5)]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\\ \lr{1}&\lr{2}&\lr{3}\\ \lr{4}&\lr{5}\\ \end{array}$} } >>> print(tex_from_array([[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5),Integer(6),Integer(7)],[Integer(8)]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\cline{1-3} \lr{1}&\lr{2}&\lr{3}\\\cline{1-4} \lr{4}&\lr{5}&\lr{6}&\lr{7}\\\cline{1-4} \lr{8}\\\cline{1-1} \end{array}$} } >>> print(tex_from_array([[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5),Integer(6),Integer(7)],[Integer(8)]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\\ \lr{1}&\lr{2}&\lr{3}\\ \lr{4}&\lr{5}&\lr{6}&\lr{7}\\ \lr{8}\\ \end{array}$} } >>> print(tex_from_array([[None,None,Integer(3)],[None,Integer(5),Integer(6),Integer(7)],[Integer(8)]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\cline{3-3} &&\lr{3}\\\cline{2-4} &\lr{5}&\lr{6}&\lr{7}\\\cline{1-4} \lr{8}\\\cline{1-1} \end{array}$} } >>> print(tex_from_array([[None,None,Integer(3)],[None,Integer(5),Integer(6),Integer(7)],[None,Integer(8)]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\cline{3-3} &&\lr{3}\\\cline{2-4} &\lr{5}&\lr{6}&\lr{7}\\\cline{2-4} &\lr{8}\\\cline{2-2} \end{array}$} } >>> print(tex_from_array([[None,None,Integer(3)],[None,Integer(5),Integer(6),Integer(7)],[Integer(8)]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\\ &&\lr{3}\\ &\lr{5}&\lr{6}&\lr{7}\\ \lr{8}\\ \end{array}$} } >>> print(tex_from_array([[None,None,Integer(3)],[None,Integer(5),Integer(6),Integer(7)],[None,Integer(8)]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\\ &&\lr{3}\\ &\lr{5}&\lr{6}&\lr{7}\\ &\lr{8}\\ \end{array}$} } >>> Tableaux.options.convention="french" >>> print(tex_from_array([[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5)]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\cline{1-2} \lr{4}&\lr{5}\\\cline{1-3} \lr{1}&\lr{2}&\lr{3}\\\cline{1-3} \end{array}$} } >>> print(tex_from_array([[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5)]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\\ \lr{4}&\lr{5}\\ \lr{1}&\lr{2}&\lr{3}\\ \end{array}$} } >>> print(tex_from_array([[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5),Integer(6),Integer(7)],[Integer(8)]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\cline{1-1} \lr{8}\\\cline{1-4} \lr{4}&\lr{5}&\lr{6}&\lr{7}\\\cline{1-4} \lr{1}&\lr{2}&\lr{3}\\\cline{1-3} \end{array}$} } >>> print(tex_from_array([[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5),Integer(6),Integer(7)],[Integer(8)]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\\ \lr{8}\\ \lr{4}&\lr{5}&\lr{6}&\lr{7}\\ \lr{1}&\lr{2}&\lr{3}\\ \end{array}$} } >>> print(tex_from_array([[None,None,Integer(3)],[None,Integer(5),Integer(6),Integer(7)],[Integer(8)]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\cline{1-1} \lr{8}\\\cline{1-4} &\lr{5}&\lr{6}&\lr{7}\\\cline{2-4} &&\lr{3}\\\cline{3-3} \end{array}$} } >>> print(tex_from_array([[None,None,Integer(3)],[None,Integer(5),Integer(6),Integer(7)],[None,Integer(8)]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\cline{2-2} &\lr{8}\\\cline{2-4} &\lr{5}&\lr{6}&\lr{7}\\\cline{2-4} &&\lr{3}\\\cline{3-3} \end{array}$} } >>> print(tex_from_array([[None,None,Integer(3)],[None,Integer(5),Integer(6),Integer(7)],[Integer(8)]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\\ \lr{8}\\ &\lr{5}&\lr{6}&\lr{7}\\ &&\lr{3}\\ \end{array}$} } >>> print(tex_from_array([[None,None,Integer(3)],[None,Integer(5),Integer(6),Integer(7)],[None,Integer(8)]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\\ &\lr{8}\\ &\lr{5}&\lr{6}&\lr{7}\\ &&\lr{3}\\ \end{array}$} } >>> Tableaux.options.convention="russian" >>> print(tex_from_array([[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5)]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\cline{1-2} \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}\\\cline{1-3} \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\\cline{1-3} \end{array}$}} } >>> print(tex_from_array([[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5)]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\\ \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}\\ \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\ \end{array}$}} } >>> print(tex_from_array([[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5),Integer(6),Integer(7)],[Integer(8)]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\cline{1-1} \lr{\rotatebox{-45}{8}}\\\cline{1-4} \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\\cline{1-4} \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\\cline{1-3} \end{array}$}} } >>> print(tex_from_array([[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5),Integer(6),Integer(7)],[Integer(8)]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\\ \lr{\rotatebox{-45}{8}}\\ \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\ \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\ \end{array}$}} } >>> print(tex_from_array([[None,None,Integer(3)],[None,Integer(5),Integer(6),Integer(7)],[Integer(8)]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\cline{1-1} \lr{\rotatebox{-45}{8}}\\\cline{1-4} &\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\\cline{2-4} &&\lr{\rotatebox{-45}{3}}\\\cline{3-3} \end{array}$}} } >>> print(tex_from_array([[None,None,Integer(3)],[None,Integer(5),Integer(6),Integer(7)],[None,Integer(8)]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\cline{2-2} &\lr{\rotatebox{-45}{8}}\\\cline{2-4} &\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\\cline{2-4} &&\lr{\rotatebox{-45}{3}}\\\cline{3-3} \end{array}$}} } >>> print(tex_from_array([[None,None,Integer(3)],[None,Integer(5),Integer(6),Integer(7)],[Integer(8)]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\\ \lr{\rotatebox{-45}{8}}\\ &\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\ &&\lr{\rotatebox{-45}{3}}\\ \end{array}$}} } >>> print(tex_from_array([[None,None,Integer(3)],[None,Integer(5),Integer(6),Integer(7)],[None,Integer(8)]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\\ &\lr{\rotatebox{-45}{8}}\\ &\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\ &&\lr{\rotatebox{-45}{3}}\\ \end{array}$}} } >>> Tableaux.options._reset()
- sage.combinat.output.tex_from_array_tuple(a_tuple, with_lines=True)[source]¶
Return a latex string for a tuple of two dimensional array of partition, composition or skew composition shape.
INPUT:
a_tuple
– tuple of lists of listswith_lines
– boolean (default:True
); whether to draw lines to separate the entries in the components ofa_tuple
See also
tex_from_array()
for the description of each arrayEXAMPLES:
sage: from sage.combinat.output import tex_from_array_tuple sage: print(tex_from_array_tuple([[[1,2,3],[4,5]],[],[[None,6,7],[None,8],[9]]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{1-3} \lr{1}&\lr{2}&\lr{3}\\\cline{1-3} \lr{4}&\lr{5}\\\cline{1-2} \end{array}$},\emptyset,\raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{2-3} &\lr{6}&\lr{7}\\\cline{2-3} &\lr{8}\\\cline{1-2} \lr{9}\\\cline{1-1} \end{array}$} } sage: print(tex_from_array_tuple([[[1,2,3],[4,5]],[],[[None,6,7],[None,8],[9]]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\\ \lr{1}&\lr{2}&\lr{3}\\ \lr{4}&\lr{5}\\ \end{array}$},\emptyset,\raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\\ &\lr{6}&\lr{7}\\ &\lr{8}\\ \lr{9}\\ \end{array}$} } sage: Tableaux.options.convention="french" sage: print(tex_from_array_tuple([[[1,2,3],[4,5]],[],[[None,6,7],[None,8],[9]]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\cline{1-2} \lr{4}&\lr{5}\\\cline{1-3} \lr{1}&\lr{2}&\lr{3}\\\cline{1-3} \end{array}$},\emptyset,\raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\cline{1-1} \lr{9}\\\cline{1-2} &\lr{8}\\\cline{2-3} &\lr{6}&\lr{7}\\\cline{2-3} \end{array}$} } sage: print(tex_from_array_tuple([[[1,2,3],[4,5]],[],[[None,6,7],[None,8],[9]]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\\ \lr{4}&\lr{5}\\ \lr{1}&\lr{2}&\lr{3}\\ \end{array}$},\emptyset,\raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\\ \lr{9}\\ &\lr{8}\\ &\lr{6}&\lr{7}\\ \end{array}$} } sage: Tableaux.options.convention="russian" sage: print(tex_from_array_tuple([[[1,2,3],[4,5]],[],[[None,6,7],[None,8],[9]]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\cline{1-2} \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}\\\cline{1-3} \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\\cline{1-3} \end{array}$}},\emptyset,\raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\cline{1-1} \lr{\rotatebox{-45}{9}}\\\cline{1-2} &\lr{\rotatebox{-45}{8}}\\\cline{2-3} &\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\\cline{2-3} \end{array}$}} } sage: print(tex_from_array_tuple([[[1,2,3],[4,5]],[],[[None,6,7],[None,8],[9]]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\\ \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}\\ \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\ \end{array}$}},\emptyset,\raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\\ \lr{\rotatebox{-45}{9}}\\ &\lr{\rotatebox{-45}{8}}\\ &\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\ \end{array}$}} } sage: Tableaux.options._reset()
>>> from sage.all import * >>> from sage.combinat.output import tex_from_array_tuple >>> print(tex_from_array_tuple([[[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5)]],[],[[None,Integer(6),Integer(7)],[None,Integer(8)],[Integer(9)]]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{1-3} \lr{1}&\lr{2}&\lr{3}\\\cline{1-3} \lr{4}&\lr{5}\\\cline{1-2} \end{array}$},\emptyset,\raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{2-3} &\lr{6}&\lr{7}\\\cline{2-3} &\lr{8}\\\cline{1-2} \lr{9}\\\cline{1-1} \end{array}$} } >>> print(tex_from_array_tuple([[[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5)]],[],[[None,Integer(6),Integer(7)],[None,Integer(8)],[Integer(9)]]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\\ \lr{1}&\lr{2}&\lr{3}\\ \lr{4}&\lr{5}\\ \end{array}$},\emptyset,\raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\\ &\lr{6}&\lr{7}\\ &\lr{8}\\ \lr{9}\\ \end{array}$} } >>> Tableaux.options.convention="french" >>> print(tex_from_array_tuple([[[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5)]],[],[[None,Integer(6),Integer(7)],[None,Integer(8)],[Integer(9)]]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\cline{1-2} \lr{4}&\lr{5}\\\cline{1-3} \lr{1}&\lr{2}&\lr{3}\\\cline{1-3} \end{array}$},\emptyset,\raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\cline{1-1} \lr{9}\\\cline{1-2} &\lr{8}\\\cline{2-3} &\lr{6}&\lr{7}\\\cline{2-3} \end{array}$} } >>> print(tex_from_array_tuple([[[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5)]],[],[[None,Integer(6),Integer(7)],[None,Integer(8)],[Integer(9)]]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\\ \lr{4}&\lr{5}\\ \lr{1}&\lr{2}&\lr{3}\\ \end{array}$},\emptyset,\raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\\ \lr{9}\\ &\lr{8}\\ &\lr{6}&\lr{7}\\ \end{array}$} } >>> Tableaux.options.convention="russian" >>> print(tex_from_array_tuple([[[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5)]],[],[[None,Integer(6),Integer(7)],[None,Integer(8)],[Integer(9)]]])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\cline{1-2} \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}\\\cline{1-3} \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\\cline{1-3} \end{array}$}},\emptyset,\raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\cline{1-1} \lr{\rotatebox{-45}{9}}\\\cline{1-2} &\lr{\rotatebox{-45}{8}}\\\cline{2-3} &\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\\cline{2-3} \end{array}$}} } >>> print(tex_from_array_tuple([[[Integer(1),Integer(2),Integer(3)],[Integer(4),Integer(5)]],[],[[None,Integer(6),Integer(7)],[None,Integer(8)],[Integer(9)]]], with_lines=False)) {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\\ \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}\\ \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\ \end{array}$}},\emptyset,\raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\\ \lr{\rotatebox{-45}{9}}\\ &\lr{\rotatebox{-45}{8}}\\ &\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\ \end{array}$}} } >>> Tableaux.options._reset()
- sage.combinat.output.tex_from_skew_array(array, with_lines=False, align='b')[source]¶
This function creates latex code for a “skew composition”
array
. That is, for a two dimensional array in which each row can begin with an arbitrary numberNone
’s and the remaining entries could, in principle, be anything but probably should be strings or integers of similar width. A row consisting completely ofNone
’s is allowed.INPUT:
array
– the arraywith_lines
– (default:False
) ifTrue
lines are drawn, ifFalse
they are notalign
– (default:'b'
) determine the alignment on the latex array environments
EXAMPLES:
sage: array=[[None, 2,3,4],[None,None],[5,6,7,8]] sage: print(sage.combinat.output.tex_from_skew_array(array)) \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\\ &\lr{2}&\lr{3}&\lr{4}\\ &\\ \lr{5}&\lr{6}&\lr{7}&\lr{8}\\ \end{array}$}
>>> from sage.all import * >>> array=[[None, Integer(2),Integer(3),Integer(4)],[None,None],[Integer(5),Integer(6),Integer(7),Integer(8)]] >>> print(sage.combinat.output.tex_from_skew_array(array)) \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\\ &\lr{2}&\lr{3}&\lr{4}\\ &\\ \lr{5}&\lr{6}&\lr{7}&\lr{8}\\ \end{array}$}