Ask Your Question
2

Redirecting the output of show() to a file?

asked 2016-09-01 10:47:53 +0100

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
3

answered 2016-09-01 10:58:20 +0100

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 11:02:45 +0100 )edit

^_^ .

tmonteil gravatar imagetmonteil ( 2016-09-01 13:15:54 +0100 )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 10:47:53 +0100

Seen: 488 times

Last updated: Sep 01 '16