[Tex/LaTex] How to change the label separator for marginfigure in Tufte Book/Handout

captionsfloatstufte

I'm trying to use the caption package to do this and I've used the following code, but it's still not giving me a period as a label separator. How can I go about fixing this? Here's what I have:

    \documentclass[english,dotinlabels,nohyper,notoc]{tufte-handout}
    \usepackage{babel}
    \usepackage{hyperref}
    \usepackage{caption}
    \captionsetup[figure]{labelformat=simple, labelsep = period}
    \captionsetup[marginfigure]{labelformat=simple, labelsep = period}

    \begin{document}

    \section{test}

    \begin{figure}
    \caption{erere}
    \end{figure}

    \vspace{20pt}

    this is a test

    \begin{marginfigure}
    \caption{rerweaere}
    \end{marginfigure}

    \end{document}

As indicated below, it works for figure, but not margin figure:
enter image description here

Best Answer

You can redefine marginfigure to include the change in the caption formatting:

\documentclass[english,dotinlabels,nohyper,notoc]{tufte-handout}
\usepackage{babel}
\usepackage{hyperref}
\usepackage{caption}
\captionsetup[figure]{labelformat=simple, labelsep = period}

\makeatletter
\renewenvironment{marginfigure}[1][-1.2ex]%
  {\begin{@tufte@margin@float}[#1]{figure}%
    \captionsetup{labelformat=simple, labelsep = period}}
  {\end{@tufte@margin@float}}
\makeatother

\begin{document}

\section{test}

\begin{figure}
\caption{erere}
\end{figure}
\vspace{20pt}
this is a test

\begin{marginfigure}
\caption{rerweaere}
\end{marginfigure}

\end{document}

enter image description here

As a side note, openany and a5paper are not supported class options with this document class.

Related Question