Skip to main content

Section D.3 emacs

Jason Underdown reports on 2016-05-12 that emacs' nXML mode 1  works well with a schema, and Mitch Keller reports on 2021-04-18 that specifically a RELAX-NG schema may be used. The two versions of the RELAX-NG schema for PreTeXt can be found at


The first is the “real” version, while the second is an entirely equivalent (compact) syntax that is meant to be a bit more human-readable, so perhaps either may be employed.

On 2021-04-18, Mitch Keller reports success with placing the following schemas.xml file in his PreTeXt source file directories. Note that you may need to adjust the path in the @uri attribute, and the @pattern attribute implies that Mitch has used a .ptx suffix for all his source filenames. If you are already using emacs, you should have no trouble making the necessary adjustments.

<?xml version="1.0"?>
<locatingRules xmlns="">
  <uri pattern="*.ptx" uri="../../mathbook/schema/pretext.rnc"/>

You simply put your cursor at any point in the document, start a new tag with < and then call the completion-at-point function (I bound it to the key-chord: C-<return>) to get a list of possible completions. Or you can start typing a few characters to narrow the list of possibilities. It will also let you know if the element you are trying to insert is invalid.

―Jason Underdown