1

The following code

\documentclass[]{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
  A &\leq B \cdot C \cdot \int D
  \\&
    \phantom{{} \leq B \cdot {}}
    C \cdot \int D
  \\&
    \phantom{{} \leq B \cdot C {}}
    \cdot \int D
  \\&
    \phantom{{} \leq B \cdot C \cdot \int {}}
    D
\end{align*}

\begin{align*}
  A &\leq \fbox{aaaaaaaaaaaaaaaaaaaaaaaaa}
  \\&
    \phantom{{} \leq {}}
    \cdot \int \fbox{bbbbbbbbbbbbbbbb}
  \\&
    \phantom{{} \leq \cdot \int {}}
    \fbox{ccccccccccccccccccc}
\end{align*}
\end{document}

gives weird alignments

In the first case the alignments work exactly as I would expect. But why in the second case the boxes of b's and c's are not aligned?

3

In the second align you're forgetting the empty atom after \leq:

\begin{align*}
  A &\leq \fbox{aaaaaaaaaaaaaaaaaaaaaaaaa}
  \\&
    \phantom{{} \leq {}}
    \cdot \int \fbox{bbbbbbbbbbbbbbbb}
  \\&
    \phantom{{} \leq {}\cdot \int {}}
    \fbox{ccccccccccccccccccc}
\end{align*}

enter image description here

When you have Rel Bin Op, the Bin atom is changed into Ord (think to $a \leq -\log b$), so the spacing changes.

| improve this answer | |
0

Why don't you align it directly to the point where you want it, and then adjust the first row accordingly?

\documentclass[]{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
  A \leq B \cdot C \cdot \int &D
  \\
  C \cdot \int &D
  \\
  \cdot \int &D
  \\
  &D
\end{align*}

\begin{align*}
   A \leq \hspace{2.2em} &\hspace{-2em}\fbox{aaaaaaaaaaaaaaaaaaaaaaaaa}
  \\
    \cdot \int &\fbox{bbbbbbbbbbbbbbbb}
  \\
    &\fbox{ccccccccccccccccccc}
\end{align*}
\end{document}

Please not that I added 2.2em before the &, instead of 2em, because it gives a space between the \leq and the box, and it looks a bit better, at least to me.

| improve this answer | |
  • Thanks for your advice. I guess I could do that in this specific example. But that does not answer my question. Why is the alignment working in the first example but not the second? – Gilles Bonnet Jul 15 '16 at 9:18
  • And the environment align is designed such that you put the alignment before the relation symbol. It gives then the right spacing around it. It looks weird to me to write & any where else. – Gilles Bonnet Jul 15 '16 at 9:18

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.