ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 11 Dec 2016 14:15:48 -0600Display the Young lattice using Sage and Latexhttps://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/Hi everyone,
I'm trying to follow
http://doc.sagemath.org/html/en/thematic_tutorials/algebraic_combinatorics/rsk.html
to generate pictures of Young's lattice. Unfortunately I seem to be getting LaTeX code which won't compile.
I'm using Sage 7.4 (run locally not on the cloud), pdfTeX, Version 3.1415926-2.5-1.40.14 and I have the TKZ packages installed. Running sage locally or on the cloud seems to generate the same LaTeX output. I get the same errors on 2 different computers, both running OpenSUSE 42.1. I've tried generating the LaTeX code using the sagecloud, but as far as I can tell it generates the same source code and I can't compile it.
The code I input is:
level = 6
elements = [b for n in range(level) for b in Partitions(n)]
ord = lambda x,y: y.contains(x)
Y = Poset((elements,ord), facade=True)
H = Y.hasse_diagram()
view(H) # optional - dot2tex graphviz
I'd like to attach error logs and the latex source code generated by "latex(H)", but apparently I do not have enough karma to do so. The error messages are basically many repetitions of the following snippet.
! Illegal parameter number in definition of \cmdGR@vertex@L.
<to be read again>
1
l.136 }$},x=1.0389cm,y=1.8082cm]{v1}
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
**Edit:** fidbc had the excellent idea of uploading my error log and latex source to pastebin, so here they are.
- Error log: http://pastebin.com/9CC2LvPr
- LaTeX code generated by sage: http://pastebin.com/Wpj7BDiq
- LaTeX code with preamble: http://pastebin.com/M1mxavNv
I am trying to compile the LaTeX code with the following packages: "tikz", "tkz-graph", "tkz-berge", "tkz-arith" and for tikz I am also loading the "arrows" and "shapes" libraries. Am I missing any necessary libraries?Wed, 07 Dec 2016 12:13:58 -0600https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/Comment by Gonneman for <p>Hi everyone,</p>
<p>I'm trying to follow
<a href="http://doc.sagemath.org/html/en/thematic_tutorials/algebraic_combinatorics/rsk.html">http://doc.sagemath.org/html/en/thema...</a>
to generate pictures of Young's lattice. Unfortunately I seem to be getting LaTeX code which won't compile.</p>
<p>I'm using Sage 7.4 (run locally not on the cloud), pdfTeX, Version 3.1415926-2.5-1.40.14 and I have the TKZ packages installed. Running sage locally or on the cloud seems to generate the same LaTeX output. I get the same errors on 2 different computers, both running OpenSUSE 42.1. I've tried generating the LaTeX code using the sagecloud, but as far as I can tell it generates the same source code and I can't compile it.</p>
<p>The code I input is:</p>
<pre><code>level = 6
elements = [b for n in range(level) for b in Partitions(n)]
ord = lambda x,y: y.contains(x)
Y = Poset((elements,ord), facade=True)
H = Y.hasse_diagram()
view(H) # optional - dot2tex graphviz
</code></pre>
<p>I'd like to attach error logs and the latex source code generated by "latex(H)", but apparently I do not have enough karma to do so. The error messages are basically many repetitions of the following snippet.</p>
<pre><code>! Illegal parameter number in definition of \cmdGR@vertex@L.
<to be read again>
1
l.136 }$},x=1.0389cm,y=1.8082cm]{v1}
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
</code></pre>
<p><strong>Edit:</strong> fidbc had the excellent idea of uploading my error log and latex source to pastebin, so here they are.</p>
<ul>
<li>Error log: <a href="http://pastebin.com/9CC2LvPr">http://pastebin.com/9CC2LvPr</a></li>
<li>LaTeX code generated by sage: <a href="http://pastebin.com/Wpj7BDiq">http://pastebin.com/Wpj7BDiq</a></li>
<li>LaTeX code with preamble: <a href="http://pastebin.com/M1mxavNv">http://pastebin.com/M1mxavNv</a></li>
</ul>
<p>I am trying to compile the LaTeX code with the following packages: "tikz", "tkz-graph", "tkz-berge", "tkz-arith" and for tikz I am also loading the "arrows" and "shapes" libraries. Am I missing any necessary libraries?</p>
https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35960#post-id-35960The latex code you linked to compiles for me too. How odd, I was certain cloud.sagemath did not produce code that worked for me, yet now it does (both your code and what cloud.sagemath produce for me, work).
I wonder why my local installation of sage produces different LaTeX code.Thu, 08 Dec 2016 14:29:29 -0600https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35960#post-id-35960Comment by fidbc for <p>Hi everyone,</p>
<p>I'm trying to follow
<a href="http://doc.sagemath.org/html/en/thematic_tutorials/algebraic_combinatorics/rsk.html">http://doc.sagemath.org/html/en/thema...</a>
to generate pictures of Young's lattice. Unfortunately I seem to be getting LaTeX code which won't compile.</p>
<p>I'm using Sage 7.4 (run locally not on the cloud), pdfTeX, Version 3.1415926-2.5-1.40.14 and I have the TKZ packages installed. Running sage locally or on the cloud seems to generate the same LaTeX output. I get the same errors on 2 different computers, both running OpenSUSE 42.1. I've tried generating the LaTeX code using the sagecloud, but as far as I can tell it generates the same source code and I can't compile it.</p>
<p>The code I input is:</p>
<pre><code>level = 6
elements = [b for n in range(level) for b in Partitions(n)]
ord = lambda x,y: y.contains(x)
Y = Poset((elements,ord), facade=True)
H = Y.hasse_diagram()
view(H) # optional - dot2tex graphviz
</code></pre>
<p>I'd like to attach error logs and the latex source code generated by "latex(H)", but apparently I do not have enough karma to do so. The error messages are basically many repetitions of the following snippet.</p>
<pre><code>! Illegal parameter number in definition of \cmdGR@vertex@L.
<to be read again>
1
l.136 }$},x=1.0389cm,y=1.8082cm]{v1}
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
</code></pre>
<p><strong>Edit:</strong> fidbc had the excellent idea of uploading my error log and latex source to pastebin, so here they are.</p>
<ul>
<li>Error log: <a href="http://pastebin.com/9CC2LvPr">http://pastebin.com/9CC2LvPr</a></li>
<li>LaTeX code generated by sage: <a href="http://pastebin.com/Wpj7BDiq">http://pastebin.com/Wpj7BDiq</a></li>
<li>LaTeX code with preamble: <a href="http://pastebin.com/M1mxavNv">http://pastebin.com/M1mxavNv</a></li>
</ul>
<p>I am trying to compile the LaTeX code with the following packages: "tikz", "tkz-graph", "tkz-berge", "tkz-arith" and for tikz I am also loading the "arrows" and "shapes" libraries. Am I missing any necessary libraries?</p>
https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35959#post-id-35959It seems like the error arises from the labels of the nodes in the diagram, not entirely sure what is going on. Also, it should be noted that the LaTeX string returned by `latex(H)` when executed in cloud.sagemath is different, please see [here](http://pastebin.com/qSCf5JAu). That output seems to compile without issues.Thu, 08 Dec 2016 12:13:33 -0600https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35959#post-id-35959Comment by Gonneman for <p>Hi everyone,</p>
<p>I'm trying to follow
<a href="http://doc.sagemath.org/html/en/thematic_tutorials/algebraic_combinatorics/rsk.html">http://doc.sagemath.org/html/en/thema...</a>
to generate pictures of Young's lattice. Unfortunately I seem to be getting LaTeX code which won't compile.</p>
<p>I'm using Sage 7.4 (run locally not on the cloud), pdfTeX, Version 3.1415926-2.5-1.40.14 and I have the TKZ packages installed. Running sage locally or on the cloud seems to generate the same LaTeX output. I get the same errors on 2 different computers, both running OpenSUSE 42.1. I've tried generating the LaTeX code using the sagecloud, but as far as I can tell it generates the same source code and I can't compile it.</p>
<p>The code I input is:</p>
<pre><code>level = 6
elements = [b for n in range(level) for b in Partitions(n)]
ord = lambda x,y: y.contains(x)
Y = Poset((elements,ord), facade=True)
H = Y.hasse_diagram()
view(H) # optional - dot2tex graphviz
</code></pre>
<p>I'd like to attach error logs and the latex source code generated by "latex(H)", but apparently I do not have enough karma to do so. The error messages are basically many repetitions of the following snippet.</p>
<pre><code>! Illegal parameter number in definition of \cmdGR@vertex@L.
<to be read again>
1
l.136 }$},x=1.0389cm,y=1.8082cm]{v1}
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
</code></pre>
<p><strong>Edit:</strong> fidbc had the excellent idea of uploading my error log and latex source to pastebin, so here they are.</p>
<ul>
<li>Error log: <a href="http://pastebin.com/9CC2LvPr">http://pastebin.com/9CC2LvPr</a></li>
<li>LaTeX code generated by sage: <a href="http://pastebin.com/Wpj7BDiq">http://pastebin.com/Wpj7BDiq</a></li>
<li>LaTeX code with preamble: <a href="http://pastebin.com/M1mxavNv">http://pastebin.com/M1mxavNv</a></li>
</ul>
<p>I am trying to compile the LaTeX code with the following packages: "tikz", "tkz-graph", "tkz-berge", "tkz-arith" and for tikz I am also loading the "arrows" and "shapes" libraries. Am I missing any necessary libraries?</p>
https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35954#post-id-35954Excellent advice regarding pastebin! I've edited the question accordingly.Thu, 08 Dec 2016 05:14:12 -0600https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35954#post-id-35954Comment by fidbc for <p>Hi everyone,</p>
<p>I'm trying to follow
<a href="http://doc.sagemath.org/html/en/thematic_tutorials/algebraic_combinatorics/rsk.html">http://doc.sagemath.org/html/en/thema...</a>
to generate pictures of Young's lattice. Unfortunately I seem to be getting LaTeX code which won't compile.</p>
<p>I'm using Sage 7.4 (run locally not on the cloud), pdfTeX, Version 3.1415926-2.5-1.40.14 and I have the TKZ packages installed. Running sage locally or on the cloud seems to generate the same LaTeX output. I get the same errors on 2 different computers, both running OpenSUSE 42.1. I've tried generating the LaTeX code using the sagecloud, but as far as I can tell it generates the same source code and I can't compile it.</p>
<p>The code I input is:</p>
<pre><code>level = 6
elements = [b for n in range(level) for b in Partitions(n)]
ord = lambda x,y: y.contains(x)
Y = Poset((elements,ord), facade=True)
H = Y.hasse_diagram()
view(H) # optional - dot2tex graphviz
</code></pre>
<p>I'd like to attach error logs and the latex source code generated by "latex(H)", but apparently I do not have enough karma to do so. The error messages are basically many repetitions of the following snippet.</p>
<pre><code>! Illegal parameter number in definition of \cmdGR@vertex@L.
<to be read again>
1
l.136 }$},x=1.0389cm,y=1.8082cm]{v1}
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
</code></pre>
<p><strong>Edit:</strong> fidbc had the excellent idea of uploading my error log and latex source to pastebin, so here they are.</p>
<ul>
<li>Error log: <a href="http://pastebin.com/9CC2LvPr">http://pastebin.com/9CC2LvPr</a></li>
<li>LaTeX code generated by sage: <a href="http://pastebin.com/Wpj7BDiq">http://pastebin.com/Wpj7BDiq</a></li>
<li>LaTeX code with preamble: <a href="http://pastebin.com/M1mxavNv">http://pastebin.com/M1mxavNv</a></li>
</ul>
<p>I am trying to compile the LaTeX code with the following packages: "tikz", "tkz-graph", "tkz-berge", "tkz-arith" and for tikz I am also loading the "arrows" and "shapes" libraries. Am I missing any necessary libraries?</p>
https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35945#post-id-35945Generated TikZ code works for me. Have you tried including the TikZ package in the LaTeX document preamble (`\usepackage{tikz}`)? Maybe posting a link to the code uploaded to some other site would be useful? Eg pastebin.Wed, 07 Dec 2016 22:16:34 -0600https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35945#post-id-35945Answer by Sébastien for <p>Hi everyone,</p>
<p>I'm trying to follow
<a href="http://doc.sagemath.org/html/en/thematic_tutorials/algebraic_combinatorics/rsk.html">http://doc.sagemath.org/html/en/thema...</a>
to generate pictures of Young's lattice. Unfortunately I seem to be getting LaTeX code which won't compile.</p>
<p>I'm using Sage 7.4 (run locally not on the cloud), pdfTeX, Version 3.1415926-2.5-1.40.14 and I have the TKZ packages installed. Running sage locally or on the cloud seems to generate the same LaTeX output. I get the same errors on 2 different computers, both running OpenSUSE 42.1. I've tried generating the LaTeX code using the sagecloud, but as far as I can tell it generates the same source code and I can't compile it.</p>
<p>The code I input is:</p>
<pre><code>level = 6
elements = [b for n in range(level) for b in Partitions(n)]
ord = lambda x,y: y.contains(x)
Y = Poset((elements,ord), facade=True)
H = Y.hasse_diagram()
view(H) # optional - dot2tex graphviz
</code></pre>
<p>I'd like to attach error logs and the latex source code generated by "latex(H)", but apparently I do not have enough karma to do so. The error messages are basically many repetitions of the following snippet.</p>
<pre><code>! Illegal parameter number in definition of \cmdGR@vertex@L.
<to be read again>
1
l.136 }$},x=1.0389cm,y=1.8082cm]{v1}
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
</code></pre>
<p><strong>Edit:</strong> fidbc had the excellent idea of uploading my error log and latex source to pastebin, so here they are.</p>
<ul>
<li>Error log: <a href="http://pastebin.com/9CC2LvPr">http://pastebin.com/9CC2LvPr</a></li>
<li>LaTeX code generated by sage: <a href="http://pastebin.com/Wpj7BDiq">http://pastebin.com/Wpj7BDiq</a></li>
<li>LaTeX code with preamble: <a href="http://pastebin.com/M1mxavNv">http://pastebin.com/M1mxavNv</a></li>
</ul>
<p>I am trying to compile the LaTeX code with the following packages: "tikz", "tkz-graph", "tkz-berge", "tkz-arith" and for tikz I am also loading the "arrows" and "shapes" libraries. Am I missing any necessary libraries?</p>
https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?answer=35962#post-id-35962In my [optional package](https://pypi.python.org/pypi/slabbe/0.3b0) see also [#20343](https://trac.sagemath.org/ticket/20343), I wrote a module to deal with tikzpictures:
sage: from slabbe import TikzPicture
sage: path_to_file = TikzPicture.from_poset(Y).pdf() # requires dot2tex + graphviz
sage: path_to_file = TikzPicture.from_graph(H).pdf() # requires dot2tex + graphviz
which open automatically the pdf in a viewer like view does. You may also create a TikzPicture object from any tikzpicture string without using dot2tex. For example:
sage: g = graphs.PetersenGraph()
sage: s = latex(g)
sage: t = TikzPicture(s, usepackage=['tkz-graph'])
sage: t.pdf()
I intend to polish it a little bit more during the next year, maybe make it more general, before proposing its inclusion into Sage.Fri, 09 Dec 2016 03:20:01 -0600https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?answer=35962#post-id-35962Comment by Gonneman for <p>In my <a href="https://pypi.python.org/pypi/slabbe/0.3b0">optional package</a> see also <a href="https://trac.sagemath.org/ticket/20343">#20343</a>, I wrote a module to deal with tikzpictures:</p>
<pre><code>sage: from slabbe import TikzPicture
sage: path_to_file = TikzPicture.from_poset(Y).pdf() # requires dot2tex + graphviz
sage: path_to_file = TikzPicture.from_graph(H).pdf() # requires dot2tex + graphviz
</code></pre>
<p>which open automatically the pdf in a viewer like view does. You may also create a TikzPicture object from any tikzpicture string without using dot2tex. For example:</p>
<pre><code>sage: g = graphs.PetersenGraph()
sage: s = latex(g)
sage: t = TikzPicture(s, usepackage=['tkz-graph'])
sage: t.pdf()
</code></pre>
<p>I intend to polish it a little bit more during the next year, maybe make it more general, before proposing its inclusion into Sage.</p>
https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35982#post-id-35982Hi Sébastien. Thank you for the suggestion and sorry for my long silence. I'm currently travelling. I'll try out your suggestion once I'm back later this week!Sun, 11 Dec 2016 14:15:48 -0600https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35982#post-id-35982Comment by Sébastien for <p>In my <a href="https://pypi.python.org/pypi/slabbe/0.3b0">optional package</a> see also <a href="https://trac.sagemath.org/ticket/20343">#20343</a>, I wrote a module to deal with tikzpictures:</p>
<pre><code>sage: from slabbe import TikzPicture
sage: path_to_file = TikzPicture.from_poset(Y).pdf() # requires dot2tex + graphviz
sage: path_to_file = TikzPicture.from_graph(H).pdf() # requires dot2tex + graphviz
</code></pre>
<p>which open automatically the pdf in a viewer like view does. You may also create a TikzPicture object from any tikzpicture string without using dot2tex. For example:</p>
<pre><code>sage: g = graphs.PetersenGraph()
sage: s = latex(g)
sage: t = TikzPicture(s, usepackage=['tkz-graph'])
sage: t.pdf()
</code></pre>
<p>I intend to polish it a little bit more during the next year, maybe make it more general, before proposing its inclusion into Sage.</p>
https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35973#post-id-35973You are right, `from_poset` and `from_graph` both require dot2tex and graphviz installed. I edited my answer accordingly.Fri, 09 Dec 2016 14:48:56 -0600https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35973#post-id-35973Comment by fidbc for <p>In my <a href="https://pypi.python.org/pypi/slabbe/0.3b0">optional package</a> see also <a href="https://trac.sagemath.org/ticket/20343">#20343</a>, I wrote a module to deal with tikzpictures:</p>
<pre><code>sage: from slabbe import TikzPicture
sage: path_to_file = TikzPicture.from_poset(Y).pdf() # requires dot2tex + graphviz
sage: path_to_file = TikzPicture.from_graph(H).pdf() # requires dot2tex + graphviz
</code></pre>
<p>which open automatically the pdf in a viewer like view does. You may also create a TikzPicture object from any tikzpicture string without using dot2tex. For example:</p>
<pre><code>sage: g = graphs.PetersenGraph()
sage: s = latex(g)
sage: t = TikzPicture(s, usepackage=['tkz-graph'])
sage: t.pdf()
</code></pre>
<p>I intend to polish it a little bit more during the next year, maybe make it more general, before proposing its inclusion into Sage.</p>
https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35972#post-id-35972Looks like this is the package that generates the TikZ code at cloud.sagemath, nice! Just as a side comment, this seems to require the dot2tex package installed. The command `sage -pip slabbe` did not work for me to install the package. To install:
sage -sh
pip install dot2tex slabbe
Then the code above works.Fri, 09 Dec 2016 11:17:48 -0600https://ask.sagemath.org/question/35943/display-the-young-lattice-using-sage-and-latex/?comment=35972#post-id-35972