4

When using the sidenotes package the sidenote overflow (a pun intended). The sidenotes don't continue to the next page but disappears outside the page.

Here is a minimal working example:

\documentclass[12pt]{book}

\usepackage{float}
\usepackage{caption}
\usepackage{url}

 \usepackage{sidenotes}

\usepackage[outer=8cm,marginparsep=1cm,marginpar=6cm]{geometry}


\usepackage{chngcntr}
\counterwithin{sidenote}{section}
\makeatletter
\ExplSyntaxOn
\RenewDocumentCommand \sidenote { o o +m }
{
  \@sidenotes@multichecker
  \sidenotetext[#1][#2]{#3}
  \sidenotemark[#1]
  \@sidenotes@multimarker
}
\RenewDocumentCommand \sidenotetext { o o +m }
{
  \IfNoValueOrEmptyTF{#1}
    {
      \refstepcounter{sidenote}
      \@sidenotes@placemarginal{#2}{\textsuperscript{\thesidenote}{}~#3}
    }
    {
      \@sidenotes@placemarginal{#2}{\textsuperscript{#1}~#3}
    }
}
\ExplSyntaxOff
\makeatother


 \begin{document}

\chapter{Example}

\section{Cake}

This is an example.\sidenote{First sidenote.\label{first}} \\
This is second\sidenote{Second sidenote.\label{second}} \\
More text... \\
    ...
    ... \\
Then I refer to sidenote \ref{first} and then to sidenote \ref{second}. \\

Now I add a lot of text, taken from Wikipedia: \url{https://en.wikipedia.org/wiki/Darth_Vader} 

\section{Darth Vader}

Darth Vader\sidenote{Dark Lord of the Sith}, also known by his birth name Anakin Skywalker, is a fictional character in the Star Wars franchise. Vader appears in the original span of the saga going from being Anakin Skywalker, the prophesied child who would bring balance to the Force, to his corruption and transformation into Darth Vader, to being the pivotal antagonist, and eventual redemption and fulfillment of the prophecy.

The character was created by George Lucas and has been portrayed by numerous actors. His appearances span the first six Star Wars films, as well as Rogue One\sidenote{Don't miss Darth Vader's scenes, especially the last one, they are awesome!}, and his character is referenced in both Star Wars: The Force Awakens\sidenote{Episode VII, after Disney bought Lucasfilm and the Star Wars franchise. The original trilogy is still the best and Kylo Ren is not as great as Darth Vader. I keep writing here my own thoughts to demonstrate a problem: the sidenotes overflow (a pun intended). The comment doesn't continue to the next page but disappears outside the page.} and Star Wars: The Last Jedi. He is also an important character in the Star Wars expanded universe of television series, video games, novels, literature and comic books. Originally a Jedi prophesied to bring balance to the Force, he falls to the dark side of the Force and serves the evil Galactic Empire at the right hand of his Sith master, Emperor Palpatine (also known as Darth Sidious). He is also the father of Luke Skywalker and Princess Leia Organa, secret husband of Padmé Amidala and grandfather of Kylo Ren.

Darth Vader has become one of the most iconic villains in popular culture, and has been listed among the greatest villains and fictional characters ever. The American Film Institute listed him as the third greatest movie villain in cinema history on 100 Years... 100 Heroes and Villains, behind Hannibal Lecter and Norman Bates.[9] However, other critics consider him a tragic hero, citing his original motivations for the greater good before his fall to the dark side and the redemptive self-sacrifice that leads to his death.

 \end{document}

When using the sidenotes package the sidenote overflow (a pun intended). The sidenotes don't continue to the next page but disappears outside the page. The full text of the sidenote is

Episode VII, after Disney bought Lucasfilm and the Star Wars franchise. The original trilogy is still the best and Kylo Ren is not as great as Darth Vader. I keep writing here my own thoughts to demonstrate a problem: the sidenotes overflow (a pun intended). The comment doesn't continue to the next page but disappears outside the page.

Here is a screenshot of the bug: Screenshot of the sidenotes overflow

2
  • 1
    To say it is a bug says: the package promises this will work as I want, but it doesn't. It isn't a bug if you just want the package to do something it doesn't do. Are you sure this is a bug? I ask, because it sounds a really very hard thing to do, so I suspect that the package is not meant to do it.
    – cfr
    Jun 5, 2018 at 1:26
  • Doesn't that code give you a lot of bad box warnings?
    – cfr
    Jun 5, 2018 at 1:28

3 Answers 3

3

As mentioned in this answer all you have to do is load the marginfix package before sidenotes:

\usepackage{marginfix}
\usepackage{sidenotes}

This won't continue sidenotes to the next page, rather it will push sidenotes up the page to prevent them from overflowing.

Note that there is one small bug with marginfix where if you have a sidenote at the end of a paragraph which gets split across pages, the sidenote can appear on the page containing the start of the paragraph.

2
  • 1
    Thanks, it worked as you had described. Jul 13, 2020 at 12:53
  • 1
    This doesn't work with sidenotes longer than text height. They disappear altogether.
    – Damitr
    Nov 26, 2021 at 11:43
3

Reading the manual of the sidenotes package, it uses for sidenotes the command \marginparor in some cases \marginnote from the KOMA-script bundle. Neither provides the ability to have a page break inside a sidenote.

But what you are asking is possible, see here: Tufte alike design with sidenotes crossing pagebreaks, or: Tufte made with KOMAscript : Sidenotes with pagebreaks on the basis of the scrlayer-scrnotecolumn package. Please be aware that the package has got some new features since my question two years ago.

2
  • I tried the code written there, but it is not compatible with polyglossia package and Hebrew. Jun 9, 2018 at 16:45
  • Moreover, I want the sidenotes to always be on the outer margin, in scrbook document. Jun 9, 2018 at 17:55
0

The "memoir" document class has \sidebar that will let entries break across pages, but they don't have numbering like footnotes (although that could be done easily). More significantly, they will not align vertically with their reference point in the main text, but will instead fill the side bar from the top.

Memoir also has a feature of treating footnotes with \marginpar which has the same behavior as the sidenotes package.

Please report if "marginfix" fixes the trouble.

1
  • 1
    The "marginfix" works as described and pushes the sidenotes upwards so they won't break in the middle. Jul 13, 2020 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .