Ask Your Question

Typesetting text in TeX view()

asked 2012-06-07 13:36:23 +0200

Mathemage gravatar image

updated 2015-01-25 18:01:44 +0200

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 2012-06-08 19:54:35 +0200

Eviatar Bach gravatar image

You can do the following in a notebook cell:

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

answered 2017-03-09 10:37:53 +0200

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

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 13:36:23 +0200

Seen: 610 times

Last updated: Mar 09 '17