GeneralSection Numbering

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Rob K
Posts: 6
Joined: Fri Feb 03, 2012 8:33 pm

Section Numbering

Post by Rob K »

Hi there,

New to LaTeX and this forum, so please bear with me, I am quite competent, but sometimes need stuff spelling out to me. I would like to set up a nice book of my tutorials for one of my modules, it won't get marked or seen, but it is a great way to start using LaTeX for when I do my assignments. So I have a front page, a title, my name and a date. I am trying to set it up so that I have an index comprising of each weekly tutorial, but I want it to start from 1.1 not 0.1, but can't see how to do it.On the wiki page is suggests

Code: Select all

\setcounter{section}{1}
But I can't get it to work, I can get it to start from 0.2 but that's all. Can some one help me with this one please, if you need my preamble and top matter, I can post it, but I am using the standard LaTeX template from the templates drop down menu.

I currently am running a Mac osx Snow Leopard and using TeXShop.


Regards
Rob
Last edited by localghost on Fri Feb 03, 2012 9:05 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Section Numbering

Post by cgnieder »

Since you did not specify anything (which document class, which commands...) nor provided a minimal example (which would have been even better) I'll just give you two examples

Code: Select all

\documentclass{book}
\begin{document}

\section{a}      % 0.1
\chapter{A}      % 1
\section{b}      % 1.1
\subsection{c}   % 1.1.1
\setcounter{chapter}{3}
\subsection{d}   % 3.1.2
\end{document}

Code: Select all

\documentclass{article}
\begin{document}

\section{a}      % 1
\section{b}      % 2
\subsection{c}   % 2.1
\section{d}      % 3
\subsection{e}   % 3.1
\subsubsection{f}% 3.1.1
\subsection{g}   % 3.2

\end{document}
Regards
site moderator & package author
Rob K
Posts: 6
Joined: Fri Feb 03, 2012 8:33 pm

Re: Section Numbering

Post by Rob K »

Thank you, this is very helpful. Is "book" not a document class then, it says it is in the wiki page.
Rob K
Posts: 6
Joined: Fri Feb 03, 2012 8:33 pm

Section Numbering

Post by Rob K »

No, I still can't get it. Here is the code, I can't really post you the pdf, all I can ask is that do you know what I mean when I say the numbering starts at:
0.1
but I want it to start at
1.1

I never heard of a zeroth chapter or section I do not want the 0.

Code: Select all

\documentclass[11pt,a4paper]{report}
\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
%\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}

\title{Principles of Control \\Tutorials}
\author{Robert Kinsey}
%\date{}                                           % Activate to display a given date or no date

\begin{document}
\maketitle
\section{Tutorial 1}
%\subsection{}
Control of stuff


\end{document}  
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Section Numbering

Post by cgnieder »

Yes »book« is a document class, as are »article«, »report« and »letter«. There are some more...
Some of the classes define a »chapter«, like »book« and »report«, others don't.

Since you're using »report« it means that \chapter is defined. It also means that sections are numbered »<number of chapter>.<number of section>«. If you use \section before the first \chapter, you will get numbers »0.1« and the like. There are few ways around this:
  1. use a class that doesn't define chapters and have numbers 1, 2, 3, … for the sections (without leading 0 or any other number)
  2. actually use a chapter before the sections
  3. manually set the counter of the chapters to 1 before using the sections although there is no chapter

    Code: Select all

    \setcounter{chapter}{1}
  4. redefine the way the section numbers are output

    Code: Select all

    \renewcommand\thesection{1.\arabic{section}}
    Note: this will always put a »1« before the section number and section numbers are still reset if chapters are defined and \chapter is used.
Regards
site moderator & package author
Post Reply