ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 01 Sep 2016 06:15:54 -0500Redirecting the output of show() to a file?http://ask.sagemath.org/question/34675/redirecting-the-output-of-show-to-a-file/Consider the tree
t = Permutation([1, 3, 2, 6, 8, 9, 5, 7, 4]).increasing_tree().as_ordered_tree()
show(t)
The output is a TeX-tikzpicture. I want to post-process this
picture at the TeX level (for a motivation see my last question).
To do so I have to manually copy and paste the output in some
editor. It would be much easier if I could redirect the output
into a text file and proceed from this file.
Is it possible to do so?Thu, 01 Sep 2016 03:47:53 -0500http://ask.sagemath.org/question/34675/redirecting-the-output-of-show-to-a-file/Answer by tmonteil for <p>Consider the tree</p>
<pre><code>t = Permutation([1, 3, 2, 6, 8, 9, 5, 7, 4]).increasing_tree().as_ordered_tree()
show(t)
</code></pre>
<p>The output is a TeX-tikzpicture. I want to post-process this
picture at the TeX level (for a motivation see my last question). </p>
<p>To do so I have to manually copy and paste the output in some
editor. It would be much easier if I could redirect the output
into a text file and proceed from this file.</p>
<p>Is it possible to do so?</p>
http://ask.sagemath.org/question/34675/redirecting-the-output-of-show-to-a-file/?answer=34676#post-id-34676You cann get the string of this LaTeX representation with `t.latex_()`, which you can save to a file as follows:
sage: with open('/path/to/file.txt', 'w') as f:
....: f.write(t._latex_())
Thu, 01 Sep 2016 03:58:20 -0500http://ask.sagemath.org/question/34675/redirecting-the-output-of-show-to-a-file/?answer=34676#post-id-34676Comment by tmonteil for <p>You cann get the string of this LaTeX representation with <code>t.latex_()</code>, which you can save to a file as follows:</p>
<pre><code>sage: with open('/path/to/file.txt', 'w') as f:
....: f.write(t._latex_())
</code></pre>
http://ask.sagemath.org/question/34675/redirecting-the-output-of-show-to-a-file/?comment=34678#post-id-34678^_^ .Thu, 01 Sep 2016 06:15:54 -0500http://ask.sagemath.org/question/34675/redirecting-the-output-of-show-to-a-file/?comment=34678#post-id-34678Comment by Peter Luschny for <p>You cann get the string of this LaTeX representation with <code>t.latex_()</code>, which you can save to a file as follows:</p>
<pre><code>sage: with open('/path/to/file.txt', 'w') as f:
....: f.write(t._latex_())
</code></pre>
http://ask.sagemath.org/question/34675/redirecting-the-output-of-show-to-a-file/?comment=34677#post-id-34677tmonteil, I appreciate your help.Thu, 01 Sep 2016 04:02:45 -0500http://ask.sagemath.org/question/34675/redirecting-the-output-of-show-to-a-file/?comment=34677#post-id-34677