Skip to main content

The PreTeXt Guide

Section 36.3 Adding or Removing Divisions

For an Instructor’s Version you might wish to add additional material into the front matter (a specialized <preface> perhaps), or remove some material from the back matter (an <appendix> with solutions that duplicates solutions now placed within the exercises themselves). There may also be parts of each chapter you do not find necessary to include.
Modularizing your source files would allow for a different top-level XML source file to include different portions of the <frontmatter> or <backmatter>, perhaps just making a different title page. See Section 5.3 for more on modularization.
Additional, minimal, XSLT stylesheets can be used to selectively “kill” portions of your source, such as every “Additional Reading” at the end of each <chapter> residing in a <references>. Consistent use of elements, leading strings in @xml:id, and/or leading strings in <title>, can make it a single-line exercise to selectively remove multiple portions of your source without removing other portions. See Section 28.2 for more about additional XSLT stylesheets.
Think carefully about the effect of removals and additions on numbering. In HTML output all numbering is hard-coded and will be based on counts of the entire XML source file. So selectively killing content will not change numbering, but cross-references may point to divisions for which there is no content to serve as the target. Using a different top-level file can impact numbering throughout. Significant portions of the output rely on ’s automatic numbering via mechanisms like \label{} and \ref{}. So if portions of the text are killed, then the \label{} of a cross-reference may never be defined. A technical solution would be to provide an option to hard-code all numbering in output.
Generally, removing portions of each division will have the least ill-effects on numbering if the portions removed are at the end of a division and no cross-references point there. So, for example, a <references> at the end of each <chapter> can be safely killed with no ill-effects if there are no cross-references elsewhere to the particular <biblio> contained in that <references>.
When a division is killed through the use of additional XSLT, knowls and index entries will still be generated as usual for that division as part of the conversion to HTML. Thus, some care may need to be taken if certain knowls should not be uploaded to a server. Using a consistent scheme for the values of the @xml:id might make this easy to script. The <idx> elements could be killed in a manner similar to the division with a use of the ancestor axis in a filter. Of course, the conversion to will not create knowls, and the index-creation process does not suffer from the shortcomings of the creation process for HTML.