First time here? Check out the FAQ!

Ask Your Question
1

LatexExpr space problem

asked 12 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 12 years ago

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}: " + ...
Preview: (hide)
link

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 ( 12 years ago )

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 ( 12 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

Stats

Asked: 12 years ago

Seen: 394 times

Last updated: Sep 12 '12