TransWikia.com

Custom section numbering (letters and numbers)

TeX - LaTeX Asked on January 6, 2021

Can I have something like that ?

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

The idea is to introduce a title/section that is enumerated with a letter or eventually somthing else but without changing the sections structure. So this enumerating can appear the same in toc.

One Answer

You could add new section levels with titlesec. The following example introduces two new section levels, Title and subtitle (the capital T is there to avoid confusion with the title command), which are below subsection and above 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}{bfserieslarge}{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}

The output is the following.

The general formatting of the new section levels can be changed with titleformat and titlespacing, and the numbering can be changed with the theTitle and thesubtitle commands. With this example, the new section levels will appear in ToC, but the formatting should be manually handled, for example with titletoc.

Answered by Vincent on January 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP