0

I'm trying to use the sidenotes package, and it appears to not support multiple-paragraph sidenotes.

For example the following document does not compile:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{sidenotes}
\begin{document}

Here is some content.\sidenote{And it has a sidenote.

This sidenote has multiple paragraphs.}

\end{document}

And results in the following error when run through pdflatex:

Runaway argument?
{\@sidenotes@placemarginal {-NoValue-}{\textsuperscript {\thesidenote \ETC.
! Paragraph ended before \IfNoValueOrEmptyTF  was complete.
<to be read again>
                   \par
l.8 This sidenote has multiple paragraphs.}

(If "sidenote" is replaced by "footnote" this works as expected)

I assume this is expected behaviour and not just me doing something wrong, though I'd be delighted if it was the latter.

Is there any workaround for this, or an alternative to the sidenotes package with similar functionality?

DRMacIver
  • 113
  • Did you check alternatives: https://ctan.org/topic/marginal ? – MS-SPO Jun 30 '22 at 16:29
  • I hadn't, but I've now tried sidenotesplus and snotez, and they appear to have exactly the same problem. The others do not appear to actually provide sidenotes but are for other margin note functionality. – DRMacIver Jun 30 '22 at 16:35
  • Looks like a bug to me. The package doesn't set all needed arguments to long. – Ulrike Fischer Jun 30 '22 at 16:49
  • Is that likely to be an easy fix? I confess my LaTeX knowledge is pretty rudimentary. I'm happy to poke around at the sty file and try to fix the bug in principle, but I don't actually know what it means to set a needed argument to long. Do you have a reference I could read? – DRMacIver Jun 30 '22 at 16:54

2 Answers2

1

It looks like a bug, the package uses argument type +m (which allows paragraphs) for the user commands but only m in some of the internal commands. You should report that. As a work-around you can use \endgraf instead to avoid the errors:

\documentclass{article}
\usepackage{sidenotes}

\begin{document}

Here is some content.\sidenote{And it has a sidenote. \endgraf This sidenote has multiple paragraphs.}

\end{document}

Ulrike Fischer
  • 327,261
  • Thank you! Replacing the m with +m in a copy of the sty does also fix this example. It doesn't seem to work for my larger example this was extracted from, but that's a debugging problem for another day.

    I should indeed report it but it's not at all obvious how, or whether this is likely to do anything on a package whose last version is from 2016.

    – DRMacIver Jun 30 '22 at 17:28
0

This seems to work; if you want a blank line, you might need a workaround, e.g. via some box-mechanism:

enter image description here

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{sidenotes}
\begin{document}

Here is some content.\sidenote{And it has a sidenote.\ This sidenote has multiple paragraphs.} Some more text:

Related Replacing footnotes with sidenotes in Classicthesis sidenotes package not working with oneside option in book sidenotes package : error in figure alignment Wrong position of caption in odd page with sidenotes in figure*

\end{document}

P.S.: The effect was somewhat in doubt. So two versions, without and with a new paragraph:

Without

Here is some content.\sidenote{And it has also a  sn. This sn has multiple paragraphs.} Some more text:

With

Here is some content.\sidenote{And it has also a  sn.\\This sn has multiple paragraphs.} Some more text:
MS-SPO
  • 11,519
  • This seems to work in the sense that it doesn't actually work? This splits a paragraph across multiple lines in a source file, it doesn't include multiple paragraphs in the marginnote.

    In my particular use case the marginnote also e.g. has a quote in it. If I have to mangle the LaTeX in order to make it work properly it's not actually worth using.

    – DRMacIver Jun 30 '22 at 16:49
  • Please see Ulrike's response. – MS-SPO Jun 30 '22 at 16:56