![新しいカウンター スタイルに独自のシンボルのシーケンスを定義するにはどうすればよいでしょうか?](https://rvso.com/image/327786/%E6%96%B0%E3%81%97%E3%81%84%E3%82%AB%E3%82%A6%E3%83%B3%E3%82%BF%E3%83%BC%20%E3%82%B9%E3%82%BF%E3%82%A4%E3%83%AB%E3%81%AB%E7%8B%AC%E8%87%AA%E3%81%AE%E3%82%B7%E3%83%B3%E3%83%9C%E3%83%AB%E3%81%AE%E3%82%B7%E3%83%BC%E3%82%B1%E3%83%B3%E3%82%B9%E3%82%92%E5%AE%9A%E7%BE%A9%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%82%88%E3%81%84%E3%81%A7%E3%81%97%E3%82%87%E3%81%86%E3%81%8B%3F.png)
カウンターのスタイルを次のように変更できることはわかっています。
\renewcommand\thechapter{\Roman{chapter}}
(上記のコマンドを実行すると、章番号が大文字のローマ数字で表記されます)
しかし、ウィキブックスそして答えこの質問アラビア文字、ローマ字、ギリシャ文字、脚注記号の中からしか選択できません。
\arabic
1、2、3...\alph
a、b、c...\Alph
A、B、C…\roman
1、2、3 ...\Roman
Ⅰ、Ⅱ、Ⅲ…\fnsymbol
脚注を対象とし、一連の記号を印刷します。
カウンターに独自のシンボルシーケンスを定義する方法はありますか?
答え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)、この実装は動作を停止することに注意してください。したがって、十分な数のシンボルを定義するようにしてください。