LaTeX forum ⇒ Page LayoutHiding chapters in output

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Posts: 1
Joined: Sat Jan 31, 2009 8:39 am

Hiding chapters in output

Postby sprowit » Sat Jan 31, 2009 8:47 am

Hi all,

I don't know if this is possible, but I'd like to know how to keep chapters from appearing in the output and in the table of contents, while keeping their labels intact (so I can still use \ref{a_label_in_a_hidden_chapter}).

To clarify, here's the background: I have written a large text in LaTeX and it has already been printed. Now, I want to write an addendum (probably using \appendix) to that text, which will be printed separately. I don't want any of the original chapters to be in the output or the table of contents, but I still want to be able to print the section numbers of the original text by using \ref.

Is this possible? How? And what about figures; I'd like to be able to refer to them in the same way, if possible? And how about BibTeX entries?

Posts: 57
Joined: Tue Jan 20, 2009 7:49 pm

Postby marco_d » Sat Jan 31, 2009 11:20 am


you can play with the counter tocddepth:
  1. \documentclass[11pt, a4paper,english]{scrreprt}
  2. \usepackage{babel}
  3. \usepackage{blindtext}
  4. \let\origchap=\chapter
  5. \def\mychapter#1{%
  6. \addtocontents{toc}{\protect\setcounter{tocdepth}{-5}\endgraf}%
  7. \chapter{#1}%
  8. \addtocontents{toc}{\protect\setcounter{tocdepth}{3}\endgraf}%
  9. \addtocontents{toc}{\vskip1em\null}
  10. }
  11. \begin{document}
  12. \tableofcontents
  13. \chapter{foo}
  14. \blindtext[2]
  15. \section{foo bar}
  16. \blindtext
  17. \mychapter{foo}
  18. \blindtext[2]
  19. \section{foo bar}
  20. \blindtext
  21. \end{document}

i am German. I can not use difficult words. :-)

Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 4 guests