Return to languages.html CVS log | Up to [Public] / Amaya / doc |
1.32 ! cvs 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ! 2: "http://www.w3.org/TR/html4/loose.dtd"> 1.18 cvs 3: <html> 4: <head> 1.30 cvs 5: <title>The Languages of Thot</title> 6: <meta http-equiv="Content-Type" content="text/html"> 1.18 cvs 7: </head> 1.30 cvs 8: 1.18 cvs 9: <body> 10: 1.19 cvs 11: <div class="frontmatter" align="center"> 1.18 cvs 12: <h1>The Languages of Thot</h1> 13: 14: <h3>Vincent Quint</h3> 15: 16: <h4>Translated from French by Ethan Munson</h4> 17: 1.32 ! cvs 18: <h4>Version of December 26, 2000</h4> 1.30 cvs 19: 20: <p>© 1996-2000 INRIA</p> 1.18 cvs 21: <hr> 22: </div> 23: 24: <div class="tableofcontents"> 25: <h2><a href="languages.toc.html">Contents</a></h2> 26: <ul> 1.30 cvs 27: <li><big><a href="#sect2">The document model of Thot</a></big> 28: <ul> 29: <li><strong><a href="#sectb21">The logical structure of 30: documents</a></strong></li> 31: <li><strong><a href="#sectb22">Generic and specific 32: structures</a></strong></li> 33: <li><strong><a href="#sectb23">Logical structure and physical 34: structure</a></strong></li> 35: <li><strong><a href="#sectb24">Document structures and object 36: structures</a></strong></li> 37: </ul> 38: </li> 39: <li><big><a href="#sect3">The S language</a></big> 40: <ul> 41: <li><strong><a href="#sectb31">Document meta-structure</a></strong> 42: <ul> 43: <li><a href="#sectc311">The basic types</a></li> 44: <li><a href="#sectc312">Constructed elements</a></li> 45: <li><a href="#sectc313">Logical structure constructors</a> 46: <ul> 47: <li><small><a href="#sectd3131">Aggregate and 48: List</a></small></li> 49: <li><small><a href="#sectd3132">Choice, Schema, and 50: Unit</a></small></li> 51: <li><small><a href="#sectd3133">Reference and 52: Inclusion</a></small></li> 53: <li><small><a href="#sectd3134">Mark pairs</a></small></li> 54: <li><small><a href="#sectd3135">Restrictions and 55: Extensions</a></small></li> 56: <li><small><a href="#sectd3136">Summary</a></small></li> 57: </ul> 58: </li> 59: <li><a href="#sectc314">Associated Elements</a></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 65: structures</a></strong> 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="#sectc326">Parameters</a></li> 74: <li><a href="#sectc327">Structured elements</a></li> 75: <li><a href="#sectc328">Structure definitions</a> 76: <ul> 77: <li><small><a href="#sectd3281">List</a></small></li> 78: <li><small><a href="#sectd3282">Aggregate</a></small></li> 79: <li><small><a href="#sectd3283">Choice</a></small></li> 80: <li><small><a href="#sectd3284">Reference</a></small></li> 81: <li><small><a href="#sectd3285">Mark pairs</a></small></li> 82: </ul> 83: </li> 84: <li><a href="#sectc329">Imports</a></li> 85: <li><a href="#sectc3210">Extension rules</a></li> 86: <li><a href="#sectc3211">Associated elements</a></li> 87: <li><a href="#sectc3212">Units</a></li> 88: <li><a href="#sectc3213">Skeleton elements</a></li> 89: <li><a href="#sectc3214">Exceptions</a></li> 90: </ul> 91: </li> 92: <li><strong><a href="#sectb33">Some examples</a></strong> 93: <ul> 94: <li><a href="#sectc331">A class of documents: articles</a></li> 95: <li><a href="#sectc332">A class of objects: mathematical 96: formulas</a></li> 97: </ul> 98: </li> 99: </ul> 100: </li> 101: <li><big><a href="#sect4">The P language</a></big> 102: <ul> 103: <li><strong><a href="#sectb41">Document presentation</a></strong> 104: <ul> 105: <li><a href="#sectc411">Two levels of presentation</a></li> 106: <li><a href="#sectc412">Boxes</a></li> 107: <li><a href="#sectc413">Views and visibility</a></li> 108: <li><a href="#sectc414">Pages</a></li> 109: <li><a href="#sectc415">Numbering</a></li> 110: <li><a href="#sectc416">Presentation parameters</a></li> 111: </ul> 112: </li> 113: <li><strong><a href="#sectb42">Presentation description 114: language</a></strong> 115: <ul> 116: <li><a href="#sectc421">The organization of a presentation 117: schema</a></li> 118: <li><a href="#sectc422">Views</a></li> 119: <li><a href="#sectc423">Print Views</a></li> 120: <li><a href="#sectc424">Counters</a></li> 121: <li><a href="#sectc425">Presentation constants</a></li> 122: <li><a href="#sectc426">Variables</a></li> 123: <li><a href="#sectc427">Default presentation rules</a></li> 124: <li><a href="#sectc428">Presentation and page layout boxes</a></li> 125: <li><a href="#sectc429">Presentation of structured elements</a></li> 126: <li><a href="#sectc4210">Logical attribute presentation</a></li> 127: <li><a href="#sectc4212">Value transmission rules</a></li> 128: <li><a href="#sectc4213">Presentation rules</a></li> 129: <li><a href="#sectc4214">Conditions applying to presentation 130: rules</a> 131: <ul> 132: <li><small><a href="#sectd42141">Conditions based on the logical 133: position of the element</a></small></li> 134: <li><small><a href="#sectd42142">Conditions on 135: references</a></small></li> 136: <li><small><a href="#sectd42143">Conditions on logical 137: attributes</a></small></li> 138: <li><small><a href="#sectd42144">Conditions on page 139: breaks</a></small></li> 140: <li><small><a href="#sectd42145">Conditions on the element's 141: content</a></small></li> 142: <li><small><a href="#sectd42146">Conditions on 143: counters</a></small></li> 144: </ul> 145: </li> 146: <li><a href="#sectc4215">A presentation rule</a></li> 147: <li><a href="#sectc4216">Box axes</a></li> 148: <li><a href="#sectc4217">Distance units</a></li> 149: <li><a href="#sectc4218">Relative positions</a></li> 150: <li><a href="#sectc4219">Box extents</a> 151: <ul> 152: <li><small><a href="#sectd42191">Fixed extents</a></small></li> 153: <li><small><a href="#sectd42192">Relative 154: extents</a></small></li> 155: <li><small><a href="#sectd42193">Elastic 156: extents</a></small></li> 157: </ul> 158: </li> 159: <li><a href="#sectc4220">Overflow</a></li> 160: <li><a href="#sectc4221">Inheritance</a></li> 161: <li><a href="#sectc4222">Line breaking</a> 162: <ul> 163: <li><small><a href="#sectd42221">Line spacing</a></small></li> 164: <li><small><a href="#sectd42222">First line 165: indentation</a></small></li> 166: <li><small><a href="#sectd42223">Alignment</a></small></li> 167: <li><small><a href="#sectd42224">Justification</a></small></li> 168: <li><small><a href="#sectd42225">Hyphenation</a></small></li> 169: <li><small><a href="#sectd42226">Avoiding line 170: breaking</a></small></li> 171: </ul> 172: </li> 173: <li><a href="#sectc4223">Page breaking and line breaking 174: conditions</a></li> 175: <li><a href="#sectc4224">Visibility</a></li> 176: <li><a href="#sectc4225">Character style parameters</a> 177: <ul> 178: <li><small><a href="#sectd42251">Character size</a></small></li> 179: <li><small><a href="#sectd42252">Font and character 180: style</a></small></li> 181: <li><small><a href="#sectd42253">Underlining</a></small></li> 182: </ul> 183: </li> 184: <li><a href="#sectc4226">Stacking order</a></li> 185: <li><a href="#sectc4227">Line style</a></li> 186: <li><a href="#sectc4228">Line thickness</a></li> 187: <li><a href="#sectc4229">Fill pattern</a></li> 188: <li><a href="#sectc4230">Colors</a></li> 189: <li><a href="#sectc4230a">Background color and border</a></li> 190: <li><a href="#sectc4230b">Background pictures</a></li> 191: <li><a href="#sectc4231">Presentation box content</a></li> 192: <li><a href="#sectc4232">Presentation box creation</a></li> 193: <li><a href="#sectc4233">Page layout</a></li> 194: <li><a href="#sectc4234">Box copies</a></li> 195: </ul> 196: </li> 197: </ul> 198: </li> 199: <li><big><a href="#sect5">The T language</a></big> 200: <ul> 201: <li><strong><a href="#sectb51">Document translation</a></strong> 202: <ul> 203: <li><a href="#sectc511">Translation principles</a></li> 204: <li><a href="#sectc512">Translation procedure</a></li> 205: </ul> 206: </li> 207: <li><strong><a href="#sectb52">Translation definition 208: language</a></strong> 209: <ul> 210: <li><a href="#sectc521">Organization of a translation 211: schema</a></li> 212: <li><a href="#sectc522">Line length</a></li> 213: <li><a href="#sectc523">Buffers</a></li> 214: <li><a href="#sectc524">Counters</a></li> 215: <li><a href="#sectc525">Constants</a></li> 216: <li><a href="#sectc526">Variables</a></li> 217: <li><a href="#sectc527">Translating structure elements</a></li> 218: <li><a href="#sectc528">Conditional rules</a> 219: <ul> 220: <li><small><a href="#sectd5281">Conditions based on the logical 221: position of the element</a></small></li> 222: <li><small><a href="#sectd5282">Conditions on 223: references</a></small></li> 224: <li><small><a href="#sectd5283">Conditions on the 225: parameters</a></small></li> 226: <li><small><a href="#sectd5284">Conditions on the 227: alphabets</a></small></li> 228: <li><small><a href="#sectd5285">Conditions on page 229: breaks</a></small></li> 230: <li><small><a href="#sectd5286">Conditions on the element's 231: content</a></small></li> 232: <li><small><a href="#sectd5287">Conditions on the presence of 233: comments</a></small></li> 234: <li><small><a href="#sectd5288">Conditions on the presence of 235: specific presentation rules</a></small></li> 236: <li><small><a href="#sectd5289">Conditions on the presence of 237: logical attributes</a></small></li> 238: <li><small><a href="#sectd52810">Conditions on logical 239: attributes</a></small></li> 240: <li><small><a href="#sectd52811">Conditions on specific 241: presentation rules</a></small></li> 242: </ul> 243: </li> 244: <li><a href="#sectc529">Translation rules</a></li> 245: <li><a href="#sectc5210">The <tt>Create</tt> rule</a></li> 246: <li><a href="#sectc5211">The <tt>Write</tt> rule</a></li> 247: <li><a href="#sectc5212">The <tt>Read</tt> rule</a></li> 248: <li><a href="#sectc5213">The <tt>Include</tt> rule</a></li> 249: <li><a href="#sectc5214">The <tt>Get</tt> rule</a></li> 250: <li><a href="#sectc5215">The <tt>Copy</tt> rule</a></li> 251: <li><a href="#sectc5216">The <tt>Use</tt> rule</a></li> 252: <li><a href="#sectc5217">The <tt>Remove</tt> rule</a></li> 1.31 cvs 253: <li><a href="#sectc5217a">The <code>Ignore</code> rule</a></li> 1.30 cvs 254: <li><a href="#sectc5218">The <tt>NoTranslation</tt> rule</a></li> 255: <li><a href="#sectc5219">The <tt>NoLineBreak</tt> rule</a></li> 256: <li><a href="#sectc5220">The <tt>ChangeMainFile</tt> rule</a></li> 257: <li><a href="#sectc5220a">The <tt>RemoveFile</tt> rule</a></li> 258: <li><a href="#sectc5221">The <tt>Set</tt> and <tt>Add</tt> 259: rules</a></li> 260: <li><a href="#sectc5221a">The <tt>Indent</tt> rule</a></li> 261: <li><a href="#sectc5222">Rule application order</a></li> 262: <li><a href="#sectc5223">Translation of logical attributes</a></li> 263: <li><a href="#sectc5224">Translation of specific 264: presentations</a></li> 265: <li><a href="#sectc5225">Recoding of characters, symbols and 266: graphics</a></li> 267: </ul> 268: </li> 269: </ul> 270: </li> 271: <li><big><a href="#sect6">Language grammars</a></big> 272: <ul> 273: <li><strong><a href="#sectb61">The M meta-language</a></strong></li> 274: <li><strong><a href="#sectb62">The S language</a></strong></li> 275: <li><strong><a href="#sectb63">The P language</a></strong></li> 276: <li><strong><a href="#sectb64">The T language</a></strong></li> 277: </ul> 278: </li> 279: <li><big><a href="#sect7">Character coding</a></big> 280: <ul> 281: <li><strong><a href="#sectb71">Characters</a></strong></li> 282: <li><strong><a href="#sectb72">Symbols</a></strong></li> 283: <li><strong><a href="#sectb73">Graphical elements</a></strong></li> 284: </ul> 285: </li> 1.18 cvs 286: </ul> 287: <hr> 288: </div> 1.1 cvs 289: 1.18 cvs 290: <div class="chapter"> 1.30 cvs 291: <h1><a name="sect2">The document model of Thot</a></h1> 1.1 cvs 292: 1.30 cvs 293: <p>All of the services which Thot provides to the user are based on the 294: system's internal document representation. This representation is itself 295: derived from the document model which underlies Thot. The model is presented 296: here, prior to the description of the languages which permit the generic 297: specification of documents.</p> 1.1 cvs 298: 1.18 cvs 299: <div class="section"> 1.30 cvs 300: <h2><a name="sectb21">The logical structure of documents</a></h2> 1.1 cvs 301: 1.30 cvs 302: <p>The document model of Thot is primarily designed to allow the user to 303: operate on those entities which s/he has in mind when s/he works on a 304: document. The model makes no assumptions about the nature of these entities. 305: It is essentially these logical entities, such as paragraphs, sections, 306: chapters, notes, titles, and cross-references which give a document its 307: logical structure.</p> 308: 309: <p>Because of this model, the author can divide the document into chapters, 1.1 cvs 310: giving each one a title. The content of these chapters can be further divided 1.2 cvs 311: into sections, subsections, etc. The text is organized into successive 312: paragraphs, according to the content. In the writing phase, the lines, pages, 313: margins, spacing, fonts, and character styles are not very important. In fact, 314: if the system requires documents to be written in these terms, it gets in the 315: way. So, Thot's model is primarily based on the logical aspect of documents. 1.18 cvs 316: The creation of a model of this type essentially requires the definition :</p> 317: <ul> 1.30 cvs 318: <li>of the entities which can appear in the documents,</li> 319: <li>and the relations between these entities.</li> 1.18 cvs 320: </ul> 1.30 cvs 321: 322: <p>The choice of entities to include in the model can be subtle. Some 323: documents require chapters, while others only need various levels of sections. 324: Certain documents contain appendices, others don't. In different documents 325: the same logical entity may go by different names (e.g. ``Conclusion'' and 1.1 cvs 326: ``Summary''). Certain entities which are absolutely necessary in some 327: documents, such as clauses in a contract or the address of the recipient in a 1.18 cvs 328: letter, are useless in most other cases.</p> 1.30 cvs 329: 330: <p>The differences between documents result from more than just the entities 331: that appear in them, but also from the relationships between these entities 332: and the ways that they are linked. In certain documents, notes are spread 333: throughout the document, for example at the bottom of the page containing the 1.1 cvs 334: cross-reference to them, while in other documents they are collected at the 335: end of each chapter or even at the end of the work. As another example, the 336: introduction of some documents can contain many sections, while in other 337: documents, the introduction is restricted to be a short sequence of 1.18 cvs 338: paragraphs.</p> 1.30 cvs 339: 340: <p>All of this makes it unlikely that a single model can describe any document 341: at a relatively high level. It is obviously tempting to make up a list of 342: widely used entities, such as chapters, sections, paragraphs, and titles, and 343: then map all other entities onto the available choices. In this way, an 1.1 cvs 344: introduction can be supported as a chapter and a contract clause supported as 345: a paragraph or section. However, in trying to widen the range of usage of 346: certain entities, their meaning can be lost and the power of the model 347: reduced. In addition, while this widening partially solves the problem of 348: choosing entities, it does not solve the problem of their organization: when a 349: chapter must be composed of sections, how does one indicate that an 350: introduction has none when it is merely another chapter? One solution is to 351: include introductions in the list of supported entities. But then, how does 352: one distinguish those introductions which are allowed to have sections from 353: those which are not. Perhaps this could be done by defining two types of 354: introduction. Clearly, this approach risks an infinite expansion of the list 1.18 cvs 355: of widely used entities.</p> 356: </div> 1.1 cvs 357: 1.18 cvs 358: <div class="section"> 1.30 cvs 359: <h2><a name="sectb22">Generic and specific structures</a></h2> 1.1 cvs 360: 1.30 cvs 361: <p>Thus, it is apparently impossible to construct an exhaustive inventory of 362: all those entities which are necessary and sufficient to precisely describe 363: any document. It also seems impossible to specify all possible arrangements of 1.18 cvs 364: these entities in a document. This is why Thot uses a <em>meta-model</em> 365: instead, which permits the description of numerous <em>models</em>, each one 366: describing a <em>class</em> of documents.</p> 1.30 cvs 367: 368: <p>A <em>class</em> is a set of documents having very similar structure. Thus, 1.1 cvs 369: the collection of research reports published by a laboratory constitutes a 370: class; the set of commercial proposals by the sales department of a company 371: constitutes another class; the set of articles published by a journal 372: constitutes a third class. Clearly, it is not possible to enumerate every 373: possible document class. It is also clear that new document classes must be 1.18 cvs 374: created to satisfy new needs and applications.</p> 1.30 cvs 375: 376: <p>To give a more rigorous definition of classes, we must introduce the ideas 377: of <em>generic structure</em> and <em>specific structure</em>. Each document 378: has a <em>specific structure</em> which organizes the various parts which 379: comprise it. We illustrate this with the help of a simple example comparing 380: two reports, A and B (<a href="#specstruct">see Figure</a>). The report A 381: contains an introduction followed by three chapters and a conclusion. The 382: first chapter contains two sections, the second, three sections. That is the 1.18 cvs 383: <em>specific</em> structure of document A. Similarly, the structure of 1.1 cvs 384: document B is: an introduction, two chapters, a conclusion; Chapter 1 has 385: three sections while Chapter 2 has four. The specific structures of these two 1.18 cvs 386: documents are thus different.</p> 1.1 cvs 387: 1.18 cvs 388: <div class="figure"> 389: <hr> 390: <pre> Report A Report B 1.1 cvs 391: Introduction Introduction 392: Chapter 1 Chapter 1 393: Section 1.1 Section 1.1 394: Section 1.2 Section 1.2 395: Chapter 2 Section 1.3 396: Section 2.1 Chapter 2 397: Section 2.2 Section 2.1 398: Section 2.3 Section 2.2 399: Chapter 3 Section 2.3 400: Conclusion Section 2.4 1.18 cvs 401: Conclusion</pre> 1.30 cvs 402: 403: <p align="center"><em><a name="specstruct">Two specific 404: structures</a></em></p> 1.18 cvs 405: <hr> 1.30 cvs 406: </div> 407: 408: <p>The <em>generic structure</em> defines the ways in which specific 409: structures can be constructed. It specifies how to generate specific 410: structures. The reports A and B, though different, are constructed in 411: accordance with the same generic structure, which specifies that a report 412: contains an introduction followed by a variable number of chapters and a 413: conclusion, with each chapter containing a variable number of sections.</p> 414: 415: <p>There is a one-to-one correspondence between a class and a generic 416: structure: all the documents of a class are constructed in accordance with the 417: same generic structure. Hence the definition of the class: a class is a set 418: of documents whose specific structure is constructed in accordance with the 419: same generic structure. A class is characterized by its generic 420: structure.</p> 1.19 cvs 421: 1.30 cvs 422: <p>Thus, a generic structure can be considered to be a model at the level 423: which interests us, but only for one class of documents. When the definition 424: is limited to a single class of documents, it is possible to define a model 425: which does a good job of representing the documents of the class, including 426: the necessary entities and unencumbered by useless entities. The description 427: of the organization of the documents in the class can then be sufficiently 1.18 cvs 428: precise.</p> 429: </div> 1.1 cvs 430: 1.18 cvs 431: <div class="section"> 1.30 cvs 432: <h2><a name="sectb23">Logical structure and physical structure</a></h2> 1.1 cvs 433: 1.30 cvs 434: <p>Generic structures only describe the <em>logical</em> organization of 1.18 cvs 435: documents, not their <em>physical</em> presentation on a screen or on sheets 1.1 cvs 436: of paper. However, for a document to be displayed or printed, its graphic 1.18 cvs 437: presentation must be taken into account.</p> 1.30 cvs 438: 439: <p>An examination of current printed documents shows that the details of 1.1 cvs 440: presentation essentially serve to bring out their logical structure. Outside 441: of some particular domains, notably advertising, the presentation is rarely 442: independent of the logical organization of the text. Moreover, the art of 443: typography consists of enhancing the organization of the text being set, 444: without catching the eye of the reader with overly pronounced effects. Thus, 445: italic and boldface type are used to emphasize words or expressions which have 446: greater significance than the rest of the text: keywords, new ideas, 447: citations, book titles, etc. Other effects highlight the organization of the 448: text: vertical space, margin changes, page breaks, centering, eventually 449: combined with the changes in the shapes or weight of the characters. These 450: effects serve to indicate the transitions between paragraphs, sections, or 451: chapters: an object's level in the logical structure of the document is shown 1.18 cvs 452: by the markedness of the effects.</p> 1.30 cvs 453: 454: <p>Since the model permits the description of all of the logical structure of 455: the document, the presentation can be derived from the model without being 1.1 cvs 456: submerged in the document itself. It suffices to use the logical structure of 457: the document to make the desired changes in its presentation: changes in type 1.18 cvs 458: size, type style, spacing, margin, centering, etc.</p> 1.30 cvs 459: 460: <p>Just as one cannot define a unique generic logical structure for all 461: document classes, one cannot define universal presentation rules which can be 462: applied to all document classes. For certain types of documents the chapter 463: titles will be centered on the page and printed in large, bold type. For 464: other documents, the same chapter titles will be printed in small, italic type 465: and aligned on the left margin.</p> 466: 467: <p>Therefore, it is necessary to base the presentation specifications for 1.1 cvs 468: documents on their class. Such a specification can be very fine-grained, 469: because the presentation is expressed in terms of the entities defined in the 470: generic logical structure of the class. Thus, it is possible to specify a 471: different presentation for the chapter titles and the section titles, and 472: similarly to specify titles for the sections according to their level in the 473: section hierarchy. The set of rules which specify the presentation of all the 1.18 cvs 474: elements defined in a generic logical structure is called a <em>generic 475: presentation</em>.</p> 1.30 cvs 476: 477: <p>There are several advantages derived from having a presentation linked to 478: the generic structure and described by a generic presentation. Homogeneity is 479: the first. Since every document in a class corresponds to the same generic 1.1 cvs 480: logical structure, a homogenous presentation for different documents of the 481: same class can be assured by applying the same generic presentation to all 482: documents of the class. Homogeneity of presentation can also be found among 1.2 cvs 483: the entities of a single document: every section heading will be presented in 1.1 cvs 484: the same way, the first line of every paragraph of the same type will have the 1.18 cvs 485: same indentation, etc.</p> 1.30 cvs 486: 487: <p>Another advantage of this approach to presentation is that it facilitates 1.1 cvs 488: changes to the graphical aspect of documents. A change to the generic 489: presentation rules attached to each type of entity will alter the presentation 490: of the entire document, and will do so homogenously. In this case, the 491: internal homogeneity of the class is no longer assured, but the way to control 492: it is simple. It suffices to adopt a single generic presentation for the 1.18 cvs 493: entire class.</p> 1.30 cvs 494: 495: <p>If the presentation of the class does not have to be homogenous, then the 1.1 cvs 496: appearance of the document can be adapted to the way it will be used or to the 497: device used to render it. This quality is sufficient to allow the existence 1.18 cvs 498: of <a name="mulpres">many generic presentations</a> for the same document 1.1 cvs 499: class. By applying one or the other of these presentations to it, the document 500: can be seen under different graphical aspects. It must be emphasized that 501: this type of modification of the presentation is not a change to the document 502: itself (in its specific logical structure or its content), but only in its 1.18 cvs 503: appearance at the time of editing or printing.</p> 504: </div> 1.1 cvs 505: 1.18 cvs 506: <div class="section"> 1.30 cvs 507: <h2><a name="sectb24">Document structures and object structures</a></h2> 1.1 cvs 508: 1.30 cvs 509: <p>So far, we have only discussed the global structure of documents and have 510: not considered the contents found in that structure. We could limit ourselves 511: to purely textual contents by assuming that a title or a paragraph contains a 1.1 cvs 512: simple linear text. But this model would be too restrictive. In fact, 513: certain documents contain not only text, but also contain tables, diagrams, 514: photographs, mathematical formulas, and program fragments. The model must 1.18 cvs 515: permit the representation of such <em>objects</em>.</p> 1.30 cvs 516: 517: <p>Just as with the whole of the document, the model takes into account the 1.1 cvs 518: logical structure of objects of this type. Some are clearly structured, 519: others are less so. Logical structure can be recognized in mathematical 520: formulas, in tables, and in certain types of diagrams. On the other hand, it 521: is difficult to define the structure of a photograph or of some drawings. But 522: in any case, it does not seem possible to define one unique structure which 523: can represent every one of these types of objects. The approach taken in the 524: definition of meta-structure and document classes also applies to objects. 525: Object classes can be defined which put together objects of similar type, 1.18 cvs 526: constructed from the same generic logical structure.</p> 1.30 cvs 527: 528: <p>Thus, a mathematical class can be defined and have a generic logical 529: structure associated with it. But even if a single generic structure can 530: represent a sufficient variety of mathematical formulas, for other objects 531: with less rigorous structure, multiple classes must be defined. As for 532: documents, using multiple classes assures that the model can describe the full 533: range of objects to be presented. It also permits the system to support 534: objects which were not initially anticipated. Moreover, this comment applies 535: equally to mathematics: different classes of formulas can be described 536: depending on the domain of mathematics being described.</p> 537: 538: <p>Since objects have the same level of logical representation as documents, 539: they gain the same advantages. In particular, it is possible to define the 1.1 cvs 540: presentation separately from the objects themselves and attach it to the 541: class. Thus, as for documents, objects of the same type have a uniform 542: presentation and the presentation of every object in a given class can be 543: changed simply by changing the generic presentation of the class. Another 544: advantage of using this document model is that the system does not bother the 545: user with the details of presentation, but rather allows the user to 1.18 cvs 546: concentrate on the logical aspect of the document and the objects.</p> 1.30 cvs 547: 548: <p>It is clear that the documents in a class do not necessarily use the same 1.1 cvs 549: classes of objects: one technical report will contain tables while another 550: report will have no tables but will use mathematical formulas. The usable 1.2 cvs 551: object classes are not always mentioned in a limiting way in the generic 552: logical structure of documents. Rather, they can be chosen freely from a 1.18 cvs 553: large set, independent of the document class.</p> 1.30 cvs 554: 555: <p>Thus, the object classes will be made commonplace and usable in every 1.1 cvs 556: document. The notion of ``object'' can be enlarged to include not only 557: non-textual elements, but also certain types of textual elements which can 558: appear in practically every document, whatever their class. Among these 1.2 cvs 559: textual elements, one can mention enumerations, descriptions, examples, 1.18 cvs 560: quotations, even paragraphs.</p> 1.30 cvs 561: 562: <p>Thus, the document model is not a single, general model describing every 563: type of document in one place. Rather, it is a meta-model which can be used 564: to describe many different models each of which represents either a class of 1.1 cvs 565: similar documents or a class of similar objects which every document can 1.18 cvs 566: include.</p> 567: </div> 568: <hr> 569: </div> 1.1 cvs 570: 1.18 cvs 571: <div class="chapter"> 572: <h1><a name="sect3">The S language</a></h1> 1.1 cvs 573: 1.18 cvs 574: <div class="section"> 1.30 cvs 575: <h2><a name="sectb31">Document meta-structure</a></h2> 1.1 cvs 576: 1.30 cvs 577: <p>Since the concept of meta-structure is well suited to the task of 578: describing documents at a high level of abstraction, this meta-structure must 579: be precisely defined. Toward that end this section first presents the basic 1.1 cvs 580: elements from which documents and structured objects are composed and then 581: specifies the ways in which these basic elements are assembled into structures 1.18 cvs 582: representing complete documents and objects.</p> 1.1 cvs 583: 1.18 cvs 584: <div class="subsection"> 1.30 cvs 585: <h3><a name="sectc311">The basic types</a></h3> 1.1 cvs 586: 1.30 cvs 587: <p>At the lowest level of a document's structure, the first atom considered is 1.1 cvs 588: the character. However, since characters are seldom isolated, usually 589: appearing as part of a linear sequence, and in order to reduce the complexity 1.18 cvs 590: of the document structure, <em>character strings</em> are used as atoms and 1.1 cvs 591: consecutive characters belonging to the same structural element are grouped in 1.18 cvs 592: the same character string.</p> 1.30 cvs 593: 594: <p>If the structure of a document is not refined to go down to the level of 1.1 cvs 595: words or phrases, the contents of a simple paragraph can be considered to be a 596: single character string. On the other hand, the title of a chapter, the title 597: of the first section of that chapter, and the text of the first paragraph of 598: that section constitute three different character strings, because they belong 1.18 cvs 599: to distinct structural elements.</p> 1.30 cvs 600: 601: <p>If, instead, a very fine-grained representation for the structure of a 1.1 cvs 602: document is sought, character strings could be defined to contain only a 603: single word, or even just a single character. This is the case, for example, 604: in programs, for which one wants to retain a structure very close to the 1.2 cvs 605: syntax of the programming language. In this case, an assignment statement 1.1 cvs 606: initializing a simple variable to zero would be composed of two structural 607: elements, the identifier of the variable (a short character string) and the 1.18 cvs 608: assigned value (a string of a single character, `0').</p> 1.30 cvs 609: 610: <p>The character string is not the only atom necessary for representing those 1.1 cvs 611: documents that interest us. It suffices for purely textual documents, but as 612: soon as the non-textual objects which we have considered arise, there must be 613: other atoms; the number of objects which are to be represented determines the 1.18 cvs 614: number of types of atoms that are necessary.</p> 1.30 cvs 615: 616: <p>Primitive <em>graphical elements</em> are used for tables and figures of 1.1 cvs 617: different types. These elements are simple geometric shapes like horizontal 618: or vertical lines, which are sufficient for tables, or even oblique lines, 1.2 cvs 619: arrows, rectangles, circles, polygons, and curves for use in figures. From 620: these elements and character strings, graphical objects and tables can be 1.18 cvs 621: constructed.</p> 1.30 cvs 622: 623: <p>Photographs, though having very little structure, must still appear in 1.18 cvs 624: documents. They are supported by <em>picture</em> elements, which are 625: represented as matrices of pixels.</p> 1.30 cvs 626: 627: <p>Finally, mathematical notations require certain elements which are 1.18 cvs 628: simultaneously characters and graphical elements, the <em>symbols</em>. By way 1.2 cvs 629: of example, radicals, integration signs, or even large parentheses are 1.1 cvs 630: examples of this type of atom. The size of each of these symbols is 631: determined by its environment, that is to say, by the expression to which it 1.18 cvs 632: is attached.</p> 1.30 cvs 633: 634: <p>To summarize, the primitive elements which are used in the construction of 1.18 cvs 635: documents and structured objects are:</p> 636: <ul> 1.30 cvs 637: <li>character strings,</li> 638: <li>graphical elements,</li> 639: <li>pictures,</li> 640: <li>and mathematical symbols.</li> 1.18 cvs 641: </ul> 642: </div> 1.1 cvs 643: 1.18 cvs 644: <div class="subsection"> 1.30 cvs 645: <h3><a name="sectc312">Constructed elements</a></h3> 646: 647: <p>A document is evidently formed from primitive elements. But the model of 648: Thot also proposes higher level elements. Thus, in a document composed of 649: several chapters, each chapter is an element, and in the chapters each section 650: is also an element, and so on. A document is thus an organized set of 651: elements.</p> 1.1 cvs 652: 1.30 cvs 653: <p>In a document there are different sorts of elements. Each element has a 1.18 cvs 654: <em>type</em> which indicates the role of the element within the document as a 1.1 cvs 655: whole. Thus, we have, for example, the chapter and section types. The 656: document is made up of typed elements: elements of the type chapter and 657: elements of the type section, among others, but also character string elements 658: and graphical elements: the primitive elements are typed elements just as 659: well. At the other extreme, the document itself is also considered to be a 1.18 cvs 660: typed element.</p> 1.30 cvs 661: 662: <p>The important difference between the primitive elements and the other 663: elements of the document is that the primitive elements are atoms (they cannot 664: be decomposed), whereas the others, called <em>constructed elements</em>, are 1.1 cvs 665: composed of other elements, which can either be primitive elements or 666: constructed elements. A constructed element of type chapter (or more simply, 667: ``a chapter'') is composed of sections, which are also constructed elements. A 668: paragraph, a constructed element, can be made up of character strings, which 1.18 cvs 669: are primitive elements, and of equations, which are constructed elements.</p> 1.30 cvs 670: 671: <p>A document is also a constructed element. This is an important point. In 1.1 cvs 672: particular, it allows a document to be treated as part of another document, 673: and conversely, permits a part of a document to be treated as a complete 674: document. Thus, an article presented in a journal is treated by its author as 675: a document in itself, while the editor of the journal considers it to be part 676: of an issue. A table or a figure appearing in a document can be extracted and 677: treated as a complete document, for example to prepare transparencies for a 1.18 cvs 678: conference.</p> 1.30 cvs 679: 680: <p>These thoughts about types and constructed elements apply just as well to 1.1 cvs 681: objects as they do to documents. A table is a constructed element made up of 682: other constructed elements, rows and columns. A row is formed of cells, which 683: are also constructed elements which contain primitive elements (character 1.18 cvs 684: strings) and/or constructed elements like equations.</p> 685: </div> 1.1 cvs 686: 1.18 cvs 687: <div class="subsection"> 1.30 cvs 688: <h3><a name="sectc313">Logical structure constructors</a></h3> 1.1 cvs 689: 1.30 cvs 690: <p>Having defined the primitive elements and the constructed elements, it is 691: now time to define the types of organization which allow the building of 1.18 cvs 692: structures. For this, we rely on the notion of the <em>constructor</em>. A 1.1 cvs 693: constructor defines a way of assembling certain elements in a structure. It 694: resides at the level of the meta-structure: it does not describe the existing 695: relations in a given structure, but rather defines how elements are assembled 1.18 cvs 696: to build a structure that conforms to a model.</p> 1.30 cvs 697: 698: <p>In defining the overall organization of documents, the first two 699: constructors considered are the aggregate and the list.</p> 1.1 cvs 700: 1.18 cvs 701: <div class="subsubsection"> 1.30 cvs 702: <h4><a name="sectd3131">Aggregate and List</a></h4> 1.1 cvs 703: 1.30 cvs 704: <p>The <em>aggregate</em> constructor is used to define constructed element 705: types which are collections of a given number of other elements. These 706: collections may or may not be ordered. The elements may be either constructed 707: or primitive and are specified by their type. A report (that is, a 708: constructed element of the report type) has an aggregate structure. It is 709: formed from a title, an author's name, an introduction, a body, and a 710: conclusion, making it a collection of five element types. This type of 711: constructor is found in practically every document, and generally at several 712: levels in a document.</p> 713: 714: <p>The <em>list</em> constructor is used to define constructed elements which 715: are ordered sequences of elements (constructed or primitive) having the same 716: type. The minimum and maximum numbers of elements for the sequence can be 717: specified in the list constructor or the number of elements can be left 718: unconstrained. The body of a report is a list of chapters and is typically 719: required to contain a minimum of two chapters (is a chapter useful if it is 720: the only one in the report?) The chapter itself can contain a list of 721: sections, each section containing a list of paragraphs. In the same way as 722: the aggregate, the list is a very frequently used constructor in every type of 723: document. However, these two constructors are not sufficient to describe every 724: document structure; thus other constructors supplement them.</p> 1.18 cvs 725: </div> 1.1 cvs 726: 1.18 cvs 727: <div class="subsubsection"> 1.30 cvs 728: <h4><a name="sectd3132">Choice, Schema, and Unit</a></h4> 1.1 cvs 729: 1.30 cvs 730: <p>The <em>choice</em> constructor is used to define the structure of an 731: element type for which one alternative is chosen from several possibilities. 732: Thus, a paragraph can be either a simple text paragraph, or an enumeration, or 733: a citation.</p> 734: 735: <p>The choice constructor indicates the complete list of possible options, 736: which can be too restrictive in certain cases, the paragraph being one such 737: case. Two constructors, <em>unit</em> and <em>schema</em>, address this 1.1 cvs 738: inconvenience. They allow more freedom in the choice of an element type. If 739: a paragraph is defined by a schema constructor, it is possible to put in the 740: place of a paragraph a table, an equation, a drawing or any other object 741: defined by another generic logical structure. It is also possible to define a 742: paragraph as a sequence of units, which could be character strings, symbols, 1.2 cvs 743: or pictures. The choice constructor alone defines a generic logical structure 1.1 cvs 744: that is relatively constrained; in contrast, using units and schemas, a very 1.18 cvs 745: open structure can be defined.</p> 1.30 cvs 746: 747: <p>The <em>schema</em> constructor represents an object defined by a generic 1.18 cvs 748: logical structure chosen freely from among those available.</p> 1.30 cvs 749: 750: <p>The <em>unit</em> constructor represents an element whose type can be 751: either a primitive type or an element type defined as a unit in the generic 752: logical structure of the document, or in another generic logical structure 753: used in the document. Such an element may be used in document objects 754: constructed according to other generic structures.</p> 755: 756: <p>Thus, for example, if a cross-reference to a footnote is defined in the 1.1 cvs 757: generic logical structure ``Article'' as a unit, a table (an object defined by 758: another generic structure) can contain cross-references to footnotes, when 759: they appear in an article. In another type of document, a table defined by 760: the same generic structure can contain other types of elements, depending on 761: the type of document into which the table is inserted. All that is needed is 762: to declare, in the generic structure for tables, that the contents of cells 763: are units. In this way, the generic structure of objects is divided up 764: between different types of documents which are able to adapt themselves to the 1.18 cvs 765: environment into which they are inserted.</p> 766: </div> 1.1 cvs 767: 1.18 cvs 768: <div class="subsubsection"> 1.30 cvs 769: <h4><a name="sectd3133">Reference and Inclusion</a></h4> 1.1 cvs 770: 1.30 cvs 771: <p>The <em>reference</em> is used to define document elements that are 1.18 cvs 772: cross-references to other elements, such as a section, a chapter, a 773: bibliographic citation, or a figure. The reference is bi-directional. It can 774: be used to access both the element being cross-referenced and each of the 775: elements which make use of the cross-reference.</p> 1.30 cvs 776: 777: <p>References can be either <em>internal</em> or <em>external</em>. That is, 1.1 cvs 778: they can designate elements which appear in the same document or in another 1.18 cvs 779: document.</p> 1.30 cvs 780: 781: <p>The <em><a name="inclusion">inclusion</a></em> constructor is a special 782: type of reference. Like the reference, it is an internal or external 783: bidirectional link, but it is not a cross-reference. This link represents the 784: ``live'' inclusion of the designated element; it accesses the most recent 785: version of that element and not a ``dead'' copy, fixed in the state in which 786: it was found at the moment the copy was made. As soon as an element is 787: modified, all of its inclusions are automatically brought up to date. It must 788: be noted that, in addition to inclusion, Thot permits the creation of ``dead'' 789: copies.</p> 790: 791: <p>There are three types of inclusions: inclusions with full expansion, 1.1 cvs 792: inclusions with partial expansion, and inclusions without expansion. During 793: editing, inclusions without expansion are represented on the screen by the 794: name of the included document, in a special color, while inclusions with 795: expansion (full or partial) are represented by a copy (full or partial) of the 796: included element (also in a special color). The on-screen representation of a 1.18 cvs 797: partial inclusion is a <a href="#sectc3213">``skeleton''</a> image of the 798: included document.</p> 1.30 cvs 799: 800: <p>Inclusion with complete expansion can be used to include parts of the same 1.1 cvs 801: document or of other documents. Thus, it can be either an internal or an 802: external link. It can be used to include certain bibliographic entries of a 803: scientific article in another article, or to copy part of a mathematical 804: formula into another formula of the same document, thus assuring that both 1.18 cvs 805: copies will remain synchronized.</p> 1.30 cvs 806: 807: <p>Inclusion without expansion or with partial expansion is used to include 1.1 cvs 808: complete documents. It is always an external link. It is used primarily to 809: divide very large documents into sub-documents that are easier to manipulate, 810: especially when there are many authors. So, a book can include some chapters, 811: where each chapter is a different document which can be edited separately. 812: When viewing the book on the screen, it might be desirable to see only the 813: titles of the chapters and sections. This can be achieved using inclusion 1.18 cvs 814: with partial expansion.</p> 1.30 cvs 815: 816: <p>During printing, inclusions without expansion or with partial expansion can 817: be represented either as they were shown on the screen or by a complete (and 1.18 cvs 818: up-to-date) copy of the included element or document.</p> 1.30 cvs 819: 820: <p>The inclusion constructor, whatever its type, respects the generic 821: structure: only those elements authorized by the generic structure can be 822: included at a given position in a document.</p> 1.18 cvs 823: </div> 1.1 cvs 824: 1.18 cvs 825: <div class="subsubsection"> 1.30 cvs 826: <h4><a name="sectd3134">Mark pairs</a></h4> 1.1 cvs 827: 1.30 cvs 828: <p>It is often useful to delimit certain parts of a document independently 829: from the logical structure. For example, one might wish to attach some 830: information (in the form of an <a href="#sectc315">attribute</a>) or a 831: particular treatment to a group of words or a set of consecutive paragraphs. 832: <em>Mark pairs</em> are used to do this.</p> 833: 834: <p>Mark pairs are elements which are always paired and are terminals in the 1.1 cvs 835: logical structure of the document. Their position in the structure of the 836: document is defined in the generic structure. It is important to note that 1.18 cvs 837: when the terminals of a mark pair are <em>extensions</em> (see the next 838: section), they can be used quite freely.</p> 839: </div> 1.1 cvs 840: 1.18 cvs 841: <div class="subsubsection"> 1.30 cvs 842: <h4><a name="sectd3135">Restrictions and Extensions</a></h4> 1.1 cvs 843: 1.30 cvs 844: <p>The primitive types and the constructors presented so far permit the 1.1 cvs 845: definition of the logical structure of documents and objects in a rigorous 846: way. But this definition can be very cumbersome in certain cases, notably 847: when trying to constrain or extend the authorized element types in a 1.18 cvs 848: particular context. <em>Restrictions</em> and <em>extensions</em> are used to 849: cope with these cases.</p> 1.30 cvs 850: 851: <p>A restriction associates with a particular element type <em>A</em>, a list 852: of those element types which elements of type <em>A</em> may not contain, even 853: if the definition of type <em>A</em> and those of its components authorize 854: them otherwise. This simplifies the writing of generic logical structures and 1.1 cvs 855: allows limitations to be placed, when necessary, on the choices offered by the 1.18 cvs 856: schema and unit constructors.</p> 1.30 cvs 857: 858: <p>Extensions are the inverse of restrictions. They identify a list of 859: element types whose presence <em>is</em> permitted, even if its definition and 860: those of its components do not authorize them otherwise.</p> 1.18 cvs 861: </div> 862: 863: <div class="subsubsection"> 1.30 cvs 864: <h4><a name="sectd3136">Summary</a></h4> 1.18 cvs 865: 1.30 cvs 866: <p>Thus, four constructors are used to construct a document:</p> 1.18 cvs 867: <ul> 1.30 cvs 868: <li>the aggregate constructor (ordered or not),</li> 869: <li>the list constructor,</li> 870: <li>the choice constructor and its extensions, the unit and schema 871: constructors,</li> 872: <li>the reference constructor and its variant, the inclusion.</li> 873: </ul> 874: 875: <p>These constructors are also sufficient for objects. Thus, these 876: constructors provide a homogenous meta-model which can describe both the 877: organization of the document as a whole and that of the various types of 878: objects which it contains. After presenting the description language for 879: generic structures, we will present several examples which illustrate the 880: appropriateness of the model.</p> 881: 882: <p>The first three constructors (aggregate, list and choice) lead to tree-like 1.1 cvs 883: structures for documents and objects, the objects being simply the subtrees of 884: the tree of a document (or even of other objects' subtrees). The reference 885: constructor introduces other, non-hierarchical, relations which augment those 886: of the tree: when a paragraph makes reference to a chapter or a section, that 887: relation leaves the purely tree-like structure. Moreover, external reference 888: and inclusion constructors permit the establishment of links between different 1.18 cvs 889: documents, thus creating a hypertext structure.</p> 890: </div> 891: </div> 1.1 cvs 892: 1.18 cvs 893: <div class="subsection"> 1.30 cvs 894: <h3><a name="sectc314">Associated Elements</a></h3> 1.1 cvs 895: 1.30 cvs 896: <p>Thanks to the list, aggregate and choice constructors, the organization of 897: the document is specified rigorously, using constructed and primitive 898: elements. But a document is made up of more than just its elements; it clearly 899: also contains links between them. There exist elements whose position in the 1.1 cvs 900: document's structure is not determinable. This is notably the case for 901: figures and notes. A figure can be designated at many points in the same 902: document and its place in the physical document can vary over the life of the 903: document without any effect on the meaning or clarity of the document. At one 904: time, it can be placed at the end of the document along with all other 905: figures. At another time, it can appear at the top of the page which follows 906: the first mention of the figure. The figures can be dispersed throughout the 907: document or can be grouped together. The situation is similar for notes, 908: which can be printed at the bottom of the page on which they are mentioned or 909: assembled together at the end of the chapter or even the end of the work. Of 910: course, this brings up questions of the physical position of elements in 911: documents that are broken into pages, but this reflects the structural 912: instability of these elements. They cannot be treated the same way as 913: elements like paragraphs or sections, whose position in the structure is 1.18 cvs 914: directly linked to the semantics of the document.</p> 1.30 cvs 915: 916: <p>Those elements whose position in the structure of the document is not 917: fixed, even though they are definitely part of the document, are called 1.18 cvs 918: <em>associated elements</em>. Associated elements are themselves structures, 1.1 cvs 919: which is to say that their content can be organized logically by the 1.18 cvs 920: constructors from primitive and constructed elements.</p> 1.30 cvs 921: 922: <p>It can happen that the associated elements are totally disconnected from 923: the structure of the document, as in a commentary or appraisal of the entire 924: work. But more often, the associated elements are linked to the content of the 1.1 cvs 925: document by references. This is generally the case for notes and figures, 1.18 cvs 926: among others.</p> 1.30 cvs 927: 928: <p>Thus, associated elements introduce a new use for the reference 929: constructor. It not only serves to create links between elements of the 930: principal structure of the document, but also serves to link the associated 931: elements to the primary structure.</p> 1.18 cvs 932: </div> 1.1 cvs 933: 1.18 cvs 934: <div class="subsection"> 1.30 cvs 935: <h3><a name="sectc315">Attributes</a></h3> 1.1 cvs 936: 1.30 cvs 937: <p>There remain logical aspects of documents that are not entirely described 938: by the structure. Certain types of semantic information, which are not stated 1.1 cvs 939: explicitly in the text, must also be taken into account. In particular, such 940: information is shown by typographic effects which do not correspond to a 941: change between structural elements. In fact, certain titles are set in bold 942: or italic or are printed in a different typeface from the rest of the text in 943: order to mark them as structurally distinct. But these same effects 944: frequently appear in the middle of continuous text (e.g. in the interior of a 945: paragraph). In this case, there is no change between structural elements; the 946: effect serves to highlight a word, expression, or phrase. The notion of an 1.18 cvs 947: <em>attribute</em> is used to express this type of information.</p> 1.30 cvs 948: 949: <p>An attribute is a piece of information attached to a structural element 950: which augments the type of the element and clarifies its function in the 951: document. Keywords, foreign language words, and titles of other works can all 952: be represented by character strings with attached attributes. Attributes may 1.1 cvs 953: also be attached to constructed elements. Thus, an attribute indicating the 954: language can be attached to a single word or to a large part of a 1.18 cvs 955: document.</p> 1.30 cvs 956: 957: <p>In fact, an attribute can be any piece of information which is linked to a 1.1 cvs 958: part of a document and which can be used by agents which work on the document. 959: For example, the language in which the document is written determines the set 960: of characters used by an editor or formatter. It also determines the 961: algorithm or hyphenation dictionary to be used. The attribute ``keyword'' 962: facilitates the work of an information retrieval system. The attribute 963: ``index word'' allows a formatter to automatically construct an index at the 1.18 cvs 964: end of the document.</p> 1.30 cvs 965: 966: <p>As with the types of constructed elements, the attributes and the values 967: they can take are defined separately in each generic logical structure, not in 968: the meta-model, according to the needs of the document class or the nature of 969: the object.</p> 970: 971: <p>Many types of attributes are offered: numeric, textual, references, and 1.18 cvs 972: enumerations:</p> 973: <ul> 1.30 cvs 974: <li><em>Numeric attributes</em> can take integer values (negative, positive, 975: or null).</li> 976: <li><em>Textual attributes</em> have as their values character strings.</li> 977: <li><em>Reference attributes</em> designate an element of the logical 978: structure.</li> 979: <li><em>Enumeration attributes</em> can take one value from a limited list 980: of possible values, each value being a name.</li> 1.18 cvs 981: </ul> 1.30 cvs 982: 983: <p>In a generic structure, there is a distinction between <em>global 1.18 cvs 984: attributes</em> and <em>local attributes</em>. A global attribute can be 1.1 cvs 985: applied to every element type defined in the generic structure where it is 986: specified. In contrast, a local attribute can only be applied to certain 987: types of elements, even only a single type. The ``language'' attribute 988: presented above is an example of a global attribute. An example of a local 989: attribute is the rank of an author (principal author of the document or 990: secondary author): this attribute can only be applied sensibly to an element 1.18 cvs 991: of the ``author'' type.</p> 1.30 cvs 992: 993: <p>Attributes can be assigned to the elements which make up the document in 994: many different ways. The author can freely and dynamically place them on any 995: part of the document in order to attach supplementary information of his/her 1.18 cvs 996: choice. However, attributes may only be assigned in accordance with the rules 997: of the generic structure; in particular, local attributes can only be assigned 998: to those element types for which they are defined.</p> 1.30 cvs 999: 1000: <p>In the generic structure, certain local attributes can be made mandatory 1001: for certain element types. In this case, Thot automatically associates the 1.2 cvs 1002: attribute with the elements of this type and it requires the user to provide a 1.18 cvs 1003: value for this attribute.</p> 1.30 cvs 1004: 1005: <p>Attributes can also be automatically assigned, with a given value, by every 1.1 cvs 1006: application processing the document in order to systematically add a piece of 1007: information to certain predefined elements of the document. By way of 1008: example, in a report containing a French abstract and an English abstract, 1009: each of the two abstracts is defined as a sequence of paragraphs. The first 1010: abstract has a value of ``French'' for the ``language'' attribute while the 1.18 cvs 1011: second abstract's ``language'' attribute has a value of ``English''.</p> 1.30 cvs 1012: 1013: <p>In the case of mark pairs, attributes are logically associated with the 1014: pair as a whole, but are actually attached to the first mark.</p> 1.18 cvs 1015: </div> 1.1 cvs 1016: 1.18 cvs 1017: <div class="subsection"> 1.30 cvs 1018: <h3><a name="sectc316">Discussion of the model</a></h3> 1.1 cvs 1019: 1.30 cvs 1020: <p>The notions of attribute, constructor, structured element, and associated 1.1 cvs 1021: element are used in the definition of generic logical structures of documents 1022: and objects. The problem is to assemble them to form generic structures. In 1023: fact, many types of elements and attributes can be found in a variety of 1024: generic structures. Rather than redefine them for each structure in which 1025: they appear, it is best to share them between structures. The object classes 1026: already fill this sharing function. If a mathematical class is defined, its 1027: formulas can be used in many different document classes, without redefining 1028: the structure of each class. This problem arises not only for the objects 1029: considered here; it also arises for the commonplace textual elements found in 1030: many document classes. This is the reason why the notion of object is so 1031: broad and why paragraphs and enumerations are also considered to be objects. 1032: These object classes not only permit the sharing of the structures of 1.18 cvs 1033: elements, but also of the attributes defined in the generic structures.</p> 1.30 cvs 1034: 1035: <p>Structure, such as that presented here, can appear very rigid, and it is 1.1 cvs 1036: possible to imagine that a document editing system based on this model could 1037: prove very constraining to the user. This is, in fact, a common criticism of 1038: syntax-directed editors. This defect can be avoided with Thot, primarily for 1.18 cvs 1039: three reasons:</p> 1040: <ul> 1.30 cvs 1041: <li>the generic structures are not fixed in the model itself,</li> 1042: <li>the model takes the dynamics of documents into account,</li> 1043: <li>the constructors offer great flexibility.</li> 1.18 cvs 1044: </ul> 1.30 cvs 1045: 1046: <p>When the generic structure of a document is not predefined, but rather is 1.1 cvs 1047: constructed specifically for each document class, it can be carefully adapted 1048: to the current needs. In cases where the generic structure is inadequate for 1049: a particular document of the class, it is always possible either to create a 1050: new class with a generic structure well suited to the new case or to extend 1051: the generic structure of the existing class to take into account the specifics 1052: of the document which poses the problem. These two solutions can also be 1.18 cvs 1053: applied to objects whose structures prove to be poorly designed.</p> 1.30 cvs 1054: 1055: <p>The model is sufficiently flexible to take into account all the phases of 1056: the life of the document. When a generic structure specifies that a report 1057: must contain a title, an abstract, an introduction, at least two chapters, and 1058: a conclusion, this means only that a report, <em>upon completion</em>, will 1059: have to contain all of these elements. When the author begins writing, none 1060: of these elements is present. Thot uses this model. Therefore, it tolerates 1.2 cvs 1061: documents which do not conform strictly to the generic structure of their 1062: class; it also considers the generic logical structure to be a way of helping 1.18 cvs 1063: the user in the construction of a complex document.</p> 1.30 cvs 1064: 1065: <p>In contrast, other applications may reject a document which does not 1066: conform strictly to its generic structure. This is, for example, what is done 1067: by compilers which refuse to generate code for a program which is not 1.1 cvs 1068: syntactically correct. This might also occur when using a document 1.18 cvs 1069: application for a report which does not have an abstract or title.</p> 1.30 cvs 1070: 1071: <p>The constructors of the document model bring a great flexibility to the 1.1 cvs 1072: generic structures. A choice constructor (and even more, a unit or schema 1073: constructor) can represent several, very different elements. The list 1074: constructor permits the addition of more elements of the same type. Used 1075: together, these two constructors permit any series of elements of different 1076: types. Of course, this flexibility can be reduced wherever necessary since a 1077: generic structure can limit the choices or the number of elements in a 1.18 cvs 1078: list.</p> 1.30 cvs 1079: 1080: <p>Another difficulty linked to the use of structure in the document model 1.1 cvs 1081: resides in the choice of the level of the structure. The structure of a 1082: discussion could be extracted from the text itself via linguistic analysis. 1083: Some studies are exploring this approach, but the model of Thot excludes this 1084: type of structure. It only takes into account the logical structure provided 1.18 cvs 1085: explicitly by the author.</p> 1.30 cvs 1086: 1087: <p>However, the level of structure of the model is not imposed. Each generic 1.1 cvs 1088: structure defines its own level of structure, adapted to the document class or 1089: object and to the ways in which it will be processed. If it will only be 1090: edited and printed, a relatively simple structure suffices. If more 1091: specialized processing will be applied to it, the structure must represent the 1092: element types on which this processing must act. By way of example, a simple 1093: structure is sufficient for printing formulas, but a more complex structure is 1094: required to perform symbolic or numeric calculations on the mathematical 1.18 cvs 1095: expressions. The document model of Thot allows both types of structure.</p> 1096: </div> 1097: </div> 1.1 cvs 1098: 1.18 cvs 1099: <div class="section"> 1.30 cvs 1100: <h2><a name="sectb32">The definition language for generic structures</a></h2> 1.1 cvs 1101: 1.30 cvs 1102: <p>Generic structures, which form the basis of the document model of Thot, are 1.1 cvs 1103: specified using a special language. This definition language, called S, is 1.18 cvs 1104: described in this section.</p> 1.30 cvs 1105: 1106: <p>Each generic structure, which defines a class of documents or objects, is 1.2 cvs 1107: specified by a file, written in the S language, which is called a 1.18 cvs 1108: <em>structure schema</em>. Structure schemas are compiled into tables, called 1109: structure tables, which are used by Thot and which determine its behavior.</p> 1.1 cvs 1110: 1.18 cvs 1111: <div class="subsection"> 1.30 cvs 1112: <h3><a name="sectc321">Writing Conventions</a></h3> 1.1 cvs 1113: 1.30 cvs 1114: <p>The grammar of S, like those of the languages P and T presented later, is 1.1 cvs 1115: described using the meta-language M, derived from the Backus-Naur Form 1.18 cvs 1116: (BNF).</p> 1.30 cvs 1117: 1118: <p>In this meta-language each rule of the grammar is composed of a grammar 1119: symbol followed by an equals sign (`=') and the right part of the rule. The 1120: equals sign plays the same role as the traditional `::=' of BNF: it indicates 1121: that the right part defines the symbol of the left part. In the right 1122: part,</p> 1.18 cvs 1123: <dl> 1.30 cvs 1124: <dt>concatenation</dt> 1125: <dd>is shown by the juxtaposition of symbols;</dd> 1126: <dt>character strings</dt> 1127: <dd>between apostrophes ' represent terminal symbols, that is, keywords in 1128: the language defined. Keywords are written here in upper-case letters, 1.31 cvs 1129: but can be written in any combination of upper and lower-case letters. 1.30 cvs 1130: For example, the keyword <tt>DEFPRES</tt> of S can also be written as 1131: <tt>defpres</tt> or <tt>DefPres</tt>.</dd> 1132: <dt>material between brackets</dt> 1133: <dd>(`[' and `]') is optional;</dd> 1134: <dt>material between angle brackets</dt> 1135: <dd>(`<' and `>') can be repeated many times or omitted;</dd> 1136: <dt>the slash</dt> 1137: <dd>(`/') indicates an alternative, a choice between the options separated 1138: by the slash character;</dd> 1139: <dt>the period</dt> 1140: <dd>marks the end of a rule;</dd> 1141: <dt>text between braces</dt> 1142: <dd>(`{' and `}') is simply a comment.</dd> 1.18 cvs 1143: </dl> 1.30 cvs 1144: 1145: <p>The M meta-language also uses the concepts of identifiers, strings, and 1.18 cvs 1146: integers:</p> 1147: <dl> 1.30 cvs 1148: <dt><tt>NAME</tt></dt> 1149: <dd>represents an identifier, a sequence of letters (upper or lower-case), 1150: digits, and underline characters (`_'), beginning with a letter. Also 1151: considered a letter is the sequence of characters `<tt>\nnn</tt>' where 1152: the letter <tt>n</tt> represents the ISO Latin-1 code of the letter in 1153: octal. It is thus possible to use accented letters in identifiers. The 1154: maximum length of identifiers is fixed by the compiler. It is normally 1155: 31 characters. 1156: <p>Unlike keywords, upper and lower-case letters are distinct in 1157: identifiers. Thus, <tt>Title</tt>, <tt>TITLE</tt>, and <tt>title</tt> 1158: are considered different identifiers.</p> 1159: </dd> 1160: <dt><tt>STRING</tt></dt> 1161: <dd>represents a string. This is a string of characters delimited by 1.31 cvs 1162: apostrophes. If an apostrophe must appear in a string, it is doubled. As 1163: with identifiers, strings can contain characters represented by their 1.30 cvs 1164: octal code (after a backslash). As with apostrophes, if a backslash 1165: must appear in a string, it is doubled.</dd> 1166: <dt><tt>NUMBER</tt></dt> 1167: <dd>represents a positive integer or zero (without a sign), or said 1168: another way, a sequence of decimal digits.</dd> 1.18 cvs 1169: </dl> 1.30 cvs 1170: 1171: <p>The M language can be used to define itself as follows:</p> 1.18 cvs 1172: <pre>{ Any text between braces is a comment. } 1.30 cvs 1173: Grammar = Rule < Rule > 'END' . 1174: { The < and > signs indicate zero } 1.1 cvs 1175: { or more repetitions. } 1176: { END marks the end of the grammar. } 1177: Rule = Ident '=' RightPart '.' . 1178: { The period indicates the end of a rule } 1179: RightPart = RtTerminal / RtIntermed . 1180: { The slash indicates a choice } 1181: RtTerminal ='NAME' / 'STRING' / 'NUMBER' . 1182: { Right part of a terminal rule } 1.30 cvs 1183: RtIntermed = Possibility < '/' Possibility > . 1.1 cvs 1184: { Right part of an intermediate rule } 1.30 cvs 1185: Possibility = ElemOpt < ElemOpt > . 1186: ElemOpt = Element / '[' Element < Element > ']' / 1187: '<' Element < Element > '>' . 1.1 cvs 1188: { Brackets delimit optional parts } 1189: Element = Ident / KeyWord . 1190: Ident = NAME . 1191: { Identifier, sequence of characters } 1192: KeyWord = STRING . 1193: { Character string delimited by apostrophes } 1.18 cvs 1194: END</pre> 1195: </div> 1.1 cvs 1196: 1.18 cvs 1197: <div class="subsection"> 1.30 cvs 1198: <h3><a name="sectc322">Extension schemas</a></h3> 1.1 cvs 1199: 1.30 cvs 1200: <p>A structure schema defines the generic logical structure of a class of 1.1 cvs 1201: documents or objects, independent of the operations which can be performed on 1202: the documents. However, certain applications may require particular 1203: information to be represented by the structure for the documents that they 1204: operate on. Thus a document version manager will need to indicate in the 1205: document the parts which belong to one version or another. An indexing system 1206: will add highly-structured index tables as well as the links between these 1.18 cvs 1207: tables and the rest of the document.</p> 1.30 cvs 1208: 1209: <p>Thus, many applications need to extend the generic structure of the 1210: documents on which they operate to introduce new attributes, associated 1211: elements or element types. These additions are specific to each application 1212: and must be able to be applied to any generic structure: users will want to 1213: manage versions or construct indices for many types of documents. Extension 1214: schemas fulfill this role: they define attributes, elements, associated 1215: elements, units, etc., but they can only be used jointly with a structure 1216: schema that they complete. Otherwise, structure schemas can always be used 1217: without these extensions when the corresponding applications are not 1218: available.</p> 1.18 cvs 1219: </div> 1.1 cvs 1220: 1.18 cvs 1221: <div class="subsection"> 1.30 cvs 1222: <h3><a name="sectc323">The general organization of structure schemas</a></h3> 1.1 cvs 1223: 1.30 cvs 1224: <p>Every structure schema begins with the keyword <tt>STRUCTURE</tt> and ends 1.18 cvs 1225: with the keyword <tt>END</tt>. The keyword <tt>STRUCTURE</tt> is followed by 1226: the keyword <tt>EXTENSION</tt> in the case where the schema defines an 1.1 cvs 1227: extension, then by the name of the generic structure which the schema defines 1228: (the name of the document or object class). The name of the structure is 1.18 cvs 1229: followed by a semicolon.</p> 1.30 cvs 1230: 1231: <p>In the case of a complete schema (that is, a schema which is not an 1.1 cvs 1232: extension), the definition of the name of the structure is followed by the 1233: declarations of the default presentation schema, the global attributes, the 1234: parameters, the structure rules, the associated elements, the units, the 1235: skeleton elements and the exceptions. Only the definition of the structure 1236: rules is required. Each series of declarations begins with a keyword: 1.18 cvs 1237: <tt>DEFPRES</tt>, <tt>ATTR</tt>, <tt>PARAM</tt>, <tt>STRUCT</tt>, 1238: <tt>ASSOC</tt>, <tt>UNITS</tt>, <tt>EXPORT</tt>, <tt>EXCEPT</tt>.</p> 1.30 cvs 1239: 1240: <p>In the case of an extension schema, there are neither parameters nor 1241: skeleton elements and the <tt>STRUCT</tt> section is optional, while that 1242: section is required in a schema that is not an extension. On the other hand, 1243: extension schemas can contain an <tt>EXTENS</tt> section, which must not 1244: appear in a schema which is not an extension; this section defines the 1245: complements to attach to the rules found in the schema to which the extension 1246: will be added. The sections <tt>ATTR</tt>, <tt>STRUCT</tt>, <tt>ASSOC</tt>, 1247: and <tt>UNITS</tt> define new attributes, new elements, new associated 1248: elements, and new units which add their definitions to the principal 1249: schema.</p> 1.18 cvs 1250: <pre> StructSchema ='STRUCTURE' ElemID ';' 1.1 cvs 1251: 'DEFPRES' PresID ';' 1252: [ 'ATTR' AttrSeq ] 1253: [ 'PARAM' RulesSeq ] 1254: 'STRUCT' RulesSeq 1255: [ 'ASSOC' RulesSeq ] 1256: [ 'UNITS' RulesSeq ] 1257: [ 'EXPORT' SkeletonSeq ] 1258: [ 'EXCEPT' ExceptSeq ] 1259: 'END' . 1.18 cvs 1260: ElemID = NAME .</pre> 1.30 cvs 1261: 1262: <p>or</p> 1.18 cvs 1263: <pre> ExtensSchema ='STRUCTURE' 'EXTENSION' ElemID ';' 1.1 cvs 1264: 'DEFPRES' PresID ';' 1265: [ 'ATTR' AttrSeq ] 1266: [ 'STRUCT' RulesSeq ] 1267: [ 'EXTENS' ExtensRuleSeq ] 1268: [ 'ASSOC' RulesSeq ] 1269: [ 'UNITS' RulesSeq ] 1270: [ 'EXCEPT' ExceptSeq ] 1271: 'END' . 1.18 cvs 1272: ElemID = NAME .</pre> 1273: </div> 1.1 cvs 1274: 1.18 cvs 1275: <div class="subsection"> 1.30 cvs 1276: <h3><a name="sectc324">The default presentation</a></h3> 1.1 cvs 1277: 1.30 cvs 1278: <p>It was shown <a href="#mulpres">above</a> that many different presentations 1.1 cvs 1279: are possible for documents and objects of the same class. The structure 1.18 cvs 1280: schema defines a preferred presentation for the class, called the <em>default 1281: presentation</em>. Like generic structures, presentations are described by 1282: programs, called <em>presentation schemas</em>, which are written in a 1283: specific language, P, presented <a href="#sectb42">later</a> in this document. 1284: The name appearing after the keyword <tt>DEFPRES</tt> is the name of the 1.2 cvs 1285: default presentation schema. When a new document is created, Thot will use 1286: this presentation schema by default, but the user remains free to choose 1.18 cvs 1287: another if s/he wishes.</p> 1288: <pre> PresID = NAME .</pre> 1289: </div> 1.1 cvs 1290: 1.18 cvs 1291: <div class="subsection"> 1.30 cvs 1292: <h3><a name="sectc325">Global Attributes</a></h3> 1.1 cvs 1293: 1.30 cvs 1294: <p>If the generic structure includes global attributes of its own, they are 1.18 cvs 1295: declared after the keyword <tt>ATTR</tt>. Each global attribute is defined by 1.1 cvs 1296: its name, followed by an equals sign and the definition of its type. The 1.18 cvs 1297: declaration of a global attribute is terminated by a semi-colon.</p> 1.30 cvs 1298: 1299: <p>For attributes of the numeric, textual, or reference types, the type is 1.18 cvs 1300: indicated by a keyword, <tt>INTEGER</tt>, <tt>TEXT</tt>, or <tt>REFERENCE</tt> 1301: respectively.</p> 1.30 cvs 1302: 1303: <p>In the case of a reference attribute, the keyword <tt>REFERENCE</tt> is 1.1 cvs 1304: followed by the type of the referenced element in parentheses. It can refer 1.18 cvs 1305: to any type at all, specified by using the keyword <tt>ANY</tt>, or to a 1.1 cvs 1306: specific type. In the latter case, the element type designated by the 1.18 cvs 1307: reference can be defined either in the <a href="#sectc327"><tt>STRUCT</tt> 1308: section</a> of the same structure schema or in the <tt>STRUCT</tt> section of 1.1 cvs 1309: another structure schema. When the type is defined in another schema, the 1310: element type is followed by the name of the structure schema (within 1311: parentheses) in which it is defined. The name of the designated element type 1.18 cvs 1312: can be preceded by the keyword <tt>First</tt> or <tt>Second</tt>, but only in 1313: the case where the type is defined as <a href="#sectd3285">a pair</a>. These 1.1 cvs 1314: keywords indicate whether the attribute must designate the first mark of the 1315: pair or the second. If the reference refers to a pair and neither of these 1.18 cvs 1316: two keywords is present, then the first mark is used.</p> 1.30 cvs 1317: 1318: <p>In the case of an enumeration attribute, the equals sign is followed by the 1.1 cvs 1319: list of names representing the possible values of the attribute, the names 1320: being separated from each other by commas. An enumeration attribute has at 1321: least one possible value; the maximum number of values is defined by the 1.18 cvs 1322: compiler for the S language.</p> 1.30 cvs 1323: <pre> AttrSeq = Attribute < Attribute > . 1.1 cvs 1324: Attribute = AttrID '=' AttrType ';' . 1325: AttrType = 'INTEGER' / 'TEXT' / 1326: 'REFERENCE' '(' RefType ')' / 1327: ValueSeq . 1328: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] . 1329: FirstSec = 'First' / 'Second' . 1330: ExtStruct = '(' ElemID ')' . 1.30 cvs 1331: ValueSeq = AttrVal < ',' AttrVal > . 1.1 cvs 1332: AttrID = NAME . 1.18 cvs 1333: AttrVal = NAME .</pre> 1.30 cvs 1334: 1335: <p>There is a predefined global text attribute, the <em>language</em>, which 1336: is automatically added to every Thot structure schema. This attribute allows 1.2 cvs 1337: Thot to perform certain actions, such as hyphenation and spell-checking, which 1338: cannot be performed without knowing the language in which each part of the 1339: document is written. This attribute can be used just like any explicitly 1.18 cvs 1340: declared attribute: the system acts as if every structure schema contains</p> 1341: <pre>ATTR 1342: Language = TEXT;</pre> 1.30 cvs 1343: 1.18 cvs 1344: <blockquote class="example"> 1.30 cvs 1345: <p><strong>Example:</strong></p> 1346: 1347: <p>The following specification defines the global enumeration attribute 1348: WordType.</p> 1349: <pre>ATTR 1.18 cvs 1350: WordType = Definition, IndexWord, DocumentTitle;</pre> 1351: </blockquote> 1352: </div> 1.1 cvs 1353: 1.18 cvs 1354: <div class="subsection"> 1.30 cvs 1355: <h3><a name="sectc326">Parameters</a></h3> 1.1 cvs 1356: 1.30 cvs 1357: <p>A parameter is a document element which can appear many times in the 1358: document, but always has the same value. This value can only be modified in a 1.1 cvs 1359: controlled way by certain applications. For example, in an advertising 1360: circular, the name of the recipient may appear in the address part and in the 1361: text of the circular. If the recipient's name were a parameter, it might only 1.18 cvs 1362: be able to be changed by a ``mail-merge'' application.</p> 1.30 cvs 1363: 1364: <p>Parameters are not needed for every document class, but if the schema 1365: includes parameters they are declared after the keyword <tt>PARAM</tt>. Each 1366: parameter declaration is made in the same way as a <a 1367: href="#sectc327">structure element declaration</a>.</p> 1368: 1369: <p>During editing, Thot permits the insertion of parameters wherever the 1.1 cvs 1370: structure schema allows; it also permits the removal of parameters which are 1371: already in the document but does not allow the modification of the parameter's 1.2 cvs 1372: content in any way. The content is generated automatically by Thot during the 1373: creation of the parameter, based on the value of the parameter in the 1.18 cvs 1374: document.</p> 1375: </div> 1.1 cvs 1376: 1.18 cvs 1377: <div class="subsection"> 1.30 cvs 1378: <h3><a name="sectc327">Structured elements</a></h3> 1.1 cvs 1379: 1.30 cvs 1380: <p>The rules for defining structured elements are required, except in an 1.1 cvs 1381: extension schema: they constitute the core of a structure schema, since they 1382: define the structure of the different types of elements that occur in a 1.18 cvs 1383: document or object of the class defined by the schema.</p> 1.30 cvs 1384: 1385: <p>The first structure rule after the keyword <tt>STRUCT</tt> must define the 1.1 cvs 1386: structure of the class whose name appears in the first instruction 1.18 cvs 1387: (<tt>STRUCTURE</tt>) of the schema. This is the root rule of the schema, 1388: defining the root of the document tree or object tree.</p> 1.30 cvs 1389: 1390: <p>The remaining rules may be placed in any order, since the language permits 1391: the definition of element types before or after their use, or even in the same 1.1 cvs 1392: instruction in which they are used. This last case allows the definition of 1.18 cvs 1393: recursive structures.</p> 1.30 cvs 1394: 1395: <p>Each rule is composed of a name (the name of the element type whose 1396: structure is being defined) followed by an equals sign and a structure 1397: definition.</p> 1398: 1399: <p>If any local attributes are associated with the element type defined by the 1.2 cvs 1400: rule, they appear between parentheses after the type name and before the 1.18 cvs 1401: equals sign. The parentheses contain, first, the keyword <tt>ATTR</tt>, then 1.2 cvs 1402: the list of local attributes, separated by commas. Each local attribute is 1403: composed of the name of the attribute followed by an equals sign and the 1.18 cvs 1404: definition of the attribute's type, just as in the definition of <a 1405: href="#sectc325">global attributes</a>. The name of the attribute can be 1.2 cvs 1406: preceded by an exclamation point to indicate that the attribute must always be 1407: present for this element type. The same attribute, identified by its name, 1408: can be defined as a local attribute for multiple element types. In this 1409: case, the equals sign and definition of the attribute type need only appear in 1410: the first occurrence of the attribute. It should be noted that global 1.18 cvs 1411: attributes cannot also be defined as local attributes.</p> 1.30 cvs 1412: 1413: <p>If any <a href="#sectd3135">extensions</a> are defined for this element 1414: type, a plus sign follows the structure definition and the names of the 1415: extension element types appear between parentheses after the plus. If there 1416: are multiple extensions, they are separated by commas. These types can either 1417: be defined in the same schema, defined in other schemas, or they may be base 1.18 cvs 1418: types identified by the keywords <tt>TEXT</tt>, <tt>GRAPHICS</tt>, 1419: <tt>SYMBOL</tt>, or <tt>PICTURE</tt>.</p> 1.30 cvs 1420: 1421: <p><a href="#sectd3135">Restrictions</a> are indicated in the same manner as 1.18 cvs 1422: extensions, but they are introduced by a minus sign and they come after the 1423: extensions, or if there are no extensions, after the structure definition.</p> 1.30 cvs 1424: 1425: <p>If the values of attributes must be attached systematically to this element 1.18 cvs 1426: type, they are introduced by the keyword <tt>WITH</tt> and declared in the 1.1 cvs 1427: form of a list of fixed-value attributes. When such definitions of fixed 1.18 cvs 1428: attribute values appear, they are always the last part of the rule.</p> 1.30 cvs 1429: 1430: <p>The rule is terminated by a semicolon.</p> 1431: <pre> RuleSeq = Rule < Rule > . 1.1 cvs 1432: Rule = ElemID [ LocAttrSeq ] '=' DefWithAttr ';'. 1.30 cvs 1433: LocAttrSeq = '(' 'ATTR' LocAttr < ';' LocAttr > ')' . 1.1 cvs 1434: LocAttr = [ '!' ] AttrID [ '=' AttrType ] . 1435: DefWithAttr = Definition 1436: [ '+' '(' ExtensionSeq ')' ] 1437: [ '-' '(' RestrictSeq ')' ] 1438: [ 'WITH' FixedAttrSeq ] . 1.30 cvs 1439: ExtensionSeq = ExtensionElem < ',' ExtensionElem > . 1.1 cvs 1440: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' / 1441: 'SYMBOL' / 'PICTURE' . 1.30 cvs 1442: RestrictSeq = RestrictElem < ',' RestrictElem > . 1.1 cvs 1443: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' / 1.18 cvs 1444: 'SYMBOL' / 'PICTURE' .</pre> 1.30 cvs 1445: 1446: <p>The list of fixed-value attributes is composed of a sequence of 1.1 cvs 1447: attribute-value pairs separated by commas. Each pair contains the name of the 1448: attribute and the fixed value for this element type, the two being separated 1449: by an equals sign. If the sign is preceded by a question mark the given value 1450: is only an initial value that may be modified later rather than a value fixed 1451: for all time. Reference attributes are an exception to this norm. They 1452: cannot be assigned a fixed value, but when the name of such an attribute 1453: appears this indicates that this element type must have a valid value for the 1.2 cvs 1454: attribute. For the other attribute types, the fixed value is indicated by a 1.1 cvs 1455: signed integer (numeric attributes), a character string between apostrophes 1.18 cvs 1456: (textual attributes) or the name of a value (enumeration attributes).</p> 1.30 cvs 1457: 1458: <p>Fixed-value attributes can either be <a href="#sectc325">global</a> or 1459: local to the element type for which they are fixed, but they must be declared 1460: before they are used.</p> 1461: <pre> FixedAttrSeq = FixedAttr < ',' FixedAttr > . 1.1 cvs 1462: FixedAttr = AttrID [ FixedOrModifVal ] . 1463: FixedOrModifVal = [ '?' ] '=' FixedValue . 1464: FixedValue = [ '-' ] NumValue / TextVal / AttrVal . 1465: NumValue = NUMBER . 1.18 cvs 1466: TextVal = STRING .</pre> 1467: </div> 1.1 cvs 1468: 1.18 cvs 1469: <div class="subsection"> 1.30 cvs 1470: <h3><a name="sectc328">Structure definitions</a></h3> 1.1 cvs 1471: 1.30 cvs 1472: <p>The structure of an element type can be a simple base type or a constructed 1.18 cvs 1473: type.</p> 1.30 cvs 1474: 1475: <p>For constructed types, it is frequently the case that similar structures 1.1 cvs 1476: appear in many places in a document. For example the contents of the 1477: abstract, of the introduction, and of a section can have the same structure, 1478: that of a sequence of paragraphs. In this case, a single, common structure 1479: can be defined (the paragraph sequence in this example), and the schema is 1480: written to indicate that each element type possesses this structure, as 1.18 cvs 1481: follows:</p> 1482: <pre> Abstract = Paragraph_sequence; 1.1 cvs 1483: Introduction = Paragraph_sequence; 1.18 cvs 1484: Section_contents = Paragraph_sequence;</pre> 1.30 cvs 1485: 1486: <p>The equals sign means ``has the same structure as''.</p> 1487: 1488: <p>If the element type defined is a simple base type, this is indicated by one 1489: of the keywords <tt>TEXT</tt>, <tt>GRAPHICS</tt>, <tt>SYMBOL</tt>, or 1.18 cvs 1490: <tt>PICTURE</tt>. If some local attributes must be associated with a base 1.1 cvs 1491: type, the keyword of the base type is followed by the declaration of the local 1.18 cvs 1492: attributes using the syntax <a href="#sectc327">presented above.</a></p> 1.30 cvs 1493: 1494: <p>In the case of an open choice, the type is indicated by the keyword 1.18 cvs 1495: <tt>UNIT</tt> for units or the keyword <tt>NATURE</tt> for objects having a 1496: structure defined by any other schema.</p> 1.30 cvs 1497: 1498: <p>A unit represents one of the two following categories:</p> 1.18 cvs 1499: <ul> 1.30 cvs 1500: <li>a base type: text, graphical element, symbol, picture,</li> 1501: <li>an element whose type is chosen from among the types defined as units in 1502: the <tt>UNITS</tt> section of the document's structure schema. It can 1503: also be chosen from among the types defined as <a 1504: href="#sectd3132">units</a> in the <a href="#sectc3212"><tt>UNITS</tt> 1505: section</a> of the structure schemas that defines the ancestors of the 1506: element to which the rule is applied.</li> 1.18 cvs 1507: </ul> 1.30 cvs 1508: 1509: <p>Before the creation of an element defined as a unit, Thot asks the user to 1.18 cvs 1510: choose between the categories of elements.</p> 1.30 cvs 1511: 1512: <p>Thus, the contents of a paragraph can be specified as a sequence of units, 1.1 cvs 1513: which will permit the inclusion in the paragraphs of character strings, 1514: symbols, and various elements, such as cross-references, if these are defined 1.18 cvs 1515: as units.</p> 1.30 cvs 1516: 1517: <p>A schema object (keyword <tt>NATURE</tt>) represents an object defined by a 1.1 cvs 1518: structure schema freely chosen from among the available schemas; in the case 1519: the element type is defined by the first rule (the root rule) of the chosen 1.18 cvs 1520: schema.</p> 1.30 cvs 1521: 1522: <p>If the element type defined is a constructed type, the list, aggregate, 1.1 cvs 1523: choice, and reference constructors are used. In this case the definition 1524: begins with a keyword identifying the constructor. This keyword is followed 1.18 cvs 1525: by a syntax specific to each constructor.</p> 1.30 cvs 1526: 1527: <p>The local attribute definitions appear after the name of the element type 1.18 cvs 1528: being defined, if this element type has <a href="#sectc327">local 1529: attributes</a>.</p> 1530: <pre> Definition = BaseType [ LocAttrSeq ] / Constr / Element . 1.1 cvs 1531: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 'PICTURE' / 1532: 'UNIT' / 'NATURE' . 1533: Element = ElemID [ ExtOrDef ] . 1534: ExtOrDef = 'EXTERN' / 'INCLUDED' / 1535: [ LocAttrSeq ] '=' Definition . 1536: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF' 1537: '(' DefWithAttr ')' / 1538: 'BEGIN' DefOptSeq 'END' / 1539: 'AGGREGATE' DefOptSeq 'END' / 1540: 'CASE' 'OF' DefSeq 'END' / 1541: 'REFERENCE' '(' RefType ')' / 1.18 cvs 1542: 'PAIR' .</pre> 1.1 cvs 1543: 1.18 cvs 1544: <div class="subsubsection"> 1.30 cvs 1545: <h4><a name="sectd3281">List</a></h4> 1.1 cvs 1546: 1.30 cvs 1547: <p>The list constructor permits the definition of an element type composed of 1548: a list of elements, all of the same type. A list definition begins with the 1.18 cvs 1549: <tt>LIST</tt> keyword followed by an optional range, the keyword <tt>OF</tt>, 1.1 cvs 1550: and the definition, between parentheses, of the element type which must 1551: compose the list. The optional range is composed of the minimum and maximum 1552: number of elements for the list separated by two periods and enclosed by 1553: brackets. If the range is not present, the number of list elements is 1554: unconstrained. When only one of the two bounds of the range is unconstrained, 1555: it is represented by a star ('*') character. Even when both bounds are 1.18 cvs 1556: unconstrained, they can be specified by <tt>[*..*]</tt>, but it is simpler not 1557: to specify any bound.</p> 1558: <pre> 'LIST' [ '[' min '..' max ']' ] 1.1 cvs 1559: 'OF' '(' DefWithAttr ')' 1560: min = Integer / '*' . 1561: max = Integer / '*' . 1.18 cvs 1562: Integer = NUMBER .</pre> 1.30 cvs 1563: 1564: <p>Before the document is edited, Thot creates the minimum number of elements 1565: for the list. If no minimum was given, it creates a single element. If a 1566: maximum number of elements is given and that number is attained, the editor 1567: refuses to create new elements for the list.</p> 1568: 1569: <blockquote class="example"> 1570: <p><strong>Example:</strong></p> 1571: 1572: <p>The following two instructions define the body of a document as a 1573: sequence of at least two chapters and the contents of a section as a 1574: sequence of paragraphs. A single paragraph can be the entire contents of a 1575: section.</p> 1576: <pre>Body = LIST [2..*] OF (Chapter); 1.18 cvs 1577: Section_contents = LIST OF (Paragraph);</pre> 1578: </blockquote> 1579: </div> 1.1 cvs 1580: 1.18 cvs 1581: <div class="subsubsection"> 1.30 cvs 1582: <h4><a name="sectd3282">Aggregate</a></h4> 1.1 cvs 1583: 1.30 cvs 1584: <p>The aggregate constructor is used to define an element type as a collection 1585: of sub-elements, each having a fixed type. The collection may be ordered or 1.1 cvs 1586: unordered. The elements composing the collection are called 1.18 cvs 1587: <em>components</em>. In the definition of an aggregate, a keyword indicates 1588: whether or not the aggregate is ordered: <tt>BEGIN</tt> for an ordered 1589: aggregate, <tt>AGGREGATE</tt> for an unordered aggregate. This keyword is 1.1 cvs 1590: followed by the list of component type definitions which is terminated by the 1.18 cvs 1591: <tt>END</tt> keyword. The component type definitions are separated by 1592: commas.</p> 1.30 cvs 1593: 1594: <p>Before creating an aggregate, the Thot editor creates all the aggregate's 1.1 cvs 1595: components in the order they appear in the structure schema, even for 1596: unordered aggregates. However, unlike ordered aggregates, the components of 1597: an unordered aggregate may be rearranged using operations of the Thot editor. 1598: The exceptions to the rule are any components whose name was preceded by a 1599: question mark character ('?'). These components, which are optional, can be 1600: created by explicit request, possibly at the time the aggregate is created, 1.18 cvs 1601: but they are not created automatically <em>prior</em> to the creation of the 1602: aggregate.</p> 1603: <pre> 'BEGIN' DefOptSeq 'END' 1.30 cvs 1604: DefOptSeq = DefOpt ';' < DefOpt ';' > . 1.18 cvs 1605: DefOpt = [ '?' ] DefWithAttr .</pre> 1.30 cvs 1606: 1.18 cvs 1607: <blockquote class="example"> 1.30 cvs 1608: <p><strong>Example:</strong></p> 1609: 1610: <p>In a bilingual document, each paragraph has an English version and a 1611: French version. In certain cases, the translator wants to add a marginal 1612: note, but this note is present in very few paragraphs. Thus, it must not be 1613: created systematically for every paragraph. A bilingual paragraph of this 1614: type is declared:</p> 1615: <pre>Bilingual_paragraph = BEGIN 1.1 cvs 1616: French_paragraph = TEXT; 1617: English_paragraph = TEXT; 1618: ? Note = TEXT; 1.18 cvs 1619: END;</pre> 1620: </blockquote> 1621: </div> 1.1 cvs 1622: 1.18 cvs 1623: <div class="subsubsection"> 1.30 cvs 1624: <h4><a name="sectd3283">Choice</a></h4> 1.1 cvs 1625: 1.30 cvs 1626: <p>The choice constructor permits the definition of an element type which is 1.18 cvs 1627: chosen from among a set of possible types. The keywords <tt>CASE</tt> and 1628: <tt>OF</tt> are followed by a list of definitions of possible types, which are 1629: separated by semicolons and terminated by the <tt>END</tt> keyword.</p> 1630: <pre> 'CASE' 'OF' DefSeq 'END' 1.30 cvs 1631: DefSeq = DefWithAttr ';' < DefWithAttr ';' > .</pre> 1632: 1633: <p>Before the creation of an element defined as a choice, the Thot editor 1.1 cvs 1634: presents the list of possible types for the element to the user. The user has 1.18 cvs 1635: only to select the element type that s/he wants to create from this list.</p> 1.30 cvs 1636: 1637: <p>The order of the type declarations is important. It determines the order 1638: of the list presented to the user before the creation of the element. Also, 1639: when a Choice element is being created automatically, the first type in the 1640: list is used. In fact, using the Thot editor, when an empty Choice element is 1.1 cvs 1641: selected, it is possible to select this element and to enter its text from 1642: keyboard. In this case, the editor uses the first element type which can 1.18 cvs 1643: contain an atom of the character string type.</p> 1.30 cvs 1644: 1645: <p>The two special cases of the choice constructor, the <a 1.18 cvs 1646: href="#sectc328"><em>schema</em></a> and the <a 1647: href="#sectc3212"><em>unit</em></a> are discussed elsewhere.</p> 1.30 cvs 1648: 1.18 cvs 1649: <blockquote class="example"> 1.30 cvs 1650: <p><strong>Example:</strong></p> 1651: 1652: <p>It is common in documents to treat a variety of objects as if they were 1653: ordinary paragraphs. Thus, a ``Paragraph'' might actually be composed of a 1654: block of text (an ordinary paragraph), or a mathematical formula whose 1655: structure is defined by another structure schema named Math, or a table, 1656: also defined by another structure schema. Here is a definition of such a 1657: paragraph:</p> 1658: <pre>Paragraph = CASE OF 1.1 cvs 1659: Simple_text = TEXT; 1660: Formula = Math; 1661: Table_para = Table; 1.18 cvs 1662: END;</pre> 1663: </blockquote> 1664: </div> 1.1 cvs 1665: 1.18 cvs 1666: <div class="subsubsection"> 1.30 cvs 1667: <h4><a name="sectd3284">Reference</a></h4> 1.1 cvs 1668: 1.30 cvs 1669: <p>Like all elements in Thot, references are typed. An element type defined 1670: as a reference is a cross-reference to an element of some other given type. 1671: The keyword <tt>REFERENCE</tt> is followed by the name of a type enclosed in 1.1 cvs 1672: parentheses. When the type which is being cross-referenced is defined in 1673: another structure schema, the type name is itself followed by the name of the 1.18 cvs 1674: external structure schema in which it is defined.</p> 1.30 cvs 1675: 1676: <p>When the designated element type is a <a href="#sectd3285">mark pair</a>, 1677: it can be preceded by a <tt>FIRST</tt> or <tt>SECOND</tt> keyword. These 1.18 cvs 1678: keywords indicate whether the reference points to the first or second mark of 1679: the pair. If the reference points to a pair and neither of these two keywords 1680: is present, the reference is considered to point to the first mark of the 1681: pair.</p> 1.30 cvs 1682: 1683: <p>There is an exception to the principle of typed references: it is possible 1684: to define a reference which designates an element of any type, which can 1685: either be in the same document or another document. In this case, it suffices 1686: to put the keyword <tt>ANY</tt> in the parentheses which indicate the 1687: referenced element type.</p> 1.18 cvs 1688: <pre> 'REFERENCE' '(' RefType ')' 1689: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] .</pre> 1.30 cvs 1690: 1691: <p>When defining an inclusion, the <tt>REFERENCE</tt> keyword is not used. 1.1 cvs 1692: Inclusions with complete expansion are not declared as such in the structure 1693: schemas, since any element defined in a structure schema can be replaced by an 1694: element of the same type. Instead, inclusions without expansion or with 1695: partial expansion must be declared explicitly whenever they will include a 1696: complete object ( and not a part of an object). In this case, the object type 1697: to be included (that is, the name of its structure schema) is followed by a 1.18 cvs 1698: keyword: <tt>EXTERN</tt> for inclusion without expansion and <tt>INCLUDED</tt> 1699: for partial expansion.</p> 1.30 cvs 1700: 1701: <p>Before creating a cross-reference or an inclusion, the Thot editor asks the 1.1 cvs 1702: user to choose, from the document images displayed, the referenced or included 1.18 cvs 1703: element.</p> 1.30 cvs 1704: 1.18 cvs 1705: <blockquote class="example"> 1.30 cvs 1706: <p><strong>Example:</strong></p> 1707: 1708: <p>If the types Note and Section are defined in the Article structure 1709: schema, it is possible to define, in the same structure schema, a reference 1710: to a note and a reference to a section in this manner:</p> 1711: <pre>Ref_note = REFERENCE (Note); 1.18 cvs 1712: Ref_section = REFERENCE (Section);</pre> 1.30 cvs 1713: 1714: <p>It is also possible to define the generic structure of a collection of 1715: articles, which include (with partial expansion) objects of the Article 1716: class and which possess an introduction which may include cross-references 1717: to sections of the included articles. In the Collection structure schema, 1718: the definitions are:</p> 1719: <pre>Collection = BEGIN 1.6 cvs 1720: Collection_title = TEXT; 1721: Introduction = LIST OF (Elem = CASE OF 1.1 cvs 1722: TEXT; 1723: Ref_sect; 1724: END); 1.6 cvs 1725: Body = LIST OF (Article INCLUDED); 1726: END; 1.18 cvs 1727: Ref_sect = REFERENCE (Section (Article));</pre> 1.30 cvs 1728: 1729: <p>Here we define a Folder document class which has a title and includes 1730: documents of different types, particularly Folders:</p> 1731: <pre>Folder = BEGIN 1.6 cvs 1732: Folder_title = TEXT; 1733: Folder_contents = LIST OF (Document); 1734: END; 1.1 cvs 1735: 1736: Document = CASE OF 1737: Article EXTERN; 1738: Collection EXTERN; 1739: Folder EXTERN; 1.18 cvs 1740: END;</pre> 1.30 cvs 1741: 1742: <p>Under this definition, Folder represents either an aggregate which 1743: contains a folder title and the list of included documents or an included 1744: folder. To resolve this ambiguity, in the P language, the placement of a 1745: star character in front of the type name (here, Folder) indicates an 1746: included document.</p> 1.18 cvs 1747: </blockquote> 1748: </div> 1.1 cvs 1749: 1.18 cvs 1750: <div class="subsubsection"> 1.30 cvs 1751: <h4><a name="sectd3285">Mark pairs</a></h4> 1.1 cvs 1752: 1.30 cvs 1753: <p>Like other elements, mark pairs are typed. The two marks of the pair have 1754: the same type, but there exist two predefined subtypes which apply to all mark 1.18 cvs 1755: pairs: the first mark of the pair (called <tt>First</tt> in the P and T 1756: languages) and the second mark (called <tt>Second</tt>).</p> 1.30 cvs 1757: 1758: <p>In the S language, a mark pair is noted simply by the <tt>PAIR</tt> 1.18 cvs 1759: keyword.</p> 1.30 cvs 1760: 1761: <p>In the Thot editor, marks are always moved or destroyed together. The two 1.1 cvs 1762: marks of a pair have the same identifier, unique within the document, which 1.18 cvs 1763: permits intertwining mark pairs without risk of ambiguity.</p> 1764: </div> 1765: </div> 1.1 cvs 1766: 1.18 cvs 1767: <div class="subsection"> 1.30 cvs 1768: <h3><a name="sectc329">Imports</a></h3> 1.1 cvs 1769: 1.30 cvs 1770: <p>Because of schema constructors, it is possible, before editing a document, 1771: to use classes defined by other structure schemas whenever they are needed. It 1772: is also possible to assign specific document classes to certain element types. 1773: In this case, these classes are simply designated by their name. In fact, if 1774: a type name is not defined in the structure schema, it is assumed that it 1.18 cvs 1775: specifies a structure defined by another structure schema.</p> 1.30 cvs 1776: 1.18 cvs 1777: <blockquote class="example"> 1.30 cvs 1778: <p><strong>Example:</strong></p> 1779: 1780: <p>If the types Math and Table don't appear in the left part of a structure 1781: rule in the schema, the following two rules indicate that a formula has the 1782: structure of an object defined by the structure schema Math and that a table 1783: element has the structure of an object defined by the Table schema.</p> 1784: <pre>Formula = Math; 1.18 cvs 1785: Table_elem = Table;</pre> 1786: </blockquote> 1787: </div> 1788: 1789: <div class="subsection"> 1.30 cvs 1790: <h3><a name="sectc3210">Extension rules</a></h3> 1.18 cvs 1791: 1.30 cvs 1792: <p>The <tt>EXTENS</tt> section, which can only appear in an extension schema, 1.1 cvs 1793: defines complements to the rules in the primary schema (i.e. the structure 1794: schema to which the extension schema will be applied). More precisely, this 1795: section permits the addition to an existing type of local attributes, 1.18 cvs 1796: extensions, restrictions and fixed-value attributes.</p> 1.30 cvs 1797: 1798: <p>These additions can be applied to the root rule of the primary schema, 1.18 cvs 1799: designated by the keyword <tt>Root</tt>, or to any other explicitly named 1800: rule.</p> 1.30 cvs 1801: 1802: <p>Extension rules are separated from each other by a semicolon and each 1.18 cvs 1803: extension rule has the same syntax as a <a href="#sectc327">structure 1804: rule</a>, but the part which defines the constructor is absent.</p> 1.30 cvs 1805: <pre> ExtenRuleSeq = ExtensRule ';' < ExtensRule ';' > . 1.6 cvs 1806: ExtensRule = RootOrElem [ LocAttrSeq ] 1807: [ '+' '(' ExtensionSeq ')' ] 1808: [ '-' '(' RestrictSeq ')' ] 1809: [ 'WITH' FixedAttrSeq ] . 1.18 cvs 1810: RootOrElem = 'Root' / ElemID .</pre> 1811: </div> 1.1 cvs 1812: 1.18 cvs 1813: <div class="subsection"> 1.30 cvs 1814: <h3><a name="sectc3211">Associated elements</a></h3> 1.1 cvs 1815: 1.30 cvs 1816: <p>If associated elements are necessary, they must be declared in a specific 1.18 cvs 1817: section of the structure schema, introduced by the keyword <tt>ASSOC</tt>. 1.1 cvs 1818: Each associated element type is specified like any other structured element. 1819: However, these types must not appear in any other element types of the schema, 1.18 cvs 1820: except in <tt>REFERENCE</tt> rules.</p> 1821: </div> 1.1 cvs 1822: 1.18 cvs 1823: <div class="subsection"> 1.30 cvs 1824: <h3><a name="sectc3212">Units</a></h3> 1825: 1826: <p>The <tt>UNITS</tt> section of the structure schema contains the 1827: declarations of the element types which can be used in the external objects 1828: making up parts of the document or in objects of the class defined by the 1829: schema. As with associated elements, these element types are defined just 1830: like other structured element types. They can be used in the other element 1831: types of the schema, but they can also be used in any other rule of the 1832: schema.</p> 1833: 1834: <blockquote class="example"> 1835: <p><strong>Example:</strong></p> 1.1 cvs 1836: 1.30 cvs 1837: <p>If references to notes are declared as units:</p> 1838: <pre>UNITS 1.18 cvs 1839: Ref_note = REFERENCE (Note);</pre> 1.30 cvs 1840: 1841: <p>then it is possible to use references to notes in a cell of a table, even 1842: when <tt>Table</tt> is an external structure schema. The <tt>Table</tt> 1843: schema must declare a cell to be a sequence of units, which can then be base 1844: element types (text, for example) or references to notes in the 1845: document.</p> 1846: <pre>Cell = LIST OF (UNITS);</pre> 1.18 cvs 1847: </blockquote> 1848: </div> 1.1 cvs 1849: 1.18 cvs 1850: <div class="subsection"> 1.30 cvs 1851: <h3><a name="sectc3213">Skeleton elements</a></h3> 1.1 cvs 1852: 1.30 cvs 1853: <p>When editing a document which contains or must contain external references 1854: to several other documents, it may be necessary to load a large number of 1.1 cvs 1855: documents, simply to see the parts designated by the external references of 1856: the document while editing, or to access the source of included elements. In 1857: this case, the external documents are not modified and it is only necessary to 1858: see the elements of these documents which could be referenced. Because of 1859: this, the editor will suggest that the documents be loaded in ``skeleton'' 1860: form. This form contains only the elements of the document explicitly 1.18 cvs 1861: mentioned in the <tt>EXPORT</tt> section of their structure schema and, for 1.1 cvs 1862: these elements, only the part of the contents specified in that section. This 1863: form has the advantage of being very compact, thus requiring very few 1864: resources from the editor. This is also the skeleton form which constitutes 1.18 cvs 1865: the expanded form of <a href="#inclusion">inclusions</a> with partial 1866: expansion.</p> 1.30 cvs 1867: 1868: <p>Skeleton elements must be declared explicitly in the <tt>EXPORT</tt> 1869: section of the structure schema that defines them. This section begins with 1870: the keyword <tt>EXPORT</tt> followed by a comma-separated list of the element 1.1 cvs 1871: types which must appear in the skeleton form and ending with a semicolon. 1.18 cvs 1872: These types must have been previously declared in the schema.</p> 1.30 cvs 1873: 1874: <p>For each skeleton element type, the part of the contents which is loaded by 1.1 cvs 1875: the editor, and therefore displayable, can be specified by putting the keyword 1.18 cvs 1876: <tt>WITH</tt> and the name of the contained element type to be loaded after 1.1 cvs 1877: the name of the skeleton element type. In this case only that named element, 1878: among all the elements contained in the exportable element type, will be 1.18 cvs 1879: loaded. If the <tt>WITH</tt> is absent, the entire contents of the skeleton 1.1 cvs 1880: element will be loaded by the editor. If instead, it is better that the 1881: skeleton form not load the contents of a particular element type, the keyword 1.18 cvs 1882: <tt>WITH</tt> must be followed by the word <tt>Nothing</tt>.</p> 1883: <pre> [ 'EXPORT' SkeletonSeq ] 1.1 cvs 1884: 1.30 cvs 1885: SkeletonSeq = SkelElem < ',' SkelElem > ';' . 1.1 cvs 1886: SkelElem = ElemID [ 'WITH' Contents ] . 1.18 cvs 1887: Contents = 'Nothing' / ElemID [ ExtStruct ] .</pre> 1.30 cvs 1888: 1.18 cvs 1889: <blockquote class="example"> 1.30 cvs 1890: <p><strong>Example:</strong></p> 1891: 1892: <p>Suppose that, in documents of the article class, the element types 1893: Article_title, Figure, Section, Paragraph, and Biblio should appear in the 1894: skeleton form in order to make it easier to create external references to 1895: them from other documents. When loading an article in its skeleton form, 1896: all of these element types will be loaded except for paragraphs, but only 1897: the article title will be loaded in its entirety. For figures, the caption 1898: will be loaded, while for sections, the title will be loaded, and for 1.31 cvs 1899: bibliographic entries, only the title that they contain will be loaded. Note 1900: that bibliographic elements are defined in another structure schema, RefBib. 1.32 ! cvs 1901: To produce this result, the following declarations should be placed in the 1.31 cvs 1902: Article structure schema:</p> 1.30 cvs 1903: <pre>EXPORT 1.1 cvs 1904: Article_title, 1.5 cvs 1905: Figure With Caption, 1.1 cvs 1906: Section With Section_title, 1907: Paragraph With Nothing, 1.18 cvs 1908: Biblio With Biblio_title(RefBib);</pre> 1909: </blockquote> 1910: </div> 1.1 cvs 1911: 1.18 cvs 1912: <div class="subsection"> 1.30 cvs 1913: <h3><a name="sectc3214">Exceptions</a></h3> 1.1 cvs 1914: 1.30 cvs 1915: <p>The behavior of the Thot editor and the actions that it performs are 1.1 cvs 1916: determined by the structure schemas. These actions are applied to all 1917: document and object types in accordance with their generic structure. For 1918: certain object types, such as tables and graphics, these actions are not 1919: sufficient or are poorly adapted and some special actions must be added to or 1920: substituted for certain standard actions. These special actions are called 1.18 cvs 1921: <em>exceptions</em>.</p> 1.30 cvs 1922: 1923: <p>Exceptions only inhibit or modify certain standard actions, but they can be 1.18 cvs 1924: used freely in every structure schema.</p> 1.30 cvs 1925: 1926: <p>Each structure schema can contain a section defining exceptions. It begins 1.18 cvs 1927: with the keyword <tt>EXCEPT</tt> and is composed of a sequence of exception 1.1 cvs 1928: declarations, separated by semicolons. Each declaration of an exception 1929: begins with the name of an element type or attribute followed by a colon. This 1930: indicates the element type or attribute to which the following exceptions 1.18 cvs 1931: apply. When the given element type name is a <a href="#sectd3285">mark 1932: pair</a>, and only in this case, the type name can be preceded by the keyword 1933: <tt>First</tt> or <tt>Second</tt>, to indicate if the exceptions which follow 1.1 cvs 1934: are associated with the first mark of the pair or the second. In the absence 1.18 cvs 1935: of this keyword, the first mark is used.</p> 1.30 cvs 1936: 1937: <p>When placed in an <a href="#sectc322">extension schema</a>, the keyword 1.18 cvs 1938: <tt>EXTERN</tt> indicates that the type name which follows is found in the 1.1 cvs 1939: principal schema (the schema being extended by the extension schema). The 1.18 cvs 1940: exceptions are indicated by a name. They are separated by semicolons.</p> 1941: <pre> [ 'EXCEPT' ExceptSeq ] 1.1 cvs 1942: 1.30 cvs 1943: ExceptSeq = Except ';' < Except ';' > . 1.1 cvs 1944: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr 1945: ':' ExcValSeq . 1946: ExcTypeOrAttr = ElemID / AttrID . 1.30 cvs 1947: ExcValSeq = ExcValue < ',' ExcValue > . 1.19 cvs 1948: ExcValue ='NoCut' / 'NoCreate' / 'NoHMove' / 1949: 'NoVMove' / 'NoHResize' / 'NoVResize' / 1950: 'NoMove' / 'NoResize' / 'MoveResize' / 1951: 'NewWidth' / 'NewHeight' / 'NewHPos' / 1952: 'NewVPos' / 'Invisible' / 1.28 cvs 1953: 'NoSelect' / 'NoSpellCheck' / 1.1 cvs 1954: 'Hidden' / 'ActiveRef' / 1955: 'ImportLine' / 'ImportParagraph' / 1956: 'NoPaginate' / 'ParagraphBreak' / 1.19 cvs 1957: 'PageBreak' / 'PageBreakAllowed' / 'PageBreakPlace' / 1958: 'PageBreakRepetition' / 'PageBreakRepBefore' / 1.9 cvs 1959: 'HighlightChildren' / 'ExtendedSelection' / 1.29 cvs 1960: 'ReturnCreateNL' / 'ReturnCreateWithin' / 1961: 'IsDraw' / 'IsTable' / 1.19 cvs 1962: 'IsRow' / 'IsColHead' / 'IsCell' / 1963: 'NewPercentWidth' / 'ColRef' / 'ColSpan' / 1964: 'RowSpan' / 'SaveDocument' / 'Shadow' .</pre> 1.30 cvs 1965: 1966: <p>The following are the available exceptions:</p> 1.18 cvs 1967: <dl> 1.30 cvs 1968: <dt><tt>NoCut</tt></dt> 1969: <dd>This exception can only be applied to element types. Elements of a 1970: type to which this exception is applied cannot be deleted by the 1971: editor.</dd> 1972: <dt><tt>NoCreate</tt></dt> 1973: <dd>This exception can only be applied to element types. Elements of a 1974: type to which this exception is applied cannot be created by ordinary 1975: commands for creating new elements. These elements are usually created 1976: by special actions associated with other exceptions.</dd> 1977: <dt><tt>NoHMove</tt></dt> 1978: <dd>This exception can only be applied to element types. Elements of a 1979: type to which this exception is applied cannot be moved horizontally 1980: with the mouse. Their children elements cannot be moved either.</dd> 1981: <dt><tt>NoVMove</tt></dt> 1982: <dd>This exception can only be applied to element types. Elements of a 1983: type to which this exception is applied cannot be moved vertically with 1984: the mouse. Their children elements cannot be moved either.</dd> 1985: <dt><tt>NoMove</tt></dt> 1986: <dd>This exception can only be applied to element types. Elements of a 1987: type to which this exception is applied cannot be moved in any direction 1988: with the mouse. Their children elements cannot be moved either.</dd> 1989: <dt><tt>NoHResize</tt></dt> 1990: <dd>This exception can only be applied to element types. Elements of a 1991: type to which this exception is applied cannot be resized horizontally 1992: with the mouse. Their children elements cannot be resized either.</dd> 1993: <dt><tt>NoVResize</tt></dt> 1994: <dd>This exception can only be applied to element types. Elements of a 1995: type to which this exception is applied cannot be resized vertically 1996: with the mouse. Their children elements cannot be resized either.</dd> 1997: <dt><tt>NoResize</tt></dt> 1998: <dd>This exception can only be applied to element types. Elements of a 1999: type to which this exception is applied cannot be resized in any 2000: direction with the mouse. Their children elements cannot be resized 2001: either.</dd> 2002: <dt><tt>MoveResize</tt></dt> 2003: <dd>This exception can only be applied to element types. Elements of a 2004: type to which this exception is applied can be moved and resized in any 2005: direction with the mouse, even if one of their ancestor element has an 2006: exception that prevents moving or resizing. Their children elements can 2007: also be resized or moved.</dd> 2008: <dt><tt>NewWidth</tt></dt> 2009: <dd>This exception can only be applied to numeric attributes. If the 2010: width of an element which has this attribute is modified with the mouse, 2011: the value of the new width will be assigned to the attribute.</dd> 2012: <dt><tt>NewHeight</tt></dt> 2013: <dd>This exception can only be applied to numeric attributes. If the 2014: height of an element which has this attribute is modified with the 2015: mouse, the value of the new height will be assigned to the 2016: attribute.</dd> 2017: <dt><tt>NewHPos</tt></dt> 2018: <dd>This exception can only be applied to numeric attributes. If the 2019: horizontal position of an element which has this attribute is modified 2020: with the mouse, the value of the new horizontal position will be 2021: assigned to the attribute.</dd> 2022: <dt><tt>NewVPos</tt></dt> 2023: <dd>This exception can only be applied to numeric attributes. If the 2024: vertical position of an element which has this attribute is modified 2025: with the mouse, the value of the new vertical position will be assigned 2026: to the attribute.</dd> 2027: <dt><tt>Invisible</tt></dt> 2028: <dd>This exception can only be applied to attributes, but can be applied 2029: to all attribute types. It indicates that the attribute must not be 2030: seen by the user and that its value must not be changed directly. This 2031: exception is usually used when another exception manipulates the value 2032: of an attribute.</dd> 2033: <dt><tt>NoSelect</tt></dt> 2034: <dd>This exception can only be applied to element types. Elements of a 2035: type to which this exception is applied cannot be selected directly 2036: with the mouse, but they can be selected by other methods provided by 2037: the editor.</dd> 2038: <dt>NoSpellCheck</dt> 2039: <dd>This exception can only be applied to element types. Elements of a 2040: type to which this exception is applied are not taken into account by 2041: the spell checker.</dd> 2042: <dt><tt>Hidden</tt></dt> 2043: <dd>This exception can only be applied to element types. It indicates 2044: that elements of this type, although present in the document's 2045: structure, must not be shown to the user of the editor. In particular, 2046: the creation menus must not propose this type and the selection message 2047: must not pick it.</dd> 2048: <dt><tt>ActiveRef</tt></dt> 2049: <dd>This exception can only be applied to attributes of the reference 2050: type. It indicates that when the user of the editor makes a double 2051: click on an element which possesses a reference attribute having this 2052: exception, the element designated by the reference attribute will be 2053: selected.</dd> 2054: <dt><tt>ImportLine</tt></dt> 2055: <dd>This exception can only be applied to element types. It indicates 2056: that elements of this type should receive the content of imported text 2057: files. An element is created for each line of the imported file. A 2058: structure schema cannot contain several exceptions <tt>ImportLine</tt> 2059: and, if it contains one, it should not contain any exception 2060: <tt>ImportParagraph</tt>.</dd> 2061: <dt><tt>ImportParagraph</tt></dt> 2062: <dd>This exception can only be applied to element types. It indicates 2063: that elements of this type should receive the content of imported text 1.31 cvs 2064: files. An element is created for each paragraph of the imported file. A 2065: paragraph is a sequence of lines without any empty line. A structure 1.30 cvs 2066: schema cannot contain several exceptions <tt>ImportParagraph</tt> and, 2067: if it contains one, it should not contain any exception 2068: <tt>ImportLine</tt>.</dd> 2069: <dt><tt>NoPaginate</tt></dt> 2070: <dd>This exception can only be applied to the root element, i.e. the name 2071: that appear after the keyword <tt>STRUCTURE</tt> at the beginning of the 2072: structure schema. It indicates that the editor should not allow the 2073: user to paginate documents of that type.</dd> 2074: <dt><tt>ParagraphBreak</tt></dt> 2075: <dd>This exception can only be applied to element types. When the caret 2076: is within an element of a type to which this exception is applied, it is 2077: that element that will be split when the user hits the Return key.</dd> 2078: <dt><tt>ReturnCreateNL</tt></dt> 2079: <dd>This exception can only be applied to element types. When the caret 2080: is within an element of a type to which this exception is applied, the 2081: Return key simply inserts a New line character (code \212) at the 2082: current position. The Return key does not create a new element; it does 2083: not split the current element either.</dd> 2084: <dt><tt>ReturnCreateWithin</tt></dt> 2085: <dd>This exception can only be applied to element types. When the caret 2086: is within an element of a type to which this exception is applied, the 2087: Return key will create a new element within that element, not a sibling 2088: after that element.</dd> 2089: <dt><tt>HighlightChildren</tt></dt> 2090: <dd>This exception can only be applied to element types. Elements of a 2091: type to which this exception is applied are not highlighted themselves 1.32 ! cvs 2092: when they are selected in the main view, but all their children are ! 2093: highlighted instead. If children have this exception too, the process is ! 2094: applied recursively. Only the main view defined in the presentation ! 2095: schema is concerned. Tee exception is ignored for other views.</dd> 1.30 cvs 2096: <dt><tt>ExtendedSelection</tt></dt> 2097: <dd>This exception can only be applied to element types. The selection 2098: extension command (middle button of the mouse) only add the clicked 2099: element (if it has that exception) to the current selection, without 2100: selecting other elements between the current selection and the clicked 2101: element.</dd> 2102: <dt>IsDraw, IsTable, IsColHead, IsRow, IsCell</dt> 2103: <dd>These exceptions can only be applied to element types. Elements of a 2104: type to which these exceptions are applied are identified as Draws, 2105: Tables, Colheads, Rows or Cells and specific processing are applied to 2106: them.</dd> 2107: <dt>ColRef</dt> 2108: <dd>This exception can only be applied to attributes of the reference 2109: type. It indicates that this attribute refers to the column head (see 2110: exception IsColHead) which the element belongs to.</dd> 2111: <dt>ColSpan, RowSpan</dt> 1.31 cvs 2112: <dd>These exceptions can only be applied to numeric attributes of cells. 1.30 cvs 2113: They indicate that attribute values give how many columns or rows the 2114: element spans.</dd> 2115: <dt>Shadow</dt> 2116: <dd>This exception can only be applied to element types. Text of elements 2117: of a type to which this exception is applied are displayed and printed 2118: as a set of stars ('*').</dd> 1.18 cvs 2119: </dl> 1.30 cvs 2120: 1.18 cvs 2121: <blockquote class="example"> 1.30 cvs 2122: <p><strong>Example:</strong></p> 2123: 2124: <p>Consider a structure schema for object-style graphics which defines the 2125: Graphic_object element type with the associated Height and Weight numeric 2126: attributes. Suppose that we want documents of this class to have the 2127: following qualities:</p> 2128: <ul> 2129: <li>Whenever the width or height of an object is changed using the mouse, 2130: the new values are stored in the object's Width and Height 2131: attributes.</li> 2132: <li>The user should not be able to change the values of the Width and 2133: Height attributes via the Attributes menu of the Thot editor.</li> 2134: </ul> 2135: 2136: <p>The following exceptions will produce this effect.</p> 2137: <pre>STRUCT 1.1 cvs 2138: ... 1.5 cvs 2139: Graphics_object (ATTR Height = Integer; Width = Integer) 1.1 cvs 2140: = GRAPHICS with Height ?= 10, Width ?= 10; 2141: ... 2142: EXCEPT 2143: Height: NewHeight, Invisible; 1.18 cvs 2144: Width: NewWidth, Invisible;</pre> 2145: </blockquote> 2146: </div> 2147: </div> 1.1 cvs 2148: 1.18 cvs 2149: <div class="section"> 1.30 cvs 2150: <h2><a name="sectb33">Some examples</a></h2> 1.1 cvs 2151: 1.30 cvs 2152: <p>In order to illustrate the principles of the document model and the syntax 2153: of the S language, this section presents two examples of structure schemas. 2154: One defines a class of documents, the other defines a class of objects.</p> 1.1 cvs 2155: 1.18 cvs 2156: <div class="subsection"> 1.30 cvs 2157: <h3><a name="sectc331">A class of documents: articles</a></h3> 1.1 cvs 2158: 1.30 cvs 2159: <p>This example shows a possible structure for articles published in a 2160: journal. Text between braces is comments.</p> 1.18 cvs 2161: <pre>STRUCTURE Article; { This schema defines the Article class } 1.1 cvs 2162: DEFPRES ArticleP; { The default presentation schema is 2163: ArticleP } 2164: ATTR { Global attribute definitions } 2165: WordType = Definition, IndexWord, DocumentTitle; 2166: { A single global attribute is defined, with three values } 2167: STRUCT { Definition of the generic structure } 2168: Article = BEGIN { The Article class has an aggregate 2169: structure } 2170: Title = BEGIN { The title is an aggregate } 2171: French_title = 2172: Text WITH Language='Fran\347ais'; 2173: English_title = 2174: Text WITH Language='English'; 2175: END; 2176: Authors = 2177: LIST OF (Author 2178: (ATTR Author_type=principal,secondary) 2179: { The Author type has a local attribute } 2180: = BEGIN 2181: Author_name = Text; 2182: Info = Paragraphs ; 2183: { Paragraphs is defined later } 2184: Address = Text; 2185: END 2186: ); 2187: Keywords = Text; 2188: { The journal's editor introduces the article 2189: with a short introduction, in French and 2190: in English } 2191: Introduction = 2192: BEGIN 2193: French_intr = Paragraphs WITH 2194: Language='Fran\347ais'; 2195: English_intr = Paragraphs WITH 2196: Language='English'; 2197: END; 2198: Body = Sections; { Sections are defined later } 2199: { Appendixes are only created on demand } 2200: ? Appendices = 2201: LIST OF (Appendix = 2202: BEGIN 2203: Appendix_Title = Text; 2204: Appendix_Contents = Paragraphs; 2205: END 2206: ); 2207: END; { End of the Article aggregate } 2208: 2209: Sections = LIST [2..*] OF ( 2210: Section = { At least 2 sections } 2211: BEGIN 2212: Section_title = Text; 2213: Section_contents = 2214: BEGIN 2215: Paragraphs; 2216: Sections; { Sections at a lower level } 2217: END; 2218: END 2219: ); 2220: 2221: Paragraphs = LIST OF (Paragraph = CASE OF 2222: Enumeration = 2223: LIST [2..*] OF 2224: (Item = Paragraphs); 2225: Isolated_formula = Formula; 2226: LIST OF (UNIT); 2227: END 2228: ); 2229: 2230: ASSOC { Associated elements definitions } 2231: 2232: Figure = BEGIN 1.5 cvs 2233: Figure_caption = Text; 1.1 cvs 2234: Illustration = NATURE; 2235: END; 2236: 2237: Biblio_citation = CASE OF 2238: Ref_Article = 2239: BEGIN 2240: Authors_Bib = Text; 2241: Article_Title = Text; 2242: Journal = Text; 2243: Page_Numbers = Text; 2244: Date = Text; 2245: END; 2246: Ref_Livre = 2247: BEGIN 2248: Authors_Bib; { Defined above } 2249: Book_Title = Text; 2250: Editor = Text; 2251: Date; { Defined above } 2252: END; 2253: END; 2254: 2255: Note = Paragraphs - (Ref_note); 2256: 2257: UNITS { Elements which can be used in objects } 2258: 2259: Ref_note = REFERENCE (Note); 2260: Ref_biblio = REFERENCE (Biblio_citation); 2261: Ref_figure = REFERENCE (Figure); 2262: Ref_formula = REFERENCE (Isolated_formula); 2263: 2264: EXPORT { Skeleton elements } 2265: 2266: Title, 1.5 cvs 2267: Figure with Figure_caption, 1.1 cvs 2268: Section With Section_title; 2269: 1.18 cvs 2270: END { End of the structure schema }</pre> 1.30 cvs 2271: 2272: <p>This schema is very complete since it defines both paragraphs and 1.1 cvs 2273: bibliographic citations. These element types could just as well be defined in 1.18 cvs 2274: other structure schemas, as is the case with the <tt>Formula</tt> class. All 1.1 cvs 2275: sorts of other elements can be inserted into an article, since a paragraph can 2276: contain any type of unit. Similarly, figures can be any class of document or 1.18 cvs 2277: object that the user chooses.</p> 1.30 cvs 2278: 2279: <p>Generally, an article doesn't contain appendices, but it is possible to add 1.1 cvs 2280: them on explicit request: this is the effect of the question mark before the 1.18 cvs 2281: word Appendices.</p> 1.30 cvs 2282: 2283: <p>The Figure, Biblio_citation and Note elements are associated elements. 2284: Thus, they are only used in <tt>REFERENCE</tt> statements.</p> 2285: 2286: <p>Various types of cross-references can be put in paragraphs. They can also 2287: be placed the objects which are part of the article, since the 2288: cross-references are defined as units (<tt>UNITS</tt>).</p> 2289: 2290: <p>There is a single restriction to prevent the creation of Ref_note elements 1.18 cvs 2291: within notes.</p> 1.30 cvs 2292: 2293: <p>It is worth noting that the S language permits the definition of recursive 1.1 cvs 2294: structures like sections: a section can contain other sections (which are thus 2295: at the next lower level of the document tree). Paragraphs are also recursive 2296: elements, since a paragraph can contain an enumeration in which each element 1.18 cvs 2297: (<tt>Item</tt>) is composed of paragraphs.</p> 2298: </div> 1.1 cvs 2299: 1.18 cvs 2300: <div class="subsection"> 1.30 cvs 2301: <h3><a name="sectc332">A class of objects: mathematical formulas</a></h3> 1.1 cvs 2302: 1.30 cvs 2303: <p>The example below defines the <tt>Formula</tt> class which is used in 2304: Article documents. This class represents mathematical formulas with a rather 2305: simple structure, but sufficient to produce a correct rendition on the screen 2306: or printer. To support more elaborate operations (formal or numeric 1.1 cvs 2307: calculations), a finer structure should be defined. This class doesn't use any 1.18 cvs 2308: other class and doesn't define any associated elements or units.</p> 2309: <pre>STRUCTURE Formula; 1.1 cvs 2310: DEFPRES FormulaP; 2311: 2312: ATTR 2313: String_type = Function_name, Variable_name; 2314: 2315: STRUCT 2316: Formula = Expression; 2317: Expression = LIST OF (Construction); 2318: Construction = CASE OF 2319: TEXT; { Simple character string } 2320: Index = Expression; 2321: Exponent = Expression; 2322: Fraction = 2323: BEGIN 1.6 cvs 2324: Numerator = Expression; 1.1 cvs 2325: Denominator = Expression; 2326: END; 2327: Root = 2328: BEGIN 2329: ? Order = TEXT; 2330: Root_Contents = Expression; 2331: END; 2332: Integral = 2333: BEGIN 2334: Integration_Symbol = SYMBOL; 2335: Lower_Bound = Expression; 2336: Upper_Bound = Expression; 2337: END; 2338: Triple = 2339: BEGIN 2340: Princ_Expression = Expression; 2341: Lower_Expression = Expression; 2342: Upper_Expression = Expression; 2343: END; 2344: Column = LIST [2..*] OF 2345: (Element = Expression); 2346: Parentheses_Block = 2347: BEGIN 2348: Opening = SYMBOL; 2349: Contents = Expression; 2350: Closing = SYMBOL; 2351: END; 2352: END; { End of Choice Constructor } 1.18 cvs 2353: END { End of Structure Schema }</pre> 1.30 cvs 2354: 2355: <p>This schema defines a single global attribute which allows functions and 1.1 cvs 2356: variables to be distinguished. In the presentation schema, this attribute can 2357: be used to choose between roman (for functions) and italic characters (for 1.18 cvs 2358: variables).</p> 1.30 cvs 2359: 2360: <p>A formula's structure is that of a mathematical expression, which is itself 2361: a sequence of mathematical constructions. A mathematical construction can be 1.1 cvs 2362: either a simple character string, an index, an exponent, a fraction, a root, 2363: etc. Each of these mathematical constructions has a sensible structure which 2364: generally includes one or more expressions, thus making the formula class's 1.18 cvs 2365: structure definition recursive.</p> 1.30 cvs 2366: 2367: <p>In most cases, the roots which appear in the formulas are square roots and 1.1 cvs 2368: their order (2) is not specified. This is why the Order component is marked 2369: optional by a question mark. When explicitly requested, it is possible to add 1.18 cvs 2370: an order to a root, for example for cube roots (order = 3).</p> 1.30 cvs 2371: 2372: <p>An integral is formed by an integration symbol, chosen by the user (simple 1.1 cvs 2373: integral, double, curvilinear, etc.), and two bounds. A more fine-grained 2374: schema would add components for the integrand and the integration variable. 2375: Similarly, the Block_Parentheses construction leaves the choice of opening and 2376: closing symbols to the user. They can be brackets, braces, parentheses, 1.18 cvs 2377: etc.</p> 2378: </div> 2379: </div> 2380: <hr> 2381: </div> 1.1 cvs 2382: 1.18 cvs 2383: <div class="chapter"> 2384: <h1><a name="sect4">The P Language</a></h1> 1.1 cvs 2385: 1.18 cvs 2386: <div class="section"> 1.30 cvs 2387: <h2><a name="sectb41">Document presentation</a></h2> 1.1 cvs 2388: 1.30 cvs 2389: <p>Because of the model adopted for Thot, the presentation of documents is 1.1 cvs 2390: clearly separated from their structure and content. After having presented 2391: the logical structure of documents, we now detail the principles implemented 1.18 cvs 2392: for their presentation. The concept of <em>presentation</em> encompasses what 1.5 cvs 2393: is often called the page layout, the composition, or the document style. It 1.18 cvs 2394: is the set of operations which display the document on the screen or print it 2395: on paper. Like logical structure, document presentation is defined 2396: generically with the help of a language, called P.</p> 1.1 cvs 2397: 1.18 cvs 2398: <div class="subsection"> 1.30 cvs 2399: <h3><a name="sectc411">Two levels of presentation</a></h3> 1.1 cvs 2400: 1.30 cvs 2401: <p>The link between structure and presentation is clear: the logical 2402: organization of a document is used to carry out its presentation, since the 2403: purpose of the presentation is to make evident the organization of the 2404: document. But the presentation is equally dependent on the device used to 2405: render the document. Certain presentation effects, notably changes of font or 2406: character set, cannot be performed on all printers or on all screens. This is 2407: why Thot uses a two-level approach, where the presentation is first described 2408: in abstract terms, without taking into account each particular device, and 2409: then the presentation is realized within the constraints of a given 2410: device.</p> 2411: 2412: <p>Thus, presentation is only described as a function of the structure of the 1.1 cvs 2413: documents and the image that would be produced on an idealized device. For 2414: this reason, presentation descriptions do not refer to any device 1.18 cvs 2415: characteristics: they describe <em>abstract presentations</em> which can be 2416: concretized on different devices.</p> 1.30 cvs 2417: 2418: <p>A presentation description also defines a <em>generic presentation</em>, 2419: since it describes the appearance of a class of documents or objects. This 2420: generic presentation must also be applied to document and object instances, 2421: each conforming to its generic logical structure, but with all the allowances 2422: that were called to mind above: missing elements, constructed elements with 2423: other logical structures, etc.</p> 2424: 2425: <p>In order to preserve the homogeneity between documents and objects, 1.1 cvs 2426: presentation is described with a single set of tools which support the layout 2427: of a large document as well as the composition of objects like a graphical 2428: figure or mathematical formula. This unity of presentation description tools 2429: contrasts with the traditional approach, which focuses more on documents than 2430: objects and thus is based on the usual typographic conventions, such as the 2431: placement of margins, indentations, vertical spaces, line lengths, 1.18 cvs 2432: justification, font changes, etc.</p> 2433: </div> 1.1 cvs 2434: 1.18 cvs 2435: <div class="subsection"> 1.30 cvs 2436: <h3><a name="sectc412">Boxes</a></h3> 1.1 cvs 2437: 1.30 cvs 2438: <p>To assure the homogeneity of tools, all presentation in Thot, for documents 2439: as well as for the objects which they contain, is based on the notion of the 1.18 cvs 2440: <em>box</em>, such as was implemented in T<sub><big>E</big></sub>X.</p> 1.30 cvs 2441: 2442: <p>Corresponding to each element of the document is a box, which is the 1.1 cvs 2443: rectangle enclosing the element on the display device (screen or sheet of 1.18 cvs 2444: paper); the outline of this rectangle is not visible, except when a <a 2445: href="#sectc4230a"><tt>ShowBox</tt> rule</a> applies to the element. The sides 2446: of the box are parallel to the sides of the screen or the sheet of paper. By 2447: way of example, a box is associated with a character string, a line of text, a 2448: page, a paragraph, a title, a mathematical formula, or a table cell.</p> 1.30 cvs 2449: 2450: <p>Whatever element it corresponds to, each box possesses four sides and four 1.18 cvs 2451: axes, which we designate as follows (<a href="#boxes">see figure</a>):</p> 2452: <dl> 1.30 cvs 2453: <dt><tt>Top</tt></dt> 2454: <dd>the upper side,</dd> 2455: <dt><tt>Bottom</tt></dt> 2456: <dd>the lower side,</dd> 2457: <dt><tt>Left</tt></dt> 2458: <dd>the left side,</dd> 2459: <dt><tt>Right</tt></dt> 2460: <dd>the right side,</dd> 2461: <dt><tt>VMiddle</tt></dt> 2462: <dd>the vertical axis passing through the center of the box,</dd> 2463: <dt><tt>HMiddle</tt></dt> 2464: <dd>the horizontal axis passing through the center of the box,</dd> 2465: <dt><tt>VRef</tt></dt> 2466: <dd>the vertical reference axis,</dd> 2467: <dt><tt>HRef</tt></dt> 2468: <dd>the horizontal reference axis.</dd> 1.18 cvs 2469: </dl> 2470: 2471: <div class="figure"> 2472: <hr> 2473: <pre> Left VRef VMiddle Right 1.1 cvs 2474: : : 2475: Top ----------------------------- 2476: | : : | 2477: | : : | 2478: | : : | 2479: | : : | 2480: | : : | 2481: HMiddle ..|...........................|.. 2482: | : : | 2483: | : : | 2484: HRef ..|...........................|.. 2485: | : : | 2486: | : : | 2487: Bottom ----------------------------- 1.18 cvs 2488: : :</pre> 1.30 cvs 2489: 2490: <p align="center"><em><a name="boxes">The sides and axes of 2491: boxes</a><em></em></em></p> 1.18 cvs 2492: <hr> 1.30 cvs 2493: </div> 1.19 cvs 2494: 1.30 cvs 2495: <p>The principal role of boxes is to set the extent and position of the images 2496: of the different elements of a document with respect to each other on the 1.1 cvs 2497: reproduction device. This is done by defining relations between the boxes of 2498: different elements which give relative extents and positions to these 1.18 cvs 2499: boxes.</p> 1.30 cvs 2500: 2501: <p>There are three types of boxes:</p> 1.18 cvs 2502: <ul> 1.30 cvs 2503: <li>boxes corresponding to structural elements of the document,</li> 2504: <li>presentation boxes,</li> 2505: <li>page layout boxes.</li> 1.18 cvs 2506: </ul> 1.30 cvs 2507: 2508: <p><strong>Boxes corresponding to structural elements of the document</strong> 1.1 cvs 2509: are those which linked to each of the elements (base or structured) of the 2510: logical structure of the document. Such a box contains all the contents of 1.18 cvs 2511: the element to which it corresponds (there is an exception: see <a 2512: href="#sectc4220">rules <tt>VertOverflow</tt> and <tt>HorizOverflow</tt></a>). 2513: These boxes form a tree-like structure, identical to that of the structural 2514: elements to which they correspond. This tree expresses the inclusion 2515: relationships between the boxes: a box includes all the boxes of its subtree. 2516: On the other hand, there are no predefined rules for the relative positions of 2517: the included boxes. If they are at the same level, they can overlap, be 2518: contiguous, or be disjoint. The rules expressed in the generic presentation 2519: specify their relative positions.</p> 1.30 cvs 2520: 2521: <p><strong>Presentation boxes</strong> represent elements which are not found 2522: in the logical structure of the document but which are added to meet the needs 2523: of presentation. These boxes are linked to the elements of the logical 2524: structure that are best suited to bringing them out. For example, they are 2525: used to add the character string ``Summary:'' before the summary in the 2526: presentation of a report or to represent the fraction bar in a formula, or 2527: also to make the title of a field in a form appear. These elements have no 2528: role in the logical structure of the document: the presence of a Summary 2529: element in the document does not require the creation of another structural 2530: object to hold the word ``Summary''. Similarly, if a Fraction element contains 2531: both a Numerator element and a Denominator element, the fraction bar has no 2532: purpose structurally. On the other hand, these elements of the presentation 2533: are important for the reader of the reproduced document or for the user of an 1.1 cvs 2534: editor. This is why they must appear in the document's image. It is the 2535: generic presentation which specifies the presentation boxes to add by 2536: indicating their content (a base element for which the value is specified) and 2537: the position that they must take in the tree of boxes. During editing, these 1.18 cvs 2538: boxes cannot be modified by the user.</p> 1.30 cvs 2539: 2540: <p><strong>Page layout boxes</strong> are boxes created implicitly by the page 1.1 cvs 2541: layout rules. These rules indicate how the contents of a structured element 2542: must be broken into lines and pages. In contrast to presentation boxes, these 2543: line and page boxes do not depend on the logical structure of the document, 1.18 cvs 2544: but rather on the physical constraints of the output devices: character size, 2545: height and width of the window on the screen or of the sheet of paper.</p> 2546: </div> 1.1 cvs 2547: 1.18 cvs 2548: <div class="subsection"> 1.30 cvs 2549: <h3><a name="sectc413">Views and visibility</a></h3> 1.1 cvs 2550: 1.30 cvs 2551: <p>One of the operations that one might wish to perform on a document is to 2552: view it is different ways. For this reason, it is possible to define several 1.18 cvs 2553: <em>views</em> for the same document, or better yet, for all documents of the 1.1 cvs 2554: same class. A view is not a different presentation of the document, but 2555: rather a filter which only allows the display of certain parts of the 2556: document. For example, it might be desirable to see only the titles of 2557: chapters and sections in order to be able to move rapidly through the 2558: document. Such a view could be called a ``table of contents''. It might also 2559: be desirable to see only the mathematical formulas of a document in order to 2560: avoid being distracted by the non-mathematical aspects of the document. A 1.18 cvs 2561: ``mathematics'' view could provide this service.</p> 1.30 cvs 2562: 2563: <p>Views, like presentation, are based on the generic logical structure. Each 1.1 cvs 2564: document class, and each generic presentation, can be provided with views 2565: which are particularly useful for that class or presentation. For each view, 1.18 cvs 2566: the <em>visibility</em> of elements is defined, indicated whether or not the 1.1 cvs 2567: elements must be presented to the user. The visibility is calculated as a 2568: function of the type of the elements or their hierarchical position in the 2569: structure of the document. Thus, for a table of contents, all the ``Chapter 2570: Title'' and ``Section Title'' elements are made visible. However, the 2571: hierarchical level could be used to make the section titles invisible below a 2572: certain threshold level. By varying this threshold, the granularity of the 2573: view can be varied. In the ``mathematics'' view, only Formula elements would 1.18 cvs 2574: be made visible, no matter what their hierarchical level.</p> 1.30 cvs 2575: 2576: <p>Because views are especially useful for producing a synthetic image of the 1.1 cvs 2577: document, it is necessary to adapt the presentation of the elements to the 2578: view in which they appear. For example, it is inappropriate to have a page 2579: break before every chapter title in the table of contents. Thus, generic 2580: presentations take into account the possible views and permit each element 1.18 cvs 2581: type's presentation to vary according the view in which its image appears.</p> 1.30 cvs 2582: 2583: <p><a name="views">Views</a> are also used, when editing documents, to display 1.1 cvs 2584: the associated elements. So, in addition to the primary view of the document, 2585: there can be a ``notes'' view and a ``figures'' view which contain, 2586: respectively, the associated elements of the Note and Figure types. In this 2587: way, it is possible to see simultaneously the text which refers to these 2588: elements and the elements themselves, even if they will be separated when 1.18 cvs 2589: printed.</p> 2590: </div> 1.1 cvs 2591: 1.18 cvs 2592: <div class="subsection"> 1.30 cvs 2593: <h3><a name="sectc414">Pages</a></h3> 1.1 cvs 2594: 1.30 cvs 2595: <p>Presentation schemas can be defined which display the document as a long 1.1 cvs 2596: scroll, without page breaks. This type of schema is particularly well-suited 2597: to the initial phase of work on a document, where jumps from page to page 2598: would hinder composing and reading the document on a screen. In this case, 2599: the associated elements (such as notes), which are normally displayed in the 2600: page footer, are presented in a separate window. But, once the document is 2601: written, it may be desirable to display the document on the screen in the same 2602: manner in which it will be printed. So, the presentation schema must define 1.18 cvs 2603: pages.</p> 1.30 cvs 2604: 2605: <p>The P language permits the specification of the dimensions of pages as well 2606: as their composition. It is possible to generate running titles, page 2607: numbers, zones at the bottom of the page for notes, etc. The editor follows 2608: this model and inserts page break marks in the document which are used during 2609: printing, insuring that the pages on paper are the same as on the screen.</p> 2610: 2611: <p>Once a document has been edited with a presentation schema defining pages, 2612: it contains page marks. But it is always possible to edit the document using 2613: a schema without pages. In this case, the page marks are simply ignored by 2614: the editor. They are considered again as soon as a schema with pages is used. 1.18 cvs 2615: Thus, the user is free to choose between schemas with and without pages.</p> 1.30 cvs 2616: 2617: <p>Thot treats the page break, rather than the page itself, as a box. This 2618: page break box contains all the elements of one page's footer, a rule marking 2619: the edge of this page, and all the elements of the next page's header. The 1.1 cvs 2620: elements of the header and footer can be running titles, page number, 2621: associated elements (notes, for example), etc. All these elements, as well as 2622: their content and graphical appearance, are defined by the generic 1.18 cvs 2623: presentation.</p> 2624: </div> 1.1 cvs 2625: 1.18 cvs 2626: <div class="subsection"> 1.30 cvs 2627: <h3><a name="sectc415">Numbering</a></h3> 1.1 cvs 2628: 1.30 cvs 2629: <p>Many elements are numbered in documents: pages, chapters, sections, 2630: formulas, theorems, notes, figures, bibliographic references, exercises, 2631: examples, lemmas, etc. Because Thot has a notion of logical structure, all of 2632: these numbers (with the exception of pages) are redundant with information 2633: implicit in the logical structure of the document. Such numbers are simply a 2634: way to make the structure of the document more visible. So, they are part of 2635: the document's presentation and are calculated by the editor from the logical 1.1 cvs 2636: structure. The structure does not contain numbers as such; it only defines 2637: relative structural positions between elements, which serve as ordering 1.18 cvs 2638: relations on these elements.</p> 1.30 cvs 2639: 2640: <p>If the structure schema defines the body of a document as a sequence of at 1.18 cvs 2641: least two chapters:</p> 2642: <pre>Body = LIST [2..*] OF Chapter;</pre> 1.30 cvs 2643: 2644: <p>the sequence defined by the list constructor is ordered and each chapter 2645: can be assigned a number based on its rank in the Body list. Therefore, all 1.18 cvs 2646: elements contained in lists a the structure of a document can be numbered, but 2647: they are not the only ones. The tree structure induced by the aggregate, 2648: list, and choice constructors (excluding references) defines a total order on 2649: the elements of the document's primary structure. So, it is possible to 2650: define a numbering which uses this order, filtering elements according to 2651: their type so that only certain element types are taken into account in the 2652: numbering. In this way, it possible to number all the theorems and lemmas of 2653: a chapter in the same sequence of numbers, even when they are not part of the 2654: same list constructor and appear at different levels of the document's tree. 2655: By changing the filter, they can be numbered separately: one sequence of 2656: numbers for theorems, another for the lemmas.</p> 1.30 cvs 2657: 2658: <p>Associated elements pose a special problem, since they are not part of the 1.1 cvs 2659: document's primary structure, but are attached only by references, which 2660: violate the total order of the document. Then, these associated elements are 2661: frequently numbered, precisely because the number is an effective way to 2662: visualize the reference. In order to resolve this problem, Thot implicitly 2663: defines a list constructor for each type of associated element, gathering 2664: together (and ordering) these elements. Thus, the associated elements can be 1.18 cvs 2665: numbered by type.</p> 1.30 cvs 2666: 2667: <p>Since they are calculated from the document's logical structure and only 2668: for the needs of the presentation, numbers are presentation elements, 2669: described by presentation boxes, just like the fraction bar or the word 2670: ``Summary''. Nevertheless, numbers differ from these other boxes because their 2671: content varies from instance to instance, even though they are of the same 2672: type, whereas all fraction bars are horizontal lines and the same word 2673: ``Summary'' appears at the head of every document's summary.</p> 1.18 cvs 2674: </div> 1.1 cvs 2675: 1.18 cvs 2676: <div class="subsection"> 1.30 cvs 2677: <h3><a name="sectc416">Presentation parameters</a></h3> 1.1 cvs 2678: 1.30 cvs 2679: <p>The principal parameters which determine document presentation are the 1.18 cvs 2680: <em>positions</em> and <em>dimensions</em> of boxes, the <em>font</em>, the 2681: <em>style</em>, the <em>size</em>, the <em>underlining</em> and the 2682: <em>color</em> of their content. From these parameters, and some others of 1.1 cvs 2683: less importance, it is possible to represent the usual typographic parameters 2684: for the textual parts of the document. These same parameters can be used to 2685: describe the geometry of the non-textual elements, even though they are 1.18 cvs 2686: two-dimensional elements unlike the text, which is linear.</p> 1.30 cvs 2687: 2688: <p>As we have already seen, the positions of the boxes always respect the 2689: rule of enclosure: a box in the tree encloses all the boxes of the next lower 2690: level which are attached to it. The positional parameters permit the 2691: specification of the position of each box in relation to the enclosing box or 2692: to its sibling boxes (boxes directly attached to the same enclosing box in the 2693: tree of boxes).</p> 2694: 2695: <p>The presentation parameters also provide control over the dimensions of the 1.1 cvs 2696: boxes. The dimensions of a box can depend either on its content or on its 2697: context (its sibling boxes and the enclosing box). Each dimension (height or 1.18 cvs 2698: width) can be defined independently of the other.</p> 1.30 cvs 2699: 2700: <p>Because of the position and dimension parameters, it is possible to do the 1.1 cvs 2701: same things that are normally done in typography by changing margins, line 2702: lengths, and vertical or horizontal skips. This approach can also align or 1.18 cvs 2703: center elements and groups of elements.</p> 1.30 cvs 2704: 2705: <p>In contrast to the position and dimension parameters, the font, style, 2706: size, underlining, and color do not concern the box itself (the rectangle 2707: delimiting the element), but its content. These parameters indicate the 2708: typographic attributes which must be applied to the text contained in the box, 2709: and by extension, to all base elements.</p> 2710: 2711: <p>For text, the font parameter is used to change the family of characters 1.1 cvs 2712: (Times, Helvetica, Courier, etc.); the style is used to obtain italic or 2713: roman, bold or light characters; the size determines the point size of the 2714: characters; underlining defines the type and thickness of the lines drawn 1.18 cvs 2715: above, below, or through the characters.</p> 1.30 cvs 2716: 2717: <p>For graphics, the line style parameter can be either solid, dotted, or 2718: dashed; the line thickness parameter controls the width of the lines; the fill 2719: pattern parameter determines how closed geometric figures must be filled.</p> 2720: 2721: <p>While some of the parameters which determine the appearance of a box's 1.1 cvs 2722: contents make sense only for one content type (text or graphic), other 2723: parameters apply to all content types: these are the color parameters. These 1.18 cvs 2724: indicate the color of lines and the background color.</p> 2725: </div> 2726: </div> 1.1 cvs 2727: 1.18 cvs 2728: <div class="section"> 1.30 cvs 2729: <h2><a name="sectb42">Presentation description language</a></h2> 2730: 2731: <p>A generic presentation defines the values of presentation parameters (or 2732: the way to calculate those values) for a generic structure, or more precisely, 2733: for all the element types and all the global and local attributes defined in 2734: that generic structure. This definition of the presentation parameters is 2735: made with the P language. A program written in this language, that is a 2736: generic presentation expressed in P, is call a <em>presentation schema</em>. 2737: This section describes the syntax and semantics of the language, using the 2738: same <a href="#sectc321">meta-language</a> as was used for the definition of 2739: the S language.</p> 1.1 cvs 2740: 1.30 cvs 2741: <p>Recall that it is possible to write many different presentation schemas for 1.1 cvs 2742: the same class of documents or objects. This allows users to choose for a 2743: document the graphical appearance which best suits their type of work or 1.18 cvs 2744: their personal taste.</p> 1.1 cvs 2745: 1.18 cvs 2746: <div class="subsection"> 1.30 cvs 2747: <h3><a name="sectc421">The organization of a presentation schema</a></h3> 1.1 cvs 2748: 1.30 cvs 2749: <p>A presentation schema begins with the word <tt>PRESENTATION</tt> and ends 2750: with the word <tt>END</tt>. The word <tt>PRESENTATION</tt> is followed by the 2751: name of the generic structure to which the presentation will be applied. This 2752: name must be the same as that which follows the keyword <tt>STRUCTURE</tt> in 2753: the structure schema associated with the presentation schema.</p> 2754: 2755: <p>After this declaration of the name of the structure, the following sections 1.18 cvs 2756: appear (in order):</p> 2757: <ul> 1.30 cvs 2758: <li>Declarations of 2759: <ul> 2760: <li>all views,</li> 2761: <li>printed views,</li> 2762: <li>counters,</li> 2763: <li>presentation constants,</li> 2764: <li>variables,</li> 2765: </ul> 2766: </li> 2767: <li>default presentation rules,</li> 2768: <li>presentation box and page layout box definitions,</li> 2769: <li>presentation rules for structured elements,</li> 2770: <li>presentation rules for attributes,</li> 2771: <li>rules for transmitting values to attributes of included documents.</li> 1.18 cvs 2772: </ul> 1.30 cvs 2773: 2774: <p>Each of these sections is introduced by a keyword which is followed by a 1.18 cvs 2775: sequence of declarations. Every section is optional.</p> 2776: <pre> SchemaPres ='PRESENTATION' ElemID ';' 1.1 cvs 2777: [ 'VIEWS' ViewSeq ] 2778: [ 'PRINT' PrintViewSeq ] 2779: [ 'COUNTERS' CounterSeq ] 2780: [ 'CONST' ConstSeq ] 2781: [ 'VAR' VarSeq ] 2782: [ 'DEFAULT' ViewRuleSeq ] 2783: [ 'BOXES' BoxSeq ] 2784: [ 'RULES' PresentSeq ] 2785: [ 'ATTRIBUTES' PresAttrSeq ] 2786: [ 'TRANSMIT' TransmitSeq ] 2787: 'END' . 1.18 cvs 2788: ElemID = NAME .</pre> 2789: </div> 1.1 cvs 2790: 1.18 cvs 2791: <div class="subsection"> 1.30 cvs 2792: <h3><a name="sectc422">Views</a></h3> 1.1 cvs 2793: 1.30 cvs 2794: <p>Each of the possible views must be declared in the presentation schema. As 1.18 cvs 2795: has <a href="#views">already been described</a>, the presentation rules for an 1.1 cvs 2796: element type can vary according to the view in which the element appears. The 2797: name of the view is used to designate the view to which the presentation rules 1.18 cvs 2798: apply (see the <a href="#inkeyword"><tt>IN</tt> instruction</a>). The 1.1 cvs 2799: definition of the view's contents are dispersed throughout the presentation 2800: rules attached to the different element types and attributes. The 1.18 cvs 2801: <tt>VIEWS</tt> section is simply a sequence of view names separated by commas 2802: and terminated by a semi-colon.</p> 1.30 cvs 2803: 2804: <p>One of the view names (and only one) can be followed by the keyword 1.18 cvs 2805: <tt>EXPORT</tt>. This keyword identifies the view which presents the members 2806: of the document class in <a href="#sectc3213">skeleton form</a>. The 2807: graphical appearance and the content of this view is defined just as with 2808: other views, but it is useless to specify presentation rules concerning this 2809: view for the elements which are not loaded in the skeleton form.</p> 1.30 cvs 2810: 2811: <p>It is not necessary to declare any views; in this case there is a single 1.1 cvs 2812: unnamed view. If many views are declared, the first view listed is considered 2813: the principal view. The principal view is the one to which all rules that are 1.18 cvs 2814: not preceded by an indication of a view will apply (see the <a 2815: href="#inkeyword">instruction <tt>IN</tt></a>).</p> 1.30 cvs 2816: 2817: <p>The principal view is the the one which the editor presents on the screen 2818: when the user asks to create or edit a document. Thus, it makes sense to put 2819: the most frequently used view at the head of the list. But if the structure 1.18 cvs 2820: schema contains <a href="#sectc3213">skeleton elements</a> and is loaded in 2821: its skeleton form, the view whose name is followed by the keyword 2822: <tt>EXPORT</tt> will be opened and no other views can be opened.</p> 2823: <pre> 'VIEWS' ViewSeq 1.1 cvs 2824: ViewSeq = ViewDeclaration 1.30 cvs 2825: < ',' ViewDeclaration > ';' . 1.1 cvs 2826: ViewDeclaration = ViewID [ 'EXPORT' ] . 1.18 cvs 2827: ViewID = NAME .</pre> 1.30 cvs 2828: 1.18 cvs 2829: <blockquote class="example"> 1.30 cvs 2830: <p><strong>Example:</strong></p> 2831: 2832: <p>When editing a report, it might be useful have views of the table of 2833: contents and of the mathematical formulas, in addition to the principal view 2834: which shows the document in its entirety. To achieve this, a presentation 2835: schema for the Report class would have the following <tt>VIEWS</tt> 2836: section:</p> 2837: <pre>VIEWS 1.18 cvs 2838: Full_text, Table_of_contents, Formulas;</pre> 1.30 cvs 2839: 2840: <p>The contents of these views are specified in the presentation rules of 2841: the schema.</p> 1.18 cvs 2842: </blockquote> 2843: </div> 1.1 cvs 2844: 1.18 cvs 2845: <div class="subsection"> 1.30 cvs 2846: <h3><a name="sectc423">Print Views</a></h3> 1.1 cvs 2847: 1.30 cvs 2848: <p>When editing a document, each view is presented in a different window. In 1.18 cvs 2849: addition to the views specified by the <tt>VIEWS</tt> instruction, the user 1.1 cvs 2850: can display the associated elements with one window for each type of 1.18 cvs 2851: associated element.</p> 1.30 cvs 2852: 2853: <p>When printing a document, it is possible to print any number of views, 2854: chosen from among all the views which the editor can display (views in the 2855: strict sense or associated elements). Print views, as well as the order in 2856: which they must be printed, are indicated by the <tt>PRINT</tt> instruction. 2857: It appears after the <tt>VIEWS</tt> instruction and is formed of the keyword 1.18 cvs 2858: <tt>PRINT</tt> followed by the ordered list of print view names. The print 1.1 cvs 2859: view names are separated by commas and followed by a semi-colon. A print view 1.18 cvs 2860: name is either a view name declared in the <tt>VIEWS</tt> instruction or the 1.1 cvs 2861: name of an associated element type (with an ``s'' added to the end). The 1.18 cvs 2862: associated element must have been declared in the <tt>ASSOC</tt> section of 2863: the structure schema.</p> 2864: <pre> 'PRINT' PrintViewSeq 1.30 cvs 2865: PrintViewSeq = PrintView < ',' PrintView > ';' . 1.18 cvs 2866: PrintView = ViewID / ElemID .</pre> 1.30 cvs 2867: 2868: <p>If the <tt>PRINT</tt> instruction is absent, the printing program will 2869: print only the principal view (the first view specified by the <tt>VIEWS</tt> 1.18 cvs 2870: instruction or the single, unnamed view when there is no <tt>VIEWS</tt> 2871: instruction).</p> 1.30 cvs 2872: 1.18 cvs 2873: <blockquote class="example"> 1.30 cvs 2874: <p><strong>Example:</strong></p> 2875: 2876: <p>Consider a Report presentation using the view declarations from the 2877: preceding example. Suppose we want to print the full text and table of 2878: contents views, but not the Formulas view, which is only useful when 2879: editing. In addition, suppose that we also want to print the bibliographic 2880: citations, which are associated elements (of type <tt>Citation</tt>). A 2881: sensible printing order would be to print the full text then the 2882: bibliography and finally the table of contents. To obtain this result when 2883: printing, the presentation schema would say:</p> 2884: <pre>PRINT 1.18 cvs 2885: Full_text, Citations, Table_of_contents;</pre> 2886: </blockquote> 2887: </div> 2888: 2889: <div class="subsection"> 1.30 cvs 2890: <h3><a name="sectc424">Counters</a></h3> 1.18 cvs 2891: 1.30 cvs 2892: <p>A presentation has a <em>counter</em> for each type of number in the 1.1 cvs 2893: presentation. All counters, and therefore all types of numbers, used in the 1.18 cvs 2894: schema must be declared after the <tt>COUNTERS</tt> keyword.</p> 1.30 cvs 2895: 2896: <p>Each counter declaration is composed of a name identifying the counter 1.1 cvs 2897: followed by a colon and the counting function to be applied to the counter. 1.18 cvs 2898: The counter declaration ends with a semi-colon.</p> 1.30 cvs 2899: 2900: <p>The counting function indicates how the counter values will be calculated. 1.16 cvs 2901: Three types of counting functions are available. The first type is used to 2902: count the elements of a list or aggregate: it assigns to the counter the rank 1.18 cvs 2903: of the element in the list or aggregate. More precisely, the function</p> 2904: <pre>RANK OF ElemID [ LevelAsc ] [ INIT AttrID ] 2905: [ 'REINIT' AttrID ]</pre> 1.30 cvs 2906: 2907: <p>indicates that when an element creates, by a creation rule (see the <a 1.18 cvs 2908: href="#sectc4232"><tt>Create</tt> instructions</a>), a presentation box 1.5 cvs 2909: containing the counter value, this value is the rank of the creating element, 1.18 cvs 2910: if it is of type <tt>ElemID</tt>, otherwise the rank of the first element of 2911: type <tt>ElemID</tt> which encloses the creating element in the logical 2912: structure of the document.</p> 1.30 cvs 2913: 2914: <p>The type name can be preceded by a star in the special case where the 1.18 cvs 2915: structure schema defines an element of whose <tt>ElemID</tt> is the same as 2916: that of an <a href="#sectd3284">inclusion</a> without expansion or with 2917: partial expansion. To resolve this ambiguity, the <tt>ElemID</tt> alone 2918: refers to the type defined in the structure schema while the <tt>ElemID</tt> 2919: preceded by a star refers to the included type.</p> 1.30 cvs 2920: 2921: <p>The type name <tt>ElemID</tt> can be followed by an integer. That number 1.1 cvs 2922: represents the relative level, among the ancestors of the creating element, of 1.18 cvs 2923: the element whose rank is asked. If that relative level <i>n</i> is unsigned, 2924: the <i>n</i><sup>th</sup> element of type <tt>ElemID</tt> encountered when 1.1 cvs 2925: travelling the logical structure from the root to the creating element is 1.16 cvs 2926: taken into account. If the relative level is negative, the logical structure 2927: is travelled in the other direction, from the creating element to the 1.18 cvs 2928: root.</p> 1.30 cvs 2929: 2930: <p>The function can end with the keyword <tt>INIT</tt> followed by the name of 2931: a numeric attribute (and only a numeric attribute). Then, the rank of the 2932: first element of the list or aggregate is considered to be the value of this 1.1 cvs 2933: attribute, rather than the default value of 1, and the rank of the other 2934: elements is shifted accordingly. The attribute which determines the initial 1.18 cvs 2935: value is searched on the element itself and on its ancestors.</p> 1.30 cvs 2936: 2937: <p>The function can end with the keyword <tt>REINIT</tt> followed by the name 2938: of a numeric attribute (and only a numeric attribute). Then, if an element to 2939: be counted has this attribute, the counter value for this element is the 1.1 cvs 2940: attribute value and the following elements are numbered starting from this 1.18 cvs 2941: value.</p> 1.30 cvs 2942: 2943: <p>When the <tt>RANK</tt> function is written</p> 1.18 cvs 2944: <pre>RANK OF Page [ ViewID ] [ INIT AttrID ]</pre> 1.30 cvs 2945: 2946: <p>(<tt>Page</tt>is a keyword of the P language), the counter takes as its 2947: value the number of the page on which the element which creates the 2948: presentation box containing the number appears. This is done as if the pages 2949: of the document form a list for each view. The counter only takes into 2950: account the pages of the relevant view, that is the view displaying the 2951: presentation box whose contents take the value of the number. However, if the 2952: keyword <tt>Page</tt> is followed by the name of a view (between parentheses), 2953: it is the pages of that view that are taken into account. As in the preceding 2954: form, the <tt>RANK</tt> function applied to pages can end with the 2955: <tt>INIT</tt> keyword followed by the name of a numeric attribute which sets 2956: the value of the first page's number. This attribute must be a local 2957: attribute of the document itself, and not of one of its components.</p> 2958: 2959: <p>The second counting function is used to count the occurrences of a certain 1.18 cvs 2960: element type in a specified context. The instruction</p> 2961: <pre>SET n ON Type1 ADD m ON Type2 [ INIT AttrID ]</pre> 1.30 cvs 2962: 2963: <p>says that when the document is traversed from beginning to end (in the 2964: order induced by the logical structure), the counter is assigned the value 1.18 cvs 2965: <tt>n</tt> each time an element of type <tt>Type1</tt> is encountered, no 2966: matter what the current value of the counter, and the value <tt>m</tt> is 2967: added to the current value of the counter each time an element of type 2968: <tt>Type2</tt> is encountered.</p> 1.30 cvs 2969: 2970: <p>As with the <tt>RANK</tt> function, the type names can be preceded by a 2971: star to resolve the ambiguity of included elements.</p> 2972: 2973: <p>If the function ends with the keyword <tt>INIT</tt> followed by the name of 2974: an attribute and if the document possesses this attribute, the value of this 1.18 cvs 2975: attribute is used in place of <tt>n</tt>. The attribute must be numeric. It 2976: is searched on the element itself and on its ancestors.</p> 1.30 cvs 2977: 2978: <p>This function can also be used with the <tt>Page</tt> keyword in the place 2979: of <tt>Type1</tt> or <tt>Type2</tt>. In the first case, the counter is 1.18 cvs 2980: reinitialized on each page with the value <tt>n</tt>, while in the second 2981: case, it is incremented by <tt>m</tt> on each page. As with the preceding 2982: counting function, the word <tt>Page</tt> can be followed by a name between 1.1 cvs 2983: parentheses. In this case, the name specifies a view whose pages are taken 1.18 cvs 2984: into account.</p> 1.30 cvs 2985: 2986: <p>The definition of a counter can contain several <tt>SET</tt> functions and 1.18 cvs 2987: several <tt>ADD</tt> functions, each with a different value. The total number 2988: of counting functions must not be greater than 6.</p> 1.30 cvs 2989: 2990: <p>The third counting function is used to count the elements of a certain type 1.16 cvs 2991: encountered when travelling from the creating element to the root of the 2992: logical structure. The creating element is included if it is of that type. 1.18 cvs 2993: That function is written</p> 2994: <pre>RLEVEL OF Type</pre> 1.30 cvs 2995: 2996: <p>where <tt>Type</tt> represents the type of the elements to be counted.</p> 2997: 2998: <p>The formal definition of counter declarations is:</p> 1.18 cvs 2999: <pre> 'COUNTERS' CounterSeq 1.30 cvs 3000: CounterSeq = Counter < Counter > . 1.1 cvs 3001: Counter = CounterID ':' CounterFunc ';' . 3002: CounterID = NAME . 3003: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ] 1.16 cvs 3004: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] / 1.30 cvs 3005: SetFunction < SetFunction > 3006: AddFunction < AddFunction > 1.16 cvs 3007: [ 'INIT' AttrID ] / 3008: 'RLEVEL' 'OF' ElemID . 1.1 cvs 3009: SLevelAsc = [ '-' ] LevelAsc . 3010: LevelAsc = NUMBER . 3011: SetFunction = 'SET' CounterValue 'ON' TypeOrPage . 3012: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . 3013: TypeOrPage = 'Page' [ '(' ViewID ')' ] / 1.16 cvs 3014: [ '*' ] ElemID . 1.18 cvs 3015: CounterValue = NUMBER .</pre> 1.30 cvs 3016: 1.18 cvs 3017: <blockquote class="example"> 1.30 cvs 3018: <p><strong>Example:</strong></p> 3019: 3020: <p>If the body of a chapter is defined as a sequence of sections in the 3021: structure schema:</p> 3022: <pre>Chapter_body = LIST OF (Section = 1.1 cvs 3023: BEGIN 3024: Section_Title = Text; 3025: Section_Body = Paragraphs; 3026: END 1.18 cvs 3027: );</pre> 1.30 cvs 3028: 3029: <p>the section counter is declared:</p> 3030: <pre>SectionCtr : RANK OF Section;</pre> 3031: 3032: <p>and the display of the section number before the section title is 3033: obtained by a <a href="#sectc4232"><tt>CreateBefore</tt> rule</a> attached 3034: the <tt>Section_Title</tt> type, which creates a presentation box whose 3035: content is the value of the <tt>SectionCtr</tt> counter (see the <a 3036: href="#sectc4231"><tt>Content</tt> instruction</a>).</p> 3037: 3038: <p>In order to number the formulas separately within each chapter, the 3039: formula counter is declared:</p> 3040: <pre>FormulaCtr : SET 0 ON Chapter ADD 1 ON Formula;</pre> 3041: 3042: <p>and the display of the formula number in the right margin, alongside each 3043: formula, is obtained by a <tt>CreateAfter</tt> instruction attached to the 3044: <tt>Formula</tt> type, which creates a presentation box whose content is the 3045: value of the <tt>FormulaCtr</tt> counter.</p> 3046: 3047: <p>To number the page chapter by chapter, with the first page of each 3048: chapter having the number 1, the counter definition would be</p> 3049: <pre>ChapterPageCtr : SET 0 ON Chapter ADD 1 ON Page;</pre> 3050: 3051: <p>If there is also a chapter counter</p> 3052: <pre>ChapterCtr : RANK OF Chapter;</pre> 3053: 3054: <p>the <a href="#sectc4231">content</a> of a presentation box created at the 3055: top of each page could be defined as:</p> 3056: <pre>Content : (VALUE(ChapterCtr, URoman) TEXT '-' 1.18 cvs 3057: VALUE(ChapterPageCtr, Arabic));</pre> 1.30 cvs 3058: 3059: <p>Thus, the presentation box contains the number of the chapter in 3060: upper-case roman numerals followed by a hyphen and the number of the page 3061: within the chapter in arabic numerals.</p> 1.18 cvs 3062: </blockquote> 1.30 cvs 3063: 1.18 cvs 3064: <blockquote class="example"> 1.30 cvs 3065: <p><strong>Example:</strong></p> 3066: 3067: <p>To count tables and figures together in a document of the chapter type, a 3068: counter could be defined using:</p> 3069: <pre>CommonCtr : SET 0 ON Chapter ADD 1 ON Table 1.18 cvs 3070: ADD 1 ON Figure;</pre> 3071: </blockquote> 3072: </div> 1.1 cvs 3073: 1.18 cvs 3074: <div class="subsection"> 1.30 cvs 3075: <h3><a name="sectc425">Presentation constants</a></h3> 1.1 cvs 3076: 1.30 cvs 3077: <p>Presentation constants are used in the definition of the content of 1.18 cvs 3078: presentation boxes. This content is used in <a href="#sectc426">variable 3079: definitions</a> and in the <a href="#sectc4231"><tt>Content</tt> rule</a>. The 1.1 cvs 3080: only presentation constants which can be used are character strings, 1.2 cvs 3081: mathematical symbols, graphical elements, and pictures, that is to say, base 1.18 cvs 3082: elements.</p> 1.30 cvs 3083: 3084: <p>Constants can be defined directly in the variables or presentation boxes 1.18 cvs 3085: (<tt>Content</tt> rule) which use them. But it is only necessary them to 1.1 cvs 3086: declare once, in the constant declaration section, even though they are used 3087: in many variables or boxes. Thus, each declared constant has a name, which 3088: allows it to be designated whenever it is used, a type (one of the four base 3089: types) and a value (a character string or a single character for mathematical 1.18 cvs 3090: symbols and graphical elements).</p> 1.30 cvs 3091: 3092: <p>The constant declarations appear after the keyword <tt>CONST</tt>. Each 1.1 cvs 3093: declaration is composed of the name of the constant, an equals sign, a keyword 1.18 cvs 3094: representing its type (<tt>Text</tt>, <tt>Symbol</tt>, <tt>Graphics</tt> or 3095: <tt>Picture</tt>) and the string representing its value. A semi-colon 3096: terminates each declaration.</p> 1.30 cvs 3097: 3098: <p>In the case of a character string, the keyword <tt>Text</tt> can be 3099: followed by the name of an alphabet (for example, <tt>Greek</tt> or 3100: <tt>Latin</tt>) in which the constant's text should be expressed. If the 3101: alphabet name is absent, the Latin alphabet is used. When the alphabet name 3102: is present, only the first letter of the alphabet name is interpreted. Thus, 3103: the words <tt>Greek</tt> and <tt>Grec</tt> designate the same alphabet. In 3104: current versions of Thot, only the Greek and Latin alphabets are 3105: available.</p> 1.18 cvs 3106: <pre> 'CONST' ConstSeq 1.30 cvs 3107: ConstSeq = Const < Const > . 1.1 cvs 3108: Const = ConstID '=' ConstType ConstValue ';' . 3109: ConstID = NAME . 3110: ConstType ='Text' [ Alphabet ] / 'Symbol' / 3111: 'Graphics' / 'Picture' . 3112: ConstValue = STRING . 1.18 cvs 3113: Alphabet = NAME .</pre> 1.30 cvs 3114: 3115: <p>For character strings in the Latin alphabet (ISO Latin-1 character set), 1.1 cvs 3116: characters having codes higher than 127 (decimal) are represented by their 1.18 cvs 3117: code in octal.</p> 1.30 cvs 3118: 3119: <p>In the case of a symbol or graphical element, the value only contains a 3120: single character, between apostrophes, which indicates the form of the element 3121: which must be drawn in the box whose content is the constant. The symbol or 1.1 cvs 3122: graphical element takes the dimensions of the box, which are determined by the 1.18 cvs 3123: <tt>Height</tt> and <tt>Width</tt> rules. See <a href="#sectb72">table of 3124: codes</a> for the symbols and graphical elements.</p> 1.30 cvs 3125: 1.18 cvs 3126: <blockquote class="example"> 1.30 cvs 3127: <p><strong>Example:</strong></p> 3128: 3129: <p>The constants ``Summary:'' and fraction bar, which were described 3130: earlier, are declared:</p> 3131: <pre>CONST 1.1 cvs 3132: SummaryConst = Text 'Summary:'; 1.18 cvs 3133: Bar = Graphics 'h';</pre> 3134: </blockquote> 3135: </div> 1.1 cvs 3136: 1.18 cvs 3137: <div class="subsection"> 1.30 cvs 3138: <h3><a name="sectc426">Variables</a></h3> 1.1 cvs 3139: 1.30 cvs 3140: <p>Variables permit the definition of computed content for presentation boxes. 3141: A variable is associated with a presentation box by a <tt>Content</tt> rule; 3142: but before being used in a <tt>Content</tt> rule, a variable can be defined in 3143: the <tt>VAR</tt> section. It is also possible to define a variable at the 3144: time of its use in a <tt>Content</tt> rule, as can be done with a 3145: constant.</p> 3146: 3147: <p>A variable has a name and a value which is a character string resulting 3148: from the concatenation of the values of a sequence of functions. Each 3149: variable declaration is composed of the variable name followed by a colon and 3150: the sequence of functions which produces its value, separated by spaces. Each 1.18 cvs 3151: declaration is terminated by a semi-colon.</p> 3152: <pre> 'VAR' VarSeq 1.30 cvs 3153: VarSeq = Variable < Variable > . 1.1 cvs 3154: Variable = VarID ':' FunctionSeq ';' . 3155: VarID = NAME . 1.30 cvs 3156: FunctionSeq = Function < Function > .</pre> 3157: 3158: <p>Several functions are available. The first two return, in the form of a 1.18 cvs 3159: character string, the current date. <tt>DATE</tt> returns the date in 3160: English, while <tt>FDATE</tt> returns the date in french.</p> 1.30 cvs 3161: 3162: <p>Two other functions, <tt>DocName</tt> and <tt>DirName</tt>, return the 1.18 cvs 3163: document name and the directory where the document is stored.</p> 1.30 cvs 3164: 3165: <p>Function <tt>ElemName</tt> returns the type of the element which created 3166: the presentation box whose contents are the variable.</p> 3167: 3168: <p>Another function simply returns the value of a presentation constant. For 3169: any constant declared in the <tt>CONST</tt> section, it is sufficient to give 3170: the name of the constant. Otherwise, the type and value of the constant must 3171: be given, using the same form as in a <a href="#sectc425">constant 1.18 cvs 3172: declaration</a>. If the constant is not of type text, (types <tt>Symbol</tt>, 3173: <tt>Graphics</tt> or <tt>Picture</tt>), it must be alone in the variable 3174: definition; only constants of type <tt>Text</tt> can be mixed with other 3175: functions.</p> 1.30 cvs 3176: 3177: <p>It is also possible to obtain the value of an attribute, simply by 3178: mentioning the attribute's name. The value of this function is the value of 3179: the attribute for the element which created the presentation box whose 3180: contents are the variable. If the creating element does not have the 3181: indicated attribute, the value is an empty string. In the case of a numeric 3182: attribute, the attribute is translated into a decimal number in arabic 3183: numerals. If another form is desired, the <tt>VALUE</tt> function must be 3184: used.</p> 3185: 3186: <p>The last available function returns, as a character string, the value of a 1.1 cvs 3187: counter, an attribute or a page number. This value can be presented in 1.18 cvs 3188: different styles. The keyword <tt>VALUE</tt> is followed (between 1.1 cvs 3189: parentheses) by the name of the counter, the name of the attribute, or the 1.18 cvs 3190: keyword <tt>PageNumber</tt> and the desired style, the two parameters being 1.1 cvs 3191: separated by a comma. The style is a keyword which indicates whether the 1.18 cvs 3192: value should be presented in arabic numerals (<tt>Arabic</tt>), lower-case 3193: roman numerals (<tt>LRoman</tt>), or upper-case roman numerals 3194: (<tt>URoman</tt>), or by an upper-case letter (<tt>Uppercase</tt>) or 3195: lower-case letter (<tt>Lowercase</tt>).</p> 1.30 cvs 3196: 3197: <p>For a page counter, the keyword <tt>PageNumber</tt> can be followed, 3198: between parentheses, by the name of the view from which to obtain the page 3199: number. By default, the first view declared in the <tt>VIEWS</tt> section is 3200: used. The value obtained is the number of the page on which is found the 3201: element that is using the variable in a <tt>Content</tt> rule.</p> 3202: 3203: <p>For an ordinary counter, the name of the counter can be preceded by the 1.18 cvs 3204: keyword <tt>MaxRangeVal</tt> or <tt>MinRangeVal</tt>. These keywords mean 1.1 cvs 3205: that the value returned by the function is the maximum (minimum resp.) value 3206: taken by the counter in the whole document, not the value for the element 1.18 cvs 3207: concerned by the function.</p> 3208: <pre> Function = 'DATE' / 'FDATE' / 1.1 cvs 3209: 'DocName' / 'DirName' / 3210: 'ElemName' / 'AttributeName' / 3211: ConstID / ConstType ConstValue / 3212: AttrID / 3213: 'VALUE' '(' PageAttrCtr ',' 3214: CounterStyle ')' . 1.6 cvs 3215: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] / 1.1 cvs 3216: [ MinMax ] CounterID / AttrID . 3217: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' / 3218: 'Uppercase' / 'Lowercase' . 1.18 cvs 3219: MinMax = 'MaxRangeVal' / 'MinRangeVal' .</pre> 1.30 cvs 3220: 1.18 cvs 3221: <blockquote class="example"> 1.30 cvs 3222: <p><strong>Example:</strong></p> 3223: 3224: <p>To make today's date appear at the top of the first page of a report, a 3225: <a href="#sectc4232"><tt>CREATE</tt> rule</a> associated with the 3226: Report_Title element type generates a presentation box whose content 3227: (specified by the <tt>Content</tt> rule of that presentation box) is the 3228: variable:</p> 3229: <pre>VAR 1.18 cvs 3230: Todays_date : TEXT 'Version of ' DATE;</pre> 1.30 cvs 3231: 3232: <p>To produce, before each section title, the chapter number (in upper-case 3233: roman numerals) followed by the section number (in arabic numerals), two 3234: counters must be defined:</p> 3235: <pre>COUNTERS 1.1 cvs 3236: ChapterCtr : RANK OF Chapter; 1.18 cvs 3237: SectionCtr : RANK OF Section;</pre> 1.30 cvs 3238: 3239: <p>and the Section_Title element must create a presentation box whose 3240: content is the variable</p> 3241: <pre>VAR 1.1 cvs 3242: SectionNum : VALUE (ChapterCtr, URoman) TEXT '-' 1.18 cvs 3243: VALUE (SectionCtr, Arabic);</pre> 1.30 cvs 3244: 3245: <p>In order to make the page number on which each section begins appear in 3246: the table of contents view next to the section title, each Section_Title 3247: element must create a presentation box, visible only in the table of 3248: contents view, whose content is the variable:</p> 3249: <pre>VAR 1.1 cvs 3250: TitlePageNume : 1.18 cvs 3251: VALUE (PageNumber(Full_text), Arabic);</pre> 3252: </blockquote> 3253: </div> 1.1 cvs 3254: 1.18 cvs 3255: <div class="subsection"> 1.30 cvs 3256: <h3><a name="sectc427">Default presentation rules</a></h3> 1.1 cvs 3257: 1.30 cvs 3258: <p>In order to avoid having to specify, for each element type defined in the 1.1 cvs 3259: structure schema, values for every one of the numerous presentation 3260: parameters, the presentation schema allows the definition of a set of default 3261: presentation rules. These rules apply to all the boxes of the elements 3262: defined in the structure schema and to the presentation boxes and page layout 3263: boxes defined in the presentation schema. Only rules which differ from these 1.18 cvs 3264: default need to be specified in other sections of the presentation schema.</p> 1.30 cvs 3265: 3266: <p>For the primary view, the default rules can define every presentation 1.18 cvs 3267: parameter, but not the <a href="#presfunct">presentation functions</a> or the 3268: <a href="#sectc4223">linebreaking conditions</a> (the <tt>NoBreak1</tt>, 3269: <tt>NoBreak2</tt>, and <tt>Gather</tt> rules).</p> 1.30 cvs 3270: 3271: <p>In a presentation schema, the default presentation rules section is 3272: optional; in this case, the <tt>DEFAULT</tt> keyword is also absent and the 3273: following rules are considered to be the default rules:</p> 1.26 cvs 3274: <pre> Visibility: Enclosing =; 3275: VertRef: * . Left; 3276: HorizRef: Enclosed . HRef; 3277: Height: Enclosed . Height; 3278: Width: Enclosed . Width; 3279: VertPos: Top = Previous . Bottom; 3280: HorizPos: Left = Enclosing . Left; 3281: MarginTop: 0; 3282: MarginRight: 0; 3283: MarginBottom: 0; 3284: MarginLeft: 0; 3285: PaddingTop: 0; 3286: PaddingRight: 0; 3287: PaddingBottom: 0; 3288: PaddingLeft: 0; 3289: BorderTopWidth: 0; 3290: BorderRightWidth: 0; 3291: BorderBottomWidth: 0; 3292: BorderLeftWidth: 0; 3293: BorderTopColor: Foreground; 3294: BorderRightColor: Foreground; 3295: BorderBottomColor: Foreground; 3296: BorderLeftColor: Foreground; 3297: BorderTopStyle: None; 3298: BorderRightStyle: None; 3299: BorderBottomStyle: None; 3300: BorderLeftStyle: None; 3301: VertOverflow: No; 3302: HorizOverflow: No; 3303: Size: Enclosing =; 3304: Style: Enclosing =; 3305: Weight: Enclosing =; 3306: Font: Enclosing =; 3307: Underline: Enclosing =; 3308: Thickness: Enclosing =; 3309: Indent: Enclosing =; 3310: LineSpacing: Enclosing =; 3311: Adjust: Enclosing =; 3312: Justify: Enclosing =; 3313: Hyphenate: Enclosing =; 3314: PageBreak: Yes; 3315: LineBreak: Yes; 3316: InLine: Yes; 3317: Depth: 0; 3318: LineStyle: Enclosing =; 3319: LineWeight: Enclosing =; 3320: FillPattern: Enclosing =; 3321: Background: Enclosing =; 3322: Foreground: Enclosing =;</pre> 1.30 cvs 3323: 3324: <p>If other values are desired for the default rules, they must be defined 1.1 cvs 3325: explicitly in the default rules section. In fact, it is only necessary to 3326: define those default rules which differ from the ones above, since the rules 1.18 cvs 3327: above will be used whenever a rule is not explicitly named.</p> 1.30 cvs 3328: 3329: <p>Default rules for views other than the primary view can also be specified. 1.1 cvs 3330: Otherwise, the default rules for the primary views are applied to the other 1.18 cvs 3331: views.</p> 1.30 cvs 3332: 3333: <p>Default rules are expressed in the same way as <a 3334: href="#sectc4215">explicit rules for document elements</a>.</p> 1.18 cvs 3335: </div> 1.1 cvs 3336: 1.18 cvs 3337: <div class="subsection"> 1.30 cvs 3338: <h3><a name="sectc428">Presentation and page layout boxes</a></h3> 1.1 cvs 3339: 1.30 cvs 3340: <p>The presentation process uses elements which are not part of the logical 1.1 cvs 3341: structure of the document, such as pages (which are the page layout boxes) or 3342: alternatively, rules, numbers, or words introducing certain parts of the 3343: document, such as ``Summary'', ``Appendices'', ``Bibliography'', etc. (which 1.18 cvs 3344: are presentation boxes).</p> 1.30 cvs 3345: 3346: <p>After the word <tt>BOXES</tt>, each presentation or page layout box is 3347: defined by its name and a sequence of presentation rules which indicate how 3348: they must be displayed. These rules are the same as those which define the 3349: boxes associated with element of the logical structure of the document, with a 1.18 cvs 3350: single exception, the <a href="#sectc4231"><tt>Content</tt> rule</a> which is 1.1 cvs 3351: used only to specify the content of presentation boxes. The content of boxes 3352: associated with elements of the document structure is defined in each document 3353: or object and thus is not specified in the presentation schema, which applies 1.18 cvs 3354: to all documents or objects of a class.</p> 1.30 cvs 3355: 3356: <p>Among the rules which define a presentation box, certain ones can refer to 1.1 cvs 3357: another presentation box (for example, in their positional rules). If the 3358: designated box is defined after the box which designates it, a 1.18 cvs 3359: <tt>FORWARD</tt> instruction followed by the name of the designated box must 3360: appear before the designation.</p> 3361: <pre> 'BOXES' BoxSeq 1.30 cvs 3362: BoxSeq = Box < Box > . 1.1 cvs 3363: Box ='FORWARD' BoxID ';' / 3364: BoxID ':' ViewRuleSeq . 1.18 cvs 3365: BoxID = NAME .</pre> 3366: </div> 1.1 cvs 3367: 1.18 cvs 3368: <div class="subsection"> 1.30 cvs 3369: <h3><a name="sectc429">Presentation of structured elements</a></h3> 1.1 cvs 3370: 1.30 cvs 3371: <p>After the words <tt>RULES</tt>, the presentation schema gives the 3372: presentation rules that apply to the elements whose types are defined in the 3373: structure schema. Only those rules which differ from the <a 1.18 cvs 3374: href="#sectc427">default</a> must be specified in the <tt>RULES</tt> 3375: section.</p> 1.30 cvs 3376: 3377: <p>The rule definitions for each element type are composed of the name of the 1.1 cvs 3378: element type (as specified in the structure schema) followed by a colon and 1.18 cvs 3379: the set of rules specific to that type.</p> 1.30 cvs 3380: 3381: <p>The type name can be preceded by a star in the special case where the 1.18 cvs 3382: structure schema defines an <a href="#sectd3284">inclusion</a> without 1.1 cvs 3383: expansion (or with partial expansion) of a type with the same name as an 1.18 cvs 3384: element of defined in the structure schema.</p> 1.30 cvs 3385: 3386: <p>In the case where the element is a <a href="#sectd3285">mark pair</a>, but 1.18 cvs 3387: only in this case, the type name can be preceded by the keywords 3388: <tt>First</tt> or <tt>Second</tt>. These keywords indicate whether the rules 3389: that follow apply to the first or second mark of the pair.</p> 3390: <pre> 'RULES' PresentSeq 1.30 cvs 3391: PresentSeq = Present < Present > . 1.6 cvs 3392: Present = [ '*' ] [ FirstSec ] ElemID ':' 3393: ViewRuleSeq . 1.18 cvs 3394: FirstSec = 'First' / 'Second' .</pre> 1.30 cvs 3395: 3396: <p>A presentation schema can define presentation rules for base elements, 3397: which are defined implicitly in the structure schemas. In the English version 3398: of the presentation schema compiler, the base type names are the same as in 3399: the S language, but they are terminated by the <tt>_UNIT</tt> suffix: 1.18 cvs 3400: <tt>TEXT_UNIT</tt>, <tt>PICTURE_UNIT</tt>, <tt>SYMBOL_UNIT</tt>, 3401: <tt>GRAPHICS_UNIT</tt>. The base type names are written in upper-case 3402: letters.</p> 3403: </div> 3404: 3405: <div class="subsection"> 1.30 cvs 3406: <h3><a name="sectc4210">Logical attribute presentation</a></h3> 1.18 cvs 3407: 1.30 cvs 3408: <p>After the keyword <tt>ATTRIBUTES</tt>, all attributes which are to have 3409: some effect on the presentation of the element to which they are attached must 3410: be mentioned, along with the corresponding presentation rules. This is true 3411: for both global attributes (which can be attached to all element types) and 3412: local attributes (which can only be attached to certain element types).</p> 3413: 3414: <p>Also mentioned in this section are attributes which imply an effect on 1.1 cvs 3415: elements in the subtree of the element to which they are attached. The 3416: presentation of these descendants can be modified as a function of the value 3417: of the attribute which they inherit, just as if it was attached to them 1.18 cvs 3418: directly.</p> 1.30 cvs 3419: 3420: <p>The specification for each attribute includes the attribute's name, 3421: followed by an optional value specification and, after a colon, a set of 3422: rules. The set of rules must contain at least one rule.</p> 3423: 3424: <p>When there is no value specification, the rules are applied to all elements 1.1 cvs 3425: which carry the attribute, no matter what their value. When the rules must 3426: only apply when the attribute has certain values, these values must be 1.18 cvs 3427: specified. Thus, the same attribute can appear in the <tt>ATTRIBUTES</tt> 1.1 cvs 3428: section several times, with each appearance having a different value 3429: specification. However, reference attributes never have a value specification 1.18 cvs 3430: and, as a result, can only appear once in the <tt>ATTRIBUTES</tt> section.</p> 1.30 cvs 3431: 3432: <p>To specify that the presentation rules apply to some of the descendants of 3433: the element having the attribute, the name of the affected element type is 3434: given, between parentheses, after the attribute name. This way, the 3435: presentation rules for the attribute will be applied to the element having the 3436: attribute, if it is of the given type, and to all of its descendants of the 3437: given type. In the case where this type is a <a href="#sectd3285">mark 3438: pair</a>, but only in this case, the type name can be preceded by the keywords 3439: <tt>First</tt> or <tt>Second</tt>. These keywords indicate whether the rules 3440: that follow apply to the first or second mark of the pair. If the rule must 3441: apply to several different element types, the specification must be repeated 3442: for each element type.</p> 3443: 3444: <p>The specification of values for which the presentation rules will be 3445: applied varies according to the type of the attribute:</p> 1.18 cvs 3446: <dl> 1.30 cvs 3447: <dt>numeric attribute</dt> 3448: <dd>If the rules are to apply for one value of the attribute, then the 3449: attribute name is followed by an equals sign and this value. If the 3450: rules are to apply for all values less than (or greater than) a 3451: threshold value, non-inclusive, the attribute name followed by a '<' 3452: sign (or a '>' sign, respectively) and the threshold value. If the 3453: rules must apply to a range of values, the attribute name is followed by 3454: the word '<tt>IN</tt>' and the two bounds of the range, enclosed in 3455: brackets and separated by two periods ('<tt>..</tt>'). In the case of 3456: ranges, the values of the bounds are included in the range. 3457: <p>The threshold value in the comparisons can be the value of an 3458: attribute attached to an ancestor element. In this case, the attribute 3459: name is given instead of a constant value.</p> 3460: <p>It is also possible to write rules which apply only when a comparison 3461: between two different attributes of the element's ancestors is true. In 3462: this case, the first attribute name is followed by a comparison keyword 3463: and the name of the second attribute. The comparison keywords are 3464: <tt>EQUAL</tt> (simple equality), <tt>LESS</tt> (non-inclusive less 3465: than), and <tt>GREATER</tt> (non-inclusive greater than).</p> 3466: </dd> 3467: <dt>text attribute</dt> 3468: <dd>If the rules are to apply for one value of the attribute, then the 3469: attribute name is followed by an equals sign and this value.</dd> 3470: <dt>reference attribute</dt> 3471: <dd>There is never a value specification; the rules apply no matter what 3472: element is designated by the attribute.</dd> 3473: <dt>enumerated attribute</dt> 3474: <dd>If the rules are to apply for one value of the attribute, then the 3475: attribute name is followed by an equals sign and this value.</dd> 1.18 cvs 3476: </dl> 1.30 cvs 3477: 3478: <p>The order in which the rules associated with a numeric attribute are 3479: defined is important. When multiple sets of rules can be applied, the first 3480: set declared is the one used.</p> 3481: 3482: <p>Rules for attributes have priority over both default rules and rules 1.1 cvs 3483: associated with element types. The attribute rules apply to the element to 3484: which the attribute is attached. It is the rules which apply to the 3485: surrounding elements (and especially to the descendants) which determine the 3486: effect of the attribute rules on the environment ( and especially on the 1.18 cvs 3487: terminal elements of the structure).</p> 3488: <pre> 'ATTRIBUTES' PresAttrSeq 1.30 cvs 3489: PresAttrSeq = PresAttr < PresAttr > . 1.1 cvs 3490: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ] 3491: [ AttrRelation ] ':' ViewRuleSeq . 3492: AttrID = NAME . 3493: AttrRelation ='=' AttrVal / 1.30 cvs 3494: '>' [ '-' ] MinValue / 1.1 cvs 3495: '<' [ '-' ] MaxValue / 3496: 'IN' '[' [ '-' ] LowerBound '..' 3497: [ '-' ] UpperBound ']' / 3498: 'GREATER' AttrID / 3499: 'EQUAL' AttrID / 3500: 'LESS' AttrID . 3501: AttrVal = [ '-' ] EqualNum / EqualText / 3502: AttrValue . 3503: MinValue = NUMBER . 3504: MaxValue = NUMBER . 3505: LowerBound = NUMBER . 3506: UpperBound = NUMBER. 3507: EqualNum = NUMBER . 3508: EqualText = STRING . 1.18 cvs 3509: AttrValue = NAME .</pre> 1.30 cvs 3510: 3511: <p>In presentation rules associated with a numeric attribute (and only in such 1.1 cvs 3512: rules), the attribute name can be used in place of a numeric value. In this 3513: case, the value of the attribute is used in the application of the rule. Thus, 3514: the attribute can represent a relation between the size of two boxes, the 3515: height and width of a box, the height of an area where page breaks are 3516: prohibited, the distance between two boxes, the position of the reference axis 3517: of a box, the interline spacing, the indentation of the first line, the 1.18 cvs 3518: visibility, the depth (z-order), or the character set.</p> 1.30 cvs 3519: 3520: <p>The presentation rules associated with reference attributes, it is possible 3521: to use the element designated by the attribute as a reference box in a 3522: positional or extent rule. This element is represented in the <a 1.18 cvs 3523: href="#sectc4218">position</a> or <a href="#sectc4219">extent</a> rule by the 3524: keyword <tt>Referred</tt>.</p> 1.30 cvs 3525: 1.18 cvs 3526: <blockquote class="example"> 1.30 cvs 3527: <p><strong>Example:</strong></p> 3528: 3529: <p>In all structure schemas, there is a global Language attribute defined as 3530: follows:</p> 3531: <pre>ATTR 1.18 cvs 3532: Language = TEXT;</pre> 1.30 cvs 3533: 3534: <p>The following rules would make French text be displayed in roman 3535: characters and English text be displayed in italics:</p> 3536: <pre>ATTRIBUTES 1.1 cvs 3537: Language = 'French' : 1.6 cvs 3538: Style : Roman; 1.1 cvs 3539: Language = 'English' : 1.18 cvs 3540: Style : Italics;</pre> 1.30 cvs 3541: 3542: <p>Using these rules, when the user puts the Language attribute with the 3543: value 'English' on the summary of a document, every character string 3544: (terminal elements) contained in the summary are displayed in italics. See 3545: the <a href="#sectd42252"><tt>Style</tt> rule</a>.</p> 1.18 cvs 3546: </blockquote> 1.30 cvs 3547: 1.18 cvs 3548: <blockquote class="example"> 1.30 cvs 3549: <p><strong>Example:</strong></p> 3550: 3551: <p>A numeric attribute representing the importance of the part of the 3552: document to which it is attached can be defined:</p> 3553: <pre>ATTR 1.18 cvs 3554: Importance = INTEGER;</pre> 1.30 cvs 3555: 3556: <p>In the presentation schema, the importance of an element is reflected in 3557: the choice of character size, using the following rules.</p> 3558: <pre>ATTRIBUTES 1.1 cvs 3559: Importance < 2 : 3560: Size : 1; 3561: Importance IN [2..4] : 3562: Size : Importance; 3563: Importance = 10 : 3564: Size : 5; 1.30 cvs 3565: Importance > 4 : 1.18 cvs 3566: Size : 4;</pre> 1.30 cvs 3567: 3568: <p>Thus, the character size corresponds to the value of the Importance 3569: attribute; its value is</p> 3570: <ul> 3571: <li>the value of the Importance attribute when the value is between 2 and 3572: 4 (inclusive),</li> 3573: <li>1, when the value of the Importance attribute is less than 2,</li> 3574: <li>4, when the value of the Importance attribute is greater than 4,</li> 3575: <li>5, when the value of the Importance attribute is 10.</li> 3576: </ul> 3577: 3578: <p>The last case (value 5) must be defined before the case which handles all 3579: Importance values greater than 4, because the two rules are not disjoint and 3580: the first one defined will have priority. Otherwise, when the Importance 3581: attribute has value 10, the font size will be 4.</p> 1.18 cvs 3582: </blockquote> 1.30 cvs 3583: 1.18 cvs 3584: <blockquote class="example"> 1.30 cvs 3585: <p><strong>Example:</strong></p> 3586: 3587: <p>Suppose the structure defines a list element which can have an attribute 3588: defining the type of list (numbered or not):</p> 3589: <pre>STRUCT 1.1 cvs 3590: list (ATTR list_type = enumeration, dash) 1.18 cvs 3591: = LIST OF (list_item = TEXT);</pre> 1.30 cvs 3592: 3593: <p>Then, the presentation schema could use the attribute placed on the list 3594: element to put either a dash or a number before the each element of the 3595: list:</p> 3596: <pre>ATTRIBUTES 1.1 cvs 3597: list_type (list_item) = enumeration : 3598: CreateBefore (NumberBox); 3599: list_type (list_item) = dash : 1.18 cvs 3600: CreateBefore (DashBox);</pre> 3601: </blockquote> 1.30 cvs 3602: 1.18 cvs 3603: <blockquote class="example"> 1.30 cvs 3604: <p><strong>Example:</strong></p> 3605: 3606: <p>Suppose that two attributes are defined in the structure schema. The 3607: first is a numeric global attribute called ``version''. The other is a 3608: local attribute defined on the root of the document called 3609: ``Document_version'':</p> 3610: <pre>STRUCTURE Document 1.1 cvs 3611: ATTR 3612: version = INTEGER; 3613: STRUCT 3614: Document (ATTR Document_version = INTEGER) = 3615: BEGIN 3616: SomeElement ; 3617: ... 3618: SomeOtherElement ; 3619: END ; 1.18 cvs 3620: ...</pre> 1.30 cvs 3621: 3622: <p>These attributes can be used in the presentation schema to place change 3623: bars in the margin next to elements whose version attribute has a value 3624: equal to the Document_version attribute of the root and to place a star in 3625: margin of elements whose version attribute is less than the value of the 3626: root's Document_version attribute:</p> 3627: <pre>ATTRIBUTES 1.1 cvs 3628: version EQUAL Document_version : 3629: CreateBefore (ChangeBarBox) ; 3630: version LESS Document_version : 1.18 cvs 3631: CreateBefore (StarBox) ;</pre> 3632: </blockquote> 3633: </div> 1.1 cvs 3634: 1.18 cvs 3635: <div class="subsection"> 1.30 cvs 3636: <h3><a name="sectc4212">Value transmission rules</a></h3> 1.1 cvs 3637: 1.30 cvs 3638: <p>The last section of a presentation schema, which is optional, serves to 1.1 cvs 3639: defines the way in which a document transmits certain values to its 1.18 cvs 3640: sub-documents. A sub-document is an document <a 3641: href="#inclusion">included</a> without expansion or with partial expansion. 1.1 cvs 3642: The primary document can transmit to its sub-documents the values of certain 3643: counters or the textual content of certain of its elements, as a function of 1.18 cvs 3644: their type.</p> 1.30 cvs 3645: 3646: <p>The sub-documents receive these values in attributes which must be defined 3647: in their structure schema as local attributes of the root element. The types 3648: of these attributes must correspond to the type of the value which they 3649: receive: numeric attributes for receiving the value of a counter, textual 3650: attributes for receiving the content of an element.</p> 3651: 3652: <p>In the structure schema of the primary document, there appears at the end, 1.18 cvs 3653: after the <tt>TRANSMIT</tt> keyword, a sequence of transmission rules. Each 1.1 cvs 3654: rule begins with the name of the counter to transmit or of the element type 3655: whose textual content will be transmitted. This name is followed by the 1.18 cvs 3656: keyword <tt>To</tt> and the name of the attribute of the sub-document to which 1.1 cvs 3657: the value is transmitted. The sub-document class is indicated between 3658: parentheses after the name of the attribute. The transmission rule ends with 1.18 cvs 3659: a semicolon.</p> 1.30 cvs 3660: <pre> TransmitSeq = Transmit < Transmit > . 1.1 cvs 3661: Transmit = TypeOrCounter 'To' ExternAttr 3662: '(' ElemID ')' ';' . 3663: TypeOrCounter = CounterID / ElemID . 1.18 cvs 3664: ExternAttr = NAME .</pre> 1.30 cvs 3665: 1.18 cvs 3666: <blockquote class="example"> 1.30 cvs 3667: <p><strong>Example:</strong></p> 3668: 3669: <p>Consider a Book document class which includes instances of the Chapter 3670: document class. These classes might have the following schemas:</p> 3671: <pre>STRUCTURE Book 1.1 cvs 3672: STRUCT 3673: Book = BEGIN 3674: Title = Text; 3675: Body = LIST OF (Chapter INCLUDED); 3676: END; 3677: ... 3678: 3679: STRUCTURE Chapter 3680: STRUCT 3681: Chapter (ATTR FirstPageNum = Integer; 3682: ChapterNum = Integer; 3683: CurrentTitle = Text) = 1.6 cvs 3684: BEGIN 3685: ChapterTitle = Text; 3686: ... 3687: END; 1.18 cvs 3688: ...</pre> 1.30 cvs 3689: 3690: <p>Then the presentation schema for books could define chapter and page 3691: counters. The following transmission rules in the book presentation schema 3692: would transmit values for the three attributes defined at the root of each 3693: chapter sub-document.</p> 3694: <pre>PRESENTATION Book; 1.1 cvs 3695: VIEWS 3696: Full_text; 3697: COUNTERS 3698: ChapterCtr: Rank of Chapter; 3699: PageCtr: Rank of Page(Full_text); 3700: ... 3701: TRANSMIT 3702: PageCtr TO FirstPageNum(Chapter); 3703: ChapterCtr TO ChapterNum(Chapter); 3704: Title TO CurrentTitle(Chapter); 1.18 cvs 3705: END</pre> 1.30 cvs 3706: 3707: <p>Thus, each chapter included in a book can number its pages as a function 3708: of the number of pages preceding it in the book, can make the chapter's 3709: number appear before the number of each of its sections, or can place the 3710: title of the book at the top of each page.</p> 1.18 cvs 3711: </blockquote> 3712: </div> 1.1 cvs 3713: 1.18 cvs 3714: <div class="subsection"> 1.30 cvs 3715: <h3><a name="sectc4213">Presentation rules</a></h3> 1.1 cvs 3716: 1.30 cvs 3717: <p>Whether defining the appearance of a presentation or page layout box, an 1.1 cvs 3718: element type, or an attribute value, the set of presentation rules that apply 1.18 cvs 3719: is always defined in the same way.</p> 1.30 cvs 3720: 3721: <p>Normally, a set of presentation rules is placed between the keywords 1.18 cvs 3722: <tt>BEGIN</tt> and <tt>END</tt>, the keyword <tt>END</tt> being followed by a 1.1 cvs 3723: semicolon. The first section of this block defines the rules that apply to 1.18 cvs 3724: the primary view, if the <a href="#sectc427">default rules</a> are not 1.1 cvs 3725: completely suitable. Next comes the rules which apply to specific other 3726: views, with a rule sequence for each view for which the default rules are not 3727: satisfactory. If the default rules are suitable for the non-primary views, 3728: there will not be any specific rules for these views. If there is only one 1.18 cvs 3729: rule which applies to all views then the keywords <tt>BEGIN</tt> and 3730: <tt>END</tt> need not appear.</p> 1.30 cvs 3731: 3732: <p>For each view, it is only necessary to specify those rules which differ 3733: from the default rules for the view, so that for certain views (or even all 3734: views), there may be no specific rules.</p> 3735: 3736: <p>The specific rules for a non-primary view are introduced by the <a 1.18 cvs 3737: name="inkeyword"><tt>IN</tt> keyword</a>, followed by the view name. The 3738: rules for that view follow, delimited by the keywords <tt>BEGIN</tt> and 3739: <tt>END</tt>, or without these two keywords when there is only one rule.</p> 1.30 cvs 3740: 3741: <p><strong>Note:</strong> the view name which follows the <tt>IN</tt> keyword 1.1 cvs 3742: must not be the name of the primary view, since the rules for that view are 1.18 cvs 3743: found before the rules for the other views.</p> 1.30 cvs 3744: 3745: <p>Within each block concerning a view, other blocks can appear, delimited by 3746: the same keywords <tt>BEGIN</tt> and <tt>END</tt>. Each of these blocks 3747: gathers the presentation rules that apply, for a given view, only when a given 1.1 cvs 3748: condition is satisfied. Each block is preceded by a condition introduced by 1.18 cvs 3749: the <tt>IF</tt> keyword. If such a conditional block contains only one rule, 3750: the keywords <tt>BEGIN</tt> and <tt>END</tt> can be omitted.</p> 1.30 cvs 3751: 3752: <p>Although the syntax allows any presentation rule to appear in a conditional 1.18 cvs 3753: block, only <a href="#sectc4232">creation rules</a> are allowed after any 3754: condition; other rules are allowed only after conditions <tt>Within</tt> and 1.1 cvs 3755: ElemID. In addition, the following rules cannot be conditional: 1.18 cvs 3756: <tt>PageBreak, LineBreak, Inline, Gather</tt>.</p> 1.30 cvs 3757: 3758: <p>For a given view, the rules that apply without any condition must appear 1.1 cvs 3759: before the first conditional block. If some rules apply only when none of the 3760: specified condition holds, they are grouped in a block preceded by the keyword 1.18 cvs 3761: <tt>Otherwise</tt>, and that block must appear after the last conditionnal 3762: block concerning the same view.</p> 1.30 cvs 3763: <pre> ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules > 1.1 cvs 3764: 'END' ';' / 3765: ViewRules / CondRules / Rule . 3766: RulesAndCond = CondRules / Rule . 3767: ViewRules = 'IN' ViewID CondRuleSeq . 1.30 cvs 3768: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' / 1.1 cvs 3769: CondRules / Rule . 1.30 cvs 3770: CondRules = CondRule < CondRule > 1.1 cvs 3771: [ 'Otherwise' RuleSeq ] . 3772: CondRule = 'IF' ConditionSeq RuleSeq . 1.30 cvs 3773: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / 1.18 cvs 3774: Rule .</pre> 1.30 cvs 3775: 1.18 cvs 3776: <blockquote class="example"> 1.30 cvs 3777: <p><strong>Example:</strong></p> 3778: 3779: <p>The following rules for a report's title make the title visible in the 3780: primary view and invisible in the table of contents and in the formula views 3781: (see the <a href="#sectc4224"><tt>Visibility</tt> rule</a>).</p> 3782: <pre>Title : BEGIN 1.1 cvs 3783: Visibility : 1; 3784: ... {Other rules for the primary view} 3785: IN Table_of_contents 3786: Visibility : 0; 3787: IN Formulas 3788: Visibility : 0; 1.18 cvs 3789: END;</pre> 3790: </blockquote> 3791: </div> 1.1 cvs 3792: 1.18 cvs 3793: <div class="subsection"> 1.30 cvs 3794: <h3><a name="sectc4214">Conditions applying to presentation rules</a></h3> 1.1 cvs 3795: 1.30 cvs 3796: <p>Many conditions can be applied to presentation rules. Conditions allow 1.1 cvs 3797: certain presentation rules to apply only in certain cases. These conditions 3798: can be based on the structural position of the element. They can be based on 3799: whether the element has references, and what type of references, whether the 3800: element has attributes, whether the element is empty or not. They can also be 1.18 cvs 3801: based on the value of a counter.</p> 1.30 cvs 3802: 3803: <p>It is possible to specify several conditions which must all be true for the 1.18 cvs 3804: rules to apply.</p> 1.30 cvs 3805: 3806: <p>A set of conditions is specified by the <tt>IF</tt> keyword. This keyword 3807: is followed by the sequence of conditions, separated by the <tt>AND</tt> 3808: keyword. Each condition is specified by a keyword which defines the condition 3809: type. In some cases, the keyword is followed by other data, which specify the 3810: condition more precisely.</p> 3811: 3812: <p>An elementary condition can be negative; it is then preceded by the 1.18 cvs 3813: <tt>NOT</tt> keyword.</p> 1.30 cvs 3814: 3815: <p>When the presentation rule(s) controlled by the condition apply to a 3816: reference element or a reference attribute, an elementary condition can also 3817: apply to element referred by this reference. The <tt>Target</tt> keyword is 3818: used for that purpose. It must appear before the keyword defining the 3819: condition type.</p> 1.18 cvs 3820: <pre> CondRule ='IF' ConditionSeq RuleSeq . 1.30 cvs 3821: ConditionSeq = Condition < 'AND' Condition > . 1.1 cvs 3822: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem . 3823: ConditionElem ='First' / 'Last' / 3824: [ 'Immediately' ] 'Within' [ NumParent ] 3825: ElemID [ ExtStruct ] / 3826: ElemID / 3827: 'Referred' / 'FirstRef' / 'LastRef' / 3828: 'ExternalRef' / 'InternalRef' / 'CopyRef' / 3829: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' / 3830: 'UserPage' / 'StartPage' / 'ComputedPage' / 3831: 'Empty' / 3832: '(' [ MinMax ] CounterName CounterCond ')' / 3833: CondPage '(' CounterID ')' . 3834: NumParent = [ GreaterLess ] NParent . 1.30 cvs 3835: GreaterLess ='>' / '<' . 1.1 cvs 3836: NParent = NUMBER. 1.6 cvs 3837: ExtStruct ='(' ElemID ')' . 1.30 cvs 3838: CounterCond ='<' MaxCtrVal / '>' MinCtrVal / 1.1 cvs 3839: '=' EqCtrVal / 3840: 'IN' '[' ['-'] MinCtrBound '.' '.' 3841: ['-'] MaxCtrBound ']' . 3842: PageCond ='Even' / 'Odd' / 'One' . 3843: MaxCtrVal = NUMBER . 3844: MinCtrVal = NUMBER . 3845: EqCtrVal = NUMBER . 3846: MaxCtrBound = NUMBER . 1.18 cvs 3847: MinCtrBound = NUMBER .</pre> 1.1 cvs 3848: 1.18 cvs 3849: <div class="subsubsection"> 3850: <h4><a name="sectd42141">Conditions based on the logical position of the 3851: element</a></h4> 1.30 cvs 3852: 3853: <p>The condition can be on the position of the element in the document's 3854: logical structure tree. It is possible to test whether the element is the 3855: first (<tt>First</tt>) or last (<tt>Last</tt>) among its siblings or if it is 3856: not the first (<tt>NOT First</tt>) or not the last (<tt>NOT Last</tt>). These 1.18 cvs 3857: conditions can be associated only with <a href="#sectc4232">creation 3858: rules</a>.</p> 1.30 cvs 3859: 3860: <p>It is also possible to test if the element is contained in an element of a 1.18 cvs 3861: given type (<tt>Within</tt>) or if it is not (<tt>NOT Within</tt>). The type 3862: is indicated after the keyword <tt>Within</tt>. If that element type is 1.1 cvs 3863: defined in a structure schema which is not the one which corresponds to the 3864: presentation schema, the type name of this element must be followed, between 1.18 cvs 3865: parentheses, by the name of the structure schema which defines it.</p> 1.30 cvs 3866: 3867: <p>If the keyword <tt>Within</tt> is preceded by <tt>Immediately</tt>, the 1.18 cvs 3868: condition is satisfied only if the <em>parent</em> element has the type 3869: indicated. If the word <tt>Immediately</tt> is missing, the condition is 3870: satisfied if any <em>ancestor</em> has the type indicated.</p> 1.30 cvs 3871: 3872: <p>An integer <i>n</i> can appear between the keyword <tt>Within</tt> and the 1.1 cvs 3873: type. It specifies the number of ancestors of the indicated type that must be 3874: present for the condition to be satisfied. If the keyword 1.18 cvs 3875: <tt>Immediately</tt> is also present, the <i>n</i> immediate ancestors of the 3876: element must have the indicated type. The integer <i>n</i> must be positive 1.30 cvs 3877: or zero. It can be preceded by <tt><</tt> or <tt>></tt> to indicate a 1.1 cvs 3878: maximum or minimum number of ancestors. If these symbols are missing, the 1.18 cvs 3879: condition is satisfied only if it exists exactly <i>n</i> ancestors. When 1.30 cvs 3880: this number is missing, it is equivalent to > 0.</p> 3881: 3882: <p>If the condition applies to presentation rules associated with an 3883: attribute, in the <tt>ATTRIBUTES</tt> section of the presentation schema, the 3884: condition can be simply an element name. Presentation rules are then executed 3885: only if the attribute is attached to an element of that type. The keyword 3886: <tt>NOT</tt> before the element name indicates that the presentation rules 3887: must be executed only if the element is not of the type indicated.</p> 1.18 cvs 3888: </div> 1.1 cvs 3889: 1.18 cvs 3890: <div class="subsubsection"> 1.30 cvs 3891: <h4><a name="sectd42142">Conditions on references</a></h4> 3892: 3893: <p>References may be taken into account in conditions, which can be based on 3894: the fact that the element, or one of its ancestors, is designated by a at 3895: least one reference (<tt>Referred</tt>) or by none (<tt>NOT 3896: Referred</tt>).</p> 3897: 3898: <p>If the element or attribute to which the condition is attached is a 3899: reference, the condition can be based on the fact that it acts as the first 3900: reference to the designated element (<tt>FirstRef</tt>), or as the last 3901: (<tt>LastRef</tt>), or as a reference to an element located in another 3902: document (<tt>ExternalRef</tt>) or in the same document 3903: (<tt>InternalRef</tt>).</p> 1.1 cvs 3904: 1.30 cvs 3905: <p>The condition can also be based on the fact that the element is an <a 1.18 cvs 3906: href="#inclusion">inclusion</a>. This is noted (<tt>CopyRef</tt>).</p> 1.30 cvs 3907: 3908: <p>Like all conditions, conditions on references can be inverted by the 1.18 cvs 3909: <tt>NOT</tt> keyword. These conditions can be associated only with <a 3910: href="#sectc4232">creation rules</a>.</p> 3911: </div> 1.1 cvs 3912: 1.18 cvs 3913: <div class="subsubsection"> 1.30 cvs 3914: <h4><a name="sectd42143">Conditions on logical attributes</a></h4> 3915: 3916: <p>The condition can be based on the presence or absence of attributes 3917: associated with the element, no matter what the attributes or their values. 3918: The <tt>AnyAttributes</tt> keyword expresses this condition.</p> 1.1 cvs 3919: 1.30 cvs 3920: <p>If the condition appears in the presentation rules of an attribute, the 1.18 cvs 3921: <tt>FirstAttr</tt> and <tt>LastAttr</tt> keywords can be used to indicate that 1.1 cvs 3922: the rules must only be applied if this attribute is the first attribute for 3923: the element or if it is the last (respectively). These conditions can also be 1.18 cvs 3924: inverted by the <tt>NOT</tt> keyword. These conditions can be associated only 3925: with <a href="#sectc4232">creation rules</a>.</p> 1.30 cvs 3926: 3927: <p>It is also possible to apply certain presentation rules only when the 3928: element being processed or one of its ancestors has a certain attribute, 3929: perhaps with a certain value. This can be done in the <a 1.18 cvs 3930: href="#sectc4210"><tt>ATTRIBUTES</tt> section</a>.</p> 3931: </div> 1.1 cvs 3932: 1.18 cvs 3933: <div class="subsubsection"> 1.30 cvs 3934: <h4><a name="sectd42144">Conditions on page breaks</a></h4> 1.1 cvs 3935: 1.30 cvs 3936: <p>The page break base type (and only this type) can use the following 1.18 cvs 3937: conditions: <tt>ComputedPage</tt>, <tt>StartPage</tt>, and <tt>UserPage</tt>. 3938: The <tt>ComputedPage</tt> condition indicates that the presentation rule(s) 1.1 cvs 3939: should apply if the page break was created automatically by Thot; the 1.18 cvs 3940: <tt>StartPage</tt> condition is true if the page break is generated before the 3941: element by the <tt>Page</tt> rule; and the <tt>UserPage</tt> condition applies 3942: if the page break was inserted by the user.</p> 1.30 cvs 3943: 3944: <p>These conditions can be associated only with <a href="#sectc4232">creation 1.18 cvs 3945: rules</a>.</p> 3946: </div> 1.1 cvs 3947: 1.18 cvs 3948: <div class="subsubsection"> 1.30 cvs 3949: <h4><a name="sectd42145">Conditions on the element's content</a></h4> 1.1 cvs 3950: 1.30 cvs 3951: <p>The condition can be based on whether or not the element is empty. An 3952: element which has no children or whose leaves are all empty is considered to 3953: be empty itself. This condition is expressed by the <tt>Empty</tt> keyword, 3954: optionally preceded by the <tt>NOT</tt> keyword. This condition can be 3955: associated only with <a href="#sectc4232">creation rules</a>.</p> 1.18 cvs 3956: </div> 1.1 cvs 3957: 1.18 cvs 3958: <div class="subsubsection"> 1.30 cvs 3959: <h4><a name="sectd42146">Conditions on counters</a></h4> 1.1 cvs 3960: 1.30 cvs 3961: <p>Presentation rules can apply when the counter's value is one, is even or 3962: odd, is equal, greater than or less than a given value or falls in a range of 1.1 cvs 3963: values. This is particularly useful for creating header and footer boxes. 1.18 cvs 3964: These conditions can be associated only with <a href="#sectc4232">creation 3965: rules</a>.</p> 1.30 cvs 3966: 3967: <p>To compare the value of a counter to a given value, a comparison is given 1.1 cvs 3968: between parentheses. The comparison is composed of the counter name followed 3969: by an equals, greater than, or less than sign and the value to which the 3970: counter will be compared. A test for whether or not a counter's value falls 3971: in a range also appears within parentheses. In this case, the counter name is 1.18 cvs 3972: followed by the <tt>IN</tt> keyword and the range definition within brackets. 3973: The <tt>Even</tt>, <tt>Odd</tt> and <tt>One</tt> are used to test a counter's 3974: value and are followed by the counter name between parentheses.</p> 1.30 cvs 3975: 3976: <p>The list of possible conditions on counters is:</p> 1.18 cvs 3977: <dl> 1.30 cvs 3978: <dt><tt>Even (Counter)</tt></dt> 3979: <dd>the box is created only if the counter has an even value.</dd> 3980: <dt><tt>Odd (Counter)</tt></dt> 3981: <dd>the box is created only if the counter has an odd value.</dd> 3982: <dt><tt>One (Counter)</tt></dt> 3983: <dd>the box is created only the counter's value is 1.</dd> 3984: <dt><tt>NOT One (Counter)</tt></dt> 3985: <dd>the box is created, unless the counter's value is 1.</dd> 3986: <dt><tt>(Counter < Value)</tt></dt> 3987: <dd>the box is created only if the counter's value is less than 3988: Value.</dd> 3989: <dt><tt>(Counter > Value)</tt></dt> 3990: <dd>the box is created only if the counter's value is greater than 3991: Value.</dd> 3992: <dt><tt>(Counter = Value)</tt></dt> 3993: <dd>the box is created only if the counter's value is equal to Value.</dd> 3994: <dt><tt>NOT (Counter = Value)</tt></dt> 3995: <dd>the is created only if the counter's value is different than 3996: Value.</dd> 3997: <dt><tt>(Counter IN [MinValue..MaxValue])</tt></dt> 3998: <dd>the box is created only if the counter's value falls in the range 3999: bounded by MinValue and MaxValue (inclusive).</dd> 4000: <dt><tt>NOT (Counter IN [MinValue..MaxValue])</tt></dt> 4001: <dd>the box is created only if the value of the counter does not fall in 4002: the range bounded by MinValue and MaxValue (inclusive).</dd> 1.18 cvs 4003: </dl> 1.30 cvs 4004: 4005: <p><strong>Note:</strong> the <tt>NOT Even</tt> and <tt>NOT Odd</tt> 4006: conditions are syntactically correct but can be expressed more simply by 4007: <tt>Odd</tt> and <tt>Even</tt>, respectively.</p> 1.18 cvs 4008: </div> 4009: </div> 1.1 cvs 4010: 1.18 cvs 4011: <div class="subsection"> 1.30 cvs 4012: <h3><a name="sectc4215">A presentation rule</a></h3> 1.1 cvs 4013: 1.30 cvs 4014: <p>A presentation rule defines either a presentation parameter or presentation 1.18 cvs 4015: function. The parameters are:</p> 4016: <ul> 1.30 cvs 4017: <li>the position of the vertical and horizontal reference axes of the 4018: box,</li> 4019: <li>the position of the box in relation to other boxes,</li> 4020: <li>the height or width of the box, with overflow exceptions,</li> 4021: <li>the margins, padding and borders of the box,</li> 4022: <li>the characteristics of the lines contained in the box: linespacing, 4023: indentation of the first line, justification, hyphenation,</li> 4024: <li>the conditions for breaking the box across pages,</li> 4025: <li>the characteristics of the characters contained in the box: size, font, 4026: style, underlining,</li> 4027: <li>the depth of the box among overlapping boxes (often called stacking 4028: order),</li> 4029: <li>the characteristics of graphic elements contained in the box: style and 4030: thickness of lines, fill pattern for closed objects,</li> 4031: <li>the colors in text, graphics, pictures, and symbols contained in the box 4032: are displayed or printed,</li> 4033: <li>for presentation boxes only, the contents of the box.</li> 4034: </ul> 4035: 4036: <p>The <a name="presfunct">presentation functions</a> are:</p> 4037: <ul> 4038: <li>the creation of a presentation box</li> 4039: <li>the line-breaking or page-breaking style,</li> 4040: <li>the copying of another box,</li> 4041: <li>the display of the box background and border,</li> 4042: <li>the display of a background picture and its aspect.</li> 4043: </ul> 4044: 4045: <p>For each box and each view, every presentation parameter is defined once 4046: and only once, either explicitly or by the <a href="#sectc427">default 4047: rules</a>. In contrast, presentation functions are not obligatory and can 4048: appear many times for the same element. for example an element can create 4049: many presentation boxes. Another element may not use any presentation 1.18 cvs 4050: functions.</p> 1.30 cvs 4051: 4052: <p>Each rule defining a presentation parameter begins with a keyword followed 4053: by a colon. The keyword indicates the parameter which is the subject of the 1.18 cvs 4054: rule. After the keyword and the colon, the remainder of the rule varies. All 4055: rules are terminated by a semicolon.</p> 4056: <pre> Rule = PresParam ';' / PresFunc ';' . 1.6 cvs 4057: PresParam ='VertRef' ':' PositionHoriz / 4058: 'HorizRef' ':' PositionVert / 4059: 'VertPos' ':' VPos / 4060: 'HorizPos' ':' HPos / 4061: 'Height' ':' Dimension / 4062: 'Width' ':' Dimension / 4063: 'VertOverflow' ':' Boolean / 1.1 cvs 4064: 'HorizOverflow' ':' Boolean / 1.26 cvs 4065: 'MarginTop' ':' MarginWidth / 4066: 'MarginRight' ':' MarginWidth / 4067: 'MarginBottom' ':' MarginWidth / 4068: 'MarginLeft' ':' MarginWidth / 4069: 'PaddingTop' ':' PaddingWidth / 4070: 'PaddingRight' ':' PaddingWidth / 4071: 'PaddingBottom' ':' PaddingWidth / 4072: 'PaddingLeft' ':' PaddingWidth / 4073: 'BorderTopWidth' ':' BorderWidth / 4074: 'BorderRightWidth' ':' BorderWidth / 4075: 'BorderBottomWidth' ':' BorderWidth / 4076: 'BorderLeftWidth' ':' BorderWidth / 4077: 'BorderTopColor' ':' BorderColor / 4078: 'BorderRightColor' ':' BorderColor / 4079: 'BorderBottomColor' ':' BorderColor / 4080: 'BorderLeftColor' ':' BorderColor / 4081: 'BorderTopStyle' ':' BorderStyle / 4082: 'BorderRightStyle' ':' BorderStyle / 4083: 'BorderBottomStyle' ':' BorderStyle / 4084: 'BorderLeftStyle' ':' BorderStyle . 1.6 cvs 4085: 'LineSpacing' ':' DistanceInherit / 4086: 'Indent' ':' DistanceInherit / 4087: 'Adjust' ':' AdjustInherit / 4088: 'Justify' ':' BoolInherit / 4089: 'Hyphenate' ':' BoolInherit / 4090: 'PageBreak' ':' Boolean / 4091: 'LineBreak' ':' Boolean / 4092: 'InLine' ':' Boolean / 4093: 'NoBreak1' ':' AbsDist / 4094: 'NoBreak2' ':' AbsDist / 4095: 'Gather' ':' Boolean / 4096: 'Visibility' ':' NumberInherit / 4097: 'Size' ':' SizeInherit / 4098: 'Font' ':' NameInherit / 4099: 'Style' ':' StyleInherit / 1.23 cvs 4100: 'Weight' ':' WeightInherit / 1.6 cvs 4101: 'Underline' ':' UnderLineInherit / 4102: 'Thickness' ':' ThicknessInherit / 4103: 'Depth' ':' NumberInherit / 4104: 'LineStyle' ':' LineStyleInherit / 4105: 'LineWeight' ':' DistanceInherit / 4106: 'FillPattern' ':' NameInherit / 4107: 'Background' ':' NameInherit / 1.13 cvs 4108: 'Foreground' ':' NameInherit / 1.6 cvs 4109: 'Content' ':' VarConst . 1.1 cvs 4110: PresFunc = Creation '(' BoxID ')' / 4111: 'Line' / 4112: 'NoLine' / 4113: 'Page' '(' BoxID ')' / 1.13 cvs 4114: 'Copy' '(' BoxTypeToCopy ')' / 4115: 'ShowBox' / 1.18 cvs 4116: 'BackgroundPicture' ':' FileName / 4117: 'PictureMode' ':' PictMode /</pre> 4118: </div> 4119: 4120: <div class="subsection"> 1.30 cvs 4121: <h3><a name="sectc4216">Box axes</a></h3> 1.18 cvs 4122: 1.30 cvs 4123: <p>The position of the middle axes <tt>VMiddle</tt> and <tt>HMiddle</tt> in 1.1 cvs 4124: relation to their box is always calculated automatically as a function of the 4125: height and width of the box and is not specified by the presentation rules. In 4126: the presentation schema, these middle axes are used only to position their box 4127: with respect to another by specifying the distance between the middle axis and 1.18 cvs 4128: an axis or a side of another box (see the <a href="#sectc4218">relative 4129: position</a>).</p> 1.30 cvs 4130: 4131: <p>The reference axes of a box are also used to position their box in relation 4132: to another, but in contrast to the middle axes, the presentation schema must 4133: make their position explicit, either in relation to a side or the middle axis 4134: of the box itself, or in relation to an axis of an enclosed box.</p> 4135: 4136: <p>Only boxes of base elements have predefined reference axes. For character 1.1 cvs 4137: string boxes, the horizontal reference axis is the baseline of the characters 4138: (the line which passes immediately under the upper-case letters, ignoring the 4139: letter Q) and the vertical reference axis is at the left edge of the first 1.18 cvs 4140: character of the string.</p> 1.30 cvs 4141: 4142: <p>The positions of a box's reference axes are defined by the <tt>VertRef</tt> 1.18 cvs 4143: and <tt>HorizRef</tt> rules which specify the <a href="#distance">distance</a> 1.1 cvs 4144: between the reference axis and an axis or parallel side of the same box or of 1.18 cvs 4145: an enclosed box.</p> 4146: <pre> 'VertRef' ':' PositionHoriz 4147: 'HorizRef' ':' PositionVert</pre> 1.30 cvs 4148: 1.18 cvs 4149: <blockquote class="example"> 1.30 cvs 4150: <p><strong>Example:</strong></p> 4151: 4152: <p>If, in the structure schema for mathematical formulas, the fraction 4153: element is defined by</p> 4154: <pre>Fraction = BEGIN 1.1 cvs 4155: Numerator = Expression; 4156: Denominator = Expression; 1.18 cvs 4157: END;</pre> 1.30 cvs 4158: 4159: <p>then the horizontal reference axis of the fraction can be positioned on 4160: top of the denominator by the rule:</p> 4161: <pre>Fraction : 1.1 cvs 4162: BEGIN 4163: HorizRef : Enclosed Denominator . Top; 4164: ... 1.18 cvs 4165: END;</pre> 1.30 cvs 4166: 4167: <p>To put the horizontal reference axis of a column at its middle:</p> 4168: <pre>Column : 1.1 cvs 4169: BEGIN 4170: HorizRef : * . HMiddle; 4171: ... 1.18 cvs 4172: END;</pre> 4173: </blockquote> 4174: </div> 1.1 cvs 4175: 1.18 cvs 4176: <div class="subsection"> 1.30 cvs 4177: <h3><a name="sectc4217">Distance units</a></h3> 1.1 cvs 4178: 1.30 cvs 4179: <p>Some distances and dimensions appear in many rules of a presentation 4180: schema, especially in position rules (<tt>VertPos, HorizPos</tt>), in extent 4181: rules for boxes (<tt>Height, Width</tt>), in rules defining lines 4182: (<tt>LineSpacing, Indent</tt>), in rules controlling pagination (<tt>NoBreak1, 4183: NoBreak2</tt>) and in rules specifying the thickness of strokes 4184: (<tt>LineWeight</tt>).</p> 4185: 4186: <p>In all these rules, the distance or extent can be expressed</p> 4187: <ul> 4188: <li>either in relative units, which depend on the size of the characters in 4189: the current font: height of the element's font or height of the letter 4190: 'x',</li> 4191: <li>or in absolute units: centimeter, millimeter, inch, typographer's point, 4192: pica or pixel.</li> 4193: </ul> 4194: 4195: <p>Units can be chosen freely. Thus, it is possible to use relative units in 4196: one rule, centimeters in the next rule, and typographer's points in 4197: another.</p> 4198: 4199: <p>Absolute units are used to set rigid rules for the appearance of documents. 4200: In contrast, relative units allow changes of scale. The editor lets the value 4201: of relative units be changed dynamically. Such changes affect every box using 1.1 cvs 4202: relative units simultaneously and in the same proportion. Changing the value 4203: of the relative units affects the size of the characters and graphical 1.18 cvs 4204: elements, and the size of the boxes and the distances between them.</p> 1.30 cvs 4205: 4206: <p>A <a name="distance">distance</a> or extent is specified by a number, which 1.1 cvs 4207: may be followed by one or more spaces and a units keyword. When there is no 4208: units keyword, the number specifies the number of relative units, where a 4209: relative unit is the height of a character in the current font (an em). When 4210: the number is followed by a units keyword, the keyword indicates the type of 1.18 cvs 4211: absolute units:</p> 4212: <ul> 1.30 cvs 4213: <li><tt>em</tt>: height of the element's font,</li> 4214: <li><tt>ex</tt>: height of the letter 'x',</li> 4215: <li><tt>cm</tt>: centimeter,</li> 4216: <li><tt>mm</tt>: millimeter,</li> 4217: <li><tt>in</tt>: inch (1 in = 2.54 cm),</li> 4218: <li><tt>pt</tt>: point (1 pt = 1/72 in),</li> 4219: <li><tt>pc</tt>: pica (1 pc = 12 pt),</li> 4220: <li><tt>px</tt>: pixel.</li> 1.18 cvs 4221: </ul> 1.30 cvs 4222: 4223: <p>Whatever the chosen unit, relative or absolute, the number is not 4224: necessarily an integer and may be expressed in fixed point notation (using the 4225: American convention of a period to express the decimal point).</p> 4226: 4227: <p>If the distance appears in a presentation rule for a numeric attribute, the 1.1 cvs 4228: number can be replaced by the name of an attribute. In this case, the value 4229: of the attribute is used. Obviously, the attribute name cannot be followed by 4230: a decimal point and a fractional part, but it can be followed a units keyword. 1.18 cvs 4231: However, the choice of units is limited to em, ex, pt and px.</p> 4232: <pre> Distance = [ Sign ] AbsDist . 1.1 cvs 4233: Sign ='+' / '-' . 4234: AbsDist = IntegerOrAttr [ '.' DecimalPart ] 4235: [ Unit ]. 4236: IntegerOrAttr = IntegerPart / AttrID . 4237: IntegerPart = NUMBER . 4238: DecimalPart = NUMBER . 4239: Unit ='em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' / 1.18 cvs 4240: 'pc' / 'px' / '%' .</pre> 1.30 cvs 4241: 1.18 cvs 4242: <blockquote class="example"> 1.30 cvs 4243: <p><strong>Example:</strong></p> 4244: 4245: <p>The following rules specify that a box has a height of 10.5 centimeters 4246: and a width of 5.3 ems:</p> 4247: <pre>Height : 10.5 cm; 1.18 cvs 4248: Width : 5.3;</pre> 4249: </blockquote> 4250: </div> 1.1 cvs 4251: 1.18 cvs 4252: <div class="subsection"> 1.30 cvs 4253: <h3><a name="sectc4218">Relative positions</a></h3> 1.1 cvs 4254: 1.30 cvs 4255: <p>The positioning of boxes uses the eight axes and sides, the sides generally 1.1 cvs 4256: being used to define the juxtapositioning (vertical or horizontal) of boxes, 4257: the middle axes being used to define centering, and the reference axes being 1.18 cvs 4258: used for alignment.</p> 1.30 cvs 4259: 4260: <p>Two rules allow a box to be placed relative to other boxes. The 1.18 cvs 4261: <tt>VertPos</tt> rule positions the box vertically. The <tt>HorizPos</tt> 4262: rule positions the box horizontally. It is possible that a box's position 4263: could be entirely determined by other boxes positioned relative to it. In this 4264: case, the position is implicit and the word <tt>nil</tt> can be used to 4265: specify that no position rule is needed. Otherwise, an explicit rule must be 4266: given by indicating the axis or side which defines the position of the box, 4267: followed by an equals sign and the distance between between this axis or side 4268: and a parallel axis or side of another box, called the reference box. The box 4269: for which the rule is written will be positioned relative to the reference 4270: box.</p> 4271: <pre> 'VertPos' ':' VPos 1.6 cvs 4272: 'HorizPos' ':' HPos 4273: HPos = 'nil' / VertAxis '=' HorizPosition 4274: [ 'UserSpecified' ]. 4275: VPos = 'nil' / HorizAxis '=' VertPosition 4276: [ 'UserSpecified' ]. 1.1 cvs 4277: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' . 1.18 cvs 4278: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .</pre> 1.30 cvs 4279: 4280: <p>The reference box is an adjacent box: enclosing, enclosed or adjacent. When 4281: a rule is associated with a reference type attribute (and only in this case), 4282: it can be a box of the element designated by the attribute. The reference box 1.18 cvs 4283: can be either a presentation box previously defined in the <tt>BOXES</tt> 1.1 cvs 4284: section of the schema and created by a creation function, or the box 1.18 cvs 4285: associated with a structured element.</p> 1.30 cvs 4286: 4287: <p>The structural position of the reference box (relative to the box for which 1.18 cvs 4288: the rule is being written) is indicated by a keyword: <tt>Enclosing</tt>, 4289: <tt>Enclosed</tt>, or, for sibling boxes, <tt>Previous</tt> or <tt>Next</tt>. 1.1 cvs 4290: The reference attributes, or presentation boxes created by a reference 1.18 cvs 4291: attribute, the <tt>Referred</tt> keyword may be used to designate the element 4292: which the reference points to. The keyword <tt>Creator</tt> can be used in 1.1 cvs 4293: rules for presentation boxes to designate the box of the element which created 1.18 cvs 4294: the presentation box. Finally, the <tt>Root</tt> keyword can be used to 4295: designate the root of the document.</p> 1.30 cvs 4296: 4297: <p>When the keyword is ambiguous, it is followed by the name of an element 4298: type or presentation box which resolves the ambiguity (the <tt>Creator</tt> 4299: and <tt>Root</tt> keywords are never ambiguous). If this name is not given, 4300: then the first box encountered is used as the reference box. It is also 4301: possible to use just the name of an element type or presentation box without 4302: an initial keyword. In this case, a sibling having that name will be used. If 4303: the name is preceded by the keyword <tt>NOT</tt>, then the reference box will 4304: be the first box whose type is not the named one.</p> 4305: 4306: <p>In place of the box or type name, the keywords <tt>AnyElem</tt>, 1.18 cvs 4307: <tt>AnyBox</tt> and <tt>ElemWithAttr</tt> can be used, representing 1.17 cvs 4308: respectively, any structured element box, any presentation box, and the box 4309: corresponding to any structured element having a particular attribute, 4310: whatever its value; the name of this attribute must follow the keyword 1.18 cvs 4311: <tt>ElemWithAttr</tt>.</p> 1.30 cvs 4312: 4313: <p>A type name may be preceded by a star in order to resolve the ambiguity in 4314: the special case where the structure schema defines an <a 1.18 cvs 4315: href="#sectd3284">inclusion</a> without expansion (or with partial expansion) 4316: of the same type as an element of the scheme. For mark pairs (and only for <a 4317: href="#sectd3285">mark pairs</a>) the type name <em>must</em> be preceded by 4318: the <tt>First</tt> or <tt>Second</tt> keyword, which indicates which of the 4319: two marks of the pair should be used as the reference box.</p> 1.30 cvs 4320: 4321: <p>The star character ('<tt>*</tt>') used alone designates the box to which 4322: the rule applies (in this case, it is obviously useless to specify the type of 4323: the reference box).</p> 4324: 4325: <p>The keywords <tt>Enclosing</tt> and <tt>Enclosed</tt> can be used no matter 1.1 cvs 4326: what constructor defines the type to which the rule applies. When applied to 1.18 cvs 4327: the element which represents the entire document, <tt>Enclosing</tt> 1.1 cvs 4328: designates the window or page in which the document's image is displayed for 4329: the view to which the rule applies. A box or type name without a keyword is 4330: used for aggregate elements and designates another element of the same 4331: aggregate. It can also be used to designate a presentation or page layout 1.18 cvs 4332: box. The keywords <tt>Previous</tt> and <tt>Next</tt> are primarily used to 1.1 cvs 4333: denote list elements, but can also be used to denote elements of an 1.18 cvs 4334: aggregate.</p> 1.30 cvs 4335: 4336: <p>In the position rule, the structural position relative to the reference box 4337: is followed, after a period, by the name of an axis or side. The rule 4338: specifies its node's position as being some distance from this axis or side of 4339: the reference box. If this distance is zero, then the distance does not 4340: appear in the rule. Otherwise, it does appear as a positive or negative 4341: number (the sign is required for negative numbers). The sign takes into 4342: account the orientation of the coordinate axes: for top to bottom for the 4343: vertical axis and from left to right for the horizontal axis. Thus, a 4344: negative distance in a vertical position indicates that the side or axis 4345: specified in the rule is above the side or axis of the reference box.</p> 4346: 4347: <p>The distance can be followed by the <tt>UserSpecified</tt> keyword (even if 1.18 cvs 4348: the distance is nil and does not appear, the <tt>UserSpecified</tt> keyword 1.1 cvs 4349: can be used). It indicates that when the element to which the rule applies is 4350: being created, the editor will ask the user to specify the distance himself, 4351: using the mouse. In this case, the distance specified in the rule is a 4352: default distance which is suggested to the user but can be modified. The 1.18 cvs 4353: <tt>UserSpecified</tt> keyword can be used either in the vertical position 4354: rule, the horizontal position rule, or both.</p> 4355: <pre> VertPosition = Reference '.' HorizAxis [ Distance ] . 1.1 cvs 4356: HorizPosition = Reference '.' VertAxis [ Distance ] . 4357: Reference ='Enclosing' [ BoxTypeNot ] / 4358: 'Enclosed' [ BoxTypeNot ] / 4359: 'Previous' [ BoxTypeNot ] / 4360: 'Next' [ BoxTypeNot ] / 4361: 'Referred' [ BoxTypeNot ] / 4362: 'Creator' / 4363: 'Root' / 4364: '*' / 4365: BoxOrType . 4366: BoxOrType = BoxID / 4367: [ '*' ] [ FirstSec ] ElemID / 1.17 cvs 4368: 'AnyElem' / 'AnyBox' / 4369: 'ElemWithAttr' AttrID . 1.18 cvs 4370: BoxTypeNot = [ 'NOT' ] BoxOrType .</pre> 1.30 cvs 4371: 1.18 cvs 4372: <blockquote class="example"> 1.30 cvs 4373: <p><strong>Example:</strong></p> 4374: 4375: <p>If a <a name="expos1">report</a> is defined by the following structure 4376: schema:</p> 4377: <pre>Report = BEGIN 1.6 cvs 4378: Title = Text; 4379: Summary = Text; 4380: Keywords = Text; 4381: ... 1.18 cvs 4382: END;</pre> 1.30 cvs 4383: 4384: <p>then the presentation schema could contain the rules:</p> 4385: <pre>Report : BEGIN 1.6 cvs 4386: VertPos : Top = Enclosing . Top; 4387: HorizPos : Left = Enclosing . Left; 4388: ... 1.18 cvs 4389: END;</pre> 1.30 cvs 4390: 4391: <p>These rules place the <a name="reportexample">report</a> in the upper 4392: left corner of the enclosing box, which is the window in which the document 4393: is being edited.</p> 4394: <pre>Title : BEGIN 1.6 cvs 4395: VertPos : Top = Enclosing . Top + 1; 4396: HorizPos : VMiddle = Enclosing . VMiddle; 4397: ... 1.18 cvs 4398: END;</pre> 1.30 cvs 4399: 4400: <p>The top of the title is one line (a line has the height of the characters 4401: of the title) from the top of the report, which is also the top of the 4402: editing window. The title is centered horizontally in the window (see <a 4403: href="#posdim">figure</a>).</p> 4404: <pre>Summary : BEGIN 1.1 cvs 4405: VertPos : Top = Title . Bottom + 1.5; 4406: HorizPos : Left = Enclosing . Left + 2 cm; 4407: ... 1.18 cvs 4408: END;</pre> 1.30 cvs 4409: 4410: <p>The top of the summary is place a line and a half below the bottom of the 4411: title and is shifted two centimeters from the side of the window.</p> 1.18 cvs 4412: </blockquote> 1.30 cvs 4413: 1.18 cvs 4414: <blockquote class="example"> 1.30 cvs 4415: <p><strong>Example:</strong></p> 4416: 4417: <p>Suppose there is a <a name="expos2">Design</a> logical structure which 4418: contains graphical elements:</p> 4419: <pre>Design = LIST OF (ElemGraph = GRAPHICS);</pre> 4420: 4421: <p>The following rules allow the user to freely choose the position of each 4422: element when it is created:</p> 4423: <pre>ElemGraph = 1.1 cvs 4424: BEGIN 4425: VertPos : Top = Enclosing . Top + 1 cm UserSpecified; 4426: HorizPos: Left = Enclosing . Left UserSpecified; 4427: ... 1.18 cvs 4428: END;</pre> 1.30 cvs 4429: 4430: <p>Thus, when a graphical element is created, its default placement is at 4431: the left of the window and 1 cm from the top, but the user can move it 4432: immediately, simply by moving the mouse.</p> 1.18 cvs 4433: </blockquote> 4434: </div> 1.1 cvs 4435: 1.18 cvs 4436: <div class="subsection"> 1.30 cvs 4437: <h3><a name="sectc4219">Box extents</a></h3> 1.1 cvs 4438: 1.30 cvs 4439: <p>The extents (height and width) of each box are defined by the two rules 1.18 cvs 4440: <tt>Height</tt> and <tt>Width</tt>. There are three types of extents: fixed, 4441: relative, and elastic.</p> 1.1 cvs 4442: 1.18 cvs 4443: <div class="subsubsection"> 1.30 cvs 4444: <h4><a name="sectd42191">Fixed extents</a></h4> 1.1 cvs 4445: 1.30 cvs 4446: <p>A fixed dimension sets the height or width of the box independently of all 1.18 cvs 4447: other boxes. It is expressed in <a href="#sectc4217">distance units</a>. The 4448: extent can be followed by the <tt>UserSpecified</tt> keyword which indicates 1.1 cvs 4449: that when the element to which the rule applies is being created, the editor 4450: will ask the user to specify the extent himself, using the mouse. In this 4451: case, the extent specified in the rule is a default extent which is suggested 1.18 cvs 4452: to the user but can be modified. The <tt>UserSpecified</tt> keyword can be 4453: used either in the <tt>Height</tt> rule, the <tt>Width</tt> rule, or both.</p> 1.30 cvs 4454: 4455: <p>A fixed extent rule can be ended by the <tt>Min</tt> keyword, which 4456: signifies that the indicated value is a minimum, and that, if the contents of 4457: the box require it, a larger extent is possible.</p> 1.18 cvs 4458: <pre> 'Height' ':' Dimension 1.1 cvs 4459: 'Width' ':' Dimension 4460: Dimension = AbsDist [ 'UserSpecified' ] [ 'Min' ] / 1.18 cvs 4461: ...</pre> 1.30 cvs 4462: 1.18 cvs 4463: <blockquote class="example"> 1.30 cvs 4464: <p><strong>Example:</strong></p> 4465: 4466: <p>Continuing with the <a href="#expos2">previous example</a>, it is 4467: possible to allow the user to choose the size of each graphical element as 4468: it is created:</p> 4469: <pre>ElemGraph : BEGIN 1.6 cvs 4470: Width : 2 cm UserSpecified; 1.1 cvs 4471: Height : 1 cm UserSpecified; 4472: ... 1.18 cvs 4473: END;</pre> 1.30 cvs 4474: 4475: <p>Thus, when a graphical element is create, it is drawn by default with a 4476: width of 2 cm and a height of 1 cm, but the user is free to resize it 4477: immediately with the mouse.</p> 4478: <pre>Summary : BEGIN 1.1 cvs 4479: Height : 5 cm Min; 4480: ... 4481: END; 4482: Keywords : BEGIN 4483: VertPos : Top = Summary . Bottom; 4484: ... 1.18 cvs 4485: END;</pre> 4486: </blockquote> 4487: </div> 1.1 cvs 4488: 1.18 cvs 4489: <div class="subsubsection"> 1.30 cvs 4490: <h4><a name="sectd42192">Relative extents</a></h4> 4491: 4492: <p>A relative extent determines the extent as a function of the extent of 4493: another box, just as a relative position places a box in relation to another. 4494: The reference box in an extent rule is designated using the same syntax as is 4495: used in a relative position rule. It is followed by a period and a 4496: <tt>Height</tt> or <tt>Width</tt> keyword, depending on the extent being 4497: referred to. Next comes the relation between the extent being defined and the 4498: extent of the reference box. This relation can be either a percentage or a 4499: difference.</p> 1.1 cvs 4500: 1.30 cvs 4501: <p>A percentage is indicated by a star (the multiplication symbol) followed by 1.1 cvs 4502: the numeric percentage value (which may be greater than or less than 100) and 4503: the percent (`%') character. A difference is simply indicated by a signed 1.18 cvs 4504: difference.</p> 1.30 cvs 4505: 4506: <p>If the rule appears in the presentation rules of a numeric attribute, the 1.1 cvs 4507: percentage value can be replaced by the name of the attribute. This attribute 1.18 cvs 4508: is then used as a percentage. The attribute can also be used as part of a <a 4509: href="#distance">difference</a>.</p> 1.30 cvs 4510: 4511: <p>Just as with a fixed extent, a relative extent rule can end with the 1.18 cvs 4512: <tt>Min</tt> keyword, which signifies that the extent is a minimum and that, 4513: if the contents of the box require it, a larger extent is possible.</p> 1.30 cvs 4514: 4515: <p>A special case of relative extent rules is:</p> 1.18 cvs 4516: <pre>Height : Enclosed . Height;</pre> 1.30 cvs 4517: 4518: <p>or</p> 1.18 cvs 4519: <pre>Width : Enclosed . Width;</pre> 1.30 cvs 4520: 4521: <p>which specifies that the box has a height (or width) such that it encloses 4522: all the boxes which it contains, excluding boxes having a rule 4523: <tt>VertOverflow: Yes;</tt> or <tt>HorizOverflow: Yes;</tt>.</p> 4524: 4525: <p><strong>Note:</strong> character strings (type <tt>TEXT_UNIT</tt>) 4526: generally must use the sum of the widths of the characters which compose them 4527: as their width, which is expressed by the rule:</p> 1.18 cvs 4528: <pre>TEXT_UNIT : 4529: Width : Enclosed . Width;</pre> 1.30 cvs 4530: 4531: <p>If this rule is not the default <tt>Width</tt> rule, it must be given 1.18 cvs 4532: explicitly in the <tt>RULES</tt> section which defines the presentation rules 4533: of the logical elements.</p> 4534: <pre> 'Height' ':' Extent 1.1 cvs 4535: 'Width' ':' Extent 4536: Extent = Reference '.' HeightWidth [ Relation ] 4537: [ 'Min' ] / ... 4538: HeightWidth ='Height' / 'Width' . 4539: Relation ='*' ExtentAttr '%' / Distance . 4540: ExtentAttr = ExtentVal / AttrID . 1.18 cvs 4541: ExtentVal = NUMBER .</pre> 1.30 cvs 4542: 1.18 cvs 4543: <blockquote class="example"> 1.30 cvs 4544: <p><strong>Example:</strong></p> 4545: 4546: <p>Completing the <a href="#expos1">above example</a>, it is possible to 4547: specify that the report takes its width from the editing window and its 4548: height from the size of its contents (this can obviously be greater than 4549: that of the window):</p> 4550: <pre>Report : BEGIN 1.1 cvs 4551: Width : Enclosing . Width; 4552: Height : Enclosed . Height; 4553: ... 1.18 cvs 4554: END;</pre> 1.30 cvs 4555: 4556: <p>Then, the following rules make the title occupy 60% of the width of the 4557: report (which is that of the window) and is broken into centered lines of 4558: this width (see the <a href="#sectc4222"><tt>Line</tt> rule</a>).</p> 4559: <pre>Title : BEGIN 1.1 cvs 4560: Width : Enclosing . Width * 60%; 4561: Height : Enclosed . Height; 4562: Line; 4563: Adjust : VMiddle; 4564: ... 1.18 cvs 4565: END;</pre> 1.30 cvs 4566: 4567: <p>The summary occupy the entire width of the window, with the exception of 4568: a 2 cm margin reserved by the horizontal position rule:</p> 4569: <pre>Summary : BEGIN 1.1 cvs 4570: Width : Enclosing . Width - 2 cm; 4571: Height : Enclosed . Height; 4572: ... 1.18 cvs 4573: END;</pre> 4574: 1.30 cvs 4575: <p>This set of rules, plus the <a href="#reportexample">position rules given 4576: above</a>, produce the layout of boxes shown in the following<a 4577: href="#posdim">figure</a>.</p> 4578: 4579: <div class="figure"> 4580: <hr> 4581: <pre>------------------------------------------------------------- 1.1 cvs 4582: | Window and Report ^ | 4583: | | 1 line | 4584: | v | 4585: | ------------------------------------- | 4586: | | | | 4587: : 20% : Title : 20% : 1.30 cvs 4588: :<--------->: :<--------->: 1.1 cvs 4589: : : 60% : : 1.30 cvs 4590: : :<--------------------------------->: : 1.1 cvs 4591: | | | | 4592: | ------------------------------------- | 4593: | ^ | 4594: | | 1.5 line | 4595: | | | 4596: | v | 4597: | ---------------------------------------------------| 4598: | 2 cm | | 1.30 cvs 4599: |<------>| Summary | 1.18 cvs 4600: : : :</pre> 1.19 cvs 4601: 1.30 cvs 4602: <p align="center"><em><a name="posdim">Box position and 4603: extent</a><em></em></em></p> 4604: <hr> 4605: </div> 1.18 cvs 4606: </blockquote> 4607: </div> 1.1 cvs 4608: 1.18 cvs 4609: <div class="subsubsection"> 1.30 cvs 4610: <h4><a name="sectd42193">Elastic extents</a></h4> 1.1 cvs 4611: 1.30 cvs 4612: <p>The last type of extent is the elastic extent. Either one or both extents 4613: can be elastic. A box has an elastic extent when two opposite sides are 4614: linked by distance constraints to two sides or axes of other boxes.</p> 4615: 4616: <p>One of the sides of the elastic box is linked by a position rule 1.18 cvs 4617: (<tt>VertPos</tt> or <tt>HorizPos</tt>) to a neighboring box. The other side 4618: is link to another box by a <tt>Height</tt> or <tt>Width</tt> rule, which 1.1 cvs 4619: takes the same form as the position rule. For the elastic box itself, the 4620: notions of sides (left or right, top or bottom) are fuzzy, since the movement 4621: of either one of the two reference boxes can, for example, make the left side 4622: of the elastic box move to the right of its right side. This is not 4623: important. The only requirement is that the two sides of the elastic box used 1.18 cvs 4624: in the position and extent rule are opposite sides of the box.</p> 4625: <pre> 'Height' ':' Extent 1.6 cvs 4626: 'Width' ':' Extent 1.18 cvs 4627: Extent = HPos / VPos / ...</pre> 1.30 cvs 4628: 1.18 cvs 4629: <blockquote class="example"> 1.30 cvs 4630: <p><strong>Example:</strong></p> 4631: 4632: <p>Suppose we want to draw an elastic arrow or line between the middle of 4633: the bottom side of box A and the upper left corner of box B. To do this, we 4634: would define a graphics box whose upper left corner coincides with the 4635: middle of the bottom side of A (a position rule) and whose lower right 4636: corner coincides with with the upper left corner of B (dimension rules):</p> 4637: <pre>LinkedBox : 1.1 cvs 4638: BEGIN 1.6 cvs 4639: VertPos : Top = A .Bottom; 1.1 cvs 4640: HorizPos : Left = A . VMiddle; 1.6 cvs 4641: Height : Bottom = B . Top; 4642: Width : Right = B . Left; 1.18 cvs 4643: END;</pre> 4644: </blockquote> 1.30 cvs 4645: 1.18 cvs 4646: <blockquote class="example"> 1.30 cvs 4647: <p><strong>Example:</strong></p> 4648: 4649: <p>The element SectionTitle creates a presentation box called SectionNum 4650: which contains the number of the section. Suppose we want to align the 4651: SectionNum and SectionTitle horizontally, have the SectionNum take its width 4652: from its contents (the section number), have the SectionTitle box begin 0.5 4653: cm to the right of the SectionNum box and end at the right edge of its 4654: enclosing box. This would make the SectionTitle box elastic, since its width 4655: is defined by the position of its left and right sides. The following rules 4656: produce this effect:</p> 4657: <pre>SectionNum : 1.1 cvs 4658: BEGIN 4659: HorizPos : Left = Enclosing . Left; 4660: Width : Enclosed . Width; 4661: ... 4662: END; 4663: 4664: SectionTitle : 4665: BEGIN 4666: HorizPos : Left = SectionNum . Right + 0.5 cm; 4667: Width : Right = Enclosing . Right; 4668: ... 1.18 cvs 4669: END;</pre> 4670: </blockquote> 4671: </div> 4672: </div> 1.1 cvs 4673: 1.18 cvs 4674: <div class="subsection"> 1.30 cvs 4675: <h3><a name="sectc4220">Overflow</a></h3> 1.1 cvs 4676: 1.30 cvs 4677: <p>A boxes corresponding to a structural element normally contain all boxes 1.1 cvs 4678: corresponding to the elements of its subtree. However, in some cases, it 4679: could be necessary to allow a box to jut out from its parent box. Two 4680: presentation rules indicate that such an overflow is allowed, one for 1.18 cvs 4681: horizontal overflow, one for vertical overflow.</p> 1.30 cvs 4682: 4683: <p>Each of these rules is expressed by a keyword followed by a colon and the 1.18 cvs 4684: keyword <tt>Yes</tt> or <tt>No</tt>.</p> 4685: <pre> 'VertOverflow' ':' Boolean / 1.1 cvs 4686: 'HorizOverflow' ':' Boolean . 1.18 cvs 4687: Boolean = 'Yes' / 'No' .</pre> 4688: </div> 1.1 cvs 4689: 1.30 cvs 4690: <p>@@@@@ ******</p> 4691: 1.26 cvs 4692: <p>Explain Margin, Padding and Border. Refer to CSS2.</p> 4693: <pre> 'MarginTop' ':' MarginWidth / 4694: 'MarginRight' ':' MarginWidth / 4695: 'MarginBottom' ':' MarginWidth / 4696: 'MarginLeft' ':' MarginWidth / 4697: 'PaddingTop' ':' PaddingWidth / 4698: 'PaddingRight' ':' PaddingWidth / 4699: 'PaddingBottom' ':' PaddingWidth / 4700: 'PaddingLeft' ':' PaddingWidth / 4701: 'BorderTopWidth' ':' BorderWidth / 4702: 'BorderRightWidth' ':' BorderWidth / 4703: 'BorderBottomWidth' ':' BorderWidth / 4704: 'BorderLeftWidth' ':' BorderWidth / 4705: 'BorderTopColor' ':' BorderColor / 4706: 'BorderRightColor' ':' BorderColor / 4707: 'BorderBottomColor' ':' BorderColor / 4708: 'BorderLeftColor' ':' BorderColor / 4709: 'BorderTopStyle' ':' BorderStyle / 4710: 'BorderRightStyle' ':' BorderStyle / 4711: 'BorderBottomStyle' ':' BorderStyle / 4712: 'BorderLeftStyle' ':' BorderStyle . 4713: 4714: MarginWidth = InheritParent / 'Auto' / Distance . 4715: PaddingWidth = InheritParent / Distance . 4716: BorderWidth = InheritParent / 'Thin' / 'Medium' / 'Thick' / Distance . 4717: BorderColor = InheritParent / 'Transparent' / 'Foreground' / 4718: ColorName . 4719: BorderStyle = InheritParent / 4720: 'None' / 'Hidden' / 'Dotted' / 'Dashed' / 'Solid' / 4721: 'Double' / 'Groove' / 'Ridge' / 'Inset' / 'Outset' . 1.27 cvs 4722: InheritParent = 'Enclosing' '=' / 'Creator' '=' . 1.26 cvs 4723: ColorName = NAME .</pre> 1.30 cvs 4724: 4725: <p>@@@@@ ******</p> 1.26 cvs 4726: 1.18 cvs 4727: <div class="subsection"> 1.30 cvs 4728: <h3><a name="sectc4221">Inheritance</a></h3> 1.1 cvs 4729: 1.30 cvs 4730: <p>A presentation parameter can be defined by reference to the same parameter 4731: of another box in the tree of boxes. These structural links are expressed by 1.1 cvs 4732: kinship. The reference box can be that of the element immediately above in 1.18 cvs 4733: the structure (<tt>Enclosing</tt>), two levels above (<tt>GrandFather</tt>), 4734: immediately below (<tt>Enclosed</tt>) or immediately before 4735: (<tt>Previous</tt>). In the case of a presentation box, and only in that 1.1 cvs 4736: case, the reference box may be the element which created the presentation box 1.18 cvs 4737: (<tt>Creator</tt>).</p> 1.30 cvs 4738: 4739: <p>Kinship is expressed in terms of the logical structure of the document and 4740: not in terms of the tree of boxes. The presentation box cannot transmit any 4741: of their parameters by inheritance; only structured element boxes can do so. 4742: As an example, consider an element B which follows an element A in the logical 1.1 cvs 4743: structure. The element B creates a presentation box P in front of itself, 1.18 cvs 4744: using the <tt>CreateBefore</tt> rule (see the <a href="#sectc4232">creation 4745: rules</a>). If element B's box inherits its character style using the 4746: <tt>Previous</tt> kinship operation, it gets its character style from A's box, 1.1 cvs 4747: not from P's box. Inheritance works differently for positions and extents, 1.18 cvs 4748: which can refer to presentation boxes.</p> 1.30 cvs 4749: 4750: <p>The inherited parameter value can be the same as that of the reference box. 1.1 cvs 4751: This is indicated by an equals sign. However, for numeric parameters, a 4752: different value can be obtained by adding or subtracting a number from the 4753: reference box's parameter value. Addition is indicated by a plus sign before 4754: the number, while subtraction is specified with a minus sign. The value of a 4755: parameter can also be given a maximum (if the sign is a plus) or minimum (if 1.18 cvs 4756: the sign is a minus).</p> 1.30 cvs 4757: 4758: <p>If the rule is being applied to a numeric attribute, the number to add or 1.1 cvs 4759: subtract can be replaced by the attribute name. The value of a maximum or 4760: minimum may also be replaced by an attribute name. In these cases, the value 1.18 cvs 4761: of the attribute is used.</p> 4762: <pre> Inheritance = Kinship InheritedValue . 1.6 cvs 4763: Kinship ='Enclosing' / 'GrandFather' / 'Enclosed' / 4764: 'Previous' / 'Creator' . 1.1 cvs 4765: InheritedValue ='+' PosIntAttr [ 'Max' maximumA ] / 1.6 cvs 4766: '-' NegIntAttr [ 'Min' minimumA ] / 4767: '=' . 4768: PosIntAttr = PosInt / AttrID . 4769: PosInt = NUMBER . 4770: NegIntAttr = NegInt / AttrID . 4771: NegInt = NUMBER . 4772: maximumA = maximum / AttrID . 4773: maximum = NUMBER . 4774: minimumA = minimum / AttrID . 1.18 cvs 4775: minimum = NUMBER .</pre> 1.30 cvs 4776: 4777: <p>The parameters which can be obtained by inheritance are justification, 1.1 cvs 4778: hyphenation, interline spacing, character font (font family), font style, font 4779: size, visibility, indentation, underlining, alignment of text, stacking order 4780: of objects, the style and thickness of lines, fill pattern and the colors of 1.18 cvs 4781: lines and characters.</p> 4782: </div> 1.1 cvs 4783: 1.18 cvs 4784: <div class="subsection"> 1.30 cvs 4785: <h3><a name="sectc4222">Line breaking</a></h3> 1.1 cvs 4786: 1.30 cvs 4787: <p>The <tt>Line</tt> rule specifies that the contents of the box should be 4788: broken into lines: the boxes included in the box to which this rule is 4789: attached are displayed one after the other, from left to right, with their 4790: horizontal reference axes aligned so that they form a series of lines. The 4791: length of these lines is equal to the width of the box to which the 4792: <tt>Line</tt> rule is attached.</p> 4793: 4794: <p>When an included box overflows the current line, it is either carried 4795: forward to the next line, cur, or left the way it is. The <a 1.18 cvs 4796: href="#sectc4223"><tt>LineBreak</tt> rule</a> is used to allow or prevent the 1.1 cvs 4797: breaking of included boxes. If the included box is not breakable but is 4798: longer than the space remaining on the line, it is left as is. When a 4799: character string box is breakable, the line is broken between words or, if 1.18 cvs 4800: necessary, by <a href="#sectd42225">hyphenating a word</a>. When a compound 4801: box is breakable, the box is transparent in regard to line breaking. The boxes 4802: included in the compound box are treated just like included boxes which have 4803: the <tt>LineBreak</tt> rule. Thus, it is possible to traverse a complete 4804: subtree of boxes to line break the text leaves of a complex structure.</p> 1.30 cvs 4805: 4806: <p>The relative position rules of the included boxes are ignored, since the 4807: boxes will be placed according to the line breaking rules.</p> 4808: 4809: <p>The <tt>Line</tt> rule does not have a parameter. The characteristics of 4810: the lines that will be constructed are determined by the <tt>LineSpacing</tt>, 1.18 cvs 4811: <tt>Indent</tt>, <tt>Adjust</tt>, <tt>Justify</tt>, and <tt>Hyphenate</tt> 4812: rules. Moreover, the <a href="#insectd42226"><tt>Inline</tt> rule</a> permits 4813: the exclusion of certain elements from the line breaking process.</p> 1.30 cvs 4814: 4815: <p>When the <tt>Line</tt> rule appears in the rules sequence of a non-primary 1.18 cvs 4816: view, it applies only to that view, but when the <tt>Line</tt> rule appears in 1.1 cvs 4817: the rules sequence of the primary view, it also applies to the other views by 1.18 cvs 4818: default, except for those views which explicitly invoke the <tt>NoLine</tt> 4819: rule. Thus, the <tt>NoLine</tt> rule can be used in a non-primary view to 4820: override the primary view's <tt>Line</tt> rule. The <tt>NoLine</tt> rule must 4821: not be used with the primary view because the absence of the <tt>Line</tt> 4822: rule has the same effect. Like the <tt>Line</tt> rule, the <tt>NoLine</tt> 4823: rule does not take any parameters.</p> 4824: <pre> 'Line' 4825: 'NoLine'</pre> 4826: 4827: <div class="subsubsection"> 1.30 cvs 4828: <h4><a name="sectd42221">Line spacing</a></h4> 1.18 cvs 4829: 1.30 cvs 4830: <p>The <tt>LineSpacing</tt> rule defines the line spacing to be used in the 4831: line breaking process. The line spacing is the distance between the baselines 1.1 cvs 4832: (horizontal reference axis) of the successive lines produced by the 1.18 cvs 4833: <tt>Line</tt> rule. The value of the line spacing can be specified as a 4834: constant or by inheritance. It is expressed in any of the available <a 4835: href="#sectc4217">distance units</a>.</p> 1.30 cvs 4836: 4837: <p>Inheritance allows the value to be obtained from a relative in the 4838: structure tree, either without change (an equals sign appears after the 4839: inheritance keyword), with a positive difference (a plus sign), or a negative 4840: difference (a minus sign). When the rule uses a difference, the value of the 4841: difference follows the sign and is expressed as a <a 4842: href="#sectc4217">distance</a>.</p> 1.18 cvs 4843: <pre> 'LineSpacing' ':' DistOrInherit 1.6 cvs 4844: DistOrInherit = Kinship InheritedDist / Distance . 1.18 cvs 4845: InheritedDist = '=' / '+' AbsDist / '-' AbsDist .</pre> 1.30 cvs 4846: 4847: <p>When the line spacing value (or its difference from another element) is 1.1 cvs 4848: expressed in relative units, it changes with the size of the characters. Thus, 4849: when a larger font is chosen for a part of the document, the line spacing of 4850: that part expands proportionally. In contrast, when the line spacing value is 4851: expressed in absolute units (centimeters, inches, typographer's points), it is 4852: independent of the characters, which permits the maintenance of a consistent 4853: line spacing, whatever the character font. Either approach can be taken, 1.18 cvs 4854: depending on the desired effect.</p> 4855: </div> 1.1 cvs 4856: 1.18 cvs 4857: <div class="subsubsection"> 1.30 cvs 4858: <h4><a name="sectd42222">First line indentation</a></h4> 1.1 cvs 4859: 1.30 cvs 4860: <p>The <tt>Indent</tt> rule is used to specify the indentation of the first 4861: line of the elements broken into lines by the <tt>Line</tt> function. The 1.1 cvs 4862: indentation determines how far the first line of the element is shifted with 4863: respect to the other lines of the same element. It can be specified as a 4864: constant or by inheritance. The constant value is a positive integer (shifted 4865: to the right; the sign is optional), a negative integer (shifted to the left) 1.18 cvs 4866: or zero (no shift). All available <a href="#sectc4217">units</a> can be 4867: used.</p> 1.30 cvs 4868: 4869: <p>Indentation can be defined for any box, regardless of whether the box is 4870: line broken, and transmitted by inheritance to elements that are line broken. 4871: The size of the indentation is specified in the same manner as the <a 1.18 cvs 4872: href="#sectd42221">line spacing</a>.</p> 4873: <pre> 'Indent' ':' DistOrInherit</pre> 4874: </div> 1.1 cvs 4875: 1.18 cvs 4876: <div class="subsubsection"> 1.30 cvs 4877: <h4><a name="sectd42223">Alignment</a></h4> 1.1 cvs 4878: 1.30 cvs 4879: <p>The alignment style of the lines constructed during line breaking is 4880: defined by the <tt>Adjust</tt> rule. The alignment value can be a constant or 1.18 cvs 4881: inherited. A constant value is specified by a keyword:</p> 4882: <ul> 1.30 cvs 4883: <li><tt>Left</tt>: at the left edge,</li> 4884: <li><tt>Right</tt>: at the right edge,</li> 4885: <li><tt>VMiddle</tt>: centered</li> 4886: <li><tt>LeftWithDots</tt>: at the left edge with a dotted line filling out 4887: the last line up to the right edge of the line breaking box.</li> 1.18 cvs 4888: </ul> 1.30 cvs 4889: 4890: <p>An inherited value can only be the same as that of the reference box and is 1.18 cvs 4891: specified by a kinship keyword followed by an equals sign.</p> 4892: <pre> 'Adjust' ':' AlignOrInherit 1.1 cvs 4893: AlignOrInherit = Kinship '=' / Alignment . 4894: Alignment = 'Left' / 'Right' / 'VMiddle' / 1.18 cvs 4895: 'LeftWithDots' .</pre> 4896: </div> 1.1 cvs 4897: 1.18 cvs 4898: <div class="subsubsection"> 1.30 cvs 4899: <h4><a name="sectd42224">Justification</a></h4> 1.1 cvs 4900: 1.30 cvs 4901: <p>The <tt>Justify</tt> rule indicates whether the lines contained in the box 4902: and produced by a <tt>Line</tt> rule should be extended horizontally to occupy 4903: the entire width of their enclosing box. The first and last lines are treated 1.1 cvs 4904: specially: the position of the beginning of the first line is fixed by the 1.18 cvs 4905: <tt>Indent</tt> rule and last line is not extended. The justification 1.1 cvs 4906: parameter defined by this rule takes a boolean value, which can be a constant 4907: or inherited. A constant boolean value is expressed by either the 1.18 cvs 4908: <tt>Yes</tt> or the <tt>No</tt> keyword. An inherited value can only be the 1.1 cvs 4909: same as that of the reference box and is specified by a kinship keyword 1.18 cvs 4910: followed by an equals sign.</p> 4911: <pre> 'Justify' ':' BoolInherit 1.1 cvs 4912: BoolInherit = Boolean / Kinship '=' . 1.18 cvs 4913: Boolean ='Yes' / 'No' .</pre> 1.30 cvs 4914: 4915: <p>When the lines are justified, the alignment parameter specified in the 1.18 cvs 4916: <tt>Adjust</tt> rule has no influence, other than on the last line produced. 1.1 cvs 4917: This occurs because, when the other are extended to the limits of the box, the 1.18 cvs 4918: alignment style is no longer perceptible.</p> 1.30 cvs 4919: 1.18 cvs 4920: <blockquote class="example"> 1.30 cvs 4921: <p><strong>Example:</strong></p> 4922: 4923: <p>An important use of inheritance is to vary the characteristics of lines 4924: for an element type (for example, Paragraph) according to the enclosing 4925: environment (for example, Summary or Section), and thus obtain different 4926: line breaking styles for the same elements when they appear in different 4927: environments. The following rules specify that paragraphs inherit their 4928: alignment, justification, and line spacing:</p> 4929: <pre>Paragraph : 1.1 cvs 4930: BEGIN 4931: Justify : Enclosing = ; 4932: LineSpacing : Enclosing = ; 4933: Adjust : Enclosing =; 4934: Line; 1.18 cvs 4935: END;</pre> 1.30 cvs 4936: 4937: <p>If the alignment, justification, and line spacing of the Section and 4938: Summary elements is fixed:</p> 4939: <pre>Section : 1.1 cvs 4940: BEGIN 4941: Adjust : Left; 4942: Justify : Yes; 4943: LineSpacing : 1; 4944: END; 4945: Summary : 4946: BEGIN 4947: Adjust : VMiddle; 4948: Justify : No; 4949: LineSpacing : 1.3; 1.18 cvs 4950: END;</pre> 1.30 cvs 4951: 4952: <p>then the paragraphs appearing in sections are justified with a simple 4953: line spacing while those appearing in summaries are centered and not 4954: justified and have a larger line spacing. These are nevertheless the very 4955: same type of paragraph defined in the logical structure schema.</p> 1.18 cvs 4956: </blockquote> 4957: </div> 4958: 4959: <div class="subsubsection"> 1.30 cvs 4960: <h4><a name="sectd42225">Hyphenation</a></h4> 1.18 cvs 4961: 1.30 cvs 4962: <p>The <tt>Hyphenate</tt> rule indicates whether or not words should be broken 4963: by hyphenation at the end of lines. It affects the lines produced by the 1.18 cvs 4964: <tt>Line</tt> rule and contained in the box carrying the <tt>Hyphenate</tt> 4965: rule.</p> 1.30 cvs 4966: 4967: <p>The hyphenation parameter takes a boolean value, which can be either 4968: constant or inherited. A constant boolean value is expressed by either the 1.18 cvs 4969: <tt>Yes</tt> or the <tt>No</tt> keyword. An inherited value can only be the 1.1 cvs 4970: same as that of the reference box and is specified by a kinship keyword 1.18 cvs 4971: followed by an equals sign.</p> 4972: <pre> 'Hyphenate' ':' BoolInherit 1.1 cvs 4973: BoolInherit = Boolean / Kinship '=' . 1.18 cvs 4974: Boolean = 'Yes' / 'No' .</pre> 4975: </div> 4976: 4977: <div class="subsubsection"> 1.30 cvs 4978: <h4><a name="sectd42226">Avoiding line breaking</a></h4> 1.18 cvs 4979: 1.30 cvs 4980: <p>The <tt>InLine</tt> rule is used to specify that a box that would otherwise 1.18 cvs 4981: participate in line breaking asked for by the <tt>Line</tt> rule of an 1.1 cvs 4982: enclosing box, instead avoids the line breaking process and positions itself 1.18 cvs 4983: according to the <tt>HorizPos</tt> and <tt>VertPos</tt> rules that apply to 4984: it. When the <tt>InLine</tt> rule applies to a box which would not be line 4985: broken, it has no effect.</p> 1.30 cvs 4986: 4987: <p>The rule is expressed by the <tt>InLine</tt> keyword followed by a colon 4988: and the keyword <tt>Yes</tt>, if the box should participate in line breaking, 4989: or the keyword <tt>No</tt>, if it should not. This is the only form possible: 1.1 cvs 4990: this rule cannot be inherited. Moreover, it can only appear in the rules of 4991: the primary view and applies to all views defined in the presentation 1.18 cvs 4992: schema.</p> 4993: <pre> 'InLine' ':' Boolean . 4994: Boolean = 'Yes' / 'No' .</pre> 1.30 cvs 4995: 1.18 cvs 4996: <blockquote class="example"> 1.30 cvs 4997: <p><strong>Example:</strong></p> 4998: 4999: <p>Suppose the structure schema defines a logical attribute called 5000: <tt>New</tt> which is used to identify the passages in a document which were 5001: recently modified. It would be nice to have the presentation schema make a 5002: bar appear in the left margin next to each passage having the <tt>New</tt> 5003: attribute. A new passage can be an entire element, such as a paragraph or 5004: section, or it can be some words in the middle of a paragraph. To produce 5005: the desired effect, the <tt>New</tt> attribute is given a creation rule 5006: which generates a <tt>VerticalBar</tt> presentation box.</p> 5007: 5008: <p>When the <tt>New</tt> attribute is attached to a character string which 5009: is inside a line broken element (inside a paragraph, for example), the bar 5010: is one of the elements which participates in line breaking and it is placed 5011: normally in the current line, at the end of the character string which has 5012: the attribute. To avoid this, the <tt>InLine</tt> rule is used in the 5013: following way:</p> 5014: <pre>BOXES 1.1 cvs 5015: VerticalBar: 5016: BEGIN 5017: Content: Graphics 'l'; 5018: HorizPos: Left = Root . Left; 5019: VertPos: Top = Creator . Top; 5020: Height: Bottom = Creator . Bottom; 5021: Width: 1 pt; 5022: InLine: No; 5023: ... 5024: END; 5025: ... 5026: ATTRIBUTES 5027: Nouveau: 5028: BEGIN 5029: CreateAfter(VerticalBar); 1.18 cvs 5030: END;</pre> 5031: </blockquote> 5032: </div> 5033: </div> 1.1 cvs 5034: 1.18 cvs 5035: <div class="subsection"> 1.30 cvs 5036: <h3><a name="sectc4223">Page breaking and line breaking conditions</a></h3> 1.1 cvs 5037: 1.30 cvs 5038: <p>Pages are constructed by the editor in accordance with the model specified 5039: by a <a href="#sectc4233"><tt>Page</tt> rule</a>. The page model describes 5040: only the composition of the pages but does not give any rules for breaking 1.18 cvs 5041: different element types across pages. Now, it is possible that certain 5042: elements must not be cut by page breaks, while others can be cut anywhere. The 5043: <tt>PageBreak</tt>, <tt>NoBreak1</tt>, and <tt>NoBreak2</tt> rules are used to 5044: specify the conditions under which each element type can be cut.</p> 1.30 cvs 5045: 5046: <p>The <tt>PageBreak</tt> rule is used to indicate whether or not the box can 5047: be cut during the construction of pages. If cutting is authorized, the box 5048: can be cut, with one part appearing at the bottom of a page and the other part 1.1 cvs 5049: appearing at the top of the next page. The rule is formed by the 1.18 cvs 5050: <tt>PageBreak</tt> keyword followed by a colon and a constant boolean value 5051: (<tt>Yes</tt> or <tt>No</tt>). This is the only form possible: this rule 1.1 cvs 5052: cannot be inherited. Moreover, it can only appear in the rules of the primary 1.18 cvs 5053: view and applies to all views defined in the presentation schema.</p> 1.30 cvs 5054: 5055: <p>Whether objects can be cut by line breaks can be controlled in a similar 5056: way using the <tt>LineBreak</tt> rule. This rule allows the specification of 1.1 cvs 5057: whether or not the box can be cut during the construction of lines. If 5058: cutting is authorized, the box can be cut, with one part appearing at the end 5059: of a line and the other part appearing at the beginning of the next line. The 1.18 cvs 5060: rule is formed by the <tt>LineBreak</tt> keyword followed by a colon and a 5061: constant boolean value (<tt>Yes</tt> or <tt>No</tt>). This is the only form 1.1 cvs 5062: possible: this rule cannot be inherited. Moreover, it can only appear in the 5063: rules of the primary view and applies to all views defined in the presentation 1.18 cvs 5064: schema.</p> 5065: <pre> 'PageBreak' ':' Boolean . 1.1 cvs 5066: 'LineBreak' ':' Boolean . 1.18 cvs 5067: Boolean = 'Yes' / 'No' .</pre> 1.30 cvs 5068: 5069: <p>When a box can be cut by a page break, it is possible that a page break 5070: will fall an inappropriate spot, creating, for example, a widow or orphan, or 1.1 cvs 5071: separating the title of a section from the first paragraph of the section. The 1.18 cvs 5072: <tt>NoBreak1</tt> and <tt>NoBreak2</tt> rules are used to avoid this. They 5073: specify that the box of the element to which they apply cannot be cut within a 5074: certain zone at the top (<tt>NoBreak1</tt> rule) or at the bottom 5075: (<tt>NoBreak2</tt> rule). These two rules specify the height of the zones in 5076: which page breaks are prohibited.</p> 1.30 cvs 5077: 5078: <p>The <tt>NoBreak1</tt> and <tt>NoBreak2</tt> rules give the height of the 5079: zone in which page breaking is prohibited. The height is given as a constant 5080: value using any of the <a href="#sectc4217">available units</a>, absolute or 1.18 cvs 5081: relative. The value may not be inherited.</p> 5082: <pre> 'NoBreak1' ':' AbsDist . 5083: 'NoBreak2' ':' AbsDist .</pre> 1.30 cvs 5084: 1.18 cvs 5085: <blockquote class="example"> 1.30 cvs 5086: <p><strong>Example:</strong></p> 5087: 5088: <p>The following rules prevent widows and orphans in a paragraph:</p> 5089: <pre>Paragraph : 1.1 cvs 5090: BEGIN 5091: NoBreak1 : 2; 5092: NoBreak2 : 2; 1.18 cvs 5093: END;</pre> 1.30 cvs 5094: 5095: <p>This rule prevents a section title from becoming separated from the first 5096: paragraph of the section by prohibiting page breaks at the beginning of the 5097: section rule:</p> 5098: <pre>Section : 1.18 cvs 5099: NoBreak1 : 1.5 cm;</pre> 1.30 cvs 5100: 5101: <p>Finally, this rule prevents a figure from being page broken in any 5102: way:</p> 5103: <pre>Figure : 1.18 cvs 5104: PageBreak : No;</pre> 5105: </blockquote> 1.30 cvs 5106: 5107: <p>The Thot editor constructs the document images displayed on the screen 1.1 cvs 5108: dynamically. As the user moves in the document or makes the document scroll 5109: in a window, the editor constructs the image to be displayed in little bits, 5110: filling the gaps which are produced in the course of these operations. It 5111: stops filling in the image when an element reaches the edge of the window in 5112: which the gap appears. If the appearance of the document is complex, it is 5113: possible that the image in incomplete, even though the edge of the window was 5114: reached. For example, an element might need to be presented to the side of 5115: the last element displayed, but its image was not constructed. The user will 5116: not know whether the element is really absent or if its image has simply not 1.18 cvs 5117: been constructed.</p> 1.30 cvs 5118: 5119: <p>The <tt>Gather</tt> rule is used to remedy this problem. When the rule 1.18 cvs 5120: <tt>Gather : Yes;</tt> is associated with an element type, the image of such 5121: elements is constructed as a block by the editor: it is never split up.</p> 1.30 cvs 5122: 5123: <p>The <tt>Gather</tt> rule may not appear in the <a href="#sectc427">default 1.18 cvs 5124: rules</a>. Elements which do not have the <tt>Gather</tt> rule are considered 5125: susceptible to being split up during display. Thus, it is not necessary to 5126: use the <tt>Gather : No;</tt> form. This rule must be used prudently and only 5127: for those elements which truly need it. If used incorrectly, it can 5128: pointlessly increase the size of the image constructed by the editor and lead 5129: to excessive memory consumption by the editor.</p> 1.30 cvs 5130: 5131: <p>Like the <tt>PageBreak</tt> and <tt>LineBreak</tt> rules, the 5132: <tt>Gather</tt> rule can only appear in rules of the primary view and applies 5133: to all views defined in the presentation schema.</p> 1.18 cvs 5134: <pre> 'Gather' ':' Boolean .</pre> 5135: </div> 1.1 cvs 5136: 1.18 cvs 5137: <div class="subsection"> 1.30 cvs 5138: <h3><a name="sectc4224">Visibility</a></h3> 1.1 cvs 5139: 1.30 cvs 5140: <p>The visibility parameter is used to control which elements should or should 1.1 cvs 5141: not be displayed, based on context. An element can have different 5142: visibilities in different views. If an element's visibility is zero for a 5143: view, that element is not displayed in that view and does not occupy any space 1.18 cvs 5144: (its extents are zero).</p> 1.30 cvs 5145: 5146: <p>Visibility takes non-negative integer values (positive or zero). If values 1.1 cvs 5147: greater than 1 are used, they allow the user to choose a degree of visibility 5148: and, thus, to see only those boxes whose visibility parameter exceeds a 5149: certain threshold. This gives the user control over the granularity of the 1.18 cvs 5150: displayed pictures.</p> 1.30 cvs 5151: 5152: <p>The visibility parameter can be defined as a constant or by inheritance. If 1.1 cvs 5153: defined by inheritance, it cannot be based on the value of the next or 1.18 cvs 5154: previous box. Visibility can only be inherited from above.</p> 1.30 cvs 5155: 5156: <p>If it is a numeric attribute's presentation rule, the visibility can be 1.1 cvs 5157: specified by the attribute's name, in which case the value of the attribute is 1.18 cvs 5158: used.</p> 5159: <pre> 'Visibility' ':' NumberInherit 1.1 cvs 5160: NumberInherit = Integer / AttrID / Inheritance . 1.18 cvs 5161: Integer = NUMBER .</pre> 1.30 cvs 5162: 1.18 cvs 5163: <blockquote class="example"> 1.30 cvs 5164: <p><strong>Example:</strong></p> 5165: 5166: <p>Suppose that only <tt>Formula</tt> elements should be displayed in the 5167: <tt>MathView</tt> view. Then, the default rules should include:</p> 5168: <pre>DEFAULT 1.18 cvs 5169: IN MathView Visibility:0;</pre> 1.30 cvs 5170: 1.31 cvs 5171: <p>which makes all elements invisible in the <tt>MathView</tt> view. 1.30 cvs 5172: However, the <tt>Formula</tt> element also has a <tt>Visibility</tt> 5173: rule:</p> 5174: <pre>Formula : 1.18 cvs 5175: IN MathView Visibility:5;</pre> 1.30 cvs 5176: 5177: <p>which makes formulas, and only formulas, visible.</p> 1.18 cvs 5178: </blockquote> 5179: </div> 1.1 cvs 5180: 1.18 cvs 5181: <div class="subsection"> 1.30 cvs 5182: <h3><a name="sectc4225">Character style parameters</a></h3> 1.1 cvs 5183: 1.30 cvs 5184: <p>Four parameters are used to determine which characters are used to display 1.18 cvs 5185: text. They are size, font, style, and underlining.</p> 1.1 cvs 5186: 1.18 cvs 5187: <div class="subsubsection"> 1.30 cvs 5188: <h4><a name="sectd42251">Character size</a></h4> 5189: 5190: <p>The size parameter has two effects. First, it is used to specify the 5191: actual size and distance units for boxes defined in <a 5192: href="#sectc4217">relative units</a>. Second, it defines the size of the 5193: characters contained in the box.</p> 1.1 cvs 5194: 1.30 cvs 5195: <p>As a distance or length, the size can be expressed in abstract or absolute 1.1 cvs 5196: units. It can also be inherited. If it is not inherited, it is expressed 1.18 cvs 5197: simply as an integer followed by the <tt>pt</tt> keyword, which indicates that 5198: the size is expressed in typographer's points. The absence of the <tt>pt</tt> 1.1 cvs 5199: keyword indicates that it is in abstract units in which the value 1 represents 5200: the smallest size while the value 16 is the largest size. The relationship 5201: between these abstract sizes and the real character sizes is controlled by a 5202: table which can be modified statically or even dynamically during the 1.18 cvs 5203: execution of the Thot editor.</p> 1.30 cvs 5204: 5205: <p>If the <tt>Size</tt> rule is a numeric attribute's presentation rule, the 5206: value of the size parameter can be specified by the attribute's name, in which 5207: case the value of the attribute is used.</p> 5208: 5209: <p><strong>Note:</strong> the only unit available for defining an absolute 5210: size is the typographer's point. Centimeters and inches may not be used.</p> 5211: 5212: <p>If the size is inherited, the rule must specify the relative from which to 5213: inherit and any percentage or difference from that relative's value. A 5214: percentage is indicated by a <tt>*</tt> followed by the value of the 5215: percentage and a <tt>%</tt>. A difference can be expressed in either 5216: typographer's points or in abstract units and the maximum or minimum size can 5217: be specified, but without specifying the unit: it is the same as was specified 5218: for the difference.</p> 5219: 5220: <p>In a numeric attribute's presentation rule, the difference in size or the 1.22 cvs 5221: percentage can be indicated by the attribute's name instead of the numeric 5222: value, which means that the attribute's value should be used as the difference 5223: or percentage. The attribute can also be used as the minimum or maximum size 5224: for a difference.</p> 5225: <pre> 'Size' ':' SizeInherit 5226: SizeInherit = SizeAttr [ 'pt' ] / 5227: Kinship InheritedSize . 5228: InheritedSize ='+' SizeAttr [ 'pt' ] 5229: [ 'Max' MaxSizeAttr ] / 5230: '-' SizeAttr [ 'pt' ] 5231: [ 'Min' MinSizeAttr ] / 5232: '*' PercentSizeAttr '%' / 5233: '=' . 5234: SizeAttr = Size / AttrID . 5235: Size = NUMBER . 5236: MaxSizeAttr = MaxSize / AttrID . 5237: MaxSize = NUMBER . 5238: MinSizeAttr = MinSize / AttrID . 5239: MinSize = NUMBER . 5240: PercentSizeAttr = PercentSize / AttrID . 5241: PercentSize = NUMBER .</pre> 1.30 cvs 5242: 1.18 cvs 5243: <blockquote class="example"> 1.30 cvs 5244: <p><strong>Example:</strong></p> 5245: 5246: <p>The rule</p> 5247: <pre>Size : Enclosing - 2 pt Min 7;</pre> 5248: 5249: <p>states that the character size is 2 points less than that of the 5250: enclosing box, but that it may not be less than 7 points, whatever the 5251: enclosing box's value.</p> 5252: 5253: <p>The following rules make the text of a report be displayed with 5254: medium-sized characters (for example, size 5), while the title is displayed 5255: with larger characters and the summary is displayed with smaller 5256: characters:</p> 5257: <pre>Report : 1.1 cvs 5258: Size : 5; 5259: Title : 5260: Size : Enclosing + 2; 5261: Summary : 1.18 cvs 5262: Size : Enclosing - 1;</pre> 1.30 cvs 5263: 5264: <p>Thus, the character sizes in the entire document can be changed by 5265: changing the size parameter of the Report element, while preserving the 5266: relationships between the sizes of the different elements.</p> 1.18 cvs 5267: </blockquote> 5268: </div> 5269: 5270: <div class="subsubsection"> 1.30 cvs 5271: <h4><a name="sectd42252">Font and character style</a></h4> 1.18 cvs 5272: 1.30 cvs 5273: <p>The <tt>Font</tt> rule determines the font family to be used to display the 1.18 cvs 5274: characters contained in the box, while the <tt>Style</tt> rule determines 1.23 cvs 5275: their style and the <tt>Weight</tt> rule determines their weight. Thot 5276: recognizes three character fonts (Times, Helvetica, and Courier), three 5277: styles: Roman, Italics, and Oblique, and two weights: Normal and Bold.</p> 1.30 cvs 5278: 5279: <p>The font family, style and weight can be specified by a named constant or 5280: can be inherited. For the name of the font family only the first character is 5281: used.</p> 5282: 5283: <p>Only identical inheritance is allowed: the box takes the same font, style 5284: or weight as the box from which it inherits. This is indicated by an equals 1.23 cvs 5285: sign after the kinship specification.</p> 5286: <pre> 'Font' ':' NameInherit / 5287: 'Style' ':' StyleInherit / 5288: 'Weight' ':' WeightInherit / 5289: 5290: NameInherit = Kinship '=' / FontName . 5291: FontName = NAME . 5292: StyleInherit = Kinship '=' / 5293: 'Roman' / 'Italics' / 'Oblique' . 5294: WeightInherit = Kinship '=' / 5295: 'Normal' / 'Bold' .</pre> 1.30 cvs 5296: 1.18 cvs 5297: <blockquote class="example"> 1.30 cvs 5298: <p><strong>Example:</strong></p> 5299: 5300: <p>To specify that the summary uses the font family of the rest of the 5301: document, but in the italic style, the following rules are used:</p> 5302: <pre>Summary : 1.1 cvs 5303: BEGIN 5304: Font : Enclosing =; 5305: Style : Italics; 1.18 cvs 5306: END;</pre> 5307: </blockquote> 5308: </div> 5309: 5310: <div class="subsubsection"> 1.30 cvs 5311: <h4><a name="sectd42253">Underlining</a></h4> 1.18 cvs 5312: 1.30 cvs 5313: <p>The <tt>Underline</tt> rule is used to specify if the characters contained 5314: in a box should have lines drawn on or near them. There are four underlining 1.18 cvs 5315: styles: <tt>Underlined</tt>, <tt>Overlined</tt>, <tt>CrossedOut</tt>, and 5316: <tt>NoUnderline</tt>. The <tt>Thickness</tt> rule specifies the thickness of 5317: the line, <tt>Thin</tt> or <tt>Thick</tt>.</p> 1.30 cvs 5318: 5319: <p>As with font family and style, only identical inheritance is allowed: the 5320: box has the same underlining type as the box from which it inherits the value. 1.18 cvs 5321: This is indicated by an equals sign after the kinship specification.</p> 5322: <pre> 'Underline' ':' UnderLineInherit / 1.1 cvs 5323: 'Thickness' ':' ThicknessInherit / 5324: 5325: UnderLineInherit = Kinship '=' / 'NoUnderline' / 5326: 'Underlined' / 5327: 'Overlined' / 'CrossedOut' . 1.18 cvs 5328: ThicknessInherit = Kinship '=' / 'Thick' / 'Thin' .</pre> 5329: </div> 5330: </div> 5331: 5332: <div class="subsection"> 1.30 cvs 5333: <h3><a name="sectc4226">Stacking order</a></h3> 1.18 cvs 5334: 1.30 cvs 5335: <p>The <tt>Depth</tt> rule is used to define the stacking order of terminal 5336: boxes when multiple boxes at least partially overlap. This rule defines how 5337: the depth parameter, which is zero or a positive integer, is calculated. The 1.1 cvs 5338: depth parameter has a value for all boxes. For terminal boxes in the 5339: structure and for presentation boxes, the depth value is used during display 5340: and printing: the boxes with the lowest value overlap those with higher 5341: depths. For non-terminal boxes, the depth is not interpreted during display, 1.18 cvs 5342: but it is used to calculate the depth of terminal boxes by inheritance.</p> 1.30 cvs 5343: 5344: <p>Like most other rules, the depth rule is defined in the <a 1.18 cvs 5345: href="#sectc427">default rules</a> of each presentation schema. Thus, there 5346: is always a depth value, even when it is not necessary because there is no 5347: overlapping. To avoid useless operations, a zero value can be given to the 5348: depth parameter, which signifies that overlapping is never a problem.</p> 1.30 cvs 5349: 5350: <p>The depth rule has the same form as the <a href="#sectc4224">visibility 1.18 cvs 5351: rule</a>. It can be defined by inheritance or by a constant numeric value. 5352: When the rule is attached to a numeric attribute, it can take the value of 5353: that attribute.</p> 5354: <pre> 'Depth' ':' NumberInherit</pre> 1.30 cvs 5355: 1.18 cvs 5356: <blockquote class="example"> 1.30 cvs 5357: <p><strong>Example:</strong></p> 5358: 5359: <p>For a purely textual document, in which overlapping never poses a 5360: problem, a single default <tt>Depth</tt> rule in the presentation schema is 5361: sufficient:</p> 5362: <pre>DEFAULT 1.1 cvs 5363: Depth : 0; 1.18 cvs 5364: ...</pre> 1.30 cvs 5365: 5366: <p>To make the text of examples appear on a light blue background, a 5367: presentation box is defined:</p> 5368: <pre>BOXES 1.1 cvs 5369: BlueBG : 5370: BEGIN 5371: Content : Graphics 'R'; 5372: Background : LightBlue3; 5373: FillPattern: backgroundcolor; 5374: Depth : 2; 5375: ... 1.18 cvs 5376: END;</pre> 1.30 cvs 5377: 5378: <p>and is created by the <tt>Example</tt> element, which has the rules:</p> 5379: <pre>RULES 1.1 cvs 5380: Example : 5381: BEGIN 5382: CreateFirst (BlueBG); 5383: Depth : 1; 5384: ... 1.18 cvs 5385: END;</pre> 1.30 cvs 5386: 5387: <p>In this way, the text of an example (if it inherits its depth from its 5388: ancestor) will be superimposed on a light blue background, and not the 5389: reverse).</p> 1.18 cvs 5390: </blockquote> 5391: </div> 5392: 5393: <div class="subsection"> 1.30 cvs 5394: <h3><a name="sectc4227">Line style</a></h3> 1.18 cvs 5395: 1.30 cvs 5396: <p>The <tt>LineStyle</tt> rule determines the style of line which should be 5397: used to draw all the elements contained in the box and the box itself, if it 5398: has a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. The line style can be 1.18 cvs 5399: indicated by a name (<tt>Solid</tt>, <tt>Dashed</tt>, <tt>Dotted</tt>) or it 1.13 cvs 5400: can be inherited. All elements of the graphic base type are affected by this 1.1 cvs 5401: rule, but it can be attached to any box and transmitted by inheritance to the 1.18 cvs 5402: graphic elements. The border of elements having a <a 5403: href="#sectc4230a"><tt>ShowBox</tt> rule</a> is drawn according to the line 5404: style specified by this rule.</p> 1.30 cvs 5405: 5406: <p>Only identical inheritance is allowed: the box takes the same line style as 1.1 cvs 5407: the box from which it inherits. This is indicated by an equals sign after the 1.18 cvs 5408: kinship specification.</p> 5409: <pre> 'LineStyle' ':' LineStyleInherit 1.1 cvs 5410: LineStyleInherit = Kinship '=' / 1.18 cvs 5411: 'Solid' / 'Dashed' / 'Dotted' .</pre> 1.30 cvs 5412: 1.18 cvs 5413: <blockquote class="example"> 1.30 cvs 5414: <p><strong>Example:</strong></p> 5415: 5416: <p>To specify that, in Figures, the graphical parts should be drawn in solid 5417: lines, the Figure element is given a rule using the <tt>Solid</tt> name:</p> 5418: <pre>Figure : 1.18 cvs 5419: LineStyle : Solid;</pre> 1.30 cvs 5420: 5421: <p>and the elements composing figures are given an inheritance rule:</p> 5422: <pre> LineStyle : Enclosing =;</pre> 1.18 cvs 5423: </blockquote> 5424: </div> 5425: 5426: <div class="subsection"> 1.30 cvs 5427: <h3><a name="sectc4228">Line thickness</a></h3> 1.18 cvs 5428: 1.30 cvs 5429: <p>The <tt>LineWeight</tt> rule determines the thickness of the lines of all 1.1 cvs 5430: graphical elements which appear in the box, no matter what their line style. 5431: Line thickness can be specified by a constant value or by inheritance. A 5432: constant value is a positive number followed by an optional unit specification 1.18 cvs 5433: (which is absent when using relative units). All available <a 5434: href="#sectc4217">distance units</a> can be used. Line thickness is expressed 5435: in the same way as <a href="#sectd42221">line spacing</a>.</p> 5436: <pre> 'LineWeight' ':' DistOrInherit</pre> 1.30 cvs 5437: 5438: <p>All elements of the graphic base type are affected by this rule, but it can 5439: be attached to any box and transmitted by inheritance to the graphic elements. 1.18 cvs 5440: The border of element having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a> 5441: is also drawn according to the thickness specified by this rule.</p> 1.30 cvs 5442: 1.18 cvs 5443: <blockquote class="example"> 1.30 cvs 5444: <p><strong>Example:</strong></p> 5445: 5446: <p>To specify that, in Figures, the graphical parts should be drawn with 5447: lines 0.3 pt thick, the Figure element is given this rule:</p> 5448: <pre>Figure : 1.18 cvs 5449: LineWeight : 0.3 pt;</pre> 1.30 cvs 5450: 5451: <p>and the elements composing figures are given an inheritance rule:</p> 5452: <pre> LineWeight : Enclosing =;</pre> 1.18 cvs 5453: </blockquote> 5454: </div> 5455: 5456: <div class="subsection"> 1.30 cvs 5457: <h3><a name="sectc4229">Fill pattern</a></h3> 1.18 cvs 5458: 1.30 cvs 5459: <p>The <tt>FillPattern</tt> rule determines the pattern used to fill closed 1.1 cvs 5460: graphical elements (circles, rectangles, etc.) which appear in the box. This 1.18 cvs 5461: rule also specifies the pattern used to fill the box associated with elements 5462: having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a><a>. This pattern can 5463: be indicated by a named constant or by inheritance. The named constant 5464: identifies one of the patterns available in Thot. The names of the available 5465: patterns are: nopattern, foregroundcolor, backgroundcolor, gray1, gray2, 5466: gray3, gray4, gray5, gray6, gray7, horiz1, horiz2, horiz3, vert1, vert2, 5467: vert3, left1, left2, left3, right1, right2, right3, square1, square2, square3, 5468: lozenge, brick, tile, sea, basket.</a></p> 1.30 cvs 5469: 5470: <p>Like the other rules peculiar to graphics, <tt>LineStyle</tt> and 1.18 cvs 5471: <tt>LineWeight</tt>, only elements of the graphic base type are affected by 5472: the <tt>FillPattern</tt> rule, but the rule can be attached to any box and 1.1 cvs 5473: transmitted by inheritance to the graphic elements. As with the other rules 1.18 cvs 5474: specific to graphics, only identical inheritance is allowed.</p> 1.30 cvs 5475: 5476: <p>The <tt>FillPattern</tt> rule can also be used to determine whether or not 1.12 cvs 5477: text characters, symbols and pictures should be colored. For these element 5478: types (text, symbols, and pictures), the only valid values are 1.18 cvs 5479: <tt>nopattern</tt>, <tt>foregroundcolor</tt>, and <tt>backgroundcolor</tt>. 5480: When <tt>FillPattern</tt> has the value <tt>backgroundcolor</tt>, text 5481: characters, symbols, and bitmaps are given the color specified by the <a 5482: href="#sectc4230"><tt>Background</tt> rule</a> which applies to these 5483: elements. When <tt>FillPattern</tt> has the value <tt>foregroundcolor</tt>, 5484: these same elements are given the color specified by the <a 5485: href="#sectc4230"><tt>Foreground</tt> rule</a> which applies to these 5486: elements. In all other case, text characters are not colored.</p> 5487: <pre> 'FillPattern' ':' NameInherit</pre> 1.30 cvs 5488: 1.18 cvs 5489: <blockquote class="example"> 1.30 cvs 5490: <p><strong>Example:</strong></p> 5491: 5492: <p>To specify that, in Figures, the closed graphical elements should be 5493: filled with a pattern resembling a brick wall, the Figure element is given 5494: this rule:</p> 5495: <pre>Figure : 1.18 cvs 5496: FillPattern : brick;</pre> 1.30 cvs 5497: 5498: <p>and the elements composing figures are given an inheritance rule:</p> 5499: <pre> FillPattern : Enclosing =;</pre> 1.18 cvs 5500: </blockquote> 5501: </div> 5502: 5503: <div class="subsection"> 1.30 cvs 5504: <h3><a name="sectc4230">Colors</a></h3> 1.18 cvs 5505: 1.30 cvs 5506: <p>The <tt>Foreground</tt> and <tt>Background</tt> rules determine the 5507: foreground and background colors of the base elements which appear in the box. 5508: They also control the color of boxes associated with elements having a <a 1.18 cvs 5509: href="#sectc4230a"><tt>ShowBox</tt> rule</a>. These colors can be specified 5510: with a named constant or by inheritance. The named constants specify one of 5511: the available colors in Thot. The available color names can be found in the 1.30 cvs 5512: file <tt>thot.color</tt>. In addition to those names, you can use the keyword 5513: <code>Transparent</code>, to not draw anything.</p> 5514: 5515: <p>The color rules affect the same way all base elements and elements having a 5516: <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>, no matter what their type 5517: (text, graphics, pictures, symbols). The color rules can be associated with 5518: any box and can be transmitted by inheritance to the base elements or the 5519: elements having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. Like the 5520: preceding rules, only inheritance of the same value is allowed.</p> 5521: <pre> 'Foreground' ':' Color 5522: 'Background' ':' Color 5523: Color = 'Transparent' / Link '=' / FontColorName .</pre> 5524: 5525: <p><strong>Note:</strong> text colors only appear for text elements whose <a 1.18 cvs 5526: href="#sectc4229">fill pattern</a> does not prevent the use of color.</p> 1.30 cvs 5527: 1.18 cvs 5528: <blockquote class="example"> 1.30 cvs 5529: <p><strong>Example:</strong></p> 5530: 5531: <p>To specify that, in Figures, everything must be drawn in blue on a 5532: background of yellow, the Figure element is given these rules:</p> 5533: <pre>Figure : 1.1 cvs 5534: BEGIN 5535: Foreground : Blue; 5536: Background : Yellow; 5537: Fillpattern : backgroundcolor; 1.18 cvs 5538: END;</pre> 1.30 cvs 5539: 5540: <p>and the elements composing figures are given inheritance rules:</p> 5541: <pre> Foreground : Enclosing =; 1.1 cvs 5542: Background : Enclosing =; 1.18 cvs 5543: FillPattern : Enclosing =;</pre> 5544: </blockquote> 5545: </div> 5546: 5547: <div class="subsection"> 1.30 cvs 5548: <h3><a name="sectc4230a">Background color and border</a></h3> 1.18 cvs 5549: 1.30 cvs 5550: <p>Boxes associated with structural elements are normally not visible, but it 5551: is possible to draw their border and/or to paint their area when it is needed. 1.18 cvs 5552: This is achieved by associating the <tt>ShowBox</tt> rule with the concerned 1.13 cvs 5553: element. This rule has no parameter and no value. It is simply written 1.18 cvs 5554: <tt>Showbox;</tt>. It is not inherited nor transmitted to any other element. 5555: It applies only to the element with which it is associated.</p> 5556: <pre> 'ShowBox'</pre> 1.30 cvs 5557: 5558: <p>When an element has a <tt>ShowBox</tt> rule, the border is drawn only if 5559: the <tt>LineWeight</tt> rule that applies to that element has a non-zero value 1.18 cvs 5560: (this value can be inherited). The color, style and thickness of the border 5561: are defined by the <tt>Foreground</tt>, <tt>LineStyle</tt>, and 5562: <tt>LineWeight</tt> rules that apply to the element.</p> 1.30 cvs 5563: 5564: <p>When an element has a <tt>ShowBox</tt> rule, the background of this element 5565: is paint only if the value of the <tt>FillPattern</tt> rule that applies to 5566: that element is not <tt>nopattern</tt>. The pattern and color(s) of the 5567: background are defined by the <tt>FillPattern</tt>, <tt>Background</tt>, and 1.18 cvs 5568: <tt>Foreground</tt> rules that apply to the element.</p> 5569: </div> 5570: 5571: <div class="subsection"> 1.30 cvs 5572: <h3><a name="sectc4230b">Background pictures</a></h3> 1.18 cvs 5573: 1.30 cvs 5574: <p>The <tt>BackgroundPicture</tt> rule allows to display a picture as the 1.13 cvs 5575: background of an element. It has a single parameter, the file name of the 1.18 cvs 5576: picture. This is a string delimited by single quotes. If the first character 5577: in this string is '/', it is considered as an absolute path, otherwise the 5578: file is searched for along the schema directory path. This file may contain a 5579: picture in any format accepted by Thot (xbm, xpm, gif, jpeg, png, etc.)</p> 1.30 cvs 5580: 5581: <p>The <tt>BackgroundPicture</tt> and <tt>PictureMode</tt> rules apply only to 1.13 cvs 5582: the element with which they are associated. They are not inherited nor 1.18 cvs 5583: transmitted to children elements.</p> 1.30 cvs 5584: 5585: <p>The background picture has not always the same size as the element's box. 1.13 cvs 5586: There are diffrent ways to fill the element box with the picture. This is 1.18 cvs 5587: specified by the <tt>PictureMode</tt> rule, which should be associated to the 5588: same element. This rule may take one of the following values:</p> 5589: <dl> 1.30 cvs 5590: <dt><tt>NormalSize</tt></dt> 5591: <dd>The picture is centered in the box, and clipped if it is too 5592: large.</dd> 5593: <dt><tt>Scale</tt></dt> 5594: <dd>The picture is zoomed to fit the box size.</dd> 5595: <dt><tt>RepeatX</tt></dt> 5596: <dd>The picture is repeated horizontally to fit the box width.</dd> 5597: <dt><tt>RepeatY</tt></dt> 5598: <dd>The picture is repeated vertically to fit the box height.</dd> 5599: <dt><tt>RepeatXY</tt></dt> 5600: <dd>The picture is repeated both horizontally and vertically to fill the 5601: box.</dd> 1.18 cvs 5602: </dl> 1.30 cvs 5603: 5604: <p>If an element has a <tt>BackgroundPicture</tt> rule and no 1.18 cvs 5605: <tt>PictureMode</tt> rule, the <tt>NormalSize</tt> value is assumed.</p> 5606: <pre> 'BackgroundPicture' ':' FileName / 1.13 cvs 5607: 'PictureMode' ':' PictMode . 5608: 5609: FileName = STRING . 1.18 cvs 5610: PictMode = 'NormalSize' / 'Scale' / 'RepeatXY' / 'RepeatX' / 'RepeatY' .</pre> 1.30 cvs 5611: 5612: <p>The <tt>BackgroundPicture</tt> and <tt>PictureMode</tt> rules apply only to 1.13 cvs 5613: the element with which they are associated. They are not inherited nor 1.18 cvs 5614: transmitted to children elements.</p> 5615: </div> 1.13 cvs 5616: 1.18 cvs 5617: <div class="subsection"> 1.30 cvs 5618: <h3><a name="sectc4231">Presentation box content</a></h3> 1.1 cvs 5619: 1.30 cvs 5620: <p>The <tt>Content</tt> rule applies to presentation boxes. It indicates the 1.1 cvs 5621: content given to a box. This content is either a variable's value or a 1.18 cvs 5622: constant value. In the special case of <a href="#sectc4233">header or footer 5623: boxes</a>, the content can also be a structured element type.</p> 1.30 cvs 5624: 5625: <p>If the content is a constant, it can be specified, as in a variable 1.18 cvs 5626: declaration, either by the name of a constant declared in the <tt>CONST</tt> 1.1 cvs 5627: section or by direct specification of the type and value of the box's 1.18 cvs 5628: content.</p> 1.30 cvs 5629: 5630: <p>Similarly, if it is a variable, the name of a variable declared in 1.18 cvs 5631: <tt>VAR</tt> section can be given or the variable may be defined within 5632: parentheses. The content inside the parentheses has the same syntax as a <a 5633: href="#sectc426">variable declaration</a>.</p> 1.30 cvs 5634: 5635: <p>When the content is a structured element type, the name of the element type 5636: is given after the colon. In this case, the box's content is all elements of 1.1 cvs 5637: the named type which are designated by references which are part of the page 1.18 cvs 5638: on which the header or footer with this <tt>Content</tt> rule appears. Only 5639: associated elements can appear in a <tt>Content</tt> rule and the structure 1.1 cvs 5640: must provide references to these elements. Moreover, the box whose content 5641: they are must be a header or footer box generated by a page box of the primary 1.18 cvs 5642: view.</p> 5643: <pre> 'Content' ':' VarConst 1.1 cvs 5644: VarConst = ConstID / ConstType ConstValue / 5645: VarID / '(' FunctionSeq ')' / 1.18 cvs 5646: ElemID .</pre> 1.30 cvs 5647: 5648: <p>A presentation box can have only one <tt>Content</tt> rule, which means 5649: that the content of a presentation box cannot vary from view to view. However, 5650: such an effect can be achieved by creating several presentation boxes, each 5651: with different content and visible in different views.</p> 5652: 5653: <p>The <tt>Content</tt> rule also applies to elements defined as references in 1.1 cvs 5654: the structure schema. In this case, the content defined by the rule must be 5655: a constant. It is this content which appears on the screen or paper to 5656: represent references of the type to which the rule applies. A reference can 1.18 cvs 5657: have a <tt>Content</tt> rule or a <a href="#sectc4234"><tt>Copy</tt> rule</a> 1.1 cvs 5658: for each view. If neither of these rules appears, the reference is displayed 1.18 cvs 5659: as <tt>[*]</tt>, which is equivalent to the rule:</p> 5660: <pre> Content: Text '[*]';</pre> 1.30 cvs 5661: 1.18 cvs 5662: <blockquote class="example"> 1.30 cvs 5663: <p><strong>Example:</strong></p> 5664: 5665: <p>The content of the presentation box created to make the chapter number 5666: and section number appear before each section title can be defined by:</p> 5667: <pre>BOXES 1.1 cvs 5668: SectionNumBox : 5669: BEGIN 5670: Content : NumSection; 5671: ... 1.18 cvs 5672: END;</pre> 1.30 cvs 5673: 5674: <p>if the <tt>NumSection</tt> variable has been defined in the variable 5675: definition section of the presentation schema. Otherwise the 5676: <tt>Content</tt> would be written:</p> 5677: <pre>BOXES 1.1 cvs 5678: SectionNumBox : 5679: BEGIN 5680: Content : (VALUE (ChapterCtr, Roman) TEXT '.' 5681: VALUE (SectionCtr, Arabic)); 5682: ... 1.18 cvs 5683: END;</pre> 1.30 cvs 5684: 5685: <p>To specify that a page footer should contain all elements of the 5686: <tt>Note</tt> type are referred to in the page, the following rule is 5687: written:</p> 5688: <pre>BOXES 1.1 cvs 5689: NotesFooterBox : 5690: BEGIN 5691: Content : Note; 5692: ... 1.18 cvs 5693: END;</pre> 1.30 cvs 5694: 5695: <p><tt>Note</tt> is defined as an associated element in the structure schema 5696: and NotesFooterBox is created by a page box of the primary view.</p> 1.18 cvs 5697: </blockquote> 5698: </div> 1.1 cvs 5699: 1.18 cvs 5700: <div class="subsection"> 1.30 cvs 5701: <h3><a name="sectc4232">Presentation box creation</a></h3> 1.1 cvs 5702: 1.30 cvs 5703: <p>A creation rule specifies that a presentation box should be created when an 1.18 cvs 5704: element of the type to which the rule is attached appears in the document.</p> 1.30 cvs 5705: 5706: <p>A keyword specifies the position, relative to the creating box, at which 5707: the created box will be placed in the structure:</p> 1.18 cvs 5708: <dl> 1.30 cvs 5709: <dt><tt>CreateFirst</tt></dt> 5710: <dd>specifies that the box should be created as the first box of the next 5711: lower level, before any already existing boxes, and only if the 5712: beginning of the creating element is visible;</dd> 5713: <dt><tt>CreateLast</tt></dt> 5714: <dd>specifies that the box should be created as the last box of the next 5715: lower level, after any existing boxes, and only if the end of the 5716: creating element is visible;</dd> 5717: <dt><tt>CreateBefore</tt></dt> 5718: <dd>specifies that the box should be created before the creating box, on 5719: the same level as the creating box, and only if the beginning of the 5720: creating element is visible;</dd> 5721: <dt><tt>CreateAfter</tt></dt> 5722: <dd>specifies that the box should be created after the creating box, on 5723: the same level as the creating box, and only if the beginning of the 5724: creating element is visible;</dd> 5725: <dt><tt>CreateEnclosing</tt></dt> 5726: <dd>specifies that the box should be created at the upper level relatively 5727: to the creating box, and that it must contain that creating box and all 5728: presentation boxes created by the same creating box.</dd> 1.18 cvs 5729: </dl> 1.30 cvs 5730: 5731: <p>This keyword can be followed by the <tt>Repeated</tt> keyword to indicate 5732: that the box must be created for each part of the creating element. These 5733: parts result from the division of the element by page breaks or column 5734: changes. If the <tt>Repeated</tt> keyword is missing, the box is only created 5735: for the first part of the creating element (<tt>CreateFirst</tt> and 1.18 cvs 5736: <tt>CreateBefore</tt> rules) or for the last part (<tt>CreateLast</tt> and 5737: <tt>CreateAfter</tt> rules).</p> 1.30 cvs 5738: 5739: <p>The type of presentation to be created is specified at the end of the rule 1.18 cvs 5740: between parentheses.</p> 1.30 cvs 5741: 5742: <p>Creation rules cannot appear in the <a href="#sectc427">default 5743: presentation rules</a>. The boxes being created should have a 5744: <tt>Content</tt> rule which indicates their <a 5745: href="#sectc4231">content</a>.</p> 5746: 5747: <p>Creation rules can only appear in the block of rules for the primary view; 1.1 cvs 5748: creation is provoked by a document element for all views. However, for each 5749: view, the presentation box is only created if the creating element is itself a 5750: box in the view. Moreover, the visibility parameter of the presentation box 5751: can be adjusted to control the creation of the box on a view-by-view 1.18 cvs 5752: basis.</p> 5753: <pre> Creation '(' BoxID ')' 1.1 cvs 5754: Creation = Create [ 'Repeated' ] . 5755: Create ='CreateFirst' / 'CreateLast' / 5756: 'CreateBefore' / 'CreateAfter' / 1.18 cvs 5757: 'CreateEnclosing' .</pre> 1.30 cvs 5758: 1.18 cvs 5759: <blockquote class="example"> 1.30 cvs 5760: <p><strong>Example:</strong></p> 5761: 5762: <p>Let us define an object type, called Table, which is composed of a 5763: sequence of columns, all having the same fixed width, where the columns are 5764: separated by vertical lines. There is a line to the left of the first 5765: column and one to the right of the last. Each column has a variable number 1.31 cvs 5766: of cells, placed one on top of the other and separated by horizontal lines. 5767: There are no horizontal lines above the first cell or below the last cell. 1.30 cvs 5768: The text contained in each cell is broken into lines and these lines are 5769: centered horizontally in the cell. The logical structure of this object is 5770: defined by:</p> 5771: <pre>Table = LIST OF (Column); 1.18 cvs 5772: Column = LIST OF (Cell = Text);</pre> 5773: 1.30 cvs 5774: <div class="figure"> 5775: <hr> 5776: <pre>| | | | 1.1 cvs 5777: | xx xxxx xxxx |x xxxx xxx xxxxx| x xxx x xxx | 5778: | xxx xxx xxxx x | x xx x xxx | xxxxx xxxx xx | 5779: | xxxxx xxxx |----------------| xxx xxxxx x | 5780: | xxxxx xxx xxxx | xxxx xx xx xxx | xx xx | 5781: | xxx xxxx x xxx | xxxx x xxx x |---------------| 5782: |----------------| xxx xxxx xxxxx | xxxxx xxxxx | 5783: | xxx xxx xxxxxx |----------------| xxx xxxx xxxx | 5784: | xxxx xxxx xx | xxxx xx x xx | xxx xx x xx | 5785: |----------------| xxx xxxxx xxxx | xxxx xxxx xxx | 5786: | xxxxx xxx xxxx | xxxx xx x xx | xxxxx xxx | 1.18 cvs 5787: |xxxx xx x xxxxxx| xxxx xx xxxxxx | xxxxx xxxxx |</pre> 1.19 cvs 5788: 1.30 cvs 5789: <p align="center"><em><a name="table">The design of a table</a></em></p> 5790: <hr> 5791: </div> 5792: 5793: <p>The presentation of the table should resemble the design of the above <a 5794: href="#table">figure</a>. It is defined by the following presentation 5795: schema fragment:</p> 5796: <pre>BOXES 1.1 cvs 5797: VertLine : BEGIN 5798: Width : 0.3 cm; 5799: Height : Enclosing . Height; 5800: VertPos : Top = Enclosing . Top; 5801: HorizPos : Left = Previous . Right; 5802: Content : Graphics 'v'; 5803: END; 5804: 5805: HorizLine: BEGIN 5806: Width : Enclosing . Width; 5807: Height : 0.3 cm; 5808: VertPos : Top = Previous . Bottom; 5809: HorizPos : Left = Enclosing . Left; 5810: Content : Graphics 'h'; 5811: END; 5812: 5813: RULES 1.6 cvs 5814: Column : BEGIN 5815: CreateBefore (VertLine); 5816: IF LAST CreateAfter (VertLine); 5817: Width : 2.8 cm; 5818: Height : Enclosed . Height; 5819: VertPos : Top = Enclosing . Top; 5820: HorizPos : Left = Previous . Right; 5821: END; 5822: 5823: Cell : BEGIN 5824: IF NOT FIRST CreateBefore (HorizLine); 5825: Width : Enclosing . Width; 5826: Height : Enclosed . Height; 5827: VertPos : Top = Previous . Bottom; 5828: HorizPos : Left = Enclosing . Left; 5829: Line; 5830: Adjust : VMiddle; 1.18 cvs 5831: END;</pre> 1.30 cvs 5832: 5833: <p>It is useful to note that the horizontal position rule of the first 5834: vertical line will not be applied, since there is no preceding box. In this 5835: case, the box is simply placed on the left side of the enclosing box.</p> 1.18 cvs 5836: </blockquote> 5837: </div> 5838: 5839: <div class="subsection"> 1.30 cvs 5840: <h3><a name="sectc4233">Page layout</a></h3> 1.18 cvs 5841: 1.30 cvs 5842: <p>The page models specified in the <tt>Page</tt> rule are defined by boxes 1.18 cvs 5843: declared in the <tt>BOXES</tt> section of the presentation schema. Pages are 1.1 cvs 5844: not described as frames which will be filled by the document's text, but as 5845: element are inserted in the flow of the document and which mark the page 5846: breaks. Each of these page break elements contains presentation boxes which 5847: represent the footer boxes of a page followed by header boxes of the next 5848: page. The page box itself is the simple line which separates two pages on the 5849: screen. Both the footer and header boxes placed themselves with respect to 5850: this page box, with the footer being placed above it and the header boxes 1.18 cvs 5851: being placed above it.</p> 1.30 cvs 5852: 5853: <p>The boxes created by a page box are headers and footers and can only place 1.1 cvs 5854: themselves vertically with respect to the page box itself (which is in fact 5855: the separation between two pages). Besides, it is their vertical position 5856: rule which determines whether they are header or footer boxes. Header and 5857: footer boxes must have an explicit vertical position rule (they must not use 1.18 cvs 5858: the default rule).</p> 1.30 cvs 5859: 5860: <p>Footer boxes must have an absolute height or inherit the height of their 1.18 cvs 5861: contents:</p> 5862: <pre>Height : Enclosed . Height;</pre> 1.30 cvs 5863: 5864: <p>A page box must have height and width rules and these two rules must be 1.1 cvs 5865: specified with constant values, expressed in centimeters, inches, or 5866: typographer's points. These two rules are interpreted in a special way for 5867: page boxes: they determine the width of the page and the vertical distance 5868: between two page separators, which is the height of the page and its header 1.18 cvs 5869: and footer together.</p> 1.30 cvs 5870: 5871: <p>A page box should also have vertical and horizontal position rules and 5872: these two rules should specify the position on the sheet of paper of the 5873: rectangle enclosing the page's contents. These two rules must position the 5874: upper left corner of the enclosing rectangle in relation to the upper left 5875: corner of the sheet of paper, considered to be the enclosing element. In both 5876: rules, distances must be expressed in fixed units: centimeters (<tt>cm</tt>), 5877: inches (<tt>in</tt>), or typographer's points (<tt>pt</tt>). Thus, rules 5878: similar to the following should be found in the rules for a page box:</p> 1.18 cvs 5879: <pre>BOXES 1.1 cvs 5880: ThePage : 5881: BEGIN 5882: VertPos : Top = Enclosing . Top + 3 cm; 5883: HorizPos : Left = Enclosing . Left + 2.5 cm; 5884: Width : 16 cm; 5885: Height : 22.5 cm; 1.18 cvs 5886: END;</pre> 1.30 cvs 5887: 5888: <p>When a document must be page broken, the page models to be constructed are 1.18 cvs 5889: defined in the <tt>BOXES</tt> section of the presentation schema by declaring 5890: page boxes and header and footer boxes. Also, the <tt>Page</tt> rule is used 1.1 cvs 5891: to specify to which parts of the document and to which views each model should 1.18 cvs 5892: be applied.</p> 1.30 cvs 5893: 5894: <p>The <tt>Page</tt> rule has only one parameter, given between parentheses 5895: after the <tt>Page</tt> keyword. This parameter is the name of the box which 5896: must serve as the model for page construction. When a <tt>Page</tt> rule is 1.1 cvs 5897: attached to an element type, each time such an element appears in a document, 5898: a page break takes place and the page model indicated in the rule is applied 5899: to all following pages, until reaching the next element which has a 1.18 cvs 5900: <tt>Page</tt> rule.</p> 1.30 cvs 5901: 5902: <p>The <tt>Page</tt> rule applies to only one view; if it appears in the 5903: primary view's block of rules, a <tt>Page</tt> rule applies only to that view. 5904: Thus, different page models can be defined for the full document and for its 5905: table of contents, which is another view of the same document. Some views can 5906: be specified with pages, and other views of the same document can be specified 1.18 cvs 5907: without pages.</p> 5908: <pre> 'Page' '(' BoxID ')'</pre> 5909: </div> 5910: 5911: <div class="subsection"> 1.30 cvs 5912: <h3><a name="sectc4234">Box copies</a></h3> 1.18 cvs 5913: 1.30 cvs 5914: <p>The <tt>Copy</tt> rule can be used for an element which is defined as a 1.7 cvs 5915: reference in the structure schema. In this case, the rule specifies, between 1.18 cvs 5916: parenthesis, the name of the box (declared in the <tt>BOXES</tt> section) 1.1 cvs 5917: which must be produced when this reference appears in the structure of a 5918: document. The box produced is a copy (same contents, but possible different 5919: presentation) of the box type indicated by the parameter between parentheses, 5920: and which is in the element designated by the reference. The name of a box 5921: can be replaced by type name. Then what is copied is the contents of the 1.18 cvs 5922: element of this type which is inside the referenced element.</p> 1.30 cvs 5923: 5924: <p>Whether a box name or type name is given, it may be followed by the name of 5925: a structure schema between parentheses. This signifies that the box or type 5926: is defined in the indicated structure schema and not in the structure schema 5927: with which the rule's presentation schema is associated.</p> 5928: 5929: <p>The <tt>Copy</tt> rule can also be applied to a presentation box. If the 1.1 cvs 5930: presentation box was created by a reference attribute, the rule is applied as 5931: in the case of a reference element: the contents of the box having the 1.18 cvs 5932: <tt>Copy</tt> rule are based on the element designated by the reference 5933: attribute. For other presentation boxes, the <tt>Copy</tt> rule takes a type 1.1 cvs 5934: name parameter which can be followed, between parentheses, by the name of the 5935: structure schema in which the type is defined, if it is not defined in the 5936: same schema. The contents of the box which has this rule are a copy of the 5937: element of this type which is in the element creating the presentation box, or 5938: by default, the box of this type which precedes the presentation box. This 5939: last facility is used, for example, to define the running titles in headers or 1.18 cvs 5940: footers.</p> 5941: <pre> 'Copy' '(' BoxTypeToCopy ')' . 1.1 cvs 5942: BoxTypeToCopy = BoxID [ ExtStruct ] / 1.6 cvs 5943: ElemID [ ExtStruct ] . 1.18 cvs 5944: ExtStruct = '(' ElemID ')' .</pre> 1.30 cvs 5945: 5946: <p>Like the creation rules, the <tt>Copy</tt> rule cannot appear in the <a 1.18 cvs 5947: href="#sectc427">default presentation rules</a>. Moreover, this rule can only 5948: appear in the primary view's block of rules; the copy rule is applied to all 5949: views.</p> 1.30 cvs 5950: 1.18 cvs 5951: <blockquote class="example"> 1.30 cvs 5952: <p><strong>Example:</strong></p> 5953: 5954: <p>If the following definitions are in the structure schema:</p> 5955: <pre>Body = LIST OF (Chapter = 1.1 cvs 5956: BEGIN 5957: ChapterTitle = Text; 5958: ChapterBody = SectionSeq; 5959: END); 1.18 cvs 5960: RefChapter = REFERENCE (Chapter);</pre> 1.30 cvs 5961: 5962: <p>then the following presentation rules (among many other rules in the 5963: presentation schema) can be specified:</p> 5964: <pre>COUNTERS 1.1 cvs 5965: ChapterCtr : RANK OF Chapter; 5966: BOXES 5967: ChapterNumber : 5968: BEGIN 5969: Content : (VALUE (ChapterCtr, URoman)); 5970: ... 5971: END; 5972: RULES 5973: Chapter : 5974: BEGIN 5975: CreateFirst (ChapterNumber); 5976: ... 5977: END; 5978: RefChapter : 5979: BEGIN 5980: Copy (ChapterNumber); 5981: ... 1.18 cvs 5982: END;</pre> 1.30 cvs 5983: 5984: <p>which makes the number of the chapter designated by the reference appear 5985: in uppercase roman numerals, in place of the reference to a chapter itself. 5986: Alternatively, the chapter title can be made to appear in place of the 5987: reference by writing this <tt>Copy</tt>rule:</p> 5988: <pre> Copy (ChapterTitle);</pre> 5989: 5990: <p>To define a header box, named <tt>RunningTitle</tt>, which contains the 5991: title of the current chapter, the box's contents are defined in this 5992: way:</p> 5993: <pre>BOXES 1.1 cvs 5994: RunningTitle : 1.18 cvs 5995: Copy (ChapterTitle);</pre> 5996: </blockquote> 5997: </div> 5998: </div> 5999: <hr> 6000: </div> 1.1 cvs 6001: 1.18 cvs 6002: <div class="chapter"> 6003: <h1><a name="sect5">The T language</a></h1> 1.1 cvs 6004: 1.18 cvs 6005: <div class="section"> 1.30 cvs 6006: <h2><a name="sectb51">Document translation</a></h2> 1.1 cvs 6007: 1.30 cvs 6008: <p>Because of its document model, Thot can produce documents in a high-level 1.18 cvs 6009: abstract form. This form, called the <em>canonical form</em> is specific to 1.1 cvs 6010: Thot; it is well suited to the editor's manipulations, but it does not 6011: necessarily suit other operations which might be applied to documents. Because 6012: of this, the Thot editor offers the choice of saving documents in its own form 6013: (the canonical form) or a format defined by the user. In the latter case, the 6014: Thot document is transformed by the translation program. This facility can 6015: also be used to export documents from Thot to systems using other 1.18 cvs 6016: formalisms.</p> 1.1 cvs 6017: 1.18 cvs 6018: <div class="subsection"> 1.30 cvs 6019: <h3><a name="sectc511">Translation principles</a></h3> 1.1 cvs 6020: 1.30 cvs 6021: <p>Document translation allows the export of documents to other systems which 6022: do not accept Thot's canonical form. Translation can be used to export 6023: document to source-based formatters like T<sub><big>E</big></sub>X, 1.18 cvs 6024: L<sup>A</sup>T<sub><big>E</big></sub>X, and <tt>troff</tt>. It can also be 1.1 cvs 6025: used to translate documents into interchange formats like SGML or HTML. To 6026: allow the widest range of possible exports, Thot does not limit the choice of 6027: translations, but rather allows the user to define the formalisms into which 1.18 cvs 6028: documents can be translated.</p> 1.30 cvs 6029: 6030: <p>For each document or object class, a set of translation rules can be 6031: defined, specifying how the canonical form should be transformed into a given 1.18 cvs 6032: formalism. These translation rules are grouped into <em>translation 6033: schemas</em>, each schema containing the rules necessary to translate a 1.1 cvs 6034: generic logical structure (document or object structure) into a particular 6035: formalism. The same generic logical structure can have several different 6036: translation schemas, each defining translation rules for a different 1.18 cvs 6037: formalism.</p> 1.30 cvs 6038: 6039: <p>Like presentation schemas, translation schemas are generic. Thus, they 6040: apply to an entire object or document class and permit translation of all 6041: documents or objects of that class.</p> 1.18 cvs 6042: </div> 1.1 cvs 6043: 1.18 cvs 6044: <div class="subsection"> 1.30 cvs 6045: <h3><a name="sectc512">Translation procedure</a></h3> 1.1 cvs 6046: 1.30 cvs 6047: <p>The translator works on the specific logical structure of the document 6048: being translated. It traverses the primary tree of this logical structure in 1.1 cvs 6049: pre-order and, at each node encountered, it applies the corresponding 6050: translation rules defined in the translation schema. Translation can be 1.18 cvs 6051: associated:</p> 6052: <ul> 1.30 cvs 6053: <li>with element types defined in the structure schema,</li> 6054: <li>with global or local attributes defined in the structure schema,</li> 6055: <li>with specific presentation rules,</li> 6056: <li>with the content of the leaves of the structure (characters, symbols 6057: and graphical elements)</li> 1.18 cvs 6058: </ul> 1.30 cvs 6059: 6060: <p>Thus, for each node, the translator applies all rules associated with the 1.1 cvs 6061: element type, all rules associated with each attribute (local or global) 6062: carried by the element, and if the element is a leaf of the tree, it also 1.10 cvs 6063: applies translation rules for characters, symbols, or graphical elements, 1.18 cvs 6064: depending on the type of the leaf.</p> 1.30 cvs 6065: 6066: <p>Rules associated with the content of leaves are different from all other 1.1 cvs 6067: rules: they specify only how to translate character strings, symbols, and 6068: graphical elements. All other rules, whether associated with element types, 6069: with specific presentation rules or with attributes, are treated similarly. 1.18 cvs 6070: These rules primarily allow:</p> 6071: <ul> 1.30 cvs 6072: <li>generation of a text constant or variable before or after the contents 6073: of an element,</li> 6074: <li>modification of the order in which elements appear after 6075: translation,</li> 6076: <li>removal of an element in the translated document,</li> 6077: <li>and writing messages on the user's terminal during translation.</li> 1.18 cvs 6078: </ul> 6079: </div> 6080: </div> 1.1 cvs 6081: 1.18 cvs 6082: <div class="section"> 1.30 cvs 6083: <h2><a name="sectb52">Translation definition language</a></h2> 1.1 cvs 6084: 1.30 cvs 6085: <p>Translation schemas are written in a custom language, called T, which is 1.1 cvs 6086: described in the rest of this chapter. The grammar of T is specified using 1.18 cvs 6087: the same <a href="#sectc321">meta-language</a> as was used for the S and P 1.1 cvs 6088: languages and the translation schemas are written using the same conventions 6089: as the structure and presentation schemas. In particular, the keywords of the 6090: T language (the stings between apostrophes in the following syntax rules) can 6091: be written in any combination of upper-case and lower-case letters, but 6092: identifiers created by the programmer must always be written in the same 1.18 cvs 6093: way.</p> 1.1 cvs 6094: 1.18 cvs 6095: <div class="subsection"> 1.30 cvs 6096: <h3><a name="sectc521">Organization of a translation schema</a></h3> 1.1 cvs 6097: 1.30 cvs 6098: <p>A translation schema is begun by the <tt>TRANSLATION</tt> keyword and is 1.18 cvs 6099: terminated by the <tt>END</tt> keyword. The <tt>TRANSLATION</tt> keyword is 1.1 cvs 6100: followed by the name of the generic structure for which a translation is being 6101: defined and a semicolon. This name must be identical to the name which 1.18 cvs 6102: appears after the <tt>STRUCTURE</tt> keyword in the corresponding structure 6103: schema.</p> 1.30 cvs 6104: 6105: <p>After this declaration of the structure, the following material appears in 1.18 cvs 6106: order:</p> 6107: <ul> 1.30 cvs 6108: <li>the length of lines produced by the translation,</li> 6109: <li>the character delimiting the end of the line,</li> 6110: <li>the character string which the translator will insert if it must 6111: line-break the translated text,</li> 6112: <li>declarations of 6113: <ul> 6114: <li>buffers,</li> 6115: <li>counters,</li> 6116: <li>constants,</li> 6117: <li>variables,</li> 6118: </ul> 6119: </li> 6120: <li>translation rules associated with element types,</li> 6121: <li>translation rules associated with attributes,</li> 6122: <li>translation rules associated with specific presentation rules,</li> 6123: <li>translation rules associated with characters strings, symbols and 6124: graphical elements.</li> 1.18 cvs 6125: </ul> 1.30 cvs 6126: 6127: <p>Each of these sections is introduced by a keyword followed by a sequence of 1.1 cvs 6128: declarations. All of these sections are optional, expect for the translation 1.18 cvs 6129: rules associated with element types. Many <tt>TEXTTRANSLATE</tt> sections can 1.1 cvs 6130: appear, each defining the rules for translating character strings of a 1.18 cvs 6131: particular alphabet.</p> 6132: <pre> TransSchema ='TRANSLATION' ElemID ';' 1.1 cvs 6133: [ 'LINELENGTH' LineLength ';' ] 6134: [ 'LINEEND' CHARACTER ';' ] 6135: [ 'LINEENDINSERT' STRING ';' ] 6136: [ 'BUFFERS' BufferSeq ] 6137: [ 'COUNTERS' CounterSeq ] 6138: [ 'CONST' ConstSeq ] 6139: [ 'VAR' VariableSeq ] 6140: 'RULES' ElemSeq 6141: [ 'ATTRIBUTES' AttrSeq ] 6142: [ 'PRESENTATION' PresSeq ] 1.30 cvs 6143: < 'TEXTTRANSLATE' TextTransSeq > 1.1 cvs 6144: [ 'SYMBTRANSLATE' TransSeq ] 6145: [ 'GRAPHTRANSLATE' TransSeq ] 1.18 cvs 6146: 'END' .</pre> 6147: </div> 1.1 cvs 6148: 1.18 cvs 6149: <div class="subsection"> 1.30 cvs 6150: <h3><a name="sectc522">Line length</a></h3> 1.1 cvs 6151: 1.30 cvs 6152: <p>If a <tt>LINELENGTH</tt> instruction is present after the structure 1.1 cvs 6153: declaration, the translator divides the text it produces into lines, each line 6154: having a length less than or equal to the integer which follows the 1.18 cvs 6155: <tt>LINELENGTH</tt> keyword. This maximum line length is expressed as a 1.1 cvs 6156: number of characters. The end of the line is marked by the character defined 1.18 cvs 6157: by the <tt>LINEEND</tt> instruction. When the translator breaks the lines on 1.1 cvs 6158: a space character in generated text, this space will be replaced by the 1.18 cvs 6159: character string defined by the <tt>LINEENDINSERT</tt> instruction.</p> 1.30 cvs 6160: 6161: <p>If the <tt>LINEEND</tt> instruction is not defined then the linefeed 6162: character (octal code 12) is used as the default line end character. If the 1.18 cvs 6163: <tt>LINEENDINSERT</tt> instruction is not defined, the linefeed character is 6164: inserted at the end of the produced lines. If there is no <tt>LINELENGTH</tt> 1.1 cvs 6165: instruction, the translated text is not divided into lines. Otherwise, if the 6166: translation rules generate line end marks, these marks remain in the 6167: translated text, but the length of the lines is not controlled by the 1.18 cvs 6168: translator.</p> 6169: <pre> LineLength = NUMBER .</pre> 1.30 cvs 6170: 1.18 cvs 6171: <blockquote class="example"> 1.30 cvs 6172: <p><strong>Example:</strong></p> 6173: 6174: <p>To limit the lines produced by the translator to a length of 80 6175: characters, the following rule is written at the beginning of the 6176: translation schema.</p> 6177: <pre>LineLength 80;</pre> 1.18 cvs 6178: </blockquote> 6179: </div> 1.1 cvs 6180: 1.18 cvs 6181: <div class="subsection"> 1.30 cvs 6182: <h3><a name="sectc523">Buffers</a></h3> 1.1 cvs 6183: 1.30 cvs 6184: <p>A buffer is a unit of memory managed by the translator, which can either 1.18 cvs 6185: contain text read from the terminal during the translation (see the <a 6186: href="#sectc5212"><tt>Read</tt> rule</a>), or the name of the last picture 1.1 cvs 6187: (bit-map) encountered by the translator in its traversal of the document. 1.2 cvs 6188: Remember the pictures are stored in files that are separate for the document 1.1 cvs 6189: files and that the canonical form contains only the names of the files in 1.18 cvs 6190: which the pictures are found.</p> 1.30 cvs 6191: 6192: <p>Thus, there are two types of buffers: buffers for reading from the 6193: terminal (filled by the <tt>Read</tt> rule) and the buffer of picture names 6194: (containing the name of the last picture encountered). A translation schema 6195: can use either type, one or several read buffers and one (and only one) 6196: picture name buffer.</p> 6197: 6198: <p>If any buffers are used, the <tt>BUFFERS</tt> keyword must be present, 1.1 cvs 6199: followed by declarations of every buffer used in the translation schema. Each 6200: buffer declaration is composed only of the name of the buffer, chosen freely 1.2 cvs 6201: by the programmer. The picture name buffer is identified by the 1.18 cvs 6202: <tt>Picture</tt> keyword, between parentheses, following the buffer name. The 6203: <tt>Picture</tt> keyword may only appear once. Each buffer declaration is 6204: terminated by a semicolon.</p> 1.30 cvs 6205: <pre> BufferSeq = Buffer < Buffer > . 1.1 cvs 6206: Buffer = BufferID [ '(' 'Picture' ')' ] ';' . 1.18 cvs 6207: BufferID = NAME .</pre> 1.30 cvs 6208: 1.18 cvs 6209: <blockquote class="example"> 1.30 cvs 6210: <p><strong>Example:</strong></p> 6211: 6212: <p>The following buffer declarations create a picture name buffer named 6213: <tt>pictureName</tt> and a read buffer named <a 6214: name="destname"><tt>DestName</tt></a>:</p> 6215: <pre>BUFFERS 1.18 cvs 6216: pictureName (Picture); DestName;</pre> 6217: </blockquote> 6218: </div> 1.1 cvs 6219: 1.18 cvs 6220: <div class="subsection"> 1.30 cvs 6221: <h3><a name="sectc524">Counters</a></h3> 6222: 6223: <p>Certain translation rules generate text that varies according to the 6224: context of the element to which the rules apply. Variable text is defined 6225: either in the <a href="#sectc526"><tt>VAR</tt> section</a> of the translation 6226: schema or in the rule itself (see the <tt>Create</tt> and <tt>Write</tt> 6227: rules). Both types of definition rely on counters for the calculation of 6228: variable material.</p> 6229: 6230: <p>There are two types of counter: counters whose value is explicitely 6231: computed by applying <a href="#sectc5221"><tt>Set</tt> and <tt>Add</tt> 6232: rules</a>, and counters whose value is computed by a function associated with 6233: the counter. Those functions allow the same calculations as can be used in 6234: presentation schemas. As in a presentation schema, counters must be defined in 6235: the <tt>COUNTERS</tt> section of the translation schema before they are 6236: used.</p> 6237: 6238: <p>When counters are used in a translation schema, the <tt>COUNTERS</tt> 6239: keyword is followed by the declarations of every counter used. Each 6240: declaration is composed of the counter's name possibly followed by a colon and 6241: the counting function to be used for the counter. The declaration is 6242: terminated by a semi-colon. If the counter is explicitely computed by 6243: <tt>Set</tt> and <tt>Add</tt> rules, no counting function is indicated. If a 6244: counting function is indicated, <tt>Set</tt> and <tt>Add</tt> rules cannot be 6245: applied to that counter.</p> 1.1 cvs 6246: 1.30 cvs 6247: <p>The counting function indicates how the counter's value will be computed. 1.18 cvs 6248: Three functions are available: <tt>Rank</tt>, <tt>Rlevel</tt>, and 6249: <tt>Set</tt>.</p> 6250: <ul> 1.30 cvs 6251: <li><tt>Rank of ElemID</tt> indicates that the counter's value is the rank 6252: of the element of type <tt>ElemID</tt> which encloses the element for 6253: which the counter is being evaluated. For the purposes of this function, 6254: an element of type <tt>ElemID</tt> is considered to enclose itself. This 6255: function is primarily used when the element of type <tt>ElemID</tt> is 6256: part of an aggregate or list, in which case the counter's value is the 6257: element's rank in its list or aggregate. Note that, unlike the 6258: <tt>Rank</tt> function for presentation schemas, the <tt>Page</tt> keyword 6259: cannot be used in place of the <tt>ElemID</tt>. 6260: <p>The type name <tt>ElemID</tt> can be followed by an integer. That 6261: number represents the relative level, among the ancestors of the concerned 6262: element, of the element whose rank is asked. If that relative level 6263: <i>n</i> is unsigned, the <i>n<sup>th</sup></i> element of type 6264: <tt>ElemID</tt> encountered when travelling the logical structure from the 6265: root to the concerned element is taken into account. If the relative 6266: level is negative, the logical structure is travelled in the other 6267: direction, from the concerned element to the root.</p> 6268: </li> 6269: <li><tt>Rlevel of ElemID</tt> indicates that the counter's values is the 6270: relative level in the tree of the element for which the counter is being 6271: evaluated. The counter counts the number of elements of type 6272: <tt>ElemID</tt> which are found on the path between the root of the 6273: document's logical structure tree and the element (inclusive).</li> 6274: <li><tt>Set n on Type1 Add m on Type2</tt> indicates that the counter's 6275: value is calculated as follows: in traversing the document from the 6276: beginning to the element for which the counter is being evaluated, the 6277: counter is set to the value <tt>n</tt> each time a <tt>Type1</tt> element 6278: is encountered and is incremented by the amount <tt>m</tt> each time a 6279: <tt>Type2</tt> element is encountered. The initial value <tt>n</tt> and 6280: the increment <tt>m</tt> are integers.</li> 6281: </ul> 6282: 6283: <p>As in a presentation schema, the <tt>Rank</tt> and <tt>Set</tt> functions 6284: can be modified by a numeric attribute which changes their initial value. This 6285: is indicated by the <tt>Init</tt> keyword followed by the numeric attribute's 1.18 cvs 6286: name. The <tt>Set</tt> function takes the value of the attribute instead of 6287: the <tt>InitValue</tt> (<tt>n</tt>). For the <tt>Rank</tt> function, the 1.1 cvs 6288: value of the attribute is considered to be the rank of the first element of 6289: the list (rather than the normal value of 1). Subsequent items in the list 6290: have their ranks shifted accordingly. In both cases, the attribute must be 1.18 cvs 6291: numeric and must be a local attribute of the root of the document itself.</p> 1.30 cvs 6292: <pre> CounterSeq = Counter < Counter > . 1.1 cvs 6293: Counter = CounterID [ ':' CounterFunc ] ';' . 6294: CounterID = NAME . 6295: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ] 6296: [ 'Init' AttrID ] / 6297: 'Rlevel' 'of' ElemID / 6298: 'Set' InitValue 'On' ElemID 6299: 'Add' Increment 'On' ElemID 6300: [ 'Init' AttrID ] . 6301: SLevelAsc = [ '-' ] LevelAsc . 6302: LevelAsc = NUMBER . 6303: InitValue = NUMBER . 6304: Increment = NUMBER . 6305: ElemID = NAME . 1.18 cvs 6306: AttrID = NAME .</pre> 1.30 cvs 6307: 1.18 cvs 6308: <blockquote class="example"> 1.30 cvs 6309: <p><strong>Example:</strong></p> 6310: 6311: <p>If the body of a chapter is defined in the structure schema by:</p> 6312: <pre>Chapter_Body = LIST OF 1.1 cvs 6313: (Section = BEGIN 6314: Section_Title = Text; 6315: Section_Body = BEGIN 6316: Paragraphs; 6317: Section; 6318: END; 6319: END 1.18 cvs 6320: );</pre> 1.30 cvs 6321: 6322: <p>(sections are defined recursively), a counter can be defined giving the 6323: <a name="sectnum">number of a section</a> within its level in the 6324: hierarchy:</p> 6325: <pre>COUNTERS 1.18 cvs 6326: SectionNumber : Rank of Section;</pre> 1.30 cvs 6327: 6328: <p>A counter holding the hierarchic level of a section:</p> 6329: <pre> SectionLevel : Rlevel of Section;</pre> 6330: 6331: <p>A <a name="uniquenum">counter</a> which sequentially numbers all the 6332: document's sections, whatever their hierarchic level:</p> 6333: <pre> UniqueSectNum : Set 0 on Document Add 1 on Section;</pre> 1.18 cvs 6334: </blockquote> 6335: </div> 1.1 cvs 6336: 1.18 cvs 6337: <div class="subsection"> 1.30 cvs 6338: <h3><a name="sectc525">Constants</a></h3> 1.1 cvs 6339: 1.30 cvs 6340: <p>A common feature of translation rules is the generation of constant text. 6341: This text can be defined in the rule that generates it (see for example the <a 1.18 cvs 6342: href="#sectc5210"><tt>Create</tt></a> and <a 6343: href="#sectc5211"><tt>Write</tt></a> rules); but it can also be defined once 6344: in the constant declaration section and used many times in different rules. 6345: The latter option is preferable when the same text is used in several rules or 6346: several <a href="#sectc526">variables</a>.</p> 1.30 cvs 6347: 6348: <p>The <tt>CONST</tt> keyword begins the constant declaration section of the 1.1 cvs 6349: translation schema. It must be omitted if no constants are declared. Each 6350: constant declaration is composed of the constant name, an equals sign, and the 6351: constant's value, which is a character string between apostrophes. A constant 1.18 cvs 6352: declaration is terminated by a semicolon.</p> 1.30 cvs 6353: <pre> ConstSeq = Const < Const > . 1.1 cvs 6354: Const = ConstID '=' ConstValue ';' . 6355: ConstID = NAME . 1.18 cvs 6356: ConstValue = STRING .</pre> 1.30 cvs 6357: 1.18 cvs 6358: <blockquote class="example"> 1.30 cvs 6359: <p><strong><a name="levelexample">Example:</a></strong></p> 6360: 6361: <p>The following rule assigns the name <tt>TxtLevel</tt> to the character 6362: string ``Level'':</p> 6363: <pre>CONST 1.18 cvs 6364: TxtLevel = 'Level';</pre> 6365: </blockquote> 6366: </div> 1.1 cvs 6367: 1.18 cvs 6368: <div class="subsection"> 1.30 cvs 6369: <h3><a name="sectc526">Variables</a></h3> 1.1 cvs 6370: 1.30 cvs 6371: <p>Variables allow to define variable text which is generated by the 1.18 cvs 6372: <tt>Create</tt> and <tt>Write</tt> rules. They are also used to define file 6373: names which are used in the <tt>Create</tt>, <tt>ChangeMainFile</tt>, 6374: <tt>RemoveFile</tt>, and <tt>Indent</tt> rules. Variables can be defined 6375: either in the <tt>VAR</tt> section of the translation schema or directly in 6376: the rules which use them. Variables that define file names must be declared 6377: in the <tt>VAR</tt> section, and when the same variable is used several times 6378: in the translation schema, it makes sense to define it globally in the 6379: <tt>VAR</tt> section. This section is only present if at least one variable 6380: is defined globally.</p> 1.30 cvs 6381: 6382: <p>After the <tt>VAR</tt> keyword, each global variable is defined by its 6383: name, a colon separator and a sequence of functions (at least one function). 6384: Each variable definition is terminated by a semicolon. Functions determine the 1.1 cvs 6385: different parts which together give the value of the variable. The value is 6386: obtained by concatenating the strings produced by each of the functions. Seven 6387: types of functions are available. Each variable definition may use any number 1.18 cvs 6388: of functions of each type.</p> 6389: <ul> 1.30 cvs 6390: <li>The function <tt>Value(Counter)</tt>returns a string representing the 6391: value taken by the counter when it is evaluated for the element in whose 6392: rule the variable is used. The counter must have been declared in the 6393: <tt>COUNTERS</tt> section of the translation schema. When the counter is 6394: expressed in arabic numerals, the counter name can be followed by a colon 6395: and an integer indicating a minimum length (number of characters) for the 6396: string; if the counter's value is normally expressed with fewer characters 6397: than the required minimum, zeroes are added to the front of the string to 6398: achieve the minimum length. 6399: <p>By default, the counter value is written in arabic digits. If another 6400: representation of that value is needed, the counter name must be followed 6401: by a comma and one of the following keywords:</p> 6402: <ul> 6403: <li><tt>Arabic</tt>: arabic numerals (default value),</li> 6404: <li><tt>LRoman</tt>: lower-case roman numerals,</li> 6405: <li><tt>URoman</tt>: upper-case roman numerals,</li> 6406: <li><tt>Uppercase</tt>: upper-case letter,</li> 6407: <li><tt>Lowercase</tt>: lower-case letter.</li> 6408: </ul> 6409: </li> 6410: <li>The function <tt>FileDir</tt>, without parameter, returns a string 6411: representing the name of the directory of the output file that has been 6412: given as a parameter to the translation program. The string includes a 6413: character '/' at the end.</li> 6414: <li>The function <tt>FileName</tt>, without parameter, returns a string 6415: representing the name of the output file that has been given as a 6416: parameter to the translation program. The file extension (the character 6417: string that terminate the file name, after a dot) is not part of that 6418: string.</li> 6419: <li>The function <tt>Extension</tt>, without parameter, returns a string 6420: representing the extension of the file name. That string is empty if the 6421: file name that has been given as a parameter to the translation program 6422: has no extension. If there is an extension, its first character is a 6423: dot.</li> 6424: <li>The function <tt>DocumentName</tt>, without parameter, returns a string 6425: representing the name of the document being translated.</li> 6426: <li>The function <tt>DocumentDir</tt>, without parameter, returns a string 6427: representing the directory containing the document being translated.</li> 6428: <li>The function formed by the name of a constant returns that constant's 6429: value.</li> 6430: <li>The function formed by a character string between apostrophes returns 6431: that string.</li> 6432: <li>The function formed by the name of a buffer returns the contents of that 6433: buffer. If the named buffer is the picture buffer, then the name of the 6434: last picture encountered is returned. Otherwise, the buffer is a read 1.31 cvs 6435: buffer and the value returned is text previously read from the terminal. 1.30 cvs 6436: If the buffer is empty (no picture has been encountered or the 6437: <tt>Read</tt> rule has not been executed for the buffer), then the empty 6438: string is returned.</li> 6439: <li>The function formed by an attribute name takes the value of the 6440: indicated attribute for the element to which the variable applies. If the 6441: element does not have that attribute, then the element's ancestor are 6442: searched toward the root of the tree. If one of the ancestors does have 6443: the attribute then its value is used. If no ancestors have the attribute, 6444: then the value of the function is the empty string.</li> 1.18 cvs 6445: </ul> 1.30 cvs 6446: <pre> VariableSeq = Variable < Variable > . 6447: Variable = VarID ':' Function < Function > ';' . 1.1 cvs 6448: VarID = NAME . 6449: Function ='Value' '(' CounterID [ ':' Length ] 6450: [ ',' CounterStyle ] ')' / 6451: 'FileDir' / 'FileName' / 'Extension' / 6452: 'DocumentName' / 'DocumentDir' / 6453: ConstID / CharString / 6454: BufferID / AttrID . 6455: Length = NUMBER . 6456: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' / 6457: 'Uppercase' / 'Lowercase' . 1.18 cvs 6458: CharString = STRING .</pre> 1.30 cvs 6459: 1.18 cvs 6460: <blockquote class="example"> 1.30 cvs 6461: <p><strong>Example:</strong></p> 6462: 6463: <p>To create, at the beginning of each section of the translated document, 6464: text composed of the string ``Section'' followed by the section number, the 6465: following <a name="varsectexample">variable definition</a> might be 6466: used:</p> 6467: <pre>VAR 1.18 cvs 6468: SectionVar : 'Section' Value(SectionNumber);</pre> 1.30 cvs 6469: 6470: <p>(see the definition of <a 6471: href="#sectnum"><tt>SectionNumber</tt></a>).</p> 6472: 6473: <p>The following variable definition can be used to create, at the beginning 6474: of each section, the text ``Level'' followed by the hierarchical level of 6475: the section. It used the constant defined above.</p> 6476: <pre> LevelVar : TxtLevel Value(SectionLevel);</pre> 6477: 6478: <p>(see the definitions of <a href="#sectnum"><tt>SectionLevel</tt></a> and 6479: of <a href="#levelexample"><tt>TxtLevel</tt></a>).</p> 6480: 6481: <p>To generate the translation of each section in a different file (see <a 6482: href="#sectc5220">rule <tt>ChangeMainFile</tt></a>), the name of these files 6483: might be defined by the following variable:</p> 6484: <pre> VarOutpuFile : FileName Value(SectionNumber) 1.18 cvs 6485: Extension;</pre> 1.30 cvs 6486: 6487: <p>If <tt>output.txt</tt> is the name of the <a name="varoutputfile">output 6488: file</a> specified when starting the translation program, translated 6489: sections are written in files <tt>output1.txt</tt>, <tt>output2.txt</tt>, 6490: etc.</p> 1.18 cvs 6491: </blockquote> 6492: </div> 6493: 6494: <div class="subsection"> 1.30 cvs 6495: <h3><a name="sectc527">Translating structure elements</a></h3> 1.18 cvs 6496: 1.30 cvs 6497: <p>The <tt>RULES</tt> keyword introduces the translation rules which will be 1.1 cvs 6498: applied to the various structured element types. Translation rules can be 6499: specified for each element type defined in the structure schema, including the 1.18 cvs 6500: base types defined implicitly, whose names are <tt>TEXT_UNIT</tt>, 6501: <tt>PICTURE_UNIT</tt>, <tt>SYMBOL_UNIT</tt>, <tt>GRAPHIC_UNIT</tt> and 6502: <tt>PAGE_UNIT</tt>. But it is not necessary to specify rules for every 6503: defined type.</p> 1.30 cvs 6504: 6505: <p>If there are no translation rules for an element type, the elements that it 1.1 cvs 6506: contains (and which may have rules themselves) will still be translated, but 6507: the translator will produce nothing for the element itself. To make the 1.18 cvs 6508: translator completely ignore the content of an element the <a 6509: href="#sectc5217"><tt>Remove</tt> rule</a> must be used.</p> 1.30 cvs 6510: 6511: <p>The translation rules for an element type defined in the structure schema 6512: are written using the name of the type followed by a colon and the list of 1.18 cvs 6513: applicable rules. When the element type is a <a href="#sectd3285">mark 6514: pair</a>, but only in this case, the type name must be preceded by the 6515: <tt>First</tt> or <tt>Second</tt> keyword. This keyword indicates whether the 6516: rules that follow apply to the first or second mark of the pair.</p> 1.30 cvs 6517: 6518: <p>The list of rules can take several forms. It may be a simple 6519: non-conditional rule. It can also be formed by a condition followed by one or 6520: more simple rules. Or it can be a block of rules beginning with the 6521: <tt>BEGIN</tt> keyword and ending with the <tt>END</tt> keyword and a 6522: semicolon. This block of rules can contain one or more simple rules and/or 6523: one or more conditions, each followed by one or more simple rules.</p> 6524: <pre> ElemSeq = TransType < TransType > . 1.1 cvs 6525: TransType = [ FirstSec ] ElemID ':' RuleSeq . 6526: FirstSec = 'First' / 'Second' . 1.30 cvs 6527: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' . 1.1 cvs 6528: Rule = SimpleRule / ConditionBlock . 6529: ConditionBlock = 'IF' ConditionSeq SimpleRuleSeq . 1.30 cvs 6530: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' / 1.18 cvs 6531: SimpleRule .</pre> 6532: </div> 1.1 cvs 6533: 1.18 cvs 6534: <div class="subsection"> 1.30 cvs 6535: <h3><a name="sectc528">Conditional rules</a></h3> 1.1 cvs 6536: 1.30 cvs 6537: <p>In a translation schema, the translation rules are either associated with 1.1 cvs 6538: element types or with attribute values or with a specific presentation. They 6539: are applied by the translator each time an element of the corresponding type 6540: is encountered in the translated document or each time the attribute value is 6541: carried by an element or also, each time the specific translation is attached 6542: to an element. This systematic application of the rules can be relaxed: it is 6543: possible to add a condition to one or more rules, so that these rules are only 1.18 cvs 6544: applied when the condition is true.</p> 1.30 cvs 6545: 6546: <p>A condition begins with the keyword <tt>IF</tt>, followed by a sequence of 1.1 cvs 6547: elementary conditions. Elementary conditions are separated from each other by 1.18 cvs 6548: the <tt>AND</tt> keyword. If there is only one elementary condition, this 1.1 cvs 6549: keyword is absent. The rules are only applied if all the elementary 6550: conditions are true. The elementary condition can be negative; it is then 1.18 cvs 6551: preceded by the <tt>NOT</tt> keyword.</p> 1.30 cvs 6552: 6553: <p>When the translation rule(s) controlled by the condition apply to a 6554: reference element or a reference attribute, an elementary condition can also 6555: apply to element referred by this reference. The <tt>Target</tt> keyword is 6556: used for that purpose. It must appear before the keyword defining the 6557: condition type.</p> 6558: 6559: <p>Depending on their type, some conditions may apply either to the element 6560: with which they are associated, or to one of its ancestor. In the case of an 1.18 cvs 6561: ancestor, the key word <tt>Ancestor</tt> must be used, followed by</p> 6562: <ul> 1.30 cvs 6563: <li>either an integer which represents the number of levels in the tree 6564: between the element and the ancestor of interest,</li> 6565: <li>or the type name of the ancestor of interest. If that type is defined 6566: in a separate structure schema, the name of that schema must follow 6567: between parentheses.</li> 1.18 cvs 6568: </ul> 1.30 cvs 6569: 6570: <p>There is a special case for the parent element, which can be simply written 1.18 cvs 6571: <tt>Parent</tt> instead of <tt>Ancestor 1</tt>.</p> 1.30 cvs 6572: 6573: <p>Only conditions <tt>First</tt>, <tt>Last</tt>, <tt>Referred</tt>, 1.18 cvs 6574: <tt>Within</tt>, <tt>Attributes</tt>, <tt>Presentation</tt>, <tt>Comment</tt> 1.1 cvs 6575: and those concerning an attribute or a specific presentation can apply to an 1.18 cvs 6576: ancestor. Conditions <tt>Defined</tt>, <tt>FirstRef</tt>, <tt>LastRef</tt>, 6577: <tt>ExternalRef</tt>, <tt>Alphabet</tt>, <tt>FirstAttr</tt>, 6578: <tt>LastAttr</tt>, <tt>ComputedPage</tt>, <tt>StartPage</tt>, 6579: <tt>UserPage</tt>, <tt>ReminderPage</tt>, <tt>Empty</tt> cannot be preceded by 6580: keywords <tt>Parent</tt> or <tt>Ancestor</tt>.</p> 1.30 cvs 6581: 6582: <p>In condition <tt>Referred</tt> and in the condition that applies to a named 1.18 cvs 6583: attribute, a symbol '<tt>*</tt>' can indicate that the condition is related 1.5 cvs 6584: only to the element itself. If this symbol is not present, not only the 1.18 cvs 6585: element is considered, but also its ancestor, at any level.</p> 1.30 cvs 6586: 6587: <p>The form of an elementary condition varies according to the type of 1.18 cvs 6588: condition.</p> 1.1 cvs 6589: 1.18 cvs 6590: <div class="subsubsection"> 6591: <h4><a name="sectd5281">Conditions based on the logical position of the 6592: element</a></h4> 1.30 cvs 6593: 6594: <p>The condition can be on the position of the element in the document's 6595: logical structure tree. It is possible to test whether the element is the 6596: first (<tt>First</tt>) or last (<tt>Last</tt>) among its siblings or if it is 6597: not the first (<tt>NOT First</tt>) or not the last (<tt>NOT Last</tt>).</p> 6598: 6599: <p>It is also possible to test if the element is contained in an element of a 1.18 cvs 6600: given type (<tt>Within</tt>) or if it is not (<tt>NOT Within</tt>). If that 1.1 cvs 6601: element type is defined in a structure schema which is not the one which 6602: corresponds to the translation schema, the type name of this element must be 6603: followed, between parentheses, by the name of the structure schema which 1.18 cvs 6604: defines it.</p> 1.30 cvs 6605: 6606: <p>If the keyword <tt>Within</tt> is preceded by <tt>Immediately</tt>, the 1.18 cvs 6607: condition is satisfied only if the <em>parent</em> element has the type 6608: indicated. If the word <tt>Immediately</tt> is missing, the condition is 6609: satisfied if any <em>ancestor</em> has the type indicated.</p> 1.30 cvs 6610: 6611: <p>An integer <i>n</i> can appear between the keyword <tt>Within</tt> and the 1.1 cvs 6612: type. It specifies the number of ancestors of the indicated type that must be 6613: present for the condition to be satisfied. If the keyword 1.18 cvs 6614: <tt>Immediately</tt> is also present, the <i>n</i> immediate ancestors of the 6615: element must have the indicated type. The integer <i>n</i> must be positive 1.30 cvs 6616: or zero. It can be preceded by <tt><</tt> or <tt>></tt> to indicate a 1.1 cvs 6617: maximum or minimum number of ancestors. If these symbols are missing, the 1.18 cvs 6618: condition is satisfied only if it exists exactly <i>n</i> ancestors. When 1.30 cvs 6619: this number is missing, it is equivalent to > 0.</p> 6620: 6621: <p>If the condition applies to translation rules associated with an attribute, 1.18 cvs 6622: i.e. if it is in the <tt>ATTRIBUTES</tt> section of the presentation schema, 1.11 cvs 6623: the condition can be simply an element name. Translation rules are then 1.18 cvs 6624: executed only if the attribute is attached to an element of that type. The 6625: keyword <tt>NOT</tt> before the element name indicates that the translation 6626: rules must be executed only if the element is not of the type indicated.</p> 6627: </div> 1.1 cvs 6628: 1.18 cvs 6629: <div class="subsubsection"> 1.30 cvs 6630: <h4><a name="sectd5282">Conditions on references</a></h4> 1.1 cvs 6631: 1.30 cvs 6632: <p>References may be taken into account in conditions, which can be based on 6633: the fact that the element, or one of its ancestors (unless symbol <tt>*</tt> 6634: is present), is designated by a at least one reference (<tt>Referred</tt>) or 6635: by none (<tt>NOT Referred</tt>). If the element or attribute to which the 1.1 cvs 6636: condition is attached is a reference, the condition can be based on the fact 6637: that it acts as the first reference to the designated element 1.18 cvs 6638: (<tt>FirstRef</tt>), or as the last (<tt>LastRef</tt>), or as a reference to 6639: an element located in another document (<tt>ExternalRef</tt>). Like all 6640: conditions, conditions on references can be inverted by the <tt>NOT</tt> 6641: keyword.</p> 6642: </div> 6643: 6644: <div class="subsubsection"> 1.30 cvs 6645: <h4><a name="sectd5283">Conditions on the parameters</a></h4> 1.18 cvs 6646: 1.30 cvs 6647: <p>Elements which are <a href="#sectc326">parameters</a> can be given a 1.18 cvs 6648: particular condition which is based on whether or not the parameter is given a 6649: value in the document (<tt>Defined</tt> or <tt>NOT Defined</tt>, 6650: respectively).</p> 6651: </div> 1.1 cvs 6652: 1.18 cvs 6653: <div class="subsubsection"> 1.30 cvs 6654: <h4><a name="sectd5284">Conditions on the alphabets</a></h4> 1.1 cvs 6655: 1.30 cvs 6656: <p>The character string base type (and only this type) can use the condition 1.18 cvs 6657: <tt>Alphabet = a</tt> which indicates that the translation rule(s) should only 1.1 cvs 6658: apply if the alphabet of the character string is the one whose name appears 1.18 cvs 6659: after the equals sign (or is not, if there is a preceding <tt>NOT</tt> 1.1 cvs 6660: keyword). This condition cannot be applied to translation rules of an 1.18 cvs 6661: attribute.</p> 1.30 cvs 6662: 6663: <p>In the current implementation of Thot, the available alphabets are the 1.18 cvs 6664: <tt>Latin</tt> alphabet and the <tt>Greek</tt> alphabet.</p> 6665: </div> 1.1 cvs 6666: 1.18 cvs 6667: <div class="subsubsection"> 1.30 cvs 6668: <h4><a name="sectd5285">Conditions on page breaks</a></h4> 1.1 cvs 6669: 1.30 cvs 6670: <p>The page break base type (and only this type) can use the following 1.18 cvs 6671: conditions: <tt>ComputedPage</tt>, <tt>StartPage</tt>, <tt>UserPage</tt>, and 6672: <tt>ReminderPage</tt>. The <tt>ComputedPage</tt> condition indicates that the 1.1 cvs 6673: translation rule(s) should apply if the page break was created automatically 1.18 cvs 6674: by Thot; the <tt>StartPage</tt> condition is true if the page break is 6675: generated before the element by the <tt>Page</tt> rule of the P language; the 6676: <tt>UserPage</tt> condition applies if the page break was inserted by the 6677: user; and the <tt>ReminderPage</tt> is applied if the page break is a reminder 6678: of page breaking.</p> 6679: </div> 1.1 cvs 6680: 1.18 cvs 6681: <div class="subsubsection"> 1.30 cvs 6682: <h4><a name="sectd5286">Conditions on the element's content</a></h4> 1.1 cvs 6683: 1.30 cvs 6684: <p>The condition can be based on whether or not the element is empty. An 6685: element which has no children or whose leaves are all empty is considered to 6686: be empty itself. This condition is expressed by the <tt>Empty</tt> keyword, 6687: optionally preceded by the <tt>NOT</tt> keyword.</p> 1.18 cvs 6688: </div> 1.1 cvs 6689: 1.18 cvs 6690: <div class="subsubsection"> 1.30 cvs 6691: <h4><a name="sectd5287">Conditions on the presence of comments</a></h4> 1.1 cvs 6692: 1.30 cvs 6693: <p>The condition can be based on the presence or absence of comments 6694: associated with the translated element. This condition is expressed by the 6695: keyword <tt>Comment</tt>, optionally preceded by the keyword <tt>NOT</tt>.</p> 1.18 cvs 6696: </div> 1.1 cvs 6697: 1.18 cvs 6698: <div class="subsubsection"> 6699: <h4><a name="sectd5288">Conditions on the presence of specific presentation 6700: rules</a></h4> 1.30 cvs 6701: 6702: <p>The condition can be based on the presence or absence of specific 6703: presentation rules associated with the translated element, whatever the rules, 6704: their value or their number. This condition is expressed by the keyword 1.18 cvs 6705: <tt>Presentation</tt>, optionally preceded by the <tt>NOT</tt> keyword.</p> 6706: </div> 1.1 cvs 6707: 1.18 cvs 6708: <div class="subsubsection"> 6709: <h4><a name="sectd5289">Conditions on the presence of logical 6710: attributes</a></h4> 1.30 cvs 6711: 6712: <p>In the same way, the condition can be based on the presence or absence of 1.1 cvs 6713: attributes associated with the translated elements, no matter what the 1.18 cvs 6714: attributes or their values. The <tt>Attributes</tt> keyword expresses this 6715: condition.</p> 6716: </div> 1.1 cvs 6717: 1.18 cvs 6718: <div class="subsubsection"> 1.30 cvs 6719: <h4><a name="sectd52810">Conditions on logical attributes</a></h4> 1.1 cvs 6720: 1.30 cvs 6721: <p>If the condition appears in the translation rules of an attribute, the 1.18 cvs 6722: <tt>FirstAttr</tt> and <tt>LastAttr</tt> keywords can be used to indicate that 1.1 cvs 6723: the rules must only be applied if this attribute is the first attribute for 6724: the translated element or if it is the last (respectively). These conditions 1.18 cvs 6725: can also be inverted by the <tt>NOT</tt> keyword.</p> 1.30 cvs 6726: 6727: <p>Another type of condition can only be applied to the translation rules when 1.18 cvs 6728: the element being processed (or one of its ancestors if symbol <tt>*</tt> is 1.1 cvs 6729: missing) has a certain attribute, perhaps with a certain value or, in 6730: contrast, when the element does not have this attribute with this value. The 6731: condition is specified by writing the name of the attribute after the keyword 1.18 cvs 6732: <tt>IF</tt> or <tt>AND</tt>. The <tt>NOT</tt> keyword can be used to invert 1.1 cvs 6733: the condition. If the translation rules must be applied to any element which 6734: has this attribute (or does not have it, if the condition is inverted) no 6735: matter what the attribute's value, the condition is complete. If, in 6736: contrast, the condition applies to one or more values of the attribute, these 6737: are indicated after the name of the attribute, except for reference attributes 1.18 cvs 6738: which do not have values.</p> 1.30 cvs 6739: 6740: <p>The representation of the values of an <a name="relattr">attribute</a> in a 1.1 cvs 6741: condition depends on the attribute's type. For attributes with enumerated or 6742: textual types, the value (a name or character string between apostrophes, 6743: respectively) is simply preceded by an equals sign. For numeric attributes, 6744: the condition can be based on a single value or on a range of values. In the 6745: case of a unique value, this value (an integer) is simply preceded by an 1.18 cvs 6746: equals sign. Conditions based on ranges of values have several forms:</p> 6747: <ul> 1.30 cvs 6748: <li>all values less than a given value (the value is preceded by a ``less 6749: than'' sign).</li> 6750: <li>all values greater than a given value (the value is preceded by a 6751: ``greater than'' sign).</li> 6752: <li>all values falling in an interval, bounds included. The range of values 6753: is then specified <tt>IN [</tt>Minimum <tt>..</tt>Maximum<tt>]</tt>, where 6754: Minimum and Maximum are integers.</li> 1.18 cvs 6755: </ul> 1.30 cvs 6756: 6757: <p>All numeric values may be negative. The integer is simply preceded by a 6758: minus sign.</p> 6759: 6760: <p>Both local and global attributes can be used in conditions.</p> 1.18 cvs 6761: </div> 1.1 cvs 6762: 1.18 cvs 6763: <div class="subsubsection"> 1.30 cvs 6764: <h4><a name="sectd52811">Conditions on specific presentation rules</a></h4> 1.1 cvs 6765: 1.30 cvs 6766: <p>It is possible to apply translation rules only when the element being 1.1 cvs 6767: processed has or does not have a specific presentation rule, possibly with a 6768: certain value. The condition is specified by writing the name of the 1.18 cvs 6769: presentation rule after the keyword <tt>IF</tt> or <tt>AND</tt>. The 6770: <tt>NOT</tt> keyword can be used to invert the condition. If the translation 1.1 cvs 6771: rules must be applied to any element which has this presentation rule (or does 6772: not have it, if the condition is inverted) no matter what the rule's value, 6773: the condition is complete. If, in contrast, the condition applies to one or 6774: more values of the rule, these are indicated after the name of the 1.18 cvs 6775: attribute.</p> 1.30 cvs 6776: 6777: <p>The representation of presentation rule values in a condition is similar to 1.1 cvs 6778: that for attribute values. The representation of these values depend on the 6779: type of the presentation rule. There are three categories of presentation 1.18 cvs 6780: rules:</p> 6781: <ul> 1.30 cvs 6782: <li>those taking numeric values (<tt>Size, Indent, LineSpacing, 6783: LineWeight</tt>),</li> 6784: <li>those with values taken from a predefined list (<tt>Adjust, Justify, 6785: Hyphenate, Style, Weight, Font, UnderLine, Thickness, 6786: LineStyle</tt>),</li> 6787: <li>those whose value is a name (<tt>FillPattern, Background, 6788: Foreground</tt>).</li> 1.18 cvs 6789: </ul> 1.30 cvs 6790: 6791: <p>For presentation rules which take numeric values, the condition can take a 1.1 cvs 6792: unique value or a range of values. In the case of a unique value, this value 6793: (an integer) is simply preceded by an equals sign. Conditions based on ranges 1.18 cvs 6794: of values have several forms:</p> 6795: <ul> 1.30 cvs 6796: <li>all values less than a given value (the value is preceded by a ``less 6797: than'' sign).</li> 6798: <li>all values greater than a given value (the value is preceded by a 6799: ``greater than'' sign).</li> 6800: <li>all values falling in an interval, bounds included. The range of values 6801: is then specified <tt>IN [</tt>Minimum <tt>..</tt>Maximum<tt>]</tt>, where 6802: Minimum and Maximum are integers.</li> 1.18 cvs 6803: </ul> 1.30 cvs 6804: 6805: <p>Values for the <tt>Indent</tt>rule may be negative. The integer is then 1.2 cvs 6806: simply preceded by a minus sign and represents how far the first line starts 1.18 cvs 6807: to the left of the other lines.</p> 1.30 cvs 6808: 6809: <p>For presentation rules whose values are taken from predefined lists, the 6810: value which satisfies the condition is indicated by an equals sign followed by 6811: the name of the value.</p> 6812: 6813: <p>For presentation rule whose values are names, the value which satisfies the 1.1 cvs 6814: condition is indicated by the equals sign followed by the value's name. The 1.18 cvs 6815: names of fill patterns (the <tt>FillPattern</tt> rule) and of colors (the 6816: <tt>Foreground</tt> and <tt>Background</tt> rules) known to Thot are the same 6817: as in the P language.</p> 1.30 cvs 6818: 6819: <p>The syntax of conditions based on the specific presentation is the same as 6820: the syntax used to express the <a href="#sectc5224">translation of specific 1.18 cvs 6821: presentation rules</a>.</p> 1.30 cvs 6822: 6823: <p>When a condition has only one rule, the condition is simply followed by 6824: that rule. If it has several rules, they are placed after the condition 6825: between the keywords <tt>BEGIN</tt> and <tt>END</tt>.</p> 1.18 cvs 6826: <pre> ConditionSeq = Condition [ 'AND' Condition ] . 1.1 cvs 6827: Condition = [ 'NOT' ] [ 'Target' ] Cond . 6828: Cond = CondElem / CondAscend . 6829: CondElem ='FirstRef' / 'LastRef' / 6830: 'ExternalRef' / 6831: 'Defined' / 6832: 'Alphabet' '=' Alphabet / 6833: 'ComputedPage' / 'StartPage' / 6834: 'UserPage' / 'ReminderPage' / 6835: 'Empty' / 1.11 cvs 6836: ElemID / 1.1 cvs 6837: 'FirstAttr' / 'LastAttr' . 6838: CondAscend = [ Ascend ] CondOnAscend . 6839: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType . 6840: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] . 6841: CondRelLevel = NUMBER . 6842: CondOnAscend ='First' / 'Last' / 6843: 'Referred' / 6844: [ 'Immediately' ] 'Within' [ NumParent ] 6845: ElemID [ ExtStruct ] / 6846: 'Attributes' / 6847: AttrID [ RelatAttr ] / 6848: 'Presentation' / 6849: PresRule / 6850: 'Comment' . 6851: NumParent = [ GreaterLess ] NParent . 1.30 cvs 6852: GreaterLess = '>' / '<' . 1.1 cvs 6853: NParent = NUMBER. 6854: ExtStruct = '(' ElemID ')' . 6855: Alphabet = NAME . 6856: RelatAttr ='=' Value / 1.30 cvs 6857: '>' [ '-' ] Minimum / 1.1 cvs 6858: '<' [ '-' ] Maximum / 6859: 'IN' '[' [ '-' ] MinInterval '..' 6860: [ '-' ] MaxInterval ']' . 6861: Value = [ '-' ] IntegerVal / TextVal / AttrValue . 6862: Minimum = NUMBER . 6863: Maximum = NUMBER . 6864: MinInterval = NUMBER . 6865: MaxInterval = NUMBER . 6866: IntegerVal = NUMBER . 6867: TextVal = STRING . 1.18 cvs 6868: AttrValue = NAME .</pre> 1.30 cvs 6869: 1.18 cvs 6870: <blockquote class="example"> 1.30 cvs 6871: <p><strong>Example:</strong></p> 6872: 6873: <p>Suppose that after each element of type Section_Title it is useful to 6874: produce the text <tt>\label{SectX}</tt> where <tt>X</tt> represents the 6875: section number, but only if the section is designated by one or more 6876: references in the document. The following conditional rule produces this 6877: effect:</p> 6878: <pre>RULES 1.1 cvs 6879: Section_Title : 6880: IF Referred 1.18 cvs 6881: Create ('\label{Sect' Value(UniqueSectNum) '}\12') After;</pre> 1.30 cvs 6882: 6883: <p>(the declaration of the <a href="#sectc5224"><tt>UniqueSectNum</tt> 6884: counter</a> is given above). The string <tt>\12</tt> represents a line 6885: break.</p> 1.18 cvs 6886: </blockquote> 1.30 cvs 6887: 1.18 cvs 6888: <blockquote class="example"> 1.30 cvs 6889: <p><strong>Example:</strong></p> 6890: 6891: <p>Suppose that for elements of the Elmnt type it would be useful to produce 6892: a character indicating the value of the numeric attribute Level associated 6893: with the element: an ``A'' for all values of Level less than 3, a ``B'' for 6894: values between 3 and 10 and a ``C'' for values greater than 10. This can be 6895: achieved by writing the following rules for the Elmnt type:</p> 6896: <pre>RULES 1.1 cvs 6897: Elmnt : 6898: BEGIN 6899: IF Level < 3 6900: Create 'A'; 6901: IF Level IN [3..10] 6902: Create 'B'; 1.30 cvs 6903: IF Level > 10 1.1 cvs 6904: Create 'C'; 1.18 cvs 6905: END;</pre> 6906: </blockquote> 6907: </div> 6908: </div> 1.1 cvs 6909: 1.18 cvs 6910: <div class="subsection"> 1.30 cvs 6911: <h3><a name="sectc529">Translation rules</a></h3> 1.1 cvs 6912: 1.30 cvs 6913: <p>Fifteen types of translation rules can be associated with element types and 1.18 cvs 6914: attribute values. They are the <tt>Create</tt>, <tt>Write</tt>, 6915: <tt>Read</tt>, <tt>Include</tt>, <tt>Get</tt>, <tt>Copy</tt>, <tt>Use</tt>, 1.31 cvs 6916: <tt>Remove</tt>, <tt>Ignore</tt>, <tt>NoTranslation</tt>, 6917: <tt>NoLineBreak</tt>, <tt>ChangeMainFile</tt>, <tt>RemoveFile</tt>, 6918: <tt>Set</tt>, <tt>Add</tt>, <tt>Indent</tt>, rules. Each rule has its own 6919: syntax, although they are all based on very similar models.</p> 1.18 cvs 6920: <pre> SimpleRule = 'Create' [ 'IN' VarID ] Object 1.1 cvs 6921: [ Position ] ';' / 6922: 'Write' Object [ Position ] ';' / 6923: 'Read' BufferID [ Position ] ';' / 6924: 'Include' File [ Position ] ';' / 6925: 'Get' [ RelPosition ] ElemID 6926: [ ExtStruct ] 6927: [ Position ] ';' / 6928: 'Copy' [ RelPosition ] ElemID 6929: [ ExtStruct ] 6930: [ Position ] ';' / 6931: 'Use' TrSchema [ 'For' ElemID ] ';' / 6932: 'Remove' ';' / 1.31 cvs 6933: 'Ignore' ';' / 1.1 cvs 6934: 'NoTranslation' ';' / 6935: 'NoLineBreak' ';' / 6936: 'ChangeMainFile' VarID [ Position ] ';' / 1.14 cvs 6937: 'RemoveFile' VarID [ Position ] ';' / 1.10 cvs 6938: 'Set' CounterID InitValue [ Position ] ';' / 6939: 'Add' CounterID Increment [ Position ] ';' / 1.25 cvs 6940: 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' .</pre> 1.18 cvs 6941: </div> 6942: 6943: <div class="subsection"> 1.30 cvs 6944: <h3><a name="sectc5210">The <tt>Create</tt> rule</a></h3> 1.18 cvs 6945: 1.30 cvs 6946: <p>The most frequently used rule is undoubtedly the <tt>Create</tt> rule, 6947: which generates fixed or variable text (called an <em>object</em>) in the 6948: output file. The generated text can be made to appear either before or after 6949: the content of the element to which the rule applies. The rule begins with the 1.18 cvs 6950: <tt>Create</tt> keyword, followed by a specifier for the object and a keyword 6951: (<tt>Before</tt> or <tt>After</tt>) indicating the position of the generated 6952: text (<a href="#sectc5222">before or after</a> the element's content). If the 1.1 cvs 6953: position is not indicated, the object will be generated before the element's 6954: content. This rule, like all translation rules, is terminated by a 1.18 cvs 6955: semicolon.</p> 1.30 cvs 6956: 6957: <p>The <tt>Create</tt> keyword can be followed by the <tt>IN</tt> keyword and 6958: by the name of a variable. This means that the text generated by the rule 6959: must not be written in the main output file, but in the file whose name is 1.18 cvs 6960: specified by the variable.</p> 1.30 cvs 6961: 6962: <p>This allows the translation program to generate text in different files 6963: during the same run. These files do not need to be explicitely declared or 6964: opened. They do not need to be closed either, but if they contain temporary 6965: data, they can be removed (see the <a href="#sectc5220a"><tt>RemoveFile</tt> 6966: rule</a>). As soon as the translation program executes a <tt>Create</tt> rule 6967: for a file that is not yet open, it opens the file. These files are closed 6968: when the translation is finished.</p> 1.18 cvs 6969: <pre> 'Create' [ 'IN' VarID ] Object 1.1 cvs 6970: [ Position ] ';' 6971: Object = ConstID / CharString / 6972: BufferID / 6973: VarID / 1.30 cvs 6974: '(' Function < Function > ')' / 1.21 cvs 6975: [ 'Translated' ] AttrID / 1.1 cvs 6976: 'Value' / 6977: 'Content' / 6978: 'Comment' / 6979: 'Attributes' / 6980: 'Presentation' / 6981: 'RefId' / 6982: 'PairId' / 6983: 'FileDir' / 6984: 'FileName' / 6985: 'Extension' / 6986: 'DocumentName' / 6987: 'DocumentDir' / 6988: [ 'Referred' ] ReferredObject . 6989: Position ='After' / 'Before' . 6990: 6991: ReferredObject = VarID / 6992: ElemID [ ExtStruct ] / 6993: 'RefId' / 6994: 'DocumentName' / 1.18 cvs 6995: 'DocumentDir' .</pre> 1.30 cvs 6996: 6997: <p>The object to be generated can be:</p> 1.18 cvs 6998: <ul> 1.30 cvs 6999: <li>a constant string, specified by its name if it is declared in the 7000: schema's <tt>CONST</tt> section, or given directly as a value between 7001: apostrophes;</li> 7002: <li>the contents of a buffer, designated by the name of the buffer;</li> 7003: <li>a variable, designated by its name if it is declared in the translation 7004: schema's <tt>VAR</tt> section, or given directly between parentheses. The 7005: text generated is the value of that variable evaluated for the element to 7006: which the rule applies.</li> 7007: <li>the value of an attribute, if the element being translated has this 7008: attribute. The attribute is specified by its name. If it's a text 7009: attribute, it can be preceded by the <code>Translated</code> keyword, 7010: which causes the attribute value to be recoded using the text translation 7011: table defined by section <code><a 7012: href="#sectc5225">TEXTTRANSLATE</a></code>;</li> 7013: <li>the value of a specific presentation rule. This object can only be 7014: generated if the translation rule is for a <a href="#prestransl">specific 7015: presentation rule</a>. It is specified by the <tt>Value</tt> 7016: keyword;</li> 7017: <li>the element's content. That is, the content of the leaves of the 7018: subtree of the translated element. This is specified by the 7019: <tt>Content</tt> keyword;</li> 7020: <li>the comment attached to the element. When the element doesn't have a 7021: comment, nothing is generated. This is indicated by the <tt>Comment</tt> 7022: keyword;</li> 7023: <li>the translation of all attributes of the element (which is primarily 7024: used to apply the attribute translation rules <a 7025: href="#sectc5222">before</a> those of the element type). This is 7026: specified by the <tt>Attributes</tt> keyword.</li> 7027: <li>the translation of all of the element's specific presentation rules 7028: (which is primarily used to apply the translation rules for the specific 7029: presentation rules <a href="#sectc5222">before</a> those of the element or 7030: its attributes). This option is specified by the <tt>Presentation</tt> 7031: keyword;</li> 7032: <li>The value of the reference's identifier.<br> 7033: Thot associates a unique identifier with each element in a document. This 7034: identifier (called <em>reference's identifier</em> or <em>label</em>) is a 7035: character string containing the letter `L' followed by digits. Thot uses 7036: it in references for identifying the referred element.<br> 7037: The <tt>RefId</tt> keyword produces the reference's identifier of the 7038: element to which the translation rule is applied, or the reference's 7039: identifier of its first ancestor that is referred by a reference or that 7040: can be referred by a reference.</li> 7041: <li>the value of a mark pair's unique identifier. This may only be used for 7042: <a href="#sectd3285">mark pairs</a> and is indicated by the 7043: <tt>PairId</tt> keyword.</li> 7044: <li>the directory containing the file being generated (this string includes 7045: an ending '/', if it is not empty). This is indicated by the 7046: <tt>FileDir</tt> keyword.</li> 7047: <li>the name of the file being generated (only the name, without the 7048: directory and without the extension). This is indicated by the 7049: <tt>FileName</tt> keyword.</li> 7050: <li>the extension of the file being generated (this string starts with a 7051: dot, if it is not empty). This is indicated by the <tt>Extension</tt> 7052: keyword.</li> 7053: <li>the name of the document being translated. This is indicated by the 7054: <tt>DocumentName</tt> keyword.</li> 7055: <li>the directory containing the document being translated. This is 7056: indicated by the <tt>DocumentDir</tt> keyword.</li> 1.18 cvs 7057: </ul> 1.30 cvs 7058: 7059: <p>When the rule applies to a reference (an element or an attribute defined as 7060: a reference in the structure schema), it can generate a text related to the 1.21 cvs 7061: element referred by that reference. The rule name is then followed by the 1.18 cvs 7062: <tt>Referred</tt> keyword and a specification of the object to be generated 7063: for the referred element. This specification can be:</p> 7064: <ul> 1.30 cvs 7065: <li>the name of a variable. The rule generates the value of that variable, 7066: computed for the referred element.</li> 7067: <li>an element type. The rule generates the translation of the element of 7068: that type, which is in the subtree of the referred element. If this 7069: element is not defined in the structure schema which corresponds to the 7070: translation schema (that is, an object defined in another schema), the 7071: element's type name must be followed by the name of its structure schema 7072: between parentheses.</li> 7073: <li>the <tt>RefId</tt> keyword. The rule generates the reference's 7074: identifier of the referred element.</li> 7075: <li>the <tt>DocumentName</tt> keyword. The rule generates the name of the 7076: document to which the referred element belongs.</li> 7077: <li>the <tt>DocumentDir</tt> keyword. The rule generates the name of the 7078: directory that contains the document of the referred element.</li> 1.18 cvs 7079: </ul> 7080: </div> 1.1 cvs 7081: 1.18 cvs 7082: <div class="subsection"> 1.30 cvs 7083: <h3><a name="sectc5211">The <tt>Write</tt> rule</a></h3> 1.1 cvs 7084: 1.30 cvs 7085: <p>The <tt>Write</tt> has the same syntax as the <tt>Create</tt> rule. It 7086: also produces the same effect, but the generated text is displayed on the 7087: user's terminal during the translation of the document, instead of being 7088: produced in the translated document. This is useful for helping the user keep 7089: track of the progress of the translation and for prompting the user on the 7090: terminal for input required by the <tt>Read</tt> rule.</p> 1.18 cvs 7091: <pre> 'Write' Object [ Position ] ';'</pre> 1.30 cvs 7092: 7093: <p>Notice: if the translator is launched by the editor (by the ``Save as'' 1.18 cvs 7094: command), messages produced by the <tt>Write</tt> rule are not displayed.</p> 1.30 cvs 7095: 1.18 cvs 7096: <blockquote class="example"> 1.30 cvs 7097: <p><strong>Example:</strong></p> 7098: 7099: <p>To make the translator display the number of each section being 7100: translated on the user's terminal, the following rule is specified for the 7101: <tt>Section</tt> element type:</p> 7102: <pre>Section : BEGIN 1.1 cvs 7103: Write VarSection; 7104: ... 1.18 cvs 7105: END;</pre> 1.30 cvs 7106: 7107: <p>(see <a href="#varsectexample">above</a> for the definition of the 7108: <tt>VarSection</tt> variable).</p> 7109: 7110: <p>To display text on the terminal before issuing a read operation with the 7111: <tt>Read</tt> rule, the following rule is used:</p> 7112: <pre>BEGIN 1.1 cvs 7113: Write 'Enter the name of the destination: '; 7114: ... 1.18 cvs 7115: END;</pre> 7116: </blockquote> 7117: </div> 7118: 7119: <div class="subsection"> 1.30 cvs 7120: <h3><a name="sectc5212">The <tt>Read</tt> rule</a></h3> 1.18 cvs 7121: 1.30 cvs 7122: <p>The <tt>Read</tt> rule reads text from the terminal during the translation 7123: of the document and saves the text read in one of the buffers declared in the 1.18 cvs 7124: <tt>BUFFERS</tt> section of the schema. The buffer to be used is indicated by 7125: its name, after the <tt>READ</tt> keyword. This name can be followed, as in 7126: the <tt>Create</tt> and <tt>Write</tt> rules, by a keyword indicating if the 7127: read operation must be performed <tt>Before</tt> or <tt>After</tt> the 1.1 cvs 7128: translation of the element's content. If this keyword is absent, the read 7129: operation is done beforehand. The text is read into the buffer and remains 1.5 cvs 7130: there until a rule using the same buffer - possibly the same rule - is 1.18 cvs 7131: applied.</p> 7132: <pre> 'Read' BufferID [ Position ] ';'</pre> 1.30 cvs 7133: 1.18 cvs 7134: <blockquote class="example"> 1.30 cvs 7135: <p><strong>Example:</strong></p> 7136: 7137: <p>The following set of rules tells the user that the translator is waiting 7138: for the entry of some text, reads this text into a buffer and copies the 7139: text into the translated document.</p> 7140: <pre>BEGIN 1.1 cvs 7141: Write 'Enter the name of the destination: '; 7142: Read DestName; 7143: Create DestName; 7144: ... 1.18 cvs 7145: END;</pre> 1.30 cvs 7146: 7147: <p>(see <a href="#destname">above</a> the definition of 7148: <tt>DestName</tt>).</p> 1.18 cvs 7149: </blockquote> 7150: </div> 7151: 7152: <div class="subsection"> 1.30 cvs 7153: <h3><a name="sectc5213">The <tt>Include</tt> rule</a></h3> 1.18 cvs 7154: 1.30 cvs 7155: <p>The <tt>Include</tt> rule, like the <tt>Create</tt> rule, is used to 7156: produce text in the translated document. It inserts constant text which is 7157: not defined in the translation schema, but is instead taken from a file. The 1.18 cvs 7158: file's name is specified after the <tt>Include</tt> keyword, either directly 1.1 cvs 7159: as a character string between apostrophes or as the name of one of the buffers 1.18 cvs 7160: declared in the <tt>BUFFERS</tt> section of the schema. In the latter case, 1.1 cvs 7161: the buffer is assumed to contain the file's name. This can be used when the 7162: included file's name is known only at the moment of translation. This only 1.18 cvs 7163: requires that the <tt>Include</tt> rule is preceded by a <tt>Read</tt> rule 7164: which puts the name of the file desired by the user into the buffer.</p> 1.30 cvs 7165: 7166: <p>Like the other rules, it is possible to specify whether the inclusion will 1.1 cvs 7167: occur before or after the element's content, with the default being before. 7168: The file inclusion is only done at the moment of translation, not during the 7169: compilation of the translation schema. Thus, the file to be included need not 7170: exist during the compilation, but it must be accessible at the time of 7171: translation. Its contents can also be modified between two translations, thus 7172: producing different results, even if neither the document or the translation 1.18 cvs 7173: schema are modified.</p> 1.30 cvs 7174: 7175: <p>During translation, the file to be included is searched for along the 7176: schema directory path (indicated by the environment variable 7177: <tt>THOTSCH</tt>). The file name is normally only composed of a simple name, 7178: without specification of a complete file path. However, if the filename 7179: starts with a '/', it is considered as an absolute path.</p> 1.18 cvs 7180: <pre> 'Include' File [ Position ] ';' 1.6 cvs 7181: File = FileName / BufferID . 1.18 cvs 7182: FileName = STRING .</pre> 1.30 cvs 7183: 1.18 cvs 7184: <blockquote class="example"> 1.30 cvs 7185: <p><strong>Example:</strong></p> 7186: 7187: <p>Suppose that it is desirable to print documents of the Article class with 7188: a formatter which requires a number of declarations and definitions at the 7189: beginning of the file. The <tt>Include</tt>rule can be used to achieve 7190: this. All the declarations and definitions a replaced in a file called 7191: <tt>DeclarArt</tt> and then the <tt>Article</tt> element type is given the 7192: following rule:</p> 7193: <pre>Article : BEGIN 1.1 cvs 7194: Include 'DeclarArt' Before; 7195: ... 1.18 cvs 7196: END;</pre> 7197: </blockquote> 7198: </div> 7199: 7200: <div class="subsection"> 1.30 cvs 7201: <h3><a name="sectc5214">The <tt>Get</tt> rule</a></h3> 1.18 cvs 7202: 1.30 cvs 7203: <p>The <tt>Get</tt> rule is used to change the order in which the elements 7204: appear in the translated document. More precisely, it produces the 7205: translation of a specified element before or after the translation of the 7206: content of the element to which the rule applies. The <tt>Before</tt> and 7207: <tt>After</tt> keywords are placed at the end of the rule to specify whether 7208: the operation should be performed before or after translation of the rule's 7209: element (the default is before). The type of the element to be moved must be 7210: specified after the <tt>Get</tt> keyword, optionally preceded by a keyword 7211: indicating where the element will be found in the logical structure of the 7212: document:</p> 1.18 cvs 7213: <dl> 1.30 cvs 7214: <dt><tt>Included</tt></dt> 7215: <dd>The element to be moved is the first element of the indicated type 7216: which is found inside the element to which the rule applies.</dd> 7217: <dt><tt>Referred</tt></dt> 7218: <dd>This keyword can only be used if the rule applies to a reference 7219: element. The element to be moved is either the element designated by the 7220: reference (if that element is of the specified type), or the first 7221: element of the desired type contained within the element designated by 7222: the reference.</dd> 7223: <dt>no keyword</dt> 7224: <dd>If the element to be moved is an associated element, defined in the <a 7225: href="#sectc314"><tt>ASSOC</tt> section</a> of the structure schema, all 7226: associated elements of this type which have not been translated yet are 7227: then translated. Certain elements may in fact have already been 7228: translated by a <tt>Get Referred</tt> rule. 7229: <p>If the element to be moved is not an associated element, the 7230: translator takes the first element of the indicated type from among the 7231: siblings of the rule's element. This is primarily used to change the 7232: order of the components of an aggregate.</p> 7233: </dd> 1.18 cvs 7234: </dl> 1.30 cvs 7235: 7236: <p>If the element to be moved is defined in a structure schema which is not 7237: the one which corresponds to the translation schema (in the case of an 7238: included object with a different schema), the type name of this element must 7239: be followed, between parentheses, by the name of the structure schema which 1.18 cvs 7240: defines it.</p> 7241: <pre> 'Get' [ RelPosition ] ElemID 1.6 cvs 7242: [ ExtStruct ] 7243: [ Position ] ';' / 7244: RelPosition = 'Included' / 'Referred' . 1.18 cvs 7245: ExtStruct = '(' ElemID ')' .</pre> 1.30 cvs 7246: 7247: <p>The <tt>Get</tt> rule has no effect if the element which it is supposed to 1.1 cvs 7248: move has already been translated. Thus, the element will not be duplicated. 7249: It is generally best to associate the rule with the first element which will 7250: be encountered by the translator in its traversal of the document. Suppose an 1.18 cvs 7251: aggregate has two elements <tt>A</tt> and <tt>B</tt>, with <tt>A</tt> 1.1 cvs 7252: appearing first in the logical structure. To permute these two elements, a 1.18 cvs 7253: <tt>Get B before</tt> rule should be associated with the <tt>A</tt> element 7254: type, not the inverse. Similarly, a rule of the form <tt>Get Included X 7255: After</tt>, even though syntactically correct, makes no sense since, by the 1.1 cvs 7256: time it will be applied, after the translation of the contents of the element 1.18 cvs 7257: to which it is attached, the <tt>X</tt> element will already have been 7258: translated.</p> 1.30 cvs 7259: 7260: <p>The <tt>Get</tt> rule is the only way to obtain the translation of the 1.1 cvs 7261: associated elements. In fact, the translator only traverses the primary tree 7262: of the document and thus does not translate the associated elements, except 1.18 cvs 7263: when the translation is explicitly required by a <tt>Get Referred Type</tt> or 7264: <tt>Get Type</tt> rule where <tt>Type</tt> is an associated element type.</p> 1.30 cvs 7265: 1.18 cvs 7266: <blockquote class="example"> 1.30 cvs 7267: <p><strong>Example:</strong></p> 7268: 7269: <p>The structure schema defined figures as associated element which are 7270: composed of some content and a caption. Moreover, it is possible to make 7271: references to figures, using elements of the <tt>RefFigure</tt> type:</p> 7272: <pre> ... 1.1 cvs 7273: RefFigure = REFERENCE(Figure); 7274: ASSOC 1.6 cvs 7275: Figure = BEGIN 7276: Content = NATURE; 7277: Caption = Text; 7278: END; 1.18 cvs 7279: ...</pre> 1.30 cvs 7280: 7281: <p>Suppose it would be useful to make a figure appear in the translated 7282: document at the place in the text where the first reference to the figure is 7283: made. If some figures are not referenced, then they would appear at the end 7284: of the document. Also, each figure's caption should appear before the 7285: content. The following rules in the translation schema will produce this 7286: result:</p> 7287: <pre>Article : BEGIN 1.1 cvs 7288: ... 7289: Get Figures After; 7290: END; 7291: RefFigure : BEGIN 7292: If FirstRef Get Referred Figure; 7293: ... 7294: END; 7295: Content : BEGIN 7296: Get Caption Before; 7297: ... 1.18 cvs 7298: END;</pre> 7299: </blockquote> 7300: </div> 7301: 7302: <div class="subsection"> 1.30 cvs 7303: <h3><a name="sectc5215">The <tt>Copy</tt> rule</a></h3> 1.18 cvs 7304: 1.30 cvs 7305: <p>Like the <tt>Get</tt> rule, the <tt>Copy</tt> rule generates the 7306: translation of a specified element, but it acts even if the element has 7307: already been translated and it allows to copy it or to translate it later. 7308: Both rules have the same syntax.</p> 1.18 cvs 7309: <pre> 'Copy' [ RelPosition ] ElemID 7310: [ ExtStruct ] [ Position ] ';'</pre> 7311: </div> 7312: 7313: <div class="subsection"> 1.30 cvs 7314: <h3><a name="sectc5216">The <tt>Use</tt> rule</a></h3> 1.18 cvs 7315: 1.30 cvs 7316: <p>The <tt>Use</tt> rule specifies the translation schema to be applied to 1.1 cvs 7317: objects of a certain class that are part of the document. This rule only 7318: appears in the rules for the root element of the document (the first type 1.18 cvs 7319: defined after the <tt>STRUCT</tt> keyword in the structure schema) or the 1.1 cvs 7320: rules of an element defined by an external structure (by another structure 1.18 cvs 7321: schema). Also, the <tt>Use</tt> rule cannot be conditional.</p> 1.30 cvs 7322: 7323: <p>If the rule is applied to an element defined by an external structure, the 1.18 cvs 7324: <tt>Use</tt> keyword is simply followed by the name of the translation schema 1.1 cvs 7325: to be used for element constructed according to that external structure. If 7326: the rule is applied to the document's root element, it is formed by the 1.18 cvs 7327: <tt>Use</tt> keyword followed by the translation schema's name, the 7328: <tt>For</tt> keyword and the name of the external structure to which the 7329: indicated translation schema should be applied.</p> 7330: <pre> 'Use' TrSchema [ 'For' ElemID ] ';' 7331: TrSchema = NAME .</pre> 1.30 cvs 7332: 7333: <p>If no <tt>Use</tt> rule defines the translation schema to be used for an 1.1 cvs 7334: external structure which appears in a document, the translator asks the user, 7335: during the translation process, which schema should be used. Thus, it is not 1.18 cvs 7336: necessary to give the translation schema a <tt>Use</tt> rule for every 1.1 cvs 7337: external structure used, especially when the choice of translation schemas is 1.18 cvs 7338: to be left to the user.</p> 1.30 cvs 7339: 7340: <p>Notice: if the translator is launched by the editor (by the ``Save as'' 1.18 cvs 7341: command), prompts are not displayed.</p> 1.30 cvs 7342: 1.18 cvs 7343: <blockquote class="example"> 1.30 cvs 7344: <p><strong>Example:</strong></p> 7345: 7346: <p>The <tt>Article</tt> structure schema uses the <tt>Formula</tt> external 7347: structure, defined by another structure schema, for mathematical 7348: formulas:</p> 7349: <pre>STRUCTURE Article; 1.1 cvs 7350: ... 7351: STRUCT 7352: Article = ... 7353: ... 7354: Formula_in_text = Formula; 7355: Isolated_formula = Formula; 7356: ... 1.18 cvs 7357: END</pre> 1.30 cvs 7358: 7359: <p>Suppose that it would be useful to use the <tt>FormulaT</tt> translation 7360: schema for the formulas of an article. This can be expressed in two 7361: different ways in the <tt>Article</tt> class translation schema, using the 7362: rules:</p> 7363: <pre>RULES 1.1 cvs 7364: Article : 1.18 cvs 7365: Use FormulaT for Formula;</pre> 1.30 cvs 7366: 7367: <p>or:</p> 7368: <pre>RULES 1.1 cvs 7369: ... 7370: Formula : 1.18 cvs 7371: Use FormulaT;</pre> 7372: </blockquote> 7373: </div> 7374: 7375: <div class="subsection"> 1.30 cvs 7376: <h3><a name="sectc5217">The <tt>Remove</tt> rule</a></h3> 1.18 cvs 7377: 1.30 cvs 7378: <p>The <tt>Remove</tt> rule indicates that nothing should be generated, in the 1.1 cvs 7379: translated document, for the content of the element to which the rule applies. 7380: The content of that element is simply ignored by the translator. This does 7381: not prevent the generation of text for the element itself, using the 1.18 cvs 7382: <tt>Create</tt> or <tt>Include</tt> rules, for example.</p> 1.30 cvs 7383: 7384: <p>The <tt>Remove</tt> rule is simply written with the <tt>Remove</tt> 7385: keyword. It is terminated, like all rules, by a semicolon.</p> 1.18 cvs 7386: <pre> 'Remove' ';'</pre> 7387: </div> 7388: 7389: <div class="subsection"> 1.31 cvs 7390: <h3><a name="sectc5217a">The <tt>Ignore</tt> rule</a></h3> 7391: 7392: <p>The <tt>Ignore</tt> rule indicates that nothing should be generated, in the 7393: translated document, for the element to which the rule applies. The whole 1.32 ! cvs 7394: element is simply ignored by the translator.</p> 1.31 cvs 7395: 7396: <p>The <tt>Ignore</tt> rule is simply written with the <tt>Ignore</tt> 7397: keyword. It is terminated, like all rules, by a semicolon.</p> 7398: <pre> 'Ignore' ';'</pre> 7399: </div> 7400: 7401: <div class="subsection"> 1.30 cvs 7402: <h3><a name="sectc5218">The <tt>NoTranslation</tt> rule</a></h3> 1.18 cvs 7403: 1.30 cvs 7404: <p>The <tt>NoTranslation</tt> rule indicates to the translator that it must 7405: not translate the content of the leaves of the element to which it applies. In 1.18 cvs 7406: contrast to the <tt>Remove</tt> rule, it does not suppress the content of the 1.1 cvs 7407: element, but it inhibits the translation of character strings, symbols, and 7408: graphical elements contained in the element. These are retrieved so that 1.18 cvs 7409: after the translation of the document, the rules of the <a 7410: href="#sectc5225"><tt>TEXTTRANSLATE</tt>, <tt>SYMBTRANSLATE</tt> and 7411: <tt>GRAPHTRANSLATE</tt> sections</a> will not be applied to them.</p> 1.30 cvs 7412: 7413: <p>The <tt>NoTranslation</tt> rule is written with the <tt>NoTranslation</tt> 1.18 cvs 7414: keyword followed by a semicolon.</p> 7415: <pre> 'NoTranslation' ';'</pre> 7416: </div> 7417: 7418: <div class="subsection"> 1.30 cvs 7419: <h3><a name="sectc5219">The <tt>NoLineBreak</tt> rule</a></h3> 1.18 cvs 7420: 1.30 cvs 7421: <p>The <tt>NoLineBreak</tt> rule indicates to the translator that it must not 1.1 cvs 7422: generate additional line breaks in the output produced for the element to 1.18 cvs 7423: which it applies. This is as if it was an <a href="#sectc522">instruction 7424: <tt>LINELENGTH 0;</tt></a> at the beginning of the translation schema, but 7425: only for the current element.</p> 1.30 cvs 7426: 7427: <p>The <tt>NoLineBreak</tt> rule is written with the <tt>NoLineBreak</tt> 7428: keyword followed by a semicolon.</p> 1.18 cvs 7429: <pre> 'NoLineBreak' ';'</pre> 7430: </div> 1.1 cvs 7431: 1.18 cvs 7432: <div class="subsection"> 1.30 cvs 7433: <h3><a name="sectc5220">The <tt>ChangeMainFile</tt> rule</a></h3> 1.1 cvs 7434: 1.30 cvs 7435: <p>When the translation program starts, it opens a main output file, whose 7436: name is given as a parameter of the translator. All <a 1.18 cvs 7437: href="#sectc5210"><tt>Create</tt> rules</a> without explicit indication of the 7438: output file write sequentially in this file. When a <tt>ChangeMainFile</tt> 7439: rule is executed, the main output file is closed and it is replaced by a new 7440: one, whose name is specified in the <tt>ChangeMainFile</tt> rule. The 7441: <tt>Create</tt> rules without indication of the output file that are then 7442: executed write in this new file. Several <tt>ChangeMainFile</tt> rules can be 7443: executed during the same translation, for dividing the main output into 7444: several files.</p> 1.30 cvs 7445: 7446: <p>This rule is written with the <tt>ChangeMainFile</tt> keyword followed by 7447: the name of a variable that specifies the name of the new main file. The 7448: keyword <tt>Before</tt> or <tt>After</tt> can be placed at the end of the rule 7449: to specify whether the operation should be performed before or after 7450: translation of the rule's element (the default is before). This rule, like all 7451: translation rules, is terminated by a semicolon.</p> 1.18 cvs 7452: <pre> 'ChangeMainFile' VarID [ Position ] ';'</pre> 1.30 cvs 7453: 1.18 cvs 7454: <blockquote class="example"> 1.30 cvs 7455: <p><strong>Example:</strong></p> 7456: 7457: <p>To generate the translation of each section in a different file, the 7458: following rule can be associated with type <tt>Section</tt>. That rule uses 7459: the <a href="#varoutputfile"><tt>VarOutpuFile</tt> variable</a> defined 7460: above.</p> 7461: <pre> Section: 1.18 cvs 7462: ChangeMainFile VarOutpuFile Before;</pre> 1.30 cvs 7463: 7464: <p>If <tt>output.txt</tt> is the name of the output file specified when 7465: starting the translation program, translated sections are written in files 7466: <tt>output1.txt</tt>, <tt>output2.txt</tt>, etc.</p> 1.18 cvs 7467: </blockquote> 7468: </div> 1.1 cvs 7469: 1.18 cvs 7470: <div class="subsection"> 1.30 cvs 7471: <h3><a name="sectc5220a">The <tt>RemoveFile</tt> rule</a></h3> 1.14 cvs 7472: 1.30 cvs 7473: <p>Files may be used for storing temporary data that are no longer needed when 1.18 cvs 7474: the translation of a document is complete. These files may be removed by the 7475: <tt>RemoveFile</tt> rule.</p> 1.30 cvs 7476: 7477: <p>This rule is written with the <tt>RemoveFile</tt> keyword followed by the 7478: name of a variable that specifies the name of the file to be removed. The 7479: keyword <tt>Before</tt> or <tt>After</tt> can be placed at the end of the rule 7480: to specify whether the operation should be performed before or after 7481: translation of the rule's element (the default is before). This rule, like 7482: all translation rules, is terminated by a semicolon.</p> 1.18 cvs 7483: <pre> 'RemoveFile' VarID [ Position ] ';'</pre> 7484: </div> 7485: 7486: <div class="subsection"> 1.30 cvs 7487: <h3><a name="sectc5221">The <tt>Set</tt> and <tt>Add</tt> rules</a></h3> 1.18 cvs 7488: 1.30 cvs 7489: <p>The <tt>Set</tt> and <tt>Add</tt> rules are used for modifying the value of 1.18 cvs 7490: counters that have no <a href="#sectc524">counting function</a>. Only this 7491: type of counter can be used in the <tt>Set</tt> and <tt>Add</tt> rules.</p> 1.30 cvs 7492: 7493: <p>Both rules have the same syntax: after the keyword <tt>Set</tt> or 1.18 cvs 7494: <tt>Add</tt> appear the counter name and the value to assign to the counter 7495: (<tt>Set</tt> rule) or the value to be added to the counter (<tt>Add</tt> 7496: rule). The keyword <tt>Before</tt> or <tt>After</tt> can follow that value to 1.1 cvs 7497: indicate when the rule must be applied: before or after the element's content 1.18 cvs 7498: is translated. By default, <tt>Before</tt> is assumed. A semicolon terminates 7499: the rule.</p> 7500: <pre> 'Set' CounterID InitValue [ Position ] ';' / 7501: 'Add' CounterID Increment [ Position ] ';'</pre> 7502: </div> 7503: 7504: <div class="subsection"> 1.30 cvs 7505: <h3><a name="sectc5221a">The <tt>Indent</tt> rule</a></h3> 1.18 cvs 7506: 1.30 cvs 7507: <p>The <tt>Indent</tt> rule is used to modify the value of text indentation in 1.18 cvs 7508: the output files.</p> 1.30 cvs 7509: 7510: <p>Each time the translator creates a new line in an output file, it generates 7511: a variable number of space characters at the beginning of the new line. By 1.25 cvs 7512: default, the number of these characters (the indentation value) is 0. It can 7513: be changed with the <tt>Indent</tt> rule.</p> 1.30 cvs 7514: 7515: <p>In its simple form, the rule begins with the <tt>Indent</tt> keyword, 1.25 cvs 7516: followed by the indentation sign (optional) and value and a keyword 1.30 cvs 7517: <tt>Before</tt> or <tt>After</tt> indicating that the indentation should be 7518: changed <a href="#sectc5222">before or after</a> the element's content is 7519: generated. If the position is not indicated, the indentation is changed 1.25 cvs 7520: before the element's content is generated. This rule, like all translation 7521: rules, is terminated by a semicolon.</p> 1.30 cvs 7522: 7523: <p>The indentation value is indicated by an integer, which is the number of 7524: space characters to be generated at the beginning of each new line. A sign 1.18 cvs 7525: (<tt>+</tt> or <tt>-</tt>) can appear before the integer to indicate that the 7526: value is relative: the current value of indentation is incremented (if sign is 7527: <tt>+</tt>) or decremented (if sign is <tt>-</tt>) by the specified value.</p> 1.30 cvs 7528: 7529: <p>Keyword <tt>Suspend</tt> or <tt>Resume</tt> can appear instead of the 1.25 cvs 7530: (possibly signed) identation value. <tt>Suspend</tt> means that the new 1.30 cvs 7531: indentation value to be used is zero until another <tt>Indent</tt> rule is 7532: executed and changes the indentation value. <tt>Resume</tt> means that the 7533: indentation value that was used before the last <tt>Indent Suspend</tt> was 7534: executed becomes the new value. Only one <tt>Suspend</tt> can be used before 7535: a <tt>Resume</tt>; <tt>Supend</tt>-<tt>Resume</tt> pairs can not be 7536: nested.</p> 7537: 7538: <p>Like the <a href="#sectc5210"><tt>Create</tt> rule</a>, the <tt>Indent</tt> 1.18 cvs 7539: keyword can be followed by the <tt>IN</tt> keyword and by the name of a <a 7540: href="#sectc526">variable</a>. This means that the rule must not change 1.10 cvs 7541: indentation in the main output file, but in the file whose name is specified 7542: by the variable (by default, indentation is changed in the main output 1.18 cvs 7543: file).</p> 1.25 cvs 7544: <pre> 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' . 1.10 cvs 7545: 1.25 cvs 7546: Indent = 'Suspend' / 'Resume' / [ IndentSign ] IndentValue . 1.10 cvs 7547: IndentSign = '+' / '-' . 1.18 cvs 7548: IndentValue = NUMBER .</pre> 7549: </div> 1.10 cvs 7550: 1.18 cvs 7551: <div class="subsection"> 1.30 cvs 7552: <h3><a name="sectc5222">Rule application order</a></h3> 1.1 cvs 7553: 1.30 cvs 7554: <p>The translator translates the elements which comprise the document in the 1.18 cvs 7555: order induced by the tree structure, except when the <tt>Get</tt> rule is used 1.1 cvs 7556: to change the order of translation. For each element, the translator first 7557: applies the rules specified for the element's type that must be applied before 1.18 cvs 7558: translation of the element's content (rules ending with the <tt>Before</tt> 1.1 cvs 7559: keyword or which have no position keyword). If several rules meet these 7560: criteria, the translator applies them in the order in where they appear in the 1.18 cvs 7561: translation schema.</p> 1.30 cvs 7562: 7563: <p>It then applies all <a href="#sectc5223">rules for the attributes</a> which 1.1 cvs 7564: the element has and which must be applied before the translation of the 1.18 cvs 7565: element's content (rules ending with the <tt>Before</tt> keyword or which have 1.1 cvs 7566: no position keyword). For one attribute value, the translator applies the 1.18 cvs 7567: rules in the order in which they are defined in the translation schema.</p> 1.30 cvs 7568: 7569: <p>The same procedure is followed with translation rules for specific 1.18 cvs 7570: presentations.</p> 1.30 cvs 7571: 1.31 cvs 7572: <p>Next, the element's content is translated, as long as a <tt>Remove</tt> or 7573: <code>Ignore</code> rule does not apply.</p> 1.30 cvs 7574: 7575: <p>In the next step, the translator applies rules for the specific 7576: presentation of the element that are to be applied after translation of the 7577: content (rules which end with the <tt>After</tt> keyword). The rules for each 7578: type of presentation rule or each value are applied in the order in which the 1.18 cvs 7579: translation appear in the schema.</p> 1.30 cvs 7580: 7581: <p>Then, the same procedure is followed for translation rules for attributes 7582: of the element.</p> 7583: 7584: <p>Finally, the translator applies rules for the element which must be applied 1.1 cvs 7585: after translation of the element's content. These rules are applied in the 7586: order that they appear in the translation schema. When the translation of an 7587: element is done, the translator procedes to translate the following 1.18 cvs 7588: element.</p> 1.30 cvs 7589: 7590: <p>This order can be changed with the <tt>Attributes</tt> and 1.18 cvs 7591: <tt>Presentation</tt> options of the <a href="#sectc5210"><tt>Create</tt> 7592: rule</a>.</p> 7593: </div> 1.1 cvs 7594: 1.18 cvs 7595: <div class="subsection"> 1.30 cvs 7596: <h3><a name="sectc5223">Translation of logical attributes</a></h3> 1.1 cvs 7597: 1.30 cvs 7598: <p>After the rules for the element types, the translation schema defines rules 1.18 cvs 7599: for attribute values. This section begins with the <tt>ATTRIBUTES</tt> 1.1 cvs 7600: keyword and is composed of a sequence of rule blocks each preceded by an 1.18 cvs 7601: attribute name and an optional value or value range.</p> 1.30 cvs 7602: 7603: <p>If the attribute's name appears alone before the rule block, the rule are 1.1 cvs 7604: applied to all element which have the attribute, no matter what value the 7605: attribute has. In this case, the attribute name is followed by a colon before 1.18 cvs 7606: the beginning of the rule block.</p> 1.30 cvs 7607: 7608: <p>The attribute's name can be followed by the name of an element type between 1.1 cvs 7609: parentheses. This says, as in presentation schemas, that the rule block which 7610: follows applies not to the element which has the attribute, but to its 1.18 cvs 7611: descendants of the type indicated between the parentheses.</p> 1.30 cvs 7612: 7613: <p>If values are given after the attribute name (or after the name of the 7614: element type), the rules are applied only when the attribute has the indicated 7615: values. The same attribute can appear several times, with different values and 1.1 cvs 7616: different translation rules. Attribute values are indicated in the same way 1.18 cvs 7617: as in <a href="#sectc528">conditions</a> and are followed by a colon before 7618: the block of rules.</p> 1.30 cvs 7619: 7620: <p>The rule block associated with an attribute is either a simple rule or a 1.18 cvs 7621: sequence of rules delimited by the <tt>BEGIN</tt> and <tt>END</tt> keywords. 7622: Note that rules associated with attribute values cannot be conditional.</p> 1.30 cvs 7623: 7624: <p>Translation rules are not required for all attributes (or their values) 1.1 cvs 7625: defined in a structure schema. Only those attributes for which a particular 7626: action must be performed by the translator must have such rules. The rules 1.18 cvs 7627: that can be used are those described above, from <a 7628: href="#sectc5210"><tt>Create</tt></a> to <a 7629: href="#sectc5218"><tt>NoTranslation</tt></a>.</p> 1.30 cvs 7630: <pre> AttrSeq = TransAttr < TransAttr > . 1.1 cvs 7631: TransAttr = AttrID [ '(' ElemID ')' ] 7632: [ RelatAttr ] ':' RuleSeq . 7633: AttrID = NAME . 1.18 cvs 7634: ElemID = NAME .</pre> 1.30 cvs 7635: 1.18 cvs 7636: <blockquote class="example"> 1.30 cvs 7637: <p><strong>Example:</strong></p> 7638: 7639: <p>The structure defined the ``Language'' attribute which can take the 7640: values ``French'' and ``English''. To have the French parts of the original 7641: document removed and prevent the translation of the leaves of the English 7642: parts, the following rules would be used:</p> 7643: <pre>ATTRIBUTES 1.1 cvs 7644: Language=French : 7645: Remove; 7646: Language=English : 1.18 cvs 7647: NoTranslation;</pre> 7648: </blockquote> 7649: </div> 1.1 cvs 7650: 1.18 cvs 7651: <div class="subsection"> 1.30 cvs 7652: <h3><a name="sectc5224">Translation of specific presentations</a></h3> 1.1 cvs 7653: 1.30 cvs 7654: <p>After the rules for attributes, the translation schema defines rules for 7655: the specific presentation. This section begins with the <tt>PRESENTATION</tt> 1.1 cvs 7656: keyword and is composed of a sequence of translation rule blocks each preceded 7657: by a presentation rule name, optionally accompanied by a part which depends on 1.18 cvs 7658: the particular presentation rule.</p> 1.30 cvs 7659: 7660: <p>Each of these translation rule blocks is applied when the translator 7661: operates on an element which has a specific presentation rule of the type 7662: indicated at the head of the block. Depending on the type of the specific 7663: presentation rule, it is possible to specify values of the presentation rule 7664: for which the translation rule block should be applied.</p> 7665: 7666: <p>There are three categories of the presentation rules:</p> 7667: <ul> 7668: <li>rules taking numeric values: <tt>Size</tt>, <tt>Indent</tt>, 7669: <tt>LineSpacing</tt>, <tt>LineWeight</tt>,</li> 7670: <li>rules whose values are taken from a predefined list (i.e. whose type is 7671: an enumeration): <tt>Adjust</tt>, <tt>Justify</tt>, <tt>Hyphenate,/TT>, 7672: <tt>Style</tt>, <tt>Weight</tt>, <tt>Font</tt>, <tt>UnderLine</tt>, 7673: <tt>Thickness</tt>, <tt>LineStyle</tt>,</tt></li> 7674: <li>rules whose value is a name: <tt>FillPattern</tt>, <tt>Background</tt>, 7675: <tt>Foreground</tt>.</li> 1.18 cvs 7676: </ul> 1.30 cvs 7677: 7678: <p>For presentation rules of the first category, the values which provoke 1.1 cvs 7679: application of the translation rules are indicated in the same manner as for 1.18 cvs 7680: <a href="#relattr">numeric attributes</a>. This can be either a unique value 1.1 cvs 7681: or range of values. For a unique value, the value (an integer) is simply 7682: preceded by an equals sign. Value ranges can be specified in one of three 1.18 cvs 7683: ways:</p> 7684: <ul> 1.30 cvs 7685: <li>all values less than a given value (this value is preceded by a ``less 7686: than'' sign '<tt><</tt>'),</li> 7687: <li>all values greater than a given value (this value is preceded by a` 7688: `greater than'' sign '<tt>></tt>'),</li> 7689: <li>all values falling in an interval, bounds included. The range of values 7690: is then specified <tt>IN [</tt>Minimum<tt>..</tt>Maximum<tt>]</tt>, where 7691: Minimum and Maximum are integers.</li> 1.18 cvs 7692: </ul> 1.30 cvs 7693: 7694: <p>All numeric values can be negative, in which case the integer is preceded 7695: by a minus sign. All values must be given in typographers points.</p> 7696: 7697: <p>For presentation rules whose values are taken from a predefined list, the 1.1 cvs 7698: value which provokes application of the translation rules is simply indicated 1.18 cvs 7699: by the equals sign followed by the name of the value.</p> 1.30 cvs 7700: 7701: <p>For presentation rules whose values are names, the value which provokes the 1.1 cvs 7702: application of translation rules is simply indicated by the equals sign 7703: followed by the name of the value. The names of the fill patterns (the 1.18 cvs 7704: <tt>FillPattern</tt> rule) and of the colors (the <tt>Foreground</tt> and 7705: <tt>Background</tt> rules) used in Thot are the same as in the P language.</p> 1.30 cvs 7706: <pre> PresSeq = PresTrans < PresTrans > . 1.1 cvs 7707: PresTrans = PresRule ':' RuleSeq . 7708: PresRule = 'Size' [ PresRelation ] / 7709: 'Indent' [ PresRelation ] / 7710: 'LineSpacing' [ PresRelation ] / 7711: 'Adjust' [ '=' AdjustVal ] / 7712: 'Justify' [ '=' BoolVal ] / 7713: 'Hyphenate' [ '=' BoolVal ] / 7714: 'Style' [ '=' StyleVal ] / 1.24 cvs 7715: 'Weight' [ '=' WeightVal ] / 1.1 cvs 7716: 'Font' [ '=' FontVal ] / 7717: 'UnderLine' [ '=' UnderLineVal ] / 7718: 'Thickness' [ '=' ThicknessVal ] / 7719: 'LineStyle' [ '=' LineStyleVal ] / 7720: 'LineWeight' [ PresRelation ] / 7721: 'FillPattern' [ '=' Pattern ] / 7722: 'Background' [ '=' Color ] / 7723: 'Foreground' [ '=' Color ] . 7724: 7725: PresRelation = '=' PresValue / 1.30 cvs 7726: '>' [ '-' ] PresMinimum / 1.1 cvs 7727: '<' [ '-' ] PresMaximum / 7728: 'IN' '[' [ '-' ] PresIntervalMin '..' 7729: [ '-' ] PresIntervalMax ']' . 7730: AdjustVal = 'Left' / 'Right' / 'VMiddle' / 7731: 'LeftWithDots' . 7732: BoolVal = 'Yes' / 'No' . 1.24 cvs 7733: StyleVal = 'Roman' / 'Italics' / 'Oblique' . 7734: WeightVal = 'Normal' / 'Bold' . 1.1 cvs 7735: FontVal = 'Times' / 'Helvetica' / 'Courier' . 7736: UnderLineVal = 'NoUnderline' / 'UnderLined' / 7737: 'OverLined' / 'CrossedOut' . 7738: ThicknessVal = 'Thick' / 'Thin' . 1.6 cvs 7739: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' . 1.1 cvs 7740: Pattern = NAME . 7741: Color = NAME . 7742: PresMinimum = NUMBER . 7743: PresMaximum = NUMBER . 7744: PresIntervalMin= NUMBER . 7745: PresIntervalMax= NUMBER . 7746: PresValue = [ '-' ] PresVal . 1.18 cvs 7747: PresVal = NUMBER .</pre> 1.30 cvs 7748: 7749: <p>The <a name="prestransl">translation rules associated with specific 1.18 cvs 7750: presentation rules</a> can use the value of the specific presentation rule 1.1 cvs 7751: that causes them to be applied. This behavior is designated by the keyword 1.18 cvs 7752: <tt>Value</tt>. For numerically-valued presentation rules, the numeric value 1.1 cvs 7753: is produced. For other presentation rules, the name of the value is 1.18 cvs 7754: produced.</p> 1.30 cvs 7755: 7756: <p>It should be noted that modifications to the layout of the document's 7757: elements that are made using the combination of the control key and a mouse 7758: button will have no effect on the translation of the document.</p> 7759: 7760: <blockquote class="example"> 7761: <p><strong>Example:</strong></p> 7762: 7763: <p>Suppose that it is desirable to use the same font sizes as in the 7764: specific presentation, but the font size must be between 10 and 18 7765: typographer's points. If font size is set in the translated document by the 7766: string <tt>pointsize=n</tt> where <tt>n</tt> is the font size in 7767: typographer's points then the following rules will suffice:</p> 7768: <pre>PRESENTATION 1.1 cvs 7769: Size < 10 : 7770: Create 'pointsize=10'; 7771: Size in [10..18] : 7772: BEGIN 7773: Create 'pointsize='; 7774: Create Value; 7775: END; 1.30 cvs 7776: Size > 18 : 1.18 cvs 7777: Create 'pointsize=18';</pre> 7778: </blockquote> 7779: </div> 1.1 cvs 7780: 1.18 cvs 7781: <div class="subsection"> 1.30 cvs 7782: <h3><a name="sectc5225">Recoding of characters, symbols and graphics</a></h3> 1.1 cvs 7783: 1.30 cvs 7784: <p>The coding of characters, graphical elements and symbols as defined in Thot 1.1 cvs 7785: does not necessarily correspond to what is required by an application to which 7786: a Thot document must be exported. Because of this the translator can recode 7787: these terminal elements of the documents structure. The last sections of a 7788: translation schema are intended for this purpose, each specifying the recoding 1.18 cvs 7789: rules for one type of terminal element.</p> 1.30 cvs 7790: 7791: <p>The recoding rules for character strings are grouped by alphabets. There is 7792: a group of rules for each alphabet of the Thot document that must be 7793: translated. Each such group of rules begins with the <tt>TEXTTRANSLATE</tt> 7794: keyword, followed by the specification of the alphabet to translate and the 7795: recoding rules, between the <tt>BEGIN</tt> and <tt>END</tt> keywords unless 7796: there is only one recoding rule for the alphabet. The specification of the 7797: alphabet is not required: by default it is assumed to the Latin alphabet (the 7798: ISO Latin-1 character set).</p> 7799: 7800: <p>Each recoding rule is formed by a source string between apostrophes and a 1.1 cvs 7801: target string, also between apostrophes, the two strings being separated by 1.30 cvs 7802: the arrow symbol (<tt>-></tt>), formed by the ``minus'' and ``greater 7803: than'' characters. The rule is terminated by a semi-colon.</p> 1.18 cvs 7804: <pre> TextTransSeq = [ Alphabet ] TransSeq . 1.1 cvs 7805: Alphabet = NAME . 1.30 cvs 7806: TransSeq ='BEGIN' < Translation > 'END' ';' / 1.1 cvs 7807: Translation . 1.30 cvs 7808: Translation = Source [ '->' Target ] ';' . 1.1 cvs 7809: Source = STRING . 1.18 cvs 7810: Target = STRING .</pre> 1.30 cvs 7811: 7812: <p>One such rule signifies that when the source string appears in a text leaf 7813: of the document being translated, the translator must replace it, in the 1.1 cvs 7814: translated document, with the target string. The source string and the target 7815: string can have different lengths and the target string can be empty. In this 7816: last case, the translator simply suppresses every occurrence of the source 1.18 cvs 7817: string in the translated document.</p> 1.30 cvs 7818: 7819: <p>For a given alphabet, the order of the rules is not important and has no 1.1 cvs 7820: significance because the T language compiler reorders the rules in ways that 7821: speed up the translator's work. The total number of recoding rules is limited 1.18 cvs 7822: by the compiler as is the maximum length of the source and target strings.</p> 1.30 cvs 7823: 7824: <p>The recoding rules for symbols and graphical elements are written in the 7825: same manner as the recoding rules for character strings. They are preceded, 1.18 cvs 7826: respectively, by the <tt>SYMBTRANSLATE</tt> and <tt>GRAPHTRANSLATE</tt> and so 1.1 cvs 7827: not require a specification of the alphabet. Their source string is limited to 7828: one character, since, in Thot, each symbol and each graphical element is 7829: represented by a single character. The symbol and graphical element codes are 1.18 cvs 7830: defined along with the <a href="#sect7">non-standard character codes</a>.</p> 1.30 cvs 7831: 1.18 cvs 7832: <blockquote class="example"> 1.30 cvs 7833: <p><strong>Example:</strong></p> 7834: 7835: <p>In a translation schema producing documents destined for use with the 7836: L<sup>A</sup>T<sub><big>E</big></sub>X formatter, the Latin characters``é'' 7837: (octal code 351 in Thot) and ``č'' (octal code 350 in Thot) must be 7838: converted to their representation in 7839: L<sup>A</sup>T<sub><big>E</big></sub>X:</p> 7840: <pre>TEXTTRANSLATE Latin 1.1 cvs 7841: BEGIN 1.30 cvs 7842: '\350' -> '\`{e}'; { e grave } 7843: '\351' -> '\''{e}'; { e acute } 1.18 cvs 7844: END;</pre> 7845: </blockquote> 7846: </div> 7847: </div> 7848: <hr> 7849: </div> 1.1 cvs 7850: 1.18 cvs 7851: <div class="chapter"> 1.30 cvs 7852: <h1><a name="sect6">Language grammars</a></h1> 1.1 cvs 7853: 1.30 cvs 7854: <p>This chapter gives the complete grammars of the languages of Thot. The 1.1 cvs 7855: grammars were presented and described in the preceding chapters, which also 7856: specify the semantics of the languages. This section gives only the 1.18 cvs 7857: syntax.</p> 1.1 cvs 7858: 1.18 cvs 7859: <div class="section"> 1.30 cvs 7860: <h2><a name="sectb61">The M meta-language</a></h2> 1.1 cvs 7861: 1.30 cvs 7862: <p>The language grammars are all expressed in the same formalism, the M 1.18 cvs 7863: meta-language, which is defined in this section.</p> 7864: <pre>{ Any text between braces is a comment. } 1.30 cvs 7865: Grammar = Rule < Rule > 'END' . 7866: { The < and > signs indicate zero } 1.1 cvs 7867: { or more repetitions. } 7868: { END marks the end of the grammar. } 7869: Rule = Ident '=' RightPart '.' . 7870: { The period indicates the end of a rule } 7871: RightPart = RtTerminal / RtIntermed . 7872: { The slash indicates a choice } 7873: RtTerminal ='NAME' / 'STRING' / 'NUMBER' . 7874: { Right part of a terminal rule } 1.30 cvs 7875: RtIntermed = Possibility < '/' Possibility > . 1.1 cvs 7876: { Right part of an intermediate rule } 1.30 cvs 7877: Possibility = ElemOpt < ElemOpt > . 7878: ElemOpt = Element / '[' Element < Element > ']' / 7879: '<' Element < Element > '>' . 1.1 cvs 7880: { Brackets delimit optional parts } 7881: Element = Ident / KeyWord . 7882: Ident = NAME . 7883: { Identifier, sequence of characters 7884: KeyWord = STRING . 7885: { Character string delimited by apostrophes } 1.18 cvs 7886: END</pre> 7887: </div> 1.1 cvs 7888: 1.18 cvs 7889: <div class="section"> 1.30 cvs 7890: <h2><a name="sectb62">The S language</a></h2> 1.1 cvs 7891: 1.30 cvs 7892: <p>The S language is used to write structure schemas, which contain the 7893: generic logical structures of document and object classes. It is described 7894: here in the M meta-language.</p> 1.18 cvs 7895: <pre>StructSchema = 'STRUCTURE' [ 'EXTENSION' ] ElemID ';' 1.1 cvs 7896: 'DEFPRES' PresID ';' 7897: [ 'ATTR' AttrSeq ] 7898: [ 'PARAM' RulesSeq ] 7899: [ 'STRUCT' RulesSeq ] 7900: [ 'EXTENS' ExtensRuleSeq ] 7901: [ 'ASSOC' RulesSeq ] 7902: [ 'UNITS' RulesSeq ] 7903: [ 'EXPORT' SkeletonSeq ] 7904: [ 'EXCEPT' ExceptSeq ] 7905: 'END' . 7906: 7907: ElemID = NAME . 7908: PresID = NAME . 7909: 1.30 cvs 7910: AttrSeq = Attribute < Attribute > . 1.1 cvs 7911: Attribute = AttrID '=' AttrType ';' . 7912: AttrType = 'INTEGER' / 'TEXT' / 7913: 'REFERENCE' '(' RefType ')' / 7914: ValueSeq . 7915: RefType = 'ANY' / 7916: [ FirstSec ] ElemID [ ExtStruct ] . 1.30 cvs 7917: ValueSeq = AttrVal < ',' AttrVal > . 1.1 cvs 7918: AttrID = NAME . 7919: FirstSec = 'First' / 'Second' . 7920: ExtStruct = '(' ElemID ')' . 7921: AttrVal = NAME . 7922: 1.30 cvs 7923: RulesSeq = Rule < Rule > . 1.1 cvs 7924: Rule = ElemID [ LocAttrSeq ] '=' 7925: DefWithAttr ';' . 7926: LocAttrSeq = '(' 'ATTR' LocalAttr 1.30 cvs 7927: < ';' LocalAttr > ')' . 1.1 cvs 7928: LocalAttr = [ '!' ] AttrID [ '=' AttrType ] . 7929: DefWithAttr = Definition 7930: [ '+' '(' ExtensionSeq ')' ] 7931: [ '-' '(' RestrictSeq ')' ] 7932: [ 'WITH' FixedAttrSeq ] . 1.30 cvs 7933: ExtensionSeq = ExtensionElem < ',' ExtensionElem > . 1.1 cvs 7934: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' / 7935: 'SYMBOL' / 'PICTURE' . 1.30 cvs 7936: RestrictSeq = RestrictElem < ',' RestrictElem > . 1.1 cvs 7937: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' / 7938: 'SYMBOL' / 'PICTURE' . 1.30 cvs 7939: FixedAttrSeq = FixedAttr < ',' FixedAttr > . 1.1 cvs 7940: FixedAttr = AttrID [ FixedOrModifVal ] . 7941: FixedOrModifVal= [ '?' ] '=' FixedValue . 7942: FixedValue = [ '-' ] NumValue / TextValue / AttrVal . 7943: NumValue = NUMBER . 7944: TextValue = STRING . 7945: 7946: Definition = BaseType [ LocAttrSeq ] / Constr / 7947: Element . 7948: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 7949: 'PICTURE' / 'UNIT' / 'NATURE' . 7950: Element = ElemID [ ExtOrDef ] . 7951: ExtOrDef = 'EXTERN' / 'INCLUDED' / 7952: [ LocAttrSeq ] '=' Definition . 7953: 7954: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF' 7955: '(' DefWithAttr ')' / 7956: 'BEGIN' DefOptSeq 'END' / 7957: 'AGGREGATE' DefOptSeq 'END' / 7958: 'CASE' 'OF' DefSeq 'END' / 7959: 'REFERENCE' '(' RefType ')' / 7960: 'PAIR' . 7961: 7962: min = Integer / '*' . 7963: max = Integer / '*' . 7964: Integer = NUMBER . 7965: 1.30 cvs 7966: DefOptSeq = DefOpt ';' < DefOpt ';' > . 1.1 cvs 7967: DefOpt = [ '?' ] DefWithAttr . 7968: 1.30 cvs 7969: DefSeq = DefWithAttr ';' < DefWithAttr ';' > . 1.1 cvs 7970: 1.30 cvs 7971: SkeletonSeq = SkeletonElem < ',' SkeletonElem > ';' . 1.1 cvs 7972: SkeletonElem = ElemID [ 'WITH' Contents ] . 7973: Contents = 'Nothing' / ElemID [ ExtStruct ] . 7974: 1.30 cvs 7975: ExceptSeq = Except ';' < Except ';' > . 1.1 cvs 7976: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr ':' 7977: ExcValSeq . 7978: ExcTypeOrAttr = ElemID / AttrID . 1.30 cvs 7979: ExcValSeq = ExcValue < ',' ExcValue > . 1.1 cvs 7980: ExcValue = 'NoCut' / 'NoCreate' / 7981: 'NoHMove' / 'NoVMove' / 'NoMove' / 7982: 'NoHResize' / 'NoVResize' / 'NoResize' / 1.18 cvs 7983: 'MoveResize' / 1.1 cvs 7984: 'NewWidth' / 'NewHeight' / 7985: 'NewHPos' / 'NewVPos' / 7986: 'Invisible' / 'NoSelect' / 7987: 'Hidden' / 'ActiveRef' / 7988: 'ImportLine' / 'ImportParagraph' / 1.9 cvs 7989: 'NoPaginate' / 'ParagraphBreak' / 7990: 'HighlightChildren' / 'ExtendedSelection' / 1.29 cvs 7991: 'ReturnCreateNL' / 'ReturnCreateWithin' . 1.1 cvs 7992: 1.30 cvs 7993: ExtensRuleSeq = ExtensRule ';' < ExtensRule ';' > . 1.1 cvs 7994: ExtensRule = RootOrElem [ LocAttrSeq ] 7995: [ '+' '(' ExtensionSeq ')' ] 7996: [ '-' '(' RestrictSeq ')' ] 7997: [ 'WITH' FixedAttrSeq ] . 7998: RootOrElem = 'Root' / ElemID . 7999: 1.18 cvs 8000: END</pre> 8001: </div> 1.1 cvs 8002: 1.18 cvs 8003: <div class="section"> 1.30 cvs 8004: <h2><a name="sectb63">The P language</a></h2> 1.1 cvs 8005: 1.30 cvs 8006: <p>The P language is used to write presentation schemas, which define the 1.1 cvs 8007: graphical presentation rules to be applied to different classes of documents 1.18 cvs 8008: and objects. It is described here in the M meta-language.</p> 8009: <pre>PresSchema = 'PRESENTATION' ElemID ';' 1.1 cvs 8010: [ 'VIEWS' ViewSeq ] 8011: [ 'PRINT' PrintViewSeq ] 8012: [ 'COUNTERS' CounterSeq ] 8013: [ 'CONST' ConstSeq ] 8014: [ 'VAR' VarSeq ] 8015: [ 'DEFAULT' ViewRuleSeq ] 8016: [ 'BOXES' BoxSeq ] 8017: [ 'RULES' PresentSeq ] 8018: [ 'ATTRIBUTES' PresAttrSeq ] 8019: [ 'TRANSMIT' TransmitSeq ] 8020: 'END' . 8021: 8022: ElemID = NAME . 8023: 8024: ViewSeq = ViewDeclaration 1.30 cvs 8025: < ',' ViewDeclaration > ';' . 1.1 cvs 8026: ViewDeclaration = ViewID [ 'EXPORT' ] . 8027: ViewID = NAME . 8028: 1.30 cvs 8029: PrintViewSeq = PrintView < ',' PrintView > ';' . 1.1 cvs 8030: PrintView = ViewID / ElemID . 8031: 1.30 cvs 8032: CounterSeq = Counter < Counter > . 1.1 cvs 8033: Counter = CounterID ':' CounterFunc ';' . 8034: CounterID = NAME . 8035: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ] 8036: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] / 1.30 cvs 8037: SetFunction < SetFunction > 8038: AddFunction < AddFunction > 1.1 cvs 8039: [ 'INIT' AttrID ] / 1.16 cvs 8040: 'RLEVEL' 'OF' ElemID . 1.1 cvs 8041: SLevelAsc = [ '-' ] LevelAsc . 8042: LevelAsc = NUMBER . 8043: SetFunction = 'SET' CounterValue 'ON' TypeOrPage . 8044: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . 8045: TypeOrPage = 'Page' [ '(' ViewID ')' ] / 1.16 cvs 8046: [ '*' ] ElemID . 1.1 cvs 8047: CounterValue = NUMBER . 8048: 1.30 cvs 8049: ConstSeq = Const < Const > . 1.1 cvs 8050: Const = ConstID '=' ConstType ConstValue ';' . 8051: ConstID = NAME . 8052: ConstType = 'Text' [ Alphabet ] / 'Symbol' / 8053: 'Graphics' / 'Picture' . 8054: ConstValue = STRING . 8055: Alphabet = NAME . 8056: 1.30 cvs 8057: VarSeq = Variable < Variable > . 1.1 cvs 8058: Variable = VarID ':' FunctionSeq ';' . 8059: VarID = NAME . 1.30 cvs 8060: FunctionSeq = Function < Function > . 1.1 cvs 8061: Function = 'DATE' / 'FDATE' / 8062: 'DocName' / 'DirName' / 8063: 'ElemName' / 'AttributeName' / 8064: ConstID / ConstType ConstValue / 8065: AttrID / 8066: 'VALUE' '(' PageAttrCtr ',' 8067: CounterStyle ')' . 8068: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] / 8069: [ MinMax ] CounterID / AttrID . 8070: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' / 8071: 'Uppercase' / 'Lowercase' . 8072: MinMax = 'MaxRangeVal' / 'MinRangeVal' . 8073: 1.30 cvs 8074: BoxSeq = Box < Box > . 1.1 cvs 8075: Box = 'FORWARD' BoxID ';' / 8076: BoxID ':' ViewRuleSeq . 8077: BoxID = NAME . 8078: 1.30 cvs 8079: PresentSeq = Present < Present > . 1.1 cvs 8080: Present = [ '*' ] [ FirstSec ] ElemID ':' 8081: ViewRuleSeq . 8082: FirstSec = 'First' / 'Second' . 8083: 1.30 cvs 8084: PresAttrSeq = PresAttr < PresAttr > . 1.1 cvs 8085: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ] 8086: [ AttrRelation ] ':' ViewRuleSeq . 8087: AttrID = NAME . 8088: AttrRelation = '=' AttrVal / 1.30 cvs 8089: '>' [ '-' ] MinValue / 1.1 cvs 8090: '<' [ '-' ] MaxValue / 8091: 'IN' '[' [ '-' ] LowerBound '..' 8092: [ '-' ] UpperBound ']' / 8093: 'GREATER' AttrID / 8094: 'EQUAL' AttrID / 8095: 'LESS' AttrID . 8096: AttrVal = [ '-' ] EqualNum / EqualText / AttrValue . 8097: MinValue = NUMBER . 8098: MaxValue = NUMBER . 8099: LowerBound = NUMBER . 8100: UpperBound = NUMBER. 8101: EqualNum = NUMBER . 8102: EqualText = STRING . 8103: AttrValue = NAME . 8104: 1.30 cvs 8105: ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules > 1.1 cvs 8106: 'END' ';' / 8107: ViewRules / CondRules / Rule . 8108: RulesAndCond = CondRules / Rule . 8109: ViewRules = 'IN' ViewID CondRuleSeq . 1.30 cvs 8110: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' / 1.1 cvs 8111: CondRules / Rule . 1.30 cvs 8112: CondRules = CondRule < CondRule > 1.1 cvs 8113: [ 'Otherwise' RuleSeq ] . 8114: CondRule = 'IF' ConditionSeq RuleSeq . 1.30 cvs 8115: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / Rule . 1.1 cvs 8116: 1.30 cvs 8117: ConditionSeq = Condition < 'AND' Condition > . 1.6 cvs 8118: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem . 8119: ConditionElem = 'First' / 'Last' / 8120: [ 'Immediately' ] 'Within' [ NumParent ] 8121: ElemID [ ExtStruct ] / 8122: ElemID / 8123: 'Referred' / 'FirstRef' / 'LastRef' / 8124: 'ExternalRef' / 'InternalRef' / 'CopyRef' / 8125: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' / 8126: 'UserPage' / 'StartPage' / 'ComputedPage' / 8127: 'Empty' / 8128: '(' [ MinMax ] CounterName CounterCond ')' / 8129: CondPage '(' CounterID ')' . 8130: NumParent = [ GreaterLess ] NParent . 1.30 cvs 8131: GreaterLess = '>' / '<' . 1.6 cvs 8132: NParent = NUMBER. 1.30 cvs 8133: CounterCond = '<' MaxCtrVal / '>' MinCtrVal / 1.6 cvs 8134: '=' EqCtrVal / 8135: 'IN' '[' ['-'] MinCtrBound '..' 8136: ['-'] MaxCtrBound ']' . 8137: PageCond = 'Even' / 'Odd' / 'One' . 8138: MaxCtrVal = NUMBER . 8139: MinCtrVal = NUMBER . 8140: EqCtrVal = NUMBER . 8141: MaxCtrBound = NUMBER . 8142: MinCtrBound = NUMBER . 1.1 cvs 8143: 8144: Rule = PresParam ';' / PresFunc ';' . 8145: PresParam = 'VertRef' ':' HorizPosition / 8146: 'HorizRef' ':' VertPosition / 8147: 'VertPos' ':' VPos / 8148: 'HorizPos' ':' HPos / 8149: 'Height' ':' Extent / 8150: 'Width' ':' Extent / 8151: 'VertOverflow' ':' Boolean / 8152: 'HorizOverflow' ':' Boolean / 1.26 cvs 8153: 'MarginTop' ':' MarginWidth / 8154: 'MarginRight' ':' MarginWidth / 8155: 'MarginBottom' ':' MarginWidth / 8156: 'MarginLeft' ':' MarginWidth / 8157: 'PaddingTop' ':' PaddingWidth / 8158: 'PaddingRight' ':' PaddingWidth / 8159: 'PaddingBottom' ':' PaddingWidth / 8160: 'PaddingLeft' ':' PaddingWidth / 8161: 'BorderTopWidth' ':' BorderWidth / 8162: 'BorderRightWidth' ':' BorderWidth / 8163: 'BorderBottomWidth' ':' BorderWidth / 8164: 'BorderLeftWidth' ':' BorderWidth / 8165: 'BorderTopColor' ':' BorderColor / 8166: 'BorderRightColor' ':' BorderColor / 8167: 'BorderBottomColor' ':' BorderColor / 8168: 'BorderLeftColor' ':' BorderColor / 8169: 'BorderTopStyle' ':' BorderStyle / 8170: 'BorderRightStyle' ':' BorderStyle / 8171: 'BorderBottomStyle' ':' BorderStyle / 8172: 'BorderLeftStyle' ':' BorderStyle . 1.1 cvs 8173: 'LineSpacing' ':' DistOrInherit / 8174: 'Indent' ':' DistOrInherit / 8175: 'Adjust' ':' AlignOrInherit / 8176: 'Justify' ':' BoolInherit / 8177: 'Hyphenate' ':' BoolInherit / 8178: 'PageBreak' ':' Boolean / 8179: 'LineBreak' ':' Boolean / 8180: 'InLine' ':' Boolean / 8181: 'NoBreak1' ':' AbsDist / 8182: 'NoBreak2' ':' AbsDist / 8183: 'Gather' ':' Boolean / 8184: 'Visibility' ':' NumberInherit / 8185: 'Size' ':' SizeInherit / 8186: 'Font' ':' NameInherit / 8187: 'Style' ':' StyleInherit / 1.23 cvs 8188: 'Weight' ':' WeightInherit / 1.1 cvs 8189: 'Underline' ':' UnderLineInherit / 8190: 'Thickness' ':' ThicknessInherit / 8191: 'Depth' ':' NumberInherit / 8192: 'LineStyle' ':' LineStyleInherit / 8193: 'LineWeight' ':' DistOrInherit / 8194: 'FillPattern' ':' NameInherit / 1.30 cvs 8195: 'Background' ':' Color / 8196: 'Foreground' ':' Color / 1.1 cvs 8197: 'Content' ':' VarConst . 8198: PresFunc = Creation '(' BoxID ')' / 8199: 'Line' / 8200: 'NoLine' / 8201: 'Page' '(' BoxID ')' / 1.13 cvs 8202: 'Copy' '(' BoxTypeToCopy ')' / 8203: 'ShowBox' / 1.18 cvs 8204: 'BackgroundPicture' ':' FileName / 8205: 'PictureMode' ':' PictMode . 1.1 cvs 8206: 8207: BoxTypeToCopy = BoxID [ ExtStruct ] / 8208: ElemID [ ExtStruct ] . 8209: ExtStruct = '(' ElemID ')' . 8210: 8211: Distance = [ Sign ] AbsDist . 8212: Sign = '+' / '-' . 8213: AbsDist = IntegerOrAttr [ '.' DecimalPart ] 8214: [ Unit ] . 8215: IntegerOrAttr = IntegerPart / AttrID . 8216: IntegerPart = NUMBER . 8217: DecimalPart = NUMBER . 8218: Unit = 'em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' / 8219: 'pc' / 'px' / '%' . 8220: 8221: HPos = 'nil' / VertAxis '=' HorizPosition 8222: [ 'UserSpecified' ] . 8223: VPos = 'nil' / HorizAxis '=' VertPosition 8224: [ 'UserSpecified' ] . 8225: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' . 8226: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' . 8227: 1.6 cvs 8228: VertPosition = Reference '.' HorizAxis [ Distance ] . 8229: HorizPosition = Reference '.' VertAxis [ Distance ] . 8230: Reference = 'Enclosing' [ BoxTypeNot ] / 8231: 'Enclosed' [ BoxTypeNot ] / 8232: 'Previous' [ BoxTypeNot ] / 8233: 'Next' [ BoxTypeNot ] / 8234: 'Referred' [ BoxTypeNot ] / 8235: 'Creator' / 8236: 'Root' / 8237: '*' / 8238: BoxOrType . 8239: BoxOrType = BoxID / 8240: [ '*' ] [ FirstSec ] ElemID / 1.17 cvs 8241: 'AnyElem' / 'AnyBox' / 8242: 'ElemWithAttr' AttrID . 1.6 cvs 8243: BoxTypeNot = [ 'NOT' ] BoxOrType . 8244: 8245: Extent = Reference '.' HeightWidth 8246: [ Relation ] [ 'Min' ] / 8247: AbsDist [ 'UserSpecified' ] [ 'Min' ] / 8248: HPos / VPos . 8249: HeightWidth = 'Height' / 'Width' . 8250: Relation = '*' ExtentAttr '%' / Distance . 8251: ExtentAttr = ExtentVal / AttrID . 8252: ExtentVal = NUMBER . 1.26 cvs 8253: 8254: MarginWidth = InheritParent / 'Auto' / Distance . 8255: PaddingWidth = InheritParent / Distance . 8256: BorderWidth = InheritParent / 'Thin' / 'Medium' / 'Thick' / Distance . 8257: BorderColor = InheritParent / 'Transparent' / 'Foreground' / 8258: ColorName . 8259: BorderStyle = InheritParent / 8260: 'None' / 'Hidden' / 'Dotted' / 'Dashed' / 'Solid' / 8261: 'Double' / 'Groove' / 'Ridge' / 'Inset' / 'Outset' . 1.27 cvs 8262: InheritParent = 'Enclosing' '=' / 'Creator' '=' . 1.26 cvs 8263: ColorName = NAME . 1.6 cvs 8264: 8265: Inheritance = Kinship InheritedValue . 8266: Kinship = 'Enclosing' / 'GrandFather'/ 'Enclosed' / 8267: 'Previous' / 'Creator' . 8268: InheritedValue = '+' PosIntAttr [ 'Max' maximumA ] / 8269: '-' NegIntAttr [ 'Min' minimumA ] / 8270: '=' . 8271: PosIntAttr = PosInt / AttrID . 8272: PosInt = NUMBER . 8273: NegIntAttr = NegInt / AttrID . 8274: NegInt = NUMBER . 8275: maximumA = maximum / AttrID . 8276: maximum = NUMBER . 8277: minimumA = minimum / AttrID . 8278: minimum = NUMBER . 8279: 8280: AlignOrInherit = Kinship '=' / Alignment . 8281: Alignment = 'Left' / 'Right' / 'VMiddle' / 8282: 'LeftWithDots' . 1.1 cvs 8283: 1.6 cvs 8284: DistOrInherit = Kinship InheritedDist / Distance . 8285: InheritedDist = '=' / '+' AbsDist / '-' AbsDist . 1.1 cvs 8286: 1.6 cvs 8287: BoolInherit = Boolean / Kinship '=' . 8288: Boolean = 'Yes' / 'No' . 1.1 cvs 8289: 1.6 cvs 8290: NumberInherit = Integer / AttrID / Inheritance . 8291: Integer = NUMBER . 1.1 cvs 8292: 8293: LineStyleInherit= Kinship '=' / 'Solid' / 'Dashed' / 8294: 'Dotted' . 8295: 1.6 cvs 8296: SizeInherit = SizeAttr [ 'pt' ] / Kinship InheritedSize . 8297: InheritedSize = '+' SizeAttr [ 'pt' ] 8298: [ 'Max' MaxSizeAttr ] / 8299: '-' SizeAttr [ 'pt' ] 8300: [ 'Min' MinSizeAttr ] / 1.22 cvs 8301: '*' PercentSizeAttr '%' / 1.6 cvs 8302: '=' . 8303: SizeAttr = Size / AttrID . 8304: Size = NUMBER . 8305: MaxSizeAttr = MaxSize / AttrID . 8306: MaxSize = NUMBER . 8307: MinSizeAttr = MinSize / AttrID . 8308: MinSize = NUMBER . 1.22 cvs 8309: PercentSizeAttr = PercentSize / AttrID . 8310: PercentSize = NUMBER . 1.6 cvs 8311: 8312: NameInherit = Kinship '=' / FontName . 8313: FontName = NAME . 1.30 cvs 8314: Color = 'Transparent' / Kinship '=' / FontName . 1.6 cvs 8315: StyleInherit = Kinship '=' / 1.23 cvs 8316: 'Roman' / 'Italics' / 'Oblique' . 8317: WeightInherit = Kinship '=' / 8318: 'Normal' / 'Bold' . 1.1 cvs 8319: UnderLineInherit= Kinship '=' / 1.6 cvs 8320: 'NoUnderline' / 'Underlined' / 8321: 'Overlined' / 'CrossedOut' . 1.1 cvs 8322: ThicknessInherit= Kinship '=' / 'Thick' / 'Thin' . 1.13 cvs 8323: 8324: FileName = STRING . 8325: PictMode = 'NormalSize' / 'Scale' / 8326: 'RepeatXY' / 'RepeatX' / 'RepeatY' . 1.1 cvs 8327: 1.6 cvs 8328: VarConst = ConstID / ConstType ConstValue / 8329: VarID / '(' FunctionSeq ')' / 8330: ElemID . 8331: 8332: Creation = Create [ 'Repeated' ] . 8333: Create = 'CreateFirst' / 'CreateLast' / 8334: 'CreateBefore' / 'CreateAfter' / 8335: 'CreateEnclosing' . 8336: 1.30 cvs 8337: TransmitSeq = Transmit < Transmit > . 1.6 cvs 8338: Transmit = TypeOrCounter 'To' ExternAttr 8339: '(' ElemID ')' ';' . 8340: TypeOrCounter = CounterID / ElemID . 8341: ExternAttr = NAME . 1.1 cvs 8342: 1.18 cvs 8343: END</pre> 8344: </div> 1.1 cvs 8345: 1.18 cvs 8346: <div class="section"> 8347: <h2><a name="sectb64">The T language</a></h2> 8348: <pre>TransSchema = 'TRANSLATION' ElemID ';' 1.1 cvs 8349: [ 'LINELENGTH' LineLength ';' ] 8350: [ 'LINEEND' CHARACTER ';' ] 8351: [ 'LINEENDINSERT' STRING ';' ] 8352: [ 'BUFFERS' BufferSeq ] 8353: [ 'COUNTERS' CounterSeq ] 8354: [ 'CONST' ConstSeq ] 8355: [ 'VAR' VariableSeq ] 8356: 'RULES' ElemSeq 8357: [ 'ATTRIBUTES' AttrSeq ] 8358: [ 'PRESENTATION' PresSeq ] 1.30 cvs 8359: < 'TEXTTRANSLATE' TextTransSeq > 1.1 cvs 8360: [ 'SYMBTRANSLATE' TransSeq ] 8361: [ 'GRAPHTRANSLATE' TransSeq ] 8362: 'END' . 8363: 8364: LineLength = NUMBER . 8365: 1.30 cvs 8366: BufferSeq = Buffer < Buffer > . 1.1 cvs 8367: Buffer = BufferID [ '(' 'Picture' ')' ] ';' . 8368: BufferID = NAME . 8369: 1.30 cvs 8370: CounterSeq = Counter < Counter > . 1.1 cvs 8371: Counter = CounterID [ ':' CounterFunc ] ';' . 8372: CounterID = NAME . 8373: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ] 8374: [ 'Init' AttrID ] / 8375: 'Rlevel' 'of' ElemID / 8376: 'Set' InitValue 'On' ElemID 8377: 'Add' Increment 'On' ElemID 8378: [ 'Init' AttrID ] . 8379: SLevelAsc = [ '-' ] LevelAsc . 8380: LevelAsc = NUMBER . 8381: InitValue = NUMBER . 8382: Increment = NUMBER . 8383: ElemID = NAME . 8384: AttrID = NAME . 8385: 1.30 cvs 8386: ConstSeq = Const < Const > . 1.1 cvs 8387: Const = ConstID '=' ConstValue ';' . 8388: ConstID = NAME . 8389: ConstValue = STRING . 8390: 1.30 cvs 8391: VariableSeq = Variable < Variable > . 8392: Variable = VarID ':' Function < Function > ';' . 1.1 cvs 8393: VarID = NAME . 8394: Function = 'Value' '(' CounterID [ ':' Length ] 8395: [ ',' CounterStyle ] ')' / 8396: 'FileDir' / 'FileName' / 'Extension' / 8397: 'DocumentName' / 'DocumentDir' / 8398: ConstID / CharString / 8399: BufferID / AttrID . 8400: Length = NUMBER . 8401: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' / 8402: 'Uppercase' / 'Lowercase' . 8403: CharString = STRING . 8404: 1.30 cvs 8405: ElemSeq = TransType < TransType > . 1.1 cvs 8406: TransType = [ FirstSec ] ElemID ':' RuleSeq . 8407: FirstSec = 'First' / 'Second' . 1.30 cvs 8408: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' . 1.1 cvs 8409: Rule = SimpleRule / ConditionBlock . 8410: ConditionBlock= 'IF' ConditionSeq SimpleRuleSeq . 1.30 cvs 8411: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' / 1.1 cvs 8412: SimpleRule . 8413: 8414: ConditionSeq = Condition [ 'AND' Condition ] . 8415: Condition = [ 'NOT' ] [ 'Target' ] Cond . 8416: Cond = CondElem / CondAscend . 8417: CondElem = 'FirstRef' / 'LastRef' / 8418: 'ExternalRef' / 8419: 'Defined' / 8420: 'Alphabet' '=' Alphabet / 8421: 'ComputedPage' / 'StartPage' / 8422: 'UserPage' / 'ReminderPage' / 8423: 'Empty' / 1.18 cvs 8424: ElemID / 1.1 cvs 8425: 'FirstAttr' / 'LastAttr' . 8426: CondAscend = [ Ascend ] CondOnAscend . 8427: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType . 8428: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] . 8429: CondRelLevel = NUMBER . 8430: CondOnAscend = 'First' / 'Last' / 8431: 'Referred' / 8432: [ 'Immediately' ] 'Within' [ NumParent ] 8433: ElemID [ ExtStruct ] / 8434: 'Attributes' / 8435: AttrID [ RelatAttr ] / 8436: 'Presentation' / 8437: PresRule / 8438: 'Comment' . 8439: NumParent = [ GreaterLess ] NParent . 1.30 cvs 8440: GreaterLess = '>' / '<' . 1.1 cvs 8441: NParent = NUMBER. 8442: Alphabet = NAME . 8443: RelatAttr = '=' Value / 1.30 cvs 8444: '>' [ '-' ] Minimum / 1.1 cvs 8445: '<' [ '-' ] Maximum / 8446: 'IN' '[' [ '-' ] MinInterval '..' 8447: [ '-' ] MaxInterval ']' . 8448: Value = [ '-' ] IntegerVal / TextVal / AttrValue . 8449: Minimum = NUMBER . 8450: Maximum = NUMBER . 8451: MinInterval = NUMBER . 8452: MaxInterval = NUMBER . 8453: IntegerVal = NUMBER . 8454: TextVal = STRING . 8455: AttrValue = NAME . 8456: 8457: SimpleRule = 'Create' [ 'IN' VarID ] Object 8458: [ Position ] ';' / 8459: 'Write' Object [ Position ] ';' / 8460: 'Read' BufferID [ Position ] ';' / 8461: 'Include' File [ Position ] ';' / 1.6 cvs 8462: 'Get' [ RelPosition ] ElemID 8463: [ ExtStruct ] 8464: [ Position ] ';' / 1.1 cvs 8465: 'Copy' [ RelPosition ] ElemID 8466: [ ExtStruct ] 8467: [ Position ] ';' / 8468: 'Use' TrSchema [ 'For' ElemID ] ';' / 8469: 'Remove' ';' / 1.31 cvs 8470: 'Ignore' ';' / 1.1 cvs 8471: 'NoTranslation' ';' / 8472: 'NoLineBreak' ';' / 8473: 'ChangeMainFile' VarID [ Position ] ';' / 1.14 cvs 8474: 'RemoveFile' VarID [ Position ] ';' / 1.10 cvs 8475: 'Set' CounterID InitValue [ Position ] ';' / 8476: 'Add' CounterID Increment [ Position ] ';' / 1.25 cvs 8477: 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' . 1.10 cvs 8478: 1.25 cvs 8479: Indent = 'Suspend' / 'Resume' / [ IndentSign ] IndentValue . 1.10 cvs 8480: IndentSign = '+' / '-' . 8481: IndentValue = NUMBER . 1.1 cvs 8482: 8483: Object = ConstID / CharString / 8484: BufferID / 8485: VarID / 1.30 cvs 8486: '(' Function < Function > ')' / 1.21 cvs 8487: [ 'Translated' ] AttrID / 1.1 cvs 8488: 'Value' / 8489: 'Content' / 8490: 'Comment' / 8491: 'Attributes' / 8492: 'Presentation' / 8493: 'RefId' / 8494: 'PairId' / 8495: 'FileDir' / 'FileName' / 'Extension' / 8496: 'DocumentName' / 'DocumentDir' / 8497: [ 'Referred' ] ReferredObject . 8498: Position = 'After' / 'Before' . 8499: 1.6 cvs 8500: ReferredObject= VarID / 8501: ElemID [ ExtStruct ] / 8502: 'RefId' / 8503: 'DocumentName' / 'DocumentDir' . 1.1 cvs 8504: 1.6 cvs 8505: File = FileName / BufferID . 8506: FileName = STRING . 1.1 cvs 8507: 1.6 cvs 8508: RelPosition = 'Included' / 'Referred' . 8509: ExtStruct = '(' ElemID ')' . 1.1 cvs 8510: 1.6 cvs 8511: TrSchema = NAME . 8512: 1.30 cvs 8513: AttrSeq = TransAttr < TransAttr > . 1.6 cvs 8514: TransAttr = AttrID [ '(' ElemID ')' ] 8515: [ RelatAttr ] ':' RuleSeq . 8516: 1.30 cvs 8517: PresSeq = PresTrans < PresTrans > . 1.6 cvs 8518: PresTrans = PresRule ':' RuleSeq . 8519: PresRule = 'Size' [ PresRelation ] / 8520: 'Indent' [ PresRelation ] / 8521: 'LineSpacing' [ PresRelation ] / 8522: 'Adjust' [ '=' AdjustVal ] / 8523: 'Justify' [ '=' BoolVal ] / 8524: 'Hyphenate' [ '=' BoolVal ] / 8525: 'Style' [ '=' StyleVal ] / 1.24 cvs 8526: 'Weight' [ '=' WeightVal ] / 1.6 cvs 8527: 'Font' [ '=' FontVal ] / 8528: 'UnderLine' [ '=' UnderLineVal ] / 8529: 'Thickness' [ '=' ThicknessVal ] / 8530: 'LineStyle' [ '=' LineStyleVal ] / 8531: 'LineWeight' [ PresRelation ] / 8532: 'FillPattern' [ '=' Pattern ] / 8533: 'Background' [ '=' Color ] / 8534: 'Foreground' [ '=' Color ] . 8535: 8536: PresRelation = '=' PresValue / 1.30 cvs 8537: '>' [ '-' ] PresMinimum / 1.6 cvs 8538: '<' [ '-' ] PresMaximum / 8539: 'IN' '[' [ '-' ] PresIntervalMin '..' 8540: [ '-' ] PresIntervalMax ']' . 8541: AdjustVal = 'Left' / 'Right' / 'VMiddle' / 8542: 'LeftWithDots' . 8543: BoolVal = 'Yes' / 'No' . 1.24 cvs 8544: StyleVal = 'Roman' / 'Italics' / 'Oblique' . 8545: WeightVal = 'Normal' / 'Bold' . 1.6 cvs 8546: FontVal = 'Times' / 'Helvetica' / 'Courier' . 8547: UnderLineVal = 'NoUnderline' / 'UnderLined' / 8548: 'OverLined' / 'CrossedOut' . 8549: ThicknessVal = 'Thick' / 'Thin' . 8550: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' . 8551: Pattern = NAME . 8552: Color = NAME . 8553: PresMinimum = NUMBER . 8554: PresMaximum = NUMBER . 1.1 cvs 8555: PresIntervalMin= NUMBER . 8556: PresIntervalMax= NUMBER . 1.6 cvs 8557: PresValue = [ '-' ] PresVal . 8558: PresVal = NUMBER . 1.1 cvs 8559: 1.6 cvs 8560: TextTransSeq = [ Alphabet ] TransSeq . 8561: Alphabet = NAME . 1.30 cvs 8562: TransSeq = 'BEGIN' < Translation > 'END' ';' / 1.6 cvs 8563: Translation . 1.30 cvs 8564: Translation = Source [ '->' Target ] ';' . 1.6 cvs 8565: Source = STRING . 1.18 cvs 8566: Target = STRING .</pre> 8567: </div> 8568: <hr> 8569: </div> 1.1 cvs 8570: 1.18 cvs 8571: <div class="chapter"> 8572: <h1><a name="sect7">Character coding</a></h1> 1.1 cvs 8573: 1.18 cvs 8574: <div class="section"> 1.30 cvs 8575: <h2><a name="sectb71">Characters</a></h2> 1.1 cvs 8576: 1.30 cvs 8577: <p>The characters of the Latin alphabet follow the encoding defined in the ISO 1.5 cvs 8578: 8859-1 (ISO Latin-1) standard. The characters of the Greek alphabet follow 1.18 cvs 8579: the encoding defined by Adobe for its Symbol font (Adobe FontSpecific).</p> 1.30 cvs 8580: 8581: <p>Characters whose octal code is greater than 0200 are written in the form of 1.1 cvs 8582: their octal code preceded by a backslash character (``\''). For example, the 1.30 cvs 8583: French word 'Résumé' is written <tt>R\351sum\351</tt>.</p> 8584: 8585: <p>To the ISO 8859-1 encoding four characters with the following codes have 8586: been added:<br> 1.18 cvs 8587: <tt>212</tt>: line break<br> 8588: <tt>240</tt>: sticky space<br> 8589: <tt>201</tt>: thin space<br> 8590: <tt>202</tt>: en space</p> 1.30 cvs 8591: 8592: <p>The <tt>212</tt> character is a ``line break'' character which forces a 8593: line break. The <tt>240</tt> character is a ``sticky space'', which cannot be 1.18 cvs 8594: replaced by a line break.</p> 8595: </div> 1.1 cvs 8596: 1.18 cvs 8597: <div class="section"> 1.30 cvs 8598: <h2><a name="sectb72">Symbols</a></h2> 1.1 cvs 8599: 1.30 cvs 8600: <p>The table below gives the codes for the symbols of Thot. Symbols can be 8601: used in presentation schemas constants and in transcoding rules of translation 1.18 cvs 8602: schemas. Each symbol is represented by a single character.</p> 8603: <ul> 1.30 cvs 8604: <li><tt>r</tt>: a radical</li> 8605: <li><tt>i</tt>: a simple integral</li> 8606: <li><tt>c</tt>: a curvilinear integral</li> 8607: <li><tt>d</tt>: a double integral</li> 8608: <li><tt>t</tt>: a triple integral</li> 8609: <li><tt>S</tt>: the summation symbol</li> 8610: <li><tt>P</tt>: the product symbol</li> 8611: <li><tt>U</tt>: the union symbol</li> 8612: <li><tt>I</tt>: the intersection symbol</li> 8613: <li><tt>></tt>: a right arrow</li> 8614: <li><tt><</tt>: a left arrow</li> 8615: <li><tt>^</tt>: an up arrow</li> 8616: <li><tt>V</tt>: a down arrow</li> 8617: <li><tt>(</tt>: an opening parenthesis</li> 8618: <li><tt>)</tt>: a closing parenthesis</li> 8619: <li><tt>{</tt>: an opening brace</li> 8620: <li><tt>}</tt>: a closing brace</li> 8621: <li><tt>[</tt>: an opening bracket</li> 8622: <li><tt>]</tt>: a closing bracket</li> 1.18 cvs 8623: </ul> 8624: </div> 1.1 cvs 8625: 1.18 cvs 8626: <div class="section"> 1.30 cvs 8627: <h2><a name="sectb73">Graphical elements</a></h2> 1.1 cvs 8628: 1.30 cvs 8629: <p>The table below gives the codes for the graphical elements of Thot. These 1.1 cvs 8630: elements can be used in presentation schemas constants and in transcoding 8631: rules of translation schemas. Each graphical element is represented by a 1.18 cvs 8632: single character.</p> 8633: <ul> 1.30 cvs 8634: <li>a: a circle</li> 8635: <li><p><tt>A</tt>: an open curve with an arrow head at the end</p> 8636: </li> 8637: <li><tt>b</tt>: a horizontal line along the lower side of the box</li> 8638: <li><tt>B</tt>: an open curve</li> 8639: <li><tt>c</tt>: an ellipse inscribed in the box</li> 8640: <li><tt>C</tt>: a rectangle with rounded corners</li> 8641: <li><tt>D</tt>: an open curve with two arrow heads</li> 8642: <li><tt>e</tt>: The northwest/southeast diagonal of the box with an 8643: arrowhead at the bottom</li> 8644: <li><tt>E</tt>: The southwest/northeast diagonal of the box with an 8645: arrowhead at the top</li> 8646: <li><tt>F</tt>: an open curve with an arrow head at start</li> 8647: <li><tt>g</tt>: a line from the origin of the box to its opposite 8648: corner</li> 8649: <li><tt>h</tt>: a horizontal line as wide as the box and placed in its 8650: middle</li> 8651: <li><tt>l</tt>: a vertical line on the left side of the box</li> 8652: <li><tt>L</tt>: a lozenge</li> 8653: <li><tt>M</tt>: an open broken line with two arrow heads</li> 8654: <li><tt>N</tt>: an open broken line with an arrow head at start</li> 8655: <li><tt>o</tt>: The southwest/northeast diagonal of the box with an 8656: arrowhead at the bottom</li> 8657: <li><tt>O</tt>: The northwest/southeast diagonal of the box with an 8658: arrowhead at the top</li> 8659: <li><tt>p</tt>: a polygon</li> 8660: <li><tt>P</tt>: a rectangle with round corners and a horizontal bar at the 8661: top</li> 8662: <li><tt>Q</tt>: an ellipse with a horizontal bar at the top</li> 8663: <li><tt>r</tt>: a vertical line on the right side of the box</li> 8664: <li><tt>R</tt>: a rectangle which is the shape of the box</li> 8665: <li><tt>s</tt>: a closed curve</li> 8666: <li><tt>S</tt>: an open broken line</li> 8667: <li><tt>t</tt>: a horizontal line along the upper side of the box</li> 8668: <li><tt>U</tt>: an open broken line with an arrow head at the end</li> 8669: <li><tt>v</tt>: a vertical line as tall as the box and placed in its 8670: middle</li> 8671: <li><tt>V</tt>: a down arrow as tall as the box and in its middle</li> 8672: <li>w: a segment (2 points)</li> 8673: <li><tt>W</tt>: the upper right corner</li> 8674: <li>x: a segment (2 points) with an arrow head at the end</li> 8675: <li><tt>X</tt>: the lower right corner</li> 8676: <li>y: a segment (2 points) with an arrow head at the end</li> 8677: <li><tt>Y</tt>: the lower left corner</li> 8678: <li>z: a segment (2 points) with an arrow head at the end</li> 8679: <li><tt>Z</tt>: the upper left corner</li> 8680: <li><tt>space</tt>: a transparent element</li> 8681: <li><tt>^</tt>: an up arrow as tall as the box and in its middle</li> 8682: <li><tt>></tt>: a right arrow as long as the box's width and in its 8683: middle</li> 8684: <li><tt>></tt>: a left arrow as long as the box's width and in its 8685: middle</li> 8686: <li><tt>/</tt>: The southwest/northeast diagonal of the box</li> 8687: <li><tt>\</tt>: the northwest/southeast diagonal of the box</li> 1.18 cvs 8688: </ul> 8689: <hr> 8690: </div> 8691: </div> 8692: </body> 8693: </html>