# Why does not \shortintertext command work if we load nccmath after mathtools?

If you load nccmath after mathtools and use \shortintertext, you will get an error message "Package amsmath Error: Invalid use of \shortintertext". If you load nccmath before mathtools, the error message disappears.

Is there any overlap between the two packages functionalities? Do they overlap when it comes to modifying the internal commands of the standard LaTeX?

\documentclass[]{book}

\usepackage[T1]{fontenc}

\usepackage{mathtools}
\usepackage{nccmath}

\begin{document}

\begin{align}
(A + B \thinspace C) \thinspace x + C \thinspace y &= 0,
\\
\shortintertext{Short Intertext}
E \thinspace x + (F + G) \thinspace y &= 23.
\end{align}

\end{document}


The \intertext and \shortintertext commands are only valid in certain contexts; nccmath modifies the meaning of \intertext@ (which is the internal command defined by amsmath and used also by mathtools) and eventually this conflicts with the redefinitions done by mathtools.

Solution: load nccmath before mathtools. This will remove the redefinition of \intertext done by nccmath, but it's not needed because you can use \shortintertext with similar features.

\documentclass[]{book}

\usepackage[T1]{fontenc}

\usepackage{nccmath}
\usepackage{mathtools}

\begin{document}

\begin{align}
(A + B C) x + C y &= 0,
\\
\shortintertext{Short Intertext}
E x + (F + G) y &= 23.
\end{align}

\end{document}


I removed all the \thinspace commands which are not needed and wrong anyhow: for a thin space in math mode you should use \,. But, really, it is not needed in those places.

• \thinspace is more readable in my LaTeX editor. It is shown in light olive green. \, has the same color of the rest of the math in my editor. I add these small spaces to enhance to overall appearance and readability of the document (at least this is how I feel about it) – Al-Motasem Aldaoudeyeh Aug 2 '18 at 6:56
• @Al-MotasemAldaoudeyeh It's wrong anyhow, because it inserts a (text) kern instead of a math space. – egreg Aug 2 '18 at 8:34

I guess there's some overlap in this respect, because nccmath adds an optionnal argument to the standard \intertext to specify the vertical spacing inserted above and below \intertext (p.2 of the documentation).