![如何為新的計數器樣式定義自己的符號序列?](https://rvso.com/image/327786/%E5%A6%82%E4%BD%95%E7%82%BA%E6%96%B0%E7%9A%84%E8%A8%88%E6%95%B8%E5%99%A8%E6%A8%A3%E5%BC%8F%E5%AE%9A%E7%BE%A9%E8%87%AA%E5%B7%B1%E7%9A%84%E7%AC%A6%E8%99%9F%E5%BA%8F%E5%88%97%EF%BC%9F.png)
答案1
您可以輕鬆地調整其定義\alph
,如下所示latex.ltx
:
\def\alph#1{\expandafter\@alph\csname c@#1\endcsname}
\def\@alph#1{%
\ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or
k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or
y\or z\else\@ctrerr\fi}
這是自訂序列的 MWE。
\documentclass{article}
\makeatletter
\def\mysequence#1{\expandafter\@mysequence\csname c@#1\endcsname}
\def\@mysequence#1{%
\ifcase#1\or AAA\or BBB\or CCC\else\@ctrerr\fi}
\makeatother
\renewcommand\thesection{\mysequence{section}}
\begin{document}
\section{Section}
\section{Section}
\section{Section}
%\section{Section} % --> LaTeX Error: Counter too large
\end{document}
請注意,如果計數器值太高(在我的範例 4 中),此實作將停止工作。因此請確保定義了足夠的符號。