3

I'm using the tufte-handout document class to provide margin comments on a third-party text for teaching purposes. I therefore want to preserve the numbering of the main text figures (figure and figure* environments), while at the same time keep the numbering of my margin figures (marginfigure environment) separate.

Is there some way to create a separate numbering system for the margin figures only (e.g., miniscule roman numerals 'Figure iii' or letters 'Figure a') while at the same time leaving the other two figure environments untouched? (I do not need any LoF)

  • Welcome to TeX.SX! Please post a minimal compilable document showing that you've tried so far, and then people will be better able to help you with achieving your result. See minimal working example (MWE) for what needs to go into such a document. – Adam Liter Feb 11 '14 at 21:05
4

Yes, there's a way. You can define a new kind of float (I called it marfigure) with its own counter and then redefine marginfigure in terms of the new float instead of the standard figure. I also made provision for an independent "List of Margin Figures":

\documentclass{tufte-book}
\usepackage{graphicx}
\hypersetup{colorlinks}

\title{A Tufte-Style Book\thanks{Thanks to Edward R.~Tufte for his inspiration.}}
\author[The Tufte-LaTeX Developers]{The Tufte-LaTeX\ Developers}
\publisher{Publisher of This Book}

\makeatletter
% counter for margin figures
\newcounter{marfigure}[chapter]
\renewcommand\themarfigure
     {\ifnum \c@chapter>\z@ \thechapter.\fi \@roman\c@marfigure}
% definitions for the new float marfigure
\def\fps@marfigure{tbp}
\def\ftype@marfigure{1}
\def\ext@marfigure{lmf}
\def\fnum@marfigure{\figurename\nobreakspace\themarfigure}
\renewenvironment{marginfigure}[1][-1.2ex]%
  {\begin{@tufte@margin@float}[#1]{marfigure}}
  {\end{@tufte@margin@float}}
% definitions for the new list of margin figures
\newcommand\listmarfigurename{List of Margin Figures}
\let\l@marfigure\l@figure
\newcommand\listofmarfigures{%
  \ifthenelse{\equal{\@tufte@class}{book}}%
    {\chapter*{\listmarfigurename}}%
    {\section*{\listmarfigurename}}%
%  \begin{fullwidth}%
    \@starttoc{lmf}%
%  \end{fullwidth}%
}
\makeatother


\begin{document}

\listoffigures
\listofmarfigures

\begin{figure}
\centering
\includegraphics[width=.6\marginparwidth]{example-image-a}
\caption{test regular figure}
\end{figure}

\begin{marginfigure}
\centering
\includegraphics[width=.6\marginparwidth]{example-image-a}
\caption{test margin figure}
\end{marginfigure}

\vspace{2cm}

\begin{figure}
\centering
\includegraphics[width=.6\marginparwidth]{example-image-a}
\caption{test regular figure}
\end{figure}

\begin{marginfigure}
\centering
\includegraphics[width=.6\marginparwidth]{example-image-a}
\caption{test margin figure}
\end{marginfigure}

\begin{figure*}
\centering
\includegraphics[width=.6\marginparwidth]{example-image-a}
\caption{test regular starred figure}
\end{figure*}

\end{document}

The resulting LoF:

enter image description here

The new list for margin figures:

enter image description here

The document showing margin figures with their own counter:

enter image description here

4

You could also just renewcommand{\thefigure} locally for the marginfigure environment:

\makeatletter
\newcounter{marginfigure}
% Margin figure environment
\renewenvironment{marginfigure}[1][-1.2ex]%
  {\begin{@tufte@margin@float}[#1]{figure}
    \refstepcounter{marginfigure}
    \renewcommand{\thefigure}{\roman{marginfigure}}}
  {\end{@tufte@margin@float}}
\makeatother

Here's a MWE (from Gonzalo's answer, without the list of margin figures separate):

% arara: pdflatex
% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{tufte-book}
\usepackage{graphicx}
\hypersetup{colorlinks}

\title{A Tufte-Style Book\thanks{Thanks to Edward R.~Tufte for his inspiration.}}
\author[The Tufte-LaTeX Developers]{The Tufte-LaTeX\ Developers}
\publisher{Publisher of This Book}

\makeatletter
\newcounter{marginfigure}
% Margin figure environment
\renewenvironment{marginfigure}[1][-1.2ex]%
  {\begin{@tufte@margin@float}[#1]{figure}
    \refstepcounter{marginfigure}
    \renewcommand{\thefigure}{\roman{marginfigure}}}
  {\end{@tufte@margin@float}}
\makeatother


\begin{document}

\listoffigures

\begin{figure}
    \centering
    \includegraphics[width=.6\marginparwidth]{example-image-a}
    \caption{test regular figure}
    \label{fig:regularfig}
\end{figure}
test reference: \ref{fig:regularfig}

\begin{marginfigure}
    \centering
    \includegraphics[width=.6\marginparwidth]{example-image-a}
    \caption{test margin figure}
    \label{fig:marginfig}
\end{marginfigure}

test reference: \ref{fig:marginfig}
\vspace{2cm}

\begin{figure}
    \centering
    \includegraphics[width=.6\marginparwidth]{example-image-a}
    \caption{test regular figure}
\end{figure}

\begin{marginfigure}
    \centering
    \includegraphics[width=.6\marginparwidth]{example-image-a}
    \caption{test margin figure}
\end{marginfigure}

\begin{figure*}
    \centering
    \includegraphics[width=.6\marginparwidth]{example-image-a}
    \caption{test regular starred figure}
\end{figure*}

\end{document}

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.