Page LayoutHiding chapters in output

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

Hiding chapters in output

Post by sprowit »

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?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
marco_d
Posts: 57
Joined: Tue Jan 20, 2009 7:49 pm

Hiding chapters in output

Post by marco_d »

Hello,

you can play with the counter tocddepth:

Code: Select all

\documentclass[11pt, a4paper,english]{scrreprt}
\usepackage{babel}
\usepackage{blindtext}
\let\origchap=\chapter
\def\mychapter#1{%
\addtocontents{toc}{\protect\setcounter{tocdepth}{-5}\endgraf}%
\chapter{#1}%
\addtocontents{toc}{\protect\setcounter{tocdepth}{3}\endgraf}%
\addtocontents{toc}{\vskip1em\null}
}
\begin{document}
\tableofcontents
\chapter{foo}
\blindtext[2]
\section{foo bar}
\blindtext
\mychapter{foo}
\blindtext[2]
\section{foo bar}
\blindtext
\end{document}
regards
Marco
i am German. I can not use difficult words. :-)
Post Reply