6

Although I have been successfully using the sidenotes package for years, it suddenly stopped behaving. Here is the code,

\documentclass[oneside]{book}

\usepackage[utf8]{inputenc}
\usepackage{sidenotes}

\begin{document}

Here is some text. And some more. Here is a margin note \marginnote{I am a margin note}. 

Here is some text. And some more.  Here is a footnote\footnote{I am a footnote}. 

Here is some text. And some more. Here is a sidenote\sidenote{I am a side note}. 

\end{document}

that generates this output,

ResultPDF

Notice the "3sp" in the output! I also get the following error:

! Missing number, treated as zero.
<to be read again> 
                   \tex_let:D 
l.165 ... is a sidenote\sidenote{I am a side note}

and

Illegal unit of measure (pt inserted).<to be read again>

I believe this started occurring after I did an update of several dozens of packages through Tex Live Utility. It looks like something got corrupted somewhere, but I may be wrong.

I would appreciate any help in solving this issue.

  • Welcome! When did you update? – cfr Feb 27 '17 at 1:59
  • Do you have xparse version 2017/02/10 v6878 by any chance? – cfr Feb 27 '17 at 2:00
  • Works fine for me. – JPi Feb 27 '17 at 2:10
  • 2
    @JPi Then either your copy of xparse is out of date or you have access to the promised update containing an interim fix. – cfr Feb 27 '17 at 2:16
  • @cfr Tex Live utility reveals that l3packages was updated with the latest version of xparse (2017/02/10). – Seb Feb 27 '17 at 2:24
6

The issue is due to a change in xparse.sty version 2017/02/10 v6878. My understanding was that an update addressing the issues caused by the change had been pushed to CTAN. However, it seems that is not (yet?) the case.

The issue affects the handling of \NewDocumentCommand when a macro is defined with no arguments. As I understand it, the change means that it is handled in the same way as definitions which take arguments. This breaks code which relied on the previous fast implementation, which was used when a definition specified a macro with no arguments.

You can work around the problem, not altogether satisfactorily, by using \DeclareExpandableDocumentCommand. This isn't ideal, because it doesn't avoid overwriting an existing macro name, as \NewDocumentCommand does.

Alternatively, you can fall back to LaTeX 2e syntax, treating this as a gap in the current expl3 implementation.

There currently appears to be no general agreement about the appropriate approach on the part of LaTeX 3 developers as it is a work-in-progress. However, apparently what sidenotes does was never supported. It just happened to work. But sidenotes is not alone and, moreover, it was not at all clear either that this wasn't supported or what should be done instead. Indeed, the latter is still not clear, as I understand it, but the subject of ongoing discussions.

However, all of that being said, your best bet is probably to workaround the problem as follows, avoiding the expl3 issue in case of future changes, and relying on the stable LaTeX 2e implementation.

\documentclass[oneside]{book}

\usepackage[utf8]{inputenc}
\usepackage{sidenotes}
\makeatletter
\renewcommand* \@sidenotes@multisign {3sp}
\makeatother
\begin{document}

Here is some text. And some more. Here is a margin note \marginnote{I am a margin note}.

Here is some text. And some more.  Here is a footnote\footnote{I am a footnote}.

Here is some text. And some more. Here is a sidenote\sidenote{I am a side note}.

\end{document}

workaround for side notes

| improve this answer | |
  • Great, works perfectly. Thanks for your help. Not sure what this fix does, but my sidenotes are thriving again. – Seb Feb 27 '17 at 2:39
  • @Seb I think what it does is make \@sidenotes@multisign expandable, which is necessary for other things to work. It is because it doesn't expand, I think, that it complains about a missing number (it doesn't see 3 as a number) and then prints the value rather than using it. However, this is in the realm of grey boxes, for me, if not quite black ones. I hit this issue with the update and got help to fix it. So I just had to modify the fix for this case. – cfr Feb 27 '17 at 2:42
  • @Seb I do know it has something to do with expansion .... And the 2e approach I used here was recommended by people who should know ;). – cfr Feb 27 '17 at 2:45
  • (Not speaking for the LaTeX3 team.) As far as I'm concerned, \@sidenotes@multisign has no business being a document command: it is not markup that appears in the document itself. It should probably be named something like \l__sidenotes_multisign_tl or similar, and be declared as a normal expl3 token list. – Bruno Le Floch Mar 6 '17 at 18:03
  • @BrunoLeFloch I'm inclined to agree. However (1) the problem is not restricted to internal commands defined as document commands and (2) as far as I know document command is not defined anywhere. There is something of a general issue here in that xparse is an obvious place to look if you're hitting the limitations of the 2e definition macros, and that does not necessarily mean you know any expl3. Nor does xparse say what it shouldn't be used for. So, technically I'm inclined to agree, but from a user perspective, not so much. – cfr Mar 6 '17 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.