1

I am trying to change the font size of the achemso document class, and I came across this snippet of code on the second answer here: Is it possible to use 12 pt font size in the achemso package?

\let\titlefont\undefined
\makeatletter
\let\l@addto@macro\relax
\makeatother
\usepackage[fontsize=10pt]{scrextend}

It accomplishes the goal just fine, but I want to understand what the various lines are doing. I get that \let\titlefont\undefined is un-defining the title font of KOMA-script to avoid clash with achemso. I'm also okay with the \makeatletter \makeatother lines and the \usepackage line. But what is the \let\l@addto@macro\relax line doing? It seems to work with or without it. I tried researching \l@addto@macro, but all I could find is information on \g@addto@macro; what's the difference?

11
  • Normally \g@addto@macro changes the definition of the macro globally, while \l@addto@macro does so locally. Usage looks like this \newcommand\foo{bar}\l@addto@macro\foo{baz} and then the replacement text of \foo is barbaz.
    – Skillmon
    Sep 13, 2023 at 20:35
  • I doubt that the l@addto-line is still needed (and it is unclear if it was ever needed). Leave out. But as said in the other answer: it doesn't make sense to use a class like achemso and to change it. Sep 13, 2023 at 20:39
  • @Skillmon: In the usage above, then, is it adding \relax to the \let command for just this document (since it was local and not global)? Am I understanding that correctly? Many thanks! Sep 13, 2023 at 20:47
  • @UlrikeFischer: The line definitely seems to not be required. Thanks for confirming. The only reason that I wanted to change the font size was to save paper when printing for my supervisor. Sep 13, 2023 at 20:50
  • 1
    By the way, I doubt very much that such a code would have worked correctly, because \l@addto@macro is a macro with two arguments and that redefinition would leave the two arguments in the input stream.
    – egreg
    Sep 13, 2023 at 20:59

1 Answer 1

1

That code between \makeatletter and \makeatother is wrong and should be used nowhere.

If you try without that line, you'll see no difference at all.

The komascript classes and packages use \l@addto@macro in a few places. In scrextend.sty it's used once:

\newcommand\deffootnote[4][]{%
  \expandafter\ifnum\scr@v@is@ge{3.22}\relax
    \long\def\@makefntext##1{%
      \ExecuteDoHook{footnote/text/begin}%
      \raggedfootnote
      \leftskip #2
      \l@addto@macro\@trivlist{%
        \ifnum\@listdepth=\@ne\advance\leftmargin #2\relax\fi
      }%
      \parindent #3\noindent
  [...code not relevant...]
}

The macro is supposed to take two arguments and making it equivalent to \relax would leave those arguments in the input stream as soon as \deffootnote is used and later a footnote is processed, so executing \@trivlist at an unexpected and wrong place. For completeness of description, the second argument would do nothing, because the assignment would be executed in a group anyway.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .