# Vertically align two horizontally-parallel equations

I am attempting to vertically align two equations at multiple points and I have come up with the following:

\begin{array}{rlclcl}
\eta(n)&\equiv&\frac{\Lambda(n)}{\log n}&\equiv&\sum_{d\mid n}&\mu\left(\frac nd\right)\log_nd\\
\eta(p(x))&\equiv&\frac{\Lambda(p(x))}{\log p(x)}&\equiv&\sum_{c(x)\mid p(x)}&\mu\left(\frac {p(x)}{c(x)}\right)\log_{p(x)}c(x)
\end{array}


The problem I'm encountering is that there is too much space between the right-most \sum and the following \mu, but if I remove the alignment markers then the \sum symbols do not align. Is there a simple way to fix this? I arrived at this point while trying to get the \sum parts to be vertically aligned, and this part of the alignment is what I most want to keep, followed immediately by the \equivs and the \eths (with right-alignment for the \eths).

Is there a simple way to resolve this?

• Welcome to TeX.SX! I would simply center both equation using gather* (with \usepackage{amsmath}); I think that aligning the \equiv and \sum signs doesn't add to readability, but rather that it hinders it. Can you add at least the definition for \eth? – egreg Oct 10 '14 at 22:24
• @egreg: thank you; I certainly see what you are saying about hindrance particularly due to the extra spacing. My intent is to convey the similarity of the formulas and I was hoping that vertical alignment would help with that. So, are you saying that there is no (easy) way to reduce the spacing created by this alignment technique? – abiessu Oct 10 '14 at 22:28
• Oh, sorry, I'll pick another variable then... I'm just working locally using MathJAX and I'm unfamiliar with where some of the symbols actually come from... – abiessu Oct 10 '14 at 22:30

I don't think that aligning the \equiv and \sum signs adds to readability; to the contrary, I believe that it hinders it.

Anyway, with some more work one can get the required alignments.

I made also some improvements, defining a \moebius command that uses \DeclarePairedDelimiter, so you can say

\moebius{x}        % normal size
\moebius[\big]{x}  % big size
\moebius[\Big]{x}  % Big size
\moebius[\bigg]{x} % bigg size
\moebius[\Bigg]{x} % Bigg size
\moebius*{x}       % automatic sizing, use sparingly


The package array and \newcolumntype are necessary only for the second way of typesetting the formulas.

\documentclass{article}
\usepackage{mathtools,array}
\DeclarePairedDelimiter\moebiusdel{(}{)}
\newcommand{\moebius}{\mu\moebiusdel}

\newcolumntype{M}[1]{>{\displaystyle{}}#1<{{}}}

\begin{document}

My proposal
\begin{gather*}
\partial(n)\equiv\frac{\Lambda(n)}{\log n}\equiv\sum_{d\mid n}\moebius*{\frac{n}{d}}\log_nd\\
\partial(p(x))\equiv\frac{\Lambda(p(x))}{\log p(x)}\equiv\sum_{c(x)\mid p(x)}
\moebius*{\frac{p(x)}{c(x)}}\log_{p(x)}c(x)
\end{gather*}
With multiple alignments
$\setlength{\arraycolsep}{0pt} \begin{array}{Mr Mc Mc Mc Ml} \partial(n) & \equiv & \frac{\Lambda(n)}{\log n} & \equiv & \sum_{\mathmakebox[\widthof{\scriptstyle c(x)\mid p(x)}]{d\mid n}} \moebius*{\frac{n}{d}}\log_nd \\ \partial(p(x)) & \equiv & \frac{\Lambda(p(x))}{\log p(x)} & \equiv & \sum_{c(x)\mid p(x)}\moebius*{\frac{p(x)}{c(x)}}\log_{p(x)}c(x) \end{array}$
\end{document}


• Don't you think you should ‘mathclap’ the sums subscripts? – Bernard Oct 10 '14 at 23:16
• @Bernard That would be an option, but I don't like it very much and, anyway, the subscript would be too under the \equiv. – egreg Oct 10 '14 at 23:18
• Thank you! I guess that another option would be to left- or right-align the limits with the \sums, but that seems like it would cause its own problems and not improve anything. – abiessu Oct 11 '14 at 0:12
• @Bernard: sadly, it seems that \mathclap|\mathrlap|\mathllap are not available in the version of MathJAX I have. But it's okay, I'll probably come up with a better way of presenting these function definitions before it really matters. Thank you for the suggestion. – abiessu Oct 12 '14 at 6:07
• @abiessu MathJax is not LaTeX, although it shares the basic syntax. Most of the TeX constructions that require measuring simply don't work. – egreg Oct 12 '14 at 8:44