你可以使用
\def\sab#1{%
\expandafter\ifcase\csname c@#1\endcsname%
\or 甲%
\or 乙%
\or 丙%
\or 丁%
\or 戊%
\or 己%
\or 庚%
\or 辛%
\or 壬%
\or 癸%
\fi%
}
定义一种计数器(\sab
) Stems-and-Branches
(天干地支), 然后修改 \thefigure
\def\thefigure{\sab{figure}}
源码如下:
\documentclass{ctexart}
\usepackage{caption}
% Stems-and-Branches
\def\sab#1{%
\expandafter\ifcase\csname c@#1\endcsname%
\or 甲\or 乙\or 丙\or 丁\or 戊\or 己\or 庚\or 辛\or 壬\or 癸
\fi%
}
\def\thefigure{\sab{figure}}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics[width = 5cm]{example-image}
\caption{this is a picture.}\label{fig:a}
\end{figure}
\begin{center}
\includegraphics[width = 5cm]{example-image-a}
\captionof{figure}{this is a fig.}\label{fig:b}
\end{center}
\verb|hahahhahahha and this is \ref{fig:a} and \ref{fig:b}| $==>$
hahahhahahha and this is \ref{fig:a} and \ref{fig:b}
\end{document}
- 下次提问希望能够尽可能提供最小工作示例
- 楼上用了
LaTeX3
我就用TeX
吧(
问 captionof 后如何自定义 ref 时显示的名字