# How do align intertext with math instead of an awkward space? [duplicate]

This question already has an answer here:

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.

## marked as duplicate by David Carlisle spacing StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jan 6 at 10:35

• 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 6 at 2:28
• @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 6 at 2:43
• @user14554: Stick to the script. You have a problem and we're here to solve it. Can you answer my question? – Werner Jan 6 at 2:48
• @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 6 at 2:50
• @user14554: You want non-left-aligned \intertext it seems. \text doesn't centre its contents. – Werner Jan 6 at 2:53

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

\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).

• 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 6 at 3:06
• @user14554: You need a length where I have <len>; something like \\[-20pt]. – Werner Jan 6 at 3: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 6 at 3:11
• @user14554: \intertext inserts a gap of \belowdisplayskip above it and \abovedisplayskip below it. \shortintertext uses a default 3pt above and below. – Werner Jan 6 at 3: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 6 at 3:37