我是乳膠新手。我想使用自訂字串清單(primo、secundo、tertio...)來建立節編號樣式。我的理解是我應該要做這樣的事情:
\renewcommand\thesection{\fnsymbol{section}}
當然不是\fnsymbol
,而是使用受其啟發的另一個命令,產生我的自訂清單而不是 *、†、‡... 唯一的問題是,我不知道該怎麼做。我什至不知道在哪裡可以找到該\fnsymbol
命令的源代碼。有人可以幫我解決這個問題嗎?
答案1
為了寫出序數,似乎有兩個包裹適合:
它們的介面略有不同,numspell
僅適用於開箱即用的實際數字,其中fmtcount
還有一個用於 LaTeX 計數器的介面。
該fmtcount
軟體包似乎對性別(男性、女性、中性)有隱式支持,而numspell
僅對某些明確的語言有支持。
拉丁語言受支持,numspell
但不被 支持fmtcount
。 (你的例子似乎是拉丁文的。)
這是義大利語的開始。 (夠接近?)
請注意,由於目錄和參考文獻使用相同的編號方案
- 間距已隨封裝調整
tocloft
, - 引用的案例可能不正確。
如果您確實想建立自己的查找表,您將需要一個頂級命令(用於計數器)和一個執行實際工作的低階命令。
為此,您可以使用\NewNumberingScheme{<scheme>}{<look up>}
設定的宏
\<scheme>
和\@<scheme>
,
與所有其他的工作方式類似 ( arabic
, alph
, 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}