\mbox

Command in package box.

Synopsis

\mbox{content}

Description

Creates an inline box with the specified content. Line breaks are suppressed
inside the box. The default CSS stylesheets don't apply any specific layout
to the box, so it is not visually distinguished from the surrounding text.

The \mbox command is allowed in math mode, too. It can be used to embed
normal text in mathematical formulas. The embedded text can contain nested
formulas. Apart from that, the embedded text should be plain text. That is,
it should not contain markup (emphasize etc,), headlines, images, etc. The
reason is that the MathJax library, which is used to render math in browsers
which do not support MathML natively, cannot handle complex non-mathematical
content embedded in mathematical formulas.

Example 1

In normal mode (no visual effect, except suppression of newlines, if any)

Lorem ipsum \mbox{dolor sit amet}, consectetuer adipiscing elit. Aenean commodo ligula
eget dolor. Aenean massa. \mbox{Cum sociis natoque penatibus et magnis dis parturient}

For comparison, the same text witout mboxes:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula
eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient

Result, as rendered by your browser

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient

For comparison, the same text witout mboxes:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient

Example 2

In math mode

$f(x) > 0 \quad \mbox{for each} \quad x > 5$

Result, as rendered by your browser

f(x)>0for eachx>5

Example 3

In math mode, with embedded formulas

$f(x) < 0 \quad \mbox{for each $x > 5$}$

 \begin{displaymath}
   f(x)=
   \begin{cases}
     0 & \mbox{if $x < 0$} \\
     1 & \mbox{if $x \ge 0$}
   \end{cases}
 \end{displaymath}

Result, as rendered by your browser

f(x)<0for each x>5

f(x)=0if x<01if x0


This page is generated automatically and each change here will be replaced on a next update.

Add picture from clipboard (Maximum size: 500 MB)