0

Using showkeys of my MikTeX 2.9, the code below

\documentclass{article}

\usepackage{showkeys}

\begin{document} section \ref{sec:methods} section \ref{methods} \section{Methods} \label{sec:methods} \end{document}

yields weird results:

enter image description here

As you see, only the first reference is detected by the package, and I get

! Missing \endcsname inserted.
<to be read again> 
                   \BooleanFalse 
l.20    section \ref{sec:methods} section \ref{
                                             methods}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

LaTeX Warning: Reference `\endcsname ' on page 1 undefined on input line 20.

My file does not include any non-UTF character. What's the problem here?

  • 2
    Not really the point, but it should almost never be necessary to download packages from CTAN manually. According to CTAN https://ctan.org/pkg/showkeys is part of latex-tools in MikTeX, so it should most definitely be installed and found on your system. If that is not the case, something very fishy is going on. – moewe Oct 02 '22 at 05:51
  • 1
    That said I can reproduce your issue with a showkeys version that was installed regularly via MikTeX's console. (So this is not an installation issue, but I still think the comment above may be useful to other people who may get the impression that showkeys is not available in MikTeX or that it is generally a good idea to install packages from CTAN.) – moewe Oct 02 '22 at 05:51
  • @moewe: You are right. My MikTeX itself includes a showkeys.sty. So, I just updated the question. –  Oct 02 '22 at 06:09
  • @User No error with my up-to-date TeX Live. – egreg Oct 02 '22 at 08:25
  • In a deleted edit you indicated you are using a 2014 showkeys which would be wrong, the current version (in texlive and ctan) is 2022/04/12 v3.18 – David Carlisle Oct 02 '22 at 08:46
  • The issue was reported at https://github.com/MiKTeX/miktex-packaging/issues/295 and fixed shortly after. With an up-to-date MikTeX the document compiles properly again. – moewe Oct 09 '22 at 13:36
  • 4
    I’m voting to close this question because it was caused by a MikTeX packaging bug that has since been resolved. This question is unlikely to help future visitors due to the limited time in which the package mismatch could have had any consequences. (Plus, it is a standing assumption that systems should be updated anyway.) – moewe Oct 09 '22 at 13:37

1 Answers1

1

In a correctly installed LaTeX you should get no error from the posted example, however if you use the optional argument of \usepackage to force loading an old version with a new latex, you do get the error shown.

\documentclass{article}

\usepackage{showkeys}[=2014-10-28]

\begin{document} section \ref{sec:methods} section \ref{methods} \section{Methods} \label{sec:methods} \end{document}

Produces

! Missing \endcsname inserted.
<to be read again> 
                   \BooleanFalse 
l.6     section \ref{sec:methods} section \ref{
                                               methods}
? 

So it appears that you have an old showkeys in your input path.

David Carlisle
  • 757,742
  • My MiKTeX is fully updated (based on the MiKTeX console wizard), and I have a showkeys.sty at both MiKTeX 2.9\tex\latex-dev\tools and MiKTeX 2.9\tex\latex\tools. But even without any package option, I get the same error. I also checked that there is no other showkeys.sty on my disk. –  Oct 02 '22 at 09:14
  • 1
    @User raise an issue at miktex then it must have missed an update to the core latex-tools release. You can use latex-tools from ctan until that is fixed – David Carlisle Oct 02 '22 at 09:20