# Numbering after intertext in align disappears

\begin{align}
&\begin{aligned}a_{12345}&=b\\ a&=c\end{aligned}\\
\intertext{The first aligned block and the second aligned block should be aligned at the equal sign. Therefore, I added an hphantom. But I want that they have a number which summarizes several equations. In my file, these equations are longer. They contain of ten lines each. It looks appealing, if they are aligned at the equal sign.\endgraf
However, while I am writing, I make a paragraph with \endgraf. Now, I need an equation.
\begin{align*}
a&=b\\
a&=c
\end{align*}
I want this equation to be central and aligned because it has several lines. This equal sign should be central. It is not realted to the outer equal signs. It contains only two lines which have to be central.\endgraf
Bonus question: What happens if I want to write a footnote in my intertext? Like: This is a nice footnote.\footnote{Indeed!} The footnote will not appear in the output. As strange as it is!}
&\begin{aligned}\hphantom{{}_{345}}a_{12}&=b\\ a&=c\end{aligned}
\end{align}


In my output the second aligned block has no number. I wonder why.

I have a longer intertext and want to align two blocks before and after it as in the example. The number is missing in the second block.

A related question can be found here. Do you have any idea how to obtain a number in the second aligned block? Thank you in advance!

• I've learned now from another related question that it is better to use split instead of the aligned blocks. That does not change, however, that the number after the long intertext as well as the footnote disappear. – user66288 Oct 6 '18 at 15:33
• The footnote problem can be solved like this: tex.stackexchange.com/questions/51343/footnote-from-intertext – user66288 Oct 6 '18 at 15:56
• it simply is not supported to nest one align inside another even if you use \intertext align uses several global values while measuring so nested use would break far more than just label numbering I would expect. – David Carlisle Oct 6 '18 at 17:08
• For me, it works now without warnings or errors (see the answer below). There was also a comment about the foonotes but it was deleted before I could try it. Something like {savefootnotes} environment in {footnote} package. – user66288 Oct 6 '18 at 17:10
• You won't get errors as it doesnt test for this (probably it never occurred to anyone that it would be attempted) but any outcome is purely accidental, the code clearly can not work if align is nested. Your question would be clearer if you edited it to have a complete document that people could run rather than a fragment, and also show the layout that you want, why the nested align? – David Carlisle Oct 6 '18 at 17:12

You don't need to use \intertext here, especially since you're trying to insert such a large piece of text with complicated additions (like an align). Just break the components, writing the text as normal, and align them using \phantoms and math overlaps (from mathtools).

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{aligned} \sin\cos\tan\log\max\min &= b \\ a &= \sum_{i = 1}^\infty x^2 \end{aligned}
The first aligned block and the second aligned block should be aligned at the equal sign.
Therefore, I added an \texttt{\string\hphantom}. But I want that they have a number which
summarizes several equations. In my file, these equations are longer. They contain of ten
lines each. It looks appealing, if they are aligned at the equal sign.

However, while I am writing, I make a paragraph with. Now, I need an equation.
\begin{align*}
a &= b \\
a &= c
\end{align*}
I want this equation to be central and aligned because it has several lines. This equal
sign should be central. It is not related to the outer equal signs. It contains only two
lines which have to be central.

Bonus question: What happens if I write a footnote in my \texttt{\string\intertext}?
Like: This is a nice footnote.\footnote{Indeed!} The footnote will appear in the output.
As strange as it is!
\begin{aligned} \hphantom{\sin\cos\tan\log\max\min}% Widest left-hand side \mathllap{a_{12}} &= \mathrlap{b} \hphantom{\sum_{i = 1}^\infty x^2} \\ % Widest right-hand side a &= c \end{aligned}

\end{document}


For every disconnected align that you want to align with some other component, use the widest element as an \hphantom on either side, together with the appropriate overlap.

Other options for similar box sizes are also possible (via eqparbox).

• That's probably the best to do. Thank you very much! I will try to adjust my code according to this and accept later when I've suceeded. – user66288 Oct 6 '18 at 17:29

