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.

I am currently having issues with the display of this equation below.

The code I have inserted is using align but I have also tried using eqnarray, (which has right-alignment but is deprecated), and am now at the point of considering using a table.

The alignment here doesn't appear to do as the documentation says, and when I add extra &'s I can get the format slightly better but not exactly as I want. To be clear, it is the right-alignment of the second column that is giving me most trouble.

Code:

\begin{align*}
&\frac{2^{1+k/2}}{k!} &< 1\\
\Leftrightarrow &2^{1+k/2} &< k!\\
\Leftrightarrow& (\sqrt{2})^k\cdot 2 &< \left(\frac{k}{e}\right)^k \sqrt{2 \pi k}
\end{align*}

What it looks like now:

enter image description here

What I want it to look like:

enter image description here

share|improve this question

migrated from stackoverflow.com Feb 5 '13 at 13:17

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 5 down vote accepted

Following is the appropriate way to have multiple alignments within an align:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
% Original
\begin{align*}
 & \frac{2^{1+k/2}}{k!} & < 1\\
\Leftrightarrow & 2^{1+k/2} & < k!\\
\Leftrightarrow & (\sqrt{2})^k\cdot 2 & < \left(\frac{k}{e}\right)^k \sqrt{2 \pi k}
\end{align*}
% Correct
\begin{align*}
 && \frac{2^{1+k/2}}{k!} & < 1\\
\Leftrightarrow && 2^{1+k/2} & < k!\\
\Leftrightarrow && (\sqrt{2})^k\cdot 2 & < \left(\frac{k}{e}\right)^k \sqrt{2 \pi k}
\end{align*}
\end{document}

As reference for multiple points within align, see the amsmath user guide (section 3.6 Equation groups with mutual alignment, p 6-7). There's also other align-related environments that would yield this output, including alignat.

Regarding your venture to other environments, perhaps \eqnarray vs \align is of interest.

share|improve this answer
    
Great info, thanks very much for this as well as editing my original post –  Max Steele Feb 4 '13 at 19:26

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.