Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Having trouble latex the crystal graph using sage, KeyError: 'node_1'?

K = crystals.KirillovReshetikhin(['A',3,1], 1,1) view(K)

the outputs:

KeyError Traceback (most recent call last) Cell In[463], line 1 ----> 1 latex(C)

File /private/var/tmp/sage-10.5-current/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/sage/misc/latex.py:871, in LatexCall.__call__(self, x, combine_all) 842 r""" 843 Return a :class:LatexExpr built out of the argument x. 844 (...) 868 x 2 869 """ 870 if has_latex_attr(x): --> 871 return LatexExpr(x._latex_()) 872 try: 873 f = latex_table[type(x)]

File /private/var/tmp/sage-10.5-current/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/sage/categories/crystals.py:975, in Crystals.ParentMethods._latex_(self, options) 973 G = self.digraph() 974 G.set_latex_options(options) --> 975 return G._latex_()

File /private/var/tmp/sage-10.5-current/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/sage/graphs/generic_graph.py:940, in GenericGraph._latex_(self) 937 from sage.graphs.graph_latex import setup_latex_preamble 938 setup_latex_preamble() --> 940 return self.latex_options().latex()

File /private/var/tmp/sage-10.5-current/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/sage/graphs/graph_latex.py:1356, in GraphLatex.latex(self) 1354 return self.tkz_picture() 1355 elif format == "dot2tex": -> 1356 return self.dot2tex_picture()

File /private/var/tmp/sage-10.5-current/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/sage/graphs/graph_latex.py:1436, in GraphLatex.dot2tex_picture(self) 1434 dotdata = self._graph.graphviz_string(labels='latex', **options) 1435 import dot2tex -> 1436 return dot2tex.dot2tex(dotdata, 1437 format='tikz', 1438 autosize=True, 1439 crop=True, 1440 figonly='True', 1441 prog=self.get_option('prog')).strip()

File ~/Library/SageMath-10-5/lib/python3.12/site-packages/dot2tex/__init__.py:62, in dot2tex(dotsource, *kwargs) 55 def dot2tex(dotsource, *kwargs): 56 """Process dotsource and return LaTeX code 57 58 Conversion options can be specified as keyword options. Example: 59 dot2tex(data,format='tikz',crop=True) 60 61 """ ---> 62 return d2t.convert_graph(dotsource, **kwargs)

File ~/Library/SageMath-10-5/lib/python3.12/site-packages/dot2tex/dot2tex.py:500, in convert_graph(dotsource, **kwargs) 497 del kwargs['preproc'] 499 options.__dict__.update(kwargs) --> 500 tex = main(True, dotsource, options) 501 return tex

File ~/Library/SageMath-10-5/lib/python3.12/site-packages/dot2tex/dot2tex.py:450, in main(run_as_module, dotdata, options) 448 sys.exit(1) 449 try: --> 450 s = conv.convert(dotdata) 451 log.debug('Output:\n%s', s) 452 if options.autosize:

File ~/Library/SageMath-10-5/lib/python3.12/site-packages/dot2tex/base.py:624, in DotConvBase.convert(self, dotdata) 621 self.directedgraph = main_graph.directed 623 if self.dopreproc: --> 624 return self.do_preview_preproc() 626 # Remove annoying square 627 # Todo: Remove squares from subgraphs. See pgram.dot 628 dstring = self.main_graph.attr.get('_draw_', "")

File ~/Library/SageMath-10-5/lib/python3.12/site-packages/dot2tex/base.py:892, in DotConvBase.do_preview_preproc(self) 890 continue 891 node = item --> 892 hp, dp, wt = pp.texdims[name] 893 if self.options.get('rawdim'): 894 # use dimensions from preview.sty directly 895 node.attr['width'] = wt

KeyError: 'node_1'

Having trouble latex the crystal graph using sage, KeyError: 'node_1'?

The inputs:

K = crystals.KirillovReshetikhin(['A',3,1], 1,1)
view(K) 

