Return to languages.html CVS log | Up to [Public] / Amaya / doc |
1.37 cvs 1: <?xml version="1.0" encoding="iso-8859-1"?> 2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 1.52 quint 3: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 1.37 cvs 4: <html xmlns="http://www.w3.org/1999/xhtml"> 1.18 cvs 5: <head> 1.52 quint 6: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 1.30 cvs 7: <title>The Languages of Thot</title> 1.18 cvs 8: </head> 1.30 cvs 9: 1.18 cvs 10: <body> 11: 1.19 cvs 12: <div class="frontmatter" align="center"> 1.18 cvs 13: <h1>The Languages of Thot</h1> 14: 15: <h3>Vincent Quint</h3> 16: 17: <h4>Translated from French by Ethan Munson</h4> 18: 1.55 ! quint 19: <h4>Version of December 9, 2004</h4> 1.30 cvs 20: 1.52 quint 21: <p>© 1996-2004 INRIA</p> 1.37 cvs 22: <hr /> 1.18 cvs 23: </div> 24: 25: <div class="tableofcontents"> 26: <h2><a href="languages.toc.html">Contents</a></h2> 27: <ul> 1.52 quint 28: <li><big><a href="#sect2">The document model of Thot</a></big> 1.30 cvs 29: <ul> 30: <li><strong><a href="#sectb21">The logical structure of 31: documents</a></strong></li> 32: <li><strong><a href="#sectb22">Generic and specific 33: structures</a></strong></li> 34: <li><strong><a href="#sectb23">Logical structure and physical 35: structure</a></strong></li> 36: <li><strong><a href="#sectb24">Document structures and object 37: structures</a></strong></li> 38: </ul> 39: </li> 1.52 quint 40: <li><big><a href="#sect3">The S language</a></big> 1.30 cvs 41: <ul> 1.52 quint 42: <li><strong><a href="#sectb31">Document meta-structure</a></strong> 1.30 cvs 43: <ul> 44: <li><a href="#sectc311">The basic types</a></li> 45: <li><a href="#sectc312">Constructed elements</a></li> 1.52 quint 46: <li><a href="#sectc313">Logical structure constructors</a> 1.30 cvs 47: <ul> 48: <li><small><a href="#sectd3131">Aggregate and 49: List</a></small></li> 50: <li><small><a href="#sectd3132">Choice, Schema, and 51: Unit</a></small></li> 52: <li><small><a href="#sectd3133">Reference and 53: Inclusion</a></small></li> 54: <li><small><a href="#sectd3134">Mark pairs</a></small></li> 55: <li><small><a href="#sectd3135">Restrictions and 56: Extensions</a></small></li> 57: <li><small><a href="#sectd3136">Summary</a></small></li> 58: </ul> 59: </li> 60: <li><a href="#sectc315">Attributes</a></li> 61: <li><a href="#sectc316">Discussion of the model</a></li> 62: </ul> 63: </li> 64: <li><strong><a href="#sectb32">The definition language for generic 1.52 quint 65: structures</a></strong> 1.30 cvs 66: <ul> 67: <li><a href="#sectc321">Writing Conventions</a></li> 68: <li><a href="#sectc322">Extension schemas</a></li> 69: <li><a href="#sectc323">The general organization of structure 70: schemas</a></li> 71: <li><a href="#sectc324">The default presentation</a></li> 72: <li><a href="#sectc325">Global Attributes</a></li> 73: <li><a href="#sectc327">Structured elements</a></li> 1.52 quint 74: <li><a href="#sectc328">Structure definitions</a> 1.30 cvs 75: <ul> 76: <li><small><a href="#sectd3281">List</a></small></li> 77: <li><small><a href="#sectd3282">Aggregate</a></small></li> 78: <li><small><a href="#sectd3283">Choice</a></small></li> 79: <li><small><a href="#sectd3284">Reference</a></small></li> 80: <li><small><a href="#sectd3285">Mark pairs</a></small></li> 81: </ul> 82: </li> 83: <li><a href="#sectc329">Imports</a></li> 84: <li><a href="#sectc3210">Extension rules</a></li> 85: <li><a href="#sectc3212">Units</a></li> 86: <li><a href="#sectc3213">Skeleton elements</a></li> 87: <li><a href="#sectc3214">Exceptions</a></li> 88: </ul> 89: </li> 1.52 quint 90: <li><strong><a href="#sectb33">Some examples</a></strong> 1.30 cvs 91: <ul> 92: <li><a href="#sectc331">A class of documents: articles</a></li> 93: <li><a href="#sectc332">A class of objects: mathematical 94: formulas</a></li> 95: </ul> 96: </li> 97: </ul> 98: </li> 1.52 quint 99: <li><big><a href="#sect4">The P language</a></big> 1.30 cvs 100: <ul> 1.52 quint 101: <li><strong><a href="#sectb41">Document presentation</a></strong> 1.30 cvs 102: <ul> 103: <li><a href="#sectc411">Two levels of presentation</a></li> 104: <li><a href="#sectc412">Boxes</a></li> 105: <li><a href="#sectc413">Views and visibility</a></li> 106: <li><a href="#sectc414">Pages</a></li> 107: <li><a href="#sectc415">Numbering</a></li> 1.34 cvs 108: <li><a href="#sectc416">Presentation properties</a></li> 1.30 cvs 109: </ul> 110: </li> 111: <li><strong><a href="#sectb42">Presentation description 1.52 quint 112: language</a></strong> 1.30 cvs 113: <ul> 114: <li><a href="#sectc421">The organization of a presentation 115: schema</a></li> 116: <li><a href="#sectc422">Views</a></li> 117: <li><a href="#sectc423">Print Views</a></li> 118: <li><a href="#sectc424">Counters</a></li> 119: <li><a href="#sectc425">Presentation constants</a></li> 120: <li><a href="#sectc426">Variables</a></li> 121: <li><a href="#sectc427">Default presentation rules</a></li> 122: <li><a href="#sectc428">Presentation and page layout boxes</a></li> 123: <li><a href="#sectc429">Presentation of structured elements</a></li> 124: <li><a href="#sectc4210">Logical attribute presentation</a></li> 125: <li><a href="#sectc4212">Value transmission rules</a></li> 126: <li><a href="#sectc4213">Presentation rules</a></li> 127: <li><a href="#sectc4214">Conditions applying to presentation 1.52 quint 128: rules</a> 1.30 cvs 129: <ul> 1.37 cvs 130: <li><small><a href="#sectd42141">Conditions based on the 131: logical position of the element</a></small></li> 1.42 quint 132: <li><small><a href="#sectd421411">Conditions based on the 133: element type</a></small></li> 1.30 cvs 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> 1.49 quint 150: <li><a href="#Floats">Floats</a></li> 1.52 quint 151: <li><a href="#sectc4219">Box extents</a> 1.30 cvs 152: <ul> 153: <li><small><a href="#sectd42191">Fixed extents</a></small></li> 154: <li><small><a href="#sectd42192">Relative 155: extents</a></small></li> 156: <li><small><a href="#sectd42193">Elastic 157: extents</a></small></li> 158: </ul> 159: </li> 160: <li><a href="#sectc4220">Overflow</a></li> 161: <li><a href="#sectc4221">Inheritance</a></li> 1.52 quint 162: <li><a href="#sectc4222">Line breaking</a> 1.30 cvs 163: <ul> 164: <li><small><a href="#sectd42221">Line spacing</a></small></li> 165: <li><small><a href="#sectd42222">First line 166: indentation</a></small></li> 167: <li><small><a href="#sectd42223">Alignment</a></small></li> 168: <li><small><a href="#sectd42225">Hyphenation</a></small></li> 1.40 quint 169: <li><small><a href="#sectd422251">Writing 170: direction</a></small></li> 1.30 cvs 171: <li><small><a href="#sectd42226">Avoiding line 172: breaking</a></small></li> 173: </ul> 174: </li> 175: <li><a href="#sectc4223">Page breaking and line breaking 176: conditions</a></li> 1.54 quint 177: <li><a href="#Controllin">Controlling style of lists</a> 178: <ul> 179: <li><a href="#litype">List item type</a></li> 180: <li><a href="#liimage">List item image</a></li> 181: <li><a href="#liposition">List item position</a></li> 182: </ul> 183: </li> 1.30 cvs 184: <li><a href="#sectc4224">Visibility</a></li> 1.52 quint 185: <li><a href="#sectc4225">Character style properties</a> 1.30 cvs 186: <ul> 187: <li><small><a href="#sectd42251">Character size</a></small></li> 188: <li><small><a href="#sectd42252">Font and character 189: style</a></small></li> 190: <li><small><a href="#sectd42253">Underlining</a></small></li> 191: </ul> 192: </li> 193: <li><a href="#sectc4226">Stacking order</a></li> 194: <li><a href="#sectc4227">Line style</a></li> 195: <li><a href="#sectc4228">Line thickness</a></li> 196: <li><a href="#sectc4229">Fill pattern</a></li> 197: <li><a href="#sectc4230">Colors</a></li> 198: <li><a href="#sectc4230a">Background color and border</a></li> 199: <li><a href="#sectc4230b">Background pictures</a></li> 1.48 quint 200: <li><a href="#sectc4230c">Opacity</a></li> 1.30 cvs 201: <li><a href="#sectc4231">Presentation box content</a></li> 202: <li><a href="#sectc4232">Presentation box creation</a></li> 203: <li><a href="#sectc4233">Page layout</a></li> 204: <li><a href="#sectc4234">Box copies</a></li> 205: </ul> 206: </li> 207: </ul> 208: </li> 1.52 quint 209: <li><big><a href="#sect5">The T language</a></big> 1.30 cvs 210: <ul> 1.52 quint 211: <li><strong><a href="#sectb51">Document translation</a></strong> 1.30 cvs 212: <ul> 213: <li><a href="#sectc511">Translation principles</a></li> 214: <li><a href="#sectc512">Translation procedure</a></li> 215: </ul> 216: </li> 217: <li><strong><a href="#sectb52">Translation definition 1.52 quint 218: language</a></strong> 1.30 cvs 219: <ul> 220: <li><a href="#sectc521">Organization of a translation 221: schema</a></li> 222: <li><a href="#sectc522">Line length</a></li> 223: <li><a href="#sectc523">Buffers</a></li> 224: <li><a href="#sectc524">Counters</a></li> 225: <li><a href="#sectc525">Constants</a></li> 226: <li><a href="#sectc526">Variables</a></li> 227: <li><a href="#sectc527">Translating structure elements</a></li> 1.52 quint 228: <li><a href="#sectc528">Conditional rules</a> 1.30 cvs 229: <ul> 230: <li><small><a href="#sectd5281">Conditions based on the logical 231: position of the element</a></small></li> 232: <li><small><a href="#sectd5282">Conditions on 233: references</a></small></li> 234: <li><small><a href="#sectd5284">Conditions on the 1.41 vatton 235: scripts</a></small></li> 1.30 cvs 236: <li><small><a href="#sectd5285">Conditions on page 237: breaks</a></small></li> 238: <li><small><a href="#sectd5286">Conditions on the element's 239: content</a></small></li> 240: <li><small><a href="#sectd5288">Conditions on the presence of 241: specific presentation rules</a></small></li> 242: <li><small><a href="#sectd5289">Conditions on the presence of 243: logical attributes</a></small></li> 244: <li><small><a href="#sectd52810">Conditions on logical 245: attributes</a></small></li> 246: <li><small><a href="#sectd52811">Conditions on specific 247: presentation rules</a></small></li> 248: </ul> 249: </li> 250: <li><a href="#sectc529">Translation rules</a></li> 251: <li><a href="#sectc5210">The <tt>Create</tt> rule</a></li> 252: <li><a href="#sectc5211">The <tt>Write</tt> rule</a></li> 253: <li><a href="#sectc5212">The <tt>Read</tt> rule</a></li> 254: <li><a href="#sectc5213">The <tt>Include</tt> rule</a></li> 255: <li><a href="#sectc5214">The <tt>Get</tt> rule</a></li> 256: <li><a href="#sectc5215">The <tt>Copy</tt> rule</a></li> 257: <li><a href="#sectc5216">The <tt>Use</tt> rule</a></li> 258: <li><a href="#sectc5217">The <tt>Remove</tt> rule</a></li> 1.31 cvs 259: <li><a href="#sectc5217a">The <code>Ignore</code> rule</a></li> 1.30 cvs 260: <li><a href="#sectc5218">The <tt>NoTranslation</tt> rule</a></li> 261: <li><a href="#sectc5219">The <tt>NoLineBreak</tt> rule</a></li> 262: <li><a href="#sectc5220">The <tt>ChangeMainFile</tt> rule</a></li> 263: <li><a href="#sectc5220a">The <tt>RemoveFile</tt> rule</a></li> 264: <li><a href="#sectc5221">The <tt>Set</tt> and <tt>Add</tt> 265: rules</a></li> 266: <li><a href="#sectc5221a">The <tt>Indent</tt> rule</a></li> 267: <li><a href="#sectc5222">Rule application order</a></li> 268: <li><a href="#sectc5223">Translation of logical attributes</a></li> 269: <li><a href="#sectc5224">Translation of specific 270: presentations</a></li> 271: <li><a href="#sectc5225">Recoding of characters, symbols and 272: graphics</a></li> 273: </ul> 274: </li> 275: </ul> 276: </li> 1.52 quint 277: <li><big><a href="#sect6">Language grammars</a></big> 1.30 cvs 278: <ul> 279: <li><strong><a href="#sectb61">The M meta-language</a></strong></li> 280: <li><strong><a href="#sectb62">The S language</a></strong></li> 281: <li><strong><a href="#sectb63">The P language</a></strong></li> 282: <li><strong><a href="#sectb64">The T language</a></strong></li> 283: </ul> 284: </li> 1.52 quint 285: <li><big><a href="#sect7">Character coding</a></big> 1.30 cvs 286: <ul> 287: <li><strong><a href="#sectb71">Characters</a></strong></li> 288: <li><strong><a href="#sectb72">Symbols</a></strong></li> 289: <li><strong><a href="#sectb73">Graphical elements</a></strong></li> 290: </ul> 291: </li> 1.18 cvs 292: </ul> 1.37 cvs 293: <hr /> 1.18 cvs 294: </div> 1.1 cvs 295: 1.18 cvs 296: <div class="chapter"> 1.37 cvs 297: <h1><a name="sect2" id="sect2">The document model of Thot</a></h1> 1.1 cvs 298: 1.30 cvs 299: <p>All of the services which Thot provides to the user are based on the 1.37 cvs 300: system's internal document representation. This representation is itself 301: derived from the document model which underlies Thot. The model is presented 1.30 cvs 302: here, prior to the description of the languages which permit the generic 303: specification of documents.</p> 1.1 cvs 304: 1.18 cvs 305: <div class="section"> 1.37 cvs 306: <h2><a name="sectb21" id="sectb21">The logical structure of documents</a></h2> 1.1 cvs 307: 1.30 cvs 308: <p>The document model of Thot is primarily designed to allow the user to 309: operate on those entities which s/he has in mind when s/he works on a 310: document. The model makes no assumptions about the nature of these entities. 311: It is essentially these logical entities, such as paragraphs, sections, 312: chapters, notes, titles, and cross-references which give a document its 313: logical structure.</p> 314: 315: <p>Because of this model, the author can divide the document into chapters, 1.37 cvs 316: giving each one a title. The content of these chapters can be further divided 317: into sections, subsections, etc. The text is organized into successive 1.2 cvs 318: paragraphs, according to the content. In the writing phase, the lines, pages, 1.37 cvs 319: margins, spacing, fonts, and character styles are not very important. In 320: fact, if the system requires documents to be written in these terms, it gets 321: in the way. So, Thot's model is primarily based on the logical aspect of 322: documents. The creation of a model of this type essentially requires the 323: definition :</p> 1.18 cvs 324: <ul> 1.30 cvs 325: <li>of the entities which can appear in the documents,</li> 326: <li>and the relations between these entities.</li> 1.18 cvs 327: </ul> 1.30 cvs 328: 1.37 cvs 329: <p>The choice of entities to include in the model can be subtle. Some 330: documents require chapters, while others only need various levels of 331: sections. Certain documents contain appendices, others don't. In different 332: documents the same logical entity may go by different names (e.g. 333: ``Conclusion'' and ``Summary''). Certain entities which are absolutely 334: necessary in some documents, such as clauses in a contract or the address of 335: the recipient in a letter, are useless in most other cases.</p> 1.30 cvs 336: 337: <p>The differences between documents result from more than just the entities 338: that appear in them, but also from the relationships between these entities 1.37 cvs 339: and the ways that they are linked. In certain documents, notes are spread 1.30 cvs 340: throughout the document, for example at the bottom of the page containing the 1.1 cvs 341: cross-reference to them, while in other documents they are collected at the 1.37 cvs 342: end of each chapter or even at the end of the work. As another example, the 1.1 cvs 343: introduction of some documents can contain many sections, while in other 344: documents, the introduction is restricted to be a short sequence of 1.18 cvs 345: paragraphs.</p> 1.30 cvs 346: 1.37 cvs 347: <p>All of this makes it unlikely that a single model can describe any 348: document at a relatively high level. It is obviously tempting to make up a 349: list of widely used entities, such as chapters, sections, paragraphs, and 350: titles, and then map all other entities onto the available choices. In this 351: way, an introduction can be supported as a chapter and a contract clause 352: supported as a paragraph or section. However, in trying to widen the range of 353: usage of certain entities, their meaning can be lost and the power of the 354: model reduced. In addition, while this widening partially solves the problem 355: of choosing entities, it does not solve the problem of their organization: 356: when a chapter must be composed of sections, how does one indicate that an 357: introduction has none when it is merely another chapter? One solution is to 1.1 cvs 358: include introductions in the list of supported entities. But then, how does 359: one distinguish those introductions which are allowed to have sections from 1.37 cvs 360: those which are not. Perhaps this could be done by defining two types of 1.1 cvs 361: introduction. Clearly, this approach risks an infinite expansion of the list 1.18 cvs 362: of widely used entities.</p> 363: </div> 1.1 cvs 364: 1.18 cvs 365: <div class="section"> 1.37 cvs 366: <h2><a name="sectb22" id="sectb22">Generic and specific structures</a></h2> 1.1 cvs 367: 1.30 cvs 368: <p>Thus, it is apparently impossible to construct an exhaustive inventory of 369: all those entities which are necessary and sufficient to precisely describe 1.37 cvs 370: any document. It also seems impossible to specify all possible arrangements 371: of these entities in a document. This is why Thot uses a <em>meta-model</em> 1.18 cvs 372: instead, which permits the description of numerous <em>models</em>, each one 373: describing a <em>class</em> of documents.</p> 1.30 cvs 374: 1.37 cvs 375: <p>A <em>class</em> is a set of documents having very similar structure. 376: Thus, the collection of research reports published by a laboratory 377: constitutes a class; the set of commercial proposals by the sales department 378: of a company constitutes another class; the set of articles published by a 379: journal constitutes a third class. Clearly, it is not possible to enumerate 380: every possible document class. It is also clear that new document classes 381: must be created to satisfy new needs and applications.</p> 1.30 cvs 382: 383: <p>To give a more rigorous definition of classes, we must introduce the ideas 1.37 cvs 384: of <em>generic structure</em> and <em>specific structure</em>. Each document 1.30 cvs 385: has a <em>specific structure</em> which organizes the various parts which 1.37 cvs 386: comprise it. We illustrate this with the help of a simple example comparing 1.30 cvs 387: two reports, A and B (<a href="#specstruct">see Figure</a>). The report A 1.37 cvs 388: contains an introduction followed by three chapters and a conclusion. The 389: first chapter contains two sections, the second, three sections. That is the 1.18 cvs 390: <em>specific</em> structure of document A. Similarly, the structure of 1.1 cvs 391: document B is: an introduction, two chapters, a conclusion; Chapter 1 has 1.37 cvs 392: three sections while Chapter 2 has four. The specific structures of these two 1.18 cvs 393: documents are thus different.</p> 1.1 cvs 394: 1.18 cvs 395: <div class="figure"> 1.37 cvs 396: <hr /> 1.18 cvs 397: <pre> Report A Report B 1.1 cvs 398: Introduction Introduction 399: Chapter 1 Chapter 1 400: Section 1.1 Section 1.1 401: Section 1.2 Section 1.2 402: Chapter 2 Section 1.3 403: Section 2.1 Chapter 2 404: Section 2.2 Section 2.1 405: Section 2.3 Section 2.2 406: Chapter 3 Section 2.3 407: Conclusion Section 2.4 1.18 cvs 408: Conclusion</pre> 1.30 cvs 409: 1.37 cvs 410: <p align="center"><em><a name="specstruct" id="specstruct">Two specific 1.30 cvs 411: structures</a></em></p> 1.37 cvs 412: <hr /> 1.30 cvs 413: </div> 414: 415: <p>The <em>generic structure</em> defines the ways in which specific 1.37 cvs 416: structures can be constructed. It specifies how to generate specific 417: structures. The reports A and B, though different, are constructed in 1.30 cvs 418: accordance with the same generic structure, which specifies that a report 419: contains an introduction followed by a variable number of chapters and a 420: conclusion, with each chapter containing a variable number of sections.</p> 421: 422: <p>There is a one-to-one correspondence between a class and a generic 1.37 cvs 423: structure: all the documents of a class are constructed in accordance with 424: the same generic structure. Hence the definition of the class: a class is a 425: set of documents whose specific structure is constructed in accordance with 426: the same generic structure. A class is characterized by its generic 1.30 cvs 427: structure.</p> 1.19 cvs 428: 1.30 cvs 429: <p>Thus, a generic structure can be considered to be a model at the level 1.37 cvs 430: which interests us, but only for one class of documents. When the definition 1.30 cvs 431: is limited to a single class of documents, it is possible to define a model 432: which does a good job of representing the documents of the class, including 1.37 cvs 433: the necessary entities and unencumbered by useless entities. The description 1.30 cvs 434: of the organization of the documents in the class can then be sufficiently 1.18 cvs 435: precise.</p> 436: </div> 1.1 cvs 437: 1.18 cvs 438: <div class="section"> 1.37 cvs 439: <h2><a name="sectb23" id="sectb23">Logical structure and physical 440: structure</a></h2> 1.1 cvs 441: 1.30 cvs 442: <p>Generic structures only describe the <em>logical</em> organization of 1.18 cvs 443: documents, not their <em>physical</em> presentation on a screen or on sheets 1.37 cvs 444: of paper. However, for a document to be displayed or printed, its graphic 1.18 cvs 445: presentation must be taken into account.</p> 1.30 cvs 446: 447: <p>An examination of current printed documents shows that the details of 1.1 cvs 448: presentation essentially serve to bring out their logical structure. Outside 449: of some particular domains, notably advertising, the presentation is rarely 1.37 cvs 450: independent of the logical organization of the text. Moreover, the art of 1.1 cvs 451: typography consists of enhancing the organization of the text being set, 1.37 cvs 452: without catching the eye of the reader with overly pronounced effects. Thus, 453: italic and boldface type are used to emphasize words or expressions which 454: have greater significance than the rest of the text: keywords, new ideas, 455: citations, book titles, etc. Other effects highlight the organization of the 1.1 cvs 456: text: vertical space, margin changes, page breaks, centering, eventually 457: combined with the changes in the shapes or weight of the characters. These 458: effects serve to indicate the transitions between paragraphs, sections, or 459: chapters: an object's level in the logical structure of the document is shown 1.18 cvs 460: by the markedness of the effects.</p> 1.30 cvs 461: 462: <p>Since the model permits the description of all of the logical structure of 463: the document, the presentation can be derived from the model without being 1.37 cvs 464: submerged in the document itself. It suffices to use the logical structure of 1.1 cvs 465: the document to make the desired changes in its presentation: changes in type 1.18 cvs 466: size, type style, spacing, margin, centering, etc.</p> 1.30 cvs 467: 468: <p>Just as one cannot define a unique generic logical structure for all 469: document classes, one cannot define universal presentation rules which can be 1.37 cvs 470: applied to all document classes. For certain types of documents the chapter 471: titles will be centered on the page and printed in large, bold type. For 472: other documents, the same chapter titles will be printed in small, italic 473: type and aligned on the left margin.</p> 1.30 cvs 474: 475: <p>Therefore, it is necessary to base the presentation specifications for 1.37 cvs 476: documents on their class. Such a specification can be very fine-grained, 1.1 cvs 477: because the presentation is expressed in terms of the entities defined in the 1.37 cvs 478: generic logical structure of the class. Thus, it is possible to specify a 1.1 cvs 479: different presentation for the chapter titles and the section titles, and 480: similarly to specify titles for the sections according to their level in the 1.37 cvs 481: section hierarchy. The set of rules which specify the presentation of all the 1.18 cvs 482: elements defined in a generic logical structure is called a <em>generic 483: presentation</em>.</p> 1.30 cvs 484: 485: <p>There are several advantages derived from having a presentation linked to 486: the generic structure and described by a generic presentation. Homogeneity is 1.37 cvs 487: the first. Since every document in a class corresponds to the same generic 1.1 cvs 488: logical structure, a homogenous presentation for different documents of the 489: same class can be assured by applying the same generic presentation to all 1.37 cvs 490: documents of the class. Homogeneity of presentation can also be found among 491: the entities of a single document: every section heading will be presented in 492: the same way, the first line of every paragraph of the same type will have 493: the same indentation, etc.</p> 1.30 cvs 494: 495: <p>Another advantage of this approach to presentation is that it facilitates 1.37 cvs 496: changes to the graphical aspect of documents. A change to the generic 497: presentation rules attached to each type of entity will alter the 498: presentation of the entire document, and will do so homogenously. In this 499: case, the internal homogeneity of the class is no longer assured, but the way 500: to control it is simple. It suffices to adopt a single generic presentation 501: for the entire class.</p> 1.30 cvs 502: 503: <p>If the presentation of the class does not have to be homogenous, then the 1.37 cvs 504: appearance of the document can be adapted to the way it will be used or to 505: the device used to render it. This quality is sufficient to allow the 506: existence of <a name="mulpres" id="mulpres">many generic presentations</a> 507: for the same document class. By applying one or the other of these 508: presentations to it, the document can be seen under different graphical 509: aspects. It must be emphasized that this type of modification of the 510: presentation is not a change to the document itself (in its specific logical 511: structure or its content), but only in its appearance at the time of editing 512: or printing.</p> 1.18 cvs 513: </div> 1.1 cvs 514: 1.18 cvs 515: <div class="section"> 1.37 cvs 516: <h2><a name="sectb24" id="sectb24">Document structures and object 517: structures</a></h2> 1.1 cvs 518: 1.30 cvs 519: <p>So far, we have only discussed the global structure of documents and have 1.37 cvs 520: not considered the contents found in that structure. We could limit ourselves 1.30 cvs 521: to purely textual contents by assuming that a title or a paragraph contains a 1.37 cvs 522: simple linear text. But this model would be too restrictive. In fact, certain 523: documents contain not only text, but also contain tables, diagrams, 524: photographs, mathematical formulas, and program fragments. The model must 1.18 cvs 525: permit the representation of such <em>objects</em>.</p> 1.30 cvs 526: 527: <p>Just as with the whole of the document, the model takes into account the 1.37 cvs 528: logical structure of objects of this type. Some are clearly structured, 529: others are less so. Logical structure can be recognized in mathematical 530: formulas, in tables, and in certain types of diagrams. On the other hand, it 531: is difficult to define the structure of a photograph or of some drawings. But 1.1 cvs 532: in any case, it does not seem possible to define one unique structure which 1.37 cvs 533: can represent every one of these types of objects. The approach taken in the 1.1 cvs 534: definition of meta-structure and document classes also applies to objects. 535: Object classes can be defined which put together objects of similar type, 1.18 cvs 536: constructed from the same generic logical structure.</p> 1.30 cvs 537: 538: <p>Thus, a mathematical class can be defined and have a generic logical 1.37 cvs 539: structure associated with it. But even if a single generic structure can 1.30 cvs 540: represent a sufficient variety of mathematical formulas, for other objects 1.37 cvs 541: with less rigorous structure, multiple classes must be defined. As for 542: documents, using multiple classes assures that the model can describe the 543: full range of objects to be presented. It also permits the system to support 544: objects which were not initially anticipated. Moreover, this comment applies 1.30 cvs 545: equally to mathematics: different classes of formulas can be described 546: depending on the domain of mathematics being described.</p> 547: 548: <p>Since objects have the same level of logical representation as documents, 1.37 cvs 549: they gain the same advantages. In particular, it is possible to define the 1.1 cvs 550: presentation separately from the objects themselves and attach it to the 1.37 cvs 551: class. Thus, as for documents, objects of the same type have a uniform 1.1 cvs 552: presentation and the presentation of every object in a given class can be 1.37 cvs 553: changed simply by changing the generic presentation of the class. Another 1.1 cvs 554: advantage of using this document model is that the system does not bother the 555: user with the details of presentation, but rather allows the user to 1.18 cvs 556: concentrate on the logical aspect of the document and the objects.</p> 1.30 cvs 557: 558: <p>It is clear that the documents in a class do not necessarily use the same 1.1 cvs 559: classes of objects: one technical report will contain tables while another 560: report will have no tables but will use mathematical formulas. The usable 1.2 cvs 561: object classes are not always mentioned in a limiting way in the generic 1.37 cvs 562: logical structure of documents. Rather, they can be chosen freely from a 1.18 cvs 563: large set, independent of the document class.</p> 1.30 cvs 564: 565: <p>Thus, the object classes will be made commonplace and usable in every 1.1 cvs 566: document. The notion of ``object'' can be enlarged to include not only 567: non-textual elements, but also certain types of textual elements which can 1.37 cvs 568: appear in practically every document, whatever their class. Among these 1.2 cvs 569: textual elements, one can mention enumerations, descriptions, examples, 1.18 cvs 570: quotations, even paragraphs.</p> 1.30 cvs 571: 572: <p>Thus, the document model is not a single, general model describing every 1.37 cvs 573: type of document in one place. Rather, it is a meta-model which can be used 1.30 cvs 574: to describe many different models each of which represents either a class of 1.1 cvs 575: similar documents or a class of similar objects which every document can 1.18 cvs 576: include.</p> 577: </div> 1.37 cvs 578: <hr /> 1.18 cvs 579: </div> 1.1 cvs 580: 1.18 cvs 581: <div class="chapter"> 1.37 cvs 582: <h1><a name="sect3" id="sect3">The S language</a></h1> 1.1 cvs 583: 1.18 cvs 584: <div class="section"> 1.37 cvs 585: <h2><a name="sectb31" id="sectb31">Document meta-structure</a></h2> 1.1 cvs 586: 1.30 cvs 587: <p>Since the concept of meta-structure is well suited to the task of 588: describing documents at a high level of abstraction, this meta-structure must 1.37 cvs 589: be precisely defined. Toward that end this section first presents the basic 1.1 cvs 590: elements from which documents and structured objects are composed and then 1.37 cvs 591: specifies the ways in which these basic elements are assembled into 592: structures representing complete documents and objects.</p> 1.1 cvs 593: 1.18 cvs 594: <div class="subsection"> 1.37 cvs 595: <h3><a name="sectc311" id="sectc311">The basic types</a></h3> 1.1 cvs 596: 1.37 cvs 597: <p>At the lowest level of a document's structure, the first atom considered 598: is the character. However, since characters are seldom isolated, usually 1.1 cvs 599: appearing as part of a linear sequence, and in order to reduce the complexity 1.18 cvs 600: of the document structure, <em>character strings</em> are used as atoms and 1.37 cvs 601: consecutive characters belonging to the same structural element are grouped 602: in the same character string.</p> 1.30 cvs 603: 1.37 cvs 604: <p>If the structure of a document is not refined to go down to the level of 605: words or phrases, the contents of a simple paragraph can be considered to be 606: a single character string. On the other hand, the title of a chapter, the 607: title of the first section of that chapter, and the text of the first 608: paragraph of that section constitute three different character strings, 609: because they belong to distinct structural elements.</p> 1.30 cvs 610: 611: <p>If, instead, a very fine-grained representation for the structure of a 1.1 cvs 612: document is sought, character strings could be defined to contain only a 1.37 cvs 613: single word, or even just a single character. This is the case, for example, 614: in programs, for which one wants to retain a structure very close to the 615: syntax of the programming language. In this case, an assignment statement 1.1 cvs 616: initializing a simple variable to zero would be composed of two structural 617: elements, the identifier of the variable (a short character string) and the 1.18 cvs 618: assigned value (a string of a single character, `0').</p> 1.30 cvs 619: 620: <p>The character string is not the only atom necessary for representing those 1.37 cvs 621: documents that interest us. It suffices for purely textual documents, but as 1.1 cvs 622: soon as the non-textual objects which we have considered arise, there must be 623: other atoms; the number of objects which are to be represented determines the 1.18 cvs 624: number of types of atoms that are necessary.</p> 1.30 cvs 625: 626: <p>Primitive <em>graphical elements</em> are used for tables and figures of 1.37 cvs 627: different types. These elements are simple geometric shapes like horizontal 1.1 cvs 628: or vertical lines, which are sufficient for tables, or even oblique lines, 1.2 cvs 629: arrows, rectangles, circles, polygons, and curves for use in figures. From 630: these elements and character strings, graphical objects and tables can be 1.18 cvs 631: constructed.</p> 1.30 cvs 632: 633: <p>Photographs, though having very little structure, must still appear in 1.37 cvs 634: documents. They are supported by <em>picture</em> elements, which are 1.18 cvs 635: represented as matrices of pixels.</p> 1.30 cvs 636: 637: <p>Finally, mathematical notations require certain elements which are 1.37 cvs 638: simultaneously characters and graphical elements, the <em>symbols</em>. By 639: way of example, radicals, integration signs, or even large parentheses are 640: examples of this type of atom. The size of each of these symbols is 1.1 cvs 641: determined by its environment, that is to say, by the expression to which it 1.18 cvs 642: is attached.</p> 1.30 cvs 643: 644: <p>To summarize, the primitive elements which are used in the construction of 1.18 cvs 645: documents and structured objects are:</p> 646: <ul> 1.30 cvs 647: <li>character strings,</li> 648: <li>graphical elements,</li> 649: <li>pictures,</li> 650: <li>and mathematical symbols.</li> 1.18 cvs 651: </ul> 652: </div> 1.1 cvs 653: 1.18 cvs 654: <div class="subsection"> 1.37 cvs 655: <h3><a name="sectc312" id="sectc312">Constructed elements</a></h3> 1.30 cvs 656: 1.37 cvs 657: <p>A document is evidently formed from primitive elements. But the model of 658: Thot also proposes higher level elements. Thus, in a document composed of 659: several chapters, each chapter is an element, and in the chapters each 660: section is also an element, and so on. A document is thus an organized set of 1.30 cvs 661: elements.</p> 1.1 cvs 662: 1.37 cvs 663: <p>In a document there are different sorts of elements. Each element has a 664: <em>type</em> which indicates the role of the element within the document as 665: a whole. Thus, we have, for example, the chapter and section types. The 1.1 cvs 666: document is made up of typed elements: elements of the type chapter and 1.37 cvs 667: elements of the type section, among others, but also character string 668: elements and graphical elements: the primitive elements are typed elements 669: just as well. At the other extreme, the document itself is also considered to 670: be a typed element.</p> 1.30 cvs 671: 672: <p>The important difference between the primitive elements and the other 1.37 cvs 673: elements of the document is that the primitive elements are atoms (they 674: cannot be decomposed), whereas the others, called <em>constructed 675: elements</em>, are composed of other elements, which can either be primitive 676: elements or constructed elements. A constructed element of type chapter (or 677: more simply, ``a chapter'') is composed of sections, which are also 678: constructed elements. A paragraph, a constructed element, can be made up of 679: character strings, which are primitive elements, and of equations, which are 680: constructed elements.</p> 1.30 cvs 681: 1.37 cvs 682: <p>A document is also a constructed element. This is an important point. In 1.1 cvs 683: particular, it allows a document to be treated as part of another document, 684: and conversely, permits a part of a document to be treated as a complete 1.37 cvs 685: document. Thus, an article presented in a journal is treated by its author as 1.1 cvs 686: a document in itself, while the editor of the journal considers it to be part 1.37 cvs 687: of an issue. A table or a figure appearing in a document can be extracted and 1.1 cvs 688: treated as a complete document, for example to prepare transparencies for a 1.18 cvs 689: conference.</p> 1.30 cvs 690: 691: <p>These thoughts about types and constructed elements apply just as well to 1.37 cvs 692: objects as they do to documents. A table is a constructed element made up of 693: other constructed elements, rows and columns. A row is formed of cells, which 1.1 cvs 694: are also constructed elements which contain primitive elements (character 1.18 cvs 695: strings) and/or constructed elements like equations.</p> 696: </div> 1.1 cvs 697: 1.18 cvs 698: <div class="subsection"> 1.37 cvs 699: <h3><a name="sectc313" id="sectc313">Logical structure constructors</a></h3> 1.1 cvs 700: 1.30 cvs 701: <p>Having defined the primitive elements and the constructed elements, it is 702: now time to define the types of organization which allow the building of 1.37 cvs 703: structures. For this, we rely on the notion of the <em>constructor</em>. A 704: constructor defines a way of assembling certain elements in a structure. It 1.1 cvs 705: resides at the level of the meta-structure: it does not describe the existing 1.37 cvs 706: relations in a given structure, but rather defines how elements are assembled 1.18 cvs 707: to build a structure that conforms to a model.</p> 1.30 cvs 708: 709: <p>In defining the overall organization of documents, the first two 710: constructors considered are the aggregate and the list.</p> 1.1 cvs 711: 1.18 cvs 712: <div class="subsubsection"> 1.37 cvs 713: <h4><a name="sectd3131" id="sectd3131">Aggregate and List</a></h4> 1.1 cvs 714: 1.30 cvs 715: <p>The <em>aggregate</em> constructor is used to define constructed element 716: types which are collections of a given number of other elements. These 1.37 cvs 717: collections may or may not be ordered. The elements may be either constructed 718: or primitive and are specified by their type. A report (that is, a 719: constructed element of the report type) has an aggregate structure. It is 1.30 cvs 720: formed from a title, an author's name, an introduction, a body, and a 1.37 cvs 721: conclusion, making it a collection of five element types. This type of 1.30 cvs 722: constructor is found in practically every document, and generally at several 723: levels in a document.</p> 724: 725: <p>The <em>list</em> constructor is used to define constructed elements which 726: are ordered sequences of elements (constructed or primitive) having the same 727: type. The minimum and maximum numbers of elements for the sequence can be 728: specified in the list constructor or the number of elements can be left 729: unconstrained. The body of a report is a list of chapters and is typically 730: required to contain a minimum of two chapters (is a chapter useful if it is 731: the only one in the report?) The chapter itself can contain a list of 1.37 cvs 732: sections, each section containing a list of paragraphs. In the same way as 733: the aggregate, the list is a very frequently used constructor in every type 734: of document. However, these two constructors are not sufficient to describe 735: every document structure; thus other constructors supplement them.</p> 1.18 cvs 736: </div> 1.1 cvs 737: 1.18 cvs 738: <div class="subsubsection"> 1.37 cvs 739: <h4><a name="sectd3132" id="sectd3132">Choice, Schema, and Unit</a></h4> 1.1 cvs 740: 1.30 cvs 741: <p>The <em>choice</em> constructor is used to define the structure of an 742: element type for which one alternative is chosen from several possibilities. 1.37 cvs 743: Thus, a paragraph can be either a simple text paragraph, or an enumeration, 744: or a citation.</p> 1.30 cvs 745: 746: <p>The choice constructor indicates the complete list of possible options, 747: which can be too restrictive in certain cases, the paragraph being one such 748: case. Two constructors, <em>unit</em> and <em>schema</em>, address this 1.37 cvs 749: inconvenience. They allow more freedom in the choice of an element type. If a 750: paragraph is defined by a schema constructor, it is possible to put in the 1.1 cvs 751: place of a paragraph a table, an equation, a drawing or any other object 1.37 cvs 752: defined by another generic logical structure. It is also possible to define a 1.1 cvs 753: paragraph as a sequence of units, which could be character strings, symbols, 1.37 cvs 754: or pictures. The choice constructor alone defines a generic logical structure 1.1 cvs 755: that is relatively constrained; in contrast, using units and schemas, a very 1.18 cvs 756: open structure can be defined.</p> 1.30 cvs 757: 758: <p>The <em>schema</em> constructor represents an object defined by a generic 1.18 cvs 759: logical structure chosen freely from among those available.</p> 1.30 cvs 760: 761: <p>The <em>unit</em> constructor represents an element whose type can be 762: either a primitive type or an element type defined as a unit in the generic 763: logical structure of the document, or in another generic logical structure 1.37 cvs 764: used in the document. Such an element may be used in document objects 1.30 cvs 765: constructed according to other generic structures.</p> 766: 767: <p>Thus, for example, if a cross-reference to a footnote is defined in the 1.37 cvs 768: generic logical structure ``Article'' as a unit, a table (an object defined 769: by another generic structure) can contain cross-references to footnotes, when 770: they appear in an article. In another type of document, a table defined by 1.1 cvs 771: the same generic structure can contain other types of elements, depending on 1.37 cvs 772: the type of document into which the table is inserted. All that is needed is 1.1 cvs 773: to declare, in the generic structure for tables, that the contents of cells 1.37 cvs 774: are units. In this way, the generic structure of objects is divided up 775: between different types of documents which are able to adapt themselves to 776: the environment into which they are inserted.</p> 1.18 cvs 777: </div> 1.1 cvs 778: 1.18 cvs 779: <div class="subsubsection"> 1.37 cvs 780: <h4><a name="sectd3133" id="sectd3133">Reference and Inclusion</a></h4> 1.1 cvs 781: 1.30 cvs 782: <p>The <em>reference</em> is used to define document elements that are 1.18 cvs 783: cross-references to other elements, such as a section, a chapter, a 1.37 cvs 784: bibliographic citation, or a figure. The reference is bi-directional. It can 1.18 cvs 785: be used to access both the element being cross-referenced and each of the 786: elements which make use of the cross-reference.</p> 1.30 cvs 787: 1.37 cvs 788: <p>References can be either <em>internal</em> or <em>external</em>. That is, 1.1 cvs 789: they can designate elements which appear in the same document or in another 1.18 cvs 790: document.</p> 1.30 cvs 791: 1.37 cvs 792: <p>The <em><a name="inclusion" id="inclusion">inclusion</a></em> constructor 793: is a special type of reference. Like the reference, it is an internal or 794: external bidirectional link, but it is not a cross-reference. This link 795: represents the ``live'' inclusion of the designated element; it accesses the 796: most recent version of that element and not a ``dead'' copy, fixed in the 797: state in which it was found at the moment the copy was made. As soon as an 798: element is modified, all of its inclusions are automatically brought up to 799: date. It must be noted that, in addition to inclusion, Thot permits the 800: creation of ``dead'' copies.</p> 1.30 cvs 801: 802: <p>There are three types of inclusions: inclusions with full expansion, 1.1 cvs 803: inclusions with partial expansion, and inclusions without expansion. During 804: editing, inclusions without expansion are represented on the screen by the 805: name of the included document, in a special color, while inclusions with 1.37 cvs 806: expansion (full or partial) are represented by a copy (full or partial) of 807: the included element (also in a special color). The on-screen representation 808: of a partial inclusion is a <a href="#sectc3213">``skeleton''</a> image of 809: the included document.</p> 1.30 cvs 810: 811: <p>Inclusion with complete expansion can be used to include parts of the same 1.37 cvs 812: document or of other documents. Thus, it can be either an internal or an 813: external link. It can be used to include certain bibliographic entries of a 1.1 cvs 814: scientific article in another article, or to copy part of a mathematical 815: formula into another formula of the same document, thus assuring that both 1.18 cvs 816: copies will remain synchronized.</p> 1.30 cvs 817: 818: <p>Inclusion without expansion or with partial expansion is used to include 1.37 cvs 819: complete documents. It is always an external link. It is used primarily to 1.1 cvs 820: divide very large documents into sub-documents that are easier to manipulate, 1.37 cvs 821: especially when there are many authors. So, a book can include some chapters, 1.1 cvs 822: where each chapter is a different document which can be edited separately. 823: When viewing the book on the screen, it might be desirable to see only the 1.37 cvs 824: titles of the chapters and sections. This can be achieved using inclusion 1.18 cvs 825: with partial expansion.</p> 1.30 cvs 826: 1.37 cvs 827: <p>During printing, inclusions without expansion or with partial expansion 828: can be represented either as they were shown on the screen or by a complete 829: (and up-to-date) copy of the included element or document.</p> 1.30 cvs 830: 831: <p>The inclusion constructor, whatever its type, respects the generic 832: structure: only those elements authorized by the generic structure can be 833: included at a given position in a document.</p> 1.18 cvs 834: </div> 1.1 cvs 835: 1.18 cvs 836: <div class="subsubsection"> 1.37 cvs 837: <h4><a name="sectd3134" id="sectd3134">Mark pairs</a></h4> 1.1 cvs 838: 1.30 cvs 839: <p>It is often useful to delimit certain parts of a document independently 1.37 cvs 840: from the logical structure. For example, one might wish to attach some 1.30 cvs 841: information (in the form of an <a href="#sectc315">attribute</a>) or a 842: particular treatment to a group of words or a set of consecutive paragraphs. 843: <em>Mark pairs</em> are used to do this.</p> 844: 845: <p>Mark pairs are elements which are always paired and are terminals in the 1.37 cvs 846: logical structure of the document. Their position in the structure of the 847: document is defined in the generic structure. It is important to note that 1.18 cvs 848: when the terminals of a mark pair are <em>extensions</em> (see the next 849: section), they can be used quite freely.</p> 850: </div> 1.1 cvs 851: 1.18 cvs 852: <div class="subsubsection"> 1.37 cvs 853: <h4><a name="sectd3135" id="sectd3135">Restrictions and Extensions</a></h4> 1.1 cvs 854: 1.30 cvs 855: <p>The primitive types and the constructors presented so far permit the 1.1 cvs 856: definition of the logical structure of documents and objects in a rigorous 1.37 cvs 857: way. But this definition can be very cumbersome in certain cases, notably 1.1 cvs 858: when trying to constrain or extend the authorized element types in a 1.37 cvs 859: particular context. <em>Restrictions</em> and <em>extensions</em> are used to 1.18 cvs 860: cope with these cases.</p> 1.30 cvs 861: 862: <p>A restriction associates with a particular element type <em>A</em>, a list 1.37 cvs 863: of those element types which elements of type <em>A</em> may not contain, 864: even if the definition of type <em>A</em> and those of its components 865: authorize them otherwise. This simplifies the writing of generic logical 866: structures and allows limitations to be placed, when necessary, on the 867: choices offered by the schema and unit constructors.</p> 868: 869: <p>Extensions are the inverse of restrictions. They identify a list of 870: element types whose presence <em>is</em> permitted, even if its definition 871: and those of its components do not authorize them otherwise.</p> 1.18 cvs 872: </div> 873: 874: <div class="subsubsection"> 1.37 cvs 875: <h4><a name="sectd3136" id="sectd3136">Summary</a></h4> 1.18 cvs 876: 1.30 cvs 877: <p>Thus, four constructors are used to construct a document:</p> 1.18 cvs 878: <ul> 1.30 cvs 879: <li>the aggregate constructor (ordered or not),</li> 880: <li>the list constructor,</li> 881: <li>the choice constructor and its extensions, the unit and schema 882: constructors,</li> 883: <li>the reference constructor and its variant, the inclusion.</li> 884: </ul> 885: 1.37 cvs 886: <p>These constructors are also sufficient for objects. Thus, these 1.30 cvs 887: constructors provide a homogenous meta-model which can describe both the 888: organization of the document as a whole and that of the various types of 1.37 cvs 889: objects which it contains. After presenting the description language for 1.30 cvs 890: generic structures, we will present several examples which illustrate the 891: appropriateness of the model.</p> 892: 1.37 cvs 893: <p>The first three constructors (aggregate, list and choice) lead to 894: tree-like structures for documents and objects, the objects being simply the 895: subtrees of the tree of a document (or even of other objects' subtrees). The 896: reference constructor introduces other, non-hierarchical, relations which 897: augment those of the tree: when a paragraph makes reference to a chapter or a 898: section, that relation leaves the purely tree-like structure. Moreover, 899: external reference and inclusion constructors permit the establishment of 900: links between different documents, thus creating a hypertext structure.</p> 1.18 cvs 901: </div> 902: </div> 1.1 cvs 903: 1.18 cvs 904: <div class="subsection"> 1.37 cvs 905: <h3><a name="sectc315" id="sectc315">Attributes</a></h3> 1.1 cvs 906: 1.30 cvs 907: <p>There remain logical aspects of documents that are not entirely described 1.37 cvs 908: by the structure. Certain types of semantic information, which are not stated 909: explicitly in the text, must also be taken into account. In particular, such 1.1 cvs 910: information is shown by typographic effects which do not correspond to a 1.37 cvs 911: change between structural elements. In fact, certain titles are set in bold 1.1 cvs 912: or italic or are printed in a different typeface from the rest of the text in 1.37 cvs 913: order to mark them as structurally distinct. But these same effects 1.1 cvs 914: frequently appear in the middle of continuous text (e.g. in the interior of a 1.37 cvs 915: paragraph). In this case, there is no change between structural elements; the 916: effect serves to highlight a word, expression, or phrase. The notion of an 1.18 cvs 917: <em>attribute</em> is used to express this type of information.</p> 1.30 cvs 918: 919: <p>An attribute is a piece of information attached to a structural element 920: which augments the type of the element and clarifies its function in the 921: document. Keywords, foreign language words, and titles of other works can all 1.37 cvs 922: be represented by character strings with attached attributes. Attributes may 923: also be attached to constructed elements. Thus, an attribute indicating the 1.1 cvs 924: language can be attached to a single word or to a large part of a 1.18 cvs 925: document.</p> 1.30 cvs 926: 927: <p>In fact, an attribute can be any piece of information which is linked to a 1.37 cvs 928: part of a document and which can be used by agents which work on the 929: document. For example, the language in which the document is written 930: determines the set of characters used by an editor or formatter. It also 931: determines the algorithm or hyphenation dictionary to be used. The attribute 932: ``keyword'' facilitates the work of an information retrieval system. The 933: attribute ``index word'' allows a formatter to automatically construct an 934: index at the end of the document.</p> 1.30 cvs 935: 936: <p>As with the types of constructed elements, the attributes and the values 1.37 cvs 937: they can take are defined separately in each generic logical structure, not 938: in the meta-model, according to the needs of the document class or the nature 939: of the object.</p> 1.30 cvs 940: 941: <p>Many types of attributes are offered: numeric, textual, references, and 1.18 cvs 942: enumerations:</p> 943: <ul> 1.40 quint 944: <li><em>Numeric attributes</em> can take integer values (negative, 945: positive, or null).</li> 946: <li><em>Textual attributes</em> have as their values character strings.</li> 947: <li><em>Reference attributes</em> designate an element of the logical 948: structure.</li> 949: <li><em>Enumeration attributes</em> can take one value from a limited list 950: of possible values, each value being a name.</li> 1.18 cvs 951: </ul> 1.30 cvs 952: 953: <p>In a generic structure, there is a distinction between <em>global 1.37 cvs 954: attributes</em> and <em>local attributes</em>. A global attribute can be 1.1 cvs 955: applied to every element type defined in the generic structure where it is 1.37 cvs 956: specified. In contrast, a local attribute can only be applied to certain 957: types of elements, even only a single type. The ``language'' attribute 958: presented above is an example of a global attribute. An example of a local 1.1 cvs 959: attribute is the rank of an author (principal author of the document or 960: secondary author): this attribute can only be applied sensibly to an element 1.18 cvs 961: of the ``author'' type.</p> 1.30 cvs 962: 963: <p>Attributes can be assigned to the elements which make up the document in 1.37 cvs 964: many different ways. The author can freely and dynamically place them on any 1.30 cvs 965: part of the document in order to attach supplementary information of his/her 1.18 cvs 966: choice. However, attributes may only be assigned in accordance with the rules 1.37 cvs 967: of the generic structure; in particular, local attributes can only be 968: assigned to those element types for which they are defined.</p> 1.30 cvs 969: 970: <p>In the generic structure, certain local attributes can be made mandatory 1.37 cvs 971: for certain element types. In this case, Thot automatically associates the 972: attribute with the elements of this type and it requires the user to provide 973: a value for this attribute.</p> 974: 975: <p>Attributes can also be automatically assigned, with a given value, by 976: every application processing the document in order to systematically add a 977: piece of information to certain predefined elements of the document. By way 978: of example, in a report containing a French abstract and an English abstract, 979: each of the two abstracts is defined as a sequence of paragraphs. The first 1.1 cvs 980: abstract has a value of ``French'' for the ``language'' attribute while the 1.18 cvs 981: second abstract's ``language'' attribute has a value of ``English''.</p> 1.30 cvs 982: 983: <p>In the case of mark pairs, attributes are logically associated with the 984: pair as a whole, but are actually attached to the first mark.</p> 1.18 cvs 985: </div> 1.1 cvs 986: 1.18 cvs 987: <div class="subsection"> 1.37 cvs 988: <h3><a name="sectc316" id="sectc316">Discussion of the model</a></h3> 1.1 cvs 989: 1.37 cvs 990: <p>The notions of attribute, constructor, and structured element are used in 991: the definition of generic logical structures of documents and objects. The 992: problem is to assemble them to form generic structures. In fact, many types 993: of elements and attributes can be found in a variety of generic structures. 994: Rather than redefine them for each structure in which they appear, it is best 995: to share them between structures. The object classes already fill this 996: sharing function. If a mathematical class is defined, its formulas can be 997: used in many different document classes, without redefining the structure of 998: each class. This problem arises not only for the objects considered here; it 999: also arises for the commonplace textual elements found in many document 1000: classes. This is the reason why the notion of object is so broad and why 1001: paragraphs and enumerations are also considered to be objects. These object 1002: classes not only permit the sharing of the structures of elements, but also 1003: of the attributes defined in the generic structures.</p> 1.30 cvs 1004: 1005: <p>Structure, such as that presented here, can appear very rigid, and it is 1.1 cvs 1006: possible to imagine that a document editing system based on this model could 1.37 cvs 1007: prove very constraining to the user. This is, in fact, a common criticism of 1008: syntax-directed editors. This defect can be avoided with Thot, primarily for 1.18 cvs 1009: three reasons:</p> 1010: <ul> 1.30 cvs 1011: <li>the generic structures are not fixed in the model itself,</li> 1012: <li>the model takes the dynamics of documents into account,</li> 1013: <li>the constructors offer great flexibility.</li> 1.18 cvs 1014: </ul> 1.30 cvs 1015: 1016: <p>When the generic structure of a document is not predefined, but rather is 1.1 cvs 1017: constructed specifically for each document class, it can be carefully adapted 1.37 cvs 1018: to the current needs. In cases where the generic structure is inadequate for 1.1 cvs 1019: a particular document of the class, it is always possible either to create a 1020: new class with a generic structure well suited to the new case or to extend 1.37 cvs 1021: the generic structure of the existing class to take into account the 1022: specifics of the document which poses the problem. These two solutions can 1023: also be applied to objects whose structures prove to be poorly designed.</p> 1.30 cvs 1024: 1025: <p>The model is sufficiently flexible to take into account all the phases of 1.37 cvs 1026: the life of the document. When a generic structure specifies that a report 1027: must contain a title, an abstract, an introduction, at least two chapters, 1028: and a conclusion, this means only that a report, <em>upon completion</em>, 1029: will have to contain all of these elements. When the author begins writing, 1030: none of these elements is present. Thot uses this model. Therefore, it 1031: tolerates documents which do not conform strictly to the generic structure of 1032: their class; it also considers the generic logical structure to be a way of 1033: helping the user in the construction of a complex document.</p> 1.30 cvs 1034: 1035: <p>In contrast, other applications may reject a document which does not 1.37 cvs 1036: conform strictly to its generic structure. This is, for example, what is done 1.30 cvs 1037: by compilers which refuse to generate code for a program which is not 1.37 cvs 1038: syntactically correct. This might also occur when using a document 1.18 cvs 1039: application for a report which does not have an abstract or title.</p> 1.30 cvs 1040: 1041: <p>The constructors of the document model bring a great flexibility to the 1.37 cvs 1042: generic structures. A choice constructor (and even more, a unit or schema 1043: constructor) can represent several, very different elements. The list 1044: constructor permits the addition of more elements of the same type. Used 1.1 cvs 1045: together, these two constructors permit any series of elements of different 1.37 cvs 1046: types. Of course, this flexibility can be reduced wherever necessary since a 1.1 cvs 1047: generic structure can limit the choices or the number of elements in a 1.18 cvs 1048: list.</p> 1.30 cvs 1049: 1050: <p>Another difficulty linked to the use of structure in the document model 1.37 cvs 1051: resides in the choice of the level of the structure. The structure of a 1.1 cvs 1052: discussion could be extracted from the text itself via linguistic analysis. 1053: Some studies are exploring this approach, but the model of Thot excludes this 1.37 cvs 1054: type of structure. It only takes into account the logical structure provided 1.18 cvs 1055: explicitly by the author.</p> 1.30 cvs 1056: 1.37 cvs 1057: <p>However, the level of structure of the model is not imposed. Each generic 1058: structure defines its own level of structure, adapted to the document class 1059: or object and to the ways in which it will be processed. If it will only be 1060: edited and printed, a relatively simple structure suffices. If more 1061: specialized processing will be applied to it, the structure must represent 1062: the element types on which this processing must act. By way of example, a 1063: simple structure is sufficient for printing formulas, but a more complex 1064: structure is required to perform symbolic or numeric calculations on the 1065: mathematical expressions. The document model of Thot allows both types of 1066: structure.</p> 1.18 cvs 1067: </div> 1068: </div> 1.1 cvs 1069: 1.18 cvs 1070: <div class="section"> 1.37 cvs 1071: <h2><a name="sectb32" id="sectb32">The definition language for generic 1072: structures</a></h2> 1.1 cvs 1073: 1.37 cvs 1074: <p>Generic structures, which form the basis of the document model of Thot, 1075: are specified using a special language. This definition language, called S, 1076: is described in this section.</p> 1.30 cvs 1077: 1078: <p>Each generic structure, which defines a class of documents or objects, is 1.2 cvs 1079: specified by a file, written in the S language, which is called a 1.37 cvs 1080: <em>structure schema</em>. Structure schemas are compiled into tables, called 1.18 cvs 1081: structure tables, which are used by Thot and which determine its behavior.</p> 1.1 cvs 1082: 1.18 cvs 1083: <div class="subsection"> 1.37 cvs 1084: <h3><a name="sectc321" id="sectc321">Writing Conventions</a></h3> 1.1 cvs 1085: 1.30 cvs 1086: <p>The grammar of S, like those of the languages P and T presented later, is 1.1 cvs 1087: described using the meta-language M, derived from the Backus-Naur Form 1.18 cvs 1088: (BNF).</p> 1.30 cvs 1089: 1090: <p>In this meta-language each rule of the grammar is composed of a grammar 1.37 cvs 1091: symbol followed by an equals sign (`=') and the right part of the rule. The 1.30 cvs 1092: equals sign plays the same role as the traditional `::=' of BNF: it indicates 1.37 cvs 1093: that the right part defines the symbol of the left part. In the right 1.30 cvs 1094: part,</p> 1.18 cvs 1095: <dl> 1.30 cvs 1096: <dt>concatenation</dt> 1097: <dd>is shown by the juxtaposition of symbols;</dd> 1098: <dt>character strings</dt> 1.37 cvs 1099: <dd>between apostrophes ' represent terminal symbols, that is, keywords 1100: in the language defined. Keywords are written here in upper-case 1101: letters, but can be written in any combination of upper and lower-case 1102: letters. For example, the keyword <tt>DEFPRES</tt> of S can also be 1103: written as <tt>defpres</tt> or <tt>DefPres</tt>.</dd> 1.30 cvs 1104: <dt>material between brackets</dt> 1105: <dd>(`[' and `]') is optional;</dd> 1106: <dt>material between angle brackets</dt> 1107: <dd>(`<' and `>') can be repeated many times or omitted;</dd> 1108: <dt>the slash</dt> 1.37 cvs 1109: <dd>(`/') indicates an alternative, a choice between the options 1110: separated by the slash character;</dd> 1.30 cvs 1111: <dt>the period</dt> 1112: <dd>marks the end of a rule;</dd> 1113: <dt>text between braces</dt> 1114: <dd>(`{' and `}') is simply a comment.</dd> 1.18 cvs 1115: </dl> 1.30 cvs 1116: 1117: <p>The M meta-language also uses the concepts of identifiers, strings, and 1.18 cvs 1118: integers:</p> 1119: <dl> 1.30 cvs 1120: <dt><tt>NAME</tt></dt> 1.37 cvs 1121: <dd>represents an identifier, a sequence of letters (upper or 1122: lower-case), digits, and underline characters (`_'), beginning with a 1123: letter. Also considered a letter is the sequence of characters 1124: `<tt>\nnn</tt>' where the letter <tt>n</tt> represents the ISO Latin-1 1125: code of the letter in octal. It is thus possible to use accented 1126: letters in identifiers. The maximum length of identifiers is fixed by 1.52 quint 1127: the compiler. It is normally 31 characters. 1.30 cvs 1128: <p>Unlike keywords, upper and lower-case letters are distinct in 1129: identifiers. Thus, <tt>Title</tt>, <tt>TITLE</tt>, and <tt>title</tt> 1130: are considered different identifiers.</p> 1131: </dd> 1132: <dt><tt>STRING</tt></dt> 1.37 cvs 1133: <dd>represents a string. This is a string of characters delimited by 1134: apostrophes. If an apostrophe must appear in a string, it is doubled. 1135: As with identifiers, strings can contain characters represented by 1136: their octal code (after a backslash). As with apostrophes, if a 1137: backslash must appear in a string, it is doubled.</dd> 1.30 cvs 1138: <dt><tt>NUMBER</tt></dt> 1139: <dd>represents a positive integer or zero (without a sign), or said 1140: another way, a sequence of decimal digits.</dd> 1.18 cvs 1141: </dl> 1.30 cvs 1142: 1143: <p>The M language can be used to define itself as follows:</p> 1.18 cvs 1144: <pre>{ Any text between braces is a comment. } 1.30 cvs 1145: Grammar = Rule < Rule > 'END' . 1146: { The < and > signs indicate zero } 1.1 cvs 1147: { or more repetitions. } 1148: { END marks the end of the grammar. } 1149: Rule = Ident '=' RightPart '.' . 1150: { The period indicates the end of a rule } 1151: RightPart = RtTerminal / RtIntermed . 1152: { The slash indicates a choice } 1153: RtTerminal ='NAME' / 'STRING' / 'NUMBER' . 1154: { Right part of a terminal rule } 1.30 cvs 1155: RtIntermed = Possibility < '/' Possibility > . 1.1 cvs 1156: { Right part of an intermediate rule } 1.30 cvs 1157: Possibility = ElemOpt < ElemOpt > . 1158: ElemOpt = Element / '[' Element < Element > ']' / 1159: '<' Element < Element > '>' . 1.1 cvs 1160: { Brackets delimit optional parts } 1161: Element = Ident / KeyWord . 1162: Ident = NAME . 1163: { Identifier, sequence of characters } 1164: KeyWord = STRING . 1165: { Character string delimited by apostrophes } 1.18 cvs 1166: END</pre> 1167: </div> 1.1 cvs 1168: 1.18 cvs 1169: <div class="subsection"> 1.37 cvs 1170: <h3><a name="sectc322" id="sectc322">Extension schemas</a></h3> 1.1 cvs 1171: 1.30 cvs 1172: <p>A structure schema defines the generic logical structure of a class of 1.1 cvs 1173: documents or objects, independent of the operations which can be performed on 1.37 cvs 1174: the documents. However, certain applications may require particular 1.1 cvs 1175: information to be represented by the structure for the documents that they 1.37 cvs 1176: operate on. Thus a document version manager will need to indicate in the 1177: document the parts which belong to one version or another. An indexing system 1.1 cvs 1178: will add highly-structured index tables as well as the links between these 1.18 cvs 1179: tables and the rest of the document.</p> 1.30 cvs 1180: 1181: <p>Thus, many applications need to extend the generic structure of the 1.37 cvs 1182: documents on which they operate to introduce new attributes or element types. 1183: These additions are specific to each application and must be able to be 1184: applied to any generic structure: users will want to manage versions or 1185: construct indices for many types of documents. Extension schemas fulfill this 1186: role: they define attributes, elements, units, etc., but they can only be 1187: used jointly with a structure schema that they complete. Otherwise, structure 1188: schemas can always be used without these extensions when the corresponding 1189: applications are not available.</p> 1.18 cvs 1190: </div> 1.1 cvs 1191: 1.18 cvs 1192: <div class="subsection"> 1.37 cvs 1193: <h3><a name="sectc323" id="sectc323">The general organization of structure 1194: schemas</a></h3> 1.1 cvs 1195: 1.30 cvs 1196: <p>Every structure schema begins with the keyword <tt>STRUCTURE</tt> and ends 1.37 cvs 1197: with the keyword <tt>END</tt>. The keyword <tt>STRUCTURE</tt> is followed by 1.18 cvs 1198: the keyword <tt>EXTENSION</tt> in the case where the schema defines an 1.1 cvs 1199: extension, then by the name of the generic structure which the schema defines 1.37 cvs 1200: (the name of the document or object class). The name of the structure is 1.18 cvs 1201: followed by a semicolon.</p> 1.30 cvs 1202: 1203: <p>In the case of a complete schema (that is, a schema which is not an 1.1 cvs 1204: extension), the definition of the name of the structure is followed by the 1205: declarations of the default presentation schema, the global attributes, the 1.37 cvs 1206: structure rules, the units, the skeleton elements and the exceptions. Only 1207: the definition of the structure rules is required. Each series of 1208: declarations begins with a keyword: <tt>DEFPRES</tt>, <tt>ATTR</tt>, 1209: <tt>STRUCT</tt>, <tt>UNITS</tt>, <tt>EXPORT</tt>, <tt>EXCEPT</tt>.</p> 1.34 cvs 1210: 1211: <p>In the case of an extension schema, there are no skeleton elements and the 1212: <tt>STRUCT</tt> section is optional, while that section is required in a 1.37 cvs 1213: schema that is not an extension. On the other hand, extension schemas can 1214: contain an <tt>EXTENS</tt> section, which must not appear in a schema which 1215: is not an extension; this section defines the complements to attach to the 1216: rules found in the schema to which the extension will be added. The sections 1217: <tt>ATTR</tt>, <tt>STRUCT</tt>, and <tt>UNITS</tt> define new attributes, new 1218: elements, and new units which add their definitions to the principal 1219: schema.</p> 1.18 cvs 1220: <pre> StructSchema ='STRUCTURE' ElemID ';' 1.1 cvs 1221: 'DEFPRES' PresID ';' 1222: [ 'ATTR' AttrSeq ] 1223: 'STRUCT' RulesSeq 1224: [ 'UNITS' RulesSeq ] 1225: [ 'EXPORT' SkeletonSeq ] 1226: [ 'EXCEPT' ExceptSeq ] 1227: 'END' . 1.18 cvs 1228: ElemID = NAME .</pre> 1.30 cvs 1229: 1230: <p>or</p> 1.18 cvs 1231: <pre> ExtensSchema ='STRUCTURE' 'EXTENSION' ElemID ';' 1.1 cvs 1232: 'DEFPRES' PresID ';' 1233: [ 'ATTR' AttrSeq ] 1234: [ 'STRUCT' RulesSeq ] 1235: [ 'EXTENS' ExtensRuleSeq ] 1236: [ 'UNITS' RulesSeq ] 1237: [ 'EXCEPT' ExceptSeq ] 1238: 'END' . 1.18 cvs 1239: ElemID = NAME .</pre> 1240: </div> 1.1 cvs 1241: 1.18 cvs 1242: <div class="subsection"> 1.37 cvs 1243: <h3><a name="sectc324" id="sectc324">The default presentation</a></h3> 1.1 cvs 1244: 1.37 cvs 1245: <p>It was shown <a href="#mulpres">above</a> that many different 1246: presentations are possible for documents and objects of the same class. The 1247: structure schema defines a preferred presentation for the class, called the 1248: <em>default presentation</em>. Like generic structures, presentations are 1249: described by programs, called <em>presentation schemas</em>, which are 1250: written in a specific language, P, presented <a href="#sectb42">later</a> in 1251: this document. The name appearing after the keyword <tt>DEFPRES</tt> is the 1252: name of the default presentation schema. When a new document is created, Thot 1253: will use this presentation schema by default, but the user remains free to 1254: choose another if s/he wishes.</p> 1.18 cvs 1255: <pre> PresID = NAME .</pre> 1256: </div> 1.1 cvs 1257: 1.18 cvs 1258: <div class="subsection"> 1.37 cvs 1259: <h3><a name="sectc325" id="sectc325">Global Attributes</a></h3> 1.1 cvs 1260: 1.30 cvs 1261: <p>If the generic structure includes global attributes of its own, they are 1.37 cvs 1262: declared after the keyword <tt>ATTR</tt>. Each global attribute is defined by 1263: its name, followed by an equals sign and the definition of its type. The 1.18 cvs 1264: declaration of a global attribute is terminated by a semi-colon.</p> 1.30 cvs 1265: 1266: <p>For attributes of the numeric, textual, or reference types, the type is 1.37 cvs 1267: indicated by a keyword, <tt>INTEGER</tt>, <tt>TEXT</tt>, or 1268: <tt>REFERENCE</tt> respectively.</p> 1.30 cvs 1269: 1270: <p>In the case of a reference attribute, the keyword <tt>REFERENCE</tt> is 1.37 cvs 1271: followed by the type of the referenced element in parentheses. It can refer 1.18 cvs 1272: to any type at all, specified by using the keyword <tt>ANY</tt>, or to a 1.37 cvs 1273: specific type. In the latter case, the element type designated by the 1.18 cvs 1274: reference can be defined either in the <a href="#sectc327"><tt>STRUCT</tt> 1275: section</a> of the same structure schema or in the <tt>STRUCT</tt> section of 1.37 cvs 1276: another structure schema. When the type is defined in another schema, the 1.1 cvs 1277: element type is followed by the name of the structure schema (within 1.37 cvs 1278: parentheses) in which it is defined. The name of the designated element type 1.18 cvs 1279: can be preceded by the keyword <tt>First</tt> or <tt>Second</tt>, but only in 1.37 cvs 1280: the case where the type is defined as <a href="#sectd3285">a pair</a>. These 1.1 cvs 1281: keywords indicate whether the attribute must designate the first mark of the 1.37 cvs 1282: pair or the second. If the reference refers to a pair and neither of these 1.18 cvs 1283: two keywords is present, then the first mark is used.</p> 1.30 cvs 1284: 1.37 cvs 1285: <p>In the case of an enumeration attribute, the equals sign is followed by 1286: the list of names representing the possible values of the attribute, the 1287: names being separated from each other by commas. An enumeration attribute has 1288: at least one possible value; the maximum number of values is defined by the 1.18 cvs 1289: compiler for the S language.</p> 1.30 cvs 1290: <pre> AttrSeq = Attribute < Attribute > . 1.1 cvs 1291: Attribute = AttrID '=' AttrType ';' . 1292: AttrType = 'INTEGER' / 'TEXT' / 1293: 'REFERENCE' '(' RefType ')' / 1294: ValueSeq . 1295: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] . 1296: FirstSec = 'First' / 'Second' . 1297: ExtStruct = '(' ElemID ')' . 1.30 cvs 1298: ValueSeq = AttrVal < ',' AttrVal > . 1.1 cvs 1299: AttrID = NAME . 1.18 cvs 1300: AttrVal = NAME .</pre> 1.30 cvs 1301: 1302: <p>There is a predefined global text attribute, the <em>language</em>, which 1.37 cvs 1303: is automatically added to every Thot structure schema. This attribute allows 1304: Thot to perform certain actions, such as hyphenation and spell-checking, 1305: which cannot be performed without knowing the language in which each part of 1306: the document is written. This attribute can be used just like any explicitly 1.18 cvs 1307: declared attribute: the system acts as if every structure schema contains</p> 1308: <pre>ATTR 1309: Language = TEXT;</pre> 1.30 cvs 1310: 1.18 cvs 1311: <blockquote class="example"> 1.30 cvs 1312: <p><strong>Example:</strong></p> 1313: 1314: <p>The following specification defines the global enumeration attribute 1315: WordType.</p> 1316: <pre>ATTR 1.18 cvs 1317: WordType = Definition, IndexWord, DocumentTitle;</pre> 1318: </blockquote> 1319: </div> 1.1 cvs 1320: 1.18 cvs 1321: <div class="subsection"> 1.37 cvs 1322: <h3><a name="sectc327" id="sectc327">Structured elements</a></h3> 1.1 cvs 1323: 1.30 cvs 1324: <p>The rules for defining structured elements are required, except in an 1.1 cvs 1325: extension schema: they constitute the core of a structure schema, since they 1326: define the structure of the different types of elements that occur in a 1.18 cvs 1327: document or object of the class defined by the schema.</p> 1.30 cvs 1328: 1329: <p>The first structure rule after the keyword <tt>STRUCT</tt> must define the 1.1 cvs 1330: structure of the class whose name appears in the first instruction 1.37 cvs 1331: (<tt>STRUCTURE</tt>) of the schema. This is the root rule of the schema, 1.18 cvs 1332: defining the root of the document tree or object tree.</p> 1.30 cvs 1333: 1334: <p>The remaining rules may be placed in any order, since the language permits 1.37 cvs 1335: the definition of element types before or after their use, or even in the 1336: same instruction in which they are used. This last case allows the definition 1337: of recursive structures.</p> 1.30 cvs 1338: 1339: <p>Each rule is composed of a name (the name of the element type whose 1340: structure is being defined) followed by an equals sign and a structure 1341: definition.</p> 1342: 1.37 cvs 1343: <p>If any local attributes are associated with the element type defined by 1344: the rule, they appear between parentheses after the type name and before the 1345: equals sign. The parentheses contain, first, the keyword <tt>ATTR</tt>, then 1346: the list of local attributes, separated by commas. Each local attribute is 1.2 cvs 1347: composed of the name of the attribute followed by an equals sign and the 1.18 cvs 1348: definition of the attribute's type, just as in the definition of <a 1.37 cvs 1349: href="#sectc325">global attributes</a>. The name of the attribute can be 1350: preceded by an exclamation point to indicate that the attribute must always 1351: be present for this element type. The same attribute, identified by its name, 1352: can be defined as a local attribute for multiple element types. In this case, 1353: the equals sign and definition of the attribute type need only appear in the 1354: first occurrence of the attribute. It should be noted that global attributes 1355: cannot also be defined as local attributes.</p> 1.30 cvs 1356: 1357: <p>If any <a href="#sectd3135">extensions</a> are defined for this element 1358: type, a plus sign follows the structure definition and the names of the 1.37 cvs 1359: extension element types appear between parentheses after the plus. If there 1360: are multiple extensions, they are separated by commas. These types can either 1.30 cvs 1361: be defined in the same schema, defined in other schemas, or they may be base 1.18 cvs 1362: types identified by the keywords <tt>TEXT</tt>, <tt>GRAPHICS</tt>, 1363: <tt>SYMBOL</tt>, or <tt>PICTURE</tt>.</p> 1.30 cvs 1364: 1365: <p><a href="#sectd3135">Restrictions</a> are indicated in the same manner as 1.18 cvs 1366: extensions, but they are introduced by a minus sign and they come after the 1367: extensions, or if there are no extensions, after the structure definition.</p> 1.30 cvs 1368: 1.37 cvs 1369: <p>If the values of attributes must be attached systematically to this 1370: element type, they are introduced by the keyword <tt>WITH</tt> and declared 1371: in the form of a list of fixed-value attributes. When such definitions of 1372: fixed attribute values appear, they are always the last part of the rule.</p> 1.30 cvs 1373: 1374: <p>The rule is terminated by a semicolon.</p> 1375: <pre> RuleSeq = Rule < Rule > . 1.1 cvs 1376: Rule = ElemID [ LocAttrSeq ] '=' DefWithAttr ';'. 1.30 cvs 1377: LocAttrSeq = '(' 'ATTR' LocAttr < ';' LocAttr > ')' . 1.1 cvs 1378: LocAttr = [ '!' ] AttrID [ '=' AttrType ] . 1379: DefWithAttr = Definition 1380: [ '+' '(' ExtensionSeq ')' ] 1381: [ '-' '(' RestrictSeq ')' ] 1382: [ 'WITH' FixedAttrSeq ] . 1.30 cvs 1383: ExtensionSeq = ExtensionElem < ',' ExtensionElem > . 1.1 cvs 1384: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' / 1385: 'SYMBOL' / 'PICTURE' . 1.30 cvs 1386: RestrictSeq = RestrictElem < ',' RestrictElem > . 1.1 cvs 1387: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' / 1.18 cvs 1388: 'SYMBOL' / 'PICTURE' .</pre> 1.30 cvs 1389: 1390: <p>The list of fixed-value attributes is composed of a sequence of 1.37 cvs 1391: attribute-value pairs separated by commas. Each pair contains the name of the 1.1 cvs 1392: attribute and the fixed value for this element type, the two being separated 1.37 cvs 1393: by an equals sign. If the sign is preceded by a question mark the given value 1.1 cvs 1394: is only an initial value that may be modified later rather than a value fixed 1.37 cvs 1395: for all time. Reference attributes are an exception to this norm. They cannot 1396: be assigned a fixed value, but when the name of such an attribute appears 1397: this indicates that this element type must have a valid value for the 1398: attribute. For the other attribute types, the fixed value is indicated by a 1.1 cvs 1399: signed integer (numeric attributes), a character string between apostrophes 1.18 cvs 1400: (textual attributes) or the name of a value (enumeration attributes).</p> 1.30 cvs 1401: 1402: <p>Fixed-value attributes can either be <a href="#sectc325">global</a> or 1403: local to the element type for which they are fixed, but they must be declared 1404: before they are used.</p> 1405: <pre> FixedAttrSeq = FixedAttr < ',' FixedAttr > . 1.1 cvs 1406: FixedAttr = AttrID [ FixedOrModifVal ] . 1407: FixedOrModifVal = [ '?' ] '=' FixedValue . 1408: FixedValue = [ '-' ] NumValue / TextVal / AttrVal . 1409: NumValue = NUMBER . 1.18 cvs 1410: TextVal = STRING .</pre> 1411: </div> 1.1 cvs 1412: 1.18 cvs 1413: <div class="subsection"> 1.37 cvs 1414: <h3><a name="sectc328" id="sectc328">Structure definitions</a></h3> 1.1 cvs 1415: 1.37 cvs 1416: <p>The structure of an element type can be a simple base type or a 1417: constructed type.</p> 1.30 cvs 1418: 1419: <p>For constructed types, it is frequently the case that similar structures 1.37 cvs 1420: appear in many places in a document. For example the contents of the 1.1 cvs 1421: abstract, of the introduction, and of a section can have the same structure, 1.37 cvs 1422: that of a sequence of paragraphs. In this case, a single, common structure 1.1 cvs 1423: can be defined (the paragraph sequence in this example), and the schema is 1424: written to indicate that each element type possesses this structure, as 1.18 cvs 1425: follows:</p> 1426: <pre> Abstract = Paragraph_sequence; 1.1 cvs 1427: Introduction = Paragraph_sequence; 1.18 cvs 1428: Section_contents = Paragraph_sequence;</pre> 1.30 cvs 1429: 1430: <p>The equals sign means ``has the same structure as''.</p> 1431: 1.37 cvs 1432: <p>If the element type defined is a simple base type, this is indicated by 1433: one of the keywords <tt>TEXT</tt>, <tt>GRAPHICS</tt>, <tt>SYMBOL</tt>, or 1434: <tt>PICTURE</tt>. If some local attributes must be associated with a base 1435: type, the keyword of the base type is followed by the declaration of the 1436: local attributes using the syntax <a href="#sectc327">presented above.</a></p> 1.30 cvs 1437: 1438: <p>In the case of an open choice, the type is indicated by the keyword 1.18 cvs 1439: <tt>UNIT</tt> for units or the keyword <tt>NATURE</tt> for objects having a 1440: structure defined by any other schema.</p> 1.30 cvs 1441: 1442: <p>A unit represents one of the two following categories:</p> 1.18 cvs 1443: <ul> 1.30 cvs 1444: <li>a base type: text, graphical element, symbol, picture,</li> 1.37 cvs 1445: <li>an element whose type is chosen from among the types defined as units 1446: in the <tt>UNITS</tt> section of the document's structure schema. It can 1.30 cvs 1447: also be chosen from among the types defined as <a 1448: href="#sectd3132">units</a> in the <a href="#sectc3212"><tt>UNITS</tt> 1449: section</a> of the structure schemas that defines the ancestors of the 1450: element to which the rule is applied.</li> 1.18 cvs 1451: </ul> 1.30 cvs 1452: 1453: <p>Before the creation of an element defined as a unit, Thot asks the user to 1.18 cvs 1454: choose between the categories of elements.</p> 1.30 cvs 1455: 1456: <p>Thus, the contents of a paragraph can be specified as a sequence of units, 1.1 cvs 1457: which will permit the inclusion in the paragraphs of character strings, 1458: symbols, and various elements, such as cross-references, if these are defined 1.18 cvs 1459: as units.</p> 1.30 cvs 1460: 1.37 cvs 1461: <p>A schema object (keyword <tt>NATURE</tt>) represents an object defined by 1462: a structure schema freely chosen from among the available schemas; in the 1463: case the element type is defined by the first rule (the root rule) of the 1464: chosen schema.</p> 1.30 cvs 1465: 1466: <p>If the element type defined is a constructed type, the list, aggregate, 1.37 cvs 1467: choice, and reference constructors are used. In this case the definition 1468: begins with a keyword identifying the constructor. This keyword is followed 1.18 cvs 1469: by a syntax specific to each constructor.</p> 1.30 cvs 1470: 1471: <p>The local attribute definitions appear after the name of the element type 1.18 cvs 1472: being defined, if this element type has <a href="#sectc327">local 1473: attributes</a>.</p> 1474: <pre> Definition = BaseType [ LocAttrSeq ] / Constr / Element . 1.1 cvs 1475: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 'PICTURE' / 1476: 'UNIT' / 'NATURE' . 1477: Element = ElemID [ ExtOrDef ] . 1478: ExtOrDef = 'EXTERN' / 'INCLUDED' / 1479: [ LocAttrSeq ] '=' Definition . 1480: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF' 1481: '(' DefWithAttr ')' / 1482: 'BEGIN' DefOptSeq 'END' / 1483: 'AGGREGATE' DefOptSeq 'END' / 1484: 'CASE' 'OF' DefSeq 'END' / 1485: 'REFERENCE' '(' RefType ')' / 1.18 cvs 1486: 'PAIR' .</pre> 1.1 cvs 1487: 1.18 cvs 1488: <div class="subsubsection"> 1.37 cvs 1489: <h4><a name="sectd3281" id="sectd3281">List</a></h4> 1.1 cvs 1490: 1.30 cvs 1491: <p>The list constructor permits the definition of an element type composed of 1.37 cvs 1492: a list of elements, all of the same type. A list definition begins with the 1.18 cvs 1493: <tt>LIST</tt> keyword followed by an optional range, the keyword <tt>OF</tt>, 1.1 cvs 1494: and the definition, between parentheses, of the element type which must 1.37 cvs 1495: compose the list. The optional range is composed of the minimum and maximum 1.1 cvs 1496: number of elements for the list separated by two periods and enclosed by 1.37 cvs 1497: brackets. If the range is not present, the number of list elements is 1498: unconstrained. When only one of the two bounds of the range is unconstrained, 1499: it is represented by a star ('*') character. Even when both bounds are 1500: unconstrained, they can be specified by <tt>[*..*]</tt>, but it is simpler 1501: not to specify any bound.</p> 1.18 cvs 1502: <pre> 'LIST' [ '[' min '..' max ']' ] 1.1 cvs 1503: 'OF' '(' DefWithAttr ')' 1504: min = Integer / '*' . 1505: max = Integer / '*' . 1.18 cvs 1506: Integer = NUMBER .</pre> 1.30 cvs 1507: 1508: <p>Before the document is edited, Thot creates the minimum number of elements 1.37 cvs 1509: for the list. If no minimum was given, it creates a single element. If a 1.30 cvs 1510: maximum number of elements is given and that number is attained, the editor 1511: refuses to create new elements for the list.</p> 1512: 1513: <blockquote class="example"> 1514: <p><strong>Example:</strong></p> 1515: 1516: <p>The following two instructions define the body of a document as a 1517: sequence of at least two chapters and the contents of a section as a 1.37 cvs 1518: sequence of paragraphs. A single paragraph can be the entire contents of a 1.30 cvs 1519: section.</p> 1520: <pre>Body = LIST [2..*] OF (Chapter); 1.18 cvs 1521: Section_contents = LIST OF (Paragraph);</pre> 1522: </blockquote> 1523: </div> 1.1 cvs 1524: 1.18 cvs 1525: <div class="subsubsection"> 1.37 cvs 1526: <h4><a name="sectd3282" id="sectd3282">Aggregate</a></h4> 1.1 cvs 1527: 1.37 cvs 1528: <p>The aggregate constructor is used to define an element type as a 1529: collection of sub-elements, each having a fixed type. The collection may be 1530: ordered or unordered. The elements composing the collection are called 1531: <em>components</em>. In the definition of an aggregate, a keyword indicates 1.18 cvs 1532: whether or not the aggregate is ordered: <tt>BEGIN</tt> for an ordered 1533: aggregate, <tt>AGGREGATE</tt> for an unordered aggregate. This keyword is 1.1 cvs 1534: followed by the list of component type definitions which is terminated by the 1.37 cvs 1535: <tt>END</tt> keyword. The component type definitions are separated by 1.18 cvs 1536: commas.</p> 1.30 cvs 1537: 1538: <p>Before creating an aggregate, the Thot editor creates all the aggregate's 1.1 cvs 1539: components in the order they appear in the structure schema, even for 1.37 cvs 1540: unordered aggregates. However, unlike ordered aggregates, the components of 1.1 cvs 1541: an unordered aggregate may be rearranged using operations of the Thot editor. 1542: The exceptions to the rule are any components whose name was preceded by a 1.37 cvs 1543: question mark character ('?'). These components, which are optional, can be 1.1 cvs 1544: created by explicit request, possibly at the time the aggregate is created, 1.18 cvs 1545: but they are not created automatically <em>prior</em> to the creation of the 1546: aggregate.</p> 1547: <pre> 'BEGIN' DefOptSeq 'END' 1.30 cvs 1548: DefOptSeq = DefOpt ';' < DefOpt ';' > . 1.18 cvs 1549: DefOpt = [ '?' ] DefWithAttr .</pre> 1.30 cvs 1550: 1.18 cvs 1551: <blockquote class="example"> 1.30 cvs 1552: <p><strong>Example:</strong></p> 1553: 1554: <p>In a bilingual document, each paragraph has an English version and a 1.37 cvs 1555: French version. In certain cases, the translator wants to add a marginal 1556: note, but this note is present in very few paragraphs. Thus, it must not be 1557: created systematically for every paragraph. A bilingual paragraph of this 1.30 cvs 1558: type is declared:</p> 1559: <pre>Bilingual_paragraph = BEGIN 1.1 cvs 1560: French_paragraph = TEXT; 1561: English_paragraph = TEXT; 1562: ? Note = TEXT; 1.18 cvs 1563: END;</pre> 1564: </blockquote> 1565: </div> 1.1 cvs 1566: 1.18 cvs 1567: <div class="subsubsection"> 1.37 cvs 1568: <h4><a name="sectd3283" id="sectd3283">Choice</a></h4> 1.1 cvs 1569: 1.30 cvs 1570: <p>The choice constructor permits the definition of an element type which is 1.37 cvs 1571: chosen from among a set of possible types. The keywords <tt>CASE</tt> and 1572: <tt>OF</tt> are followed by a list of definitions of possible types, which 1573: are separated by semicolons and terminated by the <tt>END</tt> keyword.</p> 1.18 cvs 1574: <pre> 'CASE' 'OF' DefSeq 'END' 1.30 cvs 1575: DefSeq = DefWithAttr ';' < DefWithAttr ';' > .</pre> 1576: 1577: <p>Before the creation of an element defined as a choice, the Thot editor 1.37 cvs 1578: presents the list of possible types for the element to the user. The user has 1.18 cvs 1579: only to select the element type that s/he wants to create from this list.</p> 1.30 cvs 1580: 1.37 cvs 1581: <p>The order of the type declarations is important. It determines the order 1582: of the list presented to the user before the creation of the element. Also, 1.30 cvs 1583: when a Choice element is being created automatically, the first type in the 1.37 cvs 1584: list is used. In fact, using the Thot editor, when an empty Choice element is 1.1 cvs 1585: selected, it is possible to select this element and to enter its text from 1586: keyboard. In this case, the editor uses the first element type which can 1.18 cvs 1587: contain an atom of the character string type.</p> 1.30 cvs 1588: 1589: <p>The two special cases of the choice constructor, the <a 1.18 cvs 1590: href="#sectc328"><em>schema</em></a> and the <a 1591: href="#sectc3212"><em>unit</em></a> are discussed elsewhere.</p> 1.30 cvs 1592: 1.18 cvs 1593: <blockquote class="example"> 1.30 cvs 1594: <p><strong>Example:</strong></p> 1595: 1596: <p>It is common in documents to treat a variety of objects as if they were 1.37 cvs 1597: ordinary paragraphs. Thus, a ``Paragraph'' might actually be composed of a 1.30 cvs 1598: block of text (an ordinary paragraph), or a mathematical formula whose 1599: structure is defined by another structure schema named Math, or a table, 1.37 cvs 1600: also defined by another structure schema. Here is a definition of such a 1.30 cvs 1601: paragraph:</p> 1602: <pre>Paragraph = CASE OF 1.1 cvs 1603: Simple_text = TEXT; 1604: Formula = Math; 1605: Table_para = Table; 1.18 cvs 1606: END;</pre> 1607: </blockquote> 1608: </div> 1.1 cvs 1609: 1.18 cvs 1610: <div class="subsubsection"> 1.37 cvs 1611: <h4><a name="sectd3284" id="sectd3284">Reference</a></h4> 1.1 cvs 1612: 1.37 cvs 1613: <p>Like all elements in Thot, references are typed. An element type defined 1.30 cvs 1614: as a reference is a cross-reference to an element of some other given type. 1615: The keyword <tt>REFERENCE</tt> is followed by the name of a type enclosed in 1.37 cvs 1616: parentheses. When the type which is being cross-referenced is defined in 1.1 cvs 1617: another structure schema, the type name is itself followed by the name of the 1.18 cvs 1618: external structure schema in which it is defined.</p> 1.30 cvs 1619: 1620: <p>When the designated element type is a <a href="#sectd3285">mark pair</a>, 1.37 cvs 1621: it can be preceded by a <tt>FIRST</tt> or <tt>SECOND</tt> keyword. These 1.18 cvs 1622: keywords indicate whether the reference points to the first or second mark of 1623: the pair. If the reference points to a pair and neither of these two keywords 1624: is present, the reference is considered to point to the first mark of the 1625: pair.</p> 1.30 cvs 1626: 1.37 cvs 1627: <p>There is an exception to the principle of typed references: it is possible 1.30 cvs 1628: to define a reference which designates an element of any type, which can 1629: either be in the same document or another document. In this case, it suffices 1630: to put the keyword <tt>ANY</tt> in the parentheses which indicate the 1631: referenced element type.</p> 1.18 cvs 1632: <pre> 'REFERENCE' '(' RefType ')' 1633: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] .</pre> 1.30 cvs 1634: 1635: <p>When defining an inclusion, the <tt>REFERENCE</tt> keyword is not used. 1.1 cvs 1636: Inclusions with complete expansion are not declared as such in the structure 1.37 cvs 1637: schemas, since any element defined in a structure schema can be replaced by 1638: an element of the same type. Instead, inclusions without expansion or with 1.1 cvs 1639: partial expansion must be declared explicitly whenever they will include a 1.37 cvs 1640: complete object ( and not a part of an object). In this case, the object type 1.1 cvs 1641: to be included (that is, the name of its structure schema) is followed by a 1.37 cvs 1642: keyword: <tt>EXTERN</tt> for inclusion without expansion and 1643: <tt>INCLUDED</tt> for partial expansion.</p> 1.30 cvs 1644: 1.37 cvs 1645: <p>Before creating a cross-reference or an inclusion, the Thot editor asks 1646: the user to choose, from the document images displayed, the referenced or 1647: included element.</p> 1.30 cvs 1648: 1.18 cvs 1649: <blockquote class="example"> 1.30 cvs 1650: <p><strong>Example:</strong></p> 1651: 1652: <p>If the types Note and Section are defined in the Article structure 1653: schema, it is possible to define, in the same structure schema, a reference 1654: to a note and a reference to a section in this manner:</p> 1655: <pre>Ref_note = REFERENCE (Note); 1.18 cvs 1656: Ref_section = REFERENCE (Section);</pre> 1.30 cvs 1657: 1658: <p>It is also possible to define the generic structure of a collection of 1659: articles, which include (with partial expansion) objects of the Article 1660: class and which possess an introduction which may include cross-references 1.37 cvs 1661: to sections of the included articles. In the Collection structure schema, 1.30 cvs 1662: the definitions are:</p> 1663: <pre>Collection = BEGIN 1.6 cvs 1664: Collection_title = TEXT; 1665: Introduction = LIST OF (Elem = CASE OF 1.1 cvs 1666: TEXT; 1667: Ref_sect; 1668: END); 1.6 cvs 1669: Body = LIST OF (Article INCLUDED); 1670: END; 1.18 cvs 1671: Ref_sect = REFERENCE (Section (Article));</pre> 1.30 cvs 1672: 1673: <p>Here we define a Folder document class which has a title and includes 1674: documents of different types, particularly Folders:</p> 1675: <pre>Folder = BEGIN 1.6 cvs 1676: Folder_title = TEXT; 1677: Folder_contents = LIST OF (Document); 1678: END; 1.1 cvs 1679: 1680: Document = CASE OF 1681: Article EXTERN; 1682: Collection EXTERN; 1683: Folder EXTERN; 1.18 cvs 1684: END;</pre> 1.30 cvs 1685: 1686: <p>Under this definition, Folder represents either an aggregate which 1687: contains a folder title and the list of included documents or an included 1.37 cvs 1688: folder. To resolve this ambiguity, in the P language, the placement of a 1.30 cvs 1689: star character in front of the type name (here, Folder) indicates an 1690: included document.</p> 1.18 cvs 1691: </blockquote> 1692: </div> 1.1 cvs 1693: 1.18 cvs 1694: <div class="subsubsection"> 1.37 cvs 1695: <h4><a name="sectd3285" id="sectd3285">Mark pairs</a></h4> 1.1 cvs 1696: 1.37 cvs 1697: <p>Like other elements, mark pairs are typed. The two marks of the pair have 1698: the same type, but there exist two predefined subtypes which apply to all 1699: mark pairs: the first mark of the pair (called <tt>First</tt> in the P and T 1.18 cvs 1700: languages) and the second mark (called <tt>Second</tt>).</p> 1.30 cvs 1701: 1702: <p>In the S language, a mark pair is noted simply by the <tt>PAIR</tt> 1.18 cvs 1703: keyword.</p> 1.30 cvs 1704: 1.37 cvs 1705: <p>In the Thot editor, marks are always moved or destroyed together. The two 1.1 cvs 1706: marks of a pair have the same identifier, unique within the document, which 1.18 cvs 1707: permits intertwining mark pairs without risk of ambiguity.</p> 1708: </div> 1709: </div> 1.1 cvs 1710: 1.18 cvs 1711: <div class="subsection"> 1.37 cvs 1712: <h3><a name="sectc329" id="sectc329">Imports</a></h3> 1.1 cvs 1713: 1.30 cvs 1714: <p>Because of schema constructors, it is possible, before editing a document, 1.37 cvs 1715: to use classes defined by other structure schemas whenever they are needed. 1716: It is also possible to assign specific document classes to certain element 1717: types. In this case, these classes are simply designated by their name. In 1718: fact, if a type name is not defined in the structure schema, it is assumed 1719: that it specifies a structure defined by another structure schema.</p> 1.30 cvs 1720: 1.18 cvs 1721: <blockquote class="example"> 1.30 cvs 1722: <p><strong>Example:</strong></p> 1723: 1724: <p>If the types Math and Table don't appear in the left part of a structure 1725: rule in the schema, the following two rules indicate that a formula has the 1.37 cvs 1726: structure of an object defined by the structure schema Math and that a 1727: table element has the structure of an object defined by the Table 1728: schema.</p> 1.30 cvs 1729: <pre>Formula = Math; 1.18 cvs 1730: Table_elem = Table;</pre> 1731: </blockquote> 1732: </div> 1733: 1734: <div class="subsection"> 1.37 cvs 1735: <h3><a name="sectc3210" id="sectc3210">Extension rules</a></h3> 1.18 cvs 1736: 1.30 cvs 1737: <p>The <tt>EXTENS</tt> section, which can only appear in an extension schema, 1.1 cvs 1738: defines complements to the rules in the primary schema (i.e. the structure 1739: schema to which the extension schema will be applied). More precisely, this 1740: section permits the addition to an existing type of local attributes, 1.18 cvs 1741: extensions, restrictions and fixed-value attributes.</p> 1.30 cvs 1742: 1743: <p>These additions can be applied to the root rule of the primary schema, 1.18 cvs 1744: designated by the keyword <tt>Root</tt>, or to any other explicitly named 1745: rule.</p> 1.30 cvs 1746: 1747: <p>Extension rules are separated from each other by a semicolon and each 1.18 cvs 1748: extension rule has the same syntax as a <a href="#sectc327">structure 1749: rule</a>, but the part which defines the constructor is absent.</p> 1.30 cvs 1750: <pre> ExtenRuleSeq = ExtensRule ';' < ExtensRule ';' > . 1.6 cvs 1751: ExtensRule = RootOrElem [ LocAttrSeq ] 1752: [ '+' '(' ExtensionSeq ')' ] 1753: [ '-' '(' RestrictSeq ')' ] 1754: [ 'WITH' FixedAttrSeq ] . 1.18 cvs 1755: RootOrElem = 'Root' / ElemID .</pre> 1756: </div> 1.1 cvs 1757: 1.18 cvs 1758: <div class="subsection"> 1.37 cvs 1759: <h3><a name="sectc3212" id="sectc3212">Units</a></h3> 1.30 cvs 1760: 1761: <p>The <tt>UNITS</tt> section of the structure schema contains the 1762: declarations of the element types which can be used in the external objects 1763: making up parts of the document or in objects of the class defined by the 1.37 cvs 1764: schema. These element types are defined just like other structured element 1765: types. They can be used in the other element types of the schema, but they 1766: can also be used in any other rule of the schema.</p> 1.30 cvs 1767: 1768: <blockquote class="example"> 1769: <p><strong>Example:</strong></p> 1.1 cvs 1770: 1.30 cvs 1771: <p>If references to notes are declared as units:</p> 1772: <pre>UNITS 1.18 cvs 1773: Ref_note = REFERENCE (Note);</pre> 1.30 cvs 1774: 1.37 cvs 1775: <p>then it is possible to use references to notes in a cell of a table, 1776: even when <tt>Table</tt> is an external structure schema. The 1777: <tt>Table</tt> schema must declare a cell to be a sequence of units, which 1778: can then be base element types (text, for example) or references to notes 1779: in the document.</p> 1.30 cvs 1780: <pre>Cell = LIST OF (UNITS);</pre> 1.18 cvs 1781: </blockquote> 1782: </div> 1.1 cvs 1783: 1.18 cvs 1784: <div class="subsection"> 1.37 cvs 1785: <h3><a name="sectc3213" id="sectc3213">Skeleton elements</a></h3> 1.1 cvs 1786: 1.30 cvs 1787: <p>When editing a document which contains or must contain external references 1788: to several other documents, it may be necessary to load a large number of 1.1 cvs 1789: documents, simply to see the parts designated by the external references of 1.37 cvs 1790: the document while editing, or to access the source of included elements. In 1791: this case, the external documents are not modified and it is only necessary 1792: to see the elements of these documents which could be referenced. Because of 1.1 cvs 1793: this, the editor will suggest that the documents be loaded in ``skeleton'' 1.37 cvs 1794: form. This form contains only the elements of the document explicitly 1.18 cvs 1795: mentioned in the <tt>EXPORT</tt> section of their structure schema and, for 1.1 cvs 1796: these elements, only the part of the contents specified in that section. This 1797: form has the advantage of being very compact, thus requiring very few 1.37 cvs 1798: resources from the editor. This is also the skeleton form which constitutes 1.18 cvs 1799: the expanded form of <a href="#inclusion">inclusions</a> with partial 1800: expansion.</p> 1.30 cvs 1801: 1802: <p>Skeleton elements must be declared explicitly in the <tt>EXPORT</tt> 1.37 cvs 1803: section of the structure schema that defines them. This section begins with 1.30 cvs 1804: the keyword <tt>EXPORT</tt> followed by a comma-separated list of the element 1.1 cvs 1805: types which must appear in the skeleton form and ending with a semicolon. 1.18 cvs 1806: These types must have been previously declared in the schema.</p> 1.30 cvs 1807: 1.37 cvs 1808: <p>For each skeleton element type, the part of the contents which is loaded 1809: by the editor, and therefore displayable, can be specified by putting the 1810: keyword <tt>WITH</tt> and the name of the contained element type to be loaded 1811: after the name of the skeleton element type. In this case only that named 1812: element, among all the elements contained in the exportable element type, 1813: will be loaded. If the <tt>WITH</tt> is absent, the entire contents of the 1814: skeleton element will be loaded by the editor. If instead, it is better that 1815: the skeleton form not load the contents of a particular element type, the 1816: keyword <tt>WITH</tt> must be followed by the word <tt>Nothing</tt>.</p> 1.18 cvs 1817: <pre> [ 'EXPORT' SkeletonSeq ] 1.1 cvs 1818: 1.30 cvs 1819: SkeletonSeq = SkelElem < ',' SkelElem > ';' . 1.1 cvs 1820: SkelElem = ElemID [ 'WITH' Contents ] . 1.18 cvs 1821: Contents = 'Nothing' / ElemID [ ExtStruct ] .</pre> 1.30 cvs 1822: 1.18 cvs 1823: <blockquote class="example"> 1.30 cvs 1824: <p><strong>Example:</strong></p> 1825: 1826: <p>Suppose that, in documents of the article class, the element types 1827: Article_title, Figure, Section, Paragraph, and Biblio should appear in the 1828: skeleton form in order to make it easier to create external references to 1.37 cvs 1829: them from other documents. When loading an article in its skeleton form, 1.30 cvs 1830: all of these element types will be loaded except for paragraphs, but only 1.37 cvs 1831: the article title will be loaded in its entirety. For figures, the caption 1.30 cvs 1832: will be loaded, while for sections, the title will be loaded, and for 1.37 cvs 1833: bibliographic entries, only the title that they contain will be loaded. 1834: Note that bibliographic elements are defined in another structure schema, 1835: RefBib. To produce this result, the following declarations should be placed 1836: in the Article structure schema:</p> 1.30 cvs 1837: <pre>EXPORT 1.1 cvs 1838: Article_title, 1.5 cvs 1839: Figure With Caption, 1.1 cvs 1840: Section With Section_title, 1841: Paragraph With Nothing, 1.18 cvs 1842: Biblio With Biblio_title(RefBib);</pre> 1843: </blockquote> 1844: </div> 1.1 cvs 1845: 1.18 cvs 1846: <div class="subsection"> 1.37 cvs 1847: <h3><a name="sectc3214" id="sectc3214">Exceptions</a></h3> 1.1 cvs 1848: 1.30 cvs 1849: <p>The behavior of the Thot editor and the actions that it performs are 1.37 cvs 1850: determined by the structure schemas. These actions are applied to all 1851: document and object types in accordance with their generic structure. For 1.1 cvs 1852: certain object types, such as tables and graphics, these actions are not 1853: sufficient or are poorly adapted and some special actions must be added to or 1.37 cvs 1854: substituted for certain standard actions. These special actions are called 1.18 cvs 1855: <em>exceptions</em>.</p> 1.30 cvs 1856: 1.37 cvs 1857: <p>Exceptions only inhibit or modify certain standard actions, but they can 1858: be used freely in every structure schema.</p> 1.30 cvs 1859: 1.37 cvs 1860: <p>Each structure schema can contain a section defining exceptions. It begins 1.18 cvs 1861: with the keyword <tt>EXCEPT</tt> and is composed of a sequence of exception 1.37 cvs 1862: declarations, separated by semicolons. Each declaration of an exception 1863: begins with the name of an element type or attribute followed by a colon. 1864: This indicates the element type or attribute to which the following 1865: exceptions apply. When the given element type name is a <a 1866: href="#sectd3285">mark pair</a>, and only in this case, the type name can be 1867: preceded by the keyword <tt>First</tt> or <tt>Second</tt>, to indicate if the 1868: exceptions which follow are associated with the first mark of the pair or the 1869: second. In the absence of this keyword, the first mark is used.</p> 1.30 cvs 1870: 1871: <p>When placed in an <a href="#sectc322">extension schema</a>, the keyword 1.18 cvs 1872: <tt>EXTERN</tt> indicates that the type name which follows is found in the 1.37 cvs 1873: principal schema (the schema being extended by the extension schema). The 1874: exceptions are indicated by a name. They are separated by semicolons.</p> 1.18 cvs 1875: <pre> [ 'EXCEPT' ExceptSeq ] 1.1 cvs 1876: 1.30 cvs 1877: ExceptSeq = Except ';' < Except ';' > . 1.1 cvs 1878: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr 1879: ':' ExcValSeq . 1880: ExcTypeOrAttr = ElemID / AttrID . 1.30 cvs 1881: ExcValSeq = ExcValue < ',' ExcValue > . 1.51 quint 1882: ExcValue ='NoCut' / 'NoCreate' / 'NoReplicate' / 1883: 'NoHMove' / 'NoVMove' / 'NoMove' / 1884: 'NoHResize' / 'NoVResize' / 'NoResize' / 1885: 'MoveResize' / 1886: 'NewWidth' / 'NewHeight' / 'NewPercentWidth' / 1887: 'NewHPos' / 'NewVPos' / 1888: 'Invisible' / 'Hidden' / 1.19 cvs 1889: 'PageBreak' / 'PageBreakAllowed' / 'PageBreakPlace' / 1890: 'PageBreakRepetition' / 'PageBreakRepBefore' / 1.51 quint 1891: 'NoPaginate' / 'NoSpellCheck' / 1892: 'ActiveRef' / 'NoSelect' / 1.9 cvs 1893: 'HighlightChildren' / 'ExtendedSelection' / 1.36 cvs 1894: 'SelectParent' / 'ClickableSurface' / 1.52 quint 1895: 'ParagraphBreak' / 'IsBreak' / 1.51 quint 1896: 'ReturnCreateNL' / 'ReturnCreateWithin' / 'NoBreakByReturn' / 1897: 'ImportLine' / 'ImportParagraph' / 1898: 'GraphCreation' / 'IsDraw' / 'IsGroup' / 'EmptyGraphic' / 1899: 'IsTable' / 'IsRow' / 'IsColHead' / 'IsCell' / 1900: 'ColRef' / 'ColSpan' / 'RowSpan' / 1901: 'CssBackground' / 'CssClass' / 'CssId' / 'CssPseudoClass' / 1902: 'NoShowBox' / 'SetWindowBackground' / 1903: 'Shadow' / 'EventAttr' / 'SpacePreserve' / 1.54 quint 1904: 'IsPlaceholder' / 'StartCounter' / 'SetCounter' / 1.51 quint 1905: ExceptNum .</pre> 1.30 cvs 1906: 1907: <p>The following are the available exceptions:</p> 1.18 cvs 1908: <dl> 1.30 cvs 1909: <dt><tt>NoCut</tt></dt> 1.37 cvs 1910: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1911: type to which this exception is applied cannot be deleted by the 1912: editor.</dd> 1913: <dt><tt>NoCreate</tt></dt> 1.37 cvs 1914: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1915: type to which this exception is applied cannot be created by ordinary 1.37 cvs 1916: commands for creating new elements. These elements are usually created 1.30 cvs 1917: by special actions associated with other exceptions.</dd> 1.51 quint 1918: <dt><tt>NoReplicate</tt></dt> 1919: <dd>This exception can only be applied to element types. Elements of a 1920: type to which this exception is applied cannot be duplicated by 1921: pressing the Return key. A default element (such as a paragraph) is 1922: created instead.</dd> 1.30 cvs 1923: <dt><tt>NoHMove</tt></dt> 1.37 cvs 1924: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1925: type to which this exception is applied cannot be moved horizontally 1926: with the mouse. Their children elements cannot be moved either.</dd> 1927: <dt><tt>NoVMove</tt></dt> 1.37 cvs 1928: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1929: type to which this exception is applied cannot be moved vertically with 1930: the mouse. Their children elements cannot be moved either.</dd> 1931: <dt><tt>NoMove</tt></dt> 1.37 cvs 1932: <dd>This exception can only be applied to element types. Elements of a 1933: type to which this exception is applied cannot be moved in any 1934: direction with the mouse. Their children elements cannot be moved 1935: either.</dd> 1.30 cvs 1936: <dt><tt>NoHResize</tt></dt> 1.37 cvs 1937: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1938: type to which this exception is applied cannot be resized horizontally 1939: with the mouse. Their children elements cannot be resized either.</dd> 1940: <dt><tt>NoVResize</tt></dt> 1.37 cvs 1941: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1942: type to which this exception is applied cannot be resized vertically 1943: with the mouse. Their children elements cannot be resized either.</dd> 1944: <dt><tt>NoResize</tt></dt> 1.37 cvs 1945: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1946: type to which this exception is applied cannot be resized in any 1.37 cvs 1947: direction with the mouse. Their children elements cannot be resized 1.30 cvs 1948: either.</dd> 1949: <dt><tt>MoveResize</tt></dt> 1.37 cvs 1950: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 1951: type to which this exception is applied can be moved and resized in any 1952: direction with the mouse, even if one of their ancestor element has an 1.37 cvs 1953: exception that prevents moving or resizing. Their children elements can 1.30 cvs 1954: also be resized or moved.</dd> 1955: <dt><tt>NewWidth</tt></dt> 1.37 cvs 1956: <dd>This exception can only be applied to numeric attributes. If the 1957: width of an element which has this attribute is modified with the 1958: mouse, the value of the new width will be assigned to the 1959: attribute.</dd> 1.30 cvs 1960: <dt><tt>NewHeight</tt></dt> 1.37 cvs 1961: <dd>This exception can only be applied to numeric attributes. If the 1.30 cvs 1962: height of an element which has this attribute is modified with the 1963: mouse, the value of the new height will be assigned to the 1964: attribute.</dd> 1.51 quint 1965: <dt><tt>NewPercentWidth</tt></dt> 1966: <dd>@@@@@</dd> 1.30 cvs 1967: <dt><tt>NewHPos</tt></dt> 1.37 cvs 1968: <dd>This exception can only be applied to numeric attributes. If the 1.30 cvs 1969: horizontal position of an element which has this attribute is modified 1970: with the mouse, the value of the new horizontal position will be 1971: assigned to the attribute.</dd> 1972: <dt><tt>NewVPos</tt></dt> 1.37 cvs 1973: <dd>This exception can only be applied to numeric attributes. If the 1.30 cvs 1974: vertical position of an element which has this attribute is modified 1975: with the mouse, the value of the new vertical position will be assigned 1976: to the attribute.</dd> 1977: <dt><tt>Invisible</tt></dt> 1978: <dd>This exception can only be applied to attributes, but can be applied 1.37 cvs 1979: to all attribute types. It indicates that the attribute must not be 1980: seen by the user and that its value must not be changed directly. This 1.30 cvs 1981: exception is usually used when another exception manipulates the value 1982: of an attribute.</dd> 1983: <dt><tt>Hidden</tt></dt> 1.37 cvs 1984: <dd>This exception can only be applied to element types. It indicates 1.30 cvs 1985: that elements of this type, although present in the document's 1.37 cvs 1986: structure, must not be shown to the user of the editor. In particular, 1.30 cvs 1987: the creation menus must not propose this type and the selection message 1988: must not pick it.</dd> 1.51 quint 1989: <dt><tt>PageBreak</tt></dt> 1990: <dd>@@@@</dd> 1991: <dt><tt>PageBreakAllowed</tt></dt> 1992: <dd>@@@@</dd> 1993: <dt><tt>PageBreakPlace</tt></dt> 1994: <dd>@@@@</dd> 1995: <dt><tt>PageBreakRepetition</tt></dt> 1996: <dd>@@@@</dd> 1997: <dt><tt>PageBreakRepBefore</tt></dt> 1998: <dd>@@@@</dd> 1999: <dt><tt>NoPaginate</tt></dt> 2000: <dd>This exception can only be applied to the root element, i.e. the name 2001: that appear after the keyword <tt>STRUCTURE</tt> at the beginning of 2002: the structure schema. It indicates that the editor should not allow the 2003: user to paginate documents of that type.</dd> 2004: <dt>NoSpellCheck</dt> 2005: <dd>This exception can only be applied to element types. Elements of a 2006: type to which this exception is applied are not taken into account by 2007: the spell checker.</dd> 1.30 cvs 2008: <dt><tt>ActiveRef</tt></dt> 2009: <dd>This exception can only be applied to attributes of the reference 1.37 cvs 2010: type. It indicates that when the user of the editor makes a double 1.30 cvs 2011: click on an element which possesses a reference attribute having this 2012: exception, the element designated by the reference attribute will be 2013: selected.</dd> 1.51 quint 2014: <dt><tt>NoSelect</tt></dt> 2015: <dd>This exception can only be applied to element types. Elements of a 2016: type to which this exception is applied cannot be selected directly 2017: with the mouse, but they can be selected by other methods provided by 2018: the editor.</dd> 1.30 cvs 2019: <dt><tt>HighlightChildren</tt></dt> 1.37 cvs 2020: <dd>This exception can only be applied to element types. Elements of a 1.30 cvs 2021: type to which this exception is applied are not highlighted themselves 1.32 cvs 2022: when they are selected in the main view, but all their children are 1.37 cvs 2023: highlighted instead. If children have this exception too, the process 2024: is applied recursively. Only the main view defined in the presentation 1.32 cvs 2025: schema is concerned. Tee exception is ignored for other views.</dd> 1.30 cvs 2026: <dt><tt>ExtendedSelection</tt></dt> 1.37 cvs 2027: <dd>This exception can only be applied to element types. The selection 1.30 cvs 2028: extension command (middle button of the mouse) only add the clicked 2029: element (if it has that exception) to the current selection, without 2030: selecting other elements between the current selection and the clicked 2031: element.</dd> 1.36 cvs 2032: <dt><code>SelectParent</code></dt> 2033: <dd>This exception can only be applied to element types. When the user 1.37 cvs 2034: clicks on an element of that type, the parent of the element is 2035: selected instead of the element itself.</dd> 1.36 cvs 2036: <dt><code>ClickableSurface</code></dt> 2037: <dd>This exception can only be applied to element types. When the user 1.37 cvs 2038: clicks within a child of an element of that type, this child is 2039: selected even if it is a graphic leaf that is not filled.</dd> 1.51 quint 2040: <dt><tt>ParagraphBreak</tt></dt> 2041: <dd>This exception can only be applied to element types. When the caret 2042: is within an element of a type to which this exception is applied, it 2043: is that element that will be split when the user hits the Return 2044: key.</dd> 1.52 quint 2045: <dt><code>IsBreak</code></dt> 2046: <dd>This exception can only be applied to element types. When an element 2047: with this exception is selected, pressing the Return key breaks the 2048: enclosing element (typically a paragraph) into two pieces.</dd> 1.51 quint 2049: <dt><tt>ReturnCreateNL</tt></dt> 2050: <dd>This exception can only be applied to element types. When the caret 2051: is within an element of a type to which this exception is applied, the 2052: Return key simply inserts a New line character (code \212) at the 2053: current position. The Return key does not create a new element; it does 2054: not split the current element either.</dd> 2055: <dt><tt>ReturnCreateWithin</tt></dt> 2056: <dd>This exception can only be applied to element types. When the caret 2057: is within an element of a type to which this exception is applied, the 2058: Return key will create a new element within that element, not a sibling 2059: after that element.</dd> 2060: <dt><tt>NoBreakByReturn</tt></dt> 1.52 quint 2061: <dd>This exception can only be applied to element types. When the caret 2062: is in an empty element, child of an element of a type to which this 2063: exception is applied, the Return key will not split the element, but 2064: will create a new empty element after the current empty element.</dd> 1.51 quint 2065: <dt><tt>ImportLine</tt></dt> 2066: <dd>This exception can only be applied to element types. It indicates 2067: that elements of this type should receive the content of imported text 2068: files. An element is created for each line of the imported file. A 2069: structure schema cannot contain several exceptions <tt>ImportLine</tt> 2070: and, if it contains one, it should not contain any exception 2071: <tt>ImportParagraph</tt>.</dd> 2072: <dt><tt>ImportParagraph</tt></dt> 2073: <dd>This exception can only be applied to element types. It indicates 2074: that elements of this type should receive the content of imported text 2075: files. An element is created for each paragraph of the imported file. A 2076: paragraph is a sequence of lines without any empty line. A structure 2077: schema cannot contain several exceptions <tt>ImportParagraph</tt> and, 2078: if it contains one, it should not contain any exception 2079: <tt>ImportLine</tt>.</dd> 2080: <dt><tt>GraphCreation</tt></dt> 2081: <dd>@@@@</dd> 2082: <dt><tt>EmptyGraphic</tt></dt> 2083: <dd>@@@@</dd> 1.52 quint 2084: <dt><tt>IsDraw</tt>, <tt>IsGroup</tt>, <tt>IsTable</tt>, <tt>IsRow</tt>, 2085: <tt>IsColHead</tt>, <tt>IsCell</tt></dt> 1.37 cvs 2086: <dd>These exceptions can only be applied to element types. Elements of a 1.30 cvs 2087: type to which these exceptions are applied are identified as Draws, 2088: Tables, Colheads, Rows or Cells and specific processing are applied to 2089: them.</dd> 1.51 quint 2090: <dt><tt>ColRef</tt></dt> 1.30 cvs 2091: <dd>This exception can only be applied to attributes of the reference 2092: type. It indicates that this attribute refers to the column head (see 2093: exception IsColHead) which the element belongs to.</dd> 1.51 quint 2094: <dt><tt>ColSpan</tt>, <tt>RowSpan</tt></dt> 1.31 cvs 2095: <dd>These exceptions can only be applied to numeric attributes of cells. 1.30 cvs 2096: They indicate that attribute values give how many columns or rows the 2097: element spans.</dd> 1.51 quint 2098: <dt><tt>CssBackground</tt></dt> 2099: <dd>@@@@</dd> 2100: <dt><tt>CssClass</tt></dt> 2101: <dd>@@@@</dd> 2102: <dt><tt>CssId</tt></dt> 2103: <dd>@@@@</dd> 2104: <dt><tt>CssPseudoClass</tt></dt> 2105: <dd>@@@@</dd> 2106: <dt><tt>NoShowBox</tt></dt> 2107: <dd>@@@@</dd> 2108: <dt><tt>SetWindowBackground</tt></dt> 2109: <dd>@@@@</dd> 2110: <dt><tt>Shadow</tt></dt> 1.37 cvs 2111: <dd>This exception can only be applied to element types. Text of elements 1.30 cvs 2112: of a type to which this exception is applied are displayed and printed 2113: as a set of stars ('*').</dd> 1.51 quint 2114: <dt><tt>EventAttr</tt></dt> 2115: <dd>@@@@</dd> 2116: <dt><tt>SpacePreserve</tt></dt> 2117: <dd>@@@@</dd> 1.53 quint 2118: <dt><tt>IsPlaceholder</tt></dt> 2119: <dd>@@@@</dd> 1.54 quint 2120: <dt><tt>StartCounter</tt></dt> 2121: <dd>@@@@</dd> 2122: <dt><tt>SetCounter</tt></dt> 2123: <dd>@@@@</dd> 1.18 cvs 2124: </dl> 1.30 cvs 2125: 1.18 cvs 2126: <blockquote class="example"> 1.30 cvs 2127: <p><strong>Example:</strong></p> 2128: 2129: <p>Consider a structure schema for object-style graphics which defines the 2130: Graphic_object element type with the associated Height and Weight numeric 1.37 cvs 2131: attributes. Suppose that we want documents of this class to have the 1.30 cvs 2132: following qualities:</p> 2133: <ul> 2134: <li>Whenever the width or height of an object is changed using the mouse, 2135: the new values are stored in the object's Width and Height 2136: attributes.</li> 2137: <li>The user should not be able to change the values of the Width and 2138: Height attributes via the Attributes menu of the Thot editor.</li> 2139: </ul> 2140: 2141: <p>The following exceptions will produce this effect.</p> 2142: <pre>STRUCT 1.1 cvs 2143: ... 1.5 cvs 2144: Graphics_object (ATTR Height = Integer; Width = Integer) 1.1 cvs 2145: = GRAPHICS with Height ?= 10, Width ?= 10; 2146: ... 2147: EXCEPT 2148: Height: NewHeight, Invisible; 1.18 cvs 2149: Width: NewWidth, Invisible;</pre> 2150: </blockquote> 2151: </div> 2152: </div> 1.1 cvs 2153: 1.18 cvs 2154: <div class="section"> 1.37 cvs 2155: <h2><a name="sectb33" id="sectb33">Some examples</a></h2> 1.1 cvs 2156: 1.30 cvs 2157: <p>In order to illustrate the principles of the document model and the syntax 2158: of the S language, this section presents two examples of structure schemas. 2159: One defines a class of documents, the other defines a class of objects.</p> 1.1 cvs 2160: 1.18 cvs 2161: <div class="subsection"> 1.37 cvs 2162: <h3><a name="sectc331" id="sectc331">A class of documents: articles</a></h3> 1.1 cvs 2163: 1.30 cvs 2164: <p>This example shows a possible structure for articles published in a 2165: journal. Text between braces is comments.</p> 1.18 cvs 2166: <pre>STRUCTURE Article; { This schema defines the Article class } 1.1 cvs 2167: DEFPRES ArticleP; { The default presentation schema is 2168: ArticleP } 2169: ATTR { Global attribute definitions } 2170: WordType = Definition, IndexWord, DocumentTitle; 2171: { A single global attribute is defined, with three values } 2172: STRUCT { Definition of the generic structure } 2173: Article = BEGIN { The Article class has an aggregate 2174: structure } 2175: Title = BEGIN { The title is an aggregate } 2176: French_title = 2177: Text WITH Language='Fran\347ais'; 2178: English_title = 2179: Text WITH Language='English'; 2180: END; 2181: Authors = 2182: LIST OF (Author 2183: (ATTR Author_type=principal,secondary) 2184: { The Author type has a local attribute } 2185: = BEGIN 2186: Author_name = Text; 2187: Info = Paragraphs ; 2188: { Paragraphs is defined later } 2189: Address = Text; 2190: END 2191: ); 2192: Keywords = Text; 2193: { The journal's editor introduces the article 2194: with a short introduction, in French and 2195: in English } 2196: Introduction = 2197: BEGIN 2198: French_intr = Paragraphs WITH 2199: Language='Fran\347ais'; 2200: English_intr = Paragraphs WITH 2201: Language='English'; 2202: END; 2203: Body = Sections; { Sections are defined later } 2204: { Appendixes are only created on demand } 2205: ? Appendices = 2206: LIST OF (Appendix = 2207: BEGIN 2208: Appendix_Title = Text; 2209: Appendix_Contents = Paragraphs; 2210: END 2211: ); 1.37 cvs 2212: ? Figures = LIST OF (Figure); 2213: ? Bibliography = LIST OF (Biblio_citation); 2214: ? Notes = LIST OF (Note); 1.1 cvs 2215: END; { End of the Article aggregate } 2216: 2217: Sections = LIST [2..*] OF ( 2218: Section = { At least 2 sections } 2219: BEGIN 2220: Section_title = Text; 2221: Section_contents = 2222: BEGIN 2223: Paragraphs; 2224: Sections; { Sections at a lower level } 2225: END; 2226: END 2227: ); 2228: 2229: Paragraphs = LIST OF (Paragraph = CASE OF 2230: Enumeration = 2231: LIST [2..*] OF 2232: (Item = Paragraphs); 2233: Isolated_formula = Formula; 2234: LIST OF (UNIT); 2235: END 2236: ); 2237: 2238: Figure = BEGIN 1.5 cvs 2239: Figure_caption = Text; 1.1 cvs 2240: Illustration = NATURE; 2241: END; 2242: 2243: Biblio_citation = CASE OF 2244: Ref_Article = 2245: BEGIN 2246: Authors_Bib = Text; 2247: Article_Title = Text; 2248: Journal = Text; 2249: Page_Numbers = Text; 2250: Date = Text; 2251: END; 2252: Ref_Livre = 2253: BEGIN 2254: Authors_Bib; { Defined above } 2255: Book_Title = Text; 2256: Editor = Text; 2257: Date; { Defined above } 2258: END; 2259: END; 2260: 2261: Note = Paragraphs - (Ref_note); 2262: 2263: UNITS { Elements which can be used in objects } 2264: 2265: Ref_note = REFERENCE (Note); 2266: Ref_biblio = REFERENCE (Biblio_citation); 2267: Ref_figure = REFERENCE (Figure); 2268: Ref_formula = REFERENCE (Isolated_formula); 2269: 2270: EXPORT { Skeleton elements } 2271: 2272: Title, 1.5 cvs 2273: Figure with Figure_caption, 1.1 cvs 2274: Section With Section_title; 2275: 1.18 cvs 2276: END { End of the structure schema }</pre> 1.30 cvs 2277: 2278: <p>This schema is very complete since it defines both paragraphs and 1.37 cvs 2279: bibliographic citations. These element types could just as well be defined in 2280: other structure schemas, as is the case with the <tt>Formula</tt> class. All 2281: sorts of other elements can be inserted into an article, since a paragraph 2282: can contain any type of unit. Similarly, figures can be any class of document 2283: or object that the user chooses.</p> 2284: 2285: <p>Generally, an article doesn't contain appendices, but it is possible to 2286: add them on explicit request: this is the effect of the question mark before 2287: the word Appendices.</p> 1.30 cvs 2288: 1.37 cvs 2289: <p>Various types of cross-references can be put in paragraphs. They can also 1.30 cvs 2290: be placed the objects which are part of the article, since the 2291: cross-references are defined as units (<tt>UNITS</tt>).</p> 2292: 2293: <p>There is a single restriction to prevent the creation of Ref_note elements 1.18 cvs 2294: within notes.</p> 1.30 cvs 2295: 2296: <p>It is worth noting that the S language permits the definition of recursive 1.37 cvs 2297: structures like sections: a section can contain other sections (which are 2298: thus at the next lower level of the document tree). Paragraphs are also 2299: recursive elements, since a paragraph can contain an enumeration in which 2300: each element (<tt>Item</tt>) is composed of paragraphs.</p> 1.18 cvs 2301: </div> 1.1 cvs 2302: 1.18 cvs 2303: <div class="subsection"> 1.37 cvs 2304: <h3><a name="sectc332" id="sectc332">A class of objects: mathematical 2305: formulas</a></h3> 1.1 cvs 2306: 1.30 cvs 2307: <p>The example below defines the <tt>Formula</tt> class which is used in 1.37 cvs 2308: Article documents. This class represents mathematical formulas with a rather 1.30 cvs 2309: simple structure, but sufficient to produce a correct rendition on the screen 1.37 cvs 2310: or printer. To support more elaborate operations (formal or numeric 2311: calculations), a finer structure should be defined. This class doesn't use 2312: any other class and doesn't define any units.</p> 1.18 cvs 2313: <pre>STRUCTURE Formula; 1.1 cvs 2314: DEFPRES FormulaP; 2315: 2316: ATTR 2317: String_type = Function_name, Variable_name; 2318: 2319: STRUCT 2320: Formula = Expression; 2321: Expression = LIST OF (Construction); 2322: Construction = CASE OF 2323: TEXT; { Simple character string } 2324: Index = Expression; 2325: Exponent = Expression; 2326: Fraction = 2327: BEGIN 1.6 cvs 2328: Numerator = Expression; 1.1 cvs 2329: Denominator = Expression; 2330: END; 2331: Root = 2332: BEGIN 2333: ? Order = TEXT; 2334: Root_Contents = Expression; 2335: END; 2336: Integral = 2337: BEGIN 2338: Integration_Symbol = SYMBOL; 2339: Lower_Bound = Expression; 2340: Upper_Bound = Expression; 2341: END; 2342: Triple = 2343: BEGIN 2344: Princ_Expression = Expression; 2345: Lower_Expression = Expression; 2346: Upper_Expression = Expression; 2347: END; 2348: Column = LIST [2..*] OF 2349: (Element = Expression); 2350: Parentheses_Block = 2351: BEGIN 2352: Opening = SYMBOL; 2353: Contents = Expression; 2354: Closing = SYMBOL; 2355: END; 2356: END; { End of Choice Constructor } 1.18 cvs 2357: END { End of Structure Schema }</pre> 1.30 cvs 2358: 2359: <p>This schema defines a single global attribute which allows functions and 1.37 cvs 2360: variables to be distinguished. In the presentation schema, this attribute can 1.1 cvs 2361: be used to choose between roman (for functions) and italic characters (for 1.18 cvs 2362: variables).</p> 1.30 cvs 2363: 1.37 cvs 2364: <p>A formula's structure is that of a mathematical expression, which is 2365: itself a sequence of mathematical constructions. A mathematical construction 2366: can be either a simple character string, an index, an exponent, a fraction, a 2367: root, etc. Each of these mathematical constructions has a sensible structure 2368: which generally includes one or more expressions, thus making the formula 2369: class's structure definition recursive.</p> 1.30 cvs 2370: 2371: <p>In most cases, the roots which appear in the formulas are square roots and 1.37 cvs 2372: their order (2) is not specified. This is why the Order component is marked 2373: optional by a question mark. When explicitly requested, it is possible to add 1.18 cvs 2374: an order to a root, for example for cube roots (order = 3).</p> 1.30 cvs 2375: 2376: <p>An integral is formed by an integration symbol, chosen by the user (simple 1.37 cvs 2377: integral, double, curvilinear, etc.), and two bounds. A more fine-grained 1.1 cvs 2378: schema would add components for the integrand and the integration variable. 1.37 cvs 2379: Similarly, the Block_Parentheses construction leaves the choice of opening 2380: and closing symbols to the user. They can be brackets, braces, parentheses, 1.18 cvs 2381: etc.</p> 2382: </div> 2383: </div> 1.37 cvs 2384: <hr /> 1.18 cvs 2385: </div> 1.1 cvs 2386: 1.18 cvs 2387: <div class="chapter"> 1.37 cvs 2388: <h1><a name="sect4" id="sect4">The P Language</a></h1> 1.1 cvs 2389: 1.18 cvs 2390: <div class="section"> 1.37 cvs 2391: <h2><a name="sectb41" id="sectb41">Document presentation</a></h2> 1.1 cvs 2392: 1.30 cvs 2393: <p>Because of the model adopted for Thot, the presentation of documents is 1.37 cvs 2394: clearly separated from their structure and content. After having presented 1.1 cvs 2395: the logical structure of documents, we now detail the principles implemented 1.37 cvs 2396: for their presentation. The concept of <em>presentation</em> encompasses what 2397: is often called the page layout, the composition, or the document style. It 1.18 cvs 2398: is the set of operations which display the document on the screen or print it 1.37 cvs 2399: on paper. Like logical structure, document presentation is defined 1.18 cvs 2400: generically with the help of a language, called P.</p> 1.1 cvs 2401: 1.18 cvs 2402: <div class="subsection"> 1.37 cvs 2403: <h3><a name="sectc411" id="sectc411">Two levels of presentation</a></h3> 1.1 cvs 2404: 1.30 cvs 2405: <p>The link between structure and presentation is clear: the logical 2406: organization of a document is used to carry out its presentation, since the 2407: purpose of the presentation is to make evident the organization of the 1.37 cvs 2408: document. But the presentation is equally dependent on the device used to 1.30 cvs 2409: render the document. Certain presentation effects, notably changes of font or 1.37 cvs 2410: character set, cannot be performed on all printers or on all screens. This is 1.30 cvs 2411: why Thot uses a two-level approach, where the presentation is first described 2412: in abstract terms, without taking into account each particular device, and 2413: then the presentation is realized within the constraints of a given 2414: device.</p> 2415: 2416: <p>Thus, presentation is only described as a function of the structure of the 1.37 cvs 2417: documents and the image that would be produced on an idealized device. For 1.1 cvs 2418: this reason, presentation descriptions do not refer to any device 1.18 cvs 2419: characteristics: they describe <em>abstract presentations</em> which can be 2420: concretized on different devices.</p> 1.30 cvs 2421: 2422: <p>A presentation description also defines a <em>generic presentation</em>, 2423: since it describes the appearance of a class of documents or objects. This 2424: generic presentation must also be applied to document and object instances, 2425: each conforming to its generic logical structure, but with all the allowances 2426: that were called to mind above: missing elements, constructed elements with 2427: other logical structures, etc.</p> 2428: 2429: <p>In order to preserve the homogeneity between documents and objects, 1.1 cvs 2430: presentation is described with a single set of tools which support the layout 2431: of a large document as well as the composition of objects like a graphical 1.37 cvs 2432: figure or mathematical formula. This unity of presentation description tools 1.1 cvs 2433: contrasts with the traditional approach, which focuses more on documents than 2434: objects and thus is based on the usual typographic conventions, such as the 2435: placement of margins, indentations, vertical spaces, line lengths, 1.18 cvs 2436: justification, font changes, etc.</p> 2437: </div> 1.1 cvs 2438: 1.18 cvs 2439: <div class="subsection"> 1.37 cvs 2440: <h3><a name="sectc412" id="sectc412">Boxes</a></h3> 1.1 cvs 2441: 1.37 cvs 2442: <p>To assure the homogeneity of tools, all presentation in Thot, for 2443: documents as well as for the objects which they contain, is based on the 2444: notion of the <em>box</em>, such as was implemented in 2445: T<sub><big>E</big></sub>X.</p> 1.30 cvs 2446: 1.37 cvs 2447: <p>Corresponding to each element of the document is a box, which is the 1.1 cvs 2448: rectangle enclosing the element on the display device (screen or sheet of 1.37 cvs 2449: paper); the outline of this rectangle is not visible, except when a <a 2450: href="#sectc4230a"><tt>ShowBox</tt> rule</a> applies to the element. The 2451: sides of the box are parallel to the sides of the screen or the sheet of 2452: paper. By way of example, a box is associated with a character string, a line 2453: of text, a page, a paragraph, a title, a mathematical formula, or a table 2454: cell.</p> 1.30 cvs 2455: 2456: <p>Whatever element it corresponds to, each box possesses four sides and four 1.18 cvs 2457: axes, which we designate as follows (<a href="#boxes">see figure</a>):</p> 2458: <dl> 1.30 cvs 2459: <dt><tt>Top</tt></dt> 2460: <dd>the upper side,</dd> 2461: <dt><tt>Bottom</tt></dt> 2462: <dd>the lower side,</dd> 2463: <dt><tt>Left</tt></dt> 2464: <dd>the left side,</dd> 2465: <dt><tt>Right</tt></dt> 2466: <dd>the right side,</dd> 2467: <dt><tt>VMiddle</tt></dt> 2468: <dd>the vertical axis passing through the center of the box,</dd> 2469: <dt><tt>HMiddle</tt></dt> 2470: <dd>the horizontal axis passing through the center of the box,</dd> 2471: <dt><tt>VRef</tt></dt> 2472: <dd>the vertical reference axis,</dd> 2473: <dt><tt>HRef</tt></dt> 2474: <dd>the horizontal reference axis.</dd> 1.18 cvs 2475: </dl> 2476: 2477: <div class="figure"> 1.37 cvs 2478: <hr /> 1.18 cvs 2479: <pre> Left VRef VMiddle Right 1.1 cvs 2480: : : 2481: Top ----------------------------- 2482: | : : | 2483: | : : | 2484: | : : | 2485: | : : | 2486: | : : | 2487: HMiddle ..|...........................|.. 2488: | : : | 2489: | : : | 2490: HRef ..|...........................|.. 2491: | : : | 2492: | : : | 2493: Bottom ----------------------------- 1.18 cvs 2494: : :</pre> 1.30 cvs 2495: 1.37 cvs 2496: <p align="center"><em><a name="boxes" id="boxes">The sides and axes of 1.30 cvs 2497: boxes</a><em></em></em></p> 1.37 cvs 2498: <hr /> 1.30 cvs 2499: </div> 1.19 cvs 2500: 1.37 cvs 2501: <p>The principal role of boxes is to set the extent and position of the 2502: images of the different elements of a document with respect to each other on 2503: the reproduction device. This is done by defining relations between the boxes 2504: of different elements which give relative extents and positions to these 1.18 cvs 2505: boxes.</p> 1.30 cvs 2506: 2507: <p>There are three types of boxes:</p> 1.18 cvs 2508: <ul> 1.30 cvs 2509: <li>boxes corresponding to structural elements of the document,</li> 2510: <li>presentation boxes,</li> 2511: <li>page layout boxes.</li> 1.18 cvs 2512: </ul> 1.30 cvs 2513: 1.37 cvs 2514: <p><strong>Boxes corresponding to structural elements of the 2515: document</strong> are those which linked to each of the elements (base or 2516: structured) of the logical structure of the document. Such a box contains all 2517: the contents of the element to which it corresponds (there is an exception: 2518: see <a href="#sectc4220">rules <tt>VertOverflow</tt> and 2519: <tt>HorizOverflow</tt></a>). These boxes form a tree-like structure, 2520: identical to that of the structural elements to which they correspond. This 2521: tree expresses the inclusion relationships between the boxes: a box includes 2522: all the boxes of its subtree. On the other hand, there are no predefined 2523: rules for the relative positions of the included boxes. If they are at the 2524: same level, they can overlap, be contiguous, or be disjoint. The rules 2525: expressed in the generic presentation specify their relative positions.</p> 1.30 cvs 2526: 2527: <p><strong>Presentation boxes</strong> represent elements which are not found 1.37 cvs 2528: in the logical structure of the document but which are added to meet the 2529: needs of presentation. These boxes are linked to the elements of the logical 1.30 cvs 2530: structure that are best suited to bringing them out. For example, they are 2531: used to add the character string ``Summary:'' before the summary in the 2532: presentation of a report or to represent the fraction bar in a formula, or 1.37 cvs 2533: also to make the title of a field in a form appear. These elements have no 1.30 cvs 2534: role in the logical structure of the document: the presence of a Summary 2535: element in the document does not require the creation of another structural 1.37 cvs 2536: object to hold the word ``Summary''. Similarly, if a Fraction element 2537: contains both a Numerator element and a Denominator element, the fraction bar 2538: has no purpose structurally. On the other hand, these elements of the 2539: presentation are important for the reader of the reproduced document or for 2540: the user of an editor. This is why they must appear in the document's image. 2541: It is the generic presentation which specifies the presentation boxes to add 2542: by indicating their content (a base element for which the value is specified) 2543: and the position that they must take in the tree of boxes. During editing, 2544: these boxes cannot be modified by the user.</p> 2545: 2546: <p><strong>Page layout boxes</strong> are boxes created implicitly by the 2547: page layout rules. These rules indicate how the contents of a structured 2548: element must be broken into lines and pages. In contrast to presentation 2549: boxes, these line and page boxes do not depend on the logical structure of 2550: the document, but rather on the physical constraints of the output devices: 2551: character size, height and width of the window on the screen or of the sheet 2552: of paper.</p> 1.18 cvs 2553: </div> 1.1 cvs 2554: 1.18 cvs 2555: <div class="subsection"> 1.37 cvs 2556: <h3><a name="sectc413" id="sectc413">Views and visibility</a></h3> 1.1 cvs 2557: 1.30 cvs 2558: <p>One of the operations that one might wish to perform on a document is to 1.37 cvs 2559: view it is different ways. For this reason, it is possible to define several 1.18 cvs 2560: <em>views</em> for the same document, or better yet, for all documents of the 1.37 cvs 2561: same class. A view is not a different presentation of the document, but 1.1 cvs 2562: rather a filter which only allows the display of certain parts of the 1.37 cvs 2563: document. For example, it might be desirable to see only the titles of 1.1 cvs 2564: chapters and sections in order to be able to move rapidly through the 1.37 cvs 2565: document. Such a view could be called a ``table of contents''. It might also 1.1 cvs 2566: be desirable to see only the mathematical formulas of a document in order to 1.37 cvs 2567: avoid being distracted by the non-mathematical aspects of the document. A 1.18 cvs 2568: ``mathematics'' view could provide this service.</p> 1.30 cvs 2569: 2570: <p>Views, like presentation, are based on the generic logical structure. Each 1.1 cvs 2571: document class, and each generic presentation, can be provided with views 1.37 cvs 2572: which are particularly useful for that class or presentation. For each view, 1.18 cvs 2573: the <em>visibility</em> of elements is defined, indicated whether or not the 1.37 cvs 2574: elements must be presented to the user. The visibility is calculated as a 1.1 cvs 2575: function of the type of the elements or their hierarchical position in the 1.37 cvs 2576: structure of the document. Thus, for a table of contents, all the ``Chapter 2577: Title'' and ``Section Title'' elements are made visible. However, the 1.1 cvs 2578: hierarchical level could be used to make the section titles invisible below a 1.37 cvs 2579: certain threshold level. By varying this threshold, the granularity of the 2580: view can be varied. In the ``mathematics'' view, only Formula elements would 1.18 cvs 2581: be made visible, no matter what their hierarchical level.</p> 1.30 cvs 2582: 2583: <p>Because views are especially useful for producing a synthetic image of the 1.1 cvs 2584: document, it is necessary to adapt the presentation of the elements to the 1.37 cvs 2585: view in which they appear. For example, it is inappropriate to have a page 2586: break before every chapter title in the table of contents. Thus, generic 1.1 cvs 2587: presentations take into account the possible views and permit each element 1.18 cvs 2588: type's presentation to vary according the view in which its image appears.</p> 2589: </div> 1.1 cvs 2590: 1.18 cvs 2591: <div class="subsection"> 1.37 cvs 2592: <h3><a name="sectc414" id="sectc414">Pages</a></h3> 1.1 cvs 2593: 1.30 cvs 2594: <p>Presentation schemas can be defined which display the document as a long 1.37 cvs 2595: scroll, without page breaks. This type of schema is particularly well-suited 1.1 cvs 2596: to the initial phase of work on a document, where jumps from page to page 1.37 cvs 2597: would hinder composing and reading the document on a screen. But, once the 2598: document is written, it may be desirable to display the document on the 2599: screen in the same manner in which it will be printed. So, the presentation 2600: schema must define pages.</p> 2601: 2602: <p>The P language permits the specification of the dimensions of pages as 2603: well as their composition. It is possible to generate running titles, page 2604: numbers, zones at the bottom of the page for notes, etc. The editor follows 1.30 cvs 2605: this model and inserts page break marks in the document which are used during 2606: printing, insuring that the pages on paper are the same as on the screen.</p> 2607: 2608: <p>Once a document has been edited with a presentation schema defining pages, 1.37 cvs 2609: it contains page marks. But it is always possible to edit the document using 2610: a schema without pages. In this case, the page marks are simply ignored by 2611: the editor. They are considered again as soon as a schema with pages is used. 1.18 cvs 2612: Thus, the user is free to choose between schemas with and without pages.</p> 1.30 cvs 2613: 2614: <p>Thot treats the page break, rather than the page itself, as a box. This 2615: page break box contains all the elements of one page's footer, a rule marking 1.37 cvs 2616: the edge of this page, and all the elements of the next page's header. The 2617: elements of the header and footer can be running titles, page number, notes, 2618: etc. All these elements, as well as their content and graphical appearance, 2619: are defined by the generic presentation.</p> 1.18 cvs 2620: </div> 1.1 cvs 2621: 1.18 cvs 2622: <div class="subsection"> 1.37 cvs 2623: <h3><a name="sectc415" id="sectc415">Numbering</a></h3> 1.1 cvs 2624: 1.30 cvs 2625: <p>Many elements are numbered in documents: pages, chapters, sections, 2626: formulas, theorems, notes, figures, bibliographic references, exercises, 1.37 cvs 2627: examples, lemmas, etc. Because Thot has a notion of logical structure, all of 1.30 cvs 2628: these numbers (with the exception of pages) are redundant with information 1.37 cvs 2629: implicit in the logical structure of the document. Such numbers are simply a 2630: way to make the structure of the document more visible. So, they are part of 1.30 cvs 2631: the document's presentation and are calculated by the editor from the logical 1.37 cvs 2632: structure. The structure does not contain numbers as such; it only defines 1.1 cvs 2633: relative structural positions between elements, which serve as ordering 1.18 cvs 2634: relations on these elements.</p> 1.30 cvs 2635: 2636: <p>If the structure schema defines the body of a document as a sequence of at 1.18 cvs 2637: least two chapters:</p> 2638: <pre>Body = LIST [2..*] OF Chapter;</pre> 1.30 cvs 2639: 2640: <p>the sequence defined by the list constructor is ordered and each chapter 1.37 cvs 2641: can be assigned a number based on its rank in the Body list. Therefore, all 2642: elements contained in lists a the structure of a document can be numbered, 2643: but they are not the only ones. The tree structure induced by the aggregate, 1.18 cvs 2644: list, and choice constructors (excluding references) defines a total order on 1.37 cvs 2645: the elements of the document's primary structure. So, it is possible to 1.18 cvs 2646: define a numbering which uses this order, filtering elements according to 2647: their type so that only certain element types are taken into account in the 1.37 cvs 2648: numbering. In this way, it possible to number all the theorems and lemmas of 1.18 cvs 2649: a chapter in the same sequence of numbers, even when they are not part of the 2650: same list constructor and appear at different levels of the document's tree. 2651: By changing the filter, they can be numbered separately: one sequence of 2652: numbers for theorems, another for the lemmas.</p> 1.30 cvs 2653: 2654: <p>Since they are calculated from the document's logical structure and only 2655: for the needs of the presentation, numbers are presentation elements, 2656: described by presentation boxes, just like the fraction bar or the word 1.37 cvs 2657: ``Summary''. Nevertheless, numbers differ from these other boxes because 2658: their content varies from instance to instance, even though they are of the 2659: same type, whereas all fraction bars are horizontal lines and the same word 1.30 cvs 2660: ``Summary'' appears at the head of every document's summary.</p> 1.18 cvs 2661: </div> 1.1 cvs 2662: 1.18 cvs 2663: <div class="subsection"> 1.37 cvs 2664: <h3><a name="sectc416" id="sectc416">Presentation properties</a></h3> 1.1 cvs 2665: 1.34 cvs 2666: <p>The principal properties which determine document presentation are the 1.18 cvs 2667: <em>positions</em> and <em>dimensions</em> of boxes, the <em>font</em>, the 2668: <em>style</em>, the <em>size</em>, the <em>underlining</em> and the 1.37 cvs 2669: <em>color</em> of their content. From these properties, and some others of 1.34 cvs 2670: less importance, it is possible to represent the usual typographic properties 1.37 cvs 2671: for the textual parts of the document. These same properties can be used to 1.1 cvs 2672: describe the geometry of the non-textual elements, even though they are 1.18 cvs 2673: two-dimensional elements unlike the text, which is linear.</p> 1.30 cvs 2674: 1.37 cvs 2675: <p>As we have already seen, the positions of the boxes always respect the 1.30 cvs 2676: rule of enclosure: a box in the tree encloses all the boxes of the next lower 1.37 cvs 2677: level which are attached to it. The positional properties permit the 1.30 cvs 2678: specification of the position of each box in relation to the enclosing box or 1.37 cvs 2679: to its sibling boxes (boxes directly attached to the same enclosing box in 2680: the tree of boxes).</p> 1.30 cvs 2681: 1.37 cvs 2682: <p>The presentation properties also provide control over the dimensions of 2683: the boxes. The dimensions of a box can depend either on its content or on its 1.1 cvs 2684: context (its sibling boxes and the enclosing box). Each dimension (height or 1.18 cvs 2685: width) can be defined independently of the other.</p> 1.30 cvs 2686: 1.34 cvs 2687: <p>Because of the position and dimension properties, it is possible to do the 1.1 cvs 2688: same things that are normally done in typography by changing margins, line 1.37 cvs 2689: lengths, and vertical or horizontal skips. This approach can also align or 1.18 cvs 2690: center elements and groups of elements.</p> 1.30 cvs 2691: 1.34 cvs 2692: <p>In contrast to the position and dimension properties, the font, style, 1.30 cvs 2693: size, underlining, and color do not concern the box itself (the rectangle 1.37 cvs 2694: delimiting the element), but its content. These properties indicate the 2695: typographic attributes which must be applied to the text contained in the 2696: box, and by extension, to all base elements.</p> 1.30 cvs 2697: 1.34 cvs 2698: <p>For text, the font property is used to change the family of characters 1.1 cvs 2699: (Times, Helvetica, Courier, etc.); the style is used to obtain italic or 1.37 cvs 2700: roman, bold or light characters; the size determines the point size of the 1.1 cvs 2701: characters; underlining defines the type and thickness of the lines drawn 1.18 cvs 2702: above, below, or through the characters.</p> 1.30 cvs 2703: 1.34 cvs 2704: <p>For graphics, the line style property can be either solid, dotted, or 2705: dashed; the line thickness property controls the width of the lines; the fill 2706: pattern property determines how closed geometric figures must be filled.</p> 1.30 cvs 2707: 1.34 cvs 2708: <p>While some of the properties which determine the appearance of a box's 1.1 cvs 2709: contents make sense only for one content type (text or graphic), other 1.34 cvs 2710: properties apply to all content types: these are the color properties. These 1.18 cvs 2711: indicate the color of lines and the background color.</p> 2712: </div> 2713: </div> 1.1 cvs 2714: 1.18 cvs 2715: <div class="section"> 1.37 cvs 2716: <h2><a name="sectb42" id="sectb42">Presentation description language</a></h2> 1.30 cvs 2717: 1.34 cvs 2718: <p>A generic presentation defines the values of presentation properties (or 1.37 cvs 2719: the way to calculate those values) for a generic structure, or more 2720: precisely, for all the element types and all the global and local attributes 2721: defined in that generic structure. This definition of the presentation 2722: properties is made with the P language. A program written in this language, 2723: that is a generic presentation expressed in P, is call a <em>presentation 2724: schema</em>. This section describes the syntax and semantics of the language, 2725: using the same <a href="#sectc321">meta-language</a> as was used for the 2726: definition of the S language.</p> 2727: 2728: <p>Recall that it is possible to write many different presentation schemas 2729: for the same class of documents or objects. This allows users to choose for a 2730: document the graphical appearance which best suits their type of work or 1.18 cvs 2731: their personal taste.</p> 1.1 cvs 2732: 1.18 cvs 2733: <div class="subsection"> 1.37 cvs 2734: <h3><a name="sectc421" id="sectc421">The organization of a presentation 2735: schema</a></h3> 1.1 cvs 2736: 1.30 cvs 2737: <p>A presentation schema begins with the word <tt>PRESENTATION</tt> and ends 1.37 cvs 2738: with the word <tt>END</tt>. The word <tt>PRESENTATION</tt> is followed by the 2739: name of the generic structure to which the presentation will be applied. This 1.30 cvs 2740: name must be the same as that which follows the keyword <tt>STRUCTURE</tt> in 2741: the structure schema associated with the presentation schema.</p> 2742: 1.37 cvs 2743: <p>After this declaration of the name of the structure, the following 2744: sections appear (in order):</p> 1.18 cvs 2745: <ul> 1.52 quint 2746: <li>Declarations of 1.30 cvs 2747: <ul> 2748: <li>all views,</li> 2749: <li>printed views,</li> 2750: <li>counters,</li> 2751: <li>presentation constants,</li> 2752: <li>variables,</li> 2753: </ul> 2754: </li> 2755: <li>default presentation rules,</li> 2756: <li>presentation box and page layout box definitions,</li> 2757: <li>presentation rules for structured elements,</li> 2758: <li>presentation rules for attributes,</li> 2759: <li>rules for transmitting values to attributes of included documents.</li> 1.18 cvs 2760: </ul> 1.30 cvs 2761: 2762: <p>Each of these sections is introduced by a keyword which is followed by a 1.37 cvs 2763: sequence of declarations. Every section is optional.</p> 1.18 cvs 2764: <pre> SchemaPres ='PRESENTATION' ElemID ';' 1.1 cvs 2765: [ 'VIEWS' ViewSeq ] 2766: [ 'PRINT' PrintViewSeq ] 2767: [ 'COUNTERS' CounterSeq ] 2768: [ 'CONST' ConstSeq ] 2769: [ 'VAR' VarSeq ] 2770: [ 'DEFAULT' ViewRuleSeq ] 2771: [ 'BOXES' BoxSeq ] 2772: [ 'RULES' PresentSeq ] 2773: [ 'ATTRIBUTES' PresAttrSeq ] 2774: [ 'TRANSMIT' TransmitSeq ] 2775: 'END' . 1.18 cvs 2776: ElemID = NAME .</pre> 2777: </div> 1.1 cvs 2778: 1.18 cvs 2779: <div class="subsection"> 1.37 cvs 2780: <h3><a name="sectc422" id="sectc422">Views</a></h3> 1.1 cvs 2781: 1.37 cvs 2782: <p>Each of the possible views must be declared in the presentation schema. As 2783: has <a href="#views">already been described</a>, the presentation rules for 2784: an element type can vary according to the view in which the element appears. 2785: The name of the view is used to designate the view to which the presentation 2786: rules apply (see the <a href="#inkeyword"><tt>IN</tt> instruction</a>). The 1.1 cvs 2787: definition of the view's contents are dispersed throughout the presentation 1.37 cvs 2788: rules attached to the different element types and attributes. The 1.18 cvs 2789: <tt>VIEWS</tt> section is simply a sequence of view names separated by commas 2790: and terminated by a semi-colon.</p> 1.30 cvs 2791: 2792: <p>One of the view names (and only one) can be followed by the keyword 1.37 cvs 2793: <tt>EXPORT</tt>. This keyword identifies the view which presents the members 2794: of the document class in <a href="#sectc3213">skeleton form</a>. The 2795: graphical appearance and the content of this view is defined just as with 1.18 cvs 2796: other views, but it is useless to specify presentation rules concerning this 2797: view for the elements which are not loaded in the skeleton form.</p> 1.30 cvs 2798: 2799: <p>It is not necessary to declare any views; in this case there is a single 1.37 cvs 2800: unnamed view. If many views are declared, the first view listed is considered 2801: the principal view. The principal view is the one to which all rules that are 1.18 cvs 2802: not preceded by an indication of a view will apply (see the <a 2803: href="#inkeyword">instruction <tt>IN</tt></a>).</p> 1.30 cvs 2804: 2805: <p>The principal view is the the one which the editor presents on the screen 1.37 cvs 2806: when the user asks to create or edit a document. Thus, it makes sense to put 2807: the most frequently used view at the head of the list. But if the structure 1.18 cvs 2808: schema contains <a href="#sectc3213">skeleton elements</a> and is loaded in 2809: its skeleton form, the view whose name is followed by the keyword 2810: <tt>EXPORT</tt> will be opened and no other views can be opened.</p> 2811: <pre> 'VIEWS' ViewSeq 1.1 cvs 2812: ViewSeq = ViewDeclaration 1.30 cvs 2813: < ',' ViewDeclaration > ';' . 1.1 cvs 2814: ViewDeclaration = ViewID [ 'EXPORT' ] . 1.18 cvs 2815: ViewID = NAME .</pre> 1.30 cvs 2816: 1.18 cvs 2817: <blockquote class="example"> 1.30 cvs 2818: <p><strong>Example:</strong></p> 2819: 2820: <p>When editing a report, it might be useful have views of the table of 1.37 cvs 2821: contents and of the mathematical formulas, in addition to the principal 2822: view which shows the document in its entirety. To achieve this, a 2823: presentation schema for the Report class would have the following 2824: <tt>VIEWS</tt> section:</p> 1.30 cvs 2825: <pre>VIEWS 1.18 cvs 2826: Full_text, Table_of_contents, Formulas;</pre> 1.30 cvs 2827: 2828: <p>The contents of these views are specified in the presentation rules of 2829: the schema.</p> 1.18 cvs 2830: </blockquote> 2831: </div> 1.1 cvs 2832: 1.18 cvs 2833: <div class="subsection"> 1.37 cvs 2834: <h3><a name="sectc423" id="sectc423">Print Views</a></h3> 1.1 cvs 2835: 1.37 cvs 2836: <p>When editing a document, each view specified by the <tt>VIEWS</tt> 2837: instruction is presented in a different window.</p> 1.30 cvs 2838: 2839: <p>When printing a document, it is possible to print any number of views, 1.37 cvs 2840: chosen from among all the views which the editor can display. Print views, as 2841: well as the order in which they must be printed, are indicated by the 2842: <tt>PRINT</tt> instruction. It appears after the <tt>VIEWS</tt> instruction 2843: and is formed of the keyword <tt>PRINT</tt> followed by the ordered list of 2844: print view names. The print view names are separated by commas and followed 2845: by a semi-colon. A print view name is a view name declared in the 2846: <tt>VIEWS</tt> instruction.</p> 1.18 cvs 2847: <pre> 'PRINT' PrintViewSeq 1.30 cvs 2848: PrintViewSeq = PrintView < ',' PrintView > ';' . 1.37 cvs 2849: PrintView = ViewID .</pre> 1.30 cvs 2850: 2851: <p>If the <tt>PRINT</tt> instruction is absent, the printing program will 2852: print only the principal view (the first view specified by the <tt>VIEWS</tt> 1.18 cvs 2853: instruction or the single, unnamed view when there is no <tt>VIEWS</tt> 2854: instruction).</p> 1.30 cvs 2855: 1.18 cvs 2856: <blockquote class="example"> 1.30 cvs 2857: <p><strong>Example:</strong></p> 2858: 2859: <p>Consider a Report presentation using the view declarations from the 1.37 cvs 2860: preceding example. Suppose we want to print the full text and table of 1.30 cvs 2861: contents views, but not the Formulas view, which is only useful when 1.37 cvs 2862: editing. A sensible printing order would be to print the full text followed 2863: by the table of contents. To obtain this result when printing, the 2864: presentation schema would say:</p> 1.30 cvs 2865: <pre>PRINT 1.37 cvs 2866: Full_text, Table_of_contents;</pre> 1.18 cvs 2867: </blockquote> 2868: </div> 2869: 2870: <div class="subsection"> 1.37 cvs 2871: <h3><a name="sectc424" id="sectc424">Counters</a></h3> 1.18 cvs 2872: 1.30 cvs 2873: <p>A presentation has a <em>counter</em> for each type of number in the 1.37 cvs 2874: presentation. All counters, and therefore all types of numbers, used in the 1.18 cvs 2875: schema must be declared after the <tt>COUNTERS</tt> keyword.</p> 1.30 cvs 2876: 2877: <p>Each counter declaration is composed of a name identifying the counter 1.1 cvs 2878: followed by a colon and the counting function to be applied to the counter. 1.18 cvs 2879: The counter declaration ends with a semi-colon.</p> 1.30 cvs 2880: 2881: <p>The counting function indicates how the counter values will be calculated. 1.37 cvs 2882: Three types of counting functions are available. The first type is used to 1.16 cvs 2883: count the elements of a list or aggregate: it assigns to the counter the rank 1.37 cvs 2884: of the element in the list or aggregate. More precisely, the function</p> 1.18 cvs 2885: <pre>RANK OF ElemID [ LevelAsc ] [ INIT AttrID ] 2886: [ 'REINIT' AttrID ]</pre> 1.30 cvs 2887: 2888: <p>indicates that when an element creates, by a creation rule (see the <a 1.18 cvs 2889: href="#sectc4232"><tt>Create</tt> instructions</a>), a presentation box 1.37 cvs 2890: containing the counter value, this value is the rank of the creating element, 1.18 cvs 2891: if it is of type <tt>ElemID</tt>, otherwise the rank of the first element of 2892: type <tt>ElemID</tt> which encloses the creating element in the logical 2893: structure of the document.</p> 1.30 cvs 2894: 2895: <p>The type name can be preceded by a star in the special case where the 1.18 cvs 2896: structure schema defines an element of whose <tt>ElemID</tt> is the same as 2897: that of an <a href="#sectd3284">inclusion</a> without expansion or with 1.37 cvs 2898: partial expansion. To resolve this ambiguity, the <tt>ElemID</tt> alone 1.18 cvs 2899: refers to the type defined in the structure schema while the <tt>ElemID</tt> 2900: preceded by a star refers to the included type.</p> 1.30 cvs 2901: 1.37 cvs 2902: <p>The type name <tt>ElemID</tt> can be followed by an integer. That number 2903: represents the relative level, among the ancestors of the creating element, 2904: of the element whose rank is asked. If that relative level <i>n</i> is 2905: unsigned, the <i>n</i><sup>th</sup> element of type <tt>ElemID</tt> 2906: encountered when travelling the logical structure from the root to the 2907: creating element is taken into account. If the relative level is negative, 2908: the logical structure is travelled in the other direction, from the creating 2909: element to the root.</p> 1.30 cvs 2910: 1.37 cvs 2911: <p>The function can end with the keyword <tt>INIT</tt> followed by the name 2912: of a numeric attribute (and only a numeric attribute). Then, the rank of the 1.30 cvs 2913: first element of the list or aggregate is considered to be the value of this 1.1 cvs 2914: attribute, rather than the default value of 1, and the rank of the other 1.37 cvs 2915: elements is shifted accordingly. The attribute which determines the initial 1.18 cvs 2916: value is searched on the element itself and on its ancestors.</p> 1.30 cvs 2917: 2918: <p>The function can end with the keyword <tt>REINIT</tt> followed by the name 1.37 cvs 2919: of a numeric attribute (and only a numeric attribute). Then, if an element to 1.30 cvs 2920: be counted has this attribute, the counter value for this element is the 1.1 cvs 2921: attribute value and the following elements are numbered starting from this 1.18 cvs 2922: value.</p> 1.30 cvs 2923: 2924: <p>When the <tt>RANK</tt> function is written</p> 1.18 cvs 2925: <pre>RANK OF Page [ ViewID ] [ INIT AttrID ]</pre> 1.30 cvs 2926: 2927: <p>(<tt>Page</tt>is a keyword of the P language), the counter takes as its 2928: value the number of the page on which the element which creates the 1.37 cvs 2929: presentation box containing the number appears. This is done as if the pages 2930: of the document form a list for each view. The counter only takes into 1.30 cvs 2931: account the pages of the relevant view, that is the view displaying the 1.37 cvs 2932: presentation box whose contents take the value of the number. However, if the 2933: keyword <tt>Page</tt> is followed by the name of a view (between 2934: parentheses), it is the pages of that view that are taken into account. As in 2935: the preceding form, the <tt>RANK</tt> function applied to pages can end with 2936: the <tt>INIT</tt> keyword followed by the name of a numeric attribute which 2937: sets the value of the first page's number. This attribute must be a local 1.30 cvs 2938: attribute of the document itself, and not of one of its components.</p> 2939: 2940: <p>The second counting function is used to count the occurrences of a certain 1.37 cvs 2941: element type in a specified context. The instruction</p> 1.18 cvs 2942: <pre>SET n ON Type1 ADD m ON Type2 [ INIT AttrID ]</pre> 1.30 cvs 2943: 2944: <p>says that when the document is traversed from beginning to end (in the 2945: order induced by the logical structure), the counter is assigned the value 1.18 cvs 2946: <tt>n</tt> each time an element of type <tt>Type1</tt> is encountered, no 2947: matter what the current value of the counter, and the value <tt>m</tt> is 2948: added to the current value of the counter each time an element of type 2949: <tt>Type2</tt> is encountered.</p> 1.30 cvs 2950: 2951: <p>As with the <tt>RANK</tt> function, the type names can be preceded by a 2952: star to resolve the ambiguity of included elements.</p> 2953: 1.37 cvs 2954: <p>If the function ends with the keyword <tt>INIT</tt> followed by the name 2955: of an attribute and if the document possesses this attribute, the value of 2956: this attribute is used in place of <tt>n</tt>. The attribute must be numeric. 2957: It is searched on the element itself and on its ancestors.</p> 1.30 cvs 2958: 2959: <p>This function can also be used with the <tt>Page</tt> keyword in the place 1.37 cvs 2960: of <tt>Type1</tt> or <tt>Type2</tt>. In the first case, the counter is 1.18 cvs 2961: reinitialized on each page with the value <tt>n</tt>, while in the second 1.37 cvs 2962: case, it is incremented by <tt>m</tt> on each page. As with the preceding 1.18 cvs 2963: counting function, the word <tt>Page</tt> can be followed by a name between 1.37 cvs 2964: parentheses. In this case, the name specifies a view whose pages are taken 1.18 cvs 2965: into account.</p> 1.30 cvs 2966: 2967: <p>The definition of a counter can contain several <tt>SET</tt> functions and 1.37 cvs 2968: several <tt>ADD</tt> functions, each with a different value. The total number 1.18 cvs 2969: of counting functions must not be greater than 6.</p> 1.30 cvs 2970: 1.37 cvs 2971: <p>The third counting function is used to count the elements of a certain 2972: type encountered when travelling from the creating element to the root of the 2973: logical structure. The creating element is included if it is of that type. 1.18 cvs 2974: That function is written</p> 2975: <pre>RLEVEL OF Type</pre> 1.30 cvs 2976: 2977: <p>where <tt>Type</tt> represents the type of the elements to be counted.</p> 2978: 2979: <p>The formal definition of counter declarations is:</p> 1.18 cvs 2980: <pre> 'COUNTERS' CounterSeq 1.30 cvs 2981: CounterSeq = Counter < Counter > . 1.1 cvs 2982: Counter = CounterID ':' CounterFunc ';' . 2983: CounterID = NAME . 2984: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ] 1.16 cvs 2985: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] / 1.30 cvs 2986: SetFunction < SetFunction > 2987: AddFunction < AddFunction > 1.16 cvs 2988: [ 'INIT' AttrID ] / 2989: 'RLEVEL' 'OF' ElemID . 1.1 cvs 2990: SLevelAsc = [ '-' ] LevelAsc . 2991: LevelAsc = NUMBER . 2992: SetFunction = 'SET' CounterValue 'ON' TypeOrPage . 2993: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . 2994: TypeOrPage = 'Page' [ '(' ViewID ')' ] / 1.16 cvs 2995: [ '*' ] ElemID . 1.18 cvs 2996: CounterValue = NUMBER .</pre> 1.30 cvs 2997: 1.18 cvs 2998: <blockquote class="example"> 1.30 cvs 2999: <p><strong>Example:</strong></p> 3000: 3001: <p>If the body of a chapter is defined as a sequence of sections in the 3002: structure schema:</p> 3003: <pre>Chapter_body = LIST OF (Section = 1.1 cvs 3004: BEGIN 3005: Section_Title = Text; 3006: Section_Body = Paragraphs; 3007: END 1.18 cvs 3008: );</pre> 1.30 cvs 3009: 3010: <p>the section counter is declared:</p> 3011: <pre>SectionCtr : RANK OF Section;</pre> 3012: 3013: <p>and the display of the section number before the section title is 3014: obtained by a <a href="#sectc4232"><tt>CreateBefore</tt> rule</a> attached 3015: the <tt>Section_Title</tt> type, which creates a presentation box whose 3016: content is the value of the <tt>SectionCtr</tt> counter (see the <a 3017: href="#sectc4231"><tt>Content</tt> instruction</a>).</p> 3018: 3019: <p>In order to number the formulas separately within each chapter, the 3020: formula counter is declared:</p> 3021: <pre>FormulaCtr : SET 0 ON Chapter ADD 1 ON Formula;</pre> 3022: 1.37 cvs 3023: <p>and the display of the formula number in the right margin, alongside 3024: each formula, is obtained by a <tt>CreateAfter</tt> instruction attached to 3025: the <tt>Formula</tt> type, which creates a presentation box whose content 3026: is the value of the <tt>FormulaCtr</tt> counter.</p> 1.30 cvs 3027: 3028: <p>To number the page chapter by chapter, with the first page of each 3029: chapter having the number 1, the counter definition would be</p> 3030: <pre>ChapterPageCtr : SET 0 ON Chapter ADD 1 ON Page;</pre> 3031: 3032: <p>If there is also a chapter counter</p> 3033: <pre>ChapterCtr : RANK OF Chapter;</pre> 3034: 1.37 cvs 3035: <p>the <a href="#sectc4231">content</a> of a presentation box created at 3036: the top of each page could be defined as:</p> 1.30 cvs 3037: <pre>Content : (VALUE(ChapterCtr, URoman) TEXT '-' 1.18 cvs 3038: VALUE(ChapterPageCtr, Arabic));</pre> 1.30 cvs 3039: 3040: <p>Thus, the presentation box contains the number of the chapter in 3041: upper-case roman numerals followed by a hyphen and the number of the page 3042: within the chapter in arabic numerals.</p> 1.18 cvs 3043: </blockquote> 1.30 cvs 3044: 1.18 cvs 3045: <blockquote class="example"> 1.30 cvs 3046: <p><strong>Example:</strong></p> 3047: 1.37 cvs 3048: <p>To count tables and figures together in a document of the chapter type, 3049: a counter could be defined using:</p> 1.30 cvs 3050: <pre>CommonCtr : SET 0 ON Chapter ADD 1 ON Table 1.18 cvs 3051: ADD 1 ON Figure;</pre> 3052: </blockquote> 3053: </div> 1.1 cvs 3054: 1.18 cvs 3055: <div class="subsection"> 1.37 cvs 3056: <h3><a name="sectc425" id="sectc425">Presentation constants</a></h3> 1.1 cvs 3057: 1.30 cvs 3058: <p>Presentation constants are used in the definition of the content of 1.37 cvs 3059: presentation boxes. This content is used in <a href="#sectc426">variable 3060: definitions</a> and in the <a href="#sectc4231"><tt>Content</tt> rule</a>. 3061: The only presentation constants which can be used are character strings, 1.2 cvs 3062: mathematical symbols, graphical elements, and pictures, that is to say, base 1.18 cvs 3063: elements.</p> 1.30 cvs 3064: 3065: <p>Constants can be defined directly in the variables or presentation boxes 1.37 cvs 3066: (<tt>Content</tt> rule) which use them. But it is only necessary them to 1.1 cvs 3067: declare once, in the constant declaration section, even though they are used 1.37 cvs 3068: in many variables or boxes. Thus, each declared constant has a name, which 1.1 cvs 3069: allows it to be designated whenever it is used, a type (one of the four base 3070: types) and a value (a character string or a single character for mathematical 1.18 cvs 3071: symbols and graphical elements).</p> 1.30 cvs 3072: 1.37 cvs 3073: <p>The constant declarations appear after the keyword <tt>CONST</tt>. Each 3074: declaration is composed of the name of the constant, an equals sign, a 3075: keyword representing its type (<tt>Text</tt>, <tt>Symbol</tt>, 3076: <tt>Graphics</tt> or <tt>Picture</tt>) and the string representing its value. 3077: A semi-colon terminates each declaration.</p> 1.30 cvs 3078: 3079: <p>In the case of a character string, the keyword <tt>Text</tt> can be 1.41 vatton 3080: followed by the name of an script (for example, <tt>Greek</tt> or 1.37 cvs 3081: <tt>Latin</tt>) in which the constant's text should be expressed. If the 1.43 quint 3082: script name is absent, the Latin script is used. When the script name is 3083: present, only the first letter of the script name is interpreted. Thus, the 3084: words <tt>Greek</tt> and <tt>Grec</tt> designate the same script. In current 3085: versions of Thot, only the Greek and Latin scripts are available.</p> 1.18 cvs 3086: <pre> 'CONST' ConstSeq 1.30 cvs 3087: ConstSeq = Const < Const > . 1.1 cvs 3088: Const = ConstID '=' ConstType ConstValue ';' . 3089: ConstID = NAME . 1.41 vatton 3090: ConstType ='Text' [ Script ] / 'Symbol' / 1.1 cvs 3091: 'Graphics' / 'Picture' . 3092: ConstValue = STRING . 1.41 vatton 3093: Script = NAME .</pre> 1.30 cvs 3094: 1.41 vatton 3095: <p>For character strings in the Latin script (ISO Latin-1 character set), 1.1 cvs 3096: characters having codes higher than 127 (decimal) are represented by their 1.18 cvs 3097: code in octal.</p> 1.30 cvs 3098: 3099: <p>In the case of a symbol or graphical element, the value only contains a 1.37 cvs 3100: single character, between apostrophes, which indicates the form of the 3101: element which must be drawn in the box whose content is the constant. The 3102: symbol or graphical element takes the dimensions of the box, which are 3103: determined by the <tt>Height</tt> and <tt>Width</tt> rules. See <a 3104: href="#sectb72">table of codes</a> for the symbols and graphical elements.</p> 1.30 cvs 3105: 1.18 cvs 3106: <blockquote class="example"> 1.30 cvs 3107: <p><strong>Example:</strong></p> 3108: 3109: <p>The constants ``Summary:'' and fraction bar, which were described 3110: earlier, are declared:</p> 3111: <pre>CONST 1.1 cvs 3112: SummaryConst = Text 'Summary:'; 1.18 cvs 3113: Bar = Graphics 'h';</pre> 3114: </blockquote> 3115: </div> 1.1 cvs 3116: 1.18 cvs 3117: <div class="subsection"> 1.37 cvs 3118: <h3><a name="sectc426" id="sectc426">Variables</a></h3> 1.1 cvs 3119: 1.37 cvs 3120: <p>Variables permit the definition of computed content for presentation 3121: boxes. A variable is associated with a presentation box by a <tt>Content</tt> 3122: rule; but before being used in a <tt>Content</tt> rule, a variable can be 3123: defined in the <tt>VAR</tt> section. It is also possible to define a variable 3124: at the time of its use in a <tt>Content</tt> rule, as can be done with a 1.30 cvs 3125: constant.</p> 3126: 3127: <p>A variable has a name and a value which is a character string resulting 1.37 cvs 3128: from the concatenation of the values of a sequence of functions. Each 1.30 cvs 3129: variable declaration is composed of the variable name followed by a colon and 1.37 cvs 3130: the sequence of functions which produces its value, separated by spaces. Each 1.18 cvs 3131: declaration is terminated by a semi-colon.</p> 3132: <pre> 'VAR' VarSeq 1.30 cvs 3133: VarSeq = Variable < Variable > . 1.1 cvs 3134: Variable = VarID ':' FunctionSeq ';' . 3135: VarID = NAME . 1.30 cvs 3136: FunctionSeq = Function < Function > .</pre> 3137: 1.37 cvs 3138: <p>Several functions are available. The first two return, in the form of a 3139: character string, the current date. <tt>DATE</tt> returns the date in 1.18 cvs 3140: English, while <tt>FDATE</tt> returns the date in french.</p> 1.30 cvs 3141: 3142: <p>Two other functions, <tt>DocName</tt> and <tt>DirName</tt>, return the 1.18 cvs 3143: document name and the directory where the document is stored.</p> 1.30 cvs 3144: 1.38 cvs 3145: <p>Function <tt>ElemName</tt> returns the name of the element which created 1.30 cvs 3146: the presentation box whose contents are the variable.</p> 3147: 1.38 cvs 3148: <p>Function <tt>AttributeName</tt> returns the name of the attribute which 3149: created the presentation box whose contents are the variable. The 3150: presentation box must be created by an attribute.</p> 3151: 3152: <p>Function <tt>AttributeValue</tt> returns the value of the attribute which 3153: created the presentation box whose contents are the variable. The 3154: presentation box must be created by an attribute.</p> 3155: 1.30 cvs 3156: <p>Another function simply returns the value of a presentation constant. For 3157: any constant declared in the <tt>CONST</tt> section, it is sufficient to give 1.37 cvs 3158: the name of the constant. Otherwise, the type and value of the constant must 1.30 cvs 3159: be given, using the same form as in a <a href="#sectc425">constant 1.18 cvs 3160: declaration</a>. If the constant is not of type text, (types <tt>Symbol</tt>, 3161: <tt>Graphics</tt> or <tt>Picture</tt>), it must be alone in the variable 3162: definition; only constants of type <tt>Text</tt> can be mixed with other 3163: functions.</p> 1.30 cvs 3164: 3165: <p>It is also possible to obtain the value of an attribute, simply by 1.37 cvs 3166: mentioning the attribute's name. The value of this function is the value of 1.30 cvs 3167: the attribute for the element which created the presentation box whose 1.37 cvs 3168: contents are the variable. If the creating element does not have the 3169: indicated attribute, the value is an empty string. In the case of a numeric 1.30 cvs 3170: attribute, the attribute is translated into a decimal number in arabic 1.37 cvs 3171: numerals. If another form is desired, the <tt>VALUE</tt> function must be 1.30 cvs 3172: used.</p> 3173: 3174: <p>The last available function returns, as a character string, the value of a 1.1 cvs 3175: counter, an attribute or a page number. This value can be presented in 1.37 cvs 3176: different styles. The keyword <tt>VALUE</tt> is followed (between 1.1 cvs 3177: parentheses) by the name of the counter, the name of the attribute, or the 1.18 cvs 3178: keyword <tt>PageNumber</tt> and the desired style, the two parameters being 1.37 cvs 3179: separated by a comma. The style is a keyword which indicates whether the 1.54 quint 3180: value should be presented in arabic numerals (<tt>Arabic</tt>, 3181: <tt>Decimal</tt> or <tt>DecimalLeadingZero</tt>), lower-case roman numerals 3182: (<tt>LRoman</tt> or <tt>LowerRoman</tt>), upper-case roman numerals 3183: (<tt>URoman</tt> or <tt>UpperRoman</tt>), upper-case latin letter 3184: (<tt>Uppercase</tt> or <tt>UpperLatin</tt>), lower-case latin letter 3185: (<tt>Lowercase</tt> or <tt>LowerLatin</tt>), uppercase greek letter 3186: (<tt>UpperGreek</tt>) or lowercase greek letter (<tt>LowerGreek</tt>).</p> 1.30 cvs 3187: 3188: <p>For a page counter, the keyword <tt>PageNumber</tt> can be followed, 3189: between parentheses, by the name of the view from which to obtain the page 1.37 cvs 3190: number. By default, the first view declared in the <tt>VIEWS</tt> section is 3191: used. The value obtained is the number of the page on which is found the 1.30 cvs 3192: element that is using the variable in a <tt>Content</tt> rule.</p> 3193: 3194: <p>For an ordinary counter, the name of the counter can be preceded by the 1.37 cvs 3195: keyword <tt>MaxRangeVal</tt> or <tt>MinRangeVal</tt>. These keywords mean 1.1 cvs 3196: that the value returned by the function is the maximum (minimum resp.) value 3197: taken by the counter in the whole document, not the value for the element 1.18 cvs 3198: concerned by the function.</p> 3199: <pre> Function = 'DATE' / 'FDATE' / 1.1 cvs 3200: 'DocName' / 'DirName' / 1.38 cvs 3201: 'ElemName' / 'AttributeName' / 'AttributeValue' / 1.1 cvs 3202: ConstID / ConstType ConstValue / 3203: AttrID / 3204: 'VALUE' '(' PageAttrCtr ',' 3205: CounterStyle ')' . 1.6 cvs 3206: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] / 1.1 cvs 3207: [ MinMax ] CounterID / AttrID . 1.54 quint 3208: CounterStyle = 'Arabic' / 'Decimal' / 'DecimalLeadingZero' / 3209: 'URoman' / 'UpperRoman' / 'LRoman' / 'LowerRoman' / 3210: 'Uppercase' / 'UpperLatin' / 'Lowercase' / 'LowerLatin' / 3211: 'LowerGreek' / 'UpperGreek' . 1.18 cvs 3212: MinMax = 'MaxRangeVal' / 'MinRangeVal' .</pre> 1.30 cvs 3213: 1.18 cvs 3214: <blockquote class="example"> 1.30 cvs 3215: <p><strong>Example:</strong></p> 3216: 3217: <p>To make today's date appear at the top of the first page of a report, a 3218: <a href="#sectc4232"><tt>CREATE</tt> rule</a> associated with the 3219: Report_Title element type generates a presentation box whose content 3220: (specified by the <tt>Content</tt> rule of that presentation box) is the 3221: variable:</p> 3222: <pre>VAR 1.18 cvs 3223: Todays_date : TEXT 'Version of ' DATE;</pre> 1.30 cvs 3224: 3225: <p>To produce, before each section title, the chapter number (in upper-case 3226: roman numerals) followed by the section number (in arabic numerals), two 3227: counters must be defined:</p> 3228: <pre>COUNTERS 1.1 cvs 3229: ChapterCtr : RANK OF Chapter; 1.18 cvs 3230: SectionCtr : RANK OF Section;</pre> 1.30 cvs 3231: 3232: <p>and the Section_Title element must create a presentation box whose 3233: content is the variable</p> 3234: <pre>VAR 1.1 cvs 3235: SectionNum : VALUE (ChapterCtr, URoman) TEXT '-' 1.18 cvs 3236: VALUE (SectionCtr, Arabic);</pre> 1.30 cvs 3237: 3238: <p>In order to make the page number on which each section begins appear in 3239: the table of contents view next to the section title, each Section_Title 3240: element must create a presentation box, visible only in the table of 3241: contents view, whose content is the variable:</p> 3242: <pre>VAR 1.1 cvs 3243: TitlePageNume : 1.18 cvs 3244: VALUE (PageNumber(Full_text), Arabic);</pre> 3245: </blockquote> 3246: </div> 1.1 cvs 3247: 1.18 cvs 3248: <div class="subsection"> 1.37 cvs 3249: <h3><a name="sectc427" id="sectc427">Default presentation rules</a></h3> 1.1 cvs 3250: 1.30 cvs 3251: <p>In order to avoid having to specify, for each element type defined in the 1.1 cvs 3252: structure schema, values for every one of the numerous presentation 1.34 cvs 3253: properties, the presentation schema allows the definition of a set of default 1.37 cvs 3254: presentation rules. These rules apply to all the boxes of the elements 1.1 cvs 3255: defined in the structure schema and to the presentation boxes and page layout 1.37 cvs 3256: boxes defined in the presentation schema. Only rules which differ from these 1.18 cvs 3257: default need to be specified in other sections of the presentation schema.</p> 1.30 cvs 3258: 3259: <p>For the primary view, the default rules can define every presentation 1.34 cvs 3260: property, but not the <a href="#presfunct">presentation functions</a> or the 1.18 cvs 3261: <a href="#sectc4223">linebreaking conditions</a> (the <tt>NoBreak1</tt>, 3262: <tt>NoBreak2</tt>, and <tt>Gather</tt> rules).</p> 1.30 cvs 3263: 3264: <p>In a presentation schema, the default presentation rules section is 3265: optional; in this case, the <tt>DEFAULT</tt> keyword is also absent and the 3266: following rules are considered to be the default rules:</p> 1.26 cvs 3267: <pre> Visibility: Enclosing =; 3268: VertRef: * . Left; 3269: HorizRef: Enclosed . HRef; 3270: Height: Enclosed . Height; 3271: Width: Enclosed . Width; 3272: VertPos: Top = Previous . Bottom; 3273: HorizPos: Left = Enclosing . Left; 1.49 quint 3274: Float: None; 3275: Clear: None; 1.26 cvs 3276: MarginTop: 0; 3277: MarginRight: 0; 3278: MarginBottom: 0; 3279: MarginLeft: 0; 3280: PaddingTop: 0; 3281: PaddingRight: 0; 3282: PaddingBottom: 0; 3283: PaddingLeft: 0; 3284: BorderTopWidth: 0; 3285: BorderRightWidth: 0; 3286: BorderBottomWidth: 0; 3287: BorderLeftWidth: 0; 3288: BorderTopColor: Foreground; 3289: BorderRightColor: Foreground; 3290: BorderBottomColor: Foreground; 3291: BorderLeftColor: Foreground; 3292: BorderTopStyle: None; 3293: BorderRightStyle: None; 3294: BorderBottomStyle: None; 3295: BorderLeftStyle: None; 3296: VertOverflow: No; 3297: HorizOverflow: No; 3298: Size: Enclosing =; 3299: Style: Enclosing =; 3300: Weight: Enclosing =; 3301: Font: Enclosing =; 3302: Underline: Enclosing =; 3303: Thickness: Enclosing =; 3304: Indent: Enclosing =; 3305: LineSpacing: Enclosing =; 3306: Adjust: Enclosing =; 3307: Hyphenate: Enclosing =; 1.40 quint 3308: Direction: Enclosing =; 1.43 quint 3309: UnicodeBidi: Enclosing =; 1.26 cvs 3310: PageBreak: Yes; 3311: LineBreak: Yes; 3312: InLine: Yes; 3313: Depth: 0; 3314: LineStyle: Enclosing =; 3315: LineWeight: Enclosing =; 3316: FillPattern: Enclosing =; 3317: Background: Enclosing =; 1.48 quint 3318: Foreground: Enclosing =; 3319: Opacity: Enclosing =; 3320: FillOpacity: Enclosing =; 3321: StrokeOpacity: Enclosing =;</pre> 1.30 cvs 3322: 3323: <p>If other values are desired for the default rules, they must be defined 1.37 cvs 3324: explicitly in the default rules section. In fact, it is only necessary to 1.1 cvs 3325: define those default rules which differ from the ones above, since the rules 1.18 cvs 3326: above will be used whenever a rule is not explicitly named.</p> 1.30 cvs 3327: 1.37 cvs 3328: <p>Default rules for views other than the primary view can also be specified. 1.1 cvs 3329: Otherwise, the default rules for the primary views are applied to the other 1.18 cvs 3330: views.</p> 1.30 cvs 3331: 3332: <p>Default rules are expressed in the same way as <a 3333: href="#sectc4215">explicit rules for document elements</a>.</p> 1.18 cvs 3334: </div> 1.1 cvs 3335: 1.18 cvs 3336: <div class="subsection"> 1.37 cvs 3337: <h3><a name="sectc428" id="sectc428">Presentation and page layout 3338: 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 1.37 cvs 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 3350: a single exception, the <a href="#sectc4231"><tt>Content</tt> rule</a> which 3351: is used only to specify the content of presentation boxes. The content of 3352: boxes associated with elements of the document structure is defined in each 3353: document or object and thus is not specified in the presentation schema, 3354: which applies 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.37 cvs 3357: another presentation box (for example, in their positional rules). If the 1.1 cvs 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.37 cvs 3369: <h3><a name="sectc429" id="sectc429">Presentation of structured 3370: elements</a></h3> 1.1 cvs 3371: 1.30 cvs 3372: <p>After the words <tt>RULES</tt>, the presentation schema gives the 3373: presentation rules that apply to the elements whose types are defined in the 1.37 cvs 3374: structure schema. Only those rules which differ from the <a 1.18 cvs 3375: href="#sectc427">default</a> must be specified in the <tt>RULES</tt> 3376: section.</p> 1.30 cvs 3377: 3378: <p>The rule definitions for each element type are composed of the name of the 1.1 cvs 3379: element type (as specified in the structure schema) followed by a colon and 1.18 cvs 3380: the set of rules specific to that type.</p> 1.30 cvs 3381: 3382: <p>The type name can be preceded by a star in the special case where the 1.18 cvs 3383: structure schema defines an <a href="#sectd3284">inclusion</a> without 1.1 cvs 3384: expansion (or with partial expansion) of a type with the same name as an 1.18 cvs 3385: element of defined in the structure schema.</p> 1.30 cvs 3386: 3387: <p>In the case where the element is a <a href="#sectd3285">mark pair</a>, but 1.18 cvs 3388: only in this case, the type name can be preceded by the keywords 1.37 cvs 3389: <tt>First</tt> or <tt>Second</tt>. These keywords indicate whether the rules 1.18 cvs 3390: that follow apply to the first or second mark of the pair.</p> 3391: <pre> 'RULES' PresentSeq 1.30 cvs 3392: PresentSeq = Present < Present > . 1.6 cvs 3393: Present = [ '*' ] [ FirstSec ] ElemID ':' 3394: ViewRuleSeq . 1.18 cvs 3395: FirstSec = 'First' / 'Second' .</pre> 1.30 cvs 3396: 3397: <p>A presentation schema can define presentation rules for base elements, 1.37 cvs 3398: which are defined implicitly in the structure schemas. In the English version 1.30 cvs 3399: of the presentation schema compiler, the base type names are the same as in 3400: the S language, but they are terminated by the <tt>_UNIT</tt> suffix: 1.18 cvs 3401: <tt>TEXT_UNIT</tt>, <tt>PICTURE_UNIT</tt>, <tt>SYMBOL_UNIT</tt>, 1.37 cvs 3402: <tt>GRAPHICS_UNIT</tt>. The base type names are written in upper-case 1.18 cvs 3403: letters.</p> 3404: </div> 3405: 3406: <div class="subsection"> 1.37 cvs 3407: <h3><a name="sectc4210" id="sectc4210">Logical attribute presentation</a></h3> 1.18 cvs 3408: 1.30 cvs 3409: <p>After the keyword <tt>ATTRIBUTES</tt>, all attributes which are to have 1.37 cvs 3410: some effect on the presentation of the element to which they are attached 3411: must be mentioned, along with the corresponding presentation rules. This is 3412: true for both global attributes (which can be attached to all element types) 3413: and local attributes (which can only be attached to certain element 3414: types).</p> 1.30 cvs 3415: 3416: <p>Also mentioned in this section are attributes which imply an effect on 1.1 cvs 3417: elements in the subtree of the element to which they are attached. The 1.37 cvs 3418: presentation of these descendants can be modified as a function of the value 1.1 cvs 3419: of the attribute which they inherit, just as if it was attached to them 1.18 cvs 3420: directly.</p> 1.30 cvs 3421: 3422: <p>The specification for each attribute includes the attribute's name, 3423: followed by an optional value specification and, after a colon, a set of 1.37 cvs 3424: rules. The set of rules must contain at least one rule.</p> 1.30 cvs 3425: 1.37 cvs 3426: <p>When there is no value specification, the rules are applied to all 3427: elements which carry the attribute, no matter what their value. When the 3428: rules must only apply when the attribute has certain values, these values 3429: must be specified. Thus, the same attribute can appear in the 3430: <tt>ATTRIBUTES</tt> section several times, with each appearance having a 3431: different value specification. However, reference attributes never have a 3432: value specification and, as a result, can only appear once in the 3433: <tt>ATTRIBUTES</tt> section.</p> 1.30 cvs 3434: 3435: <p>To specify that the presentation rules apply to some of the descendants of 3436: the element having the attribute, the name of the affected element type is 1.50 quint 3437: given, between parentheses, after the attribute name. If the element type 3438: name is followed by a '<tt>*</tt>', the rules also apply to the element 3439: itself (i.e. the element that has the specified type and has the specified 3440: attribute). In the case where the element type is a <a href="#sectd3285">mark 1.37 cvs 3441: pair</a>, but only in this case, the type name can be preceded by the 3442: keywords <tt>First</tt> or <tt>Second</tt>. These keywords indicate whether 3443: the rules that follow apply to the first or second mark of the pair. If the 3444: rule must apply to several different element types, the specification must be 3445: repeated for each element type.</p> 1.30 cvs 3446: 3447: <p>The specification of values for which the presentation rules will be 3448: applied varies according to the type of the attribute:</p> 1.18 cvs 3449: <dl> 1.30 cvs 3450: <dt>numeric attribute</dt> 3451: <dd>If the rules are to apply for one value of the attribute, then the 1.37 cvs 3452: attribute name is followed by an equals sign and this value. If the 1.30 cvs 3453: rules are to apply for all values less than (or greater than) a 3454: threshold value, non-inclusive, the attribute name followed by a '<' 1.37 cvs 3455: sign (or a '>' sign, respectively) and the threshold value. If the 3456: rules must apply to a range of values, the attribute name is followed 3457: by the word '<tt>IN</tt>' and the two bounds of the range, enclosed in 3458: brackets and separated by two periods ('<tt>..</tt>'). In the case of 1.52 quint 3459: ranges, the values of the bounds are included in the range. 1.30 cvs 3460: <p>The threshold value in the comparisons can be the value of an 1.37 cvs 3461: attribute attached to an ancestor element. In this case, the attribute 1.30 cvs 3462: name is given instead of a constant value.</p> 1.37 cvs 3463: <p>It is also possible to write rules which apply only when a 3464: comparison between two different attributes of the element's ancestors 3465: is true. In this case, the first attribute name is followed by a 3466: comparison keyword and the name of the second attribute. The comparison 3467: keywords are <tt>EQUAL</tt> (simple equality), <tt>LESS</tt> 3468: (non-inclusive less than), and <tt>GREATER</tt> (non-inclusive greater 3469: than).</p> 1.30 cvs 3470: </dd> 3471: <dt>text attribute</dt> 3472: <dd>If the rules are to apply for one value of the attribute, then the 3473: attribute name is followed by an equals sign and this value.</dd> 3474: <dt>reference attribute</dt> 3475: <dd>There is never a value specification; the rules apply no matter what 3476: element is designated by the attribute.</dd> 3477: <dt>enumerated attribute</dt> 3478: <dd>If the rules are to apply for one value of the attribute, then the 3479: attribute name is followed by an equals sign and this value.</dd> 1.18 cvs 3480: </dl> 1.30 cvs 3481: 3482: <p>The order in which the rules associated with a numeric attribute are 1.37 cvs 3483: defined is important. When multiple sets of rules can be applied, the first 1.30 cvs 3484: set declared is the one used.</p> 3485: 3486: <p>Rules for attributes have priority over both default rules and rules 1.37 cvs 3487: associated with element types. The attribute rules apply to the element to 3488: which the attribute is attached. It is the rules which apply to the 1.1 cvs 3489: surrounding elements (and especially to the descendants) which determine the 3490: effect of the attribute rules on the environment ( and especially on the 1.18 cvs 3491: terminal elements of the structure).</p> 3492: <pre> 'ATTRIBUTES' PresAttrSeq 1.30 cvs 3493: PresAttrSeq = PresAttr < PresAttr > . 1.50 quint 3494: PresAttr = AttrID [ '(' [ FirstSec ] ElemID [ '*' ] ')' ] 1.1 cvs 3495: [ AttrRelation ] ':' ViewRuleSeq . 3496: AttrID = NAME . 3497: AttrRelation ='=' AttrVal / 1.30 cvs 3498: '>' [ '-' ] MinValue / 1.1 cvs 3499: '<' [ '-' ] MaxValue / 3500: 'IN' '[' [ '-' ] LowerBound '..' 3501: [ '-' ] UpperBound ']' / 3502: 'GREATER' AttrID / 3503: 'EQUAL' AttrID / 3504: 'LESS' AttrID . 3505: AttrVal = [ '-' ] EqualNum / EqualText / 3506: AttrValue . 3507: MinValue = NUMBER . 3508: MaxValue = NUMBER . 3509: LowerBound = NUMBER . 3510: UpperBound = NUMBER. 3511: EqualNum = NUMBER . 3512: EqualText = STRING . 1.18 cvs 3513: AttrValue = NAME .</pre> 1.30 cvs 3514: 1.37 cvs 3515: <p>In presentation rules associated with a numeric attribute (and only in 3516: such rules), the attribute name can be used in place of a numeric value. In 3517: this case, the value of the attribute is used in the application of the rule. 3518: Thus, the attribute can represent a relation between the size of two boxes, 3519: the height and width of a box, the height of an area where page breaks are 3520: prohibited, the distance between two boxes, the position of the reference 3521: axis of a box, the interline spacing, the indentation of the first line, the 1.18 cvs 3522: visibility, the depth (z-order), or the character set.</p> 1.30 cvs 3523: 1.37 cvs 3524: <p>The presentation rules associated with reference attributes, it is 3525: possible to use the element designated by the attribute as a reference box in 3526: a positional or extent rule. This element is represented in the <a 1.18 cvs 3527: href="#sectc4218">position</a> or <a href="#sectc4219">extent</a> rule by the 3528: keyword <tt>Referred</tt>.</p> 1.30 cvs 3529: 1.18 cvs 3530: <blockquote class="example"> 1.30 cvs 3531: <p><strong>Example:</strong></p> 3532: 1.37 cvs 3533: <p>In all structure schemas, there is a global Language attribute defined 3534: as follows:</p> 1.30 cvs 3535: <pre>ATTR 1.18 cvs 3536: Language = TEXT;</pre> 1.30 cvs 3537: 3538: <p>The following rules would make French text be displayed in roman 3539: characters and English text be displayed in italics:</p> 3540: <pre>ATTRIBUTES 1.1 cvs 3541: Language = 'French' : 1.6 cvs 3542: Style : Roman; 1.1 cvs 3543: Language = 'English' : 1.18 cvs 3544: Style : Italics;</pre> 1.30 cvs 3545: 3546: <p>Using these rules, when the user puts the Language attribute with the 3547: value 'English' on the summary of a document, every character string 1.37 cvs 3548: (terminal elements) contained in the summary are displayed in italics. See 1.30 cvs 3549: the <a href="#sectd42252"><tt>Style</tt> rule</a>.</p> 1.18 cvs 3550: </blockquote> 1.30 cvs 3551: 1.18 cvs 3552: <blockquote class="example"> 1.30 cvs 3553: <p><strong>Example:</strong></p> 3554: 3555: <p>A numeric attribute representing the importance of the part of the 3556: document to which it is attached can be defined:</p> 3557: <pre>ATTR 1.18 cvs 3558: Importance = INTEGER;</pre> 1.30 cvs 3559: 3560: <p>In the presentation schema, the importance of an element is reflected in 3561: the choice of character size, using the following rules.</p> 3562: <pre>ATTRIBUTES 1.1 cvs 3563: Importance < 2 : 3564: Size : 1; 3565: Importance IN [2..4] : 3566: Size : Importance; 3567: Importance = 10 : 3568: Size : 5; 1.30 cvs 3569: Importance > 4 : 1.18 cvs 3570: Size : 4;</pre> 1.30 cvs 3571: 3572: <p>Thus, the character size corresponds to the value of the Importance 3573: attribute; its value is</p> 3574: <ul> 3575: <li>the value of the Importance attribute when the value is between 2 and 3576: 4 (inclusive),</li> 3577: <li>1, when the value of the Importance attribute is less than 2,</li> 3578: <li>4, when the value of the Importance attribute is greater than 4,</li> 3579: <li>5, when the value of the Importance attribute is 10.</li> 3580: </ul> 3581: 1.37 cvs 3582: <p>The last case (value 5) must be defined before the case which handles 3583: all Importance values greater than 4, because the two rules are not 3584: disjoint and the first one defined will have priority. Otherwise, when the 3585: Importance attribute has value 10, the font size will be 4.</p> 1.18 cvs 3586: </blockquote> 1.30 cvs 3587: 1.18 cvs 3588: <blockquote class="example"> 1.30 cvs 3589: <p><strong>Example:</strong></p> 3590: 3591: <p>Suppose the structure defines a list element which can have an attribute 3592: defining the type of list (numbered or not):</p> 3593: <pre>STRUCT 1.1 cvs 3594: list (ATTR list_type = enumeration, dash) 1.18 cvs 3595: = LIST OF (list_item = TEXT);</pre> 1.30 cvs 3596: 3597: <p>Then, the presentation schema could use the attribute placed on the list 3598: element to put either a dash or a number before the each element of the 3599: list:</p> 3600: <pre>ATTRIBUTES 1.1 cvs 3601: list_type (list_item) = enumeration : 3602: CreateBefore (NumberBox); 3603: list_type (list_item) = dash : 1.18 cvs 3604: CreateBefore (DashBox);</pre> 3605: </blockquote> 1.30 cvs 3606: 1.18 cvs 3607: <blockquote class="example"> 1.30 cvs 3608: <p><strong>Example:</strong></p> 3609: 1.37 cvs 3610: <p>Suppose that two attributes are defined in the structure schema. The 3611: first is a numeric global attribute called ``version''. The other is a 1.30 cvs 3612: local attribute defined on the root of the document called 3613: ``Document_version'':</p> 3614: <pre>STRUCTURE Document 1.1 cvs 3615: ATTR 3616: version = INTEGER; 3617: STRUCT 3618: Document (ATTR Document_version = INTEGER) = 3619: BEGIN 3620: SomeElement ; 3621: ... 3622: SomeOtherElement ; 3623: END ; 1.18 cvs 3624: ...</pre> 1.30 cvs 3625: 3626: <p>These attributes can be used in the presentation schema to place change 3627: bars in the margin next to elements whose version attribute has a value 3628: equal to the Document_version attribute of the root and to place a star in 3629: margin of elements whose version attribute is less than the value of the 3630: root's Document_version attribute:</p> 3631: <pre>ATTRIBUTES 1.1 cvs 3632: version EQUAL Document_version : 3633: CreateBefore (ChangeBarBox) ; 3634: version LESS Document_version : 1.18 cvs 3635: CreateBefore (StarBox) ;</pre> 3636: </blockquote> 3637: </div> 1.1 cvs 3638: 1.18 cvs 3639: <div class="subsection"> 1.37 cvs 3640: <h3><a name="sectc4212" id="sectc4212">Value transmission rules</a></h3> 1.1 cvs 3641: 1.30 cvs 3642: <p>The last section of a presentation schema, which is optional, serves to 1.1 cvs 3643: defines the way in which a document transmits certain values to its 1.37 cvs 3644: sub-documents. A sub-document is an document <a 1.18 cvs 3645: href="#inclusion">included</a> without expansion or with partial expansion. 1.1 cvs 3646: The primary document can transmit to its sub-documents the values of certain 3647: counters or the textual content of certain of its elements, as a function of 1.18 cvs 3648: their type.</p> 1.30 cvs 3649: 3650: <p>The sub-documents receive these values in attributes which must be defined 1.37 cvs 3651: in their structure schema as local attributes of the root element. The types 1.30 cvs 3652: of these attributes must correspond to the type of the value which they 3653: receive: numeric attributes for receiving the value of a counter, textual 3654: attributes for receiving the content of an element.</p> 3655: 3656: <p>In the structure schema of the primary document, there appears at the end, 1.37 cvs 3657: after the <tt>TRANSMIT</tt> keyword, a sequence of transmission rules. Each 1.1 cvs 3658: rule begins with the name of the counter to transmit or of the element type 1.37 cvs 3659: whose textual content will be transmitted. This name is followed by the 3660: keyword <tt>To</tt> and the name of the attribute of the sub-document to 3661: which the value is transmitted. The sub-document class is indicated between 3662: parentheses after the name of the attribute. The transmission rule ends with 1.18 cvs 3663: a semicolon.</p> 1.30 cvs 3664: <pre> TransmitSeq = Transmit < Transmit > . 1.1 cvs 3665: Transmit = TypeOrCounter 'To' ExternAttr 3666: '(' ElemID ')' ';' . 3667: TypeOrCounter = CounterID / ElemID . 1.18 cvs 3668: ExternAttr = NAME .</pre> 1.30 cvs 3669: 1.18 cvs 3670: <blockquote class="example"> 1.30 cvs 3671: <p><strong>Example:</strong></p> 3672: 3673: <p>Consider a Book document class which includes instances of the Chapter 1.37 cvs 3674: document class. These classes might have the following schemas:</p> 1.30 cvs 3675: <pre>STRUCTURE Book 1.1 cvs 3676: STRUCT 3677: Book = BEGIN 3678: Title = Text; 3679: Body = LIST OF (Chapter INCLUDED); 3680: END; 3681: ... 3682: 3683: STRUCTURE Chapter 3684: STRUCT 3685: Chapter (ATTR FirstPageNum = Integer; 3686: ChapterNum = Integer; 3687: CurrentTitle = Text) = 1.6 cvs 3688: BEGIN 3689: ChapterTitle = Text; 3690: ... 3691: END; 1.18 cvs 3692: ...</pre> 1.30 cvs 3693: 3694: <p>Then the presentation schema for books could define chapter and page 3695: counters. The following transmission rules in the book presentation schema 3696: would transmit values for the three attributes defined at the root of each 3697: chapter sub-document.</p> 3698: <pre>PRESENTATION Book; 1.1 cvs 3699: VIEWS 3700: Full_text; 3701: COUNTERS 3702: ChapterCtr: Rank of Chapter; 3703: PageCtr: Rank of Page(Full_text); 3704: ... 3705: TRANSMIT 3706: PageCtr TO FirstPageNum(Chapter); 3707: ChapterCtr TO ChapterNum(Chapter); 3708: Title TO CurrentTitle(Chapter); 1.18 cvs 3709: END</pre> 1.30 cvs 3710: 3711: <p>Thus, each chapter included in a book can number its pages as a function 3712: of the number of pages preceding it in the book, can make the chapter's 3713: number appear before the number of each of its sections, or can place the 3714: title of the book at the top of each page.</p> 1.18 cvs 3715: </blockquote> 3716: </div> 1.1 cvs 3717: 1.18 cvs 3718: <div class="subsection"> 1.37 cvs 3719: <h3><a name="sectc4213" id="sectc4213">Presentation rules</a></h3> 1.1 cvs 3720: 1.30 cvs 3721: <p>Whether defining the appearance of a presentation or page layout box, an 1.1 cvs 3722: element type, or an attribute value, the set of presentation rules that apply 1.18 cvs 3723: is always defined in the same way.</p> 1.30 cvs 3724: 3725: <p>Normally, a set of presentation rules is placed between the keywords 1.18 cvs 3726: <tt>BEGIN</tt> and <tt>END</tt>, the keyword <tt>END</tt> being followed by a 1.37 cvs 3727: semicolon. The first section of this block defines the rules that apply to 1.18 cvs 3728: the primary view, if the <a href="#sectc427">default rules</a> are not 1.37 cvs 3729: completely suitable. Next comes the rules which apply to specific other 1.1 cvs 3730: views, with a rule sequence for each view for which the default rules are not 1.37 cvs 3731: satisfactory. If the default rules are suitable for the non-primary views, 3732: there will not be any specific rules for these views. If there is only one 1.18 cvs 3733: rule which applies to all views then the keywords <tt>BEGIN</tt> and 3734: <tt>END</tt> need not appear.</p> 1.30 cvs 3735: 3736: <p>For each view, it is only necessary to specify those rules which differ 3737: from the default rules for the view, so that for certain views (or even all 3738: views), there may be no specific rules.</p> 3739: 3740: <p>The specific rules for a non-primary view are introduced by the <a 1.37 cvs 3741: name="inkeyword" id="inkeyword"><tt>IN</tt> keyword</a>, followed by the view 3742: name. The rules for that view follow, delimited by the keywords 3743: <tt>BEGIN</tt> and <tt>END</tt>, or without these two keywords when there is 3744: only one rule.</p> 1.30 cvs 3745: 3746: <p><strong>Note:</strong> the view name which follows the <tt>IN</tt> keyword 1.1 cvs 3747: must not be the name of the primary view, since the rules for that view are 1.18 cvs 3748: found before the rules for the other views.</p> 1.30 cvs 3749: 3750: <p>Within each block concerning a view, other blocks can appear, delimited by 1.37 cvs 3751: the same keywords <tt>BEGIN</tt> and <tt>END</tt>. Each of these blocks 3752: gathers the presentation rules that apply, for a given view, only when a 3753: given condition is satisfied. Each block is preceded by a condition 3754: introduced by the <tt>IF</tt> keyword. If such a conditional block contains 3755: only one rule, the keywords <tt>BEGIN</tt> and <tt>END</tt> can be 3756: omitted.</p> 3757: 3758: <p>Although the syntax allows any presentation rule to appear in a 3759: conditional block, only <a href="#sectc4232">creation rules</a> are allowed 3760: after any condition; other rules are allowed only after conditions 3761: <tt>Within</tt> and ElemID. In addition, the following rules cannot be 3762: conditional: <tt>PageBreak, LineBreak, Inline, Gather</tt>.</p> 1.30 cvs 3763: 3764: <p>For a given view, the rules that apply without any condition must appear 1.37 cvs 3765: before the first conditional block. If some rules apply only when none of the 3766: specified condition holds, they are grouped in a block preceded by the 3767: keyword <tt>Otherwise</tt>, and that block must appear after the last 3768: conditionnal block concerning the same view.</p> 1.30 cvs 3769: <pre> ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules > 1.1 cvs 3770: 'END' ';' / 3771: ViewRules / CondRules / Rule . 3772: RulesAndCond = CondRules / Rule . 3773: ViewRules = 'IN' ViewID CondRuleSeq . 1.30 cvs 3774: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' / 1.1 cvs 3775: CondRules / Rule . 1.30 cvs 3776: CondRules = CondRule < CondRule > 1.1 cvs 3777: [ 'Otherwise' RuleSeq ] . 3778: CondRule = 'IF' ConditionSeq RuleSeq . 1.30 cvs 3779: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / 1.18 cvs 3780: Rule .</pre> 1.30 cvs 3781: 1.18 cvs 3782: <blockquote class="example"> 1.30 cvs 3783: <p><strong>Example:</strong></p> 3784: 3785: <p>The following rules for a report's title make the title visible in the 1.37 cvs 3786: primary view and invisible in the table of contents and in the formula 3787: views (see the <a href="#sectc4224"><tt>Visibility</tt> rule</a>).</p> 1.30 cvs 3788: <pre>Title : BEGIN 1.1 cvs 3789: Visibility : 1; 3790: ... {Other rules for the primary view} 3791: IN Table_of_contents 3792: Visibility : 0; 3793: IN Formulas 3794: Visibility : 0; 1.18 cvs 3795: END;</pre> 3796: </blockquote> 3797: </div> 1.1 cvs 3798: 1.18 cvs 3799: <div class="subsection"> 1.37 cvs 3800: <h3><a name="sectc4214" id="sectc4214">Conditions applying to presentation 3801: rules</a></h3> 1.1 cvs 3802: 1.37 cvs 3803: <p>Many conditions can be applied to presentation rules. Conditions allow 3804: certain presentation rules to apply only in certain cases. These conditions 3805: can be based on the structural position of the element. They can be based on 1.1 cvs 3806: whether the element has references, and what type of references, whether the 1.42 quint 3807: element has attributes, possibly with certains values, whether the element is 3808: empty or not, whether the element is the root of its document or not. They 3809: can also be based on the value of a counter.</p> 1.30 cvs 3810: 1.37 cvs 3811: <p>It is possible to specify several conditions which must all be true for 3812: the rules to apply.</p> 1.30 cvs 3813: 1.37 cvs 3814: <p>A set of conditions is specified by the <tt>IF</tt> keyword. This keyword 1.30 cvs 3815: is followed by the sequence of conditions, separated by the <tt>AND</tt> 3816: keyword. Each condition is specified by a keyword which defines the condition 3817: type. In some cases, the keyword is followed by other data, which specify the 1.42 quint 3818: condition more precisely. The keyword is not present if the condition depends 3819: on the element type or an attribute associated with the element.</p> 1.30 cvs 3820: 3821: <p>An elementary condition can be negative; it is then preceded by the 1.18 cvs 3822: <tt>NOT</tt> keyword.</p> 1.30 cvs 3823: 3824: <p>When the presentation rule(s) controlled by the condition apply to a 3825: reference element or a reference attribute, an elementary condition can also 1.37 cvs 3826: apply to element referred by this reference. The <tt>Target</tt> keyword is 3827: used for that purpose. It must appear before the keyword defining the 1.30 cvs 3828: condition type.</p> 1.18 cvs 3829: <pre> CondRule ='IF' ConditionSeq RuleSeq . 1.30 cvs 3830: ConditionSeq = Condition < 'AND' Condition > . 1.1 cvs 3831: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem . 3832: ConditionElem ='First' / 'Last' / 3833: [ 'Immediately' ] 'Within' [ NumParent ] 3834: ElemID [ ExtStruct ] / 3835: ElemID / 3836: 'Referred' / 'FirstRef' / 'LastRef' / 3837: 'ExternalRef' / 'InternalRef' / 'CopyRef' / 1.44 quint 3838: [ 'Inherited' ] AttrID [ '=' Value ] / 1.1 cvs 3839: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' / 3840: 'UserPage' / 'StartPage' / 'ComputedPage' / 1.33 cvs 3841: 'Empty' / 'Root' / 1.1 cvs 3842: '(' [ MinMax ] CounterName CounterCond ')' / 3843: CondPage '(' CounterID ')' . 3844: NumParent = [ GreaterLess ] NParent . 1.30 cvs 3845: GreaterLess ='>' / '<' . 1.1 cvs 3846: NParent = NUMBER. 1.6 cvs 3847: ExtStruct ='(' ElemID ')' . 1.42 quint 3848: Value = [ '-' ] IntegerVal / TextVal / AttrValue . 1.30 cvs 3849: CounterCond ='<' MaxCtrVal / '>' MinCtrVal / 1.1 cvs 3850: '=' EqCtrVal / 3851: 'IN' '[' ['-'] MinCtrBound '.' '.' 3852: ['-'] MaxCtrBound ']' . 3853: PageCond ='Even' / 'Odd' / 'One' . 3854: MaxCtrVal = NUMBER . 3855: MinCtrVal = NUMBER . 3856: EqCtrVal = NUMBER . 3857: MaxCtrBound = NUMBER . 1.18 cvs 3858: MinCtrBound = NUMBER .</pre> 1.1 cvs 3859: 1.18 cvs 3860: <div class="subsubsection"> 1.37 cvs 3861: <h4><a name="sectd42141" id="sectd42141">Conditions based on the logical 3862: position of the element</a></h4> 1.30 cvs 3863: 3864: <p>The condition can be on the position of the element in the document's 1.37 cvs 3865: logical structure tree. It is possible to test whether the element is the 1.30 cvs 3866: first (<tt>First</tt>) or last (<tt>Last</tt>) among its siblings or if it is 3867: not the first (<tt>NOT First</tt>) or not the last (<tt>NOT Last</tt>). These 1.18 cvs 3868: conditions can be associated only with <a href="#sectc4232">creation 3869: rules</a>.</p> 1.30 cvs 3870: 1.33 cvs 3871: <p>It is possible to test if the element is the root of its document (keyword 3872: <code>Root</code>).</p> 3873: 1.30 cvs 3874: <p>It is also possible to test if the element is contained in an element of a 1.18 cvs 3875: given type (<tt>Within</tt>) or if it is not (<tt>NOT Within</tt>). The type 3876: is indicated after the keyword <tt>Within</tt>. If that element type is 1.1 cvs 3877: defined in a structure schema which is not the one which corresponds to the 3878: presentation schema, the type name of this element must be followed, between 1.18 cvs 3879: parentheses, by the name of the structure schema which defines it.</p> 1.30 cvs 3880: 3881: <p>If the keyword <tt>Within</tt> is preceded by <tt>Immediately</tt>, the 1.18 cvs 3882: condition is satisfied only if the <em>parent</em> element has the type 3883: indicated. If the word <tt>Immediately</tt> is missing, the condition is 3884: satisfied if any <em>ancestor</em> has the type indicated.</p> 1.30 cvs 3885: 3886: <p>An integer <i>n</i> can appear between the keyword <tt>Within</tt> and the 1.37 cvs 3887: type. It specifies the number of ancestors of the indicated type that must be 3888: present for the condition to be satisfied. If the keyword 1.18 cvs 3889: <tt>Immediately</tt> is also present, the <i>n</i> immediate ancestors of the 1.37 cvs 3890: element must have the indicated type. The integer <i>n</i> must be positive 3891: or zero. It can be preceded by <tt><</tt> or <tt>></tt> to indicate a 3892: maximum or minimum number of ancestors. If these symbols are missing, the 3893: condition is satisfied only if it exists exactly <i>n</i> ancestors. When 1.30 cvs 3894: this number is missing, it is equivalent to > 0.</p> 1.42 quint 3895: </div> 3896: 3897: <div class="subsubsection"> 3898: <h4><a name="sectd421411" id="sectd421411">Conditions based on the element 3899: type</a></h4> 1.30 cvs 3900: 3901: <p>If the condition applies to presentation rules associated with an 3902: attribute, in the <tt>ATTRIBUTES</tt> section of the presentation schema, the 3903: condition can be simply an element name. Presentation rules are then executed 3904: only if the attribute is attached to an element of that type. The keyword 3905: <tt>NOT</tt> before the element name indicates that the presentation rules 3906: must be executed only if the element is not of the type indicated.</p> 1.18 cvs 3907: </div> 1.1 cvs 3908: 1.18 cvs 3909: <div class="subsubsection"> 1.37 cvs 3910: <h4><a name="sectd42142" id="sectd42142">Conditions on references</a></h4> 1.30 cvs 3911: 3912: <p>References may be taken into account in conditions, which can be based on 3913: the fact that the element, or one of its ancestors, is designated by a at 3914: least one reference (<tt>Referred</tt>) or by none (<tt>NOT 3915: Referred</tt>).</p> 3916: 3917: <p>If the element or attribute to which the condition is attached is a 3918: reference, the condition can be based on the fact that it acts as the first 3919: reference to the designated element (<tt>FirstRef</tt>), or as the last 3920: (<tt>LastRef</tt>), or as a reference to an element located in another 3921: document (<tt>ExternalRef</tt>) or in the same document 3922: (<tt>InternalRef</tt>).</p> 1.1 cvs 3923: 1.30 cvs 3924: <p>The condition can also be based on the fact that the element is an <a 1.37 cvs 3925: href="#inclusion">inclusion</a>. This is noted (<tt>CopyRef</tt>).</p> 1.30 cvs 3926: 3927: <p>Like all conditions, conditions on references can be inverted by the 1.18 cvs 3928: <tt>NOT</tt> keyword. These conditions can be associated only with <a 3929: href="#sectc4232">creation rules</a>.</p> 3930: </div> 1.1 cvs 3931: 1.18 cvs 3932: <div class="subsubsection"> 1.37 cvs 3933: <h4><a name="sectd42143" id="sectd42143">Conditions on logical 3934: attributes</a></h4> 1.30 cvs 3935: 3936: <p>The condition can be based on the presence or absence of attributes 3937: associated with the element, no matter what the attributes or their values. 3938: The <tt>AnyAttributes</tt> keyword expresses this condition.</p> 1.1 cvs 3939: 1.42 quint 3940: <p>A condition can also be based on the presence or absence of a given 3941: attribute associated with the element. This condition is simply expressed by 1.44 quint 3942: the name of the attribute. The condition may also be based on the presence of 3943: a given attribute associated with a parent of the element. This condition is 3944: expressed by the <code>Inherited</code> keyword, followed by the name of the 3945: attribute.</p> 1.42 quint 3946: 3947: <p>The condition can be based on the value of a given attribute. It is then 3948: expressed by the name of the attribute, followed by the '=' sign and the 3949: value to be tested. Depending on the type of attribute, the value is simply 3950: an integer (possibly negative), the name of one of the possible values of the 1.44 quint 3951: attribute or a quoted character string. If the attribute with the specified 3952: value has to be checked on the ancestors of the element, this condition 3953: starts with the keyword <code>Inherited.</code></p> 1.42 quint 3954: 1.30 cvs 3955: <p>If the condition appears in the presentation rules of an attribute, the 1.37 cvs 3956: <tt>FirstAttr</tt> and <tt>LastAttr</tt> keywords can be used to indicate 3957: that the rules must only be applied if this attribute is the first attribute 3958: for the element or if it is the last (respectively). These conditions can 3959: also be inverted by the <tt>NOT</tt> keyword. These conditions can be 3960: associated only with <a href="#sectc4232">creation rules</a>.</p> 1.30 cvs 3961: 3962: <p>It is also possible to apply certain presentation rules only when the 3963: element being processed or one of its ancestors has a certain attribute, 1.37 cvs 3964: perhaps with a certain value. This can be done in the <a 1.18 cvs 3965: href="#sectc4210"><tt>ATTRIBUTES</tt> section</a>.</p> 3966: </div> 1.1 cvs 3967: 1.18 cvs 3968: <div class="subsubsection"> 1.37 cvs 3969: <h4><a name="sectd42144" id="sectd42144">Conditions on page breaks</a></h4> 1.1 cvs 3970: 1.30 cvs 3971: <p>The page break base type (and only this type) can use the following 1.18 cvs 3972: conditions: <tt>ComputedPage</tt>, <tt>StartPage</tt>, and <tt>UserPage</tt>. 3973: The <tt>ComputedPage</tt> condition indicates that the presentation rule(s) 1.37 cvs 3974: should apply if the page break was created automatically by Thot; the 3975: <tt>StartPage</tt> condition is true if the page break is generated before 3976: the element by the <tt>Page</tt> rule; and the <tt>UserPage</tt> condition 3977: applies if the page break was inserted by the user.</p> 1.30 cvs 3978: 3979: <p>These conditions can be associated only with <a href="#sectc4232">creation 1.18 cvs 3980: rules</a>.</p> 3981: </div> 1.1 cvs 3982: 1.18 cvs 3983: <div class="subsubsection"> 1.37 cvs 3984: <h4><a name="sectd42145" id="sectd42145">Conditions on the element's 3985: content</a></h4> 1.1 cvs 3986: 1.37 cvs 3987: <p>The condition can be based on whether or not the element is empty. An 1.30 cvs 3988: element which has no children or whose leaves are all empty is considered to 1.37 cvs 3989: be empty itself. This condition is expressed by the <tt>Empty</tt> keyword, 1.30 cvs 3990: optionally preceded by the <tt>NOT</tt> keyword. This condition can be 3991: associated only with <a href="#sectc4232">creation rules</a>.</p> 1.18 cvs 3992: </div> 1.1 cvs 3993: 1.18 cvs 3994: <div class="subsubsection"> 1.37 cvs 3995: <h4><a name="sectd42146" id="sectd42146">Conditions on counters</a></h4> 1.1 cvs 3996: 1.30 cvs 3997: <p>Presentation rules can apply when the counter's value is one, is even or 3998: odd, is equal, greater than or less than a given value or falls in a range of 1.37 cvs 3999: values. This is particularly useful for creating header and footer boxes. 1.18 cvs 4000: These conditions can be associated only with <a href="#sectc4232">creation 4001: rules</a>.</p> 1.30 cvs 4002: 4003: <p>To compare the value of a counter to a given value, a comparison is given 1.1 cvs 4004: between parentheses. The comparison is composed of the counter name followed 4005: by an equals, greater than, or less than sign and the value to which the 1.37 cvs 4006: counter will be compared. A test for whether or not a counter's value falls 4007: in a range also appears within parentheses. In this case, the counter name is 1.18 cvs 4008: followed by the <tt>IN</tt> keyword and the range definition within brackets. 4009: The <tt>Even</tt>, <tt>Odd</tt> and <tt>One</tt> are used to test a counter's 4010: value and are followed by the counter name between parentheses.</p> 1.30 cvs 4011: 4012: <p>The list of possible conditions on counters is:</p> 1.18 cvs 4013: <dl> 1.30 cvs 4014: <dt><tt>Even (Counter)</tt></dt> 4015: <dd>the box is created only if the counter has an even value.</dd> 4016: <dt><tt>Odd (Counter)</tt></dt> 4017: <dd>the box is created only if the counter has an odd value.</dd> 4018: <dt><tt>One (Counter)</tt></dt> 4019: <dd>the box is created only the counter's value is 1.</dd> 4020: <dt><tt>NOT One (Counter)</tt></dt> 4021: <dd>the box is created, unless the counter's value is 1.</dd> 4022: <dt><tt>(Counter < Value)</tt></dt> 4023: <dd>the box is created only if the counter's value is less than 4024: Value.</dd> 4025: <dt><tt>(Counter > Value)</tt></dt> 4026: <dd>the box is created only if the counter's value is greater than 4027: Value.</dd> 4028: <dt><tt>(Counter = Value)</tt></dt> 4029: <dd>the box is created only if the counter's value is equal to Value.</dd> 4030: <dt><tt>NOT (Counter = Value)</tt></dt> 4031: <dd>the is created only if the counter's value is different than 4032: Value.</dd> 4033: <dt><tt>(Counter IN [MinValue..MaxValue])</tt></dt> 4034: <dd>the box is created only if the counter's value falls in the range 4035: bounded by MinValue and MaxValue (inclusive).</dd> 4036: <dt><tt>NOT (Counter IN [MinValue..MaxValue])</tt></dt> 4037: <dd>the box is created only if the value of the counter does not fall in 4038: the range bounded by MinValue and MaxValue (inclusive).</dd> 1.18 cvs 4039: </dl> 1.30 cvs 4040: 4041: <p><strong>Note:</strong> the <tt>NOT Even</tt> and <tt>NOT Odd</tt> 4042: conditions are syntactically correct but can be expressed more simply by 4043: <tt>Odd</tt> and <tt>Even</tt>, respectively.</p> 1.18 cvs 4044: </div> 4045: </div> 1.1 cvs 4046: 1.18 cvs 4047: <div class="subsection"> 1.37 cvs 4048: <h3><a name="sectc4215" id="sectc4215">A presentation rule</a></h3> 1.1 cvs 4049: 1.34 cvs 4050: <p>A presentation rule defines either a presentation property or presentation 1.37 cvs 4051: function. The properties are:</p> 1.18 cvs 4052: <ul> 1.30 cvs 4053: <li>the position of the vertical and horizontal reference axes of the 4054: box,</li> 4055: <li>the position of the box in relation to other boxes,</li> 4056: <li>the height or width of the box, with overflow exceptions,</li> 4057: <li>the margins, padding and borders of the box,</li> 1.54 quint 4058: <li>the style and position of list item markers,</li> 1.30 cvs 4059: <li>the characteristics of the lines contained in the box: linespacing, 1.40 quint 4060: indentation of the first line, hyphenation, writing direction</li> 1.30 cvs 4061: <li>the conditions for breaking the box across pages,</li> 4062: <li>the characteristics of the characters contained in the box: size, font, 4063: style, underlining,</li> 4064: <li>the depth of the box among overlapping boxes (often called stacking 4065: order),</li> 4066: <li>the characteristics of graphic elements contained in the box: style and 4067: thickness of lines, fill pattern for closed objects,</li> 1.37 cvs 4068: <li>the colors in text, graphics, pictures, and symbols contained in the 4069: box are displayed or printed,</li> 1.48 quint 4070: <li>the opacity of the element,</li> 1.30 cvs 4071: <li>for presentation boxes only, the contents of the box.</li> 4072: </ul> 4073: 1.37 cvs 4074: <p>The <a name="presfunct" id="presfunct">presentation functions</a> are:</p> 1.30 cvs 4075: <ul> 4076: <li>the creation of a presentation box</li> 4077: <li>the line-breaking or page-breaking style,</li> 4078: <li>the copying of another box,</li> 4079: <li>the display of the box background and border,</li> 4080: <li>the display of a background picture and its aspect.</li> 4081: </ul> 4082: 1.37 cvs 4083: <p>For each box and each view, every presentation property is defined once 4084: and only once, either explicitly or by the <a href="#sectc427">default 4085: rules</a>. In contrast, presentation functions are not obligatory and can 4086: appear many times for the same element. for example an element can create 4087: many presentation boxes. Another element may not use any presentation 1.18 cvs 4088: functions.</p> 1.30 cvs 4089: 1.34 cvs 4090: <p>Each rule defining a presentation property begins with a keyword followed 1.37 cvs 4091: by a colon. The keyword indicates the property which is the subject of the 4092: rule. After the keyword and the colon, the remainder of the rule varies. All 1.18 cvs 4093: rules are terminated by a semicolon.</p> 1.34 cvs 4094: <pre> Rule = Property ';' / PresFunc ';' . 1.49 quint 4095: Property ='VertRef' ':' HorizPosition / 4096: 'HorizRef' ':' VertPosition / 1.6 cvs 4097: 'VertPos' ':' VPos / 4098: 'HorizPos' ':' HPos / 1.49 quint 4099: 'Float' ':' FloatInherit / 4100: 'Clear' ':' ClearInherit / 1.6 cvs 4101: 'Height' ':' Dimension / 4102: 'Width' ':' Dimension / 4103: 'VertOverflow' ':' Boolean / 1.1 cvs 4104: 'HorizOverflow' ':' Boolean / 1.26 cvs 4105: 'MarginTop' ':' MarginWidth / 4106: 'MarginRight' ':' MarginWidth / 4107: 'MarginBottom' ':' MarginWidth / 4108: 'MarginLeft' ':' MarginWidth / 4109: 'PaddingTop' ':' PaddingWidth / 4110: 'PaddingRight' ':' PaddingWidth / 4111: 'PaddingBottom' ':' PaddingWidth / 4112: 'PaddingLeft' ':' PaddingWidth / 4113: 'BorderTopWidth' ':' BorderWidth / 4114: 'BorderRightWidth' ':' BorderWidth / 4115: 'BorderBottomWidth' ':' BorderWidth / 4116: 'BorderLeftWidth' ':' BorderWidth / 4117: 'BorderTopColor' ':' BorderColor / 4118: 'BorderRightColor' ':' BorderColor / 4119: 'BorderBottomColor' ':' BorderColor / 4120: 'BorderLeftColor' ':' BorderColor / 4121: 'BorderTopStyle' ':' BorderStyle / 4122: 'BorderRightStyle' ':' BorderStyle / 4123: 'BorderBottomStyle' ':' BorderStyle / 1.54 quint 4124: 'BorderLeftStyle' ':' BorderStyle / 4125: 'ListStyleType' ':' ListStyleType / 4126: 'ListStyleImage' ':' ListStyleImage / 4127: 'ListStylePosition' ':' ListStylePosition / 1.6 cvs 4128: 'LineSpacing' ':' DistanceInherit / 4129: 'Indent' ':' DistanceInherit / 4130: 'Adjust' ':' AdjustInherit / 4131: 'Hyphenate' ':' BoolInherit / 1.40 quint 4132: 'Direction' ':' DirInherit / 1.43 quint 4133: 'UnicodeBidi' ':' BidiInherit / 1.6 cvs 4134: 'PageBreak' ':' Boolean / 4135: 'LineBreak' ':' Boolean / 4136: 'InLine' ':' Boolean / 4137: 'NoBreak1' ':' AbsDist / 4138: 'NoBreak2' ':' AbsDist / 4139: 'Gather' ':' Boolean / 4140: 'Visibility' ':' NumberInherit / 4141: 'Size' ':' SizeInherit / 4142: 'Font' ':' NameInherit / 4143: 'Style' ':' StyleInherit / 1.23 cvs 4144: 'Weight' ':' WeightInherit / 1.6 cvs 4145: 'Underline' ':' UnderLineInherit / 4146: 'Thickness' ':' ThicknessInherit / 4147: 'Depth' ':' NumberInherit / 4148: 'LineStyle' ':' LineStyleInherit / 4149: 'LineWeight' ':' DistanceInherit / 4150: 'FillPattern' ':' NameInherit / 4151: 'Background' ':' NameInherit / 1.13 cvs 4152: 'Foreground' ':' NameInherit / 1.47 quint 4153: 'Opacity' ':' OpacityInherit / 4154: 'FillOpacity' ':' OpacityInherit / 4155: 'StrokeOpacity' ':' OpacityInherit / 1.6 cvs 4156: 'Content' ':' VarConst . 1.1 cvs 4157: PresFunc = Creation '(' BoxID ')' / 4158: 'Line' / 4159: 'NoLine' / 1.54 quint 4160: 'Display' ':' DisplayVal / 1.1 cvs 4161: 'Page' '(' BoxID ')' / 1.13 cvs 4162: 'Copy' '(' BoxTypeToCopy ')' / 4163: 'ShowBox' / 1.18 cvs 4164: 'BackgroundPicture' ':' FileName / 4165: 'PictureMode' ':' PictMode /</pre> 4166: </div> 4167: 4168: <div class="subsection"> 1.37 cvs 4169: <h3><a name="sectc4216" id="sectc4216">Box axes</a></h3> 1.18 cvs 4170: 1.30 cvs 4171: <p>The position of the middle axes <tt>VMiddle</tt> and <tt>HMiddle</tt> in 1.1 cvs 4172: relation to their box is always calculated automatically as a function of the 1.37 cvs 4173: height and width of the box and is not specified by the presentation rules. 4174: In the presentation schema, these middle axes are used only to position their 4175: box with respect to another by specifying the distance between the middle 4176: axis and an axis or a side of another box (see the <a 4177: href="#sectc4218">relative position</a>).</p> 4178: 4179: <p>The reference axes of a box are also used to position their box in 4180: relation to another, but in contrast to the middle axes, the presentation 4181: schema must make their position explicit, either in relation to a side or the 4182: middle axis of the box itself, or in relation to an axis of an enclosed 4183: box.</p> 1.30 cvs 4184: 1.37 cvs 4185: <p>Only boxes of base elements have predefined reference axes. For character 1.1 cvs 4186: string boxes, the horizontal reference axis is the baseline of the characters 4187: (the line which passes immediately under the upper-case letters, ignoring the 4188: letter Q) and the vertical reference axis is at the left edge of the first 1.18 cvs 4189: character of the string.</p> 1.30 cvs 4190: 1.37 cvs 4191: <p>The positions of a box's reference axes are defined by the 4192: <tt>VertRef</tt> and <tt>HorizRef</tt> rules which specify the <a 4193: href="#distance">distance</a> between the reference axis and an axis or 4194: parallel side of the same box or of an enclosed box.</p> 1.49 quint 4195: <pre> 'VertRef' ':' HorizPosition 4196: 'HorizRef' ':' VertPosition</pre> 1.30 cvs 4197: 1.18 cvs 4198: <blockquote class="example"> 1.30 cvs 4199: <p><strong>Example:</strong></p> 4200: 4201: <p>If, in the structure schema for mathematical formulas, the fraction 4202: element is defined by</p> 4203: <pre>Fraction = BEGIN 1.1 cvs 4204: Numerator = Expression; 4205: Denominator = Expression; 1.18 cvs 4206: END;</pre> 1.30 cvs 4207: 4208: <p>then the horizontal reference axis of the fraction can be positioned on 4209: top of the denominator by the rule:</p> 4210: <pre>Fraction : 1.1 cvs 4211: BEGIN 4212: HorizRef : Enclosed Denominator . Top; 4213: ... 1.18 cvs 4214: END;</pre> 1.30 cvs 4215: 4216: <p>To put the horizontal reference axis of a column at its middle:</p> 4217: <pre>Column : 1.1 cvs 4218: BEGIN 4219: HorizRef : * . HMiddle; 4220: ... 1.18 cvs 4221: END;</pre> 4222: </blockquote> 4223: </div> 1.1 cvs 4224: 1.18 cvs 4225: <div class="subsection"> 1.37 cvs 4226: <h3><a name="sectc4217" id="sectc4217">Distance units</a></h3> 1.1 cvs 4227: 1.30 cvs 4228: <p>Some distances and dimensions appear in many rules of a presentation 4229: schema, especially in position rules (<tt>VertPos, HorizPos</tt>), in extent 4230: rules for boxes (<tt>Height, Width</tt>), in rules defining lines 1.37 cvs 4231: (<tt>LineSpacing, Indent</tt>), in rules controlling pagination 4232: (<tt>NoBreak1, NoBreak2</tt>) and in rules specifying the thickness of 4233: strokes (<tt>LineWeight</tt>).</p> 1.30 cvs 4234: 4235: <p>In all these rules, the distance or extent can be expressed</p> 4236: <ul> 4237: <li>either in relative units, which depend on the size of the characters in 4238: the current font: height of the element's font or height of the letter 4239: 'x',</li> 1.37 cvs 4240: <li>or in absolute units: centimeter, millimeter, inch, typographer's 4241: point, pica or pixel.</li> 1.30 cvs 4242: </ul> 4243: 1.37 cvs 4244: <p>Units can be chosen freely. Thus, it is possible to use relative units in 1.30 cvs 4245: one rule, centimeters in the next rule, and typographer's points in 4246: another.</p> 4247: 1.37 cvs 4248: <p>Absolute units are used to set rigid rules for the appearance of 4249: documents. In contrast, relative units allow changes of scale. The editor 4250: lets the value of relative units be changed dynamically. Such changes affect 4251: every box using relative units simultaneously and in the same proportion. 4252: Changing the value of the relative units affects the size of the characters 4253: and graphical elements, and the size of the boxes and the distances between 4254: them.</p> 4255: 4256: <p>A <a name="distance" id="distance">distance</a> or extent is specified by 4257: a number, which may be followed by one or more spaces and a units keyword. 4258: When there is no units keyword, the number specifies the number of relative 4259: units, where a relative unit is the height of a character in the current font 4260: (an em). When the number is followed by a units keyword, the keyword 4261: indicates the type of absolute units:</p> 1.18 cvs 4262: <ul> 1.40 quint 4263: <li><tt>em</tt> : height of the element's font,</li> 4264: <li><tt>ex</tt> : height of the letter 'x',</li> 4265: <li><tt>cm</tt> : centimeter,</li> 4266: <li><tt>mm</tt> : millimeter,</li> 4267: <li><tt>in</tt> : inch (1 in = 2.54 cm),</li> 4268: <li><tt>pt</tt> : point (1 pt = 1/72 in),</li> 4269: <li><tt>pc</tt> : pica (1 pc = 12 pt),</li> 4270: <li><tt>px</tt> : pixel.</li> 1.18 cvs 4271: </ul> 1.30 cvs 4272: 4273: <p>Whatever the chosen unit, relative or absolute, the number is not 1.37 cvs 4274: necessarily an integer and may be expressed in fixed point notation (using 4275: the American convention of a period to express the decimal point).</p> 1.30 cvs 4276: 1.37 cvs 4277: <p>If the distance appears in a presentation rule for a numeric attribute, 4278: the number can be replaced by the name of an attribute. In this case, the 4279: value of the attribute is used. Obviously, the attribute name cannot be 4280: followed by a decimal point and a fractional part, but it can be followed a 4281: units keyword. However, the choice of units is limited to em, ex, pt and 4282: px.</p> 1.18 cvs 4283: <pre> Distance = [ Sign ] AbsDist . 1.1 cvs 4284: Sign ='+' / '-' . 4285: AbsDist = IntegerOrAttr [ '.' DecimalPart ] 4286: [ Unit ]. 4287: IntegerOrAttr = IntegerPart / AttrID . 4288: IntegerPart = NUMBER . 4289: DecimalPart = NUMBER . 4290: Unit ='em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' / 1.18 cvs 4291: 'pc' / 'px' / '%' .</pre> 1.30 cvs 4292: 1.18 cvs 4293: <blockquote class="example"> 1.30 cvs 4294: <p><strong>Example:</strong></p> 4295: 4296: <p>The following rules specify that a box has a height of 10.5 centimeters 4297: and a width of 5.3 ems:</p> 4298: <pre>Height : 10.5 cm; 1.18 cvs 4299: Width : 5.3;</pre> 4300: </blockquote> 4301: </div> 1.1 cvs 4302: 1.18 cvs 4303: <div class="subsection"> 1.37 cvs 4304: <h3><a name="sectc4218" id="sectc4218">Relative positions</a></h3> 1.1 cvs 4305: 1.37 cvs 4306: <p>The positioning of boxes uses the eight axes and sides, the sides 4307: generally being used to define the juxtapositioning (vertical or horizontal) 4308: of boxes, the middle axes being used to define centering, and the reference 4309: axes being used for alignment.</p> 4310: 4311: <p>Two rules allow a box to be placed relative to other boxes. The 4312: <tt>VertPos</tt> rule positions the box vertically. The <tt>HorizPos</tt> 4313: rule positions the box horizontally. It is possible that a box's position 4314: could be entirely determined by other boxes positioned relative to it. In 4315: this case, the position is implicit and the word <tt>nil</tt> can be used to 4316: specify that no position rule is needed. Otherwise, an explicit rule must be 1.18 cvs 4317: given by indicating the axis or side which defines the position of the box, 4318: followed by an equals sign and the distance between between this axis or side 1.37 cvs 4319: and a parallel axis or side of another box, called the reference box. The box 1.18 cvs 4320: for which the rule is written will be positioned relative to the reference 4321: box.</p> 4322: <pre> 'VertPos' ':' VPos 1.6 cvs 4323: 'HorizPos' ':' HPos 4324: HPos = 'nil' / VertAxis '=' HorizPosition 4325: [ 'UserSpecified' ]. 4326: VPos = 'nil' / HorizAxis '=' VertPosition 4327: [ 'UserSpecified' ]. 1.1 cvs 4328: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' . 1.18 cvs 4329: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .</pre> 1.30 cvs 4330: 1.37 cvs 4331: <p>The reference box is an adjacent box: enclosing, enclosed or adjacent. 4332: When a rule is associated with a reference type attribute (and only in this 4333: case), it can be a box of the element designated by the attribute. The 4334: reference box can be either a presentation box previously defined in the 4335: <tt>BOXES</tt> section of the schema and created by a creation function, or 4336: the box associated with a structured element.</p> 4337: 4338: <p>The structural position of the reference box (relative to the box for 4339: which the rule is being written) is indicated by a keyword: 4340: <tt>Enclosing</tt>, <tt>Enclosed</tt>, or, for sibling boxes, 4341: <tt>Previous</tt> or <tt>Next</tt>. The reference attributes, or presentation 4342: boxes created by a reference attribute, the <tt>Referred</tt> keyword may be 4343: used to designate the element which the reference points to. The keyword 4344: <tt>Creator</tt> can be used in rules for presentation boxes to designate the 4345: box of the element which created the presentation box. Finally, the 4346: <tt>Root</tt> keyword can be used to designate the root of the document.</p> 1.30 cvs 4347: 4348: <p>When the keyword is ambiguous, it is followed by the name of an element 4349: type or presentation box which resolves the ambiguity (the <tt>Creator</tt> 1.37 cvs 4350: and <tt>Root</tt> keywords are never ambiguous). If this name is not given, 1.30 cvs 4351: then the first box encountered is used as the reference box. It is also 4352: possible to use just the name of an element type or presentation box without 1.37 cvs 4353: an initial keyword. In this case, a sibling having that name will be used. If 1.30 cvs 4354: the name is preceded by the keyword <tt>NOT</tt>, then the reference box will 4355: be the first box whose type is not the named one.</p> 4356: 4357: <p>In place of the box or type name, the keywords <tt>AnyElem</tt>, 1.18 cvs 4358: <tt>AnyBox</tt> and <tt>ElemWithAttr</tt> can be used, representing 1.17 cvs 4359: respectively, any structured element box, any presentation box, and the box 4360: corresponding to any structured element having a particular attribute, 4361: whatever its value; the name of this attribute must follow the keyword 1.18 cvs 4362: <tt>ElemWithAttr</tt>.</p> 1.30 cvs 4363: 4364: <p>A type name may be preceded by a star in order to resolve the ambiguity in 4365: the special case where the structure schema defines an <a 1.18 cvs 4366: href="#sectd3284">inclusion</a> without expansion (or with partial expansion) 1.37 cvs 4367: of the same type as an element of the scheme. For mark pairs (and only for <a 1.18 cvs 4368: href="#sectd3285">mark pairs</a>) the type name <em>must</em> be preceded by 4369: the <tt>First</tt> or <tt>Second</tt> keyword, which indicates which of the 1.37 cvs 4370: two marks of the pair should be used as the reference box.</p> 1.30 cvs 4371: 4372: <p>The star character ('<tt>*</tt>') used alone designates the box to which 1.37 cvs 4373: the rule applies (in this case, it is obviously useless to specify the type 4374: of the reference box).</p> 1.30 cvs 4375: 1.37 cvs 4376: <p>The keywords <tt>Enclosing</tt> and <tt>Enclosed</tt> can be used no 4377: matter what constructor defines the type to which the rule applies. When 4378: applied to the element which represents the entire document, 4379: <tt>Enclosing</tt> designates the window or page in which the document's 4380: image is displayed for the view to which the rule applies. A box or type name 4381: without a keyword is used for aggregate elements and designates another 4382: element of the same aggregate. It can also be used to designate a 4383: presentation or page layout box. The keywords <tt>Previous</tt> and 4384: <tt>Next</tt> are primarily used to denote list elements, but can also be 4385: used to denote elements of an aggregate.</p> 4386: 4387: <p>In the position rule, the structural position relative to the reference 4388: box is followed, after a period, by the name of an axis or side. The rule 4389: specifies its node's position as being some distance from this axis or side 4390: of the reference box. If this distance is zero, then the distance does not 4391: appear in the rule. Otherwise, it does appear as a positive or negative 1.30 cvs 4392: number (the sign is required for negative numbers). The sign takes into 4393: account the orientation of the coordinate axes: for top to bottom for the 1.37 cvs 4394: vertical axis and from left to right for the horizontal axis. Thus, a 1.30 cvs 4395: negative distance in a vertical position indicates that the side or axis 4396: specified in the rule is above the side or axis of the reference box.</p> 4397: 1.37 cvs 4398: <p>The distance can be followed by the <tt>UserSpecified</tt> keyword (even 4399: if the distance is nil and does not appear, the <tt>UserSpecified</tt> 4400: keyword can be used). It indicates that when the element to which the rule 4401: applies is being created, the editor will ask the user to specify the 4402: distance himself, using the mouse. In this case, the distance specified in 4403: the rule is a default distance which is suggested to the user but can be 4404: modified. The <tt>UserSpecified</tt> keyword can be used either in the 4405: vertical position rule, the horizontal position rule, or both.</p> 1.18 cvs 4406: <pre> VertPosition = Reference '.' HorizAxis [ Distance ] . 1.1 cvs 4407: HorizPosition = Reference '.' VertAxis [ Distance ] . 4408: Reference ='Enclosing' [ BoxTypeNot ] / 4409: 'Enclosed' [ BoxTypeNot ] / 4410: 'Previous' [ BoxTypeNot ] / 4411: 'Next' [ BoxTypeNot ] / 4412: 'Referred' [ BoxTypeNot ] / 4413: 'Creator' / 4414: 'Root' / 4415: '*' / 4416: BoxOrType . 4417: BoxOrType = BoxID / 4418: [ '*' ] [ FirstSec ] ElemID / 1.17 cvs 4419: 'AnyElem' / 'AnyBox' / 4420: 'ElemWithAttr' AttrID . 1.18 cvs 4421: BoxTypeNot = [ 'NOT' ] BoxOrType .</pre> 1.30 cvs 4422: 1.18 cvs 4423: <blockquote class="example"> 1.30 cvs 4424: <p><strong>Example:</strong></p> 4425: 1.37 cvs 4426: <p>If a <a name="expos1" id="expos1">report</a> is defined by the following 4427: structure schema:</p> 1.30 cvs 4428: <pre>Report = BEGIN 1.6 cvs 4429: Title = Text; 4430: Summary = Text; 4431: Keywords = Text; 4432: ... 1.18 cvs 4433: END;</pre> 1.30 cvs 4434: 4435: <p>then the presentation schema could contain the rules:</p> 4436: <pre>Report : BEGIN 1.6 cvs 4437: VertPos : Top = Enclosing . Top; 4438: HorizPos : Left = Enclosing . Left; 4439: ... 1.18 cvs 4440: END;</pre> 1.30 cvs 4441: 1.37 cvs 4442: <p>These rules place the <a name="reportexample" 4443: id="reportexample">report</a> in the upper left corner of the enclosing 4444: box, which is the window in which the document is being edited.</p> 1.30 cvs 4445: <pre>Title : BEGIN 1.6 cvs 4446: VertPos : Top = Enclosing . Top + 1; 4447: HorizPos : VMiddle = Enclosing . VMiddle; 4448: ... 1.18 cvs 4449: END;</pre> 1.30 cvs 4450: 1.37 cvs 4451: <p>The top of the title is one line (a line has the height of the 4452: characters of the title) from the top of the report, which is also the top 4453: of the editing window. The title is centered horizontally in the window 4454: (see <a href="#posdim">figure</a>).</p> 1.30 cvs 4455: <pre>Summary : BEGIN 1.1 cvs 4456: VertPos : Top = Title . Bottom + 1.5; 4457: HorizPos : Left = Enclosing . Left + 2 cm; 4458: ... 1.18 cvs 4459: END;</pre> 1.30 cvs 4460: 1.37 cvs 4461: <p>The top of the summary is place a line and a half below the bottom of 4462: the title and is shifted two centimeters from the side of the window.</p> 1.18 cvs 4463: </blockquote> 1.30 cvs 4464: 1.18 cvs 4465: <blockquote class="example"> 1.30 cvs 4466: <p><strong>Example:</strong></p> 4467: 1.37 cvs 4468: <p>Suppose there is a <a name="expos2" id="expos2">Design</a> logical 4469: structure which contains graphical elements:</p> 1.30 cvs 4470: <pre>Design = LIST OF (ElemGraph = GRAPHICS);</pre> 4471: 4472: <p>The following rules allow the user to freely choose the position of each 4473: element when it is created:</p> 4474: <pre>ElemGraph = 1.1 cvs 4475: BEGIN 4476: VertPos : Top = Enclosing . Top + 1 cm UserSpecified; 4477: HorizPos: Left = Enclosing . Left UserSpecified; 4478: ... 1.18 cvs 4479: END;</pre> 1.30 cvs 4480: 4481: <p>Thus, when a graphical element is created, its default placement is at 4482: the left of the window and 1 cm from the top, but the user can move it 4483: immediately, simply by moving the mouse.</p> 1.18 cvs 4484: </blockquote> 4485: </div> 1.1 cvs 4486: 1.18 cvs 4487: <div class="subsection"> 1.49 quint 4488: <h3><a name="Floats" id="Floats">Floats</a></h3> 4489: 4490: <p>Another way to set the position of a box is to make it a floating box. The 4491: notion of a floating box is the same as in CSS2. Refer to the <a 4492: href="http://www.w3.org/TR/REC-CSS2/visuren.html#floats">relevant section of 4493: the CSS2 Recommendation</a> for the details. The <code>Float</code> and 4494: <code>Clear</code> rules allow to control how floating boxes behave. The 4495: values of these rules are the same as in CSS2. Inheritance is indicated by 4496: <code>Enclosing =</code></p> 4497: <pre> 'Float' ':' FloatInherit 4498: 'Clear' ':' ClearInherit 4499: FloatInherit = Link '=' / 'Left' / 'Right' / 'None' . 4500: ClearInherit = Link '=' / 'None' / 'Left' / 'Right' / 'Both' .</pre> 4501: </div> 4502: 4503: <div class="subsection"> 1.37 cvs 4504: <h3><a name="sectc4219" id="sectc4219">Box extents</a></h3> 1.1 cvs 4505: 1.30 cvs 4506: <p>The extents (height and width) of each box are defined by the two rules 1.37 cvs 4507: <tt>Height</tt> and <tt>Width</tt>. There are three types of extents: fixed, 1.18 cvs 4508: relative, and elastic.</p> 1.1 cvs 4509: 1.18 cvs 4510: <div class="subsubsection"> 1.37 cvs 4511: <h4><a name="sectd42191" id="sectd42191">Fixed extents</a></h4> 1.1 cvs 4512: 1.30 cvs 4513: <p>A fixed dimension sets the height or width of the box independently of all 1.37 cvs 4514: other boxes. It is expressed in <a href="#sectc4217">distance units</a>. The 1.18 cvs 4515: extent can be followed by the <tt>UserSpecified</tt> keyword which indicates 1.1 cvs 4516: that when the element to which the rule applies is being created, the editor 1.37 cvs 4517: will ask the user to specify the extent himself, using the mouse. In this 1.1 cvs 4518: case, the extent specified in the rule is a default extent which is suggested 1.37 cvs 4519: to the user but can be modified. The <tt>UserSpecified</tt> keyword can be 1.18 cvs 4520: used either in the <tt>Height</tt> rule, the <tt>Width</tt> rule, or both.</p> 1.30 cvs 4521: 4522: <p>A fixed extent rule can be ended by the <tt>Min</tt> keyword, which 4523: signifies that the indicated value is a minimum, and that, if the contents of 4524: the box require it, a larger extent is possible.</p> 1.18 cvs 4525: <pre> 'Height' ':' Dimension 1.1 cvs 4526: 'Width' ':' Dimension 4527: Dimension = AbsDist [ 'UserSpecified' ] [ 'Min' ] / 1.18 cvs 4528: ...</pre> 1.30 cvs 4529: 1.18 cvs 4530: <blockquote class="example"> 1.30 cvs 4531: <p><strong>Example:</strong></p> 4532: 4533: <p>Continuing with the <a href="#expos2">previous example</a>, it is 4534: possible to allow the user to choose the size of each graphical element as 4535: it is created:</p> 4536: <pre>ElemGraph : BEGIN 1.6 cvs 4537: Width : 2 cm UserSpecified; 1.1 cvs 4538: Height : 1 cm UserSpecified; 4539: ... 1.18 cvs 4540: END;</pre> 1.30 cvs 4541: 4542: <p>Thus, when a graphical element is create, it is drawn by default with a 4543: width of 2 cm and a height of 1 cm, but the user is free to resize it 4544: immediately with the mouse.</p> 4545: <pre>Summary : BEGIN 1.1 cvs 4546: Height : 5 cm Min; 4547: ... 4548: END; 4549: Keywords : BEGIN 4550: VertPos : Top = Summary . Bottom; 4551: ... 1.18 cvs 4552: END;</pre> 4553: </blockquote> 4554: </div> 1.1 cvs 4555: 1.18 cvs 4556: <div class="subsubsection"> 1.37 cvs 4557: <h4><a name="sectd42192" id="sectd42192">Relative extents</a></h4> 1.30 cvs 4558: 4559: <p>A relative extent determines the extent as a function of the extent of 4560: another box, just as a relative position places a box in relation to another. 4561: The reference box in an extent rule is designated using the same syntax as is 1.37 cvs 4562: used in a relative position rule. It is followed by a period and a 1.30 cvs 4563: <tt>Height</tt> or <tt>Width</tt> keyword, depending on the extent being 1.37 cvs 4564: referred to. Next comes the relation between the extent being defined and the 4565: extent of the reference box. This relation can be either a percentage or a 1.30 cvs 4566: difference.</p> 1.1 cvs 4567: 1.37 cvs 4568: <p>A percentage is indicated by a star (the multiplication symbol) followed 4569: by the numeric percentage value (which may be greater than or less than 100) 4570: and the percent (`%') character. A difference is simply indicated by a signed 1.18 cvs 4571: difference.</p> 1.30 cvs 4572: 4573: <p>If the rule appears in the presentation rules of a numeric attribute, the 1.1 cvs 4574: percentage value can be replaced by the name of the attribute. This attribute 1.37 cvs 4575: is then used as a percentage. The attribute can also be used as part of a <a 1.18 cvs 4576: href="#distance">difference</a>.</p> 1.30 cvs 4577: 4578: <p>Just as with a fixed extent, a relative extent rule can end with the 1.18 cvs 4579: <tt>Min</tt> keyword, which signifies that the extent is a minimum and that, 4580: if the contents of the box require it, a larger extent is possible.</p> 1.30 cvs 4581: 4582: <p>A special case of relative extent rules is:</p> 1.18 cvs 4583: <pre>Height : Enclosed . Height;</pre> 1.30 cvs 4584: 4585: <p>or</p> 1.18 cvs 4586: <pre>Width : Enclosed . Width;</pre> 1.30 cvs 4587: 4588: <p>which specifies that the box has a height (or width) such that it encloses 4589: all the boxes which it contains, excluding boxes having a rule 4590: <tt>VertOverflow: Yes;</tt> or <tt>HorizOverflow: Yes;</tt>.</p> 4591: 4592: <p><strong>Note:</strong> character strings (type <tt>TEXT_UNIT</tt>) 4593: generally must use the sum of the widths of the characters which compose them 4594: as their width, which is expressed by the rule:</p> 1.18 cvs 4595: <pre>TEXT_UNIT : 4596: Width : Enclosed . Width;</pre> 1.30 cvs 4597: 4598: <p>If this rule is not the default <tt>Width</tt> rule, it must be given 1.18 cvs 4599: explicitly in the <tt>RULES</tt> section which defines the presentation rules 4600: of the logical elements.</p> 4601: <pre> 'Height' ':' Extent 1.1 cvs 4602: 'Width' ':' Extent 4603: Extent = Reference '.' HeightWidth [ Relation ] 4604: [ 'Min' ] / ... 4605: HeightWidth ='Height' / 'Width' . 4606: Relation ='*' ExtentAttr '%' / Distance . 4607: ExtentAttr = ExtentVal / AttrID . 1.18 cvs 4608: ExtentVal = NUMBER .</pre> 1.30 cvs 4609: 1.18 cvs 4610: <blockquote class="example"> 1.30 cvs 4611: <p><strong>Example:</strong></p> 4612: 4613: <p>Completing the <a href="#expos1">above example</a>, it is possible to 4614: specify that the report takes its width from the editing window and its 4615: height from the size of its contents (this can obviously be greater than 4616: that of the window):</p> 4617: <pre>Report : BEGIN 1.1 cvs 4618: Width : Enclosing . Width; 4619: Height : Enclosed . Height; 4620: ... 1.18 cvs 4621: END;</pre> 1.30 cvs 4622: 4623: <p>Then, the following rules make the title occupy 60% of the width of the 4624: report (which is that of the window) and is broken into centered lines of 4625: this width (see the <a href="#sectc4222"><tt>Line</tt> rule</a>).</p> 4626: <pre>Title : BEGIN 1.1 cvs 4627: Width : Enclosing . Width * 60%; 4628: Height : Enclosed . Height; 4629: Line; 4630: Adjust : VMiddle; 4631: ... 1.18 cvs 4632: END;</pre> 1.30 cvs 4633: 4634: <p>The summary occupy the entire width of the window, with the exception of 4635: a 2 cm margin reserved by the horizontal position rule:</p> 4636: <pre>Summary : BEGIN 1.1 cvs 4637: Width : Enclosing . Width - 2 cm; 4638: Height : Enclosed . Height; 4639: ... 1.18 cvs 4640: END;</pre> 4641: 1.37 cvs 4642: <p>This set of rules, plus the <a href="#reportexample">position rules 4643: given above</a>, produce the layout of boxes shown in the following<a 1.30 cvs 4644: href="#posdim">figure</a>.</p> 4645: 4646: <div class="figure"> 1.37 cvs 4647: <hr /> 1.30 cvs 4648: <pre>------------------------------------------------------------- 1.1 cvs 4649: | Window and Report ^ | 4650: | | 1 line | 4651: | v | 4652: | ------------------------------------- | 4653: | | | | 4654: : 20% : Title : 20% : 1.30 cvs 4655: :<--------->: :<--------->: 1.1 cvs 4656: : : 60% : : 1.30 cvs 4657: : :<--------------------------------->: : 1.1 cvs 4658: | | | | 4659: | ------------------------------------- | 4660: | ^ | 4661: | | 1.5 line | 4662: | | | 4663: | v | 4664: | ---------------------------------------------------| 4665: | 2 cm | | 1.30 cvs 4666: |<------>| Summary | 1.18 cvs 4667: : : :</pre> 1.19 cvs 4668: 1.37 cvs 4669: <p align="center"><em><a name="posdim" id="posdim">Box position and 1.30 cvs 4670: extent</a><em></em></em></p> 1.37 cvs 4671: <hr /> 1.30 cvs 4672: </div> 1.18 cvs 4673: </blockquote> 4674: </div> 1.1 cvs 4675: 1.18 cvs 4676: <div class="subsubsection"> 1.37 cvs 4677: <h4><a name="sectd42193" id="sectd42193">Elastic extents</a></h4> 1.1 cvs 4678: 1.37 cvs 4679: <p>The last type of extent is the elastic extent. Either one or both extents 4680: can be elastic. A box has an elastic extent when two opposite sides are 1.30 cvs 4681: linked by distance constraints to two sides or axes of other boxes.</p> 4682: 4683: <p>One of the sides of the elastic box is linked by a position rule 1.37 cvs 4684: (<tt>VertPos</tt> or <tt>HorizPos</tt>) to a neighboring box. The other side 1.18 cvs 4685: is link to another box by a <tt>Height</tt> or <tt>Width</tt> rule, which 1.37 cvs 4686: takes the same form as the position rule. For the elastic box itself, the 1.1 cvs 4687: notions of sides (left or right, top or bottom) are fuzzy, since the movement 4688: of either one of the two reference boxes can, for example, make the left side 1.37 cvs 4689: of the elastic box move to the right of its right side. This is not 4690: important. The only requirement is that the two sides of the elastic box used 1.18 cvs 4691: in the position and extent rule are opposite sides of the box.</p> 4692: <pre> 'Height' ':' Extent 1.6 cvs 4693: 'Width' ':' Extent 1.18 cvs 4694: Extent = HPos / VPos / ...</pre> 1.30 cvs 4695: 1.18 cvs 4696: <blockquote class="example"> 1.30 cvs 4697: <p><strong>Example:</strong></p> 4698: 4699: <p>Suppose we want to draw an elastic arrow or line between the middle of 1.37 cvs 4700: the bottom side of box A and the upper left corner of box B. To do this, we 1.30 cvs 4701: would define a graphics box whose upper left corner coincides with the 4702: middle of the bottom side of A (a position rule) and whose lower right 4703: corner coincides with with the upper left corner of B (dimension rules):</p> 4704: <pre>LinkedBox : 1.1 cvs 4705: BEGIN 1.6 cvs 4706: VertPos : Top = A .Bottom; 1.1 cvs 4707: HorizPos : Left = A . VMiddle; 1.6 cvs 4708: Height : Bottom = B . Top; 4709: Width : Right = B . Left; 1.18 cvs 4710: END;</pre> 4711: </blockquote> 1.30 cvs 4712: 1.18 cvs 4713: <blockquote class="example"> 1.30 cvs 4714: <p><strong>Example:</strong></p> 4715: 4716: <p>The element SectionTitle creates a presentation box called SectionNum 1.37 cvs 4717: which contains the number of the section. Suppose we want to align the 4718: SectionNum and SectionTitle horizontally, have the SectionNum take its 4719: width from its contents (the section number), have the SectionTitle box 4720: begin 0.5 cm to the right of the SectionNum box and end at the right edge 4721: of its enclosing box. This would make the SectionTitle box elastic, since 4722: its width is defined by the position of its left and right sides. The 4723: following rules produce this effect:</p> 1.30 cvs 4724: <pre>SectionNum : 1.1 cvs 4725: BEGIN 4726: HorizPos : Left = Enclosing . Left; 4727: Width : Enclosed . Width; 4728: ... 4729: END; 4730: 4731: SectionTitle : 4732: BEGIN 4733: HorizPos : Left = SectionNum . Right + 0.5 cm; 4734: Width : Right = Enclosing . Right; 4735: ... 1.18 cvs 4736: END;</pre> 4737: </blockquote> 4738: </div> 4739: </div> 1.1 cvs 4740: 1.18 cvs 4741: <div class="subsection"> 1.37 cvs 4742: <h3><a name="sectc4220" id="sectc4220">Overflow</a></h3> 1.1 cvs 4743: 1.48 quint 4744: <p>A box corresponding to a structural element normally contain all boxes 1.37 cvs 4745: corresponding to the elements of its subtree. However, in some cases, it 1.1 cvs 4746: could be necessary to allow a box to jut out from its parent box. Two 4747: presentation rules indicate that such an overflow is allowed, one for 1.18 cvs 4748: horizontal overflow, one for vertical overflow.</p> 1.30 cvs 4749: 4750: <p>Each of these rules is expressed by a keyword followed by a colon and the 1.18 cvs 4751: keyword <tt>Yes</tt> or <tt>No</tt>.</p> 4752: <pre> 'VertOverflow' ':' Boolean / 1.1 cvs 4753: 'HorizOverflow' ':' Boolean . 1.18 cvs 4754: Boolean = 'Yes' / 'No' .</pre> 4755: </div> 1.1 cvs 4756: 1.48 quint 4757: <div> 4758: <h3><a name="Margins" id="Margins">Margins, Padding and Borders</a></h3> 1.30 cvs 4759: 1.48 quint 4760: <p>Boxes (element boxes and presentation boxes as well) may have margins, 4761: padding and borders, exactly as in CSS. A set of presentation rules allow to 4762: control the width of margins, padding and borders along the four edges of 4763: boxes. Other rules determine the color and style of borders. Refer to the 4764: CSS2 specification for more details.</p> 1.26 cvs 4765: <pre> 'MarginTop' ':' MarginWidth / 4766: 'MarginRight' ':' MarginWidth / 4767: 'MarginBottom' ':' MarginWidth / 4768: 'MarginLeft' ':' MarginWidth / 4769: 'PaddingTop' ':' PaddingWidth / 4770: 'PaddingRight' ':' PaddingWidth / 4771: 'PaddingBottom' ':' PaddingWidth / 4772: 'PaddingLeft' ':' PaddingWidth / 4773: 'BorderTopWidth' ':' BorderWidth / 4774: 'BorderRightWidth' ':' BorderWidth / 4775: 'BorderBottomWidth' ':' BorderWidth / 4776: 'BorderLeftWidth' ':' BorderWidth / 4777: 'BorderTopColor' ':' BorderColor / 4778: 'BorderRightColor' ':' BorderColor / 4779: 'BorderBottomColor' ':' BorderColor / 4780: 'BorderLeftColor' ':' BorderColor / 4781: 'BorderTopStyle' ':' BorderStyle / 4782: 'BorderRightStyle' ':' BorderStyle / 4783: 'BorderBottomStyle' ':' BorderStyle / 4784: 'BorderLeftStyle' ':' BorderStyle . 4785: 4786: MarginWidth = InheritParent / 'Auto' / Distance . 4787: PaddingWidth = InheritParent / Distance . 4788: BorderWidth = InheritParent / 'Thin' / 'Medium' / 'Thick' / Distance . 4789: BorderColor = InheritParent / 'Transparent' / 'Foreground' / 4790: ColorName . 4791: BorderStyle = InheritParent / 4792: 'None' / 'Hidden' / 'Dotted' / 'Dashed' / 'Solid' / 4793: 'Double' / 'Groove' / 'Ridge' / 'Inset' / 'Outset' . 1.27 cvs 4794: InheritParent = 'Enclosing' '=' / 'Creator' '=' . 1.26 cvs 4795: ColorName = NAME .</pre> 1.48 quint 4796: </div> 1.26 cvs 4797: 1.18 cvs 4798: <div class="subsection"> 1.37 cvs 4799: <h3><a name="sectc4221" id="sectc4221">Inheritance</a></h3> 1.1 cvs 4800: 1.37 cvs 4801: <p>A presentation property can be defined by reference to the same property 4802: of another box in the tree of boxes. These structural links are expressed by 4803: kinship. The reference box can be that of the element immediately above in 1.18 cvs 4804: the structure (<tt>Enclosing</tt>), two levels above (<tt>GrandFather</tt>), 4805: immediately below (<tt>Enclosed</tt>) or immediately before 1.37 cvs 4806: (<tt>Previous</tt>). In the case of a presentation box, and only in that 1.1 cvs 4807: case, the reference box may be the element which created the presentation box 1.18 cvs 4808: (<tt>Creator</tt>).</p> 1.30 cvs 4809: 4810: <p>Kinship is expressed in terms of the logical structure of the document and 1.37 cvs 4811: not in terms of the tree of boxes. The presentation box cannot transmit any 1.34 cvs 4812: of their properties by inheritance; only structured element boxes can do so. 1.37 cvs 4813: As an example, consider an element B which follows an element A in the 4814: logical structure. The element B creates a presentation box P in front of 4815: itself, using the <tt>CreateBefore</tt> rule (see the <a 4816: href="#sectc4232">creation rules</a>). If element B's box inherits its 4817: character style using the <tt>Previous</tt> kinship operation, it gets its 4818: character style from A's box, not from P's box. Inheritance works differently 4819: for positions and extents, which can refer to presentation boxes.</p> 1.30 cvs 4820: 1.34 cvs 4821: <p>The inherited property value can be the same as that of the reference box. 1.37 cvs 4822: This is indicated by an equals sign. However, for numeric properties, a 1.1 cvs 4823: different value can be obtained by adding or subtracting a number from the 1.37 cvs 4824: reference box's property value. Addition is indicated by a plus sign before 4825: the number, while subtraction is specified with a minus sign. The value of a 1.34 cvs 4826: property can also be given a maximum (if the sign is a plus) or minimum (if 1.18 cvs 4827: the sign is a minus).</p> 1.30 cvs 4828: 4829: <p>If the rule is being applied to a numeric attribute, the number to add or 1.37 cvs 4830: subtract can be replaced by the attribute name. The value of a maximum or 4831: minimum may also be replaced by an attribute name. In these cases, the value 1.18 cvs 4832: of the attribute is used.</p> 4833: <pre> Inheritance = Kinship InheritedValue . 1.6 cvs 4834: Kinship ='Enclosing' / 'GrandFather' / 'Enclosed' / 4835: 'Previous' / 'Creator' . 1.1 cvs 4836: InheritedValue ='+' PosIntAttr [ 'Max' maximumA ] / 1.6 cvs 4837: '-' NegIntAttr [ 'Min' minimumA ] / 4838: '=' . 4839: PosIntAttr = PosInt / AttrID . 4840: PosInt = NUMBER . 4841: NegIntAttr = NegInt / AttrID . 4842: NegInt = NUMBER . 4843: maximumA = maximum / AttrID . 4844: maximum = NUMBER . 4845: minimumA = minimum / AttrID . 1.18 cvs 4846: minimum = NUMBER .</pre> 1.30 cvs 4847: 1.36 cvs 4848: <p>The properties which can be obtained by inheritance are hyphenation, 1.43 quint 4849: writing direction, Unicode-bidi, interline spacing, character font (font 4850: family), font style, font size, visibility, indentation, underlining, 4851: alignment of text, stacking order of objects, the style and thickness of 4852: lines, fill pattern and the colors of lines and characters.</p> 1.18 cvs 4853: </div> 1.1 cvs 4854: 1.18 cvs 4855: <div class="subsection"> 1.37 cvs 4856: <h3><a name="sectc4222" id="sectc4222">Line breaking</a></h3> 1.1 cvs 4857: 1.30 cvs 4858: <p>The <tt>Line</tt> rule specifies that the contents of the box should be 4859: broken into lines: the boxes included in the box to which this rule is 4860: attached are displayed one after the other, from left to right, with their 1.37 cvs 4861: horizontal reference axes aligned so that they form a series of lines. The 1.30 cvs 4862: length of these lines is equal to the width of the box to which the 4863: <tt>Line</tt> rule is attached.</p> 4864: 4865: <p>When an included box overflows the current line, it is either carried 1.45 quint 4866: forward to the next line, broken, or left the way it is. The <a 1.18 cvs 4867: href="#sectc4223"><tt>LineBreak</tt> rule</a> is used to allow or prevent the 1.37 cvs 4868: breaking of included boxes. If the included box is not breakable but is 4869: longer than the space remaining on the line, it is left as is. When a 1.1 cvs 4870: character string box is breakable, the line is broken between words or, if 1.37 cvs 4871: necessary, by <a href="#sectd42225">hyphenating a word</a>. When a compound 4872: box is breakable, the box is transparent in regard to line breaking. The 4873: boxes included in the compound box are treated just like included boxes which 4874: have the <tt>LineBreak</tt> rule. Thus, it is possible to traverse a complete 1.18 cvs 4875: subtree of boxes to line break the text leaves of a complex structure.</p> 1.30 cvs 4876: 4877: <p>The relative position rules of the included boxes are ignored, since the 4878: boxes will be placed according to the line breaking rules.</p> 4879: 1.37 cvs 4880: <p>The <tt>Line</tt> rule does not have a parameter. The characteristics of 4881: the lines that will be constructed are determined by the 1.43 quint 4882: <tt>LineSpacing</tt>, <tt>Indent</tt>, <tt>Adjust</tt>, <tt>Hyphenate</tt>, 4883: <code>Direction</code> and <code>UnicodeBidi</code> rules. Moreover, the <a 1.37 cvs 4884: href="#insectd42226"><tt>Inline</tt> rule</a> permits the exclusion of 1.36 cvs 4885: certain elements from the line breaking process.</p> 1.30 cvs 4886: 4887: <p>When the <tt>Line</tt> rule appears in the rules sequence of a non-primary 1.37 cvs 4888: view, it applies only to that view, but when the <tt>Line</tt> rule appears 4889: in the rules sequence of the primary view, it also applies to the other views 4890: by default, except for those views which explicitly invoke the 4891: <tt>NoLine</tt> rule. Thus, the <tt>NoLine</tt> rule can be used in a 4892: non-primary view to override the primary view's <tt>Line</tt> rule. The 4893: <tt>NoLine</tt> rule must not be used with the primary view because the 4894: absence of the <tt>Line</tt> rule has the same effect. Like the <tt>Line</tt> 4895: rule, the <tt>NoLine</tt> rule does not take any parameters.</p> 1.54 quint 4896: 4897: <p id="compatibil">For compatibility with CSS, langiage P also provides the 4898: <tt>Display</tt> rule which accepts the following values: <tt>Inline</tt>, 4899: <tt>Block</tt>, <tt>ListItem</tt>, <tt>RunIin</tt>, <tt>InlineBlock</tt>, and 4900: <tt>None</tt>, plus <tt>Enclosing =</tt> for inheritance. These values play 4901: the same role as in CSS. Notice that the effect of value <tt>ListItem</tt> 4902: depends on other rules related to lists: <tt>ListStyleType</tt>, 4903: <tt>ListStyleImage</tt> and <tt>ListStylePosition</tt>.</p> 4904: <pre> 'Line' 4905: 'NoLine' 4906: 'Display' ':' DisplayVal / 4907: DisplayVal = 'Inline' / 'Block' / 'ListItem' / 'RunIin' / 4908: 'InlineBlock' / 'None' / 'Enclosing' '=' .</pre> 1.18 cvs 4909: 4910: <div class="subsubsection"> 1.37 cvs 4911: <h4><a name="sectd42221" id="sectd42221">Line spacing</a></h4> 1.18 cvs 4912: 1.30 cvs 4913: <p>The <tt>LineSpacing</tt> rule defines the line spacing to be used in the 1.37 cvs 4914: line breaking process. The line spacing is the distance between the baselines 1.1 cvs 4915: (horizontal reference axis) of the successive lines produced by the 1.37 cvs 4916: <tt>Line</tt> rule. The value of the line spacing can be specified as a 4917: constant or by inheritance. It is expressed in any of the available <a 1.18 cvs 4918: href="#sectc4217">distance units</a>.</p> 1.30 cvs 4919: 4920: <p>Inheritance allows the value to be obtained from a relative in the 4921: structure tree, either without change (an equals sign appears after the 4922: inheritance keyword), with a positive difference (a plus sign), or a negative 1.37 cvs 4923: difference (a minus sign). When the rule uses a difference, the value of the 1.30 cvs 4924: difference follows the sign and is expressed as a <a 4925: href="#sectc4217">distance</a>.</p> 1.18 cvs 4926: <pre> 'LineSpacing' ':' DistOrInherit 1.6 cvs 4927: DistOrInherit = Kinship InheritedDist / Distance . 1.18 cvs 4928: InheritedDist = '=' / '+' AbsDist / '-' AbsDist .</pre> 1.30 cvs 4929: 4930: <p>When the line spacing value (or its difference from another element) is 1.37 cvs 4931: expressed in relative units, it changes with the size of the characters. 4932: Thus, when a larger font is chosen for a part of the document, the line 4933: spacing of that part expands proportionally. In contrast, when the line 4934: spacing value is expressed in absolute units (centimeters, inches, 4935: typographer's points), it is independent of the characters, which permits the 4936: maintenance of a consistent line spacing, whatever the character font. Either 4937: approach can be taken, depending on the desired effect.</p> 1.18 cvs 4938: </div> 1.1 cvs 4939: 1.18 cvs 4940: <div class="subsubsection"> 1.37 cvs 4941: <h4><a name="sectd42222" id="sectd42222">First line indentation</a></h4> 1.1 cvs 4942: 1.30 cvs 4943: <p>The <tt>Indent</tt> rule is used to specify the indentation of the first 4944: line of the elements broken into lines by the <tt>Line</tt> function. The 1.1 cvs 4945: indentation determines how far the first line of the element is shifted with 1.37 cvs 4946: respect to the other lines of the same element. It can be specified as a 4947: constant or by inheritance. The constant value is a positive integer (shifted 1.1 cvs 4948: to the right; the sign is optional), a negative integer (shifted to the left) 1.37 cvs 4949: or zero (no shift). All available <a href="#sectc4217">units</a> can be 1.18 cvs 4950: used.</p> 1.30 cvs 4951: 4952: <p>Indentation can be defined for any box, regardless of whether the box is 4953: line broken, and transmitted by inheritance to elements that are line broken. 4954: The size of the indentation is specified in the same manner as the <a 1.18 cvs 4955: href="#sectd42221">line spacing</a>.</p> 4956: <pre> 'Indent' ':' DistOrInherit</pre> 4957: </div> 1.1 cvs 4958: 1.18 cvs 4959: <div class="subsubsection"> 1.37 cvs 4960: <h4><a name="sectd42223" id="sectd42223">Alignment</a></h4> 1.1 cvs 4961: 1.30 cvs 4962: <p>The alignment style of the lines constructed during line breaking is 1.37 cvs 4963: defined by the <tt>Adjust</tt> rule. The alignment value can be a constant or 4964: inherited. A constant value is specified by a keyword:</p> 1.18 cvs 4965: <ul> 1.40 quint 4966: <li><tt>Left</tt> : at the left edge,</li> 4967: <li><tt>Right</tt> : at the right edge,</li> 4968: <li><tt>VMiddle</tt> : centered</li> 4969: <li><tt>Justify</tt> : justified</li> 4970: <li><tt>LeftWithDots</tt> : at the left edge with a dotted line filling out 4971: the last line up to the right edge of the line breaking box.</li> 1.18 cvs 4972: </ul> 1.30 cvs 4973: 1.37 cvs 4974: <p>An inherited value can only be the same as that of the reference box and 4975: is specified by a kinship keyword followed by an equals sign.</p> 1.18 cvs 4976: <pre> 'Adjust' ':' AlignOrInherit 1.1 cvs 4977: AlignOrInherit = Kinship '=' / Alignment . 1.35 cvs 4978: Alignment = 'Left' / 'Right' / 'VMiddle' / 'Justify' / 1.18 cvs 4979: 'LeftWithDots' .</pre> 4980: </div> 1.1 cvs 4981: 1.18 cvs 4982: <div class="subsubsection"> 1.37 cvs 4983: <h4><a name="sectd42225" id="sectd42225">Hyphenation</a></h4> 1.18 cvs 4984: 1.37 cvs 4985: <p>The <tt>Hyphenate</tt> rule indicates whether or not words should be 4986: broken by hyphenation at the end of lines. It affects the lines produced by 4987: the <tt>Line</tt> rule and contained in the box carrying the 4988: <tt>Hyphenate</tt> rule.</p> 1.30 cvs 4989: 1.34 cvs 4990: <p>The hyphenation property takes a boolean value, which can be either 1.37 cvs 4991: constant or inherited. A constant boolean value is expressed by either the 4992: <tt>Yes</tt> or the <tt>No</tt> keyword. An inherited value can only be the 1.1 cvs 4993: same as that of the reference box and is specified by a kinship keyword 1.18 cvs 4994: followed by an equals sign.</p> 4995: <pre> 'Hyphenate' ':' BoolInherit 1.1 cvs 4996: BoolInherit = Boolean / Kinship '=' . 1.18 cvs 4997: Boolean = 'Yes' / 'No' .</pre> 4998: </div> 4999: 5000: <div class="subsubsection"> 1.40 quint 5001: <h4><a name="sectd422251" id="sectd422251">Writing direction</a></h4> 5002: 5003: <p>The <tt>Direction</tt> rule indicates the directionality of text: from 5004: left to right, as for latin scripts, or from right to left, as for the Arabic 1.43 quint 5005: or Hebrew scripts. This is used by the Unicode bidirectional algorithm.</p> 1.40 quint 5006: 5007: <p>The writing direction property takes either a constant value 5008: (<code>ltr</code> for left to right, or <code>rtl</code> for right to left) 5009: or it is inherited. If it is inherited, it can only be the same as that of 5010: the reference box and is specified by a kinship keyword followed by an equals 5011: sign.</p> 5012: <pre> 'Direction' ':' DirInherit 5013: DirInherit = 'ltr' / 'rtl' / Kinship '=' .</pre> 5014: </div> 5015: 1.43 quint 5016: <p>The <code>UnicodeBidi</code> rule is the equivalent of the CSS2 5017: <code>unicode-bidi</code> property. It takes the same values and acts in the 5018: same way.</p> 5019: <pre> 'Direction' ':' BidiInherit 5020: BidiInherit = 'Normal' / 'Embed' / 'Override' / Kinship '=' .</pre> 1.40 quint 5021: 5022: <div class="subsubsection"> 1.37 cvs 5023: <h4><a name="sectd42226" id="sectd42226">Avoiding line breaking</a></h4> 1.18 cvs 5024: 1.37 cvs 5025: <p>The <tt>InLine</tt> rule is used to specify that a box that would 5026: otherwise participate in line breaking asked for by the <tt>Line</tt> rule of 5027: an enclosing box, instead avoids the line breaking process and positions 5028: itself according to the <tt>HorizPos</tt> and <tt>VertPos</tt> rules that 5029: apply to it. When the <tt>InLine</tt> rule applies to a box which would not 5030: be line broken, it has no effect.</p> 1.30 cvs 5031: 5032: <p>The rule is expressed by the <tt>InLine</tt> keyword followed by a colon 5033: and the keyword <tt>Yes</tt>, if the box should participate in line breaking, 1.37 cvs 5034: or the keyword <tt>No</tt>, if it should not. This is the only form possible: 5035: this rule cannot be inherited. Moreover, it can only appear in the rules of 1.1 cvs 5036: the primary view and applies to all views defined in the presentation 1.18 cvs 5037: schema.</p> 5038: <pre> 'InLine' ':' Boolean . 5039: Boolean = 'Yes' / 'No' .</pre> 1.30 cvs 5040: 1.18 cvs 5041: <blockquote class="example"> 1.30 cvs 5042: <p><strong>Example:</strong></p> 5043: 5044: <p>Suppose the structure schema defines a logical attribute called 1.37 cvs 5045: <tt>New</tt> which is used to identify the passages in a document which 5046: were recently modified. It would be nice to have the presentation schema 5047: make a bar appear in the left margin next to each passage having the 5048: <tt>New</tt> attribute. A new passage can be an entire element, such as a 5049: paragraph or section, or it can be some words in the middle of a paragraph. 5050: To produce the desired effect, the <tt>New</tt> attribute is given a 5051: creation rule which generates a <tt>VerticalBar</tt> presentation box.</p> 1.30 cvs 5052: 5053: <p>When the <tt>New</tt> attribute is attached to a character string which 5054: is inside a line broken element (inside a paragraph, for example), the bar 5055: is one of the elements which participates in line breaking and it is placed 5056: normally in the current line, at the end of the character string which has 1.37 cvs 5057: the attribute. To avoid this, the <tt>InLine</tt> rule is used in the 1.30 cvs 5058: following way:</p> 5059: <pre>BOXES 1.1 cvs 5060: VerticalBar: 5061: BEGIN 5062: Content: Graphics 'l'; 5063: HorizPos: Left = Root . Left; 5064: VertPos: Top = Creator . Top; 5065: Height: Bottom = Creator . Bottom; 5066: Width: 1 pt; 5067: InLine: No; 5068: ... 5069: END; 5070: ... 5071: ATTRIBUTES 5072: Nouveau: 5073: BEGIN 5074: CreateAfter(VerticalBar); 1.18 cvs 5075: END;</pre> 5076: </blockquote> 5077: </div> 5078: </div> 1.1 cvs 5079: 1.18 cvs 5080: <div class="subsection"> 1.37 cvs 5081: <h3><a name="sectc4223" id="sectc4223">Page breaking and line breaking 5082: conditions</a></h3> 1.1 cvs 5083: 1.30 cvs 5084: <p>Pages are constructed by the editor in accordance with the model specified 1.37 cvs 5085: by a <a href="#sectc4233"><tt>Page</tt> rule</a>. The page model describes 1.30 cvs 5086: only the composition of the pages but does not give any rules for breaking 1.37 cvs 5087: different element types across pages. Now, it is possible that certain 5088: elements must not be cut by page breaks, while others can be cut anywhere. 5089: The <tt>PageBreak</tt>, <tt>NoBreak1</tt>, and <tt>NoBreak2</tt> rules are 5090: used to specify the conditions under which each element type can be cut.</p> 1.30 cvs 5091: 5092: <p>The <tt>PageBreak</tt> rule is used to indicate whether or not the box can 1.37 cvs 5093: be cut during the construction of pages. If cutting is authorized, the box 5094: can be cut, with one part appearing at the bottom of a page and the other 5095: part appearing at the top of the next page. The rule is formed by the 1.18 cvs 5096: <tt>PageBreak</tt> keyword followed by a colon and a constant boolean value 1.37 cvs 5097: (<tt>Yes</tt> or <tt>No</tt>). This is the only form possible: this rule 5098: cannot be inherited. Moreover, it can only appear in the rules of the primary 1.18 cvs 5099: view and applies to all views defined in the presentation schema.</p> 1.30 cvs 5100: 5101: <p>Whether objects can be cut by line breaks can be controlled in a similar 1.37 cvs 5102: way using the <tt>LineBreak</tt> rule. This rule allows the specification of 5103: whether or not the box can be cut during the construction of lines. If 1.1 cvs 5104: cutting is authorized, the box can be cut, with one part appearing at the end 1.37 cvs 5105: of a line and the other part appearing at the beginning of the next line. The 1.18 cvs 5106: rule is formed by the <tt>LineBreak</tt> keyword followed by a colon and a 1.37 cvs 5107: constant boolean value (<tt>Yes</tt> or <tt>No</tt>). This is the only form 5108: possible: this rule cannot be inherited. Moreover, it can only appear in the 5109: rules of the primary view and applies to all views defined in the 5110: presentation schema.</p> 1.18 cvs 5111: <pre> 'PageBreak' ':' Boolean . 1.1 cvs 5112: 'LineBreak' ':' Boolean . 1.18 cvs 5113: Boolean = 'Yes' / 'No' .</pre> 1.30 cvs 5114: 5115: <p>When a box can be cut by a page break, it is possible that a page break 5116: will fall an inappropriate spot, creating, for example, a widow or orphan, or 1.37 cvs 5117: separating the title of a section from the first paragraph of the section. 5118: The <tt>NoBreak1</tt> and <tt>NoBreak2</tt> rules are used to avoid this. 5119: They specify that the box of the element to which they apply cannot be cut 5120: within a certain zone at the top (<tt>NoBreak1</tt> rule) or at the bottom 5121: (<tt>NoBreak2</tt> rule). These two rules specify the height of the zones in 1.18 cvs 5122: which page breaks are prohibited.</p> 1.30 cvs 5123: 5124: <p>The <tt>NoBreak1</tt> and <tt>NoBreak2</tt> rules give the height of the 1.37 cvs 5125: zone in which page breaking is prohibited. The height is given as a constant 1.30 cvs 5126: value using any of the <a href="#sectc4217">available units</a>, absolute or 1.37 cvs 5127: relative. The value may not be inherited.</p> 1.18 cvs 5128: <pre> 'NoBreak1' ':' AbsDist . 5129: 'NoBreak2' ':' AbsDist .</pre> 1.30 cvs 5130: 1.18 cvs 5131: <blockquote class="example"> 1.30 cvs 5132: <p><strong>Example:</strong></p> 5133: 5134: <p>The following rules prevent widows and orphans in a paragraph:</p> 5135: <pre>Paragraph : 1.1 cvs 5136: BEGIN 5137: NoBreak1 : 2; 5138: NoBreak2 : 2; 1.18 cvs 5139: END;</pre> 1.30 cvs 5140: 1.37 cvs 5141: <p>This rule prevents a section title from becoming separated from the 5142: first paragraph of the section by prohibiting page breaks at the beginning 5143: of the section rule:</p> 1.30 cvs 5144: <pre>Section : 1.18 cvs 5145: NoBreak1 : 1.5 cm;</pre> 1.30 cvs 5146: 5147: <p>Finally, this rule prevents a figure from being page broken in any 5148: way:</p> 5149: <pre>Figure : 1.18 cvs 5150: PageBreak : No;</pre> 5151: </blockquote> 1.30 cvs 5152: 5153: <p>The Thot editor constructs the document images displayed on the screen 1.37 cvs 5154: dynamically. As the user moves in the document or makes the document scroll 1.1 cvs 5155: in a window, the editor constructs the image to be displayed in little bits, 1.37 cvs 5156: filling the gaps which are produced in the course of these operations. It 1.1 cvs 5157: stops filling in the image when an element reaches the edge of the window in 1.37 cvs 5158: which the gap appears. If the appearance of the document is complex, it is 1.1 cvs 5159: possible that the image in incomplete, even though the edge of the window was 1.37 cvs 5160: reached. For example, an element might need to be presented to the side of 5161: the last element displayed, but its image was not constructed. The user will 1.1 cvs 5162: not know whether the element is really absent or if its image has simply not 1.18 cvs 5163: been constructed.</p> 1.30 cvs 5164: 1.37 cvs 5165: <p>The <tt>Gather</tt> rule is used to remedy this problem. When the rule 1.18 cvs 5166: <tt>Gather : Yes;</tt> is associated with an element type, the image of such 5167: elements is constructed as a block by the editor: it is never split up.</p> 1.30 cvs 5168: 5169: <p>The <tt>Gather</tt> rule may not appear in the <a href="#sectc427">default 1.37 cvs 5170: rules</a>. Elements which do not have the <tt>Gather</tt> rule are considered 5171: susceptible to being split up during display. Thus, it is not necessary to 1.18 cvs 5172: use the <tt>Gather : No;</tt> form. This rule must be used prudently and only 1.37 cvs 5173: for those elements which truly need it. If used incorrectly, it can 1.18 cvs 5174: pointlessly increase the size of the image constructed by the editor and lead 5175: to excessive memory consumption by the editor.</p> 1.30 cvs 5176: 5177: <p>Like the <tt>PageBreak</tt> and <tt>LineBreak</tt> rules, the 5178: <tt>Gather</tt> rule can only appear in rules of the primary view and applies 5179: to all views defined in the presentation schema.</p> 1.18 cvs 5180: <pre> 'Gather' ':' Boolean .</pre> 5181: </div> 1.1 cvs 5182: 1.18 cvs 5183: <div class="subsection"> 1.54 quint 5184: <h3 id="Controllin">Controlling style of lists</h3> 5185: 5186: <p>To present an element as a list item, rule <tt>Display</tt> with value 5187: <tt>ListItem</tt> must apply to that element. The type and the position of 5188: the marker generated by this rule are determined by three other rules: 5189: <tt>ListStyleType</tt>, <tt>ListStyleImage</tt> and 5190: <tt>ListStylePosition</tt>.</p> 5191: 5192: <h4 id="litype">List item type</h4> 5193: 5194: <p>This rule defines the type of maker that must be created for a list item. 5195: It is equivalent to the CSS property <tt>list-style-type</tt>, and accepts 5196: the same values.</p> 5197: <pre> 'ListStyleType' ':' ListStyleType 5198: ListStyleType = 'Disc' / 'Circle' / 'Square' / 'Decimal' / 5199: 'DecimalLeadingZero' / 'LowerRoman' / 'UpperRoman' / 5200: 'LowerGreek' / 'LowerLatin' / 'UpperLatin' / 'None' / 5201: 'Enclosing' '=' .</pre> 5202: 5203: <h4 id="liimage">List item image</h4> 5204: 5205: <p>This rule defines the image that must be created as a merker for a list 5206: item. It is equivalent to the CSS property <tt>list-style-image</tt>. The URL 5207: of the image is simply a character string.</p> 5208: <pre> 'ListStyleImage' ':' ListStyleImage 5209: ListStyleImage = 'None' / 'Enclosing' '=' / ListStyleImageURI . 5210: ListStyleImageURI = STRING .</pre> 5211: </div> 5212: 5213: <h4 id="liposition">List item position</h4> 5214: 5215: <p>This rule defines the position of the marker: inside the list item or 5216: outside. It is equivalent to the CSS property <tt>list-style-position</tt>, 5217: and accepts the same values.</p> 5218: <pre> 'ListStylePosition' ':' ListStylePosition 5219: ListStylePosition = 'Inside' / 'Outside' / 'Enclosing' '=' .</pre> 5220: 5221: <div class="subsection"> 1.37 cvs 5222: <h3><a name="sectc4224" id="sectc4224">Visibility</a></h3> 1.1 cvs 5223: 1.34 cvs 5224: <p>The visibility property is used to control which elements should or should 1.37 cvs 5225: not be displayed, based on context. An element can have different 5226: visibilities in different views. If an element's visibility is zero for a 5227: view, that element is not displayed in that view and does not occupy any 5228: space (its extents are zero).</p> 1.30 cvs 5229: 1.37 cvs 5230: <p>Visibility takes non-negative integer values (positive or zero). If values 1.1 cvs 5231: greater than 1 are used, they allow the user to choose a degree of visibility 1.37 cvs 5232: and, thus, to see only those boxes whose visibility property exceeds a 5233: certain threshold. This gives the user control over the granularity of the 5234: displayed pictures.</p> 1.30 cvs 5235: 1.34 cvs 5236: <p>The visibility property can be defined as a constant or by inheritance. If 1.1 cvs 5237: defined by inheritance, it cannot be based on the value of the next or 1.37 cvs 5238: previous box. Visibility can only be inherited from above.</p> 1.30 cvs 5239: 5240: <p>If it is a numeric attribute's presentation rule, the visibility can be 1.37 cvs 5241: specified by the attribute's name, in which case the value of the attribute 5242: is used.</p> 1.18 cvs 5243: <pre> 'Visibility' ':' NumberInherit 1.1 cvs 5244: NumberInherit = Integer / AttrID / Inheritance . 1.18 cvs 5245: Integer = NUMBER .</pre> 1.30 cvs 5246: 1.18 cvs 5247: <blockquote class="example"> 1.30 cvs 5248: <p><strong>Example:</strong></p> 5249: 5250: <p>Suppose that only <tt>Formula</tt> elements should be displayed in the 1.37 cvs 5251: <tt>MathView</tt> view. Then, the default rules should include:</p> 1.30 cvs 5252: <pre>DEFAULT 1.18 cvs 5253: IN MathView Visibility:0;</pre> 1.30 cvs 5254: 1.31 cvs 5255: <p>which makes all elements invisible in the <tt>MathView</tt> view. 1.30 cvs 5256: However, the <tt>Formula</tt> element also has a <tt>Visibility</tt> 5257: rule:</p> 5258: <pre>Formula : 1.18 cvs 5259: IN MathView Visibility:5;</pre> 1.30 cvs 5260: 5261: <p>which makes formulas, and only formulas, visible.</p> 1.18 cvs 5262: </blockquote> 5263: </div> 1.1 cvs 5264: 1.18 cvs 5265: <div class="subsection"> 1.54 quint 5266: <p>Notice that rule <a href="#compatibil"><tt>Display</tt></a> with value 5267: <tt>None</tt> is equivalent to rule <tt>Visibility</tt> with value 5268: <tt>0</tt>.</p> 5269: 1.37 cvs 5270: <h3><a name="sectc4225" id="sectc4225">Character style properties</a></h3> 1.1 cvs 5271: 1.34 cvs 5272: <p>Four properties are used to determine which characters are used to display 1.37 cvs 5273: text. They are size, font, style, and underlining.</p> 1.1 cvs 5274: 1.18 cvs 5275: <div class="subsubsection"> 1.37 cvs 5276: <h4><a name="sectd42251" id="sectd42251">Character size</a></h4> 1.30 cvs 5277: 1.37 cvs 5278: <p>The size property has two effects. First, it is used to specify the actual 1.34 cvs 5279: size and distance units for boxes defined in <a href="#sectc4217">relative 1.37 cvs 5280: units</a>. Second, it defines the size of the characters contained in the 1.34 cvs 5281: box.</p> 1.1 cvs 5282: 1.30 cvs 5283: <p>As a distance or length, the size can be expressed in abstract or absolute 1.37 cvs 5284: units. It can also be inherited. If it is not inherited, it is expressed 5285: simply as an integer followed by the <tt>pt</tt> keyword, which indicates 5286: that the size is expressed in typographer's points. The absence of the 5287: <tt>pt</tt> keyword indicates that it is in abstract units in which the value 5288: 1 represents the smallest size while the value 16 is the largest size. The 5289: relationship between these abstract sizes and the real character sizes is 5290: controlled by a table which can be modified statically or even dynamically 5291: during the execution of the Thot editor.</p> 1.30 cvs 5292: 5293: <p>If the <tt>Size</tt> rule is a numeric attribute's presentation rule, the 1.34 cvs 5294: value of the size property can be specified by the attribute's name, in which 1.30 cvs 5295: case the value of the attribute is used.</p> 5296: 1.37 cvs 5297: <p><strong>Note:</strong> the only unit available for defining an absolute 5298: size is the typographer's point. Centimeters and inches may not be used.</p> 1.30 cvs 5299: 5300: <p>If the size is inherited, the rule must specify the relative from which to 5301: inherit and any percentage or difference from that relative's value. A 5302: percentage is indicated by a <tt>*</tt> followed by the value of the 5303: percentage and a <tt>%</tt>. A difference can be expressed in either 5304: typographer's points or in abstract units and the maximum or minimum size can 1.37 cvs 5305: be specified, but without specifying the unit: it is the same as was 5306: specified for the difference.</p> 1.30 cvs 5307: 5308: <p>In a numeric attribute's presentation rule, the difference in size or the 1.22 cvs 5309: percentage can be indicated by the attribute's name instead of the numeric 1.37 cvs 5310: value, which means that the attribute's value should be used as the 5311: difference or percentage. The attribute can also be used as the minimum or 5312: maximum size for a difference.</p> 1.22 cvs 5313: <pre> 'Size' ':' SizeInherit 5314: SizeInherit = SizeAttr [ 'pt' ] / 5315: Kinship InheritedSize . 5316: InheritedSize ='+' SizeAttr [ 'pt' ] 5317: [ 'Max' MaxSizeAttr ] / 5318: '-' SizeAttr [ 'pt' ] 5319: [ 'Min' MinSizeAttr ] / 5320: '*' PercentSizeAttr '%' / 5321: '=' . 5322: SizeAttr = Size / AttrID . 5323: Size = NUMBER . 5324: MaxSizeAttr = MaxSize / AttrID . 5325: MaxSize = NUMBER . 5326: MinSizeAttr = MinSize / AttrID . 5327: MinSize = NUMBER . 5328: PercentSizeAttr = PercentSize / AttrID . 5329: PercentSize = NUMBER .</pre> 1.30 cvs 5330: 1.18 cvs 5331: <blockquote class="example"> 1.30 cvs 5332: <p><strong>Example:</strong></p> 5333: 5334: <p>The rule</p> 5335: <pre>Size : Enclosing - 2 pt Min 7;</pre> 5336: 5337: <p>states that the character size is 2 points less than that of the 5338: enclosing box, but that it may not be less than 7 points, whatever the 5339: enclosing box's value.</p> 5340: 5341: <p>The following rules make the text of a report be displayed with 5342: medium-sized characters (for example, size 5), while the title is displayed 5343: with larger characters and the summary is displayed with smaller 5344: characters:</p> 5345: <pre>Report : 1.1 cvs 5346: Size : 5; 5347: Title : 5348: Size : Enclosing + 2; 5349: Summary : 1.18 cvs 5350: Size : Enclosing - 1;</pre> 1.30 cvs 5351: 5352: <p>Thus, the character sizes in the entire document can be changed by 1.34 cvs 5353: changing the size property of the Report element, while preserving the 1.30 cvs 5354: relationships between the sizes of the different elements.</p> 1.18 cvs 5355: </blockquote> 5356: </div> 5357: 5358: <div class="subsubsection"> 1.37 cvs 5359: <h4><a name="sectd42252" id="sectd42252">Font and character style</a></h4> 1.18 cvs 5360: 1.37 cvs 5361: <p>The <tt>Font</tt> rule determines the font family to be used to display 5362: the characters contained in the box, while the <tt>Style</tt> rule determines 5363: their style and the <tt>Weight</tt> rule determines their weight. Thot 1.23 cvs 5364: recognizes three character fonts (Times, Helvetica, and Courier), three 5365: styles: Roman, Italics, and Oblique, and two weights: Normal and Bold.</p> 1.30 cvs 5366: 5367: <p>The font family, style and weight can be specified by a named constant or 1.37 cvs 5368: can be inherited. For the name of the font family only the first character is 1.30 cvs 5369: used.</p> 5370: 5371: <p>Only identical inheritance is allowed: the box takes the same font, style 1.37 cvs 5372: or weight as the box from which it inherits. This is indicated by an equals 1.23 cvs 5373: sign after the kinship specification.</p> 5374: <pre> 'Font' ':' NameInherit / 5375: 'Style' ':' StyleInherit / 5376: 'Weight' ':' WeightInherit / 5377: 5378: NameInherit = Kinship '=' / FontName . 5379: FontName = NAME . 5380: StyleInherit = Kinship '=' / 5381: 'Roman' / 'Italics' / 'Oblique' . 5382: WeightInherit = Kinship '=' / 5383: 'Normal' / 'Bold' .</pre> 1.30 cvs 5384: 1.18 cvs 5385: <blockquote class="example"> 1.30 cvs 5386: <p><strong>Example:</strong></p> 5387: 5388: <p>To specify that the summary uses the font family of the rest of the 5389: document, but in the italic style, the following rules are used:</p> 5390: <pre>Summary : 1.1 cvs 5391: BEGIN 5392: Font : Enclosing =; 5393: Style : Italics; 1.18 cvs 5394: END;</pre> 5395: </blockquote> 5396: </div> 5397: 5398: <div class="subsubsection"> 1.37 cvs 5399: <h4><a name="sectd42253" id="sectd42253">Underlining</a></h4> 1.18 cvs 5400: 1.30 cvs 5401: <p>The <tt>Underline</tt> rule is used to specify if the characters contained 1.37 cvs 5402: in a box should have lines drawn on or near them. There are four underlining 1.18 cvs 5403: styles: <tt>Underlined</tt>, <tt>Overlined</tt>, <tt>CrossedOut</tt>, and 1.37 cvs 5404: <tt>NoUnderline</tt>. The <tt>Thickness</tt> rule specifies the thickness of 1.18 cvs 5405: the line, <tt>Thin</tt> or <tt>Thick</tt>.</p> 1.30 cvs 5406: 5407: <p>As with font family and style, only identical inheritance is allowed: the 1.37 cvs 5408: box has the same underlining type as the box from which it inherits the 5409: value. This is indicated by an equals sign after the kinship 5410: specification.</p> 1.18 cvs 5411: <pre> 'Underline' ':' UnderLineInherit / 1.1 cvs 5412: 'Thickness' ':' ThicknessInherit / 5413: 5414: UnderLineInherit = Kinship '=' / 'NoUnderline' / 5415: 'Underlined' / 5416: 'Overlined' / 'CrossedOut' . 1.18 cvs 5417: ThicknessInherit = Kinship '=' / 'Thick' / 'Thin' .</pre> 5418: </div> 5419: </div> 5420: 5421: <div class="subsection"> 1.37 cvs 5422: <h3><a name="sectc4226" id="sectc4226">Stacking order</a></h3> 1.18 cvs 5423: 1.30 cvs 5424: <p>The <tt>Depth</tt> rule is used to define the stacking order of terminal 1.37 cvs 5425: boxes when multiple boxes at least partially overlap. This rule defines how 5426: the depth property, which is zero or a positive integer, is calculated. The 5427: depth property has a value for all boxes. For terminal boxes in the structure 1.34 cvs 5428: and for presentation boxes, the depth value is used during display and 5429: printing: the boxes with the lowest value overlap those with higher depths. 1.37 cvs 5430: For non-terminal boxes, the depth is not interpreted during display, but it 5431: is used to calculate the depth of terminal boxes by inheritance.</p> 1.30 cvs 5432: 5433: <p>Like most other rules, the depth rule is defined in the <a 1.37 cvs 5434: href="#sectc427">default rules</a> of each presentation schema. Thus, there 1.18 cvs 5435: is always a depth value, even when it is not necessary because there is no 1.37 cvs 5436: overlapping. To avoid useless operations, a zero value can be given to the 1.34 cvs 5437: depth property, which signifies that overlapping is never a problem.</p> 1.30 cvs 5438: 5439: <p>The depth rule has the same form as the <a href="#sectc4224">visibility 1.18 cvs 5440: rule</a>. It can be defined by inheritance or by a constant numeric value. 5441: When the rule is attached to a numeric attribute, it can take the value of 5442: that attribute.</p> 5443: <pre> 'Depth' ':' NumberInherit</pre> 1.30 cvs 5444: 1.18 cvs 5445: <blockquote class="example"> 1.30 cvs 5446: <p><strong>Example:</strong></p> 5447: 5448: <p>For a purely textual document, in which overlapping never poses a 5449: problem, a single default <tt>Depth</tt> rule in the presentation schema is 5450: sufficient:</p> 5451: <pre>DEFAULT 1.1 cvs 5452: Depth : 0; 1.18 cvs 5453: ...</pre> 1.30 cvs 5454: 5455: <p>To make the text of examples appear on a light blue background, a 5456: presentation box is defined:</p> 5457: <pre>BOXES 1.1 cvs 5458: BlueBG : 5459: BEGIN 5460: Content : Graphics 'R'; 5461: Background : LightBlue3; 5462: FillPattern: backgroundcolor; 5463: Depth : 2; 5464: ... 1.18 cvs 5465: END;</pre> 1.30 cvs 5466: 5467: <p>and is created by the <tt>Example</tt> element, which has the rules:</p> 5468: <pre>RULES 1.1 cvs 5469: Example : 5470: BEGIN 5471: CreateFirst (BlueBG); 5472: Depth : 1; 5473: ... 1.18 cvs 5474: END;</pre> 1.30 cvs 5475: 5476: <p>In this way, the text of an example (if it inherits its depth from its 5477: ancestor) will be superimposed on a light blue background, and not the 5478: reverse).</p> 1.18 cvs 5479: </blockquote> 5480: </div> 5481: 5482: <div class="subsection"> 1.37 cvs 5483: <h3><a name="sectc4227" id="sectc4227">Line style</a></h3> 1.18 cvs 5484: 1.30 cvs 5485: <p>The <tt>LineStyle</tt> rule determines the style of line which should be 5486: used to draw all the elements contained in the box and the box itself, if it 1.37 cvs 5487: has a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. The line style can be 1.18 cvs 5488: indicated by a name (<tt>Solid</tt>, <tt>Dashed</tt>, <tt>Dotted</tt>) or it 1.37 cvs 5489: can be inherited. All elements of the graphic base type are affected by this 1.1 cvs 5490: rule, but it can be attached to any box and transmitted by inheritance to the 1.37 cvs 5491: graphic elements. The border of elements having a <a 1.18 cvs 5492: href="#sectc4230a"><tt>ShowBox</tt> rule</a> is drawn according to the line 5493: style specified by this rule.</p> 1.30 cvs 5494: 1.37 cvs 5495: <p>Only identical inheritance is allowed: the box takes the same line style 5496: as the box from which it inherits. This is indicated by an equals sign after 5497: the kinship specification.</p> 1.18 cvs 5498: <pre> 'LineStyle' ':' LineStyleInherit 1.1 cvs 5499: LineStyleInherit = Kinship '=' / 1.18 cvs 5500: 'Solid' / 'Dashed' / 'Dotted' .</pre> 1.30 cvs 5501: 1.18 cvs 5502: <blockquote class="example"> 1.30 cvs 5503: <p><strong>Example:</strong></p> 5504: 1.37 cvs 5505: <p>To specify that, in Figures, the graphical parts should be drawn in 5506: solid lines, the Figure element is given a rule using the <tt>Solid</tt> 5507: name:</p> 1.30 cvs 5508: <pre>Figure : 1.18 cvs 5509: LineStyle : Solid;</pre> 1.30 cvs 5510: 5511: <p>and the elements composing figures are given an inheritance rule:</p> 5512: <pre> LineStyle : Enclosing =;</pre> 1.18 cvs 5513: </blockquote> 5514: </div> 5515: 5516: <div class="subsection"> 1.37 cvs 5517: <h3><a name="sectc4228" id="sectc4228">Line thickness</a></h3> 1.18 cvs 5518: 1.37 cvs 5519: <p>The <tt>LineWeight</tt> rule determines the thickness of the lines of all 1.1 cvs 5520: graphical elements which appear in the box, no matter what their line style. 1.37 cvs 5521: Line thickness can be specified by a constant value or by inheritance. A 5522: constant value is a positive number followed by an optional unit 5523: specification (which is absent when using relative units). All available <a 5524: href="#sectc4217">distance units</a> can be used. Line thickness is expressed 1.18 cvs 5525: in the same way as <a href="#sectd42221">line spacing</a>.</p> 5526: <pre> 'LineWeight' ':' DistOrInherit</pre> 1.30 cvs 5527: 1.37 cvs 5528: <p>All elements of the graphic base type are affected by this rule, but it 5529: can be attached to any box and transmitted by inheritance to the graphic 5530: elements. The border of element having a <a 5531: href="#sectc4230a"><tt>ShowBox</tt> rule</a> is also drawn according to the 5532: thickness specified by this rule.</p> 1.30 cvs 5533: 1.18 cvs 5534: <blockquote class="example"> 1.30 cvs 5535: <p><strong>Example:</strong></p> 5536: 5537: <p>To specify that, in Figures, the graphical parts should be drawn with 5538: lines 0.3 pt thick, the Figure element is given this rule:</p> 5539: <pre>Figure : 1.18 cvs 5540: LineWeight : 0.3 pt;</pre> 1.30 cvs 5541: 5542: <p>and the elements composing figures are given an inheritance rule:</p> 5543: <pre> LineWeight : Enclosing =;</pre> 1.18 cvs 5544: </blockquote> 5545: </div> 5546: 5547: <div class="subsection"> 1.37 cvs 5548: <h3><a name="sectc4229" id="sectc4229">Fill pattern</a></h3> 1.18 cvs 5549: 1.30 cvs 5550: <p>The <tt>FillPattern</tt> rule determines the pattern used to fill closed 1.37 cvs 5551: graphical elements (circles, rectangles, etc.) which appear in the box. This 1.18 cvs 5552: rule also specifies the pattern used to fill the box associated with elements 1.37 cvs 5553: having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a><a>. This pattern can 5554: be indicated by a named constant or by inheritance. The named constant 5555: identifies one of the patterns available in Thot. The names of the available 1.18 cvs 5556: patterns are: nopattern, foregroundcolor, backgroundcolor, gray1, gray2, 5557: gray3, gray4, gray5, gray6, gray7, horiz1, horiz2, horiz3, vert1, vert2, 1.37 cvs 5558: vert3, left1, left2, left3, right1, right2, right3, square1, square2, 5559: square3, lozenge, brick, tile, sea, basket.</a></p> 1.30 cvs 5560: 5561: <p>Like the other rules peculiar to graphics, <tt>LineStyle</tt> and 1.18 cvs 5562: <tt>LineWeight</tt>, only elements of the graphic base type are affected by 5563: the <tt>FillPattern</tt> rule, but the rule can be attached to any box and 1.37 cvs 5564: transmitted by inheritance to the graphic elements. As with the other rules 1.18 cvs 5565: specific to graphics, only identical inheritance is allowed.</p> 1.30 cvs 5566: 5567: <p>The <tt>FillPattern</tt> rule can also be used to determine whether or not 1.37 cvs 5568: text characters, symbols and pictures should be colored. For these element 1.12 cvs 5569: types (text, symbols, and pictures), the only valid values are 1.18 cvs 5570: <tt>nopattern</tt>, <tt>foregroundcolor</tt>, and <tt>backgroundcolor</tt>. 5571: When <tt>FillPattern</tt> has the value <tt>backgroundcolor</tt>, text 5572: characters, symbols, and bitmaps are given the color specified by the <a 5573: href="#sectc4230"><tt>Background</tt> rule</a> which applies to these 1.37 cvs 5574: elements. When <tt>FillPattern</tt> has the value <tt>foregroundcolor</tt>, 1.18 cvs 5575: these same elements are given the color specified by the <a 5576: href="#sectc4230"><tt>Foreground</tt> rule</a> which applies to these 1.37 cvs 5577: elements. In all other case, text characters are not colored.</p> 1.18 cvs 5578: <pre> 'FillPattern' ':' NameInherit</pre> 1.30 cvs 5579: 1.18 cvs 5580: <blockquote class="example"> 1.30 cvs 5581: <p><strong>Example:</strong></p> 5582: 5583: <p>To specify that, in Figures, the closed graphical elements should be 5584: filled with a pattern resembling a brick wall, the Figure element is given 5585: this rule:</p> 5586: <pre>Figure : 1.18 cvs 5587: FillPattern : brick;</pre> 1.30 cvs 5588: 5589: <p>and the elements composing figures are given an inheritance rule:</p> 5590: <pre> FillPattern : Enclosing =;</pre> 1.18 cvs 5591: </blockquote> 5592: </div> 5593: 5594: <div class="subsection"> 1.37 cvs 5595: <h3><a name="sectc4230" id="sectc4230">Colors</a></h3> 1.18 cvs 5596: 1.30 cvs 5597: <p>The <tt>Foreground</tt> and <tt>Background</tt> rules determine the 1.37 cvs 5598: foreground and background colors of the base elements which appear in the 5599: box. They also control the color of boxes associated with elements having a 5600: <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. These colors can be 5601: specified with a named constant or by inheritance. The named constants 5602: specify one of the available colors in Thot. The available color names can be 5603: found in the file <tt>thot.color</tt>. In addition to those names, you can 5604: use the keyword <code>Transparent</code>, to not draw anything.</p> 5605: 5606: <p>The color rules affect the same way all base elements and elements having 5607: a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>, no matter what their type 5608: (text, graphics, pictures, symbols). The color rules can be associated with 1.30 cvs 5609: any box and can be transmitted by inheritance to the base elements or the 1.37 cvs 5610: elements having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. Like the 1.30 cvs 5611: preceding rules, only inheritance of the same value is allowed.</p> 5612: <pre> 'Foreground' ':' Color 5613: 'Background' ':' Color 5614: Color = 'Transparent' / Link '=' / FontColorName .</pre> 5615: 5616: <p><strong>Note:</strong> text colors only appear for text elements whose <a 1.18 cvs 5617: href="#sectc4229">fill pattern</a> does not prevent the use of color.</p> 1.30 cvs 5618: 1.18 cvs 5619: <blockquote class="example"> 1.30 cvs 5620: <p><strong>Example:</strong></p> 5621: 5622: <p>To specify that, in Figures, everything must be drawn in blue on a 5623: background of yellow, the Figure element is given these rules:</p> 5624: <pre>Figure : 1.1 cvs 5625: BEGIN 5626: Foreground : Blue; 5627: Background : Yellow; 5628: Fillpattern : backgroundcolor; 1.18 cvs 5629: END;</pre> 1.30 cvs 5630: 5631: <p>and the elements composing figures are given inheritance rules:</p> 5632: <pre> Foreground : Enclosing =; 1.1 cvs 5633: Background : Enclosing =; 1.18 cvs 5634: FillPattern : Enclosing =;</pre> 5635: </blockquote> 5636: </div> 5637: 5638: <div class="subsection"> 1.37 cvs 5639: <h3><a name="sectc4230a" id="sectc4230a">Background color and border</a></h3> 1.18 cvs 5640: 1.30 cvs 5641: <p>Boxes associated with structural elements are normally not visible, but it 1.37 cvs 5642: is possible to draw their border and/or to paint their area when it is 5643: needed. This is achieved by associating the <tt>ShowBox</tt> rule with the 5644: concerned element. This rule has no parameter and no value. It is simply 5645: written <tt>Showbox;</tt>. It is not inherited nor transmitted to any other 5646: element. It applies only to the element with which it is associated.</p> 1.18 cvs 5647: <pre> 'ShowBox'</pre> 1.30 cvs 5648: 5649: <p>When an element has a <tt>ShowBox</tt> rule, the border is drawn only if 1.37 cvs 5650: the <tt>LineWeight</tt> rule that applies to that element has a non-zero 5651: value (this value can be inherited). The color, style and thickness of the 5652: border are defined by the <tt>Foreground</tt>, <tt>LineStyle</tt>, and 1.18 cvs 5653: <tt>LineWeight</tt> rules that apply to the element.</p> 1.30 cvs 5654: 1.37 cvs 5655: <p>When an element has a <tt>ShowBox</tt> rule, the background of this 5656: element is paint only if the value of the <tt>FillPattern</tt> rule that 5657: applies to that element is not <tt>nopattern</tt>. The pattern and color(s) 5658: of the background are defined by the <tt>FillPattern</tt>, 5659: <tt>Background</tt>, and <tt>Foreground</tt> rules that apply to the 5660: element.</p> 1.18 cvs 5661: </div> 5662: 5663: <div class="subsection"> 1.37 cvs 5664: <h3><a name="sectc4230b" id="sectc4230b">Background pictures</a></h3> 1.18 cvs 5665: 1.30 cvs 5666: <p>The <tt>BackgroundPicture</tt> rule allows to display a picture as the 1.37 cvs 5667: background of an element. It has a single parameter, the file name of the 5668: picture. This is a string delimited by single quotes. If the first character 1.18 cvs 5669: in this string is '/', it is considered as an absolute path, otherwise the 1.37 cvs 5670: file is searched for along the schema directory path. This file may contain a 1.18 cvs 5671: picture in any format accepted by Thot (xbm, xpm, gif, jpeg, png, etc.)</p> 1.30 cvs 5672: 1.37 cvs 5673: <p>The <tt>BackgroundPicture</tt> and <tt>PictureMode</tt> rules apply only 5674: to the element with which they are associated. They are not inherited nor 1.18 cvs 5675: transmitted to children elements.</p> 1.30 cvs 5676: 5677: <p>The background picture has not always the same size as the element's box. 1.37 cvs 5678: There are diffrent ways to fill the element box with the picture. This is 1.18 cvs 5679: specified by the <tt>PictureMode</tt> rule, which should be associated to the 1.37 cvs 5680: same element. This rule may take one of the following values:</p> 1.18 cvs 5681: <dl> 1.30 cvs 5682: <dt><tt>NormalSize</tt></dt> 5683: <dd>The picture is centered in the box, and clipped if it is too 5684: large.</dd> 5685: <dt><tt>Scale</tt></dt> 5686: <dd>The picture is zoomed to fit the box size.</dd> 5687: <dt><tt>RepeatX</tt></dt> 5688: <dd>The picture is repeated horizontally to fit the box width.</dd> 5689: <dt><tt>RepeatY</tt></dt> 5690: <dd>The picture is repeated vertically to fit the box height.</dd> 5691: <dt><tt>RepeatXY</tt></dt> 5692: <dd>The picture is repeated both horizontally and vertically to fill the 5693: box.</dd> 1.18 cvs 5694: </dl> 1.30 cvs 5695: 5696: <p>If an element has a <tt>BackgroundPicture</tt> rule and no 1.18 cvs 5697: <tt>PictureMode</tt> rule, the <tt>NormalSize</tt> value is assumed.</p> 5698: <pre> 'BackgroundPicture' ':' FileName / 1.13 cvs 5699: 'PictureMode' ':' PictMode . 5700: 5701: FileName = STRING . 1.18 cvs 5702: PictMode = 'NormalSize' / 'Scale' / 'RepeatXY' / 'RepeatX' / 'RepeatY' .</pre> 1.30 cvs 5703: 1.37 cvs 5704: <p>The <tt>BackgroundPicture</tt> and <tt>PictureMode</tt> rules apply only 5705: to the element with which they are associated. They are not inherited nor 1.18 cvs 5706: transmitted to children elements.</p> 5707: </div> 1.13 cvs 5708: 1.18 cvs 5709: <div class="subsection"> 1.47 quint 5710: <h3><a name="sectc4230c" id="sectc4230c">Opacity</a></h3> 5711: 1.48 quint 5712: <p>The <tt>Opacity</tt>, <tt>FillOpacity</tt> and <tt>StrokeOpacity</tt> 5713: rules allow to set the opacity of the element(s) to which they apply. The 5714: <code>FillOpacity</code> rule controls the way the interior of the element is 5715: paint, while the <code>StrokeOpacity</code> rule concerns the outline. The 5716: <code>Opacity</code> rule concerns both the interior and the outline at the 5717: same time.</p> 5718: 5719: <p>In the three rules, opacity is expressed as a percentage. It must be 5720: comprised between 0 (fully transparent) and 100% (fully opaque). In these 5721: rules, the opacity can be expressed as an integer (from 0 to 100) followed by 5722: the <code>%</code> character. It can also be expressed as the name of a 5723: numeric attribute. In that case, the attribute's value is interpreted as a 5724: percentage. It should then be comprised between 0 and 100 included. Finally, 5725: the opacity can be inherited from the parent element.</p> 5726: <pre> 'Opacity' ':' OpacityInherit 5727: 'FillOpacity' ':' OpacityInherit 5728: 'StrokeOpacity' ':' OpacityInherit 1.47 quint 5729: OpacityInherit = OpPercent '%' / AttrID / Inheritance . 5730: OpPercent = NUMBER .</pre> 5731: </div> 5732: 5733: <div class="subsection"> 1.37 cvs 5734: <h3><a name="sectc4231" id="sectc4231">Presentation box content</a></h3> 1.1 cvs 5735: 1.37 cvs 5736: <p>The <tt>Content</tt> rule applies to presentation boxes. It indicates the 5737: content given to a box. This content is either a variable's value or a 5738: constant value.</p> 1.30 cvs 5739: 5740: <p>If the content is a constant, it can be specified, as in a variable 1.18 cvs 5741: declaration, either by the name of a constant declared in the <tt>CONST</tt> 1.1 cvs 5742: section or by direct specification of the type and value of the box's 1.18 cvs 5743: content.</p> 1.30 cvs 5744: 5745: <p>Similarly, if it is a variable, the name of a variable declared in 1.18 cvs 5746: <tt>VAR</tt> section can be given or the variable may be defined within 1.37 cvs 5747: parentheses. The content inside the parentheses has the same syntax as a <a 1.18 cvs 5748: href="#sectc426">variable declaration</a>.</p> 5749: <pre> 'Content' ':' VarConst 1.1 cvs 5750: VarConst = ConstID / ConstType ConstValue / 1.38 cvs 5751: VarID / '(' FunctionSeq ')' .</pre> 1.30 cvs 5752: 5753: <p>A presentation box can have only one <tt>Content</tt> rule, which means 1.37 cvs 5754: that the content of a presentation box cannot vary from view to view. 5755: However, such an effect can be achieved by creating several presentation 5756: boxes, each with different content and visible in different views.</p> 5757: 5758: <p>The <tt>Content</tt> rule also applies to elements defined as references 5759: in the structure schema. In this case, the content defined by the rule must 5760: be a constant. It is this content which appears on the screen or paper to 5761: represent references of the type to which the rule applies. A reference can 1.18 cvs 5762: have a <tt>Content</tt> rule or a <a href="#sectc4234"><tt>Copy</tt> rule</a> 1.37 cvs 5763: for each view. If neither of these rules appears, the reference is displayed 1.18 cvs 5764: as <tt>[*]</tt>, which is equivalent to the rule:</p> 5765: <pre> Content: Text '[*]';</pre> 1.30 cvs 5766: 1.18 cvs 5767: <blockquote class="example"> 1.30 cvs 5768: <p><strong>Example:</strong></p> 5769: 5770: <p>The content of the presentation box created to make the chapter number 5771: and section number appear before each section title can be defined by:</p> 5772: <pre>BOXES 1.1 cvs 5773: SectionNumBox : 5774: BEGIN 5775: Content : NumSection; 5776: ... 1.18 cvs 5777: END;</pre> 1.30 cvs 5778: 5779: <p>if the <tt>NumSection</tt> variable has been defined in the variable 1.37 cvs 5780: definition section of the presentation schema. Otherwise the 1.30 cvs 5781: <tt>Content</tt> would be written:</p> 5782: <pre>BOXES 1.1 cvs 5783: SectionNumBox : 5784: BEGIN 5785: Content : (VALUE (ChapterCtr, Roman) TEXT '.' 5786: VALUE (SectionCtr, Arabic)); 5787: ... 1.18 cvs 5788: END;</pre> 5789: </blockquote> 5790: </div> 1.1 cvs 5791: 1.18 cvs 5792: <div class="subsection"> 1.37 cvs 5793: <h3><a name="sectc4232" id="sectc4232">Presentation box creation</a></h3> 1.1 cvs 5794: 1.37 cvs 5795: <p>A creation rule specifies that a presentation box should be created when 5796: an element of the type to which the rule is attached appears in the 5797: document.</p> 1.30 cvs 5798: 5799: <p>A keyword specifies the position, relative to the creating box, at which 5800: the created box will be placed in the structure:</p> 1.18 cvs 5801: <dl> 1.30 cvs 5802: <dt><tt>CreateFirst</tt></dt> 5803: <dd>specifies that the box should be created as the first box of the next 5804: lower level, before any already existing boxes, and only if the 5805: beginning of the creating element is visible;</dd> 5806: <dt><tt>CreateLast</tt></dt> 5807: <dd>specifies that the box should be created as the last box of the next 5808: lower level, after any existing boxes, and only if the end of the 5809: creating element is visible;</dd> 5810: <dt><tt>CreateBefore</tt></dt> 5811: <dd>specifies that the box should be created before the creating box, on 5812: the same level as the creating box, and only if the beginning of the 5813: creating element is visible;</dd> 5814: <dt><tt>CreateAfter</tt></dt> 5815: <dd>specifies that the box should be created after the creating box, on 5816: the same level as the creating box, and only if the beginning of the 5817: creating element is visible;</dd> 5818: <dt><tt>CreateEnclosing</tt></dt> 1.37 cvs 5819: <dd>specifies that the box should be created at the upper level 5820: relatively to the creating box, and that it must contain that creating 5821: box and all presentation boxes created by the same creating box.</dd> 1.18 cvs 5822: </dl> 1.30 cvs 5823: 5824: <p>This keyword can be followed by the <tt>Repeated</tt> keyword to indicate 5825: that the box must be created for each part of the creating element. These 5826: parts result from the division of the element by page breaks or column 1.37 cvs 5827: changes. If the <tt>Repeated</tt> keyword is missing, the box is only created 1.30 cvs 5828: for the first part of the creating element (<tt>CreateFirst</tt> and 1.18 cvs 5829: <tt>CreateBefore</tt> rules) or for the last part (<tt>CreateLast</tt> and 5830: <tt>CreateAfter</tt> rules).</p> 1.30 cvs 5831: 5832: <p>The type of presentation to be created is specified at the end of the rule 1.18 cvs 5833: between parentheses.</p> 1.30 cvs 5834: 5835: <p>Creation rules cannot appear in the <a href="#sectc427">default 1.37 cvs 5836: presentation rules</a>. The boxes being created should have a 1.30 cvs 5837: <tt>Content</tt> rule which indicates their <a 5838: href="#sectc4231">content</a>.</p> 5839: 5840: <p>Creation rules can only appear in the block of rules for the primary view; 1.1 cvs 5841: creation is provoked by a document element for all views. However, for each 1.37 cvs 5842: view, the presentation box is only created if the creating element is itself 5843: a box in the view. Moreover, the visibility property of the presentation box 5844: can be adjusted to control the creation of the box on a view-by-view 5845: basis.</p> 1.18 cvs 5846: <pre> Creation '(' BoxID ')' 1.1 cvs 5847: Creation = Create [ 'Repeated' ] . 5848: Create ='CreateFirst' / 'CreateLast' / 5849: 'CreateBefore' / 'CreateAfter' / 1.18 cvs 5850: 'CreateEnclosing' .</pre> 1.30 cvs 5851: 1.18 cvs 5852: <blockquote class="example"> 1.30 cvs 5853: <p><strong>Example:</strong></p> 5854: 5855: <p>Let us define an object type, called Table, which is composed of a 5856: sequence of columns, all having the same fixed width, where the columns are 1.37 cvs 5857: separated by vertical lines. There is a line to the left of the first 5858: column and one to the right of the last. Each column has a variable number 1.31 cvs 5859: of cells, placed one on top of the other and separated by horizontal lines. 5860: There are no horizontal lines above the first cell or below the last cell. 1.37 cvs 5861: The text contained in each cell is broken into lines and these lines are 1.30 cvs 5862: centered horizontally in the cell. The logical structure of this object is 5863: defined by:</p> 5864: <pre>Table = LIST OF (Column); 1.18 cvs 5865: Column = LIST OF (Cell = Text);</pre> 5866: 1.30 cvs 5867: <div class="figure"> 1.37 cvs 5868: <hr /> 1.30 cvs 5869: <pre>| | | | 1.1 cvs 5870: | xx xxxx xxxx |x xxxx xxx xxxxx| x xxx x xxx | 5871: | xxx xxx xxxx x | x xx x xxx | xxxxx xxxx xx | 5872: | xxxxx xxxx |----------------| xxx xxxxx x | 5873: | xxxxx xxx xxxx | xxxx xx xx xxx | xx xx | 5874: | xxx xxxx x xxx | xxxx x xxx x |---------------| 5875: |----------------| xxx xxxx xxxxx | xxxxx xxxxx | 5876: | xxx xxx xxxxxx |----------------| xxx xxxx xxxx | 5877: | xxxx xxxx xx | xxxx xx x xx | xxx xx x xx | 5878: |----------------| xxx xxxxx xxxx | xxxx xxxx xxx | 5879: | xxxxx xxx xxxx | xxxx xx x xx | xxxxx xxx | 1.18 cvs 5880: |xxxx xx x xxxxxx| xxxx xx xxxxxx | xxxxx xxxxx |</pre> 1.19 cvs 5881: 1.37 cvs 5882: <p align="center"><em><a name="table" id="table">The design of a 5883: table</a></em></p> 5884: <hr /> 1.30 cvs 5885: </div> 5886: 5887: <p>The presentation of the table should resemble the design of the above <a 1.37 cvs 5888: href="#table">figure</a>. It is defined by the following presentation 1.30 cvs 5889: schema fragment:</p> 5890: <pre>BOXES 1.1 cvs 5891: VertLine : BEGIN 5892: Width : 0.3 cm; 5893: Height : Enclosing . Height; 5894: VertPos : Top = Enclosing . Top; 5895: HorizPos : Left = Previous . Right; 5896: Content : Graphics 'v'; 5897: END; 5898: 5899: HorizLine: BEGIN 5900: Width : Enclosing . Width; 5901: Height : 0.3 cm; 5902: VertPos : Top = Previous . Bottom; 5903: HorizPos : Left = Enclosing . Left; 5904: Content : Graphics 'h'; 5905: END; 5906: 5907: RULES 1.6 cvs 5908: Column : BEGIN 5909: CreateBefore (VertLine); 5910: IF LAST CreateAfter (VertLine); 5911: Width : 2.8 cm; 5912: Height : Enclosed . Height; 5913: VertPos : Top = Enclosing . Top; 5914: HorizPos : Left = Previous . Right; 5915: END; 5916: 5917: Cell : BEGIN 5918: IF NOT FIRST CreateBefore (HorizLine); 5919: Width : Enclosing . Width; 5920: Height : Enclosed . Height; 5921: VertPos : Top = Previous . Bottom; 5922: HorizPos : Left = Enclosing . Left; 5923: Line; 5924: Adjust : VMiddle; 1.18 cvs 5925: END;</pre> 1.30 cvs 5926: 5927: <p>It is useful to note that the horizontal position rule of the first 5928: vertical line will not be applied, since there is no preceding box. In this 5929: case, the box is simply placed on the left side of the enclosing box.</p> 1.18 cvs 5930: </blockquote> 5931: </div> 5932: 5933: <div class="subsection"> 1.37 cvs 5934: <h3><a name="sectc4233" id="sectc4233">Page layout</a></h3> 1.18 cvs 5935: 1.30 cvs 5936: <p>The page models specified in the <tt>Page</tt> rule are defined by boxes 1.37 cvs 5937: declared in the <tt>BOXES</tt> section of the presentation schema. Pages are 1.1 cvs 5938: not described as frames which will be filled by the document's text, but as 5939: element are inserted in the flow of the document and which mark the page 1.37 cvs 5940: breaks. Each of these page break elements contains presentation boxes which 1.1 cvs 5941: represent the footer boxes of a page followed by header boxes of the next 1.37 cvs 5942: page. The page box itself is the simple line which separates two pages on the 5943: screen. Both the footer and header boxes placed themselves with respect to 1.1 cvs 5944: this page box, with the footer being placed above it and the header boxes 1.18 cvs 5945: being placed above it.</p> 1.30 cvs 5946: 5947: <p>The boxes created by a page box are headers and footers and can only place 1.1 cvs 5948: themselves vertically with respect to the page box itself (which is in fact 1.37 cvs 5949: the separation between two pages). Besides, it is their vertical position 5950: rule which determines whether they are header or footer boxes. Header and 1.1 cvs 5951: footer boxes must have an explicit vertical position rule (they must not use 1.18 cvs 5952: the default rule).</p> 1.30 cvs 5953: 5954: <p>Footer boxes must have an absolute height or inherit the height of their 1.18 cvs 5955: contents:</p> 5956: <pre>Height : Enclosed . Height;</pre> 1.30 cvs 5957: 5958: <p>A page box must have height and width rules and these two rules must be 1.1 cvs 5959: specified with constant values, expressed in centimeters, inches, or 1.37 cvs 5960: typographer's points. These two rules are interpreted in a special way for 5961: page boxes: they determine the width of the page and the vertical distance 1.1 cvs 5962: between two page separators, which is the height of the page and its header 1.18 cvs 5963: and footer together.</p> 1.30 cvs 5964: 5965: <p>A page box should also have vertical and horizontal position rules and 5966: these two rules should specify the position on the sheet of paper of the 1.37 cvs 5967: rectangle enclosing the page's contents. These two rules must position the 1.30 cvs 5968: upper left corner of the enclosing rectangle in relation to the upper left 1.37 cvs 5969: corner of the sheet of paper, considered to be the enclosing element. In both 1.30 cvs 5970: rules, distances must be expressed in fixed units: centimeters (<tt>cm</tt>), 1.37 cvs 5971: inches (<tt>in</tt>), or typographer's points (<tt>pt</tt>). Thus, rules 1.30 cvs 5972: similar to the following should be found in the rules for a page box:</p> 1.18 cvs 5973: <pre>BOXES 1.1 cvs 5974: ThePage : 5975: BEGIN 5976: VertPos : Top = Enclosing . Top + 3 cm; 5977: HorizPos : Left = Enclosing . Left + 2.5 cm; 5978: Width : 16 cm; 5979: Height : 22.5 cm; 1.18 cvs 5980: END;</pre> 1.30 cvs 5981: 5982: <p>When a document must be page broken, the page models to be constructed are 1.18 cvs 5983: defined in the <tt>BOXES</tt> section of the presentation schema by declaring 1.37 cvs 5984: page boxes and header and footer boxes. Also, the <tt>Page</tt> rule is used 5985: to specify to which parts of the document and to which views each model 5986: should be applied.</p> 1.30 cvs 5987: 5988: <p>The <tt>Page</tt> rule has only one parameter, given between parentheses 1.37 cvs 5989: after the <tt>Page</tt> keyword. This parameter is the name of the box which 5990: must serve as the model for page construction. When a <tt>Page</tt> rule is 1.1 cvs 5991: attached to an element type, each time such an element appears in a document, 5992: a page break takes place and the page model indicated in the rule is applied 5993: to all following pages, until reaching the next element which has a 1.18 cvs 5994: <tt>Page</tt> rule.</p> 1.30 cvs 5995: 5996: <p>The <tt>Page</tt> rule applies to only one view; if it appears in the 1.37 cvs 5997: primary view's block of rules, a <tt>Page</tt> rule applies only to that 5998: view. Thus, different page models can be defined for the full document and 5999: for its table of contents, which is another view of the same document. Some 6000: views can be specified with pages, and other views of the same document can 6001: be specified without pages.</p> 1.18 cvs 6002: <pre> 'Page' '(' BoxID ')'</pre> 6003: </div> 6004: 6005: <div class="subsection"> 1.37 cvs 6006: <h3><a name="sectc4234" id="sectc4234">Box copies</a></h3> 1.18 cvs 6007: 1.30 cvs 6008: <p>The <tt>Copy</tt> rule can be used for an element which is defined as a 1.37 cvs 6009: reference in the structure schema. In this case, the rule specifies, between 1.18 cvs 6010: parenthesis, the name of the box (declared in the <tt>BOXES</tt> section) 1.1 cvs 6011: which must be produced when this reference appears in the structure of a 1.37 cvs 6012: document. The box produced is a copy (same contents, but possible different 1.1 cvs 6013: presentation) of the box type indicated by the parameter between parentheses, 1.37 cvs 6014: and which is in the element designated by the reference. The name of a box 1.1 cvs 6015: can be replaced by type name. Then what is copied is the contents of the 1.18 cvs 6016: element of this type which is inside the referenced element.</p> 1.30 cvs 6017: 1.37 cvs 6018: <p>Whether a box name or type name is given, it may be followed by the name 6019: of a structure schema between parentheses. This signifies that the box or 6020: type is defined in the indicated structure schema and not in the structure 6021: schema with which the rule's presentation schema is associated.</p> 1.30 cvs 6022: 1.37 cvs 6023: <p>The <tt>Copy</tt> rule can also be applied to a presentation box. If the 1.1 cvs 6024: presentation box was created by a reference attribute, the rule is applied as 6025: in the case of a reference element: the contents of the box having the 1.18 cvs 6026: <tt>Copy</tt> rule are based on the element designated by the reference 1.37 cvs 6027: attribute. For other presentation boxes, the <tt>Copy</tt> rule takes a type 1.1 cvs 6028: name parameter which can be followed, between parentheses, by the name of the 6029: structure schema in which the type is defined, if it is not defined in the 1.37 cvs 6030: same schema. The contents of the box which has this rule are a copy of the 6031: element of this type which is in the element creating the presentation box, 6032: or by default, the box of this type which precedes the presentation box. This 6033: last facility is used, for example, to define the running titles in headers 6034: or footers.</p> 1.18 cvs 6035: <pre> 'Copy' '(' BoxTypeToCopy ')' . 1.1 cvs 6036: BoxTypeToCopy = BoxID [ ExtStruct ] / 1.6 cvs 6037: ElemID [ ExtStruct ] . 1.18 cvs 6038: ExtStruct = '(' ElemID ')' .</pre> 1.30 cvs 6039: 6040: <p>Like the creation rules, the <tt>Copy</tt> rule cannot appear in the <a 1.37 cvs 6041: href="#sectc427">default presentation rules</a>. Moreover, this rule can only 1.18 cvs 6042: appear in the primary view's block of rules; the copy rule is applied to all 6043: views.</p> 1.30 cvs 6044: 1.18 cvs 6045: <blockquote class="example"> 1.30 cvs 6046: <p><strong>Example:</strong></p> 6047: 6048: <p>If the following definitions are in the structure schema:</p> 6049: <pre>Body = LIST OF (Chapter = 1.1 cvs 6050: BEGIN 6051: ChapterTitle = Text; 6052: ChapterBody = SectionSeq; 6053: END); 1.18 cvs 6054: RefChapter = REFERENCE (Chapter);</pre> 1.30 cvs 6055: 6056: <p>then the following presentation rules (among many other rules in the 6057: presentation schema) can be specified:</p> 6058: <pre>COUNTERS 1.1 cvs 6059: ChapterCtr : RANK OF Chapter; 6060: BOXES 6061: ChapterNumber : 6062: BEGIN 6063: Content : (VALUE (ChapterCtr, URoman)); 6064: ... 6065: END; 6066: RULES 6067: Chapter : 6068: BEGIN 6069: CreateFirst (ChapterNumber); 6070: ... 6071: END; 6072: RefChapter : 6073: BEGIN 6074: Copy (ChapterNumber); 6075: ... 1.18 cvs 6076: END;</pre> 1.30 cvs 6077: 6078: <p>which makes the number of the chapter designated by the reference appear 6079: in uppercase roman numerals, in place of the reference to a chapter itself. 6080: Alternatively, the chapter title can be made to appear in place of the 6081: reference by writing this <tt>Copy</tt>rule:</p> 6082: <pre> Copy (ChapterTitle);</pre> 6083: 6084: <p>To define a header box, named <tt>RunningTitle</tt>, which contains the 6085: title of the current chapter, the box's contents are defined in this 6086: way:</p> 6087: <pre>BOXES 1.1 cvs 6088: RunningTitle : 1.18 cvs 6089: Copy (ChapterTitle);</pre> 6090: </blockquote> 6091: </div> 6092: </div> 1.37 cvs 6093: <hr /> 1.18 cvs 6094: </div> 1.1 cvs 6095: 1.18 cvs 6096: <div class="chapter"> 1.37 cvs 6097: <h1><a name="sect5" id="sect5">The T language</a></h1> 1.1 cvs 6098: 1.18 cvs 6099: <div class="section"> 1.37 cvs 6100: <h2><a name="sectb51" id="sectb51">Document translation</a></h2> 1.1 cvs 6101: 1.30 cvs 6102: <p>Because of its document model, Thot can produce documents in a high-level 1.37 cvs 6103: abstract form. This form, called the <em>canonical form</em> is specific to 1.1 cvs 6104: Thot; it is well suited to the editor's manipulations, but it does not 1.37 cvs 6105: necessarily suit other operations which might be applied to documents. 6106: Because of this, the Thot editor offers the choice of saving documents in its 6107: own form (the canonical form) or a format defined by the user. In the latter 6108: case, the Thot document is transformed by the translation program. This 6109: facility can also be used to export documents from Thot to systems using 6110: other formalisms.</p> 1.1 cvs 6111: 1.18 cvs 6112: <div class="subsection"> 1.37 cvs 6113: <h3><a name="sectc511" id="sectc511">Translation principles</a></h3> 1.1 cvs 6114: 1.30 cvs 6115: <p>Document translation allows the export of documents to other systems which 1.37 cvs 6116: do not accept Thot's canonical form. Translation can be used to export 1.30 cvs 6117: document to source-based formatters like T<sub><big>E</big></sub>X, 1.37 cvs 6118: L<sup>A</sup>T<sub><big>E</big></sub>X, and <tt>troff</tt>. It can also be 6119: used to translate documents into interchange formats like SGML or HTML. To 1.1 cvs 6120: allow the widest range of possible exports, Thot does not limit the choice of 6121: translations, but rather allows the user to define the formalisms into which 1.18 cvs 6122: documents can be translated.</p> 1.30 cvs 6123: 6124: <p>For each document or object class, a set of translation rules can be 6125: defined, specifying how the canonical form should be transformed into a given 1.37 cvs 6126: formalism. These translation rules are grouped into <em>translation 1.18 cvs 6127: schemas</em>, each schema containing the rules necessary to translate a 1.1 cvs 6128: generic logical structure (document or object structure) into a particular 1.37 cvs 6129: formalism. The same generic logical structure can have several different 1.1 cvs 6130: translation schemas, each defining translation rules for a different 1.18 cvs 6131: formalism.</p> 1.30 cvs 6132: 1.37 cvs 6133: <p>Like presentation schemas, translation schemas are generic. Thus, they 1.30 cvs 6134: apply to an entire object or document class and permit translation of all 6135: documents or objects of that class.</p> 1.18 cvs 6136: </div> 1.1 cvs 6137: 1.18 cvs 6138: <div class="subsection"> 1.37 cvs 6139: <h3><a name="sectc512" id="sectc512">Translation procedure</a></h3> 1.1 cvs 6140: 1.30 cvs 6141: <p>The translator works on the specific logical structure of the document 1.37 cvs 6142: being translated. It traverses the primary tree of this logical structure in 1.1 cvs 6143: pre-order and, at each node encountered, it applies the corresponding 6144: translation rules defined in the translation schema. Translation can be 1.18 cvs 6145: associated:</p> 6146: <ul> 1.30 cvs 6147: <li>with element types defined in the structure schema,</li> 6148: <li>with global or local attributes defined in the structure schema,</li> 6149: <li>with specific presentation rules,</li> 1.37 cvs 6150: <li>with the content of the leaves of the structure (characters, symbols 1.30 cvs 6151: and graphical elements)</li> 1.18 cvs 6152: </ul> 1.30 cvs 6153: 6154: <p>Thus, for each node, the translator applies all rules associated with the 1.1 cvs 6155: element type, all rules associated with each attribute (local or global) 6156: carried by the element, and if the element is a leaf of the tree, it also 1.10 cvs 6157: applies translation rules for characters, symbols, or graphical elements, 1.18 cvs 6158: depending on the type of the leaf.</p> 1.30 cvs 6159: 6160: <p>Rules associated with the content of leaves are different from all other 1.1 cvs 6161: rules: they specify only how to translate character strings, symbols, and 1.37 cvs 6162: graphical elements. All other rules, whether associated with element types, 1.1 cvs 6163: with specific presentation rules or with attributes, are treated similarly. 1.18 cvs 6164: These rules primarily allow:</p> 6165: <ul> 1.30 cvs 6166: <li>generation of a text constant or variable before or after the contents 6167: of an element,</li> 6168: <li>modification of the order in which elements appear after 6169: translation,</li> 6170: <li>removal of an element in the translated document,</li> 6171: <li>and writing messages on the user's terminal during translation.</li> 1.18 cvs 6172: </ul> 6173: </div> 6174: </div> 1.1 cvs 6175: 1.18 cvs 6176: <div class="section"> 1.37 cvs 6177: <h2><a name="sectb52" id="sectb52">Translation definition language</a></h2> 1.1 cvs 6178: 1.30 cvs 6179: <p>Translation schemas are written in a custom language, called T, which is 1.37 cvs 6180: described in the rest of this chapter. The grammar of T is specified using 1.18 cvs 6181: the same <a href="#sectc321">meta-language</a> as was used for the S and P 1.1 cvs 6182: languages and the translation schemas are written using the same conventions 1.37 cvs 6183: as the structure and presentation schemas. In particular, the keywords of the 1.1 cvs 6184: T language (the stings between apostrophes in the following syntax rules) can 6185: be written in any combination of upper-case and lower-case letters, but 6186: identifiers created by the programmer must always be written in the same 1.18 cvs 6187: way.</p> 1.1 cvs 6188: 1.18 cvs 6189: <div class="subsection"> 1.37 cvs 6190: <h3><a name="sectc521" id="sectc521">Organization of a translation 6191: schema</a></h3> 1.1 cvs 6192: 1.30 cvs 6193: <p>A translation schema is begun by the <tt>TRANSLATION</tt> keyword and is 1.37 cvs 6194: terminated by the <tt>END</tt> keyword. The <tt>TRANSLATION</tt> keyword is 6195: followed by the name of the generic structure for which a translation is 6196: being defined and a semicolon. This name must be identical to the name which 1.18 cvs 6197: appears after the <tt>STRUCTURE</tt> keyword in the corresponding structure 6198: schema.</p> 1.30 cvs 6199: 6200: <p>After this declaration of the structure, the following material appears in 1.18 cvs 6201: order:</p> 6202: <ul> 1.30 cvs 6203: <li>the length of lines produced by the translation,</li> 6204: <li>the character delimiting the end of the line,</li> 6205: <li>the character string which the translator will insert if it must 6206: line-break the translated text,</li> 1.52 quint 6207: <li>declarations of 1.30 cvs 6208: <ul> 6209: <li>buffers,</li> 6210: <li>counters,</li> 6211: <li>constants,</li> 6212: <li>variables,</li> 6213: </ul> 6214: </li> 6215: <li>translation rules associated with element types,</li> 6216: <li>translation rules associated with attributes,</li> 6217: <li>translation rules associated with specific presentation rules,</li> 6218: <li>translation rules associated with characters strings, symbols and 6219: graphical elements.</li> 1.18 cvs 6220: </ul> 1.30 cvs 6221: 1.37 cvs 6222: <p>Each of these sections is introduced by a keyword followed by a sequence 6223: of declarations. All of these sections are optional, expect for the 6224: translation rules associated with element types. Many <tt>TEXTTRANSLATE</tt> 6225: sections can appear, each defining the rules for translating character 1.41 vatton 6226: strings of a particular script.</p> 1.18 cvs 6227: <pre> TransSchema ='TRANSLATION' ElemID ';' 1.1 cvs 6228: [ 'LINELENGTH' LineLength ';' ] 6229: [ 'LINEEND' CHARACTER ';' ] 6230: [ 'LINEENDINSERT' STRING ';' ] 6231: [ 'BUFFERS' BufferSeq ] 6232: [ 'COUNTERS' CounterSeq ] 6233: [ 'CONST' ConstSeq ] 6234: [ 'VAR' VariableSeq ] 6235: 'RULES' ElemSeq 6236: [ 'ATTRIBUTES' AttrSeq ] 6237: [ 'PRESENTATION' PresSeq ] 1.30 cvs 6238: < 'TEXTTRANSLATE' TextTransSeq > 1.1 cvs 6239: [ 'SYMBTRANSLATE' TransSeq ] 6240: [ 'GRAPHTRANSLATE' TransSeq ] 1.18 cvs 6241: 'END' .</pre> 6242: </div> 1.1 cvs 6243: 1.18 cvs 6244: <div class="subsection"> 1.37 cvs 6245: <h3><a name="sectc522" id="sectc522">Line length</a></h3> 1.1 cvs 6246: 1.30 cvs 6247: <p>If a <tt>LINELENGTH</tt> instruction is present after the structure 1.37 cvs 6248: declaration, the translator divides the text it produces into lines, each 6249: line having a length less than or equal to the integer which follows the 6250: <tt>LINELENGTH</tt> keyword. This maximum line length is expressed as a 6251: number of characters. The end of the line is marked by the character defined 6252: by the <tt>LINEEND</tt> instruction. When the translator breaks the lines on 1.1 cvs 6253: a space character in generated text, this space will be replaced by the 1.18 cvs 6254: character string defined by the <tt>LINEENDINSERT</tt> instruction.</p> 1.30 cvs 6255: 6256: <p>If the <tt>LINEEND</tt> instruction is not defined then the linefeed 6257: character (octal code 12) is used as the default line end character. If the 1.18 cvs 6258: <tt>LINEENDINSERT</tt> instruction is not defined, the linefeed character is 1.37 cvs 6259: inserted at the end of the produced lines. If there is no <tt>LINELENGTH</tt> 6260: instruction, the translated text is not divided into lines. Otherwise, if the 1.1 cvs 6261: translation rules generate line end marks, these marks remain in the 6262: translated text, but the length of the lines is not controlled by the 1.18 cvs 6263: translator.</p> 6264: <pre> LineLength = NUMBER .</pre> 1.30 cvs 6265: 1.18 cvs 6266: <blockquote class="example"> 1.30 cvs 6267: <p><strong>Example:</strong></p> 6268: 6269: <p>To limit the lines produced by the translator to a length of 80 6270: characters, the following rule is written at the beginning of the 6271: translation schema.</p> 6272: <pre>LineLength 80;</pre> 1.18 cvs 6273: </blockquote> 6274: </div> 1.1 cvs 6275: 1.18 cvs 6276: <div class="subsection"> 1.37 cvs 6277: <h3><a name="sectc523" id="sectc523">Buffers</a></h3> 1.1 cvs 6278: 1.37 cvs 6279: <p>A buffer is a unit of memory managed by the translator, which can either 1.18 cvs 6280: contain text read from the terminal during the translation (see the <a 6281: href="#sectc5212"><tt>Read</tt> rule</a>), or the name of the last picture 1.46 quint 6282: (bit-map) encountered by the translator in its traversal of the document, or 6283: a character string set by program. Remember the pictures are stored in files 6284: that are separate for the document files and that the canonical form contains 6285: only the names of the files in which the pictures are found.</p> 6286: 6287: <p>Thus, there are three types of buffers: buffers for reading from the 6288: terminal (filled by the <tt>Read</tt> rule), the buffer of picture names 6289: (containing the name of the last picture encountered) and buffer filled by 6290: programs (see function <code>SetVariableBuffer</code> in the code) also 6291: called <em>variable buffers</em>. A translation schema can use all types of 6292: buffers, one or several read buffers, one (and only one) picture name buffer, 6293: and one or several variable buffers.</p> 1.30 cvs 6294: 6295: <p>If any buffers are used, the <tt>BUFFERS</tt> keyword must be present, 1.37 cvs 6296: followed by declarations of every buffer used in the translation schema. Each 1.46 quint 6297: buffer declaration is composed of the name of the buffer, chosen freely by 6298: the programmer, followed by a keyword between parentheses to define the type 6299: of the buffer (read buffers do not require any keyword, as they are the 6300: default type). The picture name buffer is identified by the <tt>Picture</tt> 6301: keyword, between parentheses, following the buffer name. The <tt>Picture</tt> 6302: keyword may only appear once. A variable buffer is identified by the 6303: <tt>Variable</tt> keyword, between parentheses, following the buffer name. 6304: Each buffer declaration is terminated by a semicolon.</p> 6305: <pre> BufferSeq = Buffer < Buffer > . 6306: Buffer = BufferID [ '(' BufferType ')' ] ';' . 6307: BufferID = NAME . 6308: BufferType = 'Picture' / 'Variable' .</pre> 1.30 cvs 6309: 1.18 cvs 6310: <blockquote class="example"> 1.30 cvs 6311: <p><strong>Example:</strong></p> 6312: 6313: <p>The following buffer declarations create a picture name buffer named 1.37 cvs 6314: <tt>pictureName</tt> and a read buffer named <a name="destname" 6315: id="destname"><tt>DestName</tt></a>:</p> 1.30 cvs 6316: <pre>BUFFERS 1.18 cvs 6317: pictureName (Picture); DestName;</pre> 6318: </blockquote> 6319: </div> 1.1 cvs 6320: 1.18 cvs 6321: <div class="subsection"> 1.37 cvs 6322: <h3><a name="sectc524" id="sectc524">Counters</a></h3> 1.30 cvs 6323: 6324: <p>Certain translation rules generate text that varies according to the 1.37 cvs 6325: context of the element to which the rules apply. Variable text is defined 1.30 cvs 6326: either in the <a href="#sectc526"><tt>VAR</tt> section</a> of the translation 6327: schema or in the rule itself (see the <tt>Create</tt> and <tt>Write</tt> 1.37 cvs 6328: rules). Both types of definition rely on counters for the calculation of 1.30 cvs 6329: variable material.</p> 6330: 6331: <p>There are two types of counter: counters whose value is explicitely 6332: computed by applying <a href="#sectc5221"><tt>Set</tt> and <tt>Add</tt> 6333: rules</a>, and counters whose value is computed by a function associated with 6334: the counter. Those functions allow the same calculations as can be used in 1.37 cvs 6335: presentation schemas. As in a presentation schema, counters must be defined 6336: in the <tt>COUNTERS</tt> section of the translation schema before they are 1.30 cvs 6337: used.</p> 6338: 6339: <p>When counters are used in a translation schema, the <tt>COUNTERS</tt> 1.37 cvs 6340: keyword is followed by the declarations of every counter used. Each 6341: declaration is composed of the counter's name possibly followed by a colon 6342: and the counting function to be used for the counter. The declaration is 1.30 cvs 6343: terminated by a semi-colon. If the counter is explicitely computed by 6344: <tt>Set</tt> and <tt>Add</tt> rules, no counting function is indicated. If a 6345: counting function is indicated, <tt>Set</tt> and <tt>Add</tt> rules cannot be 6346: applied to that counter.</p> 1.1 cvs 6347: 1.30 cvs 6348: <p>The counting function indicates how the counter's value will be computed. 1.18 cvs 6349: Three functions are available: <tt>Rank</tt>, <tt>Rlevel</tt>, and 6350: <tt>Set</tt>.</p> 6351: <ul> 1.40 quint 6352: <li><tt>Rank of ElemID</tt> indicates that the counter's value is the rank 6353: of the element of type <tt>ElemID</tt> which encloses the element for 6354: which the counter is being evaluated. For the purposes of this function, 6355: an element of type <tt>ElemID</tt> is considered to enclose itself. This 6356: function is primarily used when the element of type <tt>ElemID</tt> is 6357: part of an aggregate or list, in which case the counter's value is the 6358: element's rank in its list or aggregate. Note that, unlike the 6359: <tt>Rank</tt> function for presentation schemas, the <tt>Page</tt> 1.52 quint 6360: keyword cannot be used in place of the <tt>ElemID</tt>. 1.37 cvs 6361: <p>The type name <tt>ElemID</tt> can be followed by an integer. That 6362: number represents the relative level, among the ancestors of the 6363: concerned element, of the element whose rank is asked. If that relative 6364: level <i>n</i> is unsigned, the <i>n<sup>th</sup></i> element of type 6365: <tt>ElemID</tt> encountered when travelling the logical structure from 6366: the root to the concerned element is taken into account. If the relative 1.30 cvs 6367: level is negative, the logical structure is travelled in the other 6368: direction, from the concerned element to the root.</p> 6369: </li> 1.40 quint 6370: <li><tt>Rlevel of ElemID</tt> indicates that the counter's values is the 6371: relative level in the tree of the element for which the counter is being 6372: evaluated. The counter counts the number of elements of type 6373: <tt>ElemID</tt> which are found on the path between the root of the 6374: document's logical structure tree and the element (inclusive).</li> 6375: <li><tt>Set n on Type1 Add m on Type2</tt> indicates that the counter's 6376: value is calculated as follows: in traversing the document from the 6377: beginning to the element for which the counter is being evaluated, the 6378: counter is set to the value <tt>n</tt> each time a <tt>Type1</tt> element 6379: is encountered and is incremented by the amount <tt>m</tt> each time a 6380: <tt>Type2</tt> element is encountered. The initial value <tt>n</tt> and 6381: the increment <tt>m</tt> are integers.</li> 1.30 cvs 6382: </ul> 6383: 6384: <p>As in a presentation schema, the <tt>Rank</tt> and <tt>Set</tt> functions 1.37 cvs 6385: can be modified by a numeric attribute which changes their initial value. 6386: This is indicated by the <tt>Init</tt> keyword followed by the numeric 6387: attribute's name. The <tt>Set</tt> function takes the value of the attribute 6388: instead of the <tt>InitValue</tt> (<tt>n</tt>). For the <tt>Rank</tt> 6389: function, the value of the attribute is considered to be the rank of the 6390: first element of the list (rather than the normal value of 1). Subsequent 6391: items in the list have their ranks shifted accordingly. In both cases, the 6392: attribute must be numeric and must be a local attribute of the root of the 6393: document itself.</p> 1.30 cvs 6394: <pre> CounterSeq = Counter < Counter > . 1.1 cvs 6395: Counter = CounterID [ ':' CounterFunc ] ';' . 6396: CounterID = NAME . 6397: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ] 6398: [ 'Init' AttrID ] / 6399: 'Rlevel' 'of' ElemID / 6400: 'Set' InitValue 'On' ElemID 6401: 'Add' Increment 'On' ElemID 6402: [ 'Init' AttrID ] . 6403: SLevelAsc = [ '-' ] LevelAsc . 6404: LevelAsc = NUMBER . 6405: InitValue = NUMBER . 6406: Increment = NUMBER . 6407: ElemID = NAME . 1.18 cvs 6408: AttrID = NAME .</pre> 1.30 cvs 6409: 1.18 cvs 6410: <blockquote class="example"> 1.30 cvs 6411: <p><strong>Example:</strong></p> 6412: 6413: <p>If the body of a chapter is defined in the structure schema by:</p> 6414: <pre>Chapter_Body = LIST OF 1.1 cvs 6415: (Section = BEGIN 6416: Section_Title = Text; 6417: Section_Body = BEGIN 6418: Paragraphs; 6419: Section; 6420: END; 6421: END 1.18 cvs 6422: );</pre> 1.30 cvs 6423: 6424: <p>(sections are defined recursively), a counter can be defined giving the 1.37 cvs 6425: <a name="sectnum" id="sectnum">number of a section</a> within its level in 6426: the hierarchy:</p> 1.30 cvs 6427: <pre>COUNTERS 1.18 cvs 6428: SectionNumber : Rank of Section;</pre> 1.30 cvs 6429: 6430: <p>A counter holding the hierarchic level of a section:</p> 6431: <pre> SectionLevel : Rlevel of Section;</pre> 6432: 1.37 cvs 6433: <p>A <a name="uniquenum" id="uniquenum">counter</a> which sequentially 6434: numbers all the document's sections, whatever their hierarchic level:</p> 1.30 cvs 6435: <pre> UniqueSectNum : Set 0 on Document Add 1 on Section;</pre> 1.18 cvs 6436: </blockquote> 6437: </div> 1.1 cvs 6438: 1.18 cvs 6439: <div class="subsection"> 1.37 cvs 6440: <h3><a name="sectc525" id="sectc525">Constants</a></h3> 1.1 cvs 6441: 1.30 cvs 6442: <p>A common feature of translation rules is the generation of constant text. 1.37 cvs 6443: This text can be defined in the rule that generates it (see for example the 6444: <a href="#sectc5210"><tt>Create</tt></a> and <a 1.18 cvs 6445: href="#sectc5211"><tt>Write</tt></a> rules); but it can also be defined once 6446: in the constant declaration section and used many times in different rules. 1.37 cvs 6447: The latter option is preferable when the same text is used in several rules 6448: or several <a href="#sectc526">variables</a>.</p> 1.30 cvs 6449: 6450: <p>The <tt>CONST</tt> keyword begins the constant declaration section of the 1.37 cvs 6451: translation schema. It must be omitted if no constants are declared. Each 6452: constant declaration is composed of the constant name, an equals sign, and 6453: the constant's value, which is a character string between apostrophes. A 6454: constant declaration is terminated by a semicolon.</p> 1.30 cvs 6455: <pre> ConstSeq = Const < Const > . 1.1 cvs 6456: Const = ConstID '=' ConstValue ';' . 6457: ConstID = NAME . 1.18 cvs 6458: ConstValue = STRING .</pre> 1.30 cvs 6459: 1.18 cvs 6460: <blockquote class="example"> 1.37 cvs 6461: <p><strong><a name="levelexample" 6462: id="levelexample">Example:</a></strong></p> 1.30 cvs 6463: 6464: <p>The following rule assigns the name <tt>TxtLevel</tt> to the character 6465: string ``Level'':</p> 6466: <pre>CONST 1.18 cvs 6467: TxtLevel = 'Level';</pre> 6468: </blockquote> 6469: </div> 1.1 cvs 6470: 1.18 cvs 6471: <div class="subsection"> 1.37 cvs 6472: <h3><a name="sectc526" id="sectc526">Variables</a></h3> 1.1 cvs 6473: 1.30 cvs 6474: <p>Variables allow to define variable text which is generated by the 1.37 cvs 6475: <tt>Create</tt> and <tt>Write</tt> rules. They are also used to define file 1.18 cvs 6476: names which are used in the <tt>Create</tt>, <tt>ChangeMainFile</tt>, 1.37 cvs 6477: <tt>RemoveFile</tt>, and <tt>Indent</tt> rules. Variables can be defined 1.18 cvs 6478: either in the <tt>VAR</tt> section of the translation schema or directly in 1.37 cvs 6479: the rules which use them. Variables that define file names must be declared 1.18 cvs 6480: in the <tt>VAR</tt> section, and when the same variable is used several times 6481: in the translation schema, it makes sense to define it globally in the 1.37 cvs 6482: <tt>VAR</tt> section. This section is only present if at least one variable 1.18 cvs 6483: is defined globally.</p> 1.30 cvs 6484: 6485: <p>After the <tt>VAR</tt> keyword, each global variable is defined by its 6486: name, a colon separator and a sequence of functions (at least one function). 1.37 cvs 6487: Each variable definition is terminated by a semicolon. Functions determine 6488: the different parts which together give the value of the variable. The value 6489: is obtained by concatenating the strings produced by each of the functions. 6490: Seven types of functions are available. Each variable definition may use any 6491: number of functions of each type.</p> 1.18 cvs 6492: <ul> 1.30 cvs 6493: <li>The function <tt>Value(Counter)</tt>returns a string representing the 6494: value taken by the counter when it is evaluated for the element in whose 1.37 cvs 6495: rule the variable is used. The counter must have been declared in the 6496: <tt>COUNTERS</tt> section of the translation schema. When the counter is 1.30 cvs 6497: expressed in arabic numerals, the counter name can be followed by a colon 6498: and an integer indicating a minimum length (number of characters) for the 1.37 cvs 6499: string; if the counter's value is normally expressed with fewer 6500: characters than the required minimum, zeroes are added to the front of 1.52 quint 6501: the string to achieve the minimum length. 1.30 cvs 6502: <p>By default, the counter value is written in arabic digits. If another 6503: representation of that value is needed, the counter name must be followed 6504: by a comma and one of the following keywords:</p> 6505: <ul> 1.40 quint 6506: <li><tt>Arabic</tt> : arabic numerals (default value),</li> 6507: <li><tt>LRoman</tt> : lower-case roman numerals,</li> 6508: <li><tt>URoman</tt> : upper-case roman numerals,</li> 6509: <li><tt>Uppercase</tt> : upper-case letter,</li> 6510: <li><tt>Lowercase</tt> : lower-case letter.</li> 1.30 cvs 6511: </ul> 6512: </li> 6513: <li>The function <tt>FileDir</tt>, without parameter, returns a string 6514: representing the name of the directory of the output file that has been 6515: given as a parameter to the translation program. The string includes a 6516: character '/' at the end.</li> 6517: <li>The function <tt>FileName</tt>, without parameter, returns a string 6518: representing the name of the output file that has been given as a 6519: parameter to the translation program. The file extension (the character 6520: string that terminate the file name, after a dot) is not part of that 6521: string.</li> 6522: <li>The function <tt>Extension</tt>, without parameter, returns a string 6523: representing the extension of the file name. That string is empty if the 6524: file name that has been given as a parameter to the translation program 6525: has no extension. If there is an extension, its first character is a 6526: dot.</li> 6527: <li>The function <tt>DocumentName</tt>, without parameter, returns a string 6528: representing the name of the document being translated.</li> 6529: <li>The function <tt>DocumentDir</tt>, without parameter, returns a string 6530: representing the directory containing the document being translated.</li> 6531: <li>The function formed by the name of a constant returns that constant's 6532: value.</li> 6533: <li>The function formed by a character string between apostrophes returns 6534: that string.</li> 1.37 cvs 6535: <li>The function formed by the name of a buffer returns the contents of 6536: that buffer. If the named buffer is the picture buffer, then the name of 6537: the last picture encountered is returned. Otherwise, the buffer is a read 1.31 cvs 6538: buffer and the value returned is text previously read from the terminal. 1.30 cvs 6539: If the buffer is empty (no picture has been encountered or the 6540: <tt>Read</tt> rule has not been executed for the buffer), then the empty 6541: string is returned.</li> 6542: <li>The function formed by an attribute name takes the value of the 1.37 cvs 6543: indicated attribute for the element to which the variable applies. If the 1.30 cvs 6544: element does not have that attribute, then the element's ancestor are 1.37 cvs 6545: searched toward the root of the tree. If one of the ancestors does have 6546: the attribute then its value is used. If no ancestors have the attribute, 1.30 cvs 6547: then the value of the function is the empty string.</li> 1.18 cvs 6548: </ul> 1.30 cvs 6549: <pre> VariableSeq = Variable < Variable > . 6550: Variable = VarID ':' Function < Function > ';' . 1.1 cvs 6551: VarID = NAME . 6552: Function ='Value' '(' CounterID [ ':' Length ] 6553: [ ',' CounterStyle ] ')' / 6554: 'FileDir' / 'FileName' / 'Extension' / 6555: 'DocumentName' / 'DocumentDir' / 6556: ConstID / CharString / 6557: BufferID / AttrID . 6558: Length = NUMBER . 6559: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' / 6560: 'Uppercase' / 'Lowercase' . 1.18 cvs 6561: CharString = STRING .</pre> 1.30 cvs 6562: 1.18 cvs 6563: <blockquote class="example"> 1.30 cvs 6564: <p><strong>Example:</strong></p> 6565: 6566: <p>To create, at the beginning of each section of the translated document, 6567: text composed of the string ``Section'' followed by the section number, the 1.37 cvs 6568: following <a name="varsectexample" id="varsectexample">variable 6569: definition</a> might be used:</p> 1.30 cvs 6570: <pre>VAR 1.18 cvs 6571: SectionVar : 'Section' Value(SectionNumber);</pre> 1.30 cvs 6572: 6573: <p>(see the definition of <a 6574: href="#sectnum"><tt>SectionNumber</tt></a>).</p> 6575: 1.37 cvs 6576: <p>The following variable definition can be used to create, at the 6577: beginning of each section, the text ``Level'' followed by the hierarchical 6578: level of the section. It used the constant defined above.</p> 1.30 cvs 6579: <pre> LevelVar : TxtLevel Value(SectionLevel);</pre> 6580: 6581: <p>(see the definitions of <a href="#sectnum"><tt>SectionLevel</tt></a> and 6582: of <a href="#levelexample"><tt>TxtLevel</tt></a>).</p> 6583: 6584: <p>To generate the translation of each section in a different file (see <a 1.37 cvs 6585: href="#sectc5220">rule <tt>ChangeMainFile</tt></a>), the name of these 6586: files might be defined by the following variable:</p> 1.30 cvs 6587: <pre> VarOutpuFile : FileName Value(SectionNumber) 1.18 cvs 6588: Extension;</pre> 1.30 cvs 6589: 1.37 cvs 6590: <p>If <tt>output.txt</tt> is the name of the <a name="varoutputfile" 6591: id="varoutputfile">output file</a> specified when starting the translation 6592: program, translated sections are written in files <tt>output1.txt</tt>, 6593: <tt>output2.txt</tt>, etc.</p> 1.18 cvs 6594: </blockquote> 6595: </div> 6596: 6597: <div class="subsection"> 1.37 cvs 6598: <h3><a name="sectc527" id="sectc527">Translating structure elements</a></h3> 1.18 cvs 6599: 1.30 cvs 6600: <p>The <tt>RULES</tt> keyword introduces the translation rules which will be 1.37 cvs 6601: applied to the various structured element types. Translation rules can be 6602: specified for each element type defined in the structure schema, including 6603: the base types defined implicitly, whose names are <tt>TEXT_UNIT</tt>, 1.18 cvs 6604: <tt>PICTURE_UNIT</tt>, <tt>SYMBOL_UNIT</tt>, <tt>GRAPHIC_UNIT</tt> and 1.37 cvs 6605: <tt>PAGE_UNIT</tt>. But it is not necessary to specify rules for every 1.18 cvs 6606: defined type.</p> 1.30 cvs 6607: 1.37 cvs 6608: <p>If there are no translation rules for an element type, the elements that 6609: it contains (and which may have rules themselves) will still be translated, 6610: but the translator will produce nothing for the element itself. To make the 1.18 cvs 6611: translator completely ignore the content of an element the <a 6612: href="#sectc5217"><tt>Remove</tt> rule</a> must be used.</p> 1.30 cvs 6613: 6614: <p>The translation rules for an element type defined in the structure schema 6615: are written using the name of the type followed by a colon and the list of 1.37 cvs 6616: applicable rules. When the element type is a <a href="#sectd3285">mark 1.18 cvs 6617: pair</a>, but only in this case, the type name must be preceded by the 1.37 cvs 6618: <tt>First</tt> or <tt>Second</tt> keyword. This keyword indicates whether the 1.18 cvs 6619: rules that follow apply to the first or second mark of the pair.</p> 1.30 cvs 6620: 1.37 cvs 6621: <p>The list of rules can take several forms. It may be a simple 6622: non-conditional rule. It can also be formed by a condition followed by one or 6623: more simple rules. Or it can be a block of rules beginning with the 1.30 cvs 6624: <tt>BEGIN</tt> keyword and ending with the <tt>END</tt> keyword and a 1.37 cvs 6625: semicolon. This block of rules can contain one or more simple rules and/or 1.30 cvs 6626: one or more conditions, each followed by one or more simple rules.</p> 6627: <pre> ElemSeq = TransType < TransType > . 1.1 cvs 6628: TransType = [ FirstSec ] ElemID ':' RuleSeq . 6629: FirstSec = 'First' / 'Second' . 1.30 cvs 6630: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' . 1.1 cvs 6631: Rule = SimpleRule / ConditionBlock . 6632: ConditionBlock = 'IF' ConditionSeq SimpleRuleSeq . 1.30 cvs 6633: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' / 1.18 cvs 6634: SimpleRule .</pre> 6635: </div> 1.1 cvs 6636: 1.18 cvs 6637: <div class="subsection"> 1.37 cvs 6638: <h3><a name="sectc528" id="sectc528">Conditional rules</a></h3> 1.1 cvs 6639: 1.30 cvs 6640: <p>In a translation schema, the translation rules are either associated with 1.37 cvs 6641: element types or with attribute values or with a specific presentation. They 1.1 cvs 6642: are applied by the translator each time an element of the corresponding type 6643: is encountered in the translated document or each time the attribute value is 6644: carried by an element or also, each time the specific translation is attached 1.37 cvs 6645: to an element. This systematic application of the rules can be relaxed: it is 6646: possible to add a condition to one or more rules, so that these rules are 6647: only applied when the condition is true.</p> 1.30 cvs 6648: 6649: <p>A condition begins with the keyword <tt>IF</tt>, followed by a sequence of 1.37 cvs 6650: elementary conditions. Elementary conditions are separated from each other by 6651: the <tt>AND</tt> keyword. If there is only one elementary condition, this 6652: keyword is absent. The rules are only applied if all the elementary 6653: conditions are true. The elementary condition can be negative; it is then 1.18 cvs 6654: preceded by the <tt>NOT</tt> keyword.</p> 1.30 cvs 6655: 6656: <p>When the translation rule(s) controlled by the condition apply to a 6657: reference element or a reference attribute, an elementary condition can also 1.37 cvs 6658: apply to element referred by this reference. The <tt>Target</tt> keyword is 6659: used for that purpose. It must appear before the keyword defining the 1.30 cvs 6660: condition type.</p> 6661: 6662: <p>Depending on their type, some conditions may apply either to the element 1.37 cvs 6663: with which they are associated, or to one of its ancestor. In the case of an 1.18 cvs 6664: ancestor, the key word <tt>Ancestor</tt> must be used, followed by</p> 6665: <ul> 1.30 cvs 6666: <li>either an integer which represents the number of levels in the tree 6667: between the element and the ancestor of interest,</li> 1.37 cvs 6668: <li>or the type name of the ancestor of interest. If that type is defined 1.30 cvs 6669: in a separate structure schema, the name of that schema must follow 6670: between parentheses.</li> 1.18 cvs 6671: </ul> 1.30 cvs 6672: 1.37 cvs 6673: <p>There is a special case for the parent element, which can be simply 6674: written <tt>Parent</tt> instead of <tt>Ancestor 1</tt>.</p> 1.30 cvs 6675: 6676: <p>Only conditions <tt>First</tt>, <tt>Last</tt>, <tt>Referred</tt>, 1.34 cvs 6677: <tt>Within</tt>, <tt>Attributes</tt>, <tt>Presentation</tt>, and those 6678: concerning an attribute or a specific presentation can apply to an ancestor. 6679: Conditions <tt>FirstRef</tt>, <tt>LastRef</tt>, <tt>ExternalRef</tt>, 1.41 vatton 6680: <tt>Script</tt>, <tt>FirstAttr</tt>, <tt>LastAttr</tt>, 1.34 cvs 6681: <tt>ComputedPage</tt>, <tt>StartPage</tt>, <tt>UserPage</tt>, 1.55 ! quint 6682: <tt>ReminderPage</tt>, <tt>Empty</tt>, <tt>Root</tt> cannot be preceded by ! 6683: keywords <tt>Parent</tt> or <tt>Ancestor</tt>.</p> 1.30 cvs 6684: 1.37 cvs 6685: <p>In condition <tt>Referred</tt> and in the condition that applies to a 6686: named attribute, a symbol '<tt>*</tt>' can indicate that the condition is 6687: related only to the element itself. If this symbol is not present, not only 6688: the element is considered, but also its ancestor, at any level.</p> 1.30 cvs 6689: 6690: <p>The form of an elementary condition varies according to the type of 1.18 cvs 6691: condition.</p> 1.1 cvs 6692: 1.18 cvs 6693: <div class="subsubsection"> 1.37 cvs 6694: <h4><a name="sectd5281" id="sectd5281">Conditions based on the logical 6695: position of the element</a></h4> 1.30 cvs 6696: 6697: <p>The condition can be on the position of the element in the document's 1.37 cvs 6698: logical structure tree. It is possible to test whether the element is the 1.30 cvs 6699: first (<tt>First</tt>) or last (<tt>Last</tt>) among its siblings or if it is 6700: not the first (<tt>NOT First</tt>) or not the last (<tt>NOT Last</tt>).</p> 6701: 1.55 ! quint 6702: <p>It is possible to test if the element is the root of its document (keyword ! 6703: <code>Root</code>).</p> ! 6704: 1.30 cvs 6705: <p>It is also possible to test if the element is contained in an element of a 1.18 cvs 6706: given type (<tt>Within</tt>) or if it is not (<tt>NOT Within</tt>). If that 1.1 cvs 6707: element type is defined in a structure schema which is not the one which 6708: corresponds to the translation schema, the type name of this element must be 6709: followed, between parentheses, by the name of the structure schema which 1.18 cvs 6710: defines it.</p> 1.30 cvs 6711: 6712: <p>If the keyword <tt>Within</tt> is preceded by <tt>Immediately</tt>, the 1.18 cvs 6713: condition is satisfied only if the <em>parent</em> element has the type 6714: indicated. If the word <tt>Immediately</tt> is missing, the condition is 6715: satisfied if any <em>ancestor</em> has the type indicated.</p> 1.30 cvs 6716: 6717: <p>An integer <i>n</i> can appear between the keyword <tt>Within</tt> and the 1.37 cvs 6718: type. It specifies the number of ancestors of the indicated type that must be 6719: present for the condition to be satisfied. If the keyword 1.18 cvs 6720: <tt>Immediately</tt> is also present, the <i>n</i> immediate ancestors of the 1.37 cvs 6721: element must have the indicated type. The integer <i>n</i> must be positive 6722: or zero. It can be preceded by <tt><</tt> or <tt>></tt> to indicate a 6723: maximum or minimum number of ancestors. If these symbols are missing, the 6724: condition is satisfied only if it exists exactly <i>n</i> ancestors. When 1.30 cvs 6725: this number is missing, it is equivalent to > 0.</p> 6726: 1.37 cvs 6727: <p>If the condition applies to translation rules associated with an 6728: attribute, i.e. if it is in the <tt>ATTRIBUTES</tt> section of the 6729: presentation schema, the condition can be simply an element name. Translation 6730: rules are then executed only if the attribute is attached to an element of 6731: that type. The keyword <tt>NOT</tt> before the element name indicates that 6732: the translation rules must be executed only if the element is not of the type 6733: indicated.</p> 1.18 cvs 6734: </div> 1.1 cvs 6735: 1.18 cvs 6736: <div class="subsubsection"> 1.37 cvs 6737: <h4><a name="sectd5282" id="sectd5282">Conditions on references</a></h4> 1.1 cvs 6738: 1.30 cvs 6739: <p>References may be taken into account in conditions, which can be based on 6740: the fact that the element, or one of its ancestors (unless symbol <tt>*</tt> 6741: is present), is designated by a at least one reference (<tt>Referred</tt>) or 1.37 cvs 6742: by none (<tt>NOT Referred</tt>). If the element or attribute to which the 1.1 cvs 6743: condition is attached is a reference, the condition can be based on the fact 6744: that it acts as the first reference to the designated element 1.18 cvs 6745: (<tt>FirstRef</tt>), or as the last (<tt>LastRef</tt>), or as a reference to 1.37 cvs 6746: an element located in another document (<tt>ExternalRef</tt>). Like all 1.18 cvs 6747: conditions, conditions on references can be inverted by the <tt>NOT</tt> 6748: keyword.</p> 6749: </div> 6750: 6751: <div class="subsubsection"> 1.41 vatton 6752: <h4><a name="sectd5284" id="sectd5284">Conditions on the scripts</a></h4> 1.1 cvs 6753: 1.30 cvs 6754: <p>The character string base type (and only this type) can use the condition 1.43 quint 6755: <tt>Script = a</tt> which indicates that the translation rule(s) should only 6756: apply if the script of the character string is the one whose name appears 6757: after the equals sign (or is not, if there is a preceding <tt>NOT</tt> 6758: keyword). This condition cannot be applied to translation rules of an 6759: attribute.</p> 1.30 cvs 6760: 1.41 vatton 6761: <p>In the current implementation of Thot, the available scripts are the 6762: <tt>Latin</tt> script and the <tt>Greek</tt> script.</p> 1.18 cvs 6763: </div> 1.1 cvs 6764: 1.18 cvs 6765: <div class="subsubsection"> 1.37 cvs 6766: <h4><a name="sectd5285" id="sectd5285">Conditions on page breaks</a></h4> 1.1 cvs 6767: 1.30 cvs 6768: <p>The page break base type (and only this type) can use the following 1.18 cvs 6769: conditions: <tt>ComputedPage</tt>, <tt>StartPage</tt>, <tt>UserPage</tt>, and 1.37 cvs 6770: <tt>ReminderPage</tt>. The <tt>ComputedPage</tt> condition indicates that the 1.1 cvs 6771: translation rule(s) should apply if the page break was created automatically 1.37 cvs 6772: by Thot; the <tt>StartPage</tt> condition is true if the page break is 1.18 cvs 6773: generated before the element by the <tt>Page</tt> rule of the P language; the 6774: <tt>UserPage</tt> condition applies if the page break was inserted by the 1.37 cvs 6775: user; and the <tt>ReminderPage</tt> is applied if the page break is a 6776: reminder of page breaking.</p> 1.18 cvs 6777: </div> 1.1 cvs 6778: 1.18 cvs 6779: <div class="subsubsection"> 1.37 cvs 6780: <h4><a name="sectd5286" id="sectd5286">Conditions on the element's 6781: content</a></h4> 1.1 cvs 6782: 1.37 cvs 6783: <p>The condition can be based on whether or not the element is empty. An 1.30 cvs 6784: element which has no children or whose leaves are all empty is considered to 1.37 cvs 6785: be empty itself. This condition is expressed by the <tt>Empty</tt> keyword, 1.30 cvs 6786: optionally preceded by the <tt>NOT</tt> keyword.</p> 1.18 cvs 6787: </div> 1.1 cvs 6788: 1.18 cvs 6789: <div class="subsubsection"> 1.37 cvs 6790: <h4><a name="sectd5288" id="sectd5288">Conditions on the presence of specific 6791: presentation rules</a></h4> 1.30 cvs 6792: 6793: <p>The condition can be based on the presence or absence of specific 1.37 cvs 6794: presentation rules associated with the translated element, whatever the 6795: rules, their value or their number. This condition is expressed by the 6796: keyword <tt>Presentation</tt>, optionally preceded by the <tt>NOT</tt> 6797: keyword.</p> 1.18 cvs 6798: </div> 1.1 cvs 6799: 1.18 cvs 6800: <div class="subsubsection"> 1.37 cvs 6801: <h4><a name="sectd5289" id="sectd5289">Conditions on the presence of logical 1.18 cvs 6802: attributes</a></h4> 1.30 cvs 6803: 6804: <p>In the same way, the condition can be based on the presence or absence of 1.1 cvs 6805: attributes associated with the translated elements, no matter what the 1.37 cvs 6806: attributes or their values. The <tt>Attributes</tt> keyword expresses this 1.18 cvs 6807: condition.</p> 6808: </div> 1.1 cvs 6809: 1.18 cvs 6810: <div class="subsubsection"> 1.37 cvs 6811: <h4><a name="sectd52810" id="sectd52810">Conditions on logical 6812: attributes</a></h4> 1.1 cvs 6813: 1.30 cvs 6814: <p>If the condition appears in the translation rules of an attribute, the 1.37 cvs 6815: <tt>FirstAttr</tt> and <tt>LastAttr</tt> keywords can be used to indicate 6816: that the rules must only be applied if this attribute is the first attribute 6817: for the translated element or if it is the last (respectively). These 6818: conditions can also be inverted by the <tt>NOT</tt> keyword.</p> 6819: 6820: <p>Another type of condition can only be applied to the translation rules 6821: when the element being processed (or one of its ancestors if symbol 6822: <tt>*</tt> is missing) has a certain attribute, perhaps with a certain value 6823: or, in contrast, when the element does not have this attribute with this 6824: value. The condition is specified by writing the name of the attribute after 6825: the keyword <tt>IF</tt> or <tt>AND</tt>. The <tt>NOT</tt> keyword can be used 6826: to invert the condition. If the translation rules must be applied to any 6827: element which has this attribute (or does not have it, if the condition is 6828: inverted) no matter what the attribute's value, the condition is complete. 6829: If, in contrast, the condition applies to one or more values of the 6830: attribute, these are indicated after the name of the attribute, except for 6831: reference attributes which do not have values.</p> 6832: 6833: <p>The representation of the values of an <a name="relattr" 6834: id="relattr">attribute</a> in a condition depends on the attribute's type. 6835: For attributes with enumerated or textual types, the value (a name or 6836: character string between apostrophes, respectively) is simply preceded by an 6837: equals sign. For numeric attributes, the condition can be based on a single 6838: value or on a range of values. In the case of a unique value, this value (an 6839: integer) is simply preceded by an equals sign. Conditions based on ranges of 6840: values have several forms:</p> 1.18 cvs 6841: <ul> 1.30 cvs 6842: <li>all values less than a given value (the value is preceded by a ``less 6843: than'' sign).</li> 6844: <li>all values greater than a given value (the value is preceded by a 6845: ``greater than'' sign).</li> 1.37 cvs 6846: <li>all values falling in an interval, bounds included. The range of values 6847: is then specified <tt>IN [</tt>Minimum <tt>..</tt>Maximum<tt>]</tt>, 6848: where Minimum and Maximum are integers.</li> 1.18 cvs 6849: </ul> 1.30 cvs 6850: 1.37 cvs 6851: <p>All numeric values may be negative. The integer is simply preceded by a 1.30 cvs 6852: minus sign.</p> 6853: 6854: <p>Both local and global attributes can be used in conditions.</p> 1.18 cvs 6855: </div> 1.1 cvs 6856: 1.18 cvs 6857: <div class="subsubsection"> 1.37 cvs 6858: <h4><a name="sectd52811" id="sectd52811">Conditions on specific presentation 6859: rules</a></h4> 1.1 cvs 6860: 1.30 cvs 6861: <p>It is possible to apply translation rules only when the element being 1.1 cvs 6862: processed has or does not have a specific presentation rule, possibly with a 1.37 cvs 6863: certain value. The condition is specified by writing the name of the 6864: presentation rule after the keyword <tt>IF</tt> or <tt>AND</tt>. The 6865: <tt>NOT</tt> keyword can be used to invert the condition. If the translation 6866: rules must be applied to any element which has this presentation rule (or 6867: does not have it, if the condition is inverted) no matter what the rule's 6868: value, the condition is complete. If, in contrast, the condition applies to 6869: one or more values of the rule, these are indicated after the name of the 1.18 cvs 6870: attribute.</p> 1.30 cvs 6871: 1.37 cvs 6872: <p>The representation of presentation rule values in a condition is similar 6873: to that for attribute values. The representation of these values depend on 6874: the type of the presentation rule. There are three categories of presentation 1.18 cvs 6875: rules:</p> 6876: <ul> 1.30 cvs 6877: <li>those taking numeric values (<tt>Size, Indent, LineSpacing, 6878: LineWeight</tt>),</li> 1.36 cvs 6879: <li>those with values taken from a predefined list (<tt>Adjust, Hyphenate, 1.43 quint 6880: Direction, UnicodeBidi, Style, Weight, Font, UnderLine, Thickness, 6881: LineStyle</tt>),</li> 1.30 cvs 6882: <li>those whose value is a name (<tt>FillPattern, Background, 6883: Foreground</tt>).</li> 1.18 cvs 6884: </ul> 1.30 cvs 6885: 6886: <p>For presentation rules which take numeric values, the condition can take a 1.37 cvs 6887: unique value or a range of values. In the case of a unique value, this value 1.1 cvs 6888: (an integer) is simply preceded by an equals sign. Conditions based on ranges 1.18 cvs 6889: of values have several forms:</p> 6890: <ul> 1.30 cvs 6891: <li>all values less than a given value (the value is preceded by a ``less 6892: than'' sign).</li> 6893: <li>all values greater than a given value (the value is preceded by a 6894: ``greater than'' sign).</li> 1.37 cvs 6895: <li>all values falling in an interval, bounds included. The range of values 6896: is then specified <tt>IN [</tt>Minimum <tt>..</tt>Maximum<tt>]</tt>, 6897: where Minimum and Maximum are integers.</li> 1.18 cvs 6898: </ul> 1.30 cvs 6899: 1.37 cvs 6900: <p>Values for the <tt>Indent</tt>rule may be negative. The integer is then 1.2 cvs 6901: simply preceded by a minus sign and represents how far the first line starts 1.18 cvs 6902: to the left of the other lines.</p> 1.30 cvs 6903: 6904: <p>For presentation rules whose values are taken from predefined lists, the 1.37 cvs 6905: value which satisfies the condition is indicated by an equals sign followed 6906: by the name of the value.</p> 1.30 cvs 6907: 1.37 cvs 6908: <p>For presentation rule whose values are names, the value which satisfies 6909: the condition is indicated by the equals sign followed by the value's name. 6910: The names of fill patterns (the <tt>FillPattern</tt> rule) and of colors (the 1.18 cvs 6911: <tt>Foreground</tt> and <tt>Background</tt> rules) known to Thot are the same 6912: as in the P language.</p> 1.30 cvs 6913: 6914: <p>The syntax of conditions based on the specific presentation is the same as 6915: the syntax used to express the <a href="#sectc5224">translation of specific 1.18 cvs 6916: presentation rules</a>.</p> 1.30 cvs 6917: 6918: <p>When a condition has only one rule, the condition is simply followed by 1.37 cvs 6919: that rule. If it has several rules, they are placed after the condition 1.30 cvs 6920: between the keywords <tt>BEGIN</tt> and <tt>END</tt>.</p> 1.18 cvs 6921: <pre> ConditionSeq = Condition [ 'AND' Condition ] . 1.1 cvs 6922: Condition = [ 'NOT' ] [ 'Target' ] Cond . 6923: Cond = CondElem / CondAscend . 6924: CondElem ='FirstRef' / 'LastRef' / 6925: 'ExternalRef' / 1.41 vatton 6926: 'Script' '=' Script / 1.1 cvs 6927: 'ComputedPage' / 'StartPage' / 6928: 'UserPage' / 'ReminderPage' / 1.55 ! quint 6929: 'Empty' / 'Root' / 1.11 cvs 6930: ElemID / 1.1 cvs 6931: 'FirstAttr' / 'LastAttr' . 6932: CondAscend = [ Ascend ] CondOnAscend . 6933: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType . 6934: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] . 6935: CondRelLevel = NUMBER . 6936: CondOnAscend ='First' / 'Last' / 6937: 'Referred' / 6938: [ 'Immediately' ] 'Within' [ NumParent ] 6939: ElemID [ ExtStruct ] / 6940: 'Attributes' / 6941: AttrID [ RelatAttr ] / 6942: 'Presentation' / 1.34 cvs 6943: PresRule . 1.1 cvs 6944: NumParent = [ GreaterLess ] NParent . 1.30 cvs 6945: GreaterLess = '>' / '<' . 1.1 cvs 6946: NParent = NUMBER. 6947: ExtStruct = '(' ElemID ')' . 1.41 vatton 6948: Script = NAME . 1.1 cvs 6949: RelatAttr ='=' Value / 1.30 cvs 6950: '>' [ '-' ] Minimum / 1.1 cvs 6951: '<' [ '-' ] Maximum / 6952: 'IN' '[' [ '-' ] MinInterval '..' 6953: [ '-' ] MaxInterval ']' . 6954: Value = [ '-' ] IntegerVal / TextVal / AttrValue . 6955: Minimum = NUMBER . 6956: Maximum = NUMBER . 6957: MinInterval = NUMBER . 6958: MaxInterval = NUMBER . 6959: IntegerVal = NUMBER . 6960: TextVal = STRING . 1.18 cvs 6961: AttrValue = NAME .</pre> 1.30 cvs 6962: 1.18 cvs 6963: <blockquote class="example"> 1.30 cvs 6964: <p><strong>Example:</strong></p> 6965: 6966: <p>Suppose that after each element of type Section_Title it is useful to 6967: produce the text <tt>\label{SectX}</tt> where <tt>X</tt> represents the 6968: section number, but only if the section is designated by one or more 1.37 cvs 6969: references in the document. The following conditional rule produces this 1.30 cvs 6970: effect:</p> 6971: <pre>RULES 1.1 cvs 6972: Section_Title : 6973: IF Referred 1.18 cvs 6974: Create ('\label{Sect' Value(UniqueSectNum) '}\12') After;</pre> 1.30 cvs 6975: 6976: <p>(the declaration of the <a href="#sectc5224"><tt>UniqueSectNum</tt> 1.37 cvs 6977: counter</a> is given above). The string <tt>\12</tt> represents a line 1.30 cvs 6978: break.</p> 1.18 cvs 6979: </blockquote> 1.30 cvs 6980: 1.18 cvs 6981: <blockquote class="example"> 1.30 cvs 6982: <p><strong>Example:</strong></p> 6983: 1.37 cvs 6984: <p>Suppose that for elements of the Elmnt type it would be useful to 6985: produce a character indicating the value of the numeric attribute Level 6986: associated with the element: an ``A'' for all values of Level less than 3, 6987: a ``B'' for values between 3 and 10 and a ``C'' for values greater than 10. 6988: This can be achieved by writing the following rules for the Elmnt type:</p> 1.30 cvs 6989: <pre>RULES 1.1 cvs 6990: Elmnt : 6991: BEGIN 6992: IF Level < 3 6993: Create 'A'; 6994: IF Level IN [3..10] 6995: Create 'B'; 1.30 cvs 6996: IF Level > 10 1.1 cvs 6997: Create 'C'; 1.18 cvs 6998: END;</pre> 6999: </blockquote> 7000: </div> 7001: </div> 1.1 cvs 7002: 1.18 cvs 7003: <div class="subsection"> 1.37 cvs 7004: <h3><a name="sectc529" id="sectc529">Translation rules</a></h3> 1.1 cvs 7005: 1.37 cvs 7006: <p>Fifteen types of translation rules can be associated with element types 7007: and attribute values. They are the <tt>Create</tt>, <tt>Write</tt>, 1.18 cvs 7008: <tt>Read</tt>, <tt>Include</tt>, <tt>Get</tt>, <tt>Copy</tt>, <tt>Use</tt>, 1.31 cvs 7009: <tt>Remove</tt>, <tt>Ignore</tt>, <tt>NoTranslation</tt>, 7010: <tt>NoLineBreak</tt>, <tt>ChangeMainFile</tt>, <tt>RemoveFile</tt>, 1.37 cvs 7011: <tt>Set</tt>, <tt>Add</tt>, <tt>Indent</tt>, rules. Each rule has its own 1.31 cvs 7012: syntax, although they are all based on very similar models.</p> 1.18 cvs 7013: <pre> SimpleRule = 'Create' [ 'IN' VarID ] Object 1.1 cvs 7014: [ Position ] ';' / 7015: 'Write' Object [ Position ] ';' / 7016: 'Read' BufferID [ Position ] ';' / 7017: 'Include' File [ Position ] ';' / 7018: 'Get' [ RelPosition ] ElemID 7019: [ ExtStruct ] 7020: [ Position ] ';' / 7021: 'Copy' [ RelPosition ] ElemID 7022: [ ExtStruct ] 7023: [ Position ] ';' / 7024: 'Use' TrSchema [ 'For' ElemID ] ';' / 7025: 'Remove' ';' / 1.31 cvs 7026: 'Ignore' ';' / 1.1 cvs 7027: 'NoTranslation' ';' / 7028: 'NoLineBreak' ';' / 7029: 'ChangeMainFile' VarID [ Position ] ';' / 1.14 cvs 7030: 'RemoveFile' VarID [ Position ] ';' / 1.10 cvs 7031: 'Set' CounterID InitValue [ Position ] ';' / 7032: 'Add' CounterID Increment [ Position ] ';' / 1.25 cvs 7033: 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' .</pre> 1.18 cvs 7034: </div> 7035: 7036: <div class="subsection"> 1.37 cvs 7037: <h3><a name="sectc5210" id="sectc5210">The <tt>Create</tt> rule</a></h3> 1.18 cvs 7038: 1.30 cvs 7039: <p>The most frequently used rule is undoubtedly the <tt>Create</tt> rule, 7040: which generates fixed or variable text (called an <em>object</em>) in the 1.37 cvs 7041: output file. The generated text can be made to appear either before or after 7042: the content of the element to which the rule applies. The rule begins with 7043: the <tt>Create</tt> keyword, followed by a specifier for the object and a 7044: keyword (<tt>Before</tt> or <tt>After</tt>) indicating the position of the 7045: generated text (<a href="#sectc5222">before or after</a> the element's 7046: content). If the position is not indicated, the object will be generated 7047: before the element's content. This rule, like all translation rules, is 7048: terminated by a semicolon.</p> 1.30 cvs 7049: 7050: <p>The <tt>Create</tt> keyword can be followed by the <tt>IN</tt> keyword and 1.37 cvs 7051: by the name of a variable. This means that the text generated by the rule 1.30 cvs 7052: must not be written in the main output file, but in the file whose name is 1.18 cvs 7053: specified by the variable.</p> 1.30 cvs 7054: 7055: <p>This allows the translation program to generate text in different files 7056: during the same run. These files do not need to be explicitely declared or 7057: opened. They do not need to be closed either, but if they contain temporary 7058: data, they can be removed (see the <a href="#sectc5220a"><tt>RemoveFile</tt> 7059: rule</a>). As soon as the translation program executes a <tt>Create</tt> rule 7060: for a file that is not yet open, it opens the file. These files are closed 7061: when the translation is finished.</p> 1.18 cvs 7062: <pre> 'Create' [ 'IN' VarID ] Object 1.1 cvs 7063: [ Position ] ';' 7064: Object = ConstID / CharString / 7065: BufferID / 7066: VarID / 1.30 cvs 7067: '(' Function < Function > ')' / 1.21 cvs 7068: [ 'Translated' ] AttrID / 1.1 cvs 7069: 'Value' / 7070: 'Content' / 7071: 'Attributes' / 7072: 'Presentation' / 7073: 'RefId' / 7074: 'PairId' / 7075: 'FileDir' / 7076: 'FileName' / 7077: 'Extension' / 7078: 'DocumentName' / 7079: 'DocumentDir' / 7080: [ 'Referred' ] ReferredObject . 7081: Position ='After' / 'Before' . 7082: 7083: ReferredObject = VarID / 7084: ElemID [ ExtStruct ] / 7085: 'RefId' / 7086: 'DocumentName' / 1.18 cvs 7087: 'DocumentDir' .</pre> 1.30 cvs 7088: 7089: <p>The object to be generated can be:</p> 1.18 cvs 7090: <ul> 1.30 cvs 7091: <li>a constant string, specified by its name if it is declared in the 7092: schema's <tt>CONST</tt> section, or given directly as a value between 7093: apostrophes;</li> 7094: <li>the contents of a buffer, designated by the name of the buffer;</li> 7095: <li>a variable, designated by its name if it is declared in the translation 1.37 cvs 7096: schema's <tt>VAR</tt> section, or given directly between parentheses. The 1.30 cvs 7097: text generated is the value of that variable evaluated for the element to 7098: which the rule applies.</li> 7099: <li>the value of an attribute, if the element being translated has this 7100: attribute. The attribute is specified by its name. If it's a text 7101: attribute, it can be preceded by the <code>Translated</code> keyword, 7102: which causes the attribute value to be recoded using the text translation 7103: table defined by section <code><a 7104: href="#sectc5225">TEXTTRANSLATE</a></code>;</li> 1.37 cvs 7105: <li>the value of a specific presentation rule. This object can only be 1.30 cvs 7106: generated if the translation rule is for a <a href="#prestransl">specific 1.37 cvs 7107: presentation rule</a>. It is specified by the <tt>Value</tt> keyword;</li> 7108: <li>the element's content. That is, the content of the leaves of the 7109: subtree of the translated element. This is specified by the 1.30 cvs 7110: <tt>Content</tt> keyword;</li> 7111: <li>the translation of all attributes of the element (which is primarily 7112: used to apply the attribute translation rules <a 1.37 cvs 7113: href="#sectc5222">before</a> those of the element type). This is 1.30 cvs 7114: specified by the <tt>Attributes</tt> keyword.</li> 7115: <li>the translation of all of the element's specific presentation rules 7116: (which is primarily used to apply the translation rules for the specific 1.37 cvs 7117: presentation rules <a href="#sectc5222">before</a> those of the element 7118: or its attributes). This option is specified by the <tt>Presentation</tt> 1.30 cvs 7119: keyword;</li> 1.37 cvs 7120: <li>The value of the reference's identifier.<br /> 7121: Thot associates a unique identifier with each element in a document. This 7122: identifier (called <em>reference's identifier</em> or <em>label</em>) is 7123: a character string containing the letter `L' followed by digits. Thot 7124: uses it in references for identifying the referred element.<br /> 1.30 cvs 7125: The <tt>RefId</tt> keyword produces the reference's identifier of the 7126: element to which the translation rule is applied, or the reference's 7127: identifier of its first ancestor that is referred by a reference or that 7128: can be referred by a reference.</li> 1.37 cvs 7129: <li>the value of a mark pair's unique identifier. This may only be used for 1.30 cvs 7130: <a href="#sectd3285">mark pairs</a> and is indicated by the 7131: <tt>PairId</tt> keyword.</li> 7132: <li>the directory containing the file being generated (this string includes 1.37 cvs 7133: an ending '/', if it is not empty). This is indicated by the 1.30 cvs 7134: <tt>FileDir</tt> keyword.</li> 7135: <li>the name of the file being generated (only the name, without the 7136: directory and without the extension). This is indicated by the 7137: <tt>FileName</tt> keyword.</li> 7138: <li>the extension of the file being generated (this string starts with a 1.37 cvs 7139: dot, if it is not empty). This is indicated by the <tt>Extension</tt> 1.30 cvs 7140: keyword.</li> 1.37 cvs 7141: <li>the name of the document being translated. This is indicated by the 1.30 cvs 7142: <tt>DocumentName</tt> keyword.</li> 1.37 cvs 7143: <li>the directory containing the document being translated. This is 1.30 cvs 7144: indicated by the <tt>DocumentDir</tt> keyword.</li> 1.18 cvs 7145: </ul> 1.30 cvs 7146: 1.37 cvs 7147: <p>When the rule applies to a reference (an element or an attribute defined 7148: as a reference in the structure schema), it can generate a text related to 7149: the element referred by that reference. The rule name is then followed by the 1.18 cvs 7150: <tt>Referred</tt> keyword and a specification of the object to be generated 1.37 cvs 7151: for the referred element. This specification can be:</p> 1.18 cvs 7152: <ul> 1.37 cvs 7153: <li>the name of a variable. The rule generates the value of that variable, 1.30 cvs 7154: computed for the referred element.</li> 1.37 cvs 7155: <li>an element type. The rule generates the translation of the element of 7156: that type, which is in the subtree of the referred element. If this 1.30 cvs 7157: element is not defined in the structure schema which corresponds to the 7158: translation schema (that is, an object defined in another schema), the 7159: element's type name must be followed by the name of its structure schema 7160: between parentheses.</li> 1.37 cvs 7161: <li>the <tt>RefId</tt> keyword. The rule generates the reference's 1.30 cvs 7162: identifier of the referred element.</li> 1.37 cvs 7163: <li>the <tt>DocumentName</tt> keyword. The rule generates the name of the 1.30 cvs 7164: document to which the referred element belongs.</li> 1.37 cvs 7165: <li>the <tt>DocumentDir</tt> keyword. The rule generates the name of the 1.30 cvs 7166: directory that contains the document of the referred element.</li> 1.18 cvs 7167: </ul> 7168: </div> 1.1 cvs 7169: 1.18 cvs 7170: <div class="subsection"> 1.37 cvs 7171: <h3><a name="sectc5211" id="sectc5211">The <tt>Write</tt> rule</a></h3> 1.1 cvs 7172: 1.37 cvs 7173: <p>The <tt>Write</tt> has the same syntax as the <tt>Create</tt> rule. It 1.30 cvs 7174: also produces the same effect, but the generated text is displayed on the 7175: user's terminal during the translation of the document, instead of being 1.37 cvs 7176: produced in the translated document. This is useful for helping the user keep 1.30 cvs 7177: track of the progress of the translation and for prompting the user on the 7178: terminal for input required by the <tt>Read</tt> rule.</p> 1.18 cvs 7179: <pre> 'Write' Object [ Position ] ';'</pre> 1.30 cvs 7180: 7181: <p>Notice: if the translator is launched by the editor (by the ``Save as'' 1.18 cvs 7182: command), messages produced by the <tt>Write</tt> rule are not displayed.</p> 1.30 cvs 7183: 1.18 cvs 7184: <blockquote class="example"> 1.30 cvs 7185: <p><strong>Example:</strong></p> 7186: 7187: <p>To make the translator display the number of each section being 7188: translated on the user's terminal, the following rule is specified for the 7189: <tt>Section</tt> element type:</p> 7190: <pre>Section : BEGIN 1.1 cvs 7191: Write VarSection; 7192: ... 1.18 cvs 7193: END;</pre> 1.30 cvs 7194: 7195: <p>(see <a href="#varsectexample">above</a> for the definition of the 7196: <tt>VarSection</tt> variable).</p> 7197: 7198: <p>To display text on the terminal before issuing a read operation with the 7199: <tt>Read</tt> rule, the following rule is used:</p> 7200: <pre>BEGIN 1.1 cvs 7201: Write 'Enter the name of the destination: '; 7202: ... 1.18 cvs 7203: END;</pre> 7204: </blockquote> 7205: </div> 7206: 7207: <div class="subsection"> 1.37 cvs 7208: <h3><a name="sectc5212" id="sectc5212">The <tt>Read</tt> rule</a></h3> 1.18 cvs 7209: 1.30 cvs 7210: <p>The <tt>Read</tt> rule reads text from the terminal during the translation 7211: of the document and saves the text read in one of the buffers declared in the 1.37 cvs 7212: <tt>BUFFERS</tt> section of the schema. The buffer to be used is indicated by 7213: its name, after the <tt>READ</tt> keyword. This name can be followed, as in 1.18 cvs 7214: the <tt>Create</tt> and <tt>Write</tt> rules, by a keyword indicating if the 7215: read operation must be performed <tt>Before</tt> or <tt>After</tt> the 1.37 cvs 7216: translation of the element's content. If this keyword is absent, the read 7217: operation is done beforehand. The text is read into the buffer and remains 1.5 cvs 7218: there until a rule using the same buffer - possibly the same rule - is 1.18 cvs 7219: applied.</p> 7220: <pre> 'Read' BufferID [ Position ] ';'</pre> 1.30 cvs 7221: 1.18 cvs 7222: <blockquote class="example"> 1.30 cvs 7223: <p><strong>Example:</strong></p> 7224: 7225: <p>The following set of rules tells the user that the translator is waiting 7226: for the entry of some text, reads this text into a buffer and copies the 7227: text into the translated document.</p> 7228: <pre>BEGIN 1.1 cvs 7229: Write 'Enter the name of the destination: '; 7230: Read DestName; 7231: Create DestName; 7232: ... 1.18 cvs 7233: END;</pre> 1.30 cvs 7234: 7235: <p>(see <a href="#destname">above</a> the definition of 7236: <tt>DestName</tt>).</p> 1.18 cvs 7237: </blockquote> 7238: </div> 7239: 7240: <div class="subsection"> 1.37 cvs 7241: <h3><a name="sectc5213" id="sectc5213">The <tt>Include</tt> rule</a></h3> 1.18 cvs 7242: 1.30 cvs 7243: <p>The <tt>Include</tt> rule, like the <tt>Create</tt> rule, is used to 1.37 cvs 7244: produce text in the translated document. It inserts constant text which is 7245: not defined in the translation schema, but is instead taken from a file. The 7246: file's name is specified after the <tt>Include</tt> keyword, either directly 7247: as a character string between apostrophes or as the name of one of the 7248: buffers declared in the <tt>BUFFERS</tt> section of the schema. In the latter 7249: case, the buffer is assumed to contain the file's name. This can be used when 7250: the included file's name is known only at the moment of translation. This 7251: only requires that the <tt>Include</tt> rule is preceded by a <tt>Read</tt> 7252: rule which puts the name of the file desired by the user into the buffer.</p> 1.30 cvs 7253: 7254: <p>Like the other rules, it is possible to specify whether the inclusion will 1.1 cvs 7255: occur before or after the element's content, with the default being before. 7256: The file inclusion is only done at the moment of translation, not during the 7257: compilation of the translation schema. Thus, the file to be included need not 7258: exist during the compilation, but it must be accessible at the time of 1.37 cvs 7259: translation. Its contents can also be modified between two translations, thus 1.1 cvs 7260: producing different results, even if neither the document or the translation 1.18 cvs 7261: schema are modified.</p> 1.30 cvs 7262: 7263: <p>During translation, the file to be included is searched for along the 7264: schema directory path (indicated by the environment variable 1.37 cvs 7265: <tt>THOTSCH</tt>). The file name is normally only composed of a simple name, 7266: without specification of a complete file path. However, if the filename 1.30 cvs 7267: starts with a '/', it is considered as an absolute path.</p> 1.18 cvs 7268: <pre> 'Include' File [ Position ] ';' 1.6 cvs 7269: File = FileName / BufferID . 1.18 cvs 7270: FileName = STRING .</pre> 1.30 cvs 7271: 1.18 cvs 7272: <blockquote class="example"> 1.30 cvs 7273: <p><strong>Example:</strong></p> 7274: 1.37 cvs 7275: <p>Suppose that it is desirable to print documents of the Article class 7276: with a formatter which requires a number of declarations and definitions at 7277: the beginning of the file. The <tt>Include</tt>rule can be used to achieve 1.30 cvs 7278: this. All the declarations and definitions a replaced in a file called 7279: <tt>DeclarArt</tt> and then the <tt>Article</tt> element type is given the 7280: following rule:</p> 7281: <pre>Article : BEGIN 1.1 cvs 7282: Include 'DeclarArt' Before; 7283: ... 1.18 cvs 7284: END;</pre> 7285: </blockquote> 7286: </div> 7287: 7288: <div class="subsection"> 1.37 cvs 7289: <h3><a name="sectc5214" id="sectc5214">The <tt>Get</tt> rule</a></h3> 1.18 cvs 7290: 1.30 cvs 7291: <p>The <tt>Get</tt> rule is used to change the order in which the elements 1.37 cvs 7292: appear in the translated document. More precisely, it produces the 1.30 cvs 7293: translation of a specified element before or after the translation of the 1.37 cvs 7294: content of the element to which the rule applies. The <tt>Before</tt> and 1.30 cvs 7295: <tt>After</tt> keywords are placed at the end of the rule to specify whether 7296: the operation should be performed before or after translation of the rule's 7297: element (the default is before). The type of the element to be moved must be 7298: specified after the <tt>Get</tt> keyword, optionally preceded by a keyword 7299: indicating where the element will be found in the logical structure of the 7300: document:</p> 1.18 cvs 7301: <dl> 1.30 cvs 7302: <dt><tt>Included</tt></dt> 7303: <dd>The element to be moved is the first element of the indicated type 7304: which is found inside the element to which the rule applies.</dd> 7305: <dt><tt>Referred</tt></dt> 7306: <dd>This keyword can only be used if the rule applies to a reference 1.37 cvs 7307: element. The element to be moved is either the element designated by 7308: the reference (if that element is of the specified type), or the first 1.30 cvs 7309: element of the desired type contained within the element designated by 7310: the reference.</dd> 7311: <dt>no keyword</dt> 1.37 cvs 7312: <dd><p>The translator takes the first element of the indicated type from 7313: among the siblings of the rule's element. This is primarily used to 7314: change the order of the components of an aggregate.</p> 1.30 cvs 7315: </dd> 1.18 cvs 7316: </dl> 1.30 cvs 7317: 7318: <p>If the element to be moved is defined in a structure schema which is not 7319: the one which corresponds to the translation schema (in the case of an 7320: included object with a different schema), the type name of this element must 7321: be followed, between parentheses, by the name of the structure schema which 1.18 cvs 7322: defines it.</p> 7323: <pre> 'Get' [ RelPosition ] ElemID 1.6 cvs 7324: [ ExtStruct ] 7325: [ Position ] ';' / 7326: RelPosition = 'Included' / 'Referred' . 1.18 cvs 7327: ExtStruct = '(' ElemID ')' .</pre> 1.30 cvs 7328: 7329: <p>The <tt>Get</tt> rule has no effect if the element which it is supposed to 1.37 cvs 7330: move has already been translated. Thus, the element will not be duplicated. 1.1 cvs 7331: It is generally best to associate the rule with the first element which will 1.37 cvs 7332: be encountered by the translator in its traversal of the document. Suppose an 1.18 cvs 7333: aggregate has two elements <tt>A</tt> and <tt>B</tt>, with <tt>A</tt> 1.37 cvs 7334: appearing first in the logical structure. To permute these two elements, a 1.18 cvs 7335: <tt>Get B before</tt> rule should be associated with the <tt>A</tt> element 1.37 cvs 7336: type, not the inverse. Similarly, a rule of the form <tt>Get Included X 1.18 cvs 7337: After</tt>, even though syntactically correct, makes no sense since, by the 1.1 cvs 7338: time it will be applied, after the translation of the contents of the element 1.18 cvs 7339: to which it is attached, the <tt>X</tt> element will already have been 7340: translated.</p> 7341: </div> 7342: 7343: <div class="subsection"> 1.37 cvs 7344: <h3><a name="sectc5215" id="sectc5215">The <tt>Copy</tt> rule</a></h3> 1.18 cvs 7345: 1.30 cvs 7346: <p>Like the <tt>Get</tt> rule, the <tt>Copy</tt> rule generates the 7347: translation of a specified element, but it acts even if the element has 7348: already been translated and it allows to copy it or to translate it later. 7349: Both rules have the same syntax.</p> 1.18 cvs 7350: <pre> 'Copy' [ RelPosition ] ElemID 7351: [ ExtStruct ] [ Position ] ';'</pre> 7352: </div> 7353: 7354: <div class="subsection"> 1.37 cvs 7355: <h3><a name="sectc5216" id="sectc5216">The <tt>Use</tt> rule</a></h3> 1.18 cvs 7356: 1.30 cvs 7357: <p>The <tt>Use</tt> rule specifies the translation schema to be applied to 1.37 cvs 7358: objects of a certain class that are part of the document. This rule only 1.1 cvs 7359: appears in the rules for the root element of the document (the first type 1.18 cvs 7360: defined after the <tt>STRUCT</tt> keyword in the structure schema) or the 1.1 cvs 7361: rules of an element defined by an external structure (by another structure 1.37 cvs 7362: schema). Also, the <tt>Use</tt> rule cannot be conditional.</p> 1.30 cvs 7363: 7364: <p>If the rule is applied to an element defined by an external structure, the 1.18 cvs 7365: <tt>Use</tt> keyword is simply followed by the name of the translation schema 1.37 cvs 7366: to be used for element constructed according to that external structure. If 1.1 cvs 7367: the rule is applied to the document's root element, it is formed by the 1.18 cvs 7368: <tt>Use</tt> keyword followed by the translation schema's name, the 7369: <tt>For</tt> keyword and the name of the external structure to which the 7370: indicated translation schema should be applied.</p> 7371: <pre> 'Use' TrSchema [ 'For' ElemID ] ';' 7372: TrSchema = NAME .</pre> 1.30 cvs 7373: 7374: <p>If no <tt>Use</tt> rule defines the translation schema to be used for an 1.1 cvs 7375: external structure which appears in a document, the translator asks the user, 7376: during the translation process, which schema should be used. Thus, it is not 1.18 cvs 7377: necessary to give the translation schema a <tt>Use</tt> rule for every 1.1 cvs 7378: external structure used, especially when the choice of translation schemas is 1.18 cvs 7379: to be left to the user.</p> 1.30 cvs 7380: 7381: <p>Notice: if the translator is launched by the editor (by the ``Save as'' 1.18 cvs 7382: command), prompts are not displayed.</p> 1.30 cvs 7383: 1.18 cvs 7384: <blockquote class="example"> 1.30 cvs 7385: <p><strong>Example:</strong></p> 7386: 7387: <p>The <tt>Article</tt> structure schema uses the <tt>Formula</tt> external 7388: structure, defined by another structure schema, for mathematical 7389: formulas:</p> 7390: <pre>STRUCTURE Article; 1.1 cvs 7391: ... 7392: STRUCT 7393: Article = ... 7394: ... 7395: Formula_in_text = Formula; 7396: Isolated_formula = Formula; 7397: ... 1.18 cvs 7398: END</pre> 1.30 cvs 7399: 7400: <p>Suppose that it would be useful to use the <tt>FormulaT</tt> translation 1.37 cvs 7401: schema for the formulas of an article. This can be expressed in two 1.30 cvs 7402: different ways in the <tt>Article</tt> class translation schema, using the 7403: rules:</p> 7404: <pre>RULES 1.1 cvs 7405: Article : 1.18 cvs 7406: Use FormulaT for Formula;</pre> 1.30 cvs 7407: 7408: <p>or:</p> 7409: <pre>RULES 1.1 cvs 7410: ... 7411: Formula : 1.18 cvs 7412: Use FormulaT;</pre> 7413: </blockquote> 7414: </div> 7415: 7416: <div class="subsection"> 1.37 cvs 7417: <h3><a name="sectc5217" id="sectc5217">The <tt>Remove</tt> rule</a></h3> 1.18 cvs 7418: 1.37 cvs 7419: <p>The <tt>Remove</tt> rule indicates that nothing should be generated, in 7420: the translated document, for the content of the element to which the rule 7421: applies. The content of that element is simply ignored by the translator. 7422: This does not prevent the generation of text for the element itself, using 7423: the <tt>Create</tt> or <tt>Include</tt> rules, for example.</p> 1.30 cvs 7424: 7425: <p>The <tt>Remove</tt> rule is simply written with the <tt>Remove</tt> 7426: keyword. It is terminated, like all rules, by a semicolon.</p> 1.18 cvs 7427: <pre> 'Remove' ';'</pre> 7428: </div> 7429: 7430: <div class="subsection"> 1.37 cvs 7431: <h3><a name="sectc5217a" id="sectc5217a">The <tt>Ignore</tt> rule</a></h3> 1.31 cvs 7432: 1.37 cvs 7433: <p>The <tt>Ignore</tt> rule indicates that nothing should be generated, in 7434: the translated document, for the element to which the rule applies. The whole 1.32 cvs 7435: element is simply ignored by the translator.</p> 1.31 cvs 7436: 7437: <p>The <tt>Ignore</tt> rule is simply written with the <tt>Ignore</tt> 7438: keyword. It is terminated, like all rules, by a semicolon.</p> 7439: <pre> 'Ignore' ';'</pre> 7440: </div> 7441: 7442: <div class="subsection"> 1.37 cvs 7443: <h3><a name="sectc5218" id="sectc5218">The <tt>NoTranslation</tt> 7444: rule</a></h3> 1.18 cvs 7445: 1.30 cvs 7446: <p>The <tt>NoTranslation</tt> rule indicates to the translator that it must 1.37 cvs 7447: not translate the content of the leaves of the element to which it applies. 7448: In contrast to the <tt>Remove</tt> rule, it does not suppress the content of 7449: the element, but it inhibits the translation of character strings, symbols, 7450: and graphical elements contained in the element. These are retrieved so that 1.18 cvs 7451: after the translation of the document, the rules of the <a 7452: href="#sectc5225"><tt>TEXTTRANSLATE</tt>, <tt>SYMBTRANSLATE</tt> and 7453: <tt>GRAPHTRANSLATE</tt> sections</a> will not be applied to them.</p> 1.30 cvs 7454: 7455: <p>The <tt>NoTranslation</tt> rule is written with the <tt>NoTranslation</tt> 1.18 cvs 7456: keyword followed by a semicolon.</p> 7457: <pre> 'NoTranslation' ';'</pre> 7458: </div> 7459: 7460: <div class="subsection"> 1.37 cvs 7461: <h3><a name="sectc5219" id="sectc5219">The <tt>NoLineBreak</tt> rule</a></h3> 1.18 cvs 7462: 1.30 cvs 7463: <p>The <tt>NoLineBreak</tt> rule indicates to the translator that it must not 1.1 cvs 7464: generate additional line breaks in the output produced for the element to 1.37 cvs 7465: which it applies. This is as if it was an <a href="#sectc522">instruction 1.18 cvs 7466: <tt>LINELENGTH 0;</tt></a> at the beginning of the translation schema, but 7467: only for the current element.</p> 1.30 cvs 7468: 7469: <p>The <tt>NoLineBreak</tt> rule is written with the <tt>NoLineBreak</tt> 7470: keyword followed by a semicolon.</p> 1.18 cvs 7471: <pre> 'NoLineBreak' ';'</pre> 7472: </div> 1.1 cvs 7473: 1.18 cvs 7474: <div class="subsection"> 1.37 cvs 7475: <h3><a name="sectc5220" id="sectc5220">The <tt>ChangeMainFile</tt> 7476: rule</a></h3> 1.1 cvs 7477: 1.30 cvs 7478: <p>When the translation program starts, it opens a main output file, whose 1.37 cvs 7479: name is given as a parameter of the translator. All <a 7480: href="#sectc5210"><tt>Create</tt> rules</a> without explicit indication of 7481: the output file write sequentially in this file. When a 7482: <tt>ChangeMainFile</tt> rule is executed, the main output file is closed and 7483: it is replaced by a new one, whose name is specified in the 7484: <tt>ChangeMainFile</tt> rule. The <tt>Create</tt> rules without indication of 7485: the output file that are then executed write in this new file. Several 7486: <tt>ChangeMainFile</tt> rules can be executed during the same translation, 7487: for dividing the main output into several files.</p> 1.30 cvs 7488: 7489: <p>This rule is written with the <tt>ChangeMainFile</tt> keyword followed by 7490: the name of a variable that specifies the name of the new main file. The 1.37 cvs 7491: keyword <tt>Before</tt> or <tt>After</tt> can be placed at the end of the 7492: rule to specify whether the operation should be performed before or after 7493: translation of the rule's element (the default is before). This rule, like 7494: all translation rules, is terminated by a semicolon.</p> 1.18 cvs 7495: <pre> 'ChangeMainFile' VarID [ Position ] ';'</pre> 1.30 cvs 7496: 1.18 cvs 7497: <blockquote class="example"> 1.30 cvs 7498: <p><strong>Example:</strong></p> 7499: 7500: <p>To generate the translation of each section in a different file, the 1.37 cvs 7501: following rule can be associated with type <tt>Section</tt>. That rule uses 1.30 cvs 7502: the <a href="#varoutputfile"><tt>VarOutpuFile</tt> variable</a> defined 7503: above.</p> 7504: <pre> Section: 1.18 cvs 7505: ChangeMainFile VarOutpuFile Before;</pre> 1.30 cvs 7506: 7507: <p>If <tt>output.txt</tt> is the name of the output file specified when 7508: starting the translation program, translated sections are written in files 7509: <tt>output1.txt</tt>, <tt>output2.txt</tt>, etc.</p> 1.18 cvs 7510: </blockquote> 7511: </div> 1.1 cvs 7512: 1.18 cvs 7513: <div class="subsection"> 1.37 cvs 7514: <h3><a name="sectc5220a" id="sectc5220a">The <tt>RemoveFile</tt> rule</a></h3> 1.14 cvs 7515: 1.37 cvs 7516: <p>Files may be used for storing temporary data that are no longer needed 7517: when the translation of a document is complete. These files may be removed by 7518: the <tt>RemoveFile</tt> rule.</p> 1.30 cvs 7519: 7520: <p>This rule is written with the <tt>RemoveFile</tt> keyword followed by the 1.37 cvs 7521: name of a variable that specifies the name of the file to be removed. The 7522: keyword <tt>Before</tt> or <tt>After</tt> can be placed at the end of the 7523: rule to specify whether the operation should be performed before or after 7524: translation of the rule's element (the default is before). This rule, like 1.30 cvs 7525: all translation rules, is terminated by a semicolon.</p> 1.18 cvs 7526: <pre> 'RemoveFile' VarID [ Position ] ';'</pre> 7527: </div> 7528: 7529: <div class="subsection"> 1.37 cvs 7530: <h3><a name="sectc5221" id="sectc5221">The <tt>Set</tt> and <tt>Add</tt> 7531: rules</a></h3> 1.18 cvs 7532: 1.37 cvs 7533: <p>The <tt>Set</tt> and <tt>Add</tt> rules are used for modifying the value 7534: of counters that have no <a href="#sectc524">counting function</a>. Only this 1.18 cvs 7535: type of counter can be used in the <tt>Set</tt> and <tt>Add</tt> rules.</p> 1.30 cvs 7536: 7537: <p>Both rules have the same syntax: after the keyword <tt>Set</tt> or 1.18 cvs 7538: <tt>Add</tt> appear the counter name and the value to assign to the counter 7539: (<tt>Set</tt> rule) or the value to be added to the counter (<tt>Add</tt> 1.37 cvs 7540: rule). The keyword <tt>Before</tt> or <tt>After</tt> can follow that value to 1.1 cvs 7541: indicate when the rule must be applied: before or after the element's content 1.37 cvs 7542: is translated. By default, <tt>Before</tt> is assumed. A semicolon terminates 1.18 cvs 7543: the rule.</p> 7544: <pre> 'Set' CounterID InitValue [ Position ] ';' / 7545: 'Add' CounterID Increment [ Position ] ';'</pre> 7546: </div> 7547: 7548: <div class="subsection"> 1.37 cvs 7549: <h3><a name="sectc5221a" id="sectc5221a">The <tt>Indent</tt> rule</a></h3> 1.18 cvs 7550: 1.37 cvs 7551: <p>The <tt>Indent</tt> rule is used to modify the value of text indentation 7552: in the output files.</p> 1.30 cvs 7553: 1.37 cvs 7554: <p>Each time the translator creates a new line in an output file, it 7555: generates a variable number of space characters at the beginning of the new 7556: line. By default, the number of these characters (the indentation value) is 7557: 0. It can be changed with the <tt>Indent</tt> rule.</p> 1.30 cvs 7558: 7559: <p>In its simple form, the rule begins with the <tt>Indent</tt> keyword, 1.25 cvs 7560: followed by the indentation sign (optional) and value and a keyword 1.30 cvs 7561: <tt>Before</tt> or <tt>After</tt> indicating that the indentation should be 7562: changed <a href="#sectc5222">before or after</a> the element's content is 1.37 cvs 7563: generated. If the position is not indicated, the indentation is changed 7564: before the element's content is generated. This rule, like all translation 1.25 cvs 7565: rules, is terminated by a semicolon.</p> 1.30 cvs 7566: 7567: <p>The indentation value is indicated by an integer, which is the number of 7568: space characters to be generated at the beginning of each new line. A sign 1.18 cvs 7569: (<tt>+</tt> or <tt>-</tt>) can appear before the integer to indicate that the 1.37 cvs 7570: value is relative: the current value of indentation is incremented (if sign 7571: is <tt>+</tt>) or decremented (if sign is <tt>-</tt>) by the specified 7572: value.</p> 1.30 cvs 7573: 7574: <p>Keyword <tt>Suspend</tt> or <tt>Resume</tt> can appear instead of the 1.37 cvs 7575: (possibly signed) identation value. <tt>Suspend</tt> means that the new 1.30 cvs 7576: indentation value to be used is zero until another <tt>Indent</tt> rule is 7577: executed and changes the indentation value. <tt>Resume</tt> means that the 7578: indentation value that was used before the last <tt>Indent Suspend</tt> was 1.37 cvs 7579: executed becomes the new value. Only one <tt>Suspend</tt> can be used before 1.30 cvs 7580: a <tt>Resume</tt>; <tt>Supend</tt>-<tt>Resume</tt> pairs can not be 7581: nested.</p> 7582: 1.37 cvs 7583: <p>Like the <a href="#sectc5210"><tt>Create</tt> rule</a>, the 7584: <tt>Indent</tt> keyword can be followed by the <tt>IN</tt> keyword and by the 7585: name of a <a href="#sectc526">variable</a>. This means that the rule must not 7586: change indentation in the main output file, but in the file whose name is 7587: specified by the variable (by default, indentation is changed in the main 7588: output file).</p> 1.25 cvs 7589: <pre> 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' . 1.10 cvs 7590: 1.25 cvs 7591: Indent = 'Suspend' / 'Resume' / [ IndentSign ] IndentValue . 1.10 cvs 7592: IndentSign = '+' / '-' . 1.18 cvs 7593: IndentValue = NUMBER .</pre> 7594: </div> 1.10 cvs 7595: 1.18 cvs 7596: <div class="subsection"> 1.37 cvs 7597: <h3><a name="sectc5222" id="sectc5222">Rule application order</a></h3> 1.1 cvs 7598: 1.30 cvs 7599: <p>The translator translates the elements which comprise the document in the 1.37 cvs 7600: order induced by the tree structure, except when the <tt>Get</tt> rule is 7601: used to change the order of translation. For each element, the translator 7602: first applies the rules specified for the element's type that must be applied 7603: before translation of the element's content (rules ending with the 7604: <tt>Before</tt> keyword or which have no position keyword). If several rules 7605: meet these criteria, the translator applies them in the order in where they 7606: appear in the translation schema.</p> 7607: 7608: <p>It then applies all <a href="#sectc5223">rules for the attributes</a> 7609: which the element has and which must be applied before the translation of the 7610: element's content (rules ending with the <tt>Before</tt> keyword or which 7611: have no position keyword). For one attribute value, the translator applies 7612: the rules in the order in which they are defined in the translation 7613: schema.</p> 1.30 cvs 7614: 7615: <p>The same procedure is followed with translation rules for specific 1.18 cvs 7616: presentations.</p> 1.30 cvs 7617: 1.31 cvs 7618: <p>Next, the element's content is translated, as long as a <tt>Remove</tt> or 7619: <code>Ignore</code> rule does not apply.</p> 1.30 cvs 7620: 7621: <p>In the next step, the translator applies rules for the specific 7622: presentation of the element that are to be applied after translation of the 1.37 cvs 7623: content (rules which end with the <tt>After</tt> keyword). The rules for each 1.30 cvs 7624: type of presentation rule or each value are applied in the order in which the 1.18 cvs 7625: translation appear in the schema.</p> 1.30 cvs 7626: 7627: <p>Then, the same procedure is followed for translation rules for attributes 7628: of the element.</p> 7629: 1.37 cvs 7630: <p>Finally, the translator applies rules for the element which must be 7631: applied after translation of the element's content. These rules are applied 7632: in the order that they appear in the translation schema. When the translation 7633: of an element is done, the translator procedes to translate the following 1.18 cvs 7634: element.</p> 1.30 cvs 7635: 7636: <p>This order can be changed with the <tt>Attributes</tt> and 1.18 cvs 7637: <tt>Presentation</tt> options of the <a href="#sectc5210"><tt>Create</tt> 7638: rule</a>.</p> 7639: </div> 1.1 cvs 7640: 1.18 cvs 7641: <div class="subsection"> 1.37 cvs 7642: <h3><a name="sectc5223" id="sectc5223">Translation of logical 7643: attributes</a></h3> 1.1 cvs 7644: 1.37 cvs 7645: <p>After the rules for the element types, the translation schema defines 7646: rules for attribute values. This section begins with the <tt>ATTRIBUTES</tt> 1.1 cvs 7647: keyword and is composed of a sequence of rule blocks each preceded by an 1.18 cvs 7648: attribute name and an optional value or value range.</p> 1.30 cvs 7649: 7650: <p>If the attribute's name appears alone before the rule block, the rule are 1.1 cvs 7651: applied to all element which have the attribute, no matter what value the 1.37 cvs 7652: attribute has. In this case, the attribute name is followed by a colon before 1.18 cvs 7653: the beginning of the rule block.</p> 1.30 cvs 7654: 1.37 cvs 7655: <p>The attribute's name can be followed by the name of an element type 7656: between parentheses. This says, as in presentation schemas, that the rule 7657: block which follows applies not to the element which has the attribute, but 7658: to its descendants of the type indicated between the parentheses.</p> 1.30 cvs 7659: 7660: <p>If values are given after the attribute name (or after the name of the 1.37 cvs 7661: element type), the rules are applied only when the attribute has the 7662: indicated values. The same attribute can appear several times, with different 7663: values and different translation rules. Attribute values are indicated in the 7664: same way as in <a href="#sectc528">conditions</a> and are followed by a colon 7665: before the block of rules.</p> 1.30 cvs 7666: 7667: <p>The rule block associated with an attribute is either a simple rule or a 1.18 cvs 7668: sequence of rules delimited by the <tt>BEGIN</tt> and <tt>END</tt> keywords. 7669: Note that rules associated with attribute values cannot be conditional.</p> 1.30 cvs 7670: 7671: <p>Translation rules are not required for all attributes (or their values) 1.37 cvs 7672: defined in a structure schema. Only those attributes for which a particular 7673: action must be performed by the translator must have such rules. The rules 1.18 cvs 7674: that can be used are those described above, from <a 7675: href="#sectc5210"><tt>Create</tt></a> to <a 7676: href="#sectc5218"><tt>NoTranslation</tt></a>.</p> 1.30 cvs 7677: <pre> AttrSeq = TransAttr < TransAttr > . 1.1 cvs 7678: TransAttr = AttrID [ '(' ElemID ')' ] 7679: [ RelatAttr ] ':' RuleSeq . 7680: AttrID = NAME . 1.18 cvs 7681: ElemID = NAME .</pre> 1.30 cvs 7682: 1.18 cvs 7683: <blockquote class="example"> 1.30 cvs 7684: <p><strong>Example:</strong></p> 7685: 7686: <p>The structure defined the ``Language'' attribute which can take the 1.37 cvs 7687: values ``French'' and ``English''. To have the French parts of the original 1.30 cvs 7688: document removed and prevent the translation of the leaves of the English 7689: parts, the following rules would be used:</p> 7690: <pre>ATTRIBUTES 1.1 cvs 7691: Language=French : 7692: Remove; 7693: Language=English : 1.18 cvs 7694: NoTranslation;</pre> 7695: </blockquote> 7696: </div> 1.1 cvs 7697: 1.18 cvs 7698: <div class="subsection"> 1.37 cvs 7699: <h3><a name="sectc5224" id="sectc5224">Translation of specific 7700: presentations</a></h3> 1.1 cvs 7701: 1.30 cvs 7702: <p>After the rules for attributes, the translation schema defines rules for 1.37 cvs 7703: the specific presentation. This section begins with the <tt>PRESENTATION</tt> 7704: keyword and is composed of a sequence of translation rule blocks each 7705: preceded by a presentation rule name, optionally accompanied by a part which 7706: depends on the particular presentation rule.</p> 1.30 cvs 7707: 7708: <p>Each of these translation rule blocks is applied when the translator 7709: operates on an element which has a specific presentation rule of the type 1.37 cvs 7710: indicated at the head of the block. Depending on the type of the specific 1.30 cvs 7711: presentation rule, it is possible to specify values of the presentation rule 7712: for which the translation rule block should be applied.</p> 7713: 7714: <p>There are three categories of the presentation rules:</p> 7715: <ul> 7716: <li>rules taking numeric values: <tt>Size</tt>, <tt>Indent</tt>, 7717: <tt>LineSpacing</tt>, <tt>LineWeight</tt>,</li> 7718: <li>rules whose values are taken from a predefined list (i.e. whose type is 1.43 quint 7719: an enumeration): <tt>Adjust</tt>, <tt>Hyphenate,Direction, UnicodeBidi, 1.40 quint 7720: <tt>Style</tt>, <tt>Weight</tt>, <tt>Font</tt>, <tt>UnderLine</tt>, 7721: <tt>Thickness</tt>, <tt>LineStyle</tt>,</tt></li> 1.30 cvs 7722: <li>rules whose value is a name: <tt>FillPattern</tt>, <tt>Background</tt>, 7723: <tt>Foreground</tt>.</li> 1.18 cvs 7724: </ul> 1.30 cvs 7725: 7726: <p>For presentation rules of the first category, the values which provoke 1.1 cvs 7727: application of the translation rules are indicated in the same manner as for 1.37 cvs 7728: <a href="#relattr">numeric attributes</a>. This can be either a unique value 7729: or range of values. For a unique value, the value (an integer) is simply 7730: preceded by an equals sign. Value ranges can be specified in one of three 1.18 cvs 7731: ways:</p> 7732: <ul> 1.30 cvs 7733: <li>all values less than a given value (this value is preceded by a ``less 7734: than'' sign '<tt><</tt>'),</li> 7735: <li>all values greater than a given value (this value is preceded by a` 7736: `greater than'' sign '<tt>></tt>'),</li> 1.37 cvs 7737: <li>all values falling in an interval, bounds included. The range of values 1.30 cvs 7738: is then specified <tt>IN [</tt>Minimum<tt>..</tt>Maximum<tt>]</tt>, where 7739: Minimum and Maximum are integers.</li> 1.18 cvs 7740: </ul> 1.30 cvs 7741: 7742: <p>All numeric values can be negative, in which case the integer is preceded 1.37 cvs 7743: by a minus sign. All values must be given in typographers points.</p> 1.30 cvs 7744: 7745: <p>For presentation rules whose values are taken from a predefined list, the 1.1 cvs 7746: value which provokes application of the translation rules is simply indicated 1.18 cvs 7747: by the equals sign followed by the name of the value.</p> 1.30 cvs 7748: 1.37 cvs 7749: <p>For presentation rules whose values are names, the value which provokes 7750: the application of translation rules is simply indicated by the equals sign 7751: followed by the name of the value. The names of the fill patterns (the 1.18 cvs 7752: <tt>FillPattern</tt> rule) and of the colors (the <tt>Foreground</tt> and 7753: <tt>Background</tt> rules) used in Thot are the same as in the P language.</p> 1.30 cvs 7754: <pre> PresSeq = PresTrans < PresTrans > . 1.1 cvs 7755: PresTrans = PresRule ':' RuleSeq . 7756: PresRule = 'Size' [ PresRelation ] / 7757: 'Indent' [ PresRelation ] / 7758: 'LineSpacing' [ PresRelation ] / 7759: 'Adjust' [ '=' AdjustVal ] / 7760: 'Hyphenate' [ '=' BoolVal ] / 7761: 'Style' [ '=' StyleVal ] / 1.24 cvs 7762: 'Weight' [ '=' WeightVal ] / 1.1 cvs 7763: 'Font' [ '=' FontVal ] / 7764: 'UnderLine' [ '=' UnderLineVal ] / 7765: 'Thickness' [ '=' ThicknessVal ] / 7766: 'LineStyle' [ '=' LineStyleVal ] / 7767: 'LineWeight' [ PresRelation ] / 7768: 'FillPattern' [ '=' Pattern ] / 7769: 'Background' [ '=' Color ] / 7770: 'Foreground' [ '=' Color ] . 7771: 7772: PresRelation = '=' PresValue / 1.30 cvs 7773: '>' [ '-' ] PresMinimum / 1.1 cvs 7774: '<' [ '-' ] PresMaximum / 7775: 'IN' '[' [ '-' ] PresIntervalMin '..' 7776: [ '-' ] PresIntervalMax ']' . 1.35 cvs 7777: AdjustVal = 'Left' / 'Right' / 'VMiddle' / 'Justify' / 1.1 cvs 7778: 'LeftWithDots' . 7779: BoolVal = 'Yes' / 'No' . 1.24 cvs 7780: StyleVal = 'Roman' / 'Italics' / 'Oblique' . 7781: WeightVal = 'Normal' / 'Bold' . 1.1 cvs 7782: FontVal = 'Times' / 'Helvetica' / 'Courier' . 7783: UnderLineVal = 'NoUnderline' / 'UnderLined' / 7784: 'OverLined' / 'CrossedOut' . 7785: ThicknessVal = 'Thick' / 'Thin' . 1.6 cvs 7786: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' . 1.1 cvs 7787: Pattern = NAME . 7788: Color = NAME . 7789: PresMinimum = NUMBER . 7790: PresMaximum = NUMBER . 7791: PresIntervalMin= NUMBER . 7792: PresIntervalMax= NUMBER . 7793: PresValue = [ '-' ] PresVal . 1.18 cvs 7794: PresVal = NUMBER .</pre> 1.30 cvs 7795: 1.37 cvs 7796: <p>The <a name="prestransl" id="prestransl">translation rules associated with 7797: specific presentation rules</a> can use the value of the specific 7798: presentation rule that causes them to be applied. This behavior is designated 7799: by the keyword <tt>Value</tt>. For numerically-valued presentation rules, the 7800: numeric value is produced. For other presentation rules, the name of the 7801: value is produced.</p> 1.30 cvs 7802: 7803: <p>It should be noted that modifications to the layout of the document's 7804: elements that are made using the combination of the control key and a mouse 7805: button will have no effect on the translation of the document.</p> 7806: 7807: <blockquote class="example"> 7808: <p><strong>Example:</strong></p> 7809: 7810: <p>Suppose that it is desirable to use the same font sizes as in the 7811: specific presentation, but the font size must be between 10 and 18 7812: typographer's points. If font size is set in the translated document by the 7813: string <tt>pointsize=n</tt> where <tt>n</tt> is the font size in 7814: typographer's points then the following rules will suffice:</p> 7815: <pre>PRESENTATION 1.1 cvs 7816: Size < 10 : 7817: Create 'pointsize=10'; 7818: Size in [10..18] : 7819: BEGIN 7820: Create 'pointsize='; 7821: Create Value; 7822: END; 1.30 cvs 7823: Size > 18 : 1.18 cvs 7824: Create 'pointsize=18';</pre> 7825: </blockquote> 7826: </div> 1.1 cvs 7827: 1.18 cvs 7828: <div class="subsection"> 1.37 cvs 7829: <h3><a name="sectc5225" id="sectc5225">Recoding of characters, symbols and 7830: graphics</a></h3> 1.1 cvs 7831: 1.37 cvs 7832: <p>The coding of characters, graphical elements and symbols as defined in 7833: Thot does not necessarily correspond to what is required by an application to 7834: which a Thot document must be exported. Because of this the translator can 7835: recode these terminal elements of the documents structure. The last sections 7836: of a translation schema are intended for this purpose, each specifying the 7837: recoding rules for one type of terminal element.</p> 1.30 cvs 7838: 1.43 quint 7839: <p>The recoding rules for character strings are grouped by scripts. There is 7840: a group of rules for each script of the Thot document that must be 1.30 cvs 7841: translated. Each such group of rules begins with the <tt>TEXTTRANSLATE</tt> 1.41 vatton 7842: keyword, followed by the specification of the script to translate and the 1.30 cvs 7843: recoding rules, between the <tt>BEGIN</tt> and <tt>END</tt> keywords unless 1.41 vatton 7844: there is only one recoding rule for the script. The specification of the 1.43 quint 7845: script is not required: by default it is assumed to the Latin script (the ISO 7846: Latin-1 character set).</p> 1.30 cvs 7847: 7848: <p>Each recoding rule is formed by a source string between apostrophes and a 1.1 cvs 7849: target string, also between apostrophes, the two strings being separated by 1.30 cvs 7850: the arrow symbol (<tt>-></tt>), formed by the ``minus'' and ``greater 1.37 cvs 7851: than'' characters. The rule is terminated by a semi-colon.</p> 1.41 vatton 7852: <pre> TextTransSeq = [ Script ] TransSeq . 7853: Script = NAME . 1.30 cvs 7854: TransSeq ='BEGIN' < Translation > 'END' ';' / 1.1 cvs 7855: Translation . 1.30 cvs 7856: Translation = Source [ '->' Target ] ';' . 1.1 cvs 7857: Source = STRING . 1.18 cvs 7858: Target = STRING .</pre> 1.30 cvs 7859: 7860: <p>One such rule signifies that when the source string appears in a text leaf 7861: of the document being translated, the translator must replace it, in the 1.37 cvs 7862: translated document, with the target string. The source string and the target 7863: string can have different lengths and the target string can be empty. In this 1.1 cvs 7864: last case, the translator simply suppresses every occurrence of the source 1.18 cvs 7865: string in the translated document.</p> 1.30 cvs 7866: 1.41 vatton 7867: <p>For a given script, the order of the rules is not important and has no 1.1 cvs 7868: significance because the T language compiler reorders the rules in ways that 1.37 cvs 7869: speed up the translator's work. The total number of recoding rules is limited 1.18 cvs 7870: by the compiler as is the maximum length of the source and target strings.</p> 1.30 cvs 7871: 7872: <p>The recoding rules for symbols and graphical elements are written in the 1.37 cvs 7873: same manner as the recoding rules for character strings. They are preceded, 7874: respectively, by the <tt>SYMBTRANSLATE</tt> and <tt>GRAPHTRANSLATE</tt> and 1.43 quint 7875: so not require a specification of the script. Their source string is limited 7876: to one character, since, in Thot, each symbol and each graphical element is 7877: represented by a single character. The symbol and graphical element codes are 7878: defined along with the <a href="#sect7">non-standard character codes</a>.</p> 1.30 cvs 7879: 1.18 cvs 7880: <blockquote class="example"> 1.30 cvs 7881: <p><strong>Example:</strong></p> 7882: 7883: <p>In a translation schema producing documents destined for use with the 7884: L<sup>A</sup>T<sub><big>E</big></sub>X formatter, the Latin characters``é'' 1.37 cvs 7885: (octal code 351 in Thot) and ``č'' (octal code 350 in Thot) must be 1.30 cvs 7886: converted to their representation in 7887: L<sup>A</sup>T<sub><big>E</big></sub>X:</p> 7888: <pre>TEXTTRANSLATE Latin 1.1 cvs 7889: BEGIN 1.30 cvs 7890: '\350' -> '\`{e}'; { e grave } 7891: '\351' -> '\''{e}'; { e acute } 1.18 cvs 7892: END;</pre> 7893: </blockquote> 7894: </div> 7895: </div> 1.37 cvs 7896: <hr /> 1.18 cvs 7897: </div> 1.1 cvs 7898: 1.18 cvs 7899: <div class="chapter"> 1.37 cvs 7900: <h1><a name="sect6" id="sect6">Language grammars</a></h1> 1.1 cvs 7901: 1.30 cvs 7902: <p>This chapter gives the complete grammars of the languages of Thot. The 1.1 cvs 7903: grammars were presented and described in the preceding chapters, which also 1.37 cvs 7904: specify the semantics of the languages. This section gives only the 1.18 cvs 7905: syntax.</p> 1.1 cvs 7906: 1.18 cvs 7907: <div class="section"> 1.37 cvs 7908: <h2><a name="sectb61" id="sectb61">The M meta-language</a></h2> 1.1 cvs 7909: 1.30 cvs 7910: <p>The language grammars are all expressed in the same formalism, the M 1.18 cvs 7911: meta-language, which is defined in this section.</p> 7912: <pre>{ Any text between braces is a comment. } 1.30 cvs 7913: Grammar = Rule < Rule > 'END' . 7914: { The < and > signs indicate zero } 1.1 cvs 7915: { or more repetitions. } 7916: { END marks the end of the grammar. } 7917: Rule = Ident '=' RightPart '.' . 7918: { The period indicates the end of a rule } 7919: RightPart = RtTerminal / RtIntermed . 7920: { The slash indicates a choice } 7921: RtTerminal ='NAME' / 'STRING' / 'NUMBER' . 7922: { Right part of a terminal rule } 1.30 cvs 7923: RtIntermed = Possibility < '/' Possibility > . 1.1 cvs 7924: { Right part of an intermediate rule } 1.30 cvs 7925: Possibility = ElemOpt < ElemOpt > . 7926: ElemOpt = Element / '[' Element < Element > ']' / 7927: '<' Element < Element > '>' . 1.1 cvs 7928: { Brackets delimit optional parts } 7929: Element = Ident / KeyWord . 7930: Ident = NAME . 7931: { Identifier, sequence of characters 7932: KeyWord = STRING . 7933: { Character string delimited by apostrophes } 1.18 cvs 7934: END</pre> 7935: </div> 1.1 cvs 7936: 1.18 cvs 7937: <div class="section"> 1.37 cvs 7938: <h2><a name="sectb62" id="sectb62">The S language</a></h2> 1.1 cvs 7939: 1.30 cvs 7940: <p>The S language is used to write structure schemas, which contain the 1.37 cvs 7941: generic logical structures of document and object classes. It is described 1.30 cvs 7942: here in the M meta-language.</p> 1.18 cvs 7943: <pre>StructSchema = 'STRUCTURE' [ 'EXTENSION' ] ElemID ';' 1.1 cvs 7944: 'DEFPRES' PresID ';' 7945: [ 'ATTR' AttrSeq ] 7946: [ 'STRUCT' RulesSeq ] 7947: [ 'EXTENS' ExtensRuleSeq ] 7948: [ 'UNITS' RulesSeq ] 7949: [ 'EXPORT' SkeletonSeq ] 7950: [ 'EXCEPT' ExceptSeq ] 7951: 'END' . 7952: 7953: ElemID = NAME . 7954: PresID = NAME . 7955: 1.30 cvs 7956: AttrSeq = Attribute < Attribute > . 1.1 cvs 7957: Attribute = AttrID '=' AttrType ';' . 7958: AttrType = 'INTEGER' / 'TEXT' / 7959: 'REFERENCE' '(' RefType ')' / 7960: ValueSeq . 7961: RefType = 'ANY' / 7962: [ FirstSec ] ElemID [ ExtStruct ] . 1.30 cvs 7963: ValueSeq = AttrVal < ',' AttrVal > . 1.1 cvs 7964: AttrID = NAME . 7965: FirstSec = 'First' / 'Second' . 7966: ExtStruct = '(' ElemID ')' . 7967: AttrVal = NAME . 7968: 1.30 cvs 7969: RulesSeq = Rule < Rule > . 1.1 cvs 7970: Rule = ElemID [ LocAttrSeq ] '=' 7971: DefWithAttr ';' . 7972: LocAttrSeq = '(' 'ATTR' LocalAttr 1.30 cvs 7973: < ';' LocalAttr > ')' . 1.1 cvs 7974: LocalAttr = [ '!' ] AttrID [ '=' AttrType ] . 7975: DefWithAttr = Definition 7976: [ '+' '(' ExtensionSeq ')' ] 7977: [ '-' '(' RestrictSeq ')' ] 7978: [ 'WITH' FixedAttrSeq ] . 1.30 cvs 7979: ExtensionSeq = ExtensionElem < ',' ExtensionElem > . 1.1 cvs 7980: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' / 7981: 'SYMBOL' / 'PICTURE' . 1.30 cvs 7982: RestrictSeq = RestrictElem < ',' RestrictElem > . 1.1 cvs 7983: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' / 7984: 'SYMBOL' / 'PICTURE' . 1.30 cvs 7985: FixedAttrSeq = FixedAttr < ',' FixedAttr > . 1.1 cvs 7986: FixedAttr = AttrID [ FixedOrModifVal ] . 7987: FixedOrModifVal= [ '?' ] '=' FixedValue . 7988: FixedValue = [ '-' ] NumValue / TextValue / AttrVal . 7989: NumValue = NUMBER . 7990: TextValue = STRING . 7991: 7992: Definition = BaseType [ LocAttrSeq ] / Constr / 7993: Element . 7994: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 7995: 'PICTURE' / 'UNIT' / 'NATURE' . 7996: Element = ElemID [ ExtOrDef ] . 7997: ExtOrDef = 'EXTERN' / 'INCLUDED' / 7998: [ LocAttrSeq ] '=' Definition . 7999: 8000: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF' 8001: '(' DefWithAttr ')' / 8002: 'BEGIN' DefOptSeq 'END' / 8003: 'AGGREGATE' DefOptSeq 'END' / 8004: 'CASE' 'OF' DefSeq 'END' / 8005: 'REFERENCE' '(' RefType ')' / 8006: 'PAIR' . 8007: 8008: min = Integer / '*' . 8009: max = Integer / '*' . 8010: Integer = NUMBER . 8011: 1.30 cvs 8012: DefOptSeq = DefOpt ';' < DefOpt ';' > . 1.1 cvs 8013: DefOpt = [ '?' ] DefWithAttr . 8014: 1.30 cvs 8015: DefSeq = DefWithAttr ';' < DefWithAttr ';' > . 1.1 cvs 8016: 1.30 cvs 8017: SkeletonSeq = SkeletonElem < ',' SkeletonElem > ';' . 1.1 cvs 8018: SkeletonElem = ElemID [ 'WITH' Contents ] . 8019: Contents = 'Nothing' / ElemID [ ExtStruct ] . 8020: 1.30 cvs 8021: ExceptSeq = Except ';' < Except ';' > . 1.1 cvs 8022: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr ':' 8023: ExcValSeq . 8024: ExcTypeOrAttr = ElemID / AttrID . 1.30 cvs 8025: ExcValSeq = ExcValue < ',' ExcValue > . 1.51 quint 8026: ExcValue = 'NoCut' / 'NoCreate' / 'NoReplicate' / 1.1 cvs 8027: 'NoHMove' / 'NoVMove' / 'NoMove' / 8028: 'NoHResize' / 'NoVResize' / 'NoResize' / 1.18 cvs 8029: 'MoveResize' / 1.51 quint 8030: 'NewWidth' / 'NewHeight' / 'NewPercentWidth' / 1.1 cvs 8031: 'NewHPos' / 'NewVPos' / 1.51 quint 8032: 'Invisible' / 'Hidden' / 8033: 'PageBreak' / 'PageBreakAllowed' / 'PageBreakPlace' / 8034: 'PageBreakRepetition' / 'PageBreakRepBefore' / 8035: 'NoPaginate' / 'NoSpellCheck' / 8036: 'ActiveRef' / 'NoSelect' / 1.9 cvs 8037: 'HighlightChildren' / 'ExtendedSelection' / 1.36 cvs 8038: 'SelectParent' / 'ClickableSurface' / 1.52 quint 8039: 'ParagraphBreak' / 'IsBreak' / 1.51 quint 8040: 'ReturnCreateNL' / 'ReturnCreateWithin' / 'NoBreakByReturn' / 8041: 'ImportLine' / 'ImportParagraph' / 8042: 'GraphCreation' / 'IsDraw' / 'IsGroup' / 'EmptyGraphic' / 8043: 'IsTable' / 'IsRow' / 'IsColHead' / 'IsCell' / 8044: 'ColRef' / 'ColSpan' / 'RowSpan' / 8045: 'CssBackground' / 'CssClass' / 'CssId' / 'CssPseudoClass' / 8046: 'NoShowBox' / 'SetWindowBackground' / 8047: 'Shadow' / 'EventAttr' / 'SpacePreserve' / 1.54 quint 8048: 'IsPlaceholder' / 'StartCounter' / 'SetCounter' / 1.51 quint 8049: ExceptNum . 8050: ExceptNum = NUMBER . 1.1 cvs 8051: 1.30 cvs 8052: ExtensRuleSeq = ExtensRule ';' < ExtensRule ';' > . 1.1 cvs 8053: ExtensRule = RootOrElem [ LocAttrSeq ] 8054: [ '+' '(' ExtensionSeq ')' ] 8055: [ '-' '(' RestrictSeq ')' ] 8056: [ 'WITH' FixedAttrSeq ] . 8057: RootOrElem = 'Root' / ElemID . 8058: 1.18 cvs 8059: END</pre> 8060: </div> 1.1 cvs 8061: 1.18 cvs 8062: <div class="section"> 1.37 cvs 8063: <h2><a name="sectb63" id="sectb63">The P language</a></h2> 1.1 cvs 8064: 1.30 cvs 8065: <p>The P language is used to write presentation schemas, which define the 1.1 cvs 8066: graphical presentation rules to be applied to different classes of documents 1.37 cvs 8067: and objects. It is described here in the M meta-language.</p> 1.18 cvs 8068: <pre>PresSchema = 'PRESENTATION' ElemID ';' 1.1 cvs 8069: [ 'VIEWS' ViewSeq ] 8070: [ 'PRINT' PrintViewSeq ] 8071: [ 'COUNTERS' CounterSeq ] 8072: [ 'CONST' ConstSeq ] 8073: [ 'VAR' VarSeq ] 8074: [ 'DEFAULT' ViewRuleSeq ] 8075: [ 'BOXES' BoxSeq ] 8076: [ 'RULES' PresentSeq ] 8077: [ 'ATTRIBUTES' PresAttrSeq ] 8078: [ 'TRANSMIT' TransmitSeq ] 8079: 'END' . 8080: 8081: ElemID = NAME . 8082: 8083: ViewSeq = ViewDeclaration 1.30 cvs 8084: < ',' ViewDeclaration > ';' . 1.1 cvs 8085: ViewDeclaration = ViewID [ 'EXPORT' ] . 8086: ViewID = NAME . 8087: 1.30 cvs 8088: PrintViewSeq = PrintView < ',' PrintView > ';' . 1.37 cvs 8089: PrintView = ViewID . 1.1 cvs 8090: 1.30 cvs 8091: CounterSeq = Counter < Counter > . 1.1 cvs 8092: Counter = CounterID ':' CounterFunc ';' . 8093: CounterID = NAME . 8094: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ] 8095: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] / 1.30 cvs 8096: SetFunction < SetFunction > 8097: AddFunction < AddFunction > 1.1 cvs 8098: [ 'INIT' AttrID ] / 1.16 cvs 8099: 'RLEVEL' 'OF' ElemID . 1.1 cvs 8100: SLevelAsc = [ '-' ] LevelAsc . 8101: LevelAsc = NUMBER . 8102: SetFunction = 'SET' CounterValue 'ON' TypeOrPage . 8103: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . 8104: TypeOrPage = 'Page' [ '(' ViewID ')' ] / 1.16 cvs 8105: [ '*' ] ElemID . 1.1 cvs 8106: CounterValue = NUMBER . 8107: 1.30 cvs 8108: ConstSeq = Const < Const > . 1.1 cvs 8109: Const = ConstID '=' ConstType ConstValue ';' . 8110: ConstID = NAME . 1.41 vatton 8111: ConstType = 'Text' [ Script ] / 'Symbol' / 1.1 cvs 8112: 'Graphics' / 'Picture' . 8113: ConstValue = STRING . 1.41 vatton 8114: Script = NAME . 1.1 cvs 8115: 1.30 cvs 8116: VarSeq = Variable < Variable > . 1.1 cvs 8117: Variable = VarID ':' FunctionSeq ';' . 8118: VarID = NAME . 1.30 cvs 8119: FunctionSeq = Function < Function > . 1.1 cvs 8120: Function = 'DATE' / 'FDATE' / 8121: 'DocName' / 'DirName' / 1.38 cvs 8122: 'ElemName' / 'AttributeName' / 'AttributeValue' / 1.1 cvs 8123: ConstID / ConstType ConstValue / 8124: AttrID / 8125: 'VALUE' '(' PageAttrCtr ',' 8126: CounterStyle ')' . 8127: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] / 8128: [ MinMax ] CounterID / AttrID . 1.54 quint 8129: CounterStyle = 'Arabic' / 'Decimal' / 'DecimalLeadingZero' / 8130: 'URoman' / 'UpperRoman' / 'LRoman' / 'LowerRoman' / 8131: 'Uppercase' / 'UpperLatin' / 'Lowercase' / 'LowerLatin' / 8132: 'LowerGreek' / 'UpperGreek' . 1.1 cvs 8133: MinMax = 'MaxRangeVal' / 'MinRangeVal' . 8134: 1.30 cvs 8135: BoxSeq = Box < Box > . 1.1 cvs 8136: Box = 'FORWARD' BoxID ';' / 8137: BoxID ':' ViewRuleSeq . 8138: BoxID = NAME . 8139: 1.30 cvs 8140: PresentSeq = Present < Present > . 1.1 cvs 8141: Present = [ '*' ] [ FirstSec ] ElemID ':' 8142: ViewRuleSeq . 8143: FirstSec = 'First' / 'Second' . 8144: 1.30 cvs 8145: PresAttrSeq = PresAttr < PresAttr > . 1.50 quint 8146: PresAttr = AttrID [ '(' [ FirstSec ] ElemID [ '*' ] ')' ] 1.1 cvs 8147: [ AttrRelation ] ':' ViewRuleSeq . 8148: AttrID = NAME . 8149: AttrRelation = '=' AttrVal / 1.30 cvs 8150: '>' [ '-' ] MinValue / 1.1 cvs 8151: '<' [ '-' ] MaxValue / 8152: 'IN' '[' [ '-' ] LowerBound '..' 8153: [ '-' ] UpperBound ']' / 8154: 'GREATER' AttrID / 8155: 'EQUAL' AttrID / 8156: 'LESS' AttrID . 8157: AttrVal = [ '-' ] EqualNum / EqualText / AttrValue . 8158: MinValue = NUMBER . 8159: MaxValue = NUMBER . 8160: LowerBound = NUMBER . 8161: UpperBound = NUMBER. 8162: EqualNum = NUMBER . 8163: EqualText = STRING . 8164: AttrValue = NAME . 8165: 1.30 cvs 8166: ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules > 1.1 cvs 8167: 'END' ';' / 8168: ViewRules / CondRules / Rule . 8169: RulesAndCond = CondRules / Rule . 8170: ViewRules = 'IN' ViewID CondRuleSeq . 1.30 cvs 8171: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' / 1.1 cvs 8172: CondRules / Rule . 1.30 cvs 8173: CondRules = CondRule < CondRule > 1.1 cvs 8174: [ 'Otherwise' RuleSeq ] . 8175: CondRule = 'IF' ConditionSeq RuleSeq . 1.30 cvs 8176: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / Rule . 1.1 cvs 8177: 1.30 cvs 8178: ConditionSeq = Condition < 'AND' Condition > . 1.6 cvs 8179: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem . 8180: ConditionElem = 'First' / 'Last' / 8181: [ 'Immediately' ] 'Within' [ NumParent ] 8182: ElemID [ ExtStruct ] / 8183: ElemID / 8184: 'Referred' / 'FirstRef' / 'LastRef' / 8185: 'ExternalRef' / 'InternalRef' / 'CopyRef' / 1.44 quint 8186: [ 'Inherited' ] AttrID [ '=' Value ] / 1.6 cvs 8187: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' / 8188: 'UserPage' / 'StartPage' / 'ComputedPage' / 1.33 cvs 8189: 'Empty' / 'Root' / 1.6 cvs 8190: '(' [ MinMax ] CounterName CounterCond ')' / 8191: CondPage '(' CounterID ')' . 8192: NumParent = [ GreaterLess ] NParent . 1.30 cvs 8193: GreaterLess = '>' / '<' . 1.6 cvs 8194: NParent = NUMBER. 1.30 cvs 8195: CounterCond = '<' MaxCtrVal / '>' MinCtrVal / 1.6 cvs 8196: '=' EqCtrVal / 8197: 'IN' '[' ['-'] MinCtrBound '..' 8198: ['-'] MaxCtrBound ']' . 8199: PageCond = 'Even' / 'Odd' / 'One' . 8200: MaxCtrVal = NUMBER . 8201: MinCtrVal = NUMBER . 8202: EqCtrVal = NUMBER . 8203: MaxCtrBound = NUMBER . 8204: MinCtrBound = NUMBER . 1.1 cvs 8205: 1.34 cvs 8206: Rule = Property ';' / PresFunc ';' . 8207: Property = 'VertRef' ':' HorizPosition / 1.1 cvs 8208: 'HorizRef' ':' VertPosition / 8209: 'VertPos' ':' VPos / 8210: 'HorizPos' ':' HPos / 1.49 quint 8211: 'Float' ':' FloatInherit / 8212: 'Clear' ':' ClearInherit / 1.1 cvs 8213: 'Height' ':' Extent / 8214: 'Width' ':' Extent / 8215: 'VertOverflow' ':' Boolean / 8216: 'HorizOverflow' ':' Boolean / 1.26 cvs 8217: 'MarginTop' ':' MarginWidth / 8218: 'MarginRight' ':' MarginWidth / 8219: 'MarginBottom' ':' MarginWidth / 8220: 'MarginLeft' ':' MarginWidth / 8221: 'PaddingTop' ':' PaddingWidth / 8222: 'PaddingRight' ':' PaddingWidth / 8223: 'PaddingBottom' ':' PaddingWidth / 8224: 'PaddingLeft' ':' PaddingWidth / 8225: 'BorderTopWidth' ':' BorderWidth / 8226: 'BorderRightWidth' ':' BorderWidth / 8227: 'BorderBottomWidth' ':' BorderWidth / 8228: 'BorderLeftWidth' ':' BorderWidth / 8229: 'BorderTopColor' ':' BorderColor / 8230: 'BorderRightColor' ':' BorderColor / 8231: 'BorderBottomColor' ':' BorderColor / 8232: 'BorderLeftColor' ':' BorderColor / 8233: 'BorderTopStyle' ':' BorderStyle / 8234: 'BorderRightStyle' ':' BorderStyle / 8235: 'BorderBottomStyle' ':' BorderStyle / 1.54 quint 8236: 'BorderLeftStyle' ':' BorderStyle / 8237: 'ListStyleType' ':' ListStyleType / 8238: 'ListStyleImage' ':' ListStyleImage / 8239: 'ListStylePosition' ':' ListStylePosition / 1.1 cvs 8240: 'LineSpacing' ':' DistOrInherit / 8241: 'Indent' ':' DistOrInherit / 8242: 'Adjust' ':' AlignOrInherit / 8243: 'Hyphenate' ':' BoolInherit / 1.40 quint 8244: 'Direction' ':' DirInherit / 1.43 quint 8245: 'UnicodeBidi' ':' BidiInherit / 1.1 cvs 8246: 'PageBreak' ':' Boolean / 8247: 'LineBreak' ':' Boolean / 8248: 'InLine' ':' Boolean / 8249: 'NoBreak1' ':' AbsDist / 8250: 'NoBreak2' ':' AbsDist / 8251: 'Gather' ':' Boolean / 8252: 'Visibility' ':' NumberInherit / 8253: 'Size' ':' SizeInherit / 8254: 'Font' ':' NameInherit / 8255: 'Style' ':' StyleInherit / 1.23 cvs 8256: 'Weight' ':' WeightInherit / 1.1 cvs 8257: 'Underline' ':' UnderLineInherit / 8258: 'Thickness' ':' ThicknessInherit / 8259: 'Depth' ':' NumberInherit / 8260: 'LineStyle' ':' LineStyleInherit / 8261: 'LineWeight' ':' DistOrInherit / 8262: 'FillPattern' ':' NameInherit / 1.30 cvs 8263: 'Background' ':' Color / 8264: 'Foreground' ':' Color / 1.47 quint 8265: 'Opacity' ':' OpacityInherit / 8266: 'FillOpacity' ':' OpacityInherit / 8267: 'StrokeOpacity' ':' OpacityInherit / 1.1 cvs 8268: 'Content' ':' VarConst . 8269: PresFunc = Creation '(' BoxID ')' / 8270: 'Line' / 8271: 'NoLine' / 1.54 quint 8272: 'Display' ':' DisplayVal / 1.1 cvs 8273: 'Page' '(' BoxID ')' / 1.13 cvs 8274: 'Copy' '(' BoxTypeToCopy ')' / 8275: 'ShowBox' / 1.18 cvs 8276: 'BackgroundPicture' ':' FileName / 8277: 'PictureMode' ':' PictMode . 1.1 cvs 8278: 1.54 quint 8279: DisplayVal = 'Inline' / 'Block' / 'ListItem' / 'RunIin' / 8280: 'InlineBlock' / 'None' / 'Enclosing' '=' . 1.1 cvs 8281: BoxTypeToCopy = BoxID [ ExtStruct ] / 8282: ElemID [ ExtStruct ] . 8283: ExtStruct = '(' ElemID ')' . 8284: 8285: Distance = [ Sign ] AbsDist . 8286: Sign = '+' / '-' . 8287: AbsDist = IntegerOrAttr [ '.' DecimalPart ] 8288: [ Unit ] . 8289: IntegerOrAttr = IntegerPart / AttrID . 8290: IntegerPart = NUMBER . 8291: DecimalPart = NUMBER . 8292: Unit = 'em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' / 8293: 'pc' / 'px' / '%' . 8294: 8295: HPos = 'nil' / VertAxis '=' HorizPosition 8296: [ 'UserSpecified' ] . 8297: VPos = 'nil' / HorizAxis '=' VertPosition 8298: [ 'UserSpecified' ] . 8299: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' . 8300: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' . 8301: 1.6 cvs 8302: VertPosition = Reference '.' HorizAxis [ Distance ] . 8303: HorizPosition = Reference '.' VertAxis [ Distance ] . 8304: Reference = 'Enclosing' [ BoxTypeNot ] / 8305: 'Enclosed' [ BoxTypeNot ] / 8306: 'Previous' [ BoxTypeNot ] / 8307: 'Next' [ BoxTypeNot ] / 8308: 'Referred' [ BoxTypeNot ] / 8309: 'Creator' / 8310: 'Root' / 8311: '*' / 8312: BoxOrType . 8313: BoxOrType = BoxID / 8314: [ '*' ] [ FirstSec ] ElemID / 1.17 cvs 8315: 'AnyElem' / 'AnyBox' / 8316: 'ElemWithAttr' AttrID . 1.6 cvs 8317: BoxTypeNot = [ 'NOT' ] BoxOrType . 1.49 quint 8318: 8319: FloatInherit = Link '=' / 'Left' / 'Right' / 'None' . 8320: ClearInherit = Link '=' / 'None' / 'Left' / 'Right' / 'Both' . 1.6 cvs 8321: 8322: Extent = Reference '.' HeightWidth 8323: [ Relation ] [ 'Min' ] / 8324: AbsDist [ 'UserSpecified' ] [ 'Min' ] / 8325: HPos / VPos . 8326: HeightWidth = 'Height' / 'Width' . 8327: Relation = '*' ExtentAttr '%' / Distance . 8328: ExtentAttr = ExtentVal / AttrID . 8329: ExtentVal = NUMBER . 1.26 cvs 8330: 8331: MarginWidth = InheritParent / 'Auto' / Distance . 8332: PaddingWidth = InheritParent / Distance . 8333: BorderWidth = InheritParent / 'Thin' / 'Medium' / 'Thick' / Distance . 8334: BorderColor = InheritParent / 'Transparent' / 'Foreground' / 8335: ColorName . 8336: BorderStyle = InheritParent / 8337: 'None' / 'Hidden' / 'Dotted' / 'Dashed' / 'Solid' / 8338: 'Double' / 'Groove' / 'Ridge' / 'Inset' / 'Outset' . 1.54 quint 8339: 8340: ListStyleType = 'Disc' / 'Circle' / 'Square' / 'Decimal' / 8341: 'DecimalLeadingZero' / 'LowerRoman' / 'UpperRoman' / 8342: 'LowerGreek' / 'LowerLatin' / 'UpperLatin' / 'None' / 8343: 'Enclosing' '=' . 8344: ListStyleImage = 'None' / 'Enclosing' '=' / ListStyleImageURI . 8345: ListStyleImageURI = STRING . 8346: ListStylePosition = 'Inside' / 'Outside' / 'Enclosing' '=' . 8347: 1.27 cvs 8348: InheritParent = 'Enclosing' '=' / 'Creator' '=' . 1.26 cvs 8349: ColorName = NAME . 1.6 cvs 8350: 8351: Inheritance = Kinship InheritedValue . 8352: Kinship = 'Enclosing' / 'GrandFather'/ 'Enclosed' / 8353: 'Previous' / 'Creator' . 8354: InheritedValue = '+' PosIntAttr [ 'Max' maximumA ] / 8355: '-' NegIntAttr [ 'Min' minimumA ] / 8356: '=' . 8357: PosIntAttr = PosInt / AttrID . 8358: PosInt = NUMBER . 8359: NegIntAttr = NegInt / AttrID . 8360: NegInt = NUMBER . 8361: maximumA = maximum / AttrID . 8362: maximum = NUMBER . 8363: minimumA = minimum / AttrID . 8364: minimum = NUMBER . 8365: 8366: AlignOrInherit = Kinship '=' / Alignment . 8367: Alignment = 'Left' / 'Right' / 'VMiddle' / 8368: 'LeftWithDots' . 1.1 cvs 8369: 1.40 quint 8370: DirInherit = 'ltr' / 'rtl' / Kinship '=' . 1.43 quint 8371: BidiInherit = 'Normal' / 'Embed' / 'Override' / Kinship '=' . 1.40 quint 8372: 1.6 cvs 8373: DistOrInherit = Kinship InheritedDist / Distance . 8374: InheritedDist = '=' / '+' AbsDist / '-' AbsDist . 1.1 cvs 8375: 1.6 cvs 8376: BoolInherit = Boolean / Kinship '=' . 8377: Boolean = 'Yes' / 'No' . 1.1 cvs 8378: 1.6 cvs 8379: NumberInherit = Integer / AttrID / Inheritance . 8380: Integer = NUMBER . 1.1 cvs 8381: 8382: LineStyleInherit= Kinship '=' / 'Solid' / 'Dashed' / 8383: 'Dotted' . 8384: 1.6 cvs 8385: SizeInherit = SizeAttr [ 'pt' ] / Kinship InheritedSize . 8386: InheritedSize = '+' SizeAttr [ 'pt' ] 8387: [ 'Max' MaxSizeAttr ] / 8388: '-' SizeAttr [ 'pt' ] 8389: [ 'Min' MinSizeAttr ] / 1.22 cvs 8390: '*' PercentSizeAttr '%' / 1.6 cvs 8391: '=' . 8392: SizeAttr = Size / AttrID . 8393: Size = NUMBER . 8394: MaxSizeAttr = MaxSize / AttrID . 8395: MaxSize = NUMBER . 8396: MinSizeAttr = MinSize / AttrID . 8397: MinSize = NUMBER . 1.22 cvs 8398: PercentSizeAttr = PercentSize / AttrID . 8399: PercentSize = NUMBER . 1.6 cvs 8400: 8401: NameInherit = Kinship '=' / FontName . 8402: FontName = NAME . 1.30 cvs 8403: Color = 'Transparent' / Kinship '=' / FontName . 1.47 quint 8404: OpacityInherit = OpPercent '%' / AttrID / Inheritance . 8405: OpPercent = NUMBER . 1.6 cvs 8406: StyleInherit = Kinship '=' / 1.23 cvs 8407: 'Roman' / 'Italics' / 'Oblique' . 8408: WeightInherit = Kinship '=' / 8409: 'Normal' / 'Bold' . 1.1 cvs 8410: UnderLineInherit= Kinship '=' / 1.6 cvs 8411: 'NoUnderline' / 'Underlined' / 8412: 'Overlined' / 'CrossedOut' . 1.1 cvs 8413: ThicknessInherit= Kinship '=' / 'Thick' / 'Thin' . 1.13 cvs 8414: 8415: FileName = STRING . 8416: PictMode = 'NormalSize' / 'Scale' / 8417: 'RepeatXY' / 'RepeatX' / 'RepeatY' . 1.1 cvs 8418: 1.6 cvs 8419: VarConst = ConstID / ConstType ConstValue / 8420: VarID / '(' FunctionSeq ')' / 8421: ElemID . 8422: 8423: Creation = Create [ 'Repeated' ] . 8424: Create = 'CreateFirst' / 'CreateLast' / 8425: 'CreateBefore' / 'CreateAfter' / 8426: 'CreateEnclosing' . 8427: 1.30 cvs 8428: TransmitSeq = Transmit < Transmit > . 1.6 cvs 8429: Transmit = TypeOrCounter 'To' ExternAttr 8430: '(' ElemID ')' ';' . 8431: TypeOrCounter = CounterID / ElemID . 8432: ExternAttr = NAME . 1.1 cvs 8433: 1.18 cvs 8434: END</pre> 8435: </div> 1.1 cvs 8436: 1.18 cvs 8437: <div class="section"> 1.37 cvs 8438: <h2><a name="sectb64" id="sectb64">The T language</a></h2> 1.18 cvs 8439: <pre>TransSchema = 'TRANSLATION' ElemID ';' 1.1 cvs 8440: [ 'LINELENGTH' LineLength ';' ] 8441: [ 'LINEEND' CHARACTER ';' ] 8442: [ 'LINEENDINSERT' STRING ';' ] 8443: [ 'BUFFERS' BufferSeq ] 8444: [ 'COUNTERS' CounterSeq ] 8445: [ 'CONST' ConstSeq ] 8446: [ 'VAR' VariableSeq ] 8447: 'RULES' ElemSeq 8448: [ 'ATTRIBUTES' AttrSeq ] 8449: [ 'PRESENTATION' PresSeq ] 1.30 cvs 8450: < 'TEXTTRANSLATE' TextTransSeq > 1.1 cvs 8451: [ 'SYMBTRANSLATE' TransSeq ] 8452: [ 'GRAPHTRANSLATE' TransSeq ] 8453: 'END' . 8454: 8455: LineLength = NUMBER . 8456: 1.30 cvs 8457: BufferSeq = Buffer < Buffer > . 1.46 quint 8458: Buffer = BufferID [ '(' BufferType ')' ] ';' . 1.1 cvs 8459: BufferID = NAME . 1.46 quint 8460: BufferType = 'Picture' / 'Variable' . 1.1 cvs 8461: 1.30 cvs 8462: CounterSeq = Counter < Counter > . 1.1 cvs 8463: Counter = CounterID [ ':' CounterFunc ] ';' . 8464: CounterID = NAME . 8465: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ] 8466: [ 'Init' AttrID ] / 8467: 'Rlevel' 'of' ElemID / 8468: 'Set' InitValue 'On' ElemID 8469: 'Add' Increment 'On' ElemID 8470: [ 'Init' AttrID ] . 8471: SLevelAsc = [ '-' ] LevelAsc . 8472: LevelAsc = NUMBER . 8473: InitValue = NUMBER . 8474: Increment = NUMBER . 8475: ElemID = NAME . 8476: AttrID = NAME . 8477: 1.30 cvs 8478: ConstSeq = Const < Const > . 1.1 cvs 8479: Const = ConstID '=' ConstValue ';' . 8480: ConstID = NAME . 8481: ConstValue = STRING . 8482: 1.30 cvs 8483: VariableSeq = Variable < Variable > . 8484: Variable = VarID ':' Function < Function > ';' . 1.1 cvs 8485: VarID = NAME . 8486: Function = 'Value' '(' CounterID [ ':' Length ] 8487: [ ',' CounterStyle ] ')' / 8488: 'FileDir' / 'FileName' / 'Extension' / 8489: 'DocumentName' / 'DocumentDir' / 8490: ConstID / CharString / 8491: BufferID / AttrID . 8492: Length = NUMBER . 8493: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' / 8494: 'Uppercase' / 'Lowercase' . 8495: CharString = STRING . 8496: 1.30 cvs 8497: ElemSeq = TransType < TransType > . 1.1 cvs 8498: TransType = [ FirstSec ] ElemID ':' RuleSeq . 8499: FirstSec = 'First' / 'Second' . 1.30 cvs 8500: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' . 1.1 cvs 8501: Rule = SimpleRule / ConditionBlock . 8502: ConditionBlock= 'IF' ConditionSeq SimpleRuleSeq . 1.30 cvs 8503: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' / 1.1 cvs 8504: SimpleRule . 8505: 8506: ConditionSeq = Condition [ 'AND' Condition ] . 8507: Condition = [ 'NOT' ] [ 'Target' ] Cond . 8508: Cond = CondElem / CondAscend . 8509: CondElem = 'FirstRef' / 'LastRef' / 8510: 'ExternalRef' / 1.41 vatton 8511: 'Script' '=' Script / 1.1 cvs 8512: 'ComputedPage' / 'StartPage' / 8513: 'UserPage' / 'ReminderPage' / 1.55 ! quint 8514: 'Empty' / 'Root' / 1.18 cvs 8515: ElemID / 1.1 cvs 8516: 'FirstAttr' / 'LastAttr' . 8517: CondAscend = [ Ascend ] CondOnAscend . 8518: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType . 8519: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] . 8520: CondRelLevel = NUMBER . 8521: CondOnAscend = 'First' / 'Last' / 8522: 'Referred' / 8523: [ 'Immediately' ] 'Within' [ NumParent ] 8524: ElemID [ ExtStruct ] / 8525: 'Attributes' / 8526: AttrID [ RelatAttr ] / 8527: 'Presentation' / 1.34 cvs 8528: PresRule . 1.1 cvs 8529: NumParent = [ GreaterLess ] NParent . 1.30 cvs 8530: GreaterLess = '>' / '<' . 1.1 cvs 8531: NParent = NUMBER. 1.41 vatton 8532: Script = NAME . 1.1 cvs 8533: RelatAttr = '=' Value / 1.30 cvs 8534: '>' [ '-' ] Minimum / 1.1 cvs 8535: '<' [ '-' ] Maximum / 8536: 'IN' '[' [ '-' ] MinInterval '..' 8537: [ '-' ] MaxInterval ']' . 8538: Value = [ '-' ] IntegerVal / TextVal / AttrValue . 8539: Minimum = NUMBER . 8540: Maximum = NUMBER . 8541: MinInterval = NUMBER . 8542: MaxInterval = NUMBER . 8543: IntegerVal = NUMBER . 8544: TextVal = STRING . 8545: AttrValue = NAME . 8546: 8547: SimpleRule = 'Create' [ 'IN' VarID ] Object 8548: [ Position ] ';' / 8549: 'Write' Object [ Position ] ';' / 8550: 'Read' BufferID [ Position ] ';' / 8551: 'Include' File [ Position ] ';' / 1.6 cvs 8552: 'Get' [ RelPosition ] ElemID 8553: [ ExtStruct ] 8554: [ Position ] ';' / 1.1 cvs 8555: 'Copy' [ RelPosition ] ElemID 8556: [ ExtStruct ] 8557: [ Position ] ';' / 8558: 'Use' TrSchema [ 'For' ElemID ] ';' / 8559: 'Remove' ';' / 1.31 cvs 8560: 'Ignore' ';' / 1.1 cvs 8561: 'NoTranslation' ';' / 8562: 'NoLineBreak' ';' / 8563: 'ChangeMainFile' VarID [ Position ] ';' / 1.14 cvs 8564: 'RemoveFile' VarID [ Position ] ';' / 1.10 cvs 8565: 'Set' CounterID InitValue [ Position ] ';' / 8566: 'Add' CounterID Increment [ Position ] ';' / 1.25 cvs 8567: 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' . 1.10 cvs 8568: 1.25 cvs 8569: Indent = 'Suspend' / 'Resume' / [ IndentSign ] IndentValue . 1.10 cvs 8570: IndentSign = '+' / '-' . 8571: IndentValue = NUMBER . 1.1 cvs 8572: 8573: Object = ConstID / CharString / 8574: BufferID / 8575: VarID / 1.30 cvs 8576: '(' Function < Function > ')' / 1.21 cvs 8577: [ 'Translated' ] AttrID / 1.1 cvs 8578: 'Value' / 8579: 'Content' / 8580: 'Attributes' / 8581: 'Presentation' / 8582: 'RefId' / 8583: 'PairId' / 8584: 'FileDir' / 'FileName' / 'Extension' / 8585: 'DocumentName' / 'DocumentDir' / 8586: [ 'Referred' ] ReferredObject . 8587: Position = 'After' / 'Before' . 8588: 1.6 cvs 8589: ReferredObject= VarID / 8590: ElemID [ ExtStruct ] / 8591: 'RefId' / 8592: 'DocumentName' / 'DocumentDir' . 1.1 cvs 8593: 1.6 cvs 8594: File = FileName / BufferID . 8595: FileName = STRING . 1.1 cvs 8596: 1.6 cvs 8597: RelPosition = 'Included' / 'Referred' . 8598: ExtStruct = '(' ElemID ')' . 1.1 cvs 8599: 1.6 cvs 8600: TrSchema = NAME . 8601: 1.30 cvs 8602: AttrSeq = TransAttr < TransAttr > . 1.6 cvs 8603: TransAttr = AttrID [ '(' ElemID ')' ] 8604: [ RelatAttr ] ':' RuleSeq . 8605: 1.30 cvs 8606: PresSeq = PresTrans < PresTrans > . 1.6 cvs 8607: PresTrans = PresRule ':' RuleSeq . 8608: PresRule = 'Size' [ PresRelation ] / 8609: 'Indent' [ PresRelation ] / 8610: 'LineSpacing' [ PresRelation ] / 8611: 'Adjust' [ '=' AdjustVal ] / 8612: 'Hyphenate' [ '=' BoolVal ] / 8613: 'Style' [ '=' StyleVal ] / 1.24 cvs 8614: 'Weight' [ '=' WeightVal ] / 1.6 cvs 8615: 'Font' [ '=' FontVal ] / 8616: 'UnderLine' [ '=' UnderLineVal ] / 8617: 'Thickness' [ '=' ThicknessVal ] / 8618: 'LineStyle' [ '=' LineStyleVal ] / 8619: 'LineWeight' [ PresRelation ] / 8620: 'FillPattern' [ '=' Pattern ] / 8621: 'Background' [ '=' Color ] / 8622: 'Foreground' [ '=' Color ] . 8623: 8624: PresRelation = '=' PresValue / 1.30 cvs 8625: '>' [ '-' ] PresMinimum / 1.6 cvs 8626: '<' [ '-' ] PresMaximum / 8627: 'IN' '[' [ '-' ] PresIntervalMin '..' 8628: [ '-' ] PresIntervalMax ']' . 1.35 cvs 8629: AdjustVal = 'Left' / 'Right' / 'VMiddle' / 'Justify' / 1.6 cvs 8630: 'LeftWithDots' . 8631: BoolVal = 'Yes' / 'No' . 1.24 cvs 8632: StyleVal = 'Roman' / 'Italics' / 'Oblique' . 8633: WeightVal = 'Normal' / 'Bold' . 1.6 cvs 8634: FontVal = 'Times' / 'Helvetica' / 'Courier' . 8635: UnderLineVal = 'NoUnderline' / 'UnderLined' / 8636: 'OverLined' / 'CrossedOut' . 8637: ThicknessVal = 'Thick' / 'Thin' . 8638: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' . 8639: Pattern = NAME . 8640: Color = NAME . 8641: PresMinimum = NUMBER . 8642: PresMaximum = NUMBER . 1.1 cvs 8643: PresIntervalMin= NUMBER . 8644: PresIntervalMax= NUMBER . 1.6 cvs 8645: PresValue = [ '-' ] PresVal . 8646: PresVal = NUMBER . 1.1 cvs 8647: 1.41 vatton 8648: TextTransSeq = [ Script ] TransSeq . 8649: Script = NAME . 1.30 cvs 8650: TransSeq = 'BEGIN' < Translation > 'END' ';' / 1.6 cvs 8651: Translation . 1.30 cvs 8652: Translation = Source [ '->' Target ] ';' . 1.6 cvs 8653: Source = STRING . 1.18 cvs 8654: Target = STRING .</pre> 8655: </div> 1.37 cvs 8656: <hr /> 1.18 cvs 8657: </div> 1.1 cvs 8658: 1.18 cvs 8659: <div class="chapter"> 1.37 cvs 8660: <h1><a name="sect7" id="sect7">Character coding</a></h1> 1.1 cvs 8661: 1.18 cvs 8662: <div class="section"> 1.37 cvs 8663: <h2><a name="sectb71" id="sectb71">Characters</a></h2> 1.1 cvs 8664: 1.43 quint 8665: <p>The characters of the Latin script follow the encoding defined in the ISO 8666: 8859-1 (ISO Latin-1) standard. The characters of the Greek script follow the 8667: encoding defined by Adobe for its Symbol font (Adobe FontSpecific).</p> 1.37 cvs 8668: 8669: <p>Characters whose octal code is greater than 0200 are written in the form 8670: of their octal code preceded by a backslash character (``\''). For example, 8671: the French word 'Résumé' is written <tt>R\351sum\351</tt>.</p> 1.30 cvs 8672: 8673: <p>To the ISO 8859-1 encoding four characters with the following codes have 1.37 cvs 8674: been added:<br /> 8675: <tt>212</tt>: line break<br /> 8676: <tt>240</tt>: sticky space<br /> 8677: <tt>201</tt>: thin space<br /> 1.18 cvs 8678: <tt>202</tt>: en space</p> 1.30 cvs 8679: 8680: <p>The <tt>212</tt> character is a ``line break'' character which forces a 1.37 cvs 8681: line break. The <tt>240</tt> character is a ``sticky space'', which cannot be 1.18 cvs 8682: replaced by a line break.</p> 8683: </div> 1.1 cvs 8684: 1.18 cvs 8685: <div class="section"> 1.37 cvs 8686: <h2><a name="sectb72" id="sectb72">Symbols</a></h2> 1.1 cvs 8687: 1.37 cvs 8688: <p>The table below gives the codes for the symbols of Thot. Symbols can be 8689: used in presentation schemas constants and in transcoding rules of 8690: translation schemas. Each symbol is represented by a single character.</p> 1.18 cvs 8691: <ul> 1.40 quint 8692: <li><tt>r</tt> : a radical</li> 8693: <li><tt>i</tt> : a simple integral</li> 8694: <li><tt>c</tt> : a curvilinear integral</li> 8695: <li><tt>d</tt> : a double integral</li> 8696: <li><tt>t</tt> : a triple integral</li> 1.39 cvs 8697: <li><code>o</code>: an over brace</li> 8698: <li><code>u</code>: an under brace</li> 1.40 quint 8699: <li><tt>S</tt> : the summation symbol</li> 8700: <li><tt>P</tt> : the product symbol</li> 8701: <li><tt>U</tt> : the union symbol</li> 8702: <li><tt>I</tt> : the intersection symbol</li> 8703: <li><tt>R</tt> : a right arrow</li> 8704: <li><tt>L</tt> : a left arrow</li> 8705: <li><tt><</tt> : an opening pointy bracket</li> 8706: <li><tt>></tt> : a closing pointy bracket</li> 8707: <li><tt>^</tt> : an up arrow</li> 8708: <li><tt>V</tt> : a down arrow</li> 8709: <li><tt>(</tt> : an opening parenthesis</li> 8710: <li><tt>)</tt> : a closing parenthesis</li> 8711: <li><tt>{</tt> : an opening brace</li> 8712: <li><tt>}</tt> : a closing brace</li> 8713: <li><tt>[</tt> : an opening square bracket</li> 8714: <li><tt>]</tt> : a closing square bracket</li> 1.18 cvs 8715: </ul> 8716: </div> 1.1 cvs 8717: 1.18 cvs 8718: <div class="section"> 1.37 cvs 8719: <h2><a name="sectb73" id="sectb73">Graphical elements</a></h2> 1.1 cvs 8720: 1.30 cvs 8721: <p>The table below gives the codes for the graphical elements of Thot. These 1.1 cvs 8722: elements can be used in presentation schemas constants and in transcoding 1.37 cvs 8723: rules of translation schemas. Each graphical element is represented by a 1.18 cvs 8724: single character.</p> 8725: <ul> 1.30 cvs 8726: <li>a: a circle</li> 8727: <li><p><tt>A</tt>: an open curve with an arrow head at the end</p> 8728: </li> 1.40 quint 8729: <li><tt>b</tt> : a horizontal line along the lower side of the box</li> 8730: <li><tt>B</tt> : an open curve</li> 8731: <li><tt>c</tt> : an ellipse inscribed in the box</li> 8732: <li><tt>C</tt> : a rectangle with rounded corners</li> 8733: <li><tt>D</tt> : an open curve with two arrow heads</li> 8734: <li><tt>e</tt> : The northwest/southeast diagonal of the box with an 8735: arrowhead at the bottom</li> 8736: <li><tt>E</tt> : The southwest/northeast diagonal of the box with an 8737: arrowhead at the top</li> 8738: <li><tt>F</tt> : an open curve with an arrow head at start</li> 8739: <li><tt>g</tt> : a line from the origin of the box to its opposite 8740: corner</li> 8741: <li><tt>h</tt> : a horizontal line as wide as the box and placed in its 8742: middle</li> 8743: <li><tt>l</tt> : a vertical line on the left side of the box</li> 8744: <li><tt>L</tt> : a lozenge</li> 8745: <li><tt>M</tt> : an open broken line with two arrow heads</li> 8746: <li><tt>N</tt> : an open broken line with an arrow head at start</li> 8747: <li><tt>o</tt> : The southwest/northeast diagonal of the box with an 8748: arrowhead at the bottom</li> 8749: <li><tt>O</tt> : The northwest/southeast diagonal of the box with an 8750: arrowhead at the top</li> 8751: <li><tt>p</tt> : a polygon</li> 8752: <li><tt>P</tt> : a rectangle with round corners and a horizontal bar at the 8753: top</li> 8754: <li><tt>Q</tt> : an ellipse with a horizontal bar at the top</li> 8755: <li><tt>r</tt> : a vertical line on the right side of the box</li> 8756: <li><tt>R</tt> : a rectangle which is the shape of the box</li> 8757: <li><tt>s</tt> : a closed curve</li> 8758: <li><tt>S</tt> : an open broken line</li> 8759: <li><tt>t</tt> : a horizontal line along the upper side of the box</li> 8760: <li><tt>U</tt> : an open broken line with an arrow head at the end</li> 8761: <li><tt>v</tt> : a vertical line as tall as the box and placed in its 8762: middle</li> 8763: <li><tt>V</tt> : a down arrow as tall as the box and in its middle</li> 1.30 cvs 8764: <li>w: a segment (2 points)</li> 1.40 quint 8765: <li><tt>W</tt> : the upper right corner</li> 1.30 cvs 8766: <li>x: a segment (2 points) with an arrow head at the end</li> 1.40 quint 8767: <li><tt>X</tt> : the lower right corner</li> 1.30 cvs 8768: <li>y: a segment (2 points) with an arrow head at the end</li> 1.40 quint 8769: <li><tt>Y</tt> : the lower left corner</li> 1.30 cvs 8770: <li>z: a segment (2 points) with an arrow head at the end</li> 1.40 quint 8771: <li><tt>Z</tt> : the upper left corner</li> 8772: <li><tt>space</tt> : a transparent element</li> 8773: <li><tt>^</tt> : an up arrow as tall as the box and in its middle</li> 8774: <li><tt>></tt> : a right arrow as long as the box's width and in its 8775: middle</li> 8776: <li><tt>></tt> : a left arrow as long as the box's width and in its 8777: middle</li> 8778: <li><tt>/</tt> : The southwest/northeast diagonal of the box</li> 8779: <li><tt>\</tt> : the northwest/southeast diagonal of the box</li> 1.18 cvs 8780: </ul> 1.37 cvs 8781: <hr /> 1.18 cvs 8782: </div> 8783: </div> 8784: </body> 8785: </html>