Ask Your Question

Typesetting text in TeX view()

asked 2012-06-07 06:36:23 -0600

Mathemage gravatar image

updated 2015-01-25 11:01:44 -0600

FrédéricC gravatar image

Is there a standard way to typeset TeX formulas together with normal text via view()?

So far I've been using

tex_string = "\hbox{- stationary points: }"
for pt in stats:
    tex_string += latex(pt)
    tex_string += ", " 

where stats is a list of some points (defined with formulas).

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2017-03-09 03:37:53 -0600

It has been quite a while since the question was asked, but I seem to have an answer. The key points are to use unescaped strings (avoid \t in \textbf be misinterpreted for a tab) and LatexExpr(). The following is a MWE in my jupyter notebook:

tex_string = r"\textbf{stationary points: }"
tex_string += ", ".join(map(latex,stats))

This code both shows a typeset version in the notebook (second last command) and opens up a pdf viewer with typeset latex code (last command).

edit flag offensive delete link more

answered 2012-06-08 12:54:35 -0600

Eviatar Bach gravatar image

You can do the following in a notebook cell:

Stationary points: $\sage{stats}$
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools


Asked: 2012-06-07 06:36:23 -0600

Seen: 432 times

Last updated: Mar 09 '17