사용자 정의 섹션 번호 매기기 만들기

사용자 정의 섹션 번호 매기기 만들기

저는 LaTeX를 처음 사용합니다. 사용자 정의 문자열 목록(primo, secundo, tertio…)을 사용하여 섹션 번호 매기기 스타일을 만들고 싶습니다. 내 이해는 다음과 같이 해야 한다는 것입니다.

\renewcommand\thesection{\fnsymbol{section}}

물론이 아니라 \fnsymbol여기에 영감을 받은 또 다른 명령을 사용하여 *, †, ‡… 대신 내 사용자 정의 목록을 생성하는 것입니다. 유일한 문제는 어떻게 해야 할지 모른다는 것입니다. 명령의 소스 코드를 어디서 찾을 수 있는지조차 모르겠습니다 \fnsymbol. 누군가 나를 도와 줄 수 있습니까?

답변1

서수를 기록하려면 다음과 같은 것 같습니다.두 개의 패키지그것에 적합합니다:

LaTeX 카운터에 대한 인터페이스도 있는 numspell기본 실제 숫자로만 작동한다는 점에서 약간 다른 인터페이스가 있습니다 .fmtcount

패키지 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}

여기에 이미지 설명을 입력하세요

관련 정보