私は LaTeX 初心者です。カスタム文字列リスト (primo、secundo、tertio…) を使用してセクション番号付けスタイルを作成したいと思います。私の理解では、次のようにすればよいと思います。
\renewcommand\thesection{\fnsymbol{section}}
もちろん、それではなく\fnsymbol
、それに触発された別のコマンドを使用して、*、†、‡…の代わりにカスタムリストを生成します。唯一の問題は、それをどのように行うのか全く分からないことです。\fnsymbol
コマンドのソースコードがどこにあるかさえ知りません。誰かこれを手伝ってくれませんか?
答え1
序数を表記するには、2つのパッケージそれに適しています:
これらは、LaTeX カウンター用のインターフェースも備えており、numspell
そのままでは実際の数値のみで動作するという点で若干異なるインターフェースを備えています。fmtcount
パッケージfmtcount
は性別 (男性、女性、中性) を暗黙的にサポートしているように見えますが、numspell
明示的な言語についてはサポートしているだけです。
ラテン語は ではサポートされていますnumspell
が、 ではサポートされていませんfmtcount
。(あなたの例はラテン語のようです。)
イタリア語の始まりです。(ほぼ終わりましたか?)
目次と参考文献には同じ番号体系が使用されているので注意してください。
- パッケージの間隔は調整されており
tocloft
、 - 参照の例が正しくない可能性があります。
実際に独自のルックアップ テーブルを作成したい場合は、トップレベルのコマンド (カウンター用) と実際の作業を実行する低レベルのコマンドが必要になります。
これには、\NewNumberingScheme{<scheme>}{<look up>}
マクロを使用して設定することができます
\<scheme>
そして\@<scheme>
、
他のすべて ( arabic
、、、)の動作も同様でalph
、はで使用する必要のある1 つの引数(カウンターの値)を取ります。roman
fnsymbol
\@<scheme>
#1
<look up>
\weird
次のように使用できる小さな例を追加しました\fnsymbol
:
\NewNumberingScheme{weird}{%
\ifcase #1\relax zero\or eins\or second\or tertio\or viertes\or
fifth\or another one\else more than six\fi}
\renewcommand*\thesubsection{\weird{subsection}}
コード
\documentclass[italian]{article}
\usepackage{babel}
\usepackage{fmtcount}
% Adusting Table of Contents spacing
\usepackage{tocloft}
\setlength\cftsecnumwidth{5em}
\setlength\cftsubsecnumwidth{5em}
\setlength\cftsubsubsecnumwidth{6em}
\renewcommand*{\thesection}{\Ordinalstring{section}}
\usepackage{cleveref}
% custom numbering scheme
\makeatletter
\newcommand*\NewNumberingScheme[2]{%
\edef\@tempa{\noexpand\newcommand*\expandafter\noexpand\csname #1\endcsname[1]{%
\noexpand\expandafter\expandafter\noexpand\csname @#1\endcsname\noexpand\csname c@####1\endcsname}%
\noexpand\newcommand*\expandafter\noexpand\csname @#1\endcsname}%
\@tempa[1]{#2}}
\makeatother
\NewNumberingScheme{weird}{%
\ifcase #1\relax zero\or eins\or second\or tertio\or viertes\or
fifth\or another one\else more than six\fi}
\renewcommand*\thesubsection{\weird{subsection}}
%%% only for blindtext
\usepackage{blindtext}% ignore warning about italian not defined:
\makeatletter\renewcommand\blind@checklanguage{}\makeatother
%%%
\begin{document}
\tableofcontents
\blinddocument
\blinddocument
\section{test}
\label{test}
This is \cref{test}.
\end{document}
出力
答え2
文字列のシーケンスを定義します。
\documentclass{article}
\makeatletter
\NewExpandableDocumentCommand{\mynumbering}{m}{%
\ExpandArgs{c}\@mynumbering{c@#1}%
}
\ExplSyntaxOn
\NewExpandableDocumentCommand{\@mynumbering}{m}
{
\int_case:nn { #1 }
{
{1}{primo}
{2}{secundo}
{3}{tertio}
%...
}
}
\ExplSyntaxOff
\renewcommand{\thesection}{\mynumbering{section}}
\begin{document}
\section{First}
\section{Second}
\section{Third}
\end{document}