I want to add custom lines for my appendices, produced in external software, to the table of contents. Furthermore it should be possible to specify the number of pages of any particular appendix. How can I achieve this?
As MWE I will use my best try.
\documentclass{report}
\newcommand{\append}[2]{%
\stepcounter{chapter}%
\newpage\thispagestyle{empty}\phantom{-}%
\addcontentsline{toc}{chapter}{\protect\numberline{\Alph{chapter}}{#1}}%
\newpage\addtocounter{page}{-1}\addtocounter{page}{#2}%
}
\begin{document}
\tableofcontents
\chapter{Chapter 1}
Bla bla
\chapter{Chapter 2}
Bla bla bla
\appendix
\chapter{Appendix 1}
Blah
\append{Extra 1}{2}
\append{Extra 2}{1}
\end{document}
Generated TOC:

Unfortunately to work it needs to insert a blank page for every single appendix.
How can I get rid of those extra blank pages, while keeping other traits of the \input command?
\newpages with a\phantom{-}inbetween. To remove the blank page, just insert\newpageand then the ToC entry. – Werner Sep 25 '14 at 17:33\newpagecommands on purpose - otherwise if a few\appends are placed next to each other they all end with the same page number in ToC. – Pawel Sep 25 '14 at 17:47\newpages results in: http://i.imgur.com/shV6iBl.jpg . – Pawel Sep 25 '14 at 18:08\appendactually also includes some other content into your document, or how do\appendinsert the "appendices, produced by external software"? – Werner Sep 25 '14 at 18:14\appendshould reserve these 2 pages. So if I use\appendon page 10, I want further content to be placed on page 13, but avoid the blank page inbetween 10 and 13. – Pawel Sep 25 '14 at 18:15\addcontentslinewhich will take the number of the page as a parameter. If not, in order to display different page numbers, I'm afraid you'll have to add extra blank pages. You may add the information you provided in the comments to the main question, to help other people provide the correct answer. – umarcor Sep 25 '14 at 18:58tocloftpackage provides a command to do so\cftaddtitleline{toc}{chapter}{<text>}{<page>}, as you can see in the answer to this or this question. – umarcor Sep 25 '14 at 19:05