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}
1
  • 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. Jan 23, 2014 at 20:15

2 Answers 2

15

do it inside the environment, then it is local:

\begin{figure} 
   \renewcommand\figurename{Fig.}
       ....
       \caption{This is a photo.}
\end{figure}
2
  • 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, 2014 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, 2014 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

3
  • I want to change only caption as I have a style file which may be styling figure environments, and I don't want photo differ from figure in that sense
    – Emmet B
    Jan 23, 2014 at 14:12
  • @EmmetB I see. Then this answer is not useful, so I'll delete it. Jan 23, 2014 at 14:14
  • 2
    @EmmetB Answer has been undeleted by request. Jan 23, 2014 at 20:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .