Ask Your Question
1

Redirecting the output of show() to a file?

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

Peter Luschny gravatar image

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

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

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

Comments

2

tmonteil, I appreciate your help.

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

^_^ .

tmonteil gravatar imagetmonteil ( 2016-09-01 06:15:54 -0500 )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

Stats

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

Seen: 66 times

Last updated: Sep 01 '16