[Tex/LaTex] How to reset sidenote numbering in chapters? (Tufte-LaTeX)

footnotesnumberingtufte

I've looked at this question:

How to reset footnote numbering at \chapter* and at frontmatter chapters?,

but the answers concern using \chapter*, and assume the OP is not using the Tufte-LaTeX package. I use \chapter to indicate the start of a new chapter in Tufte-LaTeX; my sidenote numbers are not reset between chapters, and I would like to do so.

Here is a MWE, using the first suggestion. Unfortunately the sidenote in chapter 2 starts at 2.

\documentclass{tufte-book}

\makeatletter% so we can use @ in the command name
\@addtoreset{footnote}{chapter}% restart the sidenote counter for each chapter
\makeatother% resets the meaning of @

\begin{document}

\chapter{ONE}
TEST\sidenote{footnote \#1}

\chapter{TWO}
LOOK\sidenote{footnote \#2}

\end{document}

Best Answer

To reset the sidenote counter each chapter, add the following lines to the preamble of your document:

\let\oldchapter\chapter
\def\chapter{%
  \setcounter{footnote}{0}%
  \oldchapter
}

Here's a minimal example:

\documentclass{tufte-book}

% Generate some dummy text
\usepackage{lipsum}
\newcommand{\sometext}{%
  Blah\sidenote{First sidenote.} \lipsum[1]\par
  Blah\sidenote{Second sidenote.} \lipsum[2]\par
}

% Reset the sidenote number each chapter
\let\oldchapter\chapter
\def\chapter{%
  \setcounter{footnote}{0}%
  \oldchapter
}

\begin{document}

% Regular chapter
\chapter{First}
\sometext

% Chapter with different table of contents entry
\chapter[Second in TOC]{Second}
\sometext

% Chapter with no table of contents entry
\chapter*{Third}
\sometext

\end{document}
Related Question