# Include Subsection Number in Section Number

I would like Sections to display the subsection number,
but I feel that redefining \thesection will recursively affect \thesubsection.

Example:

What we currently get:

1.  Section 1
1.1 Section 1, Subsection 1
1.2 Section 1, Subsection 2


What we're looking to get:

1.0 Section 1
1.1 Section 1, Subsection 1
1.2 Section 1, Subsection 2


This post was a helpful start.

• What is the use of this? – user31729 Aug 1 '16 at 15:57
• Our administrator wants this syntax for the documents we're sending out. We're at his mercy. – kando Aug 1 '16 at 18:28

Simply changing \thesection so that it would show whatever it is you want it after the number, then redefine \thesubsection so as not to call \thesection.

\documentclass{article}
\renewcommand{\thesection}{\arabic{section}.0}
\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}

\begin{document}
\tableofcontents
\medskip
text text
\section{test}
nah
\subsection{test1}
blah
\subsection{test2}
jah
\end{document}


resulting in

If you wish to fix the TOC you can use the tocloft package thus

\documentclass{article}
\usepackage{tocloft}

\renewcommand{\thesection}{\arabic{section}.0}
\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}
\renewcommand\cftsecnumwidth{2.5em}

\begin{document}
\tableofcontents
\medskip
text text
\section{test}
nah
\subsection{test1}
blah
\subsection{test2}
jah
\end{document}


This would give you

• The indentations are off in the Table of Contents. Do you know any simple code to alleviate this? (Else I recommend checking this out.) Either way, can you modify your answer to include a solution? – kando Aug 2 '16 at 17:20
• Much thanks. All should note that the method proposed by egreg also works, (although it does not contain Elad Den's ToC fix at this time.) – kando Aug 3 '16 at 14:33

Redefine \thesection to refer to subsection and \thesubsection to be the same as \thesection:

\documentclass{article}
\renewcommand{\thesection}{\arabic{section}.\arabic{subsection}}
\renewcommand{\thesubsection}{\thesection}

\begin{document}

\section{Section}

\subsection{First subsection}

\subsection{Second subsection}

\section{Section}

\subsection{First subsection}

\subsection{Second subsection}

\end{document}


• Oop. I didn't see the subtle difference between you two. Does this fix the ToC? (A peer is making the edits. He used \setlength{cftsecnumwidth}{+XXem} from package tocloft to make his fix.) – kando Aug 2 '16 at 17:28