3

The below-intertext-sep in mathtools package doesn't work correctly.
I use this example:

\documentclass[12pt]{report}
\usepackage{mathtools}
\begin{document}
\mathtoolsset{%
below-shortintertext-sep = 28pt,above-shortintertext-sep =1pt,
below-intertext-sep = 2pt,
above-intertext-sep =18pt
}
\begin{align*}
a &< b+c \\
\shortintertext{text text text text text text text text text text text text }
b &< a+c 
\end{align*}
\begin{align*}
a &< b+c \\
\intertext{text text text text text text text text text text text text }
b &< a+c 
\end{align*}
\end{document}

Thanks for your responsibility.
enter image description here

4
  • Going through the code, I see it \l_MT_below_intertext_sep being set, but I don't see it being used anywhere. – John Kormylo Jan 7 '18 at 21:43
  • I filed a bug report to the maintainers of mathtools. – egreg Jan 8 '18 at 9:48
  • Peace be upon you my dear egreg. – SH.Madadpour Jan 8 '18 at 10:05
  • @SH.Madadpour The bug has been fixed! :-) – egreg Jan 10 '18 at 11:46
2

Update

With mathtools version v1.21, released 2018-01-08, the following document prints exactly like the example below, showing that the bug has been fixed.

\documentclass[12pt]{report}
\usepackage{mathtools}

\mathtoolsset{%
  below-shortintertext-sep = 28pt,
  above-shortintertext-sep =  1pt,
  below-intertext-sep = 50pt,
  above-intertext-sep =  0pt,
}

\begin{document}

Some text to separate alignments from each other and to see them
in context. Let's make it long enough to split across two lines.
\begin{align*}
a &< b+c \\
\shortintertext{text text text text text text text text text text text text }
b &< a+c 
\end{align*}
Some text to separate alignments from each other and to see them
in context. Let's make it long enough to split across two lines.
\begin{align*}
a &< b+c \\
\intertext{text text text text text text text text text text text text }
b &< a+c 
\end{align*}
Some text to separate alignments from each other and to see them
in context. Let's make it long enough to split across two lines.
\end{document}

Original answer (before the bug fix)

It's a bug in mathtools.sty; the definition of \intertext is indirect (so \intertext can only be used in certain places) and uses \l_MT_above_intertext_sep also at the end, where it should be \l_MT_below_intertext_sep.

\def\MT_intertext: {%
  \def\intertext##1{%
    \ifvmode\else\\\@empty\fi
    \noalign{%
      \penalty\postdisplaypenalty\vskip\belowdisplayskip
      \vskip-\lineskiplimit      % CCS
      \vskip\normallineskiplimit % CCS
      \vskip\l_MT_above_intertext_sep
       \vbox{\normalbaselines
         \ifdim
           \ifdim\@totalleftmargin=\z@
             \linewidth
           \else
             -\maxdimen
           \fi
         =\columnwidth
        \else \parshape\@ne \@totalleftmargin \linewidth
        \fi
        \noindent\ignorespaces##1\par}%
      \penalty\predisplaypenalty\vskip\abovedisplayskip%
      \vskip-\lineskiplimit      % CCS
      \vskip\normallineskiplimit % CCS
      \vskip\l_MT_above_intertext_sep
   }%
 }%
 \MH_let:NwN \shortintertext \shortintertext@
}

There is another problem: you have to state original-intertext=false. Here is a set of patches and the output.

\documentclass[12pt]{report}
\usepackage{mathtools}
\usepackage{xpatch}

\MHInternalSyntaxOn
\xpatchcmd{\MT_intertext:}
 {\l_MT_above_intertext_sep}
 {\nonexistentmacro}
 {}{}
\xpatchcmd{\MT_intertext:}
 {\l_MT_above_intertext_sep}
 {\l_MT_below_intertext_sep}
 {}{}
\xpatchcmd{\MT_intertext:}
 {\nonexistentmacro}
 {\l_MT_above_intertext_sep}
 {}{}
\MHInternalSyntaxOff

\mathtoolsset{%
  original-intertext=false,
  below-shortintertext-sep = 28pt,
  above-shortintertext-sep =  1pt,
  below-intertext-sep = 50pt,
  above-intertext-sep =  0pt,
}

\begin{document}

Some text to separate alignments from each other and to see them
in context. Let's make it long enough to split across two lines.
\begin{align*}
a &< b+c \\
\shortintertext{text text text text text text text text text text text text }
b &< a+c 
\end{align*}
Some text to separate alignments from each other and to see them
in context. Let's make it long enough to split across two lines.
\begin{align*}
a &< b+c \\
\intertext{text text text text text text text text text text text text }
b &< a+c 
\end{align*}
Some text to separate alignments from each other and to see them
in context. Let's make it long enough to split across two lines.
\end{document}

enter image description here

2
  • Updated version is sent off to CTAN. The reason why original-intertext=false, is necessary for the patch is that, we internally use \MT_intertext: via a \let construction, so unless original-intertext=false,, that \let information is never updated (should probably have used a \def instead of a \let....) – daleif Jan 8 '18 at 11:49
  • Peace be upon you my dear daleif. – SH.Madadpour Jan 8 '18 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.