8
$\begingroup$

Prompted by this suggested revision.

Here is the body of the question as it appears in my browser (Chrome 40.0.2214.111 m):

image of formatted question

Marking up this paragraph with MathJax simply to introduce superscripts and a degree symbol is unnecessary; here is the same paragraph, formatted without MathJax (and correcting the location of the degree symbols):

I have a 2 mm sheet of HDPE at 280−320 °F. I want to pierce the skin of this sheet with a 2 mm-high pin with a surface area of 3.33 mm2. The pin is also made of HDPE and has cooled completely. With the Young's modulus of HDPE being 0.8 GPa, how much force do I need to apply to have the cooled HDPE pin reach the molten layer of the HDPE sheet at 280−320 °F?

I personally find the MathJax version considerably more difficult to read. The changing font impairs my ability to quickly scan and parse the paragraph.

Let's make life easier for editors and reviewers by putting together some guidelines:

  • When is it appropriate to use MathJax markup in a question or answer?
  • What style conventions are encouraged when using MathJax on Engineering.SE?
| |
$\endgroup$
  • $\begingroup$ related, but not a duplicate: meta.engineering.stackexchange.com/a/54/16 $\endgroup$ – user16 Feb 11 '15 at 1:30
  • 1
    $\begingroup$ Perhaps a guide on typesetting some of the simple things (degree symbol, superscript, etc.) without MathJax would also be useful. Many people default to Latex because it doesn't have the nasty habit of changing the font in normal documents, and doing those things without Latex isn't covered in the editing help. $\endgroup$ – Chris Mueller Feb 11 '15 at 2:27
  • 1
    $\begingroup$ By the way, if/when we graduate, we might be able to ask for a font that works better with MathJax. We're stuck until then, though. $\endgroup$ – HDE 226868 Feb 13 '15 at 18:53
8
$\begingroup$

When to Use MathJax

The most common reason to use MathJax is to make a formula or expression easy to read. One such example is the Navier-Stokes equation for incompressible flow:

$$\dfrac {\partial \mathbf u} {\partial t} + \mathbf u \cdot \nabla \mathbf u - \nu \nabla ^2 \mathbf u = - \nabla w + \mathbf g$$

The partial derivatives, nablas and large horizontal-bar fractions would make this equation very difficult to read without the use of MathJax.

It's also common to use MathJax when referring to the variables previously shown in a formatted equation. For example, the Navier-Stokes equation includes the coefficient $\nu$ and the vectors $\mathbf u$ and $\mathbf g$. While it could be reasonable to use bold font u and g for the vectors, the Unicode character ν ("nu") is much less visible, and indistinguishable from the Roman character v ("vee").

When MathJax Is Less Useful

Numeric values and units of measurement, when included in-line with text, should use the style of the enclosing text. Exponents can be written using either Unicode or HTML. For example:

The force applied to the component is 100 N/m2.

When dealing with individual symbols or operators that are awkward to format in-line, but don't seem to deserve a line of their own, try spelling them out in words instead, e.g.:

Try taking the partial derivative of $\rho$ with respect to $x$ instead of $y$.

rather than:

Try taking $\frac{\partial \rho}{\partial x}$ instead of $\frac{\partial \rho}{\partial y}$.

If you must use MathJax to format a formula or expression in the middle of a sentence, consider placing it on a line of its own.

Style Guidelines

Units

NIST specifies:

  1. There is a space between the numerical value and unit symbol, even when the value is used as an adjective, except in the case of superscript units for plane angle.

    This can be achieved inside a MathJax-formatted block either by escaping the space character with a backslash or by using one of the spacing escape sequences described in item 13 of this MathJax reference post.

  2. Unit symbols are in roman type, and quantity symbols are in italic type with superscripts and subscripts in roman or italic type as appropriate.

    The most semantically correct way to format units as roman type is via mathrm{}. However, text{} can also be convenient since it will preserve the whitespace of the argument. For a more thorough comparison, see \text and \mathrm on TeX SE.

