2

I managed to change the subsubsection numbering with the following command :

\renewcommand*{\thesubsubsection}{\arabic{subsubsection}.}

However, the cleveref \Cref{mysubsubsection} return Section 1.

I would like to have a cleveref like Section x.y.z.1

MWE :

\documentclass{article}
\usepackage[utf8]{inputenc}
\renewcommand*{\thesubsubsection}{\arabic{subsubsection}.}
\usepackage[nameinlink, french]{cleveref}

\begin{document}
\section{My Section}
\subsection{My subsection}
\subsubsection{My subsubsection}\label{mysubsubsection}
My section ref is : \Cref{mysubsubsection} and I would like to be "Section 1.1.1"
\end{document}

Result :

enter image description here

  • \renewcommand*{\thesubsubsection}{\thesubsection.\arabic{subsubsection}.} – Jesse op den Brouw Aug 25 '18 at 15:45
2

This should work for most cross-referencing packages since it updates the primary referencing components as well as the display component from the LaTeX kernel:

enter image description here

\documentclass{article}

\makeatletter
\renewcommand{\thesubsubsection}{\arabic{subsubsection}}
\renewcommand{\p@subsubsection}{\thesubsection.}
\renewcommand{\@seccntformat}[1]{%
  \csname the#1\endcsname
  \ifnum\pdfstrcmp{#1}{subsubsection}=0 .\fi% If this is a subsubsection, add a period
  \quad}
\makeatother

\usepackage[nameinlink]{cleveref}

\begin{document}

\section{My Section}

\subsection{My subsection}

\subsubsection{My subsubsection}\label{sssec:mysubsubsection}

My section ref is : \Cref{sssec:mysubsubsection} and I would like to be ``Section 1.1.1''.

\end{document}
  • I don't know what this stuff is doing, but it's doing great ! Thx a lot ! – Maxouille Aug 25 '18 at 15:59
  • Could you please post the same code for the paragraph ? :) It would be nice – Maxouille Aug 25 '18 at 16:02
  • @Maxouille: Try this paste. – Werner Aug 27 '18 at 16:53
  • Thx ! One more question, is it possible to delete the dot after the full reference and keep it in the subsubsection numbering ? Like 1. my subsubsection and Section 1.1.1.1 ? – Maxouille Aug 28 '18 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.