16

I saw here Change caption name of figures , by

\renewcommand{\figurename}{Fig.}

but if you do that, it changes all of the figures captions. How to change only some of them?

but I have 3 figures, I want default caption for figure 1 and 3, but Photo caption for figure 2.

so it should be like, Figure 1, Photo 1, Figure 2.

\begin{figure} 
      ...
      \caption{This is a figure.}
\end{figure}


\begin{figure} 
       ....
       \caption{This is a photo.}
\end{figure}


\begin{figure}
       ...
       \caption{This is a figure.}
\end{figure}
Emmet B
  • 1,159
  • After reading your comment to Herbert's answer, I've undeleted mine. You can keep his answer accepted, I don't mind :-), but since you mentioned my answer was the one you were going to use, I think it was worth to undelete it. – Gonzalo Medina Jan 23 '14 at 20:15

2 Answers2

15

do it inside the environment, then it is local:

\begin{figure} 
   \renewcommand\figurename{Fig.}
       ....
       \caption{This is a photo.}
\end{figure}
  • 2
    It looks like he wants a different environment. In his example he wants the output to be Figure 1, Photo 1, Figure 2. In this way, you'll get Figure 1, Photo 2, Figure 3. – Nico Jan 23 '14 at 13:58
  • Ok so by adding \setcounter{figure}{0} in to the second figure together with this, it works. Well I was going to accept the other answer, but since it is deleted I am gonna choose this one. so – Emmet B Jan 23 '14 at 14:35
11

The numbering showed in your question suggest that you want independent counters for photos and pictures, so it seems that you want a new independent floating object.

Using the newfloat package you can easily define this new type of float object for your photos:

\documentclass{article}
\usepackage{newfloat}

\DeclareFloatingEnvironment[fileext=lop]{photo}

\begin{document}

\begin{figure}
\centering
A
\caption{This is a figure.}
\end{figure}


\begin{photo} 
\centering
B
\caption{This is a photo.}
\end{photo}


\begin{figure}
\centering
C
\caption{This is a figure.}
\end{figure}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128