Degrees

Ideally, a block of MathJax-formatted text can be copied and pasted to produce a text output that can be reasonably understood when read by humans or parsed by screen readers. For example, it's common for users to represent degree symbols in using ^{\circ}; however, using the ° character produces a result that will be typeset correctly when copied and pasted and is more likely to be parsed correctly by screen readers:

$$\begin{array}{c|c|c} \text{Raw} & \text{Rendered} & \text{Pasted} \\ \hline \text{90\unicode{xb0}} & 90\unicode{xb0} & \text{90°} \\ \text{90°} & 90° & \text{90°} \\ \text{90^{\circ}} & 90^{\circ} & \text{90∘} \\ \end{array}$$

Units like and are also available as single characters, via either direct entry or \unicode{}; however, they do not use the same font as other characters in \text{} blocks, so users may prefer to express them using the degree and letter characters separately:

$$\begin{array}{c|c|c} \text{Raw} & \text{Rendered} & \text{Pasted} \\ \hline \text{100\:\unicode{x2103}} & 100\:\unicode{x2103} & \text{100℃} \\ \text{100\:℃} & 100\:℃ & \text{100℃} \\ \text{100\:^{\circ}C} & 100\:^{\circ}C & \text{100∘C} \\ \text{100\:^{\circ}\text{C}} & 100\:^{\circ}\text{C} & \text{100∘C} \\ \text{100\text{ °C}} & 100\text{ °C} & \text{100 °C} \\ \text{100\text{ ℃}} & 100\text{ ℃} & \text{100 ℃} \\ \end{array}$$

Unicode also has dedicated characters for superscript and subscript numerals that can be used in cases where only very simple typesetting is required.

Other Special Characters

Not all characters you might want to use in an equation are available in the implementation of MathJax used on Stack Exchange; sometimes, you may want to use a Unicode character directly in the input. For this purpose, \unicode{}, direct entry or copy-and-paste usually all provide the same result; however, there are exceptions. For example, \unicode{} is not rendered inside \text{}. Direct entry of special characters is possible in most desktop environments:

Windows

OS X

GNOME desktop environments

KDE desktop environments

$\endgroup$
3
$\begingroup$

It would seem that the general rules should be:

  1. MathJax is only to be used for formulas.
  2. MathJax should be used kept on its own line.

Those two rules could be broken in situations where it makes sense, but that should be the exception.

| |
$\endgroup$
3
$\begingroup$

I'm the guy who suggested the edit, so I feel obligated to reply to this. (Sheepish grin)

One thing to clear up: Adding LaTeX was not the primary reason for the edit. Look at the revision history - there were some grammar corrections and a tag edit. I also added in a link for HDPE, which made the question clearer. Not terribly Earth-shattering, but important nonetheless, and they were the reason I made the edit.

You wrote

The changing font plays havoc with my ability to quickly scan and parse the paragraph.

I don't know about "playing havoc," but I think that the changed font makes the question better. Those figures are the most important part of the question. The temperature was instrumental in Ben's answer, because the potential for the sheet to melt changes the entire scenario.

So I think the LaTeX helps because it calls attention to the important points.$^1$

Anyway, that's me being a tad defensive about my edit in this case, but I do think that it was warranted.


In general

LaTeX isn't needed in most cases, and I wouldn't add it in if there wasn't anything else to fix in the post (so if I just swooped in for that, that would be unacceptable by any standards). Well, sort of. Equations tend to be included because they're important to the post, can the havoc-playing font calls attention to them. For example, take this made-up section of a post:

In this instance, you need to use kinematics to figure out the rock's vertical distance traveled. Because the rock has an initial non-zero velocity in the y-direction, you use the equation y=voy t+1/2at^2. Here, a=g, and voy=vo sin theta. You can do similar things for the x-direction, but a=0, so the equation is simply x=vox t.

Using LaTeX:

