13

Inside an align environment I have a \lim with two variables which should be displayed in two lines:

\begin{align}
...
f & = \lim _ {a \rightarrow -\infty \linebreak b \rightarrow \infty} ... \\
...
\end{align}

Currently there is no line break where I want to have one; it's displayed in one line. How can I force a line break there? \linebreak is ignored and \\ breaks the align environment.

David Carlisle
  • 757,742
Florian
  • 439
  • 3
  • 9
  • 1
    levu: You may consider reading this for other alternatives to stacking limits, below: http://tex.stackexchange.com/questions/17066/how-to-stack-limits-for-maths-operators – night owl Oct 08 '11 at 03:13

2 Answers2

17

Use substack to specify the two variables.

As egreg pointed out you can also use subarry and the last two solutions provided use this. The last one also account for the fact that the a and b don't take up the same amount of space, and create a box the width of an x and centers the a and b within that amount of space.

enter image description here

Also, in this case it is better to use \to instead of \rightarrow as that better represents the mathematical sense here.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\newcommand*{\AlignChar}[1]{\makebox[1ex][c]{\ensuremath{\scriptstyle#1}}}%
\begin{align}
 \lim _{\substack{a \to -\infty \\ b \to \infty}} =
 \lim _{\begin{subarray}{l} a \to -\infty \\ b \to \infty \end{subarray}} =
 \lim _{\begin{subarray}{l} \AlignChar{a}  \to -\infty \\ \AlignChar{b} \to \infty \end{subarray}}
 \end{align}
\end{document}

As per egreg's comments, you could also write:

\newcommand*{\AlignChar}[1]{\makebox[1ex][c]{$\scriptstyle#1$}}%

which would make that macro easier to read, but my personal preference is to use \ensuremath as that to me explicitly captures the fact that it can be used in mode. In this case, the reason that $...$ is ok is that \makebox enters text mode so you can use $..$ or \ensuremath inside it.

Peter Grill
  • 223,288
4

Here is a, perhaps less attractive, alternative to stacking limits to operators by using \mathop:

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align}
f & = \mathop{\lim_{a\rightarrow-\infty}}_{b\rightarrow\infty}
\end{align}
\end{document}​
Werner
  • 603,163
  • thank you, maybe i need this at other points, here i'll use the stacking ;) – Florian Oct 07 '11 at 18:59
  • @Werner: Are you missing a "b" before the second "\rightarrow"? (Same issue as in Peter's answer...) – Mico Oct 07 '11 at 23:11
  • @Mico: Is it that obvious that I copied the MWE from Peter? :) – Werner Oct 07 '11 at 23:13
  • 3
    @Werner - A separate matter: I really admire your habit, in your answers, of providing each package's source URL as a comment. Great help for beginning LaTeXers, for sure! – Mico Oct 07 '11 at 23:19
  • 1
    A hah, now we know where you get your solutions. :-) :-) – Peter Grill Oct 07 '11 at 23:19