2

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}
| improve this question | | | | |
  • 1
    lipsum is causing some extra space. Use \lipsum*[2] and don't leave blank line between it and align. – Sigur Apr 9 '15 at 18:24
11

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}
| improve this answer | | | | |
  • this is really new for me (\par befor align) is it a bug or features? – touhami Apr 9 '15 at 18:47
  • @touhami: The idea is to avoid it. Or what do you mean? – Werner Apr 9 '15 at 18:48
  • As you said. I should not leave a blank line before align? – touhami Apr 9 '15 at 18:54
  • 1
    @touhami: Correct. The same goes before any display math equation (equation, equation*, \[..\]). – Werner Apr 9 '15 at 18:56

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.