Resolving LaTeX Math Rendering Issues

In summary, the space between the bracket and the number in MathJax is causing the value to be rendered incorrectly.
  • #1
Borek
Mentor
28,950
4,245
Is it a bug, or am I missing something obvious?

[tex]\frac {L\times atm} {K\times mol}[/tex]

[itex]\frac {L\times atm} {K\times mol}[/itex]

Same if you don't use \times, on my computer it is rendered the same wrong way under Opera and under Chrome.

This is image, not part of the text:

------------
attachment.php?attachmentid=48164&stc=1&d=1339225540.png

------------
 

Attachments

  • Untitled-1.png
    Untitled-1.png
    1.4 KB · Views: 498
Physics news on Phys.org
  • #2
[itex] \frac{ L \times \mathrm{atm}}{K \times \mathrm{mol}} [/itex]

Code:
\frac{ L \times \mathrm{atm}}{K \times \mathrm{mol}}
 
  • #3
OK, thanks, that's a way of getting it rendered correctly.

But it doesn't answer my question - was my LaTeX wrong, or was it rendered wrong?
 
  • #4
Can't really see anything wrong with your LaTeX. I never leave a space after the \frac, don't know if that makes a difference...
 
  • #5
Hi Borek! :smile:

You left a space between the two brackets, so I think it assumed you wanted that space under the line! :wink:

[tex]\frac {L\times atm} {K\times mol}[/tex]

[tex]\frac {L\times atm}{K\times mol}[/tex]
 
  • #6
Thanks, that explains it :smile:

I have a feeling it wasn't this way before, I find it hard to believe this is the first time I put the space between the brackets, I tend to add spaces to my code to make it less crowded and easier to read (be it LaTeX or C++ or anything). But I am not going to browse all my posts to check it.
 
  • #7
Looks to me that you found a bug in MathJax! :eek:.Spaces are not supposed to be significant in Latex.
They are only required to separate operators from operands if necessary, like \sin x, which is different from \sinx (which is an error:##\sinx##).
I googled for confirmation, but could not quickly find it.

Even letters with spaces between them are rendered as if the spaces were not there.
And operations on text without spaces, treat the letters as if they are separate,
like \frac ab versus \frac a b (both rendered as ##\frac ab## respectively ##\frac a b##).

Afaik the only other time when white space should be significant is within a \text environment.
Note that some latex engines have difficulty rendering long formulas without spaces (a bug).So I believe it's a bug in MathJax that your fraction does not render correctly.
A quick check shows that it is rendered correctly by another engine.
If the space were supposed to be significant, it should have been escaped.
 
  • #8
Don't leave spaces between the numerator and denominator braces.
 
  • #9
Looks like it is not a space between brackets, but a thin space, & # 8201; , so no wonder it was treated differently. But I have no idea what happened [PLAIN]http://www.bpp.com.pl/IMG/grumpy_borek.png. For sure I have not inserted it purposely, I have no idea how to do it even if I would like to.
 
Last edited by a moderator:
  • #10
Oh.
So it's not a bug.

Did you copy and paste the formula from elsewhere?
I know that for instance Microsoft Word and Excel automatically change what you type (to be supposedly more aesthetically pleasing).
Copying and pasting from any word processor that supports formatting is a risk.
 
  • #11
OK, I think I know what have happened.

I was answering question about ideal gas constant value and units, I went to wikipedia, marked units there, copied and pasted them to the edit field, but they looked like L atm K−1 mol−1 - so I wanted to latexize them to look better. I added \frac and brackets and never noticed there is a thin space instead of normal space.

Sigh. If not for the fact I tried to report problems at Google groups and CC mail that came to me displayed small square between brackets I would never found what the problem was.
 

1. What are some common LaTeX math rendering issues?

Some common issues include incorrect spacing, missing symbols or characters, incorrect font sizes, and errors in equations or formulas.

2. How can I fix incorrect spacing in my LaTeX equations?

To fix incorrect spacing, you can use commands such as \, or \! to manually adjust the spacing between symbols, or use the \hspace{} command to add or remove horizontal space.

3. What should I do if I notice missing symbols or characters in my equations?

If you notice missing symbols or characters, make sure you have loaded all the necessary packages and check for typos in your code. You can also use the \usepackage{amsmath} command to access additional symbols and characters.

4. How can I adjust the font size of my equations in LaTeX?

To adjust the font size, you can use the \fontsize{}{} command, where the first argument is the font size and the second argument is the line spacing. You can also use the \DeclareMathSizes{}{}{}{} command to specify different font sizes for different math environments.

5. What should I do if I encounter errors in my equations or formulas?

If you encounter errors, make sure you have correctly defined all variables and used the correct syntax. You can also use online resources or consult a LaTeX manual for troubleshooting tips. If the error persists, it could be due to a bug in the specific package or compiler you are using.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
797
  • MATLAB, Maple, Mathematica, LaTeX
Replies
16
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
7K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
275
  • Introductory Physics Homework Help
Replies
15
Views
327
  • MATLAB, Maple, Mathematica, LaTeX
Replies
15
Views
3K
  • Introductory Physics Homework Help
Replies
5
Views
587
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
5K
Replies
2
Views
701
Back
Top