3. The Document Type Definition

In this chapter we first explain what a "document type definition" is and then describe gapdoc.dtd in detail. That file together with the current chapter define how a GAPDoc document has to look like. It can be found in the main directory of the GAPDoc package and it is reproduced in Appendix B..

We do not give many examples in this chapter which is more intended as a formal reference for all GAPDoc elements. Instead we provide an extra document with book name GAPDocExample (also accessible from the GAP online help). This uses all the constructs introduced in this chapter and you can easily compare the source code and how it looks like in the different output formats. Furthermore recall that many basic things about XML markup were already explained by example in the introductory chapter 1..

3.1 What is a DTD?

A document type definition (DTD) is a formal declaration of how an XML document has to be structured. It is itself structured such that programs that handle documents can read it and treat the documents accordingly. There are for example parsers and validity checkers that use the DTD to validate an XML document, see 2.1-13.

The main thing a DTD does is to specify which elements may occur in documents of a certain document type, how they can be nested, and what attributes they can or must have. So, for each element there is a rule.

Note that a DTD can not ensure that a document which is "valid" also makes sense to the converters! It only says something about the formal structure of the document.

For the remaining part of this chapter we have divided the elements of GAPDoc documents into several subsets, each of which will be discussed in one of the next sections.

See the following three subsections to learn by example, how a DTD works. We do not want to be too formal here, but just enable the reader to understand the declarations in gapdoc.dtd. For precise descriptions of the syntax of DTD's see again the official standard in:

  http://www.xml.com/axml/axml.html

3.2 Overall Document Structure

A GAPDoc document contains on its top level exactly one element with name Book. This element is declared in the DTD as follows:

3.2-1

<!ELEMENT Book (TitlePage,
                TableOfContents?,
                Body,
                Appendix*,
                Bibliography?,
                TheIndex?)>
<!ATTLIST Book Name CDATA #REQUIRED>

After the keyword ELEMENT and the name Book there is a list in parentheses. This is a comma separated list of names of elements which can occur (in the given order) in the content of a Book element. Each name in such a list can be followed by one of the characters "?", "*" or "+", meaning that the corresponding element can occur zero or one time, an arbitrary number of times, or at least once, respectively. Without such an extra character the corresponding element must occur exactly once. Instead of one name in this list there can also be a list of elements names separated by "|" characters, this denotes any element with one of the names (i.e., "|" means "or").

So, the Book element must contain first a TitlePage element, then an optional TableOfContents element, then a Body element, then zero or more elements of type Appendix, then an optional Bibliography element, and finally an optional element of type TheIndex.

Note that only these elements are allowed in the content of the Book element. No other elements or text is allowed in between. An exception of this is that there may be whitespace between the end tag of one and the start tag of the next element - this should be ignored when the document is processed to some output format. An element like this is called an element with "element content".

The second declaration starts with the keyword ATTLIST and the element name Book. After that there is a triple of whitespace separated parameters (in general an arbitrary number of such triples, one for each allowed attribute name). The first (Name) is the name of an attribute for a Book element. The second (CDATA) is always the same for all of our declarations, it means that the value of the attribute consists of "character data". The third parameter #REQUIRED means that this attribute must be specified with any Book element. Later we will also see optional attributes which are declared as #IMPLIED.

3.2-2

<!ELEMENT TitlePage (Title, Subtitle?, Version?, Author+, Date?, Abstract?,
                     Copyright? , Acknowledgements? , Colophon? )>

Within this element information for the title page is collected. Note that more than one author can be specified. The elements must appear in this order because there is no sensible way to specify in a DTD something like "the following elements may occur in any order but each exactly once".

Before going on with the other elements inside the Book element we explain the elements for the title page.

3.2-3 </code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Title (%Text;)*> </pre></td></tr></table> <p>Here is the last construct you need to understand for reading <code class="file">gapdoc.dtd</code>. The expression "<code class="code">%Text;</code>" is a so-called "parameter entity". It is something like a macro within the DTD. It is defined as follows:</p> <table class="example"> <tr><td><pre> <!ENTITY % Text "%InnerText; | List | Enum | Table"> </pre></td></tr></table> <p>This means, that every occurrence of "<code class="code">%Text;</code>" in the DTD is replaced by the expression</p> <table class="example"> <tr><td><pre> %InnerText; | List | Enum | Table </pre></td></tr></table> <p>which is then expanded further because of the following definition:</p> <table class="example"> <tr><td><pre> <!ENTITY % InnerText "#PCDATA | Alt | Emph | E | Par | P | Keyword | K | Arg | A | Quoted | Q | Code | C | File | F | Button | B | Package | M | Math | Display | Example | Listing | Log | Verb | URL | Email | Homepage | Cite | Label | Ref | Index" > </pre></td></tr></table> <p>These are the only two parameter entities we are using. They expand to lists of element names which are explained in the sequel <em>and</em> the keyword <code class="code">#PCDATA</code> (concatenated with the "or" character "<code class="code">|</code>").</p> <p>So, the element (<code class="code">Title</code>) is of so-called "mixed content": It can contain <em>parsed character data</em> which does not contain further markup (<code class="code">#PCDATA</code>) or any of the other above mentioned elements. Mixed content must always have the asterisk qualifier (like in <code class="code">Title</code>) such that any sequence of elements (of the above list) and character data can be contained in a <code class="code">Title</code> element.</p> <p>The <code class="code">%Text;</code> parameter entity is used in all places in the DTD, where "normal text" should be allowed, including lists, enumerations, and tables, but <em>no</em> sectioning elements.</p> <p>The <code class="code">%InnerText;</code> parameter entity is used in all places in the DTD, where "inner text" should be allowed. This means, that no structures like lists, enumerations, and tables are allowed. This is used for example in headings.</p> <p><a name="s2ss4"></a></p> <h5>3.2-4 <code class="code"><Subtitle></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Subtitle (%Text;)*> </pre></td></tr></table> <p>Contains the subtitle of the document.</p> <p><a name="s2ss5"></a></p> <h5>3.2-5 <code class="code"><Version></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Version (#PCDATA|Alt)*> </pre></td></tr></table> <p>Note that the version can only contain character data and no further markup elements (except for <code class="code">Alt</code>, which is necessary to resolve the entities described in <a href="chap2.html#s2ss3"><b>2.2-3</b></a>). The converters will <em>not</em> put the word "Version" in front of the text in this element.</p> <p><a name="s2ss6"></a></p> <h5>3.2-6 <code class="code"><Author></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Author (%Text;)*> <!-- There may be more than one Author! --> </pre></td></tr></table> <p>As noted in the comment there may be more than one element of this type. This elements should contain the name of an author and probably an <code class="code">Email</code>-address and/or WWW-<code class="code">Homepage</code> element for this author, see <a href="chap3.html#s5ss6"><b>3.5-6</b></a> and <a href="chap3.html#s5ss7"><b>3.5-7</b></a>.</p> <p><a name="s2ss7"></a></p> <h5>3.2-7 <code class="code"><Date></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Date (#PCDATA)> </pre></td></tr></table> <p>Only character data is allowed in this element which gives a date for the document. No automatic formatting is done.</p> <p><a name="s2ss8"></a></p> <h5>3.2-8 <code class="code"><Abstract></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Abstract (%Text;)*> </pre></td></tr></table> <p>This element contains an abstract of the whole book.</p> <p><a name="s2ss9"></a></p> <h5>3.2-9 <code class="code"><Copyright></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Copyright (%Text;)*> </pre></td></tr></table> <p>This element is used for the copyright notice. Note the <code class="code">©right;</code> entity as described in section <a href="chap2.html#s2ss3"><b>2.2-3</b></a>.</p> <p><a name="s2ss10"></a></p> <h5>3.2-10 <code class="code"><Acknowledgements></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Acknowledgements (%Text;)*> </pre></td></tr></table> <p>This element contains the acknowledgements.</p> <p><a name="s2ss11"></a></p> <h5>3.2-11 <code class="code"><Colophon></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Colophon (%Text;)*> </pre></td></tr></table> <p>The "colophon" page is used to say something about the history of a document.</p> <p><a name="s2ss12"></a></p> <h5>3.2-12 <code class="code"><TableOfContents></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT TableOfContents EMPTY> </pre></td></tr></table> <p>This element may occur in the <code class="code">Book</code> element after the <code class="code">TitlePage</code> element. If it is present, a table of contents is generated and inserted into the document. Note that because this element is declared to be <code class="code">EMPTY</code> one can use the abbreviation</p> <table class="example"> <tr><td><pre> <TableOfContents/> </pre></td></tr></table> <p>to denote this empty element.</p> <p><a name="s2ss13"></a></p> <h5>3.2-13 <code class="code"><Bibliography></code> </h5> <table class="example"> <tr><td><pre> <!ELEMENT Bibliography EMPTY> <!ATTLIST Bibliography Databases CDATA #REQUIRED Style CDATA #IMPLIED> </pre></td></tr></table> <p>This element may occur in the <code class="code">Book</code> element after the last <code class="code">Appendix</code> element. If it is present, a bibliography section is generated and inserted into the document. The attribute <code class="code">Databases</code> must be specified and refers to BibTeX databases. The databases must be separated by commas and must <em>not</em> have a <code class="file">.bib</code> extension. A bibliography style may be specified with the <code class="code">Style</code> attribute. The optional <code class="code">Style</code> attribute (for LaTeX output of the document) must also be specified without the <code class="file">.bst</code> extension (the default is <code class="code">alpha</code>). See also section <a href="chap3.html#s5ss3"><b>3.5-3</b></a> for a description of the <code class="code">Cite</code> element which is used to include bibliography references into the text.</p> <p>The reference for the format of BibTeX database files is <a href="chapBib.html#biBLa85">[L85, Appendix B]</a>.</p> <p><a name="s2ss14"></a></p> <h5>3.2-14 <code class="code"><TheIndex></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT TheIndex EMPTY> </pre></td></tr></table> <p>This element may occur in the <code class="code">Book</code> element after the <code class="code">Bibliography</code> element. If it is present, an index is generated and inserted into the document. There are elements in <strong class="pkg">GAPDoc</strong> which implicitly generate index entries (e.g., <code class="code">Func</code> (<a href="chap3.html#s4ss2"><b>3.4-2</b></a>)) and there is an element <code class="code">Index</code> (<a href="chap3.html#s5ss4"><b>3.5-4</b></a>)for explicitly adding index entries.</p> <p><a name="s3ss0"></a></p> <h4>3.3 Sectioning Elements</h4> <p>A <strong class="pkg">GAPDoc</strong> book is divided into <em>chapters</em>, <em>sections</em>, and <em>subsections</em>. The idea is of course, that a chapter consists of sections, which in turn consist of subsections. However for the sake of flexibility, the rules are not too restrictive. Firstly, text is allowed everywhere in the body of the document (and not only within sections). Secondly, the chapter level may be omitted. The exact rules are described below.</p> <p><em>Appendices</em> are a flavor of chapters, occurring after all regular chapters. There is a special type of subsection called "<code class="code">ManSection</code>". This is a subsection devoted to the description of a function, operation or variable. It is analogous to a manpage in the UNIX environment. Usually each function, operation, method, and so on should have its own <code class="code">ManSection</code>.</p> <p>Cross referencing is done on the level of <code class="code">Subsection</code>s, respectively <code class="code">ManSection</code>s. The topics in <strong class="pkg">GAP</strong>'s online help are also pointing to subsections. So, they should not be too long.</p> <p>We start our description of the sectioning elements "top-down":</p> <p><a name="s3ss1"></a></p> <h5>3.3-1 <code class="code"><Body></code></h5> <p>The <code class="code">Body</code> element marks the main part of the document. It must occur after the <code class="code">TableOfContents</code> element. There is a big difference between <em>inside</em> and <em>outside</em> of this element: Whereas regular text is allowed nearly everywhere in the <code class="code">Body</code> element and its subelements, this is not true for the <em>outside</em>. This has also implications on the handling of whitespace. <em>Outside</em> superfluous whitespace is usually ignored when it occurs between elements. <em>Inside</em> of the <code class="code">Body</code> element whitespace matters because character data is allowed nearly everywhere. Here is the definition in the DTD:</p> <table class="example"> <tr><td><pre> <!ELEMENT Body ( %Text;| Chapter | Section )*> </pre></td></tr></table> <p>The fact that <code class="code">Chapter</code> and <code class="code">Section</code> elements are allowed here leads to the possibility to omit the chapter level entirely in the document. For a description of <code class="code">%Text;</code> see <a href="chap3.html#s2ss3"><b>here</b></a>.</p> <p>(Remark: The purpose of this element is to make sure that a <em>valid</em> <strong class="pkg">GAPDoc</strong> document has a correct overall structure, which is only possible when the top element <code class="code">Book</code> has element content.)</p> <p><a name="s3ss2"></a></p> <h5>3.3-2 <code class="code"><Chapter></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Chapter (%Text;| Heading | Section)*> <!ATTLIST Chapter Label CDATA #IMPLIED> <!-- For reference purposes --> </pre></td></tr></table> <p>A <code class="code">Chapter</code> element can have a <code class="code">Label</code> attribute, such that this chapter can be referenced later on with a <code class="code">Ref</code> element (see section <a href="chap3.html#s5ss1"><b>3.5-1</b></a>). Note that you have to specify a label to reference the chapter as there is no automatic labelling!</p> <p><code class="code">Chapter</code> elements can contain text (for a description of <code class="code">%Text;</code> see <a href="chap3.html#s2ss3"><b>here</b></a>), <code class="code">Section</code> elements, and <code class="code">Heading</code> elements.</p> <p>The following <em>additional</em> rule cannot be stated in the DTD because we want a <code class="code">Chapter</code> element to have mixed content. There must be <em>exactly one</em> <code class="code">Heading</code> element in the <code class="code">Chapter</code> element, containing the heading of the chapter. Here is its definition:</p> <p><a name="s3ss3"></a></p> <h5>3.3-3 <code class="code"><Heading></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Heading (%InnerText;)*> </pre></td></tr></table> <p>This element is used for headings in <code class="code">Chapter</code>, <code class="code">Section</code>, <code class="code">Subsection</code>, and <code class="code">Appendix</code> elements. It may only contain <code class="code">%InnerText;</code> (for a description see <a href="chap3.html#s2ss3"><b>here</b></a>).</p> <p>Each of the mentioned sectioning elements must contain exactly one direct <code class="code">Heading</code> element (i.e., one which is not contained in another sectioning element).</p> <p><a name="s3ss4"></a></p> <h5>3.3-4 <code class="code"><Appendix></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Appendix (%Text;| Heading | Section)*> <!ATTLIST Appendix Label CDATA #IMPLIED> <!-- For reference purposes --> </pre></td></tr></table> <p>The <code class="code">Appendix</code> element behaves exactly like a <code class="code">Chapter</code> element (see <a href="chap3.html#s3ss2"><b>3.3-2</b></a>) except for the position within the document and the numbering. While chapters are counted with numbers (1., 2., 3., ...) the appendices are counted with capital letters (A., B., ...).</p> <p>Again there is an optional <code class="code">Label</code> attribute used for references.</p> <p><a name="s3ss5"></a></p> <h5>3.3-5 <code class="code"><Section></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Section (%Text;| Heading | Subsection | ManSection)*> <!ATTLIST Section Label CDATA #IMPLIED> <!-- For reference purposes --> </pre></td></tr></table> <p>A <code class="code">Section</code> element can have a <code class="code">Label</code> attribute, such that this section can be referenced later on with a <code class="code">Ref</code> element (see section <a href="chap3.html#s5ss1"><b>3.5-1</b></a>). Note that you have to specify a label to reference the section as there is no automatic labelling!</p> <p><code class="code">Section</code> elements can contain text (for a description of <code class="code">%Text;</code> see <a href="chap3.html#s2ss3"><b>here</b></a>), <code class="code">Heading</code> elements, and subsections.</p> <p>There must be exactly one direct <code class="code">Heading</code> element in a <code class="code">Section</code> element, containing the heading of the section.</p> <p>Note that a subsection is either a <code class="code">Subsection</code> element or a <code class="code">ManSection</code> element.</p> <p><a name="s3ss6"></a></p> <h5>3.3-6 <code class="code"><Subsection></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Subsection (%Text;| Heading)*> <!ATTLIST Subsection Label CDATA #IMPLIED> <!-- For reference purposes --> </pre></td></tr></table> <p>The <code class="code">Subsection</code> element can have a <code class="code">Label</code> attribute, such that this subsection can be referenced later on with a <code class="code">Ref</code> element (see section <a href="chap3.html#s5ss1"><b>3.5-1</b></a>). Note that you have to specify a label to reference the subsection as there is no automatic labelling!</p> <p><code class="code">Subsection</code> elements can contain text (for a description of <code class="code">%Text;</code> see <a href="chap3.html#s2ss3"><b>here</b></a>), and <code class="code">Heading</code> elements.</p> <p>There must be exactly one <code class="code">Heading</code> element in a <code class="code">Subsection</code> element, containing the heading of the subsection.</p> <p>Another type of subsection is a <code class="code">ManSection</code>, explained now:</p> <p><a name="s4ss0"></a></p> <h4>3.4 ManSection</h4> <p><code class="code">ManSection</code>s are intended to describe a function, operation, method, variable, or some other technical instance. It is analogous to a manpage in the UNIX environment.</p> <p><a name="s4ss1"></a></p> <h5>3.4-1 <code class="code"><ManSection></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT ManSection (((Func, Returns?) | (Oper, Returns?) | (Meth, Returns?) | (Filt, Returns?) | (Prop, Returns?) | (Attr, Returns?) | Var | Fam | InfoClass)+, Description )> <!ATTLIST ManSection Label CDATA #IMPLIED> <!-- For reference purposes --> <!ELEMENT Returns (%Text;)*> <!ELEMENT Description (%Text;)*> </pre></td></tr></table> <p>The <code class="code">ManSection</code> element can have a <code class="code">Label</code> attribute, such that this subsection can be referenced later on with a <code class="code">Ref</code> element (see section <a href="chap3.html#s5ss1"><b>3.5-1</b></a>). But this is probably rarely necessary because the elements <code class="code">Func</code> and so on (explained below) generate automatically labels for cross referencing.</p> <p>The content of a <code class="code">ManSection</code> element is one or more elements describing certain items in <strong class="pkg">GAP</strong>, each of them optionally followed by a <code class="code">Returns</code> element, followed by a <code class="code">Description</code> element, which contains <code class="code">%Text;</code> (see <a href="chap3.html#s2ss3"><b>here</b></a>) describing it. (Remember to include examples in the description as often as possible, see <a href="chap3.html#s7ss10"><b>3.7-10</b></a>). The classes of items <strong class="pkg">GAPDoc</strong> knows of are: functions (<code class="code">Func</code>), operations (<code class="code">Oper</code>), methods (<code class="code">Meth</code>), filters (<code class="code">Filt</code>), properties (<code class="code">Prop</code>), attributes (<code class="code">Attr</code>), variables (<code class="code">Var</code>), families (<code class="code">Fam</code>), and info classes (<code class="code">InfoClass</code>). One <code class="code">ManSection</code> should only describe several of such items when these are very closely related.</p> <p>Each element for an item corresponding to a <strong class="pkg">GAP</strong> function can be followed by a <code class="code">Returns</code> element. In output versions of the document the string "Returns: " will be put in front of the content text. The text in the <code class="code">Returns</code> element should usually be a short hint about the type of object returned by the function. This is intended to give a good mnemonic for the use of a function (together with a good choice of names for the formal arguments).</p> <p><code class="code">ManSection</code>s are also sectioning elements which count as subsections. A possible heading is generated automatically from the first element.</p> <p><a name="s4ss2"></a></p> <h5>3.4-2 <code class="code"><Func></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Func EMPTY> <!ATTLIST Func Name CDATA #REQUIRED Label CDATA #IMPLIED Arg CDATA #REQUIRED Comm CDATA #IMPLIED> </pre></td></tr></table> <p>This element is used within a <code class="code">ManSection</code> element to specify the usage of a function. The <code class="code">Name</code> attribute is required and its value is the name of the function. The value of the <code class="code">Arg</code> attribute (also required) contains the full list of arguments including optional parts, which are denoted by square brackets. The arguments are separated by whitespace or commas.</p> <p>The name of the function is also used as label for cross referencing. When the name of the function appears in the text of the document it should <em>always</em> be written with the <code class="code">Ref</code> element, see <a href="chap3.html#s5ss1"><b>3.5-1</b></a>. This allows to use a unique typesetting style for function names and automatic cross referencing.</p> <p>If the optional <code class="code">Label</code> attribute is given, it is appended (with a colon <code class="code">:</code> in between) to the name of the function for cross referencing purposes. The text of the label can also appear in the document text. So, it should be a kind of short explanation.</p> <table class="example"> <tr><td><pre> <Func Arg="x[, y]" Name="LibFunc" Label="for my objects"/> </pre></td></tr></table> <p>The optional <code class="code">Comm</code> attribute should be a short description of the function, usually at most one line long.</p> <p>This element automatically produces an index entry with the name of the function and, if present, the text of the <code class="code">Label</code> attribute as subentry (see also <a href="chap3.html#s2ss14"><b>3.2-14</b></a> and <a href="chap3.html#s5ss4"><b>3.5-4</b></a>).</p> <p><a name="s4ss3"></a></p> <h5>3.4-3 <code class="code"><Oper></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Oper EMPTY> <!ATTLIST Oper Name CDATA #REQUIRED Label CDATA #IMPLIED Arg CDATA #REQUIRED Comm CDATA #IMPLIED> </pre></td></tr></table> <p>This element is used within a <code class="code">ManSection</code> element to specify the usage of an operation. The attributes are used exactly in the same way as in the <code class="code">Func</code> element (see <a href="chap3.html#s4ss2"><b>3.4-2</b></a>).</p> <p>Note that multiple descriptions of the same operation may occur in a document because there may be several declarations in <strong class="pkg">GAP</strong>. Furthermore there may be several <code class="code">ManSection</code>s for methods of this operation (see <a href="chap3.html#s4ss4"><b>3.4-4</b></a>) which also use the same name. For reference purposes these must be distinguished by different <code class="code">Label</code> attributes.</p> <p><a name="s4ss4"></a></p> <h5>3.4-4 <code class="code"><Meth></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Meth EMPTY> <!ATTLIST Meth Name CDATA #REQUIRED Label CDATA #IMPLIED Arg CDATA #REQUIRED Comm CDATA #IMPLIED> </pre></td></tr></table> <p>This element is used within a <code class="code">ManSection</code> element to specify the usage of a method. The attributes are used exactly in the same way as in the <code class="code">Func</code> element (see <a href="chap3.html#s4ss2"><b>3.4-2</b></a>).</p> <p>Due to the fact that it often happens that many methods are installed for the same operation it seems to be interesting to document them independently. This is possible by using the same method name in different <code class="code">ManSection</code>s. It is however required that these subsections and those describing the corresponding operation are distinguished by different <code class="code">Label</code> attributes.</p> <p><a name="s4ss5"></a></p> <h5>3.4-5 <code class="code"><Filt></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Filt EMPTY> <!ATTLIST Filt Name CDATA #REQUIRED Label CDATA #IMPLIED Arg CDATA #IMPLIED Comm CDATA #IMPLIED Type CDATA #IMPLIED> </pre></td></tr></table> <p>This element is used within a <code class="code">ManSection</code> element to specify the usage of a filter. The first four attributes are used in the same way as in the <code class="code">Func</code> element (see <a href="chap3.html#s4ss2"><b>3.4-2</b></a>), except that the <code class="code">Arg</code> attribute is optional.</p> <p>The <code class="code">Type</code> attribute can be any string, but it is thought to be something like "<code class="code">Category</code>" or "<code class="code">Representation</code>".</p> <p><a name="s4ss6"></a></p> <h5>3.4-6 <code class="code"><Prop></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Prop EMPTY> <!ATTLIST Prop Name CDATA #REQUIRED Label CDATA #IMPLIED Arg CDATA #REQUIRED Comm CDATA #IMPLIED> </pre></td></tr></table> <p>This element is used within a <code class="code">ManSection</code> element to specify the usage of a property. The attributes are used exactly in the same way as in the <code class="code">Func</code> element (see <a href="chap3.html#s4ss2"><b>3.4-2</b></a>).</p> <p><a name="s4ss7"></a></p> <h5>3.4-7 <code class="code"><Attr></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Attr EMPTY> <!ATTLIST Attr Name CDATA #REQUIRED Label CDATA #IMPLIED Arg CDATA #REQUIRED Comm CDATA #IMPLIED> </pre></td></tr></table> <p>This element is used within a <code class="code">ManSection</code> element to specify the usage of an attribute (in <strong class="pkg">GAP</strong>). The attributes are used exactly in the same way as in the <code class="code">Func</code> element (see <a href="chap3.html#s4ss2"><b>3.4-2</b></a>).</p> <p><a name="s4ss8"></a></p> <h5>3.4-8 <code class="code"><Var></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Var EMPTY> <!ATTLIST Var Name CDATA #REQUIRED Label CDATA #IMPLIED Comm CDATA #IMPLIED> </pre></td></tr></table> <p>This element is used within a <code class="code">ManSection</code> element to document a global variable. The attributes are used exactly in the same way as in the <code class="code">Func</code> element (see <a href="chap3.html#s4ss2"><b>3.4-2</b></a>) except that there is no <code class="code">Arg</code> attribute.</p> <p><a name="s4ss9"></a></p> <h5>3.4-9 <code class="code"><Fam></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Fam EMPTY> <!ATTLIST Fam Name CDATA #REQUIRED Label CDATA #IMPLIED Comm CDATA #IMPLIED> </pre></td></tr></table> <p>This element is used within a <code class="code">ManSection</code> element to document a family. The attributes are used exactly in the same way as in the <code class="code">Func</code> element (see <a href="chap3.html#s4ss2"><b>3.4-2</b></a>) except that there is no <code class="code">Arg</code> attribute.</p> <p><a name="s4ss10"></a></p> <h5>3.4-10 <code class="code"><InfoClass></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT InfoClass EMPTY> <!ATTLIST InfoClass Name CDATA #REQUIRED Label CDATA #IMPLIED Comm CDATA #IMPLIED> </pre></td></tr></table> <p>This element is used within a <code class="code">ManSection</code> element to document an info class. The attributes are used exactly in the same way as in the <code class="code">Func</code> element (see <a href="chap3.html#s4ss2"><b>3.4-2</b></a>) except that there is no <code class="code">Arg</code> attribute.</p> <p><a name="s5ss0"></a></p> <h4>3.5 Cross Referencing and Citations</h4> <p>Cross referencing in the <strong class="pkg">GAPDoc</strong> system is somewhat different to the usual LaTeX cross referencing in so far, that a reference knows "which type of object" it is referencing. For example a "reference to a function" is distinguished from a "reference to a chapter". The idea of this is, that the markup must contain this information such that the converters can produce better output. The HTML converter can for example typeset a function reference just as the name of the function with a link to the description of the function, or a chapter reference as a number with a link in the other case.</p> <p>Referencing is done with the <code class="code">Ref</code> element:</p> <p><a name="s5ss1"></a></p> <h5>3.5-1 <code class="code"><Ref></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Ref EMPTY> <!ATTLIST Ref Func CDATA #IMPLIED Oper CDATA #IMPLIED Meth CDATA #IMPLIED Filt CDATA #IMPLIED Prop CDATA #IMPLIED Attr CDATA #IMPLIED Var CDATA #IMPLIED Fam CDATA #IMPLIED InfoClass CDATA #IMPLIED Chap CDATA #IMPLIED Sect CDATA #IMPLIED Subsect CDATA #IMPLIED Appendix CDATA #IMPLIED Text CDATA #IMPLIED Label CDATA #IMPLIED BookName CDATA #IMPLIED Style (Text | Number) #IMPLIED> <!-- normally automatic --> </pre></td></tr></table> <p>The <code class="code">Ref</code> element is defined to be <code class="code">EMPTY</code>. If one of the attributes <code class="code">Func</code>, <code class="code">Oper</code>, <code class="code">Meth</code>, <code class="code">Prop</code>, <code class="code">Attr</code>, <code class="code">Var</code>, <code class="code">Fam</code>, <code class="code">InfoClass</code>, <code class="code">Chap</code>, <code class="code">Sect</code>, <code class="code">Subsect</code>, <code class="code">Appendix</code> is given then there must be exactly one of these, making the reference one to the corresponding object. The <code class="code">Label</code> attribute can be specified in addition to make the reference unique, for example if more than one method with a given name is present. (Note that there is no way to specify in the DTD that exactly one of the first listed attributes must be given, this is an additional rule.)</p> <p>A reference to a <code class="code">Label</code> element defined below (see <a href="chap3.html#s5ss2"><b>3.5-2</b></a>) is done by giving the <code class="code">Label</code> attribute and optionally the <code class="code">Text</code> attribute. If the <code class="code">Text</code> attribute is present its value is typeset in place of the <code class="code">Ref</code> element, if linking is possible (for example in HTML). If this is not possible, the section number is typeset. This type of reference is also used for references to tables (see <a href="chap3.html#s6ss5"><b>3.6-5</b></a>).</p> <p>Optionally an external reference into another book can be specified by using the <code class="code">BookName</code> attribute. In this case the <code class="code">Label</code> attribute <em>must</em> be specified and refers to a search string as in the <strong class="pkg">GAP</strong> help system. It is guaranteed that the reference points to the position in the other book, that the <strong class="pkg">GAP</strong> help system finds as first match if one types the value of the <code class="code">Label</code> element after a question mark.</p> <p>The optional attribute <code class="code">Style</code> can take only the values <code class="code">Text</code> and <code class="code">Number</code>. It can be used with references to sectioning units and it controls, whether an explicit section number is generated or text. Normally all references to sections generate numbers and references to a <strong class="pkg">GAP</strong> object generate the name of the corresponding object with some additional link or sectioning information, which is the behavior of <code class="code">Style="Text"</code>. In case <code class="code">Style="Number"</code> in all cases an explicit section number is generated. So</p> <table class="example"> <tr><td><pre> <Ref Subsect="Func" Style="Text"/> described in section <Ref Subsect="Func" Style="Number"/> </pre></td></tr></table> <p>produces: <a href="chap3.html#s2ss3"><b>3.2-3</b></a> described in section <b>???</b>.</p> <p><a name="s5ss2"></a></p> <h5>3.5-2 <code class="code"><Label></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Label EMPTY> <!ATTLIST Label Name CDATA #REQUIRED> </pre></td></tr></table> <p>This element is used to define a label for referencing a certain position in the document, if this is possible. If an exact reference is not possible (like in a printed version of the document) a reference to the corresponding subsection is generated. The value of the <code class="code">Name</code> attribute must be unique under all <code class="code">Label</code> elements.</p> <p><a name="s5ss3"></a></p> <h5>3.5-3 <code class="code"><Cite></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Cite EMPTY> <!ATTLIST Cite Key CDATA #REQUIRED Where CDATA #IMPLIED> </pre></td></tr></table> <p>This element is for bibliography citations. It is <code class="code">EMPTY</code> by definition. The attribute <code class="code">Key</code> is the key for a lookup in a BibTeX database that has to be specified in the <code class="code">Bibliography</code> element (see <a href="chap3.html#s2ss13"><b>3.2-13</b></a>). The value of the <code class="code">Where</code> attribute specifies the position in the document as in the corresponding LaTeX syntax <code class="code">\cite[...]{...}</code>.</p> <p><a name="s5ss4"></a></p> <h5>3.5-4 <code class="code"><Index></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Index (%InnerText;)*> <!ATTLIST Index Key CDATA #IMPLIED Subkey CDATA #IMPLIED> </pre></td></tr></table> <p>This element generates an index entry. The text within the element is typeset in the index entry, which is sorted under the value, that is specified in the <code class="code">Key</code> and <code class="code">Subkey</code> attributes. If they are not specified, the typeset text itself is used as the key.</p> <p>Note that all <code class="code">Func</code> and similar elements automatically generate index entries. If the <code class="code">TheIndex</code> element (<a href="chap3.html#s2ss14"><b>3.2-14</b></a>) is not present in the document all <code class="code">Index</code> elements are ignored.</p> <p><a name="s5ss5"></a></p> <h5>3.5-5 <code class="code"><URL></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT URL (#PCDATA)> <!-- Can we define this better? --> <!ATTLIST URL Text CDATA #IMPLIED> <!-- This is for output formats that have links like HTML --> </pre></td></tr></table> <p>This element is for references into the internet. The text within the element should be a valid URL. It is typeset in the document. For the case of an output document format that supports links the value of the attribute <code class="code">Text</code> is typeset as visible text for the link.</p> <p><a name="s5ss6"></a></p> <h5>3.5-6 <code class="code"><Email></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Email (#PCDATA)> </pre></td></tr></table> <p>This element type is the special case of an URL specifying an email address. The content of the element should be the email address without any prefix like "<code class="code">mailto:</code>". This address is typeset by all converters, also without any prefix. In the case of an output document format like HTML the converter can produce a link with a "<code class="code">mailto:</code>" prefix.</p> <p><a name="s5ss7"></a></p> <h5>3.5-7 <code class="code"><Homepage></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Homepage (#PCDATA)> </pre></td></tr></table> <p>This element type is the special case of an URL specifying a WWW-homepage. The content of the element should be the valid URL specifying a world wide web page. In comparison with the <code class="code">URL</code> element the address is visible in all output formats.</p> <p><a name="s6ss0"></a></p> <h4>3.6 Structural Elements like Lists</h4> <p>The <strong class="pkg">GAPDoc</strong> system offers some limited access to structural elements like lists, enumerations, and tables. Although it is possible to use all LaTeX constructs one always has to think about other output formats. The elements in this section are guaranteed to produce something reasonable in all output formats.</p> <p><a name="s6ss1"></a></p> <h5>3.6-1 <code class="code"><List></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT List ( ((Mark,Item)|(BigMark,Item)|Item)+ )> <!ATTLIST List Only CDATA #IMPLIED Not CDATA #IMPLIED> </pre></td></tr></table> <p>This element produces a list. Each item in the list corresponds to an <code class="code">Item</code> element. Every <code class="code">Item</code> element is optionally preceded by a <code class="code">Mark</code> element. The content of this is used as a marker for the item. Note that this marker can be a whole word or even a sentence. It will be typeset in some emphasized fashion and most converters will provide some indentation for the rest of the item.</p> <p>The <code class="code">Only</code> and <code class="code">Not</code> attributes can be used to specify, that the list is included into the output by only one type of converter (<code class="code">Only</code>) or all but one type of converter (<code class="code">Not</code>). Of course at most one of the two attributes may occur in one element. The following values are allowed as of now: "<code class="code">LaTeX</code>", "<code class="code">HTML</code>", and "<code class="code">Text</code>". See also the <code class="code">Alt</code> element in <a href="chap3.html#s9ss1"><b>3.9-1</b></a> for more about text alternatives for certain converters.</p> <p><a name="s6ss2"></a></p> <h5>3.6-2 <code class="code"><Mark></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Mark ( %InnerText;)*> </pre></td></tr></table> <p>This element is used in the <code class="code">List</code> element to mark items. See <a href="chap3.html#s6ss1"><b>3.6-1</b></a> for an explanation.</p> <p><a name="s6ss3"></a></p> <h5>3.6-3 <code class="code"><Item></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Item ( %Text;)*> </pre></td></tr></table> <p>This element is used in the <code class="code">List</code>, <code class="code">Enum</code>, and <code class="code">Table</code> elements to specify the items. See sections <a href="chap3.html#s6ss1"><b>3.6-1</b></a>, <a href="chap3.html#s6ss4"><b>3.6-4</b></a>, and <a href="chap3.html#s6ss5"><b>3.6-5</b></a> for further information.</p> <p><a name="s6ss4"></a></p> <h5>3.6-4 <code class="code"><Enum></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Enum ( Item+ )> <!ATTLIST Enum Only CDATA #IMPLIED Not CDATA #IMPLIED> </pre></td></tr></table> <p>This element is used identically to the <code class="code">List</code> element (see <a href="chap3.html#s6ss1"><b>3.6-1</b></a>) except that the items may not have marks attached to them. Instead, the items are numbered automatically. The same comments about the <code class="code">Only</code> and <code class="code">Not</code> attributes as above apply.</p> <p><a name="s6ss5"></a></p> <h5>3.6-5 <code class="code"><Table></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Table ( Caption?, (Row | HorLine)+ )> <!ATTLIST Table Label CDATA #IMPLIED Only CDATA #IMPLIED Not CDATA #IMPLIED Align CDATA #REQUIRED> <!-- We allow | and l,c,r, nothing else --> <!ELEMENT Row ( Item+ )> <!ELEMENT HorLine EMPTY> <!ELEMENT Caption ( %InnerText;)*> </pre></td></tr></table> <p>A table in <strong class="pkg">GAPDoc</strong> consists of an optional <code class="code">Caption</code> element followed by a sequence of <code class="code">Row</code> and <code class="code">HorLine</code> elements. A <code class="code">HorLine</code> element produces a horizontal line in the table. A <code class="code">Row</code> element consists of a sequence of <code class="code">Item</code> elements as they also occur in <code class="code">List</code> and <code class="code">Enum</code> elements. The <code class="code">Only</code> and <code class="code">Not</code> attributes have the same functionality as described in the <code class="code">List</code> element in <a href="chap3.html#s6ss1"><b>3.6-1</b></a>.</p> <p>The <code class="code">Align</code> attribute is written like a LaTeX tabular alignment specifier but only the letters "<code class="code">l</code>", "<code class="code">r</code>", "<code class="code">c</code>", and "<code class="code">|</code>" are allowed meaning left alignment, right alignment, centered alignment, and a vertical line as delimiter between columns respectively.</p> <p>If the <code class="code">Label</code> attribute is there, one can reference the table with the <code class="code">Ref</code> element (see <a href="chap3.html#s5ss1"><b>3.5-1</b></a>) using its <code class="code">Label</code> attribute.</p> <p>Usually only simple tables should be used. If you want a complicated table in the LaTeX output you should provide alternatives for text and HTML output. Note that in HTML-4.0 there is no possibility to interpret the "<code class="code">|</code>" column separators and <code class="code">HorLine</code> elements as intended. There are lines between all columns and rows or no lines at all.</p> <p><a name="s7ss0"></a></p> <h4>3.7 Types of Text</h4> <p>This section covers the markup of text. Various types of "text" exist. The following elements are used in the <strong class="pkg">GAPDoc</strong> system to mark them. They mostly come in pairs, one long name which is easier to remember and a shortcut to make the markup "lighter".</p> <p>Most of the following elements are thought to contain only character data and no further markup elements. It is however necessary to allow <code class="code">Alt</code> elements to resolve the entities described in section <a href="chap2.html#s2ss3"><b>2.2-3</b></a>.</p> <p><a name="s7ss1"></a></p> <h5>3.7-1 <code class="code"><Emph></code> and <code class="code"><E></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Emph (%InnerText;)*> <!-- Emphasize something --> <!ELEMENT E (%InnerText;)*> <!-- the same as shortcut --> </pre></td></tr></table> <p>This element is used to emphasize some piece of text. It may contain <code class="code">%InnerText;</code> (see <a href="chap3.html#s2ss3"><b>here</b></a>).</p> <p><a name="s7ss2"></a></p> <h5>3.7-2 <code class="code"><Quoted></code> and <code class="code"><Q></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Quoted (%InnerText;)*> <!-- Quoted (in quotes) text --> <!ELEMENT Q (%InnerText;)*> <!-- Quoted text (shortcut) --> </pre></td></tr></table> <p>This element is used to put some piece of text into " "-quotes. It may contain <code class="code">%InnerText;</code> (see <a href="chap3.html#s2ss3"><b>here</b></a>).</p> <p><a name="s7ss3"></a></p> <h5>3.7-3 <code class="code"><Keyword></code> and <code class="code"><K></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Keyword (#PCDATA|Alt)*> <!-- Keyword --> <!ELEMENT K (#PCDATA|Alt)*> <!-- Keyword (shortcut) --> </pre></td></tr></table> <p>This element is used to mark something as a <em>keyword</em>. Usually this will be a <strong class="pkg">GAP</strong> keyword such as "<code class="keyw">if</code>" or "<code class="keyw">for</code>". No further markup elements are allowed within this element except for the <code class="code">Alt</code> element, which is necessary.</p> <p><a name="s7ss4"></a></p> <h5>3.7-4 <code class="code"><Arg></code> and <code class="code"><A></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Arg (#PCDATA|Alt)*> <!-- Argument --> <!ELEMENT A (#PCDATA|Alt)*> <!-- Argument (shortcut) --> </pre></td></tr></table> <p>This element is used inside <code class="code">Description</code>s in <code class="code">ManSection</code>s to mark something as an <em>argument</em> (of a function, operation, or such). It is guaranteed that the converters typeset those exactly as in the definition of functions. No further markup elements are allowed within this element.</p> <p><a name="s7ss5"></a></p> <h5>3.7-5 <code class="code"><Code></code> and <code class="code"><C></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Code (#PCDATA|Alt)*> <!-- GAP code --> <!ELEMENT C (#PCDATA|Alt)*> <!-- GAP code (shortcut) --> </pre></td></tr></table> <p>This element is used to mark something as a piece of <em>code</em> like for example a <strong class="pkg">GAP</strong> expression. It is guaranteed that the converters typeset this exactly as in the <code class="code">Listing</code> element (compare section <a href="chap3.html#s7ss9"><b>3.7-9</b></a>. No further markup elements are allowed within this element.</p> <p><a name="s7ss6"></a></p> <h5>3.7-6 <code class="code"><File></code> and <code class="code"><F></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT File (#PCDATA|Alt)*> <!-- Filename --> <!ELEMENT F (#PCDATA|Alt)*> <!-- Filename (shortcut) --> </pre></td></tr></table> <p>This element is used to mark something as a <em>filename</em> or a <em>pathname</em> in the file system. No further markup elements are allowed within this element.</p> <p><a name="s7ss7"></a></p> <h5>3.7-7 <code class="code"><Button></code> and <code class="code"><B></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Button (#PCDATA|Alt)*> <!-- "Button" (also Menu, Key, ...) --> <!ELEMENT B (#PCDATA|Alt)*> <!-- "Button" (shortcut) --> </pre></td></tr></table> <p>This element is used to mark something as a <em>button</em>. It can also be used for other items in a graphical user interface like <em>menus</em>, <em>menu entries</em>, or <em>keys</em>. No further markup elements are allowed within this element.</p> <p><a name="s7ss8"></a></p> <h5>3.7-8 <code class="code"><Package></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Package (#PCDATA|Alt)*> <!-- A package name --> </pre></td></tr></table> <p>This element is used to mark something as a name of a <em>package</em>. This is for example used to define the entities <strong class="pkg">GAP</strong>, <strong class="pkg">XGAP</strong> or <strong class="pkg">GAPDoc</strong> (see section <a href="chap2.html#s2ss3"><b>2.2-3</b></a>). No further markup elements are allowed within this element.</p> <p><a name="s7ss9"></a></p> <h5>3.7-9 <code class="code"><Listing></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Listing (#PCDATA)> <!-- This is just for GAP code listings --> <!ATTLIST Listing Type CDATA #IMPLIED> <!-- a comment about the type of listed code, may appear in output --> </pre></td></tr></table> <p>This element is used to embed listings of programs into the document. Only character data and no other elements are allowed in the content. You should <em>not</em> use the character entities described in section <a href="chap2.html#s2ss3"><b>2.2-3</b></a> but instead type the characters directly. Only the general XML rules from section <a href="chap2.html#s1ss0"><b>2.1</b></a> apply. Note especially the usage of <code class="code"><![CDATA[</code> sections described there. It is guaranteed that all characters use a fixed width font for typesetting <code class="code">Listing</code> elements. Compare also the usage of the <code class="code">Code</code> and <code class="code">C</code> elements in <a href="chap3.html#s7ss5"><b>3.7-5</b></a>.</p> <p>The <code class="code">Type</code> attribute contains a comment about the type of listed code. It may appear in the output.</p> <p><a name="s7ss10"></a></p> <h5>3.7-10 <code class="code"><Log></code> and <code class="code"><Example></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Example (#PCDATA)> <!-- This is subject to the automatic example checking mechanism --> <!ELEMENT Log (#PCDATA)> <!-- This not --> </pre></td></tr></table> <p>These two elements behave exactly like the <code class="code">Listing</code> element (see <a href="chap3.html#s7ss9"><b>3.7-9</b></a>). They are thought for protocols of <strong class="pkg">GAP</strong> sessions. The only difference between the two is that <code class="code">Example</code> sections are intended to be subject to an automatic manual checking mechanism used to ensure the correctness of the <strong class="pkg">GAP</strong> manual whereas <code class="code">Log</code> is not touched by this.</p> <p><a name="s7ss11"></a></p> <h5>3.7-11 <Verb></h5> <p>There is one further type of verbatim-like element.</p> <table class="example"> <tr><td><pre> <!ELEMENT Verb (#PCDATA)> </pre></td></tr></table> <p>The content of such an element is guaranteed to be put into an output version exactly as it is using some fixed width font. Before the content a new line is started. If the line after the end of the start tag consists of whitespace only then this part of the content is skipped.</p> <p>This element is intended to be used together with the <code class="code">Alt</code> element to specify pre-formatted ASCII alternatives for complicated <code class="code">Display</code> formulae or <code class="code">Table</code>s.</p> <p><a name="s8ss0"></a></p> <h4>3.8 Elements for Mathematical Formulae</h4> <p><a name="s8ss1"></a></p> <h5>3.8-1 <code class="code"><Math></code> and <code class="code"><Display></code></h5> <table class="example"> <tr><td><pre> <!-- Normal TeX math mode formula --> <!ELEMENT Math (#PCDATA|A|Arg|Alt)*> <!-- TeX displayed math mode formula --> <!ELEMENT Display (#PCDATA|A|Arg|Alt)*> </pre></td></tr></table> <p>These elements are used for mathematical formulae. As described in section <a href="chap2.html#s2ss2"><b>2.2-2</b></a> they correspond to LaTeX's math and display math mode respectively.</p> <p>The formulae are typed in as in LaTeX, <em>except</em> that the standard XML entities, see <a href="chap2.html#s1ss9"><b>2.1-9</b></a> (in particular the characters <code class="code"><</code> and <code class="code">&</code>), must be escaped - either by using the corresponding entities or by enclosing the formula between "<code class="code"><![CDATA[</code>" and "<code class="code">]]></code>". (The main reference for LaTeX is <a href="chapBib.html#biBLa85">[L85]</a>.)</p> <p>The only element type that is allowed within the formula elements is the <code class="code">Arg</code> or <code class="code">A</code> element (see <a href="chap3.html#s7ss4"><b>3.7-4</b></a>), which is used to typeset identifiers that are arguments to <strong class="pkg">GAP</strong> functions or operations.</p> <p>In text and HTML output these formula are shown as LaTeX source code. For simple formulae (and you should try to make all your formulae simple!) there is the element <code class="code">M</code> (see <a href="chap3.html#s8ss2"><b>3.8-2</b></a>) for which there is a well defined translation into text, which can be used for text and HTML output versions of the document. So, if possible try to avoid the <code class="code">Math</code> and <code class="code">Display</code> elements or provide useful text substitutes for complicated formulae via <code class="code">Alt</code> elements (see <a href="chap3.html#s9ss1"><b>3.9-1</b></a> and <a href="chap3.html#s7ss11"><b>3.7-11</b></a>).</p> <p><a name="s8ss2"></a></p> <h5>3.8-2 <code class="code"><M></code></h5> <table class="example"> <tr><td><pre> <!-- Math with well defined translation to text output --> <!ELEMENT M (#PCDATA|A|Arg|Alt)*> </pre></td></tr></table> <p>The "<code class="code">M</code>" element type is intended for formulae in the running text for which there is a sensible ASCII version. For the LaTeX version of a <strong class="pkg">GAPDoc</strong> document the <code class="code">M</code> and <code class="code">Math</code> elements are equivalent. The remarks in <a href="chap3.html#s8ss1"><b>3.8-1</b></a> about special characters and the <code class="code">Arg</code> element apply here as well. A document which has all formulae enclosed in <code class="code">M</code> elements can be well readable in text terminal output and printed output versions.</p> <p>The following LaTeX macros have a sensible ASCII translation and are guaranteed to be translated accordingly by text (and HTML) converters:</p> <div class="pcenter"><table class="GAPDocTable"> <caption class="GAPDocTable"><b>Table: </b>LaTeX macros with special text translation</caption> <tr> <td class="tdleft">\ldots</td> <td class="tdleft"><code class="code">...</code></td> </tr> <tr> <td class="tdleft">\mid</td> <td class="tdleft"><code class="code">|</code></td> </tr> <tr> <td class="tdleft">\left</td> <td class="tdleft"><code class="code"> </code></td> </tr> <tr> <td class="tdleft">\right</td> <td class="tdleft"><code class="code"> </code></td> </tr> <tr> <td class="tdleft">\mathbb</td> <td class="tdleft"><code class="code"> </code></td> </tr> <tr> <td class="tdleft">\mathop</td> <td class="tdleft"><code class="code"> </code></td> </tr> <tr> <td class="tdleft">\limits</td> <td class="tdleft"><code class="code"> </code></td> </tr> <tr> <td class="tdleft">\cdot</td> <td class="tdleft"><code class="code">*</code></td> </tr> <tr> <td class="tdleft">\ast</td> <td class="tdleft"><code class="code">*</code></td> </tr> <tr> <td class="tdleft">\geq</td> <td class="tdleft"><code class="code">>=</code></td> </tr> <tr> <td class="tdleft">\leq</td> <td class="tdleft"><code class="code"><=</code></td> </tr> <tr> <td class="tdleft">\pmod</td> <td class="tdleft"><code class="code">mod</code></td> </tr> <tr> <td class="tdleft">\equiv</td> <td class="tdleft"><code class="code">=</code></td> </tr> <tr> <td class="tdleft">\rightarrow</td> <td class="tdleft"><code class="code">-></code></td> </tr> <tr> <td class="tdleft">\hookrightarrow</td> <td class="tdleft"><code class="code">-></code></td> </tr> <tr> <td class="tdleft">\to</td> <td class="tdleft"><code class="code">-></code></td> </tr> <tr> <td class="tdleft">\longrightarrow</td> <td class="tdleft"><code class="code">--></code></td> </tr> <tr> <td class="tdleft">\Rightarrow</td> <td class="tdleft"><code class="code">=></code></td> </tr> <tr> <td class="tdleft">\Longrightarrow</td> <td class="tdleft"><code class="code">==></code></td> </tr> <tr> <td class="tdleft">\Leftarrow</td> <td class="tdleft"><code class="code"><=</code></td> </tr> <tr> <td class="tdleft">\iff</td> <td class="tdleft"><code class="code"><=></code></td> </tr> <tr> <td class="tdleft">\mapsto</td> <td class="tdleft"><code class="code">-></code></td> </tr> <tr> <td class="tdleft">\leftarrow</td> <td class="tdleft"><code class="code"><-</code></td> </tr> <tr> <td class="tdleft">\langle</td> <td class="tdleft"><code class="code"><</code></td> </tr> <tr> <td class="tdleft">\rangle</td> <td class="tdleft"><code class="code">></code></td> </tr> <tr> <td class="tdleft">\setminus</td> <td class="tdleft"><code class="code">\</code></td> </tr> </table><br><p> </p><br> </div> <p>In all other macros only the backslash is removed. Whitespace is normalized (to one blank) but not removed. Note that whitespace is not added, so you may want to add a few more spaces than you usually do in your LaTeX documents.</p> <p>Braces <code class="code">{}</code> are removed in general, however pairs of double braces are converted to one pair of braces. This can be used to write <code class="code"><M>x^{12}</M></code> for <code class="code">x^12</code> and <code class="code"><M>x_{{i+1}}</M></code> for <code class="code">x_{i+1}</code>.</p> <p><a name="s9ss0"></a></p> <h4>3.9 Everything else</h4> <p><a name="s9ss1"></a></p> <h5>3.9-1 <code class="code"><Alt></code></h5> <p>This element is used to specify alternatives for different output formats within normal text. See also sections <a href="chap3.html#s6ss1"><b>3.6-1</b></a>, <a href="chap3.html#s6ss4"><b>3.6-4</b></a>, and <a href="chap3.html#s6ss5"><b>3.6-5</b></a> for alternatives in lists and tables.</p> <table class="example"> <tr><td><pre> <!ELEMENT Alt (%InnerText;)*> <!-- This is only to allow "Only" and "Not" attributes for normal text --> <!ATTLIST Alt Only CDATA #IMPLIED Not CDATA #IMPLIED> </pre></td></tr></table> <p>Of course exactly one of the two attributes must occur in one element. The following values are allowed as of now: "<code class="code">LaTeX</code>", "<code class="code">HTML</code>", and "<code class="code">Text</code>". If the <code class="code">Only</code> attribute is specified then only the corresponding converter will include the content of the element into the output document. If the <code class="code">Not</code> attribute is specified the corresponding converter will ignore the content of the element.</p> <p>Within the element only <code class="code">%InnerText;</code> (see <a href="chap3.html#s2ss3"><b>here</b></a>) is allowed. This is to ensure that the same set of chapters, sections, and subsections show up in all output formats.</p> <p><a name="s9ss2"></a></p> <h5>3.9-2 <code class="code"><Par></code> and <code class="code"><P></code></h5> <table class="example"> <tr><td><pre> <!ELEMENT Par EMPTY> <!-- this is intentionally empty! --> <!ELEMENT P EMPTY> <!-- this is intentionally empty! --> </pre></td></tr></table> <p>This <code class="code">EMPTY</code> element marks the boundary of paragraphs. Note that an empty line in the input does not mark a new paragraph as opposed to the LaTeX convention.</p> <p>(Remark: it would be much easier to parse a document and to understand its sectioning and paragraph structure when there was an element whose <em>content</em> is the text of a paragraph. But in practice many paragraph boundaries are implicitly clear which would make it somewhat painful to enclose each paragraph in extra tags. The introduction of the <code class="code">P</code> or <code class="code">Par</code> elements as above delegates this pain to the writer of a conversion program for <strong class="pkg">GAPDoc</strong> documents.)</p> <div class="pcenter"> <table class="chlink"><tr><td><a href="chap0.html">Top of Book</a></td><td><a href="chap2.html">Previous Chapter</a></td><td><a href="chap4.html">Next Chapter</a></td></tr></table> <br> <div class="pcenter"><table class="chlink"><tr><td class="chlink1">Goto Chapter: </td><td><a href="chap0.html">Top</a></td><td><a href="chap1.html">1</a></td><td><a href="chap2.html">2</a></td><td><a href="chap3.html">3</a></td><td><a href="chap4.html">4</a></td><td><a href="chap5.html">5</a></td><td><a href="chapA.html">A</a></td><td><a href="chapB.html">B</a></td><td><a href="chapBib.html">Bib</a></td><td><a href="chapInd.html">Ind</a></td></tr></table><br></div> </div> <hr> <p class="foot">generated by GAPDoc2HTML</p> </body> </html>