2

I’m having trouble applying the tufte-book class to my document (previously book class). Currently I’m trying to find a solution on how to use footnotes within a thmtools environment. PdfLaTeX gives me the following error:

Missing number, treated as zero. ...\footnote{...}
Illegal unit of measure (pt inserted). ...\footnote{...}
Class tufte-book Error:

The thmtools theorem is defined as follows in the preamble:

\usepackage{tikz}    
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{needspace}
\usepackage[T1]{fontenc}


\declaretheoremstyle[
spaceabove=\topsep, 
spacebelow=\topsep,
numberwithin=chapter,
headfont=\normalfont\bfseries,
notefont=\normalfont\scshape, 
notebraces={$\lbrack$}{$\rbrack$},
postheadhook={\textcolor{gray}{\rule[.6ex]{\linewidth}{0.4pt}}\\},
bodyfont=\normalfont\itshape,
mdframed={
    backgroundcolor=gray, 
    linecolor=gray, 
    innertopmargin=6pt,
    roundcorner=5pt, 
    innerbottommargin=6pt, 
    skipabove=\parsep, 
    skipbelow=\parsep },
postheadspace=\newline
]{theorembreak}

\declaretheorem[style=theorembreak,name=Theorem]{theorem}
\AtBeginEnvironment{theorem}{\Needspace{10\baselineskip}}

The theorem within the text looks like this:

\begin{theorem}[Theorem]
    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.\footnote{This is a footnote within a theorem.}
\end{theorem}

The problem is the footnote. Theorems without the footnotes work fine. How can this be fixed?

The complete MWE together with utilising the tufte-book class (found here) is as follows:

\documentclass{tufte-book}

% For graphics / images
\usepackage{graphicx}
\setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
\graphicspath{{graphics/}}

% The fancyvrb package lets us customize the formatting of verbatim
% environments.  We use a slightly smaller font.
\usepackage{fancyvrb}
\fvset{fontsize=\normalsize}

