# Using shortintertext with gathered environment

I am currently using amsmath's gather environment to display a list of (long) expressions. I also want to insert the text "and", for which I use mathtools's \shortintertext, like so:

...and hence the quantities \begin{gather*}
xxxxxxxxxxxxxxxxxxxxxx_1 \\
\shortintertext{and}
xxxxxxxxxxxxxxxxxxxxxx_2
\end{gather*} must all vanish.


For later in my document, I also want to label this list of expressions with one number.

If I weren't using intertext or shortintertext, this could be done using the gathered environment, nested inside equation:

...and hence the quantities $$\begin{gathered} xxxxxxxxxxxxxxxxxxxxxx_1 \\ xxxxxxxxxxxxxxxxxxxxxx_2 end{gathered} \label{eqn:commonValues}$$ must all vanish.  The values in \cref{eqn:commonValues} also appear later.


But when I try to use this with shortintertext, I get

! Package amsmath Error: Invalid use of \shortintertext.


on MikTeX. How can I use both gathered and \shortintertext?

MnWE: just wrap the second code snippet above in

\documentclass[11pt]{article}
\usepackage{amssymb,mathtools,amsthm}
\usepackage{cleveref}
\begin{document}
INSERT HERE!
\end{document}

• Welcome! Please provide copy-pastable code which reproduces the error. INSERT HERE! is just going to produce a PDF with 'INSERT HERE!' and not the error you want help with. – cfr Jul 21 '18 at 2:50
• \intertext and \shortintertext make clear distinction that you have two (set of) equations, therefore they can not be referred as one. so you cant use \shortintertext and gather together. – Zarko Jul 21 '18 at 2:58
• ups. should be gathered instead gather. – Zarko Jul 21 '18 at 3:48
• @Zarko: I can't use \intertext as well as \shortintertext within gathered nested in equation. If I nest gathered in a gather instead of equation, it compiles without problem, but… everything is aligned at the left margin. – Bernard Jul 21 '18 at 8:10
• @Bernard, yes it works, however equation number is on wrong place after gather ... maybe latex by this defend against illogical use of amsmath/mathtools math environments :-) from math aspect is what to try op, wrong. – Zarko Jul 21 '18 at 10:05

to my opinion is the way, what you like to obtain, wrong. the cloest possibiliti which cross my mind is the following:

\documentclass[11pt]{article}
\usepackage{mathtools}

\begin{document}
\begin{subequations}\label{eqn:commonValues}
\begin{gather}
xxxxxxxxxxxxxxxxxxxxxx_1
\shortintertext{with correct use of "intertext/shortintertext"}
xxxxxxxxxxxxxxxxxxxxxx_2
\end{gather}
\end{subequations}
see \eqref{eqn:commonValues}.
\end{document}


which gives:

as i mentioned in my comments above, \intertext and \shortintertext make clear distinction that you have two (set of) equations, which are interrupted by inserted text. therefore they can not be treated nor referred as one. so you can't use \shortintertextnor\intertextandgathered together. this is also wrong (to my opinion) from math aspect too.

somehow wrongly works the following (as mentioned Bernard in his comment:

\documentclass[11pt]{article}
\usepackage{mathtools}

\begin{document}
\begin{gather}\label{eqn:commonValues-2}
\begin{gathered}
xxxxxxxxxxxxxxxxxxxxxx_1
\shortintertext{and}
xxxxxxxxxxxxxxxxxxxxxx_2
\end{gathered}
\end{gather}
see \eqref{eqn:commonValues-2}.
\end{document}


but result is useless:

it seems that the (la)text on this way defend itself from illogical use of their math environments. more details, how it doing this, can explain authors of amsmath˙ package. maybe some of them will respond :-)