# Is it necessary to give a \\ before \intertext?

I am not sure which one is correct when using \intertext or \shortintertext. Adding \\ before them or not.

\documentclass[preview,border=12pt]{standalone}
\usepackage{amsmath}
\begin{document}
\section*{Without a line break }
\begin{gather*}
E = mc^2
\intertext{Multiply both side by 2, we have}
2E = 2mc^2
\end{gather*}

\section*{With a line break}
\begin{gather*}
E = mc^2\\
\intertext{Multiply both side by 2, we have}
2E = 2mc^2
\end{gather*}
\end{document}


I don't see any differences. Or there is something wrong with my eyes. So the question is: Is it necessary to give a \\ before \intertext or \shortintertext?

-
According to amsmath documentation: "\intertext may only appear right after a \\ or \\* command", but it seems to work without as well... –  karlkoeller Nov 10 '13 at 6:44
@karlkoeller: That is why I am always confused with it when writing... –  Please don't touch Nov 10 '13 at 6:48

For \intertext to work, it has to be in vertical mode, which means it should follow \\. However, \intertext does a check to see whether this is the case (...\ifvmode\else\\\@empty\fi...). If not, it attempts to insert it. As such, the use of it may be considered cautiously optional.

From the amsmath documentation (p 33 onward):

The \intertext command is used for inserting text between the rows of an alignment. It might better be done as an environment, but the \begingroup from \begin would cause the \noalign to fail.

\newcommand{\intertext}{\@amsmath@err{\Invalid@@\intertext}\@eha}


\intertext@ is called by all environments that allow the use of the \intertext command.

\def\intertext@{%
\def\intertext##1{%


If current mode is not vmode, the most likely reason is that the writer forgot the \\ that is supposed to precede \intertext. All right, then, let's try adding it our ownself. But, to be slightly careful: \\ does a futurelet, and it's slightly dangerous to allow a letted token to barge around loose in our internal code when it has been let to a conditional token like \fi. So let's interpose something in front of the \fi for the futurelet to take instead. (And careful again: it has to be something evanescent, not (e.g.) \relax which would cause the next halign cell to fire up and keep \noalign from working.)

    \ifvmode\else\\\@empty\fi
\noalign{%
\penalty\postdisplaypenalty\vskip\belowdisplayskip
\vbox{\normalbaselines


We need to do something extra if the outside environment is a list environment. I don't see offhand an elegant way to test "are we inside any list environment" that is both easy and reliable (for example, checking for zero \@totalleftmargin wouldn't catch the case where \@totalleftmargin is zero but \linewidth is less than \columnwidth), so it seems to me checking \linewidth is the best practical solution.

         \ifdim\linewidth=\columnwidth
\else \parshape\@ne \@totalleftmargin \linewidth
\fi
\noindent##1\par}%
\penalty\predisplaypenalty\vskip\abovedisplayskip%
}%
}}

-