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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to typeset math in table layout, which is stretched to page width e.g.:

   a)\, \lim_{n\to\infty} \frac{1000n}{n^2+1} &&
   b)\, \lim_{n\to\infty} \left( \sqrt{n+1}-\sqrt{n}\right) &&
   c)\, \lim_{n\to\infty} \frac{\sqrt[3]{n}\sin n!}{n+1}&&\\
   d)\, \lim_{n\to\infty} \frac{(-2)^n+ 3^n}{(-2)^{n+1}+3^{n+1}}&&

This produces output where each column is aligned to right, I'd prefer left align:

enter image description here

Moreover some padding between lines would be nice.

I've tried using an array environment:

   a)\, \displaystyle\lim_{n\to\infty} \frac{1000n}{n^2+1} &
   b)\, \displaystyle\lim_{n\to\infty} \left(\sqrt{n+1} - \sqrt{n}\right)&
   c)\, \displaystyle\lim_{n\to\infty} \frac{\sqrt[3]{n}\sin n!}{n+1}\\
   d)\, \displaystyle\lim_{n\to\infty} \frac{(-2)^n+ 3^n}{(-2)^{n+1}+3^{n+1}} 

enter image description here

It seem to solve the problem with align, but math commands inside array produces too many errors and space between rows is even smaller.

Any idea how to solve this?

share|improve this question
up vote 12 down vote accepted

You could use the normal align* environment, combined with the spreadlines environment from the mathtools package. The parameter for spreadlines (here 20pt) sets the linespacing for align and gather environments within it. Should you want this change to be global, you could instead add \setlength{\jot}{20pt} to your preamble.

   &a)\, \lim_{n\to\infty} \frac{1000n}{n^2+1} &
   &b)\, \lim_{n\to\infty} \left( \sqrt{n+1}-\sqrt{n}\right) &
   &c)\, \lim_{n\to\infty} \frac{\sqrt[3]{n}\sin n!}{n+1}\\
   &d)\, \lim_{n\to\infty} \frac{(-2)^n+ 3^n}{(-2)^{n+1}+3^{n+1}}

enter image description here

share|improve this answer
I see, I was using those ampersands incorrectly. Thanks, that's nice and simple. – Tombart Oct 30 '11 at 11:02
\newcommand{\exer}{\stepcounter{exercise}\makebox[1.2em][r]{\theexercise)\ }}

\lim_{n\to\infty} \frac{1000n}{n^2+1} &
\lim_{n\to\infty} \left(\sqrt{n+1} - \sqrt{n}\right)&
\lim_{n\to\infty} \frac{\sqrt[3]{n}\sin n!}{n+1}\\
\lim_{n\to\infty} \frac{(-2)^n+ 3^n}{(-2)^{n+1}+3^{n+1}}

You see that you only need to specify how many columns you need and, possibly, the amount of interline stretching. The numbering is automatic.

Alternative definition

Here the intercolumn space is stretched, rather than the column width

\newcommand{\exer}{\stepcounter{exercise}\makebox[1.2em][r]{\theexercise)\ }}
share|improve this answer
Nice solution as well. For displaying it on full \textwidth I would need to pass some extra argument to tabularx? – Tombart Oct 30 '11 at 11:13
It is on full line width; using \linewidth instead of \textwidth in the definition ensures that the environment will respect the line width also in list environments. You have three equal width columns. I'll add a different solution that gives "flush right" third column. – egreg Oct 30 '11 at 11:25

Here is a plain-format version too, just for fun:

\def\ealign#1{\def\amp{&}% props to Bruno
  \def\intoalpha##1{\ifcase##1 a\or b\or c\or d\or e\or f\or g\or h\or i\or
    j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or t\ot u\or v\or w\or x\or
    y\or z\else##1\fi} % convert given int < 26 to letter
  \count1=0 % used by plain output for info, let's use it for column count
  \vbox{\openup1\jot % increase (base)lineskip(limit) by 3pt (default)
    \halign to\hsize{% make the horizontal alignment take up full width
      &{\rm\intoalpha{\count1})}\enspace\global\advance\count1 by1% column count
      \mathsurround0pt$\displaystyle##$\tabskip0pt&% every other column resets
      \amp##\tabskip1em plus.5\hsize\crcr#1\crcr}}}% \tabskip to zero, so there
                                                   % is no surplus skip at end

So you see,
  \lim_{n\to\infty} {1000n\over n^2+1} &
  \lim_{n\to\infty} \left(\sqrt{n+1}-\sqrt n\,\right) &
  \lim_{n\to\infty} {{\root3\of n}\sin n!\over n+1} \cr
  \lim_{n\to\infty} {(-2)^n+3^n\over(-2)^{n+1}+3^{n+1}}
and that's that. However, if you'd like to have it indented, you could
  \lim_{n\to\infty} {1000n\over n^2+1} &
  \lim_{n\to\infty} \left(\sqrt{n+1}-\sqrt n\,\right) &
  \lim_{n\to\infty} {{\root3\of n}\sin n!\over n+1} \cr
  \lim_{n\to\infty} {(-2)^n+3^n\over(-2)^{n+1}+3^{n+1}}
is the same thing, only a second time.

Looks like:
enter image description here

share|improve this answer

Your Answer


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.