4

When using the tufte-book class (and other tufte classes, I imagine), footnotes / sidenotes seem to break the instant you load the gb4e package.

This compiles correctly, and displays a sidenote as designed.

\documentclass{tufte-book}
\begin{document}
This is text.\footnote{This is a sidenote.}
\end{document}

This throws two errors, one about 'missing number, treated as zero', the other about an illegal unit of measure. The sidenote is displayed incorrectly - there's one [ off to the side as a sidenote, and then the rest is placed in the main text preceded by a ].

\documentclass{tufte-book}
\usepackage{gb4e}
\begin{document}
This is text.\footnote{This is a sidenote.}
\end{document}

What is going on here? Does gb4e try to redefine footnotes in a way that's incompatible with tufte-latex? Since gb4e has nothing to do with footnotes, ostensibly, I'm confused as to why there's a conflict at all. Is there any way to get around this and use gb4e in a tufte-book document, or would that require rewriting one or the other package? (or is it not worth the effort?)

5

The gb4e package does modify the footnote code to number examples in footnotes correctly. Usually this doesn't interfere with other footnoting modifications, but the tufte classes make quite substantial changes. So you need to redefine the tufte footnote with the gb4e modifications included.

\documentclass{tufte-book}
\usepackage{gb4e}
\noautomath
\makeatletter
\renewcommand\@footnotetext[2][0pt]{%
  \marginpar{%
    \hbox{}\vspace*{#1}%
    \def\baselinestretch {\setspace@singlespace}%
    \reset@font\footnotesize%
    \@tufte@margin@par% use parindent and parskip settings for marginal text
    \vspace*{-1\baselineskip}\noindent%
    \protected@edef\@currentlabel{%
       \csname p@footnote\endcsname\@thefnmark%
    }%
    \color@begingroup%
       \@noftnotefalse\setcounter{fnx}{0}%
       \@makefntext{%
         \ignorespaces#2%
       }%
    \color@endgroup%
  }%
\@noftnotetrue}%
\makeatother
\usepackage{lipsum}
\begin{document}
\begin{exe}
\ex A regular example
\end{exe}
\lipsum[1]\footnote{A footnote\begin{exe}\ex A footnoted example\end{exe}}
\begin{exe}
\ex A regular example
\end{exe}
\lipsum[2]\footnote{A footnote\begin{exe}\ex A footnoted example\end{exe}}
\end{document}

output of code

  • Yep, that works beautifully. Thank you, sir! – Sjiveru Aug 10 '18 at 17:53

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.