Are you trying to achieve something like this

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{align}
&\begin{aligned}a&=b\\ a&=c\end{aligned}\\
&\begin{aligned}a&=b\end{aligned}\notag\\
&\begin{aligned}a&=b\\ a&=c\end{aligned}
\end{align}
\end{document}


or perhaps

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{align}
&\begin{aligned}a&=b\\ a&=c\end{aligned}\\
&\begin{aligned}\intertext{Hello}a&=b\intertext{World}\end{aligned}\notag\\
&\begin{aligned}a&=b\\ a&=c\end{aligned}
\end{align}
\end{document}

• (notice that these nested aligned in align look like quite complicated structure -- not to mention original \intertext, and perhaps much simpler construct can achieve not exactly known goal) – user4686 Oct 6 '18 at 14:06
• In my file, the intertext is longer. It contains several paragraphs of text, and also equations, which are in turn in an align environment. This nested align environment has no number and is not aligned with the outer blocks of aligned. – user66288 Oct 6 '18 at 14:27
• I have only ever used \intertext for one-line inserts and it sounds a priori strange to me to use for large amount of material, with the idea to maintain alignment of "before" with "after". Isn't there some simpler way with suitable \phantom to get your "before" and "after" to look aligned? Let's wait for people using \intertext for large chunks to expres advice. – user4686 Oct 6 '18 at 14:37
• Yes, I tried the phantom solution also. But then I have to add a new line to my second aligned for example. This line will be a hphantom of the longest line of the first aligned block. However, LaTeX will add vertical space as soon as I enter a new line. Even \[0pt] does not help. It controls only the space inbetween lines. But the fact that I added a new line, also includes new vertical space for the line included. – user66288 Oct 6 '18 at 14:47
• @jfbu the advice for nesting align in \intertext is simple, it can not work. – David Carlisle Oct 6 '18 at 17:10

I tried the same example with the environments of witharrows instead of the environments of amsmath. The extension witharrows give an environment {WithArrows} similar to {aligned}, an environment {DispWithArrows} similar to {align} and an environment {DispWithArrows*} similar to {align*}.

With these environments, the second tag doesn't disappear, and the footnote is extracted (if the extension is loaded with the option footnote or footnotehyper). However, the extension amsmath must be loaded because the command \intertext used is the command of amsmath.

\documentclass{article}
\usepackage{amsmath}
\usepackage[footnotehyper]{witharrows}
\begin{document}
\begin{DispWithArrows}
&\begin{WithArrows}a_{12345}&=b\\ a&=c\end{WithArrows}\\
\intertext{The first aligned block and the second aligned block should be aligned at the equal sign. Therefore, I added an hphantom. But I want that they have a number which summarizes several equations. In my file, these equations are longer. They contain of ten lines each. It looks appealing, if they are aligned at the equal sign.\endgraf
However, while I am writing, I make a paragraph with intertext.\endgraf Now, I need an equation.
\begin{DispWithArrows*}
a&=b\\
a&=c
\end{DispWithArrows*}
I want this equation to be central and aligned because it has several lines. This equal sign should be central. It is not realted to the outer equal signs. It contains only two lines which have to be central.\endgraf
Bonus question: What happens if I want to write a footnote in my intertext? Like: This is a nice footnote.\footnote{Indeed!} The footnote will not appear in the output. As strange as it is!}
&\begin{WithArrows}\hphantom{{}_{345}}a_{12}&=b\\ a&=c\end{WithArrows}
\end{DispWithArrows}
\end{document}

• Thanks, I will try this later. Sorry to bother, but is there also something similar to split? That would simplify the code drastically (less alignement points &). – user66288 Oct 6 '18 at 17:19
• I could also try split mixed with the arrow environments. I hope this is stable. – user66288 Oct 6 '18 at 17:24
• As for now, there is no equivalent of {split} in witharrows. In fact, if you don't use witharrows elsewhere in your document, it probably doesn't worth using this extension for your problem. The solution of Werner is more recommendable. – F. Pantigny Oct 6 '18 at 18:20

For all people having the same problem, I post a solution I just found. You insert the number somehow "manually" with

\refstepcounter{equation}\tag{\theequation}


at the end of the line in the align. That works fine for me up to now.