0

I have the following example:

\documentclass[journal=jacsat,manuscript=article]{achemso}

\usepackage{amsmath,amssymb}

\makeatletter

\newcommand\bsse{% \begin{singlespace}% \vspace{-\abovedisplayshortskip} \vspace*{-\abovedisplayskip} \noindent\ignorespaces }

\newcommand\esse{% \vspace{-\belowdisplayskip} \end{singlespace}% \noindent\ignorespaces }

\newcommand\bssag{% \vspace{-\abovedisplayskip} \begin{singlespace}% \noindent\ignorespaces }

\newcommand\essag{% \vspace{-\belowdisplayskip} \end{singlespace}% \noindent\ignorespaces }

\makeatother

\BeforeBeginEnvironment{equation}{\bsse} \AfterEndEnvironment{equation}{\esse} \BeforeBeginEnvironment{gather}{\bssag} \AfterEndEnvironment{gather}{\essag} \BeforeBeginEnvironment{align}{\bssag} \AfterEndEnvironment{align}{\essag}

\title{Title}

\begin{document}

Consider the following equations: % \begin{align}\label{xm_nuc} E&=mc^2, \ F&=ma, \ v&=\frac{s}{t}, \end{align} % where the symbols are familiar to all of us.

\end{document}

This code creates a large vertical space after the last equation (v=s/t). Could you please help me how I can remove exactly (not approximately) that space placed by align?

Edit:

On page Remove vertical space around align, David Carlisle provided a solution, using which I can remove the space after the equation.

\documentclass[journal=jacsat,manuscript=article]{achemso}

\usepackage{amsmath} \usepackage{etoolbox} \newcommand{\zerodisplayskips}{% \setlength{\abovedisplayskip}{0pt}% \setlength{\belowdisplayskip}{0pt}% \setlength{\abovedisplayshortskip}{0pt}% \setlength{\belowdisplayshortskip}{0pt}} \appto{\normalsize}{\zerodisplayskips} \appto{\small}{\zerodisplayskips} \appto{\footnotesize}{\zerodisplayskips}

\title{Title}

\begin{document}

Consider the following set of well-known equations: % \begin{align}\label{xm_nuc} E&=mc^2, \ F&=ma, \ v&=\frac{s}{t}, \end{align} % where the symbols are familiar to all of us.

\end{document}

However, this solution does not make the equations single-spaced.

TobiR
  • 584
  • 1
    these definitions seem.. odd why in \bsse do you subtract both abovedisplayshortskip and abovedisplayskip at the same point? TeX will never use both of these on the same equation. More generally you should never need any of these commands you never need to add a negative displayskip, just set the values to 0pt if you do not want to add the space. – David Carlisle Jan 10 '22 at 20:16
  • You are also missing several % eg after \vspace*{-\belowdisplayskip} but as I say this negatove vspace is not needed. – David Carlisle Jan 10 '22 at 20:18
  • @DavidCarlisle If I set the skip parameters to zero (abovedisplayskip, belowdisplayskip, etc.), I got larger space around the equations... Is this problem related to achemso? – TobiR Jan 10 '22 at 20:19
  • Does this answer your question? Remove vertical space around align – Imran Jan 10 '22 at 20:20
  • @Imran It seems to me that the skip commands like \setlength{\abovedisplayskip}{0pt} do not work properly in achemso enviroment. – TobiR Jan 10 '22 at 20:21
  • well obviously setting it to 0pt gives larger spacing than your \bsse which removes more space than added so might even cause the equation to over-print the preceding text. – David Carlisle Jan 10 '22 at 20:22
  • @DavidCarlisle Then what should I do to wipe out these ugly vertical spaces? – TobiR Jan 10 '22 at 20:24
  • @TobiR This is what I get with the answer of egreg after removing your definitions https://imgur.com/BYXsbFY. Do you want to get rid of this space also? – Imran Jan 10 '22 at 20:25
  • It is rather hard to guess what your issue is, but certainly I would start by removing all these definitions, I can't see how you can possibly get good behaviour especially withthe \noindent after each equation which will totally break the space after (as you see here) as it forces a blank paragraph after the equation. – David Carlisle Jan 10 '22 at 20:26
  • @DavidCarlisle OK, your answer to question https://tex.stackexchange.com/questions/47400/remove-vertical-space-around-align works, but it does not provide single-spaced equations. Could you please provide a solution to this problem? I have updated my question accordingly. – TobiR Jan 10 '22 at 20:31
  • why are you using a journal class if you don't want the publisher-specified layout? – David Carlisle Jan 10 '22 at 20:32
  • @DavidCarlisle I am using the layout selectively. It is obvious that achemso does not reflect completely the style of J. Comp. Theor. Comput, and the Production Team will format my paper in their own way. See my updated question. – TobiR Jan 10 '22 at 20:36
  • Yes but typically adding author defined layout macros complicates (or in some journals invalidates completely) the journal production of their own style, the point of the journal specified class is to give the journal process a clean known input, not to look nice. – David Carlisle Jan 10 '22 at 20:45
  • It would be good to have both. – TobiR Jan 10 '22 at 20:52

1 Answers1

2

Probably the simplest is to set the display spaces to 0pt then compensate for the double spacing by reducing the math display spacing by 9pt.

enter image description here

\documentclass[journal=jacsat,manuscript=article]{achemso}

\usepackage{amsmath,amssymb}

\AddToHook{env/align/begin}{\openup-9pt}

\title{Title}

\begin{document} \setlength{\abovedisplayskip}{0pt} \setlength{\belowdisplayskip}{0pt} \setlength{\abovedisplayshortskip}{0pt} \setlength{\belowdisplayshortskip}{0pt}

Consider the following equations: % \begin{align}\label{xm_nuc} E&=mc^2, \ F&=ma, \ v&=\frac{s}{t}, \end{align} % where the symbols are familiar to all of us.

\end{document}

David Carlisle
  • 757,742
  • Will this extension truncate those equations which are taller from these ones? – TobiR Jan 10 '22 at 20:44
  • no it just reduces baselineskip by 9pt – David Carlisle Jan 10 '22 at 20:46
  • The four setlength lines still not work with a few other equations of mine. However, when I use those lines specified in my edited answer, your solution works well. Do you know why this happens or should I add more information about the specific equations? – TobiR Jan 10 '22 at 20:52
  • @TobiR my guess would be that you have a blank line befoe the display math in teh cases where you get extra space. – David Carlisle Jan 10 '22 at 20:59
  • Thanks for your efforts. However, I found another problem with achemso spacing. Could you please give a solution for that: https://tex.stackexchange.com/questions/629824/different-vertical-spaces-around-equations-of-different-height-in-the-achemso-do? – TobiR Jan 11 '22 at 09:44