ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 29 Nov 2019 15:49:36 +0100sagetex young_diagram sizehttps://ask.sagemath.org/question/48919/sagetex-young_diagram-size/Hello, I am printing a list of young diagramas in sagetex with something like
<code><pre>\sage{[p for p in Partitions(28) if p.is_symmetric()]}</code></pre>
How can I change the size of the cells so that they can actually fit in paper?Fri, 29 Nov 2019 14:27:30 +0100https://ask.sagemath.org/question/48919/sagetex-young_diagram-size/Answer by Emmanuel Charpentier for <p>Hello, I am printing a list of young diagramas in sagetex with something like
<code></code></p><pre><code>\sage{[p for p in Partitions(28) if p.is_symmetric()]}</code></pre>
How can I change the size of the cells so that they can actually fit in paper?<p></p>
https://ask.sagemath.org/question/48919/sagetex-young_diagram-size/?answer=48920#post-id-48920The graphical representation is intrinsically large.
Would you consider settling for a textual representation such as:
sage: [str(u) for u in [p for p in Partitions(28) if p.is_symmetric()]]
['[14, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]',
'[13, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]',
'[12, 4, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1]',
'[11, 5, 2, 2, 2, 1, 1, 1, 1, 1, 1]',
'[10, 6, 2, 2, 2, 2, 1, 1, 1, 1]',
'[10, 4, 4, 4, 1, 1, 1, 1, 1, 1]',
'[9, 7, 2, 2, 2, 2, 2, 1, 1]',
'[9, 5, 4, 4, 2, 1, 1, 1, 1]',
'[8, 8, 2, 2, 2, 2, 2, 2]',
'[8, 6, 4, 4, 2, 2, 1, 1]',
'[8, 5, 5, 4, 3, 1, 1, 1]',
'[7, 7, 4, 4, 2, 2, 2]',
'[7, 6, 5, 4, 3, 2, 1]',
'[7, 5, 5, 5, 4, 1, 1]',
'[6, 6, 6, 4, 3, 3]',
'[6, 6, 5, 5, 4, 2]']
**EDIT :** Since you insist on graphics, you may try to use Latex's `\scalebox`, but the resulting graph will be `sum([max(p) for p in Partitions(28) if p.is_symmetric()])`=145 cells wide (or `sum([len(p) for p in Partitions(28) if p.is_symmetric()])`=145 if Sage decides to put the column-wise). In either case, I doubt that the resut can be scaled on an A4 (or letter) paper sheet and remain legible...
The "obvious" solution of printing the the LaTeX representation of each partition separated by Latex's `\par` won't work either: the implementation of `\sagestr` needs a *single-paragraph* LaTeX string.
The only recourses are
- print your 16 partitions one by one by repeating `\sagestr` insertins in your LaTeX source (ugly); or
- computing a`tabular` environment` of suitable dimensions whose each element is a `minipage` environment containing the (possibly suitably scaled) LaTeX representation of one partition.
This is, for now, cowardly left to the reader "as an exercise"... Note that this is mostly an exercise in Latex programming.
One can note that `org-mode`, being less fussy than Sagetex aout what it accepts, will accept multi-paragraph LaTeX outputs from Sage. OTOH, it will be more fussy than Sagetex at labelling the thing... I have to check what Pythontex would accept...Fri, 29 Nov 2019 15:10:17 +0100https://ask.sagemath.org/question/48919/sagetex-young_diagram-size/?answer=48920#post-id-48920Comment by heluani for <p>The graphical representation is intrinsically large.</p>
<p>Would you consider settling for a textual representation such as:</p>
<pre><code>sage: [str(u) for u in [p for p in Partitions(28) if p.is_symmetric()]]
['[14, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]',
'[13, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]',
'[12, 4, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1]',
'[11, 5, 2, 2, 2, 1, 1, 1, 1, 1, 1]',
'[10, 6, 2, 2, 2, 2, 1, 1, 1, 1]',
'[10, 4, 4, 4, 1, 1, 1, 1, 1, 1]',
'[9, 7, 2, 2, 2, 2, 2, 1, 1]',
'[9, 5, 4, 4, 2, 1, 1, 1, 1]',
'[8, 8, 2, 2, 2, 2, 2, 2]',
'[8, 6, 4, 4, 2, 2, 1, 1]',
'[8, 5, 5, 4, 3, 1, 1, 1]',
'[7, 7, 4, 4, 2, 2, 2]',
'[7, 6, 5, 4, 3, 2, 1]',
'[7, 5, 5, 5, 4, 1, 1]',
'[6, 6, 6, 4, 3, 3]',
'[6, 6, 5, 5, 4, 2]']
</code></pre>
<p><strong>EDIT :</strong> Since you insist on graphics, you may try to use Latex's <code>\scalebox</code>, but the resulting graph will be <code>sum([max(p) for p in Partitions(28) if p.is_symmetric()])</code>=145 cells wide (or <code>sum([len(p) for p in Partitions(28) if p.is_symmetric()])</code>=145 if Sage decides to put the column-wise). In either case, I doubt that the resut can be scaled on an A4 (or letter) paper sheet and remain legible...</p>
<p>The "obvious" solution of printing the the LaTeX representation of each partition separated by Latex's <code>\par</code> won't work either: the implementation of <code>\sagestr</code> needs a <em>single-paragraph</em> LaTeX string.</p>
<p>The only recourses are</p>
<ul>
<li><p>print your 16 partitions one by one by repeating <code>\sagestr</code> insertins in your LaTeX source (ugly); or</p></li>
<li><p>computing a<code>tabular</code> environment<code>of suitable dimensions whose each element is a</code>minipage` environment containing the (possibly suitably scaled) LaTeX representation of one partition.</p></li>
</ul>
<p>This is, for now, cowardly left to the reader "as an exercise"... Note that this is mostly an exercise in Latex programming.</p>
<p>One can note that <code>org-mode</code>, being less fussy than Sagetex aout what it accepts, will accept multi-paragraph LaTeX outputs from Sage. OTOH, it will be more fussy than Sagetex at labelling the thing... I have to check what Pythontex would accept...</p>
https://ask.sagemath.org/question/48919/sagetex-young_diagram-size/?comment=48921#post-id-48921Thanks, but I need to paint in the young diagram. I can achieve what I want by getting firs the partitions from sage and sending them to something like {\tiny\yng(7,...)}Fri, 29 Nov 2019 15:49:36 +0100https://ask.sagemath.org/question/48919/sagetex-young_diagram-size/?comment=48921#post-id-48921