# The PreTeXt Guide

A schema, in our case a RELAX-NG schema, is a formal specification of an XML vocabulary (the allowed tags and attributes), and how they relate to each other. So, for example, the restrictions that say you cannot nest a <book> inside of a <chapter>, nor can you nest a <subsection> in a <chapter> without an intervening <section>, are expressed and enforced by the schema. One of the beauties of the schema is that it is written using a very specific syntax and then there are tools that use a schema as input. In particular, a PreTeXt source file that conforms to the PreTeXt schema is said to be valid. You should strive to always, always, always have valid source files, and therefore you want to regularly verify that this is the case.
You can find the PreTeXt schema in the schema folder of the GitHub repository 1 . The version we author and maintain is pretext.xml, which is used to create pretext.rnc, which uses the compact syntax of the RELAX-NG specification. By providing the schema and your source to a program called a validator you can check if your source is valid, and if not, why. See Chapter 7 for the details on doing this.
The PreTeXt-CLI also has some basic validating capability: after running pretext build, open the .error_schema.log file in the main folder of your project to see validation errors.
github.com/PreTeXtBook/pretext/schema
xml-copy-editor.sourceforge.net/