ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 13 Sep 2012 16:42:46 -0500LatexExpr space problemhttps://ask.sagemath.org/question/9312/latexexpr-space-problem/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](/upfiles/13474797652007146.png)
The "Thisisatest" is missing the spaces between words. I would appreciate any help on how to solve this problem.Wed, 12 Sep 2012 09:58:54 -0500https://ask.sagemath.org/question/9312/latexexpr-space-problem/Answer by benjaminfjones for <p>I am trying to format test in a notebook and I am having problems with the text being run together. The sage code is:</p>
<p>Pintegral_int = 2</p>
<p>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"</p>
<p>Pint_txt_int; show(LatexExpr(Pint_txt_int))</p>
<p><img alt="image description" src="/upfiles/13474797652007146.png"/></p>
<p>The "Thisisatest" is missing the spaces between words. I would appreciate any help on how to solve this problem.</p>
https://ask.sagemath.org/question/9312/latexexpr-space-problem/?answer=12258#post-id-12258This 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}: " + ...
Wed, 12 Sep 2012 11:26:09 -0500https://ask.sagemath.org/question/9312/latexexpr-space-problem/?answer=12258#post-id-12258Comment by John Palmieri for <p>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.</p>
<pre><code>Pint_txt_int = "\\text{This is a test}: " + ...
</code></pre>
https://ask.sagemath.org/question/9312/latexexpr-space-problem/?comment=19065#post-id-19065In 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.Wed, 12 Sep 2012 16:07:03 -0500https://ask.sagemath.org/question/9312/latexexpr-space-problem/?comment=19065#post-id-19065Comment by benjaminfjones for <p>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.</p>
<pre><code>Pint_txt_int = "\\text{This is a test}: " + ...
</code></pre>
https://ask.sagemath.org/question/9312/latexexpr-space-problem/?comment=19059#post-id-19059Yep, 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 :)Thu, 13 Sep 2012 16:42:46 -0500https://ask.sagemath.org/question/9312/latexexpr-space-problem/?comment=19059#post-id-19059