LaTeX bug?


by Borek
Tags: latex
Borek
Borek is offline
#1
Jun9-12, 02:05 AM
Admin
Borek's Avatar
P: 22,704
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:

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

------------
Attached Thumbnails
Untitled-1.png  
Phys.Org News Partner Science news on Phys.org
Cougars' diverse diet helped them survive the Pleistocene mass extinction
Cyber risks can cause disruption on scale of 2008 crisis, study says
Mantis shrimp stronger than airplanes
M Quack
M Quack is offline
#2
Jun9-12, 02:24 AM
P: 640
[itex] \frac{ L \times \mathrm{atm}}{K \times \mathrm{mol}} [/itex]

\frac{ L \times \mathrm{atm}}{K \times \mathrm{mol}}
Borek
Borek is offline
#3
Jun9-12, 03:01 AM
Admin
Borek's Avatar
P: 22,704
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?

M Quack
M Quack is offline
#4
Jun9-12, 06:23 AM
P: 640

LaTeX bug?


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...
tiny-tim
tiny-tim is offline
#5
Jun9-12, 06:52 AM
Sci Advisor
HW Helper
Thanks
tiny-tim's Avatar
P: 26,167
Hi Borek!

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

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

[tex]\frac {L\times atm}{K\times mol}[/tex]
Borek
Borek is offline
#6
Jun9-12, 07:10 AM
Admin
Borek's Avatar
P: 22,704
Thanks, that explains it

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.
I like Serena
I like Serena is offline
#7
Jun9-12, 10:19 AM
HW Helper
I like Serena's Avatar
P: 6,189
Looks to me that you found a bug in MathJax! .


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.
Dickfore
Dickfore is offline
#8
Jun9-12, 10:36 AM
P: 3,015
Don't leave spaces between the numerator and denominator braces.
Borek
Borek is offline
#9
Jun9-12, 11:28 AM
Admin
Borek's Avatar
P: 22,704
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 . For sure I have not inserted it purposely, I have no idea how to do it even if I would like to.
I like Serena
I like Serena is offline
#10
Jun9-12, 11:35 AM
HW Helper
I like Serena's Avatar
P: 6,189
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.
Borek
Borek is offline
#11
Jun9-12, 12:01 PM
Admin
Borek's Avatar
P: 22,704
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.


Register to reply

Related Discussions
[LaTeX] What are the standard margins on a latex document? Math & Science Software 2
LaTex in Lyx differs from LaTex on forum? Programming & Computer Science 4
Relation between LaTeX Code: \\theta and LaTeX Code: \\mu ? Introductory Physics Homework 0
Is it possible to define in LaTeX documents Latex Help Math & Science Software 2