4

I would like to align multiple equations below each other. However, I cannot figure out how I should code this. I'm using the following preamble:

\documentclass[11pt]{article}


%comments
%pdflatex, bibtex, pdflatex, pdflatex

\usepackage{titling}
    \setlength{\droptitle}{-12cm}

\usepackage{graphics, float}
\usepackage[pdftex]{graphicx}
\usepackage{caption}
    \usepackage{subcaption}

\usepackage{siunitx}   %allows SI units by using \SI{unit} 
\usepackage{amsmath}   %allows \begin{equation} \end{equation}

\usepackage{geometry}
\usepackage{changepage}     %allows you to widen or shorten the page width from the left or the right.

For F_{hkl} I would like to align the equations below. The equal sign of the second equation should be placed right below the equal sign in the first equation. Can someone help me figuring this out?

I am now using the following code, but I am not satisfied with it yet.

\begin{equation*}
\mathrm{F_{hkl}} = \mathrm{f_{j}} 
( \operatorname{e} ^ {2\pi \cdot i (h\cdot0 + k\cdot0 + l\cdot0)} + 
\operatorname{e} ^ {2\pi  i (h\cdot\frac{1}{2} + k\cdot\frac{1}{2} + l\cdot0)} + 
\operatorname{e} ^ {2\pi  i (h\cdot0 + k\cdot\frac{1}{2} + l\cdot\frac{1}{2})} + 
\operatorname{e} ^ {2\pi  i (h\cdot\frac{1}{2} + k\cdot0 + l\cdot\frac{1}{2})} )
\end{equation*}

\begin{equation*}
\mathrm{F_{hkl}} = \mathrm{f_{j}} 
( \operatorname{e} ^ {2\pi i \cdot 0} + 
\operatorname{e} ^ {2\pi  i (h\cdot\frac{1}{2} + k\cdot\frac{1}{2} } + 
\operatorname{e} ^ {2\pi  i (k\cdot\frac{1}{2} + l\cdot\frac{1}{2})} + 
\operatorname{e} ^ {2\pi  i (h\cdot\frac{1}{2} + l\cdot\frac{1}{2})} )
\end{equation*}
  • You should use the align* environment provided by amsmath, not two equation* environments. – Torbjørn T. Dec 20 '15 at 20:11
8

This type of alignment is provided out-of-the-box using amsmath's align environment:

enter image description here

\documentclass{article}

\usepackage{amsmath}
\newcommand{\ee}{\mathrm{e}}

\begin{document}

\[
  \mathrm{F_{hkl}} = \mathrm{f_{j}} 
  ( \ee ^ {2\pi \cdot i (h\cdot0 + k\cdot0 + l\cdot0)} + 
  \ee ^ {2\pi  i (h\cdot\frac{1}{2} + k\cdot\frac{1}{2} + l\cdot0)} + 
  \ee ^ {2\pi  i (h\cdot0 + k\cdot\frac{1}{2} + l\cdot\frac{1}{2})} + 
  \ee ^ {2\pi  i (h\cdot\frac{1}{2} + k\cdot0 + l\cdot\frac{1}{2})} )
\]

\[
  \mathrm{F_{hkl}} = \mathrm{f_{j}} 
  ( \ee ^ {2\pi i \cdot 0} + 
  \ee ^ {2\pi  i (h\cdot\frac{1}{2} + k\cdot\frac{1}{2} } + 
  \ee ^ {2\pi  i (k\cdot\frac{1}{2} + l\cdot\frac{1}{2})} + 
  \ee ^ {2\pi  i (h\cdot\frac{1}{2} + l\cdot\frac{1}{2})} )
\]

\begin{align*}
  \mathrm{F_{hkl}} &= \mathrm{f_{j}} 
  ( \ee ^ {2\pi \cdot i (h\cdot0 + k\cdot0 + l\cdot0)} + 
  \ee ^ {2\pi  i (h\cdot\frac{1}{2} + k\cdot\frac{1}{2} + l\cdot0)} + 
  \ee ^ {2\pi  i (h\cdot0 + k\cdot\frac{1}{2} + l\cdot\frac{1}{2})} + 
  \ee ^ {2\pi  i (h\cdot\frac{1}{2} + k\cdot0 + l\cdot\frac{1}{2})} ) \\
  \mathrm{F_{hkl}} &= \mathrm{f_{j}} 
  ( \ee ^ {2\pi i \cdot 0} + 
  \ee ^ {2\pi  i (h\cdot\frac{1}{2} + k\cdot\frac{1}{2} } + 
  \ee ^ {2\pi  i (k\cdot\frac{1}{2} + l\cdot\frac{1}{2})} + 
  \ee ^ {2\pi  i (h\cdot\frac{1}{2} + l\cdot\frac{1}{2})} )
\end{align*}

\end{document}

Alignments are ensured using &=.

4

In addition to using an align* environment to align the two equations on their = symbols, you may want to look into using the mathastext package to save yourself from having to type lots and lots of \mathrm "wrapper" statements.

enter image description here

\documentclass[11pt]{article}
\usepackage{amsmath} 
\usepackage{geometry}
\usepackage{mathastext}
\begin{document}

\begin{align*}
F_{hkl} &= f_{j} \bigl(
e ^ {2\pi \cdot i (h\cdot0 + k\cdot0 + l\cdot0)} + 
e ^ {2\pi  i (h\cdot\frac{1}{2} + k\cdot\frac{1}{2} + l\cdot0)} + 
e ^ {2\pi  i (h\cdot0 + k\cdot\frac{1}{2} + l\cdot\frac{1}{2})} + 
e ^ {2\pi  i (h\cdot\frac{1}{2} + k\cdot0 + l\cdot\frac{1}{2})} \bigr)\\
F_{hkl} &= f_{j} \bigl(
e ^ {2\pi i \cdot 0} + 
e ^ {2\pi  i (h\cdot\frac{1}{2} + k\cdot\frac{1}{2} } + 
e ^ {2\pi  i (k\cdot\frac{1}{2} + l\cdot\frac{1}{2})} + 
e ^ {2\pi  i (h\cdot\frac{1}{2} + l\cdot\frac{1}{2})} \bigr)
\end{align*}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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