Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there a way to force a line break inside a math mode text?

My example:

\[
  \underbrace{....}_\text{Some long text that should be multiline}
\]

Trying

\text{Some long text that\\ should be multiline}

Didn't do the trick.

share|improve this question
2  
While it is not an answer, I thought you might like to know why \` fails inside \text`. If you look through the code, \text will insert an \hbox for the content when in math mode. TeX sets \hbox material in a mode where paragraphs are ignored, so there will never be a break inside the argument of the \text macro. –  Joseph Wright Dec 21 '10 at 13:55
add comment

6 Answers

up vote 32 down vote accepted

You can use the \substack command, from the amsmath package, just like \text.

\[
 \underbrace{....}_{\substack{\text{Some long text that}\\\text{should be multiline}}}
\]
share|improve this answer
add comment

One more, for a very long text:

\documentclass{article}
\usepackage{lipsum}
\newlength{\mysum}
\settowidth{\mysum}{$1+2+3+4+5+6+7+8+9$}
\begin{document}
\begin{equation}
\underbrace{1+2+3+4+5+6+7+8+9}_{
\begin{minipage}{\mysum}\lipsum[2]\end{minipage}} 
\end{equation}
\end{document}
share|improve this answer
add comment

A simple \parbox with a certain width should also do.

\documentclass[11pt]{article}
\usepackage{mathtools}   % loads »amsmath«

\begin{document}
  \[
    \underbrace{ax^3+bx^2+cx+d}_{\text{\parbox{10em}{Some text that should be multi-lined}}}
  \]
\end{document}
share|improve this answer
add comment

Another possibility:

\[
 \underbrace{some equation}_{\text{Some long text that}\atop\text{should be multilined}}
\]
share|improve this answer
add comment
  • \substack, mentioned by Carsten, probably fits best to your \underbrace because of the centered alignment.

  • subarray is similar but offers customizable alignment:

Example:

\[
 \underbrace{....}_{\begin{subarray}{l}\text{Some  long text that}\\
    \text{should be multiline}\end{subarray}}
\]
  • \parbox also works in math mode. You could use a font size command inside.
share|improve this answer
add comment
\documentclass[11pt]{article}
\usepackage{amsmath}

\newcommand\myText[1]{\text{\scriptsize\tabular[t]{@{}l@{}}#1\endtabular}}

\begin{document}

\[
  \underbrace{....}_\myText{Some long text that\\ should be multiline}
\]

\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.