Math & ScienceVertical space around display equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Promethean
Posts: 7
Joined: Mon Apr 25, 2011 9:13 pm

Vertical space around display equations

Post by Promethean »

I am trying to reduce vertical space around display (and eqnarray) equations in order to save space. For testing purposes, I have included the following commands in my preamble:

Code: Select all

\setlength\abovedisplayskip{-12pt}
\setlength\belowdisplayskip{-12pt}
\setlength\abovedisplayshortskip{-12pt}
\setlength\belowdisplayshortskip{-12pt}
This does not seem to affect the spacing around equations at all. Do you see why this might be? I am using LyX and the AMS math packages. My full preamble is as follows:

Code: Select all

\documentclass[12pt,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2cm,rmargin=3cm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{color}
\usepackage{babel}

\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{amssymb}
\usepackage{esint}
\usepackage{nomencl}
% the following is useful when we have the old nomencl.sty package
\providecommand{\printnomenclature}{\printglossary}
\providecommand{\makenomenclature}{\makeglossary}
\makenomenclature
\onehalfspacing
\usepackage[unicode=true, 
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false]
 {hyperref}
\hypersetup{pdftitle={...},
 pdfauthor={...}}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\lhead{...}
\chead{...}

\usepackage{multicol}
\usepackage{mathptmx}

\usepackage[absolute, overlay]{textpos}
\TPGrid{100}{100}
\textblockorigin{0mm}{0mm}


\clubpenalty = 10000
\widowpenalty = 10000 \displaywidowpenalty = 10000

\renewcommand\nomname{...}

\renewcommand\refname{\vspace{-12pt}}

\usepackage[small,compact]{titlesec}
\usepackage[small,it]{caption}
\usepackage[normalsections, normalmargins, normalleading, normalbib, normalbibnotes]{savetrees}

%for title page
\def\clap#1{\hbox to 0pt{\hss #1\hss}}%
\def\ligne#1{%
  \hbox to \hsize{%
    \vbox{\centering #1}}}%
\def\haut#1#2#3{%
  \hbox to \hsize{%
    \rlap{\vtop{\raggedright #1}}%
    \hss
    \clap{\vtop{\centering #2}}%
    \hss
    \llap{\vtop{\raggedleft #3}}}}%
\def\bas#1#2#3{%
  \hbox to \hsize{%
    \rlap{\vbox{\raggedright #1}}%
    \hss
    \clap{\vbox{\centering #2}}%
    \hss
    \llap{\vbox{\raggedleft #3}}}}%

\usepackage[firstpage]{draftwatermark}
\SetWatermarkScale{2}
\SetWatermarkText{Draft: \today}
\SetWatermarkFontSize{36pt}
\SetWatermarkLightness{0.8}

\setlength\abovedisplayskip{-12pt}
\setlength\belowdisplayskip{-12pt}
\setlength\abovedisplayshortskip{-12pt}
\setlength\belowdisplayshortskip{-12pt}

\makeatother

\begin{document}
If there are packages that can solve this problem for me or even have more space saving functions (like savetrees), suggestions would be welcome.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10326
Joined: Mon Mar 10, 2008 9:44 pm

Vertical space around display equations

Post by Stefan Kottwitz »

Hi Promethean,

welcome to the board!

As those lengths depend on the font size, size changing commands change also those lengths. You could redefine those commands such as \normalsize.

In this earlier post there's an explanation with code for that: Can't set vertical whitespace in the preamble.

Btw. don't use eqnarray, this environment is obsolete and doesn't work well, for example regarding the spacing. Since you use amsmath, use align instead. See eqnarray vs. align for further explanation.

Stefan
LaTeX.org admin
Promethean
Posts: 7
Joined: Mon Apr 25, 2011 9:13 pm

Re: Vertical space around display equations

Post by Promethean »

Thanks, that is perfect! This seems to be a frequently asked question, which, according to my Googling, rarely receives a competent answer. There should be a package that does this.
Post Reply