The LaTeX wiki says it makes a box, but when I used it with \mbox{Cos} for example, it simply wrote "Cos" in the same way that writing Cos by itself would have done. What's the point of \mbox?

  • There are differences, try this: \(\mbox{Not italic and with spaces \(some^{maths}\)}Italic with spaces removed\) – user2987828 Nov 25 '13 at 21:27
  • 4
    In LaTeX (and TeX) the word "box" means an unbreakable unit, whose contents are processed in text mode. \mbox is used when you want to keep some phrase from breaking at the end of a line. Occasionally it is used as a quick way to put a text-mode word or phrase inside a math display. There are also ways to store typeset material in a box (\savebox). Once stuff is saved in a box, it can be measured, reuse it later, etc. Boxes are all over LaTeX internal processing. – Dan Nov 26 '13 at 5:26

You don't really want to do that, because the spacing would be wrong.

The \mbox should typeset its argument in text mode even if in math mode; however it's wrong anyway. Operator names should be typeset in text mode, but with an upright font in any circumstance. With \mbox you don't ensure the correct spacing, nor that the font is right.

Look at the following example. In the pair of lines the first has \mbox{Cos}, the second one has \Cos properly defined.



Here we have a formula with the cosine $\mbox{Cos}0=1$.

Here we have a formula with the cosine $\Cos 0=1$.

Here we have a formula with the cosine $\mbox{Cos}0=1$.

Here we have a formula with the cosine $\Cos 0=1$.


enter image description here

You can notice that the spacing in the first line is slightly bad, but the result is dramatically wrong in the third line.

By the way, the cosine function has been named “cos” for centuries, until Mathematica came along and changed the conventions. I'll stay with the tradition, and LaTeX already provides \cos for that purpose.

It has been asked in comments to also deal with another usage of \mbox inside a math formula, say


(actually moose is claiming to have found ${\mbox{\boldmath{$\epsilon$}}}$, which I'm not really surprised of).

This is a very old, outdated and deprecated method for making a boldface math symbol. One has to remember that \boldmath is not legal inside a math formula: so with


a warning about Command \boldmath invalid in math mode would be issued and \boldmath would be ignored. By switching to text mode within the \mbox, \boldmath becomes legal and produces the desired effect. Technical note: when \mbox appears in a formula, TeX suspends math mode, enters text mode, typesets the box and switches back to math mode at the end.

However, something like


would have a bad output, because the symbol will not be in subscript size.

Since many years, a better method has been available: the instructions


allows one to say




getting a bold epsilon in the right size.

| improve this answer | |
  • 1
    @Anonymous As I understand egreg, convention is to use 'cos' for the cosine function, while Mathematica uses 'Cos' (capital C). The former is available in LaTeX already, as \cos. That someone on Physics.SX probably didn't know better. – Torbjørn T. Nov 25 '13 at 21:35
  • 2
    @Anonymous If you really want uppercase “Cos”, then add \DeclareMathOperator{\Cos}{Cos} with \usepackage{amsmath} as done in the example. – egreg Nov 25 '13 at 21:46
  • 3
    This is tangential to the actual question, but Mathematica has not changed the convention for cosine. In Wolfram language (aka InputForm, an ASCII-only 1-dimensional form), a cosine function is denoted "Cos[whatever]"; all functions in InputForm are capitalized and use square brackets when applied. When you display the expression (in 2-dimensional TraditionalForm, say), it's the same "cos(whatever)" as it always is. Analogously, you would not say LaTeX changed the convention for cosine to "\cos". – Xerxes Nov 25 '13 at 22:17
  • 2
    @moose This is a completely different situation and has nothing to do with the question. The purpose of that awkward construction is to make the epsilon bold. Of course, \usepackage{bm} and \bm{\epsilon} leads to the same result and is much easier and flexible (it also works in subscripts/superscripts, which the \mbox construction doesn't). – egreg Oct 26 '15 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy