Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
Thanks. This worked perfectly. I've edited my code to remove the unsupported class options. –  Black Milk Oct 21 '12 at 6:15
    
@EdwinMontufar You're welcome! You should also consider the answer given by the current maintainer of the class. –  Gonzalo Medina Oct 21 '12 at 6:20
add comment

The Tufte-LaTeX classes don't play very nicely with the caption package, currently.

The easiest solution is to redefine the \@caption command that is defined by the Tufte-LaTeX classes. In the preamble of your document, add the following code:

\makeatletter
\long\def\@caption#1[#2]#3{%
  \par
  \addcontentsline{\csname ext@#1\endcsname}{#1}%
    {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
  \begingroup
    \@parboxrestore
    \if@minipage
      \@setminipage
    \fi
    \@tufte@caption@font\@tufte@caption@justification
    \noindent\csname fnum@#1\endcsname. \ignorespaces#3\par% changed : to .
  \endgroup}
\makeatother

The example that you provided also has centered captions (as a by-product of using the caption package) instead of the ragged-right captions normally found in Tufte-style documents.

As Gonzalo Medina mentioned, the openany and a5paper options are ignored by the Tufte-LaTeX classes.

share|improve this answer
    
Thank you. This worked as well. I'll keep this handy in case 'caption' doesn't work right. As for the centered captions, this doesn't occur when I actually have an image embedded. –  Black Milk Oct 21 '12 at 6:20
    
It's really nice to know you're around (and sorry for not noticing it before). I really like the the features provided by the Tufte-LaTeX classes! –  Gonzalo Medina Oct 21 '12 at 6:26
    
@godbyk I'd like to thank you for maintaining this wonderful class. –  Black Milk Oct 21 '12 at 6:30
    
@EdwinMontufar: When I ran a test with images here, the captions were centered. But if it looks okay on your end, then feel free to stick with the caption package. –  godbyk Oct 21 '12 at 6:49
    
@GonzaloMedina: Thanks! I'm hoping to do some more development work on the T-L classes over the next few months (as I'll be using it to write my dissertation). –  godbyk Oct 21 '12 at 6:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.