0

I'm writing my thesis and I need to give more vertical spacing before and after environments, for only the equation* (i.e \begin{equation*}, \end{equation*}). This question has the same name as this one. Of course I tried using the proposed solution by @memin, and works great for the equation environment, but I just couldn't apply it for the equation*, which is the one I'm asking for. Does anyone know how to do this? I'd really appreciate some help. Thanks in advance.

MWE:

\documentclass[11pt,a4paper,twoside,openright]{report}

\usepackage[spanish,es-lcroman]{babel}
\addto\shorthandsspanish{\spanishdeactivate{~<>}}

\usepackage[utf8x]{inputenc}
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{etoolbox}
\usepackage{lipsum}
\usepackage{mathrsfs}

\let\oldequation=\equation
\let\endoldequation=\endequation
\renewenvironment{equation}{\vspace{0.25cm}\begin{oldequation}}{\end{oldequation}\vspace{0.25cm}}

\begin{document}
\selectlanguage{spanish}

\chapter{Física cuántica}

\lipsum[1] \noindent\textbf{Nice \underline{\texttt{equation}} spacing:}

\begin{equation}
E\Psi=\dfrac{-\hslash^2}{2m}\cdot \dfrac{d^2\Psi}{dx^2}+ V(x)\cdot \Psi
\end{equation}

\lipsum[2-4]\noindent\textbf{Horrible \underline{\texttt{equation*}} spacing:}

\begin{equation*}
\int\limits_{-\infty}^{\infty} ||\Psi||^2 \,dx=1
\end{equation*}

\lipsum[3]

\end{document}
Jorge V
  • 189
  • You should look at the answer that is not accepted in the question that you reference, it is a much better answer than the accepted one... – David Carlisle Dec 03 '16 at 23:14

2 Answers2

3

Firstly you should never have a blank line before a display equation

\lipsum[1] 

\textbf{Nice \underline{\texttt{equation}} spacing:}
\begin{equation}

not

\lipsum[1] \noindent\textbf{Nice \underline{\texttt{equation}} spacing:}

\begin{equation}

then the space before and after display math is controlled by the lengths

   \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
   \abovedisplayshortskip \z@ \@plus3\p@
   \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
   \belowdisplayskip \abovedisplayskip

(with their default values in 10pt article class).

so if you use

\setlength \abovedisplayskip{3cm plus 1cm minus 1cm}

you will get a lot more space above equations.

David Carlisle
  • 757,742
  • Thank you DavidCarlisle for your answer, I'll take your advice of the spacing between text and equations. In this case the answer from Bernard is more complete, I can use that code for all the equation* environment, which is what I was asking for. – Jorge V Dec 05 '16 at 16:12
  • @JorgeV seems odd to patch equation or equation* to add a \vspace when the environment already has a length parameters controlling the space before and after, but accept whichever answer works for you:-) – David Carlisle Dec 05 '16 at 16:46
1

If you want only equation* to have a larger vertical spacing, it's easy to do with etoolbox. Note that, if you load mathtools, you don't have to load amsmath — the former does it for you.

\documentclass[11pt,a4paper,twoside,openright]{report}

\usepackage[spanish,es-lcroman]{babel}
\addto\shorthandsspanish{\spanishdeactivate{~<>}}
\usepackage{geometry}
\usepackage[utf8x]{inputenc}
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{etoolbox}
\usepackage{lipsum}
\usepackage{mathrsfs}


\usepackage{etoolbox}
\AtBeginEnvironment{equation*}{\vspace*{0.25cm}}
\AtEndEnvironment{equation*}{\vspace*{0.25cm}}

\begin{document}
\selectlanguage{spanish}

\chapter{Física cuántica}

\lipsum[1] \noindent\textbf{Horrible \underline{\texttt{equation}} spacing:}
\begin{equation}
  E\Psi=\dfrac{-\hslash²}{2m} · \dfrac{d²Ψ}{dx²}+ V(x) · \Psi
\end{equation}
\lipsum[2]\noindent\textbf{Nice \underline{\texttt{equation*}} spacing:}
\begin{equation*}
  \int\limits_{-∞}^{∞} ||\Psi||² \,dx=1
\end{equation*}
\lipsum[3]

\end{document} 

enter image description here

Bernard
  • 271,350