0

Prelude:

"Right now it's like this, And [next one is how] I want to have this:"
Example took from this question on latex.org from 2007: Removing the page number from table of contents

% Current
Page 1 - Table of contents
Page 2 - Introduction
...
% Expected
Table of contents
Page 1 - Introduction
...

Problem Case:

  • Say, I am making a document on a per chapter basis. So, making a chapter, taking print out - submitting it, then repeating for further chapters. [Project/Paper submissions in formal institutes]
  • Now, being only few chapters, the TOC is only one page and numbered 1. And chapter numbers start from 2.
  • On the due course, the TOC becomes long to span multiple pages, now the page numbers on my past submissions are not consistent with my document. And the TOC to be submitted in the end will (of course) be inconsistent as well.

Details:

So, In LaTeX2e <2022-06-01> patch level 5 and prior as well,

  • what is that rationale behind inclusion of ToC in the starting of page numbering??
  • And the steps for accomplishing this (see below) feel more like dealing with elements individually similar to WYSIWYG editors like MS Office
  • Given the philosophy behind LaTeX - mostly good looking formatting out of the box, and defining the structure of the document, this doesn't seem to fit there.
  • So, either i am missing a better way to accomplish this :
    • like say, if there's some high level command to explicitly announce the start of different types of numberings, i.e. which does all the above things - terminates the previous numbering there, sets the counter anew, and starts the new numbering style as specified
    • this would be similar to \appendix does all those things for the chapter numbering
  • or if this is THE way, then I'd like to know the reason/rationale behind.

The steps for accomplishing this:

\documentclass[12pt,a4paper,oneside,titlepage]{report}
\renewcommand*\rmdefault{ptm}

\begin{document}

% Change style of or Remove page numbering to avoid ambiguity
\pagenumbering{roman}
\tableofcontents
% \thispagestyle{empty}

% The counter doesn't seem to reset without this command
\clearpage

% Set p-no. style back to Indo-Arabic
\pagenumbering{arabic}
% Reset the page counter
\setcounter{page}{1}

\chapter{Introduction}
...

\appendix
\chapter{A}

\end{document}
4
  • I would say that your example is indeed the way to go and I personally find it quite straightforward. If the TOC would automatically be printed on non-paginated pages, I would assume that it would be much more counterintuitive to set it up so that it is not printed on non-paginated pages (in cases where one wishes to do so). This way, the TOC is independent from the pagination, and I in my opinion this makes it easy to handle. I'd rather like to have control over things and not have the software assume what I want to do (which certain MS applications we all know annoyingly do). Sep 23 at 7:01
  • I did not mean TOC on non-paginated pages, rather on the other kind of pagination - like roman - like it's done in all books for these pages (acknowledgements, intro to this edition, contents, etc.) Sep 23 at 7:04
  • Well, I still think that having the mechanics of the TOC locigally separated from the mechanics of pagination is beneficial for the use of both in a variatey of applications. It may be true that in all books the TOC has a different pagination, but what about papers with included TOC or other use cases? The functionality of the TOC should be able to handle these as well. Sep 23 at 7:17
  • 2
    Not everyone creates a document in pieces or needs such a numbering. Beside this: the book class implements your requirement through the \frontmatter/\mainmatter commands. Sep 23 at 7:18

2 Answers 2

0

Note you are making things more complicated than needed

\pagenumbering{arabic}
% Reset the page counter
\setcounter{page}{1}

you just need

\pagenumbering{arabic}

as that already resets the counter.

In report class that is the intended markup.

In book class you can use \frontmatter ... \mainmatter ... \backmatter which do this for you.

article and report could not automatically change the page number after table of contents as they are often on the same page as the text, and lists of figures, dedications etc often also need to be in the same number sequence.

Even for books, most (but not all) latex workflows mean the traditional requirement to have the front matter in a separate number sequence does not really apply. In a pre-digital age, adding an extra page to a table of contents and so re-numbering every page in the book would have been an unthinkable cost, but with latex, it's just usually another latex run and the page number references will re-sychronise. So mostly the habit of using roman for the front matter and arabic for the main text is just a nod to tradition, not a technical necessity.

5
  • i did this too: \pagenumbering{roman}\tableofcontents\pagenumbering{arabic}\chapter{Intro} and it didn't work. Neither the Contents page had romans, nor the chapter restarted from 1. And u missed the requirement, that the past ones are hard printed, and already submitted, you can't change that. Sep 23 at 8:50
  • so, i retried, you are right about \setcounter{page}{1} being not needed, but missed the crucial \clearpage. This worked: \clearpage\pagenumbering{roman} \tableofcontents \clearpage\pagenumbering{arabic} \chapter{Intro} Sep 23 at 9:21
  • @user8395964 yes obviously changing the page numbering only has an effect from the next page output, and report tables of contents are not on their own page by default. But since defining \frontmatter/\mainmatter, and having tables of contents on their own page are more or less the man differences between report and book why not use book rather than use report and then define book features by hand? Sep 23 at 11:51
  • i just tried book class, and it has \headings "containing details on the running page of the document" \leftmark \thepage etc Sep 24 at 7:42
  • I didn't miss your paper requirement, that was the "but not all" comment. your requirements are met by the book class and only needed by a very small number of documents, so the "rationale" for not meeting them by default in report class should be clear. Note pre-existing print run requirements are not uncommon but are usually stricter. eg Knuth comments in some updates to the textbook that text added keeping all the change on one page to reduce costs, just keeping the front matter page number sequence separate is not enough. all classes have headngs: use book class with \pagestyle{empty} Sep 24 at 8:17
0

thanks all, please don't delete your comments to the question, they helped me think more about this in this direction.

  • Skimming through documentation, I already had hit on the \frontmatter \mainmatter commands (mentioned by Ulrike in comments) but didn't know they were not in report class, I tried them in report class, didn't work, and then confounded it with \preamble not being a command. Anyways...

if there's some high level command to explicitly announce the start of different types of numberings, i.e. which does all the above things - terminates the previous numbering there, sets the counter anew, and starts the new numbering style as specified

  • So, I came up with following to accomplish that, it seems to be working good, at least so far:
  • Though, I don't know if that would be correct way, or what will be the side effects of it.
\documentclass[12pt,a4paper,oneside,titlepage]{report}
\renewcommand*\rmdefault{ptm}

% **Definition:**
% \newpageseries[<start at 1>]{<style>}
\newcommand{\newpageseries}[2][1]{%
    \clearpage
    \pagenumbering{#2}
    % \setcounter{page}{#1} % Uncomment this optionally
}

\begin{document}

% **Calling/Usage:**
\newpageseries{roman}
\tableofcontents

\newpageseries{arabic}
\chapter{Introduction}

\end{document}
3
  • So ... is this supposed to be an answer to your question? Maybe it should rather be an edit to your original question. I am unsure, since your question is a bit meta ... Sep 23 at 8:06
  • In places i read: latex wikibook, latexref.xyz , latex.org link above; \thispagestyle{empty} or the "gobble" way was used, which's sideeffects, & ∵ fragmented, is unabstractable in a newcommand. Being in hurry, i missed this combo i chose can be newcommand-ed. So, you were right in the comments above. Continuing from this, a meta answer can be that this is kind of a community documentation miss that this topic is not covered in most "intro to latex" material; and even more so for this method. --~~another answer maybe could've been on why those *matter commands are not in report~~-- Sep 23 at 9:05
  • also see these answers on SE itself: removing-page-number-from-toc tex.stackexchange.com/questions/2995 all referring to pagestyle{empty} \protect numbering{gobble} and whatnot shenanigans Sep 23 at 9:13

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.