# No line-break after align environment

Whenever one uses the align environment, a line-break is automatically inserted after it:

\documentclass[]{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
1 + 2
\end{align*}
Text
\end{document}


The same happens when using two align environments after each other (line-break in inserted between them:

\documentclass[]{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
1 + 2
\end{align*}
\begin{align*}
3 + 4
\end{align*}
\end{document}


Is there a way to prevent that from happening, i.e. from having a line-break after an align environment?

EDIT: To clarify, I am certainly not looking for a simple inline equation. I don't want the results to be in the same line, obviously. I just want to get rid of the extra blank line that separates results.

For instance, with the first code snippet above I get:

While I would want:

Similarly, with the second code snippet above I get:

While I want to have something like:

Notice, the challenge is doing that not using one single align.

• Why don't you join the aligns into a single display? – Werner Mar 21 '18 at 2:35
• What is the point of two separate align environments each of which being only one line long? Try \begin{align*} 1 + 2 \\ 3 + 4 \end{align*} or \begin{align*} 1 + 2 & & 3 + 4 \end{align*}. – user121799 Mar 21 '18 at 2:42
• @Werner There are plenty of cases in which separate aligns are useful, like when doing so FOL proofs, even if the line break is wasteful. But never mind, I made the question more general if that helps. – AndraSol Mar 21 '18 at 2:50
• In your case, an answer would be to use gather instead of align. – Werner Mar 21 '18 at 3:03
• @Werner There's still the same line-break with gather – AndraSol Mar 21 '18 at 3:07

You could use \centerline to get what you are hoping:

\documentclass[]{article}
\newcommand\myalign[1]{\centerline{$\displaystyle#1$}}
\usepackage{amsmath}
\begin{document}
\myalign{1 + 2}
\myalign{3 + 4}
\noindent text
\end{document}


And while the OP's question doesn't express the need, if you really needed the actual ability to use alignment tabs in the argument, then a TABstack is for you!

\documentclass{article}
\usepackage{tabstackengine}
\TABstackMath
\TABstackMathstyle{\displaystyle}
\newcommand\myalign[1]{\centerline{\alignShortstack{\strut#1\strut}}}
\usepackage{amsmath}
\begin{document}
\myalign{1 + 2}
\myalign{y =&3 + 4\\y_1=&4x + 15\\y+y_1 =& 0}
\noindent text
\end{document}


align, like \[ is a display environment so it always takes the full width of the text block, so it's not really possible to ask for there not to be a linebreak as there is no space after the environment.

You should never start a paragraph with a display environment or have one directly after another, TeX inserts a spurious "blank paragraph" in those cases.

It seems that you want inline math so

\documentclass[]{article}
\usepackage{amsmath}

\begin{document}
$1 + 2$
and
$3 + 4$ and more on the line
\end{document}

• Thanks for your answer, but that is not what I was talking about. What I want to achieve is exactly, as described, to have an align followed by either text or by another align without the extra line-break. That is, without a wasteful blank line. – AndraSol Mar 23 '18 at 2:13
• Edited the question and added pictures for clarification. – AndraSol Mar 23 '18 at 2:27
• @AndraSol Wow!! I would never have guessed that's what you meant. Given that Text is on a new line describing that as having no linebreak after the equation is weird. No real harm done but you may consider editing to change the title of the question. there is no extra linebreak in your example, display math environments are offset by extra vertical space \abovedisplayskip and \belowdisplayskip which you can set to 0pt with \setlength – David Carlisle Mar 23 '18 at 7:40
• Many thanks, that last comment was also helpful! And sorry for the confusion. – AndraSol Mar 24 '18 at 20:18

You can use \baslineskip.

\documentclass[]{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
1 + 2
\end{align*}
\\[-2\baselineskip]
Text
\end{document}

• Your solution works for the case of align followed by text, but curiously not for align followed by another align. – AndraSol Mar 23 '18 at 2:11