# [Tex/LaTex] Change caption of a single/few figures

captions

The captions of my figures read, as usual, "Figure #: some text". I want a few of them, which are scattered through the text, to read "Diagram #: some text" (the counter being consecutive). What is the right way to do this? Should I define a new float environment?

Here, a minimal example:

\documentclass{article}
\usepackage{amssymb,latexsym,amsmath}
\usepackage{amsmath,amsthm,amssymb,pstricks,pst-node}
\begin{document}

Some text, and then:

\begin{figure}[htb]
$\text{This is a figure}$
\caption{Ok. Here I like the label figure}
\end{figure}

Now:

\begin{figure}[htb]
$\begin{array}{cc} \Rnode{a}{A} & \Rnode{b}{B} \end{array} \ncLine{a}{b}\Aput{}$
\caption{Wrong! Here I would like the caption to say Diagram 2:...''}
\end{figure}

and finally:

\begin{figure}[htb]
$\vspace{-.1cm} \setlength{\arraycolsep}{1.8cm} \text{This is another figure}$
\caption{Ok. Here I like the label figure}
\end{figure}

\end{document}


First solution Temporarily redefine the \figurename to Diagram within the figure environment. (Thanks to Torbjorn for his reminder about the group feature of figure)

\documentclass{article}
\usepackage{amssymb,latexsym,amsmath}
\usepackage{amsmath,amsthm,amssymb,pstricks,pst-node}
\begin{document}

Some text, and then:

\begin{figure}[htb]
$\text{This is a figure}$
\caption{Ok. Here I like the label figure}
\end{figure}

Now:

\begin{figure}[htb]
\renewcommand{\figurename}{Diagram}%
$\begin{array}{cc} \Rnode{a}{A} & \Rnode{b}{B} \end{array} \ncLine{a}{b}\Aput{}$
\caption{Wrong! Here I would like the caption to say Diagram 2:...''}
\end{figure}

and finally:

\begin{figure}[htb]
$\vspace{-.1cm} \setlength{\arraycolsep}{1.8cm} \text{This is another figure}$
\caption{Ok. Here I like the label figure}
\end{figure}

\end{document}


Edit -- Alternate Version using \usepackage{caption}

\documentclass{article}
\usepackage{amssymb,latexsym,amsmath}
\usepackage{amsmath,amsthm,amssymb,pstricks,pst-node}
\usepackage{caption}
\begin{document}

Some text, and then:

\begin{figure}[htb]
$\text{This is a figure}$
\caption{Ok. Here I like the label figure}
\end{figure}

Now:

\begin{figure}[htb]
\captionsetup{name=Diagram}
$\begin{array}{cc} \Rnode{a}{A} & \Rnode{b}{B} \end{array} \ncLine{a}{b}\Aput{}$
\caption{Not longer Wrong! Here I get the caption to say Diagram 2:...''}
\end{figure}

and finally:

\begin{figure}[htb]
$\vspace{-.1cm} \setlength{\arraycolsep}{1.8cm} \text{This is another figure}$
\caption{Ok. Here I like the label figure}
\end{figure}

\end{document}