1

I am reading a book whose table of contents has something like this:

...

2.2 Title of the Subsection

2.3 Title of the Subsection

2.3.A Title of the Subsection

2.4 Title of the Subsection

...

How can I achieve exactly that? Please note that 2.3.A is also a subsection, not a subsubsection belonging to 2.3.

Thanks in advance!

5
  • 1
    Welcome to TeX.SE! Can you please explain why you need this? This is very unusual! Do you need this numbering only one time or more?
    – Mensch
    Aug 15, 2019 at 4:39
  • I want to write a pdf file summarizing what each subsection of the book says. So I hope my numbering could be exactly like the book. And I'd say only one time if that's easier to achieve.
    – trisct
    Aug 15, 2019 at 4:58
  • 1
    Basically a duplicate of New level of section, interaction with hyperref
    – Alan Munn
    Aug 15, 2019 at 5:00
  • Please tell us which document class you employ.
    – Mico
    Aug 15, 2019 at 5:29
  • 1
    @Mico I am using article.
    – trisct
    Aug 15, 2019 at 5:35

1 Answer 1

4

I suggest you do the following:

  • In the preamble, issue the intstruction

    \let\origthesubsection\thesubsection
    

    This instruction "saves" the default format of the subsection counter's representation

  • Just before the start of subsection 2.3A, issue the following instructions:

    \renewcommand\thesubsection{\origthesubsection A}
    \addtocounter{subsection}{-1}
    
  • Just before the start of the next, "standard-numbered" subsection, issue the instruction

    \renewcommand\thesubsection{\origthesubsection}
    

This approach works with the hyperref and cleveref packages, and it also lets you create a table of contents via the \tableofcontents instruction.

enter image description here

\documentclass{article}
\usepackage[colorlinks,allcolors=blue]{hyperref}
\usepackage[noabbrev,nameinlink]{cleveref}
\crefname{subsection}{subsection}{subsections}
\setlength\parindent{0pt}

\let\origthesubsection\thesubsection

\begin{document}
\setcounter{section}{2}

\tableofcontents

\subsection{AAA}
\subsection{BBB}
\subsection{CCC}

\renewcommand\thesubsection{\origthesubsection A}
\addtocounter{subsection}{-1}
\subsection{DDD} \label{sec:ddd}

\renewcommand\thesubsection{\origthesubsection}
\subsection{EEE} \label{sec:eee}
\subsection{FFF} \label{sec:fff}

\ref{sec:ddd}, \ref{sec:fff}

\autoref{sec:ddd}, \autoref{sec:fff}

\cref{sec:ddd}, \cref{sec:fff}

\cref{sec:ddd,sec:fff}
\end{document} 
1
  • Thanks very much! It works well and is exactly what I want.
    – trisct
    Aug 15, 2019 at 7:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .