3

Is there a way to define a command like \notsoshortintertext with two parameters to define the vertical space before and after it?

The problem I have is that \intertext is to wide on a specific page resulting in a poor page break. And with the \shorintertext I get an underfull vbox. So I would like to tune the vertical space at that point. I've tried to find the definition for \shortintertext, but wasn't able to understand the quite cryptic definition in the mathtools.dtx.

3

If no spacing is still too much, you can use negative spacing.

\documentclass{article}
\usepackage{mathtools}

\MHInternalSyntaxOn
\newcommand{\adjintertext}[3]% #1=above skip, #2=below skip, #3=text
{\ifvmode\else\\\@empty\fi
  \noalign{%
    %\penalty\postdisplaypenalty\vskip\belowdisplayskip
    \vskip-\lineskiplimit      % CCS
    \vskip\normallineskiplimit % CCS
    \vskip#1
     \vbox{\normalbaselines
       \ifdim
         \ifdim\@totalleftmargin=\z@
           \linewidth
         \else
           -\maxdimen
         \fi
       =\columnwidth
      \else \parshape\@ne \@totalleftmargin \linewidth
      \fi
      \noindent#3\par}%
    %\penalty\predisplaypenalty\vskip\abovedisplayskip%
    \vskip-\lineskiplimit      % CCS
    \vskip\normallineskiplimit % CCS
    \vskip#2
 }}%
\MHInternalSyntaxOff

\begin{document}
\begin{align}
x &= a\\
\adjintertext{0pt}{0pt}{no spacing}
y &= b\\
\adjintertext{\baselineskip}{\baselineskip}{big spacing}
z &= c
\end{align}
\end{document}

variable spacing

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.