Ask Your Question
2

Redirecting the output of show() to a file?

asked 8 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
3

answered 8 years ago

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_())
Preview: (hide)
link

Comments

2

tmonteil, I appreciate your help.

Peter Luschny gravatar imagePeter Luschny ( 8 years ago )

^_^ .

tmonteil gravatar imagetmonteil ( 8 years ago )

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: 8 years ago

Seen: 516 times

Last updated: Sep 01 '16