Quantcast
Channel: Active questions tagged starred-version - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 63

Starred version of macro causes hyperref error if used in section command

$
0
0

In the following MWE

\documentclass{article}\usepackage[T1]{fontenc}\usepackage{lmodern}\usepackage[utf8]{inputenc}\usepackage[pdftex,unicode,final]{hyperref}\input{glyphtounicode}\pdfgentounicode=1\makeatletter\newcommand*{\boilerplate}{\@ifstar\@@boilerplate\@boilerplate}\newcommand*{\@boilerplate}{Boilerplate for running text}\newcommand*{\@@boilerplate}{Boilerplate for headings in capalized form}\makeatother\begin{document}\section{\boilerplate*}\end{document}

the star is used to obtain an alternative variant of the boilerplate. The MWE fails with

Token not allowed in a PDF string (Unicode):(hyperref)                removing `\@ifnextchar' on input line 19.

Obviously, the problem is the order of macro expansions. I have already tried to play around with \expandafter but did not find a solution.

Remark: If possibly, I would like to keep the starred-version to select the variant of the boilerplate. This design has been agreed upon some time ago and is used at myriads of places. In other words changing the macro definition to something like \boilerplateNormal and \boilerplateVariant is not an option, because that would break compatibility with other authors using the sty-file.


Viewing all articles
Browse latest Browse all 63

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>