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?

user14554
  • 155
  • 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? – Circumscribe Jan 02 '19 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 03 '19 at 00:00
  • 1
    @user14554: So you have a "big piece of text" between the two alignments? – Werner Jan 03 '19 at 00: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 03 '19 at 00:01
  • I'm sure there's a way to use fleqn and subequations, I just haven't found it yet. – user14554 Jan 03 '19 at 00:25
  • I think this is the right track https://tex.stackexchange.com/questions/381207/aligning-consecutive-align-environments-and-keep-equation-numbering because I don't want to get rid of the align environments at all. The problem are it doesn't appear to change much except the labeling. It does keep the alignment across consecutive align environments, but then if the columns switch, from that point on, following align environments then follow that new alignment instead of the original. – user14554 Jan 03 '19 at 00:36

1 Answers1

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>.

Werner
  • 603,163