Ask Your Question
1

LatexExpr space problem

asked 2012-09-12 16:58:54 +0100

mhfrey gravatar image

I am trying to format test in a notebook and I am having problems with the text being run together. The sage code is:

Pintegral_int = 2

Pint_txt_int = "This is a test: " +"P_{integral}= "+str(round(Pintegral_int,6)) \ +", 1/P_{integral}= "+str(round(1/Pintegral_int,6)) \ +"at dB= " +str(round(20*log(Pintegral_int, 10),4)) \ +", 90^{\circ} pulse"+"\mu s"

Pint_txt_int; show(LatexExpr(Pint_txt_int))

image description

The "Thisisatest" is missing the spaces between words. I would appreciate any help on how to solve this problem.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-09-12 18:26:09 +0100

benjaminfjones gravatar image

This is not a Sage question, it's a LaTeX question. But anyway, try wrapping "This is a test" in a \text latex macro, i.e.

Pint_txt_int = "\\text{This is a test}: " + ...
edit flag offensive delete link more

Comments

1

In case you want more details: by default, everything in a LatexExpr is typeset in LaTeX's math mode, and that's why the spaces disappear.

John Palmieri gravatar imageJohn Palmieri ( 2012-09-12 23:07:03 +0100 )edit

Yep, that's a good point. I shouldn't leave such terse answers but it's hard not to while waiting at the drug store with only one's phone for company :)

benjaminfjones gravatar imagebenjaminfjones ( 2012-09-13 23:42:46 +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

Stats

Asked: 2012-09-12 16:58:54 +0100

Seen: 386 times

Last updated: Sep 12 '12