To make it seem like the following, I would like to add a frame box to the numbering of each section, subsection, and subsubsection.
but the following code doesn't seem to work for 'subsubsection'.
\documentclass[12pt,a4paper]{report}
\usepackage[french]{babel}
\usepackage[a4paper,margin=0.5in]{geometry}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[Glenn]{fncychap}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\thesection{\fbox{\Roman{section}}}
\renewcommand\thesubsection{\fbox{\arabic{subsection}}}
\renewcommand\thesubsubsection{\fbox{\begin{english}\textit{\alph{subsubsection}}\end{english}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{}
\section{Section}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsubsection{\fbox{a} subSubsection}
\subsubsection{\fbox{b} subSubsection}
\section{section}
\subsection{subsection}
\subsubsection{\fbox{a} subsubsection}
\end{document}
Best Answer
Some remarks, in no particular order.
The
report
document class executes\setcounter{secnumdepth}{2}
, i.e., it doesn't number subsubsection-level headers automatically. Runto tell LaTeX to number subsubsection-level headers as well.
It's a really bad idea to incorporate the
\fbox
instruction in the (re)definition of\thesection
,\thesubsection
, and\thesubsubsection
. Why? Because the frameboxes will show up in all cross-references to sections, subsections, and subsubsection -- almost certainly not what you want.Instead, employ the low-level
\@seccntformat
macro -- see the code below for an application -- to tell LaTeX to draw frameboxes just in the headers.Since you're using alphabetic letter characters for subsubsection level headers, you should take precautions to ensure that the exact same framebox is used regardless of whether the letter has neither ascender or descender (e.g.,
a
andz
), just an ascender (e.g.,b
), just a descender ('y' or 'j'), or both (italic-shapef
). The sizing irregularity issue may be fixed by inserting a\vphantom{f}
directive in the definition of\subsubsection@cntformat
.