Ask Your Question

Redirecting the output of show() to a file?

asked 2016-09-01 03:47:53 -0600

Peter Luschny gravatar image

Consider the tree

t = Permutation([1, 3, 2, 6, 8, 9, 5, 7, 4]).increasing_tree().as_ordered_tree()

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-09-01 03:58:20 -0600

tmonteil gravatar image

You 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_())
edit flag offensive delete link more



tmonteil, I appreciate your help.

Peter Luschny gravatar imagePeter Luschny ( 2016-09-01 04:02:45 -0600 )edit

^_^ .

tmonteil gravatar imagetmonteil ( 2016-09-01 06:15:54 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-09-01 03:47:53 -0600

Seen: 61 times

Last updated: Sep 01 '16