2

Due to typographical preference, I want to use subsubsection as my subsection. However, I don't want a placeholder with a zero in it for my non-existent subsection numbering. How can I get rid of the zeros?

enter image description here

\documentclass{article}
\begin{document}
\section{Section} 
\subsection{Subsection Header Too Big For Me}
\subsubsection{I Want This Numbered as a Subsection}
\section{Other Section} 
\subsubsection{I Don't Want This Zero in the Middle}
\subsubsection{For Example, This Should be ``2.1''}
\section{Third Section} 
\subsubsection{This Should Be Numbered ``3.1''}
\subsubsection{I Don't Want This ``0'' for a Non-Existent Subsection}
\end{document}
3
  • 3
    You may consider using packages such as titlesec to modify the style of \subsection to meet your typographical preference. Here on this site you can find plenty such examples.
    – Jinwen
    Commented Feb 27, 2022 at 8:58
  • 2
    In other words, you would like to have \subsubsections that for all intents and purposes work like \subsections, except for the heading's font size. Am I reading this right? If this is true, it would open up a different (simpler) kind of solutions. (f.i. you could do what @Jinwen suggested: edit the typographical looks of \subsection)
    – marquinho
    Commented Feb 27, 2022 at 8:58
  • 2
    This is a good place to start.
    – marquinho
    Commented Feb 27, 2022 at 9:01

3 Answers 3

5

If its just about typography and the looks of things you could redefine subsection by using:

\makeatletter    
\renewcommand\subsection{\@startsection {subsection}{1}{\z@}%
                                  {-3.5ex \@plus -1ex \@minus -.2ex}%
                                  {2.3ex \@plus.2ex}%
                                  {\centering\normalfont\large\bfseries}}
\makeatother

Just substitute large with whatever fits your needs.

0

I just added this line below, it is solved. I could remove all the zeros between the subsubsection numbering:

\renewcommand{\thesubsubsection}{\thesection.\arabic{subsubsection}}
0

If you do, from a terminal window,

latexdef subsection subsubsection`

you will get the standard definition for \subsection and \subsubsection

\subsection:
\long macro:->\@startsection {subsection}{2}{\z@ }{-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}{\normalfont \large \bfseries }

\subsubsection:
\long macro:->\@startsection {subsubsection}{3}{\z@ }{-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}{\normalfont \normalsize \bfseries }

so you see that the simple difference is the font size. OK, how can you easily fix it? In two ways, neither of which relying on using \subsubsection instead of \subsection.

Method 1: sectsty

\documentclass{article}
\usepackage{sectsty}

\subsectionfont{\normalsize}

\begin{document}
\section{Section} 
\subsection{I Want This Numbered as a Subsection}
\section{Other Section} 
\subsection{I Don't Want This Zero in the Middle}
\subsection{For Example, This Should be ``2.1''}
\section{Third Section} 
\subsection{This Should Be Numbered ``3.1''}
\subsection{I Don't Want This ``0'' for a Non-Existent Subsection}
\end{document}

There are two innocuous warnings.

Method 2: etoolbox

\documentclass{article}
\usepackage{etoolbox}

\patchcmd{\subsection}{\large}{\normalsize}{}{}

\begin{document}
\section{Section} 
\subsection{I Want This Numbered as a Subsection}
\section{Other Section} 
\subsection{I Don't Want This Zero in the Middle}
\subsection{For Example, This Should be ``2.1''}
\section{Third Section} 
\subsection{This Should Be Numbered ``3.1''}
\subsection{I Don't Want This ``0'' for a Non-Existent Subsection}
\end{document}

Output with either method

enter image description here

You must log in to answer this question.

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