In this instance, you need to use kinematics to figure out the rock's vertical distance traveled. Because the rock has an initial non-zero velocity in the y-direction, you use the equation $y=v_{oy}t+\frac{1}{2}at^2$. Here, $a=g$, and $v_{oy}=v_o \sin \theta$. You can do similar things for the x-direction, but $a=0$, so the equation is simply $x=v_{ox}t$.

That's much more readable. Two big changes are the subscripts and superscripts. Alternatively, give each equation its own line. When there are more complicated equations, or - gasp - matrices, LaTeX is a must. For example,

I(x) = integral from infinity to 1 of x^3+3-ln(x) dx

I(x) = integral from infinity to 1 of x^3 dx + integral from infinity to 1 of 3 dx - integral from infinity to 1 of ln(x)dx

I(x) = [x^4\4+3x-(x ln (x) -x)] from infinity to 1

$$I(x)=\int_1^{\infty} x^3+3- \ln x dx$$

$$I(x)=\int_1^{\infty} x^3 dx + \int_1^{\infty} 3 - \int_1^{\infty} \ln xdx$$

$$I(x)=\left[ \frac{x^4}{4}+3x - (x \ln x -x) \right]_1^{\infty}$$

Perhaps the things that don't need LaTeX are units, though mm^2 looks much better as mm$^2$. Admittedly, I went all out and wrote $\text{mm}^2$, which generally isn't helpful.


$^1$ I should add that I use a lot of LaTeX in answers on Stack Exchange because I address problems involving equations and calculations, so generally the units aren't so isolated and interruptive of the font. That bias is clearly my fault.

| |
$\endgroup$
  • 3
    $\begingroup$ This won't render here in the comments, but what makes $\mathrm{mm}^2$ or mm$^2$ look any better than HTML superscript tags (mm<sup>2</sup>) or the Unicode equivalent, mm² ? $\endgroup$ – Paul Gessler Feb 11 '15 at 0:51
  • $\begingroup$ @PaulGessler Nothing, actually. I'm not familiar with the HTML superscript/subscript or Unicode, but it's definitely easy to use and effective. $\endgroup$ – HDE 226868 Feb 11 '15 at 0:52
  • $\begingroup$ The figures certainly are an important part of the question, but without the description of the problem and what answer the OP is looking for, the numbers are useless. Having the numbers in LaTeX draws my eye immediately to it, which I don't think is always beneficial. $\endgroup$ – Trevor Archibald Feb 11 '15 at 1:00
  • $\begingroup$ @PaulGessler Nothing wrong with using HTML, but many of us know Latex very well and don't know HTML. The truly unfortunate thing is that inline Latex is rendered so poorly by MathJax. This entire question would be a non-issue if it rendered as well as Latex does natively. $\endgroup$ – Chris Mueller Feb 11 '15 at 2:31
  • $\begingroup$ @ChrisMueller I know LaTeX much better than HTML as well. But the rendering is incredibly distracting (mainly because of wildly inconsistent fonts/weights) that I prefer to use text markup wherever possible, only resorting to LaTeX where it's actually required. $\endgroup$ – Paul Gessler Feb 11 '15 at 2:33
  • $\begingroup$ HDE, how do you do the "big" definite integral sign? I'm only aware of \int. $\endgroup$ – Rick supports Monica Feb 11 '15 at 19:47
  • 1
    $\begingroup$ @RickTeachey The double dollar signs automatically make it big. $\endgroup$ – HDE 226868 Feb 11 '15 at 19:48
  • $\begingroup$ @RickTeachey MathJax has inline and display styles. Single $ delimiters use inline, and $$ delimiters use display as a new, centered paragraph. Many symbols act differently depending on the style. You can force display style symbols inline (i.e., not centered or in a new paragraph) with the \displaystyle command; try $\int {\displaystyle \int}$ to see a comparison. Some symbols have alternate versions just for this purpose; e.g., $\frac{a}{b} \text{versus} \dfrac{a}{b}$, where the "d" stands for "display-style." $\endgroup$ – Air Jul 17 '15 at 15:33

You must log in to answer this question.

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