cohensh
cohensh

Reputation: 482

Including a decimal in a Latex section number

I'm trying to get my latex sections to be labeled 1.0, 2.0 instead of 1, 2. Is there an easy way to do this or some way to define the specific numbers I want sections to be numbered?

EDIT: I have this basic outline:

\documentclass[12pt]{article}

\begin{document}

\section{first}

\subsection{second}

\end{document}

I currently see:

1 first

1.1 second

I would like:

1.0 first

1.1 second

Upvotes: 5

Views: 7348

Answers (2)

theVirus
theVirus

Reputation: 1

\setcounter{chapter}{-1}% Not using chapters, but they're used in the counters

\renewcommand{\thesection}{\arabic{section}}

\renewcommand*\thesection{\arabic{section}.0}

\renewcommand*\thesubsection{\arabic{section}.\arabic{subsection}}

Upvotes: -1

froeschli
froeschli

Reputation: 2890

This should do the trick for you. Add the following lines to the preamble:

\renewcommand*\thesection{\arabic{section}.0}
\renewcommand*\thesubsection{\arabic{section}.\arabic{subsection}}

EDIT: Changed from document type book to document type article. i.e. chapter replaced with section and section replaced with subsection.

EDIT: Thanks for pointing out the \arabic command! I edited my answer accordingly.

Upvotes: 7

Related Questions