4

I want to separate my book into different volumes, I searched this site and there is no satisfied solution. I tried to work around with a package called volumes

ftp://ftp.dante.de/tex-archive/macros/latex2e/contrib/volumes/volumes.pdf

However, after reading the mannual, I still have no idea about how to use it, so can anyone just give me a concrete and compilable example.

  • 1
    I think xr package is better for separete volumes – touhami Jul 29 '16 at 11:29
3

The key part is getting the file names right, and compiling correctly. A minimal example looks like the following:

\documentclass{book}
\usepackage{lipsum}
\title{volumes is fun}
\author{me}

\usepackage{volumes}    
\volumename{chapter}

\begin{document} 
    \input{frontmatter}
    \include{chapter1}
    \include{chapter2}
\end{document}

with the following additional files: frontmatter.tex

\maketitle
\tableofcontents

and chapter1.tex:

\chapter{one}
\lipsum[1]

and chapter2.tex:

\chapter{two}
\lipsum[2]

The volumes package only works on \include's, thus, to always include the frontmatter.tex, we use \input instead. Then, as our files are called chapterX.tex, the \volumename must be set to chapter.

About compiling: First, you have to compile the document as usual. That way, all chapters are typeset and included. So far, the volumes package doesn't do much (if anything...). Now, that the relevant information on the document (page numbers, ...) is saved in the .aux files, you can exclude the parts you want. You can do that by adding e.g.

\onlyvolume[2]

before the \begin{document}. Now, simply recompile the document, and Chapter 1 will be excluded.

  • Shouldn't your MWE contain the line \usepackage{volumes} somwhere? – Andrew Jul 29 '16 at 12:53
  • That's the 6th line (1st line of the second paragraph). I chose to put \usepackage{volumes} and \volumename{..} into a separate paragraph, to highlight separate them a bit from the "normal" stuff. – hbaderts Jul 29 '16 at 13:01
  • Sorry hbaderts. My bad – Andrew Jul 31 '16 at 7:54

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.