Annotation of Amaya/doc/languages.html, revision 1.49

1.37      cvs         1: <?xml version="1.0" encoding="iso-8859-1"?>
                      2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      3:     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                      4: <html xmlns="http://www.w3.org/1999/xhtml">
1.18      cvs         5: <head>
1.30      cvs         6:   <title>The Languages of Thot</title>
1.18      cvs         7: </head>
1.30      cvs         8: 
1.18      cvs         9: <body>
                     10: 
1.19      cvs        11: <div class="frontmatter" align="center">
1.18      cvs        12: <h1>The Languages of Thot</h1>
                     13: 
                     14: <h3>Vincent Quint</h3>
                     15: 
                     16: <h4>Translated from French by Ethan Munson</h4>
                     17: 
1.49    ! quint      18: <h4>Version of March 12, 2003</h4>
1.30      cvs        19: 
1.47      quint      20: <p>© 1996-2003 INRIA</p>
1.37      cvs        21: <hr />
1.18      cvs        22: </div>
                     23: 
                     24: <div class="tableofcontents">
                     25: <h2><a href="languages.toc.html">Contents</a></h2>
                     26: <ul>
1.40      quint      27:   <li><big><a href="#sect2">The document model of Thot</a></big> 
1.30      cvs        28:     <ul>
                     29:       <li><strong><a href="#sectb21">The logical structure of
                     30:         documents</a></strong></li>
                     31:       <li><strong><a href="#sectb22">Generic and specific
                     32:         structures</a></strong></li>
                     33:       <li><strong><a href="#sectb23">Logical structure and physical
                     34:         structure</a></strong></li>
                     35:       <li><strong><a href="#sectb24">Document structures and object
                     36:         structures</a></strong></li>
                     37:     </ul>
                     38:   </li>
1.40      quint      39:   <li><big><a href="#sect3">The S language</a></big> 
1.30      cvs        40:     <ul>
1.40      quint      41:       <li><strong><a href="#sectb31">Document meta-structure</a></strong> 
1.30      cvs        42:         <ul>
                     43:           <li><a href="#sectc311">The basic types</a></li>
                     44:           <li><a href="#sectc312">Constructed elements</a></li>
1.40      quint      45:           <li><a href="#sectc313">Logical structure constructors</a> 
1.30      cvs        46:             <ul>
                     47:               <li><small><a href="#sectd3131">Aggregate and
                     48:               List</a></small></li>
                     49:               <li><small><a href="#sectd3132">Choice, Schema, and
                     50:                 Unit</a></small></li>
                     51:               <li><small><a href="#sectd3133">Reference and
                     52:                 Inclusion</a></small></li>
                     53:               <li><small><a href="#sectd3134">Mark pairs</a></small></li>
                     54:               <li><small><a href="#sectd3135">Restrictions and
                     55:                 Extensions</a></small></li>
                     56:               <li><small><a href="#sectd3136">Summary</a></small></li>
                     57:             </ul>
                     58:           </li>
                     59:           <li><a href="#sectc315">Attributes</a></li>
                     60:           <li><a href="#sectc316">Discussion of the model</a></li>
                     61:         </ul>
                     62:       </li>
                     63:       <li><strong><a href="#sectb32">The definition language for generic
1.40      quint      64:         structures</a></strong> 
1.30      cvs        65:         <ul>
                     66:           <li><a href="#sectc321">Writing Conventions</a></li>
                     67:           <li><a href="#sectc322">Extension schemas</a></li>
                     68:           <li><a href="#sectc323">The general organization of structure
                     69:             schemas</a></li>
                     70:           <li><a href="#sectc324">The default presentation</a></li>
                     71:           <li><a href="#sectc325">Global Attributes</a></li>
                     72:           <li><a href="#sectc327">Structured elements</a></li>
1.40      quint      73:           <li><a href="#sectc328">Structure definitions</a> 
1.30      cvs        74:             <ul>
                     75:               <li><small><a href="#sectd3281">List</a></small></li>
                     76:               <li><small><a href="#sectd3282">Aggregate</a></small></li>
                     77:               <li><small><a href="#sectd3283">Choice</a></small></li>
                     78:               <li><small><a href="#sectd3284">Reference</a></small></li>
                     79:               <li><small><a href="#sectd3285">Mark pairs</a></small></li>
                     80:             </ul>
                     81:           </li>
                     82:           <li><a href="#sectc329">Imports</a></li>
                     83:           <li><a href="#sectc3210">Extension rules</a></li>
                     84:           <li><a href="#sectc3212">Units</a></li>
                     85:           <li><a href="#sectc3213">Skeleton elements</a></li>
                     86:           <li><a href="#sectc3214">Exceptions</a></li>
                     87:         </ul>
                     88:       </li>
1.40      quint      89:       <li><strong><a href="#sectb33">Some examples</a></strong> 
1.30      cvs        90:         <ul>
                     91:           <li><a href="#sectc331">A class of documents: articles</a></li>
                     92:           <li><a href="#sectc332">A class of objects: mathematical
                     93:             formulas</a></li>
                     94:         </ul>
                     95:       </li>
                     96:     </ul>
                     97:   </li>
1.40      quint      98:   <li><big><a href="#sect4">The P language</a></big> 
1.30      cvs        99:     <ul>
1.40      quint     100:       <li><strong><a href="#sectb41">Document presentation</a></strong> 
1.30      cvs       101:         <ul>
                    102:           <li><a href="#sectc411">Two levels of presentation</a></li>
                    103:           <li><a href="#sectc412">Boxes</a></li>
                    104:           <li><a href="#sectc413">Views and visibility</a></li>
                    105:           <li><a href="#sectc414">Pages</a></li>
                    106:           <li><a href="#sectc415">Numbering</a></li>
1.34      cvs       107:           <li><a href="#sectc416">Presentation properties</a></li>
1.30      cvs       108:         </ul>
                    109:       </li>
                    110:       <li><strong><a href="#sectb42">Presentation description
1.40      quint     111:         language</a></strong> 
1.30      cvs       112:         <ul>
                    113:           <li><a href="#sectc421">The organization of a presentation
                    114:             schema</a></li>
                    115:           <li><a href="#sectc422">Views</a></li>
                    116:           <li><a href="#sectc423">Print Views</a></li>
                    117:           <li><a href="#sectc424">Counters</a></li>
                    118:           <li><a href="#sectc425">Presentation constants</a></li>
                    119:           <li><a href="#sectc426">Variables</a></li>
                    120:           <li><a href="#sectc427">Default presentation rules</a></li>
                    121:           <li><a href="#sectc428">Presentation and page layout boxes</a></li>
                    122:           <li><a href="#sectc429">Presentation of structured elements</a></li>
                    123:           <li><a href="#sectc4210">Logical attribute presentation</a></li>
                    124:           <li><a href="#sectc4212">Value transmission rules</a></li>
                    125:           <li><a href="#sectc4213">Presentation rules</a></li>
                    126:           <li><a href="#sectc4214">Conditions applying to presentation
1.40      quint     127:             rules</a> 
1.30      cvs       128:             <ul>
1.37      cvs       129:               <li><small><a href="#sectd42141">Conditions based on the
                    130:                 logical position of the element</a></small></li>
1.42      quint     131:               <li><small><a href="#sectd421411">Conditions based on the
                    132:                 element type</a></small></li>
1.30      cvs       133:               <li><small><a href="#sectd42142">Conditions on
                    134:                 references</a></small></li>
                    135:               <li><small><a href="#sectd42143">Conditions on logical
                    136:                 attributes</a></small></li>
                    137:               <li><small><a href="#sectd42144">Conditions on page
                    138:                 breaks</a></small></li>
                    139:               <li><small><a href="#sectd42145">Conditions on the element's
                    140:                 content</a></small></li>
                    141:               <li><small><a href="#sectd42146">Conditions on
                    142:                 counters</a></small></li>
                    143:             </ul>
                    144:           </li>
                    145:           <li><a href="#sectc4215">A presentation rule</a></li>
                    146:           <li><a href="#sectc4216">Box axes</a></li>
                    147:           <li><a href="#sectc4217">Distance units</a></li>
                    148:           <li><a href="#sectc4218">Relative positions</a></li>
1.49    ! quint     149:           <li><a href="#Floats">Floats</a></li>
1.40      quint     150:           <li><a href="#sectc4219">Box extents</a> 
1.30      cvs       151:             <ul>
                    152:               <li><small><a href="#sectd42191">Fixed extents</a></small></li>
                    153:               <li><small><a href="#sectd42192">Relative
                    154:               extents</a></small></li>
                    155:               <li><small><a href="#sectd42193">Elastic
                    156:               extents</a></small></li>
                    157:             </ul>
                    158:           </li>
                    159:           <li><a href="#sectc4220">Overflow</a></li>
                    160:           <li><a href="#sectc4221">Inheritance</a></li>
1.40      quint     161:           <li><a href="#sectc4222">Line breaking</a> 
1.30      cvs       162:             <ul>
                    163:               <li><small><a href="#sectd42221">Line spacing</a></small></li>
                    164:               <li><small><a href="#sectd42222">First line
                    165:                 indentation</a></small></li>
                    166:               <li><small><a href="#sectd42223">Alignment</a></small></li>
                    167:               <li><small><a href="#sectd42225">Hyphenation</a></small></li>
1.40      quint     168:               <li><small><a href="#sectd422251">Writing
                    169:               direction</a></small></li>
1.30      cvs       170:               <li><small><a href="#sectd42226">Avoiding line
                    171:                 breaking</a></small></li>
                    172:             </ul>
                    173:           </li>
                    174:           <li><a href="#sectc4223">Page breaking and line breaking
                    175:             conditions</a></li>
                    176:           <li><a href="#sectc4224">Visibility</a></li>
1.40      quint     177:           <li><a href="#sectc4225">Character style properties</a> 
1.30      cvs       178:             <ul>
                    179:               <li><small><a href="#sectd42251">Character size</a></small></li>
                    180:               <li><small><a href="#sectd42252">Font and character
                    181:                 style</a></small></li>
                    182:               <li><small><a href="#sectd42253">Underlining</a></small></li>
                    183:             </ul>
                    184:           </li>
                    185:           <li><a href="#sectc4226">Stacking order</a></li>
                    186:           <li><a href="#sectc4227">Line style</a></li>
                    187:           <li><a href="#sectc4228">Line thickness</a></li>
                    188:           <li><a href="#sectc4229">Fill pattern</a></li>
                    189:           <li><a href="#sectc4230">Colors</a></li>
                    190:           <li><a href="#sectc4230a">Background color and border</a></li>
                    191:           <li><a href="#sectc4230b">Background pictures</a></li>
1.48      quint     192:           <li><a href="#sectc4230c">Opacity</a></li>
1.30      cvs       193:           <li><a href="#sectc4231">Presentation box content</a></li>
                    194:           <li><a href="#sectc4232">Presentation box creation</a></li>
                    195:           <li><a href="#sectc4233">Page layout</a></li>
                    196:           <li><a href="#sectc4234">Box copies</a></li>
                    197:         </ul>
                    198:       </li>
                    199:     </ul>
                    200:   </li>
1.40      quint     201:   <li><big><a href="#sect5">The T language</a></big> 
1.30      cvs       202:     <ul>
1.40      quint     203:       <li><strong><a href="#sectb51">Document translation</a></strong> 
1.30      cvs       204:         <ul>
                    205:           <li><a href="#sectc511">Translation principles</a></li>
                    206:           <li><a href="#sectc512">Translation procedure</a></li>
                    207:         </ul>
                    208:       </li>
                    209:       <li><strong><a href="#sectb52">Translation definition
1.40      quint     210:         language</a></strong> 
1.30      cvs       211:         <ul>
                    212:           <li><a href="#sectc521">Organization of a translation
                    213:           schema</a></li>
                    214:           <li><a href="#sectc522">Line length</a></li>
                    215:           <li><a href="#sectc523">Buffers</a></li>
                    216:           <li><a href="#sectc524">Counters</a></li>
                    217:           <li><a href="#sectc525">Constants</a></li>
                    218:           <li><a href="#sectc526">Variables</a></li>
                    219:           <li><a href="#sectc527">Translating structure elements</a></li>
1.40      quint     220:           <li><a href="#sectc528">Conditional rules</a> 
1.30      cvs       221:             <ul>
                    222:               <li><small><a href="#sectd5281">Conditions based on the logical
                    223:                 position of the element</a></small></li>
                    224:               <li><small><a href="#sectd5282">Conditions on
                    225:                 references</a></small></li>
                    226:               <li><small><a href="#sectd5284">Conditions on the
1.41      vatton    227:                 scripts</a></small></li>
1.30      cvs       228:               <li><small><a href="#sectd5285">Conditions on page
                    229:                 breaks</a></small></li>
                    230:               <li><small><a href="#sectd5286">Conditions on the element's
                    231:                 content</a></small></li>
                    232:               <li><small><a href="#sectd5288">Conditions on the presence of
                    233:                 specific presentation rules</a></small></li>
                    234:               <li><small><a href="#sectd5289">Conditions on the presence of
                    235:                 logical attributes</a></small></li>
                    236:               <li><small><a href="#sectd52810">Conditions on logical
                    237:                 attributes</a></small></li>
                    238:               <li><small><a href="#sectd52811">Conditions on specific
                    239:                 presentation rules</a></small></li>
                    240:             </ul>
                    241:           </li>
                    242:           <li><a href="#sectc529">Translation rules</a></li>
                    243:           <li><a href="#sectc5210">The <tt>Create</tt> rule</a></li>
                    244:           <li><a href="#sectc5211">The <tt>Write</tt> rule</a></li>
                    245:           <li><a href="#sectc5212">The <tt>Read</tt> rule</a></li>
                    246:           <li><a href="#sectc5213">The <tt>Include</tt> rule</a></li>
                    247:           <li><a href="#sectc5214">The <tt>Get</tt> rule</a></li>
                    248:           <li><a href="#sectc5215">The <tt>Copy</tt> rule</a></li>
                    249:           <li><a href="#sectc5216">The <tt>Use</tt> rule</a></li>
                    250:           <li><a href="#sectc5217">The <tt>Remove</tt> rule</a></li>
1.31      cvs       251:           <li><a href="#sectc5217a">The <code>Ignore</code> rule</a></li>
1.30      cvs       252:           <li><a href="#sectc5218">The <tt>NoTranslation</tt> rule</a></li>
                    253:           <li><a href="#sectc5219">The <tt>NoLineBreak</tt> rule</a></li>
                    254:           <li><a href="#sectc5220">The <tt>ChangeMainFile</tt> rule</a></li>
                    255:           <li><a href="#sectc5220a">The <tt>RemoveFile</tt> rule</a></li>
                    256:           <li><a href="#sectc5221">The <tt>Set</tt> and <tt>Add</tt>
                    257:           rules</a></li>
                    258:           <li><a href="#sectc5221a">The <tt>Indent</tt> rule</a></li>
                    259:           <li><a href="#sectc5222">Rule application order</a></li>
                    260:           <li><a href="#sectc5223">Translation of logical attributes</a></li>
                    261:           <li><a href="#sectc5224">Translation of specific
                    262:           presentations</a></li>
                    263:           <li><a href="#sectc5225">Recoding of characters, symbols and
                    264:             graphics</a></li>
                    265:         </ul>
                    266:       </li>
                    267:     </ul>
                    268:   </li>
1.40      quint     269:   <li><big><a href="#sect6">Language grammars</a></big> 
1.30      cvs       270:     <ul>
                    271:       <li><strong><a href="#sectb61">The M meta-language</a></strong></li>
                    272:       <li><strong><a href="#sectb62">The S language</a></strong></li>
                    273:       <li><strong><a href="#sectb63">The P language</a></strong></li>
                    274:       <li><strong><a href="#sectb64">The T language</a></strong></li>
                    275:     </ul>
                    276:   </li>
1.40      quint     277:   <li><big><a href="#sect7">Character coding</a></big> 
1.30      cvs       278:     <ul>
                    279:       <li><strong><a href="#sectb71">Characters</a></strong></li>
                    280:       <li><strong><a href="#sectb72">Symbols</a></strong></li>
                    281:       <li><strong><a href="#sectb73">Graphical elements</a></strong></li>
                    282:     </ul>
                    283:   </li>
1.18      cvs       284: </ul>
1.37      cvs       285: <hr />
1.18      cvs       286: </div>
1.1       cvs       287: 
1.18      cvs       288: <div class="chapter">
1.37      cvs       289: <h1><a name="sect2" id="sect2">The document model of Thot</a></h1>
1.1       cvs       290: 
1.30      cvs       291: <p>All of the services which Thot provides to the user are based on the
1.37      cvs       292: system's internal document representation. This representation is itself
                    293: derived from the document model which underlies Thot. The model is presented
1.30      cvs       294: here, prior to the description of the languages which permit the generic
                    295: specification of documents.</p>
1.1       cvs       296: 
1.18      cvs       297: <div class="section">
1.37      cvs       298: <h2><a name="sectb21" id="sectb21">The logical structure of documents</a></h2>
1.1       cvs       299: 
1.30      cvs       300: <p>The document model of Thot is primarily designed to allow the user to
                    301: operate on those entities which s/he has in mind when s/he works on a
                    302: document. The model makes no assumptions about the nature of these entities.
                    303: It is essentially these logical entities, such as paragraphs, sections,
                    304: chapters, notes, titles, and cross-references which give a document its
                    305: logical structure.</p>
                    306: 
                    307: <p>Because of this model, the author can divide the document into chapters,
1.37      cvs       308: giving each one a title. The content of these chapters can be further divided
                    309: into sections, subsections, etc. The text is organized into successive
1.2       cvs       310: paragraphs, according to the content. In the writing phase, the lines, pages,
1.37      cvs       311: margins, spacing, fonts, and character styles are not very important. In
                    312: fact, if the system requires documents to be written in these terms, it gets
                    313: in the way. So, Thot's model is primarily based on the logical aspect of
                    314: documents. The creation of a model of this type essentially requires the
                    315: definition :</p>
1.18      cvs       316: <ul>
1.30      cvs       317:   <li>of the entities which can appear in the documents,</li>
                    318:   <li>and the relations between these entities.</li>
1.18      cvs       319: </ul>
1.30      cvs       320: 
1.37      cvs       321: <p>The choice of entities to include in the model can be subtle. Some
                    322: documents require chapters, while others only need various levels of
                    323: sections. Certain documents contain appendices, others don't. In different
                    324: documents the same logical entity may go by different names (e.g.
                    325: ``Conclusion'' and ``Summary''). Certain entities which are absolutely
                    326: necessary in some documents, such as clauses in a contract or the address of
                    327: the recipient in a letter, are useless in most other cases.</p>
1.30      cvs       328: 
                    329: <p>The differences between documents result from more than just the entities
                    330: that appear in them, but also from the relationships between these entities
1.37      cvs       331: and the ways that they are linked. In certain documents, notes are spread
1.30      cvs       332: throughout the document, for example at the bottom of the page containing the
1.1       cvs       333: cross-reference to them, while in other documents they are collected at the
1.37      cvs       334: end of each chapter or even at the end of the work. As another example, the
1.1       cvs       335: introduction of some documents can contain many sections, while in other
                    336: documents, the introduction is restricted to be a short sequence of
1.18      cvs       337: paragraphs.</p>
1.30      cvs       338: 
1.37      cvs       339: <p>All of this makes it unlikely that a single model can describe any
                    340: document at a relatively high level. It is obviously tempting to make up a
                    341: list of widely used entities, such as chapters, sections, paragraphs, and
                    342: titles, and then map all other entities onto the available choices. In this
                    343: way, an introduction can be supported as a chapter and a contract clause
                    344: supported as a paragraph or section. However, in trying to widen the range of
                    345: usage of certain entities, their meaning can be lost and the power of the
                    346: model reduced. In addition, while this widening partially solves the problem
                    347: of choosing entities, it does not solve the problem of their organization:
                    348: when a chapter must be composed of sections, how does one indicate that an
                    349: introduction has none when it is merely another chapter? One solution is to
1.1       cvs       350: include introductions in the list of supported entities. But then, how does
                    351: one distinguish those introductions which are allowed to have sections from
1.37      cvs       352: those which are not. Perhaps this could be done by defining two types of
1.1       cvs       353: introduction. Clearly, this approach risks an infinite expansion of the list
1.18      cvs       354: of widely used entities.</p>
                    355: </div>
1.1       cvs       356: 
1.18      cvs       357: <div class="section">
1.37      cvs       358: <h2><a name="sectb22" id="sectb22">Generic and specific structures</a></h2>
1.1       cvs       359: 
1.30      cvs       360: <p>Thus, it is apparently impossible to construct an exhaustive inventory of
                    361: all those entities which are necessary and sufficient to precisely describe
1.37      cvs       362: any document. It also seems impossible to specify all possible arrangements
                    363: of these entities in a document. This is why Thot uses a <em>meta-model</em>
1.18      cvs       364: instead, which permits the description of numerous <em>models</em>, each one
                    365: describing a <em>class</em> of documents.</p>
1.30      cvs       366: 
1.37      cvs       367: <p>A <em>class</em> is a set of documents having very similar structure.
                    368: Thus, the collection of research reports published by a laboratory
                    369: constitutes a class; the set of commercial proposals by the sales department
                    370: of a company constitutes another class; the set of articles published by a
                    371: journal constitutes a third class. Clearly, it is not possible to enumerate
                    372: every possible document class. It is also clear that new document classes
                    373: must be created to satisfy new needs and applications.</p>
1.30      cvs       374: 
                    375: <p>To give a more rigorous definition of classes, we must introduce the ideas
1.37      cvs       376: of <em>generic structure</em> and <em>specific structure</em>. Each document
1.30      cvs       377: has a <em>specific structure</em> which organizes the various parts which
1.37      cvs       378: comprise it. We illustrate this with the help of a simple example comparing
1.30      cvs       379: two reports, A and B (<a href="#specstruct">see Figure</a>). The report A
1.37      cvs       380: contains an introduction followed by three chapters and a conclusion. The
                    381: first chapter contains two sections, the second, three sections. That is the
1.18      cvs       382: <em>specific</em> structure of document A. Similarly, the structure of
1.1       cvs       383: document B is: an introduction, two chapters, a conclusion; Chapter 1 has
1.37      cvs       384: three sections while Chapter 2 has four. The specific structures of these two
1.18      cvs       385: documents are thus different.</p>
1.1       cvs       386: 
1.18      cvs       387: <div class="figure">
1.37      cvs       388: <hr />
1.18      cvs       389: <pre>        Report A                 Report B
1.1       cvs       390:              Introduction              Introduction
                    391:              Chapter 1                 Chapter 1
                    392:                   Section 1.1               Section 1.1
                    393:                   Section 1.2               Section 1.2
                    394:              Chapter 2                      Section 1.3
                    395:                   Section 2.1          Chapter 2
                    396:                   Section 2.2               Section 2.1
                    397:                   Section 2.3               Section 2.2
                    398:              Chapter 3                      Section 2.3
                    399:              Conclusion                     Section 2.4
1.18      cvs       400:                                        Conclusion</pre>
1.30      cvs       401: 
1.37      cvs       402: <p align="center"><em><a name="specstruct" id="specstruct">Two specific
1.30      cvs       403: structures</a></em></p>
1.37      cvs       404: <hr />
1.30      cvs       405: </div>
                    406: 
                    407: <p>The <em>generic structure</em> defines the ways in which specific
1.37      cvs       408: structures can be constructed. It specifies how to generate specific
                    409: structures. The reports A and B, though different, are constructed in
1.30      cvs       410: accordance with the same generic structure, which specifies that a report
                    411: contains an introduction followed by a variable number of chapters and a
                    412: conclusion, with each chapter containing a variable number of sections.</p>
                    413: 
                    414: <p>There is a one-to-one correspondence between a class and a generic
1.37      cvs       415: structure: all the documents of a class are constructed in accordance with
                    416: the same generic structure. Hence the definition of the class: a class is a
                    417: set of documents whose specific structure is constructed in accordance with
                    418: the same generic structure. A class is characterized by its generic
1.30      cvs       419: structure.</p>
1.19      cvs       420: 
1.30      cvs       421: <p>Thus, a generic structure can be considered to be a model at the level
1.37      cvs       422: which interests us, but only for one class of documents. When the definition
1.30      cvs       423: is limited to a single class of documents, it is possible to define a model
                    424: which does a good job of representing the documents of the class, including
1.37      cvs       425: the necessary entities and unencumbered by useless entities. The description
1.30      cvs       426: of the organization of the documents in the class can then be sufficiently
1.18      cvs       427: precise.</p>
                    428: </div>
1.1       cvs       429: 
1.18      cvs       430: <div class="section">
1.37      cvs       431: <h2><a name="sectb23" id="sectb23">Logical structure and physical
                    432: structure</a></h2>
1.1       cvs       433: 
1.30      cvs       434: <p>Generic structures only describe the <em>logical</em> organization of
1.18      cvs       435: documents, not their <em>physical</em> presentation on a screen or on sheets
1.37      cvs       436: of paper. However, for a document to be displayed or printed, its graphic
1.18      cvs       437: presentation must be taken into account.</p>
1.30      cvs       438: 
                    439: <p>An examination of current printed documents shows that the details of
1.1       cvs       440: presentation essentially serve to bring out their logical structure. Outside
                    441: of some particular domains, notably advertising, the presentation is rarely
1.37      cvs       442: independent of the logical organization of the text. Moreover, the art of
1.1       cvs       443: typography consists of enhancing the organization of the text being set,
1.37      cvs       444: without catching the eye of the reader with overly pronounced effects. Thus,
                    445: italic and boldface type are used to emphasize words or expressions which
                    446: have greater significance than the rest of the text: keywords, new ideas,
                    447: citations, book titles, etc. Other effects highlight the organization of the
1.1       cvs       448: text: vertical space, margin changes, page breaks, centering, eventually
                    449: combined with the changes in the shapes or weight of the characters. These
                    450: effects serve to indicate the transitions between paragraphs, sections, or
                    451: chapters: an object's level in the logical structure of the document is shown
1.18      cvs       452: by the markedness of the effects.</p>
1.30      cvs       453: 
                    454: <p>Since the model permits the description of all of the logical structure of
                    455: the document, the presentation can be derived from the model without being
1.37      cvs       456: submerged in the document itself. It suffices to use the logical structure of
1.1       cvs       457: the document to make the desired changes in its presentation: changes in type
1.18      cvs       458: size, type style, spacing, margin, centering, etc.</p>
1.30      cvs       459: 
                    460: <p>Just as one cannot define a unique generic logical structure for all
                    461: document classes, one cannot define universal presentation rules which can be
1.37      cvs       462: applied to all document classes. For certain types of documents the chapter
                    463: titles will be centered on the page and printed in large, bold type. For
                    464: other documents, the same chapter titles will be printed in small, italic
                    465: type and aligned on the left margin.</p>
1.30      cvs       466: 
                    467: <p>Therefore, it is necessary to base the presentation specifications for
1.37      cvs       468: documents on their class. Such a specification can be very fine-grained,
1.1       cvs       469: because the presentation is expressed in terms of the entities defined in the
1.37      cvs       470: generic logical structure of the class. Thus, it is possible to specify a
1.1       cvs       471: different presentation for the chapter titles and the section titles, and
                    472: similarly to specify titles for the sections according to their level in the
1.37      cvs       473: section hierarchy. The set of rules which specify the presentation of all the
1.18      cvs       474: elements defined in a generic logical structure is called a <em>generic
                    475: presentation</em>.</p>
1.30      cvs       476: 
                    477: <p>There are several advantages derived from having a presentation linked to
                    478: the generic structure and described by a generic presentation. Homogeneity is
1.37      cvs       479: the first. Since every document in a class corresponds to the same generic
1.1       cvs       480: logical structure, a homogenous presentation for different documents of the
                    481: same class can be assured by applying the same generic presentation to all
1.37      cvs       482: documents of the class. Homogeneity of presentation can also be found among
                    483: the entities of a single document: every section heading will be presented in
                    484: the same way, the first line of every paragraph of the same type will have
                    485: the same indentation, etc.</p>
1.30      cvs       486: 
                    487: <p>Another advantage of this approach to presentation is that it facilitates
1.37      cvs       488: changes to the graphical aspect of documents. A change to the generic
                    489: presentation rules attached to each type of entity will alter the
                    490: presentation of the entire document, and will do so homogenously. In this
                    491: case, the internal homogeneity of the class is no longer assured, but the way
                    492: to control it is simple. It suffices to adopt a single generic presentation
                    493: for the entire class.</p>
1.30      cvs       494: 
                    495: <p>If the presentation of the class does not have to be homogenous, then the
1.37      cvs       496: appearance of the document can be adapted to the way it will be used or to
                    497: the device used to render it. This quality is sufficient to allow the
                    498: existence of <a name="mulpres" id="mulpres">many generic presentations</a>
                    499: for the same document class. By applying one or the other of these
                    500: presentations to it, the document can be seen under different graphical
                    501: aspects. It must be emphasized that this type of modification of the
                    502: presentation is not a change to the document itself (in its specific logical
                    503: structure or its content), but only in its appearance at the time of editing
                    504: or printing.</p>
1.18      cvs       505: </div>
1.1       cvs       506: 
1.18      cvs       507: <div class="section">
1.37      cvs       508: <h2><a name="sectb24" id="sectb24">Document structures and object
                    509: structures</a></h2>
1.1       cvs       510: 
1.30      cvs       511: <p>So far, we have only discussed the global structure of documents and have
1.37      cvs       512: not considered the contents found in that structure. We could limit ourselves
1.30      cvs       513: to purely textual contents by assuming that a title or a paragraph contains a
1.37      cvs       514: simple linear text. But this model would be too restrictive. In fact, certain
                    515: documents contain not only text, but also contain tables, diagrams,
                    516: photographs, mathematical formulas, and program fragments. The model must
1.18      cvs       517: permit the representation of such <em>objects</em>.</p>
1.30      cvs       518: 
                    519: <p>Just as with the whole of the document, the model takes into account the
1.37      cvs       520: logical structure of objects of this type. Some are clearly structured,
                    521: others are less so. Logical structure can be recognized in mathematical
                    522: formulas, in tables, and in certain types of diagrams. On the other hand, it
                    523: is difficult to define the structure of a photograph or of some drawings. But
1.1       cvs       524: in any case, it does not seem possible to define one unique structure which
1.37      cvs       525: can represent every one of these types of objects. The approach taken in the
1.1       cvs       526: definition of meta-structure and document classes also applies to objects.
                    527: Object classes can be defined which put together objects of similar type,
1.18      cvs       528: constructed from the same generic logical structure.</p>
1.30      cvs       529: 
                    530: <p>Thus, a mathematical class can be defined and have a generic logical
1.37      cvs       531: structure associated with it. But even if a single generic structure can
1.30      cvs       532: represent a sufficient variety of mathematical formulas, for other objects
1.37      cvs       533: with less rigorous structure, multiple classes must be defined. As for
                    534: documents, using multiple classes assures that the model can describe the
                    535: full range of objects to be presented. It also permits the system to support
                    536: objects which were not initially anticipated. Moreover, this comment applies
1.30      cvs       537: equally to mathematics: different classes of formulas can be described
                    538: depending on the domain of mathematics being described.</p>
                    539: 
                    540: <p>Since objects have the same level of logical representation as documents,
1.37      cvs       541: they gain the same advantages. In particular, it is possible to define the
1.1       cvs       542: presentation separately from the objects themselves and attach it to the
1.37      cvs       543: class. Thus, as for documents, objects of the same type have a uniform
1.1       cvs       544: presentation and the presentation of every object in a given class can be
1.37      cvs       545: changed simply by changing the generic presentation of the class. Another
1.1       cvs       546: advantage of using this document model is that the system does not bother the
                    547: user with the details of presentation, but rather allows the user to
1.18      cvs       548: concentrate on the logical aspect of the document and the objects.</p>
1.30      cvs       549: 
                    550: <p>It is clear that the documents in a class do not necessarily use the same
1.1       cvs       551: classes of objects: one technical report will contain tables while another
                    552: report will have no tables but will use mathematical formulas. The usable
1.2       cvs       553: object classes are not always mentioned in a limiting way in the generic
1.37      cvs       554: logical structure of documents. Rather, they can be chosen freely from a
1.18      cvs       555: large set, independent of the document class.</p>
1.30      cvs       556: 
                    557: <p>Thus, the object classes will be made commonplace and usable in every
1.1       cvs       558: document. The notion of ``object'' can be enlarged to include not only
                    559: non-textual elements, but also certain types of textual elements which can
1.37      cvs       560: appear in practically every document, whatever their class. Among these
1.2       cvs       561: textual elements, one can mention enumerations, descriptions, examples,
1.18      cvs       562: quotations, even paragraphs.</p>
1.30      cvs       563: 
                    564: <p>Thus, the document model is not a single, general model describing every
1.37      cvs       565: type of document in one place. Rather, it is a meta-model which can be used
1.30      cvs       566: to describe many different models each of which represents either a class of
1.1       cvs       567: similar documents or a class of similar objects which every document can
1.18      cvs       568: include.</p>
                    569: </div>
1.37      cvs       570: <hr />
1.18      cvs       571: </div>
1.1       cvs       572: 
1.18      cvs       573: <div class="chapter">
1.37      cvs       574: <h1><a name="sect3" id="sect3">The S language</a></h1>
1.1       cvs       575: 
1.18      cvs       576: <div class="section">
1.37      cvs       577: <h2><a name="sectb31" id="sectb31">Document meta-structure</a></h2>
1.1       cvs       578: 
1.30      cvs       579: <p>Since the concept of meta-structure is well suited to the task of
                    580: describing documents at a high level of abstraction, this meta-structure must
1.37      cvs       581: be precisely defined. Toward that end this section first presents the basic
1.1       cvs       582: elements from which documents and structured objects are composed and then
1.37      cvs       583: specifies the ways in which these basic elements are assembled into
                    584: structures representing complete documents and objects.</p>
1.1       cvs       585: 
1.18      cvs       586: <div class="subsection">
1.37      cvs       587: <h3><a name="sectc311" id="sectc311">The basic types</a></h3>
1.1       cvs       588: 
1.37      cvs       589: <p>At the lowest level of a document's structure, the first atom considered
                    590: is the character. However, since characters are seldom isolated, usually
1.1       cvs       591: appearing as part of a linear sequence, and in order to reduce the complexity
1.18      cvs       592: of the document structure, <em>character strings</em> are used as atoms and
1.37      cvs       593: consecutive characters belonging to the same structural element are grouped
                    594: in the same character string.</p>
1.30      cvs       595: 
1.37      cvs       596: <p>If the structure of a document is not refined to go down to the level of
                    597: words or phrases, the contents of a simple paragraph can be considered to be
                    598: a single character string. On the other hand, the title of a chapter, the
                    599: title of the first section of that chapter, and the text of the first
                    600: paragraph of that section constitute three different character strings,
                    601: because they belong to distinct structural elements.</p>
1.30      cvs       602: 
                    603: <p>If, instead, a very fine-grained representation for the structure of a
1.1       cvs       604: document is sought, character strings could be defined to contain only a
1.37      cvs       605: single word, or even just a single character. This is the case, for example,
                    606: in programs, for which one wants to retain a structure very close to the
                    607: syntax of the programming language. In this case, an assignment statement
1.1       cvs       608: initializing a simple variable to zero would be composed of two structural
                    609: elements, the identifier of the variable (a short character string) and the
1.18      cvs       610: assigned value (a string of a single character, `0').</p>
1.30      cvs       611: 
                    612: <p>The character string is not the only atom necessary for representing those
1.37      cvs       613: documents that interest us. It suffices for purely textual documents, but as
1.1       cvs       614: soon as the non-textual objects which we have considered arise, there must be
                    615: other atoms; the number of objects which are to be represented determines the
1.18      cvs       616: number of types of atoms that are necessary.</p>
1.30      cvs       617: 
                    618: <p>Primitive <em>graphical elements</em> are used for tables and figures of
1.37      cvs       619: different types. These elements are simple geometric shapes like horizontal
1.1       cvs       620: or vertical lines, which are sufficient for tables, or even oblique lines,
1.2       cvs       621: arrows, rectangles, circles, polygons, and curves for use in figures. From
                    622: these elements and character strings, graphical objects and tables can be
1.18      cvs       623: constructed.</p>
1.30      cvs       624: 
                    625: <p>Photographs, though having very little structure, must still appear in
1.37      cvs       626: documents. They are supported by <em>picture</em> elements, which are
1.18      cvs       627: represented as matrices of pixels.</p>
1.30      cvs       628: 
                    629: <p>Finally, mathematical notations require certain elements which are
1.37      cvs       630: simultaneously characters and graphical elements, the <em>symbols</em>. By
                    631: way of example, radicals, integration signs, or even large parentheses are
                    632: examples of this type of atom. The size of each of these symbols is
1.1       cvs       633: determined by its environment, that is to say, by the expression to which it
1.18      cvs       634: is attached.</p>
1.30      cvs       635: 
                    636: <p>To summarize, the primitive elements which are used in the construction of
1.18      cvs       637: documents and structured objects are:</p>
                    638: <ul>
1.30      cvs       639:   <li>character strings,</li>
                    640:   <li>graphical elements,</li>
                    641:   <li>pictures,</li>
                    642:   <li>and mathematical symbols.</li>
1.18      cvs       643: </ul>
                    644: </div>
1.1       cvs       645: 
1.18      cvs       646: <div class="subsection">
1.37      cvs       647: <h3><a name="sectc312" id="sectc312">Constructed elements</a></h3>
1.30      cvs       648: 
1.37      cvs       649: <p>A document is evidently formed from primitive elements. But the model of
                    650: Thot also proposes higher level elements. Thus, in a document composed of
                    651: several chapters, each chapter is an element, and in the chapters each
                    652: section is also an element, and so on. A document is thus an organized set of
1.30      cvs       653: elements.</p>
1.1       cvs       654: 
1.37      cvs       655: <p>In a document there are different sorts of elements. Each element has a
                    656: <em>type</em> which indicates the role of the element within the document as
                    657: a whole. Thus, we have, for example, the chapter and section types. The
1.1       cvs       658: document is made up of typed elements: elements of the type chapter and
1.37      cvs       659: elements of the type section, among others, but also character string
                    660: elements and graphical elements: the primitive elements are typed elements
                    661: just as well. At the other extreme, the document itself is also considered to
                    662: be a typed element.</p>
1.30      cvs       663: 
                    664: <p>The important difference between the primitive elements and the other
1.37      cvs       665: elements of the document is that the primitive elements are atoms (they
                    666: cannot be decomposed), whereas the others, called <em>constructed
                    667: elements</em>, are composed of other elements, which can either be primitive
                    668: elements or constructed elements. A constructed element of type chapter (or
                    669: more simply, ``a chapter'') is composed of sections, which are also
                    670: constructed elements. A paragraph, a constructed element, can be made up of
                    671: character strings, which are primitive elements, and of equations, which are
                    672: constructed elements.</p>
1.30      cvs       673: 
1.37      cvs       674: <p>A document is also a constructed element. This is an important point. In
1.1       cvs       675: particular, it allows a document to be treated as part of another document,
                    676: and conversely, permits a part of a document to be treated as a complete
1.37      cvs       677: document. Thus, an article presented in a journal is treated by its author as
1.1       cvs       678: a document in itself, while the editor of the journal considers it to be part
1.37      cvs       679: of an issue. A table or a figure appearing in a document can be extracted and
1.1       cvs       680: treated as a complete document, for example to prepare transparencies for a
1.18      cvs       681: conference.</p>
1.30      cvs       682: 
                    683: <p>These thoughts about types and constructed elements apply just as well to
1.37      cvs       684: objects as they do to documents. A table is a constructed element made up of
                    685: other constructed elements, rows and columns. A row is formed of cells, which
1.1       cvs       686: are also constructed elements which contain primitive elements (character
1.18      cvs       687: strings) and/or constructed elements like equations.</p>
                    688: </div>
1.1       cvs       689: 
1.18      cvs       690: <div class="subsection">
1.37      cvs       691: <h3><a name="sectc313" id="sectc313">Logical structure constructors</a></h3>
1.1       cvs       692: 
1.30      cvs       693: <p>Having defined the primitive elements and the constructed elements, it is
                    694: now time to define the types of organization which allow the building of
1.37      cvs       695: structures. For this, we rely on the notion of the <em>constructor</em>. A
                    696: constructor defines a way of assembling certain elements in a structure. It
1.1       cvs       697: resides at the level of the meta-structure: it does not describe the existing
1.37      cvs       698: relations in a given structure, but rather defines how elements are assembled
1.18      cvs       699: to build a structure that conforms to a model.</p>
1.30      cvs       700: 
                    701: <p>In defining the overall organization of documents, the first two
                    702: constructors considered are the aggregate and the list.</p>
1.1       cvs       703: 
1.18      cvs       704: <div class="subsubsection">
1.37      cvs       705: <h4><a name="sectd3131" id="sectd3131">Aggregate and List</a></h4>
1.1       cvs       706: 
1.30      cvs       707: <p>The <em>aggregate</em> constructor is used to define constructed element
                    708: types which are collections of a given number of other elements. These
1.37      cvs       709: collections may or may not be ordered. The elements may be either constructed
                    710: or primitive and are specified by their type. A report (that is, a
                    711: constructed element of the report type) has an aggregate structure. It is
1.30      cvs       712: formed from a title, an author's name, an introduction, a body, and a
1.37      cvs       713: conclusion, making it a collection of five element types. This type of
1.30      cvs       714: constructor is found in practically every document, and generally at several
                    715: levels in a document.</p>
                    716: 
                    717: <p>The <em>list</em> constructor is used to define constructed elements which
                    718: are ordered sequences of elements (constructed or primitive) having the same
                    719: type. The minimum and maximum numbers of elements for the sequence can be
                    720: specified in the list constructor or the number of elements can be left
                    721: unconstrained. The body of a report is a list of chapters and is typically
                    722: required to contain a minimum of two chapters (is a chapter useful if it is
                    723: the only one in the report?) The chapter itself can contain a list of
1.37      cvs       724: sections, each section containing a list of paragraphs. In the same way as
                    725: the aggregate, the list is a very frequently used constructor in every type
                    726: of document. However, these two constructors are not sufficient to describe
                    727: every document structure; thus other constructors supplement them.</p>
1.18      cvs       728: </div>
1.1       cvs       729: 
1.18      cvs       730: <div class="subsubsection">
1.37      cvs       731: <h4><a name="sectd3132" id="sectd3132">Choice, Schema, and Unit</a></h4>
1.1       cvs       732: 
1.30      cvs       733: <p>The <em>choice</em> constructor is used to define the structure of an
                    734: element type for which one alternative is chosen from several possibilities.
1.37      cvs       735: Thus, a paragraph can be either a simple text paragraph, or an enumeration,
                    736: or a citation.</p>
1.30      cvs       737: 
                    738: <p>The choice constructor indicates the complete list of possible options,
                    739: which can be too restrictive in certain cases, the paragraph being one such
                    740: case. Two constructors, <em>unit</em> and <em>schema</em>, address this
1.37      cvs       741: inconvenience. They allow more freedom in the choice of an element type. If a
                    742: paragraph is defined by a schema constructor, it is possible to put in the
1.1       cvs       743: place of a paragraph a table, an equation, a drawing or any other object
1.37      cvs       744: defined by another generic logical structure. It is also possible to define a
1.1       cvs       745: paragraph as a sequence of units, which could be character strings, symbols,
1.37      cvs       746: or pictures. The choice constructor alone defines a generic logical structure
1.1       cvs       747: that is relatively constrained; in contrast, using units and schemas, a very
1.18      cvs       748: open structure can be defined.</p>
1.30      cvs       749: 
                    750: <p>The <em>schema</em> constructor represents an object defined by a generic
1.18      cvs       751: logical structure chosen freely from among those available.</p>
1.30      cvs       752: 
                    753: <p>The <em>unit</em> constructor represents an element whose type can be
                    754: either a primitive type or an element type defined as a unit in the generic
                    755: logical structure of the document, or in another generic logical structure
1.37      cvs       756: used in the document. Such an element may be used in document objects
1.30      cvs       757: constructed according to other generic structures.</p>
                    758: 
                    759: <p>Thus, for example, if a cross-reference to a footnote is defined in the
1.37      cvs       760: generic logical structure ``Article'' as a unit, a table (an object defined
                    761: by another generic structure) can contain cross-references to footnotes, when
                    762: they appear in an article. In another type of document, a table defined by
1.1       cvs       763: the same generic structure can contain other types of elements, depending on
1.37      cvs       764: the type of document into which the table is inserted. All that is needed is
1.1       cvs       765: to declare, in the generic structure for tables, that the contents of cells
1.37      cvs       766: are units. In this way, the generic structure of objects is divided up
                    767: between different types of documents which are able to adapt themselves to
                    768: the environment into which they are inserted.</p>
1.18      cvs       769: </div>
1.1       cvs       770: 
1.18      cvs       771: <div class="subsubsection">
1.37      cvs       772: <h4><a name="sectd3133" id="sectd3133">Reference and Inclusion</a></h4>
1.1       cvs       773: 
1.30      cvs       774: <p>The <em>reference</em> is used to define document elements that are
1.18      cvs       775: cross-references to other elements, such as a section, a chapter, a
1.37      cvs       776: bibliographic citation, or a figure. The reference is bi-directional. It can
1.18      cvs       777: be used to access both the element being cross-referenced and each of the
                    778: elements which make use of the cross-reference.</p>
1.30      cvs       779: 
1.37      cvs       780: <p>References can be either <em>internal</em> or <em>external</em>. That is,
1.1       cvs       781: they can designate elements which appear in the same document or in another
1.18      cvs       782: document.</p>
1.30      cvs       783: 
1.37      cvs       784: <p>The <em><a name="inclusion" id="inclusion">inclusion</a></em> constructor
                    785: is a special type of reference. Like the reference, it is an internal or
                    786: external bidirectional link, but it is not a cross-reference. This link
                    787: represents the ``live'' inclusion of the designated element; it accesses the
                    788: most recent version of that element and not a ``dead'' copy, fixed in the
                    789: state in which it was found at the moment the copy was made. As soon as an
                    790: element is modified, all of its inclusions are automatically brought up to
                    791: date. It must be noted that, in addition to inclusion, Thot permits the
                    792: creation of ``dead'' copies.</p>
1.30      cvs       793: 
                    794: <p>There are three types of inclusions: inclusions with full expansion,
1.1       cvs       795: inclusions with partial expansion, and inclusions without expansion. During
                    796: editing, inclusions without expansion are represented on the screen by the
                    797: name of the included document, in a special color, while inclusions with
1.37      cvs       798: expansion (full or partial) are represented by a copy (full or partial) of
                    799: the included element (also in a special color). The on-screen representation
                    800: of a partial inclusion is a <a href="#sectc3213">``skeleton''</a> image of
                    801: the included document.</p>
1.30      cvs       802: 
                    803: <p>Inclusion with complete expansion can be used to include parts of the same
1.37      cvs       804: document or of other documents. Thus, it can be either an internal or an
                    805: external link. It can be used to include certain bibliographic entries of a
1.1       cvs       806: scientific article in another article, or to copy part of a mathematical
                    807: formula into another formula of the same document, thus assuring that both
1.18      cvs       808: copies will remain synchronized.</p>
1.30      cvs       809: 
                    810: <p>Inclusion without expansion or with partial expansion is used to include
1.37      cvs       811: complete documents. It is always an external link. It is used primarily to
1.1       cvs       812: divide very large documents into sub-documents that are easier to manipulate,
1.37      cvs       813: especially when there are many authors. So, a book can include some chapters,
1.1       cvs       814: where each chapter is a different document which can be edited separately.
                    815: When viewing the book on the screen, it might be desirable to see only the
1.37      cvs       816: titles of the chapters and sections. This can be achieved using inclusion
1.18      cvs       817: with partial expansion.</p>
1.30      cvs       818: 
1.37      cvs       819: <p>During printing, inclusions without expansion or with partial expansion
                    820: can be represented either as they were shown on the screen or by a complete
                    821: (and up-to-date) copy of the included element or document.</p>
1.30      cvs       822: 
                    823: <p>The inclusion constructor, whatever its type, respects the generic
                    824: structure: only those elements authorized by the generic structure can be
                    825: included at a given position in a document.</p>
1.18      cvs       826: </div>
1.1       cvs       827: 
1.18      cvs       828: <div class="subsubsection">
1.37      cvs       829: <h4><a name="sectd3134" id="sectd3134">Mark pairs</a></h4>
1.1       cvs       830: 
1.30      cvs       831: <p>It is often useful to delimit certain parts of a document independently
1.37      cvs       832: from the logical structure. For example, one might wish to attach some
1.30      cvs       833: information (in the form of an <a href="#sectc315">attribute</a>) or a
                    834: particular treatment to a group of words or a set of consecutive paragraphs.
                    835: <em>Mark pairs</em> are used to do this.</p>
                    836: 
                    837: <p>Mark pairs are elements which are always paired and are terminals in the
1.37      cvs       838: logical structure of the document. Their position in the structure of the
                    839: document is defined in the generic structure. It is important to note that
1.18      cvs       840: when the terminals of a mark pair are <em>extensions</em> (see the next
                    841: section), they can be used quite freely.</p>
                    842: </div>
1.1       cvs       843: 
1.18      cvs       844: <div class="subsubsection">
1.37      cvs       845: <h4><a name="sectd3135" id="sectd3135">Restrictions and Extensions</a></h4>
1.1       cvs       846: 
1.30      cvs       847: <p>The primitive types and the constructors presented so far permit the
1.1       cvs       848: definition of the logical structure of documents and objects in a rigorous
1.37      cvs       849: way. But this definition can be very cumbersome in certain cases, notably
1.1       cvs       850: when trying to constrain or extend the authorized element types in a
1.37      cvs       851: particular context. <em>Restrictions</em> and <em>extensions</em> are used to
1.18      cvs       852: cope with these cases.</p>
1.30      cvs       853: 
                    854: <p>A restriction associates with a particular element type <em>A</em>, a list
1.37      cvs       855: of those element types which elements of type <em>A</em> may not contain,
                    856: even if the definition of type <em>A</em> and those of its components
                    857: authorize them otherwise. This simplifies the writing of generic logical
                    858: structures and allows limitations to be placed, when necessary, on the
                    859: choices offered by the schema and unit constructors.</p>
                    860: 
                    861: <p>Extensions are the inverse of restrictions. They identify a list of
                    862: element types whose presence <em>is</em> permitted, even if its definition
                    863: and those of its components do not authorize them otherwise.</p>
1.18      cvs       864: </div>
                    865: 
                    866: <div class="subsubsection">
1.37      cvs       867: <h4><a name="sectd3136" id="sectd3136">Summary</a></h4>
1.18      cvs       868: 
1.30      cvs       869: <p>Thus, four constructors are used to construct a document:</p>
1.18      cvs       870: <ul>
1.30      cvs       871:   <li>the aggregate constructor (ordered or not),</li>
                    872:   <li>the list constructor,</li>
                    873:   <li>the choice constructor and its extensions, the unit and schema
                    874:     constructors,</li>
                    875:   <li>the reference constructor and its variant, the inclusion.</li>
                    876: </ul>
                    877: 
1.37      cvs       878: <p>These constructors are also sufficient for objects. Thus, these
1.30      cvs       879: constructors provide a homogenous meta-model which can describe both the
                    880: organization of the document as a whole and that of the various types of
1.37      cvs       881: objects which it contains. After presenting the description language for
1.30      cvs       882: generic structures, we will present several examples which illustrate the
                    883: appropriateness of the model.</p>
                    884: 
1.37      cvs       885: <p>The first three constructors (aggregate, list and choice) lead to
                    886: tree-like structures for documents and objects, the objects being simply the
                    887: subtrees of the tree of a document (or even of other objects' subtrees). The
                    888: reference constructor introduces other, non-hierarchical, relations which
                    889: augment those of the tree: when a paragraph makes reference to a chapter or a
                    890: section, that relation leaves the purely tree-like structure. Moreover,
                    891: external reference and inclusion constructors permit the establishment of
                    892: links between different documents, thus creating a hypertext structure.</p>
1.18      cvs       893: </div>
                    894: </div>
1.1       cvs       895: 
1.18      cvs       896: <div class="subsection">
1.37      cvs       897: <h3><a name="sectc315" id="sectc315">Attributes</a></h3>
1.1       cvs       898: 
1.30      cvs       899: <p>There remain logical aspects of documents that are not entirely described
1.37      cvs       900: by the structure. Certain types of semantic information, which are not stated
                    901: explicitly in the text, must also be taken into account. In particular, such
1.1       cvs       902: information is shown by typographic effects which do not correspond to a
1.37      cvs       903: change between structural elements. In fact, certain titles are set in bold
1.1       cvs       904: or italic or are printed in a different typeface from the rest of the text in
1.37      cvs       905: order to mark them as structurally distinct. But these same effects
1.1       cvs       906: frequently appear in the middle of continuous text (e.g. in the interior of a
1.37      cvs       907: paragraph). In this case, there is no change between structural elements; the
                    908: effect serves to highlight a word, expression, or phrase. The notion of an
1.18      cvs       909: <em>attribute</em> is used to express this type of information.</p>
1.30      cvs       910: 
                    911: <p>An attribute is a piece of information attached to a structural element
                    912: which augments the type of the element and clarifies its function in the
                    913: document. Keywords, foreign language words, and titles of other works can all
1.37      cvs       914: be represented by character strings with attached attributes. Attributes may
                    915: also be attached to constructed elements. Thus, an attribute indicating the
1.1       cvs       916: language can be attached to a single word or to a large part of a
1.18      cvs       917: document.</p>
1.30      cvs       918: 
                    919: <p>In fact, an attribute can be any piece of information which is linked to a
1.37      cvs       920: part of a document and which can be used by agents which work on the
                    921: document. For example, the language in which the document is written
                    922: determines the set of characters used by an editor or formatter. It also
                    923: determines the algorithm or hyphenation dictionary to be used. The attribute
                    924: ``keyword'' facilitates the work of an information retrieval system. The
                    925: attribute ``index word'' allows a formatter to automatically construct an
                    926: index at the end of the document.</p>
1.30      cvs       927: 
                    928: <p>As with the types of constructed elements, the attributes and the values
1.37      cvs       929: they can take are defined separately in each generic logical structure, not
                    930: in the meta-model, according to the needs of the document class or the nature
                    931: of the object.</p>
1.30      cvs       932: 
                    933: <p>Many types of attributes are offered: numeric, textual, references, and
1.18      cvs       934: enumerations:</p>
                    935: <ul>
1.40      quint     936:   <li><em>Numeric attributes</em> can take integer values (negative,
                    937:     positive, or null).</li>
                    938:   <li><em>Textual attributes</em> have as their values character strings.</li>
                    939:   <li><em>Reference attributes</em> designate an element of the logical
                    940:     structure.</li>
                    941:   <li><em>Enumeration attributes</em> can take one value from a limited list
                    942:     of possible values, each value being a name.</li>
1.18      cvs       943: </ul>
1.30      cvs       944: 
                    945: <p>In a generic structure, there is a distinction between <em>global
1.37      cvs       946: attributes</em> and <em>local attributes</em>. A global attribute can be
1.1       cvs       947: applied to every element type defined in the generic structure where it is
1.37      cvs       948: specified. In contrast, a local attribute can only be applied to certain
                    949: types of elements, even only a single type. The ``language'' attribute
                    950: presented above is an example of a global attribute. An example of a local
1.1       cvs       951: attribute is the rank of an author (principal author of the document or
                    952: secondary author): this attribute can only be applied sensibly to an element
1.18      cvs       953: of the ``author'' type.</p>
1.30      cvs       954: 
                    955: <p>Attributes can be assigned to the elements which make up the document in
1.37      cvs       956: many different ways. The author can freely and dynamically place them on any
1.30      cvs       957: part of the document in order to attach supplementary information of his/her
1.18      cvs       958: choice. However, attributes may only be assigned in accordance with the rules
1.37      cvs       959: of the generic structure; in particular, local attributes can only be
                    960: assigned to those element types for which they are defined.</p>
1.30      cvs       961: 
                    962: <p>In the generic structure, certain local attributes can be made mandatory
1.37      cvs       963: for certain element types. In this case, Thot automatically associates the
                    964: attribute with the elements of this type and it requires the user to provide
                    965: a value for this attribute.</p>
                    966: 
                    967: <p>Attributes can also be automatically assigned, with a given value, by
                    968: every application processing the document in order to systematically add a
                    969: piece of information to certain predefined elements of the document. By way
                    970: of example, in a report containing a French abstract and an English abstract,
                    971: each of the two abstracts is defined as a sequence of paragraphs. The first
1.1       cvs       972: abstract has a value of ``French'' for the ``language'' attribute while the
1.18      cvs       973: second abstract's ``language'' attribute has a value of ``English''.</p>
1.30      cvs       974: 
                    975: <p>In the case of mark pairs, attributes are logically associated with the
                    976: pair as a whole, but are actually attached to the first mark.</p>
1.18      cvs       977: </div>
1.1       cvs       978: 
1.18      cvs       979: <div class="subsection">
1.37      cvs       980: <h3><a name="sectc316" id="sectc316">Discussion of the model</a></h3>
1.1       cvs       981: 
1.37      cvs       982: <p>The notions of attribute, constructor, and structured element are used in
                    983: the definition of generic logical structures of documents and objects. The
                    984: problem is to assemble them to form generic structures. In fact, many types
                    985: of elements and attributes can be found in a variety of generic structures.
                    986: Rather than redefine them for each structure in which they appear, it is best
                    987: to share them between structures. The object classes already fill this
                    988: sharing function. If a mathematical class is defined, its formulas can be
                    989: used in many different document classes, without redefining the structure of
                    990: each class. This problem arises not only for the objects considered here; it
                    991: also arises for the commonplace textual elements found in many document
                    992: classes. This is the reason why the notion of object is so broad and why
                    993: paragraphs and enumerations are also considered to be objects. These object
                    994: classes not only permit the sharing of the structures of elements, but also
                    995: of the attributes defined in the generic structures.</p>
1.30      cvs       996: 
                    997: <p>Structure, such as that presented here, can appear very rigid, and it is
1.1       cvs       998: possible to imagine that a document editing system based on this model could
1.37      cvs       999: prove very constraining to the user. This is, in fact, a common criticism of
                   1000: syntax-directed editors. This defect can be avoided with Thot, primarily for
1.18      cvs      1001: three reasons:</p>
                   1002: <ul>
1.30      cvs      1003:   <li>the generic structures are not fixed in the model itself,</li>
                   1004:   <li>the model takes the dynamics of documents into account,</li>
                   1005:   <li>the constructors offer great flexibility.</li>
1.18      cvs      1006: </ul>
1.30      cvs      1007: 
                   1008: <p>When the generic structure of a document is not predefined, but rather is
1.1       cvs      1009: constructed specifically for each document class, it can be carefully adapted
1.37      cvs      1010: to the current needs. In cases where the generic structure is inadequate for
1.1       cvs      1011: a particular document of the class, it is always possible either to create a
                   1012: new class with a generic structure well suited to the new case or to extend
1.37      cvs      1013: the generic structure of the existing class to take into account the
                   1014: specifics of the document which poses the problem. These two solutions can
                   1015: also be applied to objects whose structures prove to be poorly designed.</p>
1.30      cvs      1016: 
                   1017: <p>The model is sufficiently flexible to take into account all the phases of
1.37      cvs      1018: the life of the document. When a generic structure specifies that a report
                   1019: must contain a title, an abstract, an introduction, at least two chapters,
                   1020: and a conclusion, this means only that a report, <em>upon completion</em>,
                   1021: will have to contain all of these elements. When the author begins writing,
                   1022: none of these elements is present. Thot uses this model. Therefore, it
                   1023: tolerates documents which do not conform strictly to the generic structure of
                   1024: their class; it also considers the generic logical structure to be a way of
                   1025: helping the user in the construction of a complex document.</p>
1.30      cvs      1026: 
                   1027: <p>In contrast, other applications may reject a document which does not
1.37      cvs      1028: conform strictly to its generic structure. This is, for example, what is done
1.30      cvs      1029: by compilers which refuse to generate code for a program which is not
1.37      cvs      1030: syntactically correct. This might also occur when using a document
1.18      cvs      1031: application for a report which does not have an abstract or title.</p>
1.30      cvs      1032: 
                   1033: <p>The constructors of the document model bring a great flexibility to the
1.37      cvs      1034: generic structures. A choice constructor (and even more, a unit or schema
                   1035: constructor) can represent several, very different elements. The list
                   1036: constructor permits the addition of more elements of the same type. Used
1.1       cvs      1037: together, these two constructors permit any series of elements of different
1.37      cvs      1038: types. Of course, this flexibility can be reduced wherever necessary since a
1.1       cvs      1039: generic structure can limit the choices or the number of elements in a
1.18      cvs      1040: list.</p>
1.30      cvs      1041: 
                   1042: <p>Another difficulty linked to the use of structure in the document model
1.37      cvs      1043: resides in the choice of the level of the structure. The structure of a
1.1       cvs      1044: discussion could be extracted from the text itself via linguistic analysis.
                   1045: Some studies are exploring this approach, but the model of Thot excludes this
1.37      cvs      1046: type of structure. It only takes into account the logical structure provided
1.18      cvs      1047: explicitly by the author.</p>
1.30      cvs      1048: 
1.37      cvs      1049: <p>However, the level of structure of the model is not imposed. Each generic
                   1050: structure defines its own level of structure, adapted to the document class
                   1051: or object and to the ways in which it will be processed. If it will only be
                   1052: edited and printed, a relatively simple structure suffices. If more
                   1053: specialized processing will be applied to it, the structure must represent
                   1054: the element types on which this processing must act. By way of example, a
                   1055: simple structure is sufficient for printing formulas, but a more complex
                   1056: structure is required to perform symbolic or numeric calculations on the
                   1057: mathematical expressions. The document model of Thot allows both types of
                   1058: structure.</p>
1.18      cvs      1059: </div>
                   1060: </div>
1.1       cvs      1061: 
1.18      cvs      1062: <div class="section">
1.37      cvs      1063: <h2><a name="sectb32" id="sectb32">The definition language for generic
                   1064: structures</a></h2>
1.1       cvs      1065: 
1.37      cvs      1066: <p>Generic structures, which form the basis of the document model of Thot,
                   1067: are specified using a special language. This definition language, called S,
                   1068: is described in this section.</p>
1.30      cvs      1069: 
                   1070: <p>Each generic structure, which defines a class of documents or objects, is
1.2       cvs      1071: specified by a file, written in the S language, which is called a
1.37      cvs      1072: <em>structure schema</em>. Structure schemas are compiled into tables, called
1.18      cvs      1073: structure tables, which are used by Thot and which determine its behavior.</p>
1.1       cvs      1074: 
1.18      cvs      1075: <div class="subsection">
1.37      cvs      1076: <h3><a name="sectc321" id="sectc321">Writing Conventions</a></h3>
1.1       cvs      1077: 
1.30      cvs      1078: <p>The grammar of S, like those of the languages P and T presented later, is
1.1       cvs      1079: described using the meta-language M, derived from the Backus-Naur Form
1.18      cvs      1080: (BNF).</p>
1.30      cvs      1081: 
                   1082: <p>In this meta-language each rule of the grammar is composed of a grammar
1.37      cvs      1083: symbol followed by an equals sign (`=') and the right part of the rule. The
1.30      cvs      1084: equals sign plays the same role as the traditional `::=' of BNF: it indicates
1.37      cvs      1085: that the right part defines the symbol of the left part. In the right
1.30      cvs      1086: part,</p>
1.18      cvs      1087: <dl>
1.30      cvs      1088:   <dt>concatenation</dt>
                   1089:     <dd>is shown by the juxtaposition of symbols;</dd>
                   1090:   <dt>character strings</dt>
1.37      cvs      1091:     <dd>between apostrophes ' represent terminal symbols, that is, keywords
                   1092:       in the language defined. Keywords are written here in upper-case
                   1093:       letters, but can be written in any combination of upper and lower-case
                   1094:       letters. For example, the keyword <tt>DEFPRES</tt> of S can also be
                   1095:       written as <tt>defpres</tt> or <tt>DefPres</tt>.</dd>
1.30      cvs      1096:   <dt>material between brackets</dt>
                   1097:     <dd>(`[' and `]') is optional;</dd>
                   1098:   <dt>material between angle brackets</dt>
                   1099:     <dd>(`&lt;' and `&gt;') can be repeated many times or omitted;</dd>
                   1100:   <dt>the slash</dt>
1.37      cvs      1101:     <dd>(`/') indicates an alternative, a choice between the options
                   1102:       separated by the slash character;</dd>
1.30      cvs      1103:   <dt>the period</dt>
                   1104:     <dd>marks the end of a rule;</dd>
                   1105:   <dt>text between braces</dt>
                   1106:     <dd>(`{' and `}') is simply a comment.</dd>
1.18      cvs      1107: </dl>
1.30      cvs      1108: 
                   1109: <p>The M meta-language also uses the concepts of identifiers, strings, and
1.18      cvs      1110: integers:</p>
                   1111: <dl>
1.30      cvs      1112:   <dt><tt>NAME</tt></dt>
1.37      cvs      1113:     <dd>represents an identifier, a sequence of letters (upper or
                   1114:       lower-case), digits, and underline characters (`_'), beginning with a
                   1115:       letter. Also considered a letter is the sequence of characters
                   1116:       `<tt>\nnn</tt>' where the letter <tt>n</tt> represents the ISO Latin-1
                   1117:       code of the letter in octal. It is thus possible to use accented
                   1118:       letters in identifiers. The maximum length of identifiers is fixed by
                   1119:       the compiler. It is normally 31 characters. 
1.30      cvs      1120:       <p>Unlike keywords, upper and lower-case letters are distinct in
                   1121:       identifiers. Thus, <tt>Title</tt>, <tt>TITLE</tt>, and <tt>title</tt>
                   1122:       are considered different identifiers.</p>
                   1123:     </dd>
                   1124:   <dt><tt>STRING</tt></dt>
1.37      cvs      1125:     <dd>represents a string. This is a string of characters delimited by
                   1126:       apostrophes. If an apostrophe must appear in a string, it is doubled.
                   1127:       As with identifiers, strings can contain characters represented by
                   1128:       their octal code (after a backslash). As with apostrophes, if a
                   1129:       backslash must appear in a string, it is doubled.</dd>
1.30      cvs      1130:   <dt><tt>NUMBER</tt></dt>
                   1131:     <dd>represents a positive integer or zero (without a sign), or said
                   1132:       another way, a sequence of decimal digits.</dd>
1.18      cvs      1133: </dl>
1.30      cvs      1134: 
                   1135: <p>The M language can be used to define itself as follows:</p>
1.18      cvs      1136: <pre>{ Any text between braces is a comment. }
1.30      cvs      1137: Grammar      = Rule &lt; Rule &gt; 'END' .
                   1138:                { The &lt; and &gt; signs indicate zero }
1.1       cvs      1139:                { or more repetitions. }
                   1140:                { END marks the end of the grammar. }
                   1141: Rule         = Ident '=' RightPart '.' .
                   1142:                { The period indicates the end of a rule }
                   1143: RightPart    = RtTerminal / RtIntermed .
                   1144:                { The slash indicates a choice }
                   1145: RtTerminal   ='NAME' / 'STRING' / 'NUMBER' .
                   1146:                { Right part of a terminal rule }
1.30      cvs      1147: RtIntermed   = Possibility &lt; '/' Possibility &gt; .
1.1       cvs      1148:                { Right part of an intermediate rule }
1.30      cvs      1149: Possibility  = ElemOpt &lt; ElemOpt &gt; .
                   1150: ElemOpt      = Element / '[' Element &lt; Element &gt; ']' /
                   1151:               '&lt;' Element &lt; Element &gt; '&gt;'  .
1.1       cvs      1152:                { Brackets delimit optional parts }
                   1153: Element      = Ident / KeyWord .
                   1154: Ident        = NAME .
                   1155:                { Identifier, sequence of characters }
                   1156: KeyWord      = STRING .
                   1157:                { Character string delimited by apostrophes }
1.18      cvs      1158: END</pre>
                   1159: </div>
1.1       cvs      1160: 
1.18      cvs      1161: <div class="subsection">
1.37      cvs      1162: <h3><a name="sectc322" id="sectc322">Extension schemas</a></h3>
1.1       cvs      1163: 
1.30      cvs      1164: <p>A structure schema defines the generic logical structure of a class of
1.1       cvs      1165: documents or objects, independent of the operations which can be performed on
1.37      cvs      1166: the documents. However, certain applications may require particular
1.1       cvs      1167: information to be represented by the structure for the documents that they
1.37      cvs      1168: operate on. Thus a document version manager will need to indicate in the
                   1169: document the parts which belong to one version or another. An indexing system
1.1       cvs      1170: will add highly-structured index tables as well as the links between these
1.18      cvs      1171: tables and the rest of the document.</p>
1.30      cvs      1172: 
                   1173: <p>Thus, many applications need to extend the generic structure of the
1.37      cvs      1174: documents on which they operate to introduce new attributes or element types.
                   1175: These additions are specific to each application and must be able to be
                   1176: applied to any generic structure: users will want to manage versions or
                   1177: construct indices for many types of documents. Extension schemas fulfill this
                   1178: role: they define attributes, elements, units, etc., but they can only be
                   1179: used jointly with a structure schema that they complete. Otherwise, structure
                   1180: schemas can always be used without these extensions when the corresponding
                   1181: applications are not available.</p>
1.18      cvs      1182: </div>
1.1       cvs      1183: 
1.18      cvs      1184: <div class="subsection">
1.37      cvs      1185: <h3><a name="sectc323" id="sectc323">The general organization of structure
                   1186: schemas</a></h3>
1.1       cvs      1187: 
1.30      cvs      1188: <p>Every structure schema begins with the keyword <tt>STRUCTURE</tt> and ends
1.37      cvs      1189: with the keyword <tt>END</tt>. The keyword <tt>STRUCTURE</tt> is followed by
1.18      cvs      1190: the keyword <tt>EXTENSION</tt> in the case where the schema defines an
1.1       cvs      1191: extension, then by the name of the generic structure which the schema defines
1.37      cvs      1192: (the name of the document or object class). The name of the structure is
1.18      cvs      1193: followed by a semicolon.</p>
1.30      cvs      1194: 
                   1195: <p>In the case of a complete schema (that is, a schema which is not an
1.1       cvs      1196: extension), the definition of the name of the structure is followed by the
                   1197: declarations of the default presentation schema, the global attributes, the
1.37      cvs      1198: structure rules, the units, the skeleton elements and the exceptions. Only
                   1199: the definition of the structure rules is required. Each series of
                   1200: declarations begins with a keyword: <tt>DEFPRES</tt>, <tt>ATTR</tt>,
                   1201: <tt>STRUCT</tt>, <tt>UNITS</tt>, <tt>EXPORT</tt>, <tt>EXCEPT</tt>.</p>
1.34      cvs      1202: 
                   1203: <p>In the case of an extension schema, there are no skeleton elements and the
                   1204: <tt>STRUCT</tt> section is optional, while that section is required in a
1.37      cvs      1205: schema that is not an extension. On the other hand, extension schemas can
                   1206: contain an <tt>EXTENS</tt> section, which must not appear in a schema which
                   1207: is not an extension; this section defines the complements to attach to the
                   1208: rules found in the schema to which the extension will be added. The sections
                   1209: <tt>ATTR</tt>, <tt>STRUCT</tt>, and <tt>UNITS</tt> define new attributes, new
                   1210: elements, and new units which add their definitions to the principal
                   1211: schema.</p>
1.18      cvs      1212: <pre>     StructSchema ='STRUCTURE' ElemID ';'
1.1       cvs      1213:                    'DEFPRES' PresID ';'
                   1214:                  [ 'ATTR' AttrSeq ]
                   1215:                    'STRUCT' RulesSeq
                   1216:                  [ 'UNITS' RulesSeq ]
                   1217:                  [ 'EXPORT' SkeletonSeq ]
                   1218:                  [ 'EXCEPT' ExceptSeq ]
                   1219:                    'END' .
1.18      cvs      1220:      ElemID       = NAME .</pre>
1.30      cvs      1221: 
                   1222: <p>or</p>
1.18      cvs      1223: <pre>     ExtensSchema ='STRUCTURE' 'EXTENSION' ElemID ';'
1.1       cvs      1224:                    'DEFPRES' PresID ';'
                   1225:                  [ 'ATTR' AttrSeq ]
                   1226:                  [ 'STRUCT' RulesSeq ]
                   1227:                  [ 'EXTENS' ExtensRuleSeq ]
                   1228:                  [ 'UNITS' RulesSeq ]
                   1229:                  [ 'EXCEPT' ExceptSeq ]
                   1230:                    'END' .
1.18      cvs      1231:      ElemID       = NAME .</pre>
                   1232: </div>
1.1       cvs      1233: 
1.18      cvs      1234: <div class="subsection">
1.37      cvs      1235: <h3><a name="sectc324" id="sectc324">The default presentation</a></h3>
1.1       cvs      1236: 
1.37      cvs      1237: <p>It was shown <a href="#mulpres">above</a> that many different
                   1238: presentations are possible for documents and objects of the same class. The
                   1239: structure schema defines a preferred presentation for the class, called the
                   1240: <em>default presentation</em>. Like generic structures, presentations are
                   1241: described by programs, called <em>presentation schemas</em>, which are
                   1242: written in a specific language, P, presented <a href="#sectb42">later</a> in
                   1243: this document. The name appearing after the keyword <tt>DEFPRES</tt> is the
                   1244: name of the default presentation schema. When a new document is created, Thot
                   1245: will use this presentation schema by default, but the user remains free to
                   1246: choose another if s/he wishes.</p>
1.18      cvs      1247: <pre>     PresID = NAME .</pre>
                   1248: </div>
1.1       cvs      1249: 
1.18      cvs      1250: <div class="subsection">
1.37      cvs      1251: <h3><a name="sectc325" id="sectc325">Global Attributes</a></h3>
1.1       cvs      1252: 
1.30      cvs      1253: <p>If the generic structure includes global attributes of its own, they are
1.37      cvs      1254: declared after the keyword <tt>ATTR</tt>. Each global attribute is defined by
                   1255: its name, followed by an equals sign and the definition of its type. The
1.18      cvs      1256: declaration of a global attribute is terminated by a semi-colon.</p>
1.30      cvs      1257: 
                   1258: <p>For attributes of the numeric, textual, or reference types, the type is
1.37      cvs      1259: indicated by a keyword, <tt>INTEGER</tt>, <tt>TEXT</tt>, or
                   1260: <tt>REFERENCE</tt> respectively.</p>
1.30      cvs      1261: 
                   1262: <p>In the case of a reference attribute, the keyword <tt>REFERENCE</tt> is
1.37      cvs      1263: followed by the type of the referenced element in parentheses. It can refer
1.18      cvs      1264: to any type at all, specified by using the keyword <tt>ANY</tt>, or to a
1.37      cvs      1265: specific type. In the latter case, the element type designated by the
1.18      cvs      1266: reference can be defined either in the <a href="#sectc327"><tt>STRUCT</tt>
                   1267: section</a> of the same structure schema or in the <tt>STRUCT</tt> section of
1.37      cvs      1268: another structure schema. When the type is defined in another schema, the
1.1       cvs      1269: element type is followed by the name of the structure schema (within
1.37      cvs      1270: parentheses) in which it is defined. The name of the designated element type
1.18      cvs      1271: can be preceded by the keyword <tt>First</tt> or <tt>Second</tt>, but only in
1.37      cvs      1272: the case where the type is defined as <a href="#sectd3285">a pair</a>. These
1.1       cvs      1273: keywords indicate whether the attribute must designate the first mark of the
1.37      cvs      1274: pair or the second. If the reference refers to a pair and neither of these
1.18      cvs      1275: two keywords is present, then the first mark is used.</p>
1.30      cvs      1276: 
1.37      cvs      1277: <p>In the case of an enumeration attribute, the equals sign is followed by
                   1278: the list of names representing the possible values of the attribute, the
                   1279: names being separated from each other by commas. An enumeration attribute has
                   1280: at least one possible value; the maximum number of values is defined by the
1.18      cvs      1281: compiler for the S language.</p>
1.30      cvs      1282: <pre>     AttrSeq   = Attribute &lt; Attribute &gt; .
1.1       cvs      1283:      Attribute = AttrID '=' AttrType  ';' .
                   1284:      AttrType  = 'INTEGER' / 'TEXT' /
                   1285:                  'REFERENCE' '(' RefType ')' /
                   1286:                  ValueSeq .
                   1287:      RefType   = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] .
                   1288:      FirstSec  = 'First' / 'Second' .
                   1289:      ExtStruct = '(' ElemID ')' .
1.30      cvs      1290:      ValueSeq  = AttrVal &lt; ',' AttrVal &gt; .
1.1       cvs      1291:      AttrID    = NAME .
1.18      cvs      1292:      AttrVal   = NAME .</pre>
1.30      cvs      1293: 
                   1294: <p>There is a predefined global text attribute, the <em>language</em>, which
1.37      cvs      1295: is automatically added to every Thot structure schema. This attribute allows
                   1296: Thot to perform certain actions, such as hyphenation and spell-checking,
                   1297: which cannot be performed without knowing the language in which each part of
                   1298: the document is written. This attribute can be used just like any explicitly
1.18      cvs      1299: declared attribute: the system acts as if every structure schema contains</p>
                   1300: <pre>ATTR
                   1301:    Language = TEXT;</pre>
1.30      cvs      1302: 
1.18      cvs      1303: <blockquote class="example">
1.30      cvs      1304:   <p><strong>Example:</strong></p>
                   1305: 
                   1306:   <p>The following specification defines the global enumeration attribute
                   1307:   WordType.</p>
                   1308:   <pre>ATTR
1.18      cvs      1309:    WordType = Definition, IndexWord, DocumentTitle;</pre>
                   1310: </blockquote>
                   1311: </div>
1.1       cvs      1312: 
1.18      cvs      1313: <div class="subsection">
1.37      cvs      1314: <h3><a name="sectc327" id="sectc327">Structured elements</a></h3>
1.1       cvs      1315: 
1.30      cvs      1316: <p>The rules for defining structured elements are required, except in an
1.1       cvs      1317: extension schema: they constitute the core of a structure schema, since they
                   1318: define the structure of the different types of elements that occur in a
1.18      cvs      1319: document or object of the class defined by the schema.</p>
1.30      cvs      1320: 
                   1321: <p>The first structure rule after the keyword <tt>STRUCT</tt> must define the
1.1       cvs      1322: structure of the class whose name appears in the first instruction
1.37      cvs      1323: (<tt>STRUCTURE</tt>) of the schema. This is the root rule of the schema,
1.18      cvs      1324: defining the root of the document tree or object tree.</p>
1.30      cvs      1325: 
                   1326: <p>The remaining rules may be placed in any order, since the language permits
1.37      cvs      1327: the definition of element types before or after their use, or even in the
                   1328: same instruction in which they are used. This last case allows the definition
                   1329: of recursive structures.</p>
1.30      cvs      1330: 
                   1331: <p>Each rule is composed of a name (the name of the element type whose
                   1332: structure is being defined) followed by an equals sign and a structure
                   1333: definition.</p>
                   1334: 
1.37      cvs      1335: <p>If any local attributes are associated with the element type defined by
                   1336: the rule, they appear between parentheses after the type name and before the
                   1337: equals sign. The parentheses contain, first, the keyword <tt>ATTR</tt>, then
                   1338: the list of local attributes, separated by commas. Each local attribute is
1.2       cvs      1339: composed of the name of the attribute followed by an equals sign and the
1.18      cvs      1340: definition of the attribute's type, just as in the definition of <a
1.37      cvs      1341: href="#sectc325">global attributes</a>. The name of the attribute can be
                   1342: preceded by an exclamation point to indicate that the attribute must always
                   1343: be present for this element type. The same attribute, identified by its name,
                   1344: can be defined as a local attribute for multiple element types. In this case,
                   1345: the equals sign and definition of the attribute type need only appear in the
                   1346: first occurrence of the attribute. It should be noted that global attributes
                   1347: cannot also be defined as local attributes.</p>
1.30      cvs      1348: 
                   1349: <p>If any <a href="#sectd3135">extensions</a> are defined for this element
                   1350: type, a plus sign follows the structure definition and the names of the
1.37      cvs      1351: extension element types appear between parentheses after the plus. If there
                   1352: are multiple extensions, they are separated by commas. These types can either
1.30      cvs      1353: be defined in the same schema, defined in other schemas, or they may be base
1.18      cvs      1354: types identified by the keywords <tt>TEXT</tt>, <tt>GRAPHICS</tt>,
                   1355: <tt>SYMBOL</tt>, or <tt>PICTURE</tt>.</p>
1.30      cvs      1356: 
                   1357: <p><a href="#sectd3135">Restrictions</a> are indicated in the same manner as
1.18      cvs      1358: extensions, but they are introduced by a minus sign and they come after the
                   1359: extensions, or if there are no extensions, after the structure definition.</p>
1.30      cvs      1360: 
1.37      cvs      1361: <p>If the values of attributes must be attached systematically to this
                   1362: element type, they are introduced by the keyword <tt>WITH</tt> and declared
                   1363: in the form of a list of fixed-value attributes. When such definitions of
                   1364: fixed attribute values appear, they are always the last part of the rule.</p>
1.30      cvs      1365: 
                   1366: <p>The rule is terminated by a semicolon.</p>
                   1367: <pre>  RuleSeq       = Rule &lt; Rule &gt; .
1.1       cvs      1368:   Rule          = ElemID [ LocAttrSeq ] '=' DefWithAttr ';'.
1.30      cvs      1369:   LocAttrSeq    = '(' 'ATTR' LocAttr &lt; ';' LocAttr &gt; ')' .
1.1       cvs      1370:   LocAttr       = [ '!' ] AttrID [ '=' AttrType ] .
                   1371:   DefWithAttr   = Definition
                   1372:                   [ '+' '(' ExtensionSeq ')' ]
                   1373:                   [ '-' '(' RestrictSeq ')' ]
                   1374:                   [ 'WITH' FixedAttrSeq ] .
1.30      cvs      1375:   ExtensionSeq  = ExtensionElem &lt; ',' ExtensionElem &gt; .
1.1       cvs      1376:   ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' /
                   1377:                   'SYMBOL' / 'PICTURE' .
1.30      cvs      1378:   RestrictSeq   = RestrictElem &lt; ',' RestrictElem &gt; .
1.1       cvs      1379:   RestrictElem  = ElemID / 'TEXT' / 'GRAPHICS' /
1.18      cvs      1380:                   'SYMBOL' / 'PICTURE' .</pre>
1.30      cvs      1381: 
                   1382: <p>The list of fixed-value attributes is composed of a sequence of
1.37      cvs      1383: attribute-value pairs separated by commas. Each pair contains the name of the
1.1       cvs      1384: attribute and the fixed value for this element type, the two being separated
1.37      cvs      1385: by an equals sign. If the sign is preceded by a question mark the given value
1.1       cvs      1386: is only an initial value that may be modified later rather than a value fixed
1.37      cvs      1387: for all time. Reference attributes are an exception to this norm. They cannot
                   1388: be assigned a fixed value, but when the name of such an attribute appears
                   1389: this indicates that this element type must have a valid value for the
                   1390: attribute. For the other attribute types, the fixed value is indicated by a
1.1       cvs      1391: signed integer (numeric attributes), a character string between apostrophes
1.18      cvs      1392: (textual attributes) or the name of a value (enumeration attributes).</p>
1.30      cvs      1393: 
                   1394: <p>Fixed-value attributes can either be <a href="#sectc325">global</a> or
                   1395: local to the element type for which they are fixed, but they must be declared
                   1396: before they are used.</p>
                   1397: <pre>    FixedAttrSeq    = FixedAttr &lt; ',' FixedAttr &gt; .
1.1       cvs      1398:     FixedAttr       = AttrID [ FixedOrModifVal ] .
                   1399:     FixedOrModifVal = [ '?' ] '=' FixedValue .
                   1400:     FixedValue      = [ '-' ] NumValue / TextVal / AttrVal .
                   1401:     NumValue        = NUMBER .
1.18      cvs      1402:     TextVal         = STRING .</pre>
                   1403: </div>
1.1       cvs      1404: 
1.18      cvs      1405: <div class="subsection">
1.37      cvs      1406: <h3><a name="sectc328" id="sectc328">Structure definitions</a></h3>
1.1       cvs      1407: 
1.37      cvs      1408: <p>The structure of an element type can be a simple base type or a
                   1409: constructed type.</p>
1.30      cvs      1410: 
                   1411: <p>For constructed types, it is frequently the case that similar structures
1.37      cvs      1412: appear in many places in a document. For example the contents of the
1.1       cvs      1413: abstract, of the introduction, and of a section can have the same structure,
1.37      cvs      1414: that of a sequence of paragraphs. In this case, a single, common structure
1.1       cvs      1415: can be defined (the paragraph sequence in this example), and the schema is
                   1416: written to indicate that each element type possesses this structure, as
1.18      cvs      1417: follows:</p>
                   1418: <pre>     Abstract           = Paragraph_sequence;
1.1       cvs      1419:      Introduction       = Paragraph_sequence;
1.18      cvs      1420:      Section_contents   = Paragraph_sequence;</pre>
1.30      cvs      1421: 
                   1422: <p>The equals sign means ``has the same structure as''.</p>
                   1423: 
1.37      cvs      1424: <p>If the element type defined is a simple base type, this is indicated by
                   1425: one of the keywords <tt>TEXT</tt>, <tt>GRAPHICS</tt>, <tt>SYMBOL</tt>, or
                   1426: <tt>PICTURE</tt>. If some local attributes must be associated with a base
                   1427: type, the keyword of the base type is followed by the declaration of the
                   1428: local attributes using the syntax <a href="#sectc327">presented above.</a></p>
1.30      cvs      1429: 
                   1430: <p>In the case of an open choice, the type is indicated by the keyword
1.18      cvs      1431: <tt>UNIT</tt> for units or the keyword <tt>NATURE</tt> for objects having a
                   1432: structure defined by any other schema.</p>
1.30      cvs      1433: 
                   1434: <p>A unit represents one of the two following categories:</p>
1.18      cvs      1435: <ul>
1.30      cvs      1436:   <li>a base type: text, graphical element, symbol, picture,</li>
1.37      cvs      1437:   <li>an element whose type is chosen from among the types defined as units
                   1438:     in the <tt>UNITS</tt> section of the document's structure schema. It can
1.30      cvs      1439:     also be chosen from among the types defined as <a
                   1440:     href="#sectd3132">units</a> in the <a href="#sectc3212"><tt>UNITS</tt>
                   1441:     section</a> of the structure schemas that defines the ancestors of the
                   1442:     element to which the rule is applied.</li>
1.18      cvs      1443: </ul>
1.30      cvs      1444: 
                   1445: <p>Before the creation of an element defined as a unit, Thot asks the user to
1.18      cvs      1446: choose between the categories of elements.</p>
1.30      cvs      1447: 
                   1448: <p>Thus, the contents of a paragraph can be specified as a sequence of units,
1.1       cvs      1449: which will permit the inclusion in the paragraphs of character strings,
                   1450: symbols, and various elements, such as cross-references, if these are defined
1.18      cvs      1451: as units.</p>
1.30      cvs      1452: 
1.37      cvs      1453: <p>A schema object (keyword <tt>NATURE</tt>) represents an object defined by
                   1454: a structure schema freely chosen from among the available schemas; in the
                   1455: case the element type is defined by the first rule (the root rule) of the
                   1456: chosen schema.</p>
1.30      cvs      1457: 
                   1458: <p>If the element type defined is a constructed type, the list, aggregate,
1.37      cvs      1459: choice, and reference constructors are used. In this case the definition
                   1460: begins with a keyword identifying the constructor. This keyword is followed
1.18      cvs      1461: by a syntax specific to each constructor.</p>
1.30      cvs      1462: 
                   1463: <p>The local attribute definitions appear after the name of the element type
1.18      cvs      1464: being defined, if this element type has <a href="#sectc327">local
                   1465: attributes</a>.</p>
                   1466: <pre>   Definition = BaseType [ LocAttrSeq ] / Constr / Element .
1.1       cvs      1467:    BaseType   = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 'PICTURE' /
                   1468:                 'UNIT' / 'NATURE' .
                   1469:    Element    = ElemID [ ExtOrDef ] .
                   1470:    ExtOrDef   = 'EXTERN' / 'INCLUDED' / 
                   1471:                 [ LocAttrSeq ] '=' Definition .
                   1472:    Constr     = 'LIST' [ '[' min '..' max ']' ] 'OF'
                   1473:                        '(' DefWithAttr ')' /
                   1474:                 'BEGIN' DefOptSeq 'END' /
                   1475:                 'AGGREGATE' DefOptSeq 'END' /
                   1476:                 'CASE' 'OF' DefSeq 'END' /
                   1477:                 'REFERENCE' '(' RefType ')' /
1.18      cvs      1478:                 'PAIR' .</pre>
1.1       cvs      1479: 
1.18      cvs      1480: <div class="subsubsection">
1.37      cvs      1481: <h4><a name="sectd3281" id="sectd3281">List</a></h4>
1.1       cvs      1482: 
1.30      cvs      1483: <p>The list constructor permits the definition of an element type composed of
1.37      cvs      1484: a list of elements, all of the same type. A list definition begins with the
1.18      cvs      1485: <tt>LIST</tt> keyword followed by an optional range, the keyword <tt>OF</tt>,
1.1       cvs      1486: and the definition, between parentheses, of the element type which must
1.37      cvs      1487: compose the list. The optional range is composed of the minimum and maximum
1.1       cvs      1488: number of elements for the list separated by two periods and enclosed by
1.37      cvs      1489: brackets. If the range is not present, the number of list elements is
                   1490: unconstrained. When only one of the two bounds of the range is unconstrained,
                   1491: it is represented by a star ('*') character. Even when both bounds are
                   1492: unconstrained, they can be specified by <tt>[*..*]</tt>, but it is simpler
                   1493: not to specify any bound.</p>
1.18      cvs      1494: <pre>               'LIST' [ '[' min '..' max ']' ]
1.1       cvs      1495:                'OF' '(' DefWithAttr ')'
                   1496:      min     = Integer / '*' .
                   1497:      max     = Integer / '*' .
1.18      cvs      1498:      Integer = NUMBER .</pre>
1.30      cvs      1499: 
                   1500: <p>Before the document is edited, Thot creates the minimum number of elements
1.37      cvs      1501: for the list. If no minimum was given, it creates a single element. If a
1.30      cvs      1502: maximum number of elements is given and that number is attained, the editor
                   1503: refuses to create new elements for the list.</p>
                   1504: 
                   1505: <blockquote class="example">
                   1506:   <p><strong>Example:</strong></p>
                   1507: 
                   1508:   <p>The following two instructions define the body of a document as a
                   1509:   sequence of at least two chapters and the contents of a section as a
1.37      cvs      1510:   sequence of paragraphs. A single paragraph can be the entire contents of a
1.30      cvs      1511:   section.</p>
                   1512:   <pre>Body             = LIST [2..*] OF (Chapter);
1.18      cvs      1513: Section_contents = LIST OF (Paragraph);</pre>
                   1514: </blockquote>
                   1515: </div>
1.1       cvs      1516: 
1.18      cvs      1517: <div class="subsubsection">
1.37      cvs      1518: <h4><a name="sectd3282" id="sectd3282">Aggregate</a></h4>
1.1       cvs      1519: 
1.37      cvs      1520: <p>The aggregate constructor is used to define an element type as a
                   1521: collection of sub-elements, each having a fixed type. The collection may be
                   1522: ordered or unordered. The elements composing the collection are called
                   1523: <em>components</em>. In the definition of an aggregate, a keyword indicates
1.18      cvs      1524: whether or not the aggregate is ordered: <tt>BEGIN</tt> for an ordered
                   1525: aggregate, <tt>AGGREGATE</tt> for an unordered aggregate. This keyword is
1.1       cvs      1526: followed by the list of component type definitions which is terminated by the
1.37      cvs      1527: <tt>END</tt> keyword. The component type definitions are separated by
1.18      cvs      1528: commas.</p>
1.30      cvs      1529: 
                   1530: <p>Before creating an aggregate, the Thot editor creates all the aggregate's
1.1       cvs      1531: components in the order they appear in the structure schema, even for
1.37      cvs      1532: unordered aggregates. However, unlike ordered aggregates, the components of
1.1       cvs      1533: an unordered aggregate may be rearranged using operations of the Thot editor.
                   1534: The exceptions to the rule are any components whose name was preceded by a
1.37      cvs      1535: question mark character ('?'). These components, which are optional, can be
1.1       cvs      1536: created by explicit request, possibly at the time the aggregate is created,
1.18      cvs      1537: but they are not created automatically <em>prior</em> to the creation of the
                   1538: aggregate.</p>
                   1539: <pre>                 'BEGIN' DefOptSeq 'END'
1.30      cvs      1540:      DefOptSeq = DefOpt ';' &lt; DefOpt ';' &gt; .
1.18      cvs      1541:      DefOpt    = [ '?' ] DefWithAttr .</pre>
1.30      cvs      1542: 
1.18      cvs      1543: <blockquote class="example">
1.30      cvs      1544:   <p><strong>Example:</strong></p>
                   1545: 
                   1546:   <p>In a bilingual document, each paragraph has an English version and a
1.37      cvs      1547:   French version. In certain cases, the translator wants to add a marginal
                   1548:   note, but this note is present in very few paragraphs. Thus, it must not be
                   1549:   created systematically for every paragraph. A bilingual paragraph of this
1.30      cvs      1550:   type is declared:</p>
                   1551:   <pre>Bilingual_paragraph = BEGIN
1.1       cvs      1552:                       French_paragraph  = TEXT;
                   1553:                       English_paragraph = TEXT;
                   1554:                       ? Note            = TEXT;
1.18      cvs      1555:                       END;</pre>
                   1556: </blockquote>
                   1557: </div>
1.1       cvs      1558: 
1.18      cvs      1559: <div class="subsubsection">
1.37      cvs      1560: <h4><a name="sectd3283" id="sectd3283">Choice</a></h4>
1.1       cvs      1561: 
1.30      cvs      1562: <p>The choice constructor permits the definition of an element type which is
1.37      cvs      1563: chosen from among a set of possible types. The keywords <tt>CASE</tt> and
                   1564: <tt>OF</tt> are followed by a list of definitions of possible types, which
                   1565: are separated by semicolons and terminated by the <tt>END</tt> keyword.</p>
1.18      cvs      1566: <pre>               'CASE' 'OF' DefSeq 'END'
1.30      cvs      1567:      DefSeq = DefWithAttr ';' &lt; DefWithAttr ';' &gt; .</pre>
                   1568: 
                   1569: <p>Before the creation of an element defined as a choice, the Thot editor
1.37      cvs      1570: presents the list of possible types for the element to the user. The user has
1.18      cvs      1571: only to select the element type that s/he wants to create from this list.</p>
1.30      cvs      1572: 
1.37      cvs      1573: <p>The order of the type declarations is important. It determines the order
                   1574: of the list presented to the user before the creation of the element. Also,
1.30      cvs      1575: when a Choice element is being created automatically, the first type in the
1.37      cvs      1576: list is used. In fact, using the Thot editor, when an empty Choice element is
1.1       cvs      1577: selected, it is possible to select this element and to enter its text from
                   1578: keyboard. In this case, the editor uses the first element type which can
1.18      cvs      1579: contain an atom of the character string type.</p>
1.30      cvs      1580: 
                   1581: <p>The two special cases of the choice constructor, the <a
1.18      cvs      1582: href="#sectc328"><em>schema</em></a> and the <a
                   1583: href="#sectc3212"><em>unit</em></a> are discussed elsewhere.</p>
1.30      cvs      1584: 
1.18      cvs      1585: <blockquote class="example">
1.30      cvs      1586:   <p><strong>Example:</strong></p>
                   1587: 
                   1588:   <p>It is common in documents to treat a variety of objects as if they were
1.37      cvs      1589:   ordinary paragraphs. Thus, a ``Paragraph'' might actually be composed of a
1.30      cvs      1590:   block of text (an ordinary paragraph), or a mathematical formula whose
                   1591:   structure is defined by another structure schema named Math, or a table,
1.37      cvs      1592:   also defined by another structure schema. Here is a definition of such a
1.30      cvs      1593:   paragraph:</p>
                   1594:   <pre>Paragraph = CASE OF
1.1       cvs      1595:               Simple_text = TEXT;
                   1596:               Formula     = Math;
                   1597:               Table_para  = Table;
1.18      cvs      1598:               END;</pre>
                   1599: </blockquote>
                   1600: </div>
1.1       cvs      1601: 
1.18      cvs      1602: <div class="subsubsection">
1.37      cvs      1603: <h4><a name="sectd3284" id="sectd3284">Reference</a></h4>
1.1       cvs      1604: 
1.37      cvs      1605: <p>Like all elements in Thot, references are typed. An element type defined
1.30      cvs      1606: as a reference is a cross-reference to an element of some other given type.
                   1607: The keyword <tt>REFERENCE</tt> is followed by the name of a type enclosed in
1.37      cvs      1608: parentheses. When the type which is being cross-referenced is defined in
1.1       cvs      1609: another structure schema, the type name is itself followed by the name of the
1.18      cvs      1610: external structure schema in which it is defined.</p>
1.30      cvs      1611: 
                   1612: <p>When the designated element type is a <a href="#sectd3285">mark pair</a>,
1.37      cvs      1613: it can be preceded by a <tt>FIRST</tt> or <tt>SECOND</tt> keyword. These
1.18      cvs      1614: keywords indicate whether the reference points to the first or second mark of
                   1615: the pair. If the reference points to a pair and neither of these two keywords
                   1616: is present, the reference is considered to point to the first mark of the
                   1617: pair.</p>
1.30      cvs      1618: 
1.37      cvs      1619: <p>There is an exception to the principle of typed references: it is possible
1.30      cvs      1620: to define a reference which designates an element of any type, which can
                   1621: either be in the same document or another document. In this case, it suffices
                   1622: to put the keyword <tt>ANY</tt> in the parentheses which indicate the
                   1623: referenced element type.</p>
1.18      cvs      1624: <pre>             'REFERENCE' '(' RefType ')'
                   1625:    RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] .</pre>
1.30      cvs      1626: 
                   1627: <p>When defining an inclusion, the <tt>REFERENCE</tt> keyword is not used.
1.1       cvs      1628: Inclusions with complete expansion are not declared as such in the structure
1.37      cvs      1629: schemas, since any element defined in a structure schema can be replaced by
                   1630: an element of the same type. Instead, inclusions without expansion or with
1.1       cvs      1631: partial expansion must be declared explicitly whenever they will include a
1.37      cvs      1632: complete object ( and not a part of an object). In this case, the object type
1.1       cvs      1633: to be included (that is, the name of its structure schema) is followed by a
1.37      cvs      1634: keyword: <tt>EXTERN</tt> for inclusion without expansion and
                   1635: <tt>INCLUDED</tt> for partial expansion.</p>
1.30      cvs      1636: 
1.37      cvs      1637: <p>Before creating a cross-reference or an inclusion, the Thot editor asks
                   1638: the user to choose, from the document images displayed, the referenced or
                   1639: included element.</p>
1.30      cvs      1640: 
1.18      cvs      1641: <blockquote class="example">
1.30      cvs      1642:   <p><strong>Example:</strong></p>
                   1643: 
                   1644:   <p>If the types Note and Section are defined in the Article structure
                   1645:   schema, it is possible to define, in the same structure schema, a reference
                   1646:   to a note and a reference to a section in this manner:</p>
                   1647:   <pre>Ref_note    = REFERENCE (Note);
1.18      cvs      1648: Ref_section = REFERENCE (Section);</pre>
1.30      cvs      1649: 
                   1650:   <p>It is also possible to define the generic structure of a collection of
                   1651:   articles, which include (with partial expansion) objects of the Article
                   1652:   class and which possess an introduction which may include cross-references
1.37      cvs      1653:   to sections of the included articles. In the Collection structure schema,
1.30      cvs      1654:   the definitions are:</p>
                   1655:   <pre>Collection = BEGIN
1.6       cvs      1656:              Collection_title = TEXT;
                   1657:              Introduction = LIST OF (Elem = CASE OF
1.1       cvs      1658:                                            TEXT;
                   1659:                                            Ref_sect;
                   1660:                                            END);
1.6       cvs      1661:              Body = LIST OF (Article INCLUDED);
                   1662:              END;
1.18      cvs      1663: Ref_sect   = REFERENCE (Section (Article));</pre>
1.30      cvs      1664: 
                   1665:   <p>Here we define a Folder document class which has a title and includes
                   1666:   documents of different types, particularly Folders:</p>
                   1667:   <pre>Folder   = BEGIN
1.6       cvs      1668:            Folder_title    = TEXT;
                   1669:            Folder_contents = LIST OF (Document);
                   1670:            END;
1.1       cvs      1671: 
                   1672: Document = CASE OF
                   1673:               Article EXTERN;
                   1674:               Collection EXTERN;
                   1675:               Folder EXTERN;
1.18      cvs      1676:               END;</pre>
1.30      cvs      1677: 
                   1678:   <p>Under this definition, Folder represents either an aggregate which
                   1679:   contains a folder title and the list of included documents or an included
1.37      cvs      1680:   folder. To resolve this ambiguity, in the P language, the placement of a
1.30      cvs      1681:   star character in front of the type name (here, Folder) indicates an
                   1682:   included document.</p>
1.18      cvs      1683: </blockquote>
                   1684: </div>
1.1       cvs      1685: 
1.18      cvs      1686: <div class="subsubsection">
1.37      cvs      1687: <h4><a name="sectd3285" id="sectd3285">Mark pairs</a></h4>
1.1       cvs      1688: 
1.37      cvs      1689: <p>Like other elements, mark pairs are typed. The two marks of the pair have
                   1690: the same type, but there exist two predefined subtypes which apply to all
                   1691: mark pairs: the first mark of the pair (called <tt>First</tt> in the P and T
1.18      cvs      1692: languages) and the second mark (called <tt>Second</tt>).</p>
1.30      cvs      1693: 
                   1694: <p>In the S language, a mark pair is noted simply by the <tt>PAIR</tt>
1.18      cvs      1695: keyword.</p>
1.30      cvs      1696: 
1.37      cvs      1697: <p>In the Thot editor, marks are always moved or destroyed together. The two
1.1       cvs      1698: marks of a pair have the same identifier, unique within the document, which
1.18      cvs      1699: permits intertwining mark pairs without risk of ambiguity.</p>
                   1700: </div>
                   1701: </div>
1.1       cvs      1702: 
1.18      cvs      1703: <div class="subsection">
1.37      cvs      1704: <h3><a name="sectc329" id="sectc329">Imports</a></h3>
1.1       cvs      1705: 
1.30      cvs      1706: <p>Because of schema constructors, it is possible, before editing a document,
1.37      cvs      1707: to use classes defined by other structure schemas whenever they are needed.
                   1708: It is also possible to assign specific document classes to certain element
                   1709: types. In this case, these classes are simply designated by their name. In
                   1710: fact, if a type name is not defined in the structure schema, it is assumed
                   1711: that it specifies a structure defined by another structure schema.</p>
1.30      cvs      1712: 
1.18      cvs      1713: <blockquote class="example">
1.30      cvs      1714:   <p><strong>Example:</strong></p>
                   1715: 
                   1716:   <p>If the types Math and Table don't appear in the left part of a structure
                   1717:   rule in the schema, the following two rules indicate that a formula has the
1.37      cvs      1718:   structure of an object defined by the structure schema Math and that a
                   1719:   table element has the structure of an object defined by the Table
                   1720:   schema.</p>
1.30      cvs      1721:   <pre>Formula    = Math;
1.18      cvs      1722: Table_elem = Table;</pre>
                   1723: </blockquote>
                   1724: </div>
                   1725: 
                   1726: <div class="subsection">
1.37      cvs      1727: <h3><a name="sectc3210" id="sectc3210">Extension rules</a></h3>
1.18      cvs      1728: 
1.30      cvs      1729: <p>The <tt>EXTENS</tt> section, which can only appear in an extension schema,
1.1       cvs      1730: defines complements to the rules in the primary schema (i.e. the structure
                   1731: schema to which the extension schema will be applied). More precisely, this
                   1732: section permits the addition to an existing type of local attributes,
1.18      cvs      1733: extensions, restrictions and fixed-value attributes.</p>
1.30      cvs      1734: 
                   1735: <p>These additions can be applied to the root rule of the primary schema,
1.18      cvs      1736: designated by the keyword <tt>Root</tt>, or to any other explicitly named
                   1737: rule.</p>
1.30      cvs      1738: 
                   1739: <p>Extension rules are separated from each other by a semicolon and each
1.18      cvs      1740: extension rule has the same syntax as a <a href="#sectc327">structure
                   1741: rule</a>, but the part which defines the constructor is absent.</p>
1.30      cvs      1742: <pre>     ExtenRuleSeq = ExtensRule ';' &lt; ExtensRule ';' &gt; .
1.6       cvs      1743:      ExtensRule   = RootOrElem [ LocAttrSeq ]
                   1744:                     [ '+' '(' ExtensionSeq ')' ]
                   1745:                     [ '-' '(' RestrictSeq ')' ]
                   1746:                     [ 'WITH' FixedAttrSeq ] .
1.18      cvs      1747:      RootOrElem   = 'Root' / ElemID .</pre>
                   1748: </div>
1.1       cvs      1749: 
1.18      cvs      1750: <div class="subsection">
1.37      cvs      1751: <h3><a name="sectc3212" id="sectc3212">Units</a></h3>
1.30      cvs      1752: 
                   1753: <p>The <tt>UNITS</tt> section of the structure schema contains the
                   1754: declarations of the element types which can be used in the external objects
                   1755: making up parts of the document or in objects of the class defined by the
1.37      cvs      1756: schema. These element types are defined just like other structured element
                   1757: types. They can be used in the other element types of the schema, but they
                   1758: can also be used in any other rule of the schema.</p>
1.30      cvs      1759: 
                   1760: <blockquote class="example">
                   1761:   <p><strong>Example:</strong></p>
1.1       cvs      1762: 
1.30      cvs      1763:   <p>If references to notes are declared as units:</p>
                   1764:   <pre>UNITS
1.18      cvs      1765:    Ref_note = REFERENCE (Note);</pre>
1.30      cvs      1766: 
1.37      cvs      1767:   <p>then it is possible to use references to notes in a cell of a table,
                   1768:   even when <tt>Table</tt> is an external structure schema. The
                   1769:   <tt>Table</tt> schema must declare a cell to be a sequence of units, which
                   1770:   can then be base element types (text, for example) or references to notes
                   1771:   in the document.</p>
1.30      cvs      1772:   <pre>Cell = LIST OF (UNITS);</pre>
1.18      cvs      1773: </blockquote>
                   1774: </div>
1.1       cvs      1775: 
1.18      cvs      1776: <div class="subsection">
1.37      cvs      1777: <h3><a name="sectc3213" id="sectc3213">Skeleton elements</a></h3>
1.1       cvs      1778: 
1.30      cvs      1779: <p>When editing a document which contains or must contain external references
                   1780: to several other documents, it may be necessary to load a large number of
1.1       cvs      1781: documents, simply to see the parts designated by the external references of
1.37      cvs      1782: the document while editing, or to access the source of included elements. In
                   1783: this case, the external documents are not modified and it is only necessary
                   1784: to see the elements of these documents which could be referenced. Because of
1.1       cvs      1785: this, the editor will suggest that the documents be loaded in ``skeleton''
1.37      cvs      1786: form. This form contains only the elements of the document explicitly
1.18      cvs      1787: mentioned in the <tt>EXPORT</tt> section of their structure schema and, for
1.1       cvs      1788: these elements, only the part of the contents specified in that section. This
                   1789: form has the advantage of being very compact, thus requiring very few
1.37      cvs      1790: resources from the editor. This is also the skeleton form which constitutes
1.18      cvs      1791: the expanded form of <a href="#inclusion">inclusions</a> with partial
                   1792: expansion.</p>
1.30      cvs      1793: 
                   1794: <p>Skeleton elements must be declared explicitly in the <tt>EXPORT</tt>
1.37      cvs      1795: section of the structure schema that defines them. This section begins with
1.30      cvs      1796: the keyword <tt>EXPORT</tt> followed by a comma-separated list of the element
1.1       cvs      1797: types which must appear in the skeleton form and ending with a semicolon.
1.18      cvs      1798: These types must have been previously declared in the schema.</p>
1.30      cvs      1799: 
1.37      cvs      1800: <p>For each skeleton element type, the part of the contents which is loaded
                   1801: by the editor, and therefore displayable, can be specified by putting the
                   1802: keyword <tt>WITH</tt> and the name of the contained element type to be loaded
                   1803: after the name of the skeleton element type. In this case only that named
                   1804: element, among all the elements contained in the exportable element type,
                   1805: will be loaded. If the <tt>WITH</tt> is absent, the entire contents of the
                   1806: skeleton element will be loaded by the editor. If instead, it is better that
                   1807: the skeleton form not load the contents of a particular element type, the
                   1808: keyword <tt>WITH</tt> must be followed by the word <tt>Nothing</tt>.</p>
1.18      cvs      1809: <pre>                [ 'EXPORT' SkeletonSeq ]
1.1       cvs      1810: 
1.30      cvs      1811:      SkeletonSeq = SkelElem &lt; ',' SkelElem &gt; ';' .
1.1       cvs      1812:      SkelElem    = ElemID [ 'WITH' Contents ] .
1.18      cvs      1813:      Contents    = 'Nothing' / ElemID [ ExtStruct ] .</pre>
1.30      cvs      1814: 
1.18      cvs      1815: <blockquote class="example">
1.30      cvs      1816:   <p><strong>Example:</strong></p>
                   1817: 
                   1818:   <p>Suppose that, in documents of the article class, the element types
                   1819:   Article_title, Figure, Section, Paragraph, and Biblio should appear in the
                   1820:   skeleton form in order to make it easier to create external references to
1.37      cvs      1821:   them from other documents. When loading an article in its skeleton form,
1.30      cvs      1822:   all of these element types will be loaded except for paragraphs, but only
1.37      cvs      1823:   the article title will be loaded in its entirety. For figures, the caption
1.30      cvs      1824:   will be loaded, while for sections, the title will be loaded, and for
1.37      cvs      1825:   bibliographic entries, only the title that they contain will be loaded.
                   1826:   Note that bibliographic elements are defined in another structure schema,
                   1827:   RefBib. To produce this result, the following declarations should be placed
                   1828:   in the Article structure schema:</p>
1.30      cvs      1829:   <pre>EXPORT
1.1       cvs      1830:    Article_title,
1.5       cvs      1831:    Figure With Caption,
1.1       cvs      1832:    Section With Section_title,
                   1833:    Paragraph With Nothing,
1.18      cvs      1834:    Biblio With Biblio_title(RefBib);</pre>
                   1835: </blockquote>
                   1836: </div>
1.1       cvs      1837: 
1.18      cvs      1838: <div class="subsection">
1.37      cvs      1839: <h3><a name="sectc3214" id="sectc3214">Exceptions</a></h3>
1.1       cvs      1840: 
1.30      cvs      1841: <p>The behavior of the Thot editor and the actions that it performs are
1.37      cvs      1842: determined by the structure schemas. These actions are applied to all
                   1843: document and object types in accordance with their generic structure. For
1.1       cvs      1844: certain object types, such as tables and graphics, these actions are not
                   1845: sufficient or are poorly adapted and some special actions must be added to or
1.37      cvs      1846: substituted for certain standard actions. These special actions are called
1.18      cvs      1847: <em>exceptions</em>.</p>
1.30      cvs      1848: 
1.37      cvs      1849: <p>Exceptions only inhibit or modify certain standard actions, but they can
                   1850: be used freely in every structure schema.</p>
1.30      cvs      1851: 
1.37      cvs      1852: <p>Each structure schema can contain a section defining exceptions. It begins
1.18      cvs      1853: with the keyword <tt>EXCEPT</tt> and is composed of a sequence of exception
1.37      cvs      1854: declarations, separated by semicolons. Each declaration of an exception
                   1855: begins with the name of an element type or attribute followed by a colon.
                   1856: This indicates the element type or attribute to which the following
                   1857: exceptions apply. When the given element type name is a <a
                   1858: href="#sectd3285">mark pair</a>, and only in this case, the type name can be
                   1859: preceded by the keyword <tt>First</tt> or <tt>Second</tt>, to indicate if the
                   1860: exceptions which follow are associated with the first mark of the pair or the
                   1861: second. In the absence of this keyword, the first mark is used.</p>
1.30      cvs      1862: 
                   1863: <p>When placed in an <a href="#sectc322">extension schema</a>, the keyword
1.18      cvs      1864: <tt>EXTERN</tt> indicates that the type name which follows is found in the
1.37      cvs      1865: principal schema (the schema being extended by the extension schema). The
                   1866: exceptions are indicated by a name. They are separated by semicolons.</p>
1.18      cvs      1867: <pre>                  [ 'EXCEPT' ExceptSeq ]
1.1       cvs      1868: 
1.30      cvs      1869:      ExceptSeq     = Except ';' &lt; Except ';' &gt; .
1.1       cvs      1870:      Except        = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr
                   1871:                      ':' ExcValSeq .
                   1872:      ExcTypeOrAttr = ElemID / AttrID .
1.30      cvs      1873:      ExcValSeq     = ExcValue &lt; ',' ExcValue &gt; .
1.19      cvs      1874:      ExcValue      ='NoCut' / 'NoCreate' / 'NoHMove' / 
                   1875:                     'NoVMove' / 'NoHResize' / 'NoVResize' /
                   1876:                     'NoMove' / 'NoResize' / 'MoveResize' /
                   1877:                     'NewWidth' / 'NewHeight' / 'NewHPos' /
                   1878:                     'NewVPos' / 'Invisible' /
1.28      cvs      1879:                     'NoSelect' / 'NoSpellCheck' /
1.1       cvs      1880:                     'Hidden' / 'ActiveRef' /
                   1881:                     'ImportLine' / 'ImportParagraph' /
                   1882:                     'NoPaginate' / 'ParagraphBreak' /
1.19      cvs      1883:                     'PageBreak' / 'PageBreakAllowed' / 'PageBreakPlace' /
                   1884:                     'PageBreakRepetition' / 'PageBreakRepBefore' /
1.9       cvs      1885:                     'HighlightChildren' / 'ExtendedSelection' /
1.36      cvs      1886:                     'SelectParent' / 'ClickableSurface' /
1.29      cvs      1887:                     'ReturnCreateNL' / 'ReturnCreateWithin' /
                   1888:                     'IsDraw' / 'IsTable' /
1.19      cvs      1889:                     'IsRow' / 'IsColHead' / 'IsCell' /
                   1890:                     'NewPercentWidth' / 'ColRef' / 'ColSpan' /
                   1891:                     'RowSpan' / 'SaveDocument' / 'Shadow' .</pre>
1.30      cvs      1892: 
                   1893: <p>The following are the available exceptions:</p>
1.18      cvs      1894: <dl>
1.30      cvs      1895:   <dt><tt>NoCut</tt></dt>
1.37      cvs      1896:     <dd>This exception can only be applied to element types. Elements of a
1.30      cvs      1897:       type to which this exception is applied cannot be deleted by the
                   1898:     editor.</dd>
                   1899:   <dt><tt>NoCreate</tt></dt>
1.37      cvs      1900:     <dd>This exception can only be applied to element types. Elements of a
1.30      cvs      1901:       type to which this exception is applied cannot be created by ordinary
1.37      cvs      1902:       commands for creating new elements. These elements are usually created
1.30      cvs      1903:       by special actions associated with other exceptions.</dd>
                   1904:   <dt><tt>NoHMove</tt></dt>
1.37      cvs      1905:     <dd>This exception can only be applied to element types. Elements of a
1.30      cvs      1906:       type to which this exception is applied cannot be moved horizontally
                   1907:       with the mouse. Their children elements cannot be moved either.</dd>
                   1908:   <dt><tt>NoVMove</tt></dt>
1.37      cvs      1909:     <dd>This exception can only be applied to element types. Elements of a
1.30      cvs      1910:       type to which this exception is applied cannot be moved vertically with
                   1911:       the mouse. Their children elements cannot be moved either.</dd>
                   1912:   <dt><tt>NoMove</tt></dt>
1.37      cvs      1913:     <dd>This exception can only be applied to element types. Elements of a
                   1914:       type to which this exception is applied cannot be moved in any
                   1915:       direction with the mouse. Their children elements cannot be moved
                   1916:       either.</dd>
1.30      cvs      1917:   <dt><tt>NoHResize</tt></dt>
1.37      cvs      1918:     <dd>This exception can only be applied to element types. Elements of a
1.30      cvs      1919:       type to which this exception is applied cannot be resized horizontally
                   1920:       with the mouse. Their children elements cannot be resized either.</dd>
                   1921:   <dt><tt>NoVResize</tt></dt>
1.37      cvs      1922:     <dd>This exception can only be applied to element types. Elements of a
1.30      cvs      1923:       type to which this exception is applied cannot be resized vertically
                   1924:       with the mouse. Their children elements cannot be resized either.</dd>
                   1925:   <dt><tt>NoResize</tt></dt>
1.37      cvs      1926:     <dd>This exception can only be applied to element types. Elements of a
1.30      cvs      1927:       type to which this exception is applied cannot be resized in any
1.37      cvs      1928:       direction with the mouse. Their children elements cannot be resized
1.30      cvs      1929:       either.</dd>
                   1930:   <dt><tt>MoveResize</tt></dt>
1.37      cvs      1931:     <dd>This exception can only be applied to element types. Elements of a
1.30      cvs      1932:       type to which this exception is applied can be moved and resized in any
                   1933:       direction with the mouse, even if one of their ancestor element has an
1.37      cvs      1934:       exception that prevents moving or resizing. Their children elements can
1.30      cvs      1935:       also be resized or moved.</dd>
                   1936:   <dt><tt>NewWidth</tt></dt>
1.37      cvs      1937:     <dd>This exception can only be applied to numeric attributes. If the
                   1938:       width of an element which has this attribute is modified with the
                   1939:       mouse, the value of the new width will be assigned to the
                   1940:     attribute.</dd>
1.30      cvs      1941:   <dt><tt>NewHeight</tt></dt>
1.37      cvs      1942:     <dd>This exception can only be applied to numeric attributes. If the
1.30      cvs      1943:       height of an element which has this attribute is modified with the
                   1944:       mouse, the value of the new height will be assigned to the
                   1945:     attribute.</dd>
                   1946:   <dt><tt>NewHPos</tt></dt>
1.37      cvs      1947:     <dd>This exception can only be applied to numeric attributes. If the
1.30      cvs      1948:       horizontal position of an element which has this attribute is modified
                   1949:       with the mouse, the value of the new horizontal position will be
                   1950:       assigned to the attribute.</dd>
                   1951:   <dt><tt>NewVPos</tt></dt>
1.37      cvs      1952:     <dd>This exception can only be applied to numeric attributes. If the
1.30      cvs      1953:       vertical position of an element which has this attribute is modified
                   1954:       with the mouse, the value of the new vertical position will be assigned
                   1955:       to the attribute.</dd>
                   1956:   <dt><tt>Invisible</tt></dt>
                   1957:     <dd>This exception can only be applied to attributes, but can be applied
1.37      cvs      1958:       to all attribute types. It indicates that the attribute must not be
                   1959:       seen by the user and that its value must not be changed directly. This
1.30      cvs      1960:       exception is usually used when another exception manipulates the value
                   1961:       of an attribute.</dd>
                   1962:   <dt><tt>NoSelect</tt></dt>
1.37      cvs      1963:     <dd>This exception can only be applied to element types. Elements of a
                   1964:       type to which this exception is applied cannot be selected directly
1.30      cvs      1965:       with the mouse, but they can be selected by other methods provided by
                   1966:       the editor.</dd>
                   1967:   <dt>NoSpellCheck</dt>
1.37      cvs      1968:     <dd>This exception can only be applied to element types. Elements of a
1.30      cvs      1969:       type to which this exception is applied are not taken into account by
                   1970:       the spell checker.</dd>
                   1971:   <dt><tt>Hidden</tt></dt>
1.37      cvs      1972:     <dd>This exception can only be applied to element types. It indicates
1.30      cvs      1973:       that elements of this type, although present in the document's
1.37      cvs      1974:       structure, must not be shown to the user of the editor. In particular,
1.30      cvs      1975:       the creation menus must not propose this type and the selection message
                   1976:       must not pick it.</dd>
                   1977:   <dt><tt>ActiveRef</tt></dt>
                   1978:     <dd>This exception can only be applied to attributes of the reference
1.37      cvs      1979:       type. It indicates that when the user of the editor makes a double
1.30      cvs      1980:       click on an element which possesses a reference attribute having this
                   1981:       exception, the element designated by the reference attribute will be
                   1982:       selected.</dd>
                   1983:   <dt><tt>ImportLine</tt></dt>
1.37      cvs      1984:     <dd>This exception can only be applied to element types. It indicates
1.30      cvs      1985:       that elements of this type should receive the content of imported text
1.37      cvs      1986:       files. An element is created for each line of the imported file. A
1.30      cvs      1987:       structure schema cannot contain several exceptions <tt>ImportLine</tt>
                   1988:       and, if it contains one, it should not contain any exception
                   1989:       <tt>ImportParagraph</tt>.</dd>
                   1990:   <dt><tt>ImportParagraph</tt></dt>
1.37      cvs      1991:     <dd>This exception can only be applied to element types. It indicates
1.30      cvs      1992:       that elements of this type should receive the content of imported text
1.37      cvs      1993:       files. An element is created for each paragraph of the imported file. A
                   1994:       paragraph is a sequence of lines without any empty line. A structure
1.30      cvs      1995:       schema cannot contain several exceptions <tt>ImportParagraph</tt> and,
                   1996:       if it contains one, it should not contain any exception
                   1997:       <tt>ImportLine</tt>.</dd>
                   1998:   <dt><tt>NoPaginate</tt></dt>
                   1999:     <dd>This exception can only be applied to the root element, i.e. the name
1.37      cvs      2000:       that appear after the keyword <tt>STRUCTURE</tt> at the beginning of
                   2001:       the structure schema. It indicates that the editor should not allow the
1.30      cvs      2002:       user to paginate documents of that type.</dd>
                   2003:   <dt><tt>ParagraphBreak</tt></dt>
1.37      cvs      2004:     <dd>This exception can only be applied to element types. When the caret
                   2005:       is within an element of a type to which this exception is applied, it
                   2006:       is that element that will be split when the user hits the Return
                   2007:     key.</dd>
1.30      cvs      2008:   <dt><tt>ReturnCreateNL</tt></dt>
1.37      cvs      2009:     <dd>This exception can only be applied to element types. When the caret
1.30      cvs      2010:       is within an element of a type to which this exception is applied, the
                   2011:       Return key simply inserts a New line character (code \212) at the
                   2012:       current position. The Return key does not create a new element; it does
                   2013:       not split the current element either.</dd>
                   2014:   <dt><tt>ReturnCreateWithin</tt></dt>
1.37      cvs      2015:     <dd>This exception can only be applied to element types. When the caret
1.30      cvs      2016:       is within an element of a type to which this exception is applied, the
                   2017:       Return key will create a new element within that element, not a sibling
                   2018:       after that element.</dd>
                   2019:   <dt><tt>HighlightChildren</tt></dt>
1.37      cvs      2020:     <dd>This exception can only be applied to element types. Elements of a
1.30      cvs      2021:       type to which this exception is applied are not highlighted themselves
1.32      cvs      2022:       when they are selected in the main view, but all their children are
1.37      cvs      2023:       highlighted instead. If children have this exception too, the process
                   2024:       is applied recursively. Only the main view defined in the presentation
1.32      cvs      2025:       schema is concerned. Tee exception is ignored for other views.</dd>
1.30      cvs      2026:   <dt><tt>ExtendedSelection</tt></dt>
1.37      cvs      2027:     <dd>This exception can only be applied to element types. The selection
1.30      cvs      2028:       extension command (middle button of the mouse) only add the clicked
                   2029:       element (if it has that exception) to the current selection, without
                   2030:       selecting other elements between the current selection and the clicked
                   2031:       element.</dd>
1.36      cvs      2032:   <dt><code>SelectParent</code></dt>
                   2033:     <dd>This exception can only be applied to element types. When the user
1.37      cvs      2034:       clicks on an element of that type, the parent of the element is
                   2035:       selected instead of the element itself.</dd>
1.36      cvs      2036:   <dt><code>ClickableSurface</code></dt>
                   2037:     <dd>This exception can only be applied to element types. When the user
1.37      cvs      2038:       clicks within a child of an element of that type, this child is
                   2039:       selected even if it is a graphic leaf that is not filled.</dd>
1.36      cvs      2040:   <dt><code>IsDraw</code>, <code>IsTable</code>, <code>IsColHead</code>,
                   2041:   <code>IsRow</code>, <code>IsCell</code></dt>
1.37      cvs      2042:     <dd>These exceptions can only be applied to element types. Elements of a
1.30      cvs      2043:       type to which these exceptions are applied are identified as Draws,
                   2044:       Tables, Colheads, Rows or Cells and specific processing are applied to
                   2045:       them.</dd>
1.36      cvs      2046:   <dt><code>ColRef</code></dt>
1.30      cvs      2047:     <dd>This exception can only be applied to attributes of the reference
                   2048:       type. It indicates that this attribute refers to the column head (see
                   2049:       exception IsColHead) which the element belongs to.</dd>
1.36      cvs      2050:   <dt><code>ColSpan</code>, <code>RowSpan</code></dt>
1.31      cvs      2051:     <dd>These exceptions can only be applied to numeric attributes of cells.
1.30      cvs      2052:       They indicate that attribute values give how many columns or rows the
                   2053:       element spans.</dd>
1.36      cvs      2054:   <dt><code>Shadow</code></dt>
1.37      cvs      2055:     <dd>This exception can only be applied to element types. Text of elements
1.30      cvs      2056:       of a type to which this exception is applied are displayed and printed
                   2057:       as a set of stars ('*').</dd>
1.18      cvs      2058: </dl>
1.30      cvs      2059: 
1.18      cvs      2060: <blockquote class="example">
1.30      cvs      2061:   <p><strong>Example:</strong></p>
                   2062: 
                   2063:   <p>Consider a structure schema for object-style graphics which defines the
                   2064:   Graphic_object element type with the associated Height and Weight numeric
1.37      cvs      2065:   attributes. Suppose that we want documents of this class to have the
1.30      cvs      2066:   following qualities:</p>
                   2067:   <ul>
                   2068:     <li>Whenever the width or height of an object is changed using the mouse,
                   2069:       the new values are stored in the object's Width and Height
                   2070:     attributes.</li>
                   2071:     <li>The user should not be able to change the values of the Width and
                   2072:       Height attributes via the Attributes menu of the Thot editor.</li>
                   2073:   </ul>
                   2074: 
                   2075:   <p>The following exceptions will produce this effect.</p>
                   2076:   <pre>STRUCT
1.1       cvs      2077: ...
1.5       cvs      2078:    Graphics_object (ATTR Height = Integer; Width = Integer)
1.1       cvs      2079:        = GRAPHICS with Height ?= 10, Width ?= 10;
                   2080: ...
                   2081: EXCEPT
                   2082:    Height: NewHeight, Invisible;
1.18      cvs      2083:    Width: NewWidth, Invisible;</pre>
                   2084: </blockquote>
                   2085: </div>
                   2086: </div>
1.1       cvs      2087: 
1.18      cvs      2088: <div class="section">
1.37      cvs      2089: <h2><a name="sectb33" id="sectb33">Some examples</a></h2>
1.1       cvs      2090: 
1.30      cvs      2091: <p>In order to illustrate the principles of the document model and the syntax
                   2092: of the S language, this section presents two examples of structure schemas.
                   2093: One defines a class of documents, the other defines a class of objects.</p>
1.1       cvs      2094: 
1.18      cvs      2095: <div class="subsection">
1.37      cvs      2096: <h3><a name="sectc331" id="sectc331">A class of documents: articles</a></h3>
1.1       cvs      2097: 
1.30      cvs      2098: <p>This example shows a possible structure for articles published in a
                   2099: journal. Text between braces is comments.</p>
1.18      cvs      2100: <pre>STRUCTURE Article;  { This schema defines the Article class }
1.1       cvs      2101: DEFPRES ArticleP;   { The default presentation schema is
                   2102:                       ArticleP }
                   2103: ATTR                { Global attribute definitions }
                   2104:    WordType = Definition, IndexWord, DocumentTitle;
                   2105:    { A single global attribute is defined, with three values }
                   2106: STRUCT              { Definition of the generic structure }
                   2107:    Article = BEGIN  { The Article class has an aggregate
                   2108:                       structure }
                   2109:              Title = BEGIN   { The title is an aggregate }
                   2110:                      French_title = 
                   2111:                          Text WITH Language='Fran\347ais';
                   2112:                      English_title =
                   2113:                          Text WITH Language='English';
                   2114:                      END;
                   2115:              Authors = 
                   2116:                LIST OF (Author
                   2117:                  (ATTR Author_type=principal,secondary)
                   2118:                  { The Author type has a local attribute }
                   2119:                  = BEGIN
                   2120:                    Author_name = Text;
                   2121:                    Info = Paragraphs ;
                   2122:                    { Paragraphs is defined later }
                   2123:                    Address    = Text;
                   2124:                    END
                   2125:                  );
                   2126:              Keywords = Text;
                   2127:              { The journal's editor introduces the article
                   2128:                with a short introduction, in French and
                   2129:                in English }
                   2130:              Introduction = 
                   2131:                  BEGIN
                   2132:                  French_intr  = Paragraphs WITH
                   2133:                                 Language='Fran\347ais';
                   2134:                  English_intr = Paragraphs WITH
                   2135:                                 Language='English';
                   2136:                  END;
                   2137:              Body = Sections; { Sections are defined later }
                   2138:                    { Appendixes are only created on demand }
                   2139:            ? Appendices = 
                   2140:                  LIST OF (Appendix =
                   2141:                           BEGIN
                   2142:                           Appendix_Title    = Text;
                   2143:                           Appendix_Contents = Paragraphs;
                   2144:                           END
                   2145:                          );
1.37      cvs      2146:            ? Figures = LIST OF (Figure);
                   2147:            ? Bibliography = LIST OF (Biblio_citation);
                   2148:            ? Notes = LIST OF (Note);
1.1       cvs      2149:              END;      { End of the Article aggregate }
                   2150: 
                   2151:     Sections = LIST [2..*] OF (
                   2152:                  Section = { At least 2 sections }
                   2153:                  BEGIN
                   2154:                  Section_title   = Text;
                   2155:                  Section_contents =
                   2156:                    BEGIN
                   2157:                    Paragraphs;
                   2158:                    Sections; { Sections at a lower level }
                   2159:                    END;
                   2160:                  END
                   2161:                  );
                   2162: 
                   2163:     Paragraphs = LIST OF (Paragraph = CASE OF
                   2164:                                Enumeration = 
                   2165:                                    LIST [2..*] OF
                   2166:                                        (Item = Paragraphs);
                   2167:                                Isolated_formula = Formula;
                   2168:                                LIST OF (UNIT);
                   2169:                                END
                   2170:                           );
                   2171: 
                   2172:    Figure = BEGIN
1.5       cvs      2173:             Figure_caption  = Text;
1.1       cvs      2174:             Illustration   = NATURE;
                   2175:             END;
                   2176: 
                   2177:    Biblio_citation = CASE OF
                   2178:                         Ref_Article =
                   2179:                            BEGIN
                   2180:                            Authors_Bib   = Text;
                   2181:                            Article_Title = Text;
                   2182:                            Journal       = Text;
                   2183:                            Page_Numbers  = Text;
                   2184:                            Date          = Text;
                   2185:                            END;
                   2186:                         Ref_Livre =
                   2187:                            BEGIN
                   2188:                            Authors_Bib; { Defined above }
                   2189:                            Book_Title   = Text;
                   2190:                            Editor       = Text;
                   2191:                            Date;        { Defined above }
                   2192:                            END;
                   2193:                        END;
                   2194: 
                   2195:    Note =  Paragraphs - (Ref_note);
                   2196: 
                   2197: UNITS      { Elements which can be used in objects }
                   2198: 
                   2199:    Ref_note    = REFERENCE (Note);
                   2200:    Ref_biblio  = REFERENCE (Biblio_citation);
                   2201:    Ref_figure  = REFERENCE (Figure);
                   2202:    Ref_formula = REFERENCE (Isolated_formula);
                   2203: 
                   2204: EXPORT     { Skeleton elements }
                   2205: 
                   2206:    Title,
1.5       cvs      2207:    Figure with Figure_caption,
1.1       cvs      2208:    Section With Section_title;
                   2209: 
1.18      cvs      2210: END           { End of the structure schema }</pre>
1.30      cvs      2211: 
                   2212: <p>This schema is very complete since it defines both paragraphs and
1.37      cvs      2213: bibliographic citations. These element types could just as well be defined in
                   2214: other structure schemas, as is the case with the <tt>Formula</tt> class. All
                   2215: sorts of other elements can be inserted into an article, since a paragraph
                   2216: can contain any type of unit. Similarly, figures can be any class of document
                   2217: or object that the user chooses.</p>
                   2218: 
                   2219: <p>Generally, an article doesn't contain appendices, but it is possible to
                   2220: add them on explicit request: this is the effect of the question mark before
                   2221: the word Appendices.</p>
1.30      cvs      2222: 
1.37      cvs      2223: <p>Various types of cross-references can be put in paragraphs. They can also
1.30      cvs      2224: be placed the objects which are part of the article, since the
                   2225: cross-references are defined as units (<tt>UNITS</tt>).</p>
                   2226: 
                   2227: <p>There is a single restriction to prevent the creation of Ref_note elements
1.18      cvs      2228: within notes.</p>
1.30      cvs      2229: 
                   2230: <p>It is worth noting that the S language permits the definition of recursive
1.37      cvs      2231: structures like sections: a section can contain other sections (which are
                   2232: thus at the next lower level of the document tree). Paragraphs are also
                   2233: recursive elements, since a paragraph can contain an enumeration in which
                   2234: each element (<tt>Item</tt>) is composed of paragraphs.</p>
1.18      cvs      2235: </div>
1.1       cvs      2236: 
1.18      cvs      2237: <div class="subsection">
1.37      cvs      2238: <h3><a name="sectc332" id="sectc332">A class of objects: mathematical
                   2239: formulas</a></h3>
1.1       cvs      2240: 
1.30      cvs      2241: <p>The example below defines the <tt>Formula</tt> class which is used in
1.37      cvs      2242: Article documents. This class represents mathematical formulas with a rather
1.30      cvs      2243: simple structure, but sufficient to produce a correct rendition on the screen
1.37      cvs      2244: or printer. To support more elaborate operations (formal or numeric
                   2245: calculations), a finer structure should be defined. This class doesn't use
                   2246: any other class and doesn't define any units.</p>
1.18      cvs      2247: <pre>STRUCTURE Formula;
1.1       cvs      2248: DEFPRES FormulaP;
                   2249: 
                   2250: ATTR
                   2251:    String_type = Function_name, Variable_name;
                   2252: 
                   2253: STRUCT
                   2254:    Formula      = Expression;
                   2255:    Expression   = LIST OF (Construction);
                   2256:    Construction = CASE OF
                   2257:                   TEXT;         { Simple character string }
                   2258:                   Index    = Expression;
                   2259:                   Exponent = Expression;
                   2260:                   Fraction =
                   2261:                         BEGIN
1.6       cvs      2262:                         Numerator   = Expression;
1.1       cvs      2263:                         Denominator = Expression;
                   2264:                         END;
                   2265:                   Root = 
                   2266:                         BEGIN
                   2267:                       ? Order = TEXT;
                   2268:                         Root_Contents = Expression;
                   2269:                         END;
                   2270:                   Integral =
                   2271:                         BEGIN
                   2272:                         Integration_Symbol = SYMBOL;
                   2273:                         Lower_Bound        = Expression;
                   2274:                         Upper_Bound        = Expression;
                   2275:                         END;
                   2276:                   Triple =
                   2277:                         BEGIN
                   2278:                         Princ_Expression = Expression;
                   2279:                         Lower_Expression = Expression;
                   2280:                         Upper_Expression = Expression;
                   2281:                         END;
                   2282:                   Column = LIST [2..*] OF 
                   2283:                               (Element = Expression);
                   2284:                   Parentheses_Block =
                   2285:                         BEGIN
                   2286:                         Opening  = SYMBOL;
                   2287:                         Contents = Expression;
                   2288:                         Closing  = SYMBOL;
                   2289:                         END;
                   2290:                   END;       { End of Choice Constructor }
1.18      cvs      2291: END                          { End of Structure Schema }</pre>
1.30      cvs      2292: 
                   2293: <p>This schema defines a single global attribute which allows functions and
1.37      cvs      2294: variables to be distinguished. In the presentation schema, this attribute can
1.1       cvs      2295: be used to choose between roman (for functions) and italic characters (for
1.18      cvs      2296: variables).</p>
1.30      cvs      2297: 
1.37      cvs      2298: <p>A formula's structure is that of a mathematical expression, which is
                   2299: itself a sequence of mathematical constructions. A mathematical construction
                   2300: can be either a simple character string, an index, an exponent, a fraction, a
                   2301: root, etc. Each of these mathematical constructions has a sensible structure
                   2302: which generally includes one or more expressions, thus making the formula
                   2303: class's structure definition recursive.</p>
1.30      cvs      2304: 
                   2305: <p>In most cases, the roots which appear in the formulas are square roots and
1.37      cvs      2306: their order (2) is not specified. This is why the Order component is marked
                   2307: optional by a question mark. When explicitly requested, it is possible to add
1.18      cvs      2308: an order to a root, for example for cube roots (order = 3).</p>
1.30      cvs      2309: 
                   2310: <p>An integral is formed by an integration symbol, chosen by the user (simple
1.37      cvs      2311: integral, double, curvilinear, etc.), and two bounds. A more fine-grained
1.1       cvs      2312: schema would add components for the integrand and the integration variable.
1.37      cvs      2313: Similarly, the Block_Parentheses construction leaves the choice of opening
                   2314: and closing symbols to the user. They can be brackets, braces, parentheses,
1.18      cvs      2315: etc.</p>
                   2316: </div>
                   2317: </div>
1.37      cvs      2318: <hr />
1.18      cvs      2319: </div>
1.1       cvs      2320: 
1.18      cvs      2321: <div class="chapter">
1.37      cvs      2322: <h1><a name="sect4" id="sect4">The P Language</a></h1>
1.1       cvs      2323: 
1.18      cvs      2324: <div class="section">
1.37      cvs      2325: <h2><a name="sectb41" id="sectb41">Document presentation</a></h2>
1.1       cvs      2326: 
1.30      cvs      2327: <p>Because of the model adopted for Thot, the presentation of documents is
1.37      cvs      2328: clearly separated from their structure and content. After having presented
1.1       cvs      2329: the logical structure of documents, we now detail the principles implemented
1.37      cvs      2330: for their presentation. The concept of <em>presentation</em> encompasses what
                   2331: is often called the page layout, the composition, or the document style. It
1.18      cvs      2332: is the set of operations which display the document on the screen or print it
1.37      cvs      2333: on paper. Like logical structure, document presentation is defined
1.18      cvs      2334: generically with the help of a language, called P.</p>
1.1       cvs      2335: 
1.18      cvs      2336: <div class="subsection">
1.37      cvs      2337: <h3><a name="sectc411" id="sectc411">Two levels of presentation</a></h3>
1.1       cvs      2338: 
1.30      cvs      2339: <p>The link between structure and presentation is clear: the logical
                   2340: organization of a document is used to carry out its presentation, since the
                   2341: purpose of the presentation is to make evident the organization of the
1.37      cvs      2342: document. But the presentation is equally dependent on the device used to
1.30      cvs      2343: render the document. Certain presentation effects, notably changes of font or
1.37      cvs      2344: character set, cannot be performed on all printers or on all screens. This is
1.30      cvs      2345: why Thot uses a two-level approach, where the presentation is first described
                   2346: in abstract terms, without taking into account each particular device, and
                   2347: then the presentation is realized within the constraints of a given
                   2348: device.</p>
                   2349: 
                   2350: <p>Thus, presentation is only described as a function of the structure of the
1.37      cvs      2351: documents and the image that would be produced on an idealized device. For
1.1       cvs      2352: this reason, presentation descriptions do not refer to any device
1.18      cvs      2353: characteristics: they describe <em>abstract presentations</em> which can be
                   2354: concretized on different devices.</p>
1.30      cvs      2355: 
                   2356: <p>A presentation description also defines a <em>generic presentation</em>,
                   2357: since it describes the appearance of a class of documents or objects. This
                   2358: generic presentation must also be applied to document and object instances,
                   2359: each conforming to its generic logical structure, but with all the allowances
                   2360: that were called to mind above: missing elements, constructed elements with
                   2361: other logical structures, etc.</p>
                   2362: 
                   2363: <p>In order to preserve the homogeneity between documents and objects,
1.1       cvs      2364: presentation is described with a single set of tools which support the layout
                   2365: of a large document as well as the composition of objects like a graphical
1.37      cvs      2366: figure or mathematical formula. This unity of presentation description tools
1.1       cvs      2367: contrasts with the traditional approach, which focuses more on documents than
                   2368: objects and thus is based on the usual typographic conventions, such as the
                   2369: placement of margins, indentations, vertical spaces, line lengths,
1.18      cvs      2370: justification, font changes, etc.</p>
                   2371: </div>
1.1       cvs      2372: 
1.18      cvs      2373: <div class="subsection">
1.37      cvs      2374: <h3><a name="sectc412" id="sectc412">Boxes</a></h3>
1.1       cvs      2375: 
1.37      cvs      2376: <p>To assure the homogeneity of tools, all presentation in Thot, for
                   2377: documents as well as for the objects which they contain, is based on the
                   2378: notion of the <em>box</em>, such as was implemented in
                   2379: T<sub><big>E</big></sub>X.</p>
1.30      cvs      2380: 
1.37      cvs      2381: <p>Corresponding to each element of the document is a box, which is the
1.1       cvs      2382: rectangle enclosing the element on the display device (screen or sheet of
1.37      cvs      2383: paper); the outline of this rectangle is not visible, except when a <a
                   2384: href="#sectc4230a"><tt>ShowBox</tt> rule</a> applies to the element. The
                   2385: sides of the box are parallel to the sides of the screen or the sheet of
                   2386: paper. By way of example, a box is associated with a character string, a line
                   2387: of text, a page, a paragraph, a title, a mathematical formula, or a table
                   2388: cell.</p>
1.30      cvs      2389: 
                   2390: <p>Whatever element it corresponds to, each box possesses four sides and four
1.18      cvs      2391: axes, which we designate as follows (<a href="#boxes">see figure</a>):</p>
                   2392: <dl>
1.30      cvs      2393:   <dt><tt>Top</tt></dt>
                   2394:     <dd>the upper side,</dd>
                   2395:   <dt><tt>Bottom</tt></dt>
                   2396:     <dd>the lower side,</dd>
                   2397:   <dt><tt>Left</tt></dt>
                   2398:     <dd>the left side,</dd>
                   2399:   <dt><tt>Right</tt></dt>
                   2400:     <dd>the right side,</dd>
                   2401:   <dt><tt>VMiddle</tt></dt>
                   2402:     <dd>the vertical axis passing through the center of the box,</dd>
                   2403:   <dt><tt>HMiddle</tt></dt>
                   2404:     <dd>the horizontal axis passing through the center of the box,</dd>
                   2405:   <dt><tt>VRef</tt></dt>
                   2406:     <dd>the vertical reference axis,</dd>
                   2407:   <dt><tt>HRef</tt></dt>
                   2408:     <dd>the horizontal reference axis.</dd>
1.18      cvs      2409: </dl>
                   2410: 
                   2411: <div class="figure">
1.37      cvs      2412: <hr />
1.18      cvs      2413: <pre>        Left   VRef  VMiddle        Right
1.1       cvs      2414:                  :      :
                   2415:     Top   -----------------------------
                   2416:           |      :      :             |
                   2417:           |      :      :             |
                   2418:           |      :      :             |
                   2419:           |      :      :             |
                   2420:           |      :      :             |
                   2421: HMiddle ..|...........................|..
                   2422:           |      :      :             |
                   2423:           |      :      :             |
                   2424:    HRef ..|...........................|..
                   2425:           |      :      :             |
                   2426:           |      :      :             |
                   2427:   Bottom  -----------------------------
1.18      cvs      2428:                  :      :</pre>
1.30      cvs      2429: 
1.37      cvs      2430: <p align="center"><em><a name="boxes" id="boxes">The sides and axes of
1.30      cvs      2431: boxes</a><em></em></em></p>
1.37      cvs      2432: <hr />
1.30      cvs      2433: </div>
1.19      cvs      2434: 
1.37      cvs      2435: <p>The principal role of boxes is to set the extent and position of the
                   2436: images of the different elements of a document with respect to each other on
                   2437: the reproduction device. This is done by defining relations between the boxes
                   2438: of different elements which give relative extents and positions to these
1.18      cvs      2439: boxes.</p>
1.30      cvs      2440: 
                   2441: <p>There are three types of boxes:</p>
1.18      cvs      2442: <ul>
1.30      cvs      2443:   <li>boxes corresponding to structural elements of the document,</li>
                   2444:   <li>presentation boxes,</li>
                   2445:   <li>page layout boxes.</li>
1.18      cvs      2446: </ul>
1.30      cvs      2447: 
1.37      cvs      2448: <p><strong>Boxes corresponding to structural elements of the
                   2449: document</strong> are those which linked to each of the elements (base or
                   2450: structured) of the logical structure of the document. Such a box contains all
                   2451: the contents of the element to which it corresponds (there is an exception:
                   2452: see <a href="#sectc4220">rules <tt>VertOverflow</tt> and
                   2453: <tt>HorizOverflow</tt></a>). These boxes form a tree-like structure,
                   2454: identical to that of the structural elements to which they correspond. This
                   2455: tree expresses the inclusion relationships between the boxes: a box includes
                   2456: all the boxes of its subtree. On the other hand, there are no predefined
                   2457: rules for the relative positions of the included boxes. If they are at the
                   2458: same level, they can overlap, be contiguous, or be disjoint. The rules
                   2459: expressed in the generic presentation specify their relative positions.</p>
1.30      cvs      2460: 
                   2461: <p><strong>Presentation boxes</strong> represent elements which are not found
1.37      cvs      2462: in the logical structure of the document but which are added to meet the
                   2463: needs of presentation. These boxes are linked to the elements of the logical
1.30      cvs      2464: structure that are best suited to bringing them out. For example, they are
                   2465: used to add the character string ``Summary:'' before the summary in the
                   2466: presentation of a report or to represent the fraction bar in a formula, or
1.37      cvs      2467: also to make the title of a field in a form appear. These elements have no
1.30      cvs      2468: role in the logical structure of the document: the presence of a Summary
                   2469: element in the document does not require the creation of another structural
1.37      cvs      2470: object to hold the word ``Summary''. Similarly, if a Fraction element
                   2471: contains both a Numerator element and a Denominator element, the fraction bar
                   2472: has no purpose structurally. On the other hand, these elements of the
                   2473: presentation are important for the reader of the reproduced document or for
                   2474: the user of an editor. This is why they must appear in the document's image.
                   2475: It is the generic presentation which specifies the presentation boxes to add
                   2476: by indicating their content (a base element for which the value is specified)
                   2477: and the position that they must take in the tree of boxes. During editing,
                   2478: these boxes cannot be modified by the user.</p>
                   2479: 
                   2480: <p><strong>Page layout boxes</strong> are boxes created implicitly by the
                   2481: page layout rules. These rules indicate how the contents of a structured
                   2482: element must be broken into lines and pages. In contrast to presentation
                   2483: boxes, these line and page boxes do not depend on the logical structure of
                   2484: the document, but rather on the physical constraints of the output devices:
                   2485: character size, height and width of the window on the screen or of the sheet
                   2486: of paper.</p>
1.18      cvs      2487: </div>
1.1       cvs      2488: 
1.18      cvs      2489: <div class="subsection">
1.37      cvs      2490: <h3><a name="sectc413" id="sectc413">Views and visibility</a></h3>
1.1       cvs      2491: 
1.30      cvs      2492: <p>One of the operations that one might wish to perform on a document is to
1.37      cvs      2493: view it is different ways. For this reason, it is possible to define several
1.18      cvs      2494: <em>views</em> for the same document, or better yet, for all documents of the
1.37      cvs      2495: same class. A view is not a different presentation of the document, but
1.1       cvs      2496: rather a filter which only allows the display of certain parts of the
1.37      cvs      2497: document. For example, it might be desirable to see only the titles of
1.1       cvs      2498: chapters and sections in order to be able to move rapidly through the
1.37      cvs      2499: document. Such a view could be called a ``table of contents''. It might also
1.1       cvs      2500: be desirable to see only the mathematical formulas of a document in order to
1.37      cvs      2501: avoid being distracted by the non-mathematical aspects of the document. A
1.18      cvs      2502: ``mathematics'' view could provide this service.</p>
1.30      cvs      2503: 
                   2504: <p>Views, like presentation, are based on the generic logical structure. Each
1.1       cvs      2505: document class, and each generic presentation, can be provided with views
1.37      cvs      2506: which are particularly useful for that class or presentation. For each view,
1.18      cvs      2507: the <em>visibility</em> of elements is defined, indicated whether or not the
1.37      cvs      2508: elements must be presented to the user. The visibility is calculated as a
1.1       cvs      2509: function of the type of the elements or their hierarchical position in the
1.37      cvs      2510: structure of the document. Thus, for a table of contents, all the ``Chapter
                   2511: Title'' and ``Section Title'' elements are made visible. However, the
1.1       cvs      2512: hierarchical level could be used to make the section titles invisible below a
1.37      cvs      2513: certain threshold level. By varying this threshold, the granularity of the
                   2514: view can be varied. In the ``mathematics'' view, only Formula elements would
1.18      cvs      2515: be made visible, no matter what their hierarchical level.</p>
1.30      cvs      2516: 
                   2517: <p>Because views are especially useful for producing a synthetic image of the
1.1       cvs      2518: document, it is necessary to adapt the presentation of the elements to the
1.37      cvs      2519: view in which they appear. For example, it is inappropriate to have a page
                   2520: break before every chapter title in the table of contents. Thus, generic
1.1       cvs      2521: presentations take into account the possible views and permit each element
1.18      cvs      2522: type's presentation to vary according the view in which its image appears.</p>
                   2523: </div>
1.1       cvs      2524: 
1.18      cvs      2525: <div class="subsection">
1.37      cvs      2526: <h3><a name="sectc414" id="sectc414">Pages</a></h3>
1.1       cvs      2527: 
1.30      cvs      2528: <p>Presentation schemas can be defined which display the document as a long
1.37      cvs      2529: scroll, without page breaks. This type of schema is particularly well-suited
1.1       cvs      2530: to the initial phase of work on a document, where jumps from page to page
1.37      cvs      2531: would hinder composing and reading the document on a screen. But, once the
                   2532: document is written, it may be desirable to display the document on the
                   2533: screen in the same manner in which it will be printed. So, the presentation
                   2534: schema must define pages.</p>
                   2535: 
                   2536: <p>The P language permits the specification of the dimensions of pages as
                   2537: well as their composition. It is possible to generate running titles, page
                   2538: numbers, zones at the bottom of the page for notes, etc. The editor follows
1.30      cvs      2539: this model and inserts page break marks in the document which are used during
                   2540: printing, insuring that the pages on paper are the same as on the screen.</p>
                   2541: 
                   2542: <p>Once a document has been edited with a presentation schema defining pages,
1.37      cvs      2543: it contains page marks. But it is always possible to edit the document using
                   2544: a schema without pages. In this case, the page marks are simply ignored by
                   2545: the editor. They are considered again as soon as a schema with pages is used.
1.18      cvs      2546: Thus, the user is free to choose between schemas with and without pages.</p>
1.30      cvs      2547: 
                   2548: <p>Thot treats the page break, rather than the page itself, as a box. This
                   2549: page break box contains all the elements of one page's footer, a rule marking
1.37      cvs      2550: the edge of this page, and all the elements of the next page's header. The
                   2551: elements of the header and footer can be running titles, page number, notes,
                   2552: etc. All these elements, as well as their content and graphical appearance,
                   2553: are defined by the generic presentation.</p>
1.18      cvs      2554: </div>
1.1       cvs      2555: 
1.18      cvs      2556: <div class="subsection">
1.37      cvs      2557: <h3><a name="sectc415" id="sectc415">Numbering</a></h3>
1.1       cvs      2558: 
1.30      cvs      2559: <p>Many elements are numbered in documents: pages, chapters, sections,
                   2560: formulas, theorems, notes, figures, bibliographic references, exercises,
1.37      cvs      2561: examples, lemmas, etc. Because Thot has a notion of logical structure, all of
1.30      cvs      2562: these numbers (with the exception of pages) are redundant with information
1.37      cvs      2563: implicit in the logical structure of the document. Such numbers are simply a
                   2564: way to make the structure of the document more visible. So, they are part of
1.30      cvs      2565: the document's presentation and are calculated by the editor from the logical
1.37      cvs      2566: structure. The structure does not contain numbers as such; it only defines
1.1       cvs      2567: relative structural positions between elements, which serve as ordering
1.18      cvs      2568: relations on these elements.</p>
1.30      cvs      2569: 
                   2570: <p>If the structure schema defines the body of a document as a sequence of at
1.18      cvs      2571: least two chapters:</p>
                   2572: <pre>Body = LIST [2..*] OF Chapter;</pre>
1.30      cvs      2573: 
                   2574: <p>the sequence defined by the list constructor is ordered and each chapter
1.37      cvs      2575: can be assigned a number based on its rank in the Body list. Therefore, all
                   2576: elements contained in lists a the structure of a document can be numbered,
                   2577: but they are not the only ones. The tree structure induced by the aggregate,
1.18      cvs      2578: list, and choice constructors (excluding references) defines a total order on
1.37      cvs      2579: the elements of the document's primary structure. So, it is possible to
1.18      cvs      2580: define a numbering which uses this order, filtering elements according to
                   2581: their type so that only certain element types are taken into account in the
1.37      cvs      2582: numbering. In this way, it possible to number all the theorems and lemmas of
1.18      cvs      2583: a chapter in the same sequence of numbers, even when they are not part of the
                   2584: same list constructor and appear at different levels of the document's tree.
                   2585: By changing the filter, they can be numbered separately: one sequence of
                   2586: numbers for theorems, another for the lemmas.</p>
1.30      cvs      2587: 
                   2588: <p>Since they are calculated from the document's logical structure and only
                   2589: for the needs of the presentation, numbers are presentation elements,
                   2590: described by presentation boxes, just like the fraction bar or the word
1.37      cvs      2591: ``Summary''. Nevertheless, numbers differ from these other boxes because
                   2592: their content varies from instance to instance, even though they are of the
                   2593: same type, whereas all fraction bars are horizontal lines and the same word
1.30      cvs      2594: ``Summary'' appears at the head of every document's summary.</p>
1.18      cvs      2595: </div>
1.1       cvs      2596: 
1.18      cvs      2597: <div class="subsection">
1.37      cvs      2598: <h3><a name="sectc416" id="sectc416">Presentation properties</a></h3>
1.1       cvs      2599: 
1.34      cvs      2600: <p>The principal properties which determine document presentation are the
1.18      cvs      2601: <em>positions</em> and <em>dimensions</em> of boxes, the <em>font</em>, the
                   2602: <em>style</em>, the <em>size</em>, the <em>underlining</em> and the
1.37      cvs      2603: <em>color</em> of their content. From these properties, and some others of
1.34      cvs      2604: less importance, it is possible to represent the usual typographic properties
1.37      cvs      2605: for the textual parts of the document. These same properties can be used to
1.1       cvs      2606: describe the geometry of the non-textual elements, even though they are
1.18      cvs      2607: two-dimensional elements unlike the text, which is linear.</p>
1.30      cvs      2608: 
1.37      cvs      2609: <p>As we have already seen, the positions of the boxes always respect the
1.30      cvs      2610: rule of enclosure: a box in the tree encloses all the boxes of the next lower
1.37      cvs      2611: level which are attached to it. The positional properties permit the
1.30      cvs      2612: specification of the position of each box in relation to the enclosing box or
1.37      cvs      2613: to its sibling boxes (boxes directly attached to the same enclosing box in
                   2614: the tree of boxes).</p>
1.30      cvs      2615: 
1.37      cvs      2616: <p>The presentation properties also provide control over the dimensions of
                   2617: the boxes. The dimensions of a box can depend either on its content or on its
1.1       cvs      2618: context (its sibling boxes and the enclosing box). Each dimension (height or
1.18      cvs      2619: width) can be defined independently of the other.</p>
1.30      cvs      2620: 
1.34      cvs      2621: <p>Because of the position and dimension properties, it is possible to do the
1.1       cvs      2622: same things that are normally done in typography by changing margins, line
1.37      cvs      2623: lengths, and vertical or horizontal skips. This approach can also align or
1.18      cvs      2624: center elements and groups of elements.</p>
1.30      cvs      2625: 
1.34      cvs      2626: <p>In contrast to the position and dimension properties, the font, style,
1.30      cvs      2627: size, underlining, and color do not concern the box itself (the rectangle
1.37      cvs      2628: delimiting the element), but its content. These properties indicate the
                   2629: typographic attributes which must be applied to the text contained in the
                   2630: box, and by extension, to all base elements.</p>
1.30      cvs      2631: 
1.34      cvs      2632: <p>For text, the font property is used to change the family of characters
1.1       cvs      2633: (Times, Helvetica, Courier, etc.); the style is used to obtain italic or
1.37      cvs      2634: roman, bold or light characters; the size determines the point size of the
1.1       cvs      2635: characters; underlining defines the type and thickness of the lines drawn
1.18      cvs      2636: above, below, or through the characters.</p>
1.30      cvs      2637: 
1.34      cvs      2638: <p>For graphics, the line style property can be either solid, dotted, or
                   2639: dashed; the line thickness property controls the width of the lines; the fill
                   2640: pattern property determines how closed geometric figures must be filled.</p>
1.30      cvs      2641: 
1.34      cvs      2642: <p>While some of the properties which determine the appearance of a box's
1.1       cvs      2643: contents make sense only for one content type (text or graphic), other
1.34      cvs      2644: properties apply to all content types: these are the color properties. These
1.18      cvs      2645: indicate the color of lines and the background color.</p>
                   2646: </div>
                   2647: </div>
1.1       cvs      2648: 
1.18      cvs      2649: <div class="section">
1.37      cvs      2650: <h2><a name="sectb42" id="sectb42">Presentation description language</a></h2>
1.30      cvs      2651: 
1.34      cvs      2652: <p>A generic presentation defines the values of presentation properties (or
1.37      cvs      2653: the way to calculate those values) for a generic structure, or more
                   2654: precisely, for all the element types and all the global and local attributes
                   2655: defined in that generic structure. This definition of the presentation
                   2656: properties is made with the P language. A program written in this language,
                   2657: that is a generic presentation expressed in P, is call a <em>presentation
                   2658: schema</em>. This section describes the syntax and semantics of the language,
                   2659: using the same <a href="#sectc321">meta-language</a> as was used for the
                   2660: definition of the S language.</p>
                   2661: 
                   2662: <p>Recall that it is possible to write many different presentation schemas
                   2663: for the same class of documents or objects. This allows users to choose for a
                   2664: document the graphical appearance which best suits their type of work or
1.18      cvs      2665: their personal taste.</p>
1.1       cvs      2666: 
1.18      cvs      2667: <div class="subsection">
1.37      cvs      2668: <h3><a name="sectc421" id="sectc421">The organization of a presentation
                   2669: schema</a></h3>
1.1       cvs      2670: 
1.30      cvs      2671: <p>A presentation schema begins with the word <tt>PRESENTATION</tt> and ends
1.37      cvs      2672: with the word <tt>END</tt>. The word <tt>PRESENTATION</tt> is followed by the
                   2673: name of the generic structure to which the presentation will be applied. This
1.30      cvs      2674: name must be the same as that which follows the keyword <tt>STRUCTURE</tt> in
                   2675: the structure schema associated with the presentation schema.</p>
                   2676: 
1.37      cvs      2677: <p>After this declaration of the name of the structure, the following
                   2678: sections appear (in order):</p>
1.18      cvs      2679: <ul>
1.37      cvs      2680:   <li>Declarations of 
1.30      cvs      2681:     <ul>
                   2682:       <li>all views,</li>
                   2683:       <li>printed views,</li>
                   2684:       <li>counters,</li>
                   2685:       <li>presentation constants,</li>
                   2686:       <li>variables,</li>
                   2687:     </ul>
                   2688:   </li>
                   2689:   <li>default presentation rules,</li>
                   2690:   <li>presentation box and page layout box definitions,</li>
                   2691:   <li>presentation rules for structured elements,</li>
                   2692:   <li>presentation rules for attributes,</li>
                   2693:   <li>rules for transmitting values to attributes of included documents.</li>
1.18      cvs      2694: </ul>
1.30      cvs      2695: 
                   2696: <p>Each of these sections is introduced by a keyword which is followed by a
1.37      cvs      2697: sequence of declarations. Every section is optional.</p>
1.18      cvs      2698: <pre>     SchemaPres ='PRESENTATION' ElemID ';'
1.1       cvs      2699:                [ 'VIEWS' ViewSeq ]
                   2700:                [ 'PRINT' PrintViewSeq ]
                   2701:                [ 'COUNTERS' CounterSeq ]
                   2702:                [ 'CONST' ConstSeq ]
                   2703:                [ 'VAR' VarSeq ]
                   2704:                [ 'DEFAULT' ViewRuleSeq ]
                   2705:                [ 'BOXES' BoxSeq ]
                   2706:                [ 'RULES' PresentSeq ]
                   2707:                [ 'ATTRIBUTES' PresAttrSeq ]
                   2708:                [ 'TRANSMIT' TransmitSeq ]
                   2709:                  'END' .
1.18      cvs      2710:      ElemID     = NAME .</pre>
                   2711: </div>
1.1       cvs      2712: 
1.18      cvs      2713: <div class="subsection">
1.37      cvs      2714: <h3><a name="sectc422" id="sectc422">Views</a></h3>
1.1       cvs      2715: 
1.37      cvs      2716: <p>Each of the possible views must be declared in the presentation schema. As
                   2717: has <a href="#views">already been described</a>, the presentation rules for
                   2718: an element type can vary according to the view in which the element appears.
                   2719: The name of the view is used to designate the view to which the presentation
                   2720: rules apply (see the <a href="#inkeyword"><tt>IN</tt> instruction</a>). The
1.1       cvs      2721: definition of the view's contents are dispersed throughout the presentation
1.37      cvs      2722: rules attached to the different element types and attributes. The
1.18      cvs      2723: <tt>VIEWS</tt> section is simply a sequence of view names separated by commas
                   2724: and terminated by a semi-colon.</p>
1.30      cvs      2725: 
                   2726: <p>One of the view names (and only one) can be followed by the keyword
1.37      cvs      2727: <tt>EXPORT</tt>. This keyword identifies the view which presents the members
                   2728: of the document class in <a href="#sectc3213">skeleton form</a>. The
                   2729: graphical appearance and the content of this view is defined just as with
1.18      cvs      2730: other views, but it is useless to specify presentation rules concerning this
                   2731: view for the elements which are not loaded in the skeleton form.</p>
1.30      cvs      2732: 
                   2733: <p>It is not necessary to declare any views; in this case there is a single
1.37      cvs      2734: unnamed view. If many views are declared, the first view listed is considered
                   2735: the principal view. The principal view is the one to which all rules that are
1.18      cvs      2736: not preceded by an indication of a view will apply (see the <a
                   2737: href="#inkeyword">instruction <tt>IN</tt></a>).</p>
1.30      cvs      2738: 
                   2739: <p>The principal view is the the one which the editor presents on the screen
1.37      cvs      2740: when the user asks to create or edit a document. Thus, it makes sense to put
                   2741: the most frequently used view at the head of the list. But if the structure
1.18      cvs      2742: schema contains <a href="#sectc3213">skeleton elements</a> and is loaded in
                   2743: its skeleton form, the view whose name is followed by the keyword
                   2744: <tt>EXPORT</tt> will be opened and no other views can be opened.</p>
                   2745: <pre>                      'VIEWS' ViewSeq
1.1       cvs      2746:      ViewSeq         = ViewDeclaration
1.30      cvs      2747:                        &lt; ',' ViewDeclaration &gt; ';' .
1.1       cvs      2748:      ViewDeclaration = ViewID [ 'EXPORT' ] .
1.18      cvs      2749:      ViewID          = NAME .</pre>
1.30      cvs      2750: 
1.18      cvs      2751: <blockquote class="example">
1.30      cvs      2752:   <p><strong>Example:</strong></p>
                   2753: 
                   2754:   <p>When editing a report, it might be useful have views of the table of
1.37      cvs      2755:   contents and of the mathematical formulas, in addition to the principal
                   2756:   view which shows the document in its entirety. To achieve this, a
                   2757:   presentation schema for the Report class would have the following
                   2758:   <tt>VIEWS</tt> section:</p>
1.30      cvs      2759:   <pre>VIEWS
1.18      cvs      2760:      Full_text, Table_of_contents, Formulas;</pre>
1.30      cvs      2761: 
                   2762:   <p>The contents of these views are specified in the presentation rules of
                   2763:   the schema.</p>
1.18      cvs      2764: </blockquote>
                   2765: </div>
1.1       cvs      2766: 
1.18      cvs      2767: <div class="subsection">
1.37      cvs      2768: <h3><a name="sectc423" id="sectc423">Print Views</a></h3>
1.1       cvs      2769: 
1.37      cvs      2770: <p>When editing a document, each view specified by the <tt>VIEWS</tt>
                   2771: instruction is presented in a different window.</p>
1.30      cvs      2772: 
                   2773: <p>When printing a document, it is possible to print any number of views,
1.37      cvs      2774: chosen from among all the views which the editor can display. Print views, as
                   2775: well as the order in which they must be printed, are indicated by the
                   2776: <tt>PRINT</tt> instruction. It appears after the <tt>VIEWS</tt> instruction
                   2777: and is formed of the keyword <tt>PRINT</tt> followed by the ordered list of
                   2778: print view names. The print view names are separated by commas and followed
                   2779: by a semi-colon. A print view name is a view name declared in the
                   2780: <tt>VIEWS</tt> instruction.</p>
1.18      cvs      2781: <pre>                    'PRINT' PrintViewSeq
1.30      cvs      2782:      PrintViewSeq = PrintView &lt; ',' PrintView &gt; ';' .
1.37      cvs      2783:      PrintView    = ViewID .</pre>
1.30      cvs      2784: 
                   2785: <p>If the <tt>PRINT</tt> instruction is absent, the printing program will
                   2786: print only the principal view (the first view specified by the <tt>VIEWS</tt>
1.18      cvs      2787: instruction or the single, unnamed view when there is no <tt>VIEWS</tt>
                   2788: instruction).</p>
1.30      cvs      2789: 
1.18      cvs      2790: <blockquote class="example">
1.30      cvs      2791:   <p><strong>Example:</strong></p>
                   2792: 
                   2793:   <p>Consider a Report presentation using the view declarations from the
1.37      cvs      2794:   preceding example. Suppose we want to print the full text and table of
1.30      cvs      2795:   contents views, but not the Formulas view, which is only useful when
1.37      cvs      2796:   editing. A sensible printing order would be to print the full text followed
                   2797:   by the table of contents. To obtain this result when printing, the
                   2798:   presentation schema would say:</p>
1.30      cvs      2799:   <pre>PRINT
1.37      cvs      2800:      Full_text, Table_of_contents;</pre>
1.18      cvs      2801: </blockquote>
                   2802: </div>
                   2803: 
                   2804: <div class="subsection">
1.37      cvs      2805: <h3><a name="sectc424" id="sectc424">Counters</a></h3>
1.18      cvs      2806: 
1.30      cvs      2807: <p>A presentation has a <em>counter</em> for each type of number in the
1.37      cvs      2808: presentation. All counters, and therefore all types of numbers, used in the
1.18      cvs      2809: schema must be declared after the <tt>COUNTERS</tt> keyword.</p>
1.30      cvs      2810: 
                   2811: <p>Each counter declaration is composed of a name identifying the counter
1.1       cvs      2812: followed by a colon and the counting function to be applied to the counter.
1.18      cvs      2813: The counter declaration ends with a semi-colon.</p>
1.30      cvs      2814: 
                   2815: <p>The counting function indicates how the counter values will be calculated.
1.37      cvs      2816: Three types of counting functions are available. The first type is used to
1.16      cvs      2817: count the elements of a list or aggregate: it assigns to the counter the rank
1.37      cvs      2818: of the element in the list or aggregate. More precisely, the function</p>
1.18      cvs      2819: <pre>RANK OF ElemID [ LevelAsc ] [ INIT AttrID ]
                   2820:         [ 'REINIT' AttrID ]</pre>
1.30      cvs      2821: 
                   2822: <p>indicates that when an element creates, by a creation rule (see the <a
1.18      cvs      2823: href="#sectc4232"><tt>Create</tt> instructions</a>), a presentation box
1.37      cvs      2824: containing the counter value, this value is the rank of the creating element,
1.18      cvs      2825: if it is of type <tt>ElemID</tt>, otherwise the rank of the first element of
                   2826: type <tt>ElemID</tt> which encloses the creating element in the logical
                   2827: structure of the document.</p>
1.30      cvs      2828: 
                   2829: <p>The type name can be preceded by a star in the special case where the
1.18      cvs      2830: structure schema defines an element of whose <tt>ElemID</tt> is the same as
                   2831: that of an <a href="#sectd3284">inclusion</a> without expansion or with
1.37      cvs      2832: partial expansion. To resolve this ambiguity, the <tt>ElemID</tt> alone
1.18      cvs      2833: refers to the type defined in the structure schema while the <tt>ElemID</tt>
                   2834: preceded by a star refers to the included type.</p>
1.30      cvs      2835: 
1.37      cvs      2836: <p>The type name <tt>ElemID</tt> can be followed by an integer. That number
                   2837: represents the relative level, among the ancestors of the creating element,
                   2838: of the element whose rank is asked. If that relative level <i>n</i> is
                   2839: unsigned, the <i>n</i><sup>th</sup> element of type <tt>ElemID</tt>
                   2840: encountered when travelling the logical structure from the root to the
                   2841: creating element is taken into account. If the relative level is negative,
                   2842: the logical structure is travelled in the other direction, from the creating
                   2843: element to the root.</p>
1.30      cvs      2844: 
1.37      cvs      2845: <p>The function can end with the keyword <tt>INIT</tt> followed by the name
                   2846: of a numeric attribute (and only a numeric attribute). Then, the rank of the
1.30      cvs      2847: first element of the list or aggregate is considered to be the value of this
1.1       cvs      2848: attribute, rather than the default value of 1, and the rank of the other
1.37      cvs      2849: elements is shifted accordingly. The attribute which determines the initial
1.18      cvs      2850: value is searched on the element itself and on its ancestors.</p>
1.30      cvs      2851: 
                   2852: <p>The function can end with the keyword <tt>REINIT</tt> followed by the name
1.37      cvs      2853: of a numeric attribute (and only a numeric attribute). Then, if an element to
1.30      cvs      2854: be counted has this attribute, the counter value for this element is the
1.1       cvs      2855: attribute value and the following elements are numbered starting from this
1.18      cvs      2856: value.</p>
1.30      cvs      2857: 
                   2858: <p>When the <tt>RANK</tt> function is written</p>
1.18      cvs      2859: <pre>RANK OF Page [ ViewID ] [ INIT AttrID ]</pre>
1.30      cvs      2860: 
                   2861: <p>(<tt>Page</tt>is a keyword of the P language), the counter takes as its
                   2862: value the number of the page on which the element which creates the
1.37      cvs      2863: presentation box containing the number appears. This is done as if the pages
                   2864: of the document form a list for each view. The counter only takes into
1.30      cvs      2865: account the pages of the relevant view, that is the view displaying the
1.37      cvs      2866: presentation box whose contents take the value of the number. However, if the
                   2867: keyword <tt>Page</tt> is followed by the name of a view (between
                   2868: parentheses), it is the pages of that view that are taken into account. As in
                   2869: the preceding form, the <tt>RANK</tt> function applied to pages can end with
                   2870: the <tt>INIT</tt> keyword followed by the name of a numeric attribute which
                   2871: sets the value of the first page's number. This attribute must be a local
1.30      cvs      2872: attribute of the document itself, and not of one of its components.</p>
                   2873: 
                   2874: <p>The second counting function is used to count the occurrences of a certain
1.37      cvs      2875: element type in a specified context. The instruction</p>
1.18      cvs      2876: <pre>SET n ON Type1 ADD m ON Type2 [ INIT AttrID ]</pre>
1.30      cvs      2877: 
                   2878: <p>says that when the document is traversed from beginning to end (in the
                   2879: order induced by the logical structure), the counter is assigned the value
1.18      cvs      2880: <tt>n</tt> each time an element of type <tt>Type1</tt> is encountered, no
                   2881: matter what the current value of the counter, and the value <tt>m</tt> is
                   2882: added to the current value of the counter each time an element of type
                   2883: <tt>Type2</tt> is encountered.</p>
1.30      cvs      2884: 
                   2885: <p>As with the <tt>RANK</tt> function, the type names can be preceded by a
                   2886: star to resolve the ambiguity of included elements.</p>
                   2887: 
1.37      cvs      2888: <p>If the function ends with the keyword <tt>INIT</tt> followed by the name
                   2889: of an attribute and if the document possesses this attribute, the value of
                   2890: this attribute is used in place of <tt>n</tt>. The attribute must be numeric.
                   2891: It is searched on the element itself and on its ancestors.</p>
1.30      cvs      2892: 
                   2893: <p>This function can also be used with the <tt>Page</tt> keyword in the place
1.37      cvs      2894: of <tt>Type1</tt> or <tt>Type2</tt>. In the first case, the counter is
1.18      cvs      2895: reinitialized on each page with the value <tt>n</tt>, while in the second
1.37      cvs      2896: case, it is incremented by <tt>m</tt> on each page. As with the preceding
1.18      cvs      2897: counting function, the word <tt>Page</tt> can be followed by a name between
1.37      cvs      2898: parentheses. In this case, the name specifies a view whose pages are taken
1.18      cvs      2899: into account.</p>
1.30      cvs      2900: 
                   2901: <p>The definition of a counter can contain several <tt>SET</tt> functions and
1.37      cvs      2902: several <tt>ADD</tt> functions, each with a different value. The total number
1.18      cvs      2903: of counting functions must not be greater than 6.</p>
1.30      cvs      2904: 
1.37      cvs      2905: <p>The third counting function is used to count the elements of a certain
                   2906: type encountered when travelling from the creating element to the root of the
                   2907: logical structure. The creating element is included if it is of that type.
1.18      cvs      2908: That function is written</p>
                   2909: <pre>RLEVEL OF Type</pre>
1.30      cvs      2910: 
                   2911: <p>where <tt>Type</tt> represents the type of the elements to be counted.</p>
                   2912: 
                   2913: <p>The formal definition of counter declarations is:</p>
1.18      cvs      2914: <pre>                    'COUNTERS' CounterSeq
1.30      cvs      2915:      CounterSeq   = Counter &lt; Counter &gt; .
1.1       cvs      2916:      Counter      = CounterID ':' CounterFunc ';' .
                   2917:      CounterID    = NAME .
                   2918:      CounterFunc  = 'RANK' 'OF' TypeOrPage [ SLevelAsc ]
1.16      cvs      2919:                     [ 'INIT' AttrID ] [ 'REINIT' AttrID ] /
1.30      cvs      2920:                     SetFunction &lt; SetFunction &gt;
                   2921:                     AddFunction &lt; AddFunction &gt;
1.16      cvs      2922:                     [ 'INIT' AttrID ] /
                   2923:                     'RLEVEL' 'OF' ElemID .
1.1       cvs      2924:      SLevelAsc    = [ '-' ] LevelAsc .
                   2925:      LevelAsc     =  NUMBER .
                   2926:      SetFunction  = 'SET' CounterValue 'ON' TypeOrPage .
                   2927:      AddFunction  = 'ADD' CounterValue 'ON' TypeOrPage .
                   2928:      TypeOrPage   = 'Page' [ '(' ViewID ')' ] / 
1.16      cvs      2929:                     [ '*' ] ElemID .
1.18      cvs      2930:      CounterValue = NUMBER .</pre>
1.30      cvs      2931: 
1.18      cvs      2932: <blockquote class="example">
1.30      cvs      2933:   <p><strong>Example:</strong></p>
                   2934: 
                   2935:   <p>If the body of a chapter is defined as a sequence of sections in the
                   2936:   structure schema:</p>
                   2937:   <pre>Chapter_body = LIST OF (Section = 
1.1       cvs      2938:                             BEGIN
                   2939:                             Section_Title = Text;
                   2940:                             Section_Body  = Paragraphs;
                   2941:                             END
1.18      cvs      2942:                          );</pre>
1.30      cvs      2943: 
                   2944:   <p>the section counter is declared:</p>
                   2945:   <pre>SectionCtr : RANK OF Section;</pre>
                   2946: 
                   2947:   <p>and the display of the section number before the section title is
                   2948:   obtained by a <a href="#sectc4232"><tt>CreateBefore</tt> rule</a> attached
                   2949:   the <tt>Section_Title</tt> type, which creates a presentation box whose
                   2950:   content is the value of the <tt>SectionCtr</tt> counter (see the <a
                   2951:   href="#sectc4231"><tt>Content</tt> instruction</a>).</p>
                   2952: 
                   2953:   <p>In order to number the formulas separately within each chapter, the
                   2954:   formula counter is declared:</p>
                   2955:   <pre>FormulaCtr : SET 0 ON Chapter ADD 1 ON Formula;</pre>
                   2956: 
1.37      cvs      2957:   <p>and the display of the formula number in the right margin, alongside
                   2958:   each formula, is obtained by a <tt>CreateAfter</tt> instruction attached to
                   2959:   the <tt>Formula</tt> type, which creates a presentation box whose content
                   2960:   is the value of the <tt>FormulaCtr</tt> counter.</p>
1.30      cvs      2961: 
                   2962:   <p>To number the page chapter by chapter, with the first page of each
                   2963:   chapter having the number 1, the counter definition would be</p>
                   2964:   <pre>ChapterPageCtr : SET 0 ON Chapter ADD 1 ON Page;</pre>
                   2965: 
                   2966:   <p>If there is also a chapter counter</p>
                   2967:   <pre>ChapterCtr : RANK OF Chapter;</pre>
                   2968: 
1.37      cvs      2969:   <p>the <a href="#sectc4231">content</a> of a presentation box created at
                   2970:   the top of each page could be defined as:</p>
1.30      cvs      2971:   <pre>Content : (VALUE(ChapterCtr, URoman) TEXT '-'
1.18      cvs      2972:            VALUE(ChapterPageCtr, Arabic));</pre>
1.30      cvs      2973: 
                   2974:   <p>Thus, the presentation box contains the number of the chapter in
                   2975:   upper-case roman numerals followed by a hyphen and the number of the page
                   2976:   within the chapter in arabic numerals.</p>
1.18      cvs      2977: </blockquote>
1.30      cvs      2978: 
1.18      cvs      2979: <blockquote class="example">
1.30      cvs      2980:   <p><strong>Example:</strong></p>
                   2981: 
1.37      cvs      2982:   <p>To count tables and figures together in a document of the chapter type,
                   2983:   a counter could be defined using:</p>
1.30      cvs      2984:   <pre>CommonCtr : SET 0 ON Chapter ADD 1 ON Table
1.18      cvs      2985:             ADD 1 ON Figure;</pre>
                   2986: </blockquote>
                   2987: </div>
1.1       cvs      2988: 
1.18      cvs      2989: <div class="subsection">
1.37      cvs      2990: <h3><a name="sectc425" id="sectc425">Presentation constants</a></h3>
1.1       cvs      2991: 
1.30      cvs      2992: <p>Presentation constants are used in the definition of the content of
1.37      cvs      2993: presentation boxes. This content is used in <a href="#sectc426">variable
                   2994: definitions</a> and in the <a href="#sectc4231"><tt>Content</tt> rule</a>.
                   2995: The only presentation constants which can be used are character strings,
1.2       cvs      2996: mathematical symbols, graphical elements, and pictures, that is to say, base
1.18      cvs      2997: elements.</p>
1.30      cvs      2998: 
                   2999: <p>Constants can be defined directly in the variables or presentation boxes
1.37      cvs      3000: (<tt>Content</tt> rule) which use them. But it is only necessary them to
1.1       cvs      3001: declare once, in the constant declaration section, even though they are used
1.37      cvs      3002: in many variables or boxes. Thus, each declared constant has a name, which
1.1       cvs      3003: allows it to be designated whenever it is used, a type (one of the four base
                   3004: types) and a value (a character string or a single character for mathematical
1.18      cvs      3005: symbols and graphical elements).</p>
1.30      cvs      3006: 
1.37      cvs      3007: <p>The constant declarations appear after the keyword <tt>CONST</tt>. Each
                   3008: declaration is composed of the name of the constant, an equals sign, a
                   3009: keyword representing its type (<tt>Text</tt>, <tt>Symbol</tt>,
                   3010: <tt>Graphics</tt> or <tt>Picture</tt>) and the string representing its value.
                   3011: A semi-colon terminates each declaration.</p>
1.30      cvs      3012: 
                   3013: <p>In the case of a character string, the keyword <tt>Text</tt> can be
1.41      vatton   3014: followed by the name of an script (for example, <tt>Greek</tt> or
1.37      cvs      3015: <tt>Latin</tt>) in which the constant's text should be expressed. If the
1.43      quint    3016: script name is absent, the Latin script is used. When the script name is
                   3017: present, only the first letter of the script name is interpreted. Thus, the
                   3018: words <tt>Greek</tt> and <tt>Grec</tt> designate the same script. In current
                   3019: versions of Thot, only the Greek and Latin scripts are available.</p>
1.18      cvs      3020: <pre>                 'CONST' ConstSeq
1.30      cvs      3021:      ConstSeq   = Const &lt; Const &gt; .
1.1       cvs      3022:      Const      = ConstID '=' ConstType ConstValue ';' .
                   3023:      ConstID    = NAME .
1.41      vatton   3024:      ConstType  ='Text' [ Script ] / 'Symbol' /
1.1       cvs      3025:                  'Graphics' / 'Picture' .
                   3026:      ConstValue = STRING .
1.41      vatton   3027:      Script   = NAME .</pre>
1.30      cvs      3028: 
1.41      vatton   3029: <p>For character strings in the Latin script (ISO Latin-1 character set),
1.1       cvs      3030: characters having codes higher than 127 (decimal) are represented by their
1.18      cvs      3031: code in octal.</p>
1.30      cvs      3032: 
                   3033: <p>In the case of a symbol or graphical element, the value only contains a
1.37      cvs      3034: single character, between apostrophes, which indicates the form of the
                   3035: element which must be drawn in the box whose content is the constant. The
                   3036: symbol or graphical element takes the dimensions of the box, which are
                   3037: determined by the <tt>Height</tt> and <tt>Width</tt> rules. See <a
                   3038: href="#sectb72">table of codes</a> for the symbols and graphical elements.</p>
1.30      cvs      3039: 
1.18      cvs      3040: <blockquote class="example">
1.30      cvs      3041:   <p><strong>Example:</strong></p>
                   3042: 
                   3043:   <p>The constants ``Summary:'' and fraction bar, which were described
                   3044:   earlier, are declared:</p>
                   3045:   <pre>CONST
1.1       cvs      3046:      SummaryConst = Text 'Summary:';
1.18      cvs      3047:      Bar          = Graphics 'h';</pre>
                   3048: </blockquote>
                   3049: </div>
1.1       cvs      3050: 
1.18      cvs      3051: <div class="subsection">
1.37      cvs      3052: <h3><a name="sectc426" id="sectc426">Variables</a></h3>
1.1       cvs      3053: 
1.37      cvs      3054: <p>Variables permit the definition of computed content for presentation
                   3055: boxes. A variable is associated with a presentation box by a <tt>Content</tt>
                   3056: rule; but before being used in a <tt>Content</tt> rule, a variable can be
                   3057: defined in the <tt>VAR</tt> section. It is also possible to define a variable
                   3058: at the time of its use in a <tt>Content</tt> rule, as can be done with a
1.30      cvs      3059: constant.</p>
                   3060: 
                   3061: <p>A variable has a name and a value which is a character string resulting
1.37      cvs      3062: from the concatenation of the values of a sequence of functions. Each
1.30      cvs      3063: variable declaration is composed of the variable name followed by a colon and
1.37      cvs      3064: the sequence of functions which produces its value, separated by spaces. Each
1.18      cvs      3065: declaration is terminated by a semi-colon.</p>
                   3066: <pre>                  'VAR' VarSeq
1.30      cvs      3067:      VarSeq      = Variable &lt; Variable &gt; .
1.1       cvs      3068:      Variable    = VarID ':' FunctionSeq ';' .
                   3069:      VarID       = NAME .
1.30      cvs      3070:      FunctionSeq = Function &lt; Function &gt; .</pre>
                   3071: 
1.37      cvs      3072: <p>Several functions are available. The first two return, in the form of a
                   3073: character string, the current date. <tt>DATE</tt> returns the date in
1.18      cvs      3074: English, while <tt>FDATE</tt> returns the date in french.</p>
1.30      cvs      3075: 
                   3076: <p>Two other functions, <tt>DocName</tt> and <tt>DirName</tt>, return the
1.18      cvs      3077: document name and the directory where the document is stored.</p>
1.30      cvs      3078: 
1.38      cvs      3079: <p>Function <tt>ElemName</tt> returns the name of the element which created
1.30      cvs      3080: the presentation box whose contents are the variable.</p>
                   3081: 
1.38      cvs      3082: <p>Function <tt>AttributeName</tt> returns the name of the attribute which
                   3083: created the presentation box whose contents are the variable. The
                   3084: presentation box must be created by an attribute.</p>
                   3085: 
                   3086: <p>Function <tt>AttributeValue</tt> returns the value of the attribute which
                   3087: created the presentation box whose contents are the variable. The
                   3088: presentation box must be created by an attribute.</p>
                   3089: 
1.30      cvs      3090: <p>Another function simply returns the value of a presentation constant. For
                   3091: any constant declared in the <tt>CONST</tt> section, it is sufficient to give
1.37      cvs      3092: the name of the constant. Otherwise, the type and value of the constant must
1.30      cvs      3093: be given, using the same form as in a <a href="#sectc425">constant
1.18      cvs      3094: declaration</a>. If the constant is not of type text, (types <tt>Symbol</tt>,
                   3095: <tt>Graphics</tt> or <tt>Picture</tt>), it must be alone in the variable
                   3096: definition; only constants of type <tt>Text</tt> can be mixed with other
                   3097: functions.</p>
1.30      cvs      3098: 
                   3099: <p>It is also possible to obtain the value of an attribute, simply by
1.37      cvs      3100: mentioning the attribute's name. The value of this function is the value of
1.30      cvs      3101: the attribute for the element which created the presentation box whose
1.37      cvs      3102: contents are the variable. If the creating element does not have the
                   3103: indicated attribute, the value is an empty string. In the case of a numeric
1.30      cvs      3104: attribute, the attribute is translated into a decimal number in arabic
1.37      cvs      3105: numerals. If another form is desired, the <tt>VALUE</tt> function must be
1.30      cvs      3106: used.</p>
                   3107: 
                   3108: <p>The last available function returns, as a character string, the value of a
1.1       cvs      3109: counter, an attribute or a page number. This value can be presented in
1.37      cvs      3110: different styles. The keyword <tt>VALUE</tt> is followed (between
1.1       cvs      3111: parentheses) by the name of the counter, the name of the attribute, or the
1.18      cvs      3112: keyword <tt>PageNumber</tt> and the desired style, the two parameters being
1.37      cvs      3113: separated by a comma. The style is a keyword which indicates whether the
1.18      cvs      3114: value should be presented in arabic numerals (<tt>Arabic</tt>), lower-case
                   3115: roman numerals (<tt>LRoman</tt>), or upper-case roman numerals
                   3116: (<tt>URoman</tt>), or by an upper-case letter (<tt>Uppercase</tt>) or
                   3117: lower-case letter (<tt>Lowercase</tt>).</p>
1.30      cvs      3118: 
                   3119: <p>For a page counter, the keyword <tt>PageNumber</tt> can be followed,
                   3120: between parentheses, by the name of the view from which to obtain the page
1.37      cvs      3121: number. By default, the first view declared in the <tt>VIEWS</tt> section is
                   3122: used. The value obtained is the number of the page on which is found the
1.30      cvs      3123: element that is using the variable in a <tt>Content</tt> rule.</p>
                   3124: 
                   3125: <p>For an ordinary counter, the name of the counter can be preceded by the
1.37      cvs      3126: keyword <tt>MaxRangeVal</tt> or <tt>MinRangeVal</tt>. These keywords mean
1.1       cvs      3127: that the value returned by the function is the maximum (minimum resp.) value
                   3128: taken by the counter in the whole document, not the value for the element
1.18      cvs      3129: concerned by the function.</p>
                   3130: <pre>     Function     = 'DATE' / 'FDATE' /
1.1       cvs      3131:                     'DocName' / 'DirName' /
1.38      cvs      3132:                     'ElemName' / 'AttributeName' / 'AttributeValue' /
1.1       cvs      3133:                      ConstID / ConstType ConstValue /
                   3134:                      AttrID /
                   3135:                     'VALUE' '(' PageAttrCtr ','
                   3136:                                 CounterStyle ')' .
1.6       cvs      3137:      PageAttrCtr  = 'PageNumber' [ '(' ViewID ')' ] /
1.1       cvs      3138:                      [ MinMax ] CounterID / AttrID .
                   3139:      CounterStyle = 'Arabic' / 'LRoman' / 'URoman' /
                   3140:                     'Uppercase' / 'Lowercase' .
1.18      cvs      3141:      MinMax       = 'MaxRangeVal' / 'MinRangeVal' .</pre>
1.30      cvs      3142: 
1.18      cvs      3143: <blockquote class="example">
1.30      cvs      3144:   <p><strong>Example:</strong></p>
                   3145: 
                   3146:   <p>To make today's date appear at the top of the first page of a report, a
                   3147:   <a href="#sectc4232"><tt>CREATE</tt> rule</a> associated with the
                   3148:   Report_Title element type generates a presentation box whose content
                   3149:   (specified by the <tt>Content</tt> rule of that presentation box) is the
                   3150:   variable:</p>
                   3151:   <pre>VAR
1.18      cvs      3152:      Todays_date : TEXT 'Version of ' DATE;</pre>
1.30      cvs      3153: 
                   3154:   <p>To produce, before each section title, the chapter number (in upper-case
                   3155:   roman numerals) followed by the section number (in arabic numerals), two
                   3156:   counters must be defined:</p>
                   3157:   <pre>COUNTERS
1.1       cvs      3158:      ChapterCtr : RANK OF Chapter;
1.18      cvs      3159:      SectionCtr : RANK OF Section;</pre>
1.30      cvs      3160: 
                   3161:   <p>and the Section_Title element must create a presentation box whose
                   3162:   content is the variable</p>
                   3163:   <pre>VAR
1.1       cvs      3164:      SectionNum : VALUE (ChapterCtr, URoman) TEXT '-'
1.18      cvs      3165:                   VALUE (SectionCtr, Arabic);</pre>
1.30      cvs      3166: 
                   3167:   <p>In order to make the page number on which each section begins appear in
                   3168:   the table of contents view next to the section title, each Section_Title
                   3169:   element must create a presentation box, visible only in the table of
                   3170:   contents view, whose content is the variable:</p>
                   3171:   <pre>VAR
1.1       cvs      3172:      TitlePageNume :
1.18      cvs      3173:            VALUE (PageNumber(Full_text), Arabic);</pre>
                   3174: </blockquote>
                   3175: </div>
1.1       cvs      3176: 
1.18      cvs      3177: <div class="subsection">
1.37      cvs      3178: <h3><a name="sectc427" id="sectc427">Default presentation rules</a></h3>
1.1       cvs      3179: 
1.30      cvs      3180: <p>In order to avoid having to specify, for each element type defined in the
1.1       cvs      3181: structure schema, values for every one of the numerous presentation
1.34      cvs      3182: properties, the presentation schema allows the definition of a set of default
1.37      cvs      3183: presentation rules. These rules apply to all the boxes of the elements
1.1       cvs      3184: defined in the structure schema and to the presentation boxes and page layout
1.37      cvs      3185: boxes defined in the presentation schema. Only rules which differ from these
1.18      cvs      3186: default need to be specified in other sections of the presentation schema.</p>
1.30      cvs      3187: 
                   3188: <p>For the primary view, the default rules can define every presentation
1.34      cvs      3189: property, but not the <a href="#presfunct">presentation functions</a> or the
1.18      cvs      3190: <a href="#sectc4223">linebreaking conditions</a> (the <tt>NoBreak1</tt>,
                   3191: <tt>NoBreak2</tt>, and <tt>Gather</tt> rules).</p>
1.30      cvs      3192: 
                   3193: <p>In a presentation schema, the default presentation rules section is
                   3194: optional; in this case, the <tt>DEFAULT</tt> keyword is also absent and the
                   3195: following rules are considered to be the default rules:</p>
1.26      cvs      3196: <pre>   Visibility:        Enclosing =;
                   3197:    VertRef:           * . Left;
                   3198:    HorizRef:          Enclosed . HRef;
                   3199:    Height:            Enclosed . Height;
                   3200:    Width:             Enclosed . Width;
                   3201:    VertPos:           Top = Previous . Bottom;
                   3202:    HorizPos:          Left = Enclosing . Left;
1.49    ! quint    3203:    Float:             None;
        !          3204:    Clear:             None;
1.26      cvs      3205:    MarginTop:         0;
                   3206:    MarginRight:       0;
                   3207:    MarginBottom:      0;
                   3208:    MarginLeft:        0;
                   3209:    PaddingTop:        0;
                   3210:    PaddingRight:      0;
                   3211:    PaddingBottom:     0;
                   3212:    PaddingLeft:       0;
                   3213:    BorderTopWidth:    0;
                   3214:    BorderRightWidth:  0;
                   3215:    BorderBottomWidth: 0;
                   3216:    BorderLeftWidth:   0;
                   3217:    BorderTopColor:    Foreground;
                   3218:    BorderRightColor:  Foreground;
                   3219:    BorderBottomColor: Foreground;
                   3220:    BorderLeftColor:   Foreground;
                   3221:    BorderTopStyle:    None;
                   3222:    BorderRightStyle:  None;
                   3223:    BorderBottomStyle: None;
                   3224:    BorderLeftStyle:   None;
                   3225:    VertOverflow:      No;
                   3226:    HorizOverflow:     No;
                   3227:    Size:              Enclosing =;
                   3228:    Style:             Enclosing =;
                   3229:    Weight:            Enclosing =;
                   3230:    Font:              Enclosing =;
                   3231:    Underline:         Enclosing =;
                   3232:    Thickness:         Enclosing =;
                   3233:    Indent:            Enclosing =;
                   3234:    LineSpacing:       Enclosing =;
                   3235:    Adjust:            Enclosing =;
                   3236:    Hyphenate:         Enclosing =;
1.40      quint    3237:    Direction:         Enclosing =;
1.43      quint    3238:    UnicodeBidi:       Enclosing =;
1.26      cvs      3239:    PageBreak:         Yes;
                   3240:    LineBreak:         Yes;
                   3241:    InLine:            Yes;
                   3242:    Depth:             0;
                   3243:    LineStyle:         Enclosing =;
                   3244:    LineWeight:        Enclosing =;
                   3245:    FillPattern:       Enclosing =;
                   3246:    Background:        Enclosing =;
1.48      quint    3247:    Foreground:        Enclosing =;
                   3248:    Opacity:           Enclosing =;
                   3249:    FillOpacity:       Enclosing =;
                   3250:    StrokeOpacity:     Enclosing =;</pre>
1.30      cvs      3251: 
                   3252: <p>If other values are desired for the default rules, they must be defined
1.37      cvs      3253: explicitly in the default rules section. In fact, it is only necessary to
1.1       cvs      3254: define those default rules which differ from the ones above, since the rules
1.18      cvs      3255: above will be used whenever a rule is not explicitly named.</p>
1.30      cvs      3256: 
1.37      cvs      3257: <p>Default rules for views other than the primary view can also be specified.
1.1       cvs      3258: Otherwise, the default rules for the primary views are applied to the other
1.18      cvs      3259: views.</p>
1.30      cvs      3260: 
                   3261: <p>Default rules are expressed in the same way as <a
                   3262: href="#sectc4215">explicit rules for document elements</a>.</p>
1.18      cvs      3263: </div>
1.1       cvs      3264: 
1.18      cvs      3265: <div class="subsection">
1.37      cvs      3266: <h3><a name="sectc428" id="sectc428">Presentation and page layout
                   3267: boxes</a></h3>
1.1       cvs      3268: 
1.30      cvs      3269: <p>The presentation process uses elements which are not part of the logical
1.1       cvs      3270: structure of the document, such as pages (which are the page layout boxes) or
                   3271: alternatively, rules, numbers, or words introducing certain parts of the
                   3272: document, such as ``Summary'', ``Appendices'', ``Bibliography'', etc. (which
1.18      cvs      3273: are presentation boxes).</p>
1.30      cvs      3274: 
                   3275: <p>After the word <tt>BOXES</tt>, each presentation or page layout box is
                   3276: defined by its name and a sequence of presentation rules which indicate how
1.37      cvs      3277: they must be displayed. These rules are the same as those which define the
                   3278: boxes associated with element of the logical structure of the document, with
                   3279: a single exception, the <a href="#sectc4231"><tt>Content</tt> rule</a> which
                   3280: is used only to specify the content of presentation boxes. The content of
                   3281: boxes associated with elements of the document structure is defined in each
                   3282: document or object and thus is not specified in the presentation schema,
                   3283: which applies to all documents or objects of a class.</p>
1.30      cvs      3284: 
                   3285: <p>Among the rules which define a presentation box, certain ones can refer to
1.37      cvs      3286: another presentation box (for example, in their positional rules). If the
1.1       cvs      3287: designated box is defined after the box which designates it, a
1.18      cvs      3288: <tt>FORWARD</tt> instruction followed by the name of the designated box must
                   3289: appear before the designation.</p>
                   3290: <pre>             'BOXES' BoxSeq
1.30      cvs      3291:      BoxSeq = Box &lt; Box &gt; .
1.1       cvs      3292:      Box    ='FORWARD' BoxID ';' /
                   3293:               BoxID ':' ViewRuleSeq .
1.18      cvs      3294:      BoxID  = NAME .</pre>
                   3295: </div>
1.1       cvs      3296: 
1.18      cvs      3297: <div class="subsection">
1.37      cvs      3298: <h3><a name="sectc429" id="sectc429">Presentation of structured
                   3299: elements</a></h3>
1.1       cvs      3300: 
1.30      cvs      3301: <p>After the words <tt>RULES</tt>, the presentation schema gives the
                   3302: presentation rules that apply to the elements whose types are defined in the
1.37      cvs      3303: structure schema. Only those rules which differ from the <a
1.18      cvs      3304: href="#sectc427">default</a> must be specified in the <tt>RULES</tt>
                   3305: section.</p>
1.30      cvs      3306: 
                   3307: <p>The rule definitions for each element type are composed of the name of the
1.1       cvs      3308: element type (as specified in the structure schema) followed by a colon and
1.18      cvs      3309: the set of rules specific to that type.</p>
1.30      cvs      3310: 
                   3311: <p>The type name can be preceded by a star in the special case where the
1.18      cvs      3312: structure schema defines an <a href="#sectd3284">inclusion</a> without
1.1       cvs      3313: expansion (or with partial expansion) of a type with the same name as an
1.18      cvs      3314: element of defined in the structure schema.</p>
1.30      cvs      3315: 
                   3316: <p>In the case where the element is a <a href="#sectd3285">mark pair</a>, but
1.18      cvs      3317: only in this case, the type name can be preceded by the keywords
1.37      cvs      3318: <tt>First</tt> or <tt>Second</tt>. These keywords indicate whether the rules
1.18      cvs      3319: that follow apply to the first or second mark of the pair.</p>
                   3320: <pre>                 'RULES' PresentSeq
1.30      cvs      3321:      PresentSeq = Present &lt; Present &gt; .
1.6       cvs      3322:      Present    = [ '*' ] [ FirstSec ] ElemID ':'
                   3323:                   ViewRuleSeq .
1.18      cvs      3324:      FirstSec   = 'First' / 'Second' .</pre>
1.30      cvs      3325: 
                   3326: <p>A presentation schema can define presentation rules for base elements,
1.37      cvs      3327: which are defined implicitly in the structure schemas. In the English version
1.30      cvs      3328: of the presentation schema compiler, the base type names are the same as in
                   3329: the S language, but they are terminated by the <tt>_UNIT</tt> suffix:
1.18      cvs      3330: <tt>TEXT_UNIT</tt>, <tt>PICTURE_UNIT</tt>, <tt>SYMBOL_UNIT</tt>,
1.37      cvs      3331: <tt>GRAPHICS_UNIT</tt>. The base type names are written in upper-case
1.18      cvs      3332: letters.</p>
                   3333: </div>
                   3334: 
                   3335: <div class="subsection">
1.37      cvs      3336: <h3><a name="sectc4210" id="sectc4210">Logical attribute presentation</a></h3>
1.18      cvs      3337: 
1.30      cvs      3338: <p>After the keyword <tt>ATTRIBUTES</tt>, all attributes which are to have
1.37      cvs      3339: some effect on the presentation of the element to which they are attached
                   3340: must be mentioned, along with the corresponding presentation rules. This is
                   3341: true for both global attributes (which can be attached to all element types)
                   3342: and local attributes (which can only be attached to certain element
                   3343: types).</p>
1.30      cvs      3344: 
                   3345: <p>Also mentioned in this section are attributes which imply an effect on
1.1       cvs      3346: elements in the subtree of the element to which they are attached. The
1.37      cvs      3347: presentation of these descendants can be modified as a function of the value
1.1       cvs      3348: of the attribute which they inherit, just as if it was attached to them
1.18      cvs      3349: directly.</p>
1.30      cvs      3350: 
                   3351: <p>The specification for each attribute includes the attribute's name,
                   3352: followed by an optional value specification and, after a colon, a set of
1.37      cvs      3353: rules. The set of rules must contain at least one rule.</p>
1.30      cvs      3354: 
1.37      cvs      3355: <p>When there is no value specification, the rules are applied to all
                   3356: elements which carry the attribute, no matter what their value. When the
                   3357: rules must only apply when the attribute has certain values, these values
                   3358: must be specified. Thus, the same attribute can appear in the
                   3359: <tt>ATTRIBUTES</tt> section several times, with each appearance having a
                   3360: different value specification. However, reference attributes never have a
                   3361: value specification and, as a result, can only appear once in the
                   3362: <tt>ATTRIBUTES</tt> section.</p>
1.30      cvs      3363: 
                   3364: <p>To specify that the presentation rules apply to some of the descendants of
                   3365: the element having the attribute, the name of the affected element type is
1.37      cvs      3366: given, between parentheses, after the attribute name. This way, the
                   3367: presentation rules for the attribute will be applied to the element having
                   3368: the attribute, if it is of the given type, and to all of its descendants of
                   3369: the given type. In the case where this type is a <a href="#sectd3285">mark
                   3370: pair</a>, but only in this case, the type name can be preceded by the
                   3371: keywords <tt>First</tt> or <tt>Second</tt>. These keywords indicate whether
                   3372: the rules that follow apply to the first or second mark of the pair. If the
                   3373: rule must apply to several different element types, the specification must be
                   3374: repeated for each element type.</p>
1.30      cvs      3375: 
                   3376: <p>The specification of values for which the presentation rules will be
                   3377: applied varies according to the type of the attribute:</p>
1.18      cvs      3378: <dl>
1.30      cvs      3379:   <dt>numeric attribute</dt>
                   3380:     <dd>If the rules are to apply for one value of the attribute, then the
1.37      cvs      3381:       attribute name is followed by an equals sign and this value. If the
1.30      cvs      3382:       rules are to apply for all values less than (or greater than) a
                   3383:       threshold value, non-inclusive, the attribute name followed by a '&lt;'
1.37      cvs      3384:       sign (or a '&gt;' sign, respectively) and the threshold value. If the
                   3385:       rules must apply to a range of values, the attribute name is followed
                   3386:       by the word '<tt>IN</tt>' and the two bounds of the range, enclosed in
                   3387:       brackets and separated by two periods ('<tt>..</tt>'). In the case of
                   3388:       ranges, the values of the bounds are included in the range. 
1.30      cvs      3389:       <p>The threshold value in the comparisons can be the value of an
1.37      cvs      3390:       attribute attached to an ancestor element. In this case, the attribute
1.30      cvs      3391:       name is given instead of a constant value.</p>
1.37      cvs      3392:       <p>It is also possible to write rules which apply only when a
                   3393:       comparison between two different attributes of the element's ancestors
                   3394:       is true. In this case, the first attribute name is followed by a
                   3395:       comparison keyword and the name of the second attribute. The comparison
                   3396:       keywords are <tt>EQUAL</tt> (simple equality), <tt>LESS</tt>
                   3397:       (non-inclusive less than), and <tt>GREATER</tt> (non-inclusive greater
                   3398:       than).</p>
1.30      cvs      3399:     </dd>
                   3400:   <dt>text attribute</dt>
                   3401:     <dd>If the rules are to apply for one value of the attribute, then the
                   3402:       attribute name is followed by an equals sign and this value.</dd>
                   3403:   <dt>reference attribute</dt>
                   3404:     <dd>There is never a value specification; the rules apply no matter what
                   3405:       element is designated by the attribute.</dd>
                   3406:   <dt>enumerated attribute</dt>
                   3407:     <dd>If the rules are to apply for one value of the attribute, then the
                   3408:       attribute name is followed by an equals sign and this value.</dd>
1.18      cvs      3409: </dl>
1.30      cvs      3410: 
                   3411: <p>The order in which the rules associated with a numeric attribute are
1.37      cvs      3412: defined is important. When multiple sets of rules can be applied, the first
1.30      cvs      3413: set declared is the one used.</p>
                   3414: 
                   3415: <p>Rules for attributes have priority over both default rules and rules
1.37      cvs      3416: associated with element types. The attribute rules apply to the element to
                   3417: which the attribute is attached. It is the rules which apply to the
1.1       cvs      3418: surrounding elements (and especially to the descendants) which determine the
                   3419: effect of the attribute rules on the environment ( and especially on the
1.18      cvs      3420: terminal elements of the structure).</p>
                   3421: <pre>                    'ATTRIBUTES' PresAttrSeq
1.30      cvs      3422:      PresAttrSeq  = PresAttr &lt; PresAttr &gt; .
1.1       cvs      3423:      PresAttr     = AttrID [ '(' [ FirstSec ] ElemID ')' ]
                   3424:                     [ AttrRelation ] ':' ViewRuleSeq .
                   3425:      AttrID       = NAME .
                   3426:      AttrRelation ='=' AttrVal /
1.30      cvs      3427:                     '&gt;' [ '-' ] MinValue /
1.1       cvs      3428:                     '&lt;' [ '-' ] MaxValue /
                   3429:                     'IN' '[' [ '-' ] LowerBound '..'
                   3430:                     [ '-' ] UpperBound ']' /
                   3431:                     'GREATER' AttrID /
                   3432:                     'EQUAL' AttrID /
                   3433:                     'LESS' AttrID .
                   3434:      AttrVal      = [ '-' ] EqualNum / EqualText /
                   3435:                     AttrValue .
                   3436:      MinValue     = NUMBER .
                   3437:      MaxValue     = NUMBER .
                   3438:      LowerBound   = NUMBER .
                   3439:      UpperBound   = NUMBER.
                   3440:      EqualNum     = NUMBER .
                   3441:      EqualText    = STRING .
1.18      cvs      3442:      AttrValue    = NAME .</pre>
1.30      cvs      3443: 
1.37      cvs      3444: <p>In presentation rules associated with a numeric attribute (and only in
                   3445: such rules), the attribute name can be used in place of a numeric value. In
                   3446: this case, the value of the attribute is used in the application of the rule.
                   3447: Thus, the attribute can represent a relation between the size of two boxes,
                   3448: the height and width of a box, the height of an area where page breaks are
                   3449: prohibited, the distance between two boxes, the position of the reference
                   3450: axis of a box, the interline spacing, the indentation of the first line, the
1.18      cvs      3451: visibility, the depth (z-order), or the character set.</p>
1.30      cvs      3452: 
1.37      cvs      3453: <p>The presentation rules associated with reference attributes, it is
                   3454: possible to use the element designated by the attribute as a reference box in
                   3455: a positional or extent rule. This element is represented in the <a
1.18      cvs      3456: href="#sectc4218">position</a> or <a href="#sectc4219">extent</a> rule by the
                   3457: keyword <tt>Referred</tt>.</p>
1.30      cvs      3458: 
1.18      cvs      3459: <blockquote class="example">
1.30      cvs      3460:   <p><strong>Example:</strong></p>
                   3461: 
1.37      cvs      3462:   <p>In all structure schemas, there is a global Language attribute defined
                   3463:   as follows:</p>
1.30      cvs      3464:   <pre>ATTR
1.18      cvs      3465:      Language = TEXT;</pre>
1.30      cvs      3466: 
                   3467:   <p>The following rules would make French text be displayed in roman
                   3468:   characters and English text be displayed in italics:</p>
                   3469:   <pre>ATTRIBUTES
1.1       cvs      3470:      Language = 'French' :
1.6       cvs      3471:                 Style : Roman;
1.1       cvs      3472:      Language = 'English' :
1.18      cvs      3473:                 Style : Italics;</pre>
1.30      cvs      3474: 
                   3475:   <p>Using these rules, when the user puts the Language attribute with the
                   3476:   value 'English' on the summary of a document, every character string
1.37      cvs      3477:   (terminal elements) contained in the summary are displayed in italics. See
1.30      cvs      3478:   the <a href="#sectd42252"><tt>Style</tt> rule</a>.</p>
1.18      cvs      3479: </blockquote>
1.30      cvs      3480: 
1.18      cvs      3481: <blockquote class="example">
1.30      cvs      3482:   <p><strong>Example:</strong></p>
                   3483: 
                   3484:   <p>A numeric attribute representing the importance of the part of the
                   3485:   document to which it is attached can be defined:</p>
                   3486:   <pre>ATTR
1.18      cvs      3487:      Importance = INTEGER;</pre>
1.30      cvs      3488: 
                   3489:   <p>In the presentation schema, the importance of an element is reflected in
                   3490:   the choice of character size, using the following rules.</p>
                   3491:   <pre>ATTRIBUTES
1.1       cvs      3492:      Importance &lt; 2 :
                   3493:               Size : 1;
                   3494:      Importance IN [2..4] :
                   3495:               Size : Importance;
                   3496:      Importance = 10 :
                   3497:               Size : 5;
1.30      cvs      3498:      Importance &gt; 4 :
1.18      cvs      3499:               Size : 4;</pre>
1.30      cvs      3500: 
                   3501:   <p>Thus, the character size corresponds to the value of the Importance
                   3502:   attribute; its value is</p>
                   3503:   <ul>
                   3504:     <li>the value of the Importance attribute when the value is between 2 and
                   3505:       4 (inclusive),</li>
                   3506:     <li>1, when the value of the Importance attribute is less than 2,</li>
                   3507:     <li>4, when the value of the Importance attribute is greater than 4,</li>
                   3508:     <li>5, when the value of the Importance attribute is 10.</li>
                   3509:   </ul>
                   3510: 
1.37      cvs      3511:   <p>The last case (value 5) must be defined before the case which handles
                   3512:   all Importance values greater than 4, because the two rules are not
                   3513:   disjoint and the first one defined will have priority. Otherwise, when the
                   3514:   Importance attribute has value 10, the font size will be 4.</p>
1.18      cvs      3515: </blockquote>
1.30      cvs      3516: 
1.18      cvs      3517: <blockquote class="example">
1.30      cvs      3518:   <p><strong>Example:</strong></p>
                   3519: 
                   3520:   <p>Suppose the structure defines a list element which can have an attribute
                   3521:   defining the type of list (numbered or not):</p>
                   3522:   <pre>STRUCT
1.1       cvs      3523:     list (ATTR list_type = enumeration, dash)
1.18      cvs      3524:          = LIST OF (list_item = TEXT);</pre>
1.30      cvs      3525: 
                   3526:   <p>Then, the presentation schema could use the attribute placed on the list
                   3527:   element to put either a dash or a number before the each element of the
                   3528:   list:</p>
                   3529:   <pre>ATTRIBUTES
1.1       cvs      3530:    list_type (list_item) = enumeration :
                   3531:         CreateBefore (NumberBox);
                   3532:    list_type (list_item) = dash :
1.18      cvs      3533:         CreateBefore (DashBox);</pre>
                   3534: </blockquote>
1.30      cvs      3535: 
1.18      cvs      3536: <blockquote class="example">
1.30      cvs      3537:   <p><strong>Example:</strong></p>
                   3538: 
1.37      cvs      3539:   <p>Suppose that two attributes are defined in the structure schema. The
                   3540:   first is a numeric global attribute called ``version''. The other is a
1.30      cvs      3541:   local attribute defined on the root of the document called
                   3542:   ``Document_version'':</p>
                   3543:   <pre>STRUCTURE Document
1.1       cvs      3544: ATTR
                   3545:     version = INTEGER;
                   3546: STRUCT
                   3547:     Document (ATTR Document_version = INTEGER) =
                   3548:         BEGIN
                   3549:         SomeElement ;
                   3550:         ...
                   3551:         SomeOtherElement ;
                   3552:         END ;
1.18      cvs      3553: ...</pre>
1.30      cvs      3554: 
                   3555:   <p>These attributes can be used in the presentation schema to place change
                   3556:   bars in the margin next to elements whose version attribute has a value
                   3557:   equal to the Document_version attribute of the root and to place a star in
                   3558:   margin of elements whose version attribute is less than the value of the
                   3559:   root's Document_version attribute:</p>
                   3560:   <pre>ATTRIBUTES
1.1       cvs      3561:     version EQUAL Document_version :
                   3562:         CreateBefore (ChangeBarBox) ;
                   3563:     version LESS Document_version :
1.18      cvs      3564:         CreateBefore (StarBox) ;</pre>
                   3565: </blockquote>
                   3566: </div>
1.1       cvs      3567: 
1.18      cvs      3568: <div class="subsection">
1.37      cvs      3569: <h3><a name="sectc4212" id="sectc4212">Value transmission rules</a></h3>
1.1       cvs      3570: 
1.30      cvs      3571: <p>The last section of a presentation schema, which is optional, serves to
1.1       cvs      3572: defines the way in which a document transmits certain values to its
1.37      cvs      3573: sub-documents. A sub-document is an document <a
1.18      cvs      3574: href="#inclusion">included</a> without expansion or with partial expansion.
1.1       cvs      3575: The primary document can transmit to its sub-documents the values of certain
                   3576: counters or the textual content of certain of its elements, as a function of
1.18      cvs      3577: their type.</p>
1.30      cvs      3578: 
                   3579: <p>The sub-documents receive these values in attributes which must be defined
1.37      cvs      3580: in their structure schema as local attributes of the root element. The types
1.30      cvs      3581: of these attributes must correspond to the type of the value which they
                   3582: receive: numeric attributes for receiving the value of a counter, textual
                   3583: attributes for receiving the content of an element.</p>
                   3584: 
                   3585: <p>In the structure schema of the primary document, there appears at the end,
1.37      cvs      3586: after the <tt>TRANSMIT</tt> keyword, a sequence of transmission rules. Each
1.1       cvs      3587: rule begins with the name of the counter to transmit or of the element type
1.37      cvs      3588: whose textual content will be transmitted. This name is followed by the
                   3589: keyword <tt>To</tt> and the name of the attribute of the sub-document to
                   3590: which the value is transmitted. The sub-document class is indicated between
                   3591: parentheses after the name of the attribute. The transmission rule ends with
1.18      cvs      3592: a semicolon.</p>
1.30      cvs      3593: <pre>     TransmitSeq   =  Transmit &lt; Transmit &gt; .
1.1       cvs      3594:      Transmit      =  TypeOrCounter 'To' ExternAttr
                   3595:                       '(' ElemID ')' ';' .
                   3596:      TypeOrCounter =  CounterID / ElemID .
1.18      cvs      3597:      ExternAttr    =  NAME .</pre>
1.30      cvs      3598: 
1.18      cvs      3599: <blockquote class="example">
1.30      cvs      3600:   <p><strong>Example:</strong></p>
                   3601: 
                   3602:   <p>Consider a Book document class which includes instances of the Chapter
1.37      cvs      3603:   document class. These classes might have the following schemas:</p>
1.30      cvs      3604:   <pre>STRUCTURE Book
1.1       cvs      3605: STRUCT
                   3606:    Book = BEGIN
                   3607:           Title = Text;
                   3608:           Body  = LIST OF (Chapter INCLUDED);
                   3609:           END;
                   3610:    ...
                   3611: 
                   3612: STRUCTURE Chapter
                   3613: STRUCT
                   3614:    Chapter (ATTR FirstPageNum = Integer;
                   3615:                  ChapterNum = Integer;
                   3616:                  CurrentTitle   = Text) =
1.6       cvs      3617:           BEGIN
                   3618:           ChapterTitle = Text;
                   3619:           ...
                   3620:           END;
1.18      cvs      3621:    ...</pre>
1.30      cvs      3622: 
                   3623:   <p>Then the presentation schema for books could define chapter and page
                   3624:   counters. The following transmission rules in the book presentation schema
                   3625:   would transmit values for the three attributes defined at the root of each
                   3626:   chapter sub-document.</p>
                   3627:   <pre>PRESENTATION Book;
1.1       cvs      3628: VIEWS
                   3629:    Full_text;
                   3630: COUNTERS
                   3631:    ChapterCtr: Rank of Chapter;
                   3632:    PageCtr: Rank of Page(Full_text);
                   3633: ...
                   3634: TRANSMIT
                   3635:    PageCtr TO FirstPageNum(Chapter);
                   3636:    ChapterCtr TO ChapterNum(Chapter);
                   3637:    Title TO CurrentTitle(Chapter);
1.18      cvs      3638: END</pre>
1.30      cvs      3639: 
                   3640:   <p>Thus, each chapter included in a book can number its pages as a function
                   3641:   of the number of pages preceding it in the book, can make the chapter's
                   3642:   number appear before the number of each of its sections, or can place the
                   3643:   title of the book at the top of each page.</p>
1.18      cvs      3644: </blockquote>
                   3645: </div>
1.1       cvs      3646: 
1.18      cvs      3647: <div class="subsection">
1.37      cvs      3648: <h3><a name="sectc4213" id="sectc4213">Presentation rules</a></h3>
1.1       cvs      3649: 
1.30      cvs      3650: <p>Whether defining the appearance of a presentation or page layout box, an
1.1       cvs      3651: element type, or an attribute value, the set of presentation rules that apply
1.18      cvs      3652: is always defined in the same way.</p>
1.30      cvs      3653: 
                   3654: <p>Normally, a set of presentation rules is placed between the keywords
1.18      cvs      3655: <tt>BEGIN</tt> and <tt>END</tt>, the keyword <tt>END</tt> being followed by a
1.37      cvs      3656: semicolon. The first section of this block defines the rules that apply to
1.18      cvs      3657: the primary view, if the <a href="#sectc427">default rules</a> are not
1.37      cvs      3658: completely suitable. Next comes the rules which apply to specific other
1.1       cvs      3659: views, with a rule sequence for each view for which the default rules are not
1.37      cvs      3660: satisfactory. If the default rules are suitable for the non-primary views,
                   3661: there will not be any specific rules for these views. If there is only one
1.18      cvs      3662: rule which applies to all views then the keywords <tt>BEGIN</tt> and
                   3663: <tt>END</tt> need not appear.</p>
1.30      cvs      3664: 
                   3665: <p>For each view, it is only necessary to specify those rules which differ
                   3666: from the default rules for the view, so that for certain views (or even all
                   3667: views), there may be no specific rules.</p>
                   3668: 
                   3669: <p>The specific rules for a non-primary view are introduced by the <a
1.37      cvs      3670: name="inkeyword" id="inkeyword"><tt>IN</tt> keyword</a>, followed by the view
                   3671: name. The rules for that view follow, delimited by the keywords
                   3672: <tt>BEGIN</tt> and <tt>END</tt>, or without these two keywords when there is
                   3673: only one rule.</p>
1.30      cvs      3674: 
                   3675: <p><strong>Note:</strong> the view name which follows the <tt>IN</tt> keyword
1.1       cvs      3676: must not be the name of the primary view, since the rules for that view are
1.18      cvs      3677: found before the rules for the other views.</p>
1.30      cvs      3678: 
                   3679: <p>Within each block concerning a view, other blocks can appear, delimited by
1.37      cvs      3680: the same keywords <tt>BEGIN</tt> and <tt>END</tt>. Each of these blocks
                   3681: gathers the presentation rules that apply, for a given view, only when a
                   3682: given condition is satisfied. Each block is preceded by a condition
                   3683: introduced by the <tt>IF</tt> keyword. If such a conditional block contains
                   3684: only one rule, the keywords <tt>BEGIN</tt> and <tt>END</tt> can be
                   3685: omitted.</p>
                   3686: 
                   3687: <p>Although the syntax allows any presentation rule to appear in a
                   3688: conditional block, only <a href="#sectc4232">creation rules</a> are allowed
                   3689: after any condition; other rules are allowed only after conditions
                   3690: <tt>Within</tt> and ElemID. In addition, the following rules cannot be
                   3691: conditional: <tt>PageBreak, LineBreak, Inline, Gather</tt>.</p>
1.30      cvs      3692: 
                   3693: <p>For a given view, the rules that apply without any condition must appear
1.37      cvs      3694: before the first conditional block. If some rules apply only when none of the
                   3695: specified condition holds, they are grouped in a block preceded by the
                   3696: keyword <tt>Otherwise</tt>, and that block must appear after the last
                   3697: conditionnal block concerning the same view.</p>
1.30      cvs      3698: <pre>     ViewRuleSeq  = 'BEGIN' &lt; RulesAndCond &gt; &lt; ViewRules &gt;
1.1       cvs      3699:                     'END' ';' /
                   3700:                     ViewRules / CondRules / Rule .
                   3701:      RulesAndCond = CondRules / Rule .
                   3702:      ViewRules    = 'IN' ViewID CondRuleSeq .
1.30      cvs      3703:      CondRuleSeq  = 'BEGIN' &lt; RulesAndCond &gt; 'END' ';' /
1.1       cvs      3704:                     CondRules / Rule .
1.30      cvs      3705:      CondRules    = CondRule &lt; CondRule &gt;
1.1       cvs      3706:                     [ 'Otherwise' RuleSeq ] .
                   3707:      CondRule     = 'IF' ConditionSeq RuleSeq .
1.30      cvs      3708:      RulesSeq     = 'BEGIN' Rule &lt; Rule &gt; 'END' ';' /
1.18      cvs      3709:                     Rule .</pre>
1.30      cvs      3710: 
1.18      cvs      3711: <blockquote class="example">
1.30      cvs      3712:   <p><strong>Example:</strong></p>
                   3713: 
                   3714:   <p>The following rules for a report's title make the title visible in the
1.37      cvs      3715:   primary view and invisible in the table of contents and in the formula
                   3716:   views (see the <a href="#sectc4224"><tt>Visibility</tt> rule</a>).</p>
1.30      cvs      3717:   <pre>Title : BEGIN
1.1       cvs      3718:         Visibility : 1;
                   3719:         ...    {Other rules for the primary view}
                   3720:         IN Table_of_contents
                   3721:            Visibility : 0;
                   3722:         IN Formulas
                   3723:            Visibility : 0;
1.18      cvs      3724:         END;</pre>
                   3725: </blockquote>
                   3726: </div>
1.1       cvs      3727: 
1.18      cvs      3728: <div class="subsection">
1.37      cvs      3729: <h3><a name="sectc4214" id="sectc4214">Conditions applying to presentation
                   3730: rules</a></h3>
1.1       cvs      3731: 
1.37      cvs      3732: <p>Many conditions can be applied to presentation rules. Conditions allow
                   3733: certain presentation rules to apply only in certain cases. These conditions
                   3734: can be based on the structural position of the element. They can be based on
1.1       cvs      3735: whether the element has references, and what type of references, whether the
1.42      quint    3736: element has attributes, possibly with certains values, whether the element is
                   3737: empty or not, whether the element is the root of its document or not. They
                   3738: can also be based on the value of a counter.</p>
1.30      cvs      3739: 
1.37      cvs      3740: <p>It is possible to specify several conditions which must all be true for
                   3741: the rules to apply.</p>
1.30      cvs      3742: 
1.37      cvs      3743: <p>A set of conditions is specified by the <tt>IF</tt> keyword. This keyword
1.30      cvs      3744: is followed by the sequence of conditions, separated by the <tt>AND</tt>
                   3745: keyword. Each condition is specified by a keyword which defines the condition
                   3746: type. In some cases, the keyword is followed by other data, which specify the
1.42      quint    3747: condition more precisely. The keyword is not present if the condition depends
                   3748: on the element type or an attribute associated with the element.</p>
1.30      cvs      3749: 
                   3750: <p>An elementary condition can be negative; it is then preceded by the
1.18      cvs      3751: <tt>NOT</tt> keyword.</p>
1.30      cvs      3752: 
                   3753: <p>When the presentation rule(s) controlled by the condition apply to a
                   3754: reference element or a reference attribute, an elementary condition can also
1.37      cvs      3755: apply to element referred by this reference. The <tt>Target</tt> keyword is
                   3756: used for that purpose. It must appear before the keyword defining the
1.30      cvs      3757: condition type.</p>
1.18      cvs      3758: <pre>     CondRule      ='IF' ConditionSeq RuleSeq .
1.30      cvs      3759:      ConditionSeq  = Condition &lt; 'AND' Condition &gt; .
1.1       cvs      3760:      Condition     = [ 'NOT' ] [ 'Target' ] ConditionElem .
                   3761:      ConditionElem ='First' / 'Last' /
                   3762:                      [ 'Immediately' ] 'Within' [ NumParent ]
                   3763:                                        ElemID [ ExtStruct ] /
                   3764:                      ElemID /
                   3765:                     'Referred' / 'FirstRef' / 'LastRef' /
                   3766:                     'ExternalRef' / 'InternalRef' / 'CopyRef' /
1.44      quint    3767:                      [ 'Inherited' ] AttrID [ '=' Value ] /
1.1       cvs      3768:                     'AnyAttributes' / 'FirstAttr' / 'LastAttr' /
                   3769:                     'UserPage' / 'StartPage' / 'ComputedPage' /
1.33      cvs      3770:                     'Empty' / 'Root' /
1.1       cvs      3771:                     '(' [ MinMax ] CounterName CounterCond ')' /
                   3772:                      CondPage '(' CounterID ')' .
                   3773:      NumParent     = [ GreaterLess ] NParent .
1.30      cvs      3774:      GreaterLess   ='&gt;' / '&lt;' .
1.1       cvs      3775:      NParent       = NUMBER.
1.6       cvs      3776:      ExtStruct     ='(' ElemID ')' .
1.42      quint    3777:      Value         = [ '-' ] IntegerVal / TextVal / AttrValue .
1.30      cvs      3778:      CounterCond   ='&lt;' MaxCtrVal / '&gt;' MinCtrVal /
1.1       cvs      3779:                     '=' EqCtrVal / 
                   3780:                     'IN' '[' ['-'] MinCtrBound '.' '.'
                   3781:                      ['-'] MaxCtrBound ']' .
                   3782:      PageCond      ='Even' / 'Odd' / 'One' .
                   3783:      MaxCtrVal     = NUMBER .
                   3784:      MinCtrVal     = NUMBER .
                   3785:      EqCtrVal      = NUMBER .
                   3786:      MaxCtrBound   = NUMBER .
1.18      cvs      3787:      MinCtrBound   = NUMBER .</pre>
1.1       cvs      3788: 
1.18      cvs      3789: <div class="subsubsection">
1.37      cvs      3790: <h4><a name="sectd42141" id="sectd42141">Conditions based on the logical
                   3791: position of the element</a></h4>
1.30      cvs      3792: 
                   3793: <p>The condition can be on the position of the element in the document's
1.37      cvs      3794: logical structure tree. It is possible to test whether the element is the
1.30      cvs      3795: first (<tt>First</tt>) or last (<tt>Last</tt>) among its siblings or if it is
                   3796: not the first (<tt>NOT First</tt>) or not the last (<tt>NOT Last</tt>). These
1.18      cvs      3797: conditions can be associated only with <a href="#sectc4232">creation
                   3798: rules</a>.</p>
1.30      cvs      3799: 
1.33      cvs      3800: <p>It is possible to test if the element is the root of its document (keyword
                   3801: <code>Root</code>).</p>
                   3802: 
1.30      cvs      3803: <p>It is also possible to test if the element is contained in an element of a
1.18      cvs      3804: given type (<tt>Within</tt>) or if it is not (<tt>NOT Within</tt>). The type
                   3805: is indicated after the keyword <tt>Within</tt>. If that element type is
1.1       cvs      3806: defined in a structure schema which is not the one which corresponds to the
                   3807: presentation schema, the type name of this element must be followed, between
1.18      cvs      3808: parentheses, by the name of the structure schema which defines it.</p>
1.30      cvs      3809: 
                   3810: <p>If the keyword <tt>Within</tt> is preceded by <tt>Immediately</tt>, the
1.18      cvs      3811: condition is satisfied only if the <em>parent</em> element has the type
                   3812: indicated. If the word <tt>Immediately</tt> is missing, the condition is
                   3813: satisfied if any <em>ancestor</em> has the type indicated.</p>
1.30      cvs      3814: 
                   3815: <p>An integer <i>n</i> can appear between the keyword <tt>Within</tt> and the
1.37      cvs      3816: type. It specifies the number of ancestors of the indicated type that must be
                   3817: present for the condition to be satisfied. If the keyword
1.18      cvs      3818: <tt>Immediately</tt> is also present, the <i>n</i> immediate ancestors of the
1.37      cvs      3819: element must have the indicated type. The integer <i>n</i> must be positive
                   3820: or zero. It can be preceded by <tt>&lt;</tt> or <tt>&gt;</tt> to indicate a
                   3821: maximum or minimum number of ancestors. If these symbols are missing, the
                   3822: condition is satisfied only if it exists exactly <i>n</i> ancestors. When
1.30      cvs      3823: this number is missing, it is equivalent to &gt; 0.</p>
1.42      quint    3824: </div>
                   3825: 
                   3826: <div class="subsubsection">
                   3827: <h4><a name="sectd421411" id="sectd421411">Conditions based on the element
                   3828: type</a></h4>
1.30      cvs      3829: 
                   3830: <p>If the condition applies to presentation rules associated with an
                   3831: attribute, in the <tt>ATTRIBUTES</tt> section of the presentation schema, the
                   3832: condition can be simply an element name. Presentation rules are then executed
                   3833: only if the attribute is attached to an element of that type. The keyword
                   3834: <tt>NOT</tt> before the element name indicates that the presentation rules
                   3835: must be executed only if the element is not of the type indicated.</p>
1.18      cvs      3836: </div>
1.1       cvs      3837: 
1.18      cvs      3838: <div class="subsubsection">
1.37      cvs      3839: <h4><a name="sectd42142" id="sectd42142">Conditions on references</a></h4>
1.30      cvs      3840: 
                   3841: <p>References may be taken into account in conditions, which can be based on
                   3842: the fact that the element, or one of its ancestors, is designated by a at
                   3843: least one reference (<tt>Referred</tt>) or by none (<tt>NOT
                   3844: Referred</tt>).</p>
                   3845: 
                   3846: <p>If the element or attribute to which the condition is attached is a
                   3847: reference, the condition can be based on the fact that it acts as the first
                   3848: reference to the designated element (<tt>FirstRef</tt>), or as the last
                   3849: (<tt>LastRef</tt>), or as a reference to an element located in another
                   3850: document (<tt>ExternalRef</tt>) or in the same document
                   3851: (<tt>InternalRef</tt>).</p>
1.1       cvs      3852: 
1.30      cvs      3853: <p>The condition can also be based on the fact that the element is an <a
1.37      cvs      3854: href="#inclusion">inclusion</a>. This is noted (<tt>CopyRef</tt>).</p>
1.30      cvs      3855: 
                   3856: <p>Like all conditions, conditions on references can be inverted by the
1.18      cvs      3857: <tt>NOT</tt> keyword. These conditions can be associated only with <a
                   3858: href="#sectc4232">creation rules</a>.</p>
                   3859: </div>
1.1       cvs      3860: 
1.18      cvs      3861: <div class="subsubsection">
1.37      cvs      3862: <h4><a name="sectd42143" id="sectd42143">Conditions on logical
                   3863: attributes</a></h4>
1.30      cvs      3864: 
                   3865: <p>The condition can be based on the presence or absence of attributes
                   3866: associated with the element, no matter what the attributes or their values.
                   3867: The <tt>AnyAttributes</tt> keyword expresses this condition.</p>
1.1       cvs      3868: 
1.42      quint    3869: <p>A condition can also be based on the presence or absence of a given
                   3870: attribute associated with the element. This condition is simply expressed by
1.44      quint    3871: the name of the attribute. The condition may also be based on the presence of
                   3872: a given attribute associated with a parent of the element. This condition is
                   3873: expressed by the <code>Inherited</code> keyword, followed by the name of the
                   3874: attribute.</p>
1.42      quint    3875: 
                   3876: <p>The condition can be based on the value of a given attribute. It is then
                   3877: expressed by the name of the attribute, followed by the '=' sign and the
                   3878: value to be tested. Depending on the type of attribute, the value is simply
                   3879: an integer (possibly negative), the name of one of the possible values of the
1.44      quint    3880: attribute or a quoted character string. If the attribute with the specified
                   3881: value has to be checked on the ancestors of the element, this condition
                   3882: starts with the keyword <code>Inherited.</code></p>
1.42      quint    3883: 
1.30      cvs      3884: <p>If the condition appears in the presentation rules of an attribute, the
1.37      cvs      3885: <tt>FirstAttr</tt> and <tt>LastAttr</tt> keywords can be used to indicate
                   3886: that the rules must only be applied if this attribute is the first attribute
                   3887: for the element or if it is the last (respectively). These conditions can
                   3888: also be inverted by the <tt>NOT</tt> keyword. These conditions can be
                   3889: associated only with <a href="#sectc4232">creation rules</a>.</p>
1.30      cvs      3890: 
                   3891: <p>It is also possible to apply certain presentation rules only when the
                   3892: element being processed or one of its ancestors has a certain attribute,
1.37      cvs      3893: perhaps with a certain value. This can be done in the <a
1.18      cvs      3894: href="#sectc4210"><tt>ATTRIBUTES</tt> section</a>.</p>
                   3895: </div>
1.1       cvs      3896: 
1.18      cvs      3897: <div class="subsubsection">
1.37      cvs      3898: <h4><a name="sectd42144" id="sectd42144">Conditions on page breaks</a></h4>
1.1       cvs      3899: 
1.30      cvs      3900: <p>The page break base type (and only this type) can use the following
1.18      cvs      3901: conditions: <tt>ComputedPage</tt>, <tt>StartPage</tt>, and <tt>UserPage</tt>.
                   3902: The <tt>ComputedPage</tt> condition indicates that the presentation rule(s)
1.37      cvs      3903: should apply if the page break was created automatically by Thot; the
                   3904: <tt>StartPage</tt> condition is true if the page break is generated before
                   3905: the element by the <tt>Page</tt> rule; and the <tt>UserPage</tt> condition
                   3906: applies if the page break was inserted by the user.</p>
1.30      cvs      3907: 
                   3908: <p>These conditions can be associated only with <a href="#sectc4232">creation
1.18      cvs      3909: rules</a>.</p>
                   3910: </div>
1.1       cvs      3911: 
1.18      cvs      3912: <div class="subsubsection">
1.37      cvs      3913: <h4><a name="sectd42145" id="sectd42145">Conditions on the element's
                   3914: content</a></h4>
1.1       cvs      3915: 
1.37      cvs      3916: <p>The condition can be based on whether or not the element is empty. An
1.30      cvs      3917: element which has no children or whose leaves are all empty is considered to
1.37      cvs      3918: be empty itself. This condition is expressed by the <tt>Empty</tt> keyword,
1.30      cvs      3919: optionally preceded by the <tt>NOT</tt> keyword. This condition can be
                   3920: associated only with <a href="#sectc4232">creation rules</a>.</p>
1.18      cvs      3921: </div>
1.1       cvs      3922: 
1.18      cvs      3923: <div class="subsubsection">
1.37      cvs      3924: <h4><a name="sectd42146" id="sectd42146">Conditions on counters</a></h4>
1.1       cvs      3925: 
1.30      cvs      3926: <p>Presentation rules can apply when the counter's value is one, is even or
                   3927: odd, is equal, greater than or less than a given value or falls in a range of
1.37      cvs      3928: values. This is particularly useful for creating header and footer boxes.
1.18      cvs      3929: These conditions can be associated only with <a href="#sectc4232">creation
                   3930: rules</a>.</p>
1.30      cvs      3931: 
                   3932: <p>To compare the value of a counter to a given value, a comparison is given
1.1       cvs      3933: between parentheses. The comparison is composed of the counter name followed
                   3934: by an equals, greater than, or less than sign and the value to which the
1.37      cvs      3935: counter will be compared. A test for whether or not a counter's value falls
                   3936: in a range also appears within parentheses. In this case, the counter name is
1.18      cvs      3937: followed by the <tt>IN</tt> keyword and the range definition within brackets.
                   3938: The <tt>Even</tt>, <tt>Odd</tt> and <tt>One</tt> are used to test a counter's
                   3939: value and are followed by the counter name between parentheses.</p>
1.30      cvs      3940: 
                   3941: <p>The list of possible conditions on counters is:</p>
1.18      cvs      3942: <dl>
1.30      cvs      3943:   <dt><tt>Even (Counter)</tt></dt>
                   3944:     <dd>the box is created only if the counter has an even value.</dd>
                   3945:   <dt><tt>Odd (Counter)</tt></dt>
                   3946:     <dd>the box is created only if the counter has an odd value.</dd>
                   3947:   <dt><tt>One (Counter)</tt></dt>
                   3948:     <dd>the box is created only the counter's value is 1.</dd>
                   3949:   <dt><tt>NOT One (Counter)</tt></dt>
                   3950:     <dd>the box is created, unless the counter's value is 1.</dd>
                   3951:   <dt><tt>(Counter &lt; Value)</tt></dt>
                   3952:     <dd>the box is created only if the counter's value is less than
                   3953:     Value.</dd>
                   3954:   <dt><tt>(Counter &gt; Value)</tt></dt>
                   3955:     <dd>the box is created only if the counter's value is greater than
                   3956:     Value.</dd>
                   3957:   <dt><tt>(Counter = Value)</tt></dt>
                   3958:     <dd>the box is created only if the counter's value is equal to Value.</dd>
                   3959:   <dt><tt>NOT (Counter = Value)</tt></dt>
                   3960:     <dd>the is created only if the counter's value is different than
                   3961:     Value.</dd>
                   3962:   <dt><tt>(Counter IN [MinValue..MaxValue])</tt></dt>
                   3963:     <dd>the box is created only if the counter's value falls in the range
                   3964:       bounded by MinValue and MaxValue (inclusive).</dd>
                   3965:   <dt><tt>NOT (Counter IN [MinValue..MaxValue])</tt></dt>
                   3966:     <dd>the box is created only if the value of the counter does not fall in
                   3967:       the range bounded by MinValue and MaxValue (inclusive).</dd>
1.18      cvs      3968: </dl>
1.30      cvs      3969: 
                   3970: <p><strong>Note:</strong> the <tt>NOT Even</tt> and <tt>NOT Odd</tt>
                   3971: conditions are syntactically correct but can be expressed more simply by
                   3972: <tt>Odd</tt> and <tt>Even</tt>, respectively.</p>
1.18      cvs      3973: </div>
                   3974: </div>
1.1       cvs      3975: 
1.18      cvs      3976: <div class="subsection">
1.37      cvs      3977: <h3><a name="sectc4215" id="sectc4215">A presentation rule</a></h3>
1.1       cvs      3978: 
1.34      cvs      3979: <p>A presentation rule defines either a presentation property or presentation
1.37      cvs      3980: function. The properties are:</p>
1.18      cvs      3981: <ul>
1.30      cvs      3982:   <li>the position of the vertical and horizontal reference axes of the
                   3983:   box,</li>
                   3984:   <li>the position of the box in relation to other boxes,</li>
                   3985:   <li>the height or width of the box, with overflow exceptions,</li>
                   3986:   <li>the margins, padding and borders of the box,</li>
                   3987:   <li>the characteristics of the lines contained in the box: linespacing,
1.40      quint    3988:     indentation of the first line, hyphenation, writing direction</li>
1.30      cvs      3989:   <li>the conditions for breaking the box across pages,</li>
                   3990:   <li>the characteristics of the characters contained in the box: size, font,
                   3991:     style, underlining,</li>
                   3992:   <li>the depth of the box among overlapping boxes (often called stacking
                   3993:     order),</li>
                   3994:   <li>the characteristics of graphic elements contained in the box: style and
                   3995:     thickness of lines, fill pattern for closed objects,</li>
1.37      cvs      3996:   <li>the colors in text, graphics, pictures, and symbols contained in the
                   3997:     box are displayed or printed,</li>
1.48      quint    3998:   <li>the opacity of the element,</li>
1.30      cvs      3999:   <li>for presentation boxes only, the contents of the box.</li>
                   4000: </ul>
                   4001: 
1.37      cvs      4002: <p>The <a name="presfunct" id="presfunct">presentation functions</a> are:</p>
1.30      cvs      4003: <ul>
                   4004:   <li>the creation of a presentation box</li>
                   4005:   <li>the line-breaking or page-breaking style,</li>
                   4006:   <li>the copying of another box,</li>
                   4007:   <li>the display of the box background and border,</li>
                   4008:   <li>the display of a background picture and its aspect.</li>
                   4009: </ul>
                   4010: 
1.37      cvs      4011: <p>For each box and each view, every presentation property is defined once
                   4012: and only once, either explicitly or by the <a href="#sectc427">default
                   4013: rules</a>. In contrast, presentation functions are not obligatory and can
                   4014: appear many times for the same element. for example an element can create
                   4015: many presentation boxes. Another element may not use any presentation
1.18      cvs      4016: functions.</p>
1.30      cvs      4017: 
1.34      cvs      4018: <p>Each rule defining a presentation property begins with a keyword followed
1.37      cvs      4019: by a colon. The keyword indicates the property which is the subject of the
                   4020: rule. After the keyword and the colon, the remainder of the rule varies. All
1.18      cvs      4021: rules are terminated by a semicolon.</p>
1.34      cvs      4022: <pre>     Rule      = Property ';' / PresFunc ';' .
1.49    ! quint    4023:      Property  ='VertRef' ':'       HorizPosition /
        !          4024:                 'HorizRef' ':'      VertPosition /
1.6       cvs      4025:                 'VertPos' ':'       VPos /
                   4026:                 'HorizPos' ':'      HPos /
1.49    ! quint    4027:                 'Float' ':'         FloatInherit /
        !          4028:                 'Clear' ':'         ClearInherit /
1.6       cvs      4029:                 'Height' ':'        Dimension /
                   4030:                 'Width' ':'         Dimension /
                   4031:                 'VertOverflow' ':'  Boolean /
1.1       cvs      4032:                 'HorizOverflow' ':' Boolean /
1.26      cvs      4033:                 'MarginTop' ':'     MarginWidth /
                   4034:                 'MarginRight' ':'   MarginWidth /
                   4035:                 'MarginBottom' ':'  MarginWidth /
                   4036:                 'MarginLeft' ':'    MarginWidth /
                   4037:                 'PaddingTop' ':'    PaddingWidth /
                   4038:                 'PaddingRight' ':'  PaddingWidth /
                   4039:                 'PaddingBottom' ':' PaddingWidth /
                   4040:                 'PaddingLeft' ':'   PaddingWidth /
                   4041:                 'BorderTopWidth' ':' BorderWidth /
                   4042:                 'BorderRightWidth' ':' BorderWidth /
                   4043:                 'BorderBottomWidth' ':' BorderWidth /
                   4044:                 'BorderLeftWidth' ':' BorderWidth /
                   4045:                 'BorderTopColor' ':' BorderColor /
                   4046:                 'BorderRightColor' ':' BorderColor /
                   4047:                 'BorderBottomColor' ':' BorderColor /
                   4048:                 'BorderLeftColor' ':' BorderColor /
                   4049:                 'BorderTopStyle' ':' BorderStyle /
                   4050:                 'BorderRightStyle' ':' BorderStyle /
                   4051:                 'BorderBottomStyle' ':' BorderStyle /
                   4052:                 'BorderLeftStyle' ':' BorderStyle .
1.6       cvs      4053:                 'LineSpacing' ':'   DistanceInherit /
                   4054:                 'Indent' ':'        DistanceInherit /
                   4055:                 'Adjust' ':'        AdjustInherit /
                   4056:                 'Hyphenate' ':'     BoolInherit /
1.40      quint    4057:                 'Direction' ':'     DirInherit /
1.43      quint    4058:                 'UnicodeBidi' ':'   BidiInherit /
1.6       cvs      4059:                 'PageBreak' ':'     Boolean /
                   4060:                 'LineBreak' ':'     Boolean /
                   4061:                 'InLine' ':'        Boolean /
                   4062:                 'NoBreak1' ':'      AbsDist /
                   4063:                 'NoBreak2' ':'      AbsDist /
                   4064:                 'Gather' ':'        Boolean /
                   4065:                 'Visibility' ':'    NumberInherit /
                   4066:                 'Size'  ':'         SizeInherit /
                   4067:                 'Font' ':'          NameInherit /
                   4068:                 'Style' ':'         StyleInherit /
1.23      cvs      4069:                 'Weight' ':'        WeightInherit /
1.6       cvs      4070:                 'Underline' ':'     UnderLineInherit /
                   4071:                 'Thickness' ':'     ThicknessInherit /
                   4072:                 'Depth' ':'         NumberInherit /
                   4073:                 'LineStyle' ':'     LineStyleInherit /
                   4074:                 'LineWeight' ':'    DistanceInherit /
                   4075:                 'FillPattern' ':'   NameInherit /
                   4076:                 'Background' ':'    NameInherit /
1.13      cvs      4077:                 'Foreground' ':'    NameInherit /
1.47      quint    4078:                 'Opacity' ':'       OpacityInherit /
                   4079:                 'FillOpacity' ':'   OpacityInherit /
                   4080:                 'StrokeOpacity' ':' OpacityInherit /
1.6       cvs      4081:                 'Content' ':'       VarConst .
1.1       cvs      4082:      PresFunc = Creation '(' BoxID ')' /
                   4083:                 'Line' /
                   4084:                 'NoLine' /
                   4085:                 'Page' '(' BoxID ')' /
1.13      cvs      4086:                 'Copy' '(' BoxTypeToCopy ')' /
                   4087:                 'ShowBox' /
1.18      cvs      4088:                 'BackgroundPicture' ':' FileName /
                   4089:                 'PictureMode' ':'   PictMode /</pre>
                   4090: </div>
                   4091: 
                   4092: <div class="subsection">
1.37      cvs      4093: <h3><a name="sectc4216" id="sectc4216">Box axes</a></h3>
1.18      cvs      4094: 
1.30      cvs      4095: <p>The position of the middle axes <tt>VMiddle</tt> and <tt>HMiddle</tt> in
1.1       cvs      4096: relation to their box is always calculated automatically as a function of the
1.37      cvs      4097: height and width of the box and is not specified by the presentation rules.
                   4098: In the presentation schema, these middle axes are used only to position their
                   4099: box with respect to another by specifying the distance between the middle
                   4100: axis and an axis or a side of another box (see the <a
                   4101: href="#sectc4218">relative position</a>).</p>
                   4102: 
                   4103: <p>The reference axes of a box are also used to position their box in
                   4104: relation to another, but in contrast to the middle axes, the presentation
                   4105: schema must make their position explicit, either in relation to a side or the
                   4106: middle axis of the box itself, or in relation to an axis of an enclosed
                   4107: box.</p>
1.30      cvs      4108: 
1.37      cvs      4109: <p>Only boxes of base elements have predefined reference axes. For character
1.1       cvs      4110: string boxes, the horizontal reference axis is the baseline of the characters
                   4111: (the line which passes immediately under the upper-case letters, ignoring the
                   4112: letter Q) and the vertical reference axis is at the left edge of the first
1.18      cvs      4113: character of the string.</p>
1.30      cvs      4114: 
1.37      cvs      4115: <p>The positions of a box's reference axes are defined by the
                   4116: <tt>VertRef</tt> and <tt>HorizRef</tt> rules which specify the <a
                   4117: href="#distance">distance</a> between the reference axis and an axis or
                   4118: parallel side of the same box or of an enclosed box.</p>
1.49    ! quint    4119: <pre>               'VertRef'  ':' HorizPosition
        !          4120:                'HorizRef' ':' VertPosition</pre>
1.30      cvs      4121: 
1.18      cvs      4122: <blockquote class="example">
1.30      cvs      4123:   <p><strong>Example:</strong></p>
                   4124: 
                   4125:   <p>If, in the structure schema for mathematical formulas, the fraction
                   4126:   element is defined by</p>
                   4127:   <pre>Fraction = BEGIN
1.1       cvs      4128:            Numerator   = Expression;
                   4129:            Denominator = Expression;
1.18      cvs      4130:            END;</pre>
1.30      cvs      4131: 
                   4132:   <p>then the horizontal reference axis of the fraction can be positioned on
                   4133:   top of the denominator by the rule:</p>
                   4134:   <pre>Fraction :
1.1       cvs      4135:      BEGIN
                   4136:      HorizRef : Enclosed Denominator . Top;
                   4137:      ...
1.18      cvs      4138:      END;</pre>
1.30      cvs      4139: 
                   4140:   <p>To put the horizontal reference axis of a column at its middle:</p>
                   4141:   <pre>Column :
1.1       cvs      4142:      BEGIN
                   4143:      HorizRef : * . HMiddle;
                   4144:      ...
1.18      cvs      4145:      END;</pre>
                   4146: </blockquote>
                   4147: </div>
1.1       cvs      4148: 
1.18      cvs      4149: <div class="subsection">
1.37      cvs      4150: <h3><a name="sectc4217" id="sectc4217">Distance units</a></h3>
1.1       cvs      4151: 
1.30      cvs      4152: <p>Some distances and dimensions appear in many rules of a presentation
                   4153: schema, especially in position rules (<tt>VertPos, HorizPos</tt>), in extent
                   4154: rules for boxes (<tt>Height, Width</tt>), in rules defining lines
1.37      cvs      4155: (<tt>LineSpacing, Indent</tt>), in rules controlling pagination
                   4156: (<tt>NoBreak1, NoBreak2</tt>) and in rules specifying the thickness of
                   4157: strokes (<tt>LineWeight</tt>).</p>
1.30      cvs      4158: 
                   4159: <p>In all these rules, the distance or extent can be expressed</p>
                   4160: <ul>
                   4161:   <li>either in relative units, which depend on the size of the characters in
                   4162:     the current font: height of the element's font or height of the letter
                   4163:     'x',</li>
1.37      cvs      4164:   <li>or in absolute units: centimeter, millimeter, inch, typographer's
                   4165:     point, pica or pixel.</li>
1.30      cvs      4166: </ul>
                   4167: 
1.37      cvs      4168: <p>Units can be chosen freely. Thus, it is possible to use relative units in
1.30      cvs      4169: one rule, centimeters in the next rule, and typographer's points in
                   4170: another.</p>
                   4171: 
1.37      cvs      4172: <p>Absolute units are used to set rigid rules for the appearance of
                   4173: documents. In contrast, relative units allow changes of scale. The editor
                   4174: lets the value of relative units be changed dynamically. Such changes affect
                   4175: every box using relative units simultaneously and in the same proportion.
                   4176: Changing the value of the relative units affects the size of the characters
                   4177: and graphical elements, and the size of the boxes and the distances between
                   4178: them.</p>
                   4179: 
                   4180: <p>A <a name="distance" id="distance">distance</a> or extent is specified by
                   4181: a number, which may be followed by one or more spaces and a units keyword.
                   4182: When there is no units keyword, the number specifies the number of relative
                   4183: units, where a relative unit is the height of a character in the current font
                   4184: (an em). When the number is followed by a units keyword, the keyword
                   4185: indicates the type of absolute units:</p>
1.18      cvs      4186: <ul>
1.40      quint    4187:   <li><tt>em</tt> : height of the element's font,</li>
                   4188:   <li><tt>ex</tt> : height of the letter 'x',</li>
                   4189:   <li><tt>cm</tt> : centimeter,</li>
                   4190:   <li><tt>mm</tt> : millimeter,</li>
                   4191:   <li><tt>in</tt> : inch (1 in = 2.54 cm),</li>
                   4192:   <li><tt>pt</tt> : point (1 pt = 1/72 in),</li>
                   4193:   <li><tt>pc</tt> : pica (1 pc = 12 pt),</li>
                   4194:   <li><tt>px</tt> : pixel.</li>
1.18      cvs      4195: </ul>
1.30      cvs      4196: 
                   4197: <p>Whatever the chosen unit, relative or absolute, the number is not
1.37      cvs      4198: necessarily an integer and may be expressed in fixed point notation (using
                   4199: the American convention of a period to express the decimal point).</p>
1.30      cvs      4200: 
1.37      cvs      4201: <p>If the distance appears in a presentation rule for a numeric attribute,
                   4202: the number can be replaced by the name of an attribute. In this case, the
                   4203: value of the attribute is used. Obviously, the attribute name cannot be
                   4204: followed by a decimal point and a fractional part, but it can be followed a
                   4205: units keyword. However, the choice of units is limited to em, ex, pt and
                   4206: px.</p>
1.18      cvs      4207: <pre>     Distance      = [ Sign ] AbsDist .
1.1       cvs      4208:      Sign          ='+' / '-' .
                   4209:      AbsDist       = IntegerOrAttr [ '.' DecimalPart ]
                   4210:                      [ Unit ].
                   4211:      IntegerOrAttr = IntegerPart / AttrID .
                   4212:      IntegerPart   = NUMBER .
                   4213:      DecimalPart   = NUMBER .
                   4214:      Unit          ='em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' /
1.18      cvs      4215:                     'pc' / 'px' / '%' .</pre>
1.30      cvs      4216: 
1.18      cvs      4217: <blockquote class="example">
1.30      cvs      4218:   <p><strong>Example:</strong></p>
                   4219: 
                   4220:   <p>The following rules specify that a box has a height of 10.5 centimeters
                   4221:   and a width of 5.3 ems:</p>
                   4222:   <pre>Height : 10.5 cm;
1.18      cvs      4223: Width  : 5.3;</pre>
                   4224: </blockquote>
                   4225: </div>
1.1       cvs      4226: 
1.18      cvs      4227: <div class="subsection">
1.37      cvs      4228: <h3><a name="sectc4218" id="sectc4218">Relative positions</a></h3>
1.1       cvs      4229: 
1.37      cvs      4230: <p>The positioning of boxes uses the eight axes and sides, the sides
                   4231: generally being used to define the juxtapositioning (vertical or horizontal)
                   4232: of boxes, the middle axes being used to define centering, and the reference
                   4233: axes being used for alignment.</p>
                   4234: 
                   4235: <p>Two rules allow a box to be placed relative to other boxes. The
                   4236: <tt>VertPos</tt> rule positions the box vertically. The <tt>HorizPos</tt>
                   4237: rule positions the box horizontally. It is possible that a box's position
                   4238: could be entirely determined by other boxes positioned relative to it. In
                   4239: this case, the position is implicit and the word <tt>nil</tt> can be used to
                   4240: specify that no position rule is needed. Otherwise, an explicit rule must be
1.18      cvs      4241: given by indicating the axis or side which defines the position of the box,
                   4242: followed by an equals sign and the distance between between this axis or side
1.37      cvs      4243: and a parallel axis or side of another box, called the reference box. The box
1.18      cvs      4244: for which the rule is written will be positioned relative to the reference
                   4245: box.</p>
                   4246: <pre>                 'VertPos' ':' VPos
1.6       cvs      4247:                  'HorizPos' ':' HPos
                   4248:      HPos      = 'nil' / VertAxis '=' HorizPosition
                   4249:                  [ 'UserSpecified' ].
                   4250:      VPos      = 'nil' / HorizAxis '=' VertPosition
                   4251:                  [ 'UserSpecified' ].
1.1       cvs      4252:      VertAxis  = 'Left' / 'VMiddle' / 'VRef' / 'Right' .
1.18      cvs      4253:      HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .</pre>
1.30      cvs      4254: 
1.37      cvs      4255: <p>The reference box is an adjacent box: enclosing, enclosed or adjacent.
                   4256: When a rule is associated with a reference type attribute (and only in this
                   4257: case), it can be a box of the element designated by the attribute. The
                   4258: reference box can be either a presentation box previously defined in the
                   4259: <tt>BOXES</tt> section of the schema and created by a creation function, or
                   4260: the box associated with a structured element.</p>
                   4261: 
                   4262: <p>The structural position of the reference box (relative to the box for
                   4263: which the rule is being written) is indicated by a keyword:
                   4264: <tt>Enclosing</tt>, <tt>Enclosed</tt>, or, for sibling boxes,
                   4265: <tt>Previous</tt> or <tt>Next</tt>. The reference attributes, or presentation
                   4266: boxes created by a reference attribute, the <tt>Referred</tt> keyword may be
                   4267: used to designate the element which the reference points to. The keyword
                   4268: <tt>Creator</tt> can be used in rules for presentation boxes to designate the
                   4269: box of the element which created the presentation box. Finally, the
                   4270: <tt>Root</tt> keyword can be used to designate the root of the document.</p>
1.30      cvs      4271: 
                   4272: <p>When the keyword is ambiguous, it is followed by the name of an element
                   4273: type or presentation box which resolves the ambiguity (the <tt>Creator</tt>
1.37      cvs      4274: and <tt>Root</tt> keywords are never ambiguous). If this name is not given,
1.30      cvs      4275: then the first box encountered is used as the reference box. It is also
                   4276: possible to use just the name of an element type or presentation box without
1.37      cvs      4277: an initial keyword. In this case, a sibling having that name will be used. If
1.30      cvs      4278: the name is preceded by the keyword <tt>NOT</tt>, then the reference box will
                   4279: be the first box whose type is not the named one.</p>
                   4280: 
                   4281: <p>In place of the box or type name, the keywords <tt>AnyElem</tt>,
1.18      cvs      4282: <tt>AnyBox</tt> and <tt>ElemWithAttr</tt> can be used, representing
1.17      cvs      4283: respectively, any structured element box, any presentation box, and the box
                   4284: corresponding to any structured element having a particular attribute,
                   4285: whatever its value; the name of this attribute must follow the keyword
1.18      cvs      4286: <tt>ElemWithAttr</tt>.</p>
1.30      cvs      4287: 
                   4288: <p>A type name may be preceded by a star in order to resolve the ambiguity in
                   4289: the special case where the structure schema defines an <a
1.18      cvs      4290: href="#sectd3284">inclusion</a> without expansion (or with partial expansion)
1.37      cvs      4291: of the same type as an element of the scheme. For mark pairs (and only for <a
1.18      cvs      4292: href="#sectd3285">mark pairs</a>) the type name <em>must</em> be preceded by
                   4293: the <tt>First</tt> or <tt>Second</tt> keyword, which indicates which of the
1.37      cvs      4294: two marks of the pair should be used as the reference box.</p>
1.30      cvs      4295: 
                   4296: <p>The star character ('<tt>*</tt>') used alone designates the box to which
1.37      cvs      4297: the rule applies (in this case, it is obviously useless to specify the type
                   4298: of the reference box).</p>
1.30      cvs      4299: 
1.37      cvs      4300: <p>The keywords <tt>Enclosing</tt> and <tt>Enclosed</tt> can be used no
                   4301: matter what constructor defines the type to which the rule applies. When
                   4302: applied to the element which represents the entire document,
                   4303: <tt>Enclosing</tt> designates the window or page in which the document's
                   4304: image is displayed for the view to which the rule applies. A box or type name
                   4305: without a keyword is used for aggregate elements and designates another
                   4306: element of the same aggregate. It can also be used to designate a
                   4307: presentation or page layout box. The keywords <tt>Previous</tt> and
                   4308: <tt>Next</tt> are primarily used to denote list elements, but can also be
                   4309: used to denote elements of an aggregate.</p>
                   4310: 
                   4311: <p>In the position rule, the structural position relative to the reference
                   4312: box is followed, after a period, by the name of an axis or side. The rule
                   4313: specifies its node's position as being some distance from this axis or side
                   4314: of the reference box. If this distance is zero, then the distance does not
                   4315: appear in the rule. Otherwise, it does appear as a positive or negative
1.30      cvs      4316: number (the sign is required for negative numbers). The sign takes into
                   4317: account the orientation of the coordinate axes: for top to bottom for the
1.37      cvs      4318: vertical axis and from left to right for the horizontal axis. Thus, a
1.30      cvs      4319: negative distance in a vertical position indicates that the side or axis
                   4320: specified in the rule is above the side or axis of the reference box.</p>
                   4321: 
1.37      cvs      4322: <p>The distance can be followed by the <tt>UserSpecified</tt> keyword (even
                   4323: if the distance is nil and does not appear, the <tt>UserSpecified</tt>
                   4324: keyword can be used). It indicates that when the element to which the rule
                   4325: applies is being created, the editor will ask the user to specify the
                   4326: distance himself, using the mouse. In this case, the distance specified in
                   4327: the rule is a default distance which is suggested to the user but can be
                   4328: modified. The <tt>UserSpecified</tt> keyword can be used either in the
                   4329: vertical position rule, the horizontal position rule, or both.</p>
1.18      cvs      4330: <pre>     VertPosition  = Reference '.' HorizAxis [ Distance ] .
1.1       cvs      4331:      HorizPosition = Reference '.' VertAxis [ Distance ] .
                   4332:      Reference     ='Enclosing' [ BoxTypeNot ] /
                   4333:                     'Enclosed' [ BoxTypeNot ] /
                   4334:                     'Previous' [ BoxTypeNot ] /
                   4335:                     'Next' [ BoxTypeNot ] /
                   4336:                     'Referred' [ BoxTypeNot ] /
                   4337:                     'Creator' /
                   4338:                     'Root' /
                   4339:                     '*' /
                   4340:                      BoxOrType .
                   4341:      BoxOrType     = BoxID /
                   4342:                      [ '*' ] [ FirstSec ] ElemID /
1.17      cvs      4343:                     'AnyElem' / 'AnyBox' /
                   4344:                     'ElemWithAttr' AttrID .
1.18      cvs      4345:      BoxTypeNot    = [ 'NOT' ] BoxOrType .</pre>
1.30      cvs      4346: 
1.18      cvs      4347: <blockquote class="example">
1.30      cvs      4348:   <p><strong>Example:</strong></p>
                   4349: 
1.37      cvs      4350:   <p>If a <a name="expos1" id="expos1">report</a> is defined by the following
                   4351:   structure schema:</p>
1.30      cvs      4352:   <pre>Report = BEGIN
1.6       cvs      4353:          Title  = Text;
                   4354:          Summary = Text;
                   4355:          Keywords = Text;
                   4356:          ...
1.18      cvs      4357:          END;</pre>
1.30      cvs      4358: 
                   4359:   <p>then the presentation schema could contain the rules:</p>
                   4360:   <pre>Report : BEGIN
1.6       cvs      4361:          VertPos  : Top = Enclosing . Top;
                   4362:          HorizPos : Left = Enclosing . Left;
                   4363:          ...
1.18      cvs      4364:          END;</pre>
1.30      cvs      4365: 
1.37      cvs      4366:   <p>These rules place the <a name="reportexample"
                   4367:   id="reportexample">report</a> in the upper left corner of the enclosing
                   4368:   box, which is the window in which the document is being edited.</p>
1.30      cvs      4369:   <pre>Title :  BEGIN
1.6       cvs      4370:          VertPos  : Top = Enclosing . Top + 1;
                   4371:          HorizPos : VMiddle = Enclosing . VMiddle;
                   4372:          ...
1.18      cvs      4373:          END;</pre>
1.30      cvs      4374: 
1.37      cvs      4375:   <p>The top of the title is one line (a line has the height of the
                   4376:   characters of the title) from the top of the report, which is also the top
                   4377:   of the editing window. The title is centered horizontally in the window
                   4378:   (see <a href="#posdim">figure</a>).</p>
1.30      cvs      4379:   <pre>Summary : BEGIN
1.1       cvs      4380:           VertPos  : Top = Title . Bottom + 1.5;
                   4381:           HorizPos : Left = Enclosing . Left + 2 cm;
                   4382:           ...
1.18      cvs      4383:           END;</pre>
1.30      cvs      4384: 
1.37      cvs      4385:   <p>The top of the summary is place a line and a half below the bottom of
                   4386:   the title and is shifted two centimeters from the side of the window.</p>
1.18      cvs      4387: </blockquote>
1.30      cvs      4388: 
1.18      cvs      4389: <blockquote class="example">
1.30      cvs      4390:   <p><strong>Example:</strong></p>
                   4391: 
1.37      cvs      4392:   <p>Suppose there is a <a name="expos2" id="expos2">Design</a> logical
                   4393:   structure which contains graphical elements:</p>
1.30      cvs      4394:   <pre>Design = LIST OF (ElemGraph = GRAPHICS);</pre>
                   4395: 
                   4396:   <p>The following rules allow the user to freely choose the position of each
                   4397:   element when it is created:</p>
                   4398:   <pre>ElemGraph =
1.1       cvs      4399:    BEGIN
                   4400:    VertPos : Top = Enclosing . Top + 1 cm UserSpecified;
                   4401:    HorizPos: Left = Enclosing . Left UserSpecified;
                   4402:    ...
1.18      cvs      4403:    END;</pre>
1.30      cvs      4404: 
                   4405:   <p>Thus, when a graphical element is created, its default placement is at
                   4406:   the left of the window and 1 cm from the top, but the user can move it
                   4407:   immediately, simply by moving the mouse.</p>
1.18      cvs      4408: </blockquote>
                   4409: </div>
1.1       cvs      4410: 
1.18      cvs      4411: <div class="subsection">
1.49    ! quint    4412: <h3><a name="Floats" id="Floats">Floats</a></h3>
        !          4413: 
        !          4414: <p>Another way to set the position of a box is to make it a floating box. The
        !          4415: notion of a floating box is the same as in CSS2. Refer to the <a
        !          4416: href="http://www.w3.org/TR/REC-CSS2/visuren.html#floats">relevant section of
        !          4417: the CSS2 Recommendation</a> for the details. The <code>Float</code> and
        !          4418: <code>Clear</code> rules allow to control how floating boxes behave. The
        !          4419: values of these rules are the same as in CSS2. Inheritance is indicated by
        !          4420: <code>Enclosing =</code></p>
        !          4421: <pre>                    'Float' ':' FloatInherit
        !          4422:                     'Clear' ':' ClearInherit
        !          4423:      FloatInherit = Link '=' / 'Left' / 'Right' / 'None' .
        !          4424:      ClearInherit = Link '=' / 'None' / 'Left' / 'Right' / 'Both' .</pre>
        !          4425: </div>
        !          4426: 
        !          4427: <div class="subsection">
1.37      cvs      4428: <h3><a name="sectc4219" id="sectc4219">Box extents</a></h3>
1.1       cvs      4429: 
1.30      cvs      4430: <p>The extents (height and width) of each box are defined by the two rules
1.37      cvs      4431: <tt>Height</tt> and <tt>Width</tt>. There are three types of extents: fixed,
1.18      cvs      4432: relative, and elastic.</p>
1.1       cvs      4433: 
1.18      cvs      4434: <div class="subsubsection">
1.37      cvs      4435: <h4><a name="sectd42191" id="sectd42191">Fixed extents</a></h4>
1.1       cvs      4436: 
1.30      cvs      4437: <p>A fixed dimension sets the height or width of the box independently of all
1.37      cvs      4438: other boxes. It is expressed in <a href="#sectc4217">distance units</a>. The
1.18      cvs      4439: extent can be followed by the <tt>UserSpecified</tt> keyword which indicates
1.1       cvs      4440: that when the element to which the rule applies is being created, the editor
1.37      cvs      4441: will ask the user to specify the extent himself, using the mouse. In this
1.1       cvs      4442: case, the extent specified in the rule is a default extent which is suggested
1.37      cvs      4443: to the user but can be modified. The <tt>UserSpecified</tt> keyword can be
1.18      cvs      4444: used either in the <tt>Height</tt> rule, the <tt>Width</tt> rule, or both.</p>
1.30      cvs      4445: 
                   4446: <p>A fixed extent rule can be ended by the <tt>Min</tt> keyword, which
                   4447: signifies that the indicated value is a minimum, and that, if the contents of
                   4448: the box require it, a larger extent is possible.</p>
1.18      cvs      4449: <pre>                'Height' ':' Dimension
1.1       cvs      4450:                 'Width' ':' Dimension
                   4451:      Dimension = AbsDist [ 'UserSpecified' ]  [ 'Min' ] /
1.18      cvs      4452:                  ...</pre>
1.30      cvs      4453: 
1.18      cvs      4454: <blockquote class="example">
1.30      cvs      4455:   <p><strong>Example:</strong></p>
                   4456: 
                   4457:   <p>Continuing with the <a href="#expos2">previous example</a>, it is
                   4458:   possible to allow the user to choose the size of each graphical element as
                   4459:   it is created:</p>
                   4460:   <pre>ElemGraph : BEGIN
1.6       cvs      4461:             Width :  2 cm UserSpecified;
1.1       cvs      4462:             Height : 1 cm UserSpecified;
                   4463:             ...
1.18      cvs      4464:             END;</pre>
1.30      cvs      4465: 
                   4466:   <p>Thus, when a graphical element is create, it is drawn by default with a
                   4467:   width of 2 cm and a height of 1 cm, but the user is free to resize it
                   4468:   immediately with the mouse.</p>
                   4469:   <pre>Summary :  BEGIN
1.1       cvs      4470:            Height : 5 cm Min;
                   4471:            ...
                   4472:            END;
                   4473: Keywords : BEGIN
                   4474:            VertPos : Top = Summary . Bottom;
                   4475:            ...
1.18      cvs      4476:            END;</pre>
                   4477: </blockquote>
                   4478: </div>
1.1       cvs      4479: 
1.18      cvs      4480: <div class="subsubsection">
1.37      cvs      4481: <h4><a name="sectd42192" id="sectd42192">Relative extents</a></h4>
1.30      cvs      4482: 
                   4483: <p>A relative extent determines the extent as a function of the extent of
                   4484: another box, just as a relative position places a box in relation to another.
                   4485: The reference box in an extent rule is designated using the same syntax as is
1.37      cvs      4486: used in a relative position rule. It is followed by a period and a
1.30      cvs      4487: <tt>Height</tt> or <tt>Width</tt> keyword, depending on the extent being
1.37      cvs      4488: referred to. Next comes the relation between the extent being defined and the
                   4489: extent of the reference box. This relation can be either a percentage or a
1.30      cvs      4490: difference.</p>
1.1       cvs      4491: 
1.37      cvs      4492: <p>A percentage is indicated by a star (the multiplication symbol) followed
                   4493: by the numeric percentage value (which may be greater than or less than 100)
                   4494: and the percent (`%') character. A difference is simply indicated by a signed
1.18      cvs      4495: difference.</p>
1.30      cvs      4496: 
                   4497: <p>If the rule appears in the presentation rules of a numeric attribute, the
1.1       cvs      4498: percentage value can be replaced by the name of the attribute. This attribute
1.37      cvs      4499: is then used as a percentage. The attribute can also be used as part of a <a
1.18      cvs      4500: href="#distance">difference</a>.</p>
1.30      cvs      4501: 
                   4502: <p>Just as with a fixed extent, a relative extent rule can end with the
1.18      cvs      4503: <tt>Min</tt> keyword, which signifies that the extent is a minimum and that,
                   4504: if the contents of the box require it, a larger extent is possible.</p>
1.30      cvs      4505: 
                   4506: <p>A special case of relative extent rules is:</p>
1.18      cvs      4507: <pre>Height : Enclosed . Height;</pre>
1.30      cvs      4508: 
                   4509: <p>or</p>
1.18      cvs      4510: <pre>Width  : Enclosed . Width;</pre>
1.30      cvs      4511: 
                   4512: <p>which specifies that the box has a height (or width) such that it encloses
                   4513: all the boxes which it contains, excluding boxes having a rule
                   4514: <tt>VertOverflow: Yes;</tt> or <tt>HorizOverflow: Yes;</tt>.</p>
                   4515: 
                   4516: <p><strong>Note:</strong> character strings (type <tt>TEXT_UNIT</tt>)
                   4517: generally must use the sum of the widths of the characters which compose them
                   4518: as their width, which is expressed by the rule:</p>
1.18      cvs      4519: <pre>TEXT_UNIT :
                   4520:      Width : Enclosed . Width;</pre>
1.30      cvs      4521: 
                   4522: <p>If this rule is not the default <tt>Width</tt> rule, it must be given
1.18      cvs      4523: explicitly in the <tt>RULES</tt> section which defines the presentation rules
                   4524: of the logical elements.</p>
                   4525: <pre>                  'Height' ':' Extent
1.1       cvs      4526:                   'Width' ':' Extent
                   4527:      Extent      = Reference '.' HeightWidth [ Relation ]
                   4528:                    [ 'Min' ] / ...
                   4529:      HeightWidth ='Height' / 'Width' .
                   4530:      Relation    ='*' ExtentAttr '%' / Distance .
                   4531:      ExtentAttr  = ExtentVal / AttrID .
1.18      cvs      4532:      ExtentVal   = NUMBER .</pre>
1.30      cvs      4533: 
1.18      cvs      4534: <blockquote class="example">
1.30      cvs      4535:   <p><strong>Example:</strong></p>
                   4536: 
                   4537:   <p>Completing the <a href="#expos1">above example</a>, it is possible to
                   4538:   specify that the report takes its width from the editing window and its
                   4539:   height from the size of its contents (this can obviously be greater than
                   4540:   that of the window):</p>
                   4541:   <pre>Report :  BEGIN
1.1       cvs      4542:           Width : Enclosing . Width;
                   4543:           Height : Enclosed . Height;
                   4544:           ...
1.18      cvs      4545:           END;</pre>
1.30      cvs      4546: 
                   4547:   <p>Then, the following rules make the title occupy 60% of the width of the
                   4548:   report (which is that of the window) and is broken into centered lines of
                   4549:   this width (see the <a href="#sectc4222"><tt>Line</tt> rule</a>).</p>
                   4550:   <pre>Title :   BEGIN
1.1       cvs      4551:           Width : Enclosing . Width * 60%;
                   4552:           Height : Enclosed . Height;
                   4553:           Line;
                   4554:           Adjust : VMiddle;
                   4555:           ...
1.18      cvs      4556:           END;</pre>
1.30      cvs      4557: 
                   4558:   <p>The summary occupy the entire width of the window, with the exception of
                   4559:   a 2 cm margin reserved by the horizontal position rule:</p>
                   4560:   <pre>Summary : BEGIN
1.1       cvs      4561:           Width : Enclosing . Width - 2 cm;
                   4562:           Height : Enclosed . Height;
                   4563:           ...
1.18      cvs      4564:           END;</pre>
                   4565: 
1.37      cvs      4566:   <p>This set of rules, plus the <a href="#reportexample">position rules
                   4567:   given above</a>, produce the layout of boxes shown in the following<a
1.30      cvs      4568:   href="#posdim">figure</a>.</p>
                   4569: 
                   4570:   <div class="figure">
1.37      cvs      4571:   <hr />
1.30      cvs      4572:   <pre>-------------------------------------------------------------
1.1       cvs      4573: | Window and Report           ^                             |
                   4574: |                             | 1 line                      |
                   4575: |                             v                             |
                   4576: |           -------------------------------------           |
                   4577: |           |                                   |           |
                   4578: :    20%    :               Title               :    20%    :
1.30      cvs      4579: :&lt;---------&gt;:                                   :&lt;---------&gt;:
1.1       cvs      4580: :           :                60%                :           :
1.30      cvs      4581: :           :&lt;---------------------------------&gt;:           :
1.1       cvs      4582: |           |                                   |           |
                   4583: |           -------------------------------------           |
                   4584: |                             ^                             |
                   4585: |                             | 1.5 line                    |
                   4586: |                             |                             |
                   4587: |                             v                             |
                   4588: |        ---------------------------------------------------|
                   4589: |  2 cm  |                                                  |
1.30      cvs      4590: |&lt;------&gt;|                    Summary                       |
1.18      cvs      4591: :        :                                                  :</pre>
1.19      cvs      4592: 
1.37      cvs      4593:   <p align="center"><em><a name="posdim" id="posdim">Box position and
1.30      cvs      4594:   extent</a><em></em></em></p>
1.37      cvs      4595:   <hr />
1.30      cvs      4596:   </div>
1.18      cvs      4597: </blockquote>
                   4598: </div>
1.1       cvs      4599: 
1.18      cvs      4600: <div class="subsubsection">
1.37      cvs      4601: <h4><a name="sectd42193" id="sectd42193">Elastic extents</a></h4>
1.1       cvs      4602: 
1.37      cvs      4603: <p>The last type of extent is the elastic extent. Either one or both extents
                   4604: can be elastic. A box has an elastic extent when two opposite sides are
1.30      cvs      4605: linked by distance constraints to two sides or axes of other boxes.</p>
                   4606: 
                   4607: <p>One of the sides of the elastic box is linked by a position rule
1.37      cvs      4608: (<tt>VertPos</tt> or <tt>HorizPos</tt>) to a neighboring box. The other side
1.18      cvs      4609: is link to another box by a <tt>Height</tt> or <tt>Width</tt> rule, which
1.37      cvs      4610: takes the same form as the position rule. For the elastic box itself, the
1.1       cvs      4611: notions of sides (left or right, top or bottom) are fuzzy, since the movement
                   4612: of either one of the two reference boxes can, for example, make the left side
1.37      cvs      4613: of the elastic box move to the right of its right side. This is not
                   4614: important. The only requirement is that the two sides of the elastic box used
1.18      cvs      4615: in the position and extent rule are opposite sides of the box.</p>
                   4616: <pre>             'Height' ':' Extent
1.6       cvs      4617:              'Width' ':' Extent
1.18      cvs      4618:      Extent = HPos / VPos / ...</pre>
1.30      cvs      4619: 
1.18      cvs      4620: <blockquote class="example">
1.30      cvs      4621:   <p><strong>Example:</strong></p>
                   4622: 
                   4623:   <p>Suppose we want to draw an elastic arrow or line between the middle of
1.37      cvs      4624:   the bottom side of box A and the upper left corner of box B. To do this, we
1.30      cvs      4625:   would define a graphics box whose upper left corner coincides with the
                   4626:   middle of the bottom side of A (a position rule) and whose lower right
                   4627:   corner coincides with with the upper left corner of B (dimension rules):</p>
                   4628:   <pre>LinkedBox :
1.1       cvs      4629:    BEGIN
1.6       cvs      4630:    VertPos  : Top = A .Bottom;
1.1       cvs      4631:    HorizPos : Left = A . VMiddle;
1.6       cvs      4632:    Height   : Bottom = B . Top;
                   4633:    Width    : Right = B . Left;
1.18      cvs      4634:    END;</pre>
                   4635: </blockquote>
1.30      cvs      4636: 
1.18      cvs      4637: <blockquote class="example">
1.30      cvs      4638:   <p><strong>Example:</strong></p>
                   4639: 
                   4640:   <p>The element SectionTitle creates a presentation box called SectionNum
1.37      cvs      4641:   which contains the number of the section. Suppose we want to align the
                   4642:   SectionNum and SectionTitle horizontally, have the SectionNum take its
                   4643:   width from its contents (the section number), have the SectionTitle box
                   4644:   begin 0.5 cm to the right of the SectionNum box and end at the right edge
                   4645:   of its enclosing box. This would make the SectionTitle box elastic, since
                   4646:   its width is defined by the position of its left and right sides. The
                   4647:   following rules produce this effect:</p>
1.30      cvs      4648:   <pre>SectionNum :
1.1       cvs      4649:    BEGIN
                   4650:    HorizPos : Left = Enclosing . Left;
                   4651:    Width : Enclosed . Width;
                   4652:    ...
                   4653:    END;
                   4654: 
                   4655: SectionTitle :
                   4656:    BEGIN
                   4657:    HorizPos : Left = SectionNum . Right + 0.5 cm;
                   4658:    Width : Right = Enclosing . Right;
                   4659:    ...
1.18      cvs      4660:    END;</pre>
                   4661: </blockquote>
                   4662: </div>
                   4663: </div>
1.1       cvs      4664: 
1.18      cvs      4665: <div class="subsection">
1.37      cvs      4666: <h3><a name="sectc4220" id="sectc4220">Overflow</a></h3>
1.1       cvs      4667: 
1.48      quint    4668: <p>A box corresponding to a structural element normally contain all boxes
1.37      cvs      4669: corresponding to the elements of its subtree. However, in some cases, it
1.1       cvs      4670: could be necessary to allow a box to jut out from its parent box. Two
                   4671: presentation rules indicate that such an overflow is allowed, one for
1.18      cvs      4672: horizontal overflow, one for vertical overflow.</p>
1.30      cvs      4673: 
                   4674: <p>Each of these rules is expressed by a keyword followed by a colon and the
1.18      cvs      4675: keyword <tt>Yes</tt> or <tt>No</tt>.</p>
                   4676: <pre>               'VertOverflow' ':' Boolean /
1.1       cvs      4677:                'HorizOverflow' ':' Boolean .
1.18      cvs      4678:      Boolean = 'Yes' / 'No' .</pre>
                   4679: </div>
1.1       cvs      4680: 
1.48      quint    4681: <div>
                   4682: <h3><a name="Margins" id="Margins">Margins, Padding and Borders</a></h3>
1.30      cvs      4683: 
1.48      quint    4684: <p>Boxes (element boxes and presentation boxes as well) may have margins,
                   4685: padding and borders, exactly as in CSS. A set of presentation rules allow to
                   4686: control the width of margins, padding and borders along the four edges of
                   4687: boxes. Other rules determine the color and style of borders. Refer to the
                   4688: CSS2 specification for more details.</p>
1.26      cvs      4689: <pre>                'MarginTop' ':' MarginWidth /
                   4690:                 'MarginRight' ':' MarginWidth /
                   4691:                 'MarginBottom' ':' MarginWidth /
                   4692:                 'MarginLeft' ':' MarginWidth /
                   4693:                 'PaddingTop' ':' PaddingWidth /
                   4694:                 'PaddingRight' ':' PaddingWidth /
                   4695:                 'PaddingBottom' ':' PaddingWidth /
                   4696:                 'PaddingLeft' ':' PaddingWidth /
                   4697:                 'BorderTopWidth' ':' BorderWidth /
                   4698:                 'BorderRightWidth' ':' BorderWidth /
                   4699:                 'BorderBottomWidth' ':' BorderWidth /
                   4700:                 'BorderLeftWidth' ':' BorderWidth /
                   4701:                 'BorderTopColor' ':' BorderColor /
                   4702:                 'BorderRightColor' ':' BorderColor /
                   4703:                 'BorderBottomColor' ':' BorderColor /
                   4704:                 'BorderLeftColor' ':' BorderColor /
                   4705:                 'BorderTopStyle' ':' BorderStyle /
                   4706:                 'BorderRightStyle' ':' BorderStyle /
                   4707:                 'BorderBottomStyle' ':' BorderStyle /
                   4708:                 'BorderLeftStyle' ':' BorderStyle .
                   4709: 
                   4710: MarginWidth   = InheritParent / 'Auto' / Distance .
                   4711: PaddingWidth  = InheritParent / Distance .
                   4712: BorderWidth   = InheritParent / 'Thin' / 'Medium' / 'Thick' / Distance .
                   4713: BorderColor   = InheritParent / 'Transparent' / 'Foreground' /
                   4714:                 ColorName .
                   4715: BorderStyle   = InheritParent /
                   4716:                 'None' / 'Hidden' / 'Dotted' / 'Dashed' / 'Solid' /
                   4717:                 'Double' / 'Groove' / 'Ridge' / 'Inset' / 'Outset' .
1.27      cvs      4718: InheritParent = 'Enclosing' '=' / 'Creator' '=' .
1.26      cvs      4719: ColorName     =  NAME .</pre>
1.48      quint    4720: </div>
1.26      cvs      4721: 
1.18      cvs      4722: <div class="subsection">
1.37      cvs      4723: <h3><a name="sectc4221" id="sectc4221">Inheritance</a></h3>
1.1       cvs      4724: 
1.37      cvs      4725: <p>A presentation property can be defined by reference to the same property
                   4726: of another box in the tree of boxes. These structural links are expressed by
                   4727: kinship. The reference box can be that of the element immediately above in
1.18      cvs      4728: the structure (<tt>Enclosing</tt>), two levels above (<tt>GrandFather</tt>),
                   4729: immediately below (<tt>Enclosed</tt>) or immediately before
1.37      cvs      4730: (<tt>Previous</tt>). In the case of a presentation box, and only in that
1.1       cvs      4731: case, the reference box may be the element which created the presentation box
1.18      cvs      4732: (<tt>Creator</tt>).</p>
1.30      cvs      4733: 
                   4734: <p>Kinship is expressed in terms of the logical structure of the document and
1.37      cvs      4735: not in terms of the tree of boxes. The presentation box cannot transmit any
1.34      cvs      4736: of their properties by inheritance; only structured element boxes can do so.
1.37      cvs      4737: As an example, consider an element B which follows an element A in the
                   4738: logical structure. The element B creates a presentation box P in front of
                   4739: itself, using the <tt>CreateBefore</tt> rule (see the <a
                   4740: href="#sectc4232">creation rules</a>). If element B's box inherits its
                   4741: character style using the <tt>Previous</tt> kinship operation, it gets its
                   4742: character style from A's box, not from P's box. Inheritance works differently
                   4743: for positions and extents, which can refer to presentation boxes.</p>
1.30      cvs      4744: 
1.34      cvs      4745: <p>The inherited property value can be the same as that of the reference box.
1.37      cvs      4746: This is indicated by an equals sign. However, for numeric properties, a
1.1       cvs      4747: different value can be obtained by adding or subtracting a number from the
1.37      cvs      4748: reference box's property value. Addition is indicated by a plus sign before
                   4749: the number, while subtraction is specified with a minus sign. The value of a
1.34      cvs      4750: property can also be given a maximum (if the sign is a plus) or minimum (if
1.18      cvs      4751: the sign is a minus).</p>
1.30      cvs      4752: 
                   4753: <p>If the rule is being applied to a numeric attribute, the number to add or
1.37      cvs      4754: subtract can be replaced by the attribute name. The value of a maximum or
                   4755: minimum may also be replaced by an attribute name. In these cases, the value
1.18      cvs      4756: of the attribute is used.</p>
                   4757: <pre>  Inheritance    = Kinship  InheritedValue .
1.6       cvs      4758:   Kinship        ='Enclosing' / 'GrandFather' / 'Enclosed' /
                   4759:                   'Previous' / 'Creator' .
1.1       cvs      4760:   InheritedValue ='+' PosIntAttr [ 'Max' maximumA ] /
1.6       cvs      4761:                   '-' NegIntAttr [ 'Min' minimumA ] /
                   4762:                   '=' .
                   4763:   PosIntAttr     = PosInt / AttrID .
                   4764:   PosInt         = NUMBER .
                   4765:   NegIntAttr     = NegInt / AttrID .
                   4766:   NegInt         = NUMBER .
                   4767:   maximumA       = maximum / AttrID .
                   4768:   maximum        = NUMBER .
                   4769:   minimumA       = minimum / AttrID .
1.18      cvs      4770:   minimum        = NUMBER .</pre>
1.30      cvs      4771: 
1.36      cvs      4772: <p>The properties which can be obtained by inheritance are hyphenation,
1.43      quint    4773: writing direction, Unicode-bidi, interline spacing, character font (font
                   4774: family), font style, font size, visibility, indentation, underlining,
                   4775: alignment of text, stacking order of objects, the style and thickness of
                   4776: lines, fill pattern and the colors of lines and characters.</p>
1.18      cvs      4777: </div>
1.1       cvs      4778: 
1.18      cvs      4779: <div class="subsection">
1.37      cvs      4780: <h3><a name="sectc4222" id="sectc4222">Line breaking</a></h3>
1.1       cvs      4781: 
1.30      cvs      4782: <p>The <tt>Line</tt> rule specifies that the contents of the box should be
                   4783: broken into lines: the boxes included in the box to which this rule is
                   4784: attached are displayed one after the other, from left to right, with their
1.37      cvs      4785: horizontal reference axes aligned so that they form a series of lines. The
1.30      cvs      4786: length of these lines is equal to the width of the box to which the
                   4787: <tt>Line</tt> rule is attached.</p>
                   4788: 
                   4789: <p>When an included box overflows the current line, it is either carried
1.45      quint    4790: forward to the next line, broken, or left the way it is. The <a
1.18      cvs      4791: href="#sectc4223"><tt>LineBreak</tt> rule</a> is used to allow or prevent the
1.37      cvs      4792: breaking of included boxes. If the included box is not breakable but is
                   4793: longer than the space remaining on the line, it is left as is. When a
1.1       cvs      4794: character string box is breakable, the line is broken between words or, if
1.37      cvs      4795: necessary, by <a href="#sectd42225">hyphenating a word</a>. When a compound
                   4796: box is breakable, the box is transparent in regard to line breaking. The
                   4797: boxes included in the compound box are treated just like included boxes which
                   4798: have the <tt>LineBreak</tt> rule. Thus, it is possible to traverse a complete
1.18      cvs      4799: subtree of boxes to line break the text leaves of a complex structure.</p>
1.30      cvs      4800: 
                   4801: <p>The relative position rules of the included boxes are ignored, since the
                   4802: boxes will be placed according to the line breaking rules.</p>
                   4803: 
1.37      cvs      4804: <p>The <tt>Line</tt> rule does not have a parameter. The characteristics of
                   4805: the lines that will be constructed are determined by the
1.43      quint    4806: <tt>LineSpacing</tt>, <tt>Indent</tt>, <tt>Adjust</tt>, <tt>Hyphenate</tt>,
                   4807: <code>Direction</code> and <code>UnicodeBidi</code> rules. Moreover, the <a
1.37      cvs      4808: href="#insectd42226"><tt>Inline</tt> rule</a> permits the exclusion of
1.36      cvs      4809: certain elements from the line breaking process.</p>
1.30      cvs      4810: 
                   4811: <p>When the <tt>Line</tt> rule appears in the rules sequence of a non-primary
1.37      cvs      4812: view, it applies only to that view, but when the <tt>Line</tt> rule appears
                   4813: in the rules sequence of the primary view, it also applies to the other views
                   4814: by default, except for those views which explicitly invoke the
                   4815: <tt>NoLine</tt> rule. Thus, the <tt>NoLine</tt> rule can be used in a
                   4816: non-primary view to override the primary view's <tt>Line</tt> rule. The
                   4817: <tt>NoLine</tt> rule must not be used with the primary view because the
                   4818: absence of the <tt>Line</tt> rule has the same effect. Like the <tt>Line</tt>
                   4819: rule, the <tt>NoLine</tt> rule does not take any parameters.</p>
1.18      cvs      4820: <pre>              'Line'
                   4821:               'NoLine'</pre>
                   4822: 
                   4823: <div class="subsubsection">
1.37      cvs      4824: <h4><a name="sectd42221" id="sectd42221">Line spacing</a></h4>
1.18      cvs      4825: 
1.30      cvs      4826: <p>The <tt>LineSpacing</tt> rule defines the line spacing to be used in the
1.37      cvs      4827: line breaking process. The line spacing is the distance between the baselines
1.1       cvs      4828: (horizontal reference axis) of the successive lines produced by the
1.37      cvs      4829: <tt>Line</tt> rule. The value of the line spacing can be specified as a
                   4830: constant or by inheritance. It is expressed in any of the available <a
1.18      cvs      4831: href="#sectc4217">distance units</a>.</p>
1.30      cvs      4832: 
                   4833: <p>Inheritance allows the value to be obtained from a relative in the
                   4834: structure tree, either without change (an equals sign appears after the
                   4835: inheritance keyword), with a positive difference (a plus sign), or a negative
1.37      cvs      4836: difference (a minus sign). When the rule uses a difference, the value of the
1.30      cvs      4837: difference follows the sign and is expressed as a <a
                   4838: href="#sectc4217">distance</a>.</p>
1.18      cvs      4839: <pre>                     'LineSpacing' ':' DistOrInherit
1.6       cvs      4840:      DistOrInherit =  Kinship InheritedDist / Distance .
1.18      cvs      4841:      InheritedDist = '=' / '+' AbsDist / '-' AbsDist .</pre>
1.30      cvs      4842: 
                   4843: <p>When the line spacing value (or its difference from another element) is
1.37      cvs      4844: expressed in relative units, it changes with the size of the characters.
                   4845: Thus, when a larger font is chosen for a part of the document, the line
                   4846: spacing of that part expands proportionally. In contrast, when the line
                   4847: spacing value is expressed in absolute units (centimeters, inches,
                   4848: typographer's points), it is independent of the characters, which permits the
                   4849: maintenance of a consistent line spacing, whatever the character font. Either
                   4850: approach can be taken, depending on the desired effect.</p>
1.18      cvs      4851: </div>
1.1       cvs      4852: 
1.18      cvs      4853: <div class="subsubsection">
1.37      cvs      4854: <h4><a name="sectd42222" id="sectd42222">First line indentation</a></h4>
1.1       cvs      4855: 
1.30      cvs      4856: <p>The <tt>Indent</tt> rule is used to specify the indentation of the first
                   4857: line of the elements broken into lines by the <tt>Line</tt> function. The
1.1       cvs      4858: indentation determines how far the first line of the element is shifted with
1.37      cvs      4859: respect to the other lines of the same element. It can be specified as a
                   4860: constant or by inheritance. The constant value is a positive integer (shifted
1.1       cvs      4861: to the right; the sign is optional), a negative integer (shifted to the left)
1.37      cvs      4862: or zero (no shift). All available <a href="#sectc4217">units</a> can be
1.18      cvs      4863: used.</p>
1.30      cvs      4864: 
                   4865: <p>Indentation can be defined for any box, regardless of whether the box is
                   4866: line broken, and transmitted by inheritance to elements that are line broken.
                   4867: The size of the indentation is specified in the same manner as the <a
1.18      cvs      4868: href="#sectd42221">line spacing</a>.</p>
                   4869: <pre>              'Indent' ':' DistOrInherit</pre>
                   4870: </div>
1.1       cvs      4871: 
1.18      cvs      4872: <div class="subsubsection">
1.37      cvs      4873: <h4><a name="sectd42223" id="sectd42223">Alignment</a></h4>
1.1       cvs      4874: 
1.30      cvs      4875: <p>The alignment style of the lines constructed during line breaking is
1.37      cvs      4876: defined by the <tt>Adjust</tt> rule. The alignment value can be a constant or
                   4877: inherited. A constant value is specified by a keyword:</p>
1.18      cvs      4878: <ul>
1.40      quint    4879:   <li><tt>Left</tt> : at the left edge,</li>
                   4880:   <li><tt>Right</tt> : at the right edge,</li>
                   4881:   <li><tt>VMiddle</tt> : centered</li>
                   4882:   <li><tt>Justify</tt> : justified</li>
                   4883:   <li><tt>LeftWithDots</tt> : at the left edge with a dotted line filling out
                   4884:     the last line up to the right edge of the line breaking box.</li>
1.18      cvs      4885: </ul>
1.30      cvs      4886: 
1.37      cvs      4887: <p>An inherited value can only be the same as that of the reference box and
                   4888: is specified by a kinship keyword followed by an equals sign.</p>
1.18      cvs      4889: <pre>                      'Adjust' ':' AlignOrInherit
1.1       cvs      4890:      AlignOrInherit = Kinship '=' / Alignment .
1.35      cvs      4891:      Alignment      = 'Left' / 'Right' / 'VMiddle' / 'Justify' /
1.18      cvs      4892:                       'LeftWithDots' .</pre>
                   4893: </div>
1.1       cvs      4894: 
1.18      cvs      4895: <div class="subsubsection">
1.37      cvs      4896: <h4><a name="sectd42225" id="sectd42225">Hyphenation</a></h4>
1.18      cvs      4897: 
1.37      cvs      4898: <p>The <tt>Hyphenate</tt> rule indicates whether or not words should be
                   4899: broken by hyphenation at the end of lines. It affects the lines produced by
                   4900: the <tt>Line</tt> rule and contained in the box carrying the
                   4901: <tt>Hyphenate</tt> rule.</p>
1.30      cvs      4902: 
1.34      cvs      4903: <p>The hyphenation property takes a boolean value, which can be either
1.37      cvs      4904: constant or inherited. A constant boolean value is expressed by either the
                   4905: <tt>Yes</tt> or the <tt>No</tt> keyword. An inherited value can only be the
1.1       cvs      4906: same as that of the reference box and is specified by a kinship keyword
1.18      cvs      4907: followed by an equals sign.</p>
                   4908: <pre>                   'Hyphenate' ':' BoolInherit
1.1       cvs      4909:      BoolInherit = Boolean / Kinship '=' .
1.18      cvs      4910:      Boolean     = 'Yes' / 'No' .</pre>
                   4911: </div>
                   4912: 
                   4913: <div class="subsubsection">
1.40      quint    4914: <h4><a name="sectd422251" id="sectd422251">Writing direction</a></h4>
                   4915: 
                   4916: <p>The <tt>Direction</tt> rule indicates the directionality of text: from
                   4917: left to right, as for latin scripts, or from right to left, as for the Arabic
1.43      quint    4918: or Hebrew scripts. This is used by the Unicode bidirectional algorithm.</p>
1.40      quint    4919: 
                   4920: <p>The writing direction property takes either a constant value
                   4921: (<code>ltr</code> for left to right, or <code>rtl</code> for right to left)
                   4922: or it is inherited. If it is inherited, it can only be the same as that of
                   4923: the reference box and is specified by a kinship keyword followed by an equals
                   4924: sign.</p>
                   4925: <pre>                   'Direction' ':' DirInherit
                   4926:      DirInherit =  'ltr' / 'rtl' / Kinship '=' .</pre>
                   4927: </div>
                   4928: 
1.43      quint    4929: <p>The <code>UnicodeBidi</code> rule is the equivalent of the CSS2
                   4930: <code>unicode-bidi</code> property. It takes the same values and acts in the
                   4931: same way.</p>
                   4932: <pre>                   'Direction' ':' BidiInherit
                   4933:      BidiInherit = 'Normal' / 'Embed' / 'Override' / Kinship '=' .</pre>
1.40      quint    4934: 
                   4935: <div class="subsubsection">
1.37      cvs      4936: <h4><a name="sectd42226" id="sectd42226">Avoiding line breaking</a></h4>
1.18      cvs      4937: 
1.37      cvs      4938: <p>The <tt>InLine</tt> rule is used to specify that a box that would
                   4939: otherwise participate in line breaking asked for by the <tt>Line</tt> rule of
                   4940: an enclosing box, instead avoids the line breaking process and positions
                   4941: itself according to the <tt>HorizPos</tt> and <tt>VertPos</tt> rules that
                   4942: apply to it. When the <tt>InLine</tt> rule applies to a box which would not
                   4943: be line broken, it has no effect.</p>
1.30      cvs      4944: 
                   4945: <p>The rule is expressed by the <tt>InLine</tt> keyword followed by a colon
                   4946: and the keyword <tt>Yes</tt>, if the box should participate in line breaking,
1.37      cvs      4947: or the keyword <tt>No</tt>, if it should not. This is the only form possible:
                   4948: this rule cannot be inherited. Moreover, it can only appear in the rules of
1.1       cvs      4949: the primary view and applies to all views defined in the presentation
1.18      cvs      4950: schema.</p>
                   4951: <pre>               'InLine' ':' Boolean .
                   4952:      Boolean = 'Yes' / 'No' .</pre>
1.30      cvs      4953: 
1.18      cvs      4954: <blockquote class="example">
1.30      cvs      4955:   <p><strong>Example:</strong></p>
                   4956: 
                   4957:   <p>Suppose the structure schema defines a logical attribute called
1.37      cvs      4958:   <tt>New</tt> which is used to identify the passages in a document which
                   4959:   were recently modified. It would be nice to have the presentation schema
                   4960:   make a bar appear in the left margin next to each passage having the
                   4961:   <tt>New</tt> attribute. A new passage can be an entire element, such as a
                   4962:   paragraph or section, or it can be some words in the middle of a paragraph.
                   4963:   To produce the desired effect, the <tt>New</tt> attribute is given a
                   4964:   creation rule which generates a <tt>VerticalBar</tt> presentation box.</p>
1.30      cvs      4965: 
                   4966:   <p>When the <tt>New</tt> attribute is attached to a character string which
                   4967:   is inside a line broken element (inside a paragraph, for example), the bar
                   4968:   is one of the elements which participates in line breaking and it is placed
                   4969:   normally in the current line, at the end of the character string which has
1.37      cvs      4970:   the attribute. To avoid this, the <tt>InLine</tt> rule is used in the
1.30      cvs      4971:   following way:</p>
                   4972:   <pre>BOXES
1.1       cvs      4973:   VerticalBar:
                   4974:      BEGIN
                   4975:      Content: Graphics 'l';
                   4976:      HorizPos: Left = Root . Left;
                   4977:      VertPos: Top = Creator . Top;
                   4978:      Height: Bottom = Creator . Bottom;
                   4979:      Width: 1 pt;
                   4980:      InLine: No;
                   4981:      ...
                   4982:      END;
                   4983: ...
                   4984: ATTRIBUTES
                   4985:   Nouveau:
                   4986:      BEGIN
                   4987:      CreateAfter(VerticalBar);
1.18      cvs      4988:      END;</pre>
                   4989: </blockquote>
                   4990: </div>
                   4991: </div>
1.1       cvs      4992: 
1.18      cvs      4993: <div class="subsection">
1.37      cvs      4994: <h3><a name="sectc4223" id="sectc4223">Page breaking and line breaking
                   4995: conditions</a></h3>
1.1       cvs      4996: 
1.30      cvs      4997: <p>Pages are constructed by the editor in accordance with the model specified
1.37      cvs      4998: by a <a href="#sectc4233"><tt>Page</tt> rule</a>. The page model describes
1.30      cvs      4999: only the composition of the pages but does not give any rules for breaking
1.37      cvs      5000: different element types across pages. Now, it is possible that certain
                   5001: elements must not be cut by page breaks, while others can be cut anywhere.
                   5002: The <tt>PageBreak</tt>, <tt>NoBreak1</tt>, and <tt>NoBreak2</tt> rules are
                   5003: used to specify the conditions under which each element type can be cut.</p>
1.30      cvs      5004: 
                   5005: <p>The <tt>PageBreak</tt> rule is used to indicate whether or not the box can
1.37      cvs      5006: be cut during the construction of pages. If cutting is authorized, the box
                   5007: can be cut, with one part appearing at the bottom of a page and the other
                   5008: part appearing at the top of the next page. The rule is formed by the
1.18      cvs      5009: <tt>PageBreak</tt> keyword followed by a colon and a constant boolean value
1.37      cvs      5010: (<tt>Yes</tt> or <tt>No</tt>). This is the only form possible: this rule
                   5011: cannot be inherited. Moreover, it can only appear in the rules of the primary
1.18      cvs      5012: view and applies to all views defined in the presentation schema.</p>
1.30      cvs      5013: 
                   5014: <p>Whether objects can be cut by line breaks can be controlled in a similar
1.37      cvs      5015: way using the <tt>LineBreak</tt> rule. This rule allows the specification of
                   5016: whether or not the box can be cut during the construction of lines. If
1.1       cvs      5017: cutting is authorized, the box can be cut, with one part appearing at the end
1.37      cvs      5018: of a line and the other part appearing at the beginning of the next line. The
1.18      cvs      5019: rule is formed by the <tt>LineBreak</tt> keyword followed by a colon and a
1.37      cvs      5020: constant boolean value (<tt>Yes</tt> or <tt>No</tt>). This is the only form
                   5021: possible: this rule cannot be inherited. Moreover, it can only appear in the
                   5022: rules of the primary view and applies to all views defined in the
                   5023: presentation schema.</p>
1.18      cvs      5024: <pre>               'PageBreak' ':' Boolean .
1.1       cvs      5025:                'LineBreak' ':' Boolean .
1.18      cvs      5026:      Boolean = 'Yes' / 'No' .</pre>
1.30      cvs      5027: 
                   5028: <p>When a box can be cut by a page break, it is possible that a page break
                   5029: will fall an inappropriate spot, creating, for example, a widow or orphan, or
1.37      cvs      5030: separating the title of a section from the first paragraph of the section.
                   5031: The <tt>NoBreak1</tt> and <tt>NoBreak2</tt> rules are used to avoid this.
                   5032: They specify that the box of the element to which they apply cannot be cut
                   5033: within a certain zone at the top (<tt>NoBreak1</tt> rule) or at the bottom
                   5034: (<tt>NoBreak2</tt> rule). These two rules specify the height of the zones in
1.18      cvs      5035: which page breaks are prohibited.</p>
1.30      cvs      5036: 
                   5037: <p>The <tt>NoBreak1</tt> and <tt>NoBreak2</tt> rules give the height of the
1.37      cvs      5038: zone in which page breaking is prohibited. The height is given as a constant
1.30      cvs      5039: value using any of the <a href="#sectc4217">available units</a>, absolute or
1.37      cvs      5040: relative. The value may not be inherited.</p>
1.18      cvs      5041: <pre>                   'NoBreak1' ':' AbsDist .
                   5042:                    'NoBreak2' ':' AbsDist .</pre>
1.30      cvs      5043: 
1.18      cvs      5044: <blockquote class="example">
1.30      cvs      5045:   <p><strong>Example:</strong></p>
                   5046: 
                   5047:   <p>The following rules prevent widows and orphans in a paragraph:</p>
                   5048:   <pre>Paragraph :
1.1       cvs      5049:    BEGIN
                   5050:    NoBreak1 : 2;
                   5051:    NoBreak2 : 2;
1.18      cvs      5052:    END;</pre>
1.30      cvs      5053: 
1.37      cvs      5054:   <p>This rule prevents a section title from becoming separated from the
                   5055:   first paragraph of the section by prohibiting page breaks at the beginning
                   5056:   of the section rule:</p>
1.30      cvs      5057:   <pre>Section :
1.18      cvs      5058:    NoBreak1 : 1.5 cm;</pre>
1.30      cvs      5059: 
                   5060:   <p>Finally, this rule prevents a figure from being page broken in any
                   5061:   way:</p>
                   5062:   <pre>Figure :
1.18      cvs      5063:    PageBreak : No;</pre>
                   5064: </blockquote>
1.30      cvs      5065: 
                   5066: <p>The Thot editor constructs the document images displayed on the screen
1.37      cvs      5067: dynamically. As the user moves in the document or makes the document scroll
1.1       cvs      5068: in a window, the editor constructs the image to be displayed in little bits,
1.37      cvs      5069: filling the gaps which are produced in the course of these operations. It
1.1       cvs      5070: stops filling in the image when an element reaches the edge of the window in
1.37      cvs      5071: which the gap appears. If the appearance of the document is complex, it is
1.1       cvs      5072: possible that the image in incomplete, even though the edge of the window was
1.37      cvs      5073: reached. For example, an element might need to be presented to the side of
                   5074: the last element displayed, but its image was not constructed. The user will
1.1       cvs      5075: not know whether the element is really absent or if its image has simply not
1.18      cvs      5076: been constructed.</p>
1.30      cvs      5077: 
1.37      cvs      5078: <p>The <tt>Gather</tt> rule is used to remedy this problem. When the rule
1.18      cvs      5079: <tt>Gather : Yes;</tt> is associated with an element type, the image of such
                   5080: elements is constructed as a block by the editor: it is never split up.</p>
1.30      cvs      5081: 
                   5082: <p>The <tt>Gather</tt> rule may not appear in the <a href="#sectc427">default
1.37      cvs      5083: rules</a>. Elements which do not have the <tt>Gather</tt> rule are considered
                   5084: susceptible to being split up during display. Thus, it is not necessary to
1.18      cvs      5085: use the <tt>Gather : No;</tt> form. This rule must be used prudently and only
1.37      cvs      5086: for those elements which truly need it. If used incorrectly, it can
1.18      cvs      5087: pointlessly increase the size of the image constructed by the editor and lead
                   5088: to excessive memory consumption by the editor.</p>
1.30      cvs      5089: 
                   5090: <p>Like the <tt>PageBreak</tt> and <tt>LineBreak</tt> rules, the
                   5091: <tt>Gather</tt> rule can only appear in rules of the primary view and applies
                   5092: to all views defined in the presentation schema.</p>
1.18      cvs      5093: <pre>                   'Gather' ':' Boolean .</pre>
                   5094: </div>
1.1       cvs      5095: 
1.18      cvs      5096: <div class="subsection">
1.37      cvs      5097: <h3><a name="sectc4224" id="sectc4224">Visibility</a></h3>
1.1       cvs      5098: 
1.34      cvs      5099: <p>The visibility property is used to control which elements should or should
1.37      cvs      5100: not be displayed, based on context. An element can have different
                   5101: visibilities in different views. If an element's visibility is zero for a
                   5102: view, that element is not displayed in that view and does not occupy any
                   5103: space (its extents are zero).</p>
1.30      cvs      5104: 
1.37      cvs      5105: <p>Visibility takes non-negative integer values (positive or zero). If values
1.1       cvs      5106: greater than 1 are used, they allow the user to choose a degree of visibility
1.37      cvs      5107: and, thus, to see only those boxes whose visibility property exceeds a
                   5108: certain threshold. This gives the user control over the granularity of the
                   5109: displayed pictures.</p>
1.30      cvs      5110: 
1.34      cvs      5111: <p>The visibility property can be defined as a constant or by inheritance. If
1.1       cvs      5112: defined by inheritance, it cannot be based on the value of the next or
1.37      cvs      5113: previous box. Visibility can only be inherited from above.</p>
1.30      cvs      5114: 
                   5115: <p>If it is a numeric attribute's presentation rule, the visibility can be
1.37      cvs      5116: specified by the attribute's name, in which case the value of the attribute
                   5117: is used.</p>
1.18      cvs      5118: <pre>                   'Visibility' ':' NumberInherit
1.1       cvs      5119:      NumberInherit = Integer / AttrID / Inheritance .
1.18      cvs      5120:      Integer       = NUMBER .</pre>
1.30      cvs      5121: 
1.18      cvs      5122: <blockquote class="example">
1.30      cvs      5123:   <p><strong>Example:</strong></p>
                   5124: 
                   5125:   <p>Suppose that only <tt>Formula</tt> elements should be displayed in the
1.37      cvs      5126:   <tt>MathView</tt> view. Then, the default rules should include:</p>
1.30      cvs      5127:   <pre>DEFAULT
1.18      cvs      5128:      IN MathView Visibility:0;</pre>
1.30      cvs      5129: 
1.31      cvs      5130:   <p>which makes all elements invisible in the <tt>MathView</tt> view.
1.30      cvs      5131:   However, the <tt>Formula</tt> element also has a <tt>Visibility</tt>
                   5132:   rule:</p>
                   5133:   <pre>Formula :
1.18      cvs      5134:      IN MathView Visibility:5;</pre>
1.30      cvs      5135: 
                   5136:   <p>which makes formulas, and only formulas, visible.</p>
1.18      cvs      5137: </blockquote>
                   5138: </div>
1.1       cvs      5139: 
1.18      cvs      5140: <div class="subsection">
1.37      cvs      5141: <h3><a name="sectc4225" id="sectc4225">Character style properties</a></h3>
1.1       cvs      5142: 
1.34      cvs      5143: <p>Four properties are used to determine which characters are used to display
1.37      cvs      5144: text. They are size, font, style, and underlining.</p>
1.1       cvs      5145: 
1.18      cvs      5146: <div class="subsubsection">
1.37      cvs      5147: <h4><a name="sectd42251" id="sectd42251">Character size</a></h4>
1.30      cvs      5148: 
1.37      cvs      5149: <p>The size property has two effects. First, it is used to specify the actual
1.34      cvs      5150: size and distance units for boxes defined in <a href="#sectc4217">relative
1.37      cvs      5151: units</a>. Second, it defines the size of the characters contained in the
1.34      cvs      5152: box.</p>
1.1       cvs      5153: 
1.30      cvs      5154: <p>As a distance or length, the size can be expressed in abstract or absolute
1.37      cvs      5155: units. It can also be inherited. If it is not inherited, it is expressed
                   5156: simply as an integer followed by the <tt>pt</tt> keyword, which indicates
                   5157: that the size is expressed in typographer's points. The absence of the
                   5158: <tt>pt</tt> keyword indicates that it is in abstract units in which the value
                   5159: 1 represents the smallest size while the value 16 is the largest size. The
                   5160: relationship between these abstract sizes and the real character sizes is
                   5161: controlled by a table which can be modified statically or even dynamically
                   5162: during the execution of the Thot editor.</p>
1.30      cvs      5163: 
                   5164: <p>If the <tt>Size</tt> rule is a numeric attribute's presentation rule, the
1.34      cvs      5165: value of the size property can be specified by the attribute's name, in which
1.30      cvs      5166: case the value of the attribute is used.</p>
                   5167: 
1.37      cvs      5168: <p><strong>Note:</strong> the only unit available for defining an absolute
                   5169: size is the typographer's point. Centimeters and inches may not be used.</p>
1.30      cvs      5170: 
                   5171: <p>If the size is inherited, the rule must specify the relative from which to
                   5172: inherit and any percentage or difference from that relative's value. A
                   5173: percentage is indicated by a <tt>*</tt> followed by the value of the
                   5174: percentage and a <tt>%</tt>. A difference can be expressed in either
                   5175: typographer's points or in abstract units and the maximum or minimum size can
1.37      cvs      5176: be specified, but without specifying the unit: it is the same as was
                   5177: specified for the difference.</p>
1.30      cvs      5178: 
                   5179: <p>In a numeric attribute's presentation rule, the difference in size or the
1.22      cvs      5180: percentage can be indicated by the attribute's name instead of the numeric
1.37      cvs      5181: value, which means that the attribute's value should be used as the
                   5182: difference or percentage. The attribute can also be used as the minimum or
                   5183: maximum size for a difference.</p>
1.22      cvs      5184: <pre>                      'Size' ':' SizeInherit
                   5185:      SizeInherit     = SizeAttr [ 'pt' ] /
                   5186:                        Kinship InheritedSize .
                   5187:      InheritedSize   ='+' SizeAttr [ 'pt' ]
                   5188:                        [ 'Max' MaxSizeAttr ] /
                   5189:                       '-' SizeAttr [ 'pt' ]
                   5190:                        [ 'Min' MinSizeAttr ] /
                   5191:                       '*' PercentSizeAttr '%' /
                   5192:                       '=' .
                   5193:      SizeAttr        = Size / AttrID .
                   5194:      Size            = NUMBER .
                   5195:      MaxSizeAttr     = MaxSize / AttrID .
                   5196:      MaxSize         = NUMBER .
                   5197:      MinSizeAttr     = MinSize / AttrID .
                   5198:      MinSize         = NUMBER .
                   5199:      PercentSizeAttr = PercentSize / AttrID .
                   5200:      PercentSize     = NUMBER .</pre>
1.30      cvs      5201: 
1.18      cvs      5202: <blockquote class="example">
1.30      cvs      5203:   <p><strong>Example:</strong></p>
                   5204: 
                   5205:   <p>The rule</p>
                   5206:   <pre>Size : Enclosing - 2 pt Min 7;</pre>
                   5207: 
                   5208:   <p>states that the character size is 2 points less than that of the
                   5209:   enclosing box, but that it may not be less than 7 points, whatever the
                   5210:   enclosing box's value.</p>
                   5211: 
                   5212:   <p>The following rules make the text of a report be displayed with
                   5213:   medium-sized characters (for example, size 5), while the title is displayed
                   5214:   with larger characters and the summary is displayed with smaller
                   5215:   characters:</p>
                   5216:   <pre>Report :
1.1       cvs      5217:      Size : 5;
                   5218: Title :
                   5219:      Size : Enclosing + 2;
                   5220: Summary :
1.18      cvs      5221:      Size : Enclosing - 1;</pre>
1.30      cvs      5222: 
                   5223:   <p>Thus, the character sizes in the entire document can be changed by
1.34      cvs      5224:   changing the size property of the Report element, while preserving the
1.30      cvs      5225:   relationships between the sizes of the different elements.</p>
1.18      cvs      5226: </blockquote>
                   5227: </div>
                   5228: 
                   5229: <div class="subsubsection">
1.37      cvs      5230: <h4><a name="sectd42252" id="sectd42252">Font and character style</a></h4>
1.18      cvs      5231: 
1.37      cvs      5232: <p>The <tt>Font</tt> rule determines the font family to be used to display
                   5233: the characters contained in the box, while the <tt>Style</tt> rule determines
                   5234: their style and the <tt>Weight</tt> rule determines their weight. Thot
1.23      cvs      5235: recognizes three character fonts (Times, Helvetica, and Courier), three
                   5236: styles: Roman, Italics, and Oblique, and two weights: Normal and Bold.</p>
1.30      cvs      5237: 
                   5238: <p>The font family, style and weight can be specified by a named constant or
1.37      cvs      5239: can be inherited. For the name of the font family only the first character is
1.30      cvs      5240: used.</p>
                   5241: 
                   5242: <p>Only identical inheritance is allowed: the box takes the same font, style
1.37      cvs      5243: or weight as the box from which it inherits. This is indicated by an equals
1.23      cvs      5244: sign after the kinship specification.</p>
                   5245: <pre>               'Font' ':'          NameInherit /
                   5246:                'Style' ':'         StyleInherit /
                   5247:                'Weight' ':'        WeightInherit /
                   5248: 
                   5249: NameInherit   = Kinship '=' / FontName .
                   5250: FontName      = NAME .
                   5251: StyleInherit  = Kinship '=' /
                   5252:                 'Roman' / 'Italics' / 'Oblique' .
                   5253: WeightInherit = Kinship '=' /
                   5254:                 'Normal' / 'Bold' .</pre>
1.30      cvs      5255: 
1.18      cvs      5256: <blockquote class="example">
1.30      cvs      5257:   <p><strong>Example:</strong></p>
                   5258: 
                   5259:   <p>To specify that the summary uses the font family of the rest of the
                   5260:   document, but in the italic style, the following rules are used:</p>
                   5261:   <pre>Summary :
1.1       cvs      5262:    BEGIN
                   5263:    Font : Enclosing =;
                   5264:    Style : Italics;
1.18      cvs      5265:    END;</pre>
                   5266: </blockquote>
                   5267: </div>
                   5268: 
                   5269: <div class="subsubsection">
1.37      cvs      5270: <h4><a name="sectd42253" id="sectd42253">Underlining</a></h4>
1.18      cvs      5271: 
1.30      cvs      5272: <p>The <tt>Underline</tt> rule is used to specify if the characters contained
1.37      cvs      5273: in a box should have lines drawn on or near them. There are four underlining
1.18      cvs      5274: styles: <tt>Underlined</tt>, <tt>Overlined</tt>, <tt>CrossedOut</tt>, and
1.37      cvs      5275: <tt>NoUnderline</tt>. The <tt>Thickness</tt> rule specifies the thickness of
1.18      cvs      5276: the line, <tt>Thin</tt> or <tt>Thick</tt>.</p>
1.30      cvs      5277: 
                   5278: <p>As with font family and style, only identical inheritance is allowed: the
1.37      cvs      5279: box has the same underlining type as the box from which it inherits the
                   5280: value. This is indicated by an equals sign after the kinship
                   5281: specification.</p>
1.18      cvs      5282: <pre>                   'Underline' ':' UnderLineInherit /
1.1       cvs      5283:                    'Thickness' ':' ThicknessInherit /
                   5284: 
                   5285: UnderLineInherit = Kinship '=' / 'NoUnderline' /
                   5286:                    'Underlined' / 
                   5287:                    'Overlined' / 'CrossedOut' .
1.18      cvs      5288: ThicknessInherit = Kinship '=' / 'Thick' / 'Thin' .</pre>
                   5289: </div>
                   5290: </div>
                   5291: 
                   5292: <div class="subsection">
1.37      cvs      5293: <h3><a name="sectc4226" id="sectc4226">Stacking order</a></h3>
1.18      cvs      5294: 
1.30      cvs      5295: <p>The <tt>Depth</tt> rule is used to define the stacking order of terminal
1.37      cvs      5296: boxes when multiple boxes at least partially overlap. This rule defines how
                   5297: the depth property, which is zero or a positive integer, is calculated. The
                   5298: depth property has a value for all boxes. For terminal boxes in the structure
1.34      cvs      5299: and for presentation boxes, the depth value is used during display and
                   5300: printing: the boxes with the lowest value overlap those with higher depths.
1.37      cvs      5301: For non-terminal boxes, the depth is not interpreted during display, but it
                   5302: is used to calculate the depth of terminal boxes by inheritance.</p>
1.30      cvs      5303: 
                   5304: <p>Like most other rules, the depth rule is defined in the <a
1.37      cvs      5305: href="#sectc427">default rules</a> of each presentation schema. Thus, there
1.18      cvs      5306: is always a depth value, even when it is not necessary because there is no
1.37      cvs      5307: overlapping. To avoid useless operations, a zero value can be given to the
1.34      cvs      5308: depth property, which signifies that overlapping is never a problem.</p>
1.30      cvs      5309: 
                   5310: <p>The depth rule has the same form as the <a href="#sectc4224">visibility
1.18      cvs      5311: rule</a>. It can be defined by inheritance or by a constant numeric value.
                   5312: When the rule is attached to a numeric attribute, it can take the value of
                   5313: that attribute.</p>
                   5314: <pre>                'Depth' ':' NumberInherit</pre>
1.30      cvs      5315: 
1.18      cvs      5316: <blockquote class="example">
1.30      cvs      5317:   <p><strong>Example:</strong></p>
                   5318: 
                   5319:   <p>For a purely textual document, in which overlapping never poses a
                   5320:   problem, a single default <tt>Depth</tt> rule in the presentation schema is
                   5321:   sufficient:</p>
                   5322:   <pre>DEFAULT
1.1       cvs      5323:     Depth : 0;
1.18      cvs      5324:     ...</pre>
1.30      cvs      5325: 
                   5326:   <p>To make the text of examples appear on a light blue background, a
                   5327:   presentation box is defined:</p>
                   5328:   <pre>BOXES
1.1       cvs      5329:    BlueBG :
                   5330:       BEGIN
                   5331:       Content : Graphics 'R';
                   5332:       Background : LightBlue3;
                   5333:       FillPattern: backgroundcolor;
                   5334:       Depth : 2;
                   5335:       ...
1.18      cvs      5336:       END;</pre>
1.30      cvs      5337: 
                   5338:   <p>and is created by the <tt>Example</tt> element, which has the rules:</p>
                   5339:   <pre>RULES
1.1       cvs      5340:    Example :
                   5341:       BEGIN
                   5342:       CreateFirst (BlueBG);
                   5343:       Depth : 1;
                   5344:       ...
1.18      cvs      5345:       END;</pre>
1.30      cvs      5346: 
                   5347:   <p>In this way, the text of an example (if it inherits its depth from its
                   5348:   ancestor) will be superimposed on a light blue background, and not the
                   5349:   reverse).</p>
1.18      cvs      5350: </blockquote>
                   5351: </div>
                   5352: 
                   5353: <div class="subsection">
1.37      cvs      5354: <h3><a name="sectc4227" id="sectc4227">Line style</a></h3>
1.18      cvs      5355: 
1.30      cvs      5356: <p>The <tt>LineStyle</tt> rule determines the style of line which should be
                   5357: used to draw all the elements contained in the box and the box itself, if it
1.37      cvs      5358: has a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. The line style can be
1.18      cvs      5359: indicated by a name (<tt>Solid</tt>, <tt>Dashed</tt>, <tt>Dotted</tt>) or it
1.37      cvs      5360: can be inherited. All elements of the graphic base type are affected by this
1.1       cvs      5361: rule, but it can be attached to any box and transmitted by inheritance to the
1.37      cvs      5362: graphic elements. The border of elements having a <a
1.18      cvs      5363: href="#sectc4230a"><tt>ShowBox</tt> rule</a> is drawn according to the line
                   5364: style specified by this rule.</p>
1.30      cvs      5365: 
1.37      cvs      5366: <p>Only identical inheritance is allowed: the box takes the same line style
                   5367: as the box from which it inherits. This is indicated by an equals sign after
                   5368: the kinship specification.</p>
1.18      cvs      5369: <pre>                      'LineStyle' ':' LineStyleInherit
1.1       cvs      5370:      LineStyleInherit = Kinship '=' /
1.18      cvs      5371:                       'Solid' / 'Dashed' / 'Dotted' .</pre>
1.30      cvs      5372: 
1.18      cvs      5373: <blockquote class="example">
1.30      cvs      5374:   <p><strong>Example:</strong></p>
                   5375: 
1.37      cvs      5376:   <p>To specify that, in Figures, the graphical parts should be drawn in
                   5377:   solid lines, the Figure element is given a rule using the <tt>Solid</tt>
                   5378:   name:</p>
1.30      cvs      5379:   <pre>Figure :
1.18      cvs      5380:    LineStyle : Solid;</pre>
1.30      cvs      5381: 
                   5382:   <p>and the elements composing figures are given an inheritance rule:</p>
                   5383:   <pre>   LineStyle : Enclosing =;</pre>
1.18      cvs      5384: </blockquote>
                   5385: </div>
                   5386: 
                   5387: <div class="subsection">
1.37      cvs      5388: <h3><a name="sectc4228" id="sectc4228">Line thickness</a></h3>
1.18      cvs      5389: 
1.37      cvs      5390: <p>The <tt>LineWeight</tt> rule determines the thickness of the lines of all
1.1       cvs      5391: graphical elements which appear in the box, no matter what their line style.
1.37      cvs      5392: Line thickness can be specified by a constant value or by inheritance. A
                   5393: constant value is a positive number followed by an optional unit
                   5394: specification (which is absent when using relative units). All available <a
                   5395: href="#sectc4217">distance units</a> can be used. Line thickness is expressed
1.18      cvs      5396: in the same way as <a href="#sectd42221">line spacing</a>.</p>
                   5397: <pre>                 'LineWeight' ':' DistOrInherit</pre>
1.30      cvs      5398: 
1.37      cvs      5399: <p>All elements of the graphic base type are affected by this rule, but it
                   5400: can be attached to any box and transmitted by inheritance to the graphic
                   5401: elements. The border of element having a <a
                   5402: href="#sectc4230a"><tt>ShowBox</tt> rule</a> is also drawn according to the
                   5403: thickness specified by this rule.</p>
1.30      cvs      5404: 
1.18      cvs      5405: <blockquote class="example">
1.30      cvs      5406:   <p><strong>Example:</strong></p>
                   5407: 
                   5408:   <p>To specify that, in Figures, the graphical parts should be drawn with
                   5409:   lines 0.3 pt thick, the Figure element is given this rule:</p>
                   5410:   <pre>Figure :
1.18      cvs      5411:    LineWeight : 0.3 pt;</pre>
1.30      cvs      5412: 
                   5413:   <p>and the elements composing figures are given an inheritance rule:</p>
                   5414:   <pre>   LineWeight : Enclosing =;</pre>
1.18      cvs      5415: </blockquote>
                   5416: </div>
                   5417: 
                   5418: <div class="subsection">
1.37      cvs      5419: <h3><a name="sectc4229" id="sectc4229">Fill pattern</a></h3>
1.18      cvs      5420: 
1.30      cvs      5421: <p>The <tt>FillPattern</tt> rule determines the pattern used to fill closed
1.37      cvs      5422: graphical elements (circles, rectangles, etc.) which appear in the box. This
1.18      cvs      5423: rule also specifies the pattern used to fill the box associated with elements
1.37      cvs      5424: having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a><a>. This pattern can
                   5425: be indicated by a named constant or by inheritance. The named constant
                   5426: identifies one of the patterns available in Thot. The names of the available
1.18      cvs      5427: patterns are: nopattern, foregroundcolor, backgroundcolor, gray1, gray2,
                   5428: gray3, gray4, gray5, gray6, gray7, horiz1, horiz2, horiz3, vert1, vert2,
1.37      cvs      5429: vert3, left1, left2, left3, right1, right2, right3, square1, square2,
                   5430: square3, lozenge, brick, tile, sea, basket.</a></p>
1.30      cvs      5431: 
                   5432: <p>Like the other rules peculiar to graphics, <tt>LineStyle</tt> and
1.18      cvs      5433: <tt>LineWeight</tt>, only elements of the graphic base type are affected by
                   5434: the <tt>FillPattern</tt> rule, but the rule can be attached to any box and
1.37      cvs      5435: transmitted by inheritance to the graphic elements. As with the other rules
1.18      cvs      5436: specific to graphics, only identical inheritance is allowed.</p>
1.30      cvs      5437: 
                   5438: <p>The <tt>FillPattern</tt> rule can also be used to determine whether or not
1.37      cvs      5439: text characters, symbols and pictures should be colored. For these element
1.12      cvs      5440: types (text, symbols, and pictures), the only valid values are
1.18      cvs      5441: <tt>nopattern</tt>, <tt>foregroundcolor</tt>, and <tt>backgroundcolor</tt>.
                   5442: When <tt>FillPattern</tt> has the value <tt>backgroundcolor</tt>, text
                   5443: characters, symbols, and bitmaps are given the color specified by the <a
                   5444: href="#sectc4230"><tt>Background</tt> rule</a> which applies to these
1.37      cvs      5445: elements. When <tt>FillPattern</tt> has the value <tt>foregroundcolor</tt>,
1.18      cvs      5446: these same elements are given the color specified by the <a
                   5447: href="#sectc4230"><tt>Foreground</tt> rule</a> which applies to these
1.37      cvs      5448: elements. In all other case, text characters are not colored.</p>
1.18      cvs      5449: <pre>                 'FillPattern' ':' NameInherit</pre>
1.30      cvs      5450: 
1.18      cvs      5451: <blockquote class="example">
1.30      cvs      5452:   <p><strong>Example:</strong></p>
                   5453: 
                   5454:   <p>To specify that, in Figures, the closed graphical elements should be
                   5455:   filled with a pattern resembling a brick wall, the Figure element is given
                   5456:   this rule:</p>
                   5457:   <pre>Figure :
1.18      cvs      5458:    FillPattern : brick;</pre>
1.30      cvs      5459: 
                   5460:   <p>and the elements composing figures are given an inheritance rule:</p>
                   5461:   <pre>   FillPattern : Enclosing =;</pre>
1.18      cvs      5462: </blockquote>
                   5463: </div>
                   5464: 
                   5465: <div class="subsection">
1.37      cvs      5466: <h3><a name="sectc4230" id="sectc4230">Colors</a></h3>
1.18      cvs      5467: 
1.30      cvs      5468: <p>The <tt>Foreground</tt> and <tt>Background</tt> rules determine the
1.37      cvs      5469: foreground and background colors of the base elements which appear in the
                   5470: box. They also control the color of boxes associated with elements having a
                   5471: <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. These colors can be
                   5472: specified with a named constant or by inheritance. The named constants
                   5473: specify one of the available colors in Thot. The available color names can be
                   5474: found in the file <tt>thot.color</tt>. In addition to those names, you can
                   5475: use the keyword <code>Transparent</code>, to not draw anything.</p>
                   5476: 
                   5477: <p>The color rules affect the same way all base elements and elements having
                   5478: a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>, no matter what their type
                   5479: (text, graphics, pictures, symbols). The color rules can be associated with
1.30      cvs      5480: any box and can be transmitted by inheritance to the base elements or the
1.37      cvs      5481: elements having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. Like the
1.30      cvs      5482: preceding rules, only inheritance of the same value is allowed.</p>
                   5483: <pre>                 'Foreground' ':' Color
                   5484:                  'Background' ':' Color
                   5485:       Color = 'Transparent' / Link '=' / FontColorName .</pre>
                   5486: 
                   5487: <p><strong>Note:</strong> text colors only appear for text elements whose <a
1.18      cvs      5488: href="#sectc4229">fill pattern</a> does not prevent the use of color.</p>
1.30      cvs      5489: 
1.18      cvs      5490: <blockquote class="example">
1.30      cvs      5491:   <p><strong>Example:</strong></p>
                   5492: 
                   5493:   <p>To specify that, in Figures, everything must be drawn in blue on a
                   5494:   background of yellow, the Figure element is given these rules:</p>
                   5495:   <pre>Figure :
1.1       cvs      5496:    BEGIN
                   5497:    Foreground : Blue;
                   5498:    Background : Yellow;
                   5499:    Fillpattern : backgroundcolor;
1.18      cvs      5500:    END;</pre>
1.30      cvs      5501: 
                   5502:   <p>and the elements composing figures are given inheritance rules:</p>
                   5503:   <pre>   Foreground : Enclosing =;
1.1       cvs      5504:    Background : Enclosing =;
1.18      cvs      5505:    FillPattern : Enclosing =;</pre>
                   5506: </blockquote>
                   5507: </div>
                   5508: 
                   5509: <div class="subsection">
1.37      cvs      5510: <h3><a name="sectc4230a" id="sectc4230a">Background color and border</a></h3>
1.18      cvs      5511: 
1.30      cvs      5512: <p>Boxes associated with structural elements are normally not visible, but it
1.37      cvs      5513: is possible to draw their border and/or to paint their area when it is
                   5514: needed. This is achieved by associating the <tt>ShowBox</tt> rule with the
                   5515: concerned element. This rule has no parameter and no value. It is simply
                   5516: written <tt>Showbox;</tt>. It is not inherited nor transmitted to any other
                   5517: element. It applies only to the element with which it is associated.</p>
1.18      cvs      5518: <pre>                 'ShowBox'</pre>
1.30      cvs      5519: 
                   5520: <p>When an element has a <tt>ShowBox</tt> rule, the border is drawn only if
1.37      cvs      5521: the <tt>LineWeight</tt> rule that applies to that element has a non-zero
                   5522: value (this value can be inherited). The color, style and thickness of the
                   5523: border are defined by the <tt>Foreground</tt>, <tt>LineStyle</tt>, and
1.18      cvs      5524: <tt>LineWeight</tt> rules that apply to the element.</p>
1.30      cvs      5525: 
1.37      cvs      5526: <p>When an element has a <tt>ShowBox</tt> rule, the background of this
                   5527: element is paint only if the value of the <tt>FillPattern</tt> rule that
                   5528: applies to that element is not <tt>nopattern</tt>. The pattern and color(s)
                   5529: of the background are defined by the <tt>FillPattern</tt>,
                   5530: <tt>Background</tt>, and <tt>Foreground</tt> rules that apply to the
                   5531: element.</p>
1.18      cvs      5532: </div>
                   5533: 
                   5534: <div class="subsection">
1.37      cvs      5535: <h3><a name="sectc4230b" id="sectc4230b">Background pictures</a></h3>
1.18      cvs      5536: 
1.30      cvs      5537: <p>The <tt>BackgroundPicture</tt> rule allows to display a picture as the
1.37      cvs      5538: background of an element. It has a single parameter, the file name of the
                   5539: picture. This is a string delimited by single quotes. If the first character
1.18      cvs      5540: in this string is '/', it is considered as an absolute path, otherwise the
1.37      cvs      5541: file is searched for along the schema directory path. This file may contain a
1.18      cvs      5542: picture in any format accepted by Thot (xbm, xpm, gif, jpeg, png, etc.)</p>
1.30      cvs      5543: 
1.37      cvs      5544: <p>The <tt>BackgroundPicture</tt> and <tt>PictureMode</tt> rules apply only
                   5545: to the element with which they are associated. They are not inherited nor
1.18      cvs      5546: transmitted to children elements.</p>
1.30      cvs      5547: 
                   5548: <p>The background picture has not always the same size as the element's box.
1.37      cvs      5549: There are diffrent ways to fill the element box with the picture. This is
1.18      cvs      5550: specified by the <tt>PictureMode</tt> rule, which should be associated to the
1.37      cvs      5551: same element. This rule may take one of the following values:</p>
1.18      cvs      5552: <dl>
1.30      cvs      5553:   <dt><tt>NormalSize</tt></dt>
                   5554:     <dd>The picture is centered in the box, and clipped if it is too
                   5555:     large.</dd>
                   5556:   <dt><tt>Scale</tt></dt>
                   5557:     <dd>The picture is zoomed to fit the box size.</dd>
                   5558:   <dt><tt>RepeatX</tt></dt>
                   5559:     <dd>The picture is repeated horizontally to fit the box width.</dd>
                   5560:   <dt><tt>RepeatY</tt></dt>
                   5561:     <dd>The picture is repeated vertically to fit the box height.</dd>
                   5562:   <dt><tt>RepeatXY</tt></dt>
                   5563:     <dd>The picture is repeated both horizontally and vertically to fill the
                   5564:       box.</dd>
1.18      cvs      5565: </dl>
1.30      cvs      5566: 
                   5567: <p>If an element has a <tt>BackgroundPicture</tt> rule and no
1.18      cvs      5568: <tt>PictureMode</tt> rule, the <tt>NormalSize</tt> value is assumed.</p>
                   5569: <pre>                 'BackgroundPicture' ':' FileName /
1.13      cvs      5570:                  'PictureMode' ':' PictMode .
                   5571:  
                   5572:       FileName = STRING .
1.18      cvs      5573:       PictMode = 'NormalSize' / 'Scale' / 'RepeatXY' / 'RepeatX' / 'RepeatY' .</pre>
1.30      cvs      5574: 
1.37      cvs      5575: <p>The <tt>BackgroundPicture</tt> and <tt>PictureMode</tt> rules apply only
                   5576: to the element with which they are associated. They are not inherited nor
1.18      cvs      5577: transmitted to children elements.</p>
                   5578: </div>
1.13      cvs      5579: 
1.18      cvs      5580: <div class="subsection">
1.47      quint    5581: <h3><a name="sectc4230c" id="sectc4230c">Opacity</a></h3>
                   5582: 
1.48      quint    5583: <p>The <tt>Opacity</tt>, <tt>FillOpacity</tt> and <tt>StrokeOpacity</tt>
                   5584: rules allow to set the opacity of the element(s) to which they apply. The
                   5585: <code>FillOpacity</code> rule controls the way the interior of the element is
                   5586: paint, while the <code>StrokeOpacity</code> rule concerns the outline. The
                   5587: <code>Opacity</code> rule concerns both the interior and the outline at the
                   5588: same time.</p>
                   5589: 
                   5590: <p>In the three rules, opacity is expressed as a percentage. It must be
                   5591: comprised between 0 (fully transparent) and 100% (fully opaque). In these
                   5592: rules, the opacity can be expressed as an integer (from 0 to 100) followed by
                   5593: the <code>%</code> character. It can also be expressed as the name of a
                   5594: numeric attribute. In that case, the attribute's value is interpreted as a
                   5595: percentage. It should then be comprised between 0 and 100 included. Finally,
                   5596: the opacity can be inherited from the parent element.</p>
                   5597: <pre>                  'Opacity' ':' OpacityInherit
                   5598:                   'FillOpacity' ':' OpacityInherit
                   5599:                   'StrokeOpacity' ':' OpacityInherit
1.47      quint    5600: OpacityInherit  = OpPercent '%' / AttrID / Inheritance .
                   5601: OpPercent       = NUMBER .</pre>
                   5602: </div>
                   5603: 
                   5604: <div class="subsection">
1.37      cvs      5605: <h3><a name="sectc4231" id="sectc4231">Presentation box content</a></h3>
1.1       cvs      5606: 
1.37      cvs      5607: <p>The <tt>Content</tt> rule applies to presentation boxes. It indicates the
                   5608: content given to a box. This content is either a variable's value or a
                   5609: constant value.</p>
1.30      cvs      5610: 
                   5611: <p>If the content is a constant, it can be specified, as in a variable
1.18      cvs      5612: declaration, either by the name of a constant declared in the <tt>CONST</tt>
1.1       cvs      5613: section or by direct specification of the type and value of the box's
1.18      cvs      5614: content.</p>
1.30      cvs      5615: 
                   5616: <p>Similarly, if it is a variable, the name of a variable declared in
1.18      cvs      5617: <tt>VAR</tt> section can be given or the variable may be defined within
1.37      cvs      5618: parentheses. The content inside the parentheses has the same syntax as a <a
1.18      cvs      5619: href="#sectc426">variable declaration</a>.</p>
                   5620: <pre>               'Content' ':' VarConst
1.1       cvs      5621:      VarConst = ConstID / ConstType ConstValue /
1.38      cvs      5622:                 VarID / '(' FunctionSeq ')' .</pre>
1.30      cvs      5623: 
                   5624: <p>A presentation box can have only one <tt>Content</tt> rule, which means
1.37      cvs      5625: that the content of a presentation box cannot vary from view to view.
                   5626: However, such an effect can be achieved by creating several presentation
                   5627: boxes, each with different content and visible in different views.</p>
                   5628: 
                   5629: <p>The <tt>Content</tt> rule also applies to elements defined as references
                   5630: in the structure schema. In this case, the content defined by the rule must
                   5631: be a constant. It is this content which appears on the screen or paper to
                   5632: represent references of the type to which the rule applies. A reference can
1.18      cvs      5633: have a <tt>Content</tt> rule or a <a href="#sectc4234"><tt>Copy</tt> rule</a>
1.37      cvs      5634: for each view. If neither of these rules appears, the reference is displayed
1.18      cvs      5635: as <tt>[*]</tt>, which is equivalent to the rule:</p>
                   5636: <pre>     Content: Text '[*]';</pre>
1.30      cvs      5637: 
1.18      cvs      5638: <blockquote class="example">
1.30      cvs      5639:   <p><strong>Example:</strong></p>
                   5640: 
                   5641:   <p>The content of the presentation box created to make the chapter number
                   5642:   and section number appear before each section title can be defined by:</p>
                   5643:   <pre>BOXES
1.1       cvs      5644:      SectionNumBox :
                   5645:           BEGIN
                   5646:           Content : NumSection;
                   5647:           ...
1.18      cvs      5648:           END;</pre>
1.30      cvs      5649: 
                   5650:   <p>if the <tt>NumSection</tt> variable has been defined in the variable
1.37      cvs      5651:   definition section of the presentation schema. Otherwise the
1.30      cvs      5652:   <tt>Content</tt> would be written:</p>
                   5653:   <pre>BOXES
1.1       cvs      5654:      SectionNumBox :
                   5655:           BEGIN
                   5656:           Content : (VALUE (ChapterCtr, Roman) TEXT '.'
                   5657:                      VALUE (SectionCtr, Arabic));
                   5658:           ...
1.18      cvs      5659:           END;</pre>
                   5660: </blockquote>
                   5661: </div>
1.1       cvs      5662: 
1.18      cvs      5663: <div class="subsection">
1.37      cvs      5664: <h3><a name="sectc4232" id="sectc4232">Presentation box creation</a></h3>
1.1       cvs      5665: 
1.37      cvs      5666: <p>A creation rule specifies that a presentation box should be created when
                   5667: an element of the type to which the rule is attached appears in the
                   5668: document.</p>
1.30      cvs      5669: 
                   5670: <p>A keyword specifies the position, relative to the creating box, at which
                   5671: the created box will be placed in the structure:</p>
1.18      cvs      5672: <dl>
1.30      cvs      5673:   <dt><tt>CreateFirst</tt></dt>
                   5674:     <dd>specifies that the box should be created as the first box of the next
                   5675:       lower level, before any already existing boxes, and only if the
                   5676:       beginning of the creating element is visible;</dd>
                   5677:   <dt><tt>CreateLast</tt></dt>
                   5678:     <dd>specifies that the box should be created as the last box of the next
                   5679:       lower level, after any existing boxes, and only if the end of the
                   5680:       creating element is visible;</dd>
                   5681:   <dt><tt>CreateBefore</tt></dt>
                   5682:     <dd>specifies that the box should be created before the creating box, on
                   5683:       the same level as the creating box, and only if the beginning of the
                   5684:       creating element is visible;</dd>
                   5685:   <dt><tt>CreateAfter</tt></dt>
                   5686:     <dd>specifies that the box should be created after the creating box, on
                   5687:       the same level as the creating box, and only if the beginning of the
                   5688:       creating element is visible;</dd>
                   5689:   <dt><tt>CreateEnclosing</tt></dt>
1.37      cvs      5690:     <dd>specifies that the box should be created at the upper level
                   5691:       relatively to the creating box, and that it must contain that creating
                   5692:       box and all presentation boxes created by the same creating box.</dd>
1.18      cvs      5693: </dl>
1.30      cvs      5694: 
                   5695: <p>This keyword can be followed by the <tt>Repeated</tt> keyword to indicate
                   5696: that the box must be created for each part of the creating element. These
                   5697: parts result from the division of the element by page breaks or column
1.37      cvs      5698: changes. If the <tt>Repeated</tt> keyword is missing, the box is only created
1.30      cvs      5699: for the first part of the creating element (<tt>CreateFirst</tt> and
1.18      cvs      5700: <tt>CreateBefore</tt> rules) or for the last part (<tt>CreateLast</tt> and
                   5701: <tt>CreateAfter</tt> rules).</p>
1.30      cvs      5702: 
                   5703: <p>The type of presentation to be created is specified at the end of the rule
1.18      cvs      5704: between parentheses.</p>
1.30      cvs      5705: 
                   5706: <p>Creation rules cannot appear in the <a href="#sectc427">default
1.37      cvs      5707: presentation rules</a>. The boxes being created should have a
1.30      cvs      5708: <tt>Content</tt> rule which indicates their <a
                   5709: href="#sectc4231">content</a>.</p>
                   5710: 
                   5711: <p>Creation rules can only appear in the block of rules for the primary view;
1.1       cvs      5712: creation is provoked by a document element for all views. However, for each
1.37      cvs      5713: view, the presentation box is only created if the creating element is itself
                   5714: a box in the view. Moreover, the visibility property of the presentation box
                   5715: can be adjusted to control the creation of the box on a view-by-view
                   5716: basis.</p>
1.18      cvs      5717: <pre>                     Creation '(' BoxID ')'
1.1       cvs      5718:      Creation      = Create [ 'Repeated' ] .
                   5719:      Create        ='CreateFirst' / 'CreateLast' /
                   5720:                     'CreateBefore' / 'CreateAfter' /
1.18      cvs      5721:                     'CreateEnclosing' .</pre>
1.30      cvs      5722: 
1.18      cvs      5723: <blockquote class="example">
1.30      cvs      5724:   <p><strong>Example:</strong></p>
                   5725: 
                   5726:   <p>Let us define an object type, called Table, which is composed of a
                   5727:   sequence of columns, all having the same fixed width, where the columns are
1.37      cvs      5728:   separated by vertical lines. There is a line to the left of the first
                   5729:   column and one to the right of the last. Each column has a variable number
1.31      cvs      5730:   of cells, placed one on top of the other and separated by horizontal lines.
                   5731:   There are no horizontal lines above the first cell or below the last cell.
1.37      cvs      5732:   The text contained in each cell is broken into lines and these lines are
1.30      cvs      5733:   centered horizontally in the cell. The logical structure of this object is
                   5734:   defined by:</p>
                   5735:   <pre>Table   = LIST OF (Column);
1.18      cvs      5736: Column  = LIST OF (Cell = Text);</pre>
                   5737: 
1.30      cvs      5738:   <div class="figure">
1.37      cvs      5739:   <hr />
1.30      cvs      5740:   <pre>|                |                |               |
1.1       cvs      5741: |  xx xxxx xxxx  |x xxxx xxx xxxxx|  x xxx x xxx  |
                   5742: | xxx xxx xxxx x |   x xx x xxx   | xxxxx xxxx xx |
                   5743: |   xxxxx xxxx   |----------------|  xxx xxxxx x  |
                   5744: | xxxxx xxx xxxx | xxxx xx xx xxx |     xx xx     |
                   5745: | xxx xxxx x xxx |  xxxx x xxx x  |---------------|
                   5746: |----------------| xxx xxxx xxxxx |  xxxxx xxxxx  |
                   5747: | xxx xxx xxxxxx |----------------| xxx xxxx xxxx |
                   5748: |  xxxx xxxx xx  |  xxxx xx x xx  |  xxx xx x xx  |
                   5749: |----------------| xxx xxxxx xxxx | xxxx xxxx xxx |
                   5750: | xxxxx xxx xxxx |  xxxx xx x xx  |   xxxxx xxx   |
1.18      cvs      5751: |xxxx xx x xxxxxx| xxxx xx xxxxxx |  xxxxx xxxxx  |</pre>
1.19      cvs      5752: 
1.37      cvs      5753:   <p align="center"><em><a name="table" id="table">The design of a
                   5754:   table</a></em></p>
                   5755:   <hr />
1.30      cvs      5756:   </div>
                   5757: 
                   5758:   <p>The presentation of the table should resemble the design of the above <a
1.37      cvs      5759:   href="#table">figure</a>. It is defined by the following presentation
1.30      cvs      5760:   schema fragment:</p>
                   5761:   <pre>BOXES
1.1       cvs      5762:      VertLine : BEGIN
                   5763:                 Width : 0.3 cm;
                   5764:                 Height : Enclosing . Height;
                   5765:                 VertPos : Top = Enclosing . Top;
                   5766:                 HorizPos : Left = Previous . Right;
                   5767:                 Content : Graphics 'v';
                   5768:                 END;
                   5769: 
                   5770:      HorizLine: BEGIN
                   5771:                 Width : Enclosing . Width;
                   5772:                 Height : 0.3 cm;
                   5773:                 VertPos : Top = Previous . Bottom;
                   5774:                 HorizPos : Left = Enclosing . Left;
                   5775:                 Content : Graphics 'h';
                   5776:                 END;
                   5777: 
                   5778: RULES
1.6       cvs      5779:      Column   : BEGIN
                   5780:                 CreateBefore (VertLine);
                   5781:                 IF LAST CreateAfter (VertLine);
                   5782:                 Width : 2.8 cm;
                   5783:                 Height : Enclosed . Height;
                   5784:                 VertPos : Top = Enclosing . Top;
                   5785:                 HorizPos : Left = Previous . Right;
                   5786:                 END;
                   5787: 
                   5788:      Cell     : BEGIN
                   5789:                 IF NOT FIRST CreateBefore (HorizLine);
                   5790:                 Width : Enclosing . Width;
                   5791:                 Height : Enclosed . Height;
                   5792:                 VertPos : Top = Previous . Bottom;
                   5793:                 HorizPos : Left = Enclosing . Left;
                   5794:                 Line;
                   5795:                 Adjust : VMiddle;
1.18      cvs      5796:                 END;</pre>
1.30      cvs      5797: 
                   5798:   <p>It is useful to note that the horizontal position rule of the first
                   5799:   vertical line will not be applied, since there is no preceding box. In this
                   5800:   case, the box is simply placed on the left side of the enclosing box.</p>
1.18      cvs      5801: </blockquote>
                   5802: </div>
                   5803: 
                   5804: <div class="subsection">
1.37      cvs      5805: <h3><a name="sectc4233" id="sectc4233">Page layout</a></h3>
1.18      cvs      5806: 
1.30      cvs      5807: <p>The page models specified in the <tt>Page</tt> rule are defined by boxes
1.37      cvs      5808: declared in the <tt>BOXES</tt> section of the presentation schema. Pages are
1.1       cvs      5809: not described as frames which will be filled by the document's text, but as
                   5810: element are inserted in the flow of the document and which mark the page
1.37      cvs      5811: breaks. Each of these page break elements contains presentation boxes which
1.1       cvs      5812: represent the footer boxes of a page followed by header boxes of the next
1.37      cvs      5813: page. The page box itself is the simple line which separates two pages on the
                   5814: screen. Both the footer and header boxes placed themselves with respect to
1.1       cvs      5815: this page box, with the footer being placed above it and the header boxes
1.18      cvs      5816: being placed above it.</p>
1.30      cvs      5817: 
                   5818: <p>The boxes created by a page box are headers and footers and can only place
1.1       cvs      5819: themselves vertically with respect to the page box itself (which is in fact
1.37      cvs      5820: the separation between two pages). Besides, it is their vertical position
                   5821: rule which determines whether they are header or footer boxes. Header and
1.1       cvs      5822: footer boxes must have an explicit vertical position rule (they must not use
1.18      cvs      5823: the default rule).</p>
1.30      cvs      5824: 
                   5825: <p>Footer boxes must have an absolute height or inherit the height of their
1.18      cvs      5826: contents:</p>
                   5827: <pre>Height : Enclosed . Height;</pre>
1.30      cvs      5828: 
                   5829: <p>A page box must have height and width rules and these two rules must be
1.1       cvs      5830: specified with constant values, expressed in centimeters, inches, or
1.37      cvs      5831: typographer's points. These two rules are interpreted in a special way for
                   5832: page boxes: they determine the width of the page and the vertical distance
1.1       cvs      5833: between two page separators, which is the height of the page and its header
1.18      cvs      5834: and footer together.</p>
1.30      cvs      5835: 
                   5836: <p>A page box should also have vertical and horizontal position rules and
                   5837: these two rules should specify the position on the sheet of paper of the
1.37      cvs      5838: rectangle enclosing the page's contents. These two rules must position the
1.30      cvs      5839: upper left corner of the enclosing rectangle in relation to the upper left
1.37      cvs      5840: corner of the sheet of paper, considered to be the enclosing element. In both
1.30      cvs      5841: rules, distances must be expressed in fixed units: centimeters (<tt>cm</tt>),
1.37      cvs      5842: inches (<tt>in</tt>), or typographer's points (<tt>pt</tt>). Thus, rules
1.30      cvs      5843: similar to the following should be found in the rules for a page box:</p>
1.18      cvs      5844: <pre>BOXES
1.1       cvs      5845:    ThePage :
                   5846:       BEGIN
                   5847:       VertPos : Top = Enclosing . Top + 3 cm;
                   5848:       HorizPos : Left = Enclosing . Left + 2.5 cm;
                   5849:       Width : 16 cm;
                   5850:       Height : 22.5 cm;
1.18      cvs      5851:       END;</pre>
1.30      cvs      5852: 
                   5853: <p>When a document must be page broken, the page models to be constructed are
1.18      cvs      5854: defined in the <tt>BOXES</tt> section of the presentation schema by declaring
1.37      cvs      5855: page boxes and header and footer boxes. Also, the <tt>Page</tt> rule is used
                   5856: to specify to which parts of the document and to which views each model
                   5857: should be applied.</p>
1.30      cvs      5858: 
                   5859: <p>The <tt>Page</tt> rule has only one parameter, given between parentheses
1.37      cvs      5860: after the <tt>Page</tt> keyword. This parameter is the name of the box which
                   5861: must serve as the model for page construction. When a <tt>Page</tt> rule is
1.1       cvs      5862: attached to an element type, each time such an element appears in a document,
                   5863: a page break takes place and the page model indicated in the rule is applied
                   5864: to all following pages, until reaching the next element which has a
1.18      cvs      5865: <tt>Page</tt> rule.</p>
1.30      cvs      5866: 
                   5867: <p>The <tt>Page</tt> rule applies to only one view; if it appears in the
1.37      cvs      5868: primary view's block of rules, a <tt>Page</tt> rule applies only to that
                   5869: view. Thus, different page models can be defined for the full document and
                   5870: for its table of contents, which is another view of the same document. Some
                   5871: views can be specified with pages, and other views of the same document can
                   5872: be specified without pages.</p>
1.18      cvs      5873: <pre>                   'Page' '(' BoxID ')'</pre>
                   5874: </div>
                   5875: 
                   5876: <div class="subsection">
1.37      cvs      5877: <h3><a name="sectc4234" id="sectc4234">Box copies</a></h3>
1.18      cvs      5878: 
1.30      cvs      5879: <p>The <tt>Copy</tt> rule can be used for an element which is defined as a
1.37      cvs      5880: reference in the structure schema. In this case, the rule specifies, between
1.18      cvs      5881: parenthesis, the name of the box (declared in the <tt>BOXES</tt> section)
1.1       cvs      5882: which must be produced when this reference appears in the structure of a
1.37      cvs      5883: document. The box produced is a copy (same contents, but possible different
1.1       cvs      5884: presentation) of the box type indicated by the parameter between parentheses,
1.37      cvs      5885: and which is in the element designated by the reference. The name of a box
1.1       cvs      5886: can be replaced by type name. Then what is copied is the contents of the
1.18      cvs      5887: element of this type which is inside the referenced element.</p>
1.30      cvs      5888: 
1.37      cvs      5889: <p>Whether a box name or type name is given, it may be followed by the name
                   5890: of a structure schema between parentheses. This signifies that the box or
                   5891: type is defined in the indicated structure schema and not in the structure
                   5892: schema with which the rule's presentation schema is associated.</p>
1.30      cvs      5893: 
1.37      cvs      5894: <p>The <tt>Copy</tt> rule can also be applied to a presentation box. If the
1.1       cvs      5895: presentation box was created by a reference attribute, the rule is applied as
                   5896: in the case of a reference element: the contents of the box having the
1.18      cvs      5897: <tt>Copy</tt> rule are based on the element designated by the reference
1.37      cvs      5898: attribute. For other presentation boxes, the <tt>Copy</tt> rule takes a type
1.1       cvs      5899: name parameter which can be followed, between parentheses, by the name of the
                   5900: structure schema in which the type is defined, if it is not defined in the
1.37      cvs      5901: same schema. The contents of the box which has this rule are a copy of the
                   5902: element of this type which is in the element creating the presentation box,
                   5903: or by default, the box of this type which precedes the presentation box. This
                   5904: last facility is used, for example, to define the running titles in headers
                   5905: or footers.</p>
1.18      cvs      5906: <pre>                  'Copy' '(' BoxTypeToCopy ')' .
1.1       cvs      5907:   BoxTypeToCopy = BoxID [ ExtStruct ] /
1.6       cvs      5908:                   ElemID [ ExtStruct ] .
1.18      cvs      5909:   ExtStruct     = '(' ElemID ')' .</pre>
1.30      cvs      5910: 
                   5911: <p>Like the creation rules, the <tt>Copy</tt> rule cannot appear in the <a
1.37      cvs      5912: href="#sectc427">default presentation rules</a>. Moreover, this rule can only
1.18      cvs      5913: appear in the primary view's block of rules; the copy rule is applied to all
                   5914: views.</p>
1.30      cvs      5915: 
1.18      cvs      5916: <blockquote class="example">
1.30      cvs      5917:   <p><strong>Example:</strong></p>
                   5918: 
                   5919:   <p>If the following definitions are in the structure schema:</p>
                   5920:   <pre>Body = LIST OF (Chapter =
1.1       cvs      5921:                      BEGIN
                   5922:                      ChapterTitle = Text;
                   5923:                      ChapterBody = SectionSeq;
                   5924:                      END);
1.18      cvs      5925: RefChapter = REFERENCE (Chapter);</pre>
1.30      cvs      5926: 
                   5927:   <p>then the following presentation rules (among many other rules in the
                   5928:   presentation schema) can be specified:</p>
                   5929:   <pre>COUNTERS
1.1       cvs      5930:    ChapterCtr : RANK OF Chapter;
                   5931: BOXES
                   5932:    ChapterNumber :
                   5933:       BEGIN
                   5934:       Content : (VALUE (ChapterCtr, URoman));
                   5935:       ...
                   5936:       END;
                   5937: RULES
                   5938:    Chapter :
                   5939:       BEGIN
                   5940:       CreateFirst (ChapterNumber);
                   5941:       ...
                   5942:       END;
                   5943:    RefChapter :
                   5944:       BEGIN
                   5945:       Copy (ChapterNumber);
                   5946:       ...
1.18      cvs      5947:       END;</pre>
1.30      cvs      5948: 
                   5949:   <p>which makes the number of the chapter designated by the reference appear
                   5950:   in uppercase roman numerals, in place of the reference to a chapter itself.
                   5951:   Alternatively, the chapter title can be made to appear in place of the
                   5952:   reference by writing this <tt>Copy</tt>rule:</p>
                   5953:   <pre>      Copy (ChapterTitle);</pre>
                   5954: 
                   5955:   <p>To define a header box, named <tt>RunningTitle</tt>, which contains the
                   5956:   title of the current chapter, the box's contents are defined in this
                   5957:   way:</p>
                   5958:   <pre>BOXES
1.1       cvs      5959:    RunningTitle :
1.18      cvs      5960:       Copy (ChapterTitle);</pre>
                   5961: </blockquote>
                   5962: </div>
                   5963: </div>
1.37      cvs      5964: <hr />
1.18      cvs      5965: </div>
1.1       cvs      5966: 
1.18      cvs      5967: <div class="chapter">
1.37      cvs      5968: <h1><a name="sect5" id="sect5">The T language</a></h1>
1.1       cvs      5969: 
1.18      cvs      5970: <div class="section">
1.37      cvs      5971: <h2><a name="sectb51" id="sectb51">Document translation</a></h2>
1.1       cvs      5972: 
1.30      cvs      5973: <p>Because of its document model, Thot can produce documents in a high-level
1.37      cvs      5974: abstract form. This form, called the <em>canonical form</em> is specific to
1.1       cvs      5975: Thot; it is well suited to the editor's manipulations, but it does not
1.37      cvs      5976: necessarily suit other operations which might be applied to documents.
                   5977: Because of this, the Thot editor offers the choice of saving documents in its
                   5978: own form (the canonical form) or a format defined by the user. In the latter
                   5979: case, the Thot document is transformed by the translation program. This
                   5980: facility can also be used to export documents from Thot to systems using
                   5981: other formalisms.</p>
1.1       cvs      5982: 
1.18      cvs      5983: <div class="subsection">
1.37      cvs      5984: <h3><a name="sectc511" id="sectc511">Translation principles</a></h3>
1.1       cvs      5985: 
1.30      cvs      5986: <p>Document translation allows the export of documents to other systems which
1.37      cvs      5987: do not accept Thot's canonical form. Translation can be used to export
1.30      cvs      5988: document to source-based formatters like T<sub><big>E</big></sub>X,
1.37      cvs      5989: L<sup>A</sup>T<sub><big>E</big></sub>X, and <tt>troff</tt>. It can also be
                   5990: used to translate documents into interchange formats like SGML or HTML. To
1.1       cvs      5991: allow the widest range of possible exports, Thot does not limit the choice of
                   5992: translations, but rather allows the user to define the formalisms into which
1.18      cvs      5993: documents can be translated.</p>
1.30      cvs      5994: 
                   5995: <p>For each document or object class, a set of translation rules can be
                   5996: defined, specifying how the canonical form should be transformed into a given
1.37      cvs      5997: formalism. These translation rules are grouped into <em>translation
1.18      cvs      5998: schemas</em>, each schema containing the rules necessary to translate a
1.1       cvs      5999: generic logical structure (document or object structure) into a particular
1.37      cvs      6000: formalism. The same generic logical structure can have several different
1.1       cvs      6001: translation schemas, each defining translation rules for a different
1.18      cvs      6002: formalism.</p>
1.30      cvs      6003: 
1.37      cvs      6004: <p>Like presentation schemas, translation schemas are generic. Thus, they
1.30      cvs      6005: apply to an entire object or document class and permit translation of all
                   6006: documents or objects of that class.</p>
1.18      cvs      6007: </div>
1.1       cvs      6008: 
1.18      cvs      6009: <div class="subsection">
1.37      cvs      6010: <h3><a name="sectc512" id="sectc512">Translation procedure</a></h3>
1.1       cvs      6011: 
1.30      cvs      6012: <p>The translator works on the specific logical structure of the document
1.37      cvs      6013: being translated. It traverses the primary tree of this logical structure in
1.1       cvs      6014: pre-order and, at each node encountered, it applies the corresponding
                   6015: translation rules defined in the translation schema. Translation can be
1.18      cvs      6016: associated:</p>
                   6017: <ul>
1.30      cvs      6018:   <li>with element types defined in the structure schema,</li>
                   6019:   <li>with global or local attributes defined in the structure schema,</li>
                   6020:   <li>with specific presentation rules,</li>
1.37      cvs      6021:   <li>with the content of the leaves of the structure (characters, symbols
1.30      cvs      6022:     and graphical elements)</li>
1.18      cvs      6023: </ul>
1.30      cvs      6024: 
                   6025: <p>Thus, for each node, the translator applies all rules associated with the
1.1       cvs      6026: element type, all rules associated with each attribute (local or global)
                   6027: carried by the element, and if the element is a leaf of the tree, it also
1.10      cvs      6028: applies translation rules for characters, symbols, or graphical elements,
1.18      cvs      6029: depending on the type of the leaf.</p>
1.30      cvs      6030: 
                   6031: <p>Rules associated with the content of leaves are different from all other
1.1       cvs      6032: rules: they specify only how to translate character strings, symbols, and
1.37      cvs      6033: graphical elements. All other rules, whether associated with element types,
1.1       cvs      6034: with specific presentation rules or with attributes, are treated similarly.
1.18      cvs      6035: These rules primarily allow:</p>
                   6036: <ul>
1.30      cvs      6037:   <li>generation of a text constant or variable before or after the contents
                   6038:     of an element,</li>
                   6039:   <li>modification of the order in which elements appear after
                   6040:   translation,</li>
                   6041:   <li>removal of an element in the translated document,</li>
                   6042:   <li>and writing messages on the user's terminal during translation.</li>
1.18      cvs      6043: </ul>
                   6044: </div>
                   6045: </div>
1.1       cvs      6046: 
1.18      cvs      6047: <div class="section">
1.37      cvs      6048: <h2><a name="sectb52" id="sectb52">Translation definition language</a></h2>
1.1       cvs      6049: 
1.30      cvs      6050: <p>Translation schemas are written in a custom language, called T, which is
1.37      cvs      6051: described in the rest of this chapter. The grammar of T is specified using
1.18      cvs      6052: the same <a href="#sectc321">meta-language</a> as was used for the S and P
1.1       cvs      6053: languages and the translation schemas are written using the same conventions
1.37      cvs      6054: as the structure and presentation schemas. In particular, the keywords of the
1.1       cvs      6055: T language (the stings between apostrophes in the following syntax rules) can
                   6056: be written in any combination of upper-case and lower-case letters, but
                   6057: identifiers created by the programmer must always be written in the same
1.18      cvs      6058: way.</p>
1.1       cvs      6059: 
1.18      cvs      6060: <div class="subsection">
1.37      cvs      6061: <h3><a name="sectc521" id="sectc521">Organization of a translation
                   6062: schema</a></h3>
1.1       cvs      6063: 
1.30      cvs      6064: <p>A translation schema is begun by the <tt>TRANSLATION</tt> keyword and is
1.37      cvs      6065: terminated by the <tt>END</tt> keyword. The <tt>TRANSLATION</tt> keyword is
                   6066: followed by the name of the generic structure for which a translation is
                   6067: being defined and a semicolon. This name must be identical to the name which
1.18      cvs      6068: appears after the <tt>STRUCTURE</tt> keyword in the corresponding structure
                   6069: schema.</p>
1.30      cvs      6070: 
                   6071: <p>After this declaration of the structure, the following material appears in
1.18      cvs      6072: order:</p>
                   6073: <ul>
1.30      cvs      6074:   <li>the length of lines produced by the translation,</li>
                   6075:   <li>the character delimiting the end of the line,</li>
                   6076:   <li>the character string which the translator will insert if it must
                   6077:     line-break the translated text,</li>
1.37      cvs      6078:   <li>declarations of 
1.30      cvs      6079:     <ul>
                   6080:       <li>buffers,</li>
                   6081:       <li>counters,</li>
                   6082:       <li>constants,</li>
                   6083:       <li>variables,</li>
                   6084:     </ul>
                   6085:   </li>
                   6086:   <li>translation rules associated with element types,</li>
                   6087:   <li>translation rules associated with attributes,</li>
                   6088:   <li>translation rules associated with specific presentation rules,</li>
                   6089:   <li>translation rules associated with characters strings, symbols and
                   6090:     graphical elements.</li>
1.18      cvs      6091: </ul>
1.30      cvs      6092: 
1.37      cvs      6093: <p>Each of these sections is introduced by a keyword followed by a sequence
                   6094: of declarations. All of these sections are optional, expect for the
                   6095: translation rules associated with element types. Many <tt>TEXTTRANSLATE</tt>
                   6096: sections can appear, each defining the rules for translating character
1.41      vatton   6097: strings of a particular script.</p>
1.18      cvs      6098: <pre>     TransSchema ='TRANSLATION' ElemID ';'
1.1       cvs      6099:                 [ 'LINELENGTH' LineLength ';' ]
                   6100:                 [ 'LINEEND' CHARACTER ';' ]
                   6101:                 [ 'LINEENDINSERT' STRING ';' ]
                   6102:                 [ 'BUFFERS' BufferSeq ]
                   6103:                 [ 'COUNTERS' CounterSeq ]
                   6104:                 [ 'CONST' ConstSeq ]
                   6105:                 [ 'VAR' VariableSeq ]
                   6106:                   'RULES' ElemSeq
                   6107:                 [ 'ATTRIBUTES' AttrSeq ]
                   6108:                 [ 'PRESENTATION' PresSeq ]
1.30      cvs      6109:                 &lt; 'TEXTTRANSLATE' TextTransSeq &gt;
1.1       cvs      6110:                 [ 'SYMBTRANSLATE' TransSeq ]
                   6111:                 [ 'GRAPHTRANSLATE' TransSeq ]
1.18      cvs      6112:                   'END' .</pre>
                   6113: </div>
1.1       cvs      6114: 
1.18      cvs      6115: <div class="subsection">
1.37      cvs      6116: <h3><a name="sectc522" id="sectc522">Line length</a></h3>
1.1       cvs      6117: 
1.30      cvs      6118: <p>If a <tt>LINELENGTH</tt> instruction is present after the structure
1.37      cvs      6119: declaration, the translator divides the text it produces into lines, each
                   6120: line having a length less than or equal to the integer which follows the
                   6121: <tt>LINELENGTH</tt> keyword. This maximum line length is expressed as a
                   6122: number of characters. The end of the line is marked by the character defined
                   6123: by the <tt>LINEEND</tt> instruction. When the translator breaks the lines on
1.1       cvs      6124: a space character in generated text, this space will be replaced by the
1.18      cvs      6125: character string defined by the <tt>LINEENDINSERT</tt> instruction.</p>
1.30      cvs      6126: 
                   6127: <p>If the <tt>LINEEND</tt> instruction is not defined then the linefeed
                   6128: character (octal code 12) is used as the default line end character. If the
1.18      cvs      6129: <tt>LINEENDINSERT</tt> instruction is not defined, the linefeed character is
1.37      cvs      6130: inserted at the end of the produced lines. If there is no <tt>LINELENGTH</tt>
                   6131: instruction, the translated text is not divided into lines. Otherwise, if the
1.1       cvs      6132: translation rules generate line end marks, these marks remain in the
                   6133: translated text, but the length of the lines is not controlled by the
1.18      cvs      6134: translator.</p>
                   6135: <pre>     LineLength = NUMBER .</pre>
1.30      cvs      6136: 
1.18      cvs      6137: <blockquote class="example">
1.30      cvs      6138:   <p><strong>Example:</strong></p>
                   6139: 
                   6140:   <p>To limit the lines produced by the translator to a length of 80
                   6141:   characters, the following rule is written at the beginning of the
                   6142:   translation schema.</p>
                   6143:   <pre>LineLength 80;</pre>
1.18      cvs      6144: </blockquote>
                   6145: </div>
1.1       cvs      6146: 
1.18      cvs      6147: <div class="subsection">
1.37      cvs      6148: <h3><a name="sectc523" id="sectc523">Buffers</a></h3>
1.1       cvs      6149: 
1.37      cvs      6150: <p>A buffer is a unit of memory managed by the translator, which can either
1.18      cvs      6151: contain text read from the terminal during the translation (see the <a
                   6152: href="#sectc5212"><tt>Read</tt> rule</a>), or the name of the last picture
1.46      quint    6153: (bit-map) encountered by the translator in its traversal of the document, or
                   6154: a character string set by program. Remember the pictures are stored in files
                   6155: that are separate for the document files and that the canonical form contains
                   6156: only the names of the files in which the pictures are found.</p>
                   6157: 
                   6158: <p>Thus, there are three types of buffers: buffers for reading from the
                   6159: terminal (filled by the <tt>Read</tt> rule), the buffer of picture names
                   6160: (containing the name of the last picture encountered) and buffer filled by
                   6161: programs (see function <code>SetVariableBuffer</code> in the code) also
                   6162: called <em>variable buffers</em>. A translation schema can use all types of
                   6163: buffers, one or several read buffers, one (and only one) picture name buffer,
                   6164: and one or several variable buffers.</p>
1.30      cvs      6165: 
                   6166: <p>If any buffers are used, the <tt>BUFFERS</tt> keyword must be present,
1.37      cvs      6167: followed by declarations of every buffer used in the translation schema. Each
1.46      quint    6168: buffer declaration is composed of the name of the buffer, chosen freely by
                   6169: the programmer, followed by a keyword between parentheses to define the type
                   6170: of the buffer (read buffers do not require any keyword, as they are the
                   6171: default type). The picture name buffer is identified by the <tt>Picture</tt>
                   6172: keyword, between parentheses, following the buffer name. The <tt>Picture</tt>
                   6173: keyword may only appear once. A variable buffer is identified by the
                   6174: <tt>Variable</tt> keyword, between parentheses, following the buffer name.
                   6175: Each buffer declaration is terminated by a semicolon.</p>
                   6176: <pre>     BufferSeq  = Buffer &lt; Buffer &gt; .
                   6177:      Buffer     = BufferID [ '(' BufferType ')' ] ';' .
                   6178:      BufferID   = NAME .
                   6179:      BufferType = 'Picture' / 'Variable' .</pre>
1.30      cvs      6180: 
1.18      cvs      6181: <blockquote class="example">
1.30      cvs      6182:   <p><strong>Example:</strong></p>
                   6183: 
                   6184:   <p>The following buffer declarations create a picture name buffer named
1.37      cvs      6185:   <tt>pictureName</tt> and a read buffer named <a name="destname"
                   6186:   id="destname"><tt>DestName</tt></a>:</p>
1.30      cvs      6187:   <pre>BUFFERS
1.18      cvs      6188:      pictureName (Picture); DestName;</pre>
                   6189: </blockquote>
                   6190: </div>
1.1       cvs      6191: 
1.18      cvs      6192: <div class="subsection">
1.37      cvs      6193: <h3><a name="sectc524" id="sectc524">Counters</a></h3>
1.30      cvs      6194: 
                   6195: <p>Certain translation rules generate text that varies according to the
1.37      cvs      6196: context of the element to which the rules apply. Variable text is defined
1.30      cvs      6197: either in the <a href="#sectc526"><tt>VAR</tt> section</a> of the translation
                   6198: schema or in the rule itself (see the <tt>Create</tt> and <tt>Write</tt>
1.37      cvs      6199: rules). Both types of definition rely on counters for the calculation of
1.30      cvs      6200: variable material.</p>
                   6201: 
                   6202: <p>There are two types of counter: counters whose value is explicitely
                   6203: computed by applying <a href="#sectc5221"><tt>Set</tt> and <tt>Add</tt>
                   6204: rules</a>, and counters whose value is computed by a function associated with
                   6205: the counter. Those functions allow the same calculations as can be used in
1.37      cvs      6206: presentation schemas. As in a presentation schema, counters must be defined
                   6207: in the <tt>COUNTERS</tt> section of the translation schema before they are
1.30      cvs      6208: used.</p>
                   6209: 
                   6210: <p>When counters are used in a translation schema, the <tt>COUNTERS</tt>
1.37      cvs      6211: keyword is followed by the declarations of every counter used. Each
                   6212: declaration is composed of the counter's name possibly followed by a colon
                   6213: and the counting function to be used for the counter. The declaration is
1.30      cvs      6214: terminated by a semi-colon. If the counter is explicitely computed by
                   6215: <tt>Set</tt> and <tt>Add</tt> rules, no counting function is indicated. If a
                   6216: counting function is indicated, <tt>Set</tt> and <tt>Add</tt> rules cannot be
                   6217: applied to that counter.</p>
1.1       cvs      6218: 
1.30      cvs      6219: <p>The counting function indicates how the counter's value will be computed.
1.18      cvs      6220: Three functions are available: <tt>Rank</tt>, <tt>Rlevel</tt>, and
                   6221: <tt>Set</tt>.</p>
                   6222: <ul>
1.40      quint    6223:   <li><tt>Rank of ElemID</tt> indicates that the counter's value is the rank
                   6224:     of the element of type <tt>ElemID</tt> which encloses the element for
                   6225:     which the counter is being evaluated. For the purposes of this function,
                   6226:     an element of type <tt>ElemID</tt> is considered to enclose itself. This
                   6227:     function is primarily used when the element of type <tt>ElemID</tt> is
                   6228:     part of an aggregate or list, in which case the counter's value is the
                   6229:     element's rank in its list or aggregate. Note that, unlike the
                   6230:     <tt>Rank</tt> function for presentation schemas, the <tt>Page</tt>
                   6231:     keyword cannot be used in place of the <tt>ElemID</tt>. 
1.37      cvs      6232:     <p>The type name <tt>ElemID</tt> can be followed by an integer. That
                   6233:     number represents the relative level, among the ancestors of the
                   6234:     concerned element, of the element whose rank is asked. If that relative
                   6235:     level <i>n</i> is unsigned, the <i>n<sup>th</sup></i> element of type
                   6236:     <tt>ElemID</tt> encountered when travelling the logical structure from
                   6237:     the root to the concerned element is taken into account. If the relative
1.30      cvs      6238:     level is negative, the logical structure is travelled in the other
                   6239:     direction, from the concerned element to the root.</p>
                   6240:   </li>
1.40      quint    6241:   <li><tt>Rlevel of ElemID</tt> indicates that the counter's values is the
                   6242:     relative level in the tree of the element for which the counter is being
                   6243:     evaluated. The counter counts the number of elements of type
                   6244:     <tt>ElemID</tt> which are found on the path between the root of the
                   6245:     document's logical structure tree and the element (inclusive).</li>
                   6246:   <li><tt>Set n on Type1 Add m on Type2</tt> indicates that the counter's
                   6247:     value is calculated as follows: in traversing the document from the
                   6248:     beginning to the element for which the counter is being evaluated, the
                   6249:     counter is set to the value <tt>n</tt> each time a <tt>Type1</tt> element
                   6250:     is encountered and is incremented by the amount <tt>m</tt> each time a
                   6251:     <tt>Type2</tt> element is encountered. The initial value <tt>n</tt> and
                   6252:     the increment <tt>m</tt> are integers.</li>
1.30      cvs      6253: </ul>
                   6254: 
                   6255: <p>As in a presentation schema, the <tt>Rank</tt> and <tt>Set</tt> functions
1.37      cvs      6256: can be modified by a numeric attribute which changes their initial value.
                   6257: This is indicated by the <tt>Init</tt> keyword followed by the numeric
                   6258: attribute's name. The <tt>Set</tt> function takes the value of the attribute
                   6259: instead of the <tt>InitValue</tt> (<tt>n</tt>). For the <tt>Rank</tt>
                   6260: function, the value of the attribute is considered to be the rank of the
                   6261: first element of the list (rather than the normal value of 1). Subsequent
                   6262: items in the list have their ranks shifted accordingly. In both cases, the
                   6263: attribute must be numeric and must be a local attribute of the root of the
                   6264: document itself.</p>
1.30      cvs      6265: <pre>     CounterSeq  = Counter &lt; Counter &gt; .
1.1       cvs      6266:      Counter     = CounterID [ ':' CounterFunc ] ';' .
                   6267:      CounterID   = NAME .
                   6268:      CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ]
                   6269:                    [ 'Init' AttrID ] /
                   6270:                    'Rlevel' 'of' ElemID /
                   6271:                    'Set' InitValue 'On' ElemID
                   6272:                          'Add' Increment 'On' ElemID
                   6273:                          [ 'Init' AttrID ] .
                   6274:      SLevelAsc   = [ '-' ] LevelAsc .
                   6275:      LevelAsc    =  NUMBER .
                   6276:      InitValue   = NUMBER .
                   6277:      Increment   = NUMBER .
                   6278:      ElemID      = NAME .
1.18      cvs      6279:      AttrID      = NAME .</pre>
1.30      cvs      6280: 
1.18      cvs      6281: <blockquote class="example">
1.30      cvs      6282:   <p><strong>Example:</strong></p>
                   6283: 
                   6284:   <p>If the body of a chapter is defined in the structure schema by:</p>
                   6285:   <pre>Chapter_Body = LIST OF
1.1       cvs      6286:          (Section = BEGIN
                   6287:                     Section_Title = Text;
                   6288:                     Section_Body  = BEGIN
                   6289:                                     Paragraphs;
                   6290:                                     Section;
                   6291:                                     END;
                   6292:                     END
1.18      cvs      6293:          );</pre>
1.30      cvs      6294: 
                   6295:   <p>(sections are defined recursively), a counter can be defined giving the
1.37      cvs      6296:   <a name="sectnum" id="sectnum">number of a section</a> within its level in
                   6297:   the hierarchy:</p>
1.30      cvs      6298:   <pre>COUNTERS
1.18      cvs      6299:    SectionNumber : Rank of Section;</pre>
1.30      cvs      6300: 
                   6301:   <p>A counter holding the hierarchic level of a section:</p>
                   6302:   <pre>   SectionLevel : Rlevel of Section;</pre>
                   6303: 
1.37      cvs      6304:   <p>A <a name="uniquenum" id="uniquenum">counter</a> which sequentially
                   6305:   numbers all the document's sections, whatever their hierarchic level:</p>
1.30      cvs      6306:   <pre>   UniqueSectNum : Set 0 on Document Add 1 on Section;</pre>
1.18      cvs      6307: </blockquote>
                   6308: </div>
1.1       cvs      6309: 
1.18      cvs      6310: <div class="subsection">
1.37      cvs      6311: <h3><a name="sectc525" id="sectc525">Constants</a></h3>
1.1       cvs      6312: 
1.30      cvs      6313: <p>A common feature of translation rules is the generation of constant text.
1.37      cvs      6314: This text can be defined in the rule that generates it (see for example the
                   6315: <a href="#sectc5210"><tt>Create</tt></a> and <a
1.18      cvs      6316: href="#sectc5211"><tt>Write</tt></a> rules); but it can also be defined once
                   6317: in the constant declaration section and used many times in different rules.
1.37      cvs      6318: The latter option is preferable when the same text is used in several rules
                   6319: or several <a href="#sectc526">variables</a>.</p>
1.30      cvs      6320: 
                   6321: <p>The <tt>CONST</tt> keyword begins the constant declaration section of the
1.37      cvs      6322: translation schema. It must be omitted if no constants are declared. Each
                   6323: constant declaration is composed of the constant name, an equals sign, and
                   6324: the constant's value, which is a character string between apostrophes. A
                   6325: constant declaration is terminated by a semicolon.</p>
1.30      cvs      6326: <pre>     ConstSeq   = Const &lt; Const &gt; .
1.1       cvs      6327:      Const      = ConstID '=' ConstValue ';' .
                   6328:      ConstID    = NAME .
1.18      cvs      6329:      ConstValue = STRING .</pre>
1.30      cvs      6330: 
1.18      cvs      6331: <blockquote class="example">
1.37      cvs      6332:   <p><strong><a name="levelexample"
                   6333:   id="levelexample">Example:</a></strong></p>
1.30      cvs      6334: 
                   6335:   <p>The following rule assigns the name <tt>TxtLevel</tt> to the character
                   6336:   string ``Level'':</p>
                   6337:   <pre>CONST
1.18      cvs      6338:      TxtLevel = 'Level';</pre>
                   6339: </blockquote>
                   6340: </div>
1.1       cvs      6341: 
1.18      cvs      6342: <div class="subsection">
1.37      cvs      6343: <h3><a name="sectc526" id="sectc526">Variables</a></h3>
1.1       cvs      6344: 
1.30      cvs      6345: <p>Variables allow to define variable text which is generated by the
1.37      cvs      6346: <tt>Create</tt> and <tt>Write</tt> rules. They are also used to define file
1.18      cvs      6347: names which are used in the <tt>Create</tt>, <tt>ChangeMainFile</tt>,
1.37      cvs      6348: <tt>RemoveFile</tt>, and <tt>Indent</tt> rules. Variables can be defined
1.18      cvs      6349: either in the <tt>VAR</tt> section of the translation schema or directly in
1.37      cvs      6350: the rules which use them. Variables that define file names must be declared
1.18      cvs      6351: in the <tt>VAR</tt> section, and when the same variable is used several times
                   6352: in the translation schema, it makes sense to define it globally in the
1.37      cvs      6353: <tt>VAR</tt> section. This section is only present if at least one variable
1.18      cvs      6354: is defined globally.</p>
1.30      cvs      6355: 
                   6356: <p>After the <tt>VAR</tt> keyword, each global variable is defined by its
                   6357: name, a colon separator and a sequence of functions (at least one function).
1.37      cvs      6358: Each variable definition is terminated by a semicolon. Functions determine
                   6359: the different parts which together give the value of the variable. The value
                   6360: is obtained by concatenating the strings produced by each of the functions.
                   6361: Seven types of functions are available. Each variable definition may use any
                   6362: number of functions of each type.</p>
1.18      cvs      6363: <ul>
1.30      cvs      6364:   <li>The function <tt>Value(Counter)</tt>returns a string representing the
                   6365:     value taken by the counter when it is evaluated for the element in whose
1.37      cvs      6366:     rule the variable is used. The counter must have been declared in the
                   6367:     <tt>COUNTERS</tt> section of the translation schema. When the counter is
1.30      cvs      6368:     expressed in arabic numerals, the counter name can be followed by a colon
                   6369:     and an integer indicating a minimum length (number of characters) for the
1.37      cvs      6370:     string; if the counter's value is normally expressed with fewer
                   6371:     characters than the required minimum, zeroes are added to the front of
                   6372:     the string to achieve the minimum length. 
1.30      cvs      6373:     <p>By default, the counter value is written in arabic digits. If another
                   6374:     representation of that value is needed, the counter name must be followed
                   6375:     by a comma and one of the following keywords:</p>
                   6376:     <ul>
1.40      quint    6377:       <li><tt>Arabic</tt> : arabic numerals (default value),</li>
                   6378:       <li><tt>LRoman</tt> : lower-case roman numerals,</li>
                   6379:       <li><tt>URoman</tt> : upper-case roman numerals,</li>
                   6380:       <li><tt>Uppercase</tt> : upper-case letter,</li>
                   6381:       <li><tt>Lowercase</tt> : lower-case letter.</li>
1.30      cvs      6382:     </ul>
                   6383:   </li>
                   6384:   <li>The function <tt>FileDir</tt>, without parameter, returns a string
                   6385:     representing the name of the directory of the output file that has been
                   6386:     given as a parameter to the translation program. The string includes a
                   6387:     character '/' at the end.</li>
                   6388:   <li>The function <tt>FileName</tt>, without parameter, returns a string
                   6389:     representing the name of the output file that has been given as a
                   6390:     parameter to the translation program. The file extension (the character
                   6391:     string that terminate the file name, after a dot) is not part of that
                   6392:     string.</li>
                   6393:   <li>The function <tt>Extension</tt>, without parameter, returns a string
                   6394:     representing the extension of the file name. That string is empty if the
                   6395:     file name that has been given as a parameter to the translation program
                   6396:     has no extension. If there is an extension, its first character is a
                   6397:   dot.</li>
                   6398:   <li>The function <tt>DocumentName</tt>, without parameter, returns a string
                   6399:     representing the name of the document being translated.</li>
                   6400:   <li>The function <tt>DocumentDir</tt>, without parameter, returns a string
                   6401:     representing the directory containing the document being translated.</li>
                   6402:   <li>The function formed by the name of a constant returns that constant's
                   6403:     value.</li>
                   6404:   <li>The function formed by a character string between apostrophes returns
                   6405:     that string.</li>
1.37      cvs      6406:   <li>The function formed by the name of a buffer returns the contents of
                   6407:     that buffer. If the named buffer is the picture buffer, then the name of
                   6408:     the last picture encountered is returned. Otherwise, the buffer is a read
1.31      cvs      6409:     buffer and the value returned is text previously read from the terminal.
1.30      cvs      6410:     If the buffer is empty (no picture has been encountered or the
                   6411:     <tt>Read</tt> rule has not been executed for the buffer), then the empty
                   6412:     string is returned.</li>
                   6413:   <li>The function formed by an attribute name takes the value of the
1.37      cvs      6414:     indicated attribute for the element to which the variable applies. If the
1.30      cvs      6415:     element does not have that attribute, then the element's ancestor are
1.37      cvs      6416:     searched toward the root of the tree. If one of the ancestors does have
                   6417:     the attribute then its value is used. If no ancestors have the attribute,
1.30      cvs      6418:     then the value of the function is the empty string.</li>
1.18      cvs      6419: </ul>
1.30      cvs      6420: <pre>     VariableSeq = Variable &lt; Variable &gt; .
                   6421:      Variable    = VarID ':' Function &lt; Function &gt; ';' .
1.1       cvs      6422:      VarID       = NAME .
                   6423:      Function    ='Value' '(' CounterID [ ':' Length ]
                   6424:                             [ ',' CounterStyle ] ')' /
                   6425:                   'FileDir' / 'FileName' / 'Extension' /
                   6426:                   'DocumentName' / 'DocumentDir' /
                   6427:                    ConstID / CharString / 
                   6428:                    BufferID / AttrID .
                   6429:      Length      = NUMBER .
                   6430:      CounterStyle= 'Arabic' / 'LRoman' / 'URoman' /
                   6431:                    'Uppercase' / 'Lowercase' .
1.18      cvs      6432:      CharString  = STRING .</pre>
1.30      cvs      6433: 
1.18      cvs      6434: <blockquote class="example">
1.30      cvs      6435:   <p><strong>Example:</strong></p>
                   6436: 
                   6437:   <p>To create, at the beginning of each section of the translated document,
                   6438:   text composed of the string ``Section'' followed by the section number, the
1.37      cvs      6439:   following <a name="varsectexample" id="varsectexample">variable
                   6440:   definition</a> might be used:</p>
1.30      cvs      6441:   <pre>VAR
1.18      cvs      6442:      SectionVar : 'Section' Value(SectionNumber);</pre>
1.30      cvs      6443: 
                   6444:   <p>(see the definition of <a
                   6445:   href="#sectnum"><tt>SectionNumber</tt></a>).</p>
                   6446: 
1.37      cvs      6447:   <p>The following variable definition can be used to create, at the
                   6448:   beginning of each section, the text ``Level'' followed by the hierarchical
                   6449:   level of the section. It used the constant defined above.</p>
1.30      cvs      6450:   <pre>     LevelVar : TxtLevel Value(SectionLevel);</pre>
                   6451: 
                   6452:   <p>(see the definitions of <a href="#sectnum"><tt>SectionLevel</tt></a> and
                   6453:   of <a href="#levelexample"><tt>TxtLevel</tt></a>).</p>
                   6454: 
                   6455:   <p>To generate the translation of each section in a different file (see <a
1.37      cvs      6456:   href="#sectc5220">rule <tt>ChangeMainFile</tt></a>), the name of these
                   6457:   files might be defined by the following variable:</p>
1.30      cvs      6458:   <pre>     VarOutpuFile : FileName Value(SectionNumber)
1.18      cvs      6459:                     Extension;</pre>
1.30      cvs      6460: 
1.37      cvs      6461:   <p>If <tt>output.txt</tt> is the name of the <a name="varoutputfile"
                   6462:   id="varoutputfile">output file</a> specified when starting the translation
                   6463:   program, translated sections are written in files <tt>output1.txt</tt>,
                   6464:   <tt>output2.txt</tt>, etc.</p>
1.18      cvs      6465: </blockquote>
                   6466: </div>
                   6467: 
                   6468: <div class="subsection">
1.37      cvs      6469: <h3><a name="sectc527" id="sectc527">Translating structure elements</a></h3>
1.18      cvs      6470: 
1.30      cvs      6471: <p>The <tt>RULES</tt> keyword introduces the translation rules which will be
1.37      cvs      6472: applied to the various structured element types. Translation rules can be
                   6473: specified for each element type defined in the structure schema, including
                   6474: the base types defined implicitly, whose names are <tt>TEXT_UNIT</tt>,
1.18      cvs      6475: <tt>PICTURE_UNIT</tt>, <tt>SYMBOL_UNIT</tt>, <tt>GRAPHIC_UNIT</tt> and
1.37      cvs      6476: <tt>PAGE_UNIT</tt>. But it is not necessary to specify rules for every
1.18      cvs      6477: defined type.</p>
1.30      cvs      6478: 
1.37      cvs      6479: <p>If there are no translation rules for an element type, the elements that
                   6480: it contains (and which may have rules themselves) will still be translated,
                   6481: but the translator will produce nothing for the element itself. To make the
1.18      cvs      6482: translator completely ignore the content of an element the <a
                   6483: href="#sectc5217"><tt>Remove</tt> rule</a> must be used.</p>
1.30      cvs      6484: 
                   6485: <p>The translation rules for an element type defined in the structure schema
                   6486: are written using the name of the type followed by a colon and the list of
1.37      cvs      6487: applicable rules. When the element type is a <a href="#sectd3285">mark
1.18      cvs      6488: pair</a>, but only in this case, the type name must be preceded by the
1.37      cvs      6489: <tt>First</tt> or <tt>Second</tt> keyword. This keyword indicates whether the
1.18      cvs      6490: rules that follow apply to the first or second mark of the pair.</p>
1.30      cvs      6491: 
1.37      cvs      6492: <p>The list of rules can take several forms. It may be a simple
                   6493: non-conditional rule. It can also be formed by a condition followed by one or
                   6494: more simple rules. Or it can be a block of rules beginning with the
1.30      cvs      6495: <tt>BEGIN</tt> keyword and ending with the <tt>END</tt> keyword and a
1.37      cvs      6496: semicolon. This block of rules can contain one or more simple rules and/or
1.30      cvs      6497: one or more conditions, each followed by one or more simple rules.</p>
                   6498: <pre>     ElemSeq        = TransType &lt; TransType &gt; .
1.1       cvs      6499:      TransType      = [ FirstSec ] ElemID ':' RuleSeq .
                   6500:      FirstSec       = 'First' / 'Second' .
1.30      cvs      6501:      RuleSeq        = Rule / 'BEGIN' &lt; Rule &gt; 'END' ';' .
1.1       cvs      6502:      Rule           = SimpleRule / ConditionBlock .
                   6503:      ConditionBlock = 'IF' ConditionSeq SimpleRuleSeq .
1.30      cvs      6504:      SimpleRuleSeq  = 'BEGIN' &lt; SimpleRule &gt; 'END' ';' / 
1.18      cvs      6505:                       SimpleRule .</pre>
                   6506: </div>
1.1       cvs      6507: 
1.18      cvs      6508: <div class="subsection">
1.37      cvs      6509: <h3><a name="sectc528" id="sectc528">Conditional rules</a></h3>
1.1       cvs      6510: 
1.30      cvs      6511: <p>In a translation schema, the translation rules are either associated with
1.37      cvs      6512: element types or with attribute values or with a specific presentation. They
1.1       cvs      6513: are applied by the translator each time an element of the corresponding type
                   6514: is encountered in the translated document or each time the attribute value is
                   6515: carried by an element or also, each time the specific translation is attached
1.37      cvs      6516: to an element. This systematic application of the rules can be relaxed: it is
                   6517: possible to add a condition to one or more rules, so that these rules are
                   6518: only applied when the condition is true.</p>
1.30      cvs      6519: 
                   6520: <p>A condition begins with the keyword <tt>IF</tt>, followed by a sequence of
1.37      cvs      6521: elementary conditions. Elementary conditions are separated from each other by
                   6522: the <tt>AND</tt> keyword. If there is only one elementary condition, this
                   6523: keyword is absent. The rules are only applied if all the elementary
                   6524: conditions are true. The elementary condition can be negative; it is then
1.18      cvs      6525: preceded by the <tt>NOT</tt> keyword.</p>
1.30      cvs      6526: 
                   6527: <p>When the translation rule(s) controlled by the condition apply to a
                   6528: reference element or a reference attribute, an elementary condition can also
1.37      cvs      6529: apply to element referred by this reference. The <tt>Target</tt> keyword is
                   6530: used for that purpose. It must appear before the keyword defining the
1.30      cvs      6531: condition type.</p>
                   6532: 
                   6533: <p>Depending on their type, some conditions may apply either to the element
1.37      cvs      6534: with which they are associated, or to one of its ancestor. In the case of an
1.18      cvs      6535: ancestor, the key word <tt>Ancestor</tt> must be used, followed by</p>
                   6536: <ul>
1.30      cvs      6537:   <li>either an integer which represents the number of levels in the tree
                   6538:     between the element and the ancestor of interest,</li>
1.37      cvs      6539:   <li>or the type name of the ancestor of interest. If that type is defined
1.30      cvs      6540:     in a separate structure schema, the name of that schema must follow
                   6541:     between parentheses.</li>
1.18      cvs      6542: </ul>
1.30      cvs      6543: 
1.37      cvs      6544: <p>There is a special case for the parent element, which can be simply
                   6545: written <tt>Parent</tt> instead of <tt>Ancestor 1</tt>.</p>
1.30      cvs      6546: 
                   6547: <p>Only conditions <tt>First</tt>, <tt>Last</tt>, <tt>Referred</tt>,
1.34      cvs      6548: <tt>Within</tt>, <tt>Attributes</tt>, <tt>Presentation</tt>, and those
                   6549: concerning an attribute or a specific presentation can apply to an ancestor.
                   6550: Conditions <tt>FirstRef</tt>, <tt>LastRef</tt>, <tt>ExternalRef</tt>,
1.41      vatton   6551: <tt>Script</tt>, <tt>FirstAttr</tt>, <tt>LastAttr</tt>,
1.34      cvs      6552: <tt>ComputedPage</tt>, <tt>StartPage</tt>, <tt>UserPage</tt>,
                   6553: <tt>ReminderPage</tt>, <tt>Empty</tt> cannot be preceded by keywords
                   6554: <tt>Parent</tt> or <tt>Ancestor</tt>.</p>
1.30      cvs      6555: 
1.37      cvs      6556: <p>In condition <tt>Referred</tt> and in the condition that applies to a
                   6557: named attribute, a symbol '<tt>*</tt>' can indicate that the condition is
                   6558: related only to the element itself. If this symbol is not present, not only
                   6559: the element is considered, but also its ancestor, at any level.</p>
1.30      cvs      6560: 
                   6561: <p>The form of an elementary condition varies according to the type of
1.18      cvs      6562: condition.</p>
1.1       cvs      6563: 
1.18      cvs      6564: <div class="subsubsection">
1.37      cvs      6565: <h4><a name="sectd5281" id="sectd5281">Conditions based on the logical
                   6566: position of the element</a></h4>
1.30      cvs      6567: 
                   6568: <p>The condition can be on the position of the element in the document's
1.37      cvs      6569: logical structure tree. It is possible to test whether the element is the
1.30      cvs      6570: first (<tt>First</tt>) or last (<tt>Last</tt>) among its siblings or if it is
                   6571: not the first (<tt>NOT First</tt>) or not the last (<tt>NOT Last</tt>).</p>
                   6572: 
                   6573: <p>It is also possible to test if the element is contained in an element of a
1.18      cvs      6574: given type (<tt>Within</tt>) or if it is not (<tt>NOT Within</tt>). If that
1.1       cvs      6575: element type is defined in a structure schema which is not the one which
                   6576: corresponds to the translation schema, the type name of this element must be
                   6577: followed, between parentheses, by the name of the structure schema which
1.18      cvs      6578: defines it.</p>
1.30      cvs      6579: 
                   6580: <p>If the keyword <tt>Within</tt> is preceded by <tt>Immediately</tt>, the
1.18      cvs      6581: condition is satisfied only if the <em>parent</em> element has the type
                   6582: indicated. If the word <tt>Immediately</tt> is missing, the condition is
                   6583: satisfied if any <em>ancestor</em> has the type indicated.</p>
1.30      cvs      6584: 
                   6585: <p>An integer <i>n</i> can appear between the keyword <tt>Within</tt> and the
1.37      cvs      6586: type. It specifies the number of ancestors of the indicated type that must be
                   6587: present for the condition to be satisfied. If the keyword
1.18      cvs      6588: <tt>Immediately</tt> is also present, the <i>n</i> immediate ancestors of the
1.37      cvs      6589: element must have the indicated type. The integer <i>n</i> must be positive
                   6590: or zero. It can be preceded by <tt>&lt;</tt> or <tt>&gt;</tt> to indicate a
                   6591: maximum or minimum number of ancestors. If these symbols are missing, the
                   6592: condition is satisfied only if it exists exactly <i>n</i> ancestors. When
1.30      cvs      6593: this number is missing, it is equivalent to &gt; 0.</p>
                   6594: 
1.37      cvs      6595: <p>If the condition applies to translation rules associated with an
                   6596: attribute, i.e. if it is in the <tt>ATTRIBUTES</tt> section of the
                   6597: presentation schema, the condition can be simply an element name. Translation
                   6598: rules are then executed only if the attribute is attached to an element of
                   6599: that type. The keyword <tt>NOT</tt> before the element name indicates that
                   6600: the translation rules must be executed only if the element is not of the type
                   6601: indicated.</p>
1.18      cvs      6602: </div>
1.1       cvs      6603: 
1.18      cvs      6604: <div class="subsubsection">
1.37      cvs      6605: <h4><a name="sectd5282" id="sectd5282">Conditions on references</a></h4>
1.1       cvs      6606: 
1.30      cvs      6607: <p>References may be taken into account in conditions, which can be based on
                   6608: the fact that the element, or one of its ancestors (unless symbol <tt>*</tt>
                   6609: is present), is designated by a at least one reference (<tt>Referred</tt>) or
1.37      cvs      6610: by none (<tt>NOT Referred</tt>). If the element or attribute to which the
1.1       cvs      6611: condition is attached is a reference, the condition can be based on the fact
                   6612: that it acts as the first reference to the designated element
1.18      cvs      6613: (<tt>FirstRef</tt>), or as the last (<tt>LastRef</tt>), or as a reference to
1.37      cvs      6614: an element located in another document (<tt>ExternalRef</tt>). Like all
1.18      cvs      6615: conditions, conditions on references can be inverted by the <tt>NOT</tt>
                   6616: keyword.</p>
                   6617: </div>
                   6618: 
                   6619: <div class="subsubsection">
1.41      vatton   6620: <h4><a name="sectd5284" id="sectd5284">Conditions on the scripts</a></h4>
1.1       cvs      6621: 
1.30      cvs      6622: <p>The character string base type (and only this type) can use the condition
1.43      quint    6623: <tt>Script = a</tt> which indicates that the translation rule(s) should only
                   6624: apply if the script of the character string is the one whose name appears
                   6625: after the equals sign (or is not, if there is a preceding <tt>NOT</tt>
                   6626: keyword). This condition cannot be applied to translation rules of an
                   6627: attribute.</p>
1.30      cvs      6628: 
1.41      vatton   6629: <p>In the current implementation of Thot, the available scripts are the
                   6630: <tt>Latin</tt> script and the <tt>Greek</tt> script.</p>
1.18      cvs      6631: </div>
1.1       cvs      6632: 
1.18      cvs      6633: <div class="subsubsection">
1.37      cvs      6634: <h4><a name="sectd5285" id="sectd5285">Conditions on page breaks</a></h4>
1.1       cvs      6635: 
1.30      cvs      6636: <p>The page break base type (and only this type) can use the following
1.18      cvs      6637: conditions: <tt>ComputedPage</tt>, <tt>StartPage</tt>, <tt>UserPage</tt>, and
1.37      cvs      6638: <tt>ReminderPage</tt>. The <tt>ComputedPage</tt> condition indicates that the
1.1       cvs      6639: translation rule(s) should apply if the page break was created automatically
1.37      cvs      6640: by Thot; the <tt>StartPage</tt> condition is true if the page break is
1.18      cvs      6641: generated before the element by the <tt>Page</tt> rule of the P language; the
                   6642: <tt>UserPage</tt> condition applies if the page break was inserted by the
1.37      cvs      6643: user; and the <tt>ReminderPage</tt> is applied if the page break is a
                   6644: reminder of page breaking.</p>
1.18      cvs      6645: </div>
1.1       cvs      6646: 
1.18      cvs      6647: <div class="subsubsection">
1.37      cvs      6648: <h4><a name="sectd5286" id="sectd5286">Conditions on the element's
                   6649: content</a></h4>
1.1       cvs      6650: 
1.37      cvs      6651: <p>The condition can be based on whether or not the element is empty. An
1.30      cvs      6652: element which has no children or whose leaves are all empty is considered to
1.37      cvs      6653: be empty itself. This condition is expressed by the <tt>Empty</tt> keyword,
1.30      cvs      6654: optionally preceded by the <tt>NOT</tt> keyword.</p>
1.18      cvs      6655: </div>
1.1       cvs      6656: 
1.18      cvs      6657: <div class="subsubsection">
1.37      cvs      6658: <h4><a name="sectd5288" id="sectd5288">Conditions on the presence of specific
                   6659: presentation rules</a></h4>
1.30      cvs      6660: 
                   6661: <p>The condition can be based on the presence or absence of specific
1.37      cvs      6662: presentation rules associated with the translated element, whatever the
                   6663: rules, their value or their number. This condition is expressed by the
                   6664: keyword <tt>Presentation</tt>, optionally preceded by the <tt>NOT</tt>
                   6665: keyword.</p>
1.18      cvs      6666: </div>
1.1       cvs      6667: 
1.18      cvs      6668: <div class="subsubsection">
1.37      cvs      6669: <h4><a name="sectd5289" id="sectd5289">Conditions on the presence of logical
1.18      cvs      6670: attributes</a></h4>
1.30      cvs      6671: 
                   6672: <p>In the same way, the condition can be based on the presence or absence of
1.1       cvs      6673: attributes associated with the translated elements, no matter what the
1.37      cvs      6674: attributes or their values. The <tt>Attributes</tt> keyword expresses this
1.18      cvs      6675: condition.</p>
                   6676: </div>
1.1       cvs      6677: 
1.18      cvs      6678: <div class="subsubsection">
1.37      cvs      6679: <h4><a name="sectd52810" id="sectd52810">Conditions on logical
                   6680: attributes</a></h4>
1.1       cvs      6681: 
1.30      cvs      6682: <p>If the condition appears in the translation rules of an attribute, the
1.37      cvs      6683: <tt>FirstAttr</tt> and <tt>LastAttr</tt> keywords can be used to indicate
                   6684: that the rules must only be applied if this attribute is the first attribute
                   6685: for the translated element or if it is the last (respectively). These
                   6686: conditions can also be inverted by the <tt>NOT</tt> keyword.</p>
                   6687: 
                   6688: <p>Another type of condition can only be applied to the translation rules
                   6689: when the element being processed (or one of its ancestors if symbol
                   6690: <tt>*</tt> is missing) has a certain attribute, perhaps with a certain value
                   6691: or, in contrast, when the element does not have this attribute with this
                   6692: value. The condition is specified by writing the name of the attribute after
                   6693: the keyword <tt>IF</tt> or <tt>AND</tt>. The <tt>NOT</tt> keyword can be used
                   6694: to invert the condition. If the translation rules must be applied to any
                   6695: element which has this attribute (or does not have it, if the condition is
                   6696: inverted) no matter what the attribute's value, the condition is complete.
                   6697: If, in contrast, the condition applies to one or more values of the
                   6698: attribute, these are indicated after the name of the attribute, except for
                   6699: reference attributes which do not have values.</p>
                   6700: 
                   6701: <p>The representation of the values of an <a name="relattr"
                   6702: id="relattr">attribute</a> in a condition depends on the attribute's type.
                   6703: For attributes with enumerated or textual types, the value (a name or
                   6704: character string between apostrophes, respectively) is simply preceded by an
                   6705: equals sign. For numeric attributes, the condition can be based on a single
                   6706: value or on a range of values. In the case of a unique value, this value (an
                   6707: integer) is simply preceded by an equals sign. Conditions based on ranges of
                   6708: values have several forms:</p>
1.18      cvs      6709: <ul>
1.30      cvs      6710:   <li>all values less than a given value (the value is preceded by a ``less
                   6711:     than'' sign).</li>
                   6712:   <li>all values greater than a given value (the value is preceded by a
                   6713:     ``greater than'' sign).</li>
1.37      cvs      6714:   <li>all values falling in an interval, bounds included. The range of values
                   6715:     is then specified <tt>IN [</tt>Minimum <tt>..</tt>Maximum<tt>]</tt>,
                   6716:     where Minimum and Maximum are integers.</li>
1.18      cvs      6717: </ul>
1.30      cvs      6718: 
1.37      cvs      6719: <p>All numeric values may be negative. The integer is simply preceded by a
1.30      cvs      6720: minus sign.</p>
                   6721: 
                   6722: <p>Both local and global attributes can be used in conditions.</p>
1.18      cvs      6723: </div>
1.1       cvs      6724: 
1.18      cvs      6725: <div class="subsubsection">
1.37      cvs      6726: <h4><a name="sectd52811" id="sectd52811">Conditions on specific presentation
                   6727: rules</a></h4>
1.1       cvs      6728: 
1.30      cvs      6729: <p>It is possible to apply translation rules only when the element being
1.1       cvs      6730: processed has or does not have a specific presentation rule, possibly with a
1.37      cvs      6731: certain value. The condition is specified by writing the name of the
                   6732: presentation rule after the keyword <tt>IF</tt> or <tt>AND</tt>. The
                   6733: <tt>NOT</tt> keyword can be used to invert the condition. If the translation
                   6734: rules must be applied to any element which has this presentation rule (or
                   6735: does not have it, if the condition is inverted) no matter what the rule's
                   6736: value, the condition is complete. If, in contrast, the condition applies to
                   6737: one or more values of the rule, these are indicated after the name of the
1.18      cvs      6738: attribute.</p>
1.30      cvs      6739: 
1.37      cvs      6740: <p>The representation of presentation rule values in a condition is similar
                   6741: to that for attribute values. The representation of these values depend on
                   6742: the type of the presentation rule. There are three categories of presentation
1.18      cvs      6743: rules:</p>
                   6744: <ul>
1.30      cvs      6745:   <li>those taking numeric values (<tt>Size, Indent, LineSpacing,
                   6746:     LineWeight</tt>),</li>
1.36      cvs      6747:   <li>those with values taken from a predefined list (<tt>Adjust, Hyphenate,
1.43      quint    6748:     Direction, UnicodeBidi, Style, Weight, Font, UnderLine, Thickness,
                   6749:     LineStyle</tt>),</li>
1.30      cvs      6750:   <li>those whose value is a name (<tt>FillPattern, Background,
                   6751:     Foreground</tt>).</li>
1.18      cvs      6752: </ul>
1.30      cvs      6753: 
                   6754: <p>For presentation rules which take numeric values, the condition can take a
1.37      cvs      6755: unique value or a range of values. In the case of a unique value, this value
1.1       cvs      6756: (an integer) is simply preceded by an equals sign. Conditions based on ranges
1.18      cvs      6757: of values have several forms:</p>
                   6758: <ul>
1.30      cvs      6759:   <li>all values less than a given value (the value is preceded by a ``less
                   6760:     than'' sign).</li>
                   6761:   <li>all values greater than a given value (the value is preceded by a
                   6762:     ``greater than'' sign).</li>
1.37      cvs      6763:   <li>all values falling in an interval, bounds included. The range of values
                   6764:     is then specified <tt>IN [</tt>Minimum <tt>..</tt>Maximum<tt>]</tt>,
                   6765:     where Minimum and Maximum are integers.</li>
1.18      cvs      6766: </ul>
1.30      cvs      6767: 
1.37      cvs      6768: <p>Values for the <tt>Indent</tt>rule may be negative. The integer is then
1.2       cvs      6769: simply preceded by a minus sign and represents how far the first line starts
1.18      cvs      6770: to the left of the other lines.</p>
1.30      cvs      6771: 
                   6772: <p>For presentation rules whose values are taken from predefined lists, the
1.37      cvs      6773: value which satisfies the condition is indicated by an equals sign followed
                   6774: by the name of the value.</p>
1.30      cvs      6775: 
1.37      cvs      6776: <p>For presentation rule whose values are names, the value which satisfies
                   6777: the condition is indicated by the equals sign followed by the value's name.
                   6778: The names of fill patterns (the <tt>FillPattern</tt> rule) and of colors (the
1.18      cvs      6779: <tt>Foreground</tt> and <tt>Background</tt> rules) known to Thot are the same
                   6780: as in the P language.</p>
1.30      cvs      6781: 
                   6782: <p>The syntax of conditions based on the specific presentation is the same as
                   6783: the syntax used to express the <a href="#sectc5224">translation of specific
1.18      cvs      6784: presentation rules</a>.</p>
1.30      cvs      6785: 
                   6786: <p>When a condition has only one rule, the condition is simply followed by
1.37      cvs      6787: that rule. If it has several rules, they are placed after the condition
1.30      cvs      6788: between the keywords <tt>BEGIN</tt> and <tt>END</tt>.</p>
1.18      cvs      6789: <pre>   ConditionSeq = Condition [ 'AND' Condition ] .
1.1       cvs      6790:    Condition    = [ 'NOT' ] [ 'Target' ] Cond .
                   6791:    Cond         = CondElem / CondAscend .
                   6792:    CondElem     ='FirstRef' / 'LastRef' /
                   6793:                  'ExternalRef' /
1.41      vatton   6794:                  'Script' '=' Script /
1.1       cvs      6795:                  'ComputedPage' / 'StartPage' / 
                   6796:                  'UserPage' / 'ReminderPage' /
                   6797:                  'Empty' /
1.11      cvs      6798:                   ElemID /
1.1       cvs      6799:                  'FirstAttr' / 'LastAttr' .
                   6800:    CondAscend   = [ Ascend ] CondOnAscend .
                   6801:    Ascend       = '*' / 'Parent' / 'Ancestor' LevelOrType .
                   6802:    LevelOrType  = CondRelLevel / ElemID [ ExtStruct ] .
                   6803:    CondRelLevel = NUMBER .
                   6804:    CondOnAscend ='First' / 'Last' /
                   6805:                  'Referred' / 
                   6806:                   [ 'Immediately' ] 'Within' [ NumParent ]
                   6807:                                     ElemID [ ExtStruct ] /
                   6808:                  'Attributes' /
                   6809:                   AttrID [ RelatAttr ] /
                   6810:                  'Presentation' /
1.34      cvs      6811:                   PresRule .
1.1       cvs      6812:    NumParent    = [ GreaterLess ] NParent .
1.30      cvs      6813:    GreaterLess  = '&gt;' / '&lt;' .
1.1       cvs      6814:    NParent      = NUMBER.
                   6815:    ExtStruct    = '(' ElemID ')' .
1.41      vatton   6816:    Script     = NAME .
1.1       cvs      6817:    RelatAttr    ='=' Value /
1.30      cvs      6818:                  '&gt;' [ '-' ] Minimum /
1.1       cvs      6819:                  '&lt;' [ '-' ] Maximum /
                   6820:                  'IN' '[' [ '-' ] MinInterval '..'
                   6821:                           [ '-' ] MaxInterval ']' .
                   6822:    Value        = [ '-' ] IntegerVal / TextVal / AttrValue .
                   6823:    Minimum      = NUMBER .
                   6824:    Maximum      = NUMBER .
                   6825:    MinInterval  = NUMBER .
                   6826:    MaxInterval  = NUMBER .
                   6827:    IntegerVal   = NUMBER .
                   6828:    TextVal      = STRING .
1.18      cvs      6829:    AttrValue    = NAME .</pre>
1.30      cvs      6830: 
1.18      cvs      6831: <blockquote class="example">
1.30      cvs      6832:   <p><strong>Example:</strong></p>
                   6833: 
                   6834:   <p>Suppose that after each element of type Section_Title it is useful to
                   6835:   produce the text <tt>\label{SectX}</tt> where <tt>X</tt> represents the
                   6836:   section number, but only if the section is designated by one or more
1.37      cvs      6837:   references in the document. The following conditional rule produces this
1.30      cvs      6838:   effect:</p>
                   6839:   <pre>RULES
1.1       cvs      6840:   Section_Title :
                   6841:     IF Referred
1.18      cvs      6842:       Create ('\label{Sect' Value(UniqueSectNum) '}\12') After;</pre>
1.30      cvs      6843: 
                   6844:   <p>(the declaration of the <a href="#sectc5224"><tt>UniqueSectNum</tt>
1.37      cvs      6845:   counter</a> is given above). The string <tt>\12</tt> represents a line
1.30      cvs      6846:   break.</p>
1.18      cvs      6847: </blockquote>
1.30      cvs      6848: 
1.18      cvs      6849: <blockquote class="example">
1.30      cvs      6850:   <p><strong>Example:</strong></p>
                   6851: 
1.37      cvs      6852:   <p>Suppose that for elements of the Elmnt type it would be useful to
                   6853:   produce a character indicating the value of the numeric attribute Level
                   6854:   associated with the element: an ``A'' for all values of Level less than 3,
                   6855:   a ``B'' for values between 3 and 10 and a ``C'' for values greater than 10.
                   6856:   This can be achieved by writing the following rules for the Elmnt type:</p>
1.30      cvs      6857:   <pre>RULES
1.1       cvs      6858:   Elmnt :
                   6859:     BEGIN
                   6860:     IF Level &lt; 3
                   6861:       Create 'A';
                   6862:     IF Level IN [3..10]
                   6863:       Create 'B';
1.30      cvs      6864:     IF Level &gt; 10
1.1       cvs      6865:       Create 'C';
1.18      cvs      6866:     END;</pre>
                   6867: </blockquote>
                   6868: </div>
                   6869: </div>
1.1       cvs      6870: 
1.18      cvs      6871: <div class="subsection">
1.37      cvs      6872: <h3><a name="sectc529" id="sectc529">Translation rules</a></h3>
1.1       cvs      6873: 
1.37      cvs      6874: <p>Fifteen types of translation rules can be associated with element types
                   6875: and attribute values. They are the <tt>Create</tt>, <tt>Write</tt>,
1.18      cvs      6876: <tt>Read</tt>, <tt>Include</tt>, <tt>Get</tt>, <tt>Copy</tt>, <tt>Use</tt>,
1.31      cvs      6877: <tt>Remove</tt>, <tt>Ignore</tt>, <tt>NoTranslation</tt>,
                   6878: <tt>NoLineBreak</tt>, <tt>ChangeMainFile</tt>, <tt>RemoveFile</tt>,
1.37      cvs      6879: <tt>Set</tt>, <tt>Add</tt>, <tt>Indent</tt>, rules. Each rule has its own
1.31      cvs      6880: syntax, although they are all based on very similar models.</p>
1.18      cvs      6881: <pre>     SimpleRule = 'Create' [ 'IN' VarID ] Object
1.1       cvs      6882:                         [ Position ] ';' /
                   6883:                   'Write' Object [ Position ] ';' /
                   6884:                   'Read' BufferID [ Position ] ';' /
                   6885:                   'Include' File [ Position ] ';' /
                   6886:                   'Get' [ RelPosition ] ElemID 
                   6887:                         [ ExtStruct ] 
                   6888:                         [ Position ] ';' /
                   6889:                   'Copy' [ RelPosition ] ElemID 
                   6890:                         [ ExtStruct ] 
                   6891:                         [ Position ] ';' /
                   6892:                   'Use' TrSchema [ 'For' ElemID ] ';' /
                   6893:                   'Remove' ';' /
1.31      cvs      6894:                   'Ignore' ';' /
1.1       cvs      6895:                   'NoTranslation' ';' /
                   6896:                   'NoLineBreak' ';' /
                   6897:                   'ChangeMainFile' VarID [ Position ] ';' /
1.14      cvs      6898:                   'RemoveFile' VarID [ Position ] ';' /
1.10      cvs      6899:                   'Set' CounterID InitValue [ Position ] ';' /
                   6900:                   'Add' CounterID Increment [ Position ] ';' /
1.25      cvs      6901:                   'Indent' [ 'IN' VarID ] Indent [ Position ] ';' .</pre>
1.18      cvs      6902: </div>
                   6903: 
                   6904: <div class="subsection">
1.37      cvs      6905: <h3><a name="sectc5210" id="sectc5210">The <tt>Create</tt> rule</a></h3>
1.18      cvs      6906: 
1.30      cvs      6907: <p>The most frequently used rule is undoubtedly the <tt>Create</tt> rule,
                   6908: which generates fixed or variable text (called an <em>object</em>) in the
1.37      cvs      6909: output file. The generated text can be made to appear either before or after
                   6910: the content of the element to which the rule applies. The rule begins with
                   6911: the <tt>Create</tt> keyword, followed by a specifier for the object and a
                   6912: keyword (<tt>Before</tt> or <tt>After</tt>) indicating the position of the
                   6913: generated text (<a href="#sectc5222">before or after</a> the element's
                   6914: content). If the position is not indicated, the object will be generated
                   6915: before the element's content. This rule, like all translation rules, is
                   6916: terminated by a semicolon.</p>
1.30      cvs      6917: 
                   6918: <p>The <tt>Create</tt> keyword can be followed by the <tt>IN</tt> keyword and
1.37      cvs      6919: by the name of a variable. This means that the text generated by the rule
1.30      cvs      6920: must not be written in the main output file, but in the file whose name is
1.18      cvs      6921: specified by the variable.</p>
1.30      cvs      6922: 
                   6923: <p>This allows the translation program to generate text in different files
                   6924: during the same run. These files do not need to be explicitely declared or
                   6925: opened. They do not need to be closed either, but if they contain temporary
                   6926: data, they can be removed (see the <a href="#sectc5220a"><tt>RemoveFile</tt>
                   6927: rule</a>). As soon as the translation program executes a <tt>Create</tt> rule
                   6928: for a file that is not yet open, it opens the file. These files are closed
                   6929: when the translation is finished.</p>
1.18      cvs      6930: <pre>               'Create' [ 'IN' VarID ] Object
1.1       cvs      6931:                         [ Position ] ';'
                   6932:      Object   = ConstID / CharString /
                   6933:                 BufferID /
                   6934:                 VarID /
1.30      cvs      6935:                '(' Function &lt; Function &gt; ')' /
1.21      cvs      6936:                 [ 'Translated' ] AttrID /
1.1       cvs      6937:                'Value' /
                   6938:                'Content' /
                   6939:                'Attributes' /
                   6940:                'Presentation' /
                   6941:                'RefId' /
                   6942:                'PairId' /
                   6943:                'FileDir' /
                   6944:                'FileName' /
                   6945:                'Extension' /
                   6946:                'DocumentName' /
                   6947:                'DocumentDir' /
                   6948:                 [ 'Referred' ] ReferredObject .
                   6949:      Position ='After' / 'Before' .
                   6950: 
                   6951:      ReferredObject = VarID /
                   6952:                 ElemID [ ExtStruct ] /
                   6953:                'RefId' /
                   6954:                'DocumentName' /
1.18      cvs      6955:                'DocumentDir' .</pre>
1.30      cvs      6956: 
                   6957: <p>The object to be generated can be:</p>
1.18      cvs      6958: <ul>
1.30      cvs      6959:   <li>a constant string, specified by its name if it is declared in the
                   6960:     schema's <tt>CONST</tt> section, or given directly as a value between
                   6961:     apostrophes;</li>
                   6962:   <li>the contents of a buffer, designated by the name of the buffer;</li>
                   6963:   <li>a variable, designated by its name if it is declared in the translation
1.37      cvs      6964:     schema's <tt>VAR</tt> section, or given directly between parentheses. The
1.30      cvs      6965:     text generated is the value of that variable evaluated for the element to
                   6966:     which the rule applies.</li>
                   6967:   <li>the value of an attribute, if the element being translated has this
                   6968:     attribute. The attribute is specified by its name. If it's a text
                   6969:     attribute, it can be preceded by the <code>Translated</code> keyword,
                   6970:     which causes the attribute value to be recoded using the text translation
                   6971:     table defined by section <code><a
                   6972:     href="#sectc5225">TEXTTRANSLATE</a></code>;</li>
1.37      cvs      6973:   <li>the value of a specific presentation rule. This object can only be
1.30      cvs      6974:     generated if the translation rule is for a <a href="#prestransl">specific
1.37      cvs      6975:     presentation rule</a>. It is specified by the <tt>Value</tt> keyword;</li>
                   6976:   <li>the element's content. That is, the content of the leaves of the
                   6977:     subtree of the translated element. This is specified by the
1.30      cvs      6978:     <tt>Content</tt> keyword;</li>
                   6979:   <li>the translation of all attributes of the element (which is primarily
                   6980:     used to apply the attribute translation rules <a
1.37      cvs      6981:     href="#sectc5222">before</a> those of the element type). This is
1.30      cvs      6982:     specified by the <tt>Attributes</tt> keyword.</li>
                   6983:   <li>the translation of all of the element's specific presentation rules
                   6984:     (which is primarily used to apply the translation rules for the specific
1.37      cvs      6985:     presentation rules <a href="#sectc5222">before</a> those of the element
                   6986:     or its attributes). This option is specified by the <tt>Presentation</tt>
1.30      cvs      6987:     keyword;</li>
1.37      cvs      6988:   <li>The value of the reference's identifier.<br />
                   6989:     Thot associates a unique identifier with each element in a document. This
                   6990:     identifier (called <em>reference's identifier</em> or <em>label</em>) is
                   6991:     a character string containing the letter `L' followed by digits. Thot
                   6992:     uses it in references for identifying the referred element.<br />
1.30      cvs      6993:     The <tt>RefId</tt> keyword produces the reference's identifier of the
                   6994:     element to which the translation rule is applied, or the reference's
                   6995:     identifier of its first ancestor that is referred by a reference or that
                   6996:     can be referred by a reference.</li>
1.37      cvs      6997:   <li>the value of a mark pair's unique identifier. This may only be used for
1.30      cvs      6998:     <a href="#sectd3285">mark pairs</a> and is indicated by the
                   6999:     <tt>PairId</tt> keyword.</li>
                   7000:   <li>the directory containing the file being generated (this string includes
1.37      cvs      7001:     an ending '/', if it is not empty). This is indicated by the
1.30      cvs      7002:     <tt>FileDir</tt> keyword.</li>
                   7003:   <li>the name of the file being generated (only the name, without the
                   7004:     directory and without the extension). This is indicated by the
                   7005:     <tt>FileName</tt> keyword.</li>
                   7006:   <li>the extension of the file being generated (this string starts with a
1.37      cvs      7007:     dot, if it is not empty). This is indicated by the <tt>Extension</tt>
1.30      cvs      7008:     keyword.</li>
1.37      cvs      7009:   <li>the name of the document being translated. This is indicated by the
1.30      cvs      7010:     <tt>DocumentName</tt> keyword.</li>
1.37      cvs      7011:   <li>the directory containing the document being translated. This is
1.30      cvs      7012:     indicated by the <tt>DocumentDir</tt> keyword.</li>
1.18      cvs      7013: </ul>
1.30      cvs      7014: 
1.37      cvs      7015: <p>When the rule applies to a reference (an element or an attribute defined
                   7016: as a reference in the structure schema), it can generate a text related to
                   7017: the element referred by that reference. The rule name is then followed by the
1.18      cvs      7018: <tt>Referred</tt> keyword and a specification of the object to be generated
1.37      cvs      7019: for the referred element. This specification can be:</p>
1.18      cvs      7020: <ul>
1.37      cvs      7021:   <li>the name of a variable. The rule generates the value of that variable,
1.30      cvs      7022:     computed for the referred element.</li>
1.37      cvs      7023:   <li>an element type. The rule generates the translation of the element of
                   7024:     that type, which is in the subtree of the referred element. If this
1.30      cvs      7025:     element is not defined in the structure schema which corresponds to the
                   7026:     translation schema (that is, an object defined in another schema), the
                   7027:     element's type name must be followed by the name of its structure schema
                   7028:     between parentheses.</li>
1.37      cvs      7029:   <li>the <tt>RefId</tt> keyword. The rule generates the reference's
1.30      cvs      7030:     identifier of the referred element.</li>
1.37      cvs      7031:   <li>the <tt>DocumentName</tt> keyword. The rule generates the name of the
1.30      cvs      7032:     document to which the referred element belongs.</li>
1.37      cvs      7033:   <li>the <tt>DocumentDir</tt> keyword. The rule generates the name of the
1.30      cvs      7034:     directory that contains the document of the referred element.</li>
1.18      cvs      7035: </ul>
                   7036: </div>
1.1       cvs      7037: 
1.18      cvs      7038: <div class="subsection">
1.37      cvs      7039: <h3><a name="sectc5211" id="sectc5211">The <tt>Write</tt> rule</a></h3>
1.1       cvs      7040: 
1.37      cvs      7041: <p>The <tt>Write</tt> has the same syntax as the <tt>Create</tt> rule. It
1.30      cvs      7042: also produces the same effect, but the generated text is displayed on the
                   7043: user's terminal during the translation of the document, instead of being
1.37      cvs      7044: produced in the translated document. This is useful for helping the user keep
1.30      cvs      7045: track of the progress of the translation and for prompting the user on the
                   7046: terminal for input required by the <tt>Read</tt> rule.</p>
1.18      cvs      7047: <pre>               'Write' Object [ Position ] ';'</pre>
1.30      cvs      7048: 
                   7049: <p>Notice: if the translator is launched by the editor (by the ``Save as''
1.18      cvs      7050: command), messages produced by the <tt>Write</tt> rule are not displayed.</p>
1.30      cvs      7051: 
1.18      cvs      7052: <blockquote class="example">
1.30      cvs      7053:   <p><strong>Example:</strong></p>
                   7054: 
                   7055:   <p>To make the translator display the number of each section being
                   7056:   translated on the user's terminal, the following rule is specified for the
                   7057:   <tt>Section</tt> element type:</p>
                   7058:   <pre>Section : BEGIN
1.1       cvs      7059:           Write VarSection;
                   7060:           ...
1.18      cvs      7061:           END;</pre>
1.30      cvs      7062: 
                   7063:   <p>(see <a href="#varsectexample">above</a> for the definition of the
                   7064:   <tt>VarSection</tt> variable).</p>
                   7065: 
                   7066:   <p>To display text on the terminal before issuing a read operation with the
                   7067:   <tt>Read</tt> rule, the following rule is used:</p>
                   7068:   <pre>BEGIN
1.1       cvs      7069: Write 'Enter the name of the destination: ';
                   7070: ...
1.18      cvs      7071: END;</pre>
                   7072: </blockquote>
                   7073: </div>
                   7074: 
                   7075: <div class="subsection">
1.37      cvs      7076: <h3><a name="sectc5212" id="sectc5212">The <tt>Read</tt> rule</a></h3>
1.18      cvs      7077: 
1.30      cvs      7078: <p>The <tt>Read</tt> rule reads text from the terminal during the translation
                   7079: of the document and saves the text read in one of the buffers declared in the
1.37      cvs      7080: <tt>BUFFERS</tt> section of the schema. The buffer to be used is indicated by
                   7081: its name, after the <tt>READ</tt> keyword. This name can be followed, as in
1.18      cvs      7082: the <tt>Create</tt> and <tt>Write</tt> rules, by a keyword indicating if the
                   7083: read operation must be performed <tt>Before</tt> or <tt>After</tt> the
1.37      cvs      7084: translation of the element's content. If this keyword is absent, the read
                   7085: operation is done beforehand. The text is read into the buffer and remains
1.5       cvs      7086: there until a rule using the same buffer - possibly the same rule - is
1.18      cvs      7087: applied.</p>
                   7088: <pre>               'Read' BufferID [ Position ] ';'</pre>
1.30      cvs      7089: 
1.18      cvs      7090: <blockquote class="example">
1.30      cvs      7091:   <p><strong>Example:</strong></p>
                   7092: 
                   7093:   <p>The following set of rules tells the user that the translator is waiting
                   7094:   for the entry of some text, reads this text into a buffer and copies the
                   7095:   text into the translated document.</p>
                   7096:   <pre>BEGIN
1.1       cvs      7097: Write 'Enter the name of the destination: ';
                   7098: Read DestName;
                   7099: Create DestName;
                   7100: ...
1.18      cvs      7101: END;</pre>
1.30      cvs      7102: 
                   7103:   <p>(see <a href="#destname">above</a> the definition of
                   7104:   <tt>DestName</tt>).</p>
1.18      cvs      7105: </blockquote>
                   7106: </div>
                   7107: 
                   7108: <div class="subsection">
1.37      cvs      7109: <h3><a name="sectc5213" id="sectc5213">The <tt>Include</tt> rule</a></h3>
1.18      cvs      7110: 
1.30      cvs      7111: <p>The <tt>Include</tt> rule, like the <tt>Create</tt> rule, is used to
1.37      cvs      7112: produce text in the translated document. It inserts constant text which is
                   7113: not defined in the translation schema, but is instead taken from a file. The
                   7114: file's name is specified after the <tt>Include</tt> keyword, either directly
                   7115: as a character string between apostrophes or as the name of one of the
                   7116: buffers declared in the <tt>BUFFERS</tt> section of the schema. In the latter
                   7117: case, the buffer is assumed to contain the file's name. This can be used when
                   7118: the included file's name is known only at the moment of translation. This
                   7119: only requires that the <tt>Include</tt> rule is preceded by a <tt>Read</tt>
                   7120: rule which puts the name of the file desired by the user into the buffer.</p>
1.30      cvs      7121: 
                   7122: <p>Like the other rules, it is possible to specify whether the inclusion will
1.1       cvs      7123: occur before or after the element's content, with the default being before.
                   7124: The file inclusion is only done at the moment of translation, not during the
                   7125: compilation of the translation schema. Thus, the file to be included need not
                   7126: exist during the compilation, but it must be accessible at the time of
1.37      cvs      7127: translation. Its contents can also be modified between two translations, thus
1.1       cvs      7128: producing different results, even if neither the document or the translation
1.18      cvs      7129: schema are modified.</p>
1.30      cvs      7130: 
                   7131: <p>During translation, the file to be included is searched for along the
                   7132: schema directory path (indicated by the environment variable
1.37      cvs      7133: <tt>THOTSCH</tt>). The file name is normally only composed of a simple name,
                   7134: without specification of a complete file path. However, if the filename
1.30      cvs      7135: starts with a '/', it is considered as an absolute path.</p>
1.18      cvs      7136: <pre>                'Include' File [ Position ] ';'
1.6       cvs      7137:      File     = FileName / BufferID .
1.18      cvs      7138:      FileName = STRING .</pre>
1.30      cvs      7139: 
1.18      cvs      7140: <blockquote class="example">
1.30      cvs      7141:   <p><strong>Example:</strong></p>
                   7142: 
1.37      cvs      7143:   <p>Suppose that it is desirable to print documents of the Article class
                   7144:   with a formatter which requires a number of declarations and definitions at
                   7145:   the beginning of the file. The <tt>Include</tt>rule can be used to achieve
1.30      cvs      7146:   this. All the declarations and definitions a replaced in a file called
                   7147:   <tt>DeclarArt</tt> and then the <tt>Article</tt> element type is given the
                   7148:   following rule:</p>
                   7149:   <pre>Article : BEGIN
1.1       cvs      7150:           Include 'DeclarArt' Before;
                   7151:           ...
1.18      cvs      7152:           END;</pre>
                   7153: </blockquote>
                   7154: </div>
                   7155: 
                   7156: <div class="subsection">
1.37      cvs      7157: <h3><a name="sectc5214" id="sectc5214">The <tt>Get</tt> rule</a></h3>
1.18      cvs      7158: 
1.30      cvs      7159: <p>The <tt>Get</tt> rule is used to change the order in which the elements
1.37      cvs      7160: appear in the translated document. More precisely, it produces the
1.30      cvs      7161: translation of a specified element before or after the translation of the
1.37      cvs      7162: content of the element to which the rule applies. The <tt>Before</tt> and
1.30      cvs      7163: <tt>After</tt> keywords are placed at the end of the rule to specify whether
                   7164: the operation should be performed before or after translation of the rule's
                   7165: element (the default is before). The type of the element to be moved must be
                   7166: specified after the <tt>Get</tt> keyword, optionally preceded by a keyword
                   7167: indicating where the element will be found in the logical structure of the
                   7168: document:</p>
1.18      cvs      7169: <dl>
1.30      cvs      7170:   <dt><tt>Included</tt></dt>
                   7171:     <dd>The element to be moved is the first element of the indicated type
                   7172:       which is found inside the element to which the rule applies.</dd>
                   7173:   <dt><tt>Referred</tt></dt>
                   7174:     <dd>This keyword can only be used if the rule applies to a reference
1.37      cvs      7175:       element. The element to be moved is either the element designated by
                   7176:       the reference (if that element is of the specified type), or the first
1.30      cvs      7177:       element of the desired type contained within the element designated by
                   7178:       the reference.</dd>
                   7179:   <dt>no keyword</dt>
1.37      cvs      7180:     <dd><p>The translator takes the first element of the indicated type from
                   7181:       among the siblings of the rule's element. This is primarily used to
                   7182:       change the order of the components of an aggregate.</p>
1.30      cvs      7183:     </dd>
1.18      cvs      7184: </dl>
1.30      cvs      7185: 
                   7186: <p>If the element to be moved is defined in a structure schema which is not
                   7187: the one which corresponds to the translation schema (in the case of an
                   7188: included object with a different schema), the type name of this element must
                   7189: be followed, between parentheses, by the name of the structure schema which
1.18      cvs      7190: defines it.</p>
                   7191: <pre>                   'Get' [ RelPosition ] ElemID 
1.6       cvs      7192:                          [ ExtStruct ]
                   7193:                          [ Position ] ';' /
                   7194:      RelPosition = 'Included' / 'Referred' .
1.18      cvs      7195:      ExtStruct   = '(' ElemID ')' .</pre>
1.30      cvs      7196: 
                   7197: <p>The <tt>Get</tt> rule has no effect if the element which it is supposed to
1.37      cvs      7198: move has already been translated. Thus, the element will not be duplicated.
1.1       cvs      7199: It is generally best to associate the rule with the first element which will
1.37      cvs      7200: be encountered by the translator in its traversal of the document. Suppose an
1.18      cvs      7201: aggregate has two elements <tt>A</tt> and <tt>B</tt>, with <tt>A</tt>
1.37      cvs      7202: appearing first in the logical structure. To permute these two elements, a
1.18      cvs      7203: <tt>Get B before</tt> rule should be associated with the <tt>A</tt> element
1.37      cvs      7204: type, not the inverse. Similarly, a rule of the form <tt>Get Included X
1.18      cvs      7205: After</tt>, even though syntactically correct, makes no sense since, by the
1.1       cvs      7206: time it will be applied, after the translation of the contents of the element
1.18      cvs      7207: to which it is attached, the <tt>X</tt> element will already have been
                   7208: translated.</p>
                   7209: </div>
                   7210: 
                   7211: <div class="subsection">
1.37      cvs      7212: <h3><a name="sectc5215" id="sectc5215">The <tt>Copy</tt> rule</a></h3>
1.18      cvs      7213: 
1.30      cvs      7214: <p>Like the <tt>Get</tt> rule, the <tt>Copy</tt> rule generates the
                   7215: translation of a specified element, but it acts even if the element has
                   7216: already been translated and it allows to copy it or to translate it later.
                   7217: Both rules have the same syntax.</p>
1.18      cvs      7218: <pre>              'Copy' [ RelPosition ] ElemID 
                   7219:                      [ ExtStruct ] [ Position ] ';'</pre>
                   7220: </div>
                   7221: 
                   7222: <div class="subsection">
1.37      cvs      7223: <h3><a name="sectc5216" id="sectc5216">The <tt>Use</tt> rule</a></h3>
1.18      cvs      7224: 
1.30      cvs      7225: <p>The <tt>Use</tt> rule specifies the translation schema to be applied to
1.37      cvs      7226: objects of a certain class that are part of the document. This rule only
1.1       cvs      7227: appears in the rules for the root element of the document (the first type
1.18      cvs      7228: defined after the <tt>STRUCT</tt> keyword in the structure schema) or the
1.1       cvs      7229: rules of an element defined by an external structure (by another structure
1.37      cvs      7230: schema). Also, the <tt>Use</tt> rule cannot be conditional.</p>
1.30      cvs      7231: 
                   7232: <p>If the rule is applied to an element defined by an external structure, the
1.18      cvs      7233: <tt>Use</tt> keyword is simply followed by the name of the translation schema
1.37      cvs      7234: to be used for element constructed according to that external structure. If
1.1       cvs      7235: the rule is applied to the document's root element, it is formed by the
1.18      cvs      7236: <tt>Use</tt> keyword followed by the translation schema's name, the
                   7237: <tt>For</tt> keyword and the name of the external structure to which the
                   7238: indicated translation schema should be applied.</p>
                   7239: <pre>               'Use' TrSchema [ 'For' ElemID ] ';'
                   7240:      TrSchema = NAME .</pre>
1.30      cvs      7241: 
                   7242: <p>If no <tt>Use</tt> rule defines the translation schema to be used for an
1.1       cvs      7243: external structure which appears in a document, the translator asks the user,
                   7244: during the translation process, which schema should be used. Thus, it is not
1.18      cvs      7245: necessary to give the translation schema a <tt>Use</tt> rule for every
1.1       cvs      7246: external structure used, especially when the choice of translation schemas is
1.18      cvs      7247: to be left to the user.</p>
1.30      cvs      7248: 
                   7249: <p>Notice: if the translator is launched by the editor (by the ``Save as''
1.18      cvs      7250: command), prompts are not displayed.</p>
1.30      cvs      7251: 
1.18      cvs      7252: <blockquote class="example">
1.30      cvs      7253:   <p><strong>Example:</strong></p>
                   7254: 
                   7255:   <p>The <tt>Article</tt> structure schema uses the <tt>Formula</tt> external
                   7256:   structure, defined by another structure schema, for mathematical
                   7257:   formulas:</p>
                   7258:   <pre>STRUCTURE Article;
1.1       cvs      7259:    ...
                   7260: STRUCT
                   7261:    Article = ...
                   7262:    ...
                   7263:    Formula_in_text  = Formula;
                   7264:    Isolated_formula = Formula;
                   7265:    ...
1.18      cvs      7266: END</pre>
1.30      cvs      7267: 
                   7268:   <p>Suppose that it would be useful to use the <tt>FormulaT</tt> translation
1.37      cvs      7269:   schema for the formulas of an article. This can be expressed in two
1.30      cvs      7270:   different ways in the <tt>Article</tt> class translation schema, using the
                   7271:   rules:</p>
                   7272:   <pre>RULES
1.1       cvs      7273:     Article :
1.18      cvs      7274:        Use FormulaT for Formula;</pre>
1.30      cvs      7275: 
                   7276:   <p>or:</p>
                   7277:   <pre>RULES
1.1       cvs      7278:     ...
                   7279:     Formula :
1.18      cvs      7280:        Use FormulaT;</pre>
                   7281: </blockquote>
                   7282: </div>
                   7283: 
                   7284: <div class="subsection">
1.37      cvs      7285: <h3><a name="sectc5217" id="sectc5217">The <tt>Remove</tt> rule</a></h3>
1.18      cvs      7286: 
1.37      cvs      7287: <p>The <tt>Remove</tt> rule indicates that nothing should be generated, in
                   7288: the translated document, for the content of the element to which the rule
                   7289: applies. The content of that element is simply ignored by the translator.
                   7290: This does not prevent the generation of text for the element itself, using
                   7291: the <tt>Create</tt> or <tt>Include</tt> rules, for example.</p>
1.30      cvs      7292: 
                   7293: <p>The <tt>Remove</tt> rule is simply written with the <tt>Remove</tt>
                   7294: keyword. It is terminated, like all rules, by a semicolon.</p>
1.18      cvs      7295: <pre>               'Remove' ';'</pre>
                   7296: </div>
                   7297: 
                   7298: <div class="subsection">
1.37      cvs      7299: <h3><a name="sectc5217a" id="sectc5217a">The <tt>Ignore</tt> rule</a></h3>
1.31      cvs      7300: 
1.37      cvs      7301: <p>The <tt>Ignore</tt> rule indicates that nothing should be generated, in
                   7302: the translated document, for the element to which the rule applies. The whole
1.32      cvs      7303: element is simply ignored by the translator.</p>
1.31      cvs      7304: 
                   7305: <p>The <tt>Ignore</tt> rule is simply written with the <tt>Ignore</tt>
                   7306: keyword. It is terminated, like all rules, by a semicolon.</p>
                   7307: <pre>               'Ignore' ';'</pre>
                   7308: </div>
                   7309: 
                   7310: <div class="subsection">
1.37      cvs      7311: <h3><a name="sectc5218" id="sectc5218">The <tt>NoTranslation</tt>
                   7312: rule</a></h3>
1.18      cvs      7313: 
1.30      cvs      7314: <p>The <tt>NoTranslation</tt> rule indicates to the translator that it must
1.37      cvs      7315: not translate the content of the leaves of the element to which it applies.
                   7316: In contrast to the <tt>Remove</tt> rule, it does not suppress the content of
                   7317: the element, but it inhibits the translation of character strings, symbols,
                   7318: and graphical elements contained in the element. These are retrieved so that
1.18      cvs      7319: after the translation of the document, the rules of the <a
                   7320: href="#sectc5225"><tt>TEXTTRANSLATE</tt>, <tt>SYMBTRANSLATE</tt> and
                   7321: <tt>GRAPHTRANSLATE</tt> sections</a> will not be applied to them.</p>
1.30      cvs      7322: 
                   7323: <p>The <tt>NoTranslation</tt> rule is written with the <tt>NoTranslation</tt>
1.18      cvs      7324: keyword followed by a semicolon.</p>
                   7325: <pre>               'NoTranslation' ';'</pre>
                   7326: </div>
                   7327: 
                   7328: <div class="subsection">
1.37      cvs      7329: <h3><a name="sectc5219" id="sectc5219">The <tt>NoLineBreak</tt> rule</a></h3>
1.18      cvs      7330: 
1.30      cvs      7331: <p>The <tt>NoLineBreak</tt> rule indicates to the translator that it must not
1.1       cvs      7332: generate additional line breaks in the output produced for the element to
1.37      cvs      7333: which it applies. This is as if it was an <a href="#sectc522">instruction
1.18      cvs      7334: <tt>LINELENGTH 0;</tt></a> at the beginning of the translation schema, but
                   7335: only for the current element.</p>
1.30      cvs      7336: 
                   7337: <p>The <tt>NoLineBreak</tt> rule is written with the <tt>NoLineBreak</tt>
                   7338: keyword followed by a semicolon.</p>
1.18      cvs      7339: <pre>               'NoLineBreak' ';'</pre>
                   7340: </div>
1.1       cvs      7341: 
1.18      cvs      7342: <div class="subsection">
1.37      cvs      7343: <h3><a name="sectc5220" id="sectc5220">The <tt>ChangeMainFile</tt>
                   7344: rule</a></h3>
1.1       cvs      7345: 
1.30      cvs      7346: <p>When the translation program starts, it opens a main output file, whose
1.37      cvs      7347: name is given as a parameter of the translator. All <a
                   7348: href="#sectc5210"><tt>Create</tt> rules</a> without explicit indication of
                   7349: the output file write sequentially in this file. When a
                   7350: <tt>ChangeMainFile</tt> rule is executed, the main output file is closed and
                   7351: it is replaced by a new one, whose name is specified in the
                   7352: <tt>ChangeMainFile</tt> rule. The <tt>Create</tt> rules without indication of
                   7353: the output file that are then executed write in this new file. Several
                   7354: <tt>ChangeMainFile</tt> rules can be executed during the same translation,
                   7355: for dividing the main output into several files.</p>
1.30      cvs      7356: 
                   7357: <p>This rule is written with the <tt>ChangeMainFile</tt> keyword followed by
                   7358: the name of a variable that specifies the name of the new main file. The
1.37      cvs      7359: keyword <tt>Before</tt> or <tt>After</tt> can be placed at the end of the
                   7360: rule to specify whether the operation should be performed before or after
                   7361: translation of the rule's element (the default is before). This rule, like
                   7362: all translation rules, is terminated by a semicolon.</p>
1.18      cvs      7363: <pre>               'ChangeMainFile' VarID [ Position ] ';'</pre>
1.30      cvs      7364: 
1.18      cvs      7365: <blockquote class="example">
1.30      cvs      7366:   <p><strong>Example:</strong></p>
                   7367: 
                   7368:   <p>To generate the translation of each section in a different file, the
1.37      cvs      7369:   following rule can be associated with type <tt>Section</tt>. That rule uses
1.30      cvs      7370:   the <a href="#varoutputfile"><tt>VarOutpuFile</tt> variable</a> defined
                   7371:   above.</p>
                   7372:   <pre>     Section:
1.18      cvs      7373:          ChangeMainFile VarOutpuFile Before;</pre>
1.30      cvs      7374: 
                   7375:   <p>If <tt>output.txt</tt> is the name of the output file specified when
                   7376:   starting the translation program, translated sections are written in files
                   7377:   <tt>output1.txt</tt>, <tt>output2.txt</tt>, etc.</p>
1.18      cvs      7378: </blockquote>
                   7379: </div>
1.1       cvs      7380: 
1.18      cvs      7381: <div class="subsection">
1.37      cvs      7382: <h3><a name="sectc5220a" id="sectc5220a">The <tt>RemoveFile</tt> rule</a></h3>
1.14      cvs      7383: 
1.37      cvs      7384: <p>Files may be used for storing temporary data that are no longer needed
                   7385: when the translation of a document is complete. These files may be removed by
                   7386: the <tt>RemoveFile</tt> rule.</p>
1.30      cvs      7387: 
                   7388: <p>This rule is written with the <tt>RemoveFile</tt> keyword followed by the
1.37      cvs      7389: name of a variable that specifies the name of the file to be removed. The
                   7390: keyword <tt>Before</tt> or <tt>After</tt> can be placed at the end of the
                   7391: rule to specify whether the operation should be performed before or after
                   7392: translation of the rule's element (the default is before). This rule, like
1.30      cvs      7393: all translation rules, is terminated by a semicolon.</p>
1.18      cvs      7394: <pre>               'RemoveFile' VarID [ Position ] ';'</pre>
                   7395: </div>
                   7396: 
                   7397: <div class="subsection">
1.37      cvs      7398: <h3><a name="sectc5221" id="sectc5221">The <tt>Set</tt> and <tt>Add</tt>
                   7399: rules</a></h3>
1.18      cvs      7400: 
1.37      cvs      7401: <p>The <tt>Set</tt> and <tt>Add</tt> rules are used for modifying the value
                   7402: of counters that have no <a href="#sectc524">counting function</a>. Only this
1.18      cvs      7403: type of counter can be used in the <tt>Set</tt> and <tt>Add</tt> rules.</p>
1.30      cvs      7404: 
                   7405: <p>Both rules have the same syntax: after the keyword <tt>Set</tt> or
1.18      cvs      7406: <tt>Add</tt> appear the counter name and the value to assign to the counter
                   7407: (<tt>Set</tt> rule) or the value to be added to the counter (<tt>Add</tt>
1.37      cvs      7408: rule). The keyword <tt>Before</tt> or <tt>After</tt> can follow that value to
1.1       cvs      7409: indicate when the rule must be applied: before or after the element's content
1.37      cvs      7410: is translated. By default, <tt>Before</tt> is assumed. A semicolon terminates
1.18      cvs      7411: the rule.</p>
                   7412: <pre>               'Set' CounterID InitValue [ Position ] ';' /
                   7413:                'Add' CounterID Increment [ Position ] ';'</pre>
                   7414: </div>
                   7415: 
                   7416: <div class="subsection">
1.37      cvs      7417: <h3><a name="sectc5221a" id="sectc5221a">The <tt>Indent</tt> rule</a></h3>
1.18      cvs      7418: 
1.37      cvs      7419: <p>The <tt>Indent</tt> rule is used to modify the value of text indentation
                   7420: in the output files.</p>
1.30      cvs      7421: 
1.37      cvs      7422: <p>Each time the translator creates a new line in an output file, it
                   7423: generates a variable number of space characters at the beginning of the new
                   7424: line. By default, the number of these characters (the indentation value) is
                   7425: 0. It can be changed with the <tt>Indent</tt> rule.</p>
1.30      cvs      7426: 
                   7427: <p>In its simple form, the rule begins with the <tt>Indent</tt> keyword,
1.25      cvs      7428: followed by the indentation sign (optional) and value and a keyword
1.30      cvs      7429: <tt>Before</tt> or <tt>After</tt> indicating that the indentation should be
                   7430: changed <a href="#sectc5222">before or after</a> the element's content is
1.37      cvs      7431: generated. If the position is not indicated, the indentation is changed
                   7432: before the element's content is generated. This rule, like all translation
1.25      cvs      7433: rules, is terminated by a semicolon.</p>
1.30      cvs      7434: 
                   7435: <p>The indentation value is indicated by an integer, which is the number of
                   7436: space characters to be generated at the beginning of each new line. A sign
1.18      cvs      7437: (<tt>+</tt> or <tt>-</tt>) can appear before the integer to indicate that the
1.37      cvs      7438: value is relative: the current value of indentation is incremented (if sign
                   7439: is <tt>+</tt>) or decremented (if sign is <tt>-</tt>) by the specified
                   7440: value.</p>
1.30      cvs      7441: 
                   7442: <p>Keyword <tt>Suspend</tt> or <tt>Resume</tt> can appear instead of the
1.37      cvs      7443: (possibly signed) identation value. <tt>Suspend</tt> means that the new
1.30      cvs      7444: indentation value to be used is zero until another <tt>Indent</tt> rule is
                   7445: executed and changes the indentation value. <tt>Resume</tt> means that the
                   7446: indentation value that was used before the last <tt>Indent Suspend</tt> was
1.37      cvs      7447: executed becomes the new value. Only one <tt>Suspend</tt> can be used before
1.30      cvs      7448: a <tt>Resume</tt>; <tt>Supend</tt>-<tt>Resume</tt> pairs can not be
                   7449: nested.</p>
                   7450: 
1.37      cvs      7451: <p>Like the <a href="#sectc5210"><tt>Create</tt> rule</a>, the
                   7452: <tt>Indent</tt> keyword can be followed by the <tt>IN</tt> keyword and by the
                   7453: name of a <a href="#sectc526">variable</a>. This means that the rule must not
                   7454: change indentation in the main output file, but in the file whose name is
                   7455: specified by the variable (by default, indentation is changed in the main
                   7456: output file).</p>
1.25      cvs      7457: <pre>               'Indent' [ 'IN' VarID ] Indent [ Position ] ';' .
1.10      cvs      7458: 
1.25      cvs      7459: Indent        = 'Suspend' / 'Resume' / [ IndentSign ] IndentValue .
1.10      cvs      7460: IndentSign    = '+' / '-' .
1.18      cvs      7461: IndentValue   = NUMBER .</pre>
                   7462: </div>
1.10      cvs      7463: 
1.18      cvs      7464: <div class="subsection">
1.37      cvs      7465: <h3><a name="sectc5222" id="sectc5222">Rule application order</a></h3>
1.1       cvs      7466: 
1.30      cvs      7467: <p>The translator translates the elements which comprise the document in the
1.37      cvs      7468: order induced by the tree structure, except when the <tt>Get</tt> rule is
                   7469: used to change the order of translation. For each element, the translator
                   7470: first applies the rules specified for the element's type that must be applied
                   7471: before translation of the element's content (rules ending with the
                   7472: <tt>Before</tt> keyword or which have no position keyword). If several rules
                   7473: meet these criteria, the translator applies them in the order in where they
                   7474: appear in the translation schema.</p>
                   7475: 
                   7476: <p>It then applies all <a href="#sectc5223">rules for the attributes</a>
                   7477: which the element has and which must be applied before the translation of the
                   7478: element's content (rules ending with the <tt>Before</tt> keyword or which
                   7479: have no position keyword). For one attribute value, the translator applies
                   7480: the rules in the order in which they are defined in the translation
                   7481: schema.</p>
1.30      cvs      7482: 
                   7483: <p>The same procedure is followed with translation rules for specific
1.18      cvs      7484: presentations.</p>
1.30      cvs      7485: 
1.31      cvs      7486: <p>Next, the element's content is translated, as long as a <tt>Remove</tt> or
                   7487: <code>Ignore</code> rule does not apply.</p>
1.30      cvs      7488: 
                   7489: <p>In the next step, the translator applies rules for the specific
                   7490: presentation of the element that are to be applied after translation of the
1.37      cvs      7491: content (rules which end with the <tt>After</tt> keyword). The rules for each
1.30      cvs      7492: type of presentation rule or each value are applied in the order in which the
1.18      cvs      7493: translation appear in the schema.</p>
1.30      cvs      7494: 
                   7495: <p>Then, the same procedure is followed for translation rules for attributes
                   7496: of the element.</p>
                   7497: 
1.37      cvs      7498: <p>Finally, the translator applies rules for the element which must be
                   7499: applied after translation of the element's content. These rules are applied
                   7500: in the order that they appear in the translation schema. When the translation
                   7501: of an element is done, the translator procedes to translate the following
1.18      cvs      7502: element.</p>
1.30      cvs      7503: 
                   7504: <p>This order can be changed with the <tt>Attributes</tt> and
1.18      cvs      7505: <tt>Presentation</tt> options of the <a href="#sectc5210"><tt>Create</tt>
                   7506: rule</a>.</p>
                   7507: </div>
1.1       cvs      7508: 
1.18      cvs      7509: <div class="subsection">
1.37      cvs      7510: <h3><a name="sectc5223" id="sectc5223">Translation of logical
                   7511: attributes</a></h3>
1.1       cvs      7512: 
1.37      cvs      7513: <p>After the rules for the element types, the translation schema defines
                   7514: rules for attribute values. This section begins with the <tt>ATTRIBUTES</tt>
1.1       cvs      7515: keyword and is composed of a sequence of rule blocks each preceded by an
1.18      cvs      7516: attribute name and an optional value or value range.</p>
1.30      cvs      7517: 
                   7518: <p>If the attribute's name appears alone before the rule block, the rule are
1.1       cvs      7519: applied to all element which have the attribute, no matter what value the
1.37      cvs      7520: attribute has. In this case, the attribute name is followed by a colon before
1.18      cvs      7521: the beginning of the rule block.</p>
1.30      cvs      7522: 
1.37      cvs      7523: <p>The attribute's name can be followed by the name of an element type
                   7524: between parentheses. This says, as in presentation schemas, that the rule
                   7525: block which follows applies not to the element which has the attribute, but
                   7526: to its descendants of the type indicated between the parentheses.</p>
1.30      cvs      7527: 
                   7528: <p>If values are given after the attribute name (or after the name of the
1.37      cvs      7529: element type), the rules are applied only when the attribute has the
                   7530: indicated values. The same attribute can appear several times, with different
                   7531: values and different translation rules. Attribute values are indicated in the
                   7532: same way as in <a href="#sectc528">conditions</a> and are followed by a colon
                   7533: before the block of rules.</p>
1.30      cvs      7534: 
                   7535: <p>The rule block associated with an attribute is either a simple rule or a
1.18      cvs      7536: sequence of rules delimited by the <tt>BEGIN</tt> and <tt>END</tt> keywords.
                   7537: Note that rules associated with attribute values cannot be conditional.</p>
1.30      cvs      7538: 
                   7539: <p>Translation rules are not required for all attributes (or their values)
1.37      cvs      7540: defined in a structure schema. Only those attributes for which a particular
                   7541: action must be performed by the translator must have such rules. The rules
1.18      cvs      7542: that can be used are those described above, from <a
                   7543: href="#sectc5210"><tt>Create</tt></a> to <a
                   7544: href="#sectc5218"><tt>NoTranslation</tt></a>.</p>
1.30      cvs      7545: <pre>     AttrSeq       = TransAttr &lt; TransAttr &gt; .
1.1       cvs      7546:      TransAttr     = AttrID [ '(' ElemID ')' ] 
                   7547:                      [ RelatAttr ] ':' RuleSeq .
                   7548:      AttrID        = NAME .
1.18      cvs      7549:      ElemID        = NAME .</pre>
1.30      cvs      7550: 
1.18      cvs      7551: <blockquote class="example">
1.30      cvs      7552:   <p><strong>Example:</strong></p>
                   7553: 
                   7554:   <p>The structure defined the ``Language'' attribute which can take the
1.37      cvs      7555:   values ``French'' and ``English''. To have the French parts of the original
1.30      cvs      7556:   document removed and prevent the translation of the leaves of the English
                   7557:   parts, the following rules would be used:</p>
                   7558:   <pre>ATTRIBUTES
1.1       cvs      7559:    Language=French :
                   7560:       Remove;
                   7561:    Language=English :
1.18      cvs      7562:       NoTranslation;</pre>
                   7563: </blockquote>
                   7564: </div>
1.1       cvs      7565: 
1.18      cvs      7566: <div class="subsection">
1.37      cvs      7567: <h3><a name="sectc5224" id="sectc5224">Translation of specific
                   7568: presentations</a></h3>
1.1       cvs      7569: 
1.30      cvs      7570: <p>After the rules for attributes, the translation schema defines rules for
1.37      cvs      7571: the specific presentation. This section begins with the <tt>PRESENTATION</tt>
                   7572: keyword and is composed of a sequence of translation rule blocks each
                   7573: preceded by a presentation rule name, optionally accompanied by a part which
                   7574: depends on the particular presentation rule.</p>
1.30      cvs      7575: 
                   7576: <p>Each of these translation rule blocks is applied when the translator
                   7577: operates on an element which has a specific presentation rule of the type
1.37      cvs      7578: indicated at the head of the block. Depending on the type of the specific
1.30      cvs      7579: presentation rule, it is possible to specify values of the presentation rule
                   7580: for which the translation rule block should be applied.</p>
                   7581: 
                   7582: <p>There are three categories of the presentation rules:</p>
                   7583: <ul>
                   7584:   <li>rules taking numeric values: <tt>Size</tt>, <tt>Indent</tt>,
                   7585:     <tt>LineSpacing</tt>, <tt>LineWeight</tt>,</li>
                   7586:   <li>rules whose values are taken from a predefined list (i.e. whose type is
1.43      quint    7587:     an enumeration): <tt>Adjust</tt>, <tt>Hyphenate,Direction, UnicodeBidi,
1.40      quint    7588:     <tt>Style</tt>, <tt>Weight</tt>, <tt>Font</tt>, <tt>UnderLine</tt>,
                   7589:     <tt>Thickness</tt>, <tt>LineStyle</tt>,</tt></li>
1.30      cvs      7590:   <li>rules whose value is a name: <tt>FillPattern</tt>, <tt>Background</tt>,
                   7591:     <tt>Foreground</tt>.</li>
1.18      cvs      7592: </ul>
1.30      cvs      7593: 
                   7594: <p>For presentation rules of the first category, the values which provoke
1.1       cvs      7595: application of the translation rules are indicated in the same manner as for
1.37      cvs      7596: <a href="#relattr">numeric attributes</a>. This can be either a unique value
                   7597: or range of values. For a unique value, the value (an integer) is simply
                   7598: preceded by an equals sign. Value ranges can be specified in one of three
1.18      cvs      7599: ways:</p>
                   7600: <ul>
1.30      cvs      7601:   <li>all values less than a given value (this value is preceded by a ``less
                   7602:     than'' sign '<tt>&lt;</tt>'),</li>
                   7603:   <li>all values greater than a given value (this value is preceded by a`
                   7604:     `greater than'' sign '<tt>&gt;</tt>'),</li>
1.37      cvs      7605:   <li>all values falling in an interval, bounds included. The range of values
1.30      cvs      7606:     is then specified <tt>IN [</tt>Minimum<tt>..</tt>Maximum<tt>]</tt>, where
                   7607:     Minimum and Maximum are integers.</li>
1.18      cvs      7608: </ul>
1.30      cvs      7609: 
                   7610: <p>All numeric values can be negative, in which case the integer is preceded
1.37      cvs      7611: by a minus sign. All values must be given in typographers points.</p>
1.30      cvs      7612: 
                   7613: <p>For presentation rules whose values are taken from a predefined list, the
1.1       cvs      7614: value which provokes application of the translation rules is simply indicated
1.18      cvs      7615: by the equals sign followed by the name of the value.</p>
1.30      cvs      7616: 
1.37      cvs      7617: <p>For presentation rules whose values are names, the value which provokes
                   7618: the application of translation rules is simply indicated by the equals sign
                   7619: followed by the name of the value. The names of the fill patterns (the
1.18      cvs      7620: <tt>FillPattern</tt> rule) and of the colors (the <tt>Foreground</tt> and
                   7621: <tt>Background</tt> rules) used in Thot are the same as in the P language.</p>
1.30      cvs      7622: <pre>     PresSeq        = PresTrans &lt; PresTrans &gt; .
1.1       cvs      7623:      PresTrans      = PresRule ':' RuleSeq .
                   7624:      PresRule       = 'Size' [ PresRelation ] /
                   7625:                       'Indent' [ PresRelation ] /
                   7626:                       'LineSpacing' [ PresRelation ] /
                   7627:                       'Adjust' [ '=' AdjustVal ] /
                   7628:                       'Hyphenate' [ '=' BoolVal ] /
                   7629:                       'Style' [ '=' StyleVal ] /
1.24      cvs      7630:                       'Weight' [ '=' WeightVal ] /
1.1       cvs      7631:                       'Font' [ '=' FontVal ] /
                   7632:                       'UnderLine' [ '=' UnderLineVal ] /
                   7633:                       'Thickness' [ '=' ThicknessVal ] /
                   7634:                       'LineStyle' [ '=' LineStyleVal ] /
                   7635:                       'LineWeight' [ PresRelation ] /
                   7636:                       'FillPattern' [ '=' Pattern ] /
                   7637:                       'Background' [ '=' Color ] /
                   7638:                       'Foreground' [ '=' Color ] .
                   7639: 
                   7640:      PresRelation   = '=' PresValue /
1.30      cvs      7641:                       '&gt;' [ '-' ] PresMinimum /
1.1       cvs      7642:                       '&lt;' [ '-' ] PresMaximum /
                   7643:                       'IN' '[' [ '-' ] PresIntervalMin '..'
                   7644:                               [ '-' ] PresIntervalMax ']' .
1.35      cvs      7645:      AdjustVal      = 'Left' / 'Right' / 'VMiddle' / 'Justify' /
1.1       cvs      7646:                       'LeftWithDots' .
                   7647:      BoolVal        = 'Yes' / 'No' .
1.24      cvs      7648:      StyleVal       = 'Roman' / 'Italics' / 'Oblique' .
                   7649:      WeightVal      = 'Normal' / 'Bold' .
1.1       cvs      7650:      FontVal        = 'Times' / 'Helvetica' / 'Courier' .
                   7651:      UnderLineVal   = 'NoUnderline' / 'UnderLined' /
                   7652:                       'OverLined' / 'CrossedOut' .
                   7653:      ThicknessVal   = 'Thick' / 'Thin' .
1.6       cvs      7654:      LineStyleVal   = 'Solid' / 'Dashed' / 'Dotted' .
1.1       cvs      7655:      Pattern        = NAME .
                   7656:      Color          = NAME .
                   7657:      PresMinimum    = NUMBER .
                   7658:      PresMaximum    = NUMBER .
                   7659:      PresIntervalMin= NUMBER .
                   7660:      PresIntervalMax= NUMBER .
                   7661:      PresValue      = [ '-' ] PresVal .
1.18      cvs      7662:      PresVal        = NUMBER .</pre>
1.30      cvs      7663: 
1.37      cvs      7664: <p>The <a name="prestransl" id="prestransl">translation rules associated with
                   7665: specific presentation rules</a> can use the value of the specific
                   7666: presentation rule that causes them to be applied. This behavior is designated
                   7667: by the keyword <tt>Value</tt>. For numerically-valued presentation rules, the
                   7668: numeric value is produced. For other presentation rules, the name of the
                   7669: value is produced.</p>
1.30      cvs      7670: 
                   7671: <p>It should be noted that modifications to the layout of the document's
                   7672: elements that are made using the combination of the control key and a mouse
                   7673: button will have no effect on the translation of the document.</p>
                   7674: 
                   7675: <blockquote class="example">
                   7676:   <p><strong>Example:</strong></p>
                   7677: 
                   7678:   <p>Suppose that it is desirable to use the same font sizes as in the
                   7679:   specific presentation, but the font size must be between 10 and 18
                   7680:   typographer's points. If font size is set in the translated document by the
                   7681:   string <tt>pointsize=n</tt> where <tt>n</tt> is the font size in
                   7682:   typographer's points then the following rules will suffice:</p>
                   7683:   <pre>PRESENTATION
1.1       cvs      7684:    Size &lt; 10 :
                   7685:         Create 'pointsize=10';
                   7686:    Size in [10..18] :
                   7687:         BEGIN
                   7688:         Create 'pointsize=';
                   7689:         Create Value;
                   7690:         END;
1.30      cvs      7691:    Size &gt; 18 :
1.18      cvs      7692:         Create 'pointsize=18';</pre>
                   7693: </blockquote>
                   7694: </div>
1.1       cvs      7695: 
1.18      cvs      7696: <div class="subsection">
1.37      cvs      7697: <h3><a name="sectc5225" id="sectc5225">Recoding of characters, symbols and
                   7698: graphics</a></h3>
1.1       cvs      7699: 
1.37      cvs      7700: <p>The coding of characters, graphical elements and symbols as defined in
                   7701: Thot does not necessarily correspond to what is required by an application to
                   7702: which a Thot document must be exported. Because of this the translator can
                   7703: recode these terminal elements of the documents structure. The last sections
                   7704: of a translation schema are intended for this purpose, each specifying the
                   7705: recoding rules for one type of terminal element.</p>
1.30      cvs      7706: 
1.43      quint    7707: <p>The recoding rules for character strings are grouped by scripts. There is
                   7708: a group of rules for each script of the Thot document that must be
1.30      cvs      7709: translated. Each such group of rules begins with the <tt>TEXTTRANSLATE</tt>
1.41      vatton   7710: keyword, followed by the specification of the script to translate and the
1.30      cvs      7711: recoding rules, between the <tt>BEGIN</tt> and <tt>END</tt> keywords unless
1.41      vatton   7712: there is only one recoding rule for the script. The specification of the
1.43      quint    7713: script is not required: by default it is assumed to the Latin script (the ISO
                   7714: Latin-1 character set).</p>
1.30      cvs      7715: 
                   7716: <p>Each recoding rule is formed by a source string between apostrophes and a
1.1       cvs      7717: target string, also between apostrophes, the two strings being separated by
1.30      cvs      7718: the arrow symbol (<tt>-&gt;</tt>), formed by the ``minus'' and ``greater
1.37      cvs      7719: than'' characters. The rule is terminated by a semi-colon.</p>
1.41      vatton   7720: <pre>     TextTransSeq = [ Script ] TransSeq .
                   7721:      Script     = NAME .
1.30      cvs      7722:      TransSeq     ='BEGIN' &lt; Translation &gt; 'END' ';' /
1.1       cvs      7723:                     Translation .
1.30      cvs      7724:      Translation  = Source [ '-&gt;' Target ] ';' .
1.1       cvs      7725:      Source       = STRING .
1.18      cvs      7726:      Target       = STRING .</pre>
1.30      cvs      7727: 
                   7728: <p>One such rule signifies that when the source string appears in a text leaf
                   7729: of the document being translated, the translator must replace it, in the
1.37      cvs      7730: translated document, with the target string. The source string and the target
                   7731: string can have different lengths and the target string can be empty. In this
1.1       cvs      7732: last case, the translator simply suppresses every occurrence of the source
1.18      cvs      7733: string in the translated document.</p>
1.30      cvs      7734: 
1.41      vatton   7735: <p>For a given script, the order of the rules is not important and has no
1.1       cvs      7736: significance because the T language compiler reorders the rules in ways that
1.37      cvs      7737: speed up the translator's work. The total number of recoding rules is limited
1.18      cvs      7738: by the compiler as is the maximum length of the source and target strings.</p>
1.30      cvs      7739: 
                   7740: <p>The recoding rules for symbols and graphical elements are written in the
1.37      cvs      7741: same manner as the recoding rules for character strings. They are preceded,
                   7742: respectively, by the <tt>SYMBTRANSLATE</tt> and <tt>GRAPHTRANSLATE</tt> and
1.43      quint    7743: so not require a specification of the script. Their source string is limited
                   7744: to one character, since, in Thot, each symbol and each graphical element is
                   7745: represented by a single character. The symbol and graphical element codes are
                   7746: defined along with the <a href="#sect7">non-standard character codes</a>.</p>
1.30      cvs      7747: 
1.18      cvs      7748: <blockquote class="example">
1.30      cvs      7749:   <p><strong>Example:</strong></p>
                   7750: 
                   7751:   <p>In a translation schema producing documents destined for use with the
                   7752:   L<sup>A</sup>T<sub><big>E</big></sub>X formatter, the Latin characters``é''
1.37      cvs      7753:   (octal code 351 in Thot) and ``č'' (octal code 350 in Thot) must be
1.30      cvs      7754:   converted to their representation in
                   7755:   L<sup>A</sup>T<sub><big>E</big></sub>X:</p>
                   7756:   <pre>TEXTTRANSLATE Latin
1.1       cvs      7757:      BEGIN
1.30      cvs      7758:      '\350' -&gt; '\`{e}';    { e grave }
                   7759:      '\351' -&gt; '\''{e}';   { e acute }
1.18      cvs      7760:      END;</pre>
                   7761: </blockquote>
                   7762: </div>
                   7763: </div>
1.37      cvs      7764: <hr />
1.18      cvs      7765: </div>
1.1       cvs      7766: 
1.18      cvs      7767: <div class="chapter">
1.37      cvs      7768: <h1><a name="sect6" id="sect6">Language grammars</a></h1>
1.1       cvs      7769: 
1.30      cvs      7770: <p>This chapter gives the complete grammars of the languages of Thot. The
1.1       cvs      7771: grammars were presented and described in the preceding chapters, which also
1.37      cvs      7772: specify the semantics of the languages. This section gives only the
1.18      cvs      7773: syntax.</p>
1.1       cvs      7774: 
1.18      cvs      7775: <div class="section">
1.37      cvs      7776: <h2><a name="sectb61" id="sectb61">The M meta-language</a></h2>
1.1       cvs      7777: 
1.30      cvs      7778: <p>The language grammars are all expressed in the same formalism, the M
1.18      cvs      7779: meta-language, which is defined in this section.</p>
                   7780: <pre>{ Any text between braces is a comment. }
1.30      cvs      7781: Grammar      = Rule &lt; Rule &gt; 'END' .
                   7782:                { The &lt; and &gt; signs indicate zero }
1.1       cvs      7783:                { or more repetitions. }
                   7784:                { END marks the end of the grammar. }
                   7785: Rule         = Ident '=' RightPart '.' .
                   7786:                { The period indicates the end of a rule }
                   7787: RightPart    = RtTerminal / RtIntermed .
                   7788:                { The slash indicates a choice }
                   7789: RtTerminal   ='NAME' / 'STRING' / 'NUMBER' .
                   7790:                { Right part of a terminal rule }
1.30      cvs      7791: RtIntermed   = Possibility &lt; '/' Possibility &gt; .
1.1       cvs      7792:                { Right part of an intermediate rule }
1.30      cvs      7793: Possibility  = ElemOpt &lt; ElemOpt &gt; .
                   7794: ElemOpt      = Element / '[' Element &lt; Element &gt; ']' /
                   7795:               '&lt;' Element &lt; Element &gt; '&gt;'  .
1.1       cvs      7796:                { Brackets delimit optional parts }
                   7797: Element      = Ident / KeyWord .
                   7798: Ident        = NAME .
                   7799:                { Identifier, sequence of characters
                   7800: KeyWord      = STRING .
                   7801:                { Character string delimited by apostrophes }
1.18      cvs      7802: END</pre>
                   7803: </div>
1.1       cvs      7804: 
1.18      cvs      7805: <div class="section">
1.37      cvs      7806: <h2><a name="sectb62" id="sectb62">The S language</a></h2>
1.1       cvs      7807: 
1.30      cvs      7808: <p>The S language is used to write structure schemas, which contain the
1.37      cvs      7809: generic logical structures of document and object classes. It is described
1.30      cvs      7810: here in the M meta-language.</p>
1.18      cvs      7811: <pre>StructSchema   = 'STRUCTURE' [ 'EXTENSION' ] ElemID ';'
1.1       cvs      7812:                  'DEFPRES' PresID ';'
                   7813:                [ 'ATTR' AttrSeq ]
                   7814:                [ 'STRUCT' RulesSeq ]
                   7815:                [ 'EXTENS' ExtensRuleSeq ]
                   7816:                [ 'UNITS' RulesSeq ]
                   7817:                [ 'EXPORT' SkeletonSeq ]
                   7818:                [ 'EXCEPT' ExceptSeq ]
                   7819:                  'END' .
                   7820: 
                   7821: ElemID         = NAME .
                   7822: PresID         = NAME .
                   7823: 
1.30      cvs      7824: AttrSeq        = Attribute &lt; Attribute &gt; .
1.1       cvs      7825: Attribute      = AttrID '=' AttrType ';' .
                   7826: AttrType       = 'INTEGER' / 'TEXT' /
                   7827:                  'REFERENCE' '(' RefType ')' /
                   7828:                  ValueSeq .
                   7829: RefType        = 'ANY' /
                   7830:                  [ FirstSec ] ElemID [ ExtStruct ] .
1.30      cvs      7831: ValueSeq       = AttrVal &lt; ',' AttrVal &gt; .
1.1       cvs      7832: AttrID         = NAME .
                   7833: FirstSec       = 'First' / 'Second' .
                   7834: ExtStruct      = '(' ElemID ')' .
                   7835: AttrVal        = NAME .
                   7836: 
1.30      cvs      7837: RulesSeq       = Rule &lt; Rule &gt; .
1.1       cvs      7838: Rule           = ElemID [ LocAttrSeq ] '='
                   7839:                  DefWithAttr ';' .
                   7840: LocAttrSeq     = '(' 'ATTR' LocalAttr
1.30      cvs      7841:                       &lt; ';' LocalAttr &gt; ')' .
1.1       cvs      7842: LocalAttr      = [ '!' ] AttrID [ '=' AttrType ] .
                   7843: DefWithAttr    = Definition
                   7844:                  [ '+' '(' ExtensionSeq ')' ]
                   7845:                  [ '-' '(' RestrictSeq ')' ]
                   7846:                  [ 'WITH' FixedAttrSeq ] .
1.30      cvs      7847: ExtensionSeq   = ExtensionElem &lt; ',' ExtensionElem &gt; .
1.1       cvs      7848: ExtensionElem  = ElemID / 'TEXT' / 'GRAPHICS' /
                   7849:                  'SYMBOL' / 'PICTURE' .
1.30      cvs      7850: RestrictSeq    = RestrictElem &lt; ',' RestrictElem &gt; .
1.1       cvs      7851: RestrictElem   = ElemID / 'TEXT' / 'GRAPHICS' /
                   7852:                  'SYMBOL' / 'PICTURE' .
1.30      cvs      7853: FixedAttrSeq   = FixedAttr &lt; ',' FixedAttr &gt; .
1.1       cvs      7854: FixedAttr      = AttrID [ FixedOrModifVal ] .
                   7855: FixedOrModifVal= [ '?' ] '=' FixedValue .
                   7856: FixedValue     = [ '-' ] NumValue / TextValue / AttrVal .
                   7857: NumValue       = NUMBER .
                   7858: TextValue      = STRING .
                   7859: 
                   7860: Definition     = BaseType [ LocAttrSeq ] / Constr /
                   7861:                  Element .
                   7862: BaseType       = 'TEXT' / 'GRAPHICS' / 'SYMBOL' /
                   7863:                  'PICTURE' / 'UNIT' / 'NATURE' .
                   7864: Element        = ElemID [ ExtOrDef ] .
                   7865: ExtOrDef       = 'EXTERN' / 'INCLUDED' /
                   7866:                  [ LocAttrSeq ] '=' Definition .
                   7867: 
                   7868: Constr         = 'LIST' [ '[' min '..' max ']' ] 'OF'
                   7869:                         '(' DefWithAttr ')' /
                   7870:                  'BEGIN' DefOptSeq 'END' /
                   7871:                  'AGGREGATE' DefOptSeq 'END' /
                   7872:                  'CASE' 'OF' DefSeq 'END' /
                   7873:                  'REFERENCE' '(' RefType ')' /
                   7874:                  'PAIR' .
                   7875: 
                   7876: min            = Integer / '*' .
                   7877: max            = Integer / '*' .
                   7878: Integer        = NUMBER .
                   7879: 
1.30      cvs      7880: DefOptSeq      = DefOpt ';' &lt; DefOpt ';' &gt; .
1.1       cvs      7881: DefOpt         = [ '?' ] DefWithAttr .
                   7882: 
1.30      cvs      7883: DefSeq         = DefWithAttr ';' &lt; DefWithAttr ';' &gt; .
1.1       cvs      7884: 
1.30      cvs      7885: SkeletonSeq    = SkeletonElem &lt; ',' SkeletonElem &gt; ';' .
1.1       cvs      7886: SkeletonElem   = ElemID [ 'WITH' Contents ] .
                   7887: Contents       = 'Nothing' / ElemID [ ExtStruct ] .
                   7888: 
1.30      cvs      7889: ExceptSeq      = Except ';' &lt; Except ';' &gt; .
1.1       cvs      7890: Except         = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr ':'
                   7891:                  ExcValSeq .
                   7892: ExcTypeOrAttr  = ElemID / AttrID .
1.30      cvs      7893: ExcValSeq      = ExcValue &lt; ',' ExcValue &gt; .
1.1       cvs      7894: ExcValue       = 'NoCut' / 'NoCreate' /
                   7895:                  'NoHMove' / 'NoVMove' / 'NoMove' /
                   7896:                  'NoHResize' / 'NoVResize' / 'NoResize' /
1.18      cvs      7897:                  'MoveResize' /
1.1       cvs      7898:                  'NewWidth' / 'NewHeight' /
                   7899:                  'NewHPos' / 'NewVPos' /
                   7900:                  'Invisible' / 'NoSelect' /
                   7901:                  'Hidden' / 'ActiveRef' /
                   7902:                  'ImportLine' / 'ImportParagraph' /
1.9       cvs      7903:                  'NoPaginate' / 'ParagraphBreak' /
                   7904:                  'HighlightChildren' / 'ExtendedSelection' /
1.36      cvs      7905:                  'SelectParent' / 'ClickableSurface' /
1.29      cvs      7906:                  'ReturnCreateNL' / 'ReturnCreateWithin' .
1.1       cvs      7907: 
1.30      cvs      7908: ExtensRuleSeq  = ExtensRule ';' &lt; ExtensRule ';' &gt; .
1.1       cvs      7909: ExtensRule     = RootOrElem [ LocAttrSeq ]
                   7910:                  [ '+' '(' ExtensionSeq ')' ]
                   7911:                  [ '-' '(' RestrictSeq ')' ]
                   7912:                  [ 'WITH' FixedAttrSeq ] .
                   7913: RootOrElem     = 'Root' / ElemID .
                   7914: 
1.18      cvs      7915: END</pre>
                   7916: </div>
1.1       cvs      7917: 
1.18      cvs      7918: <div class="section">
1.37      cvs      7919: <h2><a name="sectb63" id="sectb63">The P language</a></h2>
1.1       cvs      7920: 
1.30      cvs      7921: <p>The P language is used to write presentation schemas, which define the
1.1       cvs      7922: graphical presentation rules to be applied to different classes of documents
1.37      cvs      7923: and objects. It is described here in the M meta-language.</p>
1.18      cvs      7924: <pre>PresSchema      = 'PRESENTATION' ElemID ';'
1.1       cvs      7925:                 [ 'VIEWS' ViewSeq ]
                   7926:                 [ 'PRINT' PrintViewSeq ]
                   7927:                 [ 'COUNTERS' CounterSeq ]
                   7928:                 [ 'CONST' ConstSeq ]
                   7929:                 [ 'VAR' VarSeq ]
                   7930:                 [ 'DEFAULT' ViewRuleSeq ]
                   7931:                 [ 'BOXES' BoxSeq ]
                   7932:                 [ 'RULES' PresentSeq ]
                   7933:                 [ 'ATTRIBUTES' PresAttrSeq ]
                   7934:                 [ 'TRANSMIT' TransmitSeq ]
                   7935:                   'END' .
                   7936: 
                   7937: ElemID          = NAME .
                   7938: 
                   7939: ViewSeq         = ViewDeclaration
1.30      cvs      7940:                   &lt; ',' ViewDeclaration &gt; ';' .
1.1       cvs      7941: ViewDeclaration = ViewID [ 'EXPORT' ] .
                   7942: ViewID          = NAME .
                   7943: 
1.30      cvs      7944: PrintViewSeq    = PrintView &lt; ',' PrintView &gt; ';' .
1.37      cvs      7945: PrintView       = ViewID .
1.1       cvs      7946: 
1.30      cvs      7947: CounterSeq      = Counter &lt; Counter &gt; .
1.1       cvs      7948: Counter         = CounterID ':' CounterFunc ';' .
                   7949: CounterID       = NAME .
                   7950: CounterFunc     = 'RANK' 'OF' TypeOrPage [ SLevelAsc ]
                   7951:                   [ 'INIT' AttrID ] [ 'REINIT' AttrID ] /
1.30      cvs      7952:                   SetFunction &lt; SetFunction &gt;
                   7953:                   AddFunction &lt; AddFunction &gt;
1.1       cvs      7954:                   [ 'INIT' AttrID ] /
1.16      cvs      7955:                   'RLEVEL' 'OF' ElemID .
1.1       cvs      7956: SLevelAsc       = [ '-' ] LevelAsc .
                   7957: LevelAsc        = NUMBER .
                   7958: SetFunction     = 'SET' CounterValue 'ON' TypeOrPage .
                   7959: AddFunction     = 'ADD' CounterValue 'ON' TypeOrPage .
                   7960: TypeOrPage      = 'Page' [ '(' ViewID ')' ] /
1.16      cvs      7961:                   [ '*' ] ElemID .
1.1       cvs      7962: CounterValue    = NUMBER .
                   7963: 
1.30      cvs      7964: ConstSeq        = Const &lt; Const &gt; .
1.1       cvs      7965: Const           = ConstID '=' ConstType ConstValue ';' .
                   7966: ConstID         = NAME .
1.41      vatton   7967: ConstType       = 'Text' [ Script ] / 'Symbol' /
1.1       cvs      7968:                   'Graphics' / 'Picture' .
                   7969: ConstValue      = STRING .
1.41      vatton   7970: Script        = NAME .
1.1       cvs      7971: 
1.30      cvs      7972: VarSeq          = Variable &lt; Variable &gt; .
1.1       cvs      7973: Variable        = VarID ':' FunctionSeq ';' .
                   7974: VarID           = NAME .
1.30      cvs      7975: FunctionSeq     = Function &lt; Function &gt; .
1.1       cvs      7976: Function        = 'DATE' / 'FDATE' /
                   7977:                   'DocName' / 'DirName' /
1.38      cvs      7978:                   'ElemName' / 'AttributeName' / 'AttributeValue' /
1.1       cvs      7979:                   ConstID / ConstType ConstValue /
                   7980:                   AttrID /
                   7981:                   'VALUE' '(' PageAttrCtr ','
                   7982:                   CounterStyle ')' .
                   7983: PageAttrCtr     = 'PageNumber' [ '(' ViewID ')' ] /
                   7984:                   [ MinMax ] CounterID / AttrID .
                   7985: CounterStyle    = 'Arabic' / 'LRoman' / 'URoman' /
                   7986:                   'Uppercase' / 'Lowercase' .
                   7987: MinMax          = 'MaxRangeVal' / 'MinRangeVal' .
                   7988: 
1.30      cvs      7989: BoxSeq          = Box &lt; Box &gt; .
1.1       cvs      7990: Box             = 'FORWARD' BoxID ';' /
                   7991:                   BoxID ':' ViewRuleSeq .
                   7992: BoxID           = NAME .
                   7993: 
1.30      cvs      7994: PresentSeq      = Present &lt; Present &gt; .
1.1       cvs      7995: Present         = [ '*' ] [ FirstSec ] ElemID ':'
                   7996:                   ViewRuleSeq .
                   7997: FirstSec        = 'First' / 'Second' .
                   7998: 
1.30      cvs      7999: PresAttrSeq     = PresAttr &lt; PresAttr &gt; .
1.1       cvs      8000: PresAttr        = AttrID [ '(' [ FirstSec ] ElemID ')' ] 
                   8001:                   [ AttrRelation ] ':' ViewRuleSeq .
                   8002: AttrID          = NAME .
                   8003: AttrRelation    = '=' AttrVal /
1.30      cvs      8004:                   '&gt;' [ '-' ] MinValue /
1.1       cvs      8005:                   '&lt;' [ '-' ] MaxValue /
                   8006:                   'IN' '[' [ '-' ] LowerBound '..' 
                   8007:                   [ '-' ] UpperBound ']' /
                   8008:                   'GREATER' AttrID /
                   8009:                   'EQUAL' AttrID /
                   8010:                   'LESS' AttrID .
                   8011: AttrVal         = [ '-' ] EqualNum / EqualText / AttrValue .
                   8012: MinValue        = NUMBER .
                   8013: MaxValue        = NUMBER .
                   8014: LowerBound      = NUMBER .
                   8015: UpperBound      = NUMBER.
                   8016: EqualNum        = NUMBER .
                   8017: EqualText       = STRING .
                   8018: AttrValue       = NAME .
                   8019: 
1.30      cvs      8020: ViewRuleSeq     = 'BEGIN' &lt; RulesAndCond &gt; &lt; ViewRules &gt;
1.1       cvs      8021:                   'END' ';' /
                   8022:                   ViewRules / CondRules / Rule .
                   8023: RulesAndCond    = CondRules / Rule .
                   8024: ViewRules       = 'IN' ViewID CondRuleSeq .
1.30      cvs      8025: CondRuleSeq     = 'BEGIN' &lt; RulesAndCond &gt; 'END' ';' /
1.1       cvs      8026:                   CondRules / Rule .
1.30      cvs      8027: CondRules       = CondRule &lt; CondRule &gt;
1.1       cvs      8028:                   [ 'Otherwise' RuleSeq ] .
                   8029: CondRule        = 'IF' ConditionSeq RuleSeq .
1.30      cvs      8030: RulesSeq        = 'BEGIN' Rule &lt; Rule &gt; 'END' ';' / Rule .
1.1       cvs      8031: 
1.30      cvs      8032: ConditionSeq    = Condition &lt; 'AND' Condition &gt; .
1.6       cvs      8033: Condition       = [ 'NOT' ] [ 'Target' ] ConditionElem .
                   8034: ConditionElem   = 'First' / 'Last' /
                   8035:                   [ 'Immediately' ] 'Within' [ NumParent ]
                   8036:                                      ElemID [ ExtStruct ] /
                   8037:                    ElemID /
                   8038:                   'Referred' / 'FirstRef' / 'LastRef' /
                   8039:                   'ExternalRef' / 'InternalRef' / 'CopyRef' /
1.44      quint    8040:                    [ 'Inherited' ] AttrID [ '=' Value ] /
1.6       cvs      8041:                   'AnyAttributes' / 'FirstAttr' / 'LastAttr' /
                   8042:                   'UserPage' / 'StartPage' / 'ComputedPage' /
1.33      cvs      8043:                   'Empty' / 'Root' /
1.6       cvs      8044:                   '(' [ MinMax ] CounterName CounterCond ')' /
                   8045:                   CondPage '(' CounterID ')' .
                   8046: NumParent       = [ GreaterLess ] NParent .
1.30      cvs      8047: GreaterLess     = '&gt;' / '&lt;' .
1.6       cvs      8048: NParent         = NUMBER.
1.30      cvs      8049: CounterCond     = '&lt;' MaxCtrVal / '&gt;' MinCtrVal /
1.6       cvs      8050:                   '=' EqCtrVal / 
                   8051:                   'IN' '[' ['-'] MinCtrBound '..' 
                   8052:                   ['-'] MaxCtrBound ']' .
                   8053: PageCond        = 'Even' / 'Odd' / 'One' .
                   8054: MaxCtrVal       = NUMBER .
                   8055: MinCtrVal       = NUMBER .
                   8056: EqCtrVal        = NUMBER .
                   8057: MaxCtrBound     = NUMBER .
                   8058: MinCtrBound     = NUMBER .
1.1       cvs      8059: 
1.34      cvs      8060: Rule            = Property ';' / PresFunc ';' .
                   8061: Property        = 'VertRef' ':' HorizPosition /
1.1       cvs      8062:                   'HorizRef' ':' VertPosition /
                   8063:                   'VertPos' ':' VPos /
                   8064:                   'HorizPos' ':' HPos /
1.49    ! quint    8065:                   'Float' ':' FloatInherit /
        !          8066:                   'Clear' ':' ClearInherit /
1.1       cvs      8067:                   'Height' ':' Extent /
                   8068:                   'Width' ':' Extent /
                   8069:                   'VertOverflow' ':' Boolean /
                   8070:                   'HorizOverflow' ':' Boolean /
1.26      cvs      8071:                   'MarginTop' ':' MarginWidth /
                   8072:                   'MarginRight' ':' MarginWidth /
                   8073:                   'MarginBottom' ':' MarginWidth /
                   8074:                   'MarginLeft' ':' MarginWidth /
                   8075:                   'PaddingTop' ':' PaddingWidth /
                   8076:                   'PaddingRight' ':' PaddingWidth /
                   8077:                   'PaddingBottom' ':' PaddingWidth /
                   8078:                   'PaddingLeft' ':' PaddingWidth /
                   8079:                   'BorderTopWidth' ':' BorderWidth /
                   8080:                   'BorderRightWidth' ':' BorderWidth /
                   8081:                   'BorderBottomWidth' ':' BorderWidth /
                   8082:                   'BorderLeftWidth' ':' BorderWidth /
                   8083:                   'BorderTopColor' ':' BorderColor /
                   8084:                   'BorderRightColor' ':' BorderColor /
                   8085:                   'BorderBottomColor' ':' BorderColor /
                   8086:                   'BorderLeftColor' ':' BorderColor /
                   8087:                   'BorderTopStyle' ':' BorderStyle /
                   8088:                   'BorderRightStyle' ':' BorderStyle /
                   8089:                   'BorderBottomStyle' ':' BorderStyle /
                   8090:                   'BorderLeftStyle' ':' BorderStyle .
1.1       cvs      8091:                   'LineSpacing' ':' DistOrInherit /
                   8092:                   'Indent' ':' DistOrInherit /
                   8093:                   'Adjust' ':' AlignOrInherit /
                   8094:                   'Hyphenate' ':' BoolInherit /
1.40      quint    8095:                   'Direction' ':' DirInherit /
1.43      quint    8096:                   'UnicodeBidi' ':' BidiInherit /
1.1       cvs      8097:                   'PageBreak' ':' Boolean /
                   8098:                   'LineBreak' ':' Boolean /
                   8099:                   'InLine' ':' Boolean /
                   8100:                   'NoBreak1' ':' AbsDist /
                   8101:                   'NoBreak2' ':' AbsDist /
                   8102:                   'Gather' ':' Boolean /
                   8103:                   'Visibility' ':' NumberInherit /
                   8104:                   'Size'  ':' SizeInherit /
                   8105:                   'Font' ':' NameInherit /
                   8106:                   'Style' ':' StyleInherit /
1.23      cvs      8107:                   'Weight' ':' WeightInherit /
1.1       cvs      8108:                   'Underline' ':' UnderLineInherit /
                   8109:                   'Thickness' ':' ThicknessInherit /
                   8110:                   'Depth' ':' NumberInherit /
                   8111:                   'LineStyle' ':' LineStyleInherit /
                   8112:                   'LineWeight' ':' DistOrInherit /
                   8113:                   'FillPattern' ':' NameInherit /
1.30      cvs      8114:                   'Background' ':' Color /
                   8115:                   'Foreground' ':' Color /
1.47      quint    8116:                   'Opacity' ':' OpacityInherit /
                   8117:                   'FillOpacity' ':' OpacityInherit /
                   8118:                   'StrokeOpacity' ':' OpacityInherit /
1.1       cvs      8119:                   'Content' ':' VarConst .
                   8120: PresFunc        = Creation '(' BoxID ')' /
                   8121:                   'Line' /
                   8122:                   'NoLine' /
                   8123:                   'Page' '(' BoxID ')' /
1.13      cvs      8124:                   'Copy' '(' BoxTypeToCopy ')' /
                   8125:                   'ShowBox' /
1.18      cvs      8126:                   'BackgroundPicture' ':' FileName /
                   8127:                   'PictureMode' ':' PictMode .
1.1       cvs      8128: 
                   8129: BoxTypeToCopy   = BoxID [ ExtStruct ] /
                   8130:                    ElemID [ ExtStruct ] .
                   8131: ExtStruct       = '(' ElemID ')' .
                   8132: 
                   8133: Distance        = [ Sign ] AbsDist .
                   8134: Sign            = '+' / '-' .
                   8135: AbsDist         = IntegerOrAttr [ '.' DecimalPart ]
                   8136:                   [ Unit ] .
                   8137: IntegerOrAttr   = IntegerPart / AttrID .
                   8138: IntegerPart     = NUMBER .
                   8139: DecimalPart     = NUMBER .
                   8140: Unit            = 'em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' /
                   8141:                   'pc' / 'px' / '%' .
                   8142: 
                   8143: HPos            = 'nil' / VertAxis '=' HorizPosition 
                   8144:                   [ 'UserSpecified' ] .
                   8145: VPos            = 'nil' / HorizAxis '=' VertPosition 
                   8146:                   [ 'UserSpecified' ] .
                   8147: VertAxis        = 'Left' / 'VMiddle' / 'VRef' / 'Right' .
                   8148: HorizAxis       = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .
                   8149: 
1.6       cvs      8150: VertPosition    = Reference '.' HorizAxis [ Distance ] .
                   8151: HorizPosition   = Reference '.' VertAxis [ Distance ] .
                   8152: Reference       = 'Enclosing' [ BoxTypeNot ] /
                   8153:                   'Enclosed' [ BoxTypeNot ] /
                   8154:                   'Previous' [ BoxTypeNot ] /
                   8155:                   'Next' [ BoxTypeNot ] /
                   8156:                   'Referred' [ BoxTypeNot ] /
                   8157:                   'Creator' /
                   8158:                   'Root' /
                   8159:                   '*' /
                   8160:                   BoxOrType .
                   8161: BoxOrType       = BoxID /
                   8162:                   [ '*' ] [ FirstSec ] ElemID /
1.17      cvs      8163:                   'AnyElem' / 'AnyBox' /
                   8164:                   'ElemWithAttr' AttrID .
1.6       cvs      8165: BoxTypeNot      = [ 'NOT' ] BoxOrType .
1.49    ! quint    8166: 
        !          8167: FloatInherit    = Link '=' / 'Left' / 'Right' / 'None' .
        !          8168: ClearInherit    = Link '=' / 'None' / 'Left' / 'Right' / 'Both' .
1.6       cvs      8169: 
                   8170: Extent          = Reference '.' HeightWidth
                   8171:                   [ Relation ] [ 'Min' ] /
                   8172:                   AbsDist [ 'UserSpecified' ] [ 'Min' ] /
                   8173:                   HPos / VPos .
                   8174: HeightWidth     = 'Height' / 'Width' .
                   8175: Relation        = '*' ExtentAttr '%' / Distance .
                   8176: ExtentAttr      = ExtentVal / AttrID .
                   8177: ExtentVal       = NUMBER .
1.26      cvs      8178: 
                   8179: MarginWidth     = InheritParent / 'Auto' / Distance .
                   8180: PaddingWidth    = InheritParent / Distance .
                   8181: BorderWidth     = InheritParent / 'Thin' / 'Medium' / 'Thick' / Distance .
                   8182: BorderColor     = InheritParent / 'Transparent' / 'Foreground' /
                   8183:                   ColorName .
                   8184: BorderStyle     = InheritParent /
                   8185:                   'None' / 'Hidden' / 'Dotted' / 'Dashed' / 'Solid' /
                   8186:                   'Double' / 'Groove' / 'Ridge' / 'Inset' / 'Outset' .
1.27      cvs      8187: InheritParent   = 'Enclosing' '=' / 'Creator' '=' .
1.26      cvs      8188: ColorName       = NAME .
1.6       cvs      8189: 
                   8190: Inheritance     = Kinship  InheritedValue .
                   8191: Kinship         = 'Enclosing' / 'GrandFather'/ 'Enclosed' /
                   8192:                   'Previous' / 'Creator' .
                   8193: InheritedValue  = '+' PosIntAttr [ 'Max' maximumA ] /
                   8194:                   '-' NegIntAttr [ 'Min' minimumA ] /
                   8195:                   '=' .
                   8196: PosIntAttr      = PosInt / AttrID .
                   8197: PosInt          = NUMBER .
                   8198: NegIntAttr      = NegInt / AttrID .
                   8199: NegInt          = NUMBER .
                   8200: maximumA        = maximum / AttrID .
                   8201: maximum         = NUMBER .
                   8202: minimumA        = minimum / AttrID .
                   8203: minimum         = NUMBER .
                   8204: 
                   8205: AlignOrInherit  = Kinship '=' / Alignment .
                   8206: Alignment       = 'Left' / 'Right' / 'VMiddle' /
                   8207:                   'LeftWithDots' .
1.1       cvs      8208: 
1.40      quint    8209: DirInherit      = 'ltr' / 'rtl' / Kinship '=' .
1.43      quint    8210: BidiInherit     = 'Normal' / 'Embed' / 'Override' / Kinship '=' .
1.40      quint    8211: 
1.6       cvs      8212: DistOrInherit   = Kinship InheritedDist / Distance .
                   8213: InheritedDist   = '=' / '+' AbsDist / '-' AbsDist .
1.1       cvs      8214: 
1.6       cvs      8215: BoolInherit     = Boolean / Kinship '=' .
                   8216: Boolean         = 'Yes' / 'No' .
1.1       cvs      8217: 
1.6       cvs      8218: NumberInherit   = Integer / AttrID / Inheritance .
                   8219: Integer         = NUMBER .
1.1       cvs      8220: 
                   8221: LineStyleInherit= Kinship '=' / 'Solid' / 'Dashed' /
                   8222:                   'Dotted' .
                   8223: 
1.6       cvs      8224: SizeInherit     = SizeAttr [ 'pt' ] / Kinship InheritedSize .
                   8225: InheritedSize   = '+' SizeAttr [ 'pt' ]
                   8226:                       [ 'Max' MaxSizeAttr ] /
                   8227:                   '-' SizeAttr [ 'pt' ]
                   8228:                       [ 'Min' MinSizeAttr ] /
1.22      cvs      8229:                   '*' PercentSizeAttr '%' /
1.6       cvs      8230:                   '=' .
                   8231: SizeAttr        = Size / AttrID .
                   8232: Size            = NUMBER .
                   8233: MaxSizeAttr     = MaxSize / AttrID .
                   8234: MaxSize         = NUMBER .
                   8235: MinSizeAttr     = MinSize / AttrID .
                   8236: MinSize         = NUMBER .
1.22      cvs      8237: PercentSizeAttr = PercentSize / AttrID .
                   8238: PercentSize     = NUMBER .
1.6       cvs      8239: 
                   8240: NameInherit     = Kinship '=' / FontName .
                   8241: FontName        = NAME .
1.30      cvs      8242: Color           = 'Transparent' / Kinship '=' / FontName .
1.47      quint    8243: OpacityInherit  = OpPercent '%' / AttrID / Inheritance .
                   8244: OpPercent       = NUMBER .
1.6       cvs      8245: StyleInherit    = Kinship '=' /
1.23      cvs      8246:                   'Roman' / 'Italics' / 'Oblique' .
                   8247: WeightInherit   = Kinship '=' /
                   8248:                   'Normal' / 'Bold' .
1.1       cvs      8249: UnderLineInherit= Kinship '=' /
1.6       cvs      8250:                   'NoUnderline' / 'Underlined' / 
                   8251:                   'Overlined' / 'CrossedOut' .
1.1       cvs      8252: ThicknessInherit= Kinship '=' / 'Thick' / 'Thin' .
1.13      cvs      8253: 
                   8254: FileName =        STRING .
                   8255: PictMode =        'NormalSize' / 'Scale' /
                   8256:                   'RepeatXY' / 'RepeatX' / 'RepeatY' .
1.1       cvs      8257: 
1.6       cvs      8258: VarConst        = ConstID / ConstType ConstValue /
                   8259:                   VarID / '(' FunctionSeq ')' /
                   8260:                   ElemID .
                   8261: 
                   8262: Creation        = Create [ 'Repeated' ] .
                   8263: Create          = 'CreateFirst' / 'CreateLast' /
                   8264:                   'CreateBefore' / 'CreateAfter' /
                   8265:                   'CreateEnclosing' .
                   8266: 
1.30      cvs      8267: TransmitSeq     = Transmit &lt; Transmit &gt; .
1.6       cvs      8268: Transmit        = TypeOrCounter 'To' ExternAttr
                   8269:                   '(' ElemID ')' ';' .
                   8270: TypeOrCounter   = CounterID / ElemID .
                   8271: ExternAttr      = NAME .
1.1       cvs      8272: 
1.18      cvs      8273: END</pre>
                   8274: </div>
1.1       cvs      8275: 
1.18      cvs      8276: <div class="section">
1.37      cvs      8277: <h2><a name="sectb64" id="sectb64">The T language</a></h2>
1.18      cvs      8278: <pre>TransSchema   = 'TRANSLATION' ElemID ';'
1.1       cvs      8279:               [ 'LINELENGTH' LineLength ';' ]
                   8280:               [ 'LINEEND' CHARACTER ';' ]
                   8281:               [ 'LINEENDINSERT' STRING ';' ]
                   8282:               [ 'BUFFERS' BufferSeq ]
                   8283:               [ 'COUNTERS' CounterSeq ]
                   8284:               [ 'CONST' ConstSeq ]
                   8285:               [ 'VAR' VariableSeq ]
                   8286:                 'RULES' ElemSeq
                   8287:               [ 'ATTRIBUTES' AttrSeq ]
                   8288:               [ 'PRESENTATION' PresSeq ]
1.30      cvs      8289:               &lt; 'TEXTTRANSLATE' TextTransSeq &gt;
1.1       cvs      8290:               [ 'SYMBTRANSLATE' TransSeq ]
                   8291:               [ 'GRAPHTRANSLATE' TransSeq ]
                   8292:                 'END' .
                   8293: 
                   8294: LineLength    = NUMBER .
                   8295: 
1.30      cvs      8296: BufferSeq     = Buffer &lt; Buffer &gt; .
1.46      quint    8297: Buffer        = BufferID [ '(' BufferType ')' ] ';' .
1.1       cvs      8298: BufferID      = NAME .
1.46      quint    8299: BufferType    = 'Picture' / 'Variable' .
1.1       cvs      8300: 
1.30      cvs      8301: CounterSeq    = Counter &lt; Counter &gt; .
1.1       cvs      8302: Counter       = CounterID [ ':' CounterFunc ] ';' .
                   8303: CounterID     = NAME .
                   8304: CounterFunc   = 'Rank' 'of' ElemID [ SLevelAsc ]
                   8305:                 [ 'Init' AttrID ] /
                   8306:                 'Rlevel' 'of' ElemID /
                   8307:                 'Set' InitValue 'On' ElemID
                   8308:                       'Add' Increment 'On' ElemID
                   8309:                       [ 'Init' AttrID ] .
                   8310: SLevelAsc     = [ '-' ] LevelAsc .
                   8311: LevelAsc      =  NUMBER .
                   8312: InitValue     = NUMBER .
                   8313: Increment     = NUMBER .
                   8314: ElemID        = NAME .
                   8315: AttrID        = NAME .
                   8316: 
1.30      cvs      8317: ConstSeq      = Const &lt; Const &gt; .
1.1       cvs      8318: Const         = ConstID '=' ConstValue ';' .
                   8319: ConstID       = NAME .
                   8320: ConstValue    = STRING .
                   8321: 
1.30      cvs      8322: VariableSeq   = Variable &lt; Variable &gt; .
                   8323: Variable      = VarID ':' Function &lt; Function &gt; ';' .
1.1       cvs      8324: VarID         = NAME .
                   8325: Function      = 'Value' '(' CounterID [ ':' Length ]
                   8326:                           [ ',' CounterStyle ]  ')' /
                   8327:                 'FileDir' / 'FileName' / 'Extension' /
                   8328:                 'DocumentName' / 'DocumentDir' /
                   8329:                 ConstID / CharString / 
                   8330:                 BufferID / AttrID .
                   8331: Length        = NUMBER .
                   8332: CounterStyle=   'Arabic' / 'LRoman' / 'URoman' /
                   8333:                 'Uppercase' / 'Lowercase' .
                   8334: CharString    = STRING .
                   8335: 
1.30      cvs      8336: ElemSeq       = TransType &lt; TransType &gt; .
1.1       cvs      8337: TransType     = [ FirstSec ] ElemID ':' RuleSeq .
                   8338: FirstSec      = 'First' / 'Second' .
1.30      cvs      8339: RuleSeq       = Rule / 'BEGIN' &lt; Rule &gt; 'END' ';' .
1.1       cvs      8340: Rule          = SimpleRule / ConditionBlock .
                   8341: ConditionBlock= 'IF' ConditionSeq SimpleRuleSeq .
1.30      cvs      8342: SimpleRuleSeq = 'BEGIN' &lt; SimpleRule &gt; 'END' ';' / 
1.1       cvs      8343:                 SimpleRule .
                   8344: 
                   8345: ConditionSeq  = Condition [ 'AND' Condition ] .
                   8346: Condition     = [ 'NOT' ] [ 'Target' ] Cond .
                   8347: Cond          = CondElem / CondAscend .
                   8348: CondElem      = 'FirstRef' / 'LastRef' /
                   8349:                 'ExternalRef' /
1.41      vatton   8350:                 'Script' '=' Script /
1.1       cvs      8351:                 'ComputedPage' / 'StartPage' / 
                   8352:                 'UserPage' / 'ReminderPage' /
                   8353:                 'Empty' /
1.18      cvs      8354:                 ElemID /
1.1       cvs      8355:                 'FirstAttr' / 'LastAttr' .
                   8356: CondAscend    = [ Ascend ] CondOnAscend .
                   8357: Ascend        = '*' / 'Parent' / 'Ancestor' LevelOrType .
                   8358: LevelOrType   = CondRelLevel / ElemID [ ExtStruct ] .
                   8359: CondRelLevel  = NUMBER .
                   8360: CondOnAscend  = 'First' / 'Last' /
                   8361:                 'Referred' / 
                   8362:                 [ 'Immediately' ] 'Within' [ NumParent ]
                   8363:                                   ElemID [ ExtStruct ] /
                   8364:                 'Attributes' /
                   8365:                 AttrID [ RelatAttr ] /
                   8366:                 'Presentation' /
1.34      cvs      8367:                 PresRule .
1.1       cvs      8368: NumParent     = [ GreaterLess ] NParent .
1.30      cvs      8369: GreaterLess   = '&gt;' / '&lt;' .
1.1       cvs      8370: NParent       = NUMBER.
1.41      vatton   8371: Script      = NAME .
1.1       cvs      8372: RelatAttr     = '=' Value /
1.30      cvs      8373:                  '&gt;' [ '-' ] Minimum /
1.1       cvs      8374:                  '&lt;' [ '-' ] Maximum /
                   8375:                  'IN' '[' [ '-' ] MinInterval '..'
                   8376:                           [ '-' ] MaxInterval ']' .
                   8377: Value         = [ '-' ] IntegerVal / TextVal / AttrValue .
                   8378: Minimum       = NUMBER .
                   8379: Maximum       = NUMBER .
                   8380: MinInterval   = NUMBER .
                   8381: MaxInterval   = NUMBER .
                   8382: IntegerVal    = NUMBER .
                   8383: TextVal       = STRING .
                   8384: AttrValue     = NAME .
                   8385: 
                   8386: SimpleRule    = 'Create' [ 'IN' VarID ] Object
                   8387:                        [ Position ] ';' /
                   8388:                 'Write' Object [ Position ] ';' /
                   8389:                 'Read' BufferID [ Position ] ';' /
                   8390:                 'Include' File [ Position ] ';' /
1.6       cvs      8391:                 'Get'  [ RelPosition ] ElemID 
                   8392:                        [ ExtStruct ] 
                   8393:                        [ Position ] ';' /
1.1       cvs      8394:                 'Copy' [ RelPosition ] ElemID 
                   8395:                        [ ExtStruct ] 
                   8396:                        [ Position ] ';' /
                   8397:                 'Use' TrSchema [ 'For' ElemID ] ';' /
                   8398:                 'Remove' ';' /
1.31      cvs      8399:                 'Ignore' ';' /
1.1       cvs      8400:                 'NoTranslation' ';' /
                   8401:                 'NoLineBreak' ';' /
                   8402:                 'ChangeMainFile' VarID [ Position ] ';' /
1.14      cvs      8403:                 'RemoveFile' VarID [ Position ] ';' /
1.10      cvs      8404:                 'Set' CounterID InitValue [ Position ] ';' /
                   8405:                 'Add' CounterID Increment [ Position ] ';' /
1.25      cvs      8406:                 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' .
1.10      cvs      8407: 
1.25      cvs      8408: Indent        = 'Suspend' / 'Resume' / [ IndentSign ] IndentValue .
1.10      cvs      8409: IndentSign    = '+' / '-' .
                   8410: IndentValue   = NUMBER .
1.1       cvs      8411: 
                   8412: Object        = ConstID / CharString /
                   8413:                 BufferID /
                   8414:                 VarID /
1.30      cvs      8415:                 '(' Function &lt; Function &gt; ')' /
1.21      cvs      8416:                  [ 'Translated' ] AttrID /
1.1       cvs      8417:                 'Value' /
                   8418:                 'Content' /
                   8419:                 'Attributes' /
                   8420:                 'Presentation' /
                   8421:                 'RefId' /
                   8422:                 'PairId' /
                   8423:                 'FileDir' / 'FileName' / 'Extension' /
                   8424:                 'DocumentName' / 'DocumentDir' /
                   8425:                 [ 'Referred' ] ReferredObject .
                   8426: Position      = 'After' / 'Before' .
                   8427: 
1.6       cvs      8428: ReferredObject= VarID /
                   8429:                 ElemID [ ExtStruct ] /
                   8430:                 'RefId' /
                   8431:                 'DocumentName' / 'DocumentDir' .                
1.1       cvs      8432: 
1.6       cvs      8433: File          = FileName / BufferID .
                   8434: FileName      = STRING .
1.1       cvs      8435: 
1.6       cvs      8436: RelPosition   = 'Included' / 'Referred' .
                   8437: ExtStruct     = '(' ElemID ')' .
1.1       cvs      8438: 
1.6       cvs      8439: TrSchema      = NAME .
                   8440: 
1.30      cvs      8441: AttrSeq       = TransAttr &lt; TransAttr &gt; .
1.6       cvs      8442: TransAttr     = AttrID [ '(' ElemID ')' ] 
                   8443:                 [ RelatAttr ] ':' RuleSeq .
                   8444: 
1.30      cvs      8445: PresSeq       = PresTrans &lt; PresTrans &gt; .
1.6       cvs      8446: PresTrans     = PresRule ':' RuleSeq .
                   8447: PresRule      = 'Size' [ PresRelation ] /
                   8448:                 'Indent' [ PresRelation ] /
                   8449:                 'LineSpacing' [ PresRelation ] /
                   8450:                 'Adjust' [ '=' AdjustVal ] /
                   8451:                 'Hyphenate' [ '=' BoolVal ] /
                   8452:                 'Style' [ '=' StyleVal ] /
1.24      cvs      8453:                 'Weight' [ '=' WeightVal ] /
1.6       cvs      8454:                 'Font' [ '=' FontVal ] /
                   8455:                 'UnderLine' [ '=' UnderLineVal ] /
                   8456:                 'Thickness' [ '=' ThicknessVal ] /
                   8457:                 'LineStyle' [ '=' LineStyleVal ] /
                   8458:                 'LineWeight' [ PresRelation ] /
                   8459:                 'FillPattern' [ '=' Pattern ] /
                   8460:                 'Background' [ '=' Color ] /
                   8461:                 'Foreground' [ '=' Color ] .
                   8462: 
                   8463: PresRelation  = '=' PresValue /
1.30      cvs      8464:                 '&gt;' [ '-' ] PresMinimum /
1.6       cvs      8465:                 '&lt;' [ '-' ] PresMaximum /
                   8466:                 'IN' '[' [ '-' ] PresIntervalMin '..'
                   8467:                          [ '-' ] PresIntervalMax ']' .
1.35      cvs      8468: AdjustVal     = 'Left' / 'Right' / 'VMiddle' / 'Justify' /
1.6       cvs      8469:                 'LeftWithDots' .
                   8470: BoolVal       = 'Yes' / 'No' .
1.24      cvs      8471: StyleVal      = 'Roman' / 'Italics' / 'Oblique' .
                   8472: WeightVal     = 'Normal' / 'Bold' .
1.6       cvs      8473: FontVal       = 'Times' / 'Helvetica' / 'Courier' .
                   8474: UnderLineVal  = 'NoUnderline' / 'UnderLined' /
                   8475:                 'OverLined' / 'CrossedOut' .
                   8476: ThicknessVal  = 'Thick' / 'Thin' .
                   8477: LineStyleVal  = 'Solid' / 'Dashed' / 'Dotted' .
                   8478: Pattern       = NAME .
                   8479: Color         = NAME .
                   8480: PresMinimum   = NUMBER .
                   8481: PresMaximum   = NUMBER .
1.1       cvs      8482: PresIntervalMin= NUMBER .
                   8483: PresIntervalMax= NUMBER .
1.6       cvs      8484: PresValue     = [ '-' ] PresVal .
                   8485: PresVal       = NUMBER .
1.1       cvs      8486: 
1.41      vatton   8487: TextTransSeq  = [ Script ] TransSeq .
                   8488: Script        = NAME .
1.30      cvs      8489: TransSeq      = 'BEGIN' &lt; Translation &gt; 'END' ';' /
1.6       cvs      8490:                 Translation .
1.30      cvs      8491: Translation   = Source [ '-&gt;' Target ] ';' .
1.6       cvs      8492: Source        = STRING .
1.18      cvs      8493: Target        = STRING .</pre>
                   8494: </div>
1.37      cvs      8495: <hr />
1.18      cvs      8496: </div>
1.1       cvs      8497: 
1.18      cvs      8498: <div class="chapter">
1.37      cvs      8499: <h1><a name="sect7" id="sect7">Character coding</a></h1>
1.1       cvs      8500: 
1.18      cvs      8501: <div class="section">
1.37      cvs      8502: <h2><a name="sectb71" id="sectb71">Characters</a></h2>
1.1       cvs      8503: 
1.43      quint    8504: <p>The characters of the Latin script follow the encoding defined in the ISO
                   8505: 8859-1 (ISO Latin-1) standard. The characters of the Greek script follow the
                   8506: encoding defined by Adobe for its Symbol font (Adobe FontSpecific).</p>
1.37      cvs      8507: 
                   8508: <p>Characters whose octal code is greater than 0200 are written in the form
                   8509: of their octal code preceded by a backslash character (``\''). For example,
                   8510: the French word 'Résumé' is written <tt>R\351sum\351</tt>.</p>
1.30      cvs      8511: 
                   8512: <p>To the ISO 8859-1 encoding four characters with the following codes have
1.37      cvs      8513: been added:<br />
                   8514: <tt>212</tt>: line break<br />
                   8515: <tt>240</tt>: sticky space<br />
                   8516: <tt>201</tt>: thin space<br />
1.18      cvs      8517: <tt>202</tt>: en space</p>
1.30      cvs      8518: 
                   8519: <p>The <tt>212</tt> character is a ``line break'' character which forces a
1.37      cvs      8520: line break. The <tt>240</tt> character is a ``sticky space'', which cannot be
1.18      cvs      8521: replaced by a line break.</p>
                   8522: </div>
1.1       cvs      8523: 
1.18      cvs      8524: <div class="section">
1.37      cvs      8525: <h2><a name="sectb72" id="sectb72">Symbols</a></h2>
1.1       cvs      8526: 
1.37      cvs      8527: <p>The table below gives the codes for the symbols of Thot. Symbols can be
                   8528: used in presentation schemas constants and in transcoding rules of
                   8529: translation schemas. Each symbol is represented by a single character.</p>
1.18      cvs      8530: <ul>
1.40      quint    8531:   <li><tt>r</tt> : a radical</li>
                   8532:   <li><tt>i</tt> : a simple integral</li>
                   8533:   <li><tt>c</tt> : a curvilinear integral</li>
                   8534:   <li><tt>d</tt> : a double integral</li>
                   8535:   <li><tt>t</tt> : a triple integral</li>
1.39      cvs      8536:   <li><code>o</code>: an over brace</li>
                   8537:   <li><code>u</code>: an under brace</li>
1.40      quint    8538:   <li><tt>S</tt> : the summation symbol</li>
                   8539:   <li><tt>P</tt> : the product symbol</li>
                   8540:   <li><tt>U</tt> : the union symbol</li>
                   8541:   <li><tt>I</tt> : the intersection symbol</li>
                   8542:   <li><tt>R</tt> : a right arrow</li>
                   8543:   <li><tt>L</tt> : a left arrow</li>
                   8544:   <li><tt>&lt;</tt> : an opening pointy bracket</li>
                   8545:   <li><tt>&gt;</tt> : a closing pointy bracket</li>
                   8546:   <li><tt>^</tt> : an up arrow</li>
                   8547:   <li><tt>V</tt> : a down arrow</li>
                   8548:   <li><tt>(</tt> : an opening parenthesis</li>
                   8549:   <li><tt>)</tt> : a closing parenthesis</li>
                   8550:   <li><tt>{</tt> : an opening brace</li>
                   8551:   <li><tt>}</tt> : a closing brace</li>
                   8552:   <li><tt>[</tt> : an opening square bracket</li>
                   8553:   <li><tt>]</tt> : a closing square bracket</li>
1.18      cvs      8554: </ul>
                   8555: </div>
1.1       cvs      8556: 
1.18      cvs      8557: <div class="section">
1.37      cvs      8558: <h2><a name="sectb73" id="sectb73">Graphical elements</a></h2>
1.1       cvs      8559: 
1.30      cvs      8560: <p>The table below gives the codes for the graphical elements of Thot. These
1.1       cvs      8561: elements can be used in presentation schemas constants and in transcoding
1.37      cvs      8562: rules of translation schemas. Each graphical element is represented by a
1.18      cvs      8563: single character.</p>
                   8564: <ul>
1.30      cvs      8565:   <li>a: a circle</li>
                   8566:   <li><p><tt>A</tt>: an open curve with an arrow head at the end</p>
                   8567:   </li>
1.40      quint    8568:   <li><tt>b</tt> : a horizontal line along the lower side of the box</li>
                   8569:   <li><tt>B</tt> : an open curve</li>
                   8570:   <li><tt>c</tt> : an ellipse inscribed in the box</li>
                   8571:   <li><tt>C</tt> : a rectangle with rounded corners</li>
                   8572:   <li><tt>D</tt> : an open curve with two arrow heads</li>
                   8573:   <li><tt>e</tt> : The northwest/southeast diagonal of the box with an
                   8574:     arrowhead at the bottom</li>
                   8575:   <li><tt>E</tt> : The southwest/northeast diagonal of the box with an
                   8576:     arrowhead at the top</li>
                   8577:   <li><tt>F</tt> : an open curve with an arrow head at start</li>
                   8578:   <li><tt>g</tt> : a line from the origin of the box to its opposite
                   8579:   corner</li>
                   8580:   <li><tt>h</tt> : a horizontal line as wide as the box and placed in its
                   8581:     middle</li>
                   8582:   <li><tt>l</tt> : a vertical line on the left side of the box</li>
                   8583:   <li><tt>L</tt> : a lozenge</li>
                   8584:   <li><tt>M</tt> : an open broken line with two arrow heads</li>
                   8585:   <li><tt>N</tt> : an open broken line with an arrow head at start</li>
                   8586:   <li><tt>o</tt> : The southwest/northeast diagonal of the box with an
                   8587:     arrowhead at the bottom</li>
                   8588:   <li><tt>O</tt> : The northwest/southeast diagonal of the box with an
                   8589:     arrowhead at the top</li>
                   8590:   <li><tt>p</tt> : a polygon</li>
                   8591:   <li><tt>P</tt> : a rectangle with round corners and a horizontal bar at the
                   8592:     top</li>
                   8593:   <li><tt>Q</tt> : an ellipse with a horizontal bar at the top</li>
                   8594:   <li><tt>r</tt> : a vertical line on the right side of the box</li>
                   8595:   <li><tt>R</tt> : a rectangle which is the shape of the box</li>
                   8596:   <li><tt>s</tt> : a closed curve</li>
                   8597:   <li><tt>S</tt> : an open broken line</li>
                   8598:   <li><tt>t</tt> : a horizontal line along the upper side of the box</li>
                   8599:   <li><tt>U</tt> : an open broken line with an arrow head at the end</li>
                   8600:   <li><tt>v</tt> : a vertical line as tall as the box and placed in its
                   8601:   middle</li>
                   8602:   <li><tt>V</tt> : a down arrow as tall as the box and in its middle</li>
1.30      cvs      8603:   <li>w: a segment (2 points)</li>
1.40      quint    8604:   <li><tt>W</tt> : the upper right corner</li>
1.30      cvs      8605:   <li>x: a segment (2 points) with an arrow head at the end</li>
1.40      quint    8606:   <li><tt>X</tt> : the lower right corner</li>
1.30      cvs      8607:   <li>y: a segment (2 points) with an arrow head at the end</li>
1.40      quint    8608:   <li><tt>Y</tt> : the lower left corner</li>
1.30      cvs      8609:   <li>z: a segment (2 points) with an arrow head at the end</li>
1.40      quint    8610:   <li><tt>Z</tt> : the upper left corner</li>
                   8611:   <li><tt>space</tt> : a transparent element</li>
                   8612:   <li><tt>^</tt> : an up arrow as tall as the box and in its middle</li>
                   8613:   <li><tt>&gt;</tt> : a right arrow as long as the box's width and in its
                   8614:     middle</li>
                   8615:   <li><tt>&gt;</tt> : a left arrow as long as the box's width and in its
                   8616:     middle</li>
                   8617:   <li><tt>/</tt> : The southwest/northeast diagonal of the box</li>
                   8618:   <li><tt>\</tt> : the northwest/southeast diagonal of the box</li>
1.18      cvs      8619: </ul>
1.37      cvs      8620: <hr />
1.18      cvs      8621: </div>
                   8622: </div>
                   8623: </body>
                   8624: </html>

Webmaster