0

I want to remove the vertical spacing before \begin{align*} so it looks like the vertical spacing before \begin{equation*}. To show a screenshot of what I mean:

spacing issue

\documentclass{article}

\usepackage{amsmath}

\begin{document}

hello. equation:

\begin{equation*}
  a + b = c \\
\end{equation*}

hello. align:

% this \vspace will fix the space issue for a single align environment, but I want a solution
% that addresses the issue for all align environments through the entire document.
%\vspace{-\baselineskip}
\begin{align*}
  a + b = c \\
\end{align*}

\end{document}

I can see this issue has been posted before here: Spacing: Align vs. Equation

This I can see the recommendation to use \vspace{-\baselineskip} in front of every single align environment. I want a solution that is done once in the header and is applied consistently throughout the entire document.

I also see the accepted answer involves colored boxes with tcolorbox: I want something simpler.

Also here: align vs equation

I see the recommendation to use:

[fleqn] option and \setlength{\mathindent}{0pt}

This doesn't work when I try it. Secondly, the fleqn option for amsmath is designed to left-align rather than center align environments which isn't what I want to do.

I presume this extra spacing is a full paragraph skip? Why does align do that and equation does not? can I remove that with the align environment?

1

You can try patching align*, inserting \useshortskip from nccmath at the very beginning, but in my opinion, it is better to use this command manually when necessary:

\documentclass{article}
\usepackage{etoolbox}
\usepackage{amsmath, nccmath}
\AtBeginEnvironment{align*}{\useshortskip}

\begin{document}

hello. equation:
\begin{equation*}
  a + b = c
\end{equation*}

hello. align:
\begin{align*}
  a + b = c
\end{align*}

\end{document} 

enter image description here

| improve this answer | |
  • Thanks! That works. Why do you say that it is better to use this command only manually when necessary? – clay Apr 13 at 20:17
  • 3
    Because, sometimes, the align environment gets too close from the text above. B. t. w., you already reduce a bit the vertical spacing if you delete the blank line between the text and the environment. – Bernard Apr 13 at 20:20
2

Just I have only used an old answer of the very good user @egreg.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{etoolbox}
\newcommand{\zerodisplayskips}{%
  \setlength{\abovedisplayskip}{0pt}%
  \setlength{\belowdisplayskip}{0pt}%
  \setlength{\abovedisplayshortskip}{0pt}%
  \setlength{\belowdisplayshortskip}{0pt}}
\appto{\normalsize}{\zerodisplayskips}
\appto{\small}{\zerodisplayskips}
\appto{\footnotesize}{\zerodisplayskips}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% addendum from https://tex.stackexchange.com/questions/47400/remove-vertical-space-around-align


\begin{document}

hello. equation:

\begin{equation*}
  a + b = c \\
\end{equation*}

hello. align:

\begin{align*}
  a + b = c \\
\end{align*}

\end{document}

enter image description here

| improve this answer | |

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.