# How to remove “zero” preceding section number?

\documentclass[11pt]{book}
\usepackage[svgnames]{xcolor}
\makeatletter
\let\stdl@section\l@section
\renewcommand*{\l@section}[2]{%
\stdl@section{\textcolor{blue}{#1}}{\textcolor{blue}{#2}}}
\let\stdl@subsection\l@subsection
\renewcommand*{\l@subsection}[2]{%
\stdl@subsection{\textcolor{DarkGreen}{#1}}{\textcolor{DarkGreen}{#2}}}
\makeatother
\setcounter{tocdepth}{2}
\begin{document}
\tableofcontents

\chapter*{chapter1}
\section{Section One}
\subsection{Subsection One}
\subsection{Subsection Two}
\section{Section Two}
\subsection{Subsection One}
\subsection{Subsection Two}
\end{document}


Now it has a preceding zero in front of the section numbers. How can I get rid of zero. For reference I am attaching an image as well.

-

this will get rid of the zero and period in both the toc and the body of the document:

\makeatletter
\renewcommand{\thesection}{%
\ifnum\c@chapter<1 \@arabic\c@section
\else \thechapter.\@arabic\c@section
\fi
}
\makeatother


this assumes that the chapter counter is already properly defined, as it is in the book and report classes.

-
It worked great, thanks –  Aku Feb 20 '12 at 17:01

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


This line above removes the chapter number from the section number. Unchanged, this would look something like

\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}


The changed output:

and

-
it worked as well, thank you –  Aku Feb 20 '12 at 17:01