0
$\begingroup$

While editing, I have often come across re-edits by the 2k+ rep members like this(just an example) where I have seen minor editing changes like the one in given link. I know the raw (the one containing the TEX language) version of the post looks quite bad with the type of editing I have done in the stated case but the actual output i.e. the post (the one viewed by everybody) looks the same in both the cases.

I can give another example. I don't remember the post but I am illustrating the case:

Suppose I want to write 5 m/s using TEX. In that case, both the following write-ups have the same output:

  • $5$ $m/s$
  • $5 \,\mathrm{m/s}$

So my question is: Why is this re-edit important? I know there must be some reason. But since the final result is the same in such cases, I don't see these edits as that much important.

P.S. Nothing to do with page linked. Please do not come up with answers like ACuriousMind is right and you are wrong and so on. I know I am wrong and ACuriousMind has been here for a longer time than I have been. I just want the logic, nothing else.

$\endgroup$
  • $\begingroup$ Other site members modify my Mathjax all the time. This doesn't annoy me at all, it just makes me surprised that so many people like hospital food :-) $\endgroup$ – John Rennie Oct 2 '15 at 15:11
  • $\begingroup$ @JohnRennie ...Hospital food does taste nice! $\endgroup$ – SchrodingersCat Oct 2 '15 at 15:14
7
$\begingroup$

When it comes to comparing

$5$ $m/s$
$5\,\mathrm{m/s}$

As ACuriousMind said, they don't look the same. In the first one, "m" and "s" will be italic (representing variables) but in the second one they're in upright font, representing units.

Let's say you fix that and write

$5$ $\mathrm{m/s}$

It may look the same to you, but what about to everyone else? What about to people whose browsers can't load MathJax? Or who use a different font that uses differently sized spaces? Or who use console browsers? What about screen readers? The reason there are standards for proper use of MathJax is precisely so that it can render the right way in a wide variety of different environments. And going beyond that, the source code of a post can also be used by fully automatic parsers. We'd like them to be able to figure out what is meant by a certain piece of markup, e.g. being able to identify that "5 m/s" is a single quantity with a unit, rather than two independent pieces of math. So the source code should contain information about the intended meaning of what you're writing, not just the information required to make it look the way you want. This is called semantic markup, and it's why you'll see valid edits that combine different MathJax elements, correct \text to \mathrm or vice versa, standardize the Markdown formatting in posts, and so on.

Strictly speaking, we'd like to have something like \quantity{5}{\meter\per\second}. In LaTeX, you can do this using the siunitx package (you'd write \SI{5}{m/s}), but no equivalent exists in MathJax.

$\endgroup$
  • $\begingroup$ Thanks, its a very good answer... I didn't know about all these.BTW what is this "siunitx" package you are talking about? Can you elaborate? And is there any difference between LaTeX and MathJax? I don't have much idea about this. $\endgroup$ – SchrodingersCat Oct 2 '15 at 14:56
  • $\begingroup$ @Aniket LaTeX is a document typesetting system: you write some text (including markup commands) in a file, run a program to compile it, and get a nicely formatted PDF. It's especially good at typesetting math. MathJax is a Javascript library that allows you to include nicely formatted math in a web page. They're totally separate, except that you can specify mathematical expressions for MathJax by using some of the same mathematical markup that LaTeX accepts: things like ^ for superscripts, \mathrm for upright font, and so on. $\endgroup$ – David Z Oct 2 '15 at 15:04
  • 3
    $\begingroup$ The other difference is in line breaking. The $5$ $\mathrm{m/s}$ form can break between the value and dimension. Yikes! $\endgroup$ – dmckee Oct 2 '15 at 15:27
  • $\begingroup$ @Aniket Often we will use "mathjax" and "latex" (and "tex," all with annoying capitalizations) interchangeably, since mathjax is designed to be more or less a subset of latex syntactically. siunitx is a package for latex but not mathjax that automatically puts \, and \mathrm{} and whatnot wherever you tell it you are writing a physical quantity. $\endgroup$ – user10851 Oct 2 '15 at 17:30
5
$\begingroup$

The final look is not the same.

If you do not include text in a \text{}, then the standard math mode rendering of TeX means that the text will be rendered as individual, italicized letters. The spacing is different than it would be for letters belonging to a single word, and there is no visible difference between such text and actual variables that are meant to be multiplied together.

If you, however, do use \text{} for text, it will be written in an upright font and the spacing will be as it is for words. There now is a visible difference between letters belonging to English words and letters that are variables.

$\endgroup$
  • $\begingroup$ I agree with you...That's really very deep. I couldn't make out the difference on the first go. But if I use ,like in the link, \,\ in the math mode, then the letters are individual, italicized (no doubt about it) but there is a slight spacing between the mathematical expressions and letters belonging to a single word. What about that? Yes, you can claim that \text{} makes the letters in upright font instead of being italicised. Fine. But editing rules tell us that we need to make the question clear only. So what is the difference between using \text{} and \,\? $\endgroup$ – SchrodingersCat Oct 2 '15 at 14:42
  • 2
    $\begingroup$ @Aniket: The difference is still the same - \text{} makes it easier to distinguish text from variables than the spacing by \, alone (but the spacing is better than no spacing, granted). There is no reason to prefer \, over \text{} I can see. $\endgroup$ – ACuriousMind Oct 2 '15 at 14:49
  • $\begingroup$ I see. Thanks for the answer. $\endgroup$ – SchrodingersCat Oct 2 '15 at 14:57
  • $\begingroup$ The reason to not like \text is because it is hard to raise units to a power that way. My preferred scheme uses \mathrm and a short space. Something like \,\mathrm{kg\,m^2/s^2} will mark up as expected, but uses a uptight (roman) typeface. To get something similar with \text requires some jumping through hoops \text{ kg m}^2\text{/s}^2. $\endgroup$ – dmckee Oct 9 '15 at 1:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .