1

I use this package for making the subsection text smaller:

\usepackage{titlesec}  

However, for some reason, the numbering gets lost, when I use this line of code to control the subsection:

\titleformat{\subsection}{\normalfont\fontsize{8pt}{12pt}\selectfont\bfseries}{\thesection}{1em}{}

What I wanted is to still retain the common functionality of \subsection: 4.4 for example. But instead, all the \subsection command does for me with the modification is this:

4 Test

4 Test

Here a minimal reproducible example:

\documentclass{article}
\usepackage{titlesec} 
\titleformat{\subsection}{\normalfont\fontsize{8pt}{12pt}\selectfont\bfseries}{\thesection}{1em}{}
\title{TEST}
\author{TEST}

\begin{document}
    
\maketitle
    
\newpage
\section{TEST}
\subsection{OTHER TEST}
\subsection{YET ANOTHER TEST}
    
\end{document}
4
  • 1
    Welcome to TeX.SE.
    – Mico
    Commented Oct 23, 2023 at 18:52
  • Welcomed to TeX.SE! Have you tried to write {Subsection \thesection} in your command?
    – Jes
    Commented Oct 23, 2023 at 18:54
  • @Jes What do you mean exactly? Commented Oct 23, 2023 at 18:55
  • 1
    Nevermind, @Mico already answered!
    – Jes
    Commented Oct 23, 2023 at 18:56

1 Answer 1

1

You need to change \thesection to \thesubsection in the third-to-last argument of \titleformat.

enter image description here

\documentclass{article}
\usepackage{titlesec} 
\titleformat{\subsection}{\normalfont\fontsize{8pt}%
   {12pt}\selectfont\bfseries}{\thesubsection}{1em}{}

\begin{document}

\section{TEST}
\subsection{OTHER TEST}
\subsection{YET ANOTHER TEST}
    
\end{document}
2
  • 1
    Thanks for the warm welcome and the nice answer. :) Commented Oct 23, 2023 at 18:57
  • @MySQLInjection - Many thanks for the accept. This may be a new speed record, for me at least, in receiving an accept after posting an answer. :-)
    – Mico
    Commented Oct 23, 2023 at 18:58

You must log in to answer this question.

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