Skip to main content
\( \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

Section 6.3 Coding modularly using xinclude

From [2]: “The xinclude mechanism ... is of some use for organizing your work, so you do not have mammoth files open in your editor.” By using this mechanism you can put portions of your document in separate PTX files and then “include” them in your main file. For instance, if your book has five chapters, you may want to write each chapter in a separate PTX file.

If you wish to, for instance, include the chapter in the file algebra.ptx in your main file, index.ptx, put algebra.ptx in the same directory as index.ptx, and insert the following code in index.ptx where you want the chapter to appear: <xi:include href="algebra.ptx" />. You can see examples of this technique being used in mathbook/examples/sample-book/sample-book.xml.

For more details, see the section on Modular Source Files in [2].