14

I've written a thesis and it's ready for submission but unfortunately the page limit for a volume is 300 pages and my thesis is 324. It has been decided that the solution is to split the appendices from the main text and put it in a separate volume.

What I need now is to have a contents page that says:

Volume one
Chapter 1  blah..... 1
Chapter 2  blah..... 4
...

Volume two
Appendix 1 ...... A1
Appendix 2 ...... A3
Appendix 3 ...... A12 
...

This contents page should appear in both volumes. Once as it currently is and once at the beginning of volume two.

My preamble is:

\documentclass[a4paper, 11pt, oneside]{book}

\usepackage[UKenglish]{babel}
\usepackage[left=3cm, right=3cm, bottom=3.5cm, top=3.5cm]{geometry}  
\usepackage[
        font=footnotesize, 
        center
        ]{caption}  % Changes font size of figure captions to small
\usepackage[
backend=biber,
block=space,
date=long,
doi=false,
dashed=false,
eprint=false,
firstinits=true,
isbn=false,
minnames=2,
maxnames=2,
mincitenames=2,
maxcitenames=2,
natbib=true,
sortcites=false,
sorting=nyt,
style=authoryear-comp,
terseinits=true,
uniquelist=false,
uniquename=false,
url=false
    ]{biblatex}
\addbibresource{C:/Documents and Settings/LBOYD/My Documents/LaTeX/BibTex/library.bib}

%Put initials after names...
\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{default}{last-first}    
%Remove "and" before last name. However, this also removes "and" in a textcite...
\renewcommand*{\finalnamedelim}{\space\&\space}

\usepackage{fancyhdr}   % Provides support for improved document headers
\usepackage{graphicx}   % Provides support for inserting images
\usepackage{tikz}       % Provides support for tikz images
\usetikzlibrary{arrows} % Add arrows package to tikz
\usepackage{wrapfig}    % Allows text to wrap around images
\usepackage{sidecap}    % Allows captions to be put to side of figures 
\usepackage{subfig}     % Allows us to include sub-figures
\usepackage{float}
\usepackage{pdflscape}
\usepackage{makeidx}
\usepackage[big,compact]{titlesec}
\usepackage{pdfpages}
\usepackage[inline]{enumitem}
\usepackage{multirow}
\usepackage{mathtools}

\usepackage[hidelinks]{hyperref}        
\hypersetup{
        pdftitle=Third Year Report,
        pdfauthor=Liam Boyd,
        pdfkeywords=EngD Thesis CMOS VCO Oscillator Transmission
        }

