统一图表标题格式

统一图表标题格式

我正在写一份文件imsart风格包。我的图表和表格尽管都是使用命令生成的\caption,但样式却不同,图片已附上。为什么会发生这种情况?我希望两者在我的整个文档中都具有相同的样式,但不确定是哪一种,我想分别尝试一下。我该如何实现呢?

文件中的相关代码imsart.sty如下,但我不确定如何阅读它。它似乎建议使用宏\makecaption而不是\caption,但当我应用它时这是未定义的。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% table, figure

\def\fnum@table{\tablename~\thetable}
\setlength\belowcaptionskip{4\p@}

\renewenvironment{table}
               {\let\@makecaption\@maketablecaption\@float{table}}
               {\end@float}
\renewenvironment{table*}
               {\let\@makecaption\@maketablecaption\@dblfloat{table}}
               {\end@dblfloat}

\long\def\@maketablecaption#1#2{%
      \tablecaption@shape\tablecaption@size%
      {\tablename@size #1}\tablename@skip #2\par
      \vskip\belowcaptionskip}

\setattribute{tablecaption}{shape}{\centering}
\setattribute{tablecaption}{size} {\footnotesize\itshape}
\setattribute{tablename}   {size} {\scshape}
\setattribute{tablename}   {skip} {\endgraf}


% figure : use \@makecaption:
\renewcommand\figurename{Fig}

\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \footnotesize
  \sbox\@tempboxa{\itshape\textsc{#1}. #2}%
  \ifdim \wd\@tempboxa >\hsize
    \itshape\textsc{#1}. #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}

\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \figurecaption@size
  \sbox\@tempboxa{{\figurename@size #1}\figurename@skip #2}%
  \ifdim \wd\@tempboxa >\hsize
    {\figurename@size #1}\figurename@skip #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}

\setattribute{figurecaption}{size}{\footnotesize\itshape}
\setattribute{figurename}   {size}{\scshape}
\setattribute{figurename}   {skip}{.~}


\def\@floatboxreset{%
        \reset@font
        \@setminipage
        \singlespacing
        \footnotesize
        \centering
}

\if@aihplayout
  \setattribute{tablecaption}{size} {\footnotesize}
  \setattribute{figurecaption}{size}{\footnotesize}
\fi

\if@bjpslayout
  \setattribute{tablename}   {size} {\bfseries\upshape}
  \setattribute{tablename}   {skip} {\enskip}

  \setattribute{figurename}   {size}{\bfseries\upshape}
  \setattribute{figurename}   {skip}{\enskip}
  \def\figurename{Figure}
\fi

答案1

覆盖.tex 文件中的字体应该更容易:

\documentclass{article}
\usepackage{imsart}
\begin{document}
\begin{figure}[h!]
  Figure content
  \caption{Figure caption}
\end{figure}

\begin{table}[h!]
  \caption{Table Caption}
  Table content
\end{table}

\renewcommand{\figurename}{\textsc{Figure}}
\begin{figure}[h!]
  Figure content  
  \caption{\textsc{Figure caption}}
\end{figure}

\renewcommand{\tablename}{\textsc{Tab.}}
\begin{table}[h!]
  \caption{\textsc{Table Caption}}
  Table content
\end{table}

\end{document}

在此处输入图片描述

相关内容