IACR / latex

Latex classes for IACR publications. We will start with the new journal proposal.
9 stars 2 forks source link

`\title` fails if there are macros in the full title and `plaintext` is provided but `running` is not provided #247

Closed GeeLaw closed 7 months ago

GeeLaw commented 7 months ago

Modify the template.tex downloaded from IACR:

% Change this
\title[running  = {The iacrcc class},
       subtitle = {A Template}
      ]{How to Use the IACR Communications in Cryptology Class}

% to this
\title[% running  = {The iacrcc class},
       % subtitle = {A Template},
       plaintext = {How to Use the IACR Communications in Cryptology Class}
      ]{How to Use the IACR Communications in Cryptology \textit{Class}}

Compilation with MiKTeX pdfLaTeX on Windows fails:

This is pdfTeX, Version 3.141592653-2.6-1.40.25 (MiKTeX 23.5) (preloaded format=pdflatex 2023.9.1)  7 APR 2024 18:17
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**./template.tex
(template.tex
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-08-11>
(iacrcc.cls

...

! Argument of \reserved@a has an extra }.
<inserted text> 
                \par 
l.35 ...mmunications in Cryptology \textit{Class}}

The documentation does not state that running is necessary if there are macros in the full title, only plaintext. The workaround is to set running even if it is the same as the full title.

\title[running  = {IACRCC \textit{Class}},
       % subtitle = {A Template},
       plaintext = {IACRCC Class}
      ]{IACRCC \textit{Class}}
jwbos commented 7 months ago

Thanks for reporting! This sounds indeed like a bug. I will investigate this week.

jwbos commented 7 months ago

The problem is with \StrLen which tries to expand the title when counting the length (of the title). A simple fix is to use \noexpandarg\StrLen. I will push a fix after some further testing tomorrow. Thanks for catching this!

jwbos commented 7 months ago

In slightly more details. When the running title is not specified the plain title is used as the running title. However, the style file checks if the plain title is too long (over 70 characters) since then we ask the author to provide a running title explicitly. The problem here is that this checking is done with StrLen from the xstring package. Section 3.1.2 from the xstring manual indeed specifies that macros are not allowed since they are by default expanded. The solution is to use \noexpandarg, the downside is that the characters of the macro itself are counted in the string length but this is (imo) not a big deal.

jwbos commented 7 months ago

Fixed in cb307197bd98048ad16d8b6ce1657d8a4b6d5734.