0

I would like to give a title ("Complements") to an appendix : initially, I thought to title using \section by removing the numbering (using \section*{Complements}) but for the following subtitles ( \subsection{Title 1}) the numbering is not correct (.1 instead of A.1)

So I was wondering if there was a way to give an appendix a title?

So I was wondering if there was a way to give an appendix a title?

thank you in advance

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 
\usepackage[french]{babel}
\usepackage[left=1.5cm, right=1.5cm, top=1.5cm, bottom=1.5cm]{geometry}

\usepackage{array}
\usepackage{enumitem}  %pour l'option [resume] qui permet de reprendre la numérotation
\usepackage{pifont}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage[export]{adjustbox}
\usepackage{verbatim}
\usepackage{multicol}
\usepackage{appendix}

\usepackage{graphicx}
\usepackage{picinpar}

\usepackage[european, RPvoltages, straightvoltages]{circuitikz}
\usepackage{siunitx}
\usepackage{hyperref}
\usepackage{titlesec}

\hypersetup{colorlinks=false, linkcolor=black}
\usetikzlibrary{babel}
\usepackage{lmodern}
\newenvironment{manip}{\begin{itemize}[label=\ding{45}]}{\end{itemize}}
\usepackage{booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X} 
\titleformat{\section}[hang]{\LARGE \bfseries}{\Roman{section}}{1em}{}
\titlespacing*{\section}{0pt}{*5}{*0.5}
\titleformat{\subsection}[hang]{\Large \bfseries}{\Roman{section}.\arabic{subsection}}{1em}{}
\titlespacing*{\subsection}{0pt}{*4}{*0.5}
\titleformat{\subsubsection}[hang]{\large \bfseries}{\Roman{section}.\arabic{subsection}.\alph{subsubsection}}{1em}{}
\titlespacing*{\subsubsection}{0pt}{*3}{*0.5}
\titleformat{\paragraph}[hang]{\normalsize \bfseries}{\theparagraph}{0em}{}
\titlespacing*{\paragraph}{0pt}{*3}{*0.5}


\begin{document}
\section{Titre}
\subsection{SOus-titre}
\subsection{sous-titre}
\section{Titre}
\subsection{SOus-titre}
\subsection{sous-titre}

\appendix
\clearpage
\renewcommand{\thesubsection}{\Alph{subsection}}
\renewcommand{\thesubsubsection}{\Alph{subsection}.\arabic{subsubsection}}
\section*{Compléments} %title of the appendice
\subsection{Titre}
\subsection{Titre}
\end{document}```
2
  • Normally, in the article class each appendix should be a section. Commented May 24, 2021 at 16:52
  • in fact I have only one annex with subtitles
    – Nicolas
    Commented May 24, 2021 at 16:55

2 Answers 2

1

The \appendix command resets the section number to 0. You define the \titleformat for \subsection with \Roman{section, which will be empty for section number 0. So you should redefine it for the appendices to use the new subsection number format.

\renewcommand{\thesubsection}{\Alph{subsection}}
\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}
\titleformat{\subsection}[hang]{\Large \bfseries}{\thesubsection}{1em}{}
1
  • thanks, it works
    – Nicolas
    Commented May 24, 2021 at 19:34
0

I see you use the appendix package. Try

\usepackage[page]{appendix} % put a title in the document
\renewcommand{\appendixpagename}{Complements}
...
\begin{appendices}
\section{Title}
\section{Title}
\subsection{Subtitle}
\end{appendices}

Read the appendix package manual for more information. (I have a feeling that the appendices environment does not necessarily work well with titlesec changes to divisional commands.)

You must log in to answer this question.

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