Return to languages.html CVS log | Up to [Public] / Amaya / doc |
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.37 cvs 7: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 1.18 cvs 8: </head> 1.30 cvs 9: 1.18 cvs 10: <body> 11: 1.19 cvs 12: <div class="frontmatter" align="center"> 1.18 cvs 13: <h1>The Languages of Thot</h1> 14: 15: <h3>Vincent Quint</h3> 16: 17: <h4>Translated from French by Ethan Munson</h4> 18: 1.38 ! cvs 19: <h4>Version of May 21, 2001</h4> 1.30 cvs 20: 1.37 cvs 21: <p>© 1996-2001 INRIA</p> 22: <hr /> 1.18 cvs 23: </div> 24: 25: <div class="tableofcontents"> 26: <h2><a href="languages.toc.html">Contents</a></h2> 27: <ul> 1.37 cvs 28: <li><big><a href="#sect2">The document model of Thot</a></big> 1.30 cvs 29: <ul> 30: <li><strong><a href="#sectb21">The logical structure of 31: documents</a></strong></li> 32: <li><strong><a href="#sectb22">Generic and specific 33: structures</a></strong></li> 34: <li><strong><a href="#sectb23">Logical structure and physical 35: structure</a></strong></li> 36: <li><strong><a href="#sectb24">Document structures and object 37: structures</a></strong></li> 38: </ul> 39: </li> 1.37 cvs 40: <li><big><a href="#sect3">The S language</a></big> 1.30 cvs 41: <ul> 1.37 cvs 42: <li><strong><a href="#sectb31">Document meta-structure</a></strong> 1.30 cvs 43: <ul> 44: <li><a href="#sectc311">The basic types</a></li> 45: <li><a href="#sectc312">Constructed elements</a></li> 1.37 cvs 46: <li><a href="#sectc313">Logical structure constructors</a> 1.30 cvs 47: <ul> 48: <li><small><a href="#sectd3131">Aggregate and 49: List</a></small></li> 50: <li><small><a href="#sectd3132">Choice, Schema, and 51: Unit</a></small></li> 52: <li><small><a href="#sectd3133">Reference and 53: Inclusion</a></small></li> 54: <li><small><a href="#sectd3134">Mark pairs</a></small></li> 55: <li><small><a href="#sectd3135">Restrictions and 56: Extensions</a></small></li> 57: <li><small><a href="#sectd3136">Summary</a></small></li> 58: </ul> 59: </li> 60: <li><a href="#sectc315">Attributes</a></li> 61: <li><a href="#sectc316">Discussion of the model</a></li> 62: </ul> 63: </li> 64: <li><strong><a href="#sectb32">The definition language for generic 1.37 cvs 65: structures</a></strong> 1.30 cvs 66: <ul> 67: <li><a href="#sectc321">Writing Conventions</a></li> 68: <li><a href="#sectc322">Extension schemas</a></li> 69: <li><a href="#sectc323">The general organization of structure 70: schemas</a></li> 71: <li><a href="#sectc324">The default presentation</a></li> 72: <li><a href="#sectc325">Global Attributes</a></li> 73: <li><a href="#sectc327">Structured elements</a></li> 1.37 cvs 74: <li><a href="#sectc328">Structure definitions</a> 1.30 cvs 75: <ul> 76: <li><small><a href="#sectd3281">List</a></small></li> 77: <li><small><a href="#sectd3282">Aggregate</a></small></li> 78: <li><small><a href="#sectd3283">Choice</a></small></li> 79: <li><small><a href="#sectd3284">Reference</a></small></li> 80: <li><small><a href="#sectd3285">Mark pairs</a></small></li> 81: </ul> 82: </li> 83: <li><a href="#sectc329">Imports</a></li> 84: <li><a href="#sectc3210">Extension rules</a></li> 85: <li><a href="#sectc3212">Units</a></li> 86: <li><a href="#sectc3213">Skeleton elements</a></li> 87: <li><a href="#sectc3214">Exceptions</a></li> 88: </ul> 89: </li> 1.37 cvs 90: <li><strong><a href="#sectb33">Some examples</a></strong> 1.30 cvs 91: <ul> 92: <li><a href="#sectc331">A class of documents: articles</a></li> 93: <li><a href="#sectc332">A class of objects: mathematical 94: formulas</a></li> 95: </ul> 96: </li> 97: </ul> 98: </li> 1.37 cvs 99: <li><big><a href="#sect4">The P language</a></big> 1.30 cvs 100: <ul> 1.37 cvs 101: <li><strong><a href="#sectb41">Document presentation</a></strong> 1.30 cvs 102: <ul> 103: <li><a href="#sectc411">Two levels of presentation</a></li> 104: <li><a href="#sectc412">Boxes</a></li> 105: <li><a href="#sectc413">Views and visibility</a></li> 106: <li><a href="#sectc414">Pages</a></li> 107: <li><a href="#sectc415">Numbering</a></li> 1.34 cvs 108: <li><a href="#sectc416">Presentation properties</a></li> 1.30 cvs 109: </ul> 110: </li> 111: <li><strong><a href="#sectb42">Presentation description 1.37 cvs 112: language</a></strong> 1.30 cvs 113: <ul> 114: <li><a href="#sectc421">The organization of a presentation 115: schema</a></li> 116: <li><a href="#sectc422">Views</a></li> 117: <li><a href="#sectc423">Print Views</a></li> 118: <li><a href="#sectc424">Counters</a></li> 119: <li><a href="#sectc425">Presentation constants</a></li> 120: <li><a href="#sectc426">Variables</a></li> 121: <li><a href="#sectc427">Default presentation rules</a></li> 122: <li><a href="#sectc428">Presentation and page layout boxes</a></li> 123: <li><a href="#sectc429">Presentation of structured elements</a></li> 124: <li><a href="#sectc4210">Logical attribute presentation</a></li> 125: <li><a href="#sectc4212">Value transmission rules</a></li> 126: <li><a href="#sectc4213">Presentation rules</a></li> 127: <li><a href="#sectc4214">Conditions applying to presentation 1.37 cvs 128: rules</a> 1.30 cvs 129: <ul> 1.37 cvs 130: <li><small><a href="#sectd42141">Conditions based on the 131: logical position of the element</a></small></li> 1.30 cvs 132: <li><small><a href="#sectd42142">Conditions on 133: references</a></small></li> 134: <li><small><a href="#sectd42143">Conditions on logical 135: attributes</a></small></li> 136: <li><small><a href="#sectd42144">Conditions on page 137: breaks</a></small></li> 138: <li><small><a href="#sectd42145">Conditions on the element's 139: content</a></small></li> 140: <li><small><a href="#sectd42146">Conditions on 141: counters</a></small></li> 142: </ul> 143: </li> 144: <li><a href="#sectc4215">A presentation rule</a></li> 145: <li><a href="#sectc4216">Box axes</a></li> 146: <li><a href="#sectc4217">Distance units</a></li> 147: <li><a href="#sectc4218">Relative positions</a></li> 1.37 cvs 148: <li><a href="#sectc4219">Box extents</a> 1.30 cvs 149: <ul> 150: <li><small><a href="#sectd42191">Fixed extents</a></small></li> 151: <li><small><a href="#sectd42192">Relative 152: extents</a></small></li> 153: <li><small><a href="#sectd42193">Elastic 154: extents</a></small></li> 155: </ul> 156: </li> 157: <li><a href="#sectc4220">Overflow</a></li> 158: <li><a href="#sectc4221">Inheritance</a></li> 1.37 cvs 159: <li><a href="#sectc4222">Line breaking</a> 1.30 cvs 160: <ul> 161: <li><small><a href="#sectd42221">Line spacing</a></small></li> 162: <li><small><a href="#sectd42222">First line 163: indentation</a></small></li> 164: <li><small><a href="#sectd42223">Alignment</a></small></li> 165: <li><small><a href="#sectd42225">Hyphenation</a></small></li> 166: <li><small><a href="#sectd42226">Avoiding line 167: breaking</a></small></li> 168: </ul> 169: </li> 170: <li><a href="#sectc4223">Page breaking and line breaking 171: conditions</a></li> 172: <li><a href="#sectc4224">Visibility</a></li> 1.37 cvs 173: <li><a href="#sectc4225">Character style properties</a> 1.30 cvs 174: <ul> 175: <li><small><a href="#sectd42251">Character size</a></small></li> 176: <li><small><a href="#sectd42252">Font and character 177: style</a></small></li> 178: <li><small><a href="#sectd42253">Underlining</a></small></li> 179: </ul> 180: </li> 181: <li><a href="#sectc4226">Stacking order</a></li> 182: <li><a href="#sectc4227">Line style</a></li> 183: <li><a href="#sectc4228">Line thickness</a></li> 184: <li><a href="#sectc4229">Fill pattern</a></li> 185: <li><a href="#sectc4230">Colors</a></li> 186: <li><a href="#sectc4230a">Background color and border</a></li> 187: <li><a href="#sectc4230b">Background pictures</a></li> 188: <li><a href="#sectc4231">Presentation box content</a></li> 189: <li><a href="#sectc4232">Presentation box creation</a></li> 190: <li><a href="#sectc4233">Page layout</a></li> 191: <li><a href="#sectc4234">Box copies</a></li> 192: </ul> 193: </li> 194: </ul> 195: </li> 1.37 cvs 196: <li><big><a href="#sect5">The T language</a></big> 1.30 cvs 197: <ul> 1.37 cvs 198: <li><strong><a href="#sectb51">Document translation</a></strong> 1.30 cvs 199: <ul> 200: <li><a href="#sectc511">Translation principles</a></li> 201: <li><a href="#sectc512">Translation procedure</a></li> 202: </ul> 203: </li> 204: <li><strong><a href="#sectb52">Translation definition 1.37 cvs 205: language</a></strong> 1.30 cvs 206: <ul> 207: <li><a href="#sectc521">Organization of a translation 208: schema</a></li> 209: <li><a href="#sectc522">Line length</a></li> 210: <li><a href="#sectc523">Buffers</a></li> 211: <li><a href="#sectc524">Counters</a></li> 212: <li><a href="#sectc525">Constants</a></li> 213: <li><a href="#sectc526">Variables</a></li> 214: <li><a href="#sectc527">Translating structure elements</a></li> 1.37 cvs 215: <li><a href="#sectc528">Conditional rules</a> 1.30 cvs 216: <ul> 217: <li><small><a href="#sectd5281">Conditions based on the logical 218: position of the element</a></small></li> 219: <li><small><a href="#sectd5282">Conditions on 220: references</a></small></li> 221: <li><small><a href="#sectd5284">Conditions on the 222: alphabets</a></small></li> 223: <li><small><a href="#sectd5285">Conditions on page 224: breaks</a></small></li> 225: <li><small><a href="#sectd5286">Conditions on the element's 226: content</a></small></li> 227: <li><small><a href="#sectd5288">Conditions on the presence of 228: specific presentation rules</a></small></li> 229: <li><small><a href="#sectd5289">Conditions on the presence of 230: logical attributes</a></small></li> 231: <li><small><a href="#sectd52810">Conditions on logical 232: attributes</a></small></li> 233: <li><small><a href="#sectd52811">Conditions on specific 234: presentation rules</a></small></li> 235: </ul> 236: </li> 237: <li><a href="#sectc529">Translation rules</a></li> 238: <li><a href="#sectc5210">The <tt>Create</tt> rule</a></li> 239: <li><a href="#sectc5211">The <tt>Write</tt> rule</a></li> 240: <li><a href="#sectc5212">The <tt>Read</tt> rule</a></li> 241: <li><a href="#sectc5213">The <tt>Include</tt> rule</a></li> 242: <li><a href="#sectc5214">The <tt>Get</tt> rule</a></li> 243: <li><a href="#sectc5215">The <tt>Copy</tt> rule</a></li> 244: <li><a href="#sectc5216">The <tt>Use</tt> rule</a></li> 245: <li><a href="#sectc5217">The <tt>Remove</tt> rule</a></li> 1.31 cvs 246: <li><a href="#sectc5217a">The <code>Ignore</code> rule</a></li> 1.30 cvs 247: <li><a href="#sectc5218">The <tt>NoTranslation</tt> rule</a></li> 248: <li><a href="#sectc5219">The <tt>NoLineBreak</tt> rule</a></li> 249: <li><a href="#sectc5220">The <tt>ChangeMainFile</tt> rule</a></li> 250: <li><a href="#sectc5220a">The <tt>RemoveFile</tt> rule</a></li> 251: <li><a href="#sectc5221">The <tt>Set</tt> and <tt>Add</tt> 252: rules</a></li> 253: <li><a href="#sectc5221a">The <tt>Indent</tt> rule</a></li> 254: <li><a href="#sectc5222">Rule application order</a></li> 255: <li><a href="#sectc5223">Translation of logical attributes</a></li> 256: <li><a href="#sectc5224">Translation of specific 257: presentations</a></li> 258: <li><a href="#sectc5225">Recoding of characters, symbols and 259: graphics</a></li> 260: </ul> 261: </li> 262: </ul> 263: </li> 1.37 cvs 264: <li><big><a href="#sect6">Language grammars</a></big> 1.30 cvs 265: <ul> 266: <li><strong><a href="#sectb61">The M meta-language</a></strong></li> 267: <li><strong><a href="#sectb62">The S language</a></strong></li> 268: <li><strong><a href="#sectb63">The P language</a></strong></li> 269: <li><strong><a href="#sectb64">The T language</a></strong></li> 270: </ul> 271: </li> 1.37 cvs 272: <li><big><a href="#sect7">Character coding</a></big> 1.30 cvs 273: <ul> 274: <li><strong><a href="#sectb71">Characters</a></strong></li> 275: <li><strong><a href="#sectb72">Symbols</a></strong></li> 276: <li><strong><a href="#sectb73">Graphical elements</a></strong></li> 277: </ul> 278: </li> 1.18 cvs 279: </ul> 1.37 cvs 280: <hr /> 1.18 cvs 281: </div> 1.1 cvs 282: 1.18 cvs 283: <div class="chapter"> 1.37 cvs 284: <h1><a name="sect2" id="sect2">The document model of Thot</a></h1> 1.1 cvs 285: 1.30 cvs 286: <p>All of the services which Thot provides to the user are based on the 1.37 cvs 287: system's internal document representation. This representation is itself 288: derived from the document model which underlies Thot. The model is presented 1.30 cvs 289: here, prior to the description of the languages which permit the generic 290: specification of documents.</p> 1.1 cvs 291: 1.18 cvs 292: <div class="section"> 1.37 cvs 293: <h2><a name="sectb21" id="sectb21">The logical structure of documents</a></h2> 1.1 cvs 294: 1.30 cvs 295: <p>The document model of Thot is primarily designed to allow the user to 296: operate on those entities which s/he has in mind when s/he works on a 297: document. The model makes no assumptions about the nature of these entities. 298: It is essentially these logical entities, such as paragraphs, sections, 299: chapters, notes, titles, and cross-references which give a document its 300: logical structure.</p> 301: 302: <p>Because of this model, the author can divide the document into chapters, 1.37 cvs 303: giving each one a title. The content of these chapters can be further divided 304: into sections, subsections, etc. The text is organized into successive 1.2 cvs 305: paragraphs, according to the content. In the writing phase, the lines, pages, 1.37 cvs 306: margins, spacing, fonts, and character styles are not very important. In 307: fact, if the system requires documents to be written in these terms, it gets 308: in the way. So, Thot's model is primarily based on the logical aspect of 309: documents. The creation of a model of this type essentially requires the 310: definition :</p> 1.18 cvs 311: <ul> 1.30 cvs 312: <li>of the entities which can appear in the documents,</li> 313: <li>and the relations between these entities.</li> 1.18 cvs 314: </ul> 1.30 cvs 315: 1.37 cvs 316: <p>The choice of entities to include in the model can be subtle. Some 317: documents require chapters, while others only need various levels of 318: sections. Certain documents contain appendices, others don't. In different 319: documents the same logical entity may go by different names (e.g. 320: ``Conclusion'' and ``Summary''). Certain entities which are absolutely 321: necessary in some documents, such as clauses in a contract or the address of 322: the recipient in a letter, are useless in most other cases.</p> 1.30 cvs 323: 324: <p>The differences between documents result from more than just the entities 325: that appear in them, but also from the relationships between these entities 1.37 cvs 326: and the ways that they are linked. In certain documents, notes are spread 1.30 cvs 327: throughout the document, for example at the bottom of the page containing the 1.1 cvs 328: cross-reference to them, while in other documents they are collected at the 1.37 cvs 329: end of each chapter or even at the end of the work. As another example, the 1.1 cvs 330: introduction of some documents can contain many sections, while in other 331: documents, the introduction is restricted to be a short sequence of 1.18 cvs 332: paragraphs.</p> 1.30 cvs 333: 1.37 cvs 334: <p>All of this makes it unlikely that a single model can describe any 335: document at a relatively high level. It is obviously tempting to make up a 336: list of widely used entities, such as chapters, sections, paragraphs, and 337: titles, and then map all other entities onto the available choices. In this 338: way, an introduction can be supported as a chapter and a contract clause 339: supported as a paragraph or section. However, in trying to widen the range of 340: usage of certain entities, their meaning can be lost and the power of the 341: model reduced. In addition, while this widening partially solves the problem 342: of choosing entities, it does not solve the problem of their organization: 343: when a chapter must be composed of sections, how does one indicate that an 344: introduction has none when it is merely another chapter? One solution is to 1.1 cvs 345: include introductions in the list of supported entities. But then, how does 346: one distinguish those introductions which are allowed to have sections from 1.37 cvs 347: those which are not. Perhaps this could be done by defining two types of 1.1 cvs 348: introduction. Clearly, this approach risks an infinite expansion of the list 1.18 cvs 349: of widely used entities.</p> 350: </div> 1.1 cvs 351: 1.18 cvs 352: <div class="section"> 1.37 cvs 353: <h2><a name="sectb22" id="sectb22">Generic and specific structures</a></h2> 1.1 cvs 354: 1.30 cvs 355: <p>Thus, it is apparently impossible to construct an exhaustive inventory of 356: all those entities which are necessary and sufficient to precisely describe 1.37 cvs 357: any document. It also seems impossible to specify all possible arrangements 358: of these entities in a document. This is why Thot uses a <em>meta-model</em> 1.18 cvs 359: instead, which permits the description of numerous <em>models</em>, each one 360: describing a <em>class</em> of documents.</p> 1.30 cvs 361: 1.37 cvs 362: <p>A <em>class</em> is a set of documents having very similar structure. 363: Thus, the collection of research reports published by a laboratory 364: constitutes a class; the set of commercial proposals by the sales department 365: of a company constitutes another class; the set of articles published by a 366: journal constitutes a third class. Clearly, it is not possible to enumerate 367: every possible document class. It is also clear that new document classes 368: must be created to satisfy new needs and applications.</p> 1.30 cvs 369: 370: <p>To give a more rigorous definition of classes, we must introduce the ideas 1.37 cvs 371: of <em>generic structure</em> and <em>specific structure</em>. Each document 1.30 cvs 372: has a <em>specific structure</em> which organizes the various parts which 1.37 cvs 373: comprise it. We illustrate this with the help of a simple example comparing 1.30 cvs 374: two reports, A and B (<a href="#specstruct">see Figure</a>). The report A 1.37 cvs 375: contains an introduction followed by three chapters and a conclusion. The 376: first chapter contains two sections, the second, three sections. That is the 1.18 cvs 377: <em>specific</em> structure of document A. Similarly, the structure of 1.1 cvs 378: document B is: an introduction, two chapters, a conclusion; Chapter 1 has 1.37 cvs 379: three sections while Chapter 2 has four. The specific structures of these two 1.18 cvs 380: documents are thus different.</p> 1.1 cvs 381: 1.18 cvs 382: <div class="figure"> 1.37 cvs 383: <hr /> 1.18 cvs 384: <pre> Report A Report B 1.1 cvs 385: Introduction Introduction 386: Chapter 1 Chapter 1 387: Section 1.1 Section 1.1 388: Section 1.2 Section 1.2 389: Chapter 2 Section 1.3 390: Section 2.1 Chapter 2 391: Section 2.2 Section 2.1 392: Section 2.3 Section 2.2 393: Chapter 3 Section 2.3 394: Conclusion Section 2.4 1.18 cvs 395: Conclusion</pre> 1.30 cvs 396: 1.37 cvs 397: <p align="center"><em><a name="specstruct" id="specstruct">Two specific 1.30 cvs 398: structures</a></em></p> 1.37 cvs 399: <hr /> 1.30 cvs 400: </div> 401: 402: <p>The <em>generic structure</em> defines the ways in which specific 1.37 cvs 403: structures can be constructed. It specifies how to generate specific 404: structures. The reports A and B, though different, are constructed in 1.30 cvs 405: accordance with the same generic structure, which specifies that a report 406: contains an introduction followed by a variable number of chapters and a 407: conclusion, with each chapter containing a variable number of sections.</p> 408: 409: <p>There is a one-to-one correspondence between a class and a generic 1.37 cvs 410: structure: all the documents of a class are constructed in accordance with 411: the same generic structure. Hence the definition of the class: a class is a 412: set of documents whose specific structure is constructed in accordance with 413: the same generic structure. A class is characterized by its generic 1.30 cvs 414: structure.</p> 1.19 cvs 415: 1.30 cvs 416: <p>Thus, a generic structure can be considered to be a model at the level 1.37 cvs 417: which interests us, but only for one class of documents. When the definition 1.30 cvs 418: is limited to a single class of documents, it is possible to define a model 419: which does a good job of representing the documents of the class, including 1.37 cvs 420: the necessary entities and unencumbered by useless entities. The description 1.30 cvs 421: of the organization of the documents in the class can then be sufficiently 1.18 cvs 422: precise.</p> 423: </div> 1.1 cvs 424: 1.18 cvs 425: <div class="section"> 1.37 cvs 426: <h2><a name="sectb23" id="sectb23">Logical structure and physical 427: structure</a></h2> 1.1 cvs 428: 1.30 cvs 429: <p>Generic structures only describe the <em>logical</em> organization of 1.18 cvs 430: documents, not their <em>physical</em> presentation on a screen or on sheets 1.37 cvs 431: of paper. However, for a document to be displayed or printed, its graphic 1.18 cvs 432: presentation must be taken into account.</p> 1.30 cvs 433: 434: <p>An examination of current printed documents shows that the details of 1.1 cvs 435: presentation essentially serve to bring out their logical structure. Outside 436: of some particular domains, notably advertising, the presentation is rarely 1.37 cvs 437: independent of the logical organization of the text. Moreover, the art of 1.1 cvs 438: typography consists of enhancing the organization of the text being set, 1.37 cvs 439: without catching the eye of the reader with overly pronounced effects. Thus, 440: italic and boldface type are used to emphasize words or expressions which 441: have greater significance than the rest of the text: keywords, new ideas, 442: citations, book titles, etc. Other effects highlight the organization of the 1.1 cvs 443: text: vertical space, margin changes, page breaks, centering, eventually 444: combined with the changes in the shapes or weight of the characters. These 445: effects serve to indicate the transitions between paragraphs, sections, or 446: chapters: an object's level in the logical structure of the document is shown 1.18 cvs 447: by the markedness of the effects.</p> 1.30 cvs 448: 449: <p>Since the model permits the description of all of the logical structure of 450: the document, the presentation can be derived from the model without being 1.37 cvs 451: submerged in the document itself. It suffices to use the logical structure of 1.1 cvs 452: the document to make the desired changes in its presentation: changes in type 1.18 cvs 453: size, type style, spacing, margin, centering, etc.</p> 1.30 cvs 454: 455: <p>Just as one cannot define a unique generic logical structure for all 456: document classes, one cannot define universal presentation rules which can be 1.37 cvs 457: applied to all document classes. For certain types of documents the chapter 458: titles will be centered on the page and printed in large, bold type. For 459: other documents, the same chapter titles will be printed in small, italic 460: type and aligned on the left margin.</p> 1.30 cvs 461: 462: <p>Therefore, it is necessary to base the presentation specifications for 1.37 cvs 463: documents on their class. Such a specification can be very fine-grained, 1.1 cvs 464: because the presentation is expressed in terms of the entities defined in the 1.37 cvs 465: generic logical structure of the class. Thus, it is possible to specify a 1.1 cvs 466: different presentation for the chapter titles and the section titles, and 467: similarly to specify titles for the sections according to their level in the 1.37 cvs 468: section hierarchy. The set of rules which specify the presentation of all the 1.18 cvs 469: elements defined in a generic logical structure is called a <em>generic 470: presentation</em>.</p> 1.30 cvs 471: 472: <p>There are several advantages derived from having a presentation linked to 473: the generic structure and described by a generic presentation. Homogeneity is 1.37 cvs 474: the first. Since every document in a class corresponds to the same generic 1.1 cvs 475: logical structure, a homogenous presentation for different documents of the 476: same class can be assured by applying the same generic presentation to all 1.37 cvs 477: documents of the class. Homogeneity of presentation can also be found among 478: the entities of a single document: every section heading will be presented in 479: the same way, the first line of every paragraph of the same type will have 480: the same indentation, etc.</p> 1.30 cvs 481: 482: <p>Another advantage of this approach to presentation is that it facilitates 1.37 cvs 483: changes to the graphical aspect of documents. A change to the generic 484: presentation rules attached to each type of entity will alter the 485: presentation of the entire document, and will do so homogenously. In this 486: case, the internal homogeneity of the class is no longer assured, but the way 487: to control it is simple. It suffices to adopt a single generic presentation 488: for the entire class.</p> 1.30 cvs 489: 490: <p>If the presentation of the class does not have to be homogenous, then the 1.37 cvs 491: appearance of the document can be adapted to the way it will be used or to 492: the device used to render it. This quality is sufficient to allow the 493: existence of <a name="mulpres" id="mulpres">many generic presentations</a> 494: for the same document class. By applying one or the other of these 495: presentations to it, the document can be seen under different graphical 496: aspects. It must be emphasized that this type of modification of the 497: presentation is not a change to the document itself (in its specific logical 498: structure or its content), but only in its appearance at the time of editing 499: or printing.</p> 1.18 cvs 500: </div> 1.1 cvs 501: 1.18 cvs 502: <div class="section"> 1.37 cvs 503: <h2><a name="sectb24" id="sectb24">Document structures and object 504: structures</a></h2> 1.1 cvs 505: 1.30 cvs 506: <p>So far, we have only discussed the global structure of documents and have 1.37 cvs 507: not considered the contents found in that structure. We could limit ourselves 1.30 cvs 508: to purely textual contents by assuming that a title or a paragraph contains a 1.37 cvs 509: simple linear text. But this model would be too restrictive. In fact, certain 510: documents contain not only text, but also contain tables, diagrams, 511: photographs, mathematical formulas, and program fragments. The model must 1.18 cvs 512: permit the representation of such <em>objects</em>.</p> 1.30 cvs 513: 514: <p>Just as with the whole of the document, the model takes into account the 1.37 cvs 515: logical structure of objects of this type. Some are clearly structured, 516: others are less so. Logical structure can be recognized in mathematical 517: formulas, in tables, and in certain types of diagrams. On the other hand, it 518: is difficult to define the structure of a photograph or of some drawings. But 1.1 cvs 519: in any case, it does not seem possible to define one unique structure which 1.37 cvs 520: can represent every one of these types of objects. The approach taken in the 1.1 cvs 521: definition of meta-structure and document classes also applies to objects. 522: Object classes can be defined which put together objects of similar type, 1.18 cvs 523: constructed from the same generic logical structure.</p> 1.30 cvs 524: 525: <p>Thus, a mathematical class can be defined and have a generic logical 1.37 cvs 526: structure associated with it. But even if a single generic structure can 1.30 cvs 527: represent a sufficient variety of mathematical formulas, for other objects 1.37 cvs 528: with less rigorous structure, multiple classes must be defined. As for 529: documents, using multiple classes assures that the model can describe the 530: full range of objects to be presented. It also permits the system to support 531: objects which were not initially anticipated. Moreover, this comment applies 1.30 cvs 532: equally to mathematics: different classes of formulas can be described 533: depending on the domain of mathematics being described.</p> 534: 535: <p>Since objects have the same level of logical representation as documents, 1.37 cvs 536: they gain the same advantages. In particular, it is possible to define the 1.1 cvs 537: presentation separately from the objects themselves and attach it to the 1.37 cvs 538: class. Thus, as for documents, objects of the same type have a uniform 1.1 cvs 539: presentation and the presentation of every object in a given class can be 1.37 cvs 540: changed simply by changing the generic presentation of the class. Another 1.1 cvs 541: advantage of using this document model is that the system does not bother the 542: user with the details of presentation, but rather allows the user to 1.18 cvs 543: concentrate on the logical aspect of the document and the objects.</p> 1.30 cvs 544: 545: <p>It is clear that the documents in a class do not necessarily use the same 1.1 cvs 546: classes of objects: one technical report will contain tables while another 547: report will have no tables but will use mathematical formulas. The usable 1.2 cvs 548: object classes are not always mentioned in a limiting way in the generic 1.37 cvs 549: logical structure of documents. Rather, they can be chosen freely from a 1.18 cvs 550: large set, independent of the document class.</p> 1.30 cvs 551: 552: <p>Thus, the object classes will be made commonplace and usable in every 1.1 cvs 553: document. The notion of ``object'' can be enlarged to include not only 554: non-textual elements, but also certain types of textual elements which can 1.37 cvs 555: appear in practically every document, whatever their class. Among these 1.2 cvs 556: textual elements, one can mention enumerations, descriptions, examples, 1.18 cvs 557: quotations, even paragraphs.</p> 1.30 cvs 558: 559: <p>Thus, the document model is not a single, general model describing every 1.37 cvs 560: type of document in one place. Rather, it is a meta-model which can be used 1.30 cvs 561: to describe many different models each of which represents either a class of 1.1 cvs 562: similar documents or a class of similar objects which every document can 1.18 cvs 563: include.</p> 564: </div> 1.37 cvs 565: <hr /> 1.18 cvs 566: </div> 1.1 cvs 567: 1.18 cvs 568: <div class="chapter"> 1.37 cvs 569: <h1><a name="sect3" id="sect3">The S language</a></h1> 1.1 cvs 570: 1.18 cvs 571: <div class="section"> 1.37 cvs 572: <h2><a name="sectb31" id="sectb31">Document meta-structure</a></h2> 1.1 cvs 573: 1.30 cvs 574: <p>Since the concept of meta-structure is well suited to the task of 575: describing documents at a high level of abstraction, this meta-structure must 1.37 cvs 576: be precisely defined. Toward that end this section first presents the basic 1.1 cvs 577: elements from which documents and structured objects are composed and then 1.37 cvs 578: specifies the ways in which these basic elements are assembled into 579: structures representing complete documents and objects.</p> 1.1 cvs 580: 1.18 cvs 581: <div class="subsection"> 1.37 cvs 582: <h3><a name="sectc311" id="sectc311">The basic types</a></h3> 1.1 cvs 583: 1.37 cvs 584: <p>At the lowest level of a document's structure, the first atom considered 585: is the character. However, since characters are seldom isolated, usually 1.1 cvs 586: appearing as part of a linear sequence, and in order to reduce the complexity 1.18 cvs 587: of the document structure, <em>character strings</em> are used as atoms and 1.37 cvs 588: consecutive characters belonging to the same structural element are grouped 589: in the same character string.</p> 1.30 cvs 590: 1.37 cvs 591: <p>If the structure of a document is not refined to go down to the level of 592: words or phrases, the contents of a simple paragraph can be considered to be 593: a single character string. On the other hand, the title of a chapter, the 594: title of the first section of that chapter, and the text of the first 595: paragraph of that section constitute three different character strings, 596: because they belong to distinct structural elements.</p> 1.30 cvs 597: 598: <p>If, instead, a very fine-grained representation for the structure of a 1.1 cvs 599: document is sought, character strings could be defined to contain only a 1.37 cvs 600: single word, or even just a single character. This is the case, for example, 601: in programs, for which one wants to retain a structure very close to the 602: syntax of the programming language. In this case, an assignment statement 1.1 cvs 603: initializing a simple variable to zero would be composed of two structural 604: elements, the identifier of the variable (a short character string) and the 1.18 cvs 605: assigned value (a string of a single character, `0').</p> 1.30 cvs 606: 607: <p>The character string is not the only atom necessary for representing those 1.37 cvs 608: documents that interest us. It suffices for purely textual documents, but as 1.1 cvs 609: soon as the non-textual objects which we have considered arise, there must be 610: other atoms; the number of objects which are to be represented determines the 1.18 cvs 611: number of types of atoms that are necessary.</p> 1.30 cvs 612: 613: <p>Primitive <em>graphical elements</em> are used for tables and figures of 1.37 cvs 614: different types. These elements are simple geometric shapes like horizontal 1.1 cvs 615: or vertical lines, which are sufficient for tables, or even oblique lines, 1.2 cvs 616: arrows, rectangles, circles, polygons, and curves for use in figures. From 617: these elements and character strings, graphical objects and tables can be 1.18 cvs 618: constructed.</p> 1.30 cvs 619: 620: <p>Photographs, though having very little structure, must still appear in 1.37 cvs 621: documents. They are supported by <em>picture</em> elements, which are 1.18 cvs 622: represented as matrices of pixels.</p> 1.30 cvs 623: 624: <p>Finally, mathematical notations require certain elements which are 1.37 cvs 625: simultaneously characters and graphical elements, the <em>symbols</em>. By 626: way of example, radicals, integration signs, or even large parentheses are 627: examples of this type of atom. The size of each of these symbols is 1.1 cvs 628: determined by its environment, that is to say, by the expression to which it 1.18 cvs 629: is attached.</p> 1.30 cvs 630: 631: <p>To summarize, the primitive elements which are used in the construction of 1.18 cvs 632: documents and structured objects are:</p> 633: <ul> 1.30 cvs 634: <li>character strings,</li> 635: <li>graphical elements,</li> 636: <li>pictures,</li> 637: <li>and mathematical symbols.</li> 1.18 cvs 638: </ul> 639: </div> 1.1 cvs 640: 1.18 cvs 641: <div class="subsection"> 1.37 cvs 642: <h3><a name="sectc312" id="sectc312">Constructed elements</a></h3> 1.30 cvs 643: 1.37 cvs 644: <p>A document is evidently formed from primitive elements. But the model of 645: Thot also proposes higher level elements. Thus, in a document composed of 646: several chapters, each chapter is an element, and in the chapters each 647: section is also an element, and so on. A document is thus an organized set of 1.30 cvs 648: elements.</p> 1.1 cvs 649: 1.37 cvs 650: <p>In a document there are different sorts of elements. Each element has a 651: <em>type</em> which indicates the role of the element within the document as 652: a whole. Thus, we have, for example, the chapter and section types. The 1.1 cvs 653: document is made up of typed elements: elements of the type chapter and 1.37 cvs 654: elements of the type section, among others, but also character string 655: elements and graphical elements: the primitive elements are typed elements 656: just as well. At the other extreme, the document itself is also considered to 657: be a typed element.</p> 1.30 cvs 658: 659: <p>The important difference between the primitive elements and the other 1.37 cvs 660: elements of the document is that the primitive elements are atoms (they 661: cannot be decomposed), whereas the others, called <em>constructed 662: elements</em>, are composed of other elements, which can either be primitive 663: elements or constructed elements. A constructed element of type chapter (or 664: more simply, ``a chapter'') is composed of sections, which are also 665: constructed elements. A paragraph, a constructed element, can be made up of 666: character strings, which are primitive elements, and of equations, which are 667: constructed elements.</p> 1.30 cvs 668: 1.37 cvs 669: <p>A document is also a constructed element. This is an important point. In 1.1 cvs 670: particular, it allows a document to be treated as part of another document, 671: and conversely, permits a part of a document to be treated as a complete 1.37 cvs 672: document. Thus, an article presented in a journal is treated by its author as 1.1 cvs 673: a document in itself, while the editor of the journal considers it to be part 1.37 cvs 674: of an issue. A table or a figure appearing in a document can be extracted and 1.1 cvs 675: treated as a complete document, for example to prepare transparencies for a 1.18 cvs 676: conference.</p> 1.30 cvs 677: 678: <p>These thoughts about types and constructed elements apply just as well to 1.37 cvs 679: objects as they do to documents. A table is a constructed element made up of 680: other constructed elements, rows and columns. A row is formed of cells, which 1.1 cvs 681: are also constructed elements which contain primitive elements (character 1.18 cvs 682: strings) and/or constructed elements like equations.</p> 683: </div> 1.1 cvs 684: 1.18 cvs 685: <div class="subsection"> 1.37 cvs 686: <h3><a name="sectc313" id="sectc313">Logical structure constructors</a></h3> 1.1 cvs 687: 1.30 cvs 688: <p>Having defined the primitive elements and the constructed elements, it is 689: now time to define the types of organization which allow the building of 1.37 cvs 690: structures. For this, we rely on the notion of the <em>constructor</em>. A 691: constructor defines a way of assembling certain elements in a structure. It 1.1 cvs 692: resides at the level of the meta-structure: it does not describe the existing 1.37 cvs 693: relations in a given structure, but rather defines how elements are assembled 1.18 cvs 694: to build a structure that conforms to a model.</p> 1.30 cvs 695: 696: <p>In defining the overall organization of documents, the first two 697: constructors considered are the aggregate and the list.</p> 1.1 cvs 698: 1.18 cvs 699: <div class="subsubsection"> 1.37 cvs 700: <h4><a name="sectd3131" id="sectd3131">Aggregate and List</a></h4> 1.1 cvs 701: 1.30 cvs 702: <p>The <em>aggregate</em> constructor is used to define constructed element 703: types which are collections of a given number of other elements. These 1.37 cvs 704: collections may or may not be ordered. The elements may be either constructed 705: or primitive and are specified by their type. A report (that is, a 706: constructed element of the report type) has an aggregate structure. It is 1.30 cvs 707: formed from a title, an author's name, an introduction, a body, and a 1.37 cvs 708: conclusion, making it a collection of five element types. This type of 1.30 cvs 709: constructor is found in practically every document, and generally at several 710: levels in a document.</p> 711: 712: <p>The <em>list</em> constructor is used to define constructed elements which 713: are ordered sequences of elements (constructed or primitive) having the same 714: type. The minimum and maximum numbers of elements for the sequence can be 715: specified in the list constructor or the number of elements can be left 716: unconstrained. The body of a report is a list of chapters and is typically 717: required to contain a minimum of two chapters (is a chapter useful if it is 718: the only one in the report?) The chapter itself can contain a list of 1.37 cvs 719: sections, each section containing a list of paragraphs. In the same way as 720: the aggregate, the list is a very frequently used constructor in every type 721: of document. However, these two constructors are not sufficient to describe 722: every document structure; thus other constructors supplement them.</p> 1.18 cvs 723: </div> 1.1 cvs 724: 1.18 cvs 725: <div class="subsubsection"> 1.37 cvs 726: <h4><a name="sectd3132" id="sectd3132">Choice, Schema, and Unit</a></h4> 1.1 cvs 727: 1.30 cvs 728: <p>The <em>choice</em> constructor is used to define the structure of an 729: element type for which one alternative is chosen from several possibilities. 1.37 cvs 730: Thus, a paragraph can be either a simple text paragraph, or an enumeration, 731: or a citation.</p> 1.30 cvs 732: 733: <p>The choice constructor indicates the complete list of possible options, 734: which can be too restrictive in certain cases, the paragraph being one such 735: case. Two constructors, <em>unit</em> and <em>schema</em>, address this 1.37 cvs 736: inconvenience. They allow more freedom in the choice of an element type. If a 737: paragraph is defined by a schema constructor, it is possible to put in the 1.1 cvs 738: place of a paragraph a table, an equation, a drawing or any other object 1.37 cvs 739: defined by another generic logical structure. It is also possible to define a 1.1 cvs 740: paragraph as a sequence of units, which could be character strings, symbols, 1.37 cvs 741: or pictures. The choice constructor alone defines a generic logical structure 1.1 cvs 742: that is relatively constrained; in contrast, using units and schemas, a very 1.18 cvs 743: open structure can be defined.</p> 1.30 cvs 744: 745: <p>The <em>schema</em> constructor represents an object defined by a generic 1.18 cvs 746: logical structure chosen freely from among those available.</p> 1.30 cvs 747: 748: <p>The <em>unit</em> constructor represents an element whose type can be 749: either a primitive type or an element type defined as a unit in the generic 750: logical structure of the document, or in another generic logical structure 1.37 cvs 751: used in the document. Such an element may be used in document objects 1.30 cvs 752: constructed according to other generic structures.</p> 753: 754: <p>Thus, for example, if a cross-reference to a footnote is defined in the 1.37 cvs 755: generic logical structure ``Article'' as a unit, a table (an object defined 756: by another generic structure) can contain cross-references to footnotes, when 757: they appear in an article. In another type of document, a table defined by 1.1 cvs 758: the same generic structure can contain other types of elements, depending on 1.37 cvs 759: the type of document into which the table is inserted. All that is needed is 1.1 cvs 760: to declare, in the generic structure for tables, that the contents of cells 1.37 cvs 761: are units. In this way, the generic structure of objects is divided up 762: between different types of documents which are able to adapt themselves to 763: the environment into which they are inserted.</p> 1.18 cvs 764: </div> 1.1 cvs 765: 1.18 cvs 766: <div class="subsubsection"> 1.37 cvs 767: <h4><a name="sectd3133" id="sectd3133">Reference and Inclusion</a></h4> 1.1 cvs 768: 1.30 cvs 769: <p>The <em>reference</em> is used to define document elements that are 1.18 cvs 770: cross-references to other elements, such as a section, a chapter, a 1.37 cvs 771: bibliographic citation, or a figure. The reference is bi-directional. It can 1.18 cvs 772: be used to access both the element being cross-referenced and each of the 773: elements which make use of the cross-reference.</p> 1.30 cvs 774: 1.37 cvs 775: <p>References can be either <em>internal</em> or <em>external</em>. That is, 1.1 cvs 776: they can designate elements which appear in the same document or in another 1.18 cvs 777: document.</p> 1.30 cvs 778: 1.37 cvs 779: <p>The <em><a name="inclusion" id="inclusion">inclusion</a></em> constructor 780: is a special type of reference. Like the reference, it is an internal or 781: external bidirectional link, but it is not a cross-reference. This link 782: represents the ``live'' inclusion of the designated element; it accesses the 783: most recent version of that element and not a ``dead'' copy, fixed in the 784: state in which it was found at the moment the copy was made. As soon as an 785: element is modified, all of its inclusions are automatically brought up to 786: date. It must be noted that, in addition to inclusion, Thot permits the 787: creation of ``dead'' copies.</p> 1.30 cvs 788: 789: <p>There are three types of inclusions: inclusions with full expansion, 1.1 cvs 790: inclusions with partial expansion, and inclusions without expansion. During 791: editing, inclusions without expansion are represented on the screen by the 792: name of the included document, in a special color, while inclusions with 1.37 cvs 793: expansion (full or partial) are represented by a copy (full or partial) of 794: the included element (also in a special color). The on-screen representation 795: of a partial inclusion is a <a href="#sectc3213">``skeleton''</a> image of 796: the included document.</p> 1.30 cvs 797: 798: <p>Inclusion with complete expansion can be used to include parts of the same 1.37 cvs 799: document or of other documents. Thus, it can be either an internal or an 800: external link. It can be used to include certain bibliographic entries of a 1.1 cvs 801: scientific article in another article, or to copy part of a mathematical 802: formula into another formula of the same document, thus assuring that both 1.18 cvs 803: copies will remain synchronized.</p> 1.30 cvs 804: 805: <p>Inclusion without expansion or with partial expansion is used to include 1.37 cvs 806: complete documents. It is always an external link. It is used primarily to 1.1 cvs 807: divide very large documents into sub-documents that are easier to manipulate, 1.37 cvs 808: especially when there are many authors. So, a book can include some chapters, 1.1 cvs 809: where each chapter is a different document which can be edited separately. 810: When viewing the book on the screen, it might be desirable to see only the 1.37 cvs 811: titles of the chapters and sections. This can be achieved using inclusion 1.18 cvs 812: with partial expansion.</p> 1.30 cvs 813: 1.37 cvs 814: <p>During printing, inclusions without expansion or with partial expansion 815: can be represented either as they were shown on the screen or by a complete 816: (and up-to-date) copy of the included element or document.</p> 1.30 cvs 817: 818: <p>The inclusion constructor, whatever its type, respects the generic 819: structure: only those elements authorized by the generic structure can be 820: included at a given position in a document.</p> 1.18 cvs 821: </div> 1.1 cvs 822: 1.18 cvs 823: <div class="subsubsection"> 1.37 cvs 824: <h4><a name="sectd3134" id="sectd3134">Mark pairs</a></h4> 1.1 cvs 825: 1.30 cvs 826: <p>It is often useful to delimit certain parts of a document independently 1.37 cvs 827: from the logical structure. For example, one might wish to attach some 1.30 cvs 828: information (in the form of an <a href="#sectc315">attribute</a>) or a 829: particular treatment to a group of words or a set of consecutive paragraphs. 830: <em>Mark pairs</em> are used to do this.</p> 831: 832: <p>Mark pairs are elements which are always paired and are terminals in the 1.37 cvs 833: logical structure of the document. Their position in the structure of the 834: document is defined in the generic structure. It is important to note that 1.18 cvs 835: when the terminals of a mark pair are <em>extensions</em> (see the next 836: section), they can be used quite freely.</p> 837: </div> 1.1 cvs 838: 1.18 cvs 839: <div class="subsubsection"> 1.37 cvs 840: <h4><a name="sectd3135" id="sectd3135">Restrictions and Extensions</a></h4> 1.1 cvs 841: 1.30 cvs 842: <p>The primitive types and the constructors presented so far permit the 1.1 cvs 843: definition of the logical structure of documents and objects in a rigorous 1.37 cvs 844: way. But this definition can be very cumbersome in certain cases, notably 1.1 cvs 845: when trying to constrain or extend the authorized element types in a 1.37 cvs 846: particular context. <em>Restrictions</em> and <em>extensions</em> are used to 1.18 cvs 847: cope with these cases.</p> 1.30 cvs 848: 849: <p>A restriction associates with a particular element type <em>A</em>, a list 1.37 cvs 850: of those element types which elements of type <em>A</em> may not contain, 851: even if the definition of type <em>A</em> and those of its components 852: authorize them otherwise. This simplifies the writing of generic logical 853: structures and allows limitations to be placed, when necessary, on the 854: choices offered by the schema and unit constructors.</p> 855: 856: <p>Extensions are the inverse of restrictions. They identify a list of 857: element types whose presence <em>is</em> permitted, even if its definition 858: and those of its components do not authorize them otherwise.</p> 1.18 cvs 859: </div> 860: 861: <div class="subsubsection"> 1.37 cvs 862: <h4><a name="sectd3136" id="sectd3136">Summary</a></h4> 1.18 cvs 863: 1.30 cvs 864: <p>Thus, four constructors are used to construct a document:</p> 1.18 cvs 865: <ul> 1.30 cvs 866: <li>the aggregate constructor (ordered or not),</li> 867: <li>the list constructor,</li> 868: <li>the choice constructor and its extensions, the unit and schema 869: constructors,</li> 870: <li>the reference constructor and its variant, the inclusion.</li> 871: </ul> 872: 1.37 cvs 873: <p>These constructors are also sufficient for objects. Thus, these 1.30 cvs 874: constructors provide a homogenous meta-model which can describe both the 875: organization of the document as a whole and that of the various types of 1.37 cvs 876: objects which it contains. After presenting the description language for 1.30 cvs 877: generic structures, we will present several examples which illustrate the 878: appropriateness of the model.</p> 879: 1.37 cvs 880: <p>The first three constructors (aggregate, list and choice) lead to 881: tree-like structures for documents and objects, the objects being simply the 882: subtrees of the tree of a document (or even of other objects' subtrees). The 883: reference constructor introduces other, non-hierarchical, relations which 884: augment those of the tree: when a paragraph makes reference to a chapter or a 885: section, that relation leaves the purely tree-like structure. Moreover, 886: external reference and inclusion constructors permit the establishment of 887: links between different documents, thus creating a hypertext structure.</p> 1.18 cvs 888: </div> 889: </div> 1.1 cvs 890: 1.18 cvs 891: <div class="subsection"> 1.37 cvs 892: <h3><a name="sectc315" id="sectc315">Attributes</a></h3> 1.1 cvs 893: 1.30 cvs 894: <p>There remain logical aspects of documents that are not entirely described 1.37 cvs 895: by the structure. Certain types of semantic information, which are not stated 896: explicitly in the text, must also be taken into account. In particular, such 1.1 cvs 897: information is shown by typographic effects which do not correspond to a 1.37 cvs 898: change between structural elements. In fact, certain titles are set in bold 1.1 cvs 899: or italic or are printed in a different typeface from the rest of the text in 1.37 cvs 900: order to mark them as structurally distinct. But these same effects 1.1 cvs 901: frequently appear in the middle of continuous text (e.g. in the interior of a 1.37 cvs 902: paragraph). In this case, there is no change between structural elements; the 903: effect serves to highlight a word, expression, or phrase. The notion of an 1.18 cvs 904: <em>attribute</em> is used to express this type of information.</p> 1.30 cvs 905: 906: <p>An attribute is a piece of information attached to a structural element 907: which augments the type of the element and clarifies its function in the 908: document. Keywords, foreign language words, and titles of other works can all 1.37 cvs 909: be represented by character strings with attached attributes. Attributes may 910: also be attached to constructed elements. Thus, an attribute indicating the 1.1 cvs 911: language can be attached to a single word or to a large part of a 1.18 cvs 912: document.</p> 1.30 cvs 913: 914: <p>In fact, an attribute can be any piece of information which is linked to a 1.37 cvs 915: part of a document and which can be used by agents which work on the 916: document. For example, the language in which the document is written 917: determines the set of characters used by an editor or formatter. It also 918: determines the algorithm or hyphenation dictionary to be used. The attribute 919: ``keyword'' facilitates the work of an information retrieval system. The 920: attribute ``index word'' allows a formatter to automatically construct an 921: index at the end of the document.</p> 1.30 cvs 922: 923: <p>As with the types of constructed elements, the attributes and the values 1.37 cvs 924: they can take are defined separately in each generic logical structure, not 925: in the meta-model, according to the needs of the document class or the nature 926: of the object.</p> 1.30 cvs 927: 928: <p>Many types of attributes are offered: numeric, textual, references, and 1.18 cvs 929: enumerations:</p> 930: <ul> 1.37 cvs 931: <li><em>Numeric attributes</em> can take integer values (negative, 932: positive, or null).</li> 1.30 cvs 933: <li><em>Textual attributes</em> have as their values character strings.</li> 934: <li><em>Reference attributes</em> designate an element of the logical 935: structure.</li> 936: <li><em>Enumeration attributes</em> can take one value from a limited list 937: of possible values, each value being a name.</li> 1.18 cvs 938: </ul> 1.30 cvs 939: 940: <p>In a generic structure, there is a distinction between <em>global 1.37 cvs 941: attributes</em> and <em>local attributes</em>. A global attribute can be 1.1 cvs 942: applied to every element type defined in the generic structure where it is 1.37 cvs 943: specified. In contrast, a local attribute can only be applied to certain 944: types of elements, even only a single type. The ``language'' attribute 945: presented above is an example of a global attribute. An example of a local 1.1 cvs 946: attribute is the rank of an author (principal author of the document or 947: secondary author): this attribute can only be applied sensibly to an element 1.18 cvs 948: of the ``author'' type.</p> 1.30 cvs 949: 950: <p>Attributes can be assigned to the elements which make up the document in 1.37 cvs 951: many different ways. The author can freely and dynamically place them on any 1.30 cvs 952: part of the document in order to attach supplementary information of his/her 1.18 cvs 953: choice. However, attributes may only be assigned in accordance with the rules 1.37 cvs 954: of the generic structure; in particular, local attributes can only be 955: assigned to those element types for which they are defined.</p> 1.30 cvs 956: 957: <p>In the generic structure, certain local attributes can be made mandatory 1.37 cvs 958: for certain element types. In this case, Thot automatically associates the 959: attribute with the elements of this type and it requires the user to provide 960: a value for this attribute.</p> 961: 962: <p>Attributes can also be automatically assigned, with a given value, by 963: every application processing the document in order to systematically add a 964: piece of information to certain predefined elements of the document. By way 965: of example, in a report containing a French abstract and an English abstract, 966: each of the two abstracts is defined as a sequence of paragraphs. The first 1.1 cvs 967: abstract has a value of ``French'' for the ``language'' attribute while the 1.18 cvs 968: second abstract's ``language'' attribute has a value of ``English''.</p> 1.30 cvs 969: 970: <p>In the case of mark pairs, attributes are logically associated with the 971: pair as a whole, but are actually attached to the first mark.</p> 1.18 cvs 972: </div> 1.1 cvs 973: 1.18 cvs 974: <div class="subsection"> 1.37 cvs 975: <h3><a name="sectc316" id="sectc316">Discussion of the model</a></h3> 1.1 cvs 976: 1.37 cvs 977: <p>The notions of attribute, constructor, and structured element are used in 978: the definition of generic logical structures of documents and objects. The 979: problem is to assemble them to form generic structures. In fact, many types 980: of elements and attributes can be found in a variety of generic structures. 981: Rather than redefine them for each structure in which they appear, it is best 982: to share them between structures. The object classes already fill this 983: sharing function. If a mathematical class is defined, its formulas can be 984: used in many different document classes, without redefining the structure of 985: each class. This problem arises not only for the objects considered here; it 986: also arises for the commonplace textual elements found in many document 987: classes. This is the reason why the notion of object is so broad and why 988: paragraphs and enumerations are also considered to be objects. These object 989: classes not only permit the sharing of the structures of elements, but also 990: of the attributes defined in the generic structures.</p> 1.30 cvs 991: 992: <p>Structure, such as that presented here, can appear very rigid, and it is 1.1 cvs 993: possible to imagine that a document editing system based on this model could 1.37 cvs 994: prove very constraining to the user. This is, in fact, a common criticism of 995: syntax-directed editors. This defect can be avoided with Thot, primarily for 1.18 cvs 996: three reasons:</p> 997: <ul> 1.30 cvs 998: <li>the generic structures are not fixed in the model itself,</li> 999: <li>the model takes the dynamics of documents into account,</li> 1000: <li>the constructors offer great flexibility.</li> 1.18 cvs 1001: </ul> 1.30 cvs 1002: 1003: <p>When the generic structure of a document is not predefined, but rather is 1.1 cvs 1004: constructed specifically for each document class, it can be carefully adapted 1.37 cvs 1005: to the current needs. In cases where the generic structure is inadequate for 1.1 cvs 1006: a particular document of the class, it is always possible either to create a 1007: new class with a generic structure well suited to the new case or to extend 1.37 cvs 1008: the generic structure of the existing class to take into account the 1009: specifics of the document which poses the problem. These two solutions can 1010: also be applied to objects whose structures prove to be poorly designed.</p> 1.30 cvs 1011: 1012: <p>The model is sufficiently flexible to take into account all the phases of 1.37 cvs 1013: the life of the document. When a generic structure specifies that a report 1014: must contain a title, an abstract, an introduction, at least two chapters, 1015: and a conclusion, this means only that a report, <em>upon completion</em>, 1016: will have to contain all of these elements. When the author begins writing, 1017: none of these elements is present. Thot uses this model. Therefore, it 1018: tolerates documents which do not conform strictly to the generic structure of 1019: their class; it also considers the generic logical structure to be a way of 1020: helping the user in the construction of a complex document.</p> 1.30 cvs 1021: 1022: <p>In contrast, other applications may reject a document which does not 1.37 cvs 1023: conform strictly to its generic structure. This is, for example, what is done 1.30 cvs 1024: by compilers which refuse to generate code for a program which is not 1.37 cvs 1025: syntactically correct. This might also occur when using a document 1.18 cvs 1026: application for a report which does not have an abstract or title.</p> 1.30 cvs 1027: 1028: <p>The constructors of the document model bring a great flexibility to the 1.37 cvs 1029: generic structures. A choice constructor (and even more, a unit or schema 1030: constructor) can represent several, very different elements. The list 1031: constructor permits the addition of more elements of the same type. Used 1.1 cvs 1032: together, these two constructors permit any series of elements of different 1.37 cvs 1033: types. Of course, this flexibility can be reduced wherever necessary since a 1.1 cvs 1034: generic structure can limit the choices or the number of elements in a 1.18 cvs 1035: list.</p> 1.30 cvs 1036: 1037: <p>Another difficulty linked to the use of structure in the document model 1.37 cvs 1038: resides in the choice of the level of the structure. The structure of a 1.1 cvs 1039: discussion could be extracted from the text itself via linguistic analysis. 1040: Some studies are exploring this approach, but the model of Thot excludes this 1.37 cvs 1041: type of structure. It only takes into account the logical structure provided 1.18 cvs 1042: explicitly by the author.</p> 1.30 cvs 1043: 1.37 cvs 1044: <p>However, the level of structure of the model is not imposed. Each generic 1045: structure defines its own level of structure, adapted to the document class 1046: or object and to the ways in which it will be processed. If it will only be 1047: edited and printed, a relatively simple structure suffices. If more 1048: specialized processing will be applied to it, the structure must represent 1049: the element types on which this processing must act. By way of example, a 1050: simple structure is sufficient for printing formulas, but a more complex 1051: structure is required to perform symbolic or numeric calculations on the 1052: mathematical expressions. The document model of Thot allows both types of 1053: structure.</p> 1.18 cvs 1054: </div> 1055: </div> 1.1 cvs 1056: 1.18 cvs 1057: <div class="section"> 1.37 cvs 1058: <h2><a name="sectb32" id="sectb32">The definition language for generic 1059: structures</a></h2> 1.1 cvs 1060: 1.37 cvs 1061: <p>Generic structures, which form the basis of the document model of Thot, 1062: are specified using a special language. This definition language, called S, 1063: is described in this section.</p> 1.30 cvs 1064: 1065: <p>Each generic structure, which defines a class of documents or objects, is 1.2 cvs 1066: specified by a file, written in the S language, which is called a 1.37 cvs 1067: <em>structure schema</em>. Structure schemas are compiled into tables, called 1.18 cvs 1068: structure tables, which are used by Thot and which determine its behavior.</p> 1.1 cvs 1069: 1.18 cvs 1070: <div class="subsection"> 1.37 cvs 1071: <h3><a name="sectc321" id="sectc321">Writing Conventions</a></h3> 1.1 cvs 1072: 1.30 cvs 1073: <p>The grammar of S, like those of the languages P and T presented later, is 1.1 cvs 1074: described using the meta-language M, derived from the Backus-Naur Form 1.18 cvs 1075: (BNF).</p> 1.30 cvs 1076: 1077: <p>In this meta-language each rule of the grammar is composed of a grammar 1.37 cvs 1078: symbol followed by an equals sign (`=') and the right part of the rule. The 1.30 cvs 1079: equals sign plays the same role as the traditional `::=' of BNF: it indicates 1.37 cvs 1080: that the right part defines the symbol of the left part. In the right 1.30 cvs 1081: part,</p> 1.18 cvs 1082: <dl> 1.30 cvs 1083: <dt>concatenation</dt> 1084: <dd>is shown by the juxtaposition of symbols;</dd> 1085: <dt>character strings</dt> 1.37 cvs 1086: <dd>between apostrophes ' represent terminal symbols, that is, keywords 1087: in the language defined. Keywords are written here in upper-case 1088: letters, but can be written in any combination of upper and lower-case 1089: letters. For example, the keyword <tt>DEFPRES</tt> of S can also be 1090: written as <tt>defpres</tt> or <tt>DefPres</tt>.</dd> 1.30 cvs 1091: <dt>material between brackets</dt> 1092: <dd>(`[' and `]') is optional;</dd> 1093: <dt>material between angle brackets</dt> 1094: <dd>(`<' and `>') can be repeated many times or omitted;</dd> 1095: <dt>the slash</dt> 1.37 cvs 1096: <dd>(`/') indicates an alternative, a choice between the options 1097: separated by the slash character;</dd> 1.30 cvs 1098: <dt>the period</dt> 1099: <dd>marks the end of a rule;</dd> 1100: <dt>text between braces</dt> 1101: <dd>(`{' and `}') is simply a comment.</dd> 1.18 cvs 1102: </dl> 1.30 cvs 1103: 1104: <p>The M meta-language also uses the concepts of identifiers, strings, and 1.18 cvs 1105: integers:</p> 1106: <dl> 1.30 cvs 1107: <dt><tt>NAME</tt></dt> 1.37 cvs 1108: <dd>represents an identifier, a sequence of letters (upper or 1109: lower-case), digits, and underline characters (`_'), beginning with a 1110: letter. Also considered a letter is the sequence of characters 1111: `<tt>\nnn</tt>' where the letter <tt>n</tt> represents the ISO Latin-1 1112: code of the letter in octal. It is thus possible to use accented 1113: letters in identifiers. The maximum length of identifiers is fixed by 1114: the compiler. It is normally 31 characters. 1.30 cvs 1115: <p>Unlike keywords, upper and lower-case letters are distinct in 1116: identifiers. Thus, <tt>Title</tt>, <tt>TITLE</tt>, and <tt>title</tt> 1117: are considered different identifiers.</p> 1118: </dd> 1119: <dt><tt>STRING</tt></dt> 1.37 cvs 1120: <dd>represents a string. This is a string of characters delimited by 1121: apostrophes. If an apostrophe must appear in a string, it is doubled. 1122: As with identifiers, strings can contain characters represented by 1123: their octal code (after a backslash). As with apostrophes, if a 1124: backslash must appear in a string, it is doubled.</dd> 1.30 cvs 1125: <dt><tt>NUMBER</tt></dt> 1126: <dd>represents a positive integer or zero (without a sign), or said 1127: another way, a sequence of decimal digits.</dd> 1.18 cvs 1128: </dl> 1.30 cvs 1129: 1130: <p>The M language can be used to define itself as follows:</p> 1.18 cvs 1131: <pre>{ Any text between braces is a comment. } 1.30 cvs 1132: Grammar = Rule < Rule > 'END' . 1133: { The < and > signs indicate zero } 1.1 cvs 1134: { or more repetitions. } 1135: { END marks the end of the grammar. } 1136: Rule = Ident '=' RightPart '.' . 1137: { The period indicates the end of a rule } 1138: RightPart = RtTerminal / RtIntermed . 1139: { The slash indicates a choice } 1140: RtTerminal ='NAME' / 'STRING' / 'NUMBER' . 1141: { Right part of a terminal rule } 1.30 cvs 1142: RtIntermed = Possibility < '/' Possibility > . 1.1 cvs 1143: { Right part of an intermediate rule } 1.30 cvs 1144: Possibility = ElemOpt < ElemOpt > . 1145: ElemOpt = Element / '[' Element < Element > ']' / 1146: '<' Element < Element > '>' . 1.1 cvs 1147: { Brackets delimit optional parts } 1148: Element = Ident / KeyWord . 1149: Ident = NAME . 1150: { Identifier, sequence of characters } 1151: KeyWord = STRING . 1152: { Character string delimited by apostrophes } 1.18 cvs 1153: END</pre> 1154: </div> 1.1 cvs 1155: 1.18 cvs 1156: <div class="subsection"> 1.37 cvs 1157: <h3><a name="sectc322" id="sectc322">Extension schemas</a></h3> 1.1 cvs 1158: 1.30 cvs 1159: <p>A structure schema defines the generic logical structure of a class of 1.1 cvs 1160: documents or objects, independent of the operations which can be performed on 1.37 cvs 1161: the documents. However, certain applications may require particular 1.1 cvs 1162: information to be represented by the structure for the documents that they 1.37 cvs 1163: operate on. Thus a document version manager will need to indicate in the 1164: document the parts which belong to one version or another. An indexing system 1.1 cvs 1165: will add highly-structured index tables as well as the links between these 1.18 cvs 1166: tables and the rest of the document.</p> 1.30 cvs 1167: 1168: <p>Thus, many applications need to extend the generic structure of the 1.37 cvs 1169: documents on which they operate to introduce new attributes or element types. 1170: These additions are specific to each application and must be able to be 1171: applied to any generic structure: users will want to manage versions or 1172: construct indices for many types of documents. Extension schemas fulfill this 1173: role: they define attributes, elements, units, etc., but they can only be 1174: used jointly with a structure schema that they complete. Otherwise, structure 1175: schemas can always be used without these extensions when the corresponding 1176: applications are not available.</p> 1.18 cvs 1177: </div> 1.1 cvs 1178: 1.18 cvs 1179: <div class="subsection"> 1.37 cvs 1180: <h3><a name="sectc323" id="sectc323">The general organization of structure 1181: schemas</a></h3> 1.1 cvs 1182: 1.30 cvs 1183: <p>Every structure schema begins with the keyword <tt>STRUCTURE</tt> and ends 1.37 cvs 1184: with the keyword <tt>END</tt>. The keyword <tt>STRUCTURE</tt> is followed by 1.18 cvs 1185: the keyword <tt>EXTENSION</tt> in the case where the schema defines an 1.1 cvs 1186: extension, then by the name of the generic structure which the schema defines 1.37 cvs 1187: (the name of the document or object class). The name of the structure is 1.18 cvs 1188: followed by a semicolon.</p> 1.30 cvs 1189: 1190: <p>In the case of a complete schema (that is, a schema which is not an 1.1 cvs 1191: extension), the definition of the name of the structure is followed by the 1192: declarations of the default presentation schema, the global attributes, the 1.37 cvs 1193: structure rules, the units, the skeleton elements and the exceptions. Only 1194: the definition of the structure rules is required. Each series of 1195: declarations begins with a keyword: <tt>DEFPRES</tt>, <tt>ATTR</tt>, 1196: <tt>STRUCT</tt>, <tt>UNITS</tt>, <tt>EXPORT</tt>, <tt>EXCEPT</tt>.</p> 1.34 cvs 1197: 1198: <p>In the case of an extension schema, there are no skeleton elements and the 1199: <tt>STRUCT</tt> section is optional, while that section is required in a 1.37 cvs 1200: schema that is not an extension. On the other hand, extension schemas can 1201: contain an <tt>EXTENS</tt> section, which must not appear in a schema which 1202: is not an extension; this section defines the complements to attach to the 1203: rules found in the schema to which the extension will be added. The sections 1204: <tt>ATTR</tt>, <tt>STRUCT</tt>, and <tt>UNITS</tt> define new attributes, new 1205: elements, and new units which add their definitions to the principal 1206: schema.</p> 1.18 cvs 1207: <pre> StructSchema ='STRUCTURE' ElemID ';' 1.1 cvs 1208: 'DEFPRES' PresID ';' 1209: [ 'ATTR' AttrSeq ] 1210: 'STRUCT' RulesSeq 1211: [ 'UNITS' RulesSeq ] 1212: [ 'EXPORT' SkeletonSeq ] 1213: [ 'EXCEPT' ExceptSeq ] 1214: 'END' . 1.18 cvs 1215: ElemID = NAME .</pre> 1.30 cvs 1216: 1217: <p>or</p> 1.18 cvs 1218: <pre> ExtensSchema ='STRUCTURE' 'EXTENSION' ElemID ';' 1.1 cvs 1219: 'DEFPRES' PresID ';' 1220: [ 'ATTR' AttrSeq ] 1221: [ 'STRUCT' RulesSeq ] 1222: [ 'EXTENS' ExtensRuleSeq ] 1223: [ 'UNITS' RulesSeq ] 1224: [ 'EXCEPT' ExceptSeq ] 1225: 'END' . 1.18 cvs 1226: ElemID = NAME .</pre> 1227: </div> 1.1 cvs 1228: 1.18 cvs 1229: <div class="subsection"> 1.37 cvs 1230: <h3><a name="sectc324" id="sectc324">The default presentation</a></h3> 1.1 cvs 1231: 1.37 cvs 1232: <p>It was shown <a href="#mulpres">above</a> that many different 1233: presentations are possible for documents and objects of the same class. The 1234: structure schema defines a preferred presentation for the class, called the 1235: <em>default presentation</em>. Like generic structures, presentations are 1236: described by programs, called <em>presentation schemas</em>, which are 1237: written in a specific language, P, presented <a href="#sectb42">later</a> in 1238: this document. The name appearing after the keyword <tt>DEFPRES</tt> is the 1239: name of the default presentation schema. When a new document is created, Thot 1240: will use this presentation schema by default, but the user remains free to 1241: choose another if s/he wishes.</p> 1.18 cvs 1242: <pre> PresID = NAME .</pre> 1243: </div> 1.1 cvs 1244: 1.18 cvs 1245: <div class="subsection"> 1.37 cvs 1246: <h3><a name="sectc325" id="sectc325">Global Attributes</a></h3> 1.1 cvs 1247: 1.30 cvs 1248: <p>If the generic structure includes global attributes of its own, they are 1.37 cvs 1249: declared after the keyword <tt>ATTR</tt>. Each global attribute is defined by 1250: its name, followed by an equals sign and the definition of its type. The 1.18 cvs 1251: declaration of a global attribute is terminated by a semi-colon.</p> 1.30 cvs 1252: 1253: <p>For attributes of the numeric, textual, or reference types, the type is 1.37 cvs 1254: indicated by a keyword, <tt>INTEGER</tt>, <tt>TEXT</tt>, or 1255: <tt>REFERENCE</tt> respectively.</p> 1.30 cvs 1256: 1257: <p>In the case of a reference attribute, the keyword <tt>REFERENCE</tt> is 1.37 cvs 1258: followed by the type of the referenced element in parentheses. It can refer 1.18 cvs 1259: to any type at all, specified by using the keyword <tt>ANY</tt>, or to a 1.37 cvs 1260: specific type. In the latter case, the element type designated by the 1.18 cvs 1261: reference can be defined either in the <a href="#sectc327"><tt>STRUCT</tt> 1262: section</a> of the same structure schema or in the <tt>STRUCT</tt> section of 1.37 cvs 1263: another structure schema. When the type is defined in another schema, the 1.1 cvs 1264: element type is followed by the name of the structure schema (within 1.37 cvs 1265: parentheses) in which it is defined. The name of the designated element type 1.18 cvs 1266: can be preceded by the keyword <tt>First</tt> or <tt>Second</tt>, but only in 1.37 cvs 1267: the case where the type is defined as <a href="#sectd3285">a pair</a>. These 1.1 cvs 1268: keywords indicate whether the attribute must designate the first mark of the 1.37 cvs 1269: pair or the second. If the reference refers to a pair and neither of these 1.18 cvs 1270: two keywords is present, then the first mark is used.</p> 1.30 cvs 1271: 1.37 cvs 1272: <p>In the case of an enumeration attribute, the equals sign is followed by 1273: the list of names representing the possible values of the attribute, the 1274: names being separated from each other by commas. An enumeration attribute has 1275: at least one possible value; the maximum number of values is defined by the 1.18 cvs 1276: compiler for the S language.</p> 1.30 cvs 1277: <pre> AttrSeq = Attribute < Attribute > . 1.1 cvs 1278: Attribute = AttrID '=' AttrType ';' . 1279: AttrType = 'INTEGER' / 'TEXT' / 1280: 'REFERENCE' '(' RefType ')' / 1281: ValueSeq . 1282: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] . 1283: FirstSec = 'First' / 'Second' . 1284: ExtStruct = '(' ElemID ')' . 1.30 cvs 1285: ValueSeq = AttrVal < ',' AttrVal > . 1.1 cvs 1286: AttrID = NAME . 1.18 cvs 1287: AttrVal = NAME .</pre> 1.30 cvs 1288: 1289: <p>There is a predefined global text attribute, the <em>language</em>, which 1.37 cvs 1290: is automatically added to every Thot structure schema. This attribute allows 1291: Thot to perform certain actions, such as hyphenation and spell-checking, 1292: which cannot be performed without knowing the language in which each part of 1293: the document is written. This attribute can be used just like any explicitly 1.18 cvs 1294: declared attribute: the system acts as if every structure schema contains</p> 1295: <pre>ATTR 1296: Language = TEXT;</pre> 1.30 cvs 1297: 1.18 cvs 1298: <blockquote class="example"> 1.30 cvs 1299: <p><strong>Example:</strong></p> 1300: 1301: <p>The following specification defines the global enumeration attribute 1302: WordType.</p> 1303: <pre>ATTR 1.18 cvs 1304: WordType = Definition, IndexWord, DocumentTitle;</pre> 1305: </blockquote> 1306: </div> 1.1 cvs 1307: 1.18 cvs 1308: <div class="subsection"> 1.37 cvs 1309: <h3><a name="sectc327" id="sectc327">Structured elements</a></h3> 1.1 cvs 1310: 1.30 cvs 1311: <p>The rules for defining structured elements are required, except in an 1.1 cvs 1312: extension schema: they constitute the core of a structure schema, since they 1313: define the structure of the different types of elements that occur in a 1.18 cvs 1314: document or object of the class defined by the schema.</p> 1.30 cvs 1315: 1316: <p>The first structure rule after the keyword <tt>STRUCT</tt> must define the 1.1 cvs 1317: structure of the class whose name appears in the first instruction 1.37 cvs 1318: (<tt>STRUCTURE</tt>) of the schema. This is the root rule of the schema, 1.18 cvs 1319: defining the root of the document tree or object tree.</p> 1.30 cvs 1320: 1321: <p>The remaining rules may be placed in any order, since the language permits 1.37 cvs 1322: the definition of element types before or after their use, or even in the 1323: same instruction in which they are used. This last case allows the definition 1324: of recursive structures.</p> 1.30 cvs 1325: 1326: <p>Each rule is composed of a name (the name of the element type whose 1327: structure is being defined) followed by an equals sign and a structure 1328: definition.</p> 1329: 1.37 cvs 1330: <p>If any local attributes are associated with the element type defined by 1331: the rule, they appear between parentheses after the type name and before the 1332: equals sign. The parentheses contain, first, the keyword <tt>ATTR</tt>, then 1333: the list of local attributes, separated by commas. Each local attribute is 1.2 cvs 1334: composed of the name of the attribute followed by an equals sign and the 1.18 cvs 1335: definition of the attribute's type, just as in the definition of <a 1.37 cvs 1336: href="#sectc325">global attributes</a>. The name of the attribute can be 1337: preceded by an exclamation point to indicate that the attribute must always 1338: be present for this element type. The same attribute, identified by its name, 1339: can be defined as a local attribute for multiple element types. In this case, 1340: the equals sign and definition of the attribute type need only appear in the 1341: first occurrence of the attribute. It should be noted that global attributes 1342: cannot also be defined as local attributes.</p> 1.30 cvs 1343: 1344: <p>If any <a href="#sectd3135">extensions</a> are defined for this element 1345: type, a plus sign follows the structure definition and the names of the 1.37 cvs 1346: extension element types appear between parentheses after the plus. If there 1347: are multiple extensions, they are separated by commas. These types can either 1.30 cvs 1348: be defined in the same schema, defined in other schemas, or they may be base 1.18 cvs 1349: types identified by the keywords <tt>TEXT</tt>, <tt>GRAPHICS</tt>, 1350: <tt>SYMBOL</tt>, or <tt>PICTURE</tt>.</p> 1.30 cvs 1351: 1352: <p><a href="#sectd3135">Restrictions</a> are indicated in the same manner as 1.18 cvs 1353: extensions, but they are introduced by a minus sign and they come after the 1354: extensions, or if there are no extensions, after the structure definition.</p> 1.30 cvs 1355: 1.37 cvs 1356: <p>If the values of attributes must be attached systematically to this 1357: element type, they are introduced by the keyword <tt>WITH</tt> and declared 1358: in the form of a list of fixed-value attributes. When such definitions of 1359: fixed attribute values appear, they are always the last part of the rule.</p> 1.30 cvs 1360: 1361: <p>The rule is terminated by a semicolon.</p> 1362: <pre> RuleSeq = Rule < Rule > . 1.1 cvs 1363: Rule = ElemID [ LocAttrSeq ] '=' DefWithAttr ';'. 1.30 cvs 1364: LocAttrSeq = '(' 'ATTR' LocAttr < ';' LocAttr > ')' . 1.1 cvs 1365: LocAttr = [ '!' ] AttrID [ '=' AttrType ] . 1366: DefWithAttr = Definition 1367: [ '+' '(' ExtensionSeq ')' ] 1368: [ '-' '(' RestrictSeq ')' ] 1369: [ 'WITH' FixedAttrSeq ] . 1.30 cvs 1370: ExtensionSeq = ExtensionElem < ',' ExtensionElem > . 1.1 cvs 1371: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' / 1372: 'SYMBOL' / 'PICTURE' . 1.30 cvs 1373: RestrictSeq = RestrictElem < ',' RestrictElem > . 1.1 cvs 1374: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' / 1.18 cvs 1375: 'SYMBOL' / 'PICTURE' .</pre> 1.30 cvs 1376: 1377: <p>The list of fixed-value attributes is composed of a sequence of 1.37 cvs 1378: attribute-value pairs separated by commas. Each pair contains the name of the 1.1 cvs 1379: attribute and the fixed value for this element type, the two being separated 1.37 cvs 1380: by an equals sign. If the sign is preceded by a question mark the given value 1.1 cvs 1381: is only an initial value that may be modified later rather than a value fixed 1.37 cvs 1382: for all time. Reference attributes are an exception to this norm. They cannot 1383: be assigned a fixed value, but when the name of such an attribute appears 1384: this indicates that this element type must have a valid value for the 1385: attribute. For the other attribute types, the fixed value is indicated by a 1.1 cvs 1386: signed integer (numeric attributes), a character string between apostrophes 1.18 cvs 1387: (textual attributes) or the name of a value (enumeration attributes).</p> 1.30 cvs 1388: 1389: <p>Fixed-value attributes can either be <a href="#sectc325">global</a> or 1390: local to the element type for which they are fixed, but they must be declared 1391: before they are used.</p> 1392: <pre> FixedAttrSeq = FixedAttr < ',' FixedAttr > . 1.1 cvs 1393: FixedAttr = AttrID [ FixedOrModifVal ] . 1394: FixedOrModifVal = [ '?' ] '=' FixedValue . 1395: FixedValue = [ '-' ] NumValue / TextVal / AttrVal . 1396: NumValue = NUMBER . 1.18 cvs 1397: TextVal = STRING .</pre> 1398: </div> 1.1 cvs 1399: 1.18 cvs 1400: <div class="subsection"> 1.37 cvs 1401: <h3><a name="sectc328" id="sectc328">Structure definitions</a></h3> 1.1 cvs 1402: 1.37 cvs 1403: <p>The structure of an element type can be a simple base type or a 1404: constructed type.</p> 1.30 cvs 1405: 1406: <p>For constructed types, it is frequently the case that similar structures 1.37 cvs 1407: appear in many places in a document. For example the contents of the 1.1 cvs 1408: abstract, of the introduction, and of a section can have the same structure, 1.37 cvs 1409: that of a sequence of paragraphs. In this case, a single, common structure 1.1 cvs 1410: can be defined (the paragraph sequence in this example), and the schema is 1411: written to indicate that each element type possesses this structure, as 1.18 cvs 1412: follows:</p> 1413: <pre> Abstract = Paragraph_sequence; 1.1 cvs 1414: Introduction = Paragraph_sequence; 1.18 cvs 1415: Section_contents = Paragraph_sequence;</pre> 1.30 cvs 1416: 1417: <p>The equals sign means ``has the same structure as''.</p> 1418: 1.37 cvs 1419: <p>If the element type defined is a simple base type, this is indicated by 1420: one of the keywords <tt>TEXT</tt>, <tt>GRAPHICS</tt>, <tt>SYMBOL</tt>, or 1421: <tt>PICTURE</tt>. If some local attributes must be associated with a base 1422: type, the keyword of the base type is followed by the declaration of the 1423: local attributes using the syntax <a href="#sectc327">presented above.</a></p> 1.30 cvs 1424: 1425: <p>In the case of an open choice, the type is indicated by the keyword 1.18 cvs 1426: <tt>UNIT</tt> for units or the keyword <tt>NATURE</tt> for objects having a 1427: structure defined by any other schema.</p> 1.30 cvs 1428: 1429: <p>A unit represents one of the two following categories:</p> 1.18 cvs 1430: <ul> 1.30 cvs 1431: <li>a base type: text, graphical element, symbol, picture,</li> 1.37 cvs 1432: <li>an element whose type is chosen from among the types defined as units 1433: in the <tt>UNITS</tt> section of the document's structure schema. It can 1.30 cvs 1434: also be chosen from among the types defined as <a 1435: href="#sectd3132">units</a> in the <a href="#sectc3212"><tt>UNITS</tt> 1436: section</a> of the structure schemas that defines the ancestors of the 1437: element to which the rule is applied.</li> 1.18 cvs 1438: </ul> 1.30 cvs 1439: 1440: <p>Before the creation of an element defined as a unit, Thot asks the user to 1.18 cvs 1441: choose between the categories of elements.</p> 1.30 cvs 1442: 1443: <p>Thus, the contents of a paragraph can be specified as a sequence of units, 1.1 cvs 1444: which will permit the inclusion in the paragraphs of character strings, 1445: symbols, and various elements, such as cross-references, if these are defined 1.18 cvs 1446: as units.</p> 1.30 cvs 1447: 1.37 cvs 1448: <p>A schema object (keyword <tt>NATURE</tt>) represents an object defined by 1449: a structure schema freely chosen from among the available schemas; in the 1450: case the element type is defined by the first rule (the root rule) of the 1451: chosen schema.</p> 1.30 cvs 1452: 1453: <p>If the element type defined is a constructed type, the list, aggregate, 1.37 cvs 1454: choice, and reference constructors are used. In this case the definition 1455: begins with a keyword identifying the constructor. This keyword is followed 1.18 cvs 1456: by a syntax specific to each constructor.</p> 1.30 cvs 1457: 1458: <p>The local attribute definitions appear after the name of the element type 1.18 cvs 1459: being defined, if this element type has <a href="#sectc327">local 1460: attributes</a>.</p> 1461: <pre> Definition = BaseType [ LocAttrSeq ] / Constr / Element . 1.1 cvs 1462: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 'PICTURE' / 1463: 'UNIT' / 'NATURE' . 1464: Element = ElemID [ ExtOrDef ] . 1465: ExtOrDef = 'EXTERN' / 'INCLUDED' / 1466: [ LocAttrSeq ] '=' Definition . 1467: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF' 1468: '(' DefWithAttr ')' / 1469: 'BEGIN' DefOptSeq 'END' / 1470: 'AGGREGATE' DefOptSeq 'END' / 1471: 'CASE' 'OF' DefSeq 'END' / 1472: 'REFERENCE' '(' RefType ')' / 1.18 cvs 1473: 'PAIR' .</pre> 1.1 cvs 1474: 1.18 cvs 1475: <div class="subsubsection"> 1.37 cvs 1476: <h4><a name="sectd3281" id="sectd3281">List</a></h4> 1.1 cvs 1477: 1.30 cvs 1478: <p>The list constructor permits the definition of an element type composed of 1.37 cvs 1479: a list of elements, all of the same type. A list definition begins with the 1.18 cvs 1480: <tt>LIST</tt> keyword followed by an optional range, the keyword <tt>OF</tt>, 1.1 cvs 1481: and the definition, between parentheses, of the element type which must 1.37 cvs 1482: compose the list. The optional range is composed of the minimum and maximum 1.1 cvs 1483: number of elements for the list separated by two periods and enclosed by 1.37 cvs 1484: brackets. If the range is not present, the number of list elements is 1485: unconstrained. When only one of the two bounds of the range is unconstrained, 1486: it is represented by a star ('*') character. Even when both bounds are 1487: unconstrained, they can be specified by <tt>[*..*]</tt>, but it is simpler 1488: not to specify any bound.</p> 1.18 cvs 1489: <pre> 'LIST' [ '[' min '..' max ']' ] 1.1 cvs 1490: 'OF' '(' DefWithAttr ')' 1491: min = Integer / '*' . 1492: max = Integer / '*' . 1.18 cvs 1493: Integer = NUMBER .</pre> 1.30 cvs 1494: 1495: <p>Before the document is edited, Thot creates the minimum number of elements 1.37 cvs 1496: for the list. If no minimum was given, it creates a single element. If a 1.30 cvs 1497: maximum number of elements is given and that number is attained, the editor 1498: refuses to create new elements for the list.</p> 1499: 1500: <blockquote class="example"> 1501: <p><strong>Example:</strong></p> 1502: 1503: <p>The following two instructions define the body of a document as a 1504: sequence of at least two chapters and the contents of a section as a 1.37 cvs 1505: sequence of paragraphs. A single paragraph can be the entire contents of a 1.30 cvs 1506: section.</p> 1507: <pre>Body = LIST [2..*] OF (Chapter); 1.18 cvs 1508: Section_contents = LIST OF (Paragraph);</pre> 1509: </blockquote> 1510: </div> 1.1 cvs 1511: 1.18 cvs 1512: <div class="subsubsection"> 1.37 cvs 1513: <h4><a name="sectd3282" id="sectd3282">Aggregate</a></h4> 1.1 cvs 1514: 1.37 cvs 1515: <p>The aggregate constructor is used to define an element type as a 1516: collection of sub-elements, each having a fixed type. The collection may be 1517: ordered or unordered. The elements composing the collection are called 1518: <em>components</em>. In the definition of an aggregate, a keyword indicates 1.18 cvs 1519: whether or not the aggregate is ordered: <tt>BEGIN</tt> for an ordered 1520: aggregate, <tt>AGGREGATE</tt> for an unordered aggregate. This keyword is 1.1 cvs 1521: followed by the list of component type definitions which is terminated by the 1.37 cvs 1522: <tt>END</tt> keyword. The component type definitions are separated by 1.18 cvs 1523: commas.</p> 1.30 cvs 1524: 1525: <p>Before creating an aggregate, the Thot editor creates all the aggregate's 1.1 cvs 1526: components in the order they appear in the structure schema, even for 1.37 cvs 1527: unordered aggregates. However, unlike ordered aggregates, the components of 1.1 cvs 1528: an unordered aggregate may be rearranged using operations of the Thot editor. 1529: The exceptions to the rule are any components whose name was preceded by a 1.37 cvs 1530: question mark character ('?'). These components, which are optional, can be 1.1 cvs 1531: created by explicit request, possibly at the time the aggregate is created, 1.18 cvs 1532: but they are not created automatically <em>prior</em> to the creation of the 1533: aggregate.</p> 1534: <pre> 'BEGIN' DefOptSeq 'END' 1.30 cvs 1535: DefOptSeq = DefOpt ';' < DefOpt ';' > . 1.18 cvs 1536: DefOpt = [ '?' ] DefWithAttr .</pre> 1.30 cvs 1537: 1.18 cvs 1538: <blockquote class="example"> 1.30 cvs 1539: <p><strong>Example:</strong></p> 1540: 1541: <p>In a bilingual document, each paragraph has an English version and a 1.37 cvs 1542: French version. In certain cases, the translator wants to add a marginal 1543: note, but this note is present in very few paragraphs. Thus, it must not be 1544: created systematically for every paragraph. A bilingual paragraph of this 1.30 cvs 1545: type is declared:</p> 1546: <pre>Bilingual_paragraph = BEGIN 1.1 cvs 1547: French_paragraph = TEXT; 1548: English_paragraph = TEXT; 1549: ? Note = TEXT; 1.18 cvs 1550: END;</pre> 1551: </blockquote> 1552: </div> 1.1 cvs 1553: 1.18 cvs 1554: <div class="subsubsection"> 1.37 cvs 1555: <h4><a name="sectd3283" id="sectd3283">Choice</a></h4> 1.1 cvs 1556: 1.30 cvs 1557: <p>The choice constructor permits the definition of an element type which is 1.37 cvs 1558: chosen from among a set of possible types. The keywords <tt>CASE</tt> and 1559: <tt>OF</tt> are followed by a list of definitions of possible types, which 1560: are separated by semicolons and terminated by the <tt>END</tt> keyword.</p> 1.18 cvs 1561: <pre> 'CASE' 'OF' DefSeq 'END' 1.30 cvs 1562: DefSeq = DefWithAttr ';' < DefWithAttr ';' > .</pre> 1563: 1564: <p>Before the creation of an element defined as a choice, the Thot editor 1.37 cvs 1565: presents the list of possible types for the element to the user. The user has 1.18 cvs 1566: only to select the element type that s/he wants to create from this list.</p> 1.30 cvs 1567: 1.37 cvs 1568: <p>The order of the type declarations is important. It determines the order 1569: of the list presented to the user before the creation of the element. Also, 1.30 cvs 1570: when a Choice element is being created automatically, the first type in the 1.37 cvs 1571: list is used. In fact, using the Thot editor, when an empty Choice element is 1.1 cvs 1572: selected, it is possible to select this element and to enter its text from 1573: keyboard. In this case, the editor uses the first element type which can 1.18 cvs 1574: contain an atom of the character string type.</p> 1.30 cvs 1575: 1576: <p>The two special cases of the choice constructor, the <a 1.18 cvs 1577: href="#sectc328"><em>schema</em></a> and the <a 1578: href="#sectc3212"><em>unit</em></a> are discussed elsewhere.</p> 1.30 cvs 1579: 1.18 cvs 1580: <blockquote class="example"> 1.30 cvs 1581: <p><strong>Example:</strong></p> 1582: 1583: <p>It is common in documents to treat a variety of objects as if they were 1.37 cvs 1584: ordinary paragraphs. Thus, a ``Paragraph'' might actually be composed of a 1.30 cvs 1585: block of text (an ordinary paragraph), or a mathematical formula whose 1586: structure is defined by another structure schema named Math, or a table, 1.37 cvs 1587: also defined by another structure schema. Here is a definition of such a 1.30 cvs 1588: paragraph:</p> 1589: <pre>Paragraph = CASE OF 1.1 cvs 1590: Simple_text = TEXT; 1591: Formula = Math; 1592: Table_para = Table; 1.18 cvs 1593: END;</pre> 1594: </blockquote> 1595: </div> 1.1 cvs 1596: 1.18 cvs 1597: <div class="subsubsection"> 1.37 cvs 1598: <h4><a name="sectd3284" id="sectd3284">Reference</a></h4> 1.1 cvs 1599: 1.37 cvs 1600: <p>Like all elements in Thot, references are typed. An element type defined 1.30 cvs 1601: as a reference is a cross-reference to an element of some other given type. 1602: The keyword <tt>REFERENCE</tt> is followed by the name of a type enclosed in 1.37 cvs 1603: parentheses. When the type which is being cross-referenced is defined in 1.1 cvs 1604: another structure schema, the type name is itself followed by the name of the 1.18 cvs 1605: external structure schema in which it is defined.</p> 1.30 cvs 1606: 1607: <p>When the designated element type is a <a href="#sectd3285">mark pair</a>, 1.37 cvs 1608: it can be preceded by a <tt>FIRST</tt> or <tt>SECOND</tt> keyword. These 1.18 cvs 1609: keywords indicate whether the reference points to the first or second mark of 1610: the pair. If the reference points to a pair and neither of these two keywords 1611: is present, the reference is considered to point to the first mark of the 1612: pair.</p> 1.30 cvs 1613: 1.37 cvs 1614: <p>There is an exception to the principle of typed references: it is possible 1.30 cvs 1615: to define a reference which designates an element of any type, which can 1616: either be in the same document or another document. In this case, it suffices 1617: to put the keyword <tt>ANY</tt> in the parentheses which indicate the 1618: referenced element type.</p> 1.18 cvs 1619: <pre> 'REFERENCE' '(' RefType ')' 1620: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] .</pre> 1.30 cvs 1621: 1622: <p>When defining an inclusion, the <tt>REFERENCE</tt> keyword is not used. 1.1 cvs 1623: Inclusions with complete expansion are not declared as such in the structure 1.37 cvs 1624: schemas, since any element defined in a structure schema can be replaced by 1625: an element of the same type. Instead, inclusions without expansion or with 1.1 cvs 1626: partial expansion must be declared explicitly whenever they will include a 1.37 cvs 1627: complete object ( and not a part of an object). In this case, the object type 1.1 cvs 1628: to be included (that is, the name of its structure schema) is followed by a 1.37 cvs 1629: keyword: <tt>EXTERN</tt> for inclusion without expansion and 1630: <tt>INCLUDED</tt> for partial expansion.</p> 1.30 cvs 1631: 1.37 cvs 1632: <p>Before creating a cross-reference or an inclusion, the Thot editor asks 1633: the user to choose, from the document images displayed, the referenced or 1634: included element.</p> 1.30 cvs 1635: 1.18 cvs 1636: <blockquote class="example"> 1.30 cvs 1637: <p><strong>Example:</strong></p> 1638: 1639: <p>If the types Note and Section are defined in the Article structure 1640: schema, it is possible to define, in the same structure schema, a reference 1641: to a note and a reference to a section in this manner:</p> 1642: <pre>Ref_note = REFERENCE (Note); 1.18 cvs 1643: Ref_section = REFERENCE (Section);</pre> 1.30 cvs 1644: 1645: <p>It is also possible to define the generic structure of a collection of 1646: articles, which include (with partial expansion) objects of the Article 1647: class and which possess an introduction which may include cross-references 1.37 cvs 1648: to sections of the included articles. In the Collection structure schema, 1.30 cvs 1649: the definitions are:</p> 1650: <pre>Collection = BEGIN 1.6 cvs 1651: Collection_title = TEXT; 1652: Introduction = LIST OF (Elem = CASE OF 1.1 cvs 1653: TEXT; 1654: Ref_sect; 1655: END); 1.6 cvs 1656: Body = LIST OF (Article INCLUDED); 1657: END; 1.18 cvs 1658: Ref_sect = REFERENCE (Section (Article));</pre> 1.30 cvs 1659: 1660: <p>Here we define a Folder document class which has a title and includes 1661: documents of different types, particularly Folders:</p> 1662: <pre>Folder = BEGIN 1.6 cvs 1663: Folder_title = TEXT; 1664: Folder_contents = LIST OF (Document); 1665: END; 1.1 cvs 1666: 1667: Document = CASE OF 1668: Article EXTERN; 1669: Collection EXTERN; 1670: Folder EXTERN; 1.18 cvs 1671: END;</pre> 1.30 cvs 1672: 1673: <p>Under this definition, Folder represents either an aggregate which 1674: contains a folder title and the list of included documents or an included 1.37 cvs 1675: folder. To resolve this ambiguity, in the P language, the placement of a 1.30 cvs 1676: star character in front of the type name (here, Folder) indicates an 1677: included document.</p> 1.18 cvs 1678: </blockquote> 1679: </div> 1.1 cvs 1680: 1.18 cvs 1681: <div class="subsubsection"> 1.37 cvs 1682: <h4><a name="sectd3285" id="sectd3285">Mark pairs</a></h4> 1.1 cvs 1683: 1.37 cvs 1684: <p>Like other elements, mark pairs are typed. The two marks of the pair have 1685: the same type, but there exist two predefined subtypes which apply to all 1686: mark pairs: the first mark of the pair (called <tt>First</tt> in the P and T 1.18 cvs 1687: languages) and the second mark (called <tt>Second</tt>).</p> 1.30 cvs 1688: 1689: <p>In the S language, a mark pair is noted simply by the <tt>PAIR</tt> 1.18 cvs 1690: keyword.</p> 1.30 cvs 1691: 1.37 cvs 1692: <p>In the Thot editor, marks are always moved or destroyed together. The two 1.1 cvs 1693: marks of a pair have the same identifier, unique within the document, which 1.18 cvs 1694: permits intertwining mark pairs without risk of ambiguity.</p> 1695: </div> 1696: </div> 1.1 cvs 1697: 1.18 cvs 1698: <div class="subsection"> 1.37 cvs 1699: <h3><a name="sectc329" id="sectc329">Imports</a></h3> 1.1 cvs 1700: 1.30 cvs 1701: <p>Because of schema constructors, it is possible, before editing a document, 1.37 cvs 1702: to use classes defined by other structure schemas whenever they are needed. 1703: It is also possible to assign specific document classes to certain element 1704: types. In this case, these classes are simply designated by their name. In 1705: fact, if a type name is not defined in the structure schema, it is assumed 1706: that it specifies a structure defined by another structure schema.</p> 1.30 cvs 1707: 1.18 cvs 1708: <blockquote class="example"> 1.30 cvs 1709: <p><strong>Example:</strong></p> 1710: 1711: <p>If the types Math and Table don't appear in the left part of a structure 1712: rule in the schema, the following two rules indicate that a formula has the 1.37 cvs 1713: structure of an object defined by the structure schema Math and that a 1714: table element has the structure of an object defined by the Table 1715: schema.</p> 1.30 cvs 1716: <pre>Formula = Math; 1.18 cvs 1717: Table_elem = Table;</pre> 1718: </blockquote> 1719: </div> 1720: 1721: <div class="subsection"> 1.37 cvs 1722: <h3><a name="sectc3210" id="sectc3210">Extension rules</a></h3> 1.18 cvs 1723: 1.30 cvs 1724: <p>The <tt>EXTENS</tt> section, which can only appear in an extension schema, 1.1 cvs 1725: defines complements to the rules in the primary schema (i.e. the structure 1726: schema to which the extension schema will be applied). More precisely, this 1727: section permits the addition to an existing type of local attributes, 1.18 cvs 1728: extensions, restrictions and fixed-value attributes.</p> 1.30 cvs 1729: 1730: <p>These additions can be applied to the root rule of the primary schema, 1.18 cvs 1731: designated by the keyword <tt>Root</tt>, or to any other explicitly named 1732: rule.</p> 1.30 cvs 1733: 1734: <p>Extension rules are separated from each other by a semicolon and each 1.18 cvs 1735: extension rule has the same syntax as a <a href="#sectc327">structure 1736: rule</a>, but the part which defines the constructor is absent.</p> 1.30 cvs 1737: <pre> ExtenRuleSeq = ExtensRule ';' < ExtensRule ';' > . 1.6 cvs 1738: ExtensRule = RootOrElem [ LocAttrSeq ] 1739: [ '+' '(' ExtensionSeq ')' ] 1740: [ '-' '(' RestrictSeq ')' ] 1741: [ 'WITH' FixedAttrSeq ] . 1.18 cvs 1742: RootOrElem = 'Root' / ElemID .</pre> 1743: </div> 1.1 cvs 1744: 1.18 cvs 1745: <div class="subsection"> 1.37 cvs 1746: <h3><a name="sectc3212" id="sectc3212">Units</a></h3> 1.30 cvs 1747: 1748: <p>The <tt>UNITS</tt> section of the structure schema contains the 1749: declarations of the element types which can be used in the external objects 1750: making up parts of the document or in objects of the class defined by the 1.37 cvs 1751: schema. These element types are defined just like other structured element 1752: types. They can be used in the other element types of the schema, but they 1753: can also be used in any other rule of the schema.</p> 1.30 cvs 1754: 1755: <blockquote class="example"> 1756: <p><strong>Example:</strong></p> 1.1 cvs 1757: 1.30 cvs 1758: <p>If references to notes are declared as units:</p> 1759: <pre>UNITS 1.18 cvs 1760: Ref_note = REFERENCE (Note);</pre> 1.30 cvs 1761: 1.37 cvs 1762: <p>then it is possible to use references to notes in a cell of a table, 1763: even when <tt>Table</tt> is an external structure schema. The 1764: <tt>Table</tt> schema must declare a cell to be a sequence of units, which 1765: can then be base element types (text, for example) or references to notes 1766: in the document.</p> 1.30 cvs 1767: <pre>Cell = LIST OF (UNITS);</pre> 1.18 cvs 1768: </blockquote> 1769: </div> 1.1 cvs 1770: 1.18 cvs 1771: <div class="subsection"> 1.37 cvs 1772: <h3><a name="sectc3213" id="sectc3213">Skeleton elements</a></h3> 1.1 cvs 1773: 1.30 cvs 1774: <p>When editing a document which contains or must contain external references 1775: to several other documents, it may be necessary to load a large number of 1.1 cvs 1776: documents, simply to see the parts designated by the external references of 1.37 cvs 1777: the document while editing, or to access the source of included elements. In 1778: this case, the external documents are not modified and it is only necessary 1779: to see the elements of these documents which could be referenced. Because of 1.1 cvs 1780: this, the editor will suggest that the documents be loaded in ``skeleton'' 1.37 cvs 1781: form. This form contains only the elements of the document explicitly 1.18 cvs 1782: mentioned in the <tt>EXPORT</tt> section of their structure schema and, for 1.1 cvs 1783: these elements, only the part of the contents specified in that section. This 1784: form has the advantage of being very compact, thus requiring very few 1.37 cvs 1785: resources from the editor. This is also the skeleton form which constitutes 1.18 cvs 1786: the expanded form of <a href="#inclusion">inclusions</a> with partial 1787: expansion.</p> 1.30 cvs 1788: 1789: <p>Skeleton elements must be declared explicitly in the <tt>EXPORT</tt> 1.37 cvs 1790: section of the structure schema that defines them. This section begins with 1.30 cvs 1791: the keyword <tt>EXPORT</tt> followed by a comma-separated list of the element 1.1 cvs 1792: types which must appear in the skeleton form and ending with a semicolon. 1.18 cvs 1793: These types must have been previously declared in the schema.</p> 1.30 cvs 1794: 1.37 cvs 1795: <p>For each skeleton element type, the part of the contents which is loaded 1796: by the editor, and therefore displayable, can be specified by putting the 1797: keyword <tt>WITH</tt> and the name of the contained element type to be loaded 1798: after the name of the skeleton element type. In this case only that named 1799: element, among all the elements contained in the exportable element type, 1800: will be loaded. If the <tt>WITH</tt> is absent, the entire contents of the 1801: skeleton element will be loaded by the editor. If instead, it is better that 1802: the skeleton form not load the contents of a particular element type, the 1803: keyword <tt>WITH</tt> must be followed by the word <tt>Nothing</tt>.</p> 1.18 cvs 1804: <pre> [ 'EXPORT' SkeletonSeq ] 1.1 cvs 1805: 1.30 cvs 1806: SkeletonSeq = SkelElem < ',' SkelElem > ';' . 1.1 cvs 1807: SkelElem = ElemID [ 'WITH' Contents ] . 1.18 cvs 1808: Contents = 'Nothing' / ElemID [ ExtStruct ] .</pre> 1.30 cvs 1809: 1.18 cvs 1810: <blockquote class="example"> 1.30 cvs 1811: <p><strong>Example:</strong></p> 1812: 1813: <p>Suppose that, in documents of the article class, the element types 1814: Article_title, Figure, Section, Paragraph, and Biblio should appear in the 1815: skeleton form in order to make it easier to create external references to 1.37 cvs 1816: them from other documents. When loading an article in its skeleton form, 1.30 cvs 1817: all of these element types will be loaded except for paragraphs, but only 1.37 cvs 1818: the article title will be loaded in its entirety. For figures, the caption 1.30 cvs 1819: will be loaded, while for sections, the title will be loaded, and for 1.37 cvs 1820: bibliographic entries, only the title that they contain will be loaded. 1821: Note that bibliographic elements are defined in another structure schema, 1822: RefBib. To produce this result, the following declarations should be placed 1823: in the Article structure schema:</p> 1.30 cvs 1824: <pre>EXPORT 1.1 cvs 1825: Article_title, 1.5 cvs 1826: Figure With Caption, 1.1 cvs 1827: Section With Section_title, 1828: Paragraph With Nothing, 1.18 cvs 1829: Biblio With Biblio_title(RefBib);</pre> 1830: </blockquote> 1831: </div> 1.1 cvs 1832: 1.18 cvs 1833: <div class="subsection"> 1.37 cvs 1834: <h3><a name="sectc3214" id="sectc3214">Exceptions</a></h3> 1.1 cvs 1835: 1.30 cvs 1836: <p>The behavior of the Thot editor and the actions that it performs are 1.37 cvs 1837: determined by the structure schemas. These actions are applied to all 1838: document and object types in accordance with their generic structure. For 1.1 cvs 1839: certain object types, such as tables and graphics, these actions are not 1840: sufficient or are poorly adapted and some special actions must be added to or 1.37 cvs 1841: substituted for certain standard actions. These special actions are called 1.18 cvs 1842: <em>exceptions</em>.</p> 1.30 cvs 1843: 1.37 cvs 1844: <p>Exceptions only inhibit or modify certain standard actions, but they can 1845: be used freely in every structure schema.</p> 1.30 cvs 1846: 1.37 cvs 1847: <p>Each structure schema can contain a section defining exceptions. It begins 1.18 cvs 1848: with the keyword <tt>EXCEPT</tt> and is composed of a sequence of exception 1.37 cvs 1849: declarations, separated by semicolons. Each declaration of an exception 1850: begins with the name of an element type or attribute followed by a colon. 1851: This indicates the element type or attribute to which the following 1852: exceptions apply. When the given element type name is a <a 1853: href="#sectd3285">mark pair</a>, and only in this case, the type name can be 1854: preceded by the keyword <tt>First</tt> or <tt>Second</tt>, to indicate if the 1855: exceptions which follow are associated with the first mark of the pair or the 1856: second. In the absence of this keyword, the first mark is used.</p> 1.30 cvs 1857: 1858: <p>When placed in an <a href="#sectc322">extension schema</a>, the keyword 1.18 cvs 1859: <tt>EXTERN</tt> indicates that the type name which follows is found in the 1.37 cvs 1860: principal schema (the schema being extended by the extension schema). The 1861: exceptions are indicated by a name. They are separated by semicolons.</p> 1.18 cvs 1862: <pre> [ 'EXCEPT' ExceptSeq ] 1.1 cvs 1863: 1.30 cvs 1864: ExceptSeq = Except ';' < Except ';' > . 1.1 cvs 1865: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr 1866: ':' ExcValSeq . 1867: ExcTypeOrAttr = ElemID / AttrID . 1.30 cvs 1868: ExcValSeq = ExcValue < ',' ExcValue > . 1.19 cvs 1869: ExcValue ='NoCut' / 'NoCreate' / 'NoHMove' / 1870: 'NoVMove' / 'NoHResize' / 'NoVResize' / 1871: 'NoMove' / 'NoResize' / 'MoveResize' / 1872: 'NewWidth' / 'NewHeight' / 'NewHPos' / 1873: 'NewVPos' / 'Invisible' / 1.28 cvs 1874: 'NoSelect' / 'NoSpellCheck' / 1.1 cvs 1875: 'Hidden' / 'ActiveRef' / 1876: 'ImportLine' / 'ImportParagraph' / 1877: 'NoPaginate' / 'ParagraphBreak' / 1.19 cvs 1878: 'PageBreak' / 'PageBreakAllowed' / 'PageBreakPlace' / 1879: 'PageBreakRepetition' / 'PageBreakRepBefore' / 1.9 cvs 1880: 'HighlightChildren' / 'ExtendedSelection' / 1.36 cvs 1881: 'SelectParent' / 'ClickableSurface' / 1.29 cvs 1882: 'ReturnCreateNL' / 'ReturnCreateWithin' / 1883: 'IsDraw' / 'IsTable' / 1.19 cvs 1884: 'IsRow' / 'IsColHead' / 'IsCell' / 1885: 'NewPercentWidth' / 'ColRef' / 'ColSpan' / 1886: 'RowSpan' / 'SaveDocument' / 'Shadow' .</pre> 1.30 cvs 1887: 1888: <p>The following are the available exceptions:</p> 1.18 cvs 1889: <dl> 1.30 cvs 1890: <dt><tt>NoCut</tt></dt> 1.37 cvs 1891: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1892: type to which this exception is applied cannot be deleted by the 1893: editor.</dd> 1894: <dt><tt>NoCreate</tt></dt> 1.37 cvs 1895: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1896: type to which this exception is applied cannot be created by ordinary 1.37 cvs 1897: commands for creating new elements. These elements are usually created 1.30 cvs 1898: by special actions associated with other exceptions.</dd> 1899: <dt><tt>NoHMove</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 moved horizontally 1902: with the mouse. Their children elements cannot be moved either.</dd> 1903: <dt><tt>NoVMove</tt></dt> 1.37 cvs 1904: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1905: type to which this exception is applied cannot be moved vertically with 1906: the mouse. Their children elements cannot be moved either.</dd> 1907: <dt><tt>NoMove</tt></dt> 1.37 cvs 1908: <dd>This exception can only be applied to element types. Elements of a 1909: type to which this exception is applied cannot be moved in any 1910: direction with the mouse. Their children elements cannot be moved 1911: either.</dd> 1.30 cvs 1912: <dt><tt>NoHResize</tt></dt> 1.37 cvs 1913: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1914: type to which this exception is applied cannot be resized horizontally 1915: with the mouse. Their children elements cannot be resized either.</dd> 1916: <dt><tt>NoVResize</tt></dt> 1.37 cvs 1917: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1918: type to which this exception is applied cannot be resized vertically 1919: with the mouse. Their children elements cannot be resized either.</dd> 1920: <dt><tt>NoResize</tt></dt> 1.37 cvs 1921: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1922: type to which this exception is applied cannot be resized in any 1.37 cvs 1923: direction with the mouse. Their children elements cannot be resized 1.30 cvs 1924: either.</dd> 1925: <dt><tt>MoveResize</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 can be moved and resized in any 1928: direction with the mouse, even if one of their ancestor element has an 1.37 cvs 1929: exception that prevents moving or resizing. Their children elements can 1.30 cvs 1930: also be resized or moved.</dd> 1931: <dt><tt>NewWidth</tt></dt> 1.37 cvs 1932: <dd>This exception can only be applied to numeric attributes. If the 1933: width of an element which has this attribute is modified with the 1934: mouse, the value of the new width will be assigned to the 1935: attribute.</dd> 1.30 cvs 1936: <dt><tt>NewHeight</tt></dt> 1.37 cvs 1937: <dd>This exception can only be applied to numeric attributes. If the 1.30 cvs 1938: height of an element which has this attribute is modified with the 1939: mouse, the value of the new height will be assigned to the 1940: attribute.</dd> 1941: <dt><tt>NewHPos</tt></dt> 1.37 cvs 1942: <dd>This exception can only be applied to numeric attributes. If the 1.30 cvs 1943: horizontal position of an element which has this attribute is modified 1944: with the mouse, the value of the new horizontal position will be 1945: assigned to the attribute.</dd> 1946: <dt><tt>NewVPos</tt></dt> 1.37 cvs 1947: <dd>This exception can only be applied to numeric attributes. If the 1.30 cvs 1948: vertical position of an element which has this attribute is modified 1949: with the mouse, the value of the new vertical position will be assigned 1950: to the attribute.</dd> 1951: <dt><tt>Invisible</tt></dt> 1952: <dd>This exception can only be applied to attributes, but can be applied 1.37 cvs 1953: to all attribute types. It indicates that the attribute must not be 1954: seen by the user and that its value must not be changed directly. This 1.30 cvs 1955: exception is usually used when another exception manipulates the value 1956: of an attribute.</dd> 1957: <dt><tt>NoSelect</tt></dt> 1.37 cvs 1958: <dd>This exception can only be applied to element types. Elements of a 1959: type to which this exception is applied cannot be selected directly 1.30 cvs 1960: with the mouse, but they can be selected by other methods provided by 1961: the editor.</dd> 1962: <dt>NoSpellCheck</dt> 1.37 cvs 1963: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1964: type to which this exception is applied are not taken into account by 1965: the spell checker.</dd> 1966: <dt><tt>Hidden</tt></dt> 1.37 cvs 1967: <dd>This exception can only be applied to element types. It indicates 1.30 cvs 1968: that elements of this type, although present in the document's 1.37 cvs 1969: structure, must not be shown to the user of the editor. In particular, 1.30 cvs 1970: the creation menus must not propose this type and the selection message 1971: must not pick it.</dd> 1972: <dt><tt>ActiveRef</tt></dt> 1973: <dd>This exception can only be applied to attributes of the reference 1.37 cvs 1974: type. It indicates that when the user of the editor makes a double 1.30 cvs 1975: click on an element which possesses a reference attribute having this 1976: exception, the element designated by the reference attribute will be 1977: selected.</dd> 1978: <dt><tt>ImportLine</tt></dt> 1.37 cvs 1979: <dd>This exception can only be applied to element types. It indicates 1.30 cvs 1980: that elements of this type should receive the content of imported text 1.37 cvs 1981: files. An element is created for each line of the imported file. A 1.30 cvs 1982: structure schema cannot contain several exceptions <tt>ImportLine</tt> 1983: and, if it contains one, it should not contain any exception 1984: <tt>ImportParagraph</tt>.</dd> 1985: <dt><tt>ImportParagraph</tt></dt> 1.37 cvs 1986: <dd>This exception can only be applied to element types. It indicates 1.30 cvs 1987: that elements of this type should receive the content of imported text 1.37 cvs 1988: files. An element is created for each paragraph of the imported file. A 1989: paragraph is a sequence of lines without any empty line. A structure 1.30 cvs 1990: schema cannot contain several exceptions <tt>ImportParagraph</tt> and, 1991: if it contains one, it should not contain any exception 1992: <tt>ImportLine</tt>.</dd> 1993: <dt><tt>NoPaginate</tt></dt> 1994: <dd>This exception can only be applied to the root element, i.e. the name 1.37 cvs 1995: that appear after the keyword <tt>STRUCTURE</tt> at the beginning of 1996: the structure schema. It indicates that the editor should not allow the 1.30 cvs 1997: user to paginate documents of that type.</dd> 1998: <dt><tt>ParagraphBreak</tt></dt> 1.37 cvs 1999: <dd>This exception can only be applied to element types. When the caret 2000: is within an element of a type to which this exception is applied, it 2001: is that element that will be split when the user hits the Return 2002: key.</dd> 1.30 cvs 2003: <dt><tt>ReturnCreateNL</tt></dt> 1.37 cvs 2004: <dd>This exception can only be applied to element types. When the caret 1.30 cvs 2005: is within an element of a type to which this exception is applied, the 2006: Return key simply inserts a New line character (code \212) at the 2007: current position. The Return key does not create a new element; it does 2008: not split the current element either.</dd> 2009: <dt><tt>ReturnCreateWithin</tt></dt> 1.37 cvs 2010: <dd>This exception can only be applied to element types. When the caret 1.30 cvs 2011: is within an element of a type to which this exception is applied, the 2012: Return key will create a new element within that element, not a sibling 2013: after that element.</dd> 2014: <dt><tt>HighlightChildren</tt></dt> 1.37 cvs 2015: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 2016: type to which this exception is applied are not highlighted themselves 1.32 cvs 2017: when they are selected in the main view, but all their children are 1.37 cvs 2018: highlighted instead. If children have this exception too, the process 2019: is applied recursively. Only the main view defined in the presentation 1.32 cvs 2020: schema is concerned. Tee exception is ignored for other views.</dd> 1.30 cvs 2021: <dt><tt>ExtendedSelection</tt></dt> 1.37 cvs 2022: <dd>This exception can only be applied to element types. The selection 1.30 cvs 2023: extension command (middle button of the mouse) only add the clicked 2024: element (if it has that exception) to the current selection, without 2025: selecting other elements between the current selection and the clicked 2026: element.</dd> 1.36 cvs 2027: <dt><code>SelectParent</code></dt> 2028: <dd>This exception can only be applied to element types. When the user 1.37 cvs 2029: clicks on an element of that type, the parent of the element is 2030: selected instead of the element itself.</dd> 1.36 cvs 2031: <dt><code>ClickableSurface</code></dt> 2032: <dd>This exception can only be applied to element types. When the user 1.37 cvs 2033: clicks within a child of an element of that type, this child is 2034: selected even if it is a graphic leaf that is not filled.</dd> 1.36 cvs 2035: <dt><code>IsDraw</code>, <code>IsTable</code>, <code>IsColHead</code>, 2036: <code>IsRow</code>, <code>IsCell</code></dt> 1.37 cvs 2037: <dd>These exceptions can only be applied to element types. Elements of a 1.30 cvs 2038: type to which these exceptions are applied are identified as Draws, 2039: Tables, Colheads, Rows or Cells and specific processing are applied to 2040: them.</dd> 1.36 cvs 2041: <dt><code>ColRef</code></dt> 1.30 cvs 2042: <dd>This exception can only be applied to attributes of the reference 2043: type. It indicates that this attribute refers to the column head (see 2044: exception IsColHead) which the element belongs to.</dd> 1.36 cvs 2045: <dt><code>ColSpan</code>, <code>RowSpan</code></dt> 1.31 cvs 2046: <dd>These exceptions can only be applied to numeric attributes of cells. 1.30 cvs 2047: They indicate that attribute values give how many columns or rows the 2048: element spans.</dd> 1.36 cvs 2049: <dt><code>Shadow</code></dt> 1.37 cvs 2050: <dd>This exception can only be applied to element types. Text of elements 1.30 cvs 2051: of a type to which this exception is applied are displayed and printed 2052: as a set of stars ('*').</dd> 1.18 cvs 2053: </dl> 1.30 cvs 2054: 1.18 cvs 2055: <blockquote class="example"> 1.30 cvs 2056: <p><strong>Example:</strong></p> 2057: 2058: <p>Consider a structure schema for object-style graphics which defines the 2059: Graphic_object element type with the associated Height and Weight numeric 1.37 cvs 2060: attributes. Suppose that we want documents of this class to have the 1.30 cvs 2061: following qualities:</p> 2062: <ul> 2063: <li>Whenever the width or height of an object is changed using the mouse, 2064: the new values are stored in the object's Width and Height 2065: attributes.</li> 2066: <li>The user should not be able to change the values of the Width and 2067: Height attributes via the Attributes menu of the Thot editor.</li> 2068: </ul> 2069: 2070: <p>The following exceptions will produce this effect.</p> 2071: <pre>STRUCT 1.1 cvs 2072: ... 1.5 cvs 2073: Graphics_object (ATTR Height = Integer; Width = Integer) 1.1 cvs 2074: = GRAPHICS with Height ?= 10, Width ?= 10; 2075: ... 2076: EXCEPT 2077: Height: NewHeight, Invisible; 1.18 cvs 2078: Width: NewWidth, Invisible;</pre> 2079: </blockquote> 2080: </div> 2081: </div> 1.1 cvs 2082: 1.18 cvs 2083: <div class="section"> 1.37 cvs 2084: <h2><a name="sectb33" id="sectb33">Some examples</a></h2> 1.1 cvs 2085: 1.30 cvs 2086: <p>In order to illustrate the principles of the document model and the syntax 2087: of the S language, this section presents two examples of structure schemas. 2088: One defines a class of documents, the other defines a class of objects.</p> 1.1 cvs 2089: 1.18 cvs 2090: <div class="subsection"> 1.37 cvs 2091: <h3><a name="sectc331" id="sectc331">A class of documents: articles</a></h3> 1.1 cvs 2092: 1.30 cvs 2093: <p>This example shows a possible structure for articles published in a 2094: journal. Text between braces is comments.</p> 1.18 cvs 2095: <pre>STRUCTURE Article; { This schema defines the Article class } 1.1 cvs 2096: DEFPRES ArticleP; { The default presentation schema is 2097: ArticleP } 2098: ATTR { Global attribute definitions } 2099: WordType = Definition, IndexWord, DocumentTitle; 2100: { A single global attribute is defined, with three values } 2101: STRUCT { Definition of the generic structure } 2102: Article = BEGIN { The Article class has an aggregate 2103: structure } 2104: Title = BEGIN { The title is an aggregate } 2105: French_title = 2106: Text WITH Language='Fran\347ais'; 2107: English_title = 2108: Text WITH Language='English'; 2109: END; 2110: Authors = 2111: LIST OF (Author 2112: (ATTR Author_type=principal,secondary) 2113: { The Author type has a local attribute } 2114: = BEGIN 2115: Author_name = Text; 2116: Info = Paragraphs ; 2117: { Paragraphs is defined later } 2118: Address = Text; 2119: END 2120: ); 2121: Keywords = Text; 2122: { The journal's editor introduces the article 2123: with a short introduction, in French and 2124: in English } 2125: Introduction = 2126: BEGIN 2127: French_intr = Paragraphs WITH 2128: Language='Fran\347ais'; 2129: English_intr = Paragraphs WITH 2130: Language='English'; 2131: END; 2132: Body = Sections; { Sections are defined later } 2133: { Appendixes are only created on demand } 2134: ? Appendices = 2135: LIST OF (Appendix = 2136: BEGIN 2137: Appendix_Title = Text; 2138: Appendix_Contents = Paragraphs; 2139: END 2140: ); 1.37 cvs 2141: ? Figures = LIST OF (Figure); 2142: ? Bibliography = LIST OF (Biblio_citation); 2143: ? Notes = LIST OF (Note); 1.1 cvs 2144: END; { End of the Article aggregate } 2145: 2146: Sections = LIST [2..*] OF ( 2147: Section = { At least 2 sections } 2148: BEGIN 2149: Section_title = Text; 2150: Section_contents = 2151: BEGIN 2152: Paragraphs; 2153: Sections; { Sections at a lower level } 2154: END; 2155: END 2156: ); 2157: 2158: Paragraphs = LIST OF (Paragraph = CASE OF 2159: Enumeration = 2160: LIST [2..*] OF 2161: (Item = Paragraphs); 2162: Isolated_formula = Formula; 2163: LIST OF (UNIT); 2164: END 2165: ); 2166: 2167: Figure = BEGIN 1.5 cvs 2168: Figure_caption = Text; 1.1 cvs 2169: Illustration = NATURE; 2170: END; 2171: 2172: Biblio_citation = CASE OF 2173: Ref_Article = 2174: BEGIN 2175: Authors_Bib = Text; 2176: Article_Title = Text; 2177: Journal = Text; 2178: Page_Numbers = Text; 2179: Date = Text; 2180: END; 2181: Ref_Livre = 2182: BEGIN 2183: Authors_Bib; { Defined above } 2184: Book_Title = Text; 2185: Editor = Text; 2186: Date; { Defined above } 2187: END; 2188: END; 2189: 2190: Note = Paragraphs - (Ref_note); 2191: 2192: UNITS { Elements which can be used in objects } 2193: 2194: Ref_note = REFERENCE (Note); 2195: Ref_biblio = REFERENCE (Biblio_citation); 2196: Ref_figure = REFERENCE (Figure); 2197: Ref_formula = REFERENCE (Isolated_formula); 2198: 2199: EXPORT { Skeleton elements } 2200: 2201: Title, 1.5 cvs 2202: Figure with Figure_caption, 1.1 cvs 2203: Section With Section_title; 2204: 1.18 cvs 2205: END { End of the structure schema }</pre> 1.30 cvs 2206: 2207: <p>This schema is very complete since it defines both paragraphs and 1.37 cvs 2208: bibliographic citations. These element types could just as well be defined in 2209: other structure schemas, as is the case with the <tt>Formula</tt> class. All 2210: sorts of other elements can be inserted into an article, since a paragraph 2211: can contain any type of unit. Similarly, figures can be any class of document 2212: or object that the user chooses.</p> 2213: 2214: <p>Generally, an article doesn't contain appendices, but it is possible to 2215: add them on explicit request: this is the effect of the question mark before 2216: the word Appendices.</p> 1.30 cvs 2217: 1.37 cvs 2218: <p>Various types of cross-references can be put in paragraphs. They can also 1.30 cvs 2219: be placed the objects which are part of the article, since the 2220: cross-references are defined as units (<tt>UNITS</tt>).</p> 2221: 2222: <p>There is a single restriction to prevent the creation of Ref_note elements 1.18 cvs 2223: within notes.</p> 1.30 cvs 2224: 2225: <p>It is worth noting that the S language permits the definition of recursive 1.37 cvs 2226: structures like sections: a section can contain other sections (which are 2227: thus at the next lower level of the document tree). Paragraphs are also 2228: recursive elements, since a paragraph can contain an enumeration in which 2229: each element (<tt>Item</tt>) is composed of paragraphs.</p> 1.18 cvs 2230: </div> 1.1 cvs 2231: 1.18 cvs 2232: <div class="subsection"> 1.37 cvs 2233: <h3><a name="sectc332" id="sectc332">A class of objects: mathematical 2234: formulas</a></h3> 1.1 cvs 2235: 1.30 cvs 2236: <p>The example below defines the <tt>Formula</tt> class which is used in 1.37 cvs 2237: Article documents. This class represents mathematical formulas with a rather 1.30 cvs 2238: simple structure, but sufficient to produce a correct rendition on the screen 1.37 cvs 2239: or printer. To support more elaborate operations (formal or numeric 2240: calculations), a finer structure should be defined. This class doesn't use 2241: any other class and doesn't define any units.</p> 1.18 cvs 2242: <pre>STRUCTURE Formula; 1.1 cvs 2243: DEFPRES FormulaP; 2244: 2245: ATTR 2246: String_type = Function_name, Variable_name; 2247: 2248: STRUCT 2249: Formula = Expression; 2250: Expression = LIST OF (Construction); 2251: Construction = CASE OF 2252: TEXT; { Simple character string } 2253: Index = Expression; 2254: Exponent = Expression; 2255: Fraction = 2256: BEGIN 1.6 cvs 2257: Numerator = Expression; 1.1 cvs 2258: Denominator = Expression; 2259: END; 2260: Root = 2261: BEGIN 2262: ? Order = TEXT; 2263: Root_Contents = Expression; 2264: END; 2265: Integral = 2266: BEGIN 2267: Integration_Symbol = SYMBOL; 2268: Lower_Bound = Expression; 2269: Upper_Bound = Expression; 2270: END; 2271: Triple = 2272: BEGIN 2273: Princ_Expression = Expression; 2274: Lower_Expression = Expression; 2275: Upper_Expression = Expression; 2276: END; 2277: Column = LIST [2..*] OF 2278: (Element = Expression); 2279: Parentheses_Block = 2280: BEGIN 2281: Opening = SYMBOL; 2282: Contents = Expression; 2283: Closing = SYMBOL; 2284: END; 2285: END; { End of Choice Constructor } 1.18 cvs 2286: END { End of Structure Schema }</pre> 1.30 cvs 2287: 2288: <p>This schema defines a single global attribute which allows functions and 1.37 cvs 2289: variables to be distinguished. In the presentation schema, this attribute can 1.1 cvs 2290: be used to choose between roman (for functions) and italic characters (for 1.18 cvs 2291: variables).</p> 1.30 cvs 2292: 1.37 cvs 2293: <p>A formula's structure is that of a mathematical expression, which is 2294: itself a sequence of mathematical constructions. A mathematical construction 2295: can be either a simple character string, an index, an exponent, a fraction, a 2296: root, etc. Each of these mathematical constructions has a sensible structure 2297: which generally includes one or more expressions, thus making the formula 2298: class's structure definition recursive.</p> 1.30 cvs 2299: 2300: <p>In most cases, the roots which appear in the formulas are square roots and 1.37 cvs 2301: their order (2) is not specified. This is why the Order component is marked 2302: optional by a question mark. When explicitly requested, it is possible to add 1.18 cvs 2303: an order to a root, for example for cube roots (order = 3).</p> 1.30 cvs 2304: 2305: <p>An integral is formed by an integration symbol, chosen by the user (simple 1.37 cvs 2306: integral, double, curvilinear, etc.), and two bounds. A more fine-grained 1.1 cvs 2307: schema would add components for the integrand and the integration variable. 1.37 cvs 2308: Similarly, the Block_Parentheses construction leaves the choice of opening 2309: and closing symbols to the user. They can be brackets, braces, parentheses, 1.18 cvs 2310: etc.</p> 2311: </div> 2312: </div> 1.37 cvs 2313: <hr /> 1.18 cvs 2314: </div> 1.1 cvs 2315: 1.18 cvs 2316: <div class="chapter"> 1.37 cvs 2317: <h1><a name="sect4" id="sect4">The P Language</a></h1> 1.1 cvs 2318: 1.18 cvs 2319: <div class="section"> 1.37 cvs 2320: <h2><a name="sectb41" id="sectb41">Document presentation</a></h2> 1.1 cvs 2321: 1.30 cvs 2322: <p>Because of the model adopted for Thot, the presentation of documents is 1.37 cvs 2323: clearly separated from their structure and content. After having presented 1.1 cvs 2324: the logical structure of documents, we now detail the principles implemented 1.37 cvs 2325: for their presentation. The concept of <em>presentation</em> encompasses what 2326: is often called the page layout, the composition, or the document style. It 1.18 cvs 2327: is the set of operations which display the document on the screen or print it 1.37 cvs 2328: on paper. Like logical structure, document presentation is defined 1.18 cvs 2329: generically with the help of a language, called P.</p> 1.1 cvs 2330: 1.18 cvs 2331: <div class="subsection"> 1.37 cvs 2332: <h3><a name="sectc411" id="sectc411">Two levels of presentation</a></h3> 1.1 cvs 2333: 1.30 cvs 2334: <p>The link between structure and presentation is clear: the logical 2335: organization of a document is used to carry out its presentation, since the 2336: purpose of the presentation is to make evident the organization of the 1.37 cvs 2337: document. But the presentation is equally dependent on the device used to 1.30 cvs 2338: render the document. Certain presentation effects, notably changes of font or 1.37 cvs 2339: character set, cannot be performed on all printers or on all screens. This is 1.30 cvs 2340: why Thot uses a two-level approach, where the presentation is first described 2341: in abstract terms, without taking into account each particular device, and 2342: then the presentation is realized within the constraints of a given 2343: device.</p> 2344: 2345: <p>Thus, presentation is only described as a function of the structure of the 1.37 cvs 2346: documents and the image that would be produced on an idealized device. For 1.1 cvs 2347: this reason, presentation descriptions do not refer to any device 1.18 cvs 2348: characteristics: they describe <em>abstract presentations</em> which can be 2349: concretized on different devices.</p> 1.30 cvs 2350: 2351: <p>A presentation description also defines a <em>generic presentation</em>, 2352: since it describes the appearance of a class of documents or objects. This 2353: generic presentation must also be applied to document and object instances, 2354: each conforming to its generic logical structure, but with all the allowances 2355: that were called to mind above: missing elements, constructed elements with 2356: other logical structures, etc.</p> 2357: 2358: <p>In order to preserve the homogeneity between documents and objects, 1.1 cvs 2359: presentation is described with a single set of tools which support the layout 2360: of a large document as well as the composition of objects like a graphical 1.37 cvs 2361: figure or mathematical formula. This unity of presentation description tools 1.1 cvs 2362: contrasts with the traditional approach, which focuses more on documents than 2363: objects and thus is based on the usual typographic conventions, such as the 2364: placement of margins, indentations, vertical spaces, line lengths, 1.18 cvs 2365: justification, font changes, etc.</p> 2366: </div> 1.1 cvs 2367: 1.18 cvs 2368: <div class="subsection"> 1.37 cvs 2369: <h3><a name="sectc412" id="sectc412">Boxes</a></h3> 1.1 cvs 2370: 1.37 cvs 2371: <p>To assure the homogeneity of tools, all presentation in Thot, for 2372: documents as well as for the objects which they contain, is based on the 2373: notion of the <em>box</em>, such as was implemented in 2374: T<sub><big>E</big></sub>X.</p> 1.30 cvs 2375: 1.37 cvs 2376: <p>Corresponding to each element of the document is a box, which is the 1.1 cvs 2377: rectangle enclosing the element on the display device (screen or sheet of 1.37 cvs 2378: paper); the outline of this rectangle is not visible, except when a <a 2379: href="#sectc4230a"><tt>ShowBox</tt> rule</a> applies to the element. The 2380: sides of the box are parallel to the sides of the screen or the sheet of 2381: paper. By way of example, a box is associated with a character string, a line 2382: of text, a page, a paragraph, a title, a mathematical formula, or a table 2383: cell.</p> 1.30 cvs 2384: 2385: <p>Whatever element it corresponds to, each box possesses four sides and four 1.18 cvs 2386: axes, which we designate as follows (<a href="#boxes">see figure</a>):</p> 2387: <dl> 1.30 cvs 2388: <dt><tt>Top</tt></dt> 2389: <dd>the upper side,</dd> 2390: <dt><tt>Bottom</tt></dt> 2391: <dd>the lower side,</dd> 2392: <dt><tt>Left</tt></dt> 2393: <dd>the left side,</dd> 2394: <dt><tt>Right</tt></dt> 2395: <dd>the right side,</dd> 2396: <dt><tt>VMiddle</tt></dt> 2397: <dd>the vertical axis passing through the center of the box,</dd> 2398: <dt><tt>HMiddle</tt></dt> 2399: <dd>the horizontal axis passing through the center of the box,</dd> 2400: <dt><tt>VRef</tt></dt> 2401: <dd>the vertical reference axis,</dd> 2402: <dt><tt>HRef</tt></dt> 2403: <dd>the horizontal reference axis.</dd> 1.18 cvs 2404: </dl> 2405: 2406: <div class="figure"> 1.37 cvs 2407: <hr /> 1.18 cvs 2408: <pre> Left VRef VMiddle Right 1.1 cvs 2409: : : 2410: Top ----------------------------- 2411: | : : | 2412: | : : | 2413: | : : | 2414: | : : | 2415: | : : | 2416: HMiddle ..|...........................|.. 2417: | : : | 2418: | : : | 2419: HRef ..|...........................|.. 2420: | : : | 2421: | : : | 2422: Bottom ----------------------------- 1.18 cvs 2423: : :</pre> 1.30 cvs 2424: 1.37 cvs 2425: <p align="center"><em><a name="boxes" id="boxes">The sides and axes of 1.30 cvs 2426: boxes</a><em></em></em></p> 1.37 cvs 2427: <hr /> 1.30 cvs 2428: </div> 1.19 cvs 2429: 1.37 cvs 2430: <p>The principal role of boxes is to set the extent and position of the 2431: images of the different elements of a document with respect to each other on 2432: the reproduction device. This is done by defining relations between the boxes 2433: of different elements which give relative extents and positions to these 1.18 cvs 2434: boxes.</p> 1.30 cvs 2435: 2436: <p>There are three types of boxes:</p> 1.18 cvs 2437: <ul> 1.30 cvs 2438: <li>boxes corresponding to structural elements of the document,</li> 2439: <li>presentation boxes,</li> 2440: <li>page layout boxes.</li> 1.18 cvs 2441: </ul> 1.30 cvs 2442: 1.37 cvs 2443: <p><strong>Boxes corresponding to structural elements of the 2444: document</strong> are those which linked to each of the elements (base or 2445: structured) of the logical structure of the document. Such a box contains all 2446: the contents of the element to which it corresponds (there is an exception: 2447: see <a href="#sectc4220">rules <tt>VertOverflow</tt> and 2448: <tt>HorizOverflow</tt></a>). These boxes form a tree-like structure, 2449: identical to that of the structural elements to which they correspond. This 2450: tree expresses the inclusion relationships between the boxes: a box includes 2451: all the boxes of its subtree. On the other hand, there are no predefined 2452: rules for the relative positions of the included boxes. If they are at the 2453: same level, they can overlap, be contiguous, or be disjoint. The rules 2454: expressed in the generic presentation specify their relative positions.</p> 1.30 cvs 2455: 2456: <p><strong>Presentation boxes</strong> represent elements which are not found 1.37 cvs 2457: in the logical structure of the document but which are added to meet the 2458: needs of presentation. These boxes are linked to the elements of the logical 1.30 cvs 2459: structure that are best suited to bringing them out. For example, they are 2460: used to add the character string ``Summary:'' before the summary in the 2461: presentation of a report or to represent the fraction bar in a formula, or 1.37 cvs 2462: also to make the title of a field in a form appear. These elements have no 1.30 cvs 2463: role in the logical structure of the document: the presence of a Summary 2464: element in the document does not require the creation of another structural 1.37 cvs 2465: object to hold the word ``Summary''. Similarly, if a Fraction element 2466: contains both a Numerator element and a Denominator element, the fraction bar 2467: has no purpose structurally. On the other hand, these elements of the 2468: presentation are important for the reader of the reproduced document or for 2469: the user of an editor. This is why they must appear in the document's image. 2470: It is the generic presentation which specifies the presentation boxes to add 2471: by indicating their content (a base element for which the value is specified) 2472: and the position that they must take in the tree of boxes. During editing, 2473: these boxes cannot be modified by the user.</p> 2474: 2475: <p><strong>Page layout boxes</strong> are boxes created implicitly by the 2476: page layout rules. These rules indicate how the contents of a structured 2477: element must be broken into lines and pages. In contrast to presentation 2478: boxes, these line and page boxes do not depend on the logical structure of 2479: the document, but rather on the physical constraints of the output devices: 2480: character size, height and width of the window on the screen or of the sheet 2481: of paper.</p> 1.18 cvs 2482: </div> 1.1 cvs 2483: 1.18 cvs 2484: <div class="subsection"> 1.37 cvs 2485: <h3><a name="sectc413" id="sectc413">Views and visibility</a></h3> 1.1 cvs 2486: 1.30 cvs 2487: <p>One of the operations that one might wish to perform on a document is to 1.37 cvs 2488: view it is different ways. For this reason, it is possible to define several 1.18 cvs 2489: <em>views</em> for the same document, or better yet, for all documents of the 1.37 cvs 2490: same class. A view is not a different presentation of the document, but 1.1 cvs 2491: rather a filter which only allows the display of certain parts of the 1.37 cvs 2492: document. For example, it might be desirable to see only the titles of 1.1 cvs 2493: chapters and sections in order to be able to move rapidly through the 1.37 cvs 2494: document. Such a view could be called a ``table of contents''. It might also 1.1 cvs 2495: be desirable to see only the mathematical formulas of a document in order to 1.37 cvs 2496: avoid being distracted by the non-mathematical aspects of the document. A 1.18 cvs 2497: ``mathematics'' view could provide this service.</p> 1.30 cvs 2498: 2499: <p>Views, like presentation, are based on the generic logical structure. Each 1.1 cvs 2500: document class, and each generic presentation, can be provided with views 1.37 cvs 2501: which are particularly useful for that class or presentation. For each view, 1.18 cvs 2502: the <em>visibility</em> of elements is defined, indicated whether or not the 1.37 cvs 2503: elements must be presented to the user. The visibility is calculated as a 1.1 cvs 2504: function of the type of the elements or their hierarchical position in the 1.37 cvs 2505: structure of the document. Thus, for a table of contents, all the ``Chapter 2506: Title'' and ``Section Title'' elements are made visible. However, the 1.1 cvs 2507: hierarchical level could be used to make the section titles invisible below a 1.37 cvs 2508: certain threshold level. By varying this threshold, the granularity of the 2509: view can be varied. In the ``mathematics'' view, only Formula elements would 1.18 cvs 2510: be made visible, no matter what their hierarchical level.</p> 1.30 cvs 2511: 2512: <p>Because views are especially useful for producing a synthetic image of the 1.1 cvs 2513: document, it is necessary to adapt the presentation of the elements to the 1.37 cvs 2514: view in which they appear. For example, it is inappropriate to have a page 2515: break before every chapter title in the table of contents. Thus, generic 1.1 cvs 2516: presentations take into account the possible views and permit each element 1.18 cvs 2517: type's presentation to vary according the view in which its image appears.</p> 2518: </div> 1.1 cvs 2519: 1.18 cvs 2520: <div class="subsection"> 1.37 cvs 2521: <h3><a name="sectc414" id="sectc414">Pages</a></h3> 1.1 cvs 2522: 1.30 cvs 2523: <p>Presentation schemas can be defined which display the document as a long 1.37 cvs 2524: scroll, without page breaks. This type of schema is particularly well-suited 1.1 cvs 2525: to the initial phase of work on a document, where jumps from page to page 1.37 cvs 2526: would hinder composing and reading the document on a screen. But, once the 2527: document is written, it may be desirable to display the document on the 2528: screen in the same manner in which it will be printed. So, the presentation 2529: schema must define pages.</p> 2530: 2531: <p>The P language permits the specification of the dimensions of pages as 2532: well as their composition. It is possible to generate running titles, page 2533: numbers, zones at the bottom of the page for notes, etc. The editor follows 1.30 cvs 2534: this model and inserts page break marks in the document which are used during 2535: printing, insuring that the pages on paper are the same as on the screen.</p> 2536: 2537: <p>Once a document has been edited with a presentation schema defining pages, 1.37 cvs 2538: it contains page marks. But it is always possible to edit the document using 2539: a schema without pages. In this case, the page marks are simply ignored by 2540: the editor. They are considered again as soon as a schema with pages is used. 1.18 cvs 2541: Thus, the user is free to choose between schemas with and without pages.</p> 1.30 cvs 2542: 2543: <p>Thot treats the page break, rather than the page itself, as a box. This 2544: page break box contains all the elements of one page's footer, a rule marking 1.37 cvs 2545: the edge of this page, and all the elements of the next page's header. The 2546: elements of the header and footer can be running titles, page number, notes, 2547: etc. All these elements, as well as their content and graphical appearance, 2548: are defined by the generic presentation.</p> 1.18 cvs 2549: </div> 1.1 cvs 2550: 1.18 cvs 2551: <div class="subsection"> 1.37 cvs 2552: <h3><a name="sectc415" id="sectc415">Numbering</a></h3> 1.1 cvs 2553: 1.30 cvs 2554: <p>Many elements are numbered in documents: pages, chapters, sections, 2555: formulas, theorems, notes, figures, bibliographic references, exercises, 1.37 cvs 2556: examples, lemmas, etc. Because Thot has a notion of logical structure, all of 1.30 cvs 2557: these numbers (with the exception of pages) are redundant with information 1.37 cvs 2558: implicit in the logical structure of the document. Such numbers are simply a 2559: way to make the structure of the document more visible. So, they are part of 1.30 cvs 2560: the document's presentation and are calculated by the editor from the logical 1.37 cvs 2561: structure. The structure does not contain numbers as such; it only defines 1.1 cvs 2562: relative structural positions between elements, which serve as ordering 1.18 cvs 2563: relations on these elements.</p> 1.30 cvs 2564: 2565: <p>If the structure schema defines the body of a document as a sequence of at 1.18 cvs 2566: least two chapters:</p> 2567: <pre>Body = LIST [2..*] OF Chapter;</pre> 1.30 cvs 2568: 2569: <p>the sequence defined by the list constructor is ordered and each chapter 1.37 cvs 2570: can be assigned a number based on its rank in the Body list. Therefore, all 2571: elements contained in lists a the structure of a document can be numbered, 2572: but they are not the only ones. The tree structure induced by the aggregate, 1.18 cvs 2573: list, and choice constructors (excluding references) defines a total order on 1.37 cvs 2574: the elements of the document's primary structure. So, it is possible to 1.18 cvs 2575: define a numbering which uses this order, filtering elements according to 2576: their type so that only certain element types are taken into account in the 1.37 cvs 2577: numbering. In this way, it possible to number all the theorems and lemmas of 1.18 cvs 2578: a chapter in the same sequence of numbers, even when they are not part of the 2579: same list constructor and appear at different levels of the document's tree. 2580: By changing the filter, they can be numbered separately: one sequence of 2581: numbers for theorems, another for the lemmas.</p> 1.30 cvs 2582: 2583: <p>Since they are calculated from the document's logical structure and only 2584: for the needs of the presentation, numbers are presentation elements, 2585: described by presentation boxes, just like the fraction bar or the word 1.37 cvs 2586: ``Summary''. Nevertheless, numbers differ from these other boxes because 2587: their content varies from instance to instance, even though they are of the 2588: same type, whereas all fraction bars are horizontal lines and the same word 1.30 cvs 2589: ``Summary'' appears at the head of every document's summary.</p> 1.18 cvs 2590: </div> 1.1 cvs 2591: 1.18 cvs 2592: <div class="subsection"> 1.37 cvs 2593: <h3><a name="sectc416" id="sectc416">Presentation properties</a></h3> 1.1 cvs 2594: 1.34 cvs 2595: <p>The principal properties which determine document presentation are the 1.18 cvs 2596: <em>positions</em> and <em>dimensions</em> of boxes, the <em>font</em>, the 2597: <em>style</em>, the <em>size</em>, the <em>underlining</em> and the 1.37 cvs 2598: <em>color</em> of their content. From these properties, and some others of 1.34 cvs 2599: less importance, it is possible to represent the usual typographic properties 1.37 cvs 2600: for the textual parts of the document. These same properties can be used to 1.1 cvs 2601: describe the geometry of the non-textual elements, even though they are 1.18 cvs 2602: two-dimensional elements unlike the text, which is linear.</p> 1.30 cvs 2603: 1.37 cvs 2604: <p>As we have already seen, the positions of the boxes always respect the 1.30 cvs 2605: rule of enclosure: a box in the tree encloses all the boxes of the next lower 1.37 cvs 2606: level which are attached to it. The positional properties permit the 1.30 cvs 2607: specification of the position of each box in relation to the enclosing box or 1.37 cvs 2608: to its sibling boxes (boxes directly attached to the same enclosing box in 2609: the tree of boxes).</p> 1.30 cvs 2610: 1.37 cvs 2611: <p>The presentation properties also provide control over the dimensions of 2612: the boxes. The dimensions of a box can depend either on its content or on its 1.1 cvs 2613: context (its sibling boxes and the enclosing box). Each dimension (height or 1.18 cvs 2614: width) can be defined independently of the other.</p> 1.30 cvs 2615: 1.34 cvs 2616: <p>Because of the position and dimension properties, it is possible to do the 1.1 cvs 2617: same things that are normally done in typography by changing margins, line 1.37 cvs 2618: lengths, and vertical or horizontal skips. This approach can also align or 1.18 cvs 2619: center elements and groups of elements.</p> 1.30 cvs 2620: 1.34 cvs 2621: <p>In contrast to the position and dimension properties, the font, style, 1.30 cvs 2622: size, underlining, and color do not concern the box itself (the rectangle 1.37 cvs 2623: delimiting the element), but its content. These properties indicate the 2624: typographic attributes which must be applied to the text contained in the 2625: box, and by extension, to all base elements.</p> 1.30 cvs 2626: 1.34 cvs 2627: <p>For text, the font property is used to change the family of characters 1.1 cvs 2628: (Times, Helvetica, Courier, etc.); the style is used to obtain italic or 1.37 cvs 2629: roman, bold or light characters; the size determines the point size of the 1.1 cvs 2630: characters; underlining defines the type and thickness of the lines drawn 1.18 cvs 2631: above, below, or through the characters.</p> 1.30 cvs 2632: 1.34 cvs 2633: <p>For graphics, the line style property can be either solid, dotted, or 2634: dashed; the line thickness property controls the width of the lines; the fill 2635: pattern property determines how closed geometric figures must be filled.</p> 1.30 cvs 2636: 1.34 cvs 2637: <p>While some of the properties which determine the appearance of a box's 1.1 cvs 2638: contents make sense only for one content type (text or graphic), other 1.34 cvs 2639: properties apply to all content types: these are the color properties. These 1.18 cvs 2640: indicate the color of lines and the background color.</p> 2641: </div> 2642: </div> 1.1 cvs 2643: 1.18 cvs 2644: <div class="section"> 1.37 cvs 2645: <h2><a name="sectb42" id="sectb42">Presentation description language</a></h2> 1.30 cvs 2646: 1.34 cvs 2647: <p>A generic presentation defines the values of presentation properties (or 1.37 cvs 2648: the way to calculate those values) for a generic structure, or more 2649: precisely, for all the element types and all the global and local attributes 2650: defined in that generic structure. This definition of the presentation 2651: properties is made with the P language. A program written in this language, 2652: that is a generic presentation expressed in P, is call a <em>presentation 2653: schema</em>. This section describes the syntax and semantics of the language, 2654: using the same <a href="#sectc321">meta-language</a> as was used for the 2655: definition of the S language.</p> 2656: 2657: <p>Recall that it is possible to write many different presentation schemas 2658: for the same class of documents or objects. This allows users to choose for a 2659: document the graphical appearance which best suits their type of work or 1.18 cvs 2660: their personal taste.</p> 1.1 cvs 2661: 1.18 cvs 2662: <div class="subsection"> 1.37 cvs 2663: <h3><a name="sectc421" id="sectc421">The organization of a presentation 2664: schema</a></h3> 1.1 cvs 2665: 1.30 cvs 2666: <p>A presentation schema begins with the word <tt>PRESENTATION</tt> and ends 1.37 cvs 2667: with the word <tt>END</tt>. The word <tt>PRESENTATION</tt> is followed by the 2668: name of the generic structure to which the presentation will be applied. This 1.30 cvs 2669: name must be the same as that which follows the keyword <tt>STRUCTURE</tt> in 2670: the structure schema associated with the presentation schema.</p> 2671: 1.37 cvs 2672: <p>After this declaration of the name of the structure, the following 2673: sections appear (in order):</p> 1.18 cvs 2674: <ul> 1.37 cvs 2675: <li>Declarations of 1.30 cvs 2676: <ul> 2677: <li>all views,</li> 2678: <li>printed views,</li> 2679: <li>counters,</li> 2680: <li>presentation constants,</li> 2681: <li>variables,</li> 2682: </ul> 2683: </li> 2684: <li>default presentation rules,</li> 2685: <li>presentation box and page layout box definitions,</li> 2686: <li>presentation rules for structured elements,</li> 2687: <li>presentation rules for attributes,</li> 2688: <li>rules for transmitting values to attributes of included documents.</li> 1.18 cvs 2689: </ul> 1.30 cvs 2690: 2691: <p>Each of these sections is introduced by a keyword which is followed by a 1.37 cvs 2692: sequence of declarations. Every section is optional.</p> 1.18 cvs 2693: <pre> SchemaPres ='PRESENTATION' ElemID ';' 1.1 cvs 2694: [ 'VIEWS' ViewSeq ] 2695: [ 'PRINT' PrintViewSeq ] 2696: [ 'COUNTERS' CounterSeq ] 2697: [ 'CONST' ConstSeq ] 2698: [ 'VAR' VarSeq ] 2699: [ 'DEFAULT' ViewRuleSeq ] 2700: [ 'BOXES' BoxSeq ] 2701: [ 'RULES' PresentSeq ] 2702: [ 'ATTRIBUTES' PresAttrSeq ] 2703: [ 'TRANSMIT' TransmitSeq ] 2704: 'END' . 1.18 cvs 2705: ElemID = NAME .</pre> 2706: </div> 1.1 cvs 2707: 1.18 cvs 2708: <div class="subsection"> 1.37 cvs 2709: <h3><a name="sectc422" id="sectc422">Views</a></h3> 1.1 cvs 2710: 1.37 cvs 2711: <p>Each of the possible views must be declared in the presentation schema. As 2712: has <a href="#views">already been described</a>, the presentation rules for 2713: an element type can vary according to the view in which the element appears. 2714: The name of the view is used to designate the view to which the presentation 2715: rules apply (see the <a href="#inkeyword"><tt>IN</tt> instruction</a>). The 1.1 cvs 2716: definition of the view's contents are dispersed throughout the presentation 1.37 cvs 2717: rules attached to the different element types and attributes. The 1.18 cvs 2718: <tt>VIEWS</tt> section is simply a sequence of view names separated by commas 2719: and terminated by a semi-colon.</p> 1.30 cvs 2720: 2721: <p>One of the view names (and only one) can be followed by the keyword 1.37 cvs 2722: <tt>EXPORT</tt>. This keyword identifies the view which presents the members 2723: of the document class in <a href="#sectc3213">skeleton form</a>. The 2724: graphical appearance and the content of this view is defined just as with 1.18 cvs 2725: other views, but it is useless to specify presentation rules concerning this 2726: view for the elements which are not loaded in the skeleton form.</p> 1.30 cvs 2727: 2728: <p>It is not necessary to declare any views; in this case there is a single 1.37 cvs 2729: unnamed view. If many views are declared, the first view listed is considered 2730: the principal view. The principal view is the one to which all rules that are 1.18 cvs 2731: not preceded by an indication of a view will apply (see the <a 2732: href="#inkeyword">instruction <tt>IN</tt></a>).</p> 1.30 cvs 2733: 2734: <p>The principal view is the the one which the editor presents on the screen 1.37 cvs 2735: when the user asks to create or edit a document. Thus, it makes sense to put 2736: the most frequently used view at the head of the list. But if the structure 1.18 cvs 2737: schema contains <a href="#sectc3213">skeleton elements</a> and is loaded in 2738: its skeleton form, the view whose name is followed by the keyword 2739: <tt>EXPORT</tt> will be opened and no other views can be opened.</p> 2740: <pre> 'VIEWS' ViewSeq 1.1 cvs 2741: ViewSeq = ViewDeclaration 1.30 cvs 2742: < ',' ViewDeclaration > ';' . 1.1 cvs 2743: ViewDeclaration = ViewID [ 'EXPORT' ] . 1.18 cvs 2744: ViewID = NAME .</pre> 1.30 cvs 2745: 1.18 cvs 2746: <blockquote class="example"> 1.30 cvs 2747: <p><strong>Example:</strong></p> 2748: 2749: <p>When editing a report, it might be useful have views of the table of 1.37 cvs 2750: contents and of the mathematical formulas, in addition to the principal 2751: view which shows the document in its entirety. To achieve this, a 2752: presentation schema for the Report class would have the following 2753: <tt>VIEWS</tt> section:</p> 1.30 cvs 2754: <pre>VIEWS 1.18 cvs 2755: Full_text, Table_of_contents, Formulas;</pre> 1.30 cvs 2756: 2757: <p>The contents of these views are specified in the presentation rules of 2758: the schema.</p> 1.18 cvs 2759: </blockquote> 2760: </div> 1.1 cvs 2761: 1.18 cvs 2762: <div class="subsection"> 1.37 cvs 2763: <h3><a name="sectc423" id="sectc423">Print Views</a></h3> 1.1 cvs 2764: 1.37 cvs 2765: <p>When editing a document, each view specified by the <tt>VIEWS</tt> 2766: instruction is presented in a different window.</p> 1.30 cvs 2767: 2768: <p>When printing a document, it is possible to print any number of views, 1.37 cvs 2769: chosen from among all the views which the editor can display. Print views, as 2770: well as the order in which they must be printed, are indicated by the 2771: <tt>PRINT</tt> instruction. It appears after the <tt>VIEWS</tt> instruction 2772: and is formed of the keyword <tt>PRINT</tt> followed by the ordered list of 2773: print view names. The print view names are separated by commas and followed 2774: by a semi-colon. A print view name is a view name declared in the 2775: <tt>VIEWS</tt> instruction.</p> 1.18 cvs 2776: <pre> 'PRINT' PrintViewSeq 1.30 cvs 2777: PrintViewSeq = PrintView < ',' PrintView > ';' . 1.37 cvs 2778: PrintView = ViewID .</pre> 1.30 cvs 2779: 2780: <p>If the <tt>PRINT</tt> instruction is absent, the printing program will 2781: print only the principal view (the first view specified by the <tt>VIEWS</tt> 1.18 cvs 2782: instruction or the single, unnamed view when there is no <tt>VIEWS</tt> 2783: instruction).</p> 1.30 cvs 2784: 1.18 cvs 2785: <blockquote class="example"> 1.30 cvs 2786: <p><strong>Example:</strong></p> 2787: 2788: <p>Consider a Report presentation using the view declarations from the 1.37 cvs 2789: preceding example. Suppose we want to print the full text and table of 1.30 cvs 2790: contents views, but not the Formulas view, which is only useful when 1.37 cvs 2791: editing. A sensible printing order would be to print the full text followed 2792: by the table of contents. To obtain this result when printing, the 2793: presentation schema would say:</p> 1.30 cvs 2794: <pre>PRINT 1.37 cvs 2795: Full_text, Table_of_contents;</pre> 1.18 cvs 2796: </blockquote> 2797: </div> 2798: 2799: <div class="subsection"> 1.37 cvs 2800: <h3><a name="sectc424" id="sectc424">Counters</a></h3> 1.18 cvs 2801: 1.30 cvs 2802: <p>A presentation has a <em>counter</em> for each type of number in the 1.37 cvs 2803: presentation. All counters, and therefore all types of numbers, used in the 1.18 cvs 2804: schema must be declared after the <tt>COUNTERS</tt> keyword.</p> 1.30 cvs 2805: 2806: <p>Each counter declaration is composed of a name identifying the counter 1.1 cvs 2807: followed by a colon and the counting function to be applied to the counter. 1.18 cvs 2808: The counter declaration ends with a semi-colon.</p> 1.30 cvs 2809: 2810: <p>The counting function indicates how the counter values will be calculated. 1.37 cvs 2811: Three types of counting functions are available. The first type is used to 1.16 cvs 2812: count the elements of a list or aggregate: it assigns to the counter the rank 1.37 cvs 2813: of the element in the list or aggregate. More precisely, the function</p> 1.18 cvs 2814: <pre>RANK OF ElemID [ LevelAsc ] [ INIT AttrID ] 2815: [ 'REINIT' AttrID ]</pre> 1.30 cvs 2816: 2817: <p>indicates that when an element creates, by a creation rule (see the <a 1.18 cvs 2818: href="#sectc4232"><tt>Create</tt> instructions</a>), a presentation box 1.37 cvs 2819: containing the counter value, this value is the rank of the creating element, 1.18 cvs 2820: if it is of type <tt>ElemID</tt>, otherwise the rank of the first element of 2821: type <tt>ElemID</tt> which encloses the creating element in the logical 2822: structure of the document.</p> 1.30 cvs 2823: 2824: <p>The type name can be preceded by a star in the special case where the 1.18 cvs 2825: structure schema defines an element of whose <tt>ElemID</tt> is the same as 2826: that of an <a href="#sectd3284">inclusion</a> without expansion or with 1.37 cvs 2827: partial expansion. To resolve this ambiguity, the <tt>ElemID</tt> alone 1.18 cvs 2828: refers to the type defined in the structure schema while the <tt>ElemID</tt> 2829: preceded by a star refers to the included type.</p> 1.30 cvs 2830: 1.37 cvs 2831: <p>The type name <tt>ElemID</tt> can be followed by an integer. That number 2832: represents the relative level, among the ancestors of the creating element, 2833: of the element whose rank is asked. If that relative level <i>n</i> is 2834: unsigned, the <i>n</i><sup>th</sup> element of type <tt>ElemID</tt> 2835: encountered when travelling the logical structure from the root to the 2836: creating element is taken into account. If the relative level is negative, 2837: the logical structure is travelled in the other direction, from the creating 2838: element to the root.</p> 1.30 cvs 2839: 1.37 cvs 2840: <p>The function can end with the keyword <tt>INIT</tt> followed by the name 2841: of a numeric attribute (and only a numeric attribute). Then, the rank of the 1.30 cvs 2842: first element of the list or aggregate is considered to be the value of this 1.1 cvs 2843: attribute, rather than the default value of 1, and the rank of the other 1.37 cvs 2844: elements is shifted accordingly. The attribute which determines the initial 1.18 cvs 2845: value is searched on the element itself and on its ancestors.</p> 1.30 cvs 2846: 2847: <p>The function can end with the keyword <tt>REINIT</tt> followed by the name 1.37 cvs 2848: of a numeric attribute (and only a numeric attribute). Then, if an element to 1.30 cvs 2849: be counted has this attribute, the counter value for this element is the 1.1 cvs 2850: attribute value and the following elements are numbered starting from this 1.18 cvs 2851: value.</p> 1.30 cvs 2852: 2853: <p>When the <tt>RANK</tt> function is written</p> 1.18 cvs 2854: <pre>RANK OF Page [ ViewID ] [ INIT AttrID ]</pre> 1.30 cvs 2855: 2856: <p>(<tt>Page</tt>is a keyword of the P language), the counter takes as its 2857: value the number of the page on which the element which creates the 1.37 cvs 2858: presentation box containing the number appears. This is done as if the pages 2859: of the document form a list for each view. The counter only takes into 1.30 cvs 2860: account the pages of the relevant view, that is the view displaying the 1.37 cvs 2861: presentation box whose contents take the value of the number. However, if the 2862: keyword <tt>Page</tt> is followed by the name of a view (between 2863: parentheses), it is the pages of that view that are taken into account. As in 2864: the preceding form, the <tt>RANK</tt> function applied to pages can end with 2865: the <tt>INIT</tt> keyword followed by the name of a numeric attribute which 2866: sets the value of the first page's number. This attribute must be a local 1.30 cvs 2867: attribute of the document itself, and not of one of its components.</p> 2868: 2869: <p>The second counting function is used to count the occurrences of a certain 1.37 cvs 2870: element type in a specified context. The instruction</p> 1.18 cvs 2871: <pre>SET n ON Type1 ADD m ON Type2 [ INIT AttrID ]</pre> 1.30 cvs 2872: 2873: <p>says that when the document is traversed from beginning to end (in the 2874: order induced by the logical structure), the counter is assigned the value 1.18 cvs 2875: <tt>n</tt> each time an element of type <tt>Type1</tt> is encountered, no 2876: matter what the current value of the counter, and the value <tt>m</tt> is 2877: added to the current value of the counter each time an element of type 2878: <tt>Type2</tt> is encountered.</p> 1.30 cvs 2879: 2880: <p>As with the <tt>RANK</tt> function, the type names can be preceded by a 2881: star to resolve the ambiguity of included elements.</p> 2882: 1.37 cvs 2883: <p>If the function ends with the keyword <tt>INIT</tt> followed by the name 2884: of an attribute and if the document possesses this attribute, the value of 2885: this attribute is used in place of <tt>n</tt>. The attribute must be numeric. 2886: It is searched on the element itself and on its ancestors.</p> 1.30 cvs 2887: 2888: <p>This function can also be used with the <tt>Page</tt> keyword in the place 1.37 cvs 2889: of <tt>Type1</tt> or <tt>Type2</tt>. In the first case, the counter is 1.18 cvs 2890: reinitialized on each page with the value <tt>n</tt>, while in the second 1.37 cvs 2891: case, it is incremented by <tt>m</tt> on each page. As with the preceding 1.18 cvs 2892: counting function, the word <tt>Page</tt> can be followed by a name between 1.37 cvs 2893: parentheses. In this case, the name specifies a view whose pages are taken 1.18 cvs 2894: into account.</p> 1.30 cvs 2895: 2896: <p>The definition of a counter can contain several <tt>SET</tt> functions and 1.37 cvs 2897: several <tt>ADD</tt> functions, each with a different value. The total number 1.18 cvs 2898: of counting functions must not be greater than 6.</p> 1.30 cvs 2899: 1.37 cvs 2900: <p>The third counting function is used to count the elements of a certain 2901: type encountered when travelling from the creating element to the root of the 2902: logical structure. The creating element is included if it is of that type. 1.18 cvs 2903: That function is written</p> 2904: <pre>RLEVEL OF Type</pre> 1.30 cvs 2905: 2906: <p>where <tt>Type</tt> represents the type of the elements to be counted.</p> 2907: 2908: <p>The formal definition of counter declarations is:</p> 1.18 cvs 2909: <pre> 'COUNTERS' CounterSeq 1.30 cvs 2910: CounterSeq = Counter < Counter > . 1.1 cvs 2911: Counter = CounterID ':' CounterFunc ';' . 2912: CounterID = NAME . 2913: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ] 1.16 cvs 2914: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] / 1.30 cvs 2915: SetFunction < SetFunction > 2916: AddFunction < AddFunction > 1.16 cvs 2917: [ 'INIT' AttrID ] / 2918: 'RLEVEL' 'OF' ElemID . 1.1 cvs 2919: SLevelAsc = [ '-' ] LevelAsc . 2920: LevelAsc = NUMBER . 2921: SetFunction = 'SET' CounterValue 'ON' TypeOrPage . 2922: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . 2923: TypeOrPage = 'Page' [ '(' ViewID ')' ] / 1.16 cvs 2924: [ '*' ] ElemID . 1.18 cvs 2925: CounterValue = NUMBER .</pre> 1.30 cvs 2926: 1.18 cvs 2927: <blockquote class="example"> 1.30 cvs 2928: <p><strong>Example:</strong></p> 2929: 2930: <p>If the body of a chapter is defined as a sequence of sections in the 2931: structure schema:</p> 2932: <pre>Chapter_body = LIST OF (Section = 1.1 cvs 2933: BEGIN 2934: Section_Title = Text; 2935: Section_Body = Paragraphs; 2936: END 1.18 cvs 2937: );</pre> 1.30 cvs 2938: 2939: <p>the section counter is declared:</p> 2940: <pre>SectionCtr : RANK OF Section;</pre> 2941: 2942: <p>and the display of the section number before the section title is 2943: obtained by a <a href="#sectc4232"><tt>CreateBefore</tt> rule</a> attached 2944: the <tt>Section_Title</tt> type, which creates a presentation box whose 2945: content is the value of the <tt>SectionCtr</tt> counter (see the <a 2946: href="#sectc4231"><tt>Content</tt> instruction</a>).</p> 2947: 2948: <p>In order to number the formulas separately within each chapter, the 2949: formula counter is declared:</p> 2950: <pre>FormulaCtr : SET 0 ON Chapter ADD 1 ON Formula;</pre> 2951: 1.37 cvs 2952: <p>and the display of the formula number in the right margin, alongside 2953: each formula, is obtained by a <tt>CreateAfter</tt> instruction attached to 2954: the <tt>Formula</tt> type, which creates a presentation box whose content 2955: is the value of the <tt>FormulaCtr</tt> counter.</p> 1.30 cvs 2956: 2957: <p>To number the page chapter by chapter, with the first page of each 2958: chapter having the number 1, the counter definition would be</p> 2959: <pre>ChapterPageCtr : SET 0 ON Chapter ADD 1 ON Page;</pre> 2960: 2961: <p>If there is also a chapter counter</p> 2962: <pre>ChapterCtr : RANK OF Chapter;</pre> 2963: 1.37 cvs 2964: <p>the <a href="#sectc4231">content</a> of a presentation box created at 2965: the top of each page could be defined as:</p> 1.30 cvs 2966: <pre>Content : (VALUE(ChapterCtr, URoman) TEXT '-' 1.18 cvs 2967: VALUE(ChapterPageCtr, Arabic));</pre> 1.30 cvs 2968: 2969: <p>Thus, the presentation box contains the number of the chapter in 2970: upper-case roman numerals followed by a hyphen and the number of the page 2971: within the chapter in arabic numerals.</p> 1.18 cvs 2972: </blockquote> 1.30 cvs 2973: 1.18 cvs 2974: <blockquote class="example"> 1.30 cvs 2975: <p><strong>Example:</strong></p> 2976: 1.37 cvs 2977: <p>To count tables and figures together in a document of the chapter type, 2978: a counter could be defined using:</p> 1.30 cvs 2979: <pre>CommonCtr : SET 0 ON Chapter ADD 1 ON Table 1.18 cvs 2980: ADD 1 ON Figure;</pre> 2981: </blockquote> 2982: </div> 1.1 cvs 2983: 1.18 cvs 2984: <div class="subsection"> 1.37 cvs 2985: <h3><a name="sectc425" id="sectc425">Presentation constants</a></h3> 1.1 cvs 2986: 1.30 cvs 2987: <p>Presentation constants are used in the definition of the content of 1.37 cvs 2988: presentation boxes. This content is used in <a href="#sectc426">variable 2989: definitions</a> and in the <a href="#sectc4231"><tt>Content</tt> rule</a>. 2990: The only presentation constants which can be used are character strings, 1.2 cvs 2991: mathematical symbols, graphical elements, and pictures, that is to say, base 1.18 cvs 2992: elements.</p> 1.30 cvs 2993: 2994: <p>Constants can be defined directly in the variables or presentation boxes 1.37 cvs 2995: (<tt>Content</tt> rule) which use them. But it is only necessary them to 1.1 cvs 2996: declare once, in the constant declaration section, even though they are used 1.37 cvs 2997: in many variables or boxes. Thus, each declared constant has a name, which 1.1 cvs 2998: allows it to be designated whenever it is used, a type (one of the four base 2999: types) and a value (a character string or a single character for mathematical 1.18 cvs 3000: symbols and graphical elements).</p> 1.30 cvs 3001: 1.37 cvs 3002: <p>The constant declarations appear after the keyword <tt>CONST</tt>. Each 3003: declaration is composed of the name of the constant, an equals sign, a 3004: keyword representing its type (<tt>Text</tt>, <tt>Symbol</tt>, 3005: <tt>Graphics</tt> or <tt>Picture</tt>) and the string representing its value. 3006: A semi-colon terminates each declaration.</p> 1.30 cvs 3007: 3008: <p>In the case of a character string, the keyword <tt>Text</tt> can be 3009: followed by the name of an alphabet (for example, <tt>Greek</tt> or 1.37 cvs 3010: <tt>Latin</tt>) in which the constant's text should be expressed. If the 3011: alphabet name is absent, the Latin alphabet is used. When the alphabet name 3012: is present, only the first letter of the alphabet name is interpreted. Thus, 3013: the words <tt>Greek</tt> and <tt>Grec</tt> designate the same alphabet. In 1.30 cvs 3014: current versions of Thot, only the Greek and Latin alphabets are 3015: available.</p> 1.18 cvs 3016: <pre> 'CONST' ConstSeq 1.30 cvs 3017: ConstSeq = Const < Const > . 1.1 cvs 3018: Const = ConstID '=' ConstType ConstValue ';' . 3019: ConstID = NAME . 3020: ConstType ='Text' [ Alphabet ] / 'Symbol' / 3021: 'Graphics' / 'Picture' . 3022: ConstValue = STRING . 1.18 cvs 3023: Alphabet = NAME .</pre> 1.30 cvs 3024: 3025: <p>For character strings in the Latin alphabet (ISO Latin-1 character set), 1.1 cvs 3026: characters having codes higher than 127 (decimal) are represented by their 1.18 cvs 3027: code in octal.</p> 1.30 cvs 3028: 3029: <p>In the case of a symbol or graphical element, the value only contains a 1.37 cvs 3030: single character, between apostrophes, which indicates the form of the 3031: element which must be drawn in the box whose content is the constant. The 3032: symbol or graphical element takes the dimensions of the box, which are 3033: determined by the <tt>Height</tt> and <tt>Width</tt> rules. See <a 3034: href="#sectb72">table of codes</a> for the symbols and graphical elements.</p> 1.30 cvs 3035: 1.18 cvs 3036: <blockquote class="example"> 1.30 cvs 3037: <p><strong>Example:</strong></p> 3038: 3039: <p>The constants ``Summary:'' and fraction bar, which were described 3040: earlier, are declared:</p> 3041: <pre>CONST 1.1 cvs 3042: SummaryConst = Text 'Summary:'; 1.18 cvs 3043: Bar = Graphics 'h';</pre> 3044: </blockquote> 3045: </div> 1.1 cvs 3046: 1.18 cvs 3047: <div class="subsection"> 1.37 cvs 3048: <h3><a name="sectc426" id="sectc426">Variables</a></h3> 1.1 cvs 3049: 1.37 cvs 3050: <p>Variables permit the definition of computed content for presentation 3051: boxes. A variable is associated with a presentation box by a <tt>Content</tt> 3052: rule; but before being used in a <tt>Content</tt> rule, a variable can be 3053: defined in the <tt>VAR</tt> section. It is also possible to define a variable 3054: at the time of its use in a <tt>Content</tt> rule, as can be done with a 1.30 cvs 3055: constant.</p> 3056: 3057: <p>A variable has a name and a value which is a character string resulting 1.37 cvs 3058: from the concatenation of the values of a sequence of functions. Each 1.30 cvs 3059: variable declaration is composed of the variable name followed by a colon and 1.37 cvs 3060: the sequence of functions which produces its value, separated by spaces. Each 1.18 cvs 3061: declaration is terminated by a semi-colon.</p> 3062: <pre> 'VAR' VarSeq 1.30 cvs 3063: VarSeq = Variable < Variable > . 1.1 cvs 3064: Variable = VarID ':' FunctionSeq ';' . 3065: VarID = NAME . 1.30 cvs 3066: FunctionSeq = Function < Function > .</pre> 3067: 1.37 cvs 3068: <p>Several functions are available. The first two return, in the form of a 3069: character string, the current date. <tt>DATE</tt> returns the date in 1.18 cvs 3070: English, while <tt>FDATE</tt> returns the date in french.</p> 1.30 cvs 3071: 3072: <p>Two other functions, <tt>DocName</tt> and <tt>DirName</tt>, return the 1.18 cvs 3073: document name and the directory where the document is stored.</p> 1.30 cvs 3074: 1.38 ! cvs 3075: <p>Function <tt>ElemName</tt> returns the name of the element which created 1.30 cvs 3076: the presentation box whose contents are the variable.</p> 3077: 1.38 ! cvs 3078: <p>Function <tt>AttributeName</tt> returns the name of the attribute which ! 3079: created the presentation box whose contents are the variable. The ! 3080: presentation box must be created by an attribute.</p> ! 3081: ! 3082: <p>Function <tt>AttributeValue</tt> returns the value 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: 1.30 cvs 3086: <p>Another function simply returns the value of a presentation constant. For 3087: any constant declared in the <tt>CONST</tt> section, it is sufficient to give 1.37 cvs 3088: the name of the constant. Otherwise, the type and value of the constant must 1.30 cvs 3089: be given, using the same form as in a <a href="#sectc425">constant 1.18 cvs 3090: declaration</a>. If the constant is not of type text, (types <tt>Symbol</tt>, 3091: <tt>Graphics</tt> or <tt>Picture</tt>), it must be alone in the variable 3092: definition; only constants of type <tt>Text</tt> can be mixed with other 3093: functions.</p> 1.30 cvs 3094: 3095: <p>It is also possible to obtain the value of an attribute, simply by 1.37 cvs 3096: mentioning the attribute's name. The value of this function is the value of 1.30 cvs 3097: the attribute for the element which created the presentation box whose 1.37 cvs 3098: contents are the variable. If the creating element does not have the 3099: indicated attribute, the value is an empty string. In the case of a numeric 1.30 cvs 3100: attribute, the attribute is translated into a decimal number in arabic 1.37 cvs 3101: numerals. If another form is desired, the <tt>VALUE</tt> function must be 1.30 cvs 3102: used.</p> 3103: 3104: <p>The last available function returns, as a character string, the value of a 1.1 cvs 3105: counter, an attribute or a page number. This value can be presented in 1.37 cvs 3106: different styles. The keyword <tt>VALUE</tt> is followed (between 1.1 cvs 3107: parentheses) by the name of the counter, the name of the attribute, or the 1.18 cvs 3108: keyword <tt>PageNumber</tt> and the desired style, the two parameters being 1.37 cvs 3109: separated by a comma. The style is a keyword which indicates whether the 1.18 cvs 3110: value should be presented in arabic numerals (<tt>Arabic</tt>), lower-case 3111: roman numerals (<tt>LRoman</tt>), or upper-case roman numerals 3112: (<tt>URoman</tt>), or by an upper-case letter (<tt>Uppercase</tt>) or 3113: lower-case letter (<tt>Lowercase</tt>).</p> 1.30 cvs 3114: 3115: <p>For a page counter, the keyword <tt>PageNumber</tt> can be followed, 3116: between parentheses, by the name of the view from which to obtain the page 1.37 cvs 3117: number. By default, the first view declared in the <tt>VIEWS</tt> section is 3118: used. The value obtained is the number of the page on which is found the 1.30 cvs 3119: element that is using the variable in a <tt>Content</tt> rule.</p> 3120: 3121: <p>For an ordinary counter, the name of the counter can be preceded by the 1.37 cvs 3122: keyword <tt>MaxRangeVal</tt> or <tt>MinRangeVal</tt>. These keywords mean 1.1 cvs 3123: that the value returned by the function is the maximum (minimum resp.) value 3124: taken by the counter in the whole document, not the value for the element 1.18 cvs 3125: concerned by the function.</p> 3126: <pre> Function = 'DATE' / 'FDATE' / 1.1 cvs 3127: 'DocName' / 'DirName' / 1.38 ! cvs 3128: 'ElemName' / 'AttributeName' / 'AttributeValue' / 1.1 cvs 3129: ConstID / ConstType ConstValue / 3130: AttrID / 3131: 'VALUE' '(' PageAttrCtr ',' 3132: CounterStyle ')' . 1.6 cvs 3133: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] / 1.1 cvs 3134: [ MinMax ] CounterID / AttrID . 3135: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' / 3136: 'Uppercase' / 'Lowercase' . 1.18 cvs 3137: MinMax = 'MaxRangeVal' / 'MinRangeVal' .</pre> 1.30 cvs 3138: 1.18 cvs 3139: <blockquote class="example"> 1.30 cvs 3140: <p><strong>Example:</strong></p> 3141: 3142: <p>To make today's date appear at the top of the first page of a report, a 3143: <a href="#sectc4232"><tt>CREATE</tt> rule</a> associated with the 3144: Report_Title element type generates a presentation box whose content 3145: (specified by the <tt>Content</tt> rule of that presentation box) is the 3146: variable:</p> 3147: <pre>VAR 1.18 cvs 3148: Todays_date : TEXT 'Version of ' DATE;</pre> 1.30 cvs 3149: 3150: <p>To produce, before each section title, the chapter number (in upper-case 3151: roman numerals) followed by the section number (in arabic numerals), two 3152: counters must be defined:</p> 3153: <pre>COUNTERS 1.1 cvs 3154: ChapterCtr : RANK OF Chapter; 1.18 cvs 3155: SectionCtr : RANK OF Section;</pre> 1.30 cvs 3156: 3157: <p>and the Section_Title element must create a presentation box whose 3158: content is the variable</p> 3159: <pre>VAR 1.1 cvs 3160: SectionNum : VALUE (ChapterCtr, URoman) TEXT '-' 1.18 cvs 3161: VALUE (SectionCtr, Arabic);</pre> 1.30 cvs 3162: 3163: <p>In order to make the page number on which each section begins appear in 3164: the table of contents view next to the section title, each Section_Title 3165: element must create a presentation box, visible only in the table of 3166: contents view, whose content is the variable:</p> 3167: <pre>VAR 1.1 cvs 3168: TitlePageNume : 1.18 cvs 3169: VALUE (PageNumber(Full_text), Arabic);</pre> 3170: </blockquote> 3171: </div> 1.1 cvs 3172: 1.18 cvs 3173: <div class="subsection"> 1.37 cvs 3174: <h3><a name="sectc427" id="sectc427">Default presentation rules</a></h3> 1.1 cvs 3175: 1.30 cvs 3176: <p>In order to avoid having to specify, for each element type defined in the 1.1 cvs 3177: structure schema, values for every one of the numerous presentation 1.34 cvs 3178: properties, the presentation schema allows the definition of a set of default 1.37 cvs 3179: presentation rules. These rules apply to all the boxes of the elements 1.1 cvs 3180: defined in the structure schema and to the presentation boxes and page layout 1.37 cvs 3181: boxes defined in the presentation schema. Only rules which differ from these 1.18 cvs 3182: default need to be specified in other sections of the presentation schema.</p> 1.30 cvs 3183: 3184: <p>For the primary view, the default rules can define every presentation 1.34 cvs 3185: property, but not the <a href="#presfunct">presentation functions</a> or the 1.18 cvs 3186: <a href="#sectc4223">linebreaking conditions</a> (the <tt>NoBreak1</tt>, 3187: <tt>NoBreak2</tt>, and <tt>Gather</tt> rules).</p> 1.30 cvs 3188: 3189: <p>In a presentation schema, the default presentation rules section is 3190: optional; in this case, the <tt>DEFAULT</tt> keyword is also absent and the 3191: following rules are considered to be the default rules:</p> 1.26 cvs 3192: <pre> Visibility: Enclosing =; 3193: VertRef: * . Left; 3194: HorizRef: Enclosed . HRef; 3195: Height: Enclosed . Height; 3196: Width: Enclosed . Width; 3197: VertPos: Top = Previous . Bottom; 3198: HorizPos: Left = Enclosing . Left; 3199: MarginTop: 0; 3200: MarginRight: 0; 3201: MarginBottom: 0; 3202: MarginLeft: 0; 3203: PaddingTop: 0; 3204: PaddingRight: 0; 3205: PaddingBottom: 0; 3206: PaddingLeft: 0; 3207: BorderTopWidth: 0; 3208: BorderRightWidth: 0; 3209: BorderBottomWidth: 0; 3210: BorderLeftWidth: 0; 3211: BorderTopColor: Foreground; 3212: BorderRightColor: Foreground; 3213: BorderBottomColor: Foreground; 3214: BorderLeftColor: Foreground; 3215: BorderTopStyle: None; 3216: BorderRightStyle: None; 3217: BorderBottomStyle: None; 3218: BorderLeftStyle: None; 3219: VertOverflow: No; 3220: HorizOverflow: No; 3221: Size: Enclosing =; 3222: Style: Enclosing =; 3223: Weight: Enclosing =; 3224: Font: Enclosing =; 3225: Underline: Enclosing =; 3226: Thickness: Enclosing =; 3227: Indent: Enclosing =; 3228: LineSpacing: Enclosing =; 3229: Adjust: Enclosing =; 3230: Hyphenate: Enclosing =; 3231: PageBreak: Yes; 3232: LineBreak: Yes; 3233: InLine: Yes; 3234: Depth: 0; 3235: LineStyle: Enclosing =; 3236: LineWeight: Enclosing =; 3237: FillPattern: Enclosing =; 3238: Background: Enclosing =; 3239: Foreground: Enclosing =;</pre> 1.30 cvs 3240: 3241: <p>If other values are desired for the default rules, they must be defined 1.37 cvs 3242: explicitly in the default rules section. In fact, it is only necessary to 1.1 cvs 3243: define those default rules which differ from the ones above, since the rules 1.18 cvs 3244: above will be used whenever a rule is not explicitly named.</p> 1.30 cvs 3245: 1.37 cvs 3246: <p>Default rules for views other than the primary view can also be specified. 1.1 cvs 3247: Otherwise, the default rules for the primary views are applied to the other 1.18 cvs 3248: views.</p> 1.30 cvs 3249: 3250: <p>Default rules are expressed in the same way as <a 3251: href="#sectc4215">explicit rules for document elements</a>.</p> 1.18 cvs 3252: </div> 1.1 cvs 3253: 1.18 cvs 3254: <div class="subsection"> 1.37 cvs 3255: <h3><a name="sectc428" id="sectc428">Presentation and page layout 3256: boxes</a></h3> 1.1 cvs 3257: 1.30 cvs 3258: <p>The presentation process uses elements which are not part of the logical 1.1 cvs 3259: structure of the document, such as pages (which are the page layout boxes) or 3260: alternatively, rules, numbers, or words introducing certain parts of the 3261: document, such as ``Summary'', ``Appendices'', ``Bibliography'', etc. (which 1.18 cvs 3262: are presentation boxes).</p> 1.30 cvs 3263: 3264: <p>After the word <tt>BOXES</tt>, each presentation or page layout box is 3265: defined by its name and a sequence of presentation rules which indicate how 1.37 cvs 3266: they must be displayed. These rules are the same as those which define the 3267: boxes associated with element of the logical structure of the document, with 3268: a single exception, the <a href="#sectc4231"><tt>Content</tt> rule</a> which 3269: is used only to specify the content of presentation boxes. The content of 3270: boxes associated with elements of the document structure is defined in each 3271: document or object and thus is not specified in the presentation schema, 3272: which applies to all documents or objects of a class.</p> 1.30 cvs 3273: 3274: <p>Among the rules which define a presentation box, certain ones can refer to 1.37 cvs 3275: another presentation box (for example, in their positional rules). If the 1.1 cvs 3276: designated box is defined after the box which designates it, a 1.18 cvs 3277: <tt>FORWARD</tt> instruction followed by the name of the designated box must 3278: appear before the designation.</p> 3279: <pre> 'BOXES' BoxSeq 1.30 cvs 3280: BoxSeq = Box < Box > . 1.1 cvs 3281: Box ='FORWARD' BoxID ';' / 3282: BoxID ':' ViewRuleSeq . 1.18 cvs 3283: BoxID = NAME .</pre> 3284: </div> 1.1 cvs 3285: 1.18 cvs 3286: <div class="subsection"> 1.37 cvs 3287: <h3><a name="sectc429" id="sectc429">Presentation of structured 3288: elements</a></h3> 1.1 cvs 3289: 1.30 cvs 3290: <p>After the words <tt>RULES</tt>, the presentation schema gives the 3291: presentation rules that apply to the elements whose types are defined in the 1.37 cvs 3292: structure schema. Only those rules which differ from the <a 1.18 cvs 3293: href="#sectc427">default</a> must be specified in the <tt>RULES</tt> 3294: section.</p> 1.30 cvs 3295: 3296: <p>The rule definitions for each element type are composed of the name of the 1.1 cvs 3297: element type (as specified in the structure schema) followed by a colon and 1.18 cvs 3298: the set of rules specific to that type.</p> 1.30 cvs 3299: 3300: <p>The type name can be preceded by a star in the special case where the 1.18 cvs 3301: structure schema defines an <a href="#sectd3284">inclusion</a> without 1.1 cvs 3302: expansion (or with partial expansion) of a type with the same name as an 1.18 cvs 3303: element of defined in the structure schema.</p> 1.30 cvs 3304: 3305: <p>In the case where the element is a <a href="#sectd3285">mark pair</a>, but 1.18 cvs 3306: only in this case, the type name can be preceded by the keywords 1.37 cvs 3307: <tt>First</tt> or <tt>Second</tt>. These keywords indicate whether the rules 1.18 cvs 3308: that follow apply to the first or second mark of the pair.</p> 3309: <pre> 'RULES' PresentSeq 1.30 cvs 3310: PresentSeq = Present < Present > . 1.6 cvs 3311: Present = [ '*' ] [ FirstSec ] ElemID ':' 3312: ViewRuleSeq . 1.18 cvs 3313: FirstSec = 'First' / 'Second' .</pre> 1.30 cvs 3314: 3315: <p>A presentation schema can define presentation rules for base elements, 1.37 cvs 3316: which are defined implicitly in the structure schemas. In the English version 1.30 cvs 3317: of the presentation schema compiler, the base type names are the same as in 3318: the S language, but they are terminated by the <tt>_UNIT</tt> suffix: 1.18 cvs 3319: <tt>TEXT_UNIT</tt>, <tt>PICTURE_UNIT</tt>, <tt>SYMBOL_UNIT</tt>, 1.37 cvs 3320: <tt>GRAPHICS_UNIT</tt>. The base type names are written in upper-case 1.18 cvs 3321: letters.</p> 3322: </div> 3323: 3324: <div class="subsection"> 1.37 cvs 3325: <h3><a name="sectc4210" id="sectc4210">Logical attribute presentation</a></h3> 1.18 cvs 3326: 1.30 cvs 3327: <p>After the keyword <tt>ATTRIBUTES</tt>, all attributes which are to have 1.37 cvs 3328: some effect on the presentation of the element to which they are attached 3329: must be mentioned, along with the corresponding presentation rules. This is 3330: true for both global attributes (which can be attached to all element types) 3331: and local attributes (which can only be attached to certain element 3332: types).</p> 1.30 cvs 3333: 3334: <p>Also mentioned in this section are attributes which imply an effect on 1.1 cvs 3335: elements in the subtree of the element to which they are attached. The 1.37 cvs 3336: presentation of these descendants can be modified as a function of the value 1.1 cvs 3337: of the attribute which they inherit, just as if it was attached to them 1.18 cvs 3338: directly.</p> 1.30 cvs 3339: 3340: <p>The specification for each attribute includes the attribute's name, 3341: followed by an optional value specification and, after a colon, a set of 1.37 cvs 3342: rules. The set of rules must contain at least one rule.</p> 1.30 cvs 3343: 1.37 cvs 3344: <p>When there is no value specification, the rules are applied to all 3345: elements which carry the attribute, no matter what their value. When the 3346: rules must only apply when the attribute has certain values, these values 3347: must be specified. Thus, the same attribute can appear in the 3348: <tt>ATTRIBUTES</tt> section several times, with each appearance having a 3349: different value specification. However, reference attributes never have a 3350: value specification and, as a result, can only appear once in the 3351: <tt>ATTRIBUTES</tt> section.</p> 1.30 cvs 3352: 3353: <p>To specify that the presentation rules apply to some of the descendants of 3354: the element having the attribute, the name of the affected element type is 1.37 cvs 3355: given, between parentheses, after the attribute name. This way, the 3356: presentation rules for the attribute will be applied to the element having 3357: the attribute, if it is of the given type, and to all of its descendants of 3358: the given type. In the case where this type is a <a href="#sectd3285">mark 3359: pair</a>, but only in this case, the type name can be preceded by the 3360: keywords <tt>First</tt> or <tt>Second</tt>. These keywords indicate whether 3361: the rules that follow apply to the first or second mark of the pair. If the 3362: rule must apply to several different element types, the specification must be 3363: repeated for each element type.</p> 1.30 cvs 3364: 3365: <p>The specification of values for which the presentation rules will be 3366: applied varies according to the type of the attribute:</p> 1.18 cvs 3367: <dl> 1.30 cvs 3368: <dt>numeric attribute</dt> 3369: <dd>If the rules are to apply for one value of the attribute, then the 1.37 cvs 3370: attribute name is followed by an equals sign and this value. If the 1.30 cvs 3371: rules are to apply for all values less than (or greater than) a 3372: threshold value, non-inclusive, the attribute name followed by a '<' 1.37 cvs 3373: sign (or a '>' sign, respectively) and the threshold value. If the 3374: rules must apply to a range of values, the attribute name is followed 3375: by the word '<tt>IN</tt>' and the two bounds of the range, enclosed in 3376: brackets and separated by two periods ('<tt>..</tt>'). In the case of 3377: ranges, the values of the bounds are included in the range. 1.30 cvs 3378: <p>The threshold value in the comparisons can be the value of an 1.37 cvs 3379: attribute attached to an ancestor element. In this case, the attribute 1.30 cvs 3380: name is given instead of a constant value.</p> 1.37 cvs 3381: <p>It is also possible to write rules which apply only when a 3382: comparison between two different attributes of the element's ancestors 3383: is true. In this case, the first attribute name is followed by a 3384: comparison keyword and the name of the second attribute. The comparison 3385: keywords are <tt>EQUAL</tt> (simple equality), <tt>LESS</tt> 3386: (non-inclusive less than), and <tt>GREATER</tt> (non-inclusive greater 3387: than).</p> 1.30 cvs 3388: </dd> 3389: <dt>text attribute</dt> 3390: <dd>If the rules are to apply for one value of the attribute, then the 3391: attribute name is followed by an equals sign and this value.</dd> 3392: <dt>reference attribute</dt> 3393: <dd>There is never a value specification; the rules apply no matter what 3394: element is designated by the attribute.</dd> 3395: <dt>enumerated attribute</dt> 3396: <dd>If the rules are to apply for one value of the attribute, then the 3397: attribute name is followed by an equals sign and this value.</dd> 1.18 cvs 3398: </dl> 1.30 cvs 3399: 3400: <p>The order in which the rules associated with a numeric attribute are 1.37 cvs 3401: defined is important. When multiple sets of rules can be applied, the first 1.30 cvs 3402: set declared is the one used.</p> 3403: 3404: <p>Rules for attributes have priority over both default rules and rules 1.37 cvs 3405: associated with element types. The attribute rules apply to the element to 3406: which the attribute is attached. It is the rules which apply to the 1.1 cvs 3407: surrounding elements (and especially to the descendants) which determine the 3408: effect of the attribute rules on the environment ( and especially on the 1.18 cvs 3409: terminal elements of the structure).</p> 3410: <pre> 'ATTRIBUTES' PresAttrSeq 1.30 cvs 3411: PresAttrSeq = PresAttr < PresAttr > . 1.1 cvs 3412: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ] 3413: [ AttrRelation ] ':' ViewRuleSeq . 3414: AttrID = NAME . 3415: AttrRelation ='=' AttrVal / 1.30 cvs 3416: '>' [ '-' ] MinValue / 1.1 cvs 3417: '<' [ '-' ] MaxValue / 3418: 'IN' '[' [ '-' ] LowerBound '..' 3419: [ '-' ] UpperBound ']' / 3420: 'GREATER' AttrID / 3421: 'EQUAL' AttrID / 3422: 'LESS' AttrID . 3423: AttrVal = [ '-' ] EqualNum / EqualText / 3424: AttrValue . 3425: MinValue = NUMBER . 3426: MaxValue = NUMBER . 3427: LowerBound = NUMBER . 3428: UpperBound = NUMBER. 3429: EqualNum = NUMBER . 3430: EqualText = STRING . 1.18 cvs 3431: AttrValue = NAME .</pre> 1.30 cvs 3432: 1.37 cvs 3433: <p>In presentation rules associated with a numeric attribute (and only in 3434: such rules), the attribute name can be used in place of a numeric value. In 3435: this case, the value of the attribute is used in the application of the rule. 3436: Thus, the attribute can represent a relation between the size of two boxes, 3437: the height and width of a box, the height of an area where page breaks are 3438: prohibited, the distance between two boxes, the position of the reference 3439: axis of a box, the interline spacing, the indentation of the first line, the 1.18 cvs 3440: visibility, the depth (z-order), or the character set.</p> 1.30 cvs 3441: 1.37 cvs 3442: <p>The presentation rules associated with reference attributes, it is 3443: possible to use the element designated by the attribute as a reference box in 3444: a positional or extent rule. This element is represented in the <a 1.18 cvs 3445: href="#sectc4218">position</a> or <a href="#sectc4219">extent</a> rule by the 3446: keyword <tt>Referred</tt>.</p> 1.30 cvs 3447: 1.18 cvs 3448: <blockquote class="example"> 1.30 cvs 3449: <p><strong>Example:</strong></p> 3450: 1.37 cvs 3451: <p>In all structure schemas, there is a global Language attribute defined 3452: as follows:</p> 1.30 cvs 3453: <pre>ATTR 1.18 cvs 3454: Language = TEXT;</pre> 1.30 cvs 3455: 3456: <p>The following rules would make French text be displayed in roman 3457: characters and English text be displayed in italics:</p> 3458: <pre>ATTRIBUTES 1.1 cvs 3459: Language = 'French' : 1.6 cvs 3460: Style : Roman; 1.1 cvs 3461: Language = 'English' : 1.18 cvs 3462: Style : Italics;</pre> 1.30 cvs 3463: 3464: <p>Using these rules, when the user puts the Language attribute with the 3465: value 'English' on the summary of a document, every character string 1.37 cvs 3466: (terminal elements) contained in the summary are displayed in italics. See 1.30 cvs 3467: the <a href="#sectd42252"><tt>Style</tt> rule</a>.</p> 1.18 cvs 3468: </blockquote> 1.30 cvs 3469: 1.18 cvs 3470: <blockquote class="example"> 1.30 cvs 3471: <p><strong>Example:</strong></p> 3472: 3473: <p>A numeric attribute representing the importance of the part of the 3474: document to which it is attached can be defined:</p> 3475: <pre>ATTR 1.18 cvs 3476: Importance = INTEGER;</pre> 1.30 cvs 3477: 3478: <p>In the presentation schema, the importance of an element is reflected in 3479: the choice of character size, using the following rules.</p> 3480: <pre>ATTRIBUTES 1.1 cvs 3481: Importance < 2 : 3482: Size : 1; 3483: Importance IN [2..4] : 3484: Size : Importance; 3485: Importance = 10 : 3486: Size : 5; 1.30 cvs 3487: Importance > 4 : 1.18 cvs 3488: Size : 4;</pre> 1.30 cvs 3489: 3490: <p>Thus, the character size corresponds to the value of the Importance 3491: attribute; its value is</p> 3492: <ul> 3493: <li>the value of the Importance attribute when the value is between 2 and 3494: 4 (inclusive),</li> 3495: <li>1, when the value of the Importance attribute is less than 2,</li> 3496: <li>4, when the value of the Importance attribute is greater than 4,</li> 3497: <li>5, when the value of the Importance attribute is 10.</li> 3498: </ul> 3499: 1.37 cvs 3500: <p>The last case (value 5) must be defined before the case which handles 3501: all Importance values greater than 4, because the two rules are not 3502: disjoint and the first one defined will have priority. Otherwise, when the 3503: Importance attribute has value 10, the font size will be 4.</p> 1.18 cvs 3504: </blockquote> 1.30 cvs 3505: 1.18 cvs 3506: <blockquote class="example"> 1.30 cvs 3507: <p><strong>Example:</strong></p> 3508: 3509: <p>Suppose the structure defines a list element which can have an attribute 3510: defining the type of list (numbered or not):</p> 3511: <pre>STRUCT 1.1 cvs 3512: list (ATTR list_type = enumeration, dash) 1.18 cvs 3513: = LIST OF (list_item = TEXT);</pre> 1.30 cvs 3514: 3515: <p>Then, the presentation schema could use the attribute placed on the list 3516: element to put either a dash or a number before the each element of the 3517: list:</p> 3518: <pre>ATTRIBUTES 1.1 cvs 3519: list_type (list_item) = enumeration : 3520: CreateBefore (NumberBox); 3521: list_type (list_item) = dash : 1.18 cvs 3522: CreateBefore (DashBox);</pre> 3523: </blockquote> 1.30 cvs 3524: 1.18 cvs 3525: <blockquote class="example"> 1.30 cvs 3526: <p><strong>Example:</strong></p> 3527: 1.37 cvs 3528: <p>Suppose that two attributes are defined in the structure schema. The 3529: first is a numeric global attribute called ``version''. The other is a 1.30 cvs 3530: local attribute defined on the root of the document called 3531: ``Document_version'':</p> 3532: <pre>STRUCTURE Document 1.1 cvs 3533: ATTR 3534: version = INTEGER; 3535: STRUCT 3536: Document (ATTR Document_version = INTEGER) = 3537: BEGIN 3538: SomeElement ; 3539: ... 3540: SomeOtherElement ; 3541: END ; 1.18 cvs 3542: ...</pre> 1.30 cvs 3543: 3544: <p>These attributes can be used in the presentation schema to place change 3545: bars in the margin next to elements whose version attribute has a value 3546: equal to the Document_version attribute of the root and to place a star in 3547: margin of elements whose version attribute is less than the value of the 3548: root's Document_version attribute:</p> 3549: <pre>ATTRIBUTES 1.1 cvs 3550: version EQUAL Document_version : 3551: CreateBefore (ChangeBarBox) ; 3552: version LESS Document_version : 1.18 cvs 3553: CreateBefore (StarBox) ;</pre> 3554: </blockquote> 3555: </div> 1.1 cvs 3556: 1.18 cvs 3557: <div class="subsection"> 1.37 cvs 3558: <h3><a name="sectc4212" id="sectc4212">Value transmission rules</a></h3> 1.1 cvs 3559: 1.30 cvs 3560: <p>The last section of a presentation schema, which is optional, serves to 1.1 cvs 3561: defines the way in which a document transmits certain values to its 1.37 cvs 3562: sub-documents. A sub-document is an document <a 1.18 cvs 3563: href="#inclusion">included</a> without expansion or with partial expansion. 1.1 cvs 3564: The primary document can transmit to its sub-documents the values of certain 3565: counters or the textual content of certain of its elements, as a function of 1.18 cvs 3566: their type.</p> 1.30 cvs 3567: 3568: <p>The sub-documents receive these values in attributes which must be defined 1.37 cvs 3569: in their structure schema as local attributes of the root element. The types 1.30 cvs 3570: of these attributes must correspond to the type of the value which they 3571: receive: numeric attributes for receiving the value of a counter, textual 3572: attributes for receiving the content of an element.</p> 3573: 3574: <p>In the structure schema of the primary document, there appears at the end, 1.37 cvs 3575: after the <tt>TRANSMIT</tt> keyword, a sequence of transmission rules. Each 1.1 cvs 3576: rule begins with the name of the counter to transmit or of the element type 1.37 cvs 3577: whose textual content will be transmitted. This name is followed by the 3578: keyword <tt>To</tt> and the name of the attribute of the sub-document to 3579: which the value is transmitted. The sub-document class is indicated between 3580: parentheses after the name of the attribute. The transmission rule ends with 1.18 cvs 3581: a semicolon.</p> 1.30 cvs 3582: <pre> TransmitSeq = Transmit < Transmit > . 1.1 cvs 3583: Transmit = TypeOrCounter 'To' ExternAttr 3584: '(' ElemID ')' ';' . 3585: TypeOrCounter = CounterID / ElemID . 1.18 cvs 3586: ExternAttr = NAME .</pre> 1.30 cvs 3587: 1.18 cvs 3588: <blockquote class="example"> 1.30 cvs 3589: <p><strong>Example:</strong></p> 3590: 3591: <p>Consider a Book document class which includes instances of the Chapter 1.37 cvs 3592: document class. These classes might have the following schemas:</p> 1.30 cvs 3593: <pre>STRUCTURE Book 1.1 cvs 3594: STRUCT 3595: Book = BEGIN 3596: Title = Text; 3597: Body = LIST OF (Chapter INCLUDED); 3598: END; 3599: ... 3600: 3601: STRUCTURE Chapter 3602: STRUCT 3603: Chapter (ATTR FirstPageNum = Integer; 3604: ChapterNum = Integer; 3605: CurrentTitle = Text) = 1.6 cvs 3606: BEGIN 3607: ChapterTitle = Text; 3608: ... 3609: END; 1.18 cvs 3610: ...</pre> 1.30 cvs 3611: 3612: <p>Then the presentation schema for books could define chapter and page 3613: counters. The following transmission rules in the book presentation schema 3614: would transmit values for the three attributes defined at the root of each 3615: chapter sub-document.</p> 3616: <pre>PRESENTATION Book; 1.1 cvs 3617: VIEWS 3618: Full_text; 3619: COUNTERS 3620: ChapterCtr: Rank of Chapter; 3621: PageCtr: Rank of Page(Full_text); 3622: ... 3623: TRANSMIT 3624: PageCtr TO FirstPageNum(Chapter); 3625: ChapterCtr TO ChapterNum(Chapter); 3626: Title TO CurrentTitle(Chapter); 1.18 cvs 3627: END</pre> 1.30 cvs 3628: 3629: <p>Thus, each chapter included in a book can number its pages as a function 3630: of the number of pages preceding it in the book, can make the chapter's 3631: number appear before the number of each of its sections, or can place the 3632: title of the book at the top of each page.</p> 1.18 cvs 3633: </blockquote> 3634: </div> 1.1 cvs 3635: 1.18 cvs 3636: <div class="subsection"> 1.37 cvs 3637: <h3><a name="sectc4213" id="sectc4213">Presentation rules</a></h3> 1.1 cvs 3638: 1.30 cvs 3639: <p>Whether defining the appearance of a presentation or page layout box, an 1.1 cvs 3640: element type, or an attribute value, the set of presentation rules that apply 1.18 cvs 3641: is always defined in the same way.</p> 1.30 cvs 3642: 3643: <p>Normally, a set of presentation rules is placed between the keywords 1.18 cvs 3644: <tt>BEGIN</tt> and <tt>END</tt>, the keyword <tt>END</tt> being followed by a 1.37 cvs 3645: semicolon. The first section of this block defines the rules that apply to 1.18 cvs 3646: the primary view, if the <a href="#sectc427">default rules</a> are not 1.37 cvs 3647: completely suitable. Next comes the rules which apply to specific other 1.1 cvs 3648: views, with a rule sequence for each view for which the default rules are not 1.37 cvs 3649: satisfactory. If the default rules are suitable for the non-primary views, 3650: there will not be any specific rules for these views. If there is only one 1.18 cvs 3651: rule which applies to all views then the keywords <tt>BEGIN</tt> and 3652: <tt>END</tt> need not appear.</p> 1.30 cvs 3653: 3654: <p>For each view, it is only necessary to specify those rules which differ 3655: from the default rules for the view, so that for certain views (or even all 3656: views), there may be no specific rules.</p> 3657: 3658: <p>The specific rules for a non-primary view are introduced by the <a 1.37 cvs 3659: name="inkeyword" id="inkeyword"><tt>IN</tt> keyword</a>, followed by the view 3660: name. The rules for that view follow, delimited by the keywords 3661: <tt>BEGIN</tt> and <tt>END</tt>, or without these two keywords when there is 3662: only one rule.</p> 1.30 cvs 3663: 3664: <p><strong>Note:</strong> the view name which follows the <tt>IN</tt> keyword 1.1 cvs 3665: must not be the name of the primary view, since the rules for that view are 1.18 cvs 3666: found before the rules for the other views.</p> 1.30 cvs 3667: 3668: <p>Within each block concerning a view, other blocks can appear, delimited by 1.37 cvs 3669: the same keywords <tt>BEGIN</tt> and <tt>END</tt>. Each of these blocks 3670: gathers the presentation rules that apply, for a given view, only when a 3671: given condition is satisfied. Each block is preceded by a condition 3672: introduced by the <tt>IF</tt> keyword. If such a conditional block contains 3673: only one rule, the keywords <tt>BEGIN</tt> and <tt>END</tt> can be 3674: omitted.</p> 3675: 3676: <p>Although the syntax allows any presentation rule to appear in a 3677: conditional block, only <a href="#sectc4232">creation rules</a> are allowed 3678: after any condition; other rules are allowed only after conditions 3679: <tt>Within</tt> and ElemID. In addition, the following rules cannot be 3680: conditional: <tt>PageBreak, LineBreak, Inline, Gather</tt>.</p> 1.30 cvs 3681: 3682: <p>For a given view, the rules that apply without any condition must appear 1.37 cvs 3683: before the first conditional block. If some rules apply only when none of the 3684: specified condition holds, they are grouped in a block preceded by the 3685: keyword <tt>Otherwise</tt>, and that block must appear after the last 3686: conditionnal block concerning the same view.</p> 1.30 cvs 3687: <pre> ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules > 1.1 cvs 3688: 'END' ';' / 3689: ViewRules / CondRules / Rule . 3690: RulesAndCond = CondRules / Rule . 3691: ViewRules = 'IN' ViewID CondRuleSeq . 1.30 cvs 3692: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' / 1.1 cvs 3693: CondRules / Rule . 1.30 cvs 3694: CondRules = CondRule < CondRule > 1.1 cvs 3695: [ 'Otherwise' RuleSeq ] . 3696: CondRule = 'IF' ConditionSeq RuleSeq . 1.30 cvs 3697: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / 1.18 cvs 3698: Rule .</pre> 1.30 cvs 3699: 1.18 cvs 3700: <blockquote class="example"> 1.30 cvs 3701: <p><strong>Example:</strong></p> 3702: 3703: <p>The following rules for a report's title make the title visible in the 1.37 cvs 3704: primary view and invisible in the table of contents and in the formula 3705: views (see the <a href="#sectc4224"><tt>Visibility</tt> rule</a>).</p> 1.30 cvs 3706: <pre>Title : BEGIN 1.1 cvs 3707: Visibility : 1; 3708: ... {Other rules for the primary view} 3709: IN Table_of_contents 3710: Visibility : 0; 3711: IN Formulas 3712: Visibility : 0; 1.18 cvs 3713: END;</pre> 3714: </blockquote> 3715: </div> 1.1 cvs 3716: 1.18 cvs 3717: <div class="subsection"> 1.37 cvs 3718: <h3><a name="sectc4214" id="sectc4214">Conditions applying to presentation 3719: rules</a></h3> 1.1 cvs 3720: 1.37 cvs 3721: <p>Many conditions can be applied to presentation rules. Conditions allow 3722: certain presentation rules to apply only in certain cases. These conditions 3723: can be based on the structural position of the element. They can be based on 1.1 cvs 3724: whether the element has references, and what type of references, whether the 1.33 cvs 3725: element has attributes, whether the element is empty or not, whether the 3726: element is the root of its document or not. They can also be based on the 3727: value of a counter.</p> 1.30 cvs 3728: 1.37 cvs 3729: <p>It is possible to specify several conditions which must all be true for 3730: the rules to apply.</p> 1.30 cvs 3731: 1.37 cvs 3732: <p>A set of conditions is specified by the <tt>IF</tt> keyword. This keyword 1.30 cvs 3733: is followed by the sequence of conditions, separated by the <tt>AND</tt> 3734: keyword. Each condition is specified by a keyword which defines the condition 3735: type. In some cases, the keyword is followed by other data, which specify the 3736: condition more precisely.</p> 3737: 3738: <p>An elementary condition can be negative; it is then preceded by the 1.18 cvs 3739: <tt>NOT</tt> keyword.</p> 1.30 cvs 3740: 3741: <p>When the presentation rule(s) controlled by the condition apply to a 3742: reference element or a reference attribute, an elementary condition can also 1.37 cvs 3743: apply to element referred by this reference. The <tt>Target</tt> keyword is 3744: used for that purpose. It must appear before the keyword defining the 1.30 cvs 3745: condition type.</p> 1.18 cvs 3746: <pre> CondRule ='IF' ConditionSeq RuleSeq . 1.30 cvs 3747: ConditionSeq = Condition < 'AND' Condition > . 1.1 cvs 3748: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem . 3749: ConditionElem ='First' / 'Last' / 3750: [ 'Immediately' ] 'Within' [ NumParent ] 3751: ElemID [ ExtStruct ] / 3752: ElemID / 3753: 'Referred' / 'FirstRef' / 'LastRef' / 3754: 'ExternalRef' / 'InternalRef' / 'CopyRef' / 3755: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' / 3756: 'UserPage' / 'StartPage' / 'ComputedPage' / 1.33 cvs 3757: 'Empty' / 'Root' / 1.1 cvs 3758: '(' [ MinMax ] CounterName CounterCond ')' / 3759: CondPage '(' CounterID ')' . 3760: NumParent = [ GreaterLess ] NParent . 1.30 cvs 3761: GreaterLess ='>' / '<' . 1.1 cvs 3762: NParent = NUMBER. 1.6 cvs 3763: ExtStruct ='(' ElemID ')' . 1.30 cvs 3764: CounterCond ='<' MaxCtrVal / '>' MinCtrVal / 1.1 cvs 3765: '=' EqCtrVal / 3766: 'IN' '[' ['-'] MinCtrBound '.' '.' 3767: ['-'] MaxCtrBound ']' . 3768: PageCond ='Even' / 'Odd' / 'One' . 3769: MaxCtrVal = NUMBER . 3770: MinCtrVal = NUMBER . 3771: EqCtrVal = NUMBER . 3772: MaxCtrBound = NUMBER . 1.18 cvs 3773: MinCtrBound = NUMBER .</pre> 1.1 cvs 3774: 1.18 cvs 3775: <div class="subsubsection"> 1.37 cvs 3776: <h4><a name="sectd42141" id="sectd42141">Conditions based on the logical 3777: position of the element</a></h4> 1.30 cvs 3778: 3779: <p>The condition can be on the position of the element in the document's 1.37 cvs 3780: logical structure tree. It is possible to test whether the element is the 1.30 cvs 3781: first (<tt>First</tt>) or last (<tt>Last</tt>) among its siblings or if it is 3782: not the first (<tt>NOT First</tt>) or not the last (<tt>NOT Last</tt>). These 1.18 cvs 3783: conditions can be associated only with <a href="#sectc4232">creation 3784: rules</a>.</p> 1.30 cvs 3785: 1.33 cvs 3786: <p>It is possible to test if the element is the root of its document (keyword 3787: <code>Root</code>).</p> 3788: 1.30 cvs 3789: <p>It is also possible to test if the element is contained in an element of a 1.18 cvs 3790: given type (<tt>Within</tt>) or if it is not (<tt>NOT Within</tt>). The type 3791: is indicated after the keyword <tt>Within</tt>. If that element type is 1.1 cvs 3792: defined in a structure schema which is not the one which corresponds to the 3793: presentation schema, the type name of this element must be followed, between 1.18 cvs 3794: parentheses, by the name of the structure schema which defines it.</p> 1.30 cvs 3795: 3796: <p>If the keyword <tt>Within</tt> is preceded by <tt>Immediately</tt>, the 1.18 cvs 3797: condition is satisfied only if the <em>parent</em> element has the type 3798: indicated. If the word <tt>Immediately</tt> is missing, the condition is 3799: satisfied if any <em>ancestor</em> has the type indicated.</p> 1.30 cvs 3800: 3801: <p>An integer <i>n</i> can appear between the keyword <tt>Within</tt> and the 1.37 cvs 3802: type. It specifies the number of ancestors of the indicated type that must be 3803: present for the condition to be satisfied. If the keyword 1.18 cvs 3804: <tt>Immediately</tt> is also present, the <i>n</i> immediate ancestors of the 1.37 cvs 3805: element must have the indicated type. The integer <i>n</i> must be positive 3806: or zero. It can be preceded by <tt><</tt> or <tt>></tt> to indicate a 3807: maximum or minimum number of ancestors. If these symbols are missing, the 3808: condition is satisfied only if it exists exactly <i>n</i> ancestors. When 1.30 cvs 3809: this number is missing, it is equivalent to > 0.</p> 3810: 3811: <p>If the condition applies to presentation rules associated with an 3812: attribute, in the <tt>ATTRIBUTES</tt> section of the presentation schema, the 3813: condition can be simply an element name. Presentation rules are then executed 3814: only if the attribute is attached to an element of that type. The keyword 3815: <tt>NOT</tt> before the element name indicates that the presentation rules 3816: must be executed only if the element is not of the type indicated.</p> 1.18 cvs 3817: </div> 1.1 cvs 3818: 1.18 cvs 3819: <div class="subsubsection"> 1.37 cvs 3820: <h4><a name="sectd42142" id="sectd42142">Conditions on references</a></h4> 1.30 cvs 3821: 3822: <p>References may be taken into account in conditions, which can be based on 3823: the fact that the element, or one of its ancestors, is designated by a at 3824: least one reference (<tt>Referred</tt>) or by none (<tt>NOT 3825: Referred</tt>).</p> 3826: 3827: <p>If the element or attribute to which the condition is attached is a 3828: reference, the condition can be based on the fact that it acts as the first 3829: reference to the designated element (<tt>FirstRef</tt>), or as the last 3830: (<tt>LastRef</tt>), or as a reference to an element located in another 3831: document (<tt>ExternalRef</tt>) or in the same document 3832: (<tt>InternalRef</tt>).</p> 1.1 cvs 3833: 1.30 cvs 3834: <p>The condition can also be based on the fact that the element is an <a 1.37 cvs 3835: href="#inclusion">inclusion</a>. This is noted (<tt>CopyRef</tt>).</p> 1.30 cvs 3836: 3837: <p>Like all conditions, conditions on references can be inverted by the 1.18 cvs 3838: <tt>NOT</tt> keyword. These conditions can be associated only with <a 3839: href="#sectc4232">creation rules</a>.</p> 3840: </div> 1.1 cvs 3841: 1.18 cvs 3842: <div class="subsubsection"> 1.37 cvs 3843: <h4><a name="sectd42143" id="sectd42143">Conditions on logical 3844: attributes</a></h4> 1.30 cvs 3845: 3846: <p>The condition can be based on the presence or absence of attributes 3847: associated with the element, no matter what the attributes or their values. 3848: The <tt>AnyAttributes</tt> keyword expresses this condition.</p> 1.1 cvs 3849: 1.30 cvs 3850: <p>If the condition appears in the presentation rules of an attribute, the 1.37 cvs 3851: <tt>FirstAttr</tt> and <tt>LastAttr</tt> keywords can be used to indicate 3852: that the rules must only be applied if this attribute is the first attribute 3853: for the element or if it is the last (respectively). These conditions can 3854: also be inverted by the <tt>NOT</tt> keyword. These conditions can be 3855: associated only with <a href="#sectc4232">creation rules</a>.</p> 1.30 cvs 3856: 3857: <p>It is also possible to apply certain presentation rules only when the 3858: element being processed or one of its ancestors has a certain attribute, 1.37 cvs 3859: perhaps with a certain value. This can be done in the <a 1.18 cvs 3860: href="#sectc4210"><tt>ATTRIBUTES</tt> section</a>.</p> 3861: </div> 1.1 cvs 3862: 1.18 cvs 3863: <div class="subsubsection"> 1.37 cvs 3864: <h4><a name="sectd42144" id="sectd42144">Conditions on page breaks</a></h4> 1.1 cvs 3865: 1.30 cvs 3866: <p>The page break base type (and only this type) can use the following 1.18 cvs 3867: conditions: <tt>ComputedPage</tt>, <tt>StartPage</tt>, and <tt>UserPage</tt>. 3868: The <tt>ComputedPage</tt> condition indicates that the presentation rule(s) 1.37 cvs 3869: should apply if the page break was created automatically by Thot; the 3870: <tt>StartPage</tt> condition is true if the page break is generated before 3871: the element by the <tt>Page</tt> rule; and the <tt>UserPage</tt> condition 3872: applies if the page break was inserted by the user.</p> 1.30 cvs 3873: 3874: <p>These conditions can be associated only with <a href="#sectc4232">creation 1.18 cvs 3875: rules</a>.</p> 3876: </div> 1.1 cvs 3877: 1.18 cvs 3878: <div class="subsubsection"> 1.37 cvs 3879: <h4><a name="sectd42145" id="sectd42145">Conditions on the element's 3880: content</a></h4> 1.1 cvs 3881: 1.37 cvs 3882: <p>The condition can be based on whether or not the element is empty. An 1.30 cvs 3883: element which has no children or whose leaves are all empty is considered to 1.37 cvs 3884: be empty itself. This condition is expressed by the <tt>Empty</tt> keyword, 1.30 cvs 3885: optionally preceded by the <tt>NOT</tt> keyword. This condition can be 3886: associated only with <a href="#sectc4232">creation rules</a>.</p> 1.18 cvs 3887: </div> 1.1 cvs 3888: 1.18 cvs 3889: <div class="subsubsection"> 1.37 cvs 3890: <h4><a name="sectd42146" id="sectd42146">Conditions on counters</a></h4> 1.1 cvs 3891: 1.30 cvs 3892: <p>Presentation rules can apply when the counter's value is one, is even or 3893: odd, is equal, greater than or less than a given value or falls in a range of 1.37 cvs 3894: values. This is particularly useful for creating header and footer boxes. 1.18 cvs 3895: These conditions can be associated only with <a href="#sectc4232">creation 3896: rules</a>.</p> 1.30 cvs 3897: 3898: <p>To compare the value of a counter to a given value, a comparison is given 1.1 cvs 3899: between parentheses. The comparison is composed of the counter name followed 3900: by an equals, greater than, or less than sign and the value to which the 1.37 cvs 3901: counter will be compared. A test for whether or not a counter's value falls 3902: in a range also appears within parentheses. In this case, the counter name is 1.18 cvs 3903: followed by the <tt>IN</tt> keyword and the range definition within brackets. 3904: The <tt>Even</tt>, <tt>Odd</tt> and <tt>One</tt> are used to test a counter's 3905: value and are followed by the counter name between parentheses.</p> 1.30 cvs 3906: 3907: <p>The list of possible conditions on counters is:</p> 1.18 cvs 3908: <dl> 1.30 cvs 3909: <dt><tt>Even (Counter)</tt></dt> 3910: <dd>the box is created only if the counter has an even value.</dd> 3911: <dt><tt>Odd (Counter)</tt></dt> 3912: <dd>the box is created only if the counter has an odd value.</dd> 3913: <dt><tt>One (Counter)</tt></dt> 3914: <dd>the box is created only the counter's value is 1.</dd> 3915: <dt><tt>NOT One (Counter)</tt></dt> 3916: <dd>the box is created, unless the counter's value is 1.</dd> 3917: <dt><tt>(Counter < Value)</tt></dt> 3918: <dd>the box is created only if the counter's value is less than 3919: Value.</dd> 3920: <dt><tt>(Counter > Value)</tt></dt> 3921: <dd>the box is created only if the counter's value is greater than 3922: Value.</dd> 3923: <dt><tt>(Counter = Value)</tt></dt> 3924: <dd>the box is created only if the counter's value is equal to Value.</dd> 3925: <dt><tt>NOT (Counter = Value)</tt></dt> 3926: <dd>the is created only if the counter's value is different than 3927: Value.</dd> 3928: <dt><tt>(Counter IN [MinValue..MaxValue])</tt></dt> 3929: <dd>the box is created only if the counter's value falls in the range 3930: bounded by MinValue and MaxValue (inclusive).</dd> 3931: <dt><tt>NOT (Counter IN [MinValue..MaxValue])</tt></dt> 3932: <dd>the box is created only if the value of the counter does not fall in 3933: the range bounded by MinValue and MaxValue (inclusive).</dd> 1.18 cvs 3934: </dl> 1.30 cvs 3935: 3936: <p><strong>Note:</strong> the <tt>NOT Even</tt> and <tt>NOT Odd</tt> 3937: conditions are syntactically correct but can be expressed more simply by 3938: <tt>Odd</tt> and <tt>Even</tt>, respectively.</p> 1.18 cvs 3939: </div> 3940: </div> 1.1 cvs 3941: 1.18 cvs 3942: <div class="subsection"> 1.37 cvs 3943: <h3><a name="sectc4215" id="sectc4215">A presentation rule</a></h3> 1.1 cvs 3944: 1.34 cvs 3945: <p>A presentation rule defines either a presentation property or presentation 1.37 cvs 3946: function. The properties are:</p> 1.18 cvs 3947: <ul> 1.30 cvs 3948: <li>the position of the vertical and horizontal reference axes of the 3949: box,</li> 3950: <li>the position of the box in relation to other boxes,</li> 3951: <li>the height or width of the box, with overflow exceptions,</li> 3952: <li>the margins, padding and borders of the box,</li> 3953: <li>the characteristics of the lines contained in the box: linespacing, 1.35 cvs 3954: indentation of the first line, hyphenation,</li> 1.30 cvs 3955: <li>the conditions for breaking the box across pages,</li> 3956: <li>the characteristics of the characters contained in the box: size, font, 3957: style, underlining,</li> 3958: <li>the depth of the box among overlapping boxes (often called stacking 3959: order),</li> 3960: <li>the characteristics of graphic elements contained in the box: style and 3961: thickness of lines, fill pattern for closed objects,</li> 1.37 cvs 3962: <li>the colors in text, graphics, pictures, and symbols contained in the 3963: box are displayed or printed,</li> 1.30 cvs 3964: <li>for presentation boxes only, the contents of the box.</li> 3965: </ul> 3966: 1.37 cvs 3967: <p>The <a name="presfunct" id="presfunct">presentation functions</a> are:</p> 1.30 cvs 3968: <ul> 3969: <li>the creation of a presentation box</li> 3970: <li>the line-breaking or page-breaking style,</li> 3971: <li>the copying of another box,</li> 3972: <li>the display of the box background and border,</li> 3973: <li>the display of a background picture and its aspect.</li> 3974: </ul> 3975: 1.37 cvs 3976: <p>For each box and each view, every presentation property is defined once 3977: and only once, either explicitly or by the <a href="#sectc427">default 3978: rules</a>. In contrast, presentation functions are not obligatory and can 3979: appear many times for the same element. for example an element can create 3980: many presentation boxes. Another element may not use any presentation 1.18 cvs 3981: functions.</p> 1.30 cvs 3982: 1.34 cvs 3983: <p>Each rule defining a presentation property begins with a keyword followed 1.37 cvs 3984: by a colon. The keyword indicates the property which is the subject of the 3985: rule. After the keyword and the colon, the remainder of the rule varies. All 1.18 cvs 3986: rules are terminated by a semicolon.</p> 1.34 cvs 3987: <pre> Rule = Property ';' / PresFunc ';' . 3988: Property ='VertRef' ':' PositionHoriz / 1.6 cvs 3989: 'HorizRef' ':' PositionVert / 3990: 'VertPos' ':' VPos / 3991: 'HorizPos' ':' HPos / 3992: 'Height' ':' Dimension / 3993: 'Width' ':' Dimension / 3994: 'VertOverflow' ':' Boolean / 1.1 cvs 3995: 'HorizOverflow' ':' Boolean / 1.26 cvs 3996: 'MarginTop' ':' MarginWidth / 3997: 'MarginRight' ':' MarginWidth / 3998: 'MarginBottom' ':' MarginWidth / 3999: 'MarginLeft' ':' MarginWidth / 4000: 'PaddingTop' ':' PaddingWidth / 4001: 'PaddingRight' ':' PaddingWidth / 4002: 'PaddingBottom' ':' PaddingWidth / 4003: 'PaddingLeft' ':' PaddingWidth / 4004: 'BorderTopWidth' ':' BorderWidth / 4005: 'BorderRightWidth' ':' BorderWidth / 4006: 'BorderBottomWidth' ':' BorderWidth / 4007: 'BorderLeftWidth' ':' BorderWidth / 4008: 'BorderTopColor' ':' BorderColor / 4009: 'BorderRightColor' ':' BorderColor / 4010: 'BorderBottomColor' ':' BorderColor / 4011: 'BorderLeftColor' ':' BorderColor / 4012: 'BorderTopStyle' ':' BorderStyle / 4013: 'BorderRightStyle' ':' BorderStyle / 4014: 'BorderBottomStyle' ':' BorderStyle / 4015: 'BorderLeftStyle' ':' BorderStyle . 1.6 cvs 4016: 'LineSpacing' ':' DistanceInherit / 4017: 'Indent' ':' DistanceInherit / 4018: 'Adjust' ':' AdjustInherit / 4019: 'Hyphenate' ':' BoolInherit / 4020: 'PageBreak' ':' Boolean / 4021: 'LineBreak' ':' Boolean / 4022: 'InLine' ':' Boolean / 4023: 'NoBreak1' ':' AbsDist / 4024: 'NoBreak2' ':' AbsDist / 4025: 'Gather' ':' Boolean / 4026: 'Visibility' ':' NumberInherit / 4027: 'Size' ':' SizeInherit / 4028: 'Font' ':' NameInherit / 4029: 'Style' ':' StyleInherit / 1.23 cvs 4030: 'Weight' ':' WeightInherit / 1.6 cvs 4031: 'Underline' ':' UnderLineInherit / 4032: 'Thickness' ':' ThicknessInherit / 4033: 'Depth' ':' NumberInherit / 4034: 'LineStyle' ':' LineStyleInherit / 4035: 'LineWeight' ':' DistanceInherit / 4036: 'FillPattern' ':' NameInherit / 4037: 'Background' ':' NameInherit / 1.13 cvs 4038: 'Foreground' ':' NameInherit / 1.6 cvs 4039: 'Content' ':' VarConst . 1.1 cvs 4040: PresFunc = Creation '(' BoxID ')' / 4041: 'Line' / 4042: 'NoLine' / 4043: 'Page' '(' BoxID ')' / 1.13 cvs 4044: 'Copy' '(' BoxTypeToCopy ')' / 4045: 'ShowBox' / 1.18 cvs 4046: 'BackgroundPicture' ':' FileName / 4047: 'PictureMode' ':' PictMode /</pre> 4048: </div> 4049: 4050: <div class="subsection"> 1.37 cvs 4051: <h3><a name="sectc4216" id="sectc4216">Box axes</a></h3> 1.18 cvs 4052: 1.30 cvs 4053: <p>The position of the middle axes <tt>VMiddle</tt> and <tt>HMiddle</tt> in 1.1 cvs 4054: relation to their box is always calculated automatically as a function of the 1.37 cvs 4055: height and width of the box and is not specified by the presentation rules. 4056: In the presentation schema, these middle axes are used only to position their 4057: box with respect to another by specifying the distance between the middle 4058: axis and an axis or a side of another box (see the <a 4059: href="#sectc4218">relative position</a>).</p> 4060: 4061: <p>The reference axes of a box are also used to position their box in 4062: relation to another, but in contrast to the middle axes, the presentation 4063: schema must make their position explicit, either in relation to a side or the 4064: middle axis of the box itself, or in relation to an axis of an enclosed 4065: box.</p> 1.30 cvs 4066: 1.37 cvs 4067: <p>Only boxes of base elements have predefined reference axes. For character 1.1 cvs 4068: string boxes, the horizontal reference axis is the baseline of the characters 4069: (the line which passes immediately under the upper-case letters, ignoring the 4070: letter Q) and the vertical reference axis is at the left edge of the first 1.18 cvs 4071: character of the string.</p> 1.30 cvs 4072: 1.37 cvs 4073: <p>The positions of a box's reference axes are defined by the 4074: <tt>VertRef</tt> and <tt>HorizRef</tt> rules which specify the <a 4075: href="#distance">distance</a> between the reference axis and an axis or 4076: parallel side of the same box or of an enclosed box.</p> 1.18 cvs 4077: <pre> 'VertRef' ':' PositionHoriz 4078: 'HorizRef' ':' PositionVert</pre> 1.30 cvs 4079: 1.18 cvs 4080: <blockquote class="example"> 1.30 cvs 4081: <p><strong>Example:</strong></p> 4082: 4083: <p>If, in the structure schema for mathematical formulas, the fraction 4084: element is defined by</p> 4085: <pre>Fraction = BEGIN 1.1 cvs 4086: Numerator = Expression; 4087: Denominator = Expression; 1.18 cvs 4088: END;</pre> 1.30 cvs 4089: 4090: <p>then the horizontal reference axis of the fraction can be positioned on 4091: top of the denominator by the rule:</p> 4092: <pre>Fraction : 1.1 cvs 4093: BEGIN 4094: HorizRef : Enclosed Denominator . Top; 4095: ... 1.18 cvs 4096: END;</pre> 1.30 cvs 4097: 4098: <p>To put the horizontal reference axis of a column at its middle:</p> 4099: <pre>Column : 1.1 cvs 4100: BEGIN 4101: HorizRef : * . HMiddle; 4102: ... 1.18 cvs 4103: END;</pre> 4104: </blockquote> 4105: </div> 1.1 cvs 4106: 1.18 cvs 4107: <div class="subsection"> 1.37 cvs 4108: <h3><a name="sectc4217" id="sectc4217">Distance units</a></h3> 1.1 cvs 4109: 1.30 cvs 4110: <p>Some distances and dimensions appear in many rules of a presentation 4111: schema, especially in position rules (<tt>VertPos, HorizPos</tt>), in extent 4112: rules for boxes (<tt>Height, Width</tt>), in rules defining lines 1.37 cvs 4113: (<tt>LineSpacing, Indent</tt>), in rules controlling pagination 4114: (<tt>NoBreak1, NoBreak2</tt>) and in rules specifying the thickness of 4115: strokes (<tt>LineWeight</tt>).</p> 1.30 cvs 4116: 4117: <p>In all these rules, the distance or extent can be expressed</p> 4118: <ul> 4119: <li>either in relative units, which depend on the size of the characters in 4120: the current font: height of the element's font or height of the letter 4121: 'x',</li> 1.37 cvs 4122: <li>or in absolute units: centimeter, millimeter, inch, typographer's 4123: point, pica or pixel.</li> 1.30 cvs 4124: </ul> 4125: 1.37 cvs 4126: <p>Units can be chosen freely. Thus, it is possible to use relative units in 1.30 cvs 4127: one rule, centimeters in the next rule, and typographer's points in 4128: another.</p> 4129: 1.37 cvs 4130: <p>Absolute units are used to set rigid rules for the appearance of 4131: documents. In contrast, relative units allow changes of scale. The editor 4132: lets the value of relative units be changed dynamically. Such changes affect 4133: every box using relative units simultaneously and in the same proportion. 4134: Changing the value of the relative units affects the size of the characters 4135: and graphical elements, and the size of the boxes and the distances between 4136: them.</p> 4137: 4138: <p>A <a name="distance" id="distance">distance</a> or extent is specified by 4139: a number, which may be followed by one or more spaces and a units keyword. 4140: When there is no units keyword, the number specifies the number of relative 4141: units, where a relative unit is the height of a character in the current font 4142: (an em). When the number is followed by a units keyword, the keyword 4143: indicates the type of absolute units:</p> 1.18 cvs 4144: <ul> 1.30 cvs 4145: <li><tt>em</tt>: height of the element's font,</li> 4146: <li><tt>ex</tt>: height of the letter 'x',</li> 4147: <li><tt>cm</tt>: centimeter,</li> 4148: <li><tt>mm</tt>: millimeter,</li> 4149: <li><tt>in</tt>: inch (1 in = 2.54 cm),</li> 4150: <li><tt>pt</tt>: point (1 pt = 1/72 in),</li> 4151: <li><tt>pc</tt>: pica (1 pc = 12 pt),</li> 4152: <li><tt>px</tt>: pixel.</li> 1.18 cvs 4153: </ul> 1.30 cvs 4154: 4155: <p>Whatever the chosen unit, relative or absolute, the number is not 1.37 cvs 4156: necessarily an integer and may be expressed in fixed point notation (using 4157: the American convention of a period to express the decimal point).</p> 1.30 cvs 4158: 1.37 cvs 4159: <p>If the distance appears in a presentation rule for a numeric attribute, 4160: the number can be replaced by the name of an attribute. In this case, the 4161: value of the attribute is used. Obviously, the attribute name cannot be 4162: followed by a decimal point and a fractional part, but it can be followed a 4163: units keyword. However, the choice of units is limited to em, ex, pt and 4164: px.</p> 1.18 cvs 4165: <pre> Distance = [ Sign ] AbsDist . 1.1 cvs 4166: Sign ='+' / '-' . 4167: AbsDist = IntegerOrAttr [ '.' DecimalPart ] 4168: [ Unit ]. 4169: IntegerOrAttr = IntegerPart / AttrID . 4170: IntegerPart = NUMBER . 4171: DecimalPart = NUMBER . 4172: Unit ='em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' / 1.18 cvs 4173: 'pc' / 'px' / '%' .</pre> 1.30 cvs 4174: 1.18 cvs 4175: <blockquote class="example"> 1.30 cvs 4176: <p><strong>Example:</strong></p> 4177: 4178: <p>The following rules specify that a box has a height of 10.5 centimeters 4179: and a width of 5.3 ems:</p> 4180: <pre>Height : 10.5 cm; 1.18 cvs 4181: Width : 5.3;</pre> 4182: </blockquote> 4183: </div> 1.1 cvs 4184: 1.18 cvs 4185: <div class="subsection"> 1.37 cvs 4186: <h3><a name="sectc4218" id="sectc4218">Relative positions</a></h3> 1.1 cvs 4187: 1.37 cvs 4188: <p>The positioning of boxes uses the eight axes and sides, the sides 4189: generally being used to define the juxtapositioning (vertical or horizontal) 4190: of boxes, the middle axes being used to define centering, and the reference 4191: axes being used for alignment.</p> 4192: 4193: <p>Two rules allow a box to be placed relative to other boxes. The 4194: <tt>VertPos</tt> rule positions the box vertically. The <tt>HorizPos</tt> 4195: rule positions the box horizontally. It is possible that a box's position 4196: could be entirely determined by other boxes positioned relative to it. In 4197: this case, the position is implicit and the word <tt>nil</tt> can be used to 4198: specify that no position rule is needed. Otherwise, an explicit rule must be 1.18 cvs 4199: given by indicating the axis or side which defines the position of the box, 4200: followed by an equals sign and the distance between between this axis or side 1.37 cvs 4201: and a parallel axis or side of another box, called the reference box. The box 1.18 cvs 4202: for which the rule is written will be positioned relative to the reference 4203: box.</p> 4204: <pre> 'VertPos' ':' VPos 1.6 cvs 4205: 'HorizPos' ':' HPos 4206: HPos = 'nil' / VertAxis '=' HorizPosition 4207: [ 'UserSpecified' ]. 4208: VPos = 'nil' / HorizAxis '=' VertPosition 4209: [ 'UserSpecified' ]. 1.1 cvs 4210: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' . 1.18 cvs 4211: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .</pre> 1.30 cvs 4212: 1.37 cvs 4213: <p>The reference box is an adjacent box: enclosing, enclosed or adjacent. 4214: When a rule is associated with a reference type attribute (and only in this 4215: case), it can be a box of the element designated by the attribute. The 4216: reference box can be either a presentation box previously defined in the 4217: <tt>BOXES</tt> section of the schema and created by a creation function, or 4218: the box associated with a structured element.</p> 4219: 4220: <p>The structural position of the reference box (relative to the box for 4221: which the rule is being written) is indicated by a keyword: 4222: <tt>Enclosing</tt>, <tt>Enclosed</tt>, or, for sibling boxes, 4223: <tt>Previous</tt> or <tt>Next</tt>. The reference attributes, or presentation 4224: boxes created by a reference attribute, the <tt>Referred</tt> keyword may be 4225: used to designate the element which the reference points to. The keyword 4226: <tt>Creator</tt> can be used in rules for presentation boxes to designate the 4227: box of the element which created the presentation box. Finally, the 4228: <tt>Root</tt> keyword can be used to designate the root of the document.</p> 1.30 cvs 4229: 4230: <p>When the keyword is ambiguous, it is followed by the name of an element 4231: type or presentation box which resolves the ambiguity (the <tt>Creator</tt> 1.37 cvs 4232: and <tt>Root</tt> keywords are never ambiguous). If this name is not given, 1.30 cvs 4233: then the first box encountered is used as the reference box. It is also 4234: possible to use just the name of an element type or presentation box without 1.37 cvs 4235: an initial keyword. In this case, a sibling having that name will be used. If 1.30 cvs 4236: the name is preceded by the keyword <tt>NOT</tt>, then the reference box will 4237: be the first box whose type is not the named one.</p> 4238: 4239: <p>In place of the box or type name, the keywords <tt>AnyElem</tt>, 1.18 cvs 4240: <tt>AnyBox</tt> and <tt>ElemWithAttr</tt> can be used, representing 1.17 cvs 4241: respectively, any structured element box, any presentation box, and the box 4242: corresponding to any structured element having a particular attribute, 4243: whatever its value; the name of this attribute must follow the keyword 1.18 cvs 4244: <tt>ElemWithAttr</tt>.</p> 1.30 cvs 4245: 4246: <p>A type name may be preceded by a star in order to resolve the ambiguity in 4247: the special case where the structure schema defines an <a 1.18 cvs 4248: href="#sectd3284">inclusion</a> without expansion (or with partial expansion) 1.37 cvs 4249: of the same type as an element of the scheme. For mark pairs (and only for <a 1.18 cvs 4250: href="#sectd3285">mark pairs</a>) the type name <em>must</em> be preceded by 4251: the <tt>First</tt> or <tt>Second</tt> keyword, which indicates which of the 1.37 cvs 4252: two marks of the pair should be used as the reference box.</p> 1.30 cvs 4253: 4254: <p>The star character ('<tt>*</tt>') used alone designates the box to which 1.37 cvs 4255: the rule applies (in this case, it is obviously useless to specify the type 4256: of the reference box).</p> 1.30 cvs 4257: 1.37 cvs 4258: <p>The keywords <tt>Enclosing</tt> and <tt>Enclosed</tt> can be used no 4259: matter what constructor defines the type to which the rule applies. When 4260: applied to the element which represents the entire document, 4261: <tt>Enclosing</tt> designates the window or page in which the document's 4262: image is displayed for the view to which the rule applies. A box or type name 4263: without a keyword is used for aggregate elements and designates another 4264: element of the same aggregate. It can also be used to designate a 4265: presentation or page layout box. The keywords <tt>Previous</tt> and 4266: <tt>Next</tt> are primarily used to denote list elements, but can also be 4267: used to denote elements of an aggregate.</p> 4268: 4269: <p>In the position rule, the structural position relative to the reference 4270: box is followed, after a period, by the name of an axis or side. The rule 4271: specifies its node's position as being some distance from this axis or side 4272: of the reference box. If this distance is zero, then the distance does not 4273: appear in the rule. Otherwise, it does appear as a positive or negative 1.30 cvs 4274: number (the sign is required for negative numbers). The sign takes into 4275: account the orientation of the coordinate axes: for top to bottom for the 1.37 cvs 4276: vertical axis and from left to right for the horizontal axis. Thus, a 1.30 cvs 4277: negative distance in a vertical position indicates that the side or axis 4278: specified in the rule is above the side or axis of the reference box.</p> 4279: 1.37 cvs 4280: <p>The distance can be followed by the <tt>UserSpecified</tt> keyword (even 4281: if the distance is nil and does not appear, the <tt>UserSpecified</tt> 4282: keyword can be used). It indicates that when the element to which the rule 4283: applies is being created, the editor will ask the user to specify the 4284: distance himself, using the mouse. In this case, the distance specified in 4285: the rule is a default distance which is suggested to the user but can be 4286: modified. The <tt>UserSpecified</tt> keyword can be used either in the 4287: vertical position rule, the horizontal position rule, or both.</p> 1.18 cvs 4288: <pre> VertPosition = Reference '.' HorizAxis [ Distance ] . 1.1 cvs 4289: HorizPosition = Reference '.' VertAxis [ Distance ] . 4290: Reference ='Enclosing' [ BoxTypeNot ] / 4291: 'Enclosed' [ BoxTypeNot ] / 4292: 'Previous' [ BoxTypeNot ] / 4293: 'Next' [ BoxTypeNot ] / 4294: 'Referred' [ BoxTypeNot ] / 4295: 'Creator' / 4296: 'Root' / 4297: '*' / 4298: BoxOrType . 4299: BoxOrType = BoxID / 4300: [ '*' ] [ FirstSec ] ElemID / 1.17 cvs 4301: 'AnyElem' / 'AnyBox' / 4302: 'ElemWithAttr' AttrID . 1.18 cvs 4303: BoxTypeNot = [ 'NOT' ] BoxOrType .</pre> 1.30 cvs 4304: 1.18 cvs 4305: <blockquote class="example"> 1.30 cvs 4306: <p><strong>Example:</strong></p> 4307: 1.37 cvs 4308: <p>If a <a name="expos1" id="expos1">report</a> is defined by the following 4309: structure schema:</p> 1.30 cvs 4310: <pre>Report = BEGIN 1.6 cvs 4311: Title = Text; 4312: Summary = Text; 4313: Keywords = Text; 4314: ... 1.18 cvs 4315: END;</pre> 1.30 cvs 4316: 4317: <p>then the presentation schema could contain the rules:</p> 4318: <pre>Report : BEGIN 1.6 cvs 4319: VertPos : Top = Enclosing . Top; 4320: HorizPos : Left = Enclosing . Left; 4321: ... 1.18 cvs 4322: END;</pre> 1.30 cvs 4323: 1.37 cvs 4324: <p>These rules place the <a name="reportexample" 4325: id="reportexample">report</a> in the upper left corner of the enclosing 4326: box, which is the window in which the document is being edited.</p> 1.30 cvs 4327: <pre>Title : BEGIN 1.6 cvs 4328: VertPos : Top = Enclosing . Top + 1; 4329: HorizPos : VMiddle = Enclosing . VMiddle; 4330: ... 1.18 cvs 4331: END;</pre> 1.30 cvs 4332: 1.37 cvs 4333: <p>The top of the title is one line (a line has the height of the 4334: characters of the title) from the top of the report, which is also the top 4335: of the editing window. The title is centered horizontally in the window 4336: (see <a href="#posdim">figure</a>).</p> 1.30 cvs 4337: <pre>Summary : BEGIN 1.1 cvs 4338: VertPos : Top = Title . Bottom + 1.5; 4339: HorizPos : Left = Enclosing . Left + 2 cm; 4340: ... 1.18 cvs 4341: END;</pre> 1.30 cvs 4342: 1.37 cvs 4343: <p>The top of the summary is place a line and a half below the bottom of 4344: the title and is shifted two centimeters from the side of the window.</p> 1.18 cvs 4345: </blockquote> 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>Suppose there is a <a name="expos2" id="expos2">Design</a> logical 4351: structure which contains graphical elements:</p> 1.30 cvs 4352: <pre>Design = LIST OF (ElemGraph = GRAPHICS);</pre> 4353: 4354: <p>The following rules allow the user to freely choose the position of each 4355: element when it is created:</p> 4356: <pre>ElemGraph = 1.1 cvs 4357: BEGIN 4358: VertPos : Top = Enclosing . Top + 1 cm UserSpecified; 4359: HorizPos: Left = Enclosing . Left UserSpecified; 4360: ... 1.18 cvs 4361: END;</pre> 1.30 cvs 4362: 4363: <p>Thus, when a graphical element is created, its default placement is at 4364: the left of the window and 1 cm from the top, but the user can move it 4365: immediately, simply by moving the mouse.</p> 1.18 cvs 4366: </blockquote> 4367: </div> 1.1 cvs 4368: 1.18 cvs 4369: <div class="subsection"> 1.37 cvs 4370: <h3><a name="sectc4219" id="sectc4219">Box extents</a></h3> 1.1 cvs 4371: 1.30 cvs 4372: <p>The extents (height and width) of each box are defined by the two rules 1.37 cvs 4373: <tt>Height</tt> and <tt>Width</tt>. There are three types of extents: fixed, 1.18 cvs 4374: relative, and elastic.</p> 1.1 cvs 4375: 1.18 cvs 4376: <div class="subsubsection"> 1.37 cvs 4377: <h4><a name="sectd42191" id="sectd42191">Fixed extents</a></h4> 1.1 cvs 4378: 1.30 cvs 4379: <p>A fixed dimension sets the height or width of the box independently of all 1.37 cvs 4380: other boxes. It is expressed in <a href="#sectc4217">distance units</a>. The 1.18 cvs 4381: extent can be followed by the <tt>UserSpecified</tt> keyword which indicates 1.1 cvs 4382: that when the element to which the rule applies is being created, the editor 1.37 cvs 4383: will ask the user to specify the extent himself, using the mouse. In this 1.1 cvs 4384: case, the extent specified in the rule is a default extent which is suggested 1.37 cvs 4385: to the user but can be modified. The <tt>UserSpecified</tt> keyword can be 1.18 cvs 4386: used either in the <tt>Height</tt> rule, the <tt>Width</tt> rule, or both.</p> 1.30 cvs 4387: 4388: <p>A fixed extent rule can be ended by the <tt>Min</tt> keyword, which 4389: signifies that the indicated value is a minimum, and that, if the contents of 4390: the box require it, a larger extent is possible.</p> 1.18 cvs 4391: <pre> 'Height' ':' Dimension 1.1 cvs 4392: 'Width' ':' Dimension 4393: Dimension = AbsDist [ 'UserSpecified' ] [ 'Min' ] / 1.18 cvs 4394: ...</pre> 1.30 cvs 4395: 1.18 cvs 4396: <blockquote class="example"> 1.30 cvs 4397: <p><strong>Example:</strong></p> 4398: 4399: <p>Continuing with the <a href="#expos2">previous example</a>, it is 4400: possible to allow the user to choose the size of each graphical element as 4401: it is created:</p> 4402: <pre>ElemGraph : BEGIN 1.6 cvs 4403: Width : 2 cm UserSpecified; 1.1 cvs 4404: Height : 1 cm UserSpecified; 4405: ... 1.18 cvs 4406: END;</pre> 1.30 cvs 4407: 4408: <p>Thus, when a graphical element is create, it is drawn by default with a 4409: width of 2 cm and a height of 1 cm, but the user is free to resize it 4410: immediately with the mouse.</p> 4411: <pre>Summary : BEGIN 1.1 cvs 4412: Height : 5 cm Min; 4413: ... 4414: END; 4415: Keywords : BEGIN 4416: VertPos : Top = Summary . Bottom; 4417: ... 1.18 cvs 4418: END;</pre> 4419: </blockquote> 4420: </div> 1.1 cvs 4421: 1.18 cvs 4422: <div class="subsubsection"> 1.37 cvs 4423: <h4><a name="sectd42192" id="sectd42192">Relative extents</a></h4> 1.30 cvs 4424: 4425: <p>A relative extent determines the extent as a function of the extent of 4426: another box, just as a relative position places a box in relation to another. 4427: The reference box in an extent rule is designated using the same syntax as is 1.37 cvs 4428: used in a relative position rule. It is followed by a period and a 1.30 cvs 4429: <tt>Height</tt> or <tt>Width</tt> keyword, depending on the extent being 1.37 cvs 4430: referred to. Next comes the relation between the extent being defined and the 4431: extent of the reference box. This relation can be either a percentage or a 1.30 cvs 4432: difference.</p> 1.1 cvs 4433: 1.37 cvs 4434: <p>A percentage is indicated by a star (the multiplication symbol) followed 4435: by the numeric percentage value (which may be greater than or less than 100) 4436: and the percent (`%') character. A difference is simply indicated by a signed 1.18 cvs 4437: difference.</p> 1.30 cvs 4438: 4439: <p>If the rule appears in the presentation rules of a numeric attribute, the 1.1 cvs 4440: percentage value can be replaced by the name of the attribute. This attribute 1.37 cvs 4441: is then used as a percentage. The attribute can also be used as part of a <a 1.18 cvs 4442: href="#distance">difference</a>.</p> 1.30 cvs 4443: 4444: <p>Just as with a fixed extent, a relative extent rule can end with the 1.18 cvs 4445: <tt>Min</tt> keyword, which signifies that the extent is a minimum and that, 4446: if the contents of the box require it, a larger extent is possible.</p> 1.30 cvs 4447: 4448: <p>A special case of relative extent rules is:</p> 1.18 cvs 4449: <pre>Height : Enclosed . Height;</pre> 1.30 cvs 4450: 4451: <p>or</p> 1.18 cvs 4452: <pre>Width : Enclosed . Width;</pre> 1.30 cvs 4453: 4454: <p>which specifies that the box has a height (or width) such that it encloses 4455: all the boxes which it contains, excluding boxes having a rule 4456: <tt>VertOverflow: Yes;</tt> or <tt>HorizOverflow: Yes;</tt>.</p> 4457: 4458: <p><strong>Note:</strong> character strings (type <tt>TEXT_UNIT</tt>) 4459: generally must use the sum of the widths of the characters which compose them 4460: as their width, which is expressed by the rule:</p> 1.18 cvs 4461: <pre>TEXT_UNIT : 4462: Width : Enclosed . Width;</pre> 1.30 cvs 4463: 4464: <p>If this rule is not the default <tt>Width</tt> rule, it must be given 1.18 cvs 4465: explicitly in the <tt>RULES</tt> section which defines the presentation rules 4466: of the logical elements.</p> 4467: <pre> 'Height' ':' Extent 1.1 cvs 4468: 'Width' ':' Extent 4469: Extent = Reference '.' HeightWidth [ Relation ] 4470: [ 'Min' ] / ... 4471: HeightWidth ='Height' / 'Width' . 4472: Relation ='*' ExtentAttr '%' / Distance . 4473: ExtentAttr = ExtentVal / AttrID . 1.18 cvs 4474: ExtentVal = NUMBER .</pre> 1.30 cvs 4475: 1.18 cvs 4476: <blockquote class="example"> 1.30 cvs 4477: <p><strong>Example:</strong></p> 4478: 4479: <p>Completing the <a href="#expos1">above example</a>, it is possible to 4480: specify that the report takes its width from the editing window and its 4481: height from the size of its contents (this can obviously be greater than 4482: that of the window):</p> 4483: <pre>Report : BEGIN 1.1 cvs 4484: Width : Enclosing . Width; 4485: Height : Enclosed . Height; 4486: ... 1.18 cvs 4487: END;</pre> 1.30 cvs 4488: 4489: <p>Then, the following rules make the title occupy 60% of the width of the 4490: report (which is that of the window) and is broken into centered lines of 4491: this width (see the <a href="#sectc4222"><tt>Line</tt> rule</a>).</p> 4492: <pre>Title : BEGIN 1.1 cvs 4493: Width : Enclosing . Width * 60%; 4494: Height : Enclosed . Height; 4495: Line; 4496: Adjust : VMiddle; 4497: ... 1.18 cvs 4498: END;</pre> 1.30 cvs 4499: 4500: <p>The summary occupy the entire width of the window, with the exception of 4501: a 2 cm margin reserved by the horizontal position rule:</p> 4502: <pre>Summary : BEGIN 1.1 cvs 4503: Width : Enclosing . Width - 2 cm; 4504: Height : Enclosed . Height; 4505: ... 1.18 cvs 4506: END;</pre> 4507: 1.37 cvs 4508: <p>This set of rules, plus the <a href="#reportexample">position rules 4509: given above</a>, produce the layout of boxes shown in the following<a 1.30 cvs 4510: href="#posdim">figure</a>.</p> 4511: 4512: <div class="figure"> 1.37 cvs 4513: <hr /> 1.30 cvs 4514: <pre>------------------------------------------------------------- 1.1 cvs 4515: | Window and Report ^ | 4516: | | 1 line | 4517: | v | 4518: | ------------------------------------- | 4519: | | | | 4520: : 20% : Title : 20% : 1.30 cvs 4521: :<--------->: :<--------->: 1.1 cvs 4522: : : 60% : : 1.30 cvs 4523: : :<--------------------------------->: : 1.1 cvs 4524: | | | | 4525: | ------------------------------------- | 4526: | ^ | 4527: | | 1.5 line | 4528: | | | 4529: | v | 4530: | ---------------------------------------------------| 4531: | 2 cm | | 1.30 cvs 4532: |<------>| Summary | 1.18 cvs 4533: : : :</pre> 1.19 cvs 4534: 1.37 cvs 4535: <p align="center"><em><a name="posdim" id="posdim">Box position and 1.30 cvs 4536: extent</a><em></em></em></p> 1.37 cvs 4537: <hr /> 1.30 cvs 4538: </div> 1.18 cvs 4539: </blockquote> 4540: </div> 1.1 cvs 4541: 1.18 cvs 4542: <div class="subsubsection"> 1.37 cvs 4543: <h4><a name="sectd42193" id="sectd42193">Elastic extents</a></h4> 1.1 cvs 4544: 1.37 cvs 4545: <p>The last type of extent is the elastic extent. Either one or both extents 4546: can be elastic. A box has an elastic extent when two opposite sides are 1.30 cvs 4547: linked by distance constraints to two sides or axes of other boxes.</p> 4548: 4549: <p>One of the sides of the elastic box is linked by a position rule 1.37 cvs 4550: (<tt>VertPos</tt> or <tt>HorizPos</tt>) to a neighboring box. The other side 1.18 cvs 4551: is link to another box by a <tt>Height</tt> or <tt>Width</tt> rule, which 1.37 cvs 4552: takes the same form as the position rule. For the elastic box itself, the 1.1 cvs 4553: notions of sides (left or right, top or bottom) are fuzzy, since the movement 4554: of either one of the two reference boxes can, for example, make the left side 1.37 cvs 4555: of the elastic box move to the right of its right side. This is not 4556: important. The only requirement is that the two sides of the elastic box used 1.18 cvs 4557: in the position and extent rule are opposite sides of the box.</p> 4558: <pre> 'Height' ':' Extent 1.6 cvs 4559: 'Width' ':' Extent 1.18 cvs 4560: Extent = HPos / VPos / ...</pre> 1.30 cvs 4561: 1.18 cvs 4562: <blockquote class="example"> 1.30 cvs 4563: <p><strong>Example:</strong></p> 4564: 4565: <p>Suppose we want to draw an elastic arrow or line between the middle of 1.37 cvs 4566: the bottom side of box A and the upper left corner of box B. To do this, we 1.30 cvs 4567: would define a graphics box whose upper left corner coincides with the 4568: middle of the bottom side of A (a position rule) and whose lower right 4569: corner coincides with with the upper left corner of B (dimension rules):</p> 4570: <pre>LinkedBox : 1.1 cvs 4571: BEGIN 1.6 cvs 4572: VertPos : Top = A .Bottom; 1.1 cvs 4573: HorizPos : Left = A . VMiddle; 1.6 cvs 4574: Height : Bottom = B . Top; 4575: Width : Right = B . Left; 1.18 cvs 4576: END;</pre> 4577: </blockquote> 1.30 cvs 4578: 1.18 cvs 4579: <blockquote class="example"> 1.30 cvs 4580: <p><strong>Example:</strong></p> 4581: 4582: <p>The element SectionTitle creates a presentation box called SectionNum 1.37 cvs 4583: which contains the number of the section. Suppose we want to align the 4584: SectionNum and SectionTitle horizontally, have the SectionNum take its 4585: width from its contents (the section number), have the SectionTitle box 4586: begin 0.5 cm to the right of the SectionNum box and end at the right edge 4587: of its enclosing box. This would make the SectionTitle box elastic, since 4588: its width is defined by the position of its left and right sides. The 4589: following rules produce this effect:</p> 1.30 cvs 4590: <pre>SectionNum : 1.1 cvs 4591: BEGIN 4592: HorizPos : Left = Enclosing . Left; 4593: Width : Enclosed . Width; 4594: ... 4595: END; 4596: 4597: SectionTitle : 4598: BEGIN 4599: HorizPos : Left = SectionNum . Right + 0.5 cm; 4600: Width : Right = Enclosing . Right; 4601: ... 1.18 cvs 4602: END;</pre> 4603: </blockquote> 4604: </div> 4605: </div> 1.1 cvs 4606: 1.18 cvs 4607: <div class="subsection"> 1.37 cvs 4608: <h3><a name="sectc4220" id="sectc4220">Overflow</a></h3> 1.1 cvs 4609: 1.30 cvs 4610: <p>A boxes corresponding to a structural element normally contain all boxes 1.37 cvs 4611: corresponding to the elements of its subtree. However, in some cases, it 1.1 cvs 4612: could be necessary to allow a box to jut out from its parent box. Two 4613: presentation rules indicate that such an overflow is allowed, one for 1.18 cvs 4614: horizontal overflow, one for vertical overflow.</p> 1.30 cvs 4615: 4616: <p>Each of these rules is expressed by a keyword followed by a colon and the 1.18 cvs 4617: keyword <tt>Yes</tt> or <tt>No</tt>.</p> 4618: <pre> 'VertOverflow' ':' Boolean / 1.1 cvs 4619: 'HorizOverflow' ':' Boolean . 1.18 cvs 4620: Boolean = 'Yes' / 'No' .</pre> 4621: </div> 1.1 cvs 4622: 1.30 cvs 4623: <p>@@@@@ ******</p> 4624: 1.26 cvs 4625: <p>Explain Margin, Padding and Border. Refer to CSS2.</p> 4626: <pre> 'MarginTop' ':' MarginWidth / 4627: 'MarginRight' ':' MarginWidth / 4628: 'MarginBottom' ':' MarginWidth / 4629: 'MarginLeft' ':' MarginWidth / 4630: 'PaddingTop' ':' PaddingWidth / 4631: 'PaddingRight' ':' PaddingWidth / 4632: 'PaddingBottom' ':' PaddingWidth / 4633: 'PaddingLeft' ':' PaddingWidth / 4634: 'BorderTopWidth' ':' BorderWidth / 4635: 'BorderRightWidth' ':' BorderWidth / 4636: 'BorderBottomWidth' ':' BorderWidth / 4637: 'BorderLeftWidth' ':' BorderWidth / 4638: 'BorderTopColor' ':' BorderColor / 4639: 'BorderRightColor' ':' BorderColor / 4640: 'BorderBottomColor' ':' BorderColor / 4641: 'BorderLeftColor' ':' BorderColor / 4642: 'BorderTopStyle' ':' BorderStyle / 4643: 'BorderRightStyle' ':' BorderStyle / 4644: 'BorderBottomStyle' ':' BorderStyle / 4645: 'BorderLeftStyle' ':' BorderStyle . 4646: 4647: MarginWidth = InheritParent / 'Auto' / Distance . 4648: PaddingWidth = InheritParent / Distance . 4649: BorderWidth = InheritParent / 'Thin' / 'Medium' / 'Thick' / Distance . 4650: BorderColor = InheritParent / 'Transparent' / 'Foreground' / 4651: ColorName . 4652: BorderStyle = InheritParent / 4653: 'None' / 'Hidden' / 'Dotted' / 'Dashed' / 'Solid' / 4654: 'Double' / 'Groove' / 'Ridge' / 'Inset' / 'Outset' . 1.27 cvs 4655: InheritParent = 'Enclosing' '=' / 'Creator' '=' . 1.26 cvs 4656: ColorName = NAME .</pre> 1.30 cvs 4657: 4658: <p>@@@@@ ******</p> 1.26 cvs 4659: 1.18 cvs 4660: <div class="subsection"> 1.37 cvs 4661: <h3><a name="sectc4221" id="sectc4221">Inheritance</a></h3> 1.1 cvs 4662: 1.37 cvs 4663: <p>A presentation property can be defined by reference to the same property 4664: of another box in the tree of boxes. These structural links are expressed by 4665: kinship. The reference box can be that of the element immediately above in 1.18 cvs 4666: the structure (<tt>Enclosing</tt>), two levels above (<tt>GrandFather</tt>), 4667: immediately below (<tt>Enclosed</tt>) or immediately before 1.37 cvs 4668: (<tt>Previous</tt>). In the case of a presentation box, and only in that 1.1 cvs 4669: case, the reference box may be the element which created the presentation box 1.18 cvs 4670: (<tt>Creator</tt>).</p> 1.30 cvs 4671: 4672: <p>Kinship is expressed in terms of the logical structure of the document and 1.37 cvs 4673: not in terms of the tree of boxes. The presentation box cannot transmit any 1.34 cvs 4674: of their properties by inheritance; only structured element boxes can do so. 1.37 cvs 4675: As an example, consider an element B which follows an element A in the 4676: logical structure. The element B creates a presentation box P in front of 4677: itself, using the <tt>CreateBefore</tt> rule (see the <a 4678: href="#sectc4232">creation rules</a>). If element B's box inherits its 4679: character style using the <tt>Previous</tt> kinship operation, it gets its 4680: character style from A's box, not from P's box. Inheritance works differently 4681: for positions and extents, which can refer to presentation boxes.</p> 1.30 cvs 4682: 1.34 cvs 4683: <p>The inherited property value can be the same as that of the reference box. 1.37 cvs 4684: This is indicated by an equals sign. However, for numeric properties, a 1.1 cvs 4685: different value can be obtained by adding or subtracting a number from the 1.37 cvs 4686: reference box's property value. Addition is indicated by a plus sign before 4687: the number, while subtraction is specified with a minus sign. The value of a 1.34 cvs 4688: property can also be given a maximum (if the sign is a plus) or minimum (if 1.18 cvs 4689: the sign is a minus).</p> 1.30 cvs 4690: 4691: <p>If the rule is being applied to a numeric attribute, the number to add or 1.37 cvs 4692: subtract can be replaced by the attribute name. The value of a maximum or 4693: minimum may also be replaced by an attribute name. In these cases, the value 1.18 cvs 4694: of the attribute is used.</p> 4695: <pre> Inheritance = Kinship InheritedValue . 1.6 cvs 4696: Kinship ='Enclosing' / 'GrandFather' / 'Enclosed' / 4697: 'Previous' / 'Creator' . 1.1 cvs 4698: InheritedValue ='+' PosIntAttr [ 'Max' maximumA ] / 1.6 cvs 4699: '-' NegIntAttr [ 'Min' minimumA ] / 4700: '=' . 4701: PosIntAttr = PosInt / AttrID . 4702: PosInt = NUMBER . 4703: NegIntAttr = NegInt / AttrID . 4704: NegInt = NUMBER . 4705: maximumA = maximum / AttrID . 4706: maximum = NUMBER . 4707: minimumA = minimum / AttrID . 1.18 cvs 4708: minimum = NUMBER .</pre> 1.30 cvs 4709: 1.36 cvs 4710: <p>The properties which can be obtained by inheritance are hyphenation, 4711: interline spacing, character font (font family), font style, font size, 4712: visibility, indentation, underlining, alignment of text, stacking order of 4713: objects, the style and thickness of lines, fill pattern and the colors of 1.18 cvs 4714: lines and characters.</p> 4715: </div> 1.1 cvs 4716: 1.18 cvs 4717: <div class="subsection"> 1.37 cvs 4718: <h3><a name="sectc4222" id="sectc4222">Line breaking</a></h3> 1.1 cvs 4719: 1.30 cvs 4720: <p>The <tt>Line</tt> rule specifies that the contents of the box should be 4721: broken into lines: the boxes included in the box to which this rule is 4722: attached are displayed one after the other, from left to right, with their 1.37 cvs 4723: horizontal reference axes aligned so that they form a series of lines. The 1.30 cvs 4724: length of these lines is equal to the width of the box to which the 4725: <tt>Line</tt> rule is attached.</p> 4726: 4727: <p>When an included box overflows the current line, it is either carried 1.37 cvs 4728: forward to the next line, cur, or left the way it is. The <a 1.18 cvs 4729: href="#sectc4223"><tt>LineBreak</tt> rule</a> is used to allow or prevent the 1.37 cvs 4730: breaking of included boxes. If the included box is not breakable but is 4731: longer than the space remaining on the line, it is left as is. When a 1.1 cvs 4732: character string box is breakable, the line is broken between words or, if 1.37 cvs 4733: necessary, by <a href="#sectd42225">hyphenating a word</a>. When a compound 4734: box is breakable, the box is transparent in regard to line breaking. The 4735: boxes included in the compound box are treated just like included boxes which 4736: have the <tt>LineBreak</tt> rule. Thus, it is possible to traverse a complete 1.18 cvs 4737: subtree of boxes to line break the text leaves of a complex structure.</p> 1.30 cvs 4738: 4739: <p>The relative position rules of the included boxes are ignored, since the 4740: boxes will be placed according to the line breaking rules.</p> 4741: 1.37 cvs 4742: <p>The <tt>Line</tt> rule does not have a parameter. The characteristics of 4743: the lines that will be constructed are determined by the 4744: <tt>LineSpacing</tt>, <tt>Indent</tt>, <tt>Adjust</tt>, and 4745: <tt>Hyphenate</tt> rules. Moreover, the <a 4746: href="#insectd42226"><tt>Inline</tt> rule</a> permits the exclusion of 1.36 cvs 4747: certain elements from the line breaking process.</p> 1.30 cvs 4748: 4749: <p>When the <tt>Line</tt> rule appears in the rules sequence of a non-primary 1.37 cvs 4750: view, it applies only to that view, but when the <tt>Line</tt> rule appears 4751: in the rules sequence of the primary view, it also applies to the other views 4752: by default, except for those views which explicitly invoke the 4753: <tt>NoLine</tt> rule. Thus, the <tt>NoLine</tt> rule can be used in a 4754: non-primary view to override the primary view's <tt>Line</tt> rule. The 4755: <tt>NoLine</tt> rule must not be used with the primary view because the 4756: absence of the <tt>Line</tt> rule has the same effect. Like the <tt>Line</tt> 4757: rule, the <tt>NoLine</tt> rule does not take any parameters.</p> 1.18 cvs 4758: <pre> 'Line' 4759: 'NoLine'</pre> 4760: 4761: <div class="subsubsection"> 1.37 cvs 4762: <h4><a name="sectd42221" id="sectd42221">Line spacing</a></h4> 1.18 cvs 4763: 1.30 cvs 4764: <p>The <tt>LineSpacing</tt> rule defines the line spacing to be used in the 1.37 cvs 4765: line breaking process. The line spacing is the distance between the baselines 1.1 cvs 4766: (horizontal reference axis) of the successive lines produced by the 1.37 cvs 4767: <tt>Line</tt> rule. The value of the line spacing can be specified as a 4768: constant or by inheritance. It is expressed in any of the available <a 1.18 cvs 4769: href="#sectc4217">distance units</a>.</p> 1.30 cvs 4770: 4771: <p>Inheritance allows the value to be obtained from a relative in the 4772: structure tree, either without change (an equals sign appears after the 4773: inheritance keyword), with a positive difference (a plus sign), or a negative 1.37 cvs 4774: difference (a minus sign). When the rule uses a difference, the value of the 1.30 cvs 4775: difference follows the sign and is expressed as a <a 4776: href="#sectc4217">distance</a>.</p> 1.18 cvs 4777: <pre> 'LineSpacing' ':' DistOrInherit 1.6 cvs 4778: DistOrInherit = Kinship InheritedDist / Distance . 1.18 cvs 4779: InheritedDist = '=' / '+' AbsDist / '-' AbsDist .</pre> 1.30 cvs 4780: 4781: <p>When the line spacing value (or its difference from another element) is 1.37 cvs 4782: expressed in relative units, it changes with the size of the characters. 4783: Thus, when a larger font is chosen for a part of the document, the line 4784: spacing of that part expands proportionally. In contrast, when the line 4785: spacing value is expressed in absolute units (centimeters, inches, 4786: typographer's points), it is independent of the characters, which permits the 4787: maintenance of a consistent line spacing, whatever the character font. Either 4788: approach can be taken, depending on the desired effect.</p> 1.18 cvs 4789: </div> 1.1 cvs 4790: 1.18 cvs 4791: <div class="subsubsection"> 1.37 cvs 4792: <h4><a name="sectd42222" id="sectd42222">First line indentation</a></h4> 1.1 cvs 4793: 1.30 cvs 4794: <p>The <tt>Indent</tt> rule is used to specify the indentation of the first 4795: line of the elements broken into lines by the <tt>Line</tt> function. The 1.1 cvs 4796: indentation determines how far the first line of the element is shifted with 1.37 cvs 4797: respect to the other lines of the same element. It can be specified as a 4798: constant or by inheritance. The constant value is a positive integer (shifted 1.1 cvs 4799: to the right; the sign is optional), a negative integer (shifted to the left) 1.37 cvs 4800: or zero (no shift). All available <a href="#sectc4217">units</a> can be 1.18 cvs 4801: used.</p> 1.30 cvs 4802: 4803: <p>Indentation can be defined for any box, regardless of whether the box is 4804: line broken, and transmitted by inheritance to elements that are line broken. 4805: The size of the indentation is specified in the same manner as the <a 1.18 cvs 4806: href="#sectd42221">line spacing</a>.</p> 4807: <pre> 'Indent' ':' DistOrInherit</pre> 4808: </div> 1.1 cvs 4809: 1.18 cvs 4810: <div class="subsubsection"> 1.37 cvs 4811: <h4><a name="sectd42223" id="sectd42223">Alignment</a></h4> 1.1 cvs 4812: 1.30 cvs 4813: <p>The alignment style of the lines constructed during line breaking is 1.37 cvs 4814: defined by the <tt>Adjust</tt> rule. The alignment value can be a constant or 4815: inherited. A constant value is specified by a keyword:</p> 1.18 cvs 4816: <ul> 1.30 cvs 4817: <li><tt>Left</tt>: at the left edge,</li> 4818: <li><tt>Right</tt>: at the right edge,</li> 4819: <li><tt>VMiddle</tt>: centered</li> 1.35 cvs 4820: <li><tt>Justify</tt>: justified</li> 1.30 cvs 4821: <li><tt>LeftWithDots</tt>: at the left edge with a dotted line filling out 4822: the last line up to the right edge of the line breaking box.</li> 1.18 cvs 4823: </ul> 1.30 cvs 4824: 1.37 cvs 4825: <p>An inherited value can only be the same as that of the reference box and 4826: is specified by a kinship keyword followed by an equals sign.</p> 1.18 cvs 4827: <pre> 'Adjust' ':' AlignOrInherit 1.1 cvs 4828: AlignOrInherit = Kinship '=' / Alignment . 1.35 cvs 4829: Alignment = 'Left' / 'Right' / 'VMiddle' / 'Justify' / 1.18 cvs 4830: 'LeftWithDots' .</pre> 4831: </div> 1.1 cvs 4832: 1.18 cvs 4833: <div class="subsubsection"> 1.37 cvs 4834: <h4><a name="sectd42225" id="sectd42225">Hyphenation</a></h4> 1.18 cvs 4835: 1.37 cvs 4836: <p>The <tt>Hyphenate</tt> rule indicates whether or not words should be 4837: broken by hyphenation at the end of lines. It affects the lines produced by 4838: the <tt>Line</tt> rule and contained in the box carrying the 4839: <tt>Hyphenate</tt> rule.</p> 1.30 cvs 4840: 1.34 cvs 4841: <p>The hyphenation property takes a boolean value, which can be either 1.37 cvs 4842: constant or inherited. A constant boolean value is expressed by either the 4843: <tt>Yes</tt> or the <tt>No</tt> keyword. An inherited value can only be the 1.1 cvs 4844: same as that of the reference box and is specified by a kinship keyword 1.18 cvs 4845: followed by an equals sign.</p> 4846: <pre> 'Hyphenate' ':' BoolInherit 1.1 cvs 4847: BoolInherit = Boolean / Kinship '=' . 1.18 cvs 4848: Boolean = 'Yes' / 'No' .</pre> 4849: </div> 4850: 4851: <div class="subsubsection"> 1.37 cvs 4852: <h4><a name="sectd42226" id="sectd42226">Avoiding line breaking</a></h4> 1.18 cvs 4853: 1.37 cvs 4854: <p>The <tt>InLine</tt> rule is used to specify that a box that would 4855: otherwise participate in line breaking asked for by the <tt>Line</tt> rule of 4856: an enclosing box, instead avoids the line breaking process and positions 4857: itself according to the <tt>HorizPos</tt> and <tt>VertPos</tt> rules that 4858: apply to it. When the <tt>InLine</tt> rule applies to a box which would not 4859: be line broken, it has no effect.</p> 1.30 cvs 4860: 4861: <p>The rule is expressed by the <tt>InLine</tt> keyword followed by a colon 4862: and the keyword <tt>Yes</tt>, if the box should participate in line breaking, 1.37 cvs 4863: or the keyword <tt>No</tt>, if it should not. This is the only form possible: 4864: this rule cannot be inherited. Moreover, it can only appear in the rules of 1.1 cvs 4865: the primary view and applies to all views defined in the presentation 1.18 cvs 4866: schema.</p> 4867: <pre> 'InLine' ':' Boolean . 4868: Boolean = 'Yes' / 'No' .</pre> 1.30 cvs 4869: 1.18 cvs 4870: <blockquote class="example"> 1.30 cvs 4871: <p><strong>Example:</strong></p> 4872: 4873: <p>Suppose the structure schema defines a logical attribute called 1.37 cvs 4874: <tt>New</tt> which is used to identify the passages in a document which 4875: were recently modified. It would be nice to have the presentation schema 4876: make a bar appear in the left margin next to each passage having the 4877: <tt>New</tt> attribute. A new passage can be an entire element, such as a 4878: paragraph or section, or it can be some words in the middle of a paragraph. 4879: To produce the desired effect, the <tt>New</tt> attribute is given a 4880: creation rule which generates a <tt>VerticalBar</tt> presentation box.</p> 1.30 cvs 4881: 4882: <p>When the <tt>New</tt> attribute is attached to a character string which 4883: is inside a line broken element (inside a paragraph, for example), the bar 4884: is one of the elements which participates in line breaking and it is placed 4885: normally in the current line, at the end of the character string which has 1.37 cvs 4886: the attribute. To avoid this, the <tt>InLine</tt> rule is used in the 1.30 cvs 4887: following way:</p> 4888: <pre>BOXES 1.1 cvs 4889: VerticalBar: 4890: BEGIN 4891: Content: Graphics 'l'; 4892: HorizPos: Left = Root . Left; 4893: VertPos: Top = Creator . Top; 4894: Height: Bottom = Creator . Bottom; 4895: Width: 1 pt; 4896: InLine: No; 4897: ... 4898: END; 4899: ... 4900: ATTRIBUTES 4901: Nouveau: 4902: BEGIN 4903: CreateAfter(VerticalBar); 1.18 cvs 4904: END;</pre> 4905: </blockquote> 4906: </div> 4907: </div> 1.1 cvs 4908: 1.18 cvs 4909: <div class="subsection"> 1.37 cvs 4910: <h3><a name="sectc4223" id="sectc4223">Page breaking and line breaking 4911: conditions</a></h3> 1.1 cvs 4912: 1.30 cvs 4913: <p>Pages are constructed by the editor in accordance with the model specified 1.37 cvs 4914: by a <a href="#sectc4233"><tt>Page</tt> rule</a>. The page model describes 1.30 cvs 4915: only the composition of the pages but does not give any rules for breaking 1.37 cvs 4916: different element types across pages. Now, it is possible that certain 4917: elements must not be cut by page breaks, while others can be cut anywhere. 4918: The <tt>PageBreak</tt>, <tt>NoBreak1</tt>, and <tt>NoBreak2</tt> rules are 4919: used to specify the conditions under which each element type can be cut.</p> 1.30 cvs 4920: 4921: <p>The <tt>PageBreak</tt> rule is used to indicate whether or not the box can 1.37 cvs 4922: be cut during the construction of pages. If cutting is authorized, the box 4923: can be cut, with one part appearing at the bottom of a page and the other 4924: part appearing at the top of the next page. The rule is formed by the 1.18 cvs 4925: <tt>PageBreak</tt> keyword followed by a colon and a constant boolean value 1.37 cvs 4926: (<tt>Yes</tt> or <tt>No</tt>). This is the only form possible: this rule 4927: cannot be inherited. Moreover, it can only appear in the rules of the primary 1.18 cvs 4928: view and applies to all views defined in the presentation schema.</p> 1.30 cvs 4929: 4930: <p>Whether objects can be cut by line breaks can be controlled in a similar 1.37 cvs 4931: way using the <tt>LineBreak</tt> rule. This rule allows the specification of 4932: whether or not the box can be cut during the construction of lines. If 1.1 cvs 4933: cutting is authorized, the box can be cut, with one part appearing at the end 1.37 cvs 4934: of a line and the other part appearing at the beginning of the next line. The 1.18 cvs 4935: rule is formed by the <tt>LineBreak</tt> keyword followed by a colon and a 1.37 cvs 4936: constant boolean value (<tt>Yes</tt> or <tt>No</tt>). This is the only form 4937: possible: this rule cannot be inherited. Moreover, it can only appear in the 4938: rules of the primary view and applies to all views defined in the 4939: presentation schema.</p> 1.18 cvs 4940: <pre> 'PageBreak' ':' Boolean . 1.1 cvs 4941: 'LineBreak' ':' Boolean . 1.18 cvs 4942: Boolean = 'Yes' / 'No' .</pre> 1.30 cvs 4943: 4944: <p>When a box can be cut by a page break, it is possible that a page break 4945: will fall an inappropriate spot, creating, for example, a widow or orphan, or 1.37 cvs 4946: separating the title of a section from the first paragraph of the section. 4947: The <tt>NoBreak1</tt> and <tt>NoBreak2</tt> rules are used to avoid this. 4948: They specify that the box of the element to which they apply cannot be cut 4949: within a certain zone at the top (<tt>NoBreak1</tt> rule) or at the bottom 4950: (<tt>NoBreak2</tt> rule). These two rules specify the height of the zones in 1.18 cvs 4951: which page breaks are prohibited.</p> 1.30 cvs 4952: 4953: <p>The <tt>NoBreak1</tt> and <tt>NoBreak2</tt> rules give the height of the 1.37 cvs 4954: zone in which page breaking is prohibited. The height is given as a constant 1.30 cvs 4955: value using any of the <a href="#sectc4217">available units</a>, absolute or 1.37 cvs 4956: relative. The value may not be inherited.</p> 1.18 cvs 4957: <pre> 'NoBreak1' ':' AbsDist . 4958: 'NoBreak2' ':' AbsDist .</pre> 1.30 cvs 4959: 1.18 cvs 4960: <blockquote class="example"> 1.30 cvs 4961: <p><strong>Example:</strong></p> 4962: 4963: <p>The following rules prevent widows and orphans in a paragraph:</p> 4964: <pre>Paragraph : 1.1 cvs 4965: BEGIN 4966: NoBreak1 : 2; 4967: NoBreak2 : 2; 1.18 cvs 4968: END;</pre> 1.30 cvs 4969: 1.37 cvs 4970: <p>This rule prevents a section title from becoming separated from the 4971: first paragraph of the section by prohibiting page breaks at the beginning 4972: of the section rule:</p> 1.30 cvs 4973: <pre>Section : 1.18 cvs 4974: NoBreak1 : 1.5 cm;</pre> 1.30 cvs 4975: 4976: <p>Finally, this rule prevents a figure from being page broken in any 4977: way:</p> 4978: <pre>Figure : 1.18 cvs 4979: PageBreak : No;</pre> 4980: </blockquote> 1.30 cvs 4981: 4982: <p>The Thot editor constructs the document images displayed on the screen 1.37 cvs 4983: dynamically. As the user moves in the document or makes the document scroll 1.1 cvs 4984: in a window, the editor constructs the image to be displayed in little bits, 1.37 cvs 4985: filling the gaps which are produced in the course of these operations. It 1.1 cvs 4986: stops filling in the image when an element reaches the edge of the window in 1.37 cvs 4987: which the gap appears. If the appearance of the document is complex, it is 1.1 cvs 4988: possible that the image in incomplete, even though the edge of the window was 1.37 cvs 4989: reached. For example, an element might need to be presented to the side of 4990: the last element displayed, but its image was not constructed. The user will 1.1 cvs 4991: not know whether the element is really absent or if its image has simply not 1.18 cvs 4992: been constructed.</p> 1.30 cvs 4993: 1.37 cvs 4994: <p>The <tt>Gather</tt> rule is used to remedy this problem. When the rule 1.18 cvs 4995: <tt>Gather : Yes;</tt> is associated with an element type, the image of such 4996: elements is constructed as a block by the editor: it is never split up.</p> 1.30 cvs 4997: 4998: <p>The <tt>Gather</tt> rule may not appear in the <a href="#sectc427">default 1.37 cvs 4999: rules</a>. Elements which do not have the <tt>Gather</tt> rule are considered 5000: susceptible to being split up during display. Thus, it is not necessary to 1.18 cvs 5001: use the <tt>Gather : No;</tt> form. This rule must be used prudently and only 1.37 cvs 5002: for those elements which truly need it. If used incorrectly, it can 1.18 cvs 5003: pointlessly increase the size of the image constructed by the editor and lead 5004: to excessive memory consumption by the editor.</p> 1.30 cvs 5005: 5006: <p>Like the <tt>PageBreak</tt> and <tt>LineBreak</tt> rules, the 5007: <tt>Gather</tt> rule can only appear in rules of the primary view and applies 5008: to all views defined in the presentation schema.</p> 1.18 cvs 5009: <pre> 'Gather' ':' Boolean .</pre> 5010: </div> 1.1 cvs 5011: 1.18 cvs 5012: <div class="subsection"> 1.37 cvs 5013: <h3><a name="sectc4224" id="sectc4224">Visibility</a></h3> 1.1 cvs 5014: 1.34 cvs 5015: <p>The visibility property is used to control which elements should or should 1.37 cvs 5016: not be displayed, based on context. An element can have different 5017: visibilities in different views. If an element's visibility is zero for a 5018: view, that element is not displayed in that view and does not occupy any 5019: space (its extents are zero).</p> 1.30 cvs 5020: 1.37 cvs 5021: <p>Visibility takes non-negative integer values (positive or zero). If values 1.1 cvs 5022: greater than 1 are used, they allow the user to choose a degree of visibility 1.37 cvs 5023: and, thus, to see only those boxes whose visibility property exceeds a 5024: certain threshold. This gives the user control over the granularity of the 5025: displayed pictures.</p> 1.30 cvs 5026: 1.34 cvs 5027: <p>The visibility property can be defined as a constant or by inheritance. If 1.1 cvs 5028: defined by inheritance, it cannot be based on the value of the next or 1.37 cvs 5029: previous box. Visibility can only be inherited from above.</p> 1.30 cvs 5030: 5031: <p>If it is a numeric attribute's presentation rule, the visibility can be 1.37 cvs 5032: specified by the attribute's name, in which case the value of the attribute 5033: is used.</p> 1.18 cvs 5034: <pre> 'Visibility' ':' NumberInherit 1.1 cvs 5035: NumberInherit = Integer / AttrID / Inheritance . 1.18 cvs 5036: Integer = NUMBER .</pre> 1.30 cvs 5037: 1.18 cvs 5038: <blockquote class="example"> 1.30 cvs 5039: <p><strong>Example:</strong></p> 5040: 5041: <p>Suppose that only <tt>Formula</tt> elements should be displayed in the 1.37 cvs 5042: <tt>MathView</tt> view. Then, the default rules should include:</p> 1.30 cvs 5043: <pre>DEFAULT 1.18 cvs 5044: IN MathView Visibility:0;</pre> 1.30 cvs 5045: 1.31 cvs 5046: <p>which makes all elements invisible in the <tt>MathView</tt> view. 1.30 cvs 5047: However, the <tt>Formula</tt> element also has a <tt>Visibility</tt> 5048: rule:</p> 5049: <pre>Formula : 1.18 cvs 5050: IN MathView Visibility:5;</pre> 1.30 cvs 5051: 5052: <p>which makes formulas, and only formulas, visible.</p> 1.18 cvs 5053: </blockquote> 5054: </div> 1.1 cvs 5055: 1.18 cvs 5056: <div class="subsection"> 1.37 cvs 5057: <h3><a name="sectc4225" id="sectc4225">Character style properties</a></h3> 1.1 cvs 5058: 1.34 cvs 5059: <p>Four properties are used to determine which characters are used to display 1.37 cvs 5060: text. They are size, font, style, and underlining.</p> 1.1 cvs 5061: 1.18 cvs 5062: <div class="subsubsection"> 1.37 cvs 5063: <h4><a name="sectd42251" id="sectd42251">Character size</a></h4> 1.30 cvs 5064: 1.37 cvs 5065: <p>The size property has two effects. First, it is used to specify the actual 1.34 cvs 5066: size and distance units for boxes defined in <a href="#sectc4217">relative 1.37 cvs 5067: units</a>. Second, it defines the size of the characters contained in the 1.34 cvs 5068: box.</p> 1.1 cvs 5069: 1.30 cvs 5070: <p>As a distance or length, the size can be expressed in abstract or absolute 1.37 cvs 5071: units. It can also be inherited. If it is not inherited, it is expressed 5072: simply as an integer followed by the <tt>pt</tt> keyword, which indicates 5073: that the size is expressed in typographer's points. The absence of the 5074: <tt>pt</tt> keyword indicates that it is in abstract units in which the value 5075: 1 represents the smallest size while the value 16 is the largest size. The 5076: relationship between these abstract sizes and the real character sizes is 5077: controlled by a table which can be modified statically or even dynamically 5078: during the execution of the Thot editor.</p> 1.30 cvs 5079: 5080: <p>If the <tt>Size</tt> rule is a numeric attribute's presentation rule, the 1.34 cvs 5081: value of the size property can be specified by the attribute's name, in which 1.30 cvs 5082: case the value of the attribute is used.</p> 5083: 1.37 cvs 5084: <p><strong>Note:</strong> the only unit available for defining an absolute 5085: size is the typographer's point. Centimeters and inches may not be used.</p> 1.30 cvs 5086: 5087: <p>If the size is inherited, the rule must specify the relative from which to 5088: inherit and any percentage or difference from that relative's value. A 5089: percentage is indicated by a <tt>*</tt> followed by the value of the 5090: percentage and a <tt>%</tt>. A difference can be expressed in either 5091: typographer's points or in abstract units and the maximum or minimum size can 1.37 cvs 5092: be specified, but without specifying the unit: it is the same as was 5093: specified for the difference.</p> 1.30 cvs 5094: 5095: <p>In a numeric attribute's presentation rule, the difference in size or the 1.22 cvs 5096: percentage can be indicated by the attribute's name instead of the numeric 1.37 cvs 5097: value, which means that the attribute's value should be used as the 5098: difference or percentage. The attribute can also be used as the minimum or 5099: maximum size for a difference.</p> 1.22 cvs 5100: <pre> 'Size' ':' SizeInherit 5101: SizeInherit = SizeAttr [ 'pt' ] / 5102: Kinship InheritedSize . 5103: InheritedSize ='+' SizeAttr [ 'pt' ] 5104: [ 'Max' MaxSizeAttr ] / 5105: '-' SizeAttr [ 'pt' ] 5106: [ 'Min' MinSizeAttr ] / 5107: '*' PercentSizeAttr '%' / 5108: '=' . 5109: SizeAttr = Size / AttrID . 5110: Size = NUMBER . 5111: MaxSizeAttr = MaxSize / AttrID . 5112: MaxSize = NUMBER . 5113: MinSizeAttr = MinSize / AttrID . 5114: MinSize = NUMBER . 5115: PercentSizeAttr = PercentSize / AttrID . 5116: PercentSize = NUMBER .</pre> 1.30 cvs 5117: 1.18 cvs 5118: <blockquote class="example"> 1.30 cvs 5119: <p><strong>Example:</strong></p> 5120: 5121: <p>The rule</p> 5122: <pre>Size : Enclosing - 2 pt Min 7;</pre> 5123: 5124: <p>states that the character size is 2 points less than that of the 5125: enclosing box, but that it may not be less than 7 points, whatever the 5126: enclosing box's value.</p> 5127: 5128: <p>The following rules make the text of a report be displayed with 5129: medium-sized characters (for example, size 5), while the title is displayed 5130: with larger characters and the summary is displayed with smaller 5131: characters:</p> 5132: <pre>Report : 1.1 cvs 5133: Size : 5; 5134: Title : 5135: Size : Enclosing + 2; 5136: Summary : 1.18 cvs 5137: Size : Enclosing - 1;</pre> 1.30 cvs 5138: 5139: <p>Thus, the character sizes in the entire document can be changed by 1.34 cvs 5140: changing the size property of the Report element, while preserving the 1.30 cvs 5141: relationships between the sizes of the different elements.</p> 1.18 cvs 5142: </blockquote> 5143: </div> 5144: 5145: <div class="subsubsection"> 1.37 cvs 5146: <h4><a name="sectd42252" id="sectd42252">Font and character style</a></h4> 1.18 cvs 5147: 1.37 cvs 5148: <p>The <tt>Font</tt> rule determines the font family to be used to display 5149: the characters contained in the box, while the <tt>Style</tt> rule determines 5150: their style and the <tt>Weight</tt> rule determines their weight. Thot 1.23 cvs 5151: recognizes three character fonts (Times, Helvetica, and Courier), three 5152: styles: Roman, Italics, and Oblique, and two weights: Normal and Bold.</p> 1.30 cvs 5153: 5154: <p>The font family, style and weight can be specified by a named constant or 1.37 cvs 5155: can be inherited. For the name of the font family only the first character is 1.30 cvs 5156: used.</p> 5157: 5158: <p>Only identical inheritance is allowed: the box takes the same font, style 1.37 cvs 5159: or weight as the box from which it inherits. This is indicated by an equals 1.23 cvs 5160: sign after the kinship specification.</p> 5161: <pre> 'Font' ':' NameInherit / 5162: 'Style' ':' StyleInherit / 5163: 'Weight' ':' WeightInherit / 5164: 5165: NameInherit = Kinship '=' / FontName . 5166: FontName = NAME . 5167: StyleInherit = Kinship '=' / 5168: 'Roman' / 'Italics' / 'Oblique' . 5169: WeightInherit = Kinship '=' / 5170: 'Normal' / 'Bold' .</pre> 1.30 cvs 5171: 1.18 cvs 5172: <blockquote class="example"> 1.30 cvs 5173: <p><strong>Example:</strong></p> 5174: 5175: <p>To specify that the summary uses the font family of the rest of the 5176: document, but in the italic style, the following rules are used:</p> 5177: <pre>Summary : 1.1 cvs 5178: BEGIN 5179: Font : Enclosing =; 5180: Style : Italics; 1.18 cvs 5181: END;</pre> 5182: </blockquote> 5183: </div> 5184: 5185: <div class="subsubsection"> 1.37 cvs 5186: <h4><a name="sectd42253" id="sectd42253">Underlining</a></h4> 1.18 cvs 5187: 1.30 cvs 5188: <p>The <tt>Underline</tt> rule is used to specify if the characters contained 1.37 cvs 5189: in a box should have lines drawn on or near them. There are four underlining 1.18 cvs 5190: styles: <tt>Underlined</tt>, <tt>Overlined</tt>, <tt>CrossedOut</tt>, and 1.37 cvs 5191: <tt>NoUnderline</tt>. The <tt>Thickness</tt> rule specifies the thickness of 1.18 cvs 5192: the line, <tt>Thin</tt> or <tt>Thick</tt>.</p> 1.30 cvs 5193: 5194: <p>As with font family and style, only identical inheritance is allowed: the 1.37 cvs 5195: box has the same underlining type as the box from which it inherits the 5196: value. This is indicated by an equals sign after the kinship 5197: specification.</p> 1.18 cvs 5198: <pre> 'Underline' ':' UnderLineInherit / 1.1 cvs 5199: 'Thickness' ':' ThicknessInherit / 5200: 5201: UnderLineInherit = Kinship '=' / 'NoUnderline' / 5202: 'Underlined' / 5203: 'Overlined' / 'CrossedOut' . 1.18 cvs 5204: ThicknessInherit = Kinship '=' / 'Thick' / 'Thin' .</pre> 5205: </div> 5206: </div> 5207: 5208: <div class="subsection"> 1.37 cvs 5209: <h3><a name="sectc4226" id="sectc4226">Stacking order</a></h3> 1.18 cvs 5210: 1.30 cvs 5211: <p>The <tt>Depth</tt> rule is used to define the stacking order of terminal 1.37 cvs 5212: boxes when multiple boxes at least partially overlap. This rule defines how 5213: the depth property, which is zero or a positive integer, is calculated. The 5214: depth property has a value for all boxes. For terminal boxes in the structure 1.34 cvs 5215: and for presentation boxes, the depth value is used during display and 5216: printing: the boxes with the lowest value overlap those with higher depths. 1.37 cvs 5217: For non-terminal boxes, the depth is not interpreted during display, but it 5218: is used to calculate the depth of terminal boxes by inheritance.</p> 1.30 cvs 5219: 5220: <p>Like most other rules, the depth rule is defined in the <a 1.37 cvs 5221: href="#sectc427">default rules</a> of each presentation schema. Thus, there 1.18 cvs 5222: is always a depth value, even when it is not necessary because there is no 1.37 cvs 5223: overlapping. To avoid useless operations, a zero value can be given to the 1.34 cvs 5224: depth property, which signifies that overlapping is never a problem.</p> 1.30 cvs 5225: 5226: <p>The depth rule has the same form as the <a href="#sectc4224">visibility 1.18 cvs 5227: rule</a>. It can be defined by inheritance or by a constant numeric value. 5228: When the rule is attached to a numeric attribute, it can take the value of 5229: that attribute.</p> 5230: <pre> 'Depth' ':' NumberInherit</pre> 1.30 cvs 5231: 1.18 cvs 5232: <blockquote class="example"> 1.30 cvs 5233: <p><strong>Example:</strong></p> 5234: 5235: <p>For a purely textual document, in which overlapping never poses a 5236: problem, a single default <tt>Depth</tt> rule in the presentation schema is 5237: sufficient:</p> 5238: <pre>DEFAULT 1.1 cvs 5239: Depth : 0; 1.18 cvs 5240: ...</pre> 1.30 cvs 5241: 5242: <p>To make the text of examples appear on a light blue background, a 5243: presentation box is defined:</p> 5244: <pre>BOXES 1.1 cvs 5245: BlueBG : 5246: BEGIN 5247: Content : Graphics 'R'; 5248: Background : LightBlue3; 5249: FillPattern: backgroundcolor; 5250: Depth : 2; 5251: ... 1.18 cvs 5252: END;</pre> 1.30 cvs 5253: 5254: <p>and is created by the <tt>Example</tt> element, which has the rules:</p> 5255: <pre>RULES 1.1 cvs 5256: Example : 5257: BEGIN 5258: CreateFirst (BlueBG); 5259: Depth : 1; 5260: ... 1.18 cvs 5261: END;</pre> 1.30 cvs 5262: 5263: <p>In this way, the text of an example (if it inherits its depth from its 5264: ancestor) will be superimposed on a light blue background, and not the 5265: reverse).</p> 1.18 cvs 5266: </blockquote> 5267: </div> 5268: 5269: <div class="subsection"> 1.37 cvs 5270: <h3><a name="sectc4227" id="sectc4227">Line style</a></h3> 1.18 cvs 5271: 1.30 cvs 5272: <p>The <tt>LineStyle</tt> rule determines the style of line which should be 5273: used to draw all the elements contained in the box and the box itself, if it 1.37 cvs 5274: has a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. The line style can be 1.18 cvs 5275: indicated by a name (<tt>Solid</tt>, <tt>Dashed</tt>, <tt>Dotted</tt>) or it 1.37 cvs 5276: can be inherited. All elements of the graphic base type are affected by this 1.1 cvs 5277: rule, but it can be attached to any box and transmitted by inheritance to the 1.37 cvs 5278: graphic elements. The border of elements having a <a 1.18 cvs 5279: href="#sectc4230a"><tt>ShowBox</tt> rule</a> is drawn according to the line 5280: style specified by this rule.</p> 1.30 cvs 5281: 1.37 cvs 5282: <p>Only identical inheritance is allowed: the box takes the same line style 5283: as the box from which it inherits. This is indicated by an equals sign after 5284: the kinship specification.</p> 1.18 cvs 5285: <pre> 'LineStyle' ':' LineStyleInherit 1.1 cvs 5286: LineStyleInherit = Kinship '=' / 1.18 cvs 5287: 'Solid' / 'Dashed' / 'Dotted' .</pre> 1.30 cvs 5288: 1.18 cvs 5289: <blockquote class="example"> 1.30 cvs 5290: <p><strong>Example:</strong></p> 5291: 1.37 cvs 5292: <p>To specify that, in Figures, the graphical parts should be drawn in 5293: solid lines, the Figure element is given a rule using the <tt>Solid</tt> 5294: name:</p> 1.30 cvs 5295: <pre>Figure : 1.18 cvs 5296: LineStyle : Solid;</pre> 1.30 cvs 5297: 5298: <p>and the elements composing figures are given an inheritance rule:</p> 5299: <pre> LineStyle : Enclosing =;</pre> 1.18 cvs 5300: </blockquote> 5301: </div> 5302: 5303: <div class="subsection"> 1.37 cvs 5304: <h3><a name="sectc4228" id="sectc4228">Line thickness</a></h3> 1.18 cvs 5305: 1.37 cvs 5306: <p>The <tt>LineWeight</tt> rule determines the thickness of the lines of all 1.1 cvs 5307: graphical elements which appear in the box, no matter what their line style. 1.37 cvs 5308: Line thickness can be specified by a constant value or by inheritance. A 5309: constant value is a positive number followed by an optional unit 5310: specification (which is absent when using relative units). All available <a 5311: href="#sectc4217">distance units</a> can be used. Line thickness is expressed 1.18 cvs 5312: in the same way as <a href="#sectd42221">line spacing</a>.</p> 5313: <pre> 'LineWeight' ':' DistOrInherit</pre> 1.30 cvs 5314: 1.37 cvs 5315: <p>All elements of the graphic base type are affected by this rule, but it 5316: can be attached to any box and transmitted by inheritance to the graphic 5317: elements. The border of element having a <a 5318: href="#sectc4230a"><tt>ShowBox</tt> rule</a> is also drawn according to the 5319: thickness specified by this rule.</p> 1.30 cvs 5320: 1.18 cvs 5321: <blockquote class="example"> 1.30 cvs 5322: <p><strong>Example:</strong></p> 5323: 5324: <p>To specify that, in Figures, the graphical parts should be drawn with 5325: lines 0.3 pt thick, the Figure element is given this rule:</p> 5326: <pre>Figure : 1.18 cvs 5327: LineWeight : 0.3 pt;</pre> 1.30 cvs 5328: 5329: <p>and the elements composing figures are given an inheritance rule:</p> 5330: <pre> LineWeight : Enclosing =;</pre> 1.18 cvs 5331: </blockquote> 5332: </div> 5333: 5334: <div class="subsection"> 1.37 cvs 5335: <h3><a name="sectc4229" id="sectc4229">Fill pattern</a></h3> 1.18 cvs 5336: 1.30 cvs 5337: <p>The <tt>FillPattern</tt> rule determines the pattern used to fill closed 1.37 cvs 5338: graphical elements (circles, rectangles, etc.) which appear in the box. This 1.18 cvs 5339: rule also specifies the pattern used to fill the box associated with elements 1.37 cvs 5340: having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a><a>. This pattern can 5341: be indicated by a named constant or by inheritance. The named constant 5342: identifies one of the patterns available in Thot. The names of the available 1.18 cvs 5343: patterns are: nopattern, foregroundcolor, backgroundcolor, gray1, gray2, 5344: gray3, gray4, gray5, gray6, gray7, horiz1, horiz2, horiz3, vert1, vert2, 1.37 cvs 5345: vert3, left1, left2, left3, right1, right2, right3, square1, square2, 5346: square3, lozenge, brick, tile, sea, basket.</a></p> 1.30 cvs 5347: 5348: <p>Like the other rules peculiar to graphics, <tt>LineStyle</tt> and 1.18 cvs 5349: <tt>LineWeight</tt>, only elements of the graphic base type are affected by 5350: the <tt>FillPattern</tt> rule, but the rule can be attached to any box and 1.37 cvs 5351: transmitted by inheritance to the graphic elements. As with the other rules 1.18 cvs 5352: specific to graphics, only identical inheritance is allowed.</p> 1.30 cvs 5353: 5354: <p>The <tt>FillPattern</tt> rule can also be used to determine whether or not 1.37 cvs 5355: text characters, symbols and pictures should be colored. For these element 1.12 cvs 5356: types (text, symbols, and pictures), the only valid values are 1.18 cvs 5357: <tt>nopattern</tt>, <tt>foregroundcolor</tt>, and <tt>backgroundcolor</tt>. 5358: When <tt>FillPattern</tt> has the value <tt>backgroundcolor</tt>, text 5359: characters, symbols, and bitmaps are given the color specified by the <a 5360: href="#sectc4230"><tt>Background</tt> rule</a> which applies to these 1.37 cvs 5361: elements. When <tt>FillPattern</tt> has the value <tt>foregroundcolor</tt>, 1.18 cvs 5362: these same elements are given the color specified by the <a 5363: href="#sectc4230"><tt>Foreground</tt> rule</a> which applies to these 1.37 cvs 5364: elements. In all other case, text characters are not colored.</p> 1.18 cvs 5365: <pre> 'FillPattern' ':' NameInherit</pre> 1.30 cvs 5366: 1.18 cvs 5367: <blockquote class="example"> 1.30 cvs 5368: <p><strong>Example:</strong></p> 5369: 5370: <p>To specify that, in Figures, the closed graphical elements should be 5371: filled with a pattern resembling a brick wall, the Figure element is given 5372: this rule:</p> 5373: <pre>Figure : 1.18 cvs 5374: FillPattern : brick;</pre> 1.30 cvs 5375: 5376: <p>and the elements composing figures are given an inheritance rule:</p> 5377: <pre> FillPattern : Enclosing =;</pre> 1.18 cvs 5378: </blockquote> 5379: </div> 5380: 5381: <div class="subsection"> 1.37 cvs 5382: <h3><a name="sectc4230" id="sectc4230">Colors</a></h3> 1.18 cvs 5383: 1.30 cvs 5384: <p>The <tt>Foreground</tt> and <tt>Background</tt> rules determine the 1.37 cvs 5385: foreground and background colors of the base elements which appear in the 5386: box. They also control the color of boxes associated with elements having a 5387: <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. These colors can be 5388: specified with a named constant or by inheritance. The named constants 5389: specify one of the available colors in Thot. The available color names can be 5390: found in the file <tt>thot.color</tt>. In addition to those names, you can 5391: use the keyword <code>Transparent</code>, to not draw anything.</p> 5392: 5393: <p>The color rules affect the same way all base elements and elements having 5394: a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>, no matter what their type 5395: (text, graphics, pictures, symbols). The color rules can be associated with 1.30 cvs 5396: any box and can be transmitted by inheritance to the base elements or the 1.37 cvs 5397: elements having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. Like the 1.30 cvs 5398: preceding rules, only inheritance of the same value is allowed.</p> 5399: <pre> 'Foreground' ':' Color 5400: 'Background' ':' Color 5401: Color = 'Transparent' / Link '=' / FontColorName .</pre> 5402: 5403: <p><strong>Note:</strong> text colors only appear for text elements whose <a 1.18 cvs 5404: href="#sectc4229">fill pattern</a> does not prevent the use of color.</p> 1.30 cvs 5405: 1.18 cvs 5406: <blockquote class="example"> 1.30 cvs 5407: <p><strong>Example:</strong></p> 5408: 5409: <p>To specify that, in Figures, everything must be drawn in blue on a 5410: background of yellow, the Figure element is given these rules:</p> 5411: <pre>Figure : 1.1 cvs 5412: BEGIN 5413: Foreground : Blue; 5414: Background : Yellow; 5415: Fillpattern : backgroundcolor; 1.18 cvs 5416: END;</pre> 1.30 cvs 5417: 5418: <p>and the elements composing figures are given inheritance rules:</p> 5419: <pre> Foreground : Enclosing =; 1.1 cvs 5420: Background : Enclosing =; 1.18 cvs 5421: FillPattern : Enclosing =;</pre> 5422: </blockquote> 5423: </div> 5424: 5425: <div class="subsection"> 1.37 cvs 5426: <h3><a name="sectc4230a" id="sectc4230a">Background color and border</a></h3> 1.18 cvs 5427: 1.30 cvs 5428: <p>Boxes associated with structural elements are normally not visible, but it 1.37 cvs 5429: is possible to draw their border and/or to paint their area when it is 5430: needed. This is achieved by associating the <tt>ShowBox</tt> rule with the 5431: concerned element. This rule has no parameter and no value. It is simply 5432: written <tt>Showbox;</tt>. It is not inherited nor transmitted to any other 5433: element. It applies only to the element with which it is associated.</p> 1.18 cvs 5434: <pre> 'ShowBox'</pre> 1.30 cvs 5435: 5436: <p>When an element has a <tt>ShowBox</tt> rule, the border is drawn only if 1.37 cvs 5437: the <tt>LineWeight</tt> rule that applies to that element has a non-zero 5438: value (this value can be inherited). The color, style and thickness of the 5439: border are defined by the <tt>Foreground</tt>, <tt>LineStyle</tt>, and 1.18 cvs 5440: <tt>LineWeight</tt> rules that apply to the element.</p> 1.30 cvs 5441: 1.37 cvs 5442: <p>When an element has a <tt>ShowBox</tt> rule, the background of this 5443: element is paint only if the value of the <tt>FillPattern</tt> rule that 5444: applies to that element is not <tt>nopattern</tt>. The pattern and color(s) 5445: of the background are defined by the <tt>FillPattern</tt>, 5446: <tt>Background</tt>, and <tt>Foreground</tt> rules that apply to the 5447: element.</p> 1.18 cvs 5448: </div> 5449: 5450: <div class="subsection"> 1.37 cvs 5451: <h3><a name="sectc4230b" id="sectc4230b">Background pictures</a></h3> 1.18 cvs 5452: 1.30 cvs 5453: <p>The <tt>BackgroundPicture</tt> rule allows to display a picture as the 1.37 cvs 5454: background of an element. It has a single parameter, the file name of the 5455: picture. This is a string delimited by single quotes. If the first character 1.18 cvs 5456: in this string is '/', it is considered as an absolute path, otherwise the 1.37 cvs 5457: file is searched for along the schema directory path. This file may contain a 1.18 cvs 5458: picture in any format accepted by Thot (xbm, xpm, gif, jpeg, png, etc.)</p> 1.30 cvs 5459: 1.37 cvs 5460: <p>The <tt>BackgroundPicture</tt> and <tt>PictureMode</tt> rules apply only 5461: to the element with which they are associated. They are not inherited nor 1.18 cvs 5462: transmitted to children elements.</p> 1.30 cvs 5463: 5464: <p>The background picture has not always the same size as the element's box. 1.37 cvs 5465: There are diffrent ways to fill the element box with the picture. This is 1.18 cvs 5466: specified by the <tt>PictureMode</tt> rule, which should be associated to the 1.37 cvs 5467: same element. This rule may take one of the following values:</p> 1.18 cvs 5468: <dl> 1.30 cvs 5469: <dt><tt>NormalSize</tt></dt> 5470: <dd>The picture is centered in the box, and clipped if it is too 5471: large.</dd> 5472: <dt><tt>Scale</tt></dt> 5473: <dd>The picture is zoomed to fit the box size.</dd> 5474: <dt><tt>RepeatX</tt></dt> 5475: <dd>The picture is repeated horizontally to fit the box width.</dd> 5476: <dt><tt>RepeatY</tt></dt> 5477: <dd>The picture is repeated vertically to fit the box height.</dd> 5478: <dt><tt>RepeatXY</tt></dt> 5479: <dd>The picture is repeated both horizontally and vertically to fill the 5480: box.</dd> 1.18 cvs 5481: </dl> 1.30 cvs 5482: 5483: <p>If an element has a <tt>BackgroundPicture</tt> rule and no 1.18 cvs 5484: <tt>PictureMode</tt> rule, the <tt>NormalSize</tt> value is assumed.</p> 5485: <pre> 'BackgroundPicture' ':' FileName / 1.13 cvs 5486: 'PictureMode' ':' PictMode . 5487: 5488: FileName = STRING . 1.18 cvs 5489: PictMode = 'NormalSize' / 'Scale' / 'RepeatXY' / 'RepeatX' / 'RepeatY' .</pre> 1.30 cvs 5490: 1.37 cvs 5491: <p>The <tt>BackgroundPicture</tt> and <tt>PictureMode</tt> rules apply only 5492: to the element with which they are associated. They are not inherited nor 1.18 cvs 5493: transmitted to children elements.</p> 5494: </div> 1.13 cvs 5495: 1.18 cvs 5496: <div class="subsection"> 1.37 cvs 5497: <h3><a name="sectc4231" id="sectc4231">Presentation box content</a></h3> 1.1 cvs 5498: 1.37 cvs 5499: <p>The <tt>Content</tt> rule applies to presentation boxes. It indicates the 5500: content given to a box. This content is either a variable's value or a 5501: constant value.</p> 1.30 cvs 5502: 5503: <p>If the content is a constant, it can be specified, as in a variable 1.18 cvs 5504: declaration, either by the name of a constant declared in the <tt>CONST</tt> 1.1 cvs 5505: section or by direct specification of the type and value of the box's 1.18 cvs 5506: content.</p> 1.30 cvs 5507: 5508: <p>Similarly, if it is a variable, the name of a variable declared in 1.18 cvs 5509: <tt>VAR</tt> section can be given or the variable may be defined within 1.37 cvs 5510: parentheses. The content inside the parentheses has the same syntax as a <a 1.18 cvs 5511: href="#sectc426">variable declaration</a>.</p> 5512: <pre> 'Content' ':' VarConst 1.1 cvs 5513: VarConst = ConstID / ConstType ConstValue / 1.38 ! cvs 5514: VarID / '(' FunctionSeq ')' .</pre> 1.30 cvs 5515: 5516: <p>A presentation box can have only one <tt>Content</tt> rule, which means 1.37 cvs 5517: that the content of a presentation box cannot vary from view to view. 5518: However, such an effect can be achieved by creating several presentation 5519: boxes, each with different content and visible in different views.</p> 5520: 5521: <p>The <tt>Content</tt> rule also applies to elements defined as references 5522: in the structure schema. In this case, the content defined by the rule must 5523: be a constant. It is this content which appears on the screen or paper to 5524: represent references of the type to which the rule applies. A reference can 1.18 cvs 5525: have a <tt>Content</tt> rule or a <a href="#sectc4234"><tt>Copy</tt> rule</a> 1.37 cvs 5526: for each view. If neither of these rules appears, the reference is displayed 1.18 cvs 5527: as <tt>[*]</tt>, which is equivalent to the rule:</p> 5528: <pre> Content: Text '[*]';</pre> 1.30 cvs 5529: 1.18 cvs 5530: <blockquote class="example"> 1.30 cvs 5531: <p><strong>Example:</strong></p> 5532: 5533: <p>The content of the presentation box created to make the chapter number 5534: and section number appear before each section title can be defined by:</p> 5535: <pre>BOXES 1.1 cvs 5536: SectionNumBox : 5537: BEGIN 5538: Content : NumSection; 5539: ... 1.18 cvs 5540: END;</pre> 1.30 cvs 5541: 5542: <p>if the <tt>NumSection</tt> variable has been defined in the variable 1.37 cvs 5543: definition section of the presentation schema. Otherwise the 1.30 cvs 5544: <tt>Content</tt> would be written:</p> 5545: <pre>BOXES 1.1 cvs 5546: SectionNumBox : 5547: BEGIN 5548: Content : (VALUE (ChapterCtr, Roman) TEXT '.' 5549: VALUE (SectionCtr, Arabic)); 5550: ... 1.18 cvs 5551: END;</pre> 5552: </blockquote> 5553: </div> 1.1 cvs 5554: 1.18 cvs 5555: <div class="subsection"> 1.37 cvs 5556: <h3><a name="sectc4232" id="sectc4232">Presentation box creation</a></h3> 1.1 cvs 5557: 1.37 cvs 5558: <p>A creation rule specifies that a presentation box should be created when 5559: an element of the type to which the rule is attached appears in the 5560: document.</p> 1.30 cvs 5561: 5562: <p>A keyword specifies the position, relative to the creating box, at which 5563: the created box will be placed in the structure:</p> 1.18 cvs 5564: <dl> 1.30 cvs 5565: <dt><tt>CreateFirst</tt></dt> 5566: <dd>specifies that the box should be created as the first box of the next 5567: lower level, before any already existing boxes, and only if the 5568: beginning of the creating element is visible;</dd> 5569: <dt><tt>CreateLast</tt></dt> 5570: <dd>specifies that the box should be created as the last box of the next 5571: lower level, after any existing boxes, and only if the end of the 5572: creating element is visible;</dd> 5573: <dt><tt>CreateBefore</tt></dt> 5574: <dd>specifies that the box should be created before the creating box, on 5575: the same level as the creating box, and only if the beginning of the 5576: creating element is visible;</dd> 5577: <dt><tt>CreateAfter</tt></dt> 5578: <dd>specifies that the box should be created after the creating box, on 5579: the same level as the creating box, and only if the beginning of the 5580: creating element is visible;</dd> 5581: <dt><tt>CreateEnclosing</tt></dt> 1.37 cvs 5582: <dd>specifies that the box should be created at the upper level 5583: relatively to the creating box, and that it must contain that creating 5584: box and all presentation boxes created by the same creating box.</dd> 1.18 cvs 5585: </dl> 1.30 cvs 5586: 5587: <p>This keyword can be followed by the <tt>Repeated</tt> keyword to indicate 5588: that the box must be created for each part of the creating element. These 5589: parts result from the division of the element by page breaks or column 1.37 cvs 5590: changes. If the <tt>Repeated</tt> keyword is missing, the box is only created 1.30 cvs 5591: for the first part of the creating element (<tt>CreateFirst</tt> and 1.18 cvs 5592: <tt>CreateBefore</tt> rules) or for the last part (<tt>CreateLast</tt> and 5593: <tt>CreateAfter</tt> rules).</p> 1.30 cvs 5594: 5595: <p>The type of presentation to be created is specified at the end of the rule 1.18 cvs 5596: between parentheses.</p> 1.30 cvs 5597: 5598: <p>Creation rules cannot appear in the <a href="#sectc427">default 1.37 cvs 5599: presentation rules</a>. The boxes being created should have a 1.30 cvs 5600: <tt>Content</tt> rule which indicates their <a 5601: href="#sectc4231">content</a>.</p> 5602: 5603: <p>Creation rules can only appear in the block of rules for the primary view; 1.1 cvs 5604: creation is provoked by a document element for all views. However, for each 1.37 cvs 5605: view, the presentation box is only created if the creating element is itself 5606: a box in the view. Moreover, the visibility property of the presentation box 5607: can be adjusted to control the creation of the box on a view-by-view 5608: basis.</p> 1.18 cvs 5609: <pre> Creation '(' BoxID ')' 1.1 cvs 5610: Creation = Create [ 'Repeated' ] . 5611: Create ='CreateFirst' / 'CreateLast' / 5612: 'CreateBefore' / 'CreateAfter' / 1.18 cvs 5613: 'CreateEnclosing' .</pre> 1.30 cvs 5614: 1.18 cvs 5615: <blockquote class="example"> 1.30 cvs 5616: <p><strong>Example:</strong></p> 5617: 5618: <p>Let us define an object type, called Table, which is composed of a 5619: sequence of columns, all having the same fixed width, where the columns are 1.37 cvs 5620: separated by vertical lines. There is a line to the left of the first 5621: column and one to the right of the last. Each column has a variable number 1.31 cvs 5622: of cells, placed one on top of the other and separated by horizontal lines. 5623: There are no horizontal lines above the first cell or below the last cell. 1.37 cvs 5624: The text contained in each cell is broken into lines and these lines are 1.30 cvs 5625: centered horizontally in the cell. The logical structure of this object is 5626: defined by:</p> 5627: <pre>Table = LIST OF (Column); 1.18 cvs 5628: Column = LIST OF (Cell = Text);</pre> 5629: 1.30 cvs 5630: <div class="figure"> 1.37 cvs 5631: <hr /> 1.30 cvs 5632: <pre>| | | | 1.1 cvs 5633: | xx xxxx xxxx |x xxxx xxx xxxxx| x xxx x xxx | 5634: | xxx xxx xxxx x | x xx x xxx | xxxxx xxxx xx | 5635: | xxxxx xxxx |----------------| xxx xxxxx x | 5636: | xxxxx xxx xxxx | xxxx xx xx xxx | xx xx | 5637: | xxx xxxx x xxx | xxxx x xxx x |---------------| 5638: |----------------| xxx xxxx xxxxx | xxxxx xxxxx | 5639: | xxx xxx xxxxxx |----------------| xxx xxxx xxxx | 5640: | xxxx xxxx xx | xxxx xx x xx | xxx xx x xx | 5641: |----------------| xxx xxxxx xxxx | xxxx xxxx xxx | 5642: | xxxxx xxx xxxx | xxxx xx x xx | xxxxx xxx | 1.18 cvs 5643: |xxxx xx x xxxxxx| xxxx xx xxxxxx | xxxxx xxxxx |</pre> 1.19 cvs 5644: 1.37 cvs 5645: <p align="center"><em><a name="table" id="table">The design of a 5646: table</a></em></p> 5647: <hr /> 1.30 cvs 5648: </div> 5649: 5650: <p>The presentation of the table should resemble the design of the above <a 1.37 cvs 5651: href="#table">figure</a>. It is defined by the following presentation 1.30 cvs 5652: schema fragment:</p> 5653: <pre>BOXES 1.1 cvs 5654: VertLine : BEGIN 5655: Width : 0.3 cm; 5656: Height : Enclosing . Height; 5657: VertPos : Top = Enclosing . Top; 5658: HorizPos : Left = Previous . Right; 5659: Content : Graphics 'v'; 5660: END; 5661: 5662: HorizLine: BEGIN 5663: Width : Enclosing . Width; 5664: Height : 0.3 cm; 5665: VertPos : Top = Previous . Bottom; 5666: HorizPos : Left = Enclosing . Left; 5667: Content : Graphics 'h'; 5668: END; 5669: 5670: RULES 1.6 cvs 5671: Column : BEGIN 5672: CreateBefore (VertLine); 5673: IF LAST CreateAfter (VertLine); 5674: Width : 2.8 cm; 5675: Height : Enclosed . Height; 5676: VertPos : Top = Enclosing . Top; 5677: HorizPos : Left = Previous . Right; 5678: END; 5679: 5680: Cell : BEGIN 5681: IF NOT FIRST CreateBefore (HorizLine); 5682: Width : Enclosing . Width; 5683: Height : Enclosed . Height; 5684: VertPos : Top = Previous . Bottom; 5685: HorizPos : Left = Enclosing . Left; 5686: Line; 5687: Adjust : VMiddle; 1.18 cvs 5688: END;</pre> 1.30 cvs 5689: 5690: <p>It is useful to note that the horizontal position rule of the first 5691: vertical line will not be applied, since there is no preceding box. In this 5692: case, the box is simply placed on the left side of the enclosing box.</p> 1.18 cvs 5693: </blockquote> 5694: </div> 5695: 5696: <div class="subsection"> 1.37 cvs 5697: <h3><a name="sectc4233" id="sectc4233">Page layout</a></h3> 1.18 cvs 5698: 1.30 cvs 5699: <p>The page models specified in the <tt>Page</tt> rule are defined by boxes 1.37 cvs 5700: declared in the <tt>BOXES</tt> section of the presentation schema. Pages are 1.1 cvs 5701: not described as frames which will be filled by the document's text, but as 5702: element are inserted in the flow of the document and which mark the page 1.37 cvs 5703: breaks. Each of these page break elements contains presentation boxes which 1.1 cvs 5704: represent the footer boxes of a page followed by header boxes of the next 1.37 cvs 5705: page. The page box itself is the simple line which separates two pages on the 5706: screen. Both the footer and header boxes placed themselves with respect to 1.1 cvs 5707: this page box, with the footer being placed above it and the header boxes 1.18 cvs 5708: being placed above it.</p> 1.30 cvs 5709: 5710: <p>The boxes created by a page box are headers and footers and can only place 1.1 cvs 5711: themselves vertically with respect to the page box itself (which is in fact 1.37 cvs 5712: the separation between two pages). Besides, it is their vertical position 5713: rule which determines whether they are header or footer boxes. Header and 1.1 cvs 5714: footer boxes must have an explicit vertical position rule (they must not use 1.18 cvs 5715: the default rule).</p> 1.30 cvs 5716: 5717: <p>Footer boxes must have an absolute height or inherit the height of their 1.18 cvs 5718: contents:</p> 5719: <pre>Height : Enclosed . Height;</pre> 1.30 cvs 5720: 5721: <p>A page box must have height and width rules and these two rules must be 1.1 cvs 5722: specified with constant values, expressed in centimeters, inches, or 1.37 cvs 5723: typographer's points. These two rules are interpreted in a special way for 5724: page boxes: they determine the width of the page and the vertical distance 1.1 cvs 5725: between two page separators, which is the height of the page and its header 1.18 cvs 5726: and footer together.</p> 1.30 cvs 5727: 5728: <p>A page box should also have vertical and horizontal position rules and 5729: these two rules should specify the position on the sheet of paper of the 1.37 cvs 5730: rectangle enclosing the page's contents. These two rules must position the 1.30 cvs 5731: upper left corner of the enclosing rectangle in relation to the upper left 1.37 cvs 5732: corner of the sheet of paper, considered to be the enclosing element. In both 1.30 cvs 5733: rules, distances must be expressed in fixed units: centimeters (<tt>cm</tt>), 1.37 cvs 5734: inches (<tt>in</tt>), or typographer's points (<tt>pt</tt>). Thus, rules 1.30 cvs 5735: similar to the following should be found in the rules for a page box:</p> 1.18 cvs 5736: <pre>BOXES 1.1 cvs 5737: ThePage : 5738: BEGIN 5739: VertPos : Top = Enclosing . Top + 3 cm; 5740: HorizPos : Left = Enclosing . Left + 2.5 cm; 5741: Width : 16 cm; 5742: Height : 22.5 cm; 1.18 cvs 5743: END;</pre> 1.30 cvs 5744: 5745: <p>When a document must be page broken, the page models to be constructed are 1.18 cvs 5746: defined in the <tt>BOXES</tt> section of the presentation schema by declaring 1.37 cvs 5747: page boxes and header and footer boxes. Also, the <tt>Page</tt> rule is used 5748: to specify to which parts of the document and to which views each model 5749: should be applied.</p> 1.30 cvs 5750: 5751: <p>The <tt>Page</tt> rule has only one parameter, given between parentheses 1.37 cvs 5752: after the <tt>Page</tt> keyword. This parameter is the name of the box which 5753: must serve as the model for page construction. When a <tt>Page</tt> rule is 1.1 cvs 5754: attached to an element type, each time such an element appears in a document, 5755: a page break takes place and the page model indicated in the rule is applied 5756: to all following pages, until reaching the next element which has a 1.18 cvs 5757: <tt>Page</tt> rule.</p> 1.30 cvs 5758: 5759: <p>The <tt>Page</tt> rule applies to only one view; if it appears in the 1.37 cvs 5760: primary view's block of rules, a <tt>Page</tt> rule applies only to that 5761: view. Thus, different page models can be defined for the full document and 5762: for its table of contents, which is another view of the same document. Some 5763: views can be specified with pages, and other views of the same document can 5764: be specified without pages.</p> 1.18 cvs 5765: <pre> 'Page' '(' BoxID ')'</pre> 5766: </div> 5767: 5768: <div class="subsection"> 1.37 cvs 5769: <h3><a name="sectc4234" id="sectc4234">Box copies</a></h3> 1.18 cvs 5770: 1.30 cvs 5771: <p>The <tt>Copy</tt> rule can be used for an element which is defined as a 1.37 cvs 5772: reference in the structure schema. In this case, the rule specifies, between 1.18 cvs 5773: parenthesis, the name of the box (declared in the <tt>BOXES</tt> section) 1.1 cvs 5774: which must be produced when this reference appears in the structure of a 1.37 cvs 5775: document. The box produced is a copy (same contents, but possible different 1.1 cvs 5776: presentation) of the box type indicated by the parameter between parentheses, 1.37 cvs 5777: and which is in the element designated by the reference. The name of a box 1.1 cvs 5778: can be replaced by type name. Then what is copied is the contents of the 1.18 cvs 5779: element of this type which is inside the referenced element.</p> 1.30 cvs 5780: 1.37 cvs 5781: <p>Whether a box name or type name is given, it may be followed by the name 5782: of a structure schema between parentheses. This signifies that the box or 5783: type is defined in the indicated structure schema and not in the structure 5784: schema with which the rule's presentation schema is associated.</p> 1.30 cvs 5785: 1.37 cvs 5786: <p>The <tt>Copy</tt> rule can also be applied to a presentation box. If the 1.1 cvs 5787: presentation box was created by a reference attribute, the rule is applied as 5788: in the case of a reference element: the contents of the box having the 1.18 cvs 5789: <tt>Copy</tt> rule are based on the element designated by the reference 1.37 cvs 5790: attribute. For other presentation boxes, the <tt>Copy</tt> rule takes a type 1.1 cvs 5791: name parameter which can be followed, between parentheses, by the name of the 5792: structure schema in which the type is defined, if it is not defined in the 1.37 cvs 5793: same schema. The contents of the box which has this rule are a copy of the 5794: element of this type which is in the element creating the presentation box, 5795: or by default, the box of this type which precedes the presentation box. This 5796: last facility is used, for example, to define the running titles in headers 5797: or footers.</p> 1.18 cvs 5798: <pre> 'Copy' '(' BoxTypeToCopy ')' . 1.1 cvs 5799: BoxTypeToCopy = BoxID [ ExtStruct ] / 1.6 cvs 5800: ElemID [ ExtStruct ] . 1.18 cvs 5801: ExtStruct = '(' ElemID ')' .</pre> 1.30 cvs 5802: 5803: <p>Like the creation rules, the <tt>Copy</tt> rule cannot appear in the <a 1.37 cvs 5804: href="#sectc427">default presentation rules</a>. Moreover, this rule can only 1.18 cvs 5805: appear in the primary view's block of rules; the copy rule is applied to all 5806: views.</p> 1.30 cvs 5807: 1.18 cvs 5808: <blockquote class="example"> 1.30 cvs 5809: <p><strong>Example:</strong></p> 5810: 5811: <p>If the following definitions are in the structure schema:</p> 5812: <pre>Body = LIST OF (Chapter = 1.1 cvs 5813: BEGIN 5814: ChapterTitle = Text; 5815: ChapterBody = SectionSeq; 5816: END); 1.18 cvs 5817: RefChapter = REFERENCE (Chapter);</pre> 1.30 cvs 5818: 5819: <p>then the following presentation rules (among many other rules in the 5820: presentation schema) can be specified:</p> 5821: <pre>COUNTERS 1.1 cvs 5822: ChapterCtr : RANK OF Chapter; 5823: BOXES 5824: ChapterNumber : 5825: BEGIN 5826: Content : (VALUE (ChapterCtr, URoman)); 5827: ... 5828: END; 5829: RULES 5830: Chapter : 5831: BEGIN 5832: CreateFirst (ChapterNumber); 5833: ... 5834: END; 5835: RefChapter : 5836: BEGIN 5837: Copy (ChapterNumber); 5838: ... 1.18 cvs 5839: END;</pre> 1.30 cvs 5840: 5841: <p>which makes the number of the chapter designated by the reference appear 5842: in uppercase roman numerals, in place of the reference to a chapter itself. 5843: Alternatively, the chapter title can be made to appear in place of the 5844: reference by writing this <tt>Copy</tt>rule:</p> 5845: <pre> Copy (ChapterTitle);</pre> 5846: 5847: <p>To define a header box, named <tt>RunningTitle</tt>, which contains the 5848: title of the current chapter, the box's contents are defined in this 5849: way:</p> 5850: <pre>BOXES 1.1 cvs 5851: RunningTitle : 1.18 cvs 5852: Copy (ChapterTitle);</pre> 5853: </blockquote> 5854: </div> 5855: </div> 1.37 cvs 5856: <hr /> 1.18 cvs 5857: </div> 1.1 cvs 5858: 1.18 cvs 5859: <div class="chapter"> 1.37 cvs 5860: <h1><a name="sect5" id="sect5">The T language</a></h1> 1.1 cvs 5861: 1.18 cvs 5862: <div class="section"> 1.37 cvs 5863: <h2><a name="sectb51" id="sectb51">Document translation</a></h2> 1.1 cvs 5864: 1.30 cvs 5865: <p>Because of its document model, Thot can produce documents in a high-level 1.37 cvs 5866: abstract form. This form, called the <em>canonical form</em> is specific to 1.1 cvs 5867: Thot; it is well suited to the editor's manipulations, but it does not 1.37 cvs 5868: necessarily suit other operations which might be applied to documents. 5869: Because of this, the Thot editor offers the choice of saving documents in its 5870: own form (the canonical form) or a format defined by the user. In the latter 5871: case, the Thot document is transformed by the translation program. This 5872: facility can also be used to export documents from Thot to systems using 5873: other formalisms.</p> 1.1 cvs 5874: 1.18 cvs 5875: <div class="subsection"> 1.37 cvs 5876: <h3><a name="sectc511" id="sectc511">Translation principles</a></h3> 1.1 cvs 5877: 1.30 cvs 5878: <p>Document translation allows the export of documents to other systems which 1.37 cvs 5879: do not accept Thot's canonical form. Translation can be used to export 1.30 cvs 5880: document to source-based formatters like T<sub><big>E</big></sub>X, 1.37 cvs 5881: L<sup>A</sup>T<sub><big>E</big></sub>X, and <tt>troff</tt>. It can also be 5882: used to translate documents into interchange formats like SGML or HTML. To 1.1 cvs 5883: allow the widest range of possible exports, Thot does not limit the choice of 5884: translations, but rather allows the user to define the formalisms into which 1.18 cvs 5885: documents can be translated.</p> 1.30 cvs 5886: 5887: <p>For each document or object class, a set of translation rules can be 5888: defined, specifying how the canonical form should be transformed into a given 1.37 cvs 5889: formalism. These translation rules are grouped into <em>translation 1.18 cvs 5890: schemas</em>, each schema containing the rules necessary to translate a 1.1 cvs 5891: generic logical structure (document or object structure) into a particular 1.37 cvs 5892: formalism. The same generic logical structure can have several different 1.1 cvs 5893: translation schemas, each defining translation rules for a different 1.18 cvs 5894: formalism.</p> 1.30 cvs 5895: 1.37 cvs 5896: <p>Like presentation schemas, translation schemas are generic. Thus, they 1.30 cvs 5897: apply to an entire object or document class and permit translation of all 5898: documents or objects of that class.</p> 1.18 cvs 5899: </div> 1.1 cvs 5900: 1.18 cvs 5901: <div class="subsection"> 1.37 cvs 5902: <h3><a name="sectc512" id="sectc512">Translation procedure</a></h3> 1.1 cvs 5903: 1.30 cvs 5904: <p>The translator works on the specific logical structure of the document 1.37 cvs 5905: being translated. It traverses the primary tree of this logical structure in 1.1 cvs 5906: pre-order and, at each node encountered, it applies the corresponding 5907: translation rules defined in the translation schema. Translation can be 1.18 cvs 5908: associated:</p> 5909: <ul> 1.30 cvs 5910: <li>with element types defined in the structure schema,</li> 5911: <li>with global or local attributes defined in the structure schema,</li> 5912: <li>with specific presentation rules,</li> 1.37 cvs 5913: <li>with the content of the leaves of the structure (characters, symbols 1.30 cvs 5914: and graphical elements)</li> 1.18 cvs 5915: </ul> 1.30 cvs 5916: 5917: <p>Thus, for each node, the translator applies all rules associated with the 1.1 cvs 5918: element type, all rules associated with each attribute (local or global) 5919: carried by the element, and if the element is a leaf of the tree, it also 1.10 cvs 5920: applies translation rules for characters, symbols, or graphical elements, 1.18 cvs 5921: depending on the type of the leaf.</p> 1.30 cvs 5922: 5923: <p>Rules associated with the content of leaves are different from all other 1.1 cvs 5924: rules: they specify only how to translate character strings, symbols, and 1.37 cvs 5925: graphical elements. All other rules, whether associated with element types, 1.1 cvs 5926: with specific presentation rules or with attributes, are treated similarly. 1.18 cvs 5927: These rules primarily allow:</p> 5928: <ul> 1.30 cvs 5929: <li>generation of a text constant or variable before or after the contents 5930: of an element,</li> 5931: <li>modification of the order in which elements appear after 5932: translation,</li> 5933: <li>removal of an element in the translated document,</li> 5934: <li>and writing messages on the user's terminal during translation.</li> 1.18 cvs 5935: </ul> 5936: </div> 5937: </div> 1.1 cvs 5938: 1.18 cvs 5939: <div class="section"> 1.37 cvs 5940: <h2><a name="sectb52" id="sectb52">Translation definition language</a></h2> 1.1 cvs 5941: 1.30 cvs 5942: <p>Translation schemas are written in a custom language, called T, which is 1.37 cvs 5943: described in the rest of this chapter. The grammar of T is specified using 1.18 cvs 5944: the same <a href="#sectc321">meta-language</a> as was used for the S and P 1.1 cvs 5945: languages and the translation schemas are written using the same conventions 1.37 cvs 5946: as the structure and presentation schemas. In particular, the keywords of the 1.1 cvs 5947: T language (the stings between apostrophes in the following syntax rules) can 5948: be written in any combination of upper-case and lower-case letters, but 5949: identifiers created by the programmer must always be written in the same 1.18 cvs 5950: way.</p> 1.1 cvs 5951: 1.18 cvs 5952: <div class="subsection"> 1.37 cvs 5953: <h3><a name="sectc521" id="sectc521">Organization of a translation 5954: schema</a></h3> 1.1 cvs 5955: 1.30 cvs 5956: <p>A translation schema is begun by the <tt>TRANSLATION</tt> keyword and is 1.37 cvs 5957: terminated by the <tt>END</tt> keyword. The <tt>TRANSLATION</tt> keyword is 5958: followed by the name of the generic structure for which a translation is 5959: being defined and a semicolon. This name must be identical to the name which 1.18 cvs 5960: appears after the <tt>STRUCTURE</tt> keyword in the corresponding structure 5961: schema.</p> 1.30 cvs 5962: 5963: <p>After this declaration of the structure, the following material appears in 1.18 cvs 5964: order:</p> 5965: <ul> 1.30 cvs 5966: <li>the length of lines produced by the translation,</li> 5967: <li>the character delimiting the end of the line,</li> 5968: <li>the character string which the translator will insert if it must 5969: line-break the translated text,</li> 1.37 cvs 5970: <li>declarations of 1.30 cvs 5971: <ul> 5972: <li>buffers,</li> 5973: <li>counters,</li> 5974: <li>constants,</li> 5975: <li>variables,</li> 5976: </ul> 5977: </li> 5978: <li>translation rules associated with element types,</li> 5979: <li>translation rules associated with attributes,</li> 5980: <li>translation rules associated with specific presentation rules,</li> 5981: <li>translation rules associated with characters strings, symbols and 5982: graphical elements.</li> 1.18 cvs 5983: </ul> 1.30 cvs 5984: 1.37 cvs 5985: <p>Each of these sections is introduced by a keyword followed by a sequence 5986: of declarations. All of these sections are optional, expect for the 5987: translation rules associated with element types. Many <tt>TEXTTRANSLATE</tt> 5988: sections can appear, each defining the rules for translating character 5989: strings of a particular alphabet.</p> 1.18 cvs 5990: <pre> TransSchema ='TRANSLATION' ElemID ';' 1.1 cvs 5991: [ 'LINELENGTH' LineLength ';' ] 5992: [ 'LINEEND' CHARACTER ';' ] 5993: [ 'LINEENDINSERT' STRING ';' ] 5994: [ 'BUFFERS' BufferSeq ] 5995: [ 'COUNTERS' CounterSeq ] 5996: [ 'CONST' ConstSeq ] 5997: [ 'VAR' VariableSeq ] 5998: 'RULES' ElemSeq 5999: [ 'ATTRIBUTES' AttrSeq ] 6000: [ 'PRESENTATION' PresSeq ] 1.30 cvs 6001: < 'TEXTTRANSLATE' TextTransSeq > 1.1 cvs 6002: [ 'SYMBTRANSLATE' TransSeq ] 6003: [ 'GRAPHTRANSLATE' TransSeq ] 1.18 cvs 6004: 'END' .</pre> 6005: </div> 1.1 cvs 6006: 1.18 cvs 6007: <div class="subsection"> 1.37 cvs 6008: <h3><a name="sectc522" id="sectc522">Line length</a></h3> 1.1 cvs 6009: 1.30 cvs 6010: <p>If a <tt>LINELENGTH</tt> instruction is present after the structure 1.37 cvs 6011: declaration, the translator divides the text it produces into lines, each 6012: line having a length less than or equal to the integer which follows the 6013: <tt>LINELENGTH</tt> keyword. This maximum line length is expressed as a 6014: number of characters. The end of the line is marked by the character defined 6015: by the <tt>LINEEND</tt> instruction. When the translator breaks the lines on 1.1 cvs 6016: a space character in generated text, this space will be replaced by the 1.18 cvs 6017: character string defined by the <tt>LINEENDINSERT</tt> instruction.</p> 1.30 cvs 6018: 6019: <p>If the <tt>LINEEND</tt> instruction is not defined then the linefeed 6020: character (octal code 12) is used as the default line end character. If the 1.18 cvs 6021: <tt>LINEENDINSERT</tt> instruction is not defined, the linefeed character is 1.37 cvs 6022: inserted at the end of the produced lines. If there is no <tt>LINELENGTH</tt> 6023: instruction, the translated text is not divided into lines. Otherwise, if the 1.1 cvs 6024: translation rules generate line end marks, these marks remain in the 6025: translated text, but the length of the lines is not controlled by the 1.18 cvs 6026: translator.</p> 6027: <pre> LineLength = NUMBER .</pre> 1.30 cvs 6028: 1.18 cvs 6029: <blockquote class="example"> 1.30 cvs 6030: <p><strong>Example:</strong></p> 6031: 6032: <p>To limit the lines produced by the translator to a length of 80 6033: characters, the following rule is written at the beginning of the 6034: translation schema.</p> 6035: <pre>LineLength 80;</pre> 1.18 cvs 6036: </blockquote> 6037: </div> 1.1 cvs 6038: 1.18 cvs 6039: <div class="subsection"> 1.37 cvs 6040: <h3><a name="sectc523" id="sectc523">Buffers</a></h3> 1.1 cvs 6041: 1.37 cvs 6042: <p>A buffer is a unit of memory managed by the translator, which can either 1.18 cvs 6043: contain text read from the terminal during the translation (see the <a 6044: href="#sectc5212"><tt>Read</tt> rule</a>), or the name of the last picture 1.1 cvs 6045: (bit-map) encountered by the translator in its traversal of the document. 1.2 cvs 6046: Remember the pictures are stored in files that are separate for the document 1.1 cvs 6047: files and that the canonical form contains only the names of the files in 1.18 cvs 6048: which the pictures are found.</p> 1.30 cvs 6049: 1.37 cvs 6050: <p>Thus, there are two types of buffers: buffers for reading from the 1.30 cvs 6051: terminal (filled by the <tt>Read</tt> rule) and the buffer of picture names 1.37 cvs 6052: (containing the name of the last picture encountered). A translation schema 1.30 cvs 6053: can use either type, one or several read buffers and one (and only one) 6054: picture name buffer.</p> 6055: 6056: <p>If any buffers are used, the <tt>BUFFERS</tt> keyword must be present, 1.37 cvs 6057: followed by declarations of every buffer used in the translation schema. Each 6058: buffer declaration is composed only of the name of the buffer, chosen freely 6059: by the programmer. The picture name buffer is identified by the 6060: <tt>Picture</tt> keyword, between parentheses, following the buffer name. The 6061: <tt>Picture</tt> keyword may only appear once. Each buffer declaration is 1.18 cvs 6062: terminated by a semicolon.</p> 1.30 cvs 6063: <pre> BufferSeq = Buffer < Buffer > . 1.1 cvs 6064: Buffer = BufferID [ '(' 'Picture' ')' ] ';' . 1.18 cvs 6065: BufferID = NAME .</pre> 1.30 cvs 6066: 1.18 cvs 6067: <blockquote class="example"> 1.30 cvs 6068: <p><strong>Example:</strong></p> 6069: 6070: <p>The following buffer declarations create a picture name buffer named 1.37 cvs 6071: <tt>pictureName</tt> and a read buffer named <a name="destname" 6072: id="destname"><tt>DestName</tt></a>:</p> 1.30 cvs 6073: <pre>BUFFERS 1.18 cvs 6074: pictureName (Picture); DestName;</pre> 6075: </blockquote> 6076: </div> 1.1 cvs 6077: 1.18 cvs 6078: <div class="subsection"> 1.37 cvs 6079: <h3><a name="sectc524" id="sectc524">Counters</a></h3> 1.30 cvs 6080: 6081: <p>Certain translation rules generate text that varies according to the 1.37 cvs 6082: context of the element to which the rules apply. Variable text is defined 1.30 cvs 6083: either in the <a href="#sectc526"><tt>VAR</tt> section</a> of the translation 6084: schema or in the rule itself (see the <tt>Create</tt> and <tt>Write</tt> 1.37 cvs 6085: rules). Both types of definition rely on counters for the calculation of 1.30 cvs 6086: variable material.</p> 6087: 6088: <p>There are two types of counter: counters whose value is explicitely 6089: computed by applying <a href="#sectc5221"><tt>Set</tt> and <tt>Add</tt> 6090: rules</a>, and counters whose value is computed by a function associated with 6091: the counter. Those functions allow the same calculations as can be used in 1.37 cvs 6092: presentation schemas. As in a presentation schema, counters must be defined 6093: in the <tt>COUNTERS</tt> section of the translation schema before they are 1.30 cvs 6094: used.</p> 6095: 6096: <p>When counters are used in a translation schema, the <tt>COUNTERS</tt> 1.37 cvs 6097: keyword is followed by the declarations of every counter used. Each 6098: declaration is composed of the counter's name possibly followed by a colon 6099: and the counting function to be used for the counter. The declaration is 1.30 cvs 6100: terminated by a semi-colon. If the counter is explicitely computed by 6101: <tt>Set</tt> and <tt>Add</tt> rules, no counting function is indicated. If a 6102: counting function is indicated, <tt>Set</tt> and <tt>Add</tt> rules cannot be 6103: applied to that counter.</p> 1.1 cvs 6104: 1.30 cvs 6105: <p>The counting function indicates how the counter's value will be computed. 1.18 cvs 6106: Three functions are available: <tt>Rank</tt>, <tt>Rlevel</tt>, and 6107: <tt>Set</tt>.</p> 6108: <ul> 1.30 cvs 6109: <li><tt>Rank of ElemID</tt> indicates that the counter's value is the rank 6110: of the element of type <tt>ElemID</tt> which encloses the element for 1.37 cvs 6111: which the counter is being evaluated. For the purposes of this function, 6112: an element of type <tt>ElemID</tt> is considered to enclose itself. This 6113: function is primarily used when the element of type <tt>ElemID</tt> is 1.30 cvs 6114: part of an aggregate or list, in which case the counter's value is the 1.37 cvs 6115: element's rank in its list or aggregate. Note that, unlike the 6116: <tt>Rank</tt> function for presentation schemas, the <tt>Page</tt> 6117: keyword cannot be used in place of the <tt>ElemID</tt>. 6118: <p>The type name <tt>ElemID</tt> can be followed by an integer. That 6119: number represents the relative level, among the ancestors of the 6120: concerned element, of the element whose rank is asked. If that relative 6121: level <i>n</i> is unsigned, the <i>n<sup>th</sup></i> element of type 6122: <tt>ElemID</tt> encountered when travelling the logical structure from 6123: the root to the concerned element is taken into account. If the relative 1.30 cvs 6124: level is negative, the logical structure is travelled in the other 6125: direction, from the concerned element to the root.</p> 6126: </li> 6127: <li><tt>Rlevel of ElemID</tt> indicates that the counter's values is the 6128: relative level in the tree of the element for which the counter is being 6129: evaluated. The counter counts the number of elements of type 6130: <tt>ElemID</tt> which are found on the path between the root of the 6131: document's logical structure tree and the element (inclusive).</li> 6132: <li><tt>Set n on Type1 Add m on Type2</tt> indicates that the counter's 1.37 cvs 6133: value is calculated as follows: in traversing the document from the 1.30 cvs 6134: beginning to the element for which the counter is being evaluated, the 6135: counter is set to the value <tt>n</tt> each time a <tt>Type1</tt> element 6136: is encountered and is incremented by the amount <tt>m</tt> each time a 1.37 cvs 6137: <tt>Type2</tt> element is encountered. The initial value <tt>n</tt> and 1.30 cvs 6138: the increment <tt>m</tt> are integers.</li> 6139: </ul> 6140: 6141: <p>As in a presentation schema, the <tt>Rank</tt> and <tt>Set</tt> functions 1.37 cvs 6142: can be modified by a numeric attribute which changes their initial value. 6143: This is indicated by the <tt>Init</tt> keyword followed by the numeric 6144: attribute's name. The <tt>Set</tt> function takes the value of the attribute 6145: instead of the <tt>InitValue</tt> (<tt>n</tt>). For the <tt>Rank</tt> 6146: function, the value of the attribute is considered to be the rank of the 6147: first element of the list (rather than the normal value of 1). Subsequent 6148: items in the list have their ranks shifted accordingly. In both cases, the 6149: attribute must be numeric and must be a local attribute of the root of the 6150: document itself.</p> 1.30 cvs 6151: <pre> CounterSeq = Counter < Counter > . 1.1 cvs 6152: Counter = CounterID [ ':' CounterFunc ] ';' . 6153: CounterID = NAME . 6154: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ] 6155: [ 'Init' AttrID ] / 6156: 'Rlevel' 'of' ElemID / 6157: 'Set' InitValue 'On' ElemID 6158: 'Add' Increment 'On' ElemID 6159: [ 'Init' AttrID ] . 6160: SLevelAsc = [ '-' ] LevelAsc . 6161: LevelAsc = NUMBER . 6162: InitValue = NUMBER . 6163: Increment = NUMBER . 6164: ElemID = NAME . 1.18 cvs 6165: AttrID = NAME .</pre> 1.30 cvs 6166: 1.18 cvs 6167: <blockquote class="example"> 1.30 cvs 6168: <p><strong>Example:</strong></p> 6169: 6170: <p>If the body of a chapter is defined in the structure schema by:</p> 6171: <pre>Chapter_Body = LIST OF 1.1 cvs 6172: (Section = BEGIN 6173: Section_Title = Text; 6174: Section_Body = BEGIN 6175: Paragraphs; 6176: Section; 6177: END; 6178: END 1.18 cvs 6179: );</pre> 1.30 cvs 6180: 6181: <p>(sections are defined recursively), a counter can be defined giving the 1.37 cvs 6182: <a name="sectnum" id="sectnum">number of a section</a> within its level in 6183: the hierarchy:</p> 1.30 cvs 6184: <pre>COUNTERS 1.18 cvs 6185: SectionNumber : Rank of Section;</pre> 1.30 cvs 6186: 6187: <p>A counter holding the hierarchic level of a section:</p> 6188: <pre> SectionLevel : Rlevel of Section;</pre> 6189: 1.37 cvs 6190: <p>A <a name="uniquenum" id="uniquenum">counter</a> which sequentially 6191: numbers all the document's sections, whatever their hierarchic level:</p> 1.30 cvs 6192: <pre> UniqueSectNum : Set 0 on Document Add 1 on Section;</pre> 1.18 cvs 6193: </blockquote> 6194: </div> 1.1 cvs 6195: 1.18 cvs 6196: <div class="subsection"> 1.37 cvs 6197: <h3><a name="sectc525" id="sectc525">Constants</a></h3> 1.1 cvs 6198: 1.30 cvs 6199: <p>A common feature of translation rules is the generation of constant text. 1.37 cvs 6200: This text can be defined in the rule that generates it (see for example the 6201: <a href="#sectc5210"><tt>Create</tt></a> and <a 1.18 cvs 6202: href="#sectc5211"><tt>Write</tt></a> rules); but it can also be defined once 6203: in the constant declaration section and used many times in different rules. 1.37 cvs 6204: The latter option is preferable when the same text is used in several rules 6205: or several <a href="#sectc526">variables</a>.</p> 1.30 cvs 6206: 6207: <p>The <tt>CONST</tt> keyword begins the constant declaration section of the 1.37 cvs 6208: translation schema. It must be omitted if no constants are declared. Each 6209: constant declaration is composed of the constant name, an equals sign, and 6210: the constant's value, which is a character string between apostrophes. A 6211: constant declaration is terminated by a semicolon.</p> 1.30 cvs 6212: <pre> ConstSeq = Const < Const > . 1.1 cvs 6213: Const = ConstID '=' ConstValue ';' . 6214: ConstID = NAME . 1.18 cvs 6215: ConstValue = STRING .</pre> 1.30 cvs 6216: 1.18 cvs 6217: <blockquote class="example"> 1.37 cvs 6218: <p><strong><a name="levelexample" 6219: id="levelexample">Example:</a></strong></p> 1.30 cvs 6220: 6221: <p>The following rule assigns the name <tt>TxtLevel</tt> to the character 6222: string ``Level'':</p> 6223: <pre>CONST 1.18 cvs 6224: TxtLevel = 'Level';</pre> 6225: </blockquote> 6226: </div> 1.1 cvs 6227: 1.18 cvs 6228: <div class="subsection"> 1.37 cvs 6229: <h3><a name="sectc526" id="sectc526">Variables</a></h3> 1.1 cvs 6230: 1.30 cvs 6231: <p>Variables allow to define variable text which is generated by the 1.37 cvs 6232: <tt>Create</tt> and <tt>Write</tt> rules. They are also used to define file 1.18 cvs 6233: names which are used in the <tt>Create</tt>, <tt>ChangeMainFile</tt>, 1.37 cvs 6234: <tt>RemoveFile</tt>, and <tt>Indent</tt> rules. Variables can be defined 1.18 cvs 6235: either in the <tt>VAR</tt> section of the translation schema or directly in 1.37 cvs 6236: the rules which use them. Variables that define file names must be declared 1.18 cvs 6237: in the <tt>VAR</tt> section, and when the same variable is used several times 6238: in the translation schema, it makes sense to define it globally in the 1.37 cvs 6239: <tt>VAR</tt> section. This section is only present if at least one variable 1.18 cvs 6240: is defined globally.</p> 1.30 cvs 6241: 6242: <p>After the <tt>VAR</tt> keyword, each global variable is defined by its 6243: name, a colon separator and a sequence of functions (at least one function). 1.37 cvs 6244: Each variable definition is terminated by a semicolon. Functions determine 6245: the different parts which together give the value of the variable. The value 6246: is obtained by concatenating the strings produced by each of the functions. 6247: Seven types of functions are available. Each variable definition may use any 6248: number of functions of each type.</p> 1.18 cvs 6249: <ul> 1.30 cvs 6250: <li>The function <tt>Value(Counter)</tt>returns a string representing the 6251: value taken by the counter when it is evaluated for the element in whose 1.37 cvs 6252: rule the variable is used. The counter must have been declared in the 6253: <tt>COUNTERS</tt> section of the translation schema. When the counter is 1.30 cvs 6254: expressed in arabic numerals, the counter name can be followed by a colon 6255: and an integer indicating a minimum length (number of characters) for the 1.37 cvs 6256: string; if the counter's value is normally expressed with fewer 6257: characters than the required minimum, zeroes are added to the front of 6258: the string to achieve the minimum length. 1.30 cvs 6259: <p>By default, the counter value is written in arabic digits. If another 6260: representation of that value is needed, the counter name must be followed 6261: by a comma and one of the following keywords:</p> 6262: <ul> 6263: <li><tt>Arabic</tt>: arabic numerals (default value),</li> 6264: <li><tt>LRoman</tt>: lower-case roman numerals,</li> 6265: <li><tt>URoman</tt>: upper-case roman numerals,</li> 6266: <li><tt>Uppercase</tt>: upper-case letter,</li> 6267: <li><tt>Lowercase</tt>: lower-case letter.</li> 6268: </ul> 6269: </li> 6270: <li>The function <tt>FileDir</tt>, without parameter, returns a string 6271: representing the name of the directory of the output file that has been 6272: given as a parameter to the translation program. The string includes a 6273: character '/' at the end.</li> 6274: <li>The function <tt>FileName</tt>, without parameter, returns a string 6275: representing the name of the output file that has been given as a 6276: parameter to the translation program. The file extension (the character 6277: string that terminate the file name, after a dot) is not part of that 6278: string.</li> 6279: <li>The function <tt>Extension</tt>, without parameter, returns a string 6280: representing the extension of the file name. That string is empty if the 6281: file name that has been given as a parameter to the translation program 6282: has no extension. If there is an extension, its first character is a 6283: dot.</li> 6284: <li>The function <tt>DocumentName</tt>, without parameter, returns a string 6285: representing the name of the document being translated.</li> 6286: <li>The function <tt>DocumentDir</tt>, without parameter, returns a string 6287: representing the directory containing the document being translated.</li> 6288: <li>The function formed by the name of a constant returns that constant's 6289: value.</li> 6290: <li>The function formed by a character string between apostrophes returns 6291: that string.</li> 1.37 cvs 6292: <li>The function formed by the name of a buffer returns the contents of 6293: that buffer. If the named buffer is the picture buffer, then the name of 6294: the last picture encountered is returned. Otherwise, the buffer is a read 1.31 cvs 6295: buffer and the value returned is text previously read from the terminal. 1.30 cvs 6296: If the buffer is empty (no picture has been encountered or the 6297: <tt>Read</tt> rule has not been executed for the buffer), then the empty 6298: string is returned.</li> 6299: <li>The function formed by an attribute name takes the value of the 1.37 cvs 6300: indicated attribute for the element to which the variable applies. If the 1.30 cvs 6301: element does not have that attribute, then the element's ancestor are 1.37 cvs 6302: searched toward the root of the tree. If one of the ancestors does have 6303: the attribute then its value is used. If no ancestors have the attribute, 1.30 cvs 6304: then the value of the function is the empty string.</li> 1.18 cvs 6305: </ul> 1.30 cvs 6306: <pre> VariableSeq = Variable < Variable > . 6307: Variable = VarID ':' Function < Function > ';' . 1.1 cvs 6308: VarID = NAME . 6309: Function ='Value' '(' CounterID [ ':' Length ] 6310: [ ',' CounterStyle ] ')' / 6311: 'FileDir' / 'FileName' / 'Extension' / 6312: 'DocumentName' / 'DocumentDir' / 6313: ConstID / CharString / 6314: BufferID / AttrID . 6315: Length = NUMBER . 6316: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' / 6317: 'Uppercase' / 'Lowercase' . 1.18 cvs 6318: CharString = STRING .</pre> 1.30 cvs 6319: 1.18 cvs 6320: <blockquote class="example"> 1.30 cvs 6321: <p><strong>Example:</strong></p> 6322: 6323: <p>To create, at the beginning of each section of the translated document, 6324: text composed of the string ``Section'' followed by the section number, the 1.37 cvs 6325: following <a name="varsectexample" id="varsectexample">variable 6326: definition</a> might be used:</p> 1.30 cvs 6327: <pre>VAR 1.18 cvs 6328: SectionVar : 'Section' Value(SectionNumber);</pre> 1.30 cvs 6329: 6330: <p>(see the definition of <a 6331: href="#sectnum"><tt>SectionNumber</tt></a>).</p> 6332: 1.37 cvs 6333: <p>The following variable definition can be used to create, at the 6334: beginning of each section, the text ``Level'' followed by the hierarchical 6335: level of the section. It used the constant defined above.</p> 1.30 cvs 6336: <pre> LevelVar : TxtLevel Value(SectionLevel);</pre> 6337: 6338: <p>(see the definitions of <a href="#sectnum"><tt>SectionLevel</tt></a> and 6339: of <a href="#levelexample"><tt>TxtLevel</tt></a>).</p> 6340: 6341: <p>To generate the translation of each section in a different file (see <a 1.37 cvs 6342: href="#sectc5220">rule <tt>ChangeMainFile</tt></a>), the name of these 6343: files might be defined by the following variable:</p> 1.30 cvs 6344: <pre> VarOutpuFile : FileName Value(SectionNumber) 1.18 cvs 6345: Extension;</pre> 1.30 cvs 6346: 1.37 cvs 6347: <p>If <tt>output.txt</tt> is the name of the <a name="varoutputfile" 6348: id="varoutputfile">output file</a> specified when starting the translation 6349: program, translated sections are written in files <tt>output1.txt</tt>, 6350: <tt>output2.txt</tt>, etc.</p> 1.18 cvs 6351: </blockquote> 6352: </div> 6353: 6354: <div class="subsection"> 1.37 cvs 6355: <h3><a name="sectc527" id="sectc527">Translating structure elements</a></h3> 1.18 cvs 6356: 1.30 cvs 6357: <p>The <tt>RULES</tt> keyword introduces the translation rules which will be 1.37 cvs 6358: applied to the various structured element types. Translation rules can be 6359: specified for each element type defined in the structure schema, including 6360: the base types defined implicitly, whose names are <tt>TEXT_UNIT</tt>, 1.18 cvs 6361: <tt>PICTURE_UNIT</tt>, <tt>SYMBOL_UNIT</tt>, <tt>GRAPHIC_UNIT</tt> and 1.37 cvs 6362: <tt>PAGE_UNIT</tt>. But it is not necessary to specify rules for every 1.18 cvs 6363: defined type.</p> 1.30 cvs 6364: 1.37 cvs 6365: <p>If there are no translation rules for an element type, the elements that 6366: it contains (and which may have rules themselves) will still be translated, 6367: but the translator will produce nothing for the element itself. To make the 1.18 cvs 6368: translator completely ignore the content of an element the <a 6369: href="#sectc5217"><tt>Remove</tt> rule</a> must be used.</p> 1.30 cvs 6370: 6371: <p>The translation rules for an element type defined in the structure schema 6372: are written using the name of the type followed by a colon and the list of 1.37 cvs 6373: applicable rules. When the element type is a <a href="#sectd3285">mark 1.18 cvs 6374: pair</a>, but only in this case, the type name must be preceded by the 1.37 cvs 6375: <tt>First</tt> or <tt>Second</tt> keyword. This keyword indicates whether the 1.18 cvs 6376: rules that follow apply to the first or second mark of the pair.</p> 1.30 cvs 6377: 1.37 cvs 6378: <p>The list of rules can take several forms. It may be a simple 6379: non-conditional rule. It can also be formed by a condition followed by one or 6380: more simple rules. Or it can be a block of rules beginning with the 1.30 cvs 6381: <tt>BEGIN</tt> keyword and ending with the <tt>END</tt> keyword and a 1.37 cvs 6382: semicolon. This block of rules can contain one or more simple rules and/or 1.30 cvs 6383: one or more conditions, each followed by one or more simple rules.</p> 6384: <pre> ElemSeq = TransType < TransType > . 1.1 cvs 6385: TransType = [ FirstSec ] ElemID ':' RuleSeq . 6386: FirstSec = 'First' / 'Second' . 1.30 cvs 6387: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' . 1.1 cvs 6388: Rule = SimpleRule / ConditionBlock . 6389: ConditionBlock = 'IF' ConditionSeq SimpleRuleSeq . 1.30 cvs 6390: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' / 1.18 cvs 6391: SimpleRule .</pre> 6392: </div> 1.1 cvs 6393: 1.18 cvs 6394: <div class="subsection"> 1.37 cvs 6395: <h3><a name="sectc528" id="sectc528">Conditional rules</a></h3> 1.1 cvs 6396: 1.30 cvs 6397: <p>In a translation schema, the translation rules are either associated with 1.37 cvs 6398: element types or with attribute values or with a specific presentation. They 1.1 cvs 6399: are applied by the translator each time an element of the corresponding type 6400: is encountered in the translated document or each time the attribute value is 6401: carried by an element or also, each time the specific translation is attached 1.37 cvs 6402: to an element. This systematic application of the rules can be relaxed: it is 6403: possible to add a condition to one or more rules, so that these rules are 6404: only applied when the condition is true.</p> 1.30 cvs 6405: 6406: <p>A condition begins with the keyword <tt>IF</tt>, followed by a sequence of 1.37 cvs 6407: elementary conditions. Elementary conditions are separated from each other by 6408: the <tt>AND</tt> keyword. If there is only one elementary condition, this 6409: keyword is absent. The rules are only applied if all the elementary 6410: conditions are true. The elementary condition can be negative; it is then 1.18 cvs 6411: preceded by the <tt>NOT</tt> keyword.</p> 1.30 cvs 6412: 6413: <p>When the translation rule(s) controlled by the condition apply to a 6414: reference element or a reference attribute, an elementary condition can also 1.37 cvs 6415: apply to element referred by this reference. The <tt>Target</tt> keyword is 6416: used for that purpose. It must appear before the keyword defining the 1.30 cvs 6417: condition type.</p> 6418: 6419: <p>Depending on their type, some conditions may apply either to the element 1.37 cvs 6420: with which they are associated, or to one of its ancestor. In the case of an 1.18 cvs 6421: ancestor, the key word <tt>Ancestor</tt> must be used, followed by</p> 6422: <ul> 1.30 cvs 6423: <li>either an integer which represents the number of levels in the tree 6424: between the element and the ancestor of interest,</li> 1.37 cvs 6425: <li>or the type name of the ancestor of interest. If that type is defined 1.30 cvs 6426: in a separate structure schema, the name of that schema must follow 6427: between parentheses.</li> 1.18 cvs 6428: </ul> 1.30 cvs 6429: 1.37 cvs 6430: <p>There is a special case for the parent element, which can be simply 6431: written <tt>Parent</tt> instead of <tt>Ancestor 1</tt>.</p> 1.30 cvs 6432: 6433: <p>Only conditions <tt>First</tt>, <tt>Last</tt>, <tt>Referred</tt>, 1.34 cvs 6434: <tt>Within</tt>, <tt>Attributes</tt>, <tt>Presentation</tt>, and those 6435: concerning an attribute or a specific presentation can apply to an ancestor. 6436: Conditions <tt>FirstRef</tt>, <tt>LastRef</tt>, <tt>ExternalRef</tt>, 6437: <tt>Alphabet</tt>, <tt>FirstAttr</tt>, <tt>LastAttr</tt>, 6438: <tt>ComputedPage</tt>, <tt>StartPage</tt>, <tt>UserPage</tt>, 6439: <tt>ReminderPage</tt>, <tt>Empty</tt> cannot be preceded by keywords 6440: <tt>Parent</tt> or <tt>Ancestor</tt>.</p> 1.30 cvs 6441: 1.37 cvs 6442: <p>In condition <tt>Referred</tt> and in the condition that applies to a 6443: named attribute, a symbol '<tt>*</tt>' can indicate that the condition is 6444: related only to the element itself. If this symbol is not present, not only 6445: the element is considered, but also its ancestor, at any level.</p> 1.30 cvs 6446: 6447: <p>The form of an elementary condition varies according to the type of 1.18 cvs 6448: condition.</p> 1.1 cvs 6449: 1.18 cvs 6450: <div class="subsubsection"> 1.37 cvs 6451: <h4><a name="sectd5281" id="sectd5281">Conditions based on the logical 6452: position of the element</a></h4> 1.30 cvs 6453: 6454: <p>The condition can be on the position of the element in the document's 1.37 cvs 6455: logical structure tree. It is possible to test whether the element is the 1.30 cvs 6456: first (<tt>First</tt>) or last (<tt>Last</tt>) among its siblings or if it is 6457: not the first (<tt>NOT First</tt>) or not the last (<tt>NOT Last</tt>).</p> 6458: 6459: <p>It is also possible to test if the element is contained in an element of a 1.18 cvs 6460: given type (<tt>Within</tt>) or if it is not (<tt>NOT Within</tt>). If that 1.1 cvs 6461: element type is defined in a structure schema which is not the one which 6462: corresponds to the translation schema, the type name of this element must be 6463: followed, between parentheses, by the name of the structure schema which 1.18 cvs 6464: defines it.</p> 1.30 cvs 6465: 6466: <p>If the keyword <tt>Within</tt> is preceded by <tt>Immediately</tt>, the 1.18 cvs 6467: condition is satisfied only if the <em>parent</em> element has the type 6468: indicated. If the word <tt>Immediately</tt> is missing, the condition is 6469: satisfied if any <em>ancestor</em> has the type indicated.</p> 1.30 cvs 6470: 6471: <p>An integer <i>n</i> can appear between the keyword <tt>Within</tt> and the 1.37 cvs 6472: type. It specifies the number of ancestors of the indicated type that must be 6473: present for the condition to be satisfied. If the keyword 1.18 cvs 6474: <tt>Immediately</tt> is also present, the <i>n</i> immediate ancestors of the 1.37 cvs 6475: element must have the indicated type. The integer <i>n</i> must be positive 6476: or zero. It can be preceded by <tt><</tt> or <tt>></tt> to indicate a 6477: maximum or minimum number of ancestors. If these symbols are missing, the 6478: condition is satisfied only if it exists exactly <i>n</i> ancestors. When 1.30 cvs 6479: this number is missing, it is equivalent to > 0.</p> 6480: 1.37 cvs 6481: <p>If the condition applies to translation rules associated with an 6482: attribute, i.e. if it is in the <tt>ATTRIBUTES</tt> section of the 6483: presentation schema, the condition can be simply an element name. Translation 6484: rules are then executed only if the attribute is attached to an element of 6485: that type. The keyword <tt>NOT</tt> before the element name indicates that 6486: the translation rules must be executed only if the element is not of the type 6487: indicated.</p> 1.18 cvs 6488: </div> 1.1 cvs 6489: 1.18 cvs 6490: <div class="subsubsection"> 1.37 cvs 6491: <h4><a name="sectd5282" id="sectd5282">Conditions on references</a></h4> 1.1 cvs 6492: 1.30 cvs 6493: <p>References may be taken into account in conditions, which can be based on 6494: the fact that the element, or one of its ancestors (unless symbol <tt>*</tt> 6495: is present), is designated by a at least one reference (<tt>Referred</tt>) or 1.37 cvs 6496: by none (<tt>NOT Referred</tt>). If the element or attribute to which the 1.1 cvs 6497: condition is attached is a reference, the condition can be based on the fact 6498: that it acts as the first reference to the designated element 1.18 cvs 6499: (<tt>FirstRef</tt>), or as the last (<tt>LastRef</tt>), or as a reference to 1.37 cvs 6500: an element located in another document (<tt>ExternalRef</tt>). Like all 1.18 cvs 6501: conditions, conditions on references can be inverted by the <tt>NOT</tt> 6502: keyword.</p> 6503: </div> 6504: 6505: <div class="subsubsection"> 1.37 cvs 6506: <h4><a name="sectd5284" id="sectd5284">Conditions on the alphabets</a></h4> 1.1 cvs 6507: 1.30 cvs 6508: <p>The character string base type (and only this type) can use the condition 1.37 cvs 6509: <tt>Alphabet = a</tt> which indicates that the translation rule(s) should 6510: only apply if the alphabet of the character string is the one whose name 6511: appears after the equals sign (or is not, if there is a preceding 6512: <tt>NOT</tt> keyword). This condition cannot be applied to translation rules 6513: of an attribute.</p> 1.30 cvs 6514: 6515: <p>In the current implementation of Thot, the available alphabets are the 1.18 cvs 6516: <tt>Latin</tt> alphabet and the <tt>Greek</tt> alphabet.</p> 6517: </div> 1.1 cvs 6518: 1.18 cvs 6519: <div class="subsubsection"> 1.37 cvs 6520: <h4><a name="sectd5285" id="sectd5285">Conditions on page breaks</a></h4> 1.1 cvs 6521: 1.30 cvs 6522: <p>The page break base type (and only this type) can use the following 1.18 cvs 6523: conditions: <tt>ComputedPage</tt>, <tt>StartPage</tt>, <tt>UserPage</tt>, and 1.37 cvs 6524: <tt>ReminderPage</tt>. The <tt>ComputedPage</tt> condition indicates that the 1.1 cvs 6525: translation rule(s) should apply if the page break was created automatically 1.37 cvs 6526: by Thot; the <tt>StartPage</tt> condition is true if the page break is 1.18 cvs 6527: generated before the element by the <tt>Page</tt> rule of the P language; the 6528: <tt>UserPage</tt> condition applies if the page break was inserted by the 1.37 cvs 6529: user; and the <tt>ReminderPage</tt> is applied if the page break is a 6530: reminder of page breaking.</p> 1.18 cvs 6531: </div> 1.1 cvs 6532: 1.18 cvs 6533: <div class="subsubsection"> 1.37 cvs 6534: <h4><a name="sectd5286" id="sectd5286">Conditions on the element's 6535: content</a></h4> 1.1 cvs 6536: 1.37 cvs 6537: <p>The condition can be based on whether or not the element is empty. An 1.30 cvs 6538: element which has no children or whose leaves are all empty is considered to 1.37 cvs 6539: be empty itself. This condition is expressed by the <tt>Empty</tt> keyword, 1.30 cvs 6540: optionally preceded by the <tt>NOT</tt> keyword.</p> 1.18 cvs 6541: </div> 1.1 cvs 6542: 1.18 cvs 6543: <div class="subsubsection"> 1.37 cvs 6544: <h4><a name="sectd5288" id="sectd5288">Conditions on the presence of specific 6545: presentation rules</a></h4> 1.30 cvs 6546: 6547: <p>The condition can be based on the presence or absence of specific 1.37 cvs 6548: presentation rules associated with the translated element, whatever the 6549: rules, their value or their number. This condition is expressed by the 6550: keyword <tt>Presentation</tt>, optionally preceded by the <tt>NOT</tt> 6551: keyword.</p> 1.18 cvs 6552: </div> 1.1 cvs 6553: 1.18 cvs 6554: <div class="subsubsection"> 1.37 cvs 6555: <h4><a name="sectd5289" id="sectd5289">Conditions on the presence of logical 1.18 cvs 6556: attributes</a></h4> 1.30 cvs 6557: 6558: <p>In the same way, the condition can be based on the presence or absence of 1.1 cvs 6559: attributes associated with the translated elements, no matter what the 1.37 cvs 6560: attributes or their values. The <tt>Attributes</tt> keyword expresses this 1.18 cvs 6561: condition.</p> 6562: </div> 1.1 cvs 6563: 1.18 cvs 6564: <div class="subsubsection"> 1.37 cvs 6565: <h4><a name="sectd52810" id="sectd52810">Conditions on logical 6566: attributes</a></h4> 1.1 cvs 6567: 1.30 cvs 6568: <p>If the condition appears in the translation rules of an attribute, the 1.37 cvs 6569: <tt>FirstAttr</tt> and <tt>LastAttr</tt> keywords can be used to indicate 6570: that the rules must only be applied if this attribute is the first attribute 6571: for the translated element or if it is the last (respectively). These 6572: conditions can also be inverted by the <tt>NOT</tt> keyword.</p> 6573: 6574: <p>Another type of condition can only be applied to the translation rules 6575: when the element being processed (or one of its ancestors if symbol 6576: <tt>*</tt> is missing) has a certain attribute, perhaps with a certain value 6577: or, in contrast, when the element does not have this attribute with this 6578: value. The condition is specified by writing the name of the attribute after 6579: the keyword <tt>IF</tt> or <tt>AND</tt>. The <tt>NOT</tt> keyword can be used 6580: to invert the condition. If the translation rules must be applied to any 6581: element which has this attribute (or does not have it, if the condition is 6582: inverted) no matter what the attribute's value, the condition is complete. 6583: If, in contrast, the condition applies to one or more values of the 6584: attribute, these are indicated after the name of the attribute, except for 6585: reference attributes which do not have values.</p> 6586: 6587: <p>The representation of the values of an <a name="relattr" 6588: id="relattr">attribute</a> in a condition depends on the attribute's type. 6589: For attributes with enumerated or textual types, the value (a name or 6590: character string between apostrophes, respectively) is simply preceded by an 6591: equals sign. For numeric attributes, the condition can be based on a single 6592: value or on a range of values. In the case of a unique value, this value (an 6593: integer) is simply preceded by an equals sign. Conditions based on ranges of 6594: values have several forms:</p> 1.18 cvs 6595: <ul> 1.30 cvs 6596: <li>all values less than a given value (the value is preceded by a ``less 6597: than'' sign).</li> 6598: <li>all values greater than a given value (the value is preceded by a 6599: ``greater than'' sign).</li> 1.37 cvs 6600: <li>all values falling in an interval, bounds included. The range of values 6601: is then specified <tt>IN [</tt>Minimum <tt>..</tt>Maximum<tt>]</tt>, 6602: where Minimum and Maximum are integers.</li> 1.18 cvs 6603: </ul> 1.30 cvs 6604: 1.37 cvs 6605: <p>All numeric values may be negative. The integer is simply preceded by a 1.30 cvs 6606: minus sign.</p> 6607: 6608: <p>Both local and global attributes can be used in conditions.</p> 1.18 cvs 6609: </div> 1.1 cvs 6610: 1.18 cvs 6611: <div class="subsubsection"> 1.37 cvs 6612: <h4><a name="sectd52811" id="sectd52811">Conditions on specific presentation 6613: rules</a></h4> 1.1 cvs 6614: 1.30 cvs 6615: <p>It is possible to apply translation rules only when the element being 1.1 cvs 6616: processed has or does not have a specific presentation rule, possibly with a 1.37 cvs 6617: certain value. The condition is specified by writing the name of the 6618: presentation rule after the keyword <tt>IF</tt> or <tt>AND</tt>. The 6619: <tt>NOT</tt> keyword can be used to invert the condition. If the translation 6620: rules must be applied to any element which has this presentation rule (or 6621: does not have it, if the condition is inverted) no matter what the rule's 6622: value, the condition is complete. If, in contrast, the condition applies to 6623: one or more values of the rule, these are indicated after the name of the 1.18 cvs 6624: attribute.</p> 1.30 cvs 6625: 1.37 cvs 6626: <p>The representation of presentation rule values in a condition is similar 6627: to that for attribute values. The representation of these values depend on 6628: the type of the presentation rule. There are three categories of presentation 1.18 cvs 6629: rules:</p> 6630: <ul> 1.30 cvs 6631: <li>those taking numeric values (<tt>Size, Indent, LineSpacing, 6632: LineWeight</tt>),</li> 1.36 cvs 6633: <li>those with values taken from a predefined list (<tt>Adjust, Hyphenate, 6634: Style, Weight, Font, UnderLine, Thickness, LineStyle</tt>),</li> 1.30 cvs 6635: <li>those whose value is a name (<tt>FillPattern, Background, 6636: Foreground</tt>).</li> 1.18 cvs 6637: </ul> 1.30 cvs 6638: 6639: <p>For presentation rules which take numeric values, the condition can take a 1.37 cvs 6640: unique value or a range of values. In the case of a unique value, this value 1.1 cvs 6641: (an integer) is simply preceded by an equals sign. Conditions based on ranges 1.18 cvs 6642: of values have several forms:</p> 6643: <ul> 1.30 cvs 6644: <li>all values less than a given value (the value is preceded by a ``less 6645: than'' sign).</li> 6646: <li>all values greater than a given value (the value is preceded by a 6647: ``greater than'' sign).</li> 1.37 cvs 6648: <li>all values falling in an interval, bounds included. The range of values 6649: is then specified <tt>IN [</tt>Minimum <tt>..</tt>Maximum<tt>]</tt>, 6650: where Minimum and Maximum are integers.</li> 1.18 cvs 6651: </ul> 1.30 cvs 6652: 1.37 cvs 6653: <p>Values for the <tt>Indent</tt>rule may be negative. The integer is then 1.2 cvs 6654: simply preceded by a minus sign and represents how far the first line starts 1.18 cvs 6655: to the left of the other lines.</p> 1.30 cvs 6656: 6657: <p>For presentation rules whose values are taken from predefined lists, the 1.37 cvs 6658: value which satisfies the condition is indicated by an equals sign followed 6659: by the name of the value.</p> 1.30 cvs 6660: 1.37 cvs 6661: <p>For presentation rule whose values are names, the value which satisfies 6662: the condition is indicated by the equals sign followed by the value's name. 6663: The names of fill patterns (the <tt>FillPattern</tt> rule) and of colors (the 1.18 cvs 6664: <tt>Foreground</tt> and <tt>Background</tt> rules) known to Thot are the same 6665: as in the P language.</p> 1.30 cvs 6666: 6667: <p>The syntax of conditions based on the specific presentation is the same as 6668: the syntax used to express the <a href="#sectc5224">translation of specific 1.18 cvs 6669: presentation rules</a>.</p> 1.30 cvs 6670: 6671: <p>When a condition has only one rule, the condition is simply followed by 1.37 cvs 6672: that rule. If it has several rules, they are placed after the condition 1.30 cvs 6673: between the keywords <tt>BEGIN</tt> and <tt>END</tt>.</p> 1.18 cvs 6674: <pre> ConditionSeq = Condition [ 'AND' Condition ] . 1.1 cvs 6675: Condition = [ 'NOT' ] [ 'Target' ] Cond . 6676: Cond = CondElem / CondAscend . 6677: CondElem ='FirstRef' / 'LastRef' / 6678: 'ExternalRef' / 6679: 'Alphabet' '=' Alphabet / 6680: 'ComputedPage' / 'StartPage' / 6681: 'UserPage' / 'ReminderPage' / 6682: 'Empty' / 1.11 cvs 6683: ElemID / 1.1 cvs 6684: 'FirstAttr' / 'LastAttr' . 6685: CondAscend = [ Ascend ] CondOnAscend . 6686: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType . 6687: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] . 6688: CondRelLevel = NUMBER . 6689: CondOnAscend ='First' / 'Last' / 6690: 'Referred' / 6691: [ 'Immediately' ] 'Within' [ NumParent ] 6692: ElemID [ ExtStruct ] / 6693: 'Attributes' / 6694: AttrID [ RelatAttr ] / 6695: 'Presentation' / 1.34 cvs 6696: PresRule . 1.1 cvs 6697: NumParent = [ GreaterLess ] NParent . 1.30 cvs 6698: GreaterLess = '>' / '<' . 1.1 cvs 6699: NParent = NUMBER. 6700: ExtStruct = '(' ElemID ')' . 6701: Alphabet = NAME . 6702: RelatAttr ='=' Value / 1.30 cvs 6703: '>' [ '-' ] Minimum / 1.1 cvs 6704: '<' [ '-' ] Maximum / 6705: 'IN' '[' [ '-' ] MinInterval '..' 6706: [ '-' ] MaxInterval ']' . 6707: Value = [ '-' ] IntegerVal / TextVal / AttrValue . 6708: Minimum = NUMBER . 6709: Maximum = NUMBER . 6710: MinInterval = NUMBER . 6711: MaxInterval = NUMBER . 6712: IntegerVal = NUMBER . 6713: TextVal = STRING . 1.18 cvs 6714: AttrValue = NAME .</pre> 1.30 cvs 6715: 1.18 cvs 6716: <blockquote class="example"> 1.30 cvs 6717: <p><strong>Example:</strong></p> 6718: 6719: <p>Suppose that after each element of type Section_Title it is useful to 6720: produce the text <tt>\label{SectX}</tt> where <tt>X</tt> represents the 6721: section number, but only if the section is designated by one or more 1.37 cvs 6722: references in the document. The following conditional rule produces this 1.30 cvs 6723: effect:</p> 6724: <pre>RULES 1.1 cvs 6725: Section_Title : 6726: IF Referred 1.18 cvs 6727: Create ('\label{Sect' Value(UniqueSectNum) '}\12') After;</pre> 1.30 cvs 6728: 6729: <p>(the declaration of the <a href="#sectc5224"><tt>UniqueSectNum</tt> 1.37 cvs 6730: counter</a> is given above). The string <tt>\12</tt> represents a line 1.30 cvs 6731: break.</p> 1.18 cvs 6732: </blockquote> 1.30 cvs 6733: 1.18 cvs 6734: <blockquote class="example"> 1.30 cvs 6735: <p><strong>Example:</strong></p> 6736: 1.37 cvs 6737: <p>Suppose that for elements of the Elmnt type it would be useful to 6738: produce a character indicating the value of the numeric attribute Level 6739: associated with the element: an ``A'' for all values of Level less than 3, 6740: a ``B'' for values between 3 and 10 and a ``C'' for values greater than 10. 6741: This can be achieved by writing the following rules for the Elmnt type:</p> 1.30 cvs 6742: <pre>RULES 1.1 cvs 6743: Elmnt : 6744: BEGIN 6745: IF Level < 3 6746: Create 'A'; 6747: IF Level IN [3..10] 6748: Create 'B'; 1.30 cvs 6749: IF Level > 10 1.1 cvs 6750: Create 'C'; 1.18 cvs 6751: END;</pre> 6752: </blockquote> 6753: </div> 6754: </div> 1.1 cvs 6755: 1.18 cvs 6756: <div class="subsection"> 1.37 cvs 6757: <h3><a name="sectc529" id="sectc529">Translation rules</a></h3> 1.1 cvs 6758: 1.37 cvs 6759: <p>Fifteen types of translation rules can be associated with element types 6760: and attribute values. They are the <tt>Create</tt>, <tt>Write</tt>, 1.18 cvs 6761: <tt>Read</tt>, <tt>Include</tt>, <tt>Get</tt>, <tt>Copy</tt>, <tt>Use</tt>, 1.31 cvs 6762: <tt>Remove</tt>, <tt>Ignore</tt>, <tt>NoTranslation</tt>, 6763: <tt>NoLineBreak</tt>, <tt>ChangeMainFile</tt>, <tt>RemoveFile</tt>, 1.37 cvs 6764: <tt>Set</tt>, <tt>Add</tt>, <tt>Indent</tt>, rules. Each rule has its own 1.31 cvs 6765: syntax, although they are all based on very similar models.</p> 1.18 cvs 6766: <pre> SimpleRule = 'Create' [ 'IN' VarID ] Object 1.1 cvs 6767: [ Position ] ';' / 6768: 'Write' Object [ Position ] ';' / 6769: 'Read' BufferID [ Position ] ';' / 6770: 'Include' File [ Position ] ';' / 6771: 'Get' [ RelPosition ] ElemID 6772: [ ExtStruct ] 6773: [ Position ] ';' / 6774: 'Copy' [ RelPosition ] ElemID 6775: [ ExtStruct ] 6776: [ Position ] ';' / 6777: 'Use' TrSchema [ 'For' ElemID ] ';' / 6778: 'Remove' ';' / 1.31 cvs 6779: 'Ignore' ';' / 1.1 cvs 6780: 'NoTranslation' ';' / 6781: 'NoLineBreak' ';' / 6782: 'ChangeMainFile' VarID [ Position ] ';' / 1.14 cvs 6783: 'RemoveFile' VarID [ Position ] ';' / 1.10 cvs 6784: 'Set' CounterID InitValue [ Position ] ';' / 6785: 'Add' CounterID Increment [ Position ] ';' / 1.25 cvs 6786: 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' .</pre> 1.18 cvs 6787: </div> 6788: 6789: <div class="subsection"> 1.37 cvs 6790: <h3><a name="sectc5210" id="sectc5210">The <tt>Create</tt> rule</a></h3> 1.18 cvs 6791: 1.30 cvs 6792: <p>The most frequently used rule is undoubtedly the <tt>Create</tt> rule, 6793: which generates fixed or variable text (called an <em>object</em>) in the 1.37 cvs 6794: output file. The generated text can be made to appear either before or after 6795: the content of the element to which the rule applies. The rule begins with 6796: the <tt>Create</tt> keyword, followed by a specifier for the object and a 6797: keyword (<tt>Before</tt> or <tt>After</tt>) indicating the position of the 6798: generated text (<a href="#sectc5222">before or after</a> the element's 6799: content). If the position is not indicated, the object will be generated 6800: before the element's content. This rule, like all translation rules, is 6801: terminated by a semicolon.</p> 1.30 cvs 6802: 6803: <p>The <tt>Create</tt> keyword can be followed by the <tt>IN</tt> keyword and 1.37 cvs 6804: by the name of a variable. This means that the text generated by the rule 1.30 cvs 6805: must not be written in the main output file, but in the file whose name is 1.18 cvs 6806: specified by the variable.</p> 1.30 cvs 6807: 6808: <p>This allows the translation program to generate text in different files 6809: during the same run. These files do not need to be explicitely declared or 6810: opened. They do not need to be closed either, but if they contain temporary 6811: data, they can be removed (see the <a href="#sectc5220a"><tt>RemoveFile</tt> 6812: rule</a>). As soon as the translation program executes a <tt>Create</tt> rule 6813: for a file that is not yet open, it opens the file. These files are closed 6814: when the translation is finished.</p> 1.18 cvs 6815: <pre> 'Create' [ 'IN' VarID ] Object 1.1 cvs 6816: [ Position ] ';' 6817: Object = ConstID / CharString / 6818: BufferID / 6819: VarID / 1.30 cvs 6820: '(' Function < Function > ')' / 1.21 cvs 6821: [ 'Translated' ] AttrID / 1.1 cvs 6822: 'Value' / 6823: 'Content' / 6824: 'Attributes' / 6825: 'Presentation' / 6826: 'RefId' / 6827: 'PairId' / 6828: 'FileDir' / 6829: 'FileName' / 6830: 'Extension' / 6831: 'DocumentName' / 6832: 'DocumentDir' / 6833: [ 'Referred' ] ReferredObject . 6834: Position ='After' / 'Before' . 6835: 6836: ReferredObject = VarID / 6837: ElemID [ ExtStruct ] / 6838: 'RefId' / 6839: 'DocumentName' / 1.18 cvs 6840: 'DocumentDir' .</pre> 1.30 cvs 6841: 6842: <p>The object to be generated can be:</p> 1.18 cvs 6843: <ul> 1.30 cvs 6844: <li>a constant string, specified by its name if it is declared in the 6845: schema's <tt>CONST</tt> section, or given directly as a value between 6846: apostrophes;</li> 6847: <li>the contents of a buffer, designated by the name of the buffer;</li> 6848: <li>a variable, designated by its name if it is declared in the translation 1.37 cvs 6849: schema's <tt>VAR</tt> section, or given directly between parentheses. The 1.30 cvs 6850: text generated is the value of that variable evaluated for the element to 6851: which the rule applies.</li> 6852: <li>the value of an attribute, if the element being translated has this 6853: attribute. The attribute is specified by its name. If it's a text 6854: attribute, it can be preceded by the <code>Translated</code> keyword, 6855: which causes the attribute value to be recoded using the text translation 6856: table defined by section <code><a 6857: href="#sectc5225">TEXTTRANSLATE</a></code>;</li> 1.37 cvs 6858: <li>the value of a specific presentation rule. This object can only be 1.30 cvs 6859: generated if the translation rule is for a <a href="#prestransl">specific 1.37 cvs 6860: presentation rule</a>. It is specified by the <tt>Value</tt> keyword;</li> 6861: <li>the element's content. That is, the content of the leaves of the 6862: subtree of the translated element. This is specified by the 1.30 cvs 6863: <tt>Content</tt> keyword;</li> 6864: <li>the translation of all attributes of the element (which is primarily 6865: used to apply the attribute translation rules <a 1.37 cvs 6866: href="#sectc5222">before</a> those of the element type). This is 1.30 cvs 6867: specified by the <tt>Attributes</tt> keyword.</li> 6868: <li>the translation of all of the element's specific presentation rules 6869: (which is primarily used to apply the translation rules for the specific 1.37 cvs 6870: presentation rules <a href="#sectc5222">before</a> those of the element 6871: or its attributes). This option is specified by the <tt>Presentation</tt> 1.30 cvs 6872: keyword;</li> 1.37 cvs 6873: <li>The value of the reference's identifier.<br /> 6874: Thot associates a unique identifier with each element in a document. This 6875: identifier (called <em>reference's identifier</em> or <em>label</em>) is 6876: a character string containing the letter `L' followed by digits. Thot 6877: uses it in references for identifying the referred element.<br /> 1.30 cvs 6878: The <tt>RefId</tt> keyword produces the reference's identifier of the 6879: element to which the translation rule is applied, or the reference's 6880: identifier of its first ancestor that is referred by a reference or that 6881: can be referred by a reference.</li> 1.37 cvs 6882: <li>the value of a mark pair's unique identifier. This may only be used for 1.30 cvs 6883: <a href="#sectd3285">mark pairs</a> and is indicated by the 6884: <tt>PairId</tt> keyword.</li> 6885: <li>the directory containing the file being generated (this string includes 1.37 cvs 6886: an ending '/', if it is not empty). This is indicated by the 1.30 cvs 6887: <tt>FileDir</tt> keyword.</li> 6888: <li>the name of the file being generated (only the name, without the 6889: directory and without the extension). This is indicated by the 6890: <tt>FileName</tt> keyword.</li> 6891: <li>the extension of the file being generated (this string starts with a 1.37 cvs 6892: dot, if it is not empty). This is indicated by the <tt>Extension</tt> 1.30 cvs 6893: keyword.</li> 1.37 cvs 6894: <li>the name of the document being translated. This is indicated by the 1.30 cvs 6895: <tt>DocumentName</tt> keyword.</li> 1.37 cvs 6896: <li>the directory containing the document being translated. This is 1.30 cvs 6897: indicated by the <tt>DocumentDir</tt> keyword.</li> 1.18 cvs 6898: </ul> 1.30 cvs 6899: 1.37 cvs 6900: <p>When the rule applies to a reference (an element or an attribute defined 6901: as a reference in the structure schema), it can generate a text related to 6902: the element referred by that reference. The rule name is then followed by the 1.18 cvs 6903: <tt>Referred</tt> keyword and a specification of the object to be generated 1.37 cvs 6904: for the referred element. This specification can be:</p> 1.18 cvs 6905: <ul> 1.37 cvs 6906: <li>the name of a variable. The rule generates the value of that variable, 1.30 cvs 6907: computed for the referred element.</li> 1.37 cvs 6908: <li>an element type. The rule generates the translation of the element of 6909: that type, which is in the subtree of the referred element. If this 1.30 cvs 6910: element is not defined in the structure schema which corresponds to the 6911: translation schema (that is, an object defined in another schema), the 6912: element's type name must be followed by the name of its structure schema 6913: between parentheses.</li> 1.37 cvs 6914: <li>the <tt>RefId</tt> keyword. The rule generates the reference's 1.30 cvs 6915: identifier of the referred element.</li> 1.37 cvs 6916: <li>the <tt>DocumentName</tt> keyword. The rule generates the name of the 1.30 cvs 6917: document to which the referred element belongs.</li> 1.37 cvs 6918: <li>the <tt>DocumentDir</tt> keyword. The rule generates the name of the 1.30 cvs 6919: directory that contains the document of the referred element.</li> 1.18 cvs 6920: </ul> 6921: </div> 1.1 cvs 6922: 1.18 cvs 6923: <div class="subsection"> 1.37 cvs 6924: <h3><a name="sectc5211" id="sectc5211">The <tt>Write</tt> rule</a></h3> 1.1 cvs 6925: 1.37 cvs 6926: <p>The <tt>Write</tt> has the same syntax as the <tt>Create</tt> rule. It 1.30 cvs 6927: also produces the same effect, but the generated text is displayed on the 6928: user's terminal during the translation of the document, instead of being 1.37 cvs 6929: produced in the translated document. This is useful for helping the user keep 1.30 cvs 6930: track of the progress of the translation and for prompting the user on the 6931: terminal for input required by the <tt>Read</tt> rule.</p> 1.18 cvs 6932: <pre> 'Write' Object [ Position ] ';'</pre> 1.30 cvs 6933: 6934: <p>Notice: if the translator is launched by the editor (by the ``Save as'' 1.18 cvs 6935: command), messages produced by the <tt>Write</tt> rule are not displayed.</p> 1.30 cvs 6936: 1.18 cvs 6937: <blockquote class="example"> 1.30 cvs 6938: <p><strong>Example:</strong></p> 6939: 6940: <p>To make the translator display the number of each section being 6941: translated on the user's terminal, the following rule is specified for the 6942: <tt>Section</tt> element type:</p> 6943: <pre>Section : BEGIN 1.1 cvs 6944: Write VarSection; 6945: ... 1.18 cvs 6946: END;</pre> 1.30 cvs 6947: 6948: <p>(see <a href="#varsectexample">above</a> for the definition of the 6949: <tt>VarSection</tt> variable).</p> 6950: 6951: <p>To display text on the terminal before issuing a read operation with the 6952: <tt>Read</tt> rule, the following rule is used:</p> 6953: <pre>BEGIN 1.1 cvs 6954: Write 'Enter the name of the destination: '; 6955: ... 1.18 cvs 6956: END;</pre> 6957: </blockquote> 6958: </div> 6959: 6960: <div class="subsection"> 1.37 cvs 6961: <h3><a name="sectc5212" id="sectc5212">The <tt>Read</tt> rule</a></h3> 1.18 cvs 6962: 1.30 cvs 6963: <p>The <tt>Read</tt> rule reads text from the terminal during the translation 6964: of the document and saves the text read in one of the buffers declared in the 1.37 cvs 6965: <tt>BUFFERS</tt> section of the schema. The buffer to be used is indicated by 6966: its name, after the <tt>READ</tt> keyword. This name can be followed, as in 1.18 cvs 6967: the <tt>Create</tt> and <tt>Write</tt> rules, by a keyword indicating if the 6968: read operation must be performed <tt>Before</tt> or <tt>After</tt> the 1.37 cvs 6969: translation of the element's content. If this keyword is absent, the read 6970: operation is done beforehand. The text is read into the buffer and remains 1.5 cvs 6971: there until a rule using the same buffer - possibly the same rule - is 1.18 cvs 6972: applied.</p> 6973: <pre> 'Read' BufferID [ Position ] ';'</pre> 1.30 cvs 6974: 1.18 cvs 6975: <blockquote class="example"> 1.30 cvs 6976: <p><strong>Example:</strong></p> 6977: 6978: <p>The following set of rules tells the user that the translator is waiting 6979: for the entry of some text, reads this text into a buffer and copies the 6980: text into the translated document.</p> 6981: <pre>BEGIN 1.1 cvs 6982: Write 'Enter the name of the destination: '; 6983: Read DestName; 6984: Create DestName; 6985: ... 1.18 cvs 6986: END;</pre> 1.30 cvs 6987: 6988: <p>(see <a href="#destname">above</a> the definition of 6989: <tt>DestName</tt>).</p> 1.18 cvs 6990: </blockquote> 6991: </div> 6992: 6993: <div class="subsection"> 1.37 cvs 6994: <h3><a name="sectc5213" id="sectc5213">The <tt>Include</tt> rule</a></h3> 1.18 cvs 6995: 1.30 cvs 6996: <p>The <tt>Include</tt> rule, like the <tt>Create</tt> rule, is used to 1.37 cvs 6997: produce text in the translated document. It inserts constant text which is 6998: not defined in the translation schema, but is instead taken from a file. The 6999: file's name is specified after the <tt>Include</tt> keyword, either directly 7000: as a character string between apostrophes or as the name of one of the 7001: buffers declared in the <tt>BUFFERS</tt> section of the schema. In the latter 7002: case, the buffer is assumed to contain the file's name. This can be used when 7003: the included file's name is known only at the moment of translation. This 7004: only requires that the <tt>Include</tt> rule is preceded by a <tt>Read</tt> 7005: rule which puts the name of the file desired by the user into the buffer.</p> 1.30 cvs 7006: 7007: <p>Like the other rules, it is possible to specify whether the inclusion will 1.1 cvs 7008: occur before or after the element's content, with the default being before. 7009: The file inclusion is only done at the moment of translation, not during the 7010: compilation of the translation schema. Thus, the file to be included need not 7011: exist during the compilation, but it must be accessible at the time of 1.37 cvs 7012: translation. Its contents can also be modified between two translations, thus 1.1 cvs 7013: producing different results, even if neither the document or the translation 1.18 cvs 7014: schema are modified.</p> 1.30 cvs 7015: 7016: <p>During translation, the file to be included is searched for along the 7017: schema directory path (indicated by the environment variable 1.37 cvs 7018: <tt>THOTSCH</tt>). The file name is normally only composed of a simple name, 7019: without specification of a complete file path. However, if the filename 1.30 cvs 7020: starts with a '/', it is considered as an absolute path.</p> 1.18 cvs 7021: <pre> 'Include' File [ Position ] ';' 1.6 cvs 7022: File = FileName / BufferID . 1.18 cvs 7023: FileName = STRING .</pre> 1.30 cvs 7024: 1.18 cvs 7025: <blockquote class="example"> 1.30 cvs 7026: <p><strong>Example:</strong></p> 7027: 1.37 cvs 7028: <p>Suppose that it is desirable to print documents of the Article class 7029: with a formatter which requires a number of declarations and definitions at 7030: the beginning of the file. The <tt>Include</tt>rule can be used to achieve 1.30 cvs 7031: this. All the declarations and definitions a replaced in a file called 7032: <tt>DeclarArt</tt> and then the <tt>Article</tt> element type is given the 7033: following rule:</p> 7034: <pre>Article : BEGIN 1.1 cvs 7035: Include 'DeclarArt' Before; 7036: ... 1.18 cvs 7037: END;</pre> 7038: </blockquote> 7039: </div> 7040: 7041: <div class="subsection"> 1.37 cvs 7042: <h3><a name="sectc5214" id="sectc5214">The <tt>Get</tt> rule</a></h3> 1.18 cvs 7043: 1.30 cvs 7044: <p>The <tt>Get</tt> rule is used to change the order in which the elements 1.37 cvs 7045: appear in the translated document. More precisely, it produces the 1.30 cvs 7046: translation of a specified element before or after the translation of the 1.37 cvs 7047: content of the element to which the rule applies. The <tt>Before</tt> and 1.30 cvs 7048: <tt>After</tt> keywords are placed at the end of the rule to specify whether 7049: the operation should be performed before or after translation of the rule's 7050: element (the default is before). The type of the element to be moved must be 7051: specified after the <tt>Get</tt> keyword, optionally preceded by a keyword 7052: indicating where the element will be found in the logical structure of the 7053: document:</p> 1.18 cvs 7054: <dl> 1.30 cvs 7055: <dt><tt>Included</tt></dt> 7056: <dd>The element to be moved is the first element of the indicated type 7057: which is found inside the element to which the rule applies.</dd> 7058: <dt><tt>Referred</tt></dt> 7059: <dd>This keyword can only be used if the rule applies to a reference 1.37 cvs 7060: element. The element to be moved is either the element designated by 7061: the reference (if that element is of the specified type), or the first 1.30 cvs 7062: element of the desired type contained within the element designated by 7063: the reference.</dd> 7064: <dt>no keyword</dt> 1.37 cvs 7065: <dd><p>The translator takes the first element of the indicated type from 7066: among the siblings of the rule's element. This is primarily used to 7067: change the order of the components of an aggregate.</p> 1.30 cvs 7068: </dd> 1.18 cvs 7069: </dl> 1.30 cvs 7070: 7071: <p>If the element to be moved is defined in a structure schema which is not 7072: the one which corresponds to the translation schema (in the case of an 7073: included object with a different schema), the type name of this element must 7074: be followed, between parentheses, by the name of the structure schema which 1.18 cvs 7075: defines it.</p> 7076: <pre> 'Get' [ RelPosition ] ElemID 1.6 cvs 7077: [ ExtStruct ] 7078: [ Position ] ';' / 7079: RelPosition = 'Included' / 'Referred' . 1.18 cvs 7080: ExtStruct = '(' ElemID ')' .</pre> 1.30 cvs 7081: 7082: <p>The <tt>Get</tt> rule has no effect if the element which it is supposed to 1.37 cvs 7083: move has already been translated. Thus, the element will not be duplicated. 1.1 cvs 7084: It is generally best to associate the rule with the first element which will 1.37 cvs 7085: be encountered by the translator in its traversal of the document. Suppose an 1.18 cvs 7086: aggregate has two elements <tt>A</tt> and <tt>B</tt>, with <tt>A</tt> 1.37 cvs 7087: appearing first in the logical structure. To permute these two elements, a 1.18 cvs 7088: <tt>Get B before</tt> rule should be associated with the <tt>A</tt> element 1.37 cvs 7089: type, not the inverse. Similarly, a rule of the form <tt>Get Included X 1.18 cvs 7090: After</tt>, even though syntactically correct, makes no sense since, by the 1.1 cvs 7091: time it will be applied, after the translation of the contents of the element 1.18 cvs 7092: to which it is attached, the <tt>X</tt> element will already have been 7093: translated.</p> 7094: </div> 7095: 7096: <div class="subsection"> 1.37 cvs 7097: <h3><a name="sectc5215" id="sectc5215">The <tt>Copy</tt> rule</a></h3> 1.18 cvs 7098: 1.30 cvs 7099: <p>Like the <tt>Get</tt> rule, the <tt>Copy</tt> rule generates the 7100: translation of a specified element, but it acts even if the element has 7101: already been translated and it allows to copy it or to translate it later. 7102: Both rules have the same syntax.</p> 1.18 cvs 7103: <pre> 'Copy' [ RelPosition ] ElemID 7104: [ ExtStruct ] [ Position ] ';'</pre> 7105: </div> 7106: 7107: <div class="subsection"> 1.37 cvs 7108: <h3><a name="sectc5216" id="sectc5216">The <tt>Use</tt> rule</a></h3> 1.18 cvs 7109: 1.30 cvs 7110: <p>The <tt>Use</tt> rule specifies the translation schema to be applied to 1.37 cvs 7111: objects of a certain class that are part of the document. This rule only 1.1 cvs 7112: appears in the rules for the root element of the document (the first type 1.18 cvs 7113: defined after the <tt>STRUCT</tt> keyword in the structure schema) or the 1.1 cvs 7114: rules of an element defined by an external structure (by another structure 1.37 cvs 7115: schema). Also, the <tt>Use</tt> rule cannot be conditional.</p> 1.30 cvs 7116: 7117: <p>If the rule is applied to an element defined by an external structure, the 1.18 cvs 7118: <tt>Use</tt> keyword is simply followed by the name of the translation schema 1.37 cvs 7119: to be used for element constructed according to that external structure. If 1.1 cvs 7120: the rule is applied to the document's root element, it is formed by the 1.18 cvs 7121: <tt>Use</tt> keyword followed by the translation schema's name, the 7122: <tt>For</tt> keyword and the name of the external structure to which the 7123: indicated translation schema should be applied.</p> 7124: <pre> 'Use' TrSchema [ 'For' ElemID ] ';' 7125: TrSchema = NAME .</pre> 1.30 cvs 7126: 7127: <p>If no <tt>Use</tt> rule defines the translation schema to be used for an 1.1 cvs 7128: external structure which appears in a document, the translator asks the user, 7129: during the translation process, which schema should be used. Thus, it is not 1.18 cvs 7130: necessary to give the translation schema a <tt>Use</tt> rule for every 1.1 cvs 7131: external structure used, especially when the choice of translation schemas is 1.18 cvs 7132: to be left to the user.</p> 1.30 cvs 7133: 7134: <p>Notice: if the translator is launched by the editor (by the ``Save as'' 1.18 cvs 7135: command), prompts are not displayed.</p> 1.30 cvs 7136: 1.18 cvs 7137: <blockquote class="example"> 1.30 cvs 7138: <p><strong>Example:</strong></p> 7139: 7140: <p>The <tt>Article</tt> structure schema uses the <tt>Formula</tt> external 7141: structure, defined by another structure schema, for mathematical 7142: formulas:</p> 7143: <pre>STRUCTURE Article; 1.1 cvs 7144: ... 7145: STRUCT 7146: Article = ... 7147: ... 7148: Formula_in_text = Formula; 7149: Isolated_formula = Formula; 7150: ... 1.18 cvs 7151: END</pre> 1.30 cvs 7152: 7153: <p>Suppose that it would be useful to use the <tt>FormulaT</tt> translation 1.37 cvs 7154: schema for the formulas of an article. This can be expressed in two 1.30 cvs 7155: different ways in the <tt>Article</tt> class translation schema, using the 7156: rules:</p> 7157: <pre>RULES 1.1 cvs 7158: Article : 1.18 cvs 7159: Use FormulaT for Formula;</pre> 1.30 cvs 7160: 7161: <p>or:</p> 7162: <pre>RULES 1.1 cvs 7163: ... 7164: Formula : 1.18 cvs 7165: Use FormulaT;</pre> 7166: </blockquote> 7167: </div> 7168: 7169: <div class="subsection"> 1.37 cvs 7170: <h3><a name="sectc5217" id="sectc5217">The <tt>Remove</tt> rule</a></h3> 1.18 cvs 7171: 1.37 cvs 7172: <p>The <tt>Remove</tt> rule indicates that nothing should be generated, in 7173: the translated document, for the content of the element to which the rule 7174: applies. The content of that element is simply ignored by the translator. 7175: This does not prevent the generation of text for the element itself, using 7176: the <tt>Create</tt> or <tt>Include</tt> rules, for example.</p> 1.30 cvs 7177: 7178: <p>The <tt>Remove</tt> rule is simply written with the <tt>Remove</tt> 7179: keyword. It is terminated, like all rules, by a semicolon.</p> 1.18 cvs 7180: <pre> 'Remove' ';'</pre> 7181: </div> 7182: 7183: <div class="subsection"> 1.37 cvs 7184: <h3><a name="sectc5217a" id="sectc5217a">The <tt>Ignore</tt> rule</a></h3> 1.31 cvs 7185: 1.37 cvs 7186: <p>The <tt>Ignore</tt> rule indicates that nothing should be generated, in 7187: the translated document, for the element to which the rule applies. The whole 1.32 cvs 7188: element is simply ignored by the translator.</p> 1.31 cvs 7189: 7190: <p>The <tt>Ignore</tt> rule is simply written with the <tt>Ignore</tt> 7191: keyword. It is terminated, like all rules, by a semicolon.</p> 7192: <pre> 'Ignore' ';'</pre> 7193: </div> 7194: 7195: <div class="subsection"> 1.37 cvs 7196: <h3><a name="sectc5218" id="sectc5218">The <tt>NoTranslation</tt> 7197: rule</a></h3> 1.18 cvs 7198: 1.30 cvs 7199: <p>The <tt>NoTranslation</tt> rule indicates to the translator that it must 1.37 cvs 7200: not translate the content of the leaves of the element to which it applies. 7201: In contrast to the <tt>Remove</tt> rule, it does not suppress the content of 7202: the element, but it inhibits the translation of character strings, symbols, 7203: and graphical elements contained in the element. These are retrieved so that 1.18 cvs 7204: after the translation of the document, the rules of the <a 7205: href="#sectc5225"><tt>TEXTTRANSLATE</tt>, <tt>SYMBTRANSLATE</tt> and 7206: <tt>GRAPHTRANSLATE</tt> sections</a> will not be applied to them.</p> 1.30 cvs 7207: 7208: <p>The <tt>NoTranslation</tt> rule is written with the <tt>NoTranslation</tt> 1.18 cvs 7209: keyword followed by a semicolon.</p> 7210: <pre> 'NoTranslation' ';'</pre> 7211: </div> 7212: 7213: <div class="subsection"> 1.37 cvs 7214: <h3><a name="sectc5219" id="sectc5219">The <tt>NoLineBreak</tt> rule</a></h3> 1.18 cvs 7215: 1.30 cvs 7216: <p>The <tt>NoLineBreak</tt> rule indicates to the translator that it must not 1.1 cvs 7217: generate additional line breaks in the output produced for the element to 1.37 cvs 7218: which it applies. This is as if it was an <a href="#sectc522">instruction 1.18 cvs 7219: <tt>LINELENGTH 0;</tt></a> at the beginning of the translation schema, but 7220: only for the current element.</p> 1.30 cvs 7221: 7222: <p>The <tt>NoLineBreak</tt> rule is written with the <tt>NoLineBreak</tt> 7223: keyword followed by a semicolon.</p> 1.18 cvs 7224: <pre> 'NoLineBreak' ';'</pre> 7225: </div> 1.1 cvs 7226: 1.18 cvs 7227: <div class="subsection"> 1.37 cvs 7228: <h3><a name="sectc5220" id="sectc5220">The <tt>ChangeMainFile</tt> 7229: rule</a></h3> 1.1 cvs 7230: 1.30 cvs 7231: <p>When the translation program starts, it opens a main output file, whose 1.37 cvs 7232: name is given as a parameter of the translator. All <a 7233: href="#sectc5210"><tt>Create</tt> rules</a> without explicit indication of 7234: the output file write sequentially in this file. When a 7235: <tt>ChangeMainFile</tt> rule is executed, the main output file is closed and 7236: it is replaced by a new one, whose name is specified in the 7237: <tt>ChangeMainFile</tt> rule. The <tt>Create</tt> rules without indication of 7238: the output file that are then executed write in this new file. Several 7239: <tt>ChangeMainFile</tt> rules can be executed during the same translation, 7240: for dividing the main output into several files.</p> 1.30 cvs 7241: 7242: <p>This rule is written with the <tt>ChangeMainFile</tt> keyword followed by 7243: the name of a variable that specifies the name of the new main file. The 1.37 cvs 7244: keyword <tt>Before</tt> or <tt>After</tt> can be placed at the end of the 7245: rule to specify whether the operation should be performed before or after 7246: translation of the rule's element (the default is before). This rule, like 7247: all translation rules, is terminated by a semicolon.</p> 1.18 cvs 7248: <pre> 'ChangeMainFile' VarID [ Position ] ';'</pre> 1.30 cvs 7249: 1.18 cvs 7250: <blockquote class="example"> 1.30 cvs 7251: <p><strong>Example:</strong></p> 7252: 7253: <p>To generate the translation of each section in a different file, the 1.37 cvs 7254: following rule can be associated with type <tt>Section</tt>. That rule uses 1.30 cvs 7255: the <a href="#varoutputfile"><tt>VarOutpuFile</tt> variable</a> defined 7256: above.</p> 7257: <pre> Section: 1.18 cvs 7258: ChangeMainFile VarOutpuFile Before;</pre> 1.30 cvs 7259: 7260: <p>If <tt>output.txt</tt> is the name of the output file specified when 7261: starting the translation program, translated sections are written in files 7262: <tt>output1.txt</tt>, <tt>output2.txt</tt>, etc.</p> 1.18 cvs 7263: </blockquote> 7264: </div> 1.1 cvs 7265: 1.18 cvs 7266: <div class="subsection"> 1.37 cvs 7267: <h3><a name="sectc5220a" id="sectc5220a">The <tt>RemoveFile</tt> rule</a></h3> 1.14 cvs 7268: 1.37 cvs 7269: <p>Files may be used for storing temporary data that are no longer needed 7270: when the translation of a document is complete. These files may be removed by 7271: the <tt>RemoveFile</tt> rule.</p> 1.30 cvs 7272: 7273: <p>This rule is written with the <tt>RemoveFile</tt> keyword followed by the 1.37 cvs 7274: name of a variable that specifies the name of the file to be removed. The 7275: keyword <tt>Before</tt> or <tt>After</tt> can be placed at the end of the 7276: rule to specify whether the operation should be performed before or after 7277: translation of the rule's element (the default is before). This rule, like 1.30 cvs 7278: all translation rules, is terminated by a semicolon.</p> 1.18 cvs 7279: <pre> 'RemoveFile' VarID [ Position ] ';'</pre> 7280: </div> 7281: 7282: <div class="subsection"> 1.37 cvs 7283: <h3><a name="sectc5221" id="sectc5221">The <tt>Set</tt> and <tt>Add</tt> 7284: rules</a></h3> 1.18 cvs 7285: 1.37 cvs 7286: <p>The <tt>Set</tt> and <tt>Add</tt> rules are used for modifying the value 7287: of counters that have no <a href="#sectc524">counting function</a>. Only this 1.18 cvs 7288: type of counter can be used in the <tt>Set</tt> and <tt>Add</tt> rules.</p> 1.30 cvs 7289: 7290: <p>Both rules have the same syntax: after the keyword <tt>Set</tt> or 1.18 cvs 7291: <tt>Add</tt> appear the counter name and the value to assign to the counter 7292: (<tt>Set</tt> rule) or the value to be added to the counter (<tt>Add</tt> 1.37 cvs 7293: rule). The keyword <tt>Before</tt> or <tt>After</tt> can follow that value to 1.1 cvs 7294: indicate when the rule must be applied: before or after the element's content 1.37 cvs 7295: is translated. By default, <tt>Before</tt> is assumed. A semicolon terminates 1.18 cvs 7296: the rule.</p> 7297: <pre> 'Set' CounterID InitValue [ Position ] ';' / 7298: 'Add' CounterID Increment [ Position ] ';'</pre> 7299: </div> 7300: 7301: <div class="subsection"> 1.37 cvs 7302: <h3><a name="sectc5221a" id="sectc5221a">The <tt>Indent</tt> rule</a></h3> 1.18 cvs 7303: 1.37 cvs 7304: <p>The <tt>Indent</tt> rule is used to modify the value of text indentation 7305: in the output files.</p> 1.30 cvs 7306: 1.37 cvs 7307: <p>Each time the translator creates a new line in an output file, it 7308: generates a variable number of space characters at the beginning of the new 7309: line. By default, the number of these characters (the indentation value) is 7310: 0. It can be changed with the <tt>Indent</tt> rule.</p> 1.30 cvs 7311: 7312: <p>In its simple form, the rule begins with the <tt>Indent</tt> keyword, 1.25 cvs 7313: followed by the indentation sign (optional) and value and a keyword 1.30 cvs 7314: <tt>Before</tt> or <tt>After</tt> indicating that the indentation should be 7315: changed <a href="#sectc5222">before or after</a> the element's content is 1.37 cvs 7316: generated. If the position is not indicated, the indentation is changed 7317: before the element's content is generated. This rule, like all translation 1.25 cvs 7318: rules, is terminated by a semicolon.</p> 1.30 cvs 7319: 7320: <p>The indentation value is indicated by an integer, which is the number of 7321: space characters to be generated at the beginning of each new line. A sign 1.18 cvs 7322: (<tt>+</tt> or <tt>-</tt>) can appear before the integer to indicate that the 1.37 cvs 7323: value is relative: the current value of indentation is incremented (if sign 7324: is <tt>+</tt>) or decremented (if sign is <tt>-</tt>) by the specified 7325: value.</p> 1.30 cvs 7326: 7327: <p>Keyword <tt>Suspend</tt> or <tt>Resume</tt> can appear instead of the 1.37 cvs 7328: (possibly signed) identation value. <tt>Suspend</tt> means that the new 1.30 cvs 7329: indentation value to be used is zero until another <tt>Indent</tt> rule is 7330: executed and changes the indentation value. <tt>Resume</tt> means that the 7331: indentation value that was used before the last <tt>Indent Suspend</tt> was 1.37 cvs 7332: executed becomes the new value. Only one <tt>Suspend</tt> can be used before 1.30 cvs 7333: a <tt>Resume</tt>; <tt>Supend</tt>-<tt>Resume</tt> pairs can not be 7334: nested.</p> 7335: 1.37 cvs 7336: <p>Like the <a href="#sectc5210"><tt>Create</tt> rule</a>, the 7337: <tt>Indent</tt> keyword can be followed by the <tt>IN</tt> keyword and by the 7338: name of a <a href="#sectc526">variable</a>. This means that the rule must not 7339: change indentation in the main output file, but in the file whose name is 7340: specified by the variable (by default, indentation is changed in the main 7341: output file).</p> 1.25 cvs 7342: <pre> 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' . 1.10 cvs 7343: 1.25 cvs 7344: Indent = 'Suspend' / 'Resume' / [ IndentSign ] IndentValue . 1.10 cvs 7345: IndentSign = '+' / '-' . 1.18 cvs 7346: IndentValue = NUMBER .</pre> 7347: </div> 1.10 cvs 7348: 1.18 cvs 7349: <div class="subsection"> 1.37 cvs 7350: <h3><a name="sectc5222" id="sectc5222">Rule application order</a></h3> 1.1 cvs 7351: 1.30 cvs 7352: <p>The translator translates the elements which comprise the document in the 1.37 cvs 7353: order induced by the tree structure, except when the <tt>Get</tt> rule is 7354: used to change the order of translation. For each element, the translator 7355: first applies the rules specified for the element's type that must be applied 7356: before translation of the element's content (rules ending with the 7357: <tt>Before</tt> keyword or which have no position keyword). If several rules 7358: meet these criteria, the translator applies them in the order in where they 7359: appear in the translation schema.</p> 7360: 7361: <p>It then applies all <a href="#sectc5223">rules for the attributes</a> 7362: which the element has and which must be applied before the translation of the 7363: element's content (rules ending with the <tt>Before</tt> keyword or which 7364: have no position keyword). For one attribute value, the translator applies 7365: the rules in the order in which they are defined in the translation 7366: schema.</p> 1.30 cvs 7367: 7368: <p>The same procedure is followed with translation rules for specific 1.18 cvs 7369: presentations.</p> 1.30 cvs 7370: 1.31 cvs 7371: <p>Next, the element's content is translated, as long as a <tt>Remove</tt> or 7372: <code>Ignore</code> rule does not apply.</p> 1.30 cvs 7373: 7374: <p>In the next step, the translator applies rules for the specific 7375: presentation of the element that are to be applied after translation of the 1.37 cvs 7376: content (rules which end with the <tt>After</tt> keyword). The rules for each 1.30 cvs 7377: type of presentation rule or each value are applied in the order in which the 1.18 cvs 7378: translation appear in the schema.</p> 1.30 cvs 7379: 7380: <p>Then, the same procedure is followed for translation rules for attributes 7381: of the element.</p> 7382: 1.37 cvs 7383: <p>Finally, the translator applies rules for the element which must be 7384: applied after translation of the element's content. These rules are applied 7385: in the order that they appear in the translation schema. When the translation 7386: of an element is done, the translator procedes to translate the following 1.18 cvs 7387: element.</p> 1.30 cvs 7388: 7389: <p>This order can be changed with the <tt>Attributes</tt> and 1.18 cvs 7390: <tt>Presentation</tt> options of the <a href="#sectc5210"><tt>Create</tt> 7391: rule</a>.</p> 7392: </div> 1.1 cvs 7393: 1.18 cvs 7394: <div class="subsection"> 1.37 cvs 7395: <h3><a name="sectc5223" id="sectc5223">Translation of logical 7396: attributes</a></h3> 1.1 cvs 7397: 1.37 cvs 7398: <p>After the rules for the element types, the translation schema defines 7399: rules for attribute values. This section begins with the <tt>ATTRIBUTES</tt> 1.1 cvs 7400: keyword and is composed of a sequence of rule blocks each preceded by an 1.18 cvs 7401: attribute name and an optional value or value range.</p> 1.30 cvs 7402: 7403: <p>If the attribute's name appears alone before the rule block, the rule are 1.1 cvs 7404: applied to all element which have the attribute, no matter what value the 1.37 cvs 7405: attribute has. In this case, the attribute name is followed by a colon before 1.18 cvs 7406: the beginning of the rule block.</p> 1.30 cvs 7407: 1.37 cvs 7408: <p>The attribute's name can be followed by the name of an element type 7409: between parentheses. This says, as in presentation schemas, that the rule 7410: block which follows applies not to the element which has the attribute, but 7411: to its descendants of the type indicated between the parentheses.</p> 1.30 cvs 7412: 7413: <p>If values are given after the attribute name (or after the name of the 1.37 cvs 7414: element type), the rules are applied only when the attribute has the 7415: indicated values. The same attribute can appear several times, with different 7416: values and different translation rules. Attribute values are indicated in the 7417: same way as in <a href="#sectc528">conditions</a> and are followed by a colon 7418: before the block of rules.</p> 1.30 cvs 7419: 7420: <p>The rule block associated with an attribute is either a simple rule or a 1.18 cvs 7421: sequence of rules delimited by the <tt>BEGIN</tt> and <tt>END</tt> keywords. 7422: Note that rules associated with attribute values cannot be conditional.</p> 1.30 cvs 7423: 7424: <p>Translation rules are not required for all attributes (or their values) 1.37 cvs 7425: defined in a structure schema. Only those attributes for which a particular 7426: action must be performed by the translator must have such rules. The rules 1.18 cvs 7427: that can be used are those described above, from <a 7428: href="#sectc5210"><tt>Create</tt></a> to <a 7429: href="#sectc5218"><tt>NoTranslation</tt></a>.</p> 1.30 cvs 7430: <pre> AttrSeq = TransAttr < TransAttr > . 1.1 cvs 7431: TransAttr = AttrID [ '(' ElemID ')' ] 7432: [ RelatAttr ] ':' RuleSeq . 7433: AttrID = NAME . 1.18 cvs 7434: ElemID = NAME .</pre> 1.30 cvs 7435: 1.18 cvs 7436: <blockquote class="example"> 1.30 cvs 7437: <p><strong>Example:</strong></p> 7438: 7439: <p>The structure defined the ``Language'' attribute which can take the 1.37 cvs 7440: values ``French'' and ``English''. To have the French parts of the original 1.30 cvs 7441: document removed and prevent the translation of the leaves of the English 7442: parts, the following rules would be used:</p> 7443: <pre>ATTRIBUTES 1.1 cvs 7444: Language=French : 7445: Remove; 7446: Language=English : 1.18 cvs 7447: NoTranslation;</pre> 7448: </blockquote> 7449: </div> 1.1 cvs 7450: 1.18 cvs 7451: <div class="subsection"> 1.37 cvs 7452: <h3><a name="sectc5224" id="sectc5224">Translation of specific 7453: presentations</a></h3> 1.1 cvs 7454: 1.30 cvs 7455: <p>After the rules for attributes, the translation schema defines rules for 1.37 cvs 7456: the specific presentation. This section begins with the <tt>PRESENTATION</tt> 7457: keyword and is composed of a sequence of translation rule blocks each 7458: preceded by a presentation rule name, optionally accompanied by a part which 7459: depends on the particular presentation rule.</p> 1.30 cvs 7460: 7461: <p>Each of these translation rule blocks is applied when the translator 7462: operates on an element which has a specific presentation rule of the type 1.37 cvs 7463: indicated at the head of the block. Depending on the type of the specific 1.30 cvs 7464: presentation rule, it is possible to specify values of the presentation rule 7465: for which the translation rule block should be applied.</p> 7466: 7467: <p>There are three categories of the presentation rules:</p> 7468: <ul> 7469: <li>rules taking numeric values: <tt>Size</tt>, <tt>Indent</tt>, 7470: <tt>LineSpacing</tt>, <tt>LineWeight</tt>,</li> 7471: <li>rules whose values are taken from a predefined list (i.e. whose type is 1.36 cvs 7472: an enumeration): <tt>Adjust</tt>, <tt>Hyphenate,/TT>, <tt>Style</tt>, 7473: <tt>Weight</tt>, <tt>Font</tt>, <tt>UnderLine</tt>, <tt>Thickness</tt>, 7474: <tt>LineStyle</tt>,</tt></li> 1.30 cvs 7475: <li>rules whose value is a name: <tt>FillPattern</tt>, <tt>Background</tt>, 7476: <tt>Foreground</tt>.</li> 1.18 cvs 7477: </ul> 1.30 cvs 7478: 7479: <p>For presentation rules of the first category, the values which provoke 1.1 cvs 7480: application of the translation rules are indicated in the same manner as for 1.37 cvs 7481: <a href="#relattr">numeric attributes</a>. This can be either a unique value 7482: or range of values. For a unique value, the value (an integer) is simply 7483: preceded by an equals sign. Value ranges can be specified in one of three 1.18 cvs 7484: ways:</p> 7485: <ul> 1.30 cvs 7486: <li>all values less than a given value (this value is preceded by a ``less 7487: than'' sign '<tt><</tt>'),</li> 7488: <li>all values greater than a given value (this value is preceded by a` 7489: `greater than'' sign '<tt>></tt>'),</li> 1.37 cvs 7490: <li>all values falling in an interval, bounds included. The range of values 1.30 cvs 7491: is then specified <tt>IN [</tt>Minimum<tt>..</tt>Maximum<tt>]</tt>, where 7492: Minimum and Maximum are integers.</li> 1.18 cvs 7493: </ul> 1.30 cvs 7494: 7495: <p>All numeric values can be negative, in which case the integer is preceded 1.37 cvs 7496: by a minus sign. All values must be given in typographers points.</p> 1.30 cvs 7497: 7498: <p>For presentation rules whose values are taken from a predefined list, the 1.1 cvs 7499: value which provokes application of the translation rules is simply indicated 1.18 cvs 7500: by the equals sign followed by the name of the value.</p> 1.30 cvs 7501: 1.37 cvs 7502: <p>For presentation rules whose values are names, the value which provokes 7503: the application of translation rules is simply indicated by the equals sign 7504: followed by the name of the value. The names of the fill patterns (the 1.18 cvs 7505: <tt>FillPattern</tt> rule) and of the colors (the <tt>Foreground</tt> and 7506: <tt>Background</tt> rules) used in Thot are the same as in the P language.</p> 1.30 cvs 7507: <pre> PresSeq = PresTrans < PresTrans > . 1.1 cvs 7508: PresTrans = PresRule ':' RuleSeq . 7509: PresRule = 'Size' [ PresRelation ] / 7510: 'Indent' [ PresRelation ] / 7511: 'LineSpacing' [ PresRelation ] / 7512: 'Adjust' [ '=' AdjustVal ] / 7513: 'Hyphenate' [ '=' BoolVal ] / 7514: 'Style' [ '=' StyleVal ] / 1.24 cvs 7515: 'Weight' [ '=' WeightVal ] / 1.1 cvs 7516: 'Font' [ '=' FontVal ] / 7517: 'UnderLine' [ '=' UnderLineVal ] / 7518: 'Thickness' [ '=' ThicknessVal ] / 7519: 'LineStyle' [ '=' LineStyleVal ] / 7520: 'LineWeight' [ PresRelation ] / 7521: 'FillPattern' [ '=' Pattern ] / 7522: 'Background' [ '=' Color ] / 7523: 'Foreground' [ '=' Color ] . 7524: 7525: PresRelation = '=' PresValue / 1.30 cvs 7526: '>' [ '-' ] PresMinimum / 1.1 cvs 7527: '<' [ '-' ] PresMaximum / 7528: 'IN' '[' [ '-' ] PresIntervalMin '..' 7529: [ '-' ] PresIntervalMax ']' . 1.35 cvs 7530: AdjustVal = 'Left' / 'Right' / 'VMiddle' / 'Justify' / 1.1 cvs 7531: 'LeftWithDots' . 7532: BoolVal = 'Yes' / 'No' . 1.24 cvs 7533: StyleVal = 'Roman' / 'Italics' / 'Oblique' . 7534: WeightVal = 'Normal' / 'Bold' . 1.1 cvs 7535: FontVal = 'Times' / 'Helvetica' / 'Courier' . 7536: UnderLineVal = 'NoUnderline' / 'UnderLined' / 7537: 'OverLined' / 'CrossedOut' . 7538: ThicknessVal = 'Thick' / 'Thin' . 1.6 cvs 7539: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' . 1.1 cvs 7540: Pattern = NAME . 7541: Color = NAME . 7542: PresMinimum = NUMBER . 7543: PresMaximum = NUMBER . 7544: PresIntervalMin= NUMBER . 7545: PresIntervalMax= NUMBER . 7546: PresValue = [ '-' ] PresVal . 1.18 cvs 7547: PresVal = NUMBER .</pre> 1.30 cvs 7548: 1.37 cvs 7549: <p>The <a name="prestransl" id="prestransl">translation rules associated with 7550: specific presentation rules</a> can use the value of the specific 7551: presentation rule that causes them to be applied. This behavior is designated 7552: by the keyword <tt>Value</tt>. For numerically-valued presentation rules, the 7553: numeric value is produced. For other presentation rules, the name of the 7554: value is produced.</p> 1.30 cvs 7555: 7556: <p>It should be noted that modifications to the layout of the document's 7557: elements that are made using the combination of the control key and a mouse 7558: button will have no effect on the translation of the document.</p> 7559: 7560: <blockquote class="example"> 7561: <p><strong>Example:</strong></p> 7562: 7563: <p>Suppose that it is desirable to use the same font sizes as in the 7564: specific presentation, but the font size must be between 10 and 18 7565: typographer's points. If font size is set in the translated document by the 7566: string <tt>pointsize=n</tt> where <tt>n</tt> is the font size in 7567: typographer's points then the following rules will suffice:</p> 7568: <pre>PRESENTATION 1.1 cvs 7569: Size < 10 : 7570: Create 'pointsize=10'; 7571: Size in [10..18] : 7572: BEGIN 7573: Create 'pointsize='; 7574: Create Value; 7575: END; 1.30 cvs 7576: Size > 18 : 1.18 cvs 7577: Create 'pointsize=18';</pre> 7578: </blockquote> 7579: </div> 1.1 cvs 7580: 1.18 cvs 7581: <div class="subsection"> 1.37 cvs 7582: <h3><a name="sectc5225" id="sectc5225">Recoding of characters, symbols and 7583: graphics</a></h3> 1.1 cvs 7584: 1.37 cvs 7585: <p>The coding of characters, graphical elements and symbols as defined in 7586: Thot does not necessarily correspond to what is required by an application to 7587: which a Thot document must be exported. Because of this the translator can 7588: recode these terminal elements of the documents structure. The last sections 7589: of a translation schema are intended for this purpose, each specifying the 7590: recoding rules for one type of terminal element.</p> 1.30 cvs 7591: 1.37 cvs 7592: <p>The recoding rules for character strings are grouped by alphabets. There 7593: is a group of rules for each alphabet of the Thot document that must be 1.30 cvs 7594: translated. Each such group of rules begins with the <tt>TEXTTRANSLATE</tt> 7595: keyword, followed by the specification of the alphabet to translate and the 7596: recoding rules, between the <tt>BEGIN</tt> and <tt>END</tt> keywords unless 7597: there is only one recoding rule for the alphabet. The specification of the 7598: alphabet is not required: by default it is assumed to the Latin alphabet (the 7599: ISO Latin-1 character set).</p> 7600: 7601: <p>Each recoding rule is formed by a source string between apostrophes and a 1.1 cvs 7602: target string, also between apostrophes, the two strings being separated by 1.30 cvs 7603: the arrow symbol (<tt>-></tt>), formed by the ``minus'' and ``greater 1.37 cvs 7604: than'' characters. The rule is terminated by a semi-colon.</p> 1.18 cvs 7605: <pre> TextTransSeq = [ Alphabet ] TransSeq . 1.1 cvs 7606: Alphabet = NAME . 1.30 cvs 7607: TransSeq ='BEGIN' < Translation > 'END' ';' / 1.1 cvs 7608: Translation . 1.30 cvs 7609: Translation = Source [ '->' Target ] ';' . 1.1 cvs 7610: Source = STRING . 1.18 cvs 7611: Target = STRING .</pre> 1.30 cvs 7612: 7613: <p>One such rule signifies that when the source string appears in a text leaf 7614: of the document being translated, the translator must replace it, in the 1.37 cvs 7615: translated document, with the target string. The source string and the target 7616: string can have different lengths and the target string can be empty. In this 1.1 cvs 7617: last case, the translator simply suppresses every occurrence of the source 1.18 cvs 7618: string in the translated document.</p> 1.30 cvs 7619: 7620: <p>For a given alphabet, the order of the rules is not important and has no 1.1 cvs 7621: significance because the T language compiler reorders the rules in ways that 1.37 cvs 7622: speed up the translator's work. The total number of recoding rules is limited 1.18 cvs 7623: by the compiler as is the maximum length of the source and target strings.</p> 1.30 cvs 7624: 7625: <p>The recoding rules for symbols and graphical elements are written in the 1.37 cvs 7626: same manner as the recoding rules for character strings. They are preceded, 7627: respectively, by the <tt>SYMBTRANSLATE</tt> and <tt>GRAPHTRANSLATE</tt> and 7628: so not require a specification of the alphabet. Their source string is 7629: limited to one character, since, in Thot, each symbol and each graphical 7630: element is represented by a single character. The symbol and graphical 7631: element codes are defined along with the <a href="#sect7">non-standard 7632: character codes</a>.</p> 1.30 cvs 7633: 1.18 cvs 7634: <blockquote class="example"> 1.30 cvs 7635: <p><strong>Example:</strong></p> 7636: 7637: <p>In a translation schema producing documents destined for use with the 7638: L<sup>A</sup>T<sub><big>E</big></sub>X formatter, the Latin characters``é'' 1.37 cvs 7639: (octal code 351 in Thot) and ``č'' (octal code 350 in Thot) must be 1.30 cvs 7640: converted to their representation in 7641: L<sup>A</sup>T<sub><big>E</big></sub>X:</p> 7642: <pre>TEXTTRANSLATE Latin 1.1 cvs 7643: BEGIN 1.30 cvs 7644: '\350' -> '\`{e}'; { e grave } 7645: '\351' -> '\''{e}'; { e acute } 1.18 cvs 7646: END;</pre> 7647: </blockquote> 7648: </div> 7649: </div> 1.37 cvs 7650: <hr /> 1.18 cvs 7651: </div> 1.1 cvs 7652: 1.18 cvs 7653: <div class="chapter"> 1.37 cvs 7654: <h1><a name="sect6" id="sect6">Language grammars</a></h1> 1.1 cvs 7655: 1.30 cvs 7656: <p>This chapter gives the complete grammars of the languages of Thot. The 1.1 cvs 7657: grammars were presented and described in the preceding chapters, which also 1.37 cvs 7658: specify the semantics of the languages. This section gives only the 1.18 cvs 7659: syntax.</p> 1.1 cvs 7660: 1.18 cvs 7661: <div class="section"> 1.37 cvs 7662: <h2><a name="sectb61" id="sectb61">The M meta-language</a></h2> 1.1 cvs 7663: 1.30 cvs 7664: <p>The language grammars are all expressed in the same formalism, the M 1.18 cvs 7665: meta-language, which is defined in this section.</p> 7666: <pre>{ Any text between braces is a comment. } 1.30 cvs 7667: Grammar = Rule < Rule > 'END' . 7668: { The < and > signs indicate zero } 1.1 cvs 7669: { or more repetitions. } 7670: { END marks the end of the grammar. } 7671: Rule = Ident '=' RightPart '.' . 7672: { The period indicates the end of a rule } 7673: RightPart = RtTerminal / RtIntermed . 7674: { The slash indicates a choice } 7675: RtTerminal ='NAME' / 'STRING' / 'NUMBER' . 7676: { Right part of a terminal rule } 1.30 cvs 7677: RtIntermed = Possibility < '/' Possibility > . 1.1 cvs 7678: { Right part of an intermediate rule } 1.30 cvs 7679: Possibility = ElemOpt < ElemOpt > . 7680: ElemOpt = Element / '[' Element < Element > ']' / 7681: '<' Element < Element > '>' . 1.1 cvs 7682: { Brackets delimit optional parts } 7683: Element = Ident / KeyWord . 7684: Ident = NAME . 7685: { Identifier, sequence of characters 7686: KeyWord = STRING . 7687: { Character string delimited by apostrophes } 1.18 cvs 7688: END</pre> 7689: </div> 1.1 cvs 7690: 1.18 cvs 7691: <div class="section"> 1.37 cvs 7692: <h2><a name="sectb62" id="sectb62">The S language</a></h2> 1.1 cvs 7693: 1.30 cvs 7694: <p>The S language is used to write structure schemas, which contain the 1.37 cvs 7695: generic logical structures of document and object classes. It is described 1.30 cvs 7696: here in the M meta-language.</p> 1.18 cvs 7697: <pre>StructSchema = 'STRUCTURE' [ 'EXTENSION' ] ElemID ';' 1.1 cvs 7698: 'DEFPRES' PresID ';' 7699: [ 'ATTR' AttrSeq ] 7700: [ 'STRUCT' RulesSeq ] 7701: [ 'EXTENS' ExtensRuleSeq ] 7702: [ 'UNITS' RulesSeq ] 7703: [ 'EXPORT' SkeletonSeq ] 7704: [ 'EXCEPT' ExceptSeq ] 7705: 'END' . 7706: 7707: ElemID = NAME . 7708: PresID = NAME . 7709: 1.30 cvs 7710: AttrSeq = Attribute < Attribute > . 1.1 cvs 7711: Attribute = AttrID '=' AttrType ';' . 7712: AttrType = 'INTEGER' / 'TEXT' / 7713: 'REFERENCE' '(' RefType ')' / 7714: ValueSeq . 7715: RefType = 'ANY' / 7716: [ FirstSec ] ElemID [ ExtStruct ] . 1.30 cvs 7717: ValueSeq = AttrVal < ',' AttrVal > . 1.1 cvs 7718: AttrID = NAME . 7719: FirstSec = 'First' / 'Second' . 7720: ExtStruct = '(' ElemID ')' . 7721: AttrVal = NAME . 7722: 1.30 cvs 7723: RulesSeq = Rule < Rule > . 1.1 cvs 7724: Rule = ElemID [ LocAttrSeq ] '=' 7725: DefWithAttr ';' . 7726: LocAttrSeq = '(' 'ATTR' LocalAttr 1.30 cvs 7727: < ';' LocalAttr > ')' . 1.1 cvs 7728: LocalAttr = [ '!' ] AttrID [ '=' AttrType ] . 7729: DefWithAttr = Definition 7730: [ '+' '(' ExtensionSeq ')' ] 7731: [ '-' '(' RestrictSeq ')' ] 7732: [ 'WITH' FixedAttrSeq ] . 1.30 cvs 7733: ExtensionSeq = ExtensionElem < ',' ExtensionElem > . 1.1 cvs 7734: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' / 7735: 'SYMBOL' / 'PICTURE' . 1.30 cvs 7736: RestrictSeq = RestrictElem < ',' RestrictElem > . 1.1 cvs 7737: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' / 7738: 'SYMBOL' / 'PICTURE' . 1.30 cvs 7739: FixedAttrSeq = FixedAttr < ',' FixedAttr > . 1.1 cvs 7740: FixedAttr = AttrID [ FixedOrModifVal ] . 7741: FixedOrModifVal= [ '?' ] '=' FixedValue . 7742: FixedValue = [ '-' ] NumValue / TextValue / AttrVal . 7743: NumValue = NUMBER . 7744: TextValue = STRING . 7745: 7746: Definition = BaseType [ LocAttrSeq ] / Constr / 7747: Element . 7748: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 7749: 'PICTURE' / 'UNIT' / 'NATURE' . 7750: Element = ElemID [ ExtOrDef ] . 7751: ExtOrDef = 'EXTERN' / 'INCLUDED' / 7752: [ LocAttrSeq ] '=' Definition . 7753: 7754: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF' 7755: '(' DefWithAttr ')' / 7756: 'BEGIN' DefOptSeq 'END' / 7757: 'AGGREGATE' DefOptSeq 'END' / 7758: 'CASE' 'OF' DefSeq 'END' / 7759: 'REFERENCE' '(' RefType ')' / 7760: 'PAIR' . 7761: 7762: min = Integer / '*' . 7763: max = Integer / '*' . 7764: Integer = NUMBER . 7765: 1.30 cvs 7766: DefOptSeq = DefOpt ';' < DefOpt ';' > . 1.1 cvs 7767: DefOpt = [ '?' ] DefWithAttr . 7768: 1.30 cvs 7769: DefSeq = DefWithAttr ';' < DefWithAttr ';' > . 1.1 cvs 7770: 1.30 cvs 7771: SkeletonSeq = SkeletonElem < ',' SkeletonElem > ';' . 1.1 cvs 7772: SkeletonElem = ElemID [ 'WITH' Contents ] . 7773: Contents = 'Nothing' / ElemID [ ExtStruct ] . 7774: 1.30 cvs 7775: ExceptSeq = Except ';' < Except ';' > . 1.1 cvs 7776: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr ':' 7777: ExcValSeq . 7778: ExcTypeOrAttr = ElemID / AttrID . 1.30 cvs 7779: ExcValSeq = ExcValue < ',' ExcValue > . 1.1 cvs 7780: ExcValue = 'NoCut' / 'NoCreate' / 7781: 'NoHMove' / 'NoVMove' / 'NoMove' / 7782: 'NoHResize' / 'NoVResize' / 'NoResize' / 1.18 cvs 7783: 'MoveResize' / 1.1 cvs 7784: 'NewWidth' / 'NewHeight' / 7785: 'NewHPos' / 'NewVPos' / 7786: 'Invisible' / 'NoSelect' / 7787: 'Hidden' / 'ActiveRef' / 7788: 'ImportLine' / 'ImportParagraph' / 1.9 cvs 7789: 'NoPaginate' / 'ParagraphBreak' / 7790: 'HighlightChildren' / 'ExtendedSelection' / 1.36 cvs 7791: 'SelectParent' / 'ClickableSurface' / 1.29 cvs 7792: 'ReturnCreateNL' / 'ReturnCreateWithin' . 1.1 cvs 7793: 1.30 cvs 7794: ExtensRuleSeq = ExtensRule ';' < ExtensRule ';' > . 1.1 cvs 7795: ExtensRule = RootOrElem [ LocAttrSeq ] 7796: [ '+' '(' ExtensionSeq ')' ] 7797: [ '-' '(' RestrictSeq ')' ] 7798: [ 'WITH' FixedAttrSeq ] . 7799: RootOrElem = 'Root' / ElemID . 7800: 1.18 cvs 7801: END</pre> 7802: </div> 1.1 cvs 7803: 1.18 cvs 7804: <div class="section"> 1.37 cvs 7805: <h2><a name="sectb63" id="sectb63">The P language</a></h2> 1.1 cvs 7806: 1.30 cvs 7807: <p>The P language is used to write presentation schemas, which define the 1.1 cvs 7808: graphical presentation rules to be applied to different classes of documents 1.37 cvs 7809: and objects. It is described here in the M meta-language.</p> 1.18 cvs 7810: <pre>PresSchema = 'PRESENTATION' ElemID ';' 1.1 cvs 7811: [ 'VIEWS' ViewSeq ] 7812: [ 'PRINT' PrintViewSeq ] 7813: [ 'COUNTERS' CounterSeq ] 7814: [ 'CONST' ConstSeq ] 7815: [ 'VAR' VarSeq ] 7816: [ 'DEFAULT' ViewRuleSeq ] 7817: [ 'BOXES' BoxSeq ] 7818: [ 'RULES' PresentSeq ] 7819: [ 'ATTRIBUTES' PresAttrSeq ] 7820: [ 'TRANSMIT' TransmitSeq ] 7821: 'END' . 7822: 7823: ElemID = NAME . 7824: 7825: ViewSeq = ViewDeclaration 1.30 cvs 7826: < ',' ViewDeclaration > ';' . 1.1 cvs 7827: ViewDeclaration = ViewID [ 'EXPORT' ] . 7828: ViewID = NAME . 7829: 1.30 cvs 7830: PrintViewSeq = PrintView < ',' PrintView > ';' . 1.37 cvs 7831: PrintView = ViewID . 1.1 cvs 7832: 1.30 cvs 7833: CounterSeq = Counter < Counter > . 1.1 cvs 7834: Counter = CounterID ':' CounterFunc ';' . 7835: CounterID = NAME . 7836: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ] 7837: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] / 1.30 cvs 7838: SetFunction < SetFunction > 7839: AddFunction < AddFunction > 1.1 cvs 7840: [ 'INIT' AttrID ] / 1.16 cvs 7841: 'RLEVEL' 'OF' ElemID . 1.1 cvs 7842: SLevelAsc = [ '-' ] LevelAsc . 7843: LevelAsc = NUMBER . 7844: SetFunction = 'SET' CounterValue 'ON' TypeOrPage . 7845: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . 7846: TypeOrPage = 'Page' [ '(' ViewID ')' ] / 1.16 cvs 7847: [ '*' ] ElemID . 1.1 cvs 7848: CounterValue = NUMBER . 7849: 1.30 cvs 7850: ConstSeq = Const < Const > . 1.1 cvs 7851: Const = ConstID '=' ConstType ConstValue ';' . 7852: ConstID = NAME . 7853: ConstType = 'Text' [ Alphabet ] / 'Symbol' / 7854: 'Graphics' / 'Picture' . 7855: ConstValue = STRING . 7856: Alphabet = NAME . 7857: 1.30 cvs 7858: VarSeq = Variable < Variable > . 1.1 cvs 7859: Variable = VarID ':' FunctionSeq ';' . 7860: VarID = NAME . 1.30 cvs 7861: FunctionSeq = Function < Function > . 1.1 cvs 7862: Function = 'DATE' / 'FDATE' / 7863: 'DocName' / 'DirName' / 1.38 ! cvs 7864: 'ElemName' / 'AttributeName' / 'AttributeValue' / 1.1 cvs 7865: ConstID / ConstType ConstValue / 7866: AttrID / 7867: 'VALUE' '(' PageAttrCtr ',' 7868: CounterStyle ')' . 7869: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] / 7870: [ MinMax ] CounterID / AttrID . 7871: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' / 7872: 'Uppercase' / 'Lowercase' . 7873: MinMax = 'MaxRangeVal' / 'MinRangeVal' . 7874: 1.30 cvs 7875: BoxSeq = Box < Box > . 1.1 cvs 7876: Box = 'FORWARD' BoxID ';' / 7877: BoxID ':' ViewRuleSeq . 7878: BoxID = NAME . 7879: 1.30 cvs 7880: PresentSeq = Present < Present > . 1.1 cvs 7881: Present = [ '*' ] [ FirstSec ] ElemID ':' 7882: ViewRuleSeq . 7883: FirstSec = 'First' / 'Second' . 7884: 1.30 cvs 7885: PresAttrSeq = PresAttr < PresAttr > . 1.1 cvs 7886: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ] 7887: [ AttrRelation ] ':' ViewRuleSeq . 7888: AttrID = NAME . 7889: AttrRelation = '=' AttrVal / 1.30 cvs 7890: '>' [ '-' ] MinValue / 1.1 cvs 7891: '<' [ '-' ] MaxValue / 7892: 'IN' '[' [ '-' ] LowerBound '..' 7893: [ '-' ] UpperBound ']' / 7894: 'GREATER' AttrID / 7895: 'EQUAL' AttrID / 7896: 'LESS' AttrID . 7897: AttrVal = [ '-' ] EqualNum / EqualText / AttrValue . 7898: MinValue = NUMBER . 7899: MaxValue = NUMBER . 7900: LowerBound = NUMBER . 7901: UpperBound = NUMBER. 7902: EqualNum = NUMBER . 7903: EqualText = STRING . 7904: AttrValue = NAME . 7905: 1.30 cvs 7906: ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules > 1.1 cvs 7907: 'END' ';' / 7908: ViewRules / CondRules / Rule . 7909: RulesAndCond = CondRules / Rule . 7910: ViewRules = 'IN' ViewID CondRuleSeq . 1.30 cvs 7911: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' / 1.1 cvs 7912: CondRules / Rule . 1.30 cvs 7913: CondRules = CondRule < CondRule > 1.1 cvs 7914: [ 'Otherwise' RuleSeq ] . 7915: CondRule = 'IF' ConditionSeq RuleSeq . 1.30 cvs 7916: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / Rule . 1.1 cvs 7917: 1.30 cvs 7918: ConditionSeq = Condition < 'AND' Condition > . 1.6 cvs 7919: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem . 7920: ConditionElem = 'First' / 'Last' / 7921: [ 'Immediately' ] 'Within' [ NumParent ] 7922: ElemID [ ExtStruct ] / 7923: ElemID / 7924: 'Referred' / 'FirstRef' / 'LastRef' / 7925: 'ExternalRef' / 'InternalRef' / 'CopyRef' / 7926: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' / 7927: 'UserPage' / 'StartPage' / 'ComputedPage' / 1.33 cvs 7928: 'Empty' / 'Root' / 1.6 cvs 7929: '(' [ MinMax ] CounterName CounterCond ')' / 7930: CondPage '(' CounterID ')' . 7931: NumParent = [ GreaterLess ] NParent . 1.30 cvs 7932: GreaterLess = '>' / '<' . 1.6 cvs 7933: NParent = NUMBER. 1.30 cvs 7934: CounterCond = '<' MaxCtrVal / '>' MinCtrVal / 1.6 cvs 7935: '=' EqCtrVal / 7936: 'IN' '[' ['-'] MinCtrBound '..' 7937: ['-'] MaxCtrBound ']' . 7938: PageCond = 'Even' / 'Odd' / 'One' . 7939: MaxCtrVal = NUMBER . 7940: MinCtrVal = NUMBER . 7941: EqCtrVal = NUMBER . 7942: MaxCtrBound = NUMBER . 7943: MinCtrBound = NUMBER . 1.1 cvs 7944: 1.34 cvs 7945: Rule = Property ';' / PresFunc ';' . 7946: Property = 'VertRef' ':' HorizPosition / 1.1 cvs 7947: 'HorizRef' ':' VertPosition / 7948: 'VertPos' ':' VPos / 7949: 'HorizPos' ':' HPos / 7950: 'Height' ':' Extent / 7951: 'Width' ':' Extent / 7952: 'VertOverflow' ':' Boolean / 7953: 'HorizOverflow' ':' Boolean / 1.26 cvs 7954: 'MarginTop' ':' MarginWidth / 7955: 'MarginRight' ':' MarginWidth / 7956: 'MarginBottom' ':' MarginWidth / 7957: 'MarginLeft' ':' MarginWidth / 7958: 'PaddingTop' ':' PaddingWidth / 7959: 'PaddingRight' ':' PaddingWidth / 7960: 'PaddingBottom' ':' PaddingWidth / 7961: 'PaddingLeft' ':' PaddingWidth / 7962: 'BorderTopWidth' ':' BorderWidth / 7963: 'BorderRightWidth' ':' BorderWidth / 7964: 'BorderBottomWidth' ':' BorderWidth / 7965: 'BorderLeftWidth' ':' BorderWidth / 7966: 'BorderTopColor' ':' BorderColor / 7967: 'BorderRightColor' ':' BorderColor / 7968: 'BorderBottomColor' ':' BorderColor / 7969: 'BorderLeftColor' ':' BorderColor / 7970: 'BorderTopStyle' ':' BorderStyle / 7971: 'BorderRightStyle' ':' BorderStyle / 7972: 'BorderBottomStyle' ':' BorderStyle / 7973: 'BorderLeftStyle' ':' BorderStyle . 1.1 cvs 7974: 'LineSpacing' ':' DistOrInherit / 7975: 'Indent' ':' DistOrInherit / 7976: 'Adjust' ':' AlignOrInherit / 7977: 'Hyphenate' ':' BoolInherit / 7978: 'PageBreak' ':' Boolean / 7979: 'LineBreak' ':' Boolean / 7980: 'InLine' ':' Boolean / 7981: 'NoBreak1' ':' AbsDist / 7982: 'NoBreak2' ':' AbsDist / 7983: 'Gather' ':' Boolean / 7984: 'Visibility' ':' NumberInherit / 7985: 'Size' ':' SizeInherit / 7986: 'Font' ':' NameInherit / 7987: 'Style' ':' StyleInherit / 1.23 cvs 7988: 'Weight' ':' WeightInherit / 1.1 cvs 7989: 'Underline' ':' UnderLineInherit / 7990: 'Thickness' ':' ThicknessInherit / 7991: 'Depth' ':' NumberInherit / 7992: 'LineStyle' ':' LineStyleInherit / 7993: 'LineWeight' ':' DistOrInherit / 7994: 'FillPattern' ':' NameInherit / 1.30 cvs 7995: 'Background' ':' Color / 7996: 'Foreground' ':' Color / 1.1 cvs 7997: 'Content' ':' VarConst . 7998: PresFunc = Creation '(' BoxID ')' / 7999: 'Line' / 8000: 'NoLine' / 8001: 'Page' '(' BoxID ')' / 1.13 cvs 8002: 'Copy' '(' BoxTypeToCopy ')' / 8003: 'ShowBox' / 1.18 cvs 8004: 'BackgroundPicture' ':' FileName / 8005: 'PictureMode' ':' PictMode . 1.1 cvs 8006: 8007: BoxTypeToCopy = BoxID [ ExtStruct ] / 8008: ElemID [ ExtStruct ] . 8009: ExtStruct = '(' ElemID ')' . 8010: 8011: Distance = [ Sign ] AbsDist . 8012: Sign = '+' / '-' . 8013: AbsDist = IntegerOrAttr [ '.' DecimalPart ] 8014: [ Unit ] . 8015: IntegerOrAttr = IntegerPart / AttrID . 8016: IntegerPart = NUMBER . 8017: DecimalPart = NUMBER . 8018: Unit = 'em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' / 8019: 'pc' / 'px' / '%' . 8020: 8021: HPos = 'nil' / VertAxis '=' HorizPosition 8022: [ 'UserSpecified' ] . 8023: VPos = 'nil' / HorizAxis '=' VertPosition 8024: [ 'UserSpecified' ] . 8025: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' . 8026: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' . 8027: 1.6 cvs 8028: VertPosition = Reference '.' HorizAxis [ Distance ] . 8029: HorizPosition = Reference '.' VertAxis [ Distance ] . 8030: Reference = 'Enclosing' [ BoxTypeNot ] / 8031: 'Enclosed' [ BoxTypeNot ] / 8032: 'Previous' [ BoxTypeNot ] / 8033: 'Next' [ BoxTypeNot ] / 8034: 'Referred' [ BoxTypeNot ] / 8035: 'Creator' / 8036: 'Root' / 8037: '*' / 8038: BoxOrType . 8039: BoxOrType = BoxID / 8040: [ '*' ] [ FirstSec ] ElemID / 1.17 cvs 8041: 'AnyElem' / 'AnyBox' / 8042: 'ElemWithAttr' AttrID . 1.6 cvs 8043: BoxTypeNot = [ 'NOT' ] BoxOrType . 8044: 8045: Extent = Reference '.' HeightWidth 8046: [ Relation ] [ 'Min' ] / 8047: AbsDist [ 'UserSpecified' ] [ 'Min' ] / 8048: HPos / VPos . 8049: HeightWidth = 'Height' / 'Width' . 8050: Relation = '*' ExtentAttr '%' / Distance . 8051: ExtentAttr = ExtentVal / AttrID . 8052: ExtentVal = NUMBER . 1.26 cvs 8053: 8054: MarginWidth = InheritParent / 'Auto' / Distance . 8055: PaddingWidth = InheritParent / Distance . 8056: BorderWidth = InheritParent / 'Thin' / 'Medium' / 'Thick' / Distance . 8057: BorderColor = InheritParent / 'Transparent' / 'Foreground' / 8058: ColorName . 8059: BorderStyle = InheritParent / 8060: 'None' / 'Hidden' / 'Dotted' / 'Dashed' / 'Solid' / 8061: 'Double' / 'Groove' / 'Ridge' / 'Inset' / 'Outset' . 1.27 cvs 8062: InheritParent = 'Enclosing' '=' / 'Creator' '=' . 1.26 cvs 8063: ColorName = NAME . 1.6 cvs 8064: 8065: Inheritance = Kinship InheritedValue . 8066: Kinship = 'Enclosing' / 'GrandFather'/ 'Enclosed' / 8067: 'Previous' / 'Creator' . 8068: InheritedValue = '+' PosIntAttr [ 'Max' maximumA ] / 8069: '-' NegIntAttr [ 'Min' minimumA ] / 8070: '=' . 8071: PosIntAttr = PosInt / AttrID . 8072: PosInt = NUMBER . 8073: NegIntAttr = NegInt / AttrID . 8074: NegInt = NUMBER . 8075: maximumA = maximum / AttrID . 8076: maximum = NUMBER . 8077: minimumA = minimum / AttrID . 8078: minimum = NUMBER . 8079: 8080: AlignOrInherit = Kinship '=' / Alignment . 8081: Alignment = 'Left' / 'Right' / 'VMiddle' / 8082: 'LeftWithDots' . 1.1 cvs 8083: 1.6 cvs 8084: DistOrInherit = Kinship InheritedDist / Distance . 8085: InheritedDist = '=' / '+' AbsDist / '-' AbsDist . 1.1 cvs 8086: 1.6 cvs 8087: BoolInherit = Boolean / Kinship '=' . 8088: Boolean = 'Yes' / 'No' . 1.1 cvs 8089: 1.6 cvs 8090: NumberInherit = Integer / AttrID / Inheritance . 8091: Integer = NUMBER . 1.1 cvs 8092: 8093: LineStyleInherit= Kinship '=' / 'Solid' / 'Dashed' / 8094: 'Dotted' . 8095: 1.6 cvs 8096: SizeInherit = SizeAttr [ 'pt' ] / Kinship InheritedSize . 8097: InheritedSize = '+' SizeAttr [ 'pt' ] 8098: [ 'Max' MaxSizeAttr ] / 8099: '-' SizeAttr [ 'pt' ] 8100: [ 'Min' MinSizeAttr ] / 1.22 cvs 8101: '*' PercentSizeAttr '%' / 1.6 cvs 8102: '=' . 8103: SizeAttr = Size / AttrID . 8104: Size = NUMBER . 8105: MaxSizeAttr = MaxSize / AttrID . 8106: MaxSize = NUMBER . 8107: MinSizeAttr = MinSize / AttrID . 8108: MinSize = NUMBER . 1.22 cvs 8109: PercentSizeAttr = PercentSize / AttrID . 8110: PercentSize = NUMBER . 1.6 cvs 8111: 8112: NameInherit = Kinship '=' / FontName . 8113: FontName = NAME . 1.30 cvs 8114: Color = 'Transparent' / Kinship '=' / FontName . 1.6 cvs 8115: StyleInherit = Kinship '=' / 1.23 cvs 8116: 'Roman' / 'Italics' / 'Oblique' . 8117: WeightInherit = Kinship '=' / 8118: 'Normal' / 'Bold' . 1.1 cvs 8119: UnderLineInherit= Kinship '=' / 1.6 cvs 8120: 'NoUnderline' / 'Underlined' / 8121: 'Overlined' / 'CrossedOut' . 1.1 cvs 8122: ThicknessInherit= Kinship '=' / 'Thick' / 'Thin' . 1.13 cvs 8123: 8124: FileName = STRING . 8125: PictMode = 'NormalSize' / 'Scale' / 8126: 'RepeatXY' / 'RepeatX' / 'RepeatY' . 1.1 cvs 8127: 1.6 cvs 8128: VarConst = ConstID / ConstType ConstValue / 8129: VarID / '(' FunctionSeq ')' / 8130: ElemID . 8131: 8132: Creation = Create [ 'Repeated' ] . 8133: Create = 'CreateFirst' / 'CreateLast' / 8134: 'CreateBefore' / 'CreateAfter' / 8135: 'CreateEnclosing' . 8136: 1.30 cvs 8137: TransmitSeq = Transmit < Transmit > . 1.6 cvs 8138: Transmit = TypeOrCounter 'To' ExternAttr 8139: '(' ElemID ')' ';' . 8140: TypeOrCounter = CounterID / ElemID . 8141: ExternAttr = NAME . 1.1 cvs 8142: 1.18 cvs 8143: END</pre> 8144: </div> 1.1 cvs 8145: 1.18 cvs 8146: <div class="section"> 1.37 cvs 8147: <h2><a name="sectb64" id="sectb64">The T language</a></h2> 1.18 cvs 8148: <pre>TransSchema = 'TRANSLATION' ElemID ';' 1.1 cvs 8149: [ 'LINELENGTH' LineLength ';' ] 8150: [ 'LINEEND' CHARACTER ';' ] 8151: [ 'LINEENDINSERT' STRING ';' ] 8152: [ 'BUFFERS' BufferSeq ] 8153: [ 'COUNTERS' CounterSeq ] 8154: [ 'CONST' ConstSeq ] 8155: [ 'VAR' VariableSeq ] 8156: 'RULES' ElemSeq 8157: [ 'ATTRIBUTES' AttrSeq ] 8158: [ 'PRESENTATION' PresSeq ] 1.30 cvs 8159: < 'TEXTTRANSLATE' TextTransSeq > 1.1 cvs 8160: [ 'SYMBTRANSLATE' TransSeq ] 8161: [ 'GRAPHTRANSLATE' TransSeq ] 8162: 'END' . 8163: 8164: LineLength = NUMBER . 8165: 1.30 cvs 8166: BufferSeq = Buffer < Buffer > . 1.1 cvs 8167: Buffer = BufferID [ '(' 'Picture' ')' ] ';' . 8168: BufferID = NAME . 8169: 1.30 cvs 8170: CounterSeq = Counter < Counter > . 1.1 cvs 8171: Counter = CounterID [ ':' CounterFunc ] ';' . 8172: CounterID = NAME . 8173: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ] 8174: [ 'Init' AttrID ] / 8175: 'Rlevel' 'of' ElemID / 8176: 'Set' InitValue 'On' ElemID 8177: 'Add' Increment 'On' ElemID 8178: [ 'Init' AttrID ] . 8179: SLevelAsc = [ '-' ] LevelAsc . 8180: LevelAsc = NUMBER . 8181: InitValue = NUMBER . 8182: Increment = NUMBER . 8183: ElemID = NAME . 8184: AttrID = NAME . 8185: 1.30 cvs 8186: ConstSeq = Const < Const > . 1.1 cvs 8187: Const = ConstID '=' ConstValue ';' . 8188: ConstID = NAME . 8189: ConstValue = STRING . 8190: 1.30 cvs 8191: VariableSeq = Variable < Variable > . 8192: Variable = VarID ':' Function < Function > ';' . 1.1 cvs 8193: VarID = NAME . 8194: Function = 'Value' '(' CounterID [ ':' Length ] 8195: [ ',' CounterStyle ] ')' / 8196: 'FileDir' / 'FileName' / 'Extension' / 8197: 'DocumentName' / 'DocumentDir' / 8198: ConstID / CharString / 8199: BufferID / AttrID . 8200: Length = NUMBER . 8201: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' / 8202: 'Uppercase' / 'Lowercase' . 8203: CharString = STRING . 8204: 1.30 cvs 8205: ElemSeq = TransType < TransType > . 1.1 cvs 8206: TransType = [ FirstSec ] ElemID ':' RuleSeq . 8207: FirstSec = 'First' / 'Second' . 1.30 cvs 8208: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' . 1.1 cvs 8209: Rule = SimpleRule / ConditionBlock . 8210: ConditionBlock= 'IF' ConditionSeq SimpleRuleSeq . 1.30 cvs 8211: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' / 1.1 cvs 8212: SimpleRule . 8213: 8214: ConditionSeq = Condition [ 'AND' Condition ] . 8215: Condition = [ 'NOT' ] [ 'Target' ] Cond . 8216: Cond = CondElem / CondAscend . 8217: CondElem = 'FirstRef' / 'LastRef' / 8218: 'ExternalRef' / 8219: 'Alphabet' '=' Alphabet / 8220: 'ComputedPage' / 'StartPage' / 8221: 'UserPage' / 'ReminderPage' / 8222: 'Empty' / 1.18 cvs 8223: ElemID / 1.1 cvs 8224: 'FirstAttr' / 'LastAttr' . 8225: CondAscend = [ Ascend ] CondOnAscend . 8226: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType . 8227: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] . 8228: CondRelLevel = NUMBER . 8229: CondOnAscend = 'First' / 'Last' / 8230: 'Referred' / 8231: [ 'Immediately' ] 'Within' [ NumParent ] 8232: ElemID [ ExtStruct ] / 8233: 'Attributes' / 8234: AttrID [ RelatAttr ] / 8235: 'Presentation' / 1.34 cvs 8236: PresRule . 1.1 cvs 8237: NumParent = [ GreaterLess ] NParent . 1.30 cvs 8238: GreaterLess = '>' / '<' . 1.1 cvs 8239: NParent = NUMBER. 8240: Alphabet = NAME . 8241: RelatAttr = '=' Value / 1.30 cvs 8242: '>' [ '-' ] Minimum / 1.1 cvs 8243: '<' [ '-' ] Maximum / 8244: 'IN' '[' [ '-' ] MinInterval '..' 8245: [ '-' ] MaxInterval ']' . 8246: Value = [ '-' ] IntegerVal / TextVal / AttrValue . 8247: Minimum = NUMBER . 8248: Maximum = NUMBER . 8249: MinInterval = NUMBER . 8250: MaxInterval = NUMBER . 8251: IntegerVal = NUMBER . 8252: TextVal = STRING . 8253: AttrValue = NAME . 8254: 8255: SimpleRule = 'Create' [ 'IN' VarID ] Object 8256: [ Position ] ';' / 8257: 'Write' Object [ Position ] ';' / 8258: 'Read' BufferID [ Position ] ';' / 8259: 'Include' File [ Position ] ';' / 1.6 cvs 8260: 'Get' [ RelPosition ] ElemID 8261: [ ExtStruct ] 8262: [ Position ] ';' / 1.1 cvs 8263: 'Copy' [ RelPosition ] ElemID 8264: [ ExtStruct ] 8265: [ Position ] ';' / 8266: 'Use' TrSchema [ 'For' ElemID ] ';' / 8267: 'Remove' ';' / 1.31 cvs 8268: 'Ignore' ';' / 1.1 cvs 8269: 'NoTranslation' ';' / 8270: 'NoLineBreak' ';' / 8271: 'ChangeMainFile' VarID [ Position ] ';' / 1.14 cvs 8272: 'RemoveFile' VarID [ Position ] ';' / 1.10 cvs 8273: 'Set' CounterID InitValue [ Position ] ';' / 8274: 'Add' CounterID Increment [ Position ] ';' / 1.25 cvs 8275: 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' . 1.10 cvs 8276: 1.25 cvs 8277: Indent = 'Suspend' / 'Resume' / [ IndentSign ] IndentValue . 1.10 cvs 8278: IndentSign = '+' / '-' . 8279: IndentValue = NUMBER . 1.1 cvs 8280: 8281: Object = ConstID / CharString / 8282: BufferID / 8283: VarID / 1.30 cvs 8284: '(' Function < Function > ')' / 1.21 cvs 8285: [ 'Translated' ] AttrID / 1.1 cvs 8286: 'Value' / 8287: 'Content' / 8288: 'Attributes' / 8289: 'Presentation' / 8290: 'RefId' / 8291: 'PairId' / 8292: 'FileDir' / 'FileName' / 'Extension' / 8293: 'DocumentName' / 'DocumentDir' / 8294: [ 'Referred' ] ReferredObject . 8295: Position = 'After' / 'Before' . 8296: 1.6 cvs 8297: ReferredObject= VarID / 8298: ElemID [ ExtStruct ] / 8299: 'RefId' / 8300: 'DocumentName' / 'DocumentDir' . 1.1 cvs 8301: 1.6 cvs 8302: File = FileName / BufferID . 8303: FileName = STRING . 1.1 cvs 8304: 1.6 cvs 8305: RelPosition = 'Included' / 'Referred' . 8306: ExtStruct = '(' ElemID ')' . 1.1 cvs 8307: 1.6 cvs 8308: TrSchema = NAME . 8309: 1.30 cvs 8310: AttrSeq = TransAttr < TransAttr > . 1.6 cvs 8311: TransAttr = AttrID [ '(' ElemID ')' ] 8312: [ RelatAttr ] ':' RuleSeq . 8313: 1.30 cvs 8314: PresSeq = PresTrans < PresTrans > . 1.6 cvs 8315: PresTrans = PresRule ':' RuleSeq . 8316: PresRule = 'Size' [ PresRelation ] / 8317: 'Indent' [ PresRelation ] / 8318: 'LineSpacing' [ PresRelation ] / 8319: 'Adjust' [ '=' AdjustVal ] / 8320: 'Hyphenate' [ '=' BoolVal ] / 8321: 'Style' [ '=' StyleVal ] / 1.24 cvs 8322: 'Weight' [ '=' WeightVal ] / 1.6 cvs 8323: 'Font' [ '=' FontVal ] / 8324: 'UnderLine' [ '=' UnderLineVal ] / 8325: 'Thickness' [ '=' ThicknessVal ] / 8326: 'LineStyle' [ '=' LineStyleVal ] / 8327: 'LineWeight' [ PresRelation ] / 8328: 'FillPattern' [ '=' Pattern ] / 8329: 'Background' [ '=' Color ] / 8330: 'Foreground' [ '=' Color ] . 8331: 8332: PresRelation = '=' PresValue / 1.30 cvs 8333: '>' [ '-' ] PresMinimum / 1.6 cvs 8334: '<' [ '-' ] PresMaximum / 8335: 'IN' '[' [ '-' ] PresIntervalMin '..' 8336: [ '-' ] PresIntervalMax ']' . 1.35 cvs 8337: AdjustVal = 'Left' / 'Right' / 'VMiddle' / 'Justify' / 1.6 cvs 8338: 'LeftWithDots' . 8339: BoolVal = 'Yes' / 'No' . 1.24 cvs 8340: StyleVal = 'Roman' / 'Italics' / 'Oblique' . 8341: WeightVal = 'Normal' / 'Bold' . 1.6 cvs 8342: FontVal = 'Times' / 'Helvetica' / 'Courier' . 8343: UnderLineVal = 'NoUnderline' / 'UnderLined' / 8344: 'OverLined' / 'CrossedOut' . 8345: ThicknessVal = 'Thick' / 'Thin' . 8346: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' . 8347: Pattern = NAME . 8348: Color = NAME . 8349: PresMinimum = NUMBER . 8350: PresMaximum = NUMBER . 1.1 cvs 8351: PresIntervalMin= NUMBER . 8352: PresIntervalMax= NUMBER . 1.6 cvs 8353: PresValue = [ '-' ] PresVal . 8354: PresVal = NUMBER . 1.1 cvs 8355: 1.6 cvs 8356: TextTransSeq = [ Alphabet ] TransSeq . 8357: Alphabet = NAME . 1.30 cvs 8358: TransSeq = 'BEGIN' < Translation > 'END' ';' / 1.6 cvs 8359: Translation . 1.30 cvs 8360: Translation = Source [ '->' Target ] ';' . 1.6 cvs 8361: Source = STRING . 1.18 cvs 8362: Target = STRING .</pre> 8363: </div> 1.37 cvs 8364: <hr /> 1.18 cvs 8365: </div> 1.1 cvs 8366: 1.18 cvs 8367: <div class="chapter"> 1.37 cvs 8368: <h1><a name="sect7" id="sect7">Character coding</a></h1> 1.1 cvs 8369: 1.18 cvs 8370: <div class="section"> 1.37 cvs 8371: <h2><a name="sectb71" id="sectb71">Characters</a></h2> 1.1 cvs 8372: 1.37 cvs 8373: <p>The characters of the Latin alphabet follow the encoding defined in the 8374: ISO 8859-1 (ISO Latin-1) standard. The characters of the Greek alphabet 8375: follow the encoding defined by Adobe for its Symbol font (Adobe 8376: FontSpecific).</p> 8377: 8378: <p>Characters whose octal code is greater than 0200 are written in the form 8379: of their octal code preceded by a backslash character (``\''). For example, 8380: the French word 'Résumé' is written <tt>R\351sum\351</tt>.</p> 1.30 cvs 8381: 8382: <p>To the ISO 8859-1 encoding four characters with the following codes have 1.37 cvs 8383: been added:<br /> 8384: <tt>212</tt>: line break<br /> 8385: <tt>240</tt>: sticky space<br /> 8386: <tt>201</tt>: thin space<br /> 1.18 cvs 8387: <tt>202</tt>: en space</p> 1.30 cvs 8388: 8389: <p>The <tt>212</tt> character is a ``line break'' character which forces a 1.37 cvs 8390: line break. The <tt>240</tt> character is a ``sticky space'', which cannot be 1.18 cvs 8391: replaced by a line break.</p> 8392: </div> 1.1 cvs 8393: 1.18 cvs 8394: <div class="section"> 1.37 cvs 8395: <h2><a name="sectb72" id="sectb72">Symbols</a></h2> 1.1 cvs 8396: 1.37 cvs 8397: <p>The table below gives the codes for the symbols of Thot. Symbols can be 8398: used in presentation schemas constants and in transcoding rules of 8399: translation schemas. Each symbol is represented by a single character.</p> 1.18 cvs 8400: <ul> 1.30 cvs 8401: <li><tt>r</tt>: a radical</li> 8402: <li><tt>i</tt>: a simple integral</li> 8403: <li><tt>c</tt>: a curvilinear integral</li> 8404: <li><tt>d</tt>: a double integral</li> 8405: <li><tt>t</tt>: a triple integral</li> 8406: <li><tt>S</tt>: the summation symbol</li> 8407: <li><tt>P</tt>: the product symbol</li> 8408: <li><tt>U</tt>: the union symbol</li> 8409: <li><tt>I</tt>: the intersection symbol</li> 8410: <li><tt>></tt>: a right arrow</li> 8411: <li><tt><</tt>: a left arrow</li> 1.37 cvs 8412: <li><tt>^</tt>: an up arrow</li> 1.30 cvs 8413: <li><tt>V</tt>: a down arrow</li> 8414: <li><tt>(</tt>: an opening parenthesis</li> 8415: <li><tt>)</tt>: a closing parenthesis</li> 8416: <li><tt>{</tt>: an opening brace</li> 8417: <li><tt>}</tt>: a closing brace</li> 8418: <li><tt>[</tt>: an opening bracket</li> 8419: <li><tt>]</tt>: a closing bracket</li> 1.18 cvs 8420: </ul> 8421: </div> 1.1 cvs 8422: 1.18 cvs 8423: <div class="section"> 1.37 cvs 8424: <h2><a name="sectb73" id="sectb73">Graphical elements</a></h2> 1.1 cvs 8425: 1.30 cvs 8426: <p>The table below gives the codes for the graphical elements of Thot. These 1.1 cvs 8427: elements can be used in presentation schemas constants and in transcoding 1.37 cvs 8428: rules of translation schemas. Each graphical element is represented by a 1.18 cvs 8429: single character.</p> 8430: <ul> 1.30 cvs 8431: <li>a: a circle</li> 8432: <li><p><tt>A</tt>: an open curve with an arrow head at the end</p> 8433: </li> 8434: <li><tt>b</tt>: a horizontal line along the lower side of the box</li> 8435: <li><tt>B</tt>: an open curve</li> 8436: <li><tt>c</tt>: an ellipse inscribed in the box</li> 8437: <li><tt>C</tt>: a rectangle with rounded corners</li> 8438: <li><tt>D</tt>: an open curve with two arrow heads</li> 8439: <li><tt>e</tt>: The northwest/southeast diagonal of the box with an 8440: arrowhead at the bottom</li> 8441: <li><tt>E</tt>: The southwest/northeast diagonal of the box with an 8442: arrowhead at the top</li> 8443: <li><tt>F</tt>: an open curve with an arrow head at start</li> 8444: <li><tt>g</tt>: a line from the origin of the box to its opposite 8445: corner</li> 8446: <li><tt>h</tt>: a horizontal line as wide as the box and placed in its 8447: middle</li> 8448: <li><tt>l</tt>: a vertical line on the left side of the box</li> 8449: <li><tt>L</tt>: a lozenge</li> 8450: <li><tt>M</tt>: an open broken line with two arrow heads</li> 8451: <li><tt>N</tt>: an open broken line with an arrow head at start</li> 8452: <li><tt>o</tt>: The southwest/northeast diagonal of the box with an 8453: arrowhead at the bottom</li> 8454: <li><tt>O</tt>: The northwest/southeast diagonal of the box with an 8455: arrowhead at the top</li> 8456: <li><tt>p</tt>: a polygon</li> 8457: <li><tt>P</tt>: a rectangle with round corners and a horizontal bar at the 8458: top</li> 8459: <li><tt>Q</tt>: an ellipse with a horizontal bar at the top</li> 8460: <li><tt>r</tt>: a vertical line on the right side of the box</li> 8461: <li><tt>R</tt>: a rectangle which is the shape of the box</li> 8462: <li><tt>s</tt>: a closed curve</li> 8463: <li><tt>S</tt>: an open broken line</li> 8464: <li><tt>t</tt>: a horizontal line along the upper side of the box</li> 8465: <li><tt>U</tt>: an open broken line with an arrow head at the end</li> 8466: <li><tt>v</tt>: a vertical line as tall as the box and placed in its 8467: middle</li> 8468: <li><tt>V</tt>: a down arrow as tall as the box and in its middle</li> 8469: <li>w: a segment (2 points)</li> 8470: <li><tt>W</tt>: the upper right corner</li> 8471: <li>x: a segment (2 points) with an arrow head at the end</li> 8472: <li><tt>X</tt>: the lower right corner</li> 8473: <li>y: a segment (2 points) with an arrow head at the end</li> 8474: <li><tt>Y</tt>: the lower left corner</li> 8475: <li>z: a segment (2 points) with an arrow head at the end</li> 8476: <li><tt>Z</tt>: the upper left corner</li> 8477: <li><tt>space</tt>: a transparent element</li> 8478: <li><tt>^</tt>: an up arrow as tall as the box and in its middle</li> 8479: <li><tt>></tt>: a right arrow as long as the box's width and in its 8480: middle</li> 8481: <li><tt>></tt>: a left arrow as long as the box's width and in its 8482: middle</li> 8483: <li><tt>/</tt>: The southwest/northeast diagonal of the box</li> 8484: <li><tt>\</tt>: the northwest/southeast diagonal of the box</li> 1.18 cvs 8485: </ul> 1.37 cvs 8486: <hr /> 1.18 cvs 8487: </div> 8488: </div> 8489: </body> 8490: </html>