I am writing a double space document, but I do not want excessive spacing between math display environments. For things like code listings I can use etoolbox
and say \AtBeginEnvironment{minted}{\setstretch{1}}
etc, is there a way to modify the stretch before / after math display?
\documentclass{article}
\usepackage{lipsum}
\usepackage[margin=0.5in]{geometry}
\usepackage{setspace}
\setstretch{2}
% kind of does the right thing, but only at the bottom...
% \everydisplay{\vspace*{-1em}}
\usepackage{amsmath}
% i think this is only for align?
% \belowdisplayskip=0pt
% this also doesn't work, just for array?
% \setlength{\jot}{-1ex}
\usepackage{etoolbox}
% is math / amsmath an environment?
\AtBeginEnvironment{math}{\setstretch{1}}
\AfterEndEnvironment{math}{\setstretch{2}}
\begin{document}
\lipsum[1]
% desired effect without manual every time
% \setstretch{1}
$$
ax + by + cz + d = 0
$$
% not really even working
% \setstretch{2}\vspace*{-2em}
\lipsum[2]
\end{document}
I want to do this globally, getting rid of the spacing denoted by the red rectangles
I feel like this has to be a duplicate, but I can't get anything I find to work :/ If it matters, the above code was pdftex but I'm writing with xetex. I don't think that makes a difference in this question, but it may.