ACM Baseline – How to Make Acmart Stop Complaining About \baselinestretch

acmartbaseline

I have a document in acmart style, which uses some old package. This package modifies baselinestretch somehow. In the end, I see this in the log:

Class acmart Error: An attempt to redefine \baselinestretch detected. 
Please do not do this for ACM submissions!.

What would be a reasonable workaround? I can't change the package. I just want acmart to stop printing this error message. I also don't want to modify acmart.cls. It seems that that I should add something right before \end{document} to reset this length back to what acmart expects…

The code I have is this:

\documentclass[sigplan,nonacm]{acmart}
\usepackage{oz}
\begin{document}
Hello, world!
\end{document}

Best Answer

The default definition of \baselinestretch in the LaTeX kernel is empty and the oz package wants to modify the kernel macro \@setfontsize in such a way that also the internal \zedbaselineskip parameter is adjusted at each font size change. It does

\def\@setfontsize#1#2#3{\@nomath#1%
    \ifx\protect\@typeset@protect
      \let\@currsize#1%
    \fi
    \fontsize{#2}{#3}\selectfont
\setlength{\zedbaselineskip}{\baselineskip/\real{\baselinestretch}}%
    \zedbaselineskip\zedbaselinestretch\zedbaselineskip
    \setbox\zstrutbox\hbox{\vrule height.7\zedbaselineskip
    depth.3\zedbaselineskip width\z@}}

where the part from \setlength is added. It's pure luck that \@setfontsize hasn't been changed in the last 23 years… Anyway, the problem is the division by \baselinestretch, so the packages takes the initiative to do

\def\baselinestretch{1}

Well, it was a very unfortunate decision, in my opinion, just to avoid a simple conditional, see the proposed fix.

The acmart class sets \baselinestretch to 1.25 and refuses to compile if the value is changed. So you must reset the baseline stretch to the previous value after loading oz, or the appearance of the document will not conform the ACM standards.

Since you probably use the package oz also in other documents, you should also fix it so that it does not take inappropriate initiatives such as changing \baselinestretch without warning.

\documentclass{acmart}
\usepackage{lipsum} % just for this example

\let\savedbaselinestretch\baselinestretch
\usepackage{oz}
\let\baselinestretch\savedbaselinestretch

% fix the bad part in oz.sty
\makeatletter
\def\@setfontsize#1#2#3{%
  \@nomath#1%
  \ifx\protect\@typeset@protect
    \let\@currsize#1%
  \fi
  % addition by oz.sty
  \fontsize{#2}{#3}\selectfont
  \ifx\baselinestretch\@empty
    \setlength{\zedbaselineskip}{\baselineskip}%
  \else
    \setlength{\zedbaselineskip}{\baselineskip/\real{\baselinestretch}}%
  \fi
  \zedbaselineskip\zedbaselinestretch\zedbaselineskip
  \sbox\zstrutbox{%
    \vrule height.7\zedbaselineskip depth.3\zedbaselineskip width\z@
  }%
}
\makeatother

\begin{document}

\lipsum[1]

\begin{schema}{BirthdayBook}
    known: \pset NAME \\
    birthday: NAME \pfun DATE
\ST
    known = \dom birthday
\end{schema}

\end{document}

enter image description here

The output with the “fix” proposed by David Carlisle would be

enter image description here

which would probably cause rejection of your submission anyway.

Related Question