Skip to content

Commit a510047

Browse files
author
Release Manager
committed
Trac #34760: latex of empty SkewPartition is broken
{{{ sage: p = SkewPartition([[],[]]) sage: latex(p) ------------------------------------------------------------------------ --- ValueError Traceback (most recent call last) Input In [9], in <cell line: 1>() ----> 1 latex(p) File ~/sage-develop/src/sage/misc/latex.py:929, in LatexCall.__call__(self, x, combine_all) 898 r""" 899 Return a :class:`LatexExpr` built out of the argument ``x``. 900 (...) 926 x 2 927 """ 928 if has_latex_attr(x): --> 929 return LatexExpr(x._latex_()) 930 try: 931 f = latex_table[type(x)] File ~/sage-develop/src/sage/combinat/skew_partition.py:254, in SkewPartition._latex_(self) 235 def _latex_(self): 236 r""" 237 Return a `\LaTeX` representation of ``self``. 238 (...) 252 } 253 """ --> 254 return self.parent().options._dispatch(self, '_latex_', 'latex') File ~/sage-develop/src/sage/structure/global_options.py:1690, in GlobalOptions._dispatch(self, obj, dispatch_to, option, *args, **kargs) 1688 dispatch_to = dispatch_to[:-1] 1689 dispatch = getattr(obj, dispatch_to + '_' + self._value[option]) -> 1690 return dispatch(*args, **kargs) 1692 raise ValueError('%s is not a dispatchable option!' % option) File ~/sage-develop/src/sage/combinat/skew_partition.py:306, in SkewPartition._latex_young_diagram(self) 304 for j in range(skew_size): 305 arr[i][j] = None --> 306 return tex_from_array(arr) File ~/sage-develop/src/sage/combinat/output.py:175, in tex_from_array(array, with_lines) 173 lr=lr_macro.substitute(bar='|' if with_lines else '') 174 if Tableaux.options.convention == "English": --> 175 return '{%s\n%s\n}' % (lr, tex_from_skew_array(array, with_lines)) 176 else: 177 return '{%s\n%s\n}' % (lr, tex_from_skew_array(array[::-1], with_lines, align='t')) File ~/sage-develop/src/sage/combinat/output.py:309, in tex_from_skew_array(array, with_lines, align) 306 end_line=lambda r: r'\\' 308 # now we draw the array --> 309 tex=r'\raisebox{-.6ex}{$\begin{array}[%s]{*{%s}c}'%(align,max(ma p(len,array))) 310 tex+=end_line(0)+'\n' 311 for r in range(len(array)): ValueError: max() arg is an empty sequence }}} URL: https://trac.sagemath.org/34760 Reported by: mantepse Ticket author(s): Martin Rubey Reviewer(s): Christian Stump
2 parents bcf41a0 + 249ce49 commit a510047

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

src/sage/combinat/skew_partition.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,16 @@ def _latex_diagram(self):
268268
&\lr{\ast}&\lr{\ast}\\\cline{2-3}
269269
\end{array}$}
270270
}
271+
272+
TESTS:
273+
274+
Check that :trac:`34760` is fixed::
275+
276+
sage: print(SkewPartition([[],[]])._latex_diagram())
277+
{\emptyset}
278+
271279
"""
272-
if len(self._list) == 0:
280+
if not any(self._list):
273281
return "{\\emptyset}"
274282

275283
char = self.parent().options.latex_diagram_str
@@ -295,8 +303,15 @@ def _latex_young_diagram(self):
295303
&\lr{\phantom{x}}&\lr{\phantom{x}}\\\cline{2-3}
296304
\end{array}$}
297305
}
306+
307+
TESTS:
308+
309+
Check that :trac:`34760` is fixed::
310+
311+
sage: print(SkewPartition([[],[]])._latex_young_diagram())
312+
{\emptyset}
298313
"""
299-
if len(self._list) == 0:
314+
if not any(self._list):
300315
return "{\\emptyset}"
301316

302317
from sage.combinat.output import tex_from_array
@@ -320,8 +335,15 @@ def _latex_marked(self):
320335
\lr{X}&\lr{\phantom{x}}&\lr{\phantom{x}}\\\cline{1-3}
321336
\end{array}$}
322337
}
338+
339+
TESTS:
340+
341+
Check that :trac:`34760` is fixed::
342+
343+
sage: print(SkewPartition([[],[]])._latex_marked())
344+
{\emptyset}
323345
"""
324-
if len(self._list) == 0:
346+
if not any(self._list):
325347
return "{\\emptyset}"
326348

327349
from sage.combinat.output import tex_from_array

0 commit comments

Comments
 (0)