[Tex/LaTex] Remove vertical space around align equations

alignspacing

Formed with the alignment occurs in the equation some gaps.

I tried to indicate with red arrows.

enter image description here

This is without gaps like I mentioned with the ellipse how can i do?

Sorry for my English.

\documentclass[10pt,a4paper,twocolumn]{extarticle}

\usepackage{amsmath,lipsum}

\begin{document}

\noindent \lipsum[2] 
\begin{align*}
       & x_1+x_2+x_3+x_4 \leq 10 \\
       & x_5+x_5 \leq 8 \\
       & x_7+x_8 \leq 5 
     \end{align*}

\noindent \lipsum[4]

{\centering $x_1+x_2+x_3+x_4 \leq 10$

$x_2+x_3 \leq 8$

$x_1+x_3 \leq 5$ \\}

\noindent \lipsum[1]

\end{document}

Best Answer

Your example is somewhat flawed, as lipsum inserts a \par at the end of every paragraph. As such, you're actually left with an empty line before the align (a display math equation) - something you should avoid. One way to avoid this is to load lipsum with the nopar option:

\usepackage[nopar]{lipsum}

Alternatively, use \lipsum*[<nums>].

Now for the real changes:

Space above/below a display math equation is regulated by 4 different lengths: Two for the space above and two below. For each of these locations, the two lengths are dependent on whether the preceding/following line is short or not.

\abovedisplayskip% Default: 12pt plus 3pt minus 9pt
\abovedisplayshortskip% Default: 0pt plus 3pt
\belowdisplayskip% Default: 12pt plus 3pt minus 9pt
\belowdisplayshortskip% Default: 7pt plus 3pt minus 4pt

You can adjust these to suit your needs, of course. Finally, align uses a length \jot that influences the space between the multi-line equation. Adjust \jot to suit your needs as well.

Here's a minimal example that completely removes any spaces around the align as well as the inter-equation spacing (effectively setting all of the above-mentioned lengths to 0pt):

enter image description here

\documentclass[twocolumn]{extarticle}
\usepackage[nopar]{lipsum}
\usepackage{amsmath}

\begin{document}

\lipsum[2] 
\begin{align*}
  x_1+x_2+x_3+x_4 &\leq 10 \\
  x_5+x_5         &\leq 8 \\
  x_7+x_8         &\leq 5 
\end{align*}
\lipsum[4]

\setlength{\abovedisplayskip}{0pt}%
\setlength{\belowdisplayskip}{0pt}%
\setlength{\abovedisplayshortskip}{0pt}%
\setlength{\belowdisplayshortskip}{0pt}%
\setlength{\jot}{0pt}% Inter-equation spacing
\lipsum[2] 
\begin{align*}
  x_1+x_2+x_3+x_4 &\leq 10 \\
  x_5+x_5         &\leq 8 \\
  x_7+x_8         &\leq 5 
\end{align*}
\lipsum[4]

\end{document}