字幕格式改变

字幕格式改变

我希望我的图形标题格式如下:

1 pav. 第一个标题

2 pav. 第二个标题

此外,我需要将我的标题居中。

我该如何重新定义它?

答案1

为了获得“1 pav”而不是“图 1”,您可以按如下方式破解 IEEE 文档类(但请注意,出版商可能不会喜欢这样)。

\documentclass[journal]{IEEEtran}
\renewcommand\figurename{pav}
\makeatletter
\def\fnum@figure{\thefigure\ \figurename}
\makeatother
\begin{document}
\begin{figure}
\rule{4cm}{4cm}
\caption{A nice figure}
\end{figure}
\begin{figure}
\rule{4cm}{4cm}
\caption{Another nice figure}
\end{figure}
\end{document}

\@makecaption使标题居中比较困难。一种可能性是从文件中复制定义cls并进行调整,使标题的行为与 IEEE 会议论文中的行为相同(如果标题适合一行则居中)。

\documentclass[journal]{IEEEtran}
\makeatletter
%
\long\def\@makecaption#1#2{%
% test if is a for a figure or table
\ifx\@captype\@IEEEtablestring%
% if a table, do table caption
\footnotesize\begin{center}{\normalfont\footnotesize #1}\\{\normalfont\footnotesize\scshape #2}\end{center}%
\@IEEEtablecaptionsepspace
% if not a table, format it as a figure
\else
\@IEEEfigurecaptionsepspace
% 3/2001 use footnotesize, not small; use two nonbreaking spaces, not one
\setbox\@tempboxa\hbox{\normalfont\footnotesize {#1.}~~ #2}%
\ifdim \wd\@tempboxa >\hsize%
% if caption is longer than a line, let it wrap around
\setbox\@tempboxa\hbox{\normalfont\footnotesize {#1.}~~ }%
\parbox[t]{\hsize}{\normalfont\footnotesize\noindent\unhbox\@tempboxa#2}%
% if caption is shorter than a line, center 
\else%
\hbox to\hsize{\normalfont\footnotesize\hfil\box\@tempboxa\hfil}%
\fi\fi}
%
\renewcommand\figurename{pav}
\def\fnum@figure{\thefigure\ \figurename}
\makeatother
\begin{document}
\begin{figure}
\centering\rule{4cm}{4cm}
\caption{A nice figure}
\end{figure}
\begin{figure}
\centering\rule{4cm}{4cm}
\caption{Another nice figure}
\end{figure}
\end{document}

答案2

该解决方案涉及 boxhandler 包,可让您最大程度地控制字幕,如三个示例所示。

\documentclass{article}
\usepackage{boxhandler}

\makeatletter
\def\figurename{pav}
\def\fnum@figure{\thefigure\nobreakspace\figurename}
\makeatother

\begin{document}
\captionStyle{o}{c}
\bxfigure{This is the caption to the figure, which I am making very long
to show a point}{\fbox{This is the figure right here}}

\captionStyle{n}{c}
\bxfigure{This is the caption to the figure, which I am making very long
to show a point}{\fbox{This is the figure right here}}

\constrainCaptionWidth{\textwidth}
\bxfigure{This is the caption to the figure, which I am making very long
to show a point}{\fbox{This is the figure right here}}

\end{document}

在此处输入图片描述

相关内容