自訂部分編號(字母和數字)

自訂部分編號(字母和數字)

我可以有這樣的東西嗎?

1. section one
  1.1 subsection one
  1.2 subsction two

2. section two
  2.1 subsection two

    A. title
       1) subtitle A.1
       2) subtitle A.2

    B. title
       1) subtitle B.1
           a) subsubtitle B.1.a
           b) subsubtitle B.1.b
       2) subtitle B.2

    C. title
    .
    .
    .
    .
    etc

          2.1.1 subsubsection two one
          2.1.2 subsubsection two two
          2.1.3 subsubsection two three
          2.1.4 subsubsection two four

這個想法是引入一個標題/部分,用一個枚舉或最終是其他東西,但不改變部分結構。所以這個枚舉可以出現在相同的目錄

答案1

您可以新增新的部分級別titlesec。以下範例引入了兩個新的部分級別,\Title並且\subtitle(大寫 T 是為了避免與命令混淆\title),它們位於 之下\subsection和之上\subsubsection

\documentclass{article}
\usepackage{titlesec}
\titleclass{\Title}{straight}[\subsection]
\titleclass{\subtitle}{straight}[\Title]
\newcounter{Title}
\newcounter{subtitle}
\renewcommand*{\theTitle}{\Alph{Title}}
\renewcommand*{\thesubtitle}{\arabic{subtitle})}
\titleformat{\Title}{\bfseries\large}{\theTitle}{1em}{}
\titleformat{\subtitle}{\bfseries}{\thesubtitle}{1em}{}
\titlespacing*{\Title}{1.5em}{6pt}{6pt}
\titlespacing*{\subtitle}{3em}{6pt}{6pt}
\setcounter{secnumdepth}{5}

\begin{document}

\section{Section one}
\subsection{Subsection one}
\subsection{Subsection two}

\section{Section two}
\subsection{Subsection one}
\Title{Title}
\subtitle{Subtitle A.1}
\subtitle{Subtitle A.2}

\subsubsection{Subsubsection one}
\subsubsection{Subsubsection two}
\end{document}

輸出如下。

新節層級的一般格式可以使用 和 進行更改\titleformat\titlespacing編號可以使用\theTitle\thesubtitle命令進行更改。在此範例中,新的章節層級將出現在目錄中,但應手動處理格式,例如使用titletoc.

相關內容