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.

Let's say I have two standard figures and two supplementary figures. If I change the name of figure using \renewcommand{\figurename} the figure counter will still count all figures continuously (i.e. Fig 1, Fig 2, Supp Fig 3, Supp Fig 4 – see code below). How can I reset the figure counter so it will count standard figures separately from supplementary figures?

\documentclass[]{article}
\usepackage[footnotesize]{caption}
\begin{document}
\begin{figure}[ht]
\caption{}
\end{figure}
\begin{figure}[ht]
\caption{}
\end{figure}
\begin{figure}[ht]
\renewcommand{\figurename}{Supplementary Figure}
\caption{}
\end{figure}
\begin{figure}[ht]
\renewcommand{\figurename}{Supplementary Figure}
\caption{}
\end{figure}
\end{document}
share|improve this question
add comment

2 Answers

up vote 10 down vote accepted

In preamble,

\usepackage{newfloat}
\DeclareFloatingEnvironment[name={Supplementary Figure}]{suppfigure}

In text,

\begin{suppfigure}
\caption{...}
\end{suppfigure}

If you use old versions of caption package, there is no newfloat package, then use caption package and \DeclareCaptionType command instead.

share|improve this answer
add comment

You can use \setcounter{figure}{0} to reset the figure counter. However, as noted by lockstep in the comments, this will cause the number of the next "normal" figure to be wrong, as demonstrated in the example below, which has two Figure 2.

Another option is to define a new float style with the float package.

\documentclass[]{article}
\usepackage{float}
\usepackage[footnotesize]{caption}

\newfloat{suppfig}{tbh}{losf}
\floatname{suppfig}{Supplementary Figure}
\begin{document}
\begin{figure}[ht]
\caption{}
\end{figure}
\begin{figure}[ht]
\caption{}
\end{figure}
\setcounter{figure}{0}
\begin{figure}[htb!]
\renewcommand{\figurename}{Supplementary Figure}
\caption{}
\end{figure}
\begin{figure}[htb!]
\caption{}
\end{figure}
\begin{suppfig}[htb!]
\caption{}
\end{suppfig}
\begin{suppfig}[hb!]
\caption{}
\end{suppfig}
\end{document}
share|improve this answer
    
Resetting the figure counter will cause wrong numbering of the next "normal" figure (unless one saves and restores the former value). If the OP's aim is to "count standard figures separately from supplementary figures", the correct way seems to be to define different float types, as Leo Liu already did in his answer. –  lockstep Dec 25 '11 at 17:43
    
@lockstep Of course, and I agree. I'll add a note about this in my answer. –  Torbjørn T. Dec 25 '11 at 17:47
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.