3
$\begingroup$

Should we report $\LaTeX$/MathJax issues in meta?? If so here is something I recently found: The following code (edit to see it) effects the line break behaviour:

 \frac{\text{numerator}}\\\text{denominator missing, linebreak doesn't work} 

$$ \frac{\text{numerator}}\\\Rightarrow\text{denominator was missing, line break doesn't work} \tag{1} $$

 \frac{\text{numerator}}{\text{denominator}}\\\text{denominator present, linebreak works}

$$ \frac{\text{numerator}}{\text{denominator}}\\\Rightarrow\text{denominator present, line break works}\tag{2} $$

$\endgroup$
  • 1
    $\begingroup$ Yes. Some of the MathJax developers roam around the meta site; and some of the bugs are due to faulty SE code. Both parties are roaming around this meta to find bug reports. $\endgroup$ – Asaf Karagila Dec 4 '12 at 11:56
3
$\begingroup$

The \cfrac needs a denominator so it treats the first two backslash \\ as the denominator, a backslash is always followed by a command (even if it is just a space), so what you did was define the denominator as a linebreak.

$\frac{\text{numerator}}\\\text{denominator is a linebreak, text follows the fraction}

is $$\cfrac {\text{numerator}}\\\text{denominator is a linebreak, text follows the fraction}$$ but since the backslash isn't define, one has to use \backslash, then nothing appears in the denominator.

  • but it changes if an additional backslash is added, like this

    \frac{\text{numerator}}\ \\\text{denominator is a space, linebreak works}

    and you get this

    $$\frac{\text{numerator}}\ \\\text{denominator is a space, linebreak works} $$ which gives you what you want.

    Notice the space after the first backslash, it means that the denominator is just a space.

  • Assuming there is no space

    \frac{\text{numerator}}\\\\text{denominator is a linebreak, linebreak works but text doesn't}

    or there is a space after the first two backslash

    \frac{\text{numerator}}\\ \\text{denominator is a linebreak, linebreak works but text doesn't}

    it treats the first two backslashes \\ (a linebreak) as the denominator, and the last two \\ as another linebreak, thus rendering the rest as non-formatted text and you get this

$$\frac{\text{numerator}}\\\\text{denominator is a linebreak, linebreak works but text doesn't} $$

  • Now let's put the space after the first three backslash

    \frac{\text{numerator}}\\\ \text{denominator is a linebreak,a space follows the fraction, and text works}

    $$\frac{\text{numerator}}\\\ \text{denominator is a linebreak,a space follows the fraction, and text works}$$

  • Let's put spaces between all backlashes

    \frac{\text{numerator}}\ \ \ \text{denominator is a space, two spaces follow the fraction, and text works}

$$\frac{\text{numerator}}\ \ \ \text{denominator is a space, two spaces follow the fraction, and text works} $$

The trick is simple, every backslash is followed by a command, even if it is just a space, for a linebreak, the command is another backslash. Backslashes are treated in the order in which they are written (from the first to the last)

I'm not sure of the termilogies I used or even my argument, so if anything is wrong, add your comment below.

$\endgroup$
  • 1
    $\begingroup$ Thanks ${ }$ ${ }$ $\endgroup$ – draks ... Dec 4 '12 at 14:08

You must log in to answer this question.

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