Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to write a solution manual for a maths book which is about 900 pages.

I want it to include detailed solutions to all exercises as as well summaries for every chapter.

The file will obviously be quite large. I'd love to hear any tips on handling such large files, such as breaking it into several files etc...

share|improve this question
    
Please see this question. –  MMA Feb 16 at 10:22
    
If you are not including graphics files, even a 900 page .tex file is not "large" by today's standards. Compare with a Word or other binary file format and you'll find that the .tex file, being just text, isn't that large at all. My guess is that it could easily fit on a floppy. Oh wait, there aren't any floppies anymore. –  user26732 Feb 17 at 15:54
add comment

marked as duplicate by Martin Schröder, MMA, Jubobs, Peter Jansson, mafp Feb 16 at 12:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 2 down vote accepted

There are basically two possibilities, both deal with splitting into several files

  1. Include each file with the \input{filename} command
  2. Include each file with the \include{filename} command

The second way always adds a pagebreak.

Regardless which style you apply, I would split the large file in logically parts, such as chapters or sections, but not into subsections.

Please note, that you cannot nest \include commands, in that case, you have to use \input in deeper hierarchies.

If you want to test some parts only, you could use \includeonly command, say

\documentclass{minimal}
%Starting stuff
\includeonly{section1,section6}%
\begin{document}
%Something to be done before formatting etc. of solutions
\include{section1}
\include{section2}
\include{section3}
\include{section4}
\include{section5}
\include{section6}
% Other stuff here
\end{document}

This will include only the files with section1 and section6, although the other ones are given explicitly in the \include statement.

Please also have a look on the filecontents package.

share|improve this answer
1  
If you don't want pagebreak after include use the newclude package. stackoverflow.com/questions/1209065/… –  Nicholas Hamilton Feb 16 at 11:07
    
@NicholasHamilton: Good to know, I wasn't aware of that package. Thanks for that clue! –  Christian Hupfer Feb 17 at 18:16
    
Just be aware that if you use newclude (or equivalent) and also includeonly{...} as a means to increase compilation speed when you are working on your document, without an explicit break (\clearpage) before each include{...} the layout may actually be very different in your final document, compared to what you are working on depending on how the sections NOT listed in (and before) the includeonly{...} command finish. –  Nicholas Hamilton Feb 17 at 20:32
    
In other words, the there is a very good reason why include{...} by default starts on a new page, and that is to ensure layout consistency on the assumption you may be using the includeonly{...} command at some stage. –  Nicholas Hamilton Feb 17 at 20:34
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.