Skip to main content

The PreTeXt Guide

Subsection 27.2.2 Forming a Version

Now, a publisher can elect to include or exclude all of the content of each component. This is accomplished with the @include attribute of the source/include element inside a publication file. The value of this attribute is a space-separated listing of some of the component names in use. An example minimal publication file could look like the following example. See Subsection 44.7.2 for the specifics.
        <version include="videos labs"/>
This attribute is interpreted according to these rules:
  • An element whose @component value is in the list in @include will be included in the source that will be converted.
  • An element whose @component value is not in the list in @include will not be included in the source that will be converted.
  • If there is no @include attribute in the publication file, the indication of the components are ignored and the entire source is processed. This would be the same as listing every component name in @include.
  • Setting @include to an empty value (include="") achieves the opposite effect and excludes every component from the source that will be converted.
You can nest one component inside another. But understand that once a PreTeXt element is excluded because the version in play does not include a certain component, then all of that element’s contained source is gone and never coming back. In other words, an element nested inside an excluded element cannot be influenced by whatever other component it may be assigned to. However, the converse is possible: include an element via a component, and exclude contained elements via a different component.