7
$\begingroup$

I'm certainly one of Worldbuilding's foremost proponents of $\LaTeX$, and I've encouraged its use in the past. However, I've noticed a certain trend that I think is important to note: the use of inline LaTeX.

Here's an example:

You'll need a spaceship to provide about 125,000 newtons of thrust.

LaTeX-ified, this is sometimes written as

You'll need a spaceship to provide about $125,000 newtons$ of thrust.

I find this annoying for several reasons:

  1. There should really be a \text modifier in use, specifically, \text{ newtons}, which would make this line render as

    You'll need a spaceship to provide about $125,000 \text{ newtons}$ of thrust.

    Why? Because the normal LaTeX formatting treats the letters newtons as variables (i.e. $n\times e\times w\times t\times o\times n\times s$), and so tilts them. There should also be a space between the units and the number (hence \text{ newtons} instead of \text{newtons}.

  2. More importantly, LaTeX should not be used here at all, in my opinion. It grabs my eye when such emphasis is not necessarily necessary - for example, the important part of this sentence could be that a spaceship is needed. But instead, my eye is drawn to the number, which is formatted in a way that clashes with the normal font.

    The exceptions are when symbols are needed that can't be easily added by normal characters. One example is $\int_0^1 f(x)dx$. Now, I typically give integrals their own lines, but that's simply a personal preference. As an example workaround, exponents can be represented as xn via the text x<sup>n</sup>, instead of as $x^n$; the same is true for subscripts.

Does anyone else find the unnecessary usage of LaTeX to be a little annoying, and if so, can we try to reduce these occurrences?

$\endgroup$
9
  • $\begingroup$ Now that you mention it in your example, yes I do find it annoying. But I don't think I've seen it on the site. How common is it? $\endgroup$
    – Vincent
    Sep 16, 2015 at 2:56
  • $\begingroup$ I've seen that kind of behavior in my own answers but didn't identify it as a problem that needed correction. I shall use the \text{ } command from now on. $\endgroup$
    – Green
    Sep 16, 2015 at 3:28
  • 1
    $\begingroup$ Same as Vincent, I haven't come too much upon it. And btw, I don't know which packages are available, but Ideally, one would write \SI{125,000}{N} so that the space between the unit is taken care of by the lib. $\endgroup$ Sep 16, 2015 at 5:17
  • $\begingroup$ @bilbo_pingouin You can try that in the preview. \SI{}{} does not seem to be available. (Though a case can probably be made for that it should be; I don't think we'd be the only site that would find it useful.) $\endgroup$
    – user
    Sep 16, 2015 at 8:05
  • $\begingroup$ @Vincent I couldn't say. $\endgroup$
    – HDE 226868 Mod
    Sep 16, 2015 at 22:44
  • 1
    $\begingroup$ Note that the \LaTeX macro is also made for text mode, so you should use \rm\LaTeX to produce $\rm\LaTeX$. (The seemingly obvious \text{\LaTeX} doesn't work because MathJax apparently doesn't expand macros inside \text.) $\endgroup$
    – celtschk
    Sep 17, 2015 at 7:01
  • 3
    $\begingroup$ BTW, the $125,000 newtons$ has another error: In $\rm\LaTeX$ if you use the comma as thousands separator, you should put it in braces to avoid extra spacing behind, that is 125{,}000 to produce $125{,}000$ instead of 125,000 producing $125,000$. But the better idea is to use \, to produce a small space: 125\,000 produces $125\,000$. $\endgroup$
    – celtschk
    Sep 17, 2015 at 7:08
  • 2
    $\begingroup$ Your HTML $x^n$ looks wrong to me because the variables are in the wrong font. Just like units should be upright, variables should be italics. $\endgroup$
    – celtschk
    Sep 17, 2015 at 7:16
  • $\begingroup$ I'd like to point out that \space works (in the sense of this): 125,000\space\text{newtons}. As in $125{,}000\space\text{newtons}$. $\endgroup$ May 5, 2018 at 20:27

2 Answers 2

4
$\begingroup$

This is a topic I feel quite strongly about. I personally use MathJax a lot, in particular for quantities. I find that it:

  1. Visually distinguishes them from the surrounding text, so that a reader can skim quickly through my answer without missing anything. My reasoning for this is that I usually emphasize the calculation: for me, the important information is that there's $125~\text{kN}$ of thrust. If it's important, I'll describe the source of the thrust somewhere else.

  2. Keeps a consistent appearance outside and inside formulas. This is the biggest reason to use MathJax in my opinion.

An example of my type of usage:

We can use a simple formula to find the speed of a spacecraft in a $400\times 400~\text{km}$ circular orbit:

$$ v = \sqrt{\frac{\mu}{a}}=\sqrt{\frac{\mu}{R_E+400~\text{km}}}=7.67~\text{km}/\text{s} $$

$\mu$ is Earth's gravitational parameter, equal to $3.98600441\cdot 10^{5}~\text{km}^3\text{s}^{-2}$

It so happens that escape velocity at any altitude is equal to $\sqrt{2}$ times the speed of a circular orbit at that altitude,1 so $v_\text{esc}=\sqrt{2}\times 7.67~\text{km}/\text{s}=10.8~\text{km}/\text{s}$


1 A proof of this is beyond the scope of this example, but essentially the idea is that...

A few notes:

  1. I typeset units with upright letters, and put a space between them and the numeric part of the quantity, e.g.:

    • $1.6~\text{km}$ ($1.6~\text{km}$)

    • $39.3~\text{m}/\text{s}$ ($39.3~\text{m}/\text{s}$)

    • $9.8~\text{m}\cdot\text{s}^{-2}$ ($9.8~\text{m}\cdot\text{s}^{-2}$)

    I use the tilde ~ for a space out of habit (in LaTeX's text mode it's a non-breaking space, which is useful to prevent a quantity from being split over two lines); also I just don't like the unbalanced spacing in 1.6\text{ m} (but this is just a personal preference). An escaped space (1.6\ \text{m}) works too.

    Also note that I don't surround all of the units in a quantity with a single \text{ }: I encapsulate each unit individually. This allows me to use mathmode constructs like ^{-2} or \cdot in compound or derived units.

  2. I use \cdot ($\cdot$) to separate parts of a single quantity, i.e. between the significand and the exponent, and between units (when necessary). I reserve the multiplication sign (\times, $\times$) for multiplication of quantities or numbers.

  3. I use a thin space (\,) to separate groups of digits. This allows you to use either a dot or comma as the decimal separator without causing confusion, e.g. $12\,345.678$ ($12\,345.678$) or $12\,345{,}678$ ($12\,345{,}678$).

    However, I try to avoid numbers with lots of places whenever possible, using either SI prefixes or scientific notation. An exception is when comparing values: "$12~\text{MW}$ vs. $760~\text{kW}$" might be better stated as $12\,000~\text{kW}$ vs. $760~\text{kW}$."

Most of the above points are mandated by the BIPM: see the SI brochure, section 5. Here are some of the important bits (but I recommend you read it yourself):

Unit symbols are printed in roman (upright) type regardless of the type used in the surrounding text.

A multiple or sub-multiple prefix, if used, is part of the unit and precedes the unit symbol without a separator. A prefix is never used in isolation.

Multiplication must be indicated by a space or a half-high (centred) dot (⋅). Division is indicated by a horizontal line, by a solidus (oblique stroke, /) or by negative exponents.

It is not permissible to use abbreviations for unit symbols or unit names.

The numerical value always precedes the unit, and a space is always used to separate the unit from the number. [An exception is made for degrees (and minutes and seconds) of arc, but not for degrees Celsius.]

For numbers with many digits the digits may be divided into groups of three by a thin space. Neither dots nor commas are inserted in the spaces between groups of three.

When multiplying the value of quantities either a multiplication sign, ×, or brackets should be used, not a half-high (centred) dot. When multiplying numbers only the multiplication sign, ×, should be used.

Not conforming to this standard is not a matter of preference, or even poor style: it is just wrong. (I told you I feel strongly about this!) Do note that the BIPM uses $\times$, not $\cdot$, to separate the significand and exponent, although they do not mandate such usage.

  1. I avoid using MathJax where it would introduce inconsistency in the style: for example, the footnote label 1 (<sup>1</sup>) remains consistent with the surrounding text. I feel it improper to use $^{1}$ ($^{1}$) in this context because the footnote label should not be stylistically associated with quantities or formulas.

If you don't use a lot of math, or don't want the overhead of MathJax, I recommend the use of the following HTML entities and tags to improve your formatting:

  • &nbsp; - non-breaking space, use to separate numbers and units, e.g. 1.6&nbsp;km (1.6 km). This prevents a quantity's unit from being separated by a line break. (As in: 1.6 km.)

  • &sdot; - multiplication dot, use to separate compound units, e.g. 5.8&nbsp;N&sdot;m (5.8 N⋅m).

  • <sup> - superscript, use for exponents, e.g. 6.62607&sdot;10<sup>&minus;34</sup>&nbsp;J&sdot;s (6.62607⋅10−34 J⋅s). Don't use the Unicode superscript/subscript characters, since a) most browsers will end up rendering them with a different font from the rest of the numbers, and b) using <sup> is better for accessibility and copy-pasting.

    Also note the use of the minus sign (&minus;, −) instead of the hypen-minus (-, -). Not only does it look better, it properly lines up with the plus sign (+, +) in a variable-width font:

    1 - 1 (-)
    1 + 1
    1 − 1 (&minus;)

I admit these are not easy to type on mobile devices (one reason you may be avoiding MathJax in the first place!) but they do help your posts look more professional.


Taking into account the above information, let me tackle HDE's "annoying" examples:

  • $125,000 newtons$. This is wrong. Let me say again, this wrong in pretty much every way. HDE's suggestion of $125{,}000\text{ newtons}$ is better, but we should really get rid of the comma:

    $$ 125\, 000\text{ newtons} $$

    Personally, I feel like if you're spelling out a unit then it's better formatted as plain text (i.e. 125 000 newtons), to make the "word form" of the unit consistent with the surrounding words. (Note the use of the narrow no-break space &#8239; as the thousands separator.) If you want to treat the quantity as a symbol, I'd use the abbreviation:

    $$ 125\,000~\text{N} $$

    In fact, let's compactify the representation even more by removing all those zeros:

    $$ 125~\text{kN} $$

    Much better! (Of course if you don't want MathJax you can write 125 kN.)

  • $x^n$. This one is much more a matter of preference. xn is perfectly valid, but in my opinion it fails to distinguish the mathematical expression from the surrounding text. The change in font when reading $x^n$ is a clear sign that the reader's brain needs to switch gears, which eases comprehension.

If you've read this far, thanks for listening and happy typesetting!

$\endgroup$
3
  • $\begingroup$ @HDE By the way, do you mind if people call you "HDE" or do you prefer the full "HDE 226868"? $\endgroup$ Sep 30, 2015 at 2:35
  • $\begingroup$ Very good review! $\endgroup$ Sep 30, 2015 at 5:57
  • $\begingroup$ @2012rcampion I'm fine with either. Thanks for the answer! $\endgroup$
    – HDE 226868 Mod
    Sep 30, 2015 at 22:09
2
$\begingroup$

I had to hunt around to find how to use units. If it were explained on a cheetnsheet summary...? What I found was a different word, though.

Another "minor" use that could be handled without TeX is superscrips. It's not on the toolbar or markdown, but html tags work. I've seen posts use mathjax to get the superscript but then mess up the unit.

Peppering a post with small fragments of mathJax is a real problem on a tablet, as it makes the editor slow down to the point where you can't type.

$\endgroup$
2
  • $\begingroup$ If the superscripts have a mathematical meaning (like $x^2$), I prefer MathJax. Howeveer for things like chemical formulas (e.g. CO<sub>2</sub>) I prefer HTML tags. So I would write $10\,\mathrm{m}^3$ of CO<sub>2</sub> (which I entered as $10\,\mathrm{m}^3$ of CO<sub>2</sub>). Addendum: I just notice that in comments, the HTML tags don't seem to work. $\endgroup$
    – celtschk
    Sep 17, 2015 at 7:13
  • $\begingroup$ @celtschk, see help center, like worldbuilding.stackexchange.com/editing-help#comment-formatting $\endgroup$ Sep 17, 2015 at 12:15

You must log in to answer this question.

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