I'm using the class: tufte-handout and I need a new coloured environment for data, examples and details that I want to highlight.

I found this question (with answer) that is literally what I want. It create a coloured rectangle with a caption. If I copy and paste the code, I actually obtain the result that I want with a working caption, but the software shows an error message at the end of the compilation: "Undefined control sequence. \end{example}" and "Missing number, treated as zero. \end{example}". The error message (both combined) is repeated like 3 times.

The MWE is (the answer from Gonzalo Medina):

Caption placement for new float in tufte-book class

(The second one, with the code for the colouration integrated in the definition of the new environment.)

If I copy the MWE provided in the answer, the result is good and without error, if I change only the class (handout instead of book) I obtain the same result but with the error message.

The pdf is ok, but the message itself annoys me. I would have commented on the other discussion, but I haven't the point to that...

There is a way to solve this or to block the showing of the error message?



1 Answer 1


The problem seems to be that the answer there assumes the presence of chapters, which are of course present for tufte-book, but tufte-handout lacks them. Simply adapting the code there for the case of section as the higher sectioning level should do:



\newcommand\listexamplename{List of Examples}
%  \begin{fullwidth}%
%  \end{fullwidth}%

%\renewcommand\theexample{\ifnum \c@section>\z@ \thesection.\fi \@arabic\c@example} % this was adapted for the section case, but doesn't seem to be needed, given the sections are not numbered in the class by default. It would have an effect if the next line is uncommented and a section is added to the document.


\caption{Currently, this caption is in the right margin similar to the table caption below.}

\caption{This is how I want the new float environment caption to behave.}
Column 1 & Column 2 & Column 3 \\
Value A1 & Value A2 & Value A3 \\

  • Thanks, this works beautifully. I had tried to change the code myself with the section option, but I hadn't edited and commented all the needed part! Thanks!
    – DrewGecko
    Feb 28, 2018 at 21:14

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.