3

I'm having troubles with sections number...Each section continues the numeration of the precedent one, although a new chapter has started.

here is a MWE

\documentclass[12pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{remreset,siunitx,array,textgreek,booktabs,etoolbox,geometry}
\usepackage{graphicx,wrapfig,lscape,rotating,amsmath}
\geometry{letterpaper}
\sisetup{text-micro=\textmu}

\title{\Huge\textbf{Title}}
\author{di \textbf{Author}}
\date{date}

\makeatletter
  \renewcommand \thesection {\@arabic\c@section}
  \@removefromreset{section}{chapter}
\makeatother

\begin{document}
\maketitle 

\chapter*{C1}
\section{S1.1}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah

\section{S1.2}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah   blah blah blah
\chapter*{C2}
\section{S2.1}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
\section{S2.2}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 

\chapter*{C3}
\section{S3.1}
blah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah 

How can I solve this problem?

  • 1
    Try to comment the line \@removefromreset{section}{chapter} – Sigur May 17 '14 at 18:50
  • Plus, use \chapter (the non-starred version) instead of \chapter*. – lockstep May 17 '14 at 18:50
  • 1
    Its the \chapter* command and your example is not complete. \end{document} is missing ;-) – user31729 May 17 '14 at 18:51
  • @Sigur Commenting the line didn't help. – Mengops May 17 '14 at 18:54
  • @lockstep Ok but I do need to use \chapter* because I don't want to see the "Chapter #" header to each chapter. Is there anyway to solve the problem and keep \chapter*? – Mengops May 17 '14 at 18:58
2

Quick and dirty redefinition of \chapter* 'works', it resets the section counter within and uses the usual chapter* style anyway.

\documentclass[12pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{remreset,siunitx,array,textgreek,booktabs,etoolbox}
\usepackage{geometry}
\usepackage{graphicx,wrapfig,lscape,rotating,amsmath}
\geometry{letterpaper}
\sisetup{text-micro=\textmu}

\title{\Huge\textbf{Title}}
\author{di \textbf{Author}}
\date{date}


\let\LaTeXStandardChapter\chapter

\makeatletter
\renewcommand{\chapter}{%
\@ifstar{\improvedstarredchapter}{\LaTeXStandardChapter}%
}%

\newcommand{\improvedstarredchapter}[1]{%
\setcounter{section}{0}%
\LaTeXStandardChapter*{#1}%
}%

\makeatother


\makeatletter
  \renewcommand \thesection {\@arabic\c@section}
\makeatother



\begin{document}
\maketitle 

\chapter*{C1}
\section{S1.1}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah

\section{S1.2}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah   blah blah blah
\chapter*{C2}
\section{S2.1}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
\section{S2.2}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 

\chapter*{C3}
\section{S3.1}
blah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah 

\end{document}
3

If all you want is to remove the “Chapter n” part, the workaround is very simple: just change \@makechapterhead not to produce it and the easiest way is to use the same command used when \chapter* is found.

\documentclass[12pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{siunitx,array,textgreek,booktabs,etoolbox,geometry}
\usepackage{graphicx,wrapfig,lscape,rotating,amsmath}

\sisetup{text-micro=\textmu}

\makeatletter
\let\@makechapterhead\@makeschapterhead
\makeatother

\title{\Huge\textbf{Title}}
\author{di \textbf{Author}}
\date{date}

\begin{document}

\chapter{C1}
\section{S1.1}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah

\section{S1.2}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah   blah blah blah
\chapter{C2}
\section{S2.1}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
\section{S2.2}
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 

\chapter{C3}
\section{S3.1}
blah blah blahblah blah blahblah blah blahblah blah blahblah blah blahblah 

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.