\usepackage{longtable}
\usepackage{acro}% needs v0.4 of `acro'
\acsetup{
            page-name=Acronyms,
            list-style=longtable,
            list-header=chapter*,
            list-table-width=10cm,
            list-long-format=\capitalisewords
            }
\usepackage{mfirstuc}% provides\capitalisewords
\include{Frontmatter/acronyms2} %Include external acronym list.
\makeindex

\setlength{\parindent}{0in}
\usepackage{setspace}
\doublespacing

\newcommand{\comment}[1]{}

\begin{document}

%%---------------------------------------------------------------    
% FRONTMATTER
%%---------------------------------------------------------------
\pdfbookmark[0]{Title}{Title}
\input{Frontmatter/titlepage} % Custom front page

\frontmatter        
\input{Frontmatter/abstract} % Document Abstract
\addcontentsline{toc}{chapter}{Abstract}

\pagestyle{plain}   % Set page style
\input{Frontmatter/declaration}
\addcontentsline{toc}{chapter}{Declaration}

\input{Frontmatter/acknowledgments} % Acknowledgements page
\addcontentsline{toc}{chapter}{Acknowledgements}

\listoffigures                          % List of figures
\addcontentsline{toc}{chapter}{List of Figures}
\newpage                                % Start a new page
\listoftables                           % List of Tables
\addcontentsline{toc}{chapter}{List of Tables}
\newpage                                % Start a new page

\begingroup
  \setlength{\LTleft}{-\tabcolsep}
  \printacronyms
\endgroup
\addcontentsline{toc}{chapter}{Acronyms}%\printacronyms
\clearpage                              % Start a new page
\pdfbookmark[0]{Contents}{Contents}
\tableofcontents            % Insert a table of contents
\clearpage      
%%---------------------------------------------------------------
% INPUT CHAPTERS
%%---------------------------------------------------------------
\mainmatter
    \pagestyle{plain}                                               
\input{Mainmatter/Introduction}
\input{Mainmatter/DesignOptions}
\input{Mainmatter/SystemsContext}
\input{Mainmatter/MB8AW4316}
\input{Mainmatter/MB8AW5318}
\input{Mainmatter/Analysis}
\input{Mainmatter/Conclusion}

%%---------------------------------------------------------------
% BACK MATTER
%%---------------------------------------------------------------
\backmatter     % States that we are now into Appendicies
\pagestyle{plain}
\printbibliography[heading=bibintoc]        % Insert Bibliography
\input{Backmatter/Appendix}                     % Appendix 
\end{document}

I realise that this is similar to Split a book into multiple volumes but the numbering and format demands are different.

6

I will describe a way to go with the book class using etoc. The code sample is minimal but you should be able to transfer the relevant parts to your real use case.

see update below in response to question asked in comment

Here are the two tables of contents (with correct hyperlinks):

split in two

split in two B

Code:

\documentclass{book}
\usepackage{hyperref}
\usepackage{blindtext}
\usepackage{etoc}

\newcommand{\TableOfContents}{%
 \centerline{\LARGE\scshape Thesis Contents}
 \vspace{0.5cm}
 \markboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}
 \phantomsection
 \addcontentsline{toc}{chapter}{Thesis contents}
 \etocsettagdepth {VolumeOne}{all}
 \etocsettagdepth {VolumeTwo}{none}
 \etocsettocstyle {\section*{Volume One}}{\bigskip}
 \tableofcontents
 \etocsettagdepth {VolumeOne}{none}
 \etocsettagdepth {VolumeTwo}{all}
 \etocsettocstyle {\section*{Volume Two}}{\cleardoublepage}
 \tableofcontents
}


\begin{document}
\etocdepthtag.toc {VolumeOne}

\frontmatter
\vspace*{1cm}
\begin{center}
\huge\bfseries Volume One:\\ Oscillation Theory and Beyond
\end{center}
\vspace{2cm}
\TableOfContents

\mainmatter
\chapter{Foo}
\blindtext
\chapter{Bar}
\blindtext

\backmatter 
\etocdepthtag.toc {VolumeTwo}

\vspace*{1cm}
\begin{center}
\huge\bfseries Volume Two:\\ Appendices
\end{center}
\vspace{2cm}
\TableOfContents

\chapter{Appendix}
\blindtext
\chapter{Another appendix}
\blindtext

\end{document}

Here is now a variant where the TOC in the Volume Two only lists the appendices. Also the page numbering is restarted for Volume Two.

split in two C

\documentclass{book}
\usepackage{hyperref}
\usepackage{blindtext}
\usepackage{etoc}

\newcommand{\TableOfContents}{%
 \centerline{\LARGE\scshape Thesis Contents}
 \vspace{0.5cm}
 \markboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}
 \phantomsection
 \addcontentsline{toc}{chapter}{Thesis contents}
 \etocsettagdepth {VolumeOne}{all}
 \etocsettagdepth {VolumeTwo}{none}
 \etocsettocstyle {\section*{Volume One}}{\bigskip}
 \tableofcontents
 \etocsettagdepth {VolumeOne}{none}
 \etocsettagdepth {VolumeTwo}{all}
 \etocsettocstyle {\section*{Volume Two}}{\cleardoublepage}
 \tableofcontents
}


\begin{document}
\etocdepthtag.toc {VolumeOne}

\frontmatter
\vspace*{1cm}
\begin{center}
\huge\bfseries Volume One:\\ Oscillation Theory and Beyond
\end{center}
\vspace{2cm}
\TableOfContents

\mainmatter
\chapter{Foo}
\blindtext
\chapter{Bar}
\blindtext

\mainmatter % to restart page numbering
\backmatter 
\etocdepthtag.toc {VolumeTwo}

\vspace*{1cm}
\begin{center}
\huge\bfseries Volume Two:\\ Appendices
\end{center}
\vspace{2cm}
\etocsettagdepth {VolumeOne}{none}
\etocsettagdepth {VolumeTwo}{all}
\etocsettocstyle {\section*{\contentsname}\phantomsection
                  \addcontentsline{toc}{chapter}{\contentsname}}
                 {\cleardoublepage}
 \markboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}
\tableofcontents

\chapter{Appendix}
\blindtext
\chapter{Another appendix}
\blindtext

\end{document}
  • This works pretty well. However, it doesn't change the numbering system of the appendix volume. Also, after viewing the results of this method, I've decided that it would look better if the first volume has the full toc but the second appendix volume only has a toc covering the appendices in it. Are these simple fixes? – E_L Mar 22 '14 at 15:57
  • @E_L I have updated the answer to respond to your comment. – user4686 Mar 23 '14 at 8:53
  • I'm not what I'm doing wrong, but I'm getting a the full contents repeated in the second volume. However, when I copy your minimum working example in to a new script and compile, it works. I am most perplexed. – E_L Mar 23 '14 at 19:04
  • 1
    @E_L the first table of contents uses command \TableOfContents from the preamble, the second uses \tableofcontents. Did you insert into your code the \etocdepthtag.toc {VolumeOne} and \etocdepthtag.toc {VolumeTwo} commands, at the respective starts of volume one and volume two? – user4686 Mar 23 '14 at 19:58
  • Ah it was the '\TableOfContents' vs '\tableofcontents' thing that caught me out. Thanks! – E_L Mar 23 '14 at 20:27
7

UPDATE

This proved surprisingly troublesome. I originally posted what I thought was a solution, based on modifying \tableofcontents which lasted about ten seconds, before I found it wouldn't work with hyperref. I then found something that worked, but was clunky. This version is more pleasing: my initial instinct (modification the way tables of contents are printed to enable two of them) was right; the trouble was hyperref. The solution lay in the suggestion in pst's answer below that memoir could do this. It occurred to me that memoir had probably solved the problem I was having, and so it transpired.

The following therefore is really very largely thanks to Peter Wilson's code (and I think there may be some David Carlisle in there too, I think) which I have adopted, and to pst's suggestion to look at Memoir, without which I don't think I would ever have tracked down a solution to the issue with hyperref.

THE METHOD

  1. We define the command \startvolume{name} to start a new volume. Since the Questioner does not apparently use "part", I simply adapted that, though it would no doubt be more elegant to define a new sectioning unit. \startvolume clears the page, resets page numbering to 1, prints an introductory flyleaf, and makes an appropriate entry in the table of contents.

  2. In order to keep the table of contents straight, we redefine the internal macro l@part, so that it doesn't attempt to put any page number in the list. We also fiddle with the definition of \part to ensure we don't get a page number on our volume page. (Proper book design requires that the flyleaf for a volume comes (a) first, before the title page; (b) bears no folio number but (c) is treated as folio 1.)

  3. Then the part that seems easy in principle but proved difficult. The standard LaTeX definition of \tableofcontents means that you can only have one: as soon as it is printed the necessary file is "clobbered". This is the consequence of how \@starttoc is written. This is not hard to change in principle, and gets tricky only because hyperref fiddles too. Anyway, memoir has the right code, which I've commandeered.

  4. This all worked, but hyperref was complaining because resetting the page numbering muddled it. I tried various solutions. In the end, the easiest and most reliable one seemed to be to use the option hypertexnames=false; this seems to be working, but it's true cargo cult programming of the worst sort, since I can't pretend really to understand what is happening.

  5. There was a little bit of tweaking needed to \backmatter, because (since nobody anticipated that it might follow immediately from \frontmatter!) it doesn't reset pagination to roman.

I haven't comprehensively tested this with the very many packages you use, and so no doubt it may take some fiddling. But it's a start at least.

\documentclass[a4paper,oneside]{book}
\usepackage{filecontents}% Just for demonstration
\begin{filecontents}{\jobname-c.tex}
\chapter{Blah}
\lipsum% Just for demonstration

\chapter{More Blah}
\lipsum
\end{filecontents}
\usepackage[hypertexnames=false]{hyperref}
\usepackage{lipsum}
\makeatletter
%This is to enable an unpaginated "part" entry in the TOC, based on l@part in book.cls
\renewcommand*\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{2.25em \@plus\p@}%
    \setlength\@tempdima{3em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      {\leavevmode
       \large \bfseries #1}\par
       \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}
%And this is simply to ensure that we get an empty page for the volume titles
\renewcommand\part{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \thispagestyle{empty}%
  \if@twocolumn
    \onecolumn
    \@tempswatrue
  \else
    \@tempswafalse
  \fi
  \null\vfil
  \secdef\@part\@spart}
%backmatter needs to be patched to reset pagination to arabic
\renewcommand\backmatter{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \pagenumbering{arabic}%
  \@mainmatterfalse}
\newcommand{\secondtableofcontents}{%
  \tableofcontents
  \if@filesw
  [Table of Contents will generate here]\par 
  \typeout{Warning: No second table of contents generated. Rerun with \nofiles once all references are stable.} 
  \fi}
%Finally we patch the \@starttoc macro so that it doesn't clobber the .toc file,
%this code is taken straight from memoir. We are using hyperref here, but for
%completeness we provide for both
\renewcommand{\@starttoc}[1]{%
  \begingroup\makeatletter
    \@input{\jobname.#1}%
    \if@filesw
      \AtEndDocument{%
        \expandafter\ifx\csname tf@#1\endcsname\relax
          \expandafter\newwrite\csname tf@#1\endcsname
          \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
        \fi
      }%
    \fi
  \@nobreakfalse
  \endgroup}
\@ifpackageloaded{hyperref}{%
\Hy@AtBeginDocument{%
  \ifx\hyper@last\@undefined
    \def\@starttoc#1{%
      \begingroup\makeatletter
        \IfFileExists{\jobname.#1}{%
          \Hy@WarningNoLine{%
          old #1 file detected, not used; run LaTeX again%
          }%
        }{}%
        \if@filesw
        \AtEndDocument{%
          \expandafter\ifx\csname tf@#1\endcsname\relax
            \expandafter\newwrite\csname tf@#1\endcsname
            \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
          \fi
        }
        \fi
        \@nobreakfalse
      \endgroup
    }%
  \fi
}
}
% \startvolume{Title} at beginning of each volume: print a starting page
% for hyperref to grab and add contents line

\newcommand{\startvolume}[1]{%
  \cleardoublepage%
  \setcounter{page}{1}%
  \part*{#1}%
  \addcontentsline{toc}{part}{#1}%
}
\makeatother

\begin{document}

\frontmatter

\startvolume{I}

\tableofcontents

\mainmatter

\input{\jobname-c.tex}

\frontmatter

\startvolume{II}

\tableofcontents

\backmatter

\input{\jobname-c.tex}

\end{document}
  • Hello, Thank you for this code that works well. However, I have a small problem: Since the Backmatter command has been redefined, how do I use it without resetting the numbering if I really need it? – Axelito Oct 26 at 9:05
3

If changing from book to memoir is acceptable this late in the process, you could use that. One feature of it is that \tableofcontents and similar commands can be repeated, since they are not cleared when used, like in the standard classes. Here is a non-polished proof-of-concept of how to do this in memoir, creating a result that can be split afterwards into the two volumes.

\documentclass{memoir}
\usepackage{blindtext}

\begin{document}

\author{A. Uthor}
\title{The Book -- Volume One}

\frontmatter
\addcontentsline{toc}{part}{Volume one}

\maketitle

\newpage
\tableofcontents*

\mainmatter

\chapter{Foo}
\blindtext
\chapter{Bar}
\blindtext

% Restart page numbering
\frontmatter
\addcontentsline{toc}{part}{Volume two}

\title{The Book -- Volume Two}
\maketitle

\newpage
\tableofcontents*

\mainmatter
\backmatter
\chapter{Appendix}
\blindtext
\chapter{Another appendix}
\blindtext

\end{document}
  • +1 The main problem is the one you noted. It might be worth looking at how memoir does this, and see if it could be combined with my approach so that the questioner could continue to use book. I could get that working --- but not with hyperref. – Paul Stanley Mar 21 '14 at 10:59

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.