更改单个或几个图片的标题

更改单个或几个图片的标题

我的图表标题照常显示为“图表编号:一些文本”。我希望其中几个分散在文本中的图表标题显示为“图表编号:一些文本”(计数器连续)。正确的做法是什么?我应该定义一个新的浮动环境吗?

这是一个简单的例子:

\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} 

答案1

第一个解决方案暂时重新定义\figurename图表在环境中figure。(感谢 Torbjorn 对 的组队功能的提醒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} 

在此处输入图片描述

编辑--替代版本使用\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} 

在此处输入图片描述

相关内容