2
\documentclass[letterpaper,10pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
w &z &t
\end{align}
\begin{align}
w+w+w+w &z+z+z+z &t+t+t+t
\end{align}
\end{document}

On their own, these are going to have differently aligned columns. Is there a way to keep at least some of the alignment across different align environments the same?

6
  • 3
    You can use \intertext{<text>} to interrupt an align environment. Is this what you want or do you want to align equations that are very far apart? Jan 2, 2019 at 23:57
  • I have already used for some text, but I want different align environments for completely different text sections, though I want the equation alignment to remain consistent.
    – user14554
    Jan 3, 2019 at 0:00
  • 1
    @user14554: So you have a "big piece of text" between the two alignments?
    – Werner
    Jan 3, 2019 at 0:00
  • I have two large and distinct text sections with their own titles and such yes. I do not want them altered and intertext will not solve anything. As far as I know there is possibly some way to use fleqn.
    – user14554
    Jan 3, 2019 at 0:01
  • I'm sure there's a way to use fleqn and subequations, I just haven't found it yet.
    – user14554
    Jan 3, 2019 at 0:25

1 Answer 1

3

If you're unable to use \intertext, you need to identify the widest element around each alignment. And the easiest way to capture these "widest elements" is using eqparbox. Below I define \eqmathbox[<tag>][<align>]{<stuff>} that puts its contents <stuff> in a box of widest width across all of the same <tag> with a specific <align>ment.

enter image description here

\documentclass{article}

\usepackage{amsmath,eqparbox,xparse}

% https://tex.stackexchange.com/a/34412/5764
\makeatletter
\NewDocumentCommand{\eqmathbox}{o O{c} m}{%
  \IfValueTF{#1}
    {\def\eqmathbox@##1##2{\eqmakebox[#1][#2]{$##1##2$}}}
    {\def\eqmathbox@##1##2{\eqmakebox{$##1##2$}}}
  \mathpalette\eqmathbox@{#3}
}
\makeatother

\usepackage{lipsum}

\begin{document}
\lipsum*[1]
\begin{align}
  \eqmathbox[left][r]{w} &\eqmathbox[centre][l]{z} & \eqmathbox[right][r]{t}
\end{align}
\lipsum*[2]
\begin{align}
  \eqmathbox[left][r]{w+w+w+w} & \eqmathbox[centre][l]{z+z+z+z} & \eqmathbox[right][l]{t+t+t+t}
\end{align}
\lipsum*[3]

\end{document}

The alignment choice matches that of the R&L & R&L ... style of align.

Since eqparbox uses TeX's \label-\ref-like system in order to manage the lengths, you'll need to compile at least twice with every change in the widest element per <tag>.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .