## SectionD.3emacs

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

mathbook/schema/pretext.rng
mathbook/schema/pretext.rnc


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.

www.gnu.org/software/emacs/manual/html_mono/nxml-mode.html

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="http://thaiopensource.com/ns/locating-rules/1.0">
<uri pattern="*.ptx" uri="../../mathbook/schema/pretext.rnc"/>
</locatingRules>


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