5

Since I performed an update of MiKTeX yesterday, acronyms containing \hyp{} do not work correctly in captions anymore. I get the following error message:

! Argument of \__tl_change_case_cs_four:w has an extra }.

The update comprised the following packages including the acro package:

acro.tar.lzma
beamer.tar.lzma
bidi.tar.lzma
glossaries.tar.lzma
koma-script.tar.lzma
l3kernel.tar.lzma
luamplib.tar.lzma
miktex-bibtex8bit-bin-2.9.tar.lzma
miktex-dvips-bin-2.9.tar.lzma
miktex-icu-bin-2.9.tar.lzma
miktex-pdftex-bin-2.9.tar.lzma
miktex-runtime-bin-2.9.tar.lzma
miktex-texify-bin-2.9.tar.lzma
miktex-texinfo-base.tar.lzma
miktex-texinfo-bin-2.9.tar.lzma
miktex-xetex-bin-2.9.tar.lzma

I could drag the problem down to the usage of \hyp{} inside my acronyms. Surprisingly the problem occurs when using \Acl{...} but not when using \acl{...}. How can I fix the problem?

Here is a minimal example exposing the problem:

\documentclass{article}

\usepackage{acro}
\usepackage{hyphenat}

\DeclareAcronym{AB}{
  short        = AB,
  %long         = a-b, % works fine
  long         = a\hyp{}b % does not work
}

\begin{document}

% works fine with hyp
\begin{figure}
  \caption{\acl{AB}}
\end{figure}

% does not work with hyp
\begin{figure}
  \caption{\Acl{AB}}
\end{figure}

\end{document}
Gerd Kainz
  • 51
  • 2

1 Answers1

3

Due to how acro works, commands like \hyp that are defined with \DeclareRobustCommand don't work in that context and adding \protect does no good either. Switching to a different protection mechanism works.

\documentclass{article}

\usepackage{acro}
\usepackage{hyphenat}
\usepackage{etoolbox}

\robustify{\hyp} % make \hyp survive the capitalization process used by acro

\DeclareAcronym{AB}{
  short        = AB,
  %long         = a-b, % works fine
  long         = a\hyp{}b % does not work
}

\begin{document}

% works fine with hyp
\begin{figure}
  \caption{\acl{AB}}
\end{figure}

% does not work with hyp
\begin{figure}
  \caption{\Acl{AB}}
\end{figure}

\end{document}

enter image description here

egreg
  • 1,121,712