Jump to content

Wikipedia:Manual of Style/Mathematics/Why you should never use \mbox within Wikipedia

From Wikipedia, the free encyclopedia

In the early days of the use of TeX on Wikipedia (in about 2003), \text and \mathrm were not available, but \mbox was used as a workaround to set things in text style within math tags, and for some years, that was even suggested in the mathematics style manual. The less important reason for not doing that is that it does not always yield the same results that \text or \mathrm yield. For example:

The subscript text in the first integral above, using \mbox, is conspicuously bigger than in the second, which uses \text (on some browsers, you might not see this effect if you're using mathJax, and on others you will, and it may also depend on how you have set your preferences). \text, on the other hand, uses sizes appropriate to the particular context in which it is used.

The more important reason is that it misleads people about the correct use of \mbox when LaTeX is used in the normal way, as opposed to the way it's used on web pages. Vast numbers of people seem to have learned this from Wikipedia and taken it to other internet forums, since it continued to be suggested at WP:MOSMATH for years after it was no longer needed.

When LaTeX is used in the normal way, as opposed to being used on web pages, \mbox does not have the effect of causing things to appear in text mode; nor is that its purpose. Its purpose is to prevent infelicitous line-breaks. Thus, suppose you write

This holds whenever the number of cases is more than 3.

It may be considered undesirable for the digit "3" to appear alone on the next line, especially at the end of a paragraph:

This holds whenever the number of cases is more than
3.

That can be prevented by writing

This holds whenever the number of cases is more \mbox{than 3}.

The sentence may then appear thus:

This holds whenever the number of cases is more than 3.

but if further editing of material earlier in the document should cause the sentence to get too long to fit on the line, then it will appear thus:

This holds whenever the number of cases is more
than 3.

This works regardless of whether text-mode or math-mode is used. Thus suppose you type

This holds whenever the number of cases is more than $x+y$.

so that the reader sees something like this:

This holds whenever the number of cases is more than x + y

(the two "$"s cause x + y to appear in math mode, including the italicization and spacing conventions). But a line-break could result in the reader seeing any of these:

This holds whenever the number of cases is more than x + 
y.
This holds whenever the number of cases is more than x
y.
This holds whenever the number of cases is more than
x + y.

If you type instead

This holds whenever the number of cases is more \mbox{than $x+y$}.

then any line-break in will appear no later than just after the word "more":

This holds whenever the number of cases is more
than x + y.

None of this works within Wikipedia. This is how LaTeX behaves when used in the normal way as typesetting software, as opposed to its use on web pages. Using \mbox as a substitute for \text within math tags on Wikipedia misleads users about the behavior and intended purpose of \mbox in normal LaTeX documents.