# \Q{foo-bar} command from examplep package produces 'rm'

I have freshly installed new Windows machine on which I've installed my typical combo of MiKTeX (release 2.9.7350), TeXnicCenter (2.02) and Sumatra which I've been using for years. Unfortunately something is terribly wrong with using examplep package. For example:

\documentclass{article}
\usepackage[Q=yes]{examplep}

\begin{document}

Foo \Q{bar}. Whatever I put into \Q{becomes just a rm}.

\end{document}


produces:

Whatever I put as an argument of \Q{} command becomes just 'rm'. It is typed with proper monospaced font though. verbatim environment works fine however in my text I use a lot of \Q{} to cite source code commands and arguments inline in regular text, tables, etc.

I've tried this on fresh windows on virtual machine with the same result. I've tried to use other editors (TeXworks). Reinstallation of MiKTeX doesn't help - either for single user or all users. I've remover MiKTeX and installed TeX Live with the same result. How do I diagnose what is wrong?

• the behaviour changed in texlive 2019, texlive 2018 shows the text you expect 2019 and 2020 show rm – David Carlisle Apr 18 at 1:17
• Thank you for the confirmation. It is past 3 am where I live so I was not sure of my senses any more seeing such strange behaviour. I suspected that the cause may be just the new LaTeX implementation which may contain some bug or there is a bug in examplep which manifests itself in newer LaTeX releases. I'll try with older one tomorrow. Thanks! – piast99 Apr 18 at 1:25
• yep its half 2 here as well, good night (the package hasn't changed so a latex change has affected it, but too late to trace now) – David Carlisle Apr 18 at 1:28

The package is faulty. It stores something in a temporary command (\reserved@a), then calls a font command, and then continues with the processing by using \reserved@a.

But \reserved@a is not a protected command, it is used in many places and assuming that it still has the right content after a call of external code is wrong. As the font commands of LaTeX have changed (and now affect \reserved@a), this bug now has a visible effect.

One can demonstrate the problem also in older system by redefining the font command:

\documentclass{article}
\usepackage[Q=yes]{examplep}
\makeatletter
\def\pexa@cverb@@verbatimfont{\def\reserved@a{XXXX}}
\makeatother
\begin{document}
Foo\Q{bar}.
\end{document}


You get rm as output as this is what the font commands leave in \reserved@a after the processing:

\documentclass{article}
\begin{document}
\makeatletter
\def\reserved@a{XXXX} \reserved@a \ttfamily abc \reserved@a
\end{document}


• Nice job! What would be the solution? Is it just the bad practice or just unfortunate collision of commands? Would the replacement of \reserved@a and \reserved@b from the package code to for example \reserved@examplepa to give it a bit more unique name be an acceptable solution? I've liked the \Q command an I would like not to convert all my documents back to use \verb instead... – piast99 Apr 18 at 11:22
• The solution is to ask the author to correct the code, and yes this means replacing some of the \reserved@ (and perhaps other temporary commands by package specific commands. But the code is over 2000 lines long, so don't expect me to find all places. – Ulrike Fischer Apr 18 at 13:01
• Thank you. I've notified the author about the issue already pointing to this discussion. I absolutely did not expect you to make the changes. I asked about it just out of the curiosity, – piast99 Apr 18 at 13:11
• I put the package source on GitHub at github.com/koppor/examplep to enable collecting all issues and fixes. - Since the package has difficulties with UTF-8, I'm evaluating other alternatives (all listed at the CTAN topic macro-demo - ctan.org/topic/macro-demo). – koppor May 9 at 11:16