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.

1

2 Answers 2

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.

5
  • Or, maybe better, \lim _{\begin{subarray}{l} a \to -\infty \\ \hphantom{a}\to \infty \end{subarray}} Commented Oct 7, 2011 at 21:27
  • @Peter: Are you missing a "b" before the second "\rightarrow"? (see also Werner's answer...) Commented Oct 7, 2011 at 23:10
  • @Mico: Thanks. Have corrected it, and also took that opportunity to enhance the solution. Commented Oct 7, 2011 at 23:41
  • Why \ensuremath? Wouldn't $\scriptstyle#1$ be easier to read? Commented Oct 8, 2011 at 10:07
  • @egreg: Thanks for pointing that out. Have added it to the solution. Commented Oct 8, 2011 at 15:01
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}​ 
5
  • thank you, maybe i need this at other points, here i'll use the stacking ;) Commented Oct 7, 2011 at 18:59
  • @Werner: Are you missing a "b" before the second "\rightarrow"? (Same issue as in Peter's answer...) Commented Oct 7, 2011 at 23:11
  • @Mico: Is it that obvious that I copied the MWE from Peter? :) Commented Oct 7, 2011 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! Commented Oct 7, 2011 at 23:19
  • 1
    A hah, now we know where you get your solutions. :-) :-) Commented Oct 7, 2011 at 23:19

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.