view(K)

the outputs:

KeyError                                  Traceback (most recent call last)
Cell In[463], line 1
----> 1 latex(C)

latex(C) File /private/var/tmp/sage-10.5-current/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/sage/misc/latex.py:871, in LatexCall.__call__(self, x, combine_all) 842 r""" 843 Return a :class:LatexExpr :class:`LatexExpr` built out of the argument x. ``x``. 844 (...) 868 x 2 869 """ 870 if has_latex_attr(x): --> 871 return LatexExpr(x._latex_()) 872 try: 873 f = latex_table[type(x)]

latex_table[type(x)] File /private/var/tmp/sage-10.5-current/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/sage/categories/crystals.py:975, in Crystals.ParentMethods._latex_(self, options) **options) 973 G = self.digraph() 974 G.set_latex_options(options) G.set_latex_options(**options) --> 975 return G._latex_()

G._latex_() File /private/var/tmp/sage-10.5-current/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/sage/graphs/generic_graph.py:940, in GenericGraph._latex_(self) 937 from sage.graphs.graph_latex import setup_latex_preamble 938 setup_latex_preamble() --> 940 return self.latex_options().latex()

self.latex_options().latex() File /private/var/tmp/sage-10.5-current/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/sage/graphs/graph_latex.py:1356, in GraphLatex.latex(self) 1354 return self.tkz_picture() 1355 elif format == "dot2tex": -> 1356 return self.dot2tex_picture()

self.dot2tex_picture() File /private/var/tmp/sage-10.5-current/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/sage/graphs/graph_latex.py:1436, in GraphLatex.dot2tex_picture(self) 1434 dotdata = self._graph.graphviz_string(labels='latex', **options) 1435 import dot2tex -> 1436 return dot2tex.dot2tex(dotdata, 1437 format='tikz', 1438 autosize=True, 1439 crop=True, 1440 figonly='True', 1441 prog=self.get_option('prog')).strip()

prog=self.get_option('prog')).strip() File ~/Library/SageMath-10-5/lib/python3.12/site-packages/dot2tex/__init__.py:62, in dot2tex(dotsource, *kwargs) **kwargs) 55 def dot2tex(dotsource, *kwargs): **kwargs): 56 """Process dotsource and return LaTeX code 57 58 Conversion options can be specified as keyword options. Example: 59 dot2tex(data,format='tikz',crop=True) 60 61 """ ---> 62 return d2t.convert_graph(dotsource, **kwargs)

**kwargs) File ~/Library/SageMath-10-5/lib/python3.12/site-packages/dot2tex/dot2tex.py:500, in convert_graph(dotsource, **kwargs) 497 del kwargs['preproc'] 499 options.__dict__.update(kwargs) --> 500 tex = main(True, dotsource, options) 501 return tex

tex File ~/Library/SageMath-10-5/lib/python3.12/site-packages/dot2tex/dot2tex.py:450, in main(run_as_module, dotdata, options) 448 sys.exit(1) 449 try: --> 450 s = conv.convert(dotdata) 451 log.debug('Output:\n%s', s) 452 if options.autosize:

options.autosize: File ~/Library/SageMath-10-5/lib/python3.12/site-packages/dot2tex/base.py:624, in DotConvBase.convert(self, dotdata) 621 self.directedgraph = main_graph.directed 623 if self.dopreproc: --> 624 return self.do_preview_preproc() 626 # Remove annoying square 627 # Todo: Remove squares from subgraphs. See pgram.dot 628 dstring = self.main_graph.attr.get('_draw_', "")

"") File ~/Library/SageMath-10-5/lib/python3.12/site-packages/dot2tex/base.py:892, in DotConvBase.do_preview_preproc(self) 890 continue 891 node = item --> 892 hp, dp, wt = pp.texdims[name] 893 if self.options.get('rawdim'): 894 # use dimensions from preview.sty directly 895 node.attr['width'] = wt

wt KeyError: 'node_1'

'node_1'