I have defined the following environment that tightens up equations of different environments, adding just one initial and one final space. For example, this code:

\documentclass{article}

\newenvironment{tight}
    {
    \vspace{\abovedisplayskip}
    \setlength{\abovedisplayskip}{0pt}
    \setlength{\abovedisplayshortskip}{0pt}
    \setlength{\belowdisplayskip}{0pt}
    \setlength{\belowdisplayshortskip}{0pt}
    }{
    \vspace{10.0pt plus 2.0pt minus 5.0pt}
    }

\setlength{\parindent}{4em}

\begin{document}

Sample text Sample text Sample text Sample text Sample text Sample text Sample text Sample text Sample text:
\begin{tight}
\begin{equation}
a = b^ 2 + c^2
\end{equation}
\begin{equation}
e^{j\theta} = \cos \theta + j \sin \theta
\end{equation}
\end{tight}
Sample text Sample text Sample text Sample text Sample text Sample text Sample text Sample text Sample text.

\end{document}

Gives this result:

enter image description here

There are two problems with the environment:

  • As you can see from the example, the last \vspace is not placing the space as intended (unless I make a new paragraph, but I do not want that).
  • I must manually define the parameters of the last \vspace, I do not know a way of saving the default skip parameters before setting them to zero.

My question is: is there a way fixing any of these problems?

up vote 3 down vote accepted

You are trying to reinvent the wheel! 😉

Doing that with \vspace is not really the best choice and moreover the spacing you get will be very uneven.

The problem is solved by using gather:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

Sample text Sample text Sample text Sample text Sample text
Sample text Sample text Sample text Sample text:
\begin{gather}
a = b^ 2 + c^2
\\
e^{j\theta} = \cos \theta + j \sin \theta
\end{gather}
Sample text Sample text Sample text Sample text Sample text
Sample text Sample text Sample text Sample text.

\end{document}

enter image description here

It is possible with a tight environment, but I can't recommend doing it.

\documentclass{article}
\usepackage{amsmath}

\newenvironment{tight}
 {%
  \vspace{\abovedisplayskip}%
  \setlength{\savedbelowdisplayskip}{\belowdisplayskip}% save the value
  \setlength{\abovedisplayskip}{0pt}%
    \setlength{\abovedisplayshortskip}{0pt}%
    \setlength{\belowdisplayskip}{0pt}%
    \setlength{\belowdisplayshortskip}{0pt}%
 }{%
   \vadjust pre{\vskip\savedbelowdisplayskip}% the dirty trick!
   \ignorespacesafterend
 }
\newlength{\savedbelowdisplayskip}

\begin{document}

Sample text Sample text Sample text Sample text Sample text 
Sample text Sample text Sample text Sample text:
\begin{tight}
\begin{equation}
a = b^ 2 + c^2
\end{equation}
\begin{equation}
e^{j\theta} = \cos \theta + j \sin \theta
\end{equation}
\end{tight}
Sample text Sample text Sample text Sample text Sample text 
Sample text Sample text Sample text Sample text.

\end{document}

enter image description here

You can get tighter spacing also with gather by setting \jot to zero, but I don't recommend it either.

\documentclass{article}
\usepackage{amsmath}

\setlength{\jot}{0pt}

\begin{document}

Sample text Sample text Sample text Sample text Sample text
Sample text Sample text Sample text Sample text:
\begin{gather}
a = b^ 2 + c^2
\\
e^{j\theta} = \cos \theta + j \sin \theta
\end{gather}
Sample text Sample text Sample text Sample text Sample text
Sample text Sample text Sample text Sample text.

\end{document}

enter image description here

  • I cannot use gather, I have cases where I have to use multline followed by align, but your environment does the trick. Thank you! – Daniel Turizo Sep 13 at 2:06

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.