1

I have a number of equations aligned at the equal sign. I insert a line containing just \vdots to indicate a bunch of steps and then equations again. How I can make the \vdots align with the equal signs? enter image description here Here's my code:

\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{twoopt}

\usepackage[a4paper,margin=20mm]{geometry}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[range-units = single]{siunitx}


\renewcommand{\vec}[1]{\boldsymbol{#1}}
\newcommand{\der}{\operatorname{d\!}{}}\renewcommand{\dfrac}[2]{\frac{\der #1}{\der #2}}
\newcommand{\pdfrac}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\sdots}{\makebox[1em][c]{.\hfil.\hfil.}\thinspace}
\newcommandtwoopt{\spint}[2][x][3]{\int_{\mathbb{R}^{\num{3}}} \! \der^#2#1 \,}
\newcommandtwoopt{\spiint}[2][x][y]{\iint_{\mathbb{R}^{\num{3}}} \! \der^{\num{3}}#1 \der^{\num{3}}#2 \,}
\newcommand{\moint}[1][p]{\int_{\mathbb{R}^{\num{3}}} \! \frac{\der^{\num{3}}#1}{\(\num{2}\pi\)^{\num{3}}} \,}
\newcommand{\vnabla}{\vec{\nabla}}
\renewcommand{\(}{\left(}
\renewcommand{\)}{\right)}
\renewcommand{\[}{\left[}
\renewcommand{\]}{\right]}
\let\phi\varphi
\newcommandtwoopt{\nfrac}[2][1][2]{\frac{\num{#1}}{\num{#2}}}

\begin{document}
\begin{equation}
\begin{aligned}
P^\mu |\vec{p}_{\num{1}},\sdots,\vec{p}_n\rangle
&= P^\mu\underbrace{\sqrt{\num{2}E_{\vec{p}_{\num{1}}}} \cdot\sdots\cdot \sqrt{\num{2}E_{\vec{p}_n}}}_{\alpha} \, a^\dagger\(\vec{p}_{\num{1}}\) \sdots a^\dagger\(\vec{p}_n\) |\num{0}\rangle \\
&= \alpha  \,a^\dagger\(\vec{p}_{\num{1}}\) \(p_{\num{1}}^\mu + P^\mu\) a^\dagger\(\vec{p}_{\num{2}}\) \sdots a^\dagger\(\vec{p}_n\) |\num{0}\rangle \\
&= \alpha  \,a^\dagger\(\vec{p}_{\num{1}}\)a^\dagger\(\vec{p}_{\num{2}}\) \[p_{\num{1}}^\mu + p_{\num{2}}^\mu +
P^\mu\] a^\dagger\(\vec{p}_{\num{3}}\) \sdots a^\dagger\(\vec{p}_n\) |\num{0}\rangle \\
&\vdots \\
&=
\end{aligned}
\end{equation}
\end{document}
Janosh
  • 4,042
  • This is very brave code:-) \renewcommand{\(}{\left(} \renewcommand{\)}{\right)} \renewcommand{\[}{\left[} \renewcommand{\]}{\right]} – David Carlisle Oct 25 '14 at 17:18
  • I take that as a compliment. I've found it to work very well so far. Are there known issues with this? – Janosh Oct 25 '14 at 17:27
  • \( and \[ are the standard latex commands to enter math mode, so if code using your redefinitions and code assuming the standard definitions ever mix then the document will be very broken. – David Carlisle Oct 25 '14 at 17:34
  • try for example \begin{displaymath}a=b\end{displaymath} with and without the redefinitions – David Carlisle Oct 25 '14 at 17:37
  • I don't think I understand. How can they mix up if I redefined the commands. The old ones are overwritten, no? – Janosh Oct 25 '14 at 17:40
  • If you use displaymath or algorithmic package or bliondtex package or xscak package or akk package or rcs package (just a few that came up on a search of \( then your redefinitions will make the package commands fail as they use \( or \[ to get in to math mode and you have redefined them. redefining core commands of the latex language is bound to break a lot of packages. – David Carlisle Oct 25 '14 at 17:49
  • I see. So it's not that brave to redefine these commands if you know about the accompanying restrictions, which I now do, thanks to you. – Janosh Oct 25 '14 at 19:16
  • So should I delete this question, or leave it here to make the answer in the other question more easily discoverable? After all, my quick search didn't turn it up. – Janosh Oct 25 '14 at 19:22
  • leave it: it's fine to leave duplicates once they are marked as such – David Carlisle Oct 25 '14 at 20:01

0 Answers0