I need to print my document without the mainmatter, but the table of contents must contain all titles of chapters and sections and the appendix must have the good number page without the mainmatter pages.

Have you a tip to do that ?



%name of toc \addto\captionsfrench{\renewcommand*\contentsname{Plan}}



    \setcounter{tocdepth}{1} \tableofcontents

\input{tex/chapter2} %etc.



  • Welcome to TeX.SX! How about compiling fully and setting the page range in the printing dialog? – TeXnician Apr 18 '18 at 15:40
  • Thanks for your answer (and your edition). It doesn't work because I need a correct number for my appendix pages. – Scryptus Apr 18 '18 at 15:42
  • 1
    Ah, that's "good number page". It will be hard to achieve this using \input as this (in contrast to \include) does not write auxiliary files that may help here. – TeXnician Apr 18 '18 at 15:44

I do not understand what "good number page" means. Maybe you are looking for something like

enter image description here

\documentclass[11pt,a4paper,DIV=12,oneside]{scrbook}[2017/04/13]% needs at least version 3.23
\usepackage{bookmark}% loads hyperref too

\usepackage{blindtext}% only for dummy text


%\setmtoctrue% uncomment for one run to renew the mtoc file

      \begingroup\renewcommand*{\blinddocument}{}% redefine \blinddocument to avoid the output





If there are any changes in the mainmatter, either the file with extension mtoc have to be removed or there must be one run with \setmtoctrue to renew the contents of the mtoc file.

If you comment \usemtoctrue the content of main matter is printed as usual.

Note that I have used \blinddocument instead the \input macros in your MWE. Therefore I have redefined \blinddocument for the main matter while you have to redefine \input.

  • Excellent ! When I redefine \input, the path of my files stay. Have you a suggestion to hide them ? – Scryptus Apr 19 '18 at 19:49
  • I start to understand a little bit your code. Because it create a .mtoc file, I can comment all of my \input until we find a better solution ! – Scryptus Apr 19 '18 at 20:14
  • \renewcommand{\input}[1]{}? – esdd Apr 19 '18 at 20:24
  • Oh, so simple... I realize I should learn more... ;-) Thanks ! – Scryptus Apr 19 '18 at 20:47

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.