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 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}
share|improve this question
    
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 at 20:15

2 Answers 2

up vote 5 down vote accepted

do it inside the environment, then it is local:

\begin{figure} 
   \renewcommand\figurename{Fig.}
       ....
       \caption{This is a photo.}
\end{figure}
share|improve this answer
    
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 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 at 14:35

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

share|improve this answer
    
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 at 14:12
    
@EmmetB I see. Then this answer is not useful, so I'll delete it. –  Gonzalo Medina Jan 23 at 14:14
2  
@EmmetB Answer has been undeleted by request. –  Gonzalo Medina Jan 23 at 20:12

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.