%%
% Prints argument within hanging parentheses (i.e., parentheses that take
% up no horizontal space).  Useful in tabular environments.
\newcommand{\hangp}[1]{\makebox[0pt][r]{(}#1\makebox[0pt][l]{)}}

%%
% Prints an asterisk that takes up no horizontal space.
% Useful in tabular environments.
\newcommand{\hangstar}{\makebox[0pt][l]{*}}

%%
% Prints a trailing space in a smart way.
\usepackage{xspace}


% Prints an epigraph and speaker in sans serif, all-caps type.
\newcommand{\openepigraph}[2]{%
  %\sffamily\fontsize{14}{16}\selectfont
  \begin{fullwidth}
  \sffamily\large
  \begin{doublespace}
  \noindent\allcaps{#1}\\% epigraph
  \noindent\allcaps{#2}% author
  \end{doublespace}
  \end{fullwidth}
}

% Inserts a blank page
\newcommand{\blankpage}{\newpage\hbox{}\thispagestyle{empty}\newpage}

\usepackage{units}

% Typesets the font size, leading, and measure in the form of 10/12x26 pc.
\newcommand{\measure}[3]{#1/#2$\times$\unit[#3]{pc}}

% Macros for typesetting the documentation
\newcommand{\hlred}[1]{\textcolor{Maroon}{#1}}% prints in red
\newcommand{\hangleft}[1]{\makebox[0pt][r]{#1}}
\newcommand{\hairsp}{\hspace{1pt}}% hair space
\newcommand{\hquad}{\hskip0.5em\relax}% half quad space
\newcommand{\TODO}{\textcolor{red}{\bf TODO!}\xspace}
\newcommand{\na}{\quad--}% used in tables for N/A cells
\providecommand{\XeLaTeX}{X\lower.5ex\hbox{\kern-0.15em\reflectbox{E}}\kern-0.1em\LaTeX}
\newcommand{\tXeLaTeX}{\XeLaTeX\index{XeLaTeX@\protect\XeLaTeX}}
% \index{\texttt{\textbackslash xyz}@\hangleft{\texttt{\textbackslash}}\texttt{xyz}}
\newcommand{\tuftebs}{\symbol{'134}}% a backslash in tt type in OT1/T1
\newcommand{\doccmdnoindex}[2][]{\texttt{\tuftebs#2}}% command name -- adds backslash automatically (and doesn't add cmd to the index)
\newcommand{\doccmddef}[2][]{%
  \hlred{\texttt{\tuftebs#2}}\label{cmd:#2}%
  \ifthenelse{\isempty{#1}}%
    {% add the command to the index
      \index{#2 command@\protect\hangleft{\texttt{\tuftebs}}\texttt{#2}}% command name
    }%
    {% add the command and package to the index
      \index{#2 command@\protect\hangleft{\texttt{\tuftebs}}\texttt{#2} (\texttt{#1} package)}% command name
      \index{#1 package@\texttt{#1} package}\index{packages!#1@\texttt{#1}}% package name
    }%
}% command name -- adds backslash automatically
\newcommand{\doccmd}[2][]{%
  \texttt{\tuftebs#2}%
  \ifthenelse{\isempty{#1}}%
    {% add the command to the index
      \index{#2 command@\protect\hangleft{\texttt{\tuftebs}}\texttt{#2}}% command name
    }%
    {% add the command and package to the index
      \index{#2 command@\protect\hangleft{\texttt{\tuftebs}}\texttt{#2} (\texttt{#1} package)}% command name
      \index{#1 package@\texttt{#1} package}\index{packages!#1@\texttt{#1}}% package name
    }%
}% command name -- adds backslash automatically
\newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument
\newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument
\newenvironment{docspec}{\begin{quotation}\ttfamily\parskip0pt\parindent0pt\ignorespaces}{\end{quotation}}% command specification environment
\newcommand{\docenv}[1]{\texttt{#1}\index{#1 environment@\texttt{#1} environment}\index{environments!#1@\texttt{#1}}}% environment name
\newcommand{\docenvdef}[1]{\hlred{\texttt{#1}}\label{env:#1}\index{#1 environment@\texttt{#1} environment}\index{environments!#1@\texttt{#1}}}% environment name
\newcommand{\docpkg}[1]{\texttt{#1}\index{#1 package@\texttt{#1} package}\index{packages!#1@\texttt{#1}}}% package name
\newcommand{\doccls}[1]{\texttt{#1}}% document class name
\newcommand{\docclsopt}[1]{\texttt{#1}\index{#1 class option@\texttt{#1} class option}\index{class options!#1@\texttt{#1}}}% document class option name
\newcommand{\docclsoptdef}[1]{\hlred{\texttt{#1}}\label{clsopt:#1}\index{#1 class option@\texttt{#1} class option}\index{class options!#1@\texttt{#1}}}% document class option name defined
\newcommand{\docmsg}[2]{\bigskip\begin{fullwidth}\noindent\ttfamily#1\end{fullwidth}\medskip\par\noindent#2}
\newcommand{\docfilehook}[2]{\texttt{#1}\index{file hooks!#2}\index{#1@\texttt{#1}}}
\newcommand{\doccounter}[1]{\texttt{#1}\index{#1 counter@\texttt{#1} counter}}

% Generates the index
\usepackage{makeidx}
\makeindex

\usepackage{tikz}  
\usepackage{amsthm}  
\usepackage{thmtools}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{needspace}
\usepackage[T1]{fontenc}



\declaretheoremstyle[
spaceabove=\topsep, 
spacebelow=\topsep,
numberwithin=chapter,
headfont=\normalfont\bfseries,
notefont=\normalfont\scshape, 
notebraces={$\lbrack$}{$\rbrack$},
postheadhook={\textcolor{gray}{\rule[.6ex]{\linewidth}{0.4pt}}\\},
bodyfont=\normalfont\itshape,
mdframed={
    backgroundcolor=gray, 
    linecolor=gray, 
    innertopmargin=6pt,
    roundcorner=5pt, 
    innerbottommargin=6pt, 
    skipabove=\parsep, 
    skipbelow=\parsep },
postheadspace=\newline
]{theorembreak}

\declaretheorem[style=theorembreak,name=Theorem]{theorem}
\AtBeginEnvironment{theorem}{\Needspace{10\baselineskip}}


\begin{document}


\mainmatter
\chapter{Introduction}

\begin{theorem}[Theorem]
    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.\footnote{This is a footnote within a theorem.}
\end{theorem}


\end{document}
  • Can you please provide a complete minimal example that shows your problem, ready to copy, paste, compile & see? See the comments to your earlier questions on what a minimal working example (MWE) is. – gernot Oct 23 '16 at 15:43
  • Sorry! I've now added a complete example producing the error. in my original post. – user3347232 Oct 23 '16 at 16:29
2

This is kind of an answer, though a negative one as it seems. Your theorem is essentially an mdframed environment, and the tufte class redefines \footnote to be a \sidenote. So your example boils down to

\documentclass{tufte-book}
\usepackage{mdframed}
\begin{document}
\begin{mdframed}
  Some text.
  \sidenote{This is a side note.}
\end{mdframed}
\end{document}

which gives the error

! Missing number, treated as zero.
<to be read again> 
                   ]
l.6   \sidenote{This is a side note.}

According to the answer of Using sidenotes in mdframed environment,

The command \sidenote is equal to \marginpar or \marginnote which are not allowed in tables or boxes. So you can't use them.

This answer is from four years ago, maybe it doesn't apply anymore and there is a solution.

|improve this answer|||||

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.