def _latex_(self): r""" EXAMPLES:: sage: T = CrystalOfTableaux(['A',3], shape = [4,2]) sage: t = T(rows=[[1,1,2,3],[2,3]]) sage: latex(t) # indirect doctest {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\cline{1-4} \lr{1}&\lr{1}&\lr{2}&\lr{3}\\\cline{1-4} \lr{2}&\lr{3}\\\cline{1-2} \end{array}$} } """ from sage.combinat.output import tex_from_array # Modified version of to_tableau() to have the entrys be letters # rather than their values if self._list == []: return "{\\emptyset}" tab = [[self[0]]] for i in range(1, len(self)): if self[i - 1] < self[i] or (self[i - 1].value != 0 and self[i - 1] == self[i]): tab.append([self[i]]) else: l = len(tab) - 1 tab[l].append(self[i]) for x in tab: x.reverse() T = Tableau(tab).conjugate() return tex_from_array([[letter._latex_() for letter in row] for row in T])
def _latex_(self): r""" EXAMPLES:: sage: T = CrystalOfTableaux(['A',3], shape = [4,2]) sage: t = T(rows=[[1,1,2,3],[2,3]]) sage: latex(t) # indirect doctest {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\cline{1-4} \lr{1}&\lr{1}&\lr{2}&\lr{3}\\\cline{1-4} \lr{2}&\lr{3}\\\cline{1-2} \end{array}$} } """ from sage.combinat.output import tex_from_array # Modified version of to_tableau() to have the entrys be letters # rather than their values if self._list == []: return "{\\emptyset}" tab = [ [self[0]] ] for i in range(1,len(self)): if self[i-1] < self[i] or (self[i-1].value != 0 and self[i-1] == self[i]): tab.append([self[i]]) else: l = len(tab)-1 tab[l].append(self[i]) for x in tab: x.reverse() T = Tableau(tab).conjugate() return tex_from_array([[letter._latex_() for letter in row] for row in T])
def _latex_(self): """ Return a latex representation of ``self``. EXAMPLES:: sage: KRT = KirillovReshetikhinTableaux(['A', 4, 1], 2, 3) sage: latex(KRT([3,2,4,2,4,3])) # indirect doctest {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{1-3} \lr{2}&\lr{2}&\lr{3}\\\cline{1-3} \lr{3}&\lr{4}&\lr{4}\\\cline{1-3} \end{array}$} } """ from sage.combinat.output import tex_from_array return tex_from_array(self.to_array())
def _latex_(self): r""" Return latex code for ``self``. EXAMPLES:: sage: B = crystals.Tableaux(['Q',3], shape=[3,2,1]) sage: t = B.an_element() sage: latex(t) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{1-3} \lr{3}&\lr{3}&\lr{3}\\\cline{1-3} &\lr{2}&\lr{2}\\\cline{2-3} &&\lr{1}\\\cline{3-3} \end{array}$} } """ from sage.combinat.output import tex_from_array return tex_from_array([[None] * i + list(reversed(row)) for i, row in enumerate(self.rows())])
def _latex_(self): """ LaTeX output as a young diagram. EXAMPLES:: sage: P = Partition([2, 1]) sage: print P._latex_young_diagram() {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{2}c}\cline{1-2} \lr{\phantom{x}}&\lr{\phantom{x}}\\\cline{1-2} \lr{\phantom{x}}\\\cline{1-1} \end{array}$} } """ if len(self._list) == 0: return "{\\emptyset}" from sage.combinat.output import tex_from_array return tex_from_array([ ["\\phantom{x}"]*row_size for row_size in self._list ])
def latex_dual(elt): r""" Return a latex representation of a type `A_n` crystal tableau ``elt`` expressed in terms of dual letters. The dual letter of `k` is expressed as `\overline{n+2-k}`. EXAMPLES:: sage: from sage.combinat.crystals.kac_modules import latex_dual sage: T = crystals.Tableaux(['A',2], shape=[2,1]) sage: print(latex_dual(T[0])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{2}c}\cline{1-2} \lr{\overline{3}}&\lr{\overline{3}}\\\cline{1-2} \lr{\overline{2}}\\\cline{1-1} \end{array}$} } """ M = elt.parent().cartan_type().rank() + 2 from sage.combinat.tableau import Tableau from sage.combinat.output import tex_from_array # Modified version of to_tableau() to have the entries be letters # rather than their values if not elt: return "{\\emptyset}" tab = [["\\overline{{{}}}".format(M - elt[0].value)]] for i in range(1, len(elt)): if elt[i - 1] < elt[i] or (elt[i - 1].value != 0 and elt[i - 1] == elt[i]): tab.append(["\\overline{{{}}}".format(M - elt[i].value)]) else: l = len(tab) - 1 tab[l].append("\\overline{{{}}}".format(M - elt[i].value)) for x in tab: x.reverse() T = Tableau(tab).conjugate() return tex_from_array([list(row) for row in T])
def latex_dual(elt): r""" Return a latex representation of a type `A_n` crystal tableau ``elt`` expressed in terms of dual letters. The dual letter of `k` is expressed as `\overline{n+2-k}`. EXAMPLES:: sage: from sage.combinat.crystals.kac_modules import latex_dual sage: T = crystals.Tableaux(['A',2], shape=[2,1]) sage: print(latex_dual(T[0])) {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} \raisebox{-.6ex}{$\begin{array}[b]{*{2}c}\cline{1-2} \lr{\overline{3}}&\lr{\overline{3}}\\\cline{1-2} \lr{\overline{2}}\\\cline{1-1} \end{array}$} } """ M = elt.parent().cartan_type().rank() + 2 from sage.combinat.output import tex_from_array # Modified version of to_tableau() to have the entries be letters # rather than their values if not elt: return "{\\emptyset}" tab = [ ["\\overline{{{}}}".format(M-elt[0].value)] ] for i in range(1, len(elt)): if elt[i-1] < elt[i] or (elt[i-1].value != 0 and elt[i-1] == elt[i]): tab.append(["\\overline{{{}}}".format(M-elt[i].value)]) else: l = len(tab)-1 tab[l].append("\\overline{{{}}}".format(M-elt[i].value)) for x in tab: x.reverse() from sage.combinat.tableau import Tableau T = Tableau(tab).conjugate() from sage.combinat.output import tex_from_array return tex_from_array([list(row) for row in T])