2

When you use the \intertext in the \align* environment with the amsmath package, it has a small vertical space between the displayed text and equation even though it is still coded on the same line as the equation.

In a regular line of code, you can type \intertext{text} (generic equation) on the one line. Yet, when it is compiled, it visual output shows a small vertical space between the text and the equation that I did not add manually.

I am using \intertext because it is left-aligned and I don't want the equation itself to be left-aligned, just the text, but it should also be on the same displayed line as the \intertext.

Werner
  • 603,163
user14554
  • 155
  • 3
    Please, please, please show us a short compilable code resulting in your issue. Please learn from older comments, I asked you to do so in your last question too ... Simply help us to help you! – Mensch Jan 06 '19 at 02:28
  • 2
    @user14554: It's not clear what you mean by \intertext being on the same line as the math display. Are you talking about your code, or the output? If you just want some textual display, use \text, not \intertext. – Werner Jan 06 '19 at 02:43
  • 2
    @user14554: Stick to the script. You have a problem and we're here to solve it. Can you answer my question? – Werner Jan 06 '19 at 02:48
  • 2
    @user14554: Okay, so you use \intertext and it inserts a (vertical) gap. That's what it's meant to do. If that's not what you want, then what do you want? Do you just want to insert text? Then use \text as I suggested... – Werner Jan 06 '19 at 02:50
  • I want it to not insert a vertical gap because I see no alternative to forcing inter-equational text to be left-aligned. The \text command will automatically center with the rest of the columns in the output instead of keeping the text left aligned, and when I try using \flalign inside a \text command, I get an error. – user14554 Jan 06 '19 at 02:51
  • 1
    @user14554: You want non-left-aligned \intertext it seems. \text doesn't centre its contents. – Werner Jan 06 '19 at 02:53
  • I do want left-aligned \intertext, I just don't want the vertical gap that it for some reason automatically has. If there was a command that did exactly what \intertext did but without the vertical gap, that would solve the problem. – user14554 Jan 06 '19 at 02:54

1 Answers1

2

If \intertext inserts too much vertical space between the equation components, then consider using \shortintertext from mathtools:

enter image description here

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{align*}
           f(x) &= ax^2 + bx + c \\
  ax^2 + bx + c &= f(x)          \\
\intertext{here is some \texttt{intertext}}
           f(x) &= ax^2 + bx + c \\
  ax^2 + bx + c &= f(x)          \\
\shortintertext{here is some \texttt{short intertext}}
           f(x) &= ax^2 + bx + c \\
  ax^2 + bx + c &= f(x)          \\[-.8\normalbaselineskip]
\intertext{here is some \texttt{intertext}} \\[-2.2\normalbaselineskip]
           f(x) &= ax^2 + bx + c \\
  ax^2 + bx + c &= f(x)
\end{align*}  

\end{document}

If you really don't like the space around either, you can use the optional argument of \\[<len>] to insert negative vertical space and shrink the gap to suit your needs (the last option in the above code).

Werner
  • 603,163
  • It seems shortintertext has the same problem of creating a vertical gap. I tried copying and pasting \\[<len>] inside the align* environment in different locations but all I got was the error "treated as zero" or "misplaced tab character". – user14554 Jan 06 '19 at 03:06
  • 1
    @user14554: You need a length where I have <len>; something like \\[-20pt]. – Werner Jan 06 '19 at 03:08
  • Okay then, \\[<length>pt] seems to do the trick, but is there anything that specifies exactly how big the \intertext or \shortintertext vertical gap is to completely get rid of it without adding too much space? All I want is to get rid of the gap that \intertext causes, going over that would likely cause errors down the document. – user14554 Jan 06 '19 at 03:11
  • @user14554: \intertext inserts a gap of \belowdisplayskip above it and \abovedisplayskip below it. \shortintertext uses a default 3pt above and below. – Werner Jan 06 '19 at 03:15
  • 3pt is much to small to close the gap, but -30 in the \\[...] seems aligned. Is -30pt what you meant? It's a good guess but the real spacing could be 35pt or 29pt, the ams manual doesn't seem to specify. – user14554 Jan 06 '19 at 03:37