Document Classes ⇒ Report vs. Article
Report vs. Article
I am beginning with Latex, and find it awesome. However I have a problem seriously bugging me.
I would like to use report as my document class as I find it perfect (title on seperate page, vertically and horizontally centered, parts on seperate pages, etc.). However, I DO NOT want to use chapters, only parts, sections, subsections, etc. My table of contents thus show sections as 0.1, 0.2, etc. as I have not defined any chapter. How can I change numbering in a report-class Table of Content to be PART.SECTION instead of CHAPTER.SECTION?
Thanks!
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Report vs. Article
you can do a redefinition of the representation of the section counter and some adjustment to make this counter restart with every new part; an example:
Code: Select all
\documentclass{report}
\usepackage{chngcntr}
\renewcommand\thesection{\thepart.\arabic{section}}
\counterwithin{section}{part}
\begin{document}
\tableofcontents
\part{Test part one}
\section{Test section one one}
\section{Test section one two}
\part{Test part two}
\section{Test section two one}
\section{Test section two two}
\end{document}
Report vs. Article
Great, except parts are numbered with roman numerals and sections are displayed as I.1, II.1, etc. in the TOC. I would like either parts as arabic and sections as 1.1, 2.1, etc. in the TOC or parts as roman and sections as 1.1, 2.1, etc.gmedina wrote:Hi,
you can do a redefinition of the representation of the section counter and some adjustment to make this counter restart with every new part; an example:
Code: Select all
\documentclass{report} \usepackage{chngcntr} \renewcommand\thesection{\thepart.\arabic{section}} \counterwithin{section}{part} \begin{document} \tableofcontents \part{Test part one} \section{Test section one one} \section{Test section one two} \part{Test part two} \section{Test section two one} \section{Test section two two} \end{document}
As long as section are pure arabic, parts can be roman or arabic. How do I go about it?
Report vs. Article
Code: Select all
\renewcommand\thepart{\arabic{part}}
Report vs. Article
Ahhhh great! That worked perfectly. Thank you very much.gmedina wrote:Code: Select all
\renewcommand\thepart{\arabic{part}}
If I understand correctly, the above command (re)sets part numbers to arabic.
However what I don't understand is the \counterwithin command, is it a TOC-specific command?
Thanks again!