Return to languages.html CVS log | Up to [Public] / Amaya / doc |
1.6 cvs 1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> 1.1 cvs 2: <HTML> 3: <HEAD> 4: <TITLE>The Languages of Thot</TITLE> 5: </HEAD> 6: <BODY> 7: 8: <DIV class="frontmatter" align=center> 9: <H1>The Languages of Thot</H1> 10: 11: <H3>Vincent Quint</H3> 12: 1.6 cvs 13: <H4>Translated from French by Ethan Munson</H4> 1.1 cvs 14: 1.12 ! cvs 15: <H4>Version of March 26, 1997</H4> 1.1 cvs 16: 1.6 cvs 17: <P>© 1996 INRIA 18: 19: <HR> 20: </DIV> 21: 22: <DIV class="tableofcontents"> 23: <H2><A href="languages.toc.html">Contents</A></H2> 24: <UL> 25: <LI><BIG><A href="#sect2">The document model of Thot</A></BIG> 26: <UL> 27: <LI><STRONG><A href="#sectb21">The logical structure of documents</A></STRONG> 28: <LI><STRONG><A href="#sectb22">Generic and specific structures</A></STRONG> 29: <LI><STRONG><A href="#sectb23">Logical structure and physical structure</A></STRONG> 30: <LI><STRONG><A href="#sectb24">Document structures and object structures</A></STRONG> 31: </UL> 32: 33: <LI><BIG><A href="#sect3">The S language</A></BIG> 34: <UL> 35: <LI><STRONG><A href="#sectb31">Document meta-structure</A></STRONG> 36: <UL> 37: <LI><A href="#sectc311">The basic types</A> 38: <LI><A href="#sectc312">Constructed elements</A> 39: <LI><A href="#sectc313">Logical structure constructors</A> 40: <UL> 41: <LI><SMALL><A href="#sectd3131">Aggregate and List</A></SMALL> 42: <LI><SMALL><A href="#sectd3132">Choice, Schema, and Unit</A></SMALL> 43: <LI><SMALL><A href="#sectd3133">Reference and Inclusion</A></SMALL> 44: <LI><SMALL><A href="#sectd3134">Mark pairs</A></SMALL> 45: <LI><SMALL><A href="#sectd3135">Restrictions and Extensions</A></SMALL> 46: <LI><SMALL><A href="#sectd3136">Summary</A></SMALL> 47: </UL> 48: <LI><A href="#sectc314">Associated Elements</A> 49: <LI><A href="#sectc315">Attributes</A> 50: <LI><A href="#sectc316">Discussion of the model</A> 51: </UL> 52: <LI><STRONG><A href="#sectb32">The definition language for generic structures</A></STRONG> 53: <UL> 54: <LI><A href="#sectc321">Writing Conventions</A> 55: <LI><A href="#sectc322">Extension schemas</A> 56: <LI><A href="#sectc323">The general organization of structure schemas</A> 57: <LI><A href="#sectc324">The default presentation</A> 58: <LI><A href="#sectc325">Global Attributes</A> 59: <LI><A href="#sectc326">Parameters</A> 60: <LI><A href="#sectc327">Structured elements</A> 61: <LI><A href="#sectc328">Structure definitions</A> 62: <UL> 63: <LI><SMALL><A href="#sectd3281">List</A></SMALL> 64: <LI><SMALL><A href="#sectd3282">Aggregate</A></SMALL> 65: <LI><SMALL><A href="#sectd3283">Choice</A></SMALL> 66: <LI><SMALL><A href="#sectd3284">Reference</A></SMALL> 67: <LI><SMALL><A href="#sectd3285">Mark pairs</A></SMALL> 68: </UL> 69: <LI><A href="#sectc329">Imports</A> 70: <LI><A href="#sectc3210">Extension rules</A> 71: <LI><A href="#sectc3211">Associated elements</A> 72: <LI><A href="#sectc3212">Units</A> 73: <LI><A href="#sectc3213">Skeleton elements</A> 74: <LI><A href="#sectc3214">Exceptions</A> 75: </UL> 76: <LI><STRONG><A href="#sectb33">Some examples</A></STRONG> 77: <UL> 78: <LI><A href="#sectc331">A class of documents: articles</A> 79: <LI><A href="#sectc332">A class of objects: mathematical formulas</A> 1.8 cvs 80: </UL> 1.6 cvs 81: </UL> 82: 1.8 cvs 83: <LI><BIG><A href="#sect4">The P language</A></BIG> 1.6 cvs 84: <UL> 85: <LI><STRONG><A href="#sectb41">Document presentation</A></STRONG> 86: <UL> 87: <LI><A href="#sectc411">Two levels of presentation</A> 88: <LI><A href="#sectc412">Boxes</A> 89: <LI><A href="#sectc413">Views and visibility</A> 90: <LI><A href="#sectc414">Pages</A> 91: <LI><A href="#sectc415">Numbering</A> 92: <LI><A href="#sectc416">Presentation parameters</A> 93: </UL> 94: <LI><STRONG><A href="#sectb42">Presentation description language</A></STRONG> 95: <UL> 96: <LI><A href="#sectc421">The organization of a presentation schema</A> 97: <LI><A href="#sectc422">Views</A> 98: <LI><A href="#sectc423">Print Views</A> 99: <LI><A href="#sectc424">Counters</A> 100: <LI><A href="#sectc425">Presentation constants</A> 101: <LI><A href="#sectc426">Variables</A> 102: <LI><A href="#sectc427">Default presentation rules</A> 103: <LI><A href="#sectc428">Presentation and page layout boxes</A> 104: <LI><A href="#sectc429">Presentation of structured elements</A> 105: <LI><A href="#sectc4210">Logical attribute presentation</A> 106: <LI><A href="#sectc4212">Value transmission rules</A> 107: <LI><A href="#sectc4213">Presentation rules</A> 108: <LI><A href="#sectc4214">Conditions applying to presentation rules</A> 109: <UL> 110: <LI><SMALL><A href="#sectd42141">Conditions based on the logical position of the element</A></SMALL> 111: <LI><SMALL><A href="#sectd42142">Conditions on references</A></SMALL> 112: <LI><SMALL><A href="#sectd42143">Conditions on logical attributes</A></SMALL> 113: <LI><SMALL><A href="#sectd42144">Conditions on page breaks</A></SMALL> 114: <LI><SMALL><A href="#sectd42145">Conditions on the element's content</A></SMALL> 115: <LI><SMALL><A href="#sectd42146">Conditions on counters</A></SMALL> 116: </UL> 117: <LI><A href="#sectc4215">A presentation rule</A> 118: <LI><A href="#sectc4216">Box axes</A> 119: <LI><A href="#sectc4217">Distance units</A> 120: <LI><A href="#sectc4218">Relative positions</A> 121: <LI><A href="#sectc4219">Box extents</A> 122: <UL> 123: <LI><SMALL><A href="#sectd42191">Fixed extents</A></SMALL> 124: <LI><SMALL><A href="#sectd42192">Relative extents</A></SMALL> 125: <LI><SMALL><A href="#sectd42193">Elastic extents</A></SMALL> 126: </UL> 127: <LI><A href="#sectc4220">Overflow</A> 128: <LI><A href="#sectc4221">Inheritance</A> 129: <LI><A href="#sectc4222">Line breaking</A> 130: <UL> 131: <LI><SMALL><A href="#sectd42221">Line spacing</A></SMALL> 132: <LI><SMALL><A href="#sectd42222">First line indentation</A></SMALL> 133: <LI><SMALL><A href="#sectd42223">Alignment</A></SMALL> 134: <LI><SMALL><A href="#sectd42224">Justification</A></SMALL> 135: <LI><SMALL><A href="#sectd42225">Hyphenation</A></SMALL> 136: <LI><SMALL><A href="#sectd42226">Avoiding line breaking</A></SMALL> 137: </UL> 138: <LI><A href="#sectc4223">Page breaking and line breaking conditions</A> 139: <LI><A href="#sectc4224">Visibility</A> 140: <LI><A href="#sectc4225">Character style parameters</A> 141: <UL> 142: <LI><SMALL><A href="#sectd42251">Character size</A></SMALL> 143: <LI><SMALL><A href="#sectd42252">Font and character style</A></SMALL> 144: <LI><SMALL><A href="#sectd42253">Underlining</A></SMALL> 145: </UL> 146: <LI><A href="#sectc4226">Stacking order</A> 147: <LI><A href="#sectc4227">Line Style</A> 148: <LI><A href="#sectc4228">Line thickness</A> 149: <LI><A href="#sectc4229">Fill pattern</A> 150: <LI><A href="#sectc4230">Colors</A> 151: <LI><A href="#sectc4231">Presentation box content</A> 152: <LI><A href="#sectc4232">Presentation box creation</A> 153: <LI><A href="#sectc4233">Page layout</A> 154: <LI><A href="#sectc4234">Box copies</A> 155: </UL> 156: </UL> 157: 158: <LI><BIG><A href="#sect5">The T language</A></BIG> 159: <UL> 160: <LI><STRONG><A href="#sectb51">Document translation</A></STRONG> 161: <UL> 162: <LI><A href="#sectc511">Translation principles</A> 163: <LI><A href="#sectc512">Translation procedure</A> 164: </UL> 165: <LI><STRONG><A href="#sectb52">Translation definition language</A></STRONG> 166: <UL> 167: <LI><A href="#sectc521">Organization of a translation schema</A> 168: <LI><A href="#sectc522">Line length</A> 169: <LI><A href="#sectc523">Buffers</A> 170: <LI><A href="#sectc524">Counters</A> 171: <LI><A href="#sectc525">Constants</A> 172: <LI><A href="#sectc526">Variables</A> 173: <LI><A href="#sectc527">Translating structure elements</A> 174: <LI><A href="#sectc528">Conditional rules</A> 175: <UL> 176: <LI><SMALL><A href="#sectd5281">Conditions based on the logical position of the element</A></SMALL> 177: <LI><SMALL><A href="#sectd5282">Conditions on references</A></SMALL> 178: <LI><SMALL><A href="#sectd5283">Conditions on the parameters</A></SMALL> 179: <LI><SMALL><A href="#sectd5284">Conditions on the alphabets</A></SMALL> 180: <LI><SMALL><A href="#sectd5285">Conditions on page breaks</A></SMALL> 181: <LI><SMALL><A href="#sectd5286">Conditions on the element's content</A></SMALL> 182: <LI><SMALL><A href="#sectd5287">Conditions on the presence of comments</A></SMALL> 183: <LI><SMALL><A href="#sectd5288">Conditions on the presence of specific presentation rules</A></SMALL> 184: <LI><SMALL><A href="#sectd5289">Conditions on the presence of logical attributes</A></SMALL> 185: <LI><SMALL><A href="#sectd52810">Conditions on logical attributes</A></SMALL> 186: <LI><SMALL><A href="#sectd52811">Conditions on specific presentation rules</A></SMALL> 187: </UL> 188: <LI><A href="#sectc529">Translation rules</A> 189: <LI><A href="#sectc5210">The <TT>Create</TT> rule</A> 190: <LI><A href="#sectc5211">The <TT>Write</TT> rule</A> 191: <LI><A href="#sectc5212">The <TT>Read</TT> rule</A> 192: <LI><A href="#sectc5213">The <TT>Include</TT> rule</A> 193: <LI><A href="#sectc5214">The <TT>Get</TT> rule</A> 194: <LI><A href="#sectc5215">The <TT>Copy</TT> rule</A> 195: <LI><A href="#sectc5216">The <TT>Use</TT> rule</A> 196: <LI><A href="#sectc5217">The <TT>Remove</TT> rule</A> 197: <LI><A href="#sectc5218">The <TT>NoTranslation</TT> rule</A> 198: <LI><A href="#sectc5219">The <TT>NoLineBreak</TT> rule</A> 199: <LI><A href="#sectc5220">The <TT>ChangeMainFile</TT> rule</A> 200: <LI><A href="#sectc5221">The <TT>Set</TT> and <TT>Add</TT> rules</A> 1.10 cvs 201: <LI><A href="#sectc5221a">The <TT>Indent</TT> rule</A> 1.6 cvs 202: <LI><A href="#sectc5222">Rule application order</A> 203: <LI><A href="#sectc5223">Translation of logical attributes</A> 204: <LI><A href="#sectc5224">Translation of specific presentations</A> 205: <LI><A href="#sectc5225">Recoding of characters, symbols and graphics</A> 206: </UL> 207: </UL> 208: 209: <LI><BIG><A href="#sect6">Language grammars</A></BIG> 210: <UL> 211: <LI><STRONG><A href="#sectb61">The M meta-language</A></STRONG> 212: <LI><STRONG><A href="#sectb62">The S language</A></STRONG> 213: <LI><STRONG><A href="#sectb63">The P language</A></STRONG> 214: <LI><STRONG><A href="#sectb64">The T language</A></STRONG> 215: </UL> 216: 217: <LI><BIG><A href="#sect7">Character coding</A></BIG> 218: <UL> 219: <LI><STRONG><A href="#sectb71">Characters</A></STRONG> 220: <LI><STRONG><A href="#sectb72">Symbols</A></STRONG> 221: <LI><STRONG><A href="#sectb73">Graphical elements</A></STRONG> 222: </UL> 223: </UL> 1.1 cvs 224: <HR> 225: </DIV> 226: 227: <DIV class="chapter"> 1.6 cvs 228: <H1><A name=sect2>The document model of Thot</A></H1> 1.1 cvs 229: 230: <P> 231: All of the services which Thot provides to the user are based on the system's 232: internal document representation. This representation is itself derived from 233: the document model which underlies Thot. The model is presented here, prior 234: to the description of the languages which permit the generic specification of 235: documents.</P> 236: 237: <DIV class="section"> 1.6 cvs 238: <H2><A name=sectb21>The logical structure of documents</A></H2> 1.1 cvs 239: 240: <P> 241: The document model of Thot is primarily designed to allow the user to operate 1.5 cvs 242: on those entities which s/he has in mind when s/he works on a document. The 243: model makes no assumptions about the nature of these entities. It is 244: essentially these logical entities, such as paragraphs, sections, chapters, 245: notes, titles, and cross-references which give a document its logical 246: structure.</P> 1.1 cvs 247: <P> 1.5 cvs 248: Because of this model, the author can divide the document into chapters, 1.1 cvs 249: giving each one a title. The content of these chapters can be further divided 1.2 cvs 250: into sections, subsections, etc. The text is organized into successive 251: paragraphs, according to the content. In the writing phase, the lines, pages, 252: margins, spacing, fonts, and character styles are not very important. In fact, 253: if the system requires documents to be written in these terms, it gets in the 254: way. So, Thot's model is primarily based on the logical aspect of documents. 255: The creation of a model of this type essentially requires the definition :</P> 1.1 cvs 256: <UL> 257: <LI>of the entities which can appear in the documents, 258: <LI>and the relations between these entities. 259: </UL> 260: <P> 261: The choice of entities to include in the model can be subtle. Some documents 262: require chapters, while others only need various levels of sections. Certain 263: documents contain appendices, others don't. In different documents the same 264: logical entity may go by different names (e.g. ``Conclusion'' and 265: ``Summary''). Certain entities which are absolutely necessary in some 266: documents, such as clauses in a contract or the address of the recipient in a 267: letter, are useless in most other cases.</P> 268: <P> 269: The differences between documents result from more than just the entities that 270: appear in them, but also from the relationships between these entities and the 271: ways that they are linked. In certain documents, notes are spread throughout 272: the document, for example at the bottom of the page containing the 273: cross-reference to them, while in other documents they are collected at the 274: end of each chapter or even at the end of the work. As another example, the 275: introduction of some documents can contain many sections, while in other 276: documents, the introduction is restricted to be a short sequence of 277: paragraphs.</P> 278: <P> 279: All of this makes it unlikely that a single model can describe any document at 280: a relatively high level. It is obviously tempting to make up a list of widely 281: used entities, such as chapters, sections, paragraphs, and titles, and then 282: map all other entities onto the available choices. In this way, an 283: introduction can be supported as a chapter and a contract clause supported as 284: a paragraph or section. However, in trying to widen the range of usage of 285: certain entities, their meaning can be lost and the power of the model 286: reduced. In addition, while this widening partially solves the problem of 287: choosing entities, it does not solve the problem of their organization: when a 288: chapter must be composed of sections, how does one indicate that an 289: introduction has none when it is merely another chapter? One solution is to 290: include introductions in the list of supported entities. But then, how does 291: one distinguish those introductions which are allowed to have sections from 292: those which are not. Perhaps this could be done by defining two types of 293: introduction. Clearly, this approach risks an infinite expansion of the list 294: of widely used entities.</P> 295: </DIV> 296: 297: <DIV class="section"> 1.6 cvs 298: <H2><A name=sectb22>Generic and specific structures</A></H2> 1.1 cvs 299: 300: <P> 301: Thus, it is apparently impossible to construct an exhaustive inventory of all 1.2 cvs 302: those entities which are necessary and sufficient to precisely describe any 303: document. It also seems impossible to specify all possible arrangements of 304: these entities in a document. This is why Thot uses a <EM>meta-model</EM> 305: instead, which permits the description of numerous <EM>models</EM>, each one 306: describing a <EM>class</EM> of documents.</P> 1.1 cvs 307: <P> 308: A <EM>class</EM> is a set of documents having very similar structure. Thus, 309: the collection of research reports published by a laboratory constitutes a 310: class; the set of commercial proposals by the sales department of a company 311: constitutes another class; the set of articles published by a journal 312: constitutes a third class. Clearly, it is not possible to enumerate every 313: possible document class. It is also clear that new document classes must be 314: created to satisfy new needs and applications.</P> 315: <P> 316: To give a more rigorous definition of classes, we must introduce the ideas of 317: <EM>generic structure</EM> and <EM>specific structure</EM>. Each document has 318: a <EM>specific structure</EM> which organizes the various parts which comprise 319: it. We illustrate this with the help of a simple example comparing two 320: reports, A and B (<A href="#specstruct">see Figure</A>). The report A contains 321: an introduction followed by three chapters and a conclusion. The first 322: chapter contains two sections, the second, three sections. That is the 323: <EM>specific</EM> structure of document A. Similarly, the structure of 324: document B is: an introduction, two chapters, a conclusion; Chapter 1 has 325: three sections while Chapter 2 has four. The specific structures of these two 326: documents are thus different.</P> 327: 328: <DIV class="figure"> 329: <HR> 330: <PRE> 331: Report A Report B 332: Introduction Introduction 333: Chapter 1 Chapter 1 334: Section 1.1 Section 1.1 335: Section 1.2 Section 1.2 336: Chapter 2 Section 1.3 337: Section 2.1 Chapter 2 338: Section 2.2 Section 2.1 339: Section 2.3 Section 2.2 340: Chapter 3 Section 2.3 341: Conclusion Section 2.4 342: Conclusion 343: </PRE> 344: <P align=center> 345: <EM><A name="specstruct">Two specific structures</A></EM></P> 346: <HR> 347: </DIV> 348: <P> 349: The <EM>generic structure</EM> defines the ways in which specific structures 350: can be constructed. It specifies how to generate specific structures. The 351: reports A and B, though different, are constructed in accordance with the same 352: generic structure, which specifies that a report contains an introduction 353: followed by a variable number of chapters and a conclusion, with each chapter 354: containing a variable number of sections.</P> 355: <P> 356: There is a one-to-one correspondence between a class and a generic structure: 357: all the documents of a class are constructed in accordance with the same 358: generic structure. Hence the definition of the class: a class is a set of 359: documents whose specific structure is constructed in accordance with the same 360: generic structure. A class is characterized by its generic structure.</P> 361: <P> 362: Thus, a generic structure can be considered to be a model at the level which 363: interests us, but only for one class of documents. When the definition is 364: limited to a single class of documents, it is possible to define a model which 365: does a good job of representing the documents of the class, including the 366: necessary entities and unencumbered by useless entities. The description of 367: the organization of the documents in the class can then be sufficiently 368: precise.</P> 369: </DIV> 370: 371: <DIV class="section"> 1.6 cvs 372: <H2><A name=sectb23>Logical structure and physical structure</A></H2> 1.1 cvs 373: 374: <P> 375: Generic structures only describe the <EM>logical</EM> organization of 376: documents, not their <EM>physical</EM> presentation on a screen or on sheets 377: of paper. However, for a document to be displayed or printed, its graphic 378: presentation must be taken into account.</P> 379: <P> 380: An examination of current printed documents shows that the details of 381: presentation essentially serve to bring out their logical structure. Outside 382: of some particular domains, notably advertising, the presentation is rarely 383: independent of the logical organization of the text. Moreover, the art of 384: typography consists of enhancing the organization of the text being set, 385: without catching the eye of the reader with overly pronounced effects. Thus, 386: italic and boldface type are used to emphasize words or expressions which have 387: greater significance than the rest of the text: keywords, new ideas, 388: citations, book titles, etc. Other effects highlight the organization of the 389: text: vertical space, margin changes, page breaks, centering, eventually 390: combined with the changes in the shapes or weight of the characters. These 391: effects serve to indicate the transitions between paragraphs, sections, or 392: chapters: an object's level in the logical structure of the document is shown 393: by the markedness of the effects.</P> 394: <P> 395: Since the model permits the description of all of the logical structure of the 396: document, the presentation can be derived from the model without being 397: submerged in the document itself. It suffices to use the logical structure of 398: the document to make the desired changes in its presentation: changes in type 399: size, type style, spacing, margin, centering, etc.</P> 400: <P> 401: Just as one cannot define a unique generic logical structure for all document 402: classes, one cannot define universal presentation rules which can be applied 403: to all document classes. For certain types of documents the chapter titles 404: will be centered on the page and printed in large, bold type. For other 405: documents, the same chapter titles will be printed in small, italic type and 406: aligned on the left margin.</P> 407: <P> 408: Therefore, it is necessary to base the presentation specifications for 409: documents on their class. Such a specification can be very fine-grained, 410: because the presentation is expressed in terms of the entities defined in the 411: generic logical structure of the class. Thus, it is possible to specify a 412: different presentation for the chapter titles and the section titles, and 413: similarly to specify titles for the sections according to their level in the 414: section hierarchy. The set of rules which specify the presentation of all the 415: elements defined in a generic logical structure is called a <EM>generic 416: presentation</EM>.</P> 417: <P> 418: There are several advantages derived from having a presentation linked to the 419: generic structure and described by a generic presentation. Homogeneity is the 420: first. Since every document in a class corresponds to the same generic 421: logical structure, a homogenous presentation for different documents of the 422: same class can be assured by applying the same generic presentation to all 423: documents of the class. Homogeneity of presentation can also be found among 1.2 cvs 424: the entities of a single document: every section heading will be presented in 1.1 cvs 425: the same way, the first line of every paragraph of the same type will have the 426: same indentation, etc.</P> 427: <P> 428: Another advantage of this approach to presentation is that it facilitates 429: changes to the graphical aspect of documents. A change to the generic 430: presentation rules attached to each type of entity will alter the presentation 431: of the entire document, and will do so homogenously. In this case, the 432: internal homogeneity of the class is no longer assured, but the way to control 433: it is simple. It suffices to adopt a single generic presentation for the 434: entire class.</P> 435: <P> 436: If the presentation of the class does not have to be homogenous, then the 437: appearance of the document can be adapted to the way it will be used or to the 438: device used to render it. This quality is sufficient to allow the existence 439: of <A name="mulpres">many generic presentations</A> for the same document 440: class. By applying one or the other of these presentations to it, the document 441: can be seen under different graphical aspects. It must be emphasized that 442: this type of modification of the presentation is not a change to the document 443: itself (in its specific logical structure or its content), but only in its 444: appearance at the time of editing or printing.</P> 445: </DIV> 446: 447: <DIV class="section"> 1.6 cvs 448: <H2><A name=sectb24>Document structures and object structures</A></H2> 1.1 cvs 449: 450: <P> 451: So far, we have only discussed the global structure of documents and have not 452: considered the contents found in that structure. We could limit ourselves to 453: purely textual contents by assuming that a title or a paragraph contains a 454: simple linear text. But this model would be too restrictive. In fact, 455: certain documents contain not only text, but also contain tables, diagrams, 456: photographs, mathematical formulas, and program fragments. The model must 457: permit the representation of such <EM>objects</EM>.</P> 458: <P> 459: Just as with the whole of the document, the model takes into account the 460: logical structure of objects of this type. Some are clearly structured, 461: others are less so. Logical structure can be recognized in mathematical 462: formulas, in tables, and in certain types of diagrams. On the other hand, it 463: is difficult to define the structure of a photograph or of some drawings. But 464: in any case, it does not seem possible to define one unique structure which 465: can represent every one of these types of objects. The approach taken in the 466: definition of meta-structure and document classes also applies to objects. 467: Object classes can be defined which put together objects of similar type, 468: constructed from the same generic logical structure.</P> 469: <P> 470: Thus, a mathematical class can be defined and have a generic logical structure 471: associated with it. But even if a single generic structure can represent a 472: sufficient variety of mathematical formulas, for other objects with less 473: rigorous structure, multiple classes must be defined. As for documents, using 474: multiple classes assures that the model can describe the full range of objects 475: to be presented. It also permits the system to support objects which were not 476: initially anticipated. Moreover, this comment applies equally to mathematics: 477: different classes of formulas can be described depending on the domain of 478: mathematics being described.</P> 479: <P> 480: Since objects have the same level of logical representation as documents, they 481: gain the same advantages. In particular, it is possible to define the 482: presentation separately from the objects themselves and attach it to the 483: class. Thus, as for documents, objects of the same type have a uniform 484: presentation and the presentation of every object in a given class can be 485: changed simply by changing the generic presentation of the class. Another 486: advantage of using this document model is that the system does not bother the 487: user with the details of presentation, but rather allows the user to 488: concentrate on the logical aspect of the document and the objects.</P> 489: <P> 490: It is clear that the documents in a class do not necessarily use the same 491: classes of objects: one technical report will contain tables while another 492: report will have no tables but will use mathematical formulas. The usable 1.2 cvs 493: object classes are not always mentioned in a limiting way in the generic 494: logical structure of documents. Rather, they can be chosen freely from a 495: large set, independent of the document class.</P> 1.1 cvs 496: <P> 497: Thus, the object classes will be made commonplace and usable in every 498: document. The notion of ``object'' can be enlarged to include not only 499: non-textual elements, but also certain types of textual elements which can 500: appear in practically every document, whatever their class. Among these 1.2 cvs 501: textual elements, one can mention enumerations, descriptions, examples, 502: quotations, even paragraphs.</P> 1.1 cvs 503: <P> 504: Thus, the document model is not a single, general model describing every type 505: of document in one place. Rather, it is a meta-model which can be used to 506: describe many different models each of which represents either a class of 507: similar documents or a class of similar objects which every document can 508: include.</P> 509: </DIV> 510: <HR> 511: </DIV> 512: 513: <DIV class="chapter"> 1.6 cvs 514: <H1><A name=sect3>The S language</A></H1> 1.1 cvs 515: 516: 517: <DIV class="section"> 1.6 cvs 518: <H2><A name=sectb31>Document meta-structure</A></H2> 1.1 cvs 519: 520: <P> 521: Since the concept of meta-structure is well suited to the task of describing 522: documents at a high level of abstraction, this meta-structure must be 523: precisely defined. Toward that end this section first presents the basic 524: elements from which documents and structured objects are composed and then 525: specifies the ways in which these basic elements are assembled into structures 526: representing complete documents and objects.</P> 527: 528: <DIV class="subsection"> 1.6 cvs 529: <H3><A name=sectc311>The basic types</A></H3> 1.1 cvs 530: 531: <P> 532: At the lowest level of a document's structure, the first atom considered is 533: the character. However, since characters are seldom isolated, usually 534: appearing as part of a linear sequence, and in order to reduce the complexity 535: of the document structure, <EM>character strings</EM> are used as atoms and 536: consecutive characters belonging to the same structural element are grouped in 537: the same character string.</P> 538: <P> 539: If the structure of a document is not refined to go down to the level of 540: words or phrases, the contents of a simple paragraph can be considered to be a 541: single character string. On the other hand, the title of a chapter, the title 542: of the first section of that chapter, and the text of the first paragraph of 543: that section constitute three different character strings, because they belong 544: to distinct structural elements.</P> 545: <P> 546: If, instead, a very fine-grained representation for the structure of a 547: document is sought, character strings could be defined to contain only a 548: single word, or even just a single character. This is the case, for example, 549: in programs, for which one wants to retain a structure very close to the 1.2 cvs 550: syntax of the programming language. In this case, an assignment statement 1.1 cvs 551: initializing a simple variable to zero would be composed of two structural 552: elements, the identifier of the variable (a short character string) and the 553: assigned value (a string of a single character, `0').</P> 554: <P> 555: The character string is not the only atom necessary for representing those 556: documents that interest us. It suffices for purely textual documents, but as 557: soon as the non-textual objects which we have considered arise, there must be 558: other atoms; the number of objects which are to be represented determines the 559: number of types of atoms that are necessary.</P> 560: <P> 561: Primitive <EM>graphical elements</EM> are used for tables and figures of 562: different types. These elements are simple geometric shapes like horizontal 563: or vertical lines, which are sufficient for tables, or even oblique lines, 1.2 cvs 564: arrows, rectangles, circles, polygons, and curves for use in figures. From 565: these elements and character strings, graphical objects and tables can be 566: constructed.</P> 1.1 cvs 567: <P> 568: Photographs, though having very little structure, must still appear in 1.2 cvs 569: documents. They are supported by <EM>picture</EM> elements, which are 570: represented as matrices of pixels.</P> 1.1 cvs 571: <P> 572: Finally, mathematical notations require certain elements which are 573: simultaneously characters and graphical elements, the <EM>symbols</EM>. By way 1.2 cvs 574: of example, radicals, integration signs, or even large parentheses are 1.1 cvs 575: examples of this type of atom. The size of each of these symbols is 576: determined by its environment, that is to say, by the expression to which it 577: is attached.</P> 578: <P> 579: To summarize, the primitive elements which are used in the construction of 580: documents and structured objects are:</P> 581: <UL> 582: <LI>character strings, 583: <LI>graphical elements, 1.2 cvs 584: <LI>pictures, 1.1 cvs 585: <LI>and mathematical symbols. 586: </UL> 587: </DIV> 588: 589: <DIV class="subsection"> 1.6 cvs 590: <H3><A name=sectc312>Constructed elements</A></H3> 1.1 cvs 591: 592: <P> 593: A document is evidently formed from primitive elements. But the model of Thot 594: also proposes higher level elements. Thus, in a document composed of several 595: chapters, each chapter is an element, and in the chapters each section is also 596: an element, and so on. A document is thus an organized set of elements.</P> 597: <P> 598: In a document there are different sorts of elements. Each element has a 599: <EM>type</EM> which indicates the role of the element within the document as a 600: whole. Thus, we have, for example, the chapter and section types. The 601: document is made up of typed elements: elements of the type chapter and 602: elements of the type section, among others, but also character string elements 603: and graphical elements: the primitive elements are typed elements just as 604: well. At the other extreme, the document itself is also considered to be a 605: typed element.</P> 606: <P> 607: The important difference between the primitive elements and the other elements 608: of the document is that the primitive elements are atoms (they cannot be 609: decomposed), whereas the others, called <EM>constructed elements</EM>, are 610: composed of other elements, which can either be primitive elements or 611: constructed elements. A constructed element of type chapter (or more simply, 612: ``a chapter'') is composed of sections, which are also constructed elements. A 613: paragraph, a constructed element, can be made up of character strings, which 614: are primitive elements, and of equations, which are constructed elements.</P> 615: <P> 616: A document is also a constructed element. This is an important point. In 617: particular, it allows a document to be treated as part of another document, 618: and conversely, permits a part of a document to be treated as a complete 619: document. Thus, an article presented in a journal is treated by its author as 620: a document in itself, while the editor of the journal considers it to be part 621: of an issue. A table or a figure appearing in a document can be extracted and 622: treated as a complete document, for example to prepare transparencies for a 623: conference.</P> 624: <P> 625: These thoughts about types and constructed elements apply just as well to 626: objects as they do to documents. A table is a constructed element made up of 627: other constructed elements, rows and columns. A row is formed of cells, which 628: are also constructed elements which contain primitive elements (character 629: strings) and/or constructed elements like equations.</P> 630: </DIV> 631: 632: <DIV class="subsection"> 1.6 cvs 633: <H3><A name=sectc313>Logical structure constructors</A></H3> 1.1 cvs 634: 635: <P> 636: Having defined the primitive elements and the constructed elements, it is now 637: time to define the types of organization which allow the building of 638: structures. For this, we rely on the notion of the <EM>constructor</EM>. A 639: constructor defines a way of assembling certain elements in a structure. It 640: resides at the level of the meta-structure: it does not describe the existing 641: relations in a given structure, but rather defines how elements are assembled 1.2 cvs 642: to build a structure that conforms to a model.</P> 1.1 cvs 643: <P> 644: In defining the overall organization of documents, the first two constructors 645: considered are the aggregate and the list.</P> 646: 647: <DIV class="subsubsection"> 1.6 cvs 648: <H4><A name=sectd3131>Aggregate and List</A></H4> 1.1 cvs 649: 650: <P> 651: The <EM>aggregate</EM> constructor is used to define constructed element types 652: which are collections of a given number of other elements. These collections 653: may or may not be ordered. The elements may be either constructed or 654: primitive and are specified by their type. A report (that is, a constructed 655: element of the report type) has an aggregate structure. It is formed from a 656: title, an author's name, an introduction, a body, and a conclusion, making it 657: a collection of five element types. This type of constructor is found in 658: practically every document, and generally at several levels in a document.</P> 659: <P> 660: The <EM>list</EM> constructor is used to define constructed elements which are 661: ordered sequences of elements (constructed or primitive) having the same type. 662: The minimum and maximum numbers of elements for the sequence can be specified 663: in the list constructor or the number of elements can be left unconstrained. 664: The body of a report is a list of chapters and is typically required to 665: contain a minimum of two chapters (is a chapter useful if it is the only one 666: in the report?) The chapter itself can contain a list of sections, each 1.2 cvs 667: section containing a list of paragraphs. In the same way as the aggregate, 668: the list is a very frequently used constructor in every type of document. 669: However, these two constructors are not sufficient to describe every document 670: structure; thus other constructors supplement them.</P> 1.1 cvs 671: </DIV> 672: 673: <DIV class="subsubsection"> 1.6 cvs 674: <H4><A name=sectd3132>Choice, Schema, and Unit</A></H4> 1.1 cvs 675: 676: <P> 677: The <EM>choice</EM> constructor is used to define the structure of an element 678: type for which one alternative is chosen from several possibilities. Thus, a 679: paragraph can be either a simple text paragraph, or an enumeration, or a 1.2 cvs 680: citation.</P> 1.1 cvs 681: <P> 682: The choice constructor indicates the complete list of possible options, which 683: can be too restrictive in certain cases, the paragraph being one such case. 684: Two constructors, <EM>unit</EM> and <EM>schema</EM>, address this 685: inconvenience. They allow more freedom in the choice of an element type. If 686: a paragraph is defined by a schema constructor, it is possible to put in the 687: place of a paragraph a table, an equation, a drawing or any other object 688: defined by another generic logical structure. It is also possible to define a 689: paragraph as a sequence of units, which could be character strings, symbols, 1.2 cvs 690: or pictures. The choice constructor alone defines a generic logical structure 1.1 cvs 691: that is relatively constrained; in contrast, using units and schemas, a very 692: open structure can be defined.</P> 693: <P> 694: The <EM>schema</EM> constructor represents an object defined by a generic 695: logical structure chosen freely from among those available.</P> 696: <P> 697: The <EM>unit</EM> constructor represents an element whose type can be either a 698: primitive type or an element type defined as a unit in the generic logical 699: structure of the document, or in another generic logical structure used in the 700: document. Such an element may be used in document objects constructed 701: according to other generic structures.</P> 702: <P> 703: Thus, for example, if a cross-reference to a footnote is defined in the 704: generic logical structure ``Article'' as a unit, a table (an object defined by 705: another generic structure) can contain cross-references to footnotes, when 706: they appear in an article. In another type of document, a table defined by 707: the same generic structure can contain other types of elements, depending on 708: the type of document into which the table is inserted. All that is needed is 709: to declare, in the generic structure for tables, that the contents of cells 710: are units. In this way, the generic structure of objects is divided up 711: between different types of documents which are able to adapt themselves to the 712: environment into which they are inserted.</P> 713: </DIV> 714: 715: <DIV class="subsubsection"> 1.6 cvs 716: <H4><A name=sectd3133>Reference and Inclusion</A></H4> 1.1 cvs 717: 718: <P> 1.5 cvs 719: The <EM>reference</EM> is used to define document 1.1 cvs 720: elements that are cross-references to other elements, such as a section, a 1.2 cvs 721: chapter, a bibliographic citation, or a figure. The reference is 722: bi-directional. It can be used to access both the element being 1.1 cvs 723: cross-referenced and each of the elements which make use of the 724: cross-reference.</P> 725: <P> 726: References can be either <EM>internal</EM> or <EM>external</EM>. That is, 727: they can designate elements which appear in the same document or in another 728: document.</P> 729: <P> 730: The <EM><A name="inclusion">inclusion</A></EM> constructor is a special type 731: of reference. Like the reference, it is an internal or external bidirectional 732: link, but it is not a cross-reference. This link represents the ``live'' 733: inclusion of the designated element; it accesses the most recent version of 734: that element and not a ``dead'' copy, fixed in the state in which it was found 735: at the moment the copy was made. As soon as an element is modified, all of 736: its inclusions are automatically brought up to date. It must be noted that, 1.2 cvs 737: in addition to inclusion, Thot permits the creation of ``dead'' copies.</P> 1.1 cvs 738: <P> 739: There are three types of inclusions: inclusions with full expansion, 740: inclusions with partial expansion, and inclusions without expansion. During 741: editing, inclusions without expansion are represented on the screen by the 742: name of the included document, in a special color, while inclusions with 743: expansion (full or partial) are represented by a copy (full or partial) of the 744: included element (also in a special color). The on-screen representation of a 1.6 cvs 745: partial inclusion is a <A href="#sectc3213">``skeleton''</A> image of the 1.1 cvs 746: included document.</P> 747: <P> 748: Inclusion with complete expansion can be used to include parts of the same 749: document or of other documents. Thus, it can be either an internal or an 750: external link. It can be used to include certain bibliographic entries of a 751: scientific article in another article, or to copy part of a mathematical 752: formula into another formula of the same document, thus assuring that both 753: copies will remain synchronized.</P> 754: <P> 755: Inclusion without expansion or with partial expansion is used to include 756: complete documents. It is always an external link. It is used primarily to 757: divide very large documents into sub-documents that are easier to manipulate, 758: especially when there are many authors. So, a book can include some chapters, 759: where each chapter is a different document which can be edited separately. 760: When viewing the book on the screen, it might be desirable to see only the 761: titles of the chapters and sections. This can be achieved using inclusion 762: with partial expansion.</P> 763: <P> 764: During printing, inclusions without expansion or with partial expansion can be 765: represented either as they were shown on the screen or by a complete (and 766: up-to-date) copy of the included element or document.</P> 767: <P> 768: The inclusion constructor, whatever its type, respects the generic structure: 769: only those elements authorized by the generic structure can be included at a 770: given position in a document.</P> 771: </DIV> 772: 773: <DIV class="subsubsection"> 1.6 cvs 774: <H4><A name=sectd3134>Mark pairs</A></H4> 1.1 cvs 775: 776: <P> 777: It is often useful to delimit certain parts of a document independently from 778: the logical structure. For example, one might wish to attach some information 1.6 cvs 779: (in the form of an <A href="#sectc315">attribute</A>) or a particular 1.1 cvs 780: treatment to a group of words or a set of consecutive paragraphs. <EM>Mark 781: pairs</EM> are used to do this.</P> 782: <P> 783: Mark pairs are elements which are always paired and are terminals in the 784: logical structure of the document. Their position in the structure of the 785: document is defined in the generic structure. It is important to note that 786: when the terminals of a mark pair are <EM>extensions</EM> (see the next 787: section), they can be used quite freely.</P> 788: </DIV> 789: 790: <DIV class="subsubsection"> 1.6 cvs 791: <H4><A name=sectd3135>Restrictions and Extensions</A></H4> 1.1 cvs 792: 793: <P> 794: The primitive types and the constructors presented so far permit the 795: definition of the logical structure of documents and objects in a rigorous 796: way. But this definition can be very cumbersome in certain cases, notably 797: when trying to constrain or extend the authorized element types in a 798: particular context. <EM>Restrictions</EM> and <EM>extensions</EM> are used to 1.2 cvs 799: cope with these cases.</P> 1.1 cvs 800: <P> 801: A restriction associates with a particular element type <EM>A</EM>, a list of 802: those element types which elements of type <EM>A</EM> may not contain, even if 803: the definition of type <EM>A</EM> and those of its components authorize them 804: otherwise. This simplifies the writing of generic logical structures and 805: allows limitations to be placed, when necessary, on the choices offered by the 806: schema and unit constructors.</P> 807: <P> 808: Extensions are the inverse of restrictions. They identify a list of element 809: types whose presence <EM>is</EM> permitted, even if its definition and those 810: of its components do not authorize them otherwise.</P> 811: </DIV> 812: 813: <DIV class="subsubsection"> 1.6 cvs 814: <H4><A name=sectd3136>Summary</A></H4> 1.1 cvs 815: 816: <P> 817: Thus, four constructors are used to construct a document:</P> 818: <UL> 1.2 cvs 819: <LI>the aggregate constructor (ordered or not), 1.1 cvs 820: <LI>the list constructor, 1.2 cvs 821: <LI>the choice constructor and its extensions, the unit and schema 822: constructors, 1.1 cvs 823: <LI>the reference constructor and its variant, the inclusion. 824: </UL> 825: <P> 826: These constructors are also sufficient for objects. Thus, these constructors 827: provide a homogenous meta-model which can describe both the organization of 828: the document as a whole and that of the various types of objects which it 829: contains. After presenting the description language for generic structures, 830: we will present several examples which illustrate the appropriateness of the 831: model.</P> 832: <P> 833: The first three constructors (aggregate, list and choice) lead to tree-like 834: structures for documents and objects, the objects being simply the subtrees of 835: the tree of a document (or even of other objects' subtrees). The reference 836: constructor introduces other, non-hierarchical, relations which augment those 837: of the tree: when a paragraph makes reference to a chapter or a section, that 838: relation leaves the purely tree-like structure. Moreover, external reference 839: and inclusion constructors permit the establishment of links between different 840: documents, thus creating a hypertext structure.</P> 841: </DIV> 842: </DIV> 843: 844: <DIV class="subsection"> 1.6 cvs 845: <H3><A name=sectc314>Associated Elements</A></H3> 1.1 cvs 846: 847: <P> 848: Thanks to the list, aggregate and choice constructors, the organization of the 849: document is specified rigorously, using constructed and primitive elements. 850: But a document is made up of more than just its elements; it clearly also 851: contains links between them. There exist elements whose position in the 852: document's structure is not determinable. This is notably the case for 853: figures and notes. A figure can be designated at many points in the same 854: document and its place in the physical document can vary over the life of the 855: document without any effect on the meaning or clarity of the document. At one 856: time, it can be placed at the end of the document along with all other 857: figures. At another time, it can appear at the top of the page which follows 858: the first mention of the figure. The figures can be dispersed throughout the 859: document or can be grouped together. The situation is similar for notes, 860: which can be printed at the bottom of the page on which they are mentioned or 861: assembled together at the end of the chapter or even the end of the work. Of 862: course, this brings up questions of the physical position of elements in 863: documents that are broken into pages, but this reflects the structural 864: instability of these elements. They cannot be treated the same way as 865: elements like paragraphs or sections, whose position in the structure is 866: directly linked to the semantics of the document.</P> 867: <P> 868: Those elements whose position in the structure of the document is not fixed, 869: even though they are definitely part of the document, are called 870: <EM>associated elements</EM>. Associated elements are themselves structures, 871: which is to say that their content can be organized logically by the 872: constructors from primitive and constructed elements.</P> 873: <P> 874: It can happen that the associated elements are totally disconnected from the 875: structure of the document, as in a commentary or appraisal of the entire work. 876: But more often, the associated elements are linked to the content of the 877: document by references. This is generally the case for notes and figures, 878: among others.</P> 879: <P> 880: Thus, associated elements introduce a new use for the reference constructor. 881: It not only serves to create links between elements of the principal structure 882: of the document, but also serves to link the associated elements to the 883: primary structure.</P> 884: </DIV> 885: 886: <DIV class="subsection"> 1.6 cvs 887: <H3><A name=sectc315>Attributes</A></H3> 1.1 cvs 888: 889: <P> 890: There remain logical aspects of documents that are not entirely described by 891: the structure. Certain types of semantic information, which are not stated 892: explicitly in the text, must also be taken into account. In particular, such 893: information is shown by typographic effects which do not correspond to a 894: change between structural elements. In fact, certain titles are set in bold 895: or italic or are printed in a different typeface from the rest of the text in 896: order to mark them as structurally distinct. But these same effects 897: frequently appear in the middle of continuous text (e.g. in the interior of a 898: paragraph). In this case, there is no change between structural elements; the 899: effect serves to highlight a word, expression, or phrase. The notion of an 900: <EM>attribute</EM> is used to express this type of information.</P> 901: <P> 902: An attribute is a piece of information attached to a structural element which 903: augments the type of the element and clarifies its function in the document. 904: Keywords, foreign language words, and titles of other works can all be 905: represented by character strings with attached attributes. Attributes may 906: also be attached to constructed elements. Thus, an attribute indicating the 907: language can be attached to a single word or to a large part of a 908: document.</P> 909: <P> 910: In fact, an attribute can be any piece of information which is linked to a 911: part of a document and which can be used by agents which work on the document. 912: For example, the language in which the document is written determines the set 913: of characters used by an editor or formatter. It also determines the 914: algorithm or hyphenation dictionary to be used. The attribute ``keyword'' 915: facilitates the work of an information retrieval system. The attribute 916: ``index word'' allows a formatter to automatically construct an index at the 917: end of the document.</P> 918: <P> 919: As with the types of constructed elements, the attributes and the values they 920: can take are defined separately in each generic logical structure, not in the 921: meta-model, according to the needs of the document class or the nature of the 922: object.</P> 923: <P> 924: Many types of attributes are offered: numeric, textual, references, and 925: enumerations:</P> 926: <UL> 1.2 cvs 927: <LI><EM>Numeric attributes</EM> can take integer values (negative, positive, 928: or null). 1.1 cvs 929: <LI><EM>Textual attributes</EM> have as their values character strings. 1.2 cvs 930: <LI><EM>Reference attributes</EM> designate an element of the logical 931: structure. 932: <LI><EM>Enumeration attributes</EM> can take one value from a limited list of 1.1 cvs 933: possible values, each value being a name. 934: </UL> 935: <P> 936: In a generic structure, there is a distinction between <EM>global 937: attributes</EM> and <EM>local attributes</EM>. A global attribute can be 938: applied to every element type defined in the generic structure where it is 939: specified. In contrast, a local attribute can only be applied to certain 940: types of elements, even only a single type. The ``language'' attribute 941: presented above is an example of a global attribute. An example of a local 942: attribute is the rank of an author (principal author of the document or 943: secondary author): this attribute can only be applied sensibly to an element 944: of the ``author'' type.</P> 945: <P> 946: Attributes can be assigned to the elements which make up the document in many 947: different ways. The author can freely and dynamically place them on any part 1.5 cvs 948: of the document in order to attach supplementary information of his/her choice. 1.1 cvs 949: However, attributes may only be assigned in accordance with the rules of the 950: generic structure; in particular, local attributes can only be assigned to 951: those element types for which they are defined.</P> 952: <P> 953: In the generic structure, certain local attributes can be made mandatory for 1.2 cvs 954: certain element types. In this case, Thot automatically associates the 955: attribute with the elements of this type and it requires the user to provide a 956: value for this attribute.</P> 1.1 cvs 957: <P> 958: Attributes can also be automatically assigned, with a given value, by every 959: application processing the document in order to systematically add a piece of 960: information to certain predefined elements of the document. By way of 961: example, in a report containing a French abstract and an English abstract, 962: each of the two abstracts is defined as a sequence of paragraphs. The first 963: abstract has a value of ``French'' for the ``language'' attribute while the 964: second abstract's ``language'' attribute has a value of ``English''.</P> 965: <P> 966: In the case of mark pairs, attributes are logically associated with the pair 967: as a whole, but are actually attached to the first mark.</P> 968: </DIV> 969: 970: <DIV class="subsection"> 1.6 cvs 971: <H3><A name=sectc316>Discussion of the model</A></H3> 1.1 cvs 972: 973: <P> 974: The notions of attribute, constructor, structured element, and associated 975: element are used in the definition of generic logical structures of documents 976: and objects. The problem is to assemble them to form generic structures. In 977: fact, many types of elements and attributes can be found in a variety of 978: generic structures. Rather than redefine them for each structure in which 979: they appear, it is best to share them between structures. The object classes 980: already fill this sharing function. If a mathematical class is defined, its 981: formulas can be used in many different document classes, without redefining 982: the structure of each class. This problem arises not only for the objects 983: considered here; it also arises for the commonplace textual elements found in 984: many document classes. This is the reason why the notion of object is so 985: broad and why paragraphs and enumerations are also considered to be objects. 986: These object classes not only permit the sharing of the structures of 987: elements, but also of the attributes defined in the generic structures.</P> 988: <P> 989: Structure, such as that presented here, can appear very rigid, and it is 990: possible to imagine that a document editing system based on this model could 991: prove very constraining to the user. This is, in fact, a common criticism of 992: syntax-directed editors. This defect can be avoided with Thot, primarily for 993: three reasons:</P> 994: <UL> 995: <LI>the generic structures are not fixed in the model itself, 996: <LI>the model takes the dynamics of documents into account, 997: <LI>the constructors offer great flexibility. 998: </UL> 999: <P> 1000: When the generic structure of a document is not predefined, but rather is 1001: constructed specifically for each document class, it can be carefully adapted 1002: to the current needs. In cases where the generic structure is inadequate for 1003: a particular document of the class, it is always possible either to create a 1004: new class with a generic structure well suited to the new case or to extend 1005: the generic structure of the existing class to take into account the specifics 1006: of the document which poses the problem. These two solutions can also be 1007: applied to objects whose structures prove to be poorly designed.</P> 1008: <P> 1009: The model is sufficiently flexible to take into account all the phases of the 1010: life of the document. When a generic structure specifies that a report must 1011: contain a title, an abstract, an introduction, at least two chapters, and a 1012: conclusion, this means only that a report, <EM>upon completion</EM>, will have 1013: to contain all of these elements. When the author begins writing, none of 1.2 cvs 1014: these elements is present. Thot uses this model. Therefore, it tolerates 1015: documents which do not conform strictly to the generic structure of their 1016: class; it also considers the generic logical structure to be a way of helping 1017: the user in the construction of a complex document.</P> 1.1 cvs 1018: <P> 1019: In contrast, other applications may reject a document which does not conform 1020: strictly to its generic structure. This is, for example, what is done by 1021: compilers which refuse to generate code for a program which is not 1022: syntactically correct. This might also occur when using a document 1023: application for a report which does not have an abstract or title.</P> 1024: <P> 1025: The constructors of the document model bring a great flexibility to the 1026: generic structures. A choice constructor (and even more, a unit or schema 1027: constructor) can represent several, very different elements. The list 1028: constructor permits the addition of more elements of the same type. Used 1029: together, these two constructors permit any series of elements of different 1030: types. Of course, this flexibility can be reduced wherever necessary since a 1031: generic structure can limit the choices or the number of elements in a 1032: list.</P> 1033: <P> 1034: Another difficulty linked to the use of structure in the document model 1035: resides in the choice of the level of the structure. The structure of a 1036: discussion could be extracted from the text itself via linguistic analysis. 1037: Some studies are exploring this approach, but the model of Thot excludes this 1038: type of structure. It only takes into account the logical structure provided 1039: explicitly by the author.</P> 1040: <P> 1041: However, the level of structure of the model is not imposed. Each generic 1042: structure defines its own level of structure, adapted to the document class or 1043: object and to the ways in which it will be processed. If it will only be 1044: edited and printed, a relatively simple structure suffices. If more 1045: specialized processing will be applied to it, the structure must represent the 1046: element types on which this processing must act. By way of example, a simple 1047: structure is sufficient for printing formulas, but a more complex structure is 1048: required to perform symbolic or numeric calculations on the mathematical 1049: expressions. The document model of Thot allows both types of structure.</P> 1050: </DIV> 1051: </DIV> 1052: 1053: <DIV class="section"> 1.6 cvs 1054: <H2><A name=sectb32>The definition language for generic structures</A></H2> 1.1 cvs 1055: 1056: <P> 1057: Generic structures, which form the basis of the document model of Thot, are 1058: specified using a special language. This definition language, called S, is 1059: described in this section.</P> 1060: <P> 1061: Each generic structure, which defines a class of documents or objects, is 1.2 cvs 1062: specified by a file, written in the S language, which is called a 1.1 cvs 1063: <EM>structure schema</EM>. Structure schemas are compiled into tables, called 1.2 cvs 1064: structure tables, which are used by Thot and which determine its behavior.</P> 1.1 cvs 1065: 1066: <DIV class="subsection"> 1.6 cvs 1067: <H3><A name=sectc321>Writing Conventions</A></H3> 1.1 cvs 1068: 1069: <P> 1070: The grammar of S, like those of the languages P and T presented later, is 1071: described using the meta-language M, derived from the Backus-Naur Form 1072: (BNF).</P> 1073: <P> 1074: In this meta-language each rule of the grammar is composed of a grammar symbol 1075: followed by an equals sign (`=') and the right part of the rule. The equals 1076: sign plays the same role as the traditional `::=' of BNF: it indicates that 1077: the right part defines the symbol of the left part. In the right part,</P> 1078: <DL> 1079: <DT>concatenation</DT> 1080: <DD>is shown by the juxtaposition of symbols; 1081: </DD> 1082: <DT>character strings</DT> 1.2 cvs 1083: <DD>between apostrophes ' represent terminal symbols, that is, keywords in the 1084: language defined. Keywords are written here in upper-case letters, but can be 1085: written in any combination of upper and lower-case letters. For example, the 1086: keyword <TT>DEFPRES</TT> of S can also be written as <TT>defpres</TT> or 1087: <TT>DefPres</TT>. 1.1 cvs 1088: </DD> 1089: <DT>material between brackets</DT> 1090: <DD>(`[' and `]') is optional; 1091: </DD> 1092: <DT>material between angle brackets</DT> 1.2 cvs 1093: <DD>(`<' and `>') can be repeated many times or omitted; 1.1 cvs 1094: </DD> 1095: <DT>the slash</DT> 1.2 cvs 1096: <DD>(`/') indicates an alternative, a choice between the options separated by 1.1 cvs 1097: the slash character; 1098: </DD> 1099: <DT>the period</DT> 1100: <DD>marks the end of a rule; 1101: </DD> 1102: <DT>text between braces</DT> 1103: <DD>(`{' and `}') is simply a comment. 1104: </DD> 1105: </DL> 1106: <P> 1107: The M meta-language also uses the concepts of identifiers, strings, and 1108: integers:</P> 1109: <DL> 1110: <DT><TT>NAME</TT></DT> 1.2 cvs 1111: <DD>represents an identifier, a sequence of letters (upper or lower-case), 1112: digits, and underline characters (`_'), beginning with a letter. Also 1113: considered a letter is the sequence of characters `<TT>\nnn</TT>' where the 1.5 cvs 1114: letter <TT>n</TT> represents the ISO Latin-1 code of the letter in octal. It 1.2 cvs 1115: is thus possible to use accented letters in identifiers. The maximum length 1116: of identifiers is fixed by the compiler. It is normally 31 characters. 1.1 cvs 1117: <P> 1118: Unlike keywords, upper and lower-case letters are distinct in identifiers. 1119: Thus, <TT>Title</TT>, <TT>TITLE</TT>, and <TT>title</TT> are considered 1120: different identifiers.</P> 1121: </DD> 1122: <DT><TT>STRING</TT></DT> 1.2 cvs 1123: <DD>represents a string. This is a string of characters delimited by 1124: apostrophes. If an apostrophe must appear in a string, it is doubled. As 1125: with identifiers, strings can contain characters represented by their octal 1126: code (after a backslash). As with apostrophes, if a backslash must appear in 1127: a string, it is doubled. 1.1 cvs 1128: </DD> 1129: <DT><TT>NUMBER</TT></DT> 1.2 cvs 1130: <DD>represents a positive integer or zero (without a sign), or said another 1.1 cvs 1131: way, a sequence of decimal digits. 1132: </DD> 1133: </DL> 1134: <P> 1135: The M language can be used to define itself as follows:</P> 1136: <PRE> 1137: { Any text between braces is a comment. } 1138: Grammar = Rule < Rule > 'END' . 1139: { The < and > signs indicate zero } 1140: { or more repetitions. } 1141: { END marks the end of the grammar. } 1142: Rule = Ident '=' RightPart '.' . 1143: { The period indicates the end of a rule } 1144: RightPart = RtTerminal / RtIntermed . 1145: { The slash indicates a choice } 1146: RtTerminal ='NAME' / 'STRING' / 'NUMBER' . 1147: { Right part of a terminal rule } 1148: RtIntermed = Possibility < '/' Possibility > . 1149: { Right part of an intermediate rule } 1150: Possibility = ElemOpt < ElemOpt > . 1151: ElemOpt = Element / '[' Element < Element > ']' / 1152: '<' Element < Element > '>' . 1153: { Brackets delimit optional parts } 1154: Element = Ident / KeyWord . 1155: Ident = NAME . 1156: { Identifier, sequence of characters } 1157: KeyWord = STRING . 1158: { Character string delimited by apostrophes } 1159: END 1160: </PRE> 1161: </DIV> 1162: 1163: <DIV class="subsection"> 1.6 cvs 1164: <H3><A name=sectc322>Extension schemas</A></H3> 1.1 cvs 1165: 1166: <P> 1167: A structure schema defines the generic logical structure of a class of 1168: documents or objects, independent of the operations which can be performed on 1169: the documents. However, certain applications may require particular 1170: information to be represented by the structure for the documents that they 1171: operate on. Thus a document version manager will need to indicate in the 1172: document the parts which belong to one version or another. An indexing system 1173: will add highly-structured index tables as well as the links between these 1174: tables and the rest of the document.</P> 1175: <P> 1.2 cvs 1176: Thus, many applications need to extend the generic structure of the documents 1177: on which they operate to introduce new attributes, associated elements or 1.1 cvs 1178: element types. These additions are specific to each application and must be 1179: able to be applied to any generic structure: users will want to manage 1180: versions or construct indices for many types of documents. Extension schemas 1181: fulfill this role: they define attributes, elements, associated elements, 1182: units, etc., but they can only be used jointly with a structure schema that 1183: they complete. Otherwise, structure schemas can always be used without these 1184: extensions when the corresponding applications are not available.</P> 1185: </DIV> 1186: 1187: <DIV class="subsection"> 1.6 cvs 1188: <H3><A name=sectc323>The general organization of structure schemas</A></H3> 1.1 cvs 1189: 1190: <P> 1191: Every structure schema begins with the keyword <TT>STRUCTURE</TT> and ends 1192: with the keyword <TT>END</TT>. The keyword <TT>STRUCTURE</TT> is followed by 1193: the keyword <TT>EXTENSION</TT> in the case where the schema defines an 1194: extension, then by the name of the generic structure which the schema defines 1195: (the name of the document or object class). The name of the structure is 1196: followed by a semicolon.</P> 1197: <P> 1198: In the case of a complete schema (that is, a schema which is not an 1199: extension), the definition of the name of the structure is followed by the 1200: declarations of the default presentation schema, the global attributes, the 1201: parameters, the structure rules, the associated elements, the units, the 1202: skeleton elements and the exceptions. Only the definition of the structure 1203: rules is required. Each series of declarations begins with a keyword: 1204: <TT>DEFPRES</TT>, <TT>ATTR</TT>, <TT>PARAM</TT>, <TT>STRUCT</TT>, 1205: <TT>ASSOC</TT>, <TT>UNITS</TT>, <TT>EXPORT</TT>, <TT>EXCEPT</TT>.</P> 1206: <P> 1207: In the case of an extension schema, there are neither parameters nor skeleton 1208: elements and the <TT>STRUCT</TT> section is optional, while that section is 1209: required in a schema that is not an extension. On the other hand, extension 1210: schemas can contain an <TT>EXTENS</TT> section, which must not appear in a 1211: schema which is not an extension; this section defines the complements to 1212: attach to the rules found in the schema to which the extension will be added. 1213: The sections <TT>ATTR</TT>, <TT>STRUCT</TT>, <TT>ASSOC</TT>, and 1214: <TT>UNITS</TT> define new attributes, new elements, new associated elements, 1215: and new units which add their definitions to the principal schema.</P> 1216: <PRE> 1217: StructSchema ='STRUCTURE' ElemID ';' 1218: 'DEFPRES' PresID ';' 1219: [ 'ATTR' AttrSeq ] 1220: [ 'PARAM' RulesSeq ] 1221: 'STRUCT' RulesSeq 1222: [ 'ASSOC' RulesSeq ] 1223: [ 'UNITS' RulesSeq ] 1224: [ 'EXPORT' SkeletonSeq ] 1225: [ 'EXCEPT' ExceptSeq ] 1226: 'END' . 1227: ElemID = NAME . 1228: </PRE> 1229: <P> 1230: or</P> 1231: <PRE> 1232: ExtensSchema ='STRUCTURE' 'EXTENSION' ElemID ';' 1233: 'DEFPRES' PresID ';' 1234: [ 'ATTR' AttrSeq ] 1235: [ 'STRUCT' RulesSeq ] 1236: [ 'EXTENS' ExtensRuleSeq ] 1237: [ 'ASSOC' RulesSeq ] 1238: [ 'UNITS' RulesSeq ] 1239: [ 'EXCEPT' ExceptSeq ] 1240: 'END' . 1241: ElemID = NAME . 1242: </PRE> 1243: </DIV> 1244: 1245: <DIV class="subsection"> 1.6 cvs 1246: <H3><A name=sectc324>The default presentation</A></H3> 1.1 cvs 1247: 1248: <P> 1249: It was shown <A href="#mulpres">above</A> that many different presentations 1250: are possible for documents and objects of the same class. The structure 1251: schema defines a preferred presentation for the class, called the <EM>default 1252: presentation</EM>. Like generic structures, presentations are described by 1253: programs, called <EM>presentation schemas</EM>, which are written in a 1.6 cvs 1254: specific language, P, presented <A href="#sectb42">later</A> in this document. 1.1 cvs 1255: The name appearing after the keyword <TT>DEFPRES</TT> is the name of the 1.2 cvs 1256: default presentation schema. When a new document is created, Thot will use 1257: this presentation schema by default, but the user remains free to choose 1.5 cvs 1258: another if s/he wishes.</P> 1.1 cvs 1259: <PRE> 1260: PresID = NAME . 1261: </PRE> 1262: </DIV> 1263: 1264: <DIV class="subsection"> 1.6 cvs 1265: <H3><A name=sectc325>Global Attributes</A></H3> 1.1 cvs 1266: 1267: <P> 1268: If the generic structure includes global attributes of its own, they are 1269: declared after the keyword <TT>ATTR</TT>. Each global attribute is defined by 1270: its name, followed by an equals sign and the definition of its type. The 1271: declaration of a global attribute is terminated by a semi-colon.</P> 1272: <P> 1273: For attributes of the numeric, textual, or reference types, the type is 1274: indicated by a keyword, <TT>INTEGER</TT>, <TT>TEXT</TT>, or <TT>REFERENCE</TT> 1275: respectively.</P> 1276: <P> 1277: In the case of a reference attribute, the keyword <TT>REFERENCE</TT> is 1278: followed by the type of the referenced element in parentheses. It can refer 1279: to any type at all, specified by using the keyword <TT>ANY</TT>, or to a 1280: specific type. In the latter case, the element type designated by the 1.6 cvs 1281: reference can be defined either in the <A href="#sectc327"><TT>STRUCT</TT> 1.1 cvs 1282: section</A> of the same structure schema or in the <TT>STRUCT</TT> section of 1283: another structure schema. When the type is defined in another schema, the 1284: element type is followed by the name of the structure schema (within 1285: parentheses) in which it is defined. The name of the designated element type 1286: can be preceded by the keyword <TT>First</TT> or <TT>Second</TT>, but only in 1.6 cvs 1287: the case where the type is defined as <A href="#sectd3285">a pair</A>. These 1.1 cvs 1288: keywords indicate whether the attribute must designate the first mark of the 1289: pair or the second. If the reference refers to a pair and neither of these 1290: two keywords is present, then the first mark is used.</P> 1291: <P> 1292: In the case of an enumeration attribute, the equals sign is followed by the 1293: list of names representing the possible values of the attribute, the names 1294: being separated from each other by commas. An enumeration attribute has at 1295: least one possible value; the maximum number of values is defined by the 1296: compiler for the S language.</P> 1297: <PRE> 1298: AttrSeq = Attribute < Attribute > . 1299: Attribute = AttrID '=' AttrType ';' . 1300: AttrType = 'INTEGER' / 'TEXT' / 1301: 'REFERENCE' '(' RefType ')' / 1302: ValueSeq . 1303: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] . 1304: FirstSec = 'First' / 'Second' . 1305: ExtStruct = '(' ElemID ')' . 1306: ValueSeq = AttrVal < ',' AttrVal > . 1307: AttrID = NAME . 1308: AttrVal = NAME . 1309: </PRE> 1310: <P> 1311: There is a predefined global text attribute, the <EM>language</EM>, which is 1.2 cvs 1312: automatically added to every Thot structure schema. This attribute allows 1313: Thot to perform certain actions, such as hyphenation and spell-checking, which 1314: cannot be performed without knowing the language in which each part of the 1315: document is written. This attribute can be used just like any explicitly 1.1 cvs 1316: declared attribute: the system acts as if every structure schema contains</P> 1317: <PRE> 1318: ATTR 1319: Language = TEXT; 1320: </PRE> 1321: <BLOCKQUOTE class="example"> 1322: <P> 1323: <STRONG>Example:</STRONG></P> 1324: <P> 1.2 cvs 1325: The following specification defines the global enumeration attribute 1326: WordType.</P> 1.1 cvs 1327: <PRE> 1328: ATTR 1.6 cvs 1329: WordType = Definition, IndexWord, DocumentTitle; 1.1 cvs 1330: </PRE> 1331: </BLOCKQUOTE> 1332: </DIV> 1333: 1334: <DIV class="subsection"> 1.6 cvs 1335: <H3><A name=sectc326>Parameters</A></H3> 1.1 cvs 1336: 1337: <P> 1338: A parameter is a document element which can appear many times in the document, 1339: but always has the same value. This value can only be modified in a 1340: controlled way by certain applications. For example, in an advertising 1341: circular, the name of the recipient may appear in the address part and in the 1342: text of the circular. If the recipient's name were a parameter, it might only 1343: be able to be changed by a ``mail-merge'' application.</P> 1344: <P> 1345: Parameters are not needed for every document class, but if the schema includes 1346: parameters they are declared after the keyword <TT>PARAM</TT>. Each parameter 1.6 cvs 1347: declaration is made in the same way as a <A href="#sectc327">structure 1.1 cvs 1348: element declaration</A>.</P> 1349: <P> 1350: During editing, Thot permits the insertion of parameters wherever the 1351: structure schema allows; it also permits the removal of parameters which are 1352: already in the document but does not allow the modification of the parameter's 1.2 cvs 1353: content in any way. The content is generated automatically by Thot during the 1354: creation of the parameter, based on the value of the parameter in the 1355: document.</P> 1.1 cvs 1356: </DIV> 1357: 1358: <DIV class="subsection"> 1.6 cvs 1359: <H3><A name=sectc327>Structured elements</A></H3> 1.1 cvs 1360: 1361: <P> 1362: The rules for defining structured elements are required, except in an 1363: extension schema: they constitute the core of a structure schema, since they 1364: define the structure of the different types of elements that occur in a 1365: document or object of the class defined by the schema.</P> 1366: <P> 1367: The first structure rule after the keyword <TT>STRUCT</TT> must define the 1368: structure of the class whose name appears in the first instruction 1369: (<TT>STRUCTURE</TT>) of the schema. This is the root rule of the schema, 1370: defining the root of the document tree or object tree.</P> 1371: <P> 1372: The remaining rules may be placed in any order, since the language permits the 1373: definition of element types before or after their use, or even in the same 1374: instruction in which they are used. This last case allows the definition of 1375: recursive structures.</P> 1376: <P> 1377: Each rule is composed of a name (the name of the element type whose structure 1378: is being defined) followed by an equals sign and a structure definition.</P> 1379: <P> 1380: If any local attributes are associated with the element type defined by the 1.2 cvs 1381: rule, they appear between parentheses after the type name and before the 1382: equals sign. The parentheses contain, first, the keyword <TT>ATTR</TT>, then 1383: the list of local attributes, separated by commas. Each local attribute is 1384: composed of the name of the attribute followed by an equals sign and the 1385: definition of the attribute's type, just as in the definition of <A 1.6 cvs 1386: href="#sectc325">global attributes</A>. The name of the attribute can be 1.2 cvs 1387: preceded by an exclamation point to indicate that the attribute must always be 1388: present for this element type. The same attribute, identified by its name, 1389: can be defined as a local attribute for multiple element types. In this 1390: case, the equals sign and definition of the attribute type need only appear in 1391: the first occurrence of the attribute. It should be noted that global 1392: attributes cannot also be defined as local attributes.</P> 1.1 cvs 1393: <P> 1.6 cvs 1394: If any <A href="#sectd3135">extensions</A> are defined for this 1.1 cvs 1395: element type, a plus sign follows the structure definition and the names of 1396: the extension element types appear between parentheses after the plus. If 1397: there are multiple extensions, they are separated by commas. These types can 1398: either be defined in the same schema, defined in other schemas, or they may be 1399: base types identified by the keywords <TT>TEXT</TT>, <TT>GRAPHICS</TT>, 1400: <TT>SYMBOL</TT>, or <TT>PICTURE</TT>.</P> 1401: <P> 1.6 cvs 1402: <A href="#sectd3135">Restrictions</A> are indicated in the same 1.1 cvs 1403: manner as extensions, but they are introduced by a minus sign and they come 1404: after the extensions, or if there are no extensions, after the structure 1405: definition.</P> 1406: <P> 1407: If the values of attributes must be attached systematically to this element 1408: type, they are introduced by the keyword <TT>WITH</TT> and declared in the 1409: form of a list of fixed-value attributes. When such definitions of fixed 1410: attribute values appear, they are always the last part of the rule.</P> 1411: <P> 1412: The rule is terminated by a semicolon.</P> 1413: <PRE> 1414: RuleSeq = Rule < Rule > . 1415: Rule = ElemID [ LocAttrSeq ] '=' DefWithAttr ';'. 1416: LocAttrSeq = '(' 'ATTR' LocAttr < ';' LocAttr > ')' . 1417: LocAttr = [ '!' ] AttrID [ '=' AttrType ] . 1418: DefWithAttr = Definition 1419: [ '+' '(' ExtensionSeq ')' ] 1420: [ '-' '(' RestrictSeq ')' ] 1421: [ 'WITH' FixedAttrSeq ] . 1422: ExtensionSeq = ExtensionElem < ',' ExtensionElem > . 1423: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' / 1424: 'SYMBOL' / 'PICTURE' . 1425: RestrictSeq = RestrictElem < ',' RestrictElem > . 1426: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' / 1427: 'SYMBOL' / 'PICTURE' . 1428: </PRE> 1429: <P> 1430: The list of fixed-value attributes is composed of a sequence of 1431: attribute-value pairs separated by commas. Each pair contains the name of the 1432: attribute and the fixed value for this element type, the two being separated 1433: by an equals sign. If the sign is preceded by a question mark the given value 1434: is only an initial value that may be modified later rather than a value fixed 1435: for all time. Reference attributes are an exception to this norm. They 1436: cannot be assigned a fixed value, but when the name of such an attribute 1437: appears this indicates that this element type must have a valid value for the 1.2 cvs 1438: attribute. For the other attribute types, the fixed value is indicated by a 1.1 cvs 1439: signed integer (numeric attributes), a character string between apostrophes 1440: (textual attributes) or the name of a value (enumeration attributes).</P> 1441: <P> 1.6 cvs 1442: Fixed-value attributes can either be <A href="#sectc325">global</A> or local 1.1 cvs 1443: to the element type for which they are fixed, but they must be declared before 1444: they are used.</P> 1445: <PRE> 1446: FixedAttrSeq = FixedAttr < ',' FixedAttr > . 1447: FixedAttr = AttrID [ FixedOrModifVal ] . 1448: FixedOrModifVal = [ '?' ] '=' FixedValue . 1449: FixedValue = [ '-' ] NumValue / TextVal / AttrVal . 1450: NumValue = NUMBER . 1451: TextVal = STRING . 1452: </PRE> 1453: </DIV> 1454: 1455: <DIV class="subsection"> 1.6 cvs 1456: <H3><A name=sectc328>Structure definitions</A></H3> 1.1 cvs 1457: 1458: <P> 1459: The structure of an element type can be a simple base type or a constructed 1460: type.</P> 1461: <P> 1462: For constructed types, it is frequently the case that similar structures 1463: appear in many places in a document. For example the contents of the 1464: abstract, of the introduction, and of a section can have the same structure, 1465: that of a sequence of paragraphs. In this case, a single, common structure 1466: can be defined (the paragraph sequence in this example), and the schema is 1467: written to indicate that each element type possesses this structure, as 1468: follows:</P> 1469: <PRE> 1470: Abstract = Paragraph_sequence; 1471: Introduction = Paragraph_sequence; 1472: Section_contents = Paragraph_sequence; 1473: </PRE> 1474: <P> 1475: The equals sign means ``has the same structure as''.</P> 1476: <P> 1477: If the element type defined is a simple base type, this is indicated by one of 1478: the keywords <TT>TEXT</TT>, <TT>GRAPHICS</TT>, <TT>SYMBOL</TT>, or 1479: <TT>PICTURE</TT>. If some local attributes must be associated with a base 1480: type, the keyword of the base type is followed by the declaration of the local 1.6 cvs 1481: attributes using the syntax <A href="#sectc327">presented above.</A></P> 1.1 cvs 1482: <P> 1483: In the case of an open choice, the type is indicated by the keyword 1.2 cvs 1484: <TT>UNIT</TT> for units or the keyword <TT>NATURE</TT> for objects having a 1485: structure defined by any other schema.</P> 1.1 cvs 1486: <P> 1487: A unit represents one of the two following categories:</P> 1488: <UL> 1.2 cvs 1489: <LI>a base type: text, graphical element, symbol, picture, 1490: <LI>an element whose type is chosen from among the types defined as units in 1.5 cvs 1491: the <TT>UNITS</TT> section of the document's structure schema. It can also be 1.6 cvs 1492: chosen from among the types defined as <A href="#sectd3132">units</A> in 1493: the <A href="#sectc3212"><TT>UNITS</TT> section</A> of the structure schemas that 1.2 cvs 1494: defines the ancestors of the element to which the rule is applied. 1.1 cvs 1495: </UL> 1496: <P> 1.2 cvs 1497: Before the creation of an element defined as a unit, Thot asks the user to 1498: choose between the categories of elements.</P> 1.1 cvs 1499: <P> 1500: Thus, the contents of a paragraph can be specified as a sequence of units, 1501: which will permit the inclusion in the paragraphs of character strings, 1502: symbols, and various elements, such as cross-references, if these are defined 1503: as units.</P> 1504: <P> 1505: A schema object (keyword <TT>NATURE</TT>) represents an object defined by a 1506: structure schema freely chosen from among the available schemas; in the case 1507: the element type is defined by the first rule (the root rule) of the chosen 1508: schema.</P> 1509: <P> 1510: If the element type defined is a constructed type, the list, aggregate, 1511: choice, and reference constructors are used. In this case the definition 1512: begins with a keyword identifying the constructor. This keyword is followed 1513: by a syntax specific to each constructor.</P> 1514: <P> 1515: The local attribute definitions appear after the name of the element type 1.6 cvs 1516: being defined, if this element type has <A href="#sectc327">local 1.1 cvs 1517: attributes</A>.</P> 1518: <PRE> 1519: Definition = BaseType [ LocAttrSeq ] / Constr / Element . 1520: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 'PICTURE' / 1521: 'UNIT' / 'NATURE' . 1522: Element = ElemID [ ExtOrDef ] . 1523: ExtOrDef = 'EXTERN' / 'INCLUDED' / 1524: [ LocAttrSeq ] '=' Definition . 1525: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF' 1526: '(' DefWithAttr ')' / 1527: 'BEGIN' DefOptSeq 'END' / 1528: 'AGGREGATE' DefOptSeq 'END' / 1529: 'CASE' 'OF' DefSeq 'END' / 1530: 'REFERENCE' '(' RefType ')' / 1531: 'PAIR' . 1532: </PRE> 1533: 1534: <DIV class="subsubsection"> 1.6 cvs 1535: <H4><A name=sectd3281>List</A></H4> 1.1 cvs 1536: 1537: <P> 1538: The list constructor permits the definition of an element type composed of a 1539: list of elements, all of the same type. A list definition begins with the 1540: <TT>LIST</TT> keyword followed by an optional range, the keyword <TT>OF</TT>, 1541: and the definition, between parentheses, of the element type which must 1542: compose the list. The optional range is composed of the minimum and maximum 1543: number of elements for the list separated by two periods and enclosed by 1544: brackets. If the range is not present, the number of list elements is 1545: unconstrained. When only one of the two bounds of the range is unconstrained, 1546: it is represented by a star ('*') character. Even when both bounds are 1547: unconstrained, they can be specified by <TT>[*..*]</TT>, but it is simpler not 1548: to specify any bound.</P> 1549: <PRE> 1550: 'LIST' [ '[' min '..' max ']' ] 1551: 'OF' '(' DefWithAttr ')' 1552: min = Integer / '*' . 1553: max = Integer / '*' . 1554: Integer = NUMBER . 1555: </PRE> 1556: <P> 1.2 cvs 1557: Before the document is edited, Thot creates the minimum number of elements for 1558: the list. If no minimum was given, it creates a single element. If a maximum 1559: number of elements is given and that number is attained, the editor refuses to 1560: create new elements for the list.</P> 1.1 cvs 1561: <BLOCKQUOTE class="example"> 1562: <P> 1563: <STRONG>Example:</STRONG></P> 1564: <P> 1.3 cvs 1565: The following two instructions define the body of a document as a sequence of 1566: at least two chapters and the contents of a section as a sequence of 1567: paragraphs. A single paragraph can be the entire contents of a section.</P> 1.1 cvs 1568: <PRE> 1569: Body = LIST [2..*] OF (Chapter); 1570: Section_contents = LIST OF (Paragraph); 1571: </PRE> 1572: </BLOCKQUOTE> 1573: </DIV> 1574: 1575: <DIV class="subsubsection"> 1.6 cvs 1576: <H4><A name=sectd3282>Aggregate</A></H4> 1.1 cvs 1577: 1578: <P> 1579: The aggregate constructor is used to define an element type as a collection of 1580: sub-elements, each having a fixed type. The collection may be ordered or 1581: unordered. The elements composing the collection are called 1582: <EM>components</EM>. In the definition of an aggregate, a keyword indicates 1583: whether or not the aggregate is ordered: <TT>BEGIN</TT> for an ordered 1584: aggregate, <TT>AGGREGATE</TT> for an unordered aggregate. This keyword is 1585: followed by the list of component type definitions which is terminated by the 1586: <TT>END</TT> keyword. The component type definitions are separated by 1587: commas.</P> 1588: <P> 1589: Before creating an aggregate, the Thot editor creates all the aggregate's 1590: components in the order they appear in the structure schema, even for 1591: unordered aggregates. However, unlike ordered aggregates, the components of 1592: an unordered aggregate may be rearranged using operations of the Thot editor. 1593: The exceptions to the rule are any components whose name was preceded by a 1594: question mark character ('?'). These components, which are optional, can be 1595: created by explicit request, possibly at the time the aggregate is created, 1596: but they are not created automatically <EM>prior</EM> to the creation of the 1597: aggregate.</P> 1598: <PRE> 1599: 'BEGIN' DefOptSeq 'END' 1600: DefOptSeq = DefOpt ';' < DefOpt ';' > . 1601: DefOpt = [ '?' ] DefWithAttr . 1602: </PRE> 1603: <BLOCKQUOTE class="example"> 1604: <P> 1605: <STRONG>Example:</STRONG></P> 1606: <P> 1.3 cvs 1607: In a bilingual document, each paragraph has an English version and a French 1608: version. In certain cases, the translator wants to add a marginal note, but 1609: this note is present in very few paragraphs. Thus, it must not be created 1610: systematically for every paragraph. A bilingual paragraph of this type is 1.1 cvs 1611: declared:</P> 1612: <PRE> 1613: Bilingual_paragraph = BEGIN 1614: French_paragraph = TEXT; 1615: English_paragraph = TEXT; 1616: ? Note = TEXT; 1617: END; 1618: </PRE> 1619: </BLOCKQUOTE> 1620: </DIV> 1621: 1622: <DIV class="subsubsection"> 1.6 cvs 1623: <H4><A name=sectd3283>Choice</A></H4> 1.1 cvs 1624: 1625: <P> 1626: The choice constructor permits the definition of an element type which is 1627: chosen from among a set of possible types. The keywords <TT>CASE</TT> and 1628: <TT>OF</TT> are followed by a list of definitions of possible types, which are 1629: separated by semicolons and terminated by the <TT>END</TT> keyword.</P> 1630: <PRE> 1631: 'CASE' 'OF' DefSeq 'END' 1632: DefSeq = DefWithAttr ';' < DefWithAttr ';' > . 1633: </PRE> 1634: <P> 1635: Before the creation of an element defined as a choice, the Thot editor 1636: presents the list of possible types for the element to the user. The user has 1.5 cvs 1637: only to select the element type that s/he wants to create from this list.</P> 1.1 cvs 1638: <P> 1639: The order of the type declarations is important. It determines the order of 1640: the list presented to the user before the creation of the element. Also, when 1641: a Choice element is being created automatically, the first type in the list is 1642: used. In fact, using the Thot editor, when an empty Choice element is 1643: selected, it is possible to select this element and to enter its text from 1644: keyboard. In this case, the editor uses the first element type which can 1645: contain an atom of the character string type.</P> 1646: <P> 1647: The two special cases of the choice constructor, the <A 1.6 cvs 1648: href="#sectc328"><EM>schema</EM></A> and the <A 1649: href="#sectc3212"><EM>unit</EM></A> are discussed elsewhere.</P> 1.1 cvs 1650: <BLOCKQUOTE class="example"> 1651: <P> 1652: <STRONG>Example:</STRONG></P> 1653: <P> 1.3 cvs 1654: It is common in documents to treat a variety of objects as if they were 1655: ordinary paragraphs. Thus, a ``Paragraph'' might actually be composed of a 1656: block of text (an ordinary paragraph), or a mathematical formula whose 1657: structure is defined by another structure schema named Math, or a table, also 1658: defined by another structure schema. Here is a definition of such a 1.1 cvs 1659: paragraph:</P> 1660: <PRE> 1661: Paragraph = CASE OF 1662: Simple_text = TEXT; 1663: Formula = Math; 1664: Table_para = Table; 1665: END; 1666: </PRE> 1667: </BLOCKQUOTE> 1668: </DIV> 1669: 1670: <DIV class="subsubsection"> 1.6 cvs 1671: <H4><A name=sectd3284>Reference</A></H4> 1.1 cvs 1672: 1673: <P> 1674: Like all elements in Thot, references are typed. An element type defined as a 1675: reference is a cross-reference to an element of some other given type. The 1676: keyword <TT>REFERENCE</TT> is followed by the name of a type enclosed in 1677: parentheses. When the type which is being cross-referenced is defined in 1678: another structure schema, the type name is itself followed by the name of the 1679: external structure schema in which it is defined.</P> 1680: <P> 1.6 cvs 1681: When the designated element type is a <A href="#sectd3285">mark pair</A>, it can 1.1 cvs 1682: be preceded by a <TT>FIRST</TT> or <TT>SECOND</TT> keyword. These keywords 1683: indicate whether the reference points to the first or second mark of the pair. 1684: If the reference points to a pair and neither of these two keywords is 1685: present, the reference is considered to point to the first mark of the 1686: pair.</P> 1687: <P> 1688: There is an exception to the principle of typed references: it is possible to 1689: define a reference which designates an element of any type, which can either 1690: be in the same document or another document. In this case, it suffices to put 1691: the keyword <TT>ANY</TT> in the parentheses which indicate the referenced 1692: element type.</P> 1693: <PRE> 1694: 'REFERENCE' '(' RefType ')' 1695: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] . 1696: </PRE> 1697: <P> 1698: When defining an inclusion, the <TT>REFERENCE</TT> keyword is not used. 1699: Inclusions with complete expansion are not declared as such in the structure 1700: schemas, since any element defined in a structure schema can be replaced by an 1701: element of the same type. Instead, inclusions without expansion or with 1702: partial expansion must be declared explicitly whenever they will include a 1703: complete object ( and not a part of an object). In this case, the object type 1704: to be included (that is, the name of its structure schema) is followed by a 1705: keyword: <TT>EXTERN</TT> for inclusion without expansion and <TT>INCLUDED</TT> 1706: for partial expansion.</P> 1707: <P> 1708: Before creating a cross-reference or an inclusion, the Thot editor asks the 1709: user to choose, from the document images displayed, the referenced or included 1710: element.</P> 1711: <BLOCKQUOTE class="example"> 1712: <P> 1713: <STRONG>Example:</STRONG></P> 1714: <P> 1.3 cvs 1715: If the types Note and Section are defined in the Article structure schema, it 1716: is possible to define, in the same structure schema, a reference to a note and 1717: a reference to a section in this manner:</P> 1.1 cvs 1718: <PRE> 1719: Ref_note = REFERENCE (Note); 1720: Ref_section = REFERENCE (Section); 1721: </PRE> 1722: <P> 1723: It is also possible to define the generic structure of a collection of 1724: articles, which include (with partial expansion) objects of the Article class 1725: and which possess an introduction which may include cross-references to 1726: sections of the included articles. In the Collection structure schema, the 1727: definitions are:</P> 1728: <PRE> 1729: Collection = BEGIN 1.6 cvs 1730: Collection_title = TEXT; 1731: Introduction = LIST OF (Elem = CASE OF 1.1 cvs 1732: TEXT; 1733: Ref_sect; 1734: END); 1.6 cvs 1735: Body = LIST OF (Article INCLUDED); 1736: END; 1737: Ref_sect = REFERENCE (Section (Article)); 1.1 cvs 1738: </PRE> 1739: <P> 1740: Here we define a Folder document class which has a title and includes 1741: documents of different types, particularly Folders:</P> 1742: <PRE> 1.6 cvs 1743: Folder = BEGIN 1744: Folder_title = TEXT; 1745: Folder_contents = LIST OF (Document); 1746: END; 1.1 cvs 1747: 1748: Document = CASE OF 1749: Article EXTERN; 1750: Collection EXTERN; 1751: Folder EXTERN; 1752: END; 1753: </PRE> 1754: <P> 1755: Under this definition, Folder represents either an aggregate which contains a 1756: folder title and the list of included documents or an included folder. To 1757: resolve this ambiguity, in the P language, the placement of a star character 1758: in front of the type name (here, Folder) indicates an included document.</P> 1759: </BLOCKQUOTE> 1760: </DIV> 1761: 1762: <DIV class="subsubsection"> 1.6 cvs 1763: <H4><A name=sectd3285>Mark pairs</A></H4> 1.1 cvs 1764: 1765: <P> 1766: Like other elements, mark pairs are typed. The two marks of the pair have the 1767: same type, but there exist two predefined subtypes which apply to all mark 1768: pairs: the first mark of the pair (called <TT>First</TT> in the P and T 1769: languages) and the second mark (called <TT>Second</TT>).</P> 1770: <P> 1771: In the S language, a mark pair is noted simply by the <TT>PAIR</TT> 1772: keyword.</P> 1773: <P> 1774: In the Thot editor, marks are always moved or destroyed together. The two 1775: marks of a pair have the same identifier, unique within the document, which 1776: permits intertwining mark pairs without risk of ambiguity.</P> 1777: </DIV> 1778: </DIV> 1779: 1780: <DIV class="subsection"> 1.6 cvs 1781: <H3><A name=sectc329>Imports</A></H3> 1.1 cvs 1782: 1783: <P> 1784: Because of schema constructors, it is possible, before editing a document, to 1785: use classes defined by other structure schemas whenever they are needed. It is 1786: also possible to assign specific document classes to certain element types. In 1787: this case, these classes are simply designated by their name. In fact, if a 1788: type name is not defined in the structure schema, it is assumed that it 1789: specifies a structure defined by another structure schema.</P> 1790: <BLOCKQUOTE class="example"> 1791: <P> 1792: <STRONG>Example:</STRONG></P> 1793: <P> 1.3 cvs 1794: If the types Math and Table don't appear in the left part of a structure rule 1795: in the schema, the following two rules indicate that a formula has the 1796: structure of an object defined by the structure schema Math and that a table 1797: element has the structure of an object defined by the Table schema.</P> 1.1 cvs 1798: <PRE> 1.6 cvs 1799: Formula = Math; 1.1 cvs 1800: Table_elem = Table; 1801: </PRE> 1802: </BLOCKQUOTE> 1803: </DIV> 1804: 1805: <DIV class="subsection"> 1.6 cvs 1806: <H3><A name=sectc3210>Extension rules</A></H3> 1.1 cvs 1807: 1808: <P> 1809: The <TT>EXTENS</TT> section, which can only appear in an extension schema, 1810: defines complements to the rules in the primary schema (i.e. the structure 1811: schema to which the extension schema will be applied). More precisely, this 1812: section permits the addition to an existing type of local attributes, 1813: extensions, restrictions and fixed-value attributes.</P> 1814: <P> 1815: These additions can be applied to the root rule of the primary schema, 1816: designated by the keyword <TT>Root</TT>, or to any other explicitly named 1817: rule.</P> 1818: <P> 1819: Extension rules are separated from each other by a semicolon and each 1.6 cvs 1820: extension rule has the same syntax as a <A href="#sectc327">structure 1.1 cvs 1821: rule</A>, but the part which defines the constructor is absent.</P> 1822: <PRE> 1823: ExtenRuleSeq = ExtensRule ';' < ExtensRule ';' > . 1.6 cvs 1824: ExtensRule = RootOrElem [ LocAttrSeq ] 1825: [ '+' '(' ExtensionSeq ')' ] 1826: [ '-' '(' RestrictSeq ')' ] 1827: [ 'WITH' FixedAttrSeq ] . 1828: RootOrElem = 'Root' / ElemID . 1.1 cvs 1829: </PRE> 1830: </DIV> 1831: 1832: <DIV class="subsection"> 1.6 cvs 1833: <H3><A name=sectc3211>Associated elements</A></H3> 1.1 cvs 1834: 1835: <P> 1836: If associated elements are necessary, they must be declared in a specific 1837: section of the structure schema, introduced by the keyword <TT>ASSOC</TT>. 1838: Each associated element type is specified like any other structured element. 1839: However, these types must not appear in any other element types of the schema, 1840: except in <TT>REFERENCE</TT> rules.</P> 1841: </DIV> 1842: 1843: <DIV class="subsection"> 1.6 cvs 1844: <H3><A name=sectc3212>Units</A></H3> 1.1 cvs 1845: 1846: <P> 1847: The <TT>UNITS</TT> section of the structure schema contains the declarations 1848: of the element types which can be used in the external objects making up parts 1849: of the document or in objects of the class defined by the schema. As with 1850: associated elements, these element types are defined just like other 1851: structured element types. They can be used in the other element types of the 1852: schema, but they can also be used in any other rule of the schema.</P> 1853: <BLOCKQUOTE class="example"> 1854: <P> 1855: <STRONG>Example:</STRONG></P> 1856: <P> 1857: If references to notes are declared as units:</P> 1858: <PRE> 1859: UNITS 1860: Ref_note = REFERENCE (Note); 1861: </PRE> 1862: <P> 1.3 cvs 1863: then it is possible to use references to notes in a cell of a table, even when 1.5 cvs 1864: <TT>Table</TT> is an external structure schema. The <TT>Table</TT> schema must 1.1 cvs 1865: declare a cell to be a sequence of units, which can then be base element types 1.6 cvs 1866: (text, for example) or references to notes in the document.</P> 1867: <PRE> 1.1 cvs 1868: Cell = LIST OF (UNITS); 1869: </PRE> 1870: </BLOCKQUOTE> 1871: </DIV> 1872: 1873: <DIV class="subsection"> 1.6 cvs 1874: <H3><A name=sectc3213>Skeleton elements</A></H3> 1.1 cvs 1875: 1876: <P> 1877: When editing a document which contains or must contain external references to 1878: several other documents, it may be necessary to load a large number of 1879: documents, simply to see the parts designated by the external references of 1880: the document while editing, or to access the source of included elements. In 1881: this case, the external documents are not modified and it is only necessary to 1882: see the elements of these documents which could be referenced. Because of 1883: this, the editor will suggest that the documents be loaded in ``skeleton'' 1884: form. This form contains only the elements of the document explicitly 1885: mentioned in the <TT>EXPORT</TT> section of their structure schema and, for 1886: these elements, only the part of the contents specified in that section. This 1887: form has the advantage of being very compact, thus requiring very few 1888: resources from the editor. This is also the skeleton form which constitutes 1889: the expanded form of <A href="#inclusion">inclusions</A> with partial 1890: expansion.</P> 1891: <P> 1892: Skeleton elements must be declared explicitly in the <TT>EXPORT</TT> section 1893: of the structure schema that defines them. This section begins with the 1894: keyword <TT>EXPORT</TT> followed by a comma-separated list of the element 1895: types which must appear in the skeleton form and ending with a semicolon. 1896: These types must have been previously declared in the schema.</P> 1897: <P> 1898: For each skeleton element type, the part of the contents which is loaded by 1899: the editor, and therefore displayable, can be specified by putting the keyword 1900: <TT>WITH</TT> and the name of the contained element type to be loaded after 1901: the name of the skeleton element type. In this case only that named element, 1902: among all the elements contained in the exportable element type, will be 1903: loaded. If the <TT>WITH</TT> is absent, the entire contents of the skeleton 1904: element will be loaded by the editor. If instead, it is better that the 1905: skeleton form not load the contents of a particular element type, the keyword 1906: <TT>WITH</TT> must be followed by the word <TT>Nothing</TT>.</P> 1907: <PRE> 1908: [ 'EXPORT' SkeletonSeq ] 1909: 1910: SkeletonSeq = SkelElem < ',' SkelElem > ';' . 1911: SkelElem = ElemID [ 'WITH' Contents ] . 1912: Contents = 'Nothing' / ElemID [ ExtStruct ] . 1913: </PRE> 1914: <BLOCKQUOTE class="example"> 1915: <P> 1916: <STRONG>Example:</STRONG></P> 1917: <P> 1.3 cvs 1918: Suppose that, in documents of the article class, the element types 1919: Article_title, Figure, Section, Paragraph, and Biblio should appear in the 1920: skeleton form in order to make it easier to create external references to them 1921: from other documents. When loading an article in its skeleton form, all of 1922: these element types will be loaded except for paragraphs, but only the article 1.5 cvs 1923: title will be loaded in its entirety. For figures, the caption will be loaded, 1.3 cvs 1924: while for sections, the title will be loaded, and for bibliographic entries, 1925: only the title that they contain will be loaded. Note that 1926: bibliographic elements are defined in another structure schema, RefBib. To 1927: produce this result, the following declarations should be placed in the 1928: Article structure schema:</P> 1.1 cvs 1929: <PRE> 1930: EXPORT 1931: Article_title, 1.5 cvs 1932: Figure With Caption, 1.1 cvs 1933: Section With Section_title, 1934: Paragraph With Nothing, 1935: Biblio With Biblio_title(RefBib); 1936: </PRE> 1937: </BLOCKQUOTE> 1938: </DIV> 1939: 1940: <DIV class="subsection"> 1.6 cvs 1941: <H3><A name=sectc3214>Exceptions</A></H3> 1.1 cvs 1942: 1943: <P> 1944: The behavior of the Thot editor and the actions that it performs are 1945: determined by the structure schemas. These actions are applied to all 1946: document and object types in accordance with their generic structure. For 1947: certain object types, such as tables and graphics, these actions are not 1948: sufficient or are poorly adapted and some special actions must be added to or 1949: substituted for certain standard actions. These special actions are called 1950: <EM>exceptions</EM>.</P> 1951: <P> 1952: Exceptions only inhibit or modify certain standard actions, but they can be 1953: used freely in every structure schema.</P> 1954: <P> 1955: Each structure schema can contain a section defining exceptions. It begins 1956: with the keyword <TT>EXCEPT</TT> and is composed of a sequence of exception 1957: declarations, separated by semicolons. Each declaration of an exception 1958: begins with the name of an element type or attribute followed by a colon. This 1959: indicates the element type or attribute to which the following exceptions 1.6 cvs 1960: apply. When the given element type name is a <A href="#sectd3285">mark pair</A>, 1.1 cvs 1961: and only in this case, the type name can be preceded by the keyword 1962: <TT>First</TT> or <TT>Second</TT>, to indicate if the exceptions which follow 1963: are associated with the first mark of the pair or the second. In the absence 1964: of this keyword, the first mark is used.</P> 1965: <P> 1.6 cvs 1966: When placed in an <A href="#sectc322">extension schema</A>, the keyword 1.1 cvs 1967: <TT>EXTERN</TT> indicates that the type name which follows is found in the 1968: principal schema (the schema being extended by the extension schema). The 1969: exceptions are indicated by a name. They are separated by semicolons.</P> 1970: <PRE> 1971: [ 'EXCEPT' ExceptSeq ] 1972: 1973: ExceptSeq = Except ';' < Except ';' > . 1974: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr 1975: ':' ExcValSeq . 1976: ExcTypeOrAttr = ElemID / AttrID . 1977: ExcValSeq = ExcValue < ',' ExcValue > . 1978: ExcValue ='NoCut' / 'NoCreate' / 1979: 'NoHMove' / 'NoVMove' / 'NoMove' / 1980: 'NoHResize' / 'NoVResize' / 'NoResize' / 1981: 'NewWidth' / 'NewHeight' / 1982: 'NewHPos' / 'NewVPos' / 1983: 'Invisible' / 'NoSelect' / 1984: 'Hidden' / 'ActiveRef' / 1985: 'ImportLine' / 'ImportParagraph' / 1986: 'NoPaginate' / 'ParagraphBreak' / 1.9 cvs 1987: 'HighlightChildren' / 'ExtendedSelection' / 1988: 'ReturnCreateNL' . 1.1 cvs 1989: </PRE> 1990: <P> 1991: The following are the available exceptions:</P> 1992: <DL> 1993: <DT><TT>NoCut</TT></DT> 1.2 cvs 1994: <DD>This exception can only be applied to element types. Elements of a type to 1995: which this exception is applied cannot be destroyed by the editor. 1.1 cvs 1996: </DD> 1997: <DT><TT>NoCreate</TT></DT> 1.2 cvs 1998: <DD>This exception can only be applied to element types. Elements of a type to 1999: which this exception is applied cannot be created by ordinary commands for 2000: creating new elements. These elements are usually created by special actions 1.1 cvs 2001: associated with otherexceptions. 2002: </DD> 2003: <DT><TT>NoHMove</TT></DT> 1.2 cvs 2004: <DD>This exception can only be applied to element types. Elements of a type to 2005: which this exception is applied cannot be moved horizontally with the mouse. 1.1 cvs 2006: </DD> 2007: <DT><TT>NoVMove</TT></DT> 1.2 cvs 2008: <DD>This exception can only be applied to element types. Elements of a type to 1.5 cvs 2009: which this exception is applied cannot be moved vertically with the mouse. 1.1 cvs 2010: </DD> 2011: <DT><TT>NoMove</TT></DT> 1.2 cvs 2012: <DD>This exception can only be applied to element types. Elements of a type to 2013: which this exception is applied cannot be moved in any direction with the 1.1 cvs 2014: mouse. 2015: </DD> 2016: <DT><TT>NoHResize</TT></DT> 1.2 cvs 2017: <DD>This exception can only be applied to element types. Elements of a type to 2018: which this exception is applied cannot be resized horizontally with the mouse. 1.1 cvs 2019: </DD> 2020: <DT><TT>NoVResize</TT></DT> 1.2 cvs 2021: <DD>This exception can only be applied to element types. Elements of a type to 2022: which this exception is applied cannot be resized vertically with the mouse. 1.1 cvs 2023: </DD> 2024: <DT><TT>NoResize</TT></DT> 1.2 cvs 2025: <DD>This exception can only be applied to element types. Elements of a type to 2026: which this exception is applied cannot be resized in any direction with the 1.1 cvs 2027: mouse. 2028: </DD> 2029: <DT><TT>NoSelect</TT></DT> 1.2 cvs 2030: <DD>This exception can only be applied to element types. Elements of a type to 2031: which this exception is applied cannot be selected directly with the mouse, but 2032: they can be selected by other methods provided by the editor. 1.1 cvs 2033: </DD> 2034: <DT><TT>NewWidth</TT></DT> 1.2 cvs 2035: <DD>This exception can only be applied to numeric attributes. If the width of 2036: an element which has this attribute is modified with the mouse, the value of 2037: the new width will be assigned to the attribute. 1.1 cvs 2038: </DD> 2039: <DT><TT>NewHeight</TT></DT> 1.2 cvs 2040: <DD>This exception can only be applied to numeric attributes. If the height of 2041: an element which has this attribute is modified with the mouse, the value of 2042: the new height will be assigned to the attribute. 1.1 cvs 2043: </DD> 2044: <DT><TT>NewHPos</TT></DT> 1.2 cvs 2045: <DD>This exception can only be applied to numeric attributes. If the 2046: horizontal position of an element which has this attribute is modified with the 2047: mouse, the value of the new horizontal position will be assigned to the 1.1 cvs 2048: attribute. 2049: </DD> 2050: <DT><TT>NewVPos</TT></DT> 1.2 cvs 2051: <DD>This exception can only be applied to numeric attributes. If the vertical 2052: position of an element which has this attribute is modified with the mouse, the 2053: value of the new vertical position will be assigned to the attribute. 1.1 cvs 2054: </DD> 2055: <DT><TT>Invisible</TT></DT> 1.2 cvs 2056: <DD>This exception can only be applied to attributes, but can be applied to all 2057: attribute types. It indicates that the attribute must not be seen by the user 2058: and that its value must not be changed directly. This exception is usually 1.5 cvs 2059: used when another exception manipulates the value of an attribute. 1.1 cvs 2060: </DD> 2061: <DT><TT>Hidden</TT></DT> 1.2 cvs 2062: <DD>This exception can only be applied to element types. It indicates that 2063: elements of this type, although present in the document's structure, must not 2064: be shown to the user of the editor. In particular, the creation menus must not 2065: propose this type and the selection message must not pick it. 1.1 cvs 2066: </DD> 2067: <DT><TT>ActiveRef</TT></DT> 1.2 cvs 2068: <DD>This exception can only be applied to attributes of the reference type. It 2069: indicates that when the user of the editor makes a double click on an element 2070: which possesses a reference attribute having this exception, the element 2071: designated by the reference attribute will be selected. 1.1 cvs 2072: </DD> 2073: <DT><TT>ImportLine</TT></DT> 1.2 cvs 2074: <DD>This exception can only be applied to element types. It indicates that 2075: elements of this type should receive the content of imported text files. An 2076: element is created for each line of the imported file. A structure schema 2077: cannot contain several exceptions <TT>ImportLine</TT> and, if it contains one, 2078: it should not contain any exception <TT>ImportParagraph</TT>. 1.1 cvs 2079: </DD> 2080: <DT><TT>ImportParagraph</TT></DT> 1.2 cvs 2081: <DD>This exception can only be applied to element types. It indicates that 2082: elements of this type should receive the content of imported text files. An 2083: element is created for each paragraph of the imported file. A paragraph is a 2084: sequence of lines without any empty line. A structure schema cannot contain 2085: several exceptions <TT>ImportParagraph</TT> and, if it contains one, it should 2086: not contain any exception <TT>ImportLine</TT>. 1.1 cvs 2087: </DD> 2088: <DT><TT>NoPaginate</TT></DT> 1.2 cvs 2089: <DD>This exception can only be applied to the root element, i.e. the name that 2090: appear after the keyword <TT>STRUCTURE</TT> at the beginning of the structure 2091: schema. It indicates that the editor should not allow the user to paginate 1.1 cvs 2092: documents of that type. 2093: </DD> 2094: <DT><TT>ParagraphBreak</TT></DT> 1.2 cvs 2095: <DD>This exception can only be applied to element types. When the caret is 2096: within an element of a type to which this exception is applied, it is that 2097: element that will be split when the user hits the Return key. 1.1 cvs 2098: </DD> 1.9 cvs 2099: <DT><TT>ReturnCreateNL</TT></DT> 2100: <DD>This exception can only be applied to element types. When the caret is 2101: within an element of a type to which this exception is applied, the Return 2102: key simply inserts a New line character (code \212) at the current position. 2103: The Return key does not create a new element; it does not split the current 2104: element either. 2105: </DD> 1.1 cvs 2106: <DT><TT>HighlightChildren</TT></DT> 1.2 cvs 2107: <DD>This exception can only be applied to element types. Elements of a type to 2108: which this exception is applied are not highlighted themselves when they are 2109: selected, but all their children are highlighted instead. 1.1 cvs 2110: </DD> 2111: <DT><TT>ExtendedSelection</TT></DT> 1.2 cvs 2112: <DD>This exception can only be applied to element types. The selection 2113: extension command (middle button of the mouse) only add the clicked element (if 2114: it has that exception) to the current selection, without selecting other 2115: elements between the current selection and the clicked element. 1.1 cvs 2116: </DD> 2117: </DL> 2118: <BLOCKQUOTE class="example"> 2119: <P> 2120: <STRONG>Example:</STRONG></P> 2121: <P> 1.3 cvs 2122: Consider a structure schema for object-style graphics which defines the 1.1 cvs 2123: Graphic_object element type with the associated Height and Weight 1.3 cvs 2124: numeric attributes. Suppose that we want documents of this class to have 2125: the following qualities:</P> 1.1 cvs 2126: <UL> 1.2 cvs 2127: <LI>Whenever the width or height of an object is changed using the mouse, the 2128: new values are stored in the object's Width and Height attributes. 2129: <LI>The user should not be able to change the values of the Width and Height 1.5 cvs 2130: attributes via the Attributes menu of the Thot editor. 1.1 cvs 2131: </UL> 2132: <P> 2133: The following exceptions will produce this effect.</P> 2134: <PRE> 2135: STRUCT 2136: ... 1.5 cvs 2137: Graphics_object (ATTR Height = Integer; Width = Integer) 1.1 cvs 2138: = GRAPHICS with Height ?= 10, Width ?= 10; 2139: ... 2140: EXCEPT 2141: Height: NewHeight, Invisible; 2142: Width: NewWidth, Invisible; 2143: </PRE> 2144: </BLOCKQUOTE> 2145: </DIV> 2146: </DIV> 2147: 2148: <DIV class="section"> 1.6 cvs 2149: <H2><A name=sectb33>Some examples</A></H2> 1.1 cvs 2150: 2151: <P> 2152: In order to illustrate the principles of the document model and the syntax of 2153: the S language, this section presents two examples of structure schemas. One 2154: defines a class of documents, the other defines a class of objects.</P> 2155: 2156: <DIV class="subsection"> 1.6 cvs 2157: <H3><A name=sectc331>A class of documents: articles</A></H3> 1.1 cvs 2158: 2159: <P> 2160: This example shows a possible structure for articles published in a journal. 2161: Text between braces is comments.</P> 2162: <PRE> 2163: STRUCTURE Article; { This schema defines the Article class } 2164: DEFPRES ArticleP; { The default presentation schema is 2165: ArticleP } 2166: ATTR { Global attribute definitions } 2167: WordType = Definition, IndexWord, DocumentTitle; 2168: { A single global attribute is defined, with three values } 2169: STRUCT { Definition of the generic structure } 2170: Article = BEGIN { The Article class has an aggregate 2171: structure } 2172: Title = BEGIN { The title is an aggregate } 2173: French_title = 2174: Text WITH Language='Fran\347ais'; 2175: English_title = 2176: Text WITH Language='English'; 2177: END; 2178: Authors = 2179: LIST OF (Author 2180: (ATTR Author_type=principal,secondary) 2181: { The Author type has a local attribute } 2182: = BEGIN 2183: Author_name = Text; 2184: Info = Paragraphs ; 2185: { Paragraphs is defined later } 2186: Address = Text; 2187: END 2188: ); 2189: Keywords = Text; 2190: { The journal's editor introduces the article 2191: with a short introduction, in French and 2192: in English } 2193: Introduction = 2194: BEGIN 2195: French_intr = Paragraphs WITH 2196: Language='Fran\347ais'; 2197: English_intr = Paragraphs WITH 2198: Language='English'; 2199: END; 2200: Body = Sections; { Sections are defined later } 2201: { Appendixes are only created on demand } 2202: ? Appendices = 2203: LIST OF (Appendix = 2204: BEGIN 2205: Appendix_Title = Text; 2206: Appendix_Contents = Paragraphs; 2207: END 2208: ); 2209: END; { End of the Article aggregate } 2210: 2211: Sections = LIST [2..*] OF ( 2212: Section = { At least 2 sections } 2213: BEGIN 2214: Section_title = Text; 2215: Section_contents = 2216: BEGIN 2217: Paragraphs; 2218: Sections; { Sections at a lower level } 2219: END; 2220: END 2221: ); 2222: 2223: Paragraphs = LIST OF (Paragraph = CASE OF 2224: Enumeration = 2225: LIST [2..*] OF 2226: (Item = Paragraphs); 2227: Isolated_formula = Formula; 2228: LIST OF (UNIT); 2229: END 2230: ); 2231: 2232: ASSOC { Associated elements definitions } 2233: 2234: Figure = BEGIN 1.5 cvs 2235: Figure_caption = Text; 1.1 cvs 2236: Illustration = NATURE; 2237: END; 2238: 2239: Biblio_citation = CASE OF 2240: Ref_Article = 2241: BEGIN 2242: Authors_Bib = Text; 2243: Article_Title = Text; 2244: Journal = Text; 2245: Page_Numbers = Text; 2246: Date = Text; 2247: END; 2248: Ref_Livre = 2249: BEGIN 2250: Authors_Bib; { Defined above } 2251: Book_Title = Text; 2252: Editor = Text; 2253: Date; { Defined above } 2254: END; 2255: END; 2256: 2257: Note = Paragraphs - (Ref_note); 2258: 2259: UNITS { Elements which can be used in objects } 2260: 2261: Ref_note = REFERENCE (Note); 2262: Ref_biblio = REFERENCE (Biblio_citation); 2263: Ref_figure = REFERENCE (Figure); 2264: Ref_formula = REFERENCE (Isolated_formula); 2265: 2266: EXPORT { Skeleton elements } 2267: 2268: Title, 1.5 cvs 2269: Figure with Figure_caption, 1.1 cvs 2270: Section With Section_title; 2271: 2272: END { End of the structure schema } 2273: </PRE> 2274: <P> 2275: This schema is very complete since it defines both paragraphs and 2276: bibliographic citations. These element types could just as well be defined in 2277: other structure schemas, as is the case with the <TT>Formula</TT> class. All 2278: sorts of other elements can be inserted into an article, since a paragraph can 2279: contain any type of unit. Similarly, figures can be any class of document or 2280: object that the user chooses.</P> 2281: <P> 2282: Generally, an article doesn't contain appendices, but it is possible to add 2283: them on explicit request: this is the effect of the question mark before the 2284: word Appendices.</P> 2285: <P> 2286: The Figure, Biblio_citation and Note elements are associated elements. Thus, 2287: they are only used in <TT>REFERENCE</TT> statements.</P> 2288: <P> 2289: Various types of cross-references can be put in paragraphs. They can also be 2290: placed the objects which are part of the article, since the cross-references 2291: are defined as units (<TT>UNITS</TT>).</P> 2292: <P> 2293: There is a single restriction to prevent the creation of Ref_note elements 2294: within notes.</P> 2295: <P> 2296: It is worth noting that the S language permits the definition of recursive 2297: structures like sections: a section can contain other sections (which are thus 2298: at the next lower level of the document tree). Paragraphs are also recursive 2299: elements, since a paragraph can contain an enumeration in which each element 2300: (<TT>Item</TT>) is composed of paragraphs.</P> 2301: </DIV> 2302: 2303: <DIV class="subsection"> 1.6 cvs 2304: <H3><A name=sectc332>A class of objects: mathematical formulas</A></H3> 1.1 cvs 2305: 2306: <P> 2307: The example below defines the <TT>Formula</TT> class which is used in Article 2308: documents. This class represents mathematical formulas with a rather simple 2309: structure, but sufficient to produce a correct rendition on the screen or 2310: printer. To support more elaborate operations (formal or numeric 2311: calculations), a finer structure should be defined. This class doesn't use any 2312: other class and doesn't define any associated elements or units.</P> 2313: <PRE> 2314: STRUCTURE Formula; 2315: DEFPRES FormulaP; 2316: 2317: ATTR 2318: String_type = Function_name, Variable_name; 2319: 2320: STRUCT 2321: Formula = Expression; 2322: Expression = LIST OF (Construction); 2323: Construction = CASE OF 2324: TEXT; { Simple character string } 2325: Index = Expression; 2326: Exponent = Expression; 2327: Fraction = 2328: BEGIN 1.6 cvs 2329: Numerator = Expression; 1.1 cvs 2330: Denominator = Expression; 2331: END; 2332: Root = 2333: BEGIN 2334: ? Order = TEXT; 2335: Root_Contents = Expression; 2336: END; 2337: Integral = 2338: BEGIN 2339: Integration_Symbol = SYMBOL; 2340: Lower_Bound = Expression; 2341: Upper_Bound = Expression; 2342: END; 2343: Triple = 2344: BEGIN 2345: Princ_Expression = Expression; 2346: Lower_Expression = Expression; 2347: Upper_Expression = Expression; 2348: END; 2349: Column = LIST [2..*] OF 2350: (Element = Expression); 2351: Parentheses_Block = 2352: BEGIN 2353: Opening = SYMBOL; 2354: Contents = Expression; 2355: Closing = SYMBOL; 2356: END; 2357: END; { End of Choice Constructor } 2358: END { End of Structure Schema } 2359: </PRE> 2360: <P> 2361: This schema defines a single global attribute which allows functions and 2362: variables to be distinguished. In the presentation schema, this attribute can 2363: be used to choose between roman (for functions) and italic characters (for 2364: variables).</P> 2365: <P> 2366: A formula's structure is that of a mathematical expression, which is itself a 2367: sequence of mathematical constructions. A mathematical construction can be 2368: either a simple character string, an index, an exponent, a fraction, a root, 2369: etc. Each of these mathematical constructions has a sensible structure which 2370: generally includes one or more expressions, thus making the formula class's 2371: structure definition recursive.</P> 2372: <P> 2373: In most cases, the roots which appear in the formulas are square roots and 2374: their order (2) is not specified. This is why the Order component is marked 2375: optional by a question mark. When explicitly requested, it is possible to add 2376: an order to a root, for example for cube roots (order = 3).</P> 2377: <P> 2378: An integral is formed by an integration symbol, chosen by the user (simple 2379: integral, double, curvilinear, etc.), and two bounds. A more fine-grained 2380: schema would add components for the integrand and the integration variable. 2381: Similarly, the Block_Parentheses construction leaves the choice of opening and 2382: closing symbols to the user. They can be brackets, braces, parentheses, 2383: etc.</P> 2384: </DIV> 2385: </DIV> 2386: <HR> 2387: </DIV> 2388: 2389: <DIV class="chapter"> 1.6 cvs 2390: <H1><A name=sect4>The P Language</A></H1> 1.1 cvs 2391: 2392: 2393: <DIV class="section"> 1.6 cvs 2394: <H2><A name=sectb41>Document presentation</A></H2> 1.1 cvs 2395: 2396: <P> 2397: Because of the model adopted for Thot, the presentation of documents is 2398: clearly separated from their structure and content. After having presented 2399: the logical structure of documents, we now detail the principles implemented 2400: for their presentation. The concept of <EM>presentation</EM> encompasses what 1.5 cvs 2401: is often called the page layout, the composition, or the document style. It 2402: is the set of operations which display the document on the screen or print 2403: it on paper. Like logical structure, document presentation is defined 2404: generically with the help of a language, called P.</P> 1.1 cvs 2405: 2406: <DIV class="subsection"> 1.6 cvs 2407: <H3><A name=sectc411>Two levels of presentation</A></H3> 1.1 cvs 2408: 2409: <P> 2410: The link between structure and presentation is clear: the logical organization 2411: of a document is used to carry out its presentation, since the purpose of the 2412: presentation is to make evident the organization of the document. But the 2413: presentation is equally dependent on the device used to render the document. 2414: Certain presentation effects, notably changes of font or character set, cannot 2415: be performed on all printers or on all screens. This is why Thot uses a 2416: two-level approach, where the presentation is first described in abstract 2417: terms, without taking into account each particular device, and then the 2418: presentation is realized within the constraints of a given device.</P> 2419: <P> 2420: Thus, presentation is only described as a function of the structure of the 2421: documents and the image that would be produced on an idealized device. For 2422: this reason, presentation descriptions do not refer to any device 2423: characteristics: they describe <EM>abstract presentations</EM> which can be 2424: concretized on different devices.</P> 2425: <P> 2426: A presentation description also defines a <EM>generic presentation</EM>, since 2427: it describes the appearance of a class of documents or objects. This generic 2428: presentation must also be applied to document and object instances, each 2429: conforming to its generic logical structure, but with all the allowances that 2430: were called to mind above: missing elements, constructed elements with other 2431: logical structures, etc.</P> 2432: <P> 2433: In order to preserve the homogeneity between documents and objects, 2434: presentation is described with a single set of tools which support the layout 2435: of a large document as well as the composition of objects like a graphical 2436: figure or mathematical formula. This unity of presentation description tools 2437: contrasts with the traditional approach, which focuses more on documents than 2438: objects and thus is based on the usual typographic conventions, such as the 2439: placement of margins, indentations, vertical spaces, line lengths, 2440: justification, font changes, etc.</P> 2441: </DIV> 2442: 2443: <DIV class="subsection"> 1.6 cvs 2444: <H3><A name=sectc412>Boxes</A></H3> 1.1 cvs 2445: 2446: <P> 2447: To assure the homogeneity of tools, all presentation in Thot, for documents as 2448: well as for the objects which they contain, is based on the notion of the 2449: <EM>box</EM>, such as was implemented in T<SUB><BIG>E</BIG></SUB>X.</P> 2450: <P> 2451: Corresponding to each element of the document is a box, which is the 2452: rectangle enclosing the element on the display device (screen or sheet of 2453: paper); the outline of this rectangle is normally not visible. The sides of 2454: the box are parallel to the sides of the screen or the sheet of paper. By way 2455: of example, a box is associated with a character string, a line of text, a 2456: page, a paragraph, a title, a mathematical formula, or a table cell.</P> 2457: <P> 2458: Whatever element it corresponds to, each box possesses four sides and four 2459: axes, which we designate as follows (<A href="#boxes">see figure</A>):</P> 2460: <DL> 2461: <DT><TT> Top</TT></DT> 2462: <DD>the upper side, 2463: </DD> 2464: <DT><TT> Bottom</TT></DT> 2465: <DD>the lower side, 2466: </DD> 2467: <DT><TT> Left</TT></DT> 2468: <DD>the left side, 2469: </DD> 2470: <DT><TT> Right</TT></DT> 2471: <DD>the right side, 2472: </DD> 2473: <DT><TT> VMiddle</TT></DT> 1.2 cvs 2474: <DD>the vertical axis passing through the center of the box, 1.1 cvs 2475: </DD> 2476: <DT><TT> HMiddle</TT></DT> 1.2 cvs 2477: <DD>the horizontal axis passing through the center of the box, 1.1 cvs 2478: </DD> 2479: <DT><TT> VRef</TT></DT> 2480: <DD>the vertical reference axis, 2481: </DD> 2482: <DT><TT> HRef</TT></DT> 2483: <DD>the horizontal reference axis. 2484: </DD> 2485: </DL> 2486: 2487: <DIV class="figure"> 2488: <HR> 2489: <PRE> 2490: Left VRef VMiddle Right 2491: : : 2492: Top ----------------------------- 2493: | : : | 2494: | : : | 2495: | : : | 2496: | : : | 2497: | : : | 2498: HMiddle ..|...........................|.. 2499: | : : | 2500: | : : | 2501: HRef ..|...........................|.. 2502: | : : | 2503: | : : | 2504: Bottom ----------------------------- 2505: : : 2506: </PRE> 2507: <P align=center> 2508: <EM><A name="boxes">The sides and axes of boxes</A><EM></EM></EM></P> 2509: <HR> 2510: </DIV> 2511: <P> 2512: The principal role of boxes is to set the extent and position of the images of 2513: the different elements of a document with respect to each other on the 2514: reproduction device. This is done by defining relations between the boxes of 2515: different elements which give relative extents and positions to these 2516: boxes.</P> 2517: <P> 2518: There are three types of boxes:</P> 2519: <UL> 2520: <LI>boxes corresponding to structural elements of the document, 2521: <LI>presentation boxes, 2522: <LI>page layout boxes. 2523: </UL> 2524: <P> 2525: <STRONG>Boxes corresponding to structural elements of the document</STRONG> 2526: are those which linked to each of the elements (base or structured) of the 2527: logical structure of the document. Such a box contains all the contents of 1.5 cvs 2528: the element to which it corresponds (there is an exception: see 1.6 cvs 2529: <A href="#sectc4220">rules <TT>VertOverflow</TT> and 1.5 cvs 2530: <TT>HorizOverflow</TT></A>). These boxes form a 1.1 cvs 2531: tree-like structure, identical to that of the structural elements to which 2532: they correspond. This tree expresses the inclusion relationships between the 2533: boxes: a box includes all the boxes of its subtree. On the other hand, there 2534: are no predefined rules for the relative positions of the included boxes. If 2535: they are at the same level, they can overlap, be contiguous, or be disjoint. 2536: The rules expressed in the generic presentation specify their relative 2537: positions.</P> 2538: <P> 2539: <STRONG>Presentation boxes</STRONG> represent elements which are not found in 2540: the logical structure of the document but which are added to meet the needs of 2541: presentation. These boxes are linked to the elements of the logical structure 2542: that are best suited to bringing them out. For example, they are used to add 2543: the character string ``Summary:'' before the summary in the presentation of a 2544: report or to represent the fraction bar in a formula, or also to make the 2545: title of a field in a form appear. These elements have no role in the logical 2546: structure of the document: the presence of a Summary element in the document 2547: does not require the creation of another structural object to hold the word 2548: ``Summary''. Similarly, if a Fraction element contains both a Numerator 2549: element and a Denominator element, the fraction bar has no purpose 2550: structurally. On the other hand, these elements of the presentation are 2551: important for the reader of the reproduced document or for the user of an 2552: editor. This is why they must appear in the document's image. It is the 2553: generic presentation which specifies the presentation boxes to add by 2554: indicating their content (a base element for which the value is specified) and 2555: the position that they must take in the tree of boxes. During editing, these 2556: boxes cannot be modified by the user.</P> 2557: <P> 2558: <STRONG>Page layout boxes</STRONG> are boxes created implicitly by the page 2559: layout rules. These rules indicate how the contents of a structured element 2560: must be broken into lines and pages. In contrast to presentation boxes, these 2561: line and page boxes do not depend on the logical structure of the document, 1.5 cvs 2562: but rather on the physical constraints of the output devices: character 1.1 cvs 2563: size, height and width of the window on the screen or of the sheet of 2564: paper.</P> 2565: </DIV> 2566: 2567: <DIV class="subsection"> 1.6 cvs 2568: <H3><A name=sectc413>Views and visibility</A></H3> 1.1 cvs 2569: 2570: <P> 2571: One of the operations that one might wish to perform on a document is to view 2572: it is different ways. For this reason, it is possible to define several 2573: <EM>views</EM> for the same document, or better yet, for all documents of the 2574: same class. A view is not a different presentation of the document, but 2575: rather a filter which only allows the display of certain parts of the 2576: document. For example, it might be desirable to see only the titles of 2577: chapters and sections in order to be able to move rapidly through the 2578: document. Such a view could be called a ``table of contents''. It might also 2579: be desirable to see only the mathematical formulas of a document in order to 2580: avoid being distracted by the non-mathematical aspects of the document. A 2581: ``mathematics'' view could provide this service.</P> 2582: <P> 2583: Views, like presentation, are based on the generic logical structure. Each 2584: document class, and each generic presentation, can be provided with views 2585: which are particularly useful for that class or presentation. For each view, 2586: the <EM>visibility</EM> of elements is defined, indicated whether or not the 2587: elements must be presented to the user. The visibility is calculated as a 2588: function of the type of the elements or their hierarchical position in the 2589: structure of the document. Thus, for a table of contents, all the ``Chapter 2590: Title'' and ``Section Title'' elements are made visible. However, the 2591: hierarchical level could be used to make the section titles invisible below a 2592: certain threshold level. By varying this threshold, the granularity of the 2593: view can be varied. In the ``mathematics'' view, only Formula elements would 2594: be made visible, no matter what their hierarchical level.</P> 2595: <P> 2596: Because views are especially useful for producing a synthetic image of the 2597: document, it is necessary to adapt the presentation of the elements to the 2598: view in which they appear. For example, it is inappropriate to have a page 2599: break before every chapter title in the table of contents. Thus, generic 2600: presentations take into account the possible views and permit each element 2601: type's presentation to vary according the view in which its image appears.</P> 2602: <P> 2603: <A name="views">Views</A> are also used, when editing documents, to display 2604: the associated elements. So, in addition to the primary view of the document, 2605: there can be a ``notes'' view and a ``figures'' view which contain, 2606: respectively, the associated elements of the Note and Figure types. In this 2607: way, it is possible to see simultaneously the text which refers to these 2608: elements and the elements themselves, even if they will be separated when 2609: printed.</P> 2610: </DIV> 2611: 2612: <DIV class="subsection"> 1.6 cvs 2613: <H3><A name=sectc414>Pages</A></H3> 1.1 cvs 2614: 2615: <P> 2616: Presentation schemas can be defined which display the document as a long 2617: scroll, without page breaks. This type of schema is particularly well-suited 2618: to the initial phase of work on a document, where jumps from page to page 2619: would hinder composing and reading the document on a screen. In this case, 2620: the associated elements (such as notes), which are normally displayed in the 2621: page footer, are presented in a separate window. But, once the document is 2622: written, it may be desirable to display the document on the screen in the same 2623: manner in which it will be printed. So, the presentation schema must define 2624: pages.</P> 2625: <P> 2626: The P language permits the specification of the dimensions of pages as well as 2627: their composition. It is possible to generate running titles, page numbers, 2628: zones at the bottom of the page for notes, etc. The editor follows this model 2629: and inserts page break marks in the document which are used during printing, 2630: insuring that the pages on paper are the same as on the screen.</P> 2631: <P> 2632: Once a document has been edited with a presentation schema defining pages, it 2633: contains page marks. But it is always possible to edit the document using a 2634: schema without pages. In this case, the page marks are simply ignored by the 2635: editor. They are considered again as soon as a schema with pages is used. 2636: Thus, the user is free to choose between schemas with and without pages.</P> 2637: <P> 2638: Thot treats the page break, rather than the page itself, as a box. This page 2639: break box contains all the elements of one page's footer, a rule marking the 2640: edge of this page, and all the elements of the next page's header. The 2641: elements of the header and footer can be running titles, page number, 2642: associated elements (notes, for example), etc. All these elements, as well as 2643: their content and graphical appearance, are defined by the generic 2644: presentation.</P> 2645: </DIV> 2646: 2647: <DIV class="subsection"> 1.6 cvs 2648: <H3><A name=sectc415>Numbering</A></H3> 1.1 cvs 2649: 2650: <P> 2651: Many elements are numbered in documents: pages, chapters, sections, formulas, 2652: theorems, notes, figures, bibliographic references, exercises, examples, 2653: lemmas, etc. Because Thot has a notion of logical structure, all of these 2654: numbers (with the exception of pages) are redundant with information implicit 2655: in the logical structure of the document. Such numbers are simply a way to 2656: make the structure of the document more visible. So, they are part of the 2657: document's presentation and are calculated by the editor from the logical 2658: structure. The structure does not contain numbers as such; it only defines 2659: relative structural positions between elements, which serve as ordering 2660: relations on these elements.</P> 2661: <P> 2662: If the structure schema defines the body of a document as a sequence of at 2663: least two chapters:</P> 2664: <PRE> 1.6 cvs 2665: Body = LIST [2..*] OF Chapter; 1.1 cvs 2666: </PRE> 2667: <P> 1.5 cvs 2668: the sequence defined by the list constructor is ordered and each chapter can be 2669: assigned a number based on its rank in the Body list. Therefore, all elements 2670: contained in lists a the structure of a document can be numbered, but they are 2671: not the only ones. The tree structure induced by the aggregate, list, and 2672: choice constructors (excluding references) defines a total order on the 2673: elements of the document's primary structure. So, it is possible to define 2674: a numbering which uses this order, filtering elements according to their type 2675: so that only certain element types are taken into account in the numbering. In 2676: this way, it possible to number all the theorems and lemmas of a chapter in the 2677: same sequence of numbers, even when they are not part of the same list 2678: constructor and appear at different levels of the document's tree. By changing 2679: the filter, they can be numbered separately: one sequence of numbers for 2680: theorems, another for the lemmas.</P> 1.1 cvs 2681: <P> 2682: Associated elements pose a special problem, since they are not part of the 2683: document's primary structure, but are attached only by references, which 2684: violate the total order of the document. Then, these associated elements are 2685: frequently numbered, precisely because the number is an effective way to 2686: visualize the reference. In order to resolve this problem, Thot implicitly 2687: defines a list constructor for each type of associated element, gathering 2688: together (and ordering) these elements. Thus, the associated elements can be 2689: numbered by type.</P> 2690: <P> 2691: Since they are calculated from the document's logical structure and only for 2692: the needs of the presentation, numbers are presentation elements, described by 2693: presentation boxes, just like the fraction bar or the word ``Summary''. 2694: Nevertheless, numbers differ from these other boxes because their content 2695: varies from instance to instance, even though they are of the same type, 2696: whereas all fraction bars are horizontal lines and the same word ``Summary'' 2697: appears at the head of every document's summary.</P> 2698: </DIV> 2699: 2700: <DIV class="subsection"> 1.6 cvs 2701: <H3><A name=sectc416>Presentation parameters</A></H3> 1.1 cvs 2702: 2703: <P> 2704: The principal parameters which determine document presentation are the 2705: <EM>positions</EM> and <EM>dimensions</EM> of boxes, the <EM>font</EM>, the 2706: <EM>style</EM>, the <EM>size</EM>, the <EM>underlining</EM> and the 2707: <EM>color</EM> of their content. From these parameters, and some others of 2708: less importance, it is possible to represent the usual typographic parameters 2709: for the textual parts of the document. These same parameters can be used to 2710: describe the geometry of the non-textual elements, even though they are 2711: two-dimensional elements unlike the text, which is linear.</P> 2712: <P> 2713: As we have already seen, the positions of the boxes always respect the rule 2714: of enclosure: a box in the tree encloses all the boxes of the next lower level 2715: which are attached to it. The positional parameters permit the specification 2716: of the position of each box in relation to the enclosing box or to its sibling 2717: boxes (boxes directly attached to the same enclosing box in the tree of 2718: boxes).</P> 2719: <P> 2720: The presentation parameters also provide control over the dimensions of the 2721: boxes. The dimensions of a box can depend either on its content or on its 2722: context (its sibling boxes and the enclosing box). Each dimension (height or 2723: width) can be defined independently of the other.</P> 2724: <P> 2725: Because of the position and dimension parameters, it is possible to do the 2726: same things that are normally done in typography by changing margins, line 2727: lengths, and vertical or horizontal skips. This approach can also align or 2728: center elements and groups of elements.</P> 2729: <P> 2730: In contrast to the position and dimension parameters, the font, style, size, 2731: underlining, and color do not concern the box itself (the rectangle delimiting 2732: the element), but its content. These parameters indicate the typographic 2733: attributes which must be applied to the text contained in the box, and by 2734: extension, to all base elements.</P> 2735: <P> 2736: For text, the font parameter is used to change the family of characters 2737: (Times, Helvetica, Courier, etc.); the style is used to obtain italic or 2738: roman, bold or light characters; the size determines the point size of the 2739: characters; underlining defines the type and thickness of the lines drawn 2740: above, below, or through the characters.</P> 2741: <P> 2742: For graphics, the line style parameter can be either solid, dotted, or dashed; 2743: the line thickness parameter controls the width of the lines; the fill pattern 2744: parameter determines how closed geometric figures must be filled.</P> 2745: <P> 2746: While some of the parameters which determine the appearance of a box's 2747: contents make sense only for one content type (text or graphic), other 2748: parameters apply to all content types: these are the color parameters. These 2749: indicate the color of lines and the background color.</P> 2750: </DIV> 2751: </DIV> 2752: 2753: <DIV class="section"> 1.6 cvs 2754: <H2><A name=sectb42>Presentation description language</A></H2> 1.1 cvs 2755: 2756: <P> 2757: A generic presentation defines the values of presentation parameters (or the 2758: way to calculate those values) for a generic structure, or more precisely, for 2759: all the element types and all the global and local attributes defined in that 2760: generic structure. This definition of the presentation parameters is made 2761: with the P language. A program written in this language, that is a generic 2762: presentation expressed in P, is call a <EM>presentation schema</EM>. This 2763: section describes the syntax and semantics of the language, using the same <A 1.6 cvs 2764: href="#sectc321">meta-language</A> as was used for the definition of the S 1.1 cvs 2765: language.</P> 2766: <P> 2767: Recall that it is possible to write many different presentation schemas for 2768: the same class of documents or objects. This allows users to choose for a 2769: document the graphical appearance which best suits their type of work or 2770: their personal taste.</P> 2771: 2772: <DIV class="subsection"> 1.6 cvs 2773: <H3><A name=sectc421>The organization of a presentation schema</A></H3> 1.1 cvs 2774: 2775: <P> 2776: A presentation schema begins with the word <TT>PRESENTATION</TT> and ends with 2777: the word <TT>END</TT>. The word <TT>PRESENTATION</TT> is followed by the name 2778: of the generic structure to which the presentation will be applied. This name 2779: must be the same as that which follows the keyword <TT>STRUCTURE</TT> in the 2780: structure schema associated with the presentation schema.</P> 2781: <P> 2782: After this declaration of the name of the structure, the following sections 2783: appear (in order):</P> 2784: <UL> 2785: <LI>Declarations of 2786: <UL> 2787: <LI>all views, 2788: <LI>printed views, 2789: <LI>counters, 2790: <LI>presentation constants, 2791: <LI>variables, 2792: </UL> 2793: <LI>default presentation rules, 2794: <LI>presentation box and page layout box definitions, 2795: <LI>presentation rules for structured elements, 2796: <LI>presentation rules for attributes, 2797: <LI>rules for transmitting values to attributes of included documents. 2798: </UL> 2799: <P> 2800: Each of these sections is introduced by a keyword which is followed by a 2801: sequence of declarations. Every section is optional.</P> 2802: <PRE> 2803: SchemaPres ='PRESENTATION' ElemID ';' 2804: [ 'VIEWS' ViewSeq ] 2805: [ 'PRINT' PrintViewSeq ] 2806: [ 'COUNTERS' CounterSeq ] 2807: [ 'CONST' ConstSeq ] 2808: [ 'VAR' VarSeq ] 2809: [ 'DEFAULT' ViewRuleSeq ] 2810: [ 'BOXES' BoxSeq ] 2811: [ 'RULES' PresentSeq ] 2812: [ 'ATTRIBUTES' PresAttrSeq ] 2813: [ 'TRANSMIT' TransmitSeq ] 2814: 'END' . 1.6 cvs 2815: ElemID = NAME . 1.1 cvs 2816: </PRE> 2817: </DIV> 2818: 2819: <DIV class="subsection"> 1.6 cvs 2820: <H3><A name=sectc422>Views</A></H3> 1.1 cvs 2821: 2822: <P> 2823: Each of the possible views must be declared in the presentation schema. As 2824: has <A href="#views">already been described</A>, the presentation rules for an 2825: element type can vary according to the view in which the element appears. The 2826: name of the view is used to designate the view to which the presentation rules 2827: apply (see the <A href="#inkeyword"><TT>IN</TT> instruction</A>). The 2828: definition of the view's contents are dispersed throughout the presentation 2829: rules attached to the different element types and attributes. The 2830: <TT>VIEWS</TT> section is simply a sequence of view names separated by commas 2831: and terminated by a semi-colon.</P> 2832: <P> 2833: One of the view names (and only one) can be followed by the keyword 2834: <TT>EXPORT</TT>. This keyword identifies the view which presents the members 1.6 cvs 2835: of the document class in <A href="#sectc3213">skeleton form</A>. The graphical 1.1 cvs 2836: appearance and the content of this view is defined just as with other views, 2837: but it is useless to specify presentation rules concerning this view for the 2838: elements which are not loaded in the skeleton form.</P> 2839: <P> 2840: It is not necessary to declare any views; in this case there is a single 2841: unnamed view. If many views are declared, the first view listed is considered 2842: the principal view. The principal view is the one to which all rules that are 2843: not preceded by an indication of a view will apply (see the <A 2844: href="#inkeyword">instruction <TT>IN</TT></A>).</P> 2845: <P> 2846: The principal view is the the one which the editor presents on the screen when 2847: the user asks to create or edit a document. Thus, it makes sense to put the 2848: most frequently used view at the head of the list. But if the structure 1.6 cvs 2849: schema contains <A href="#sectc3213">skeleton elements</A> and is loaded in its 1.1 cvs 2850: skeleton form, the view whose name is followed by the keyword <TT>EXPORT</TT> 2851: will be opened and no other views can be opened.</P> 2852: <PRE> 1.6 cvs 2853: 'VIEWS' ViewSeq 1.1 cvs 2854: ViewSeq = ViewDeclaration 1.6 cvs 2855: < ',' ViewDeclaration > ';' . 1.1 cvs 2856: ViewDeclaration = ViewID [ 'EXPORT' ] . 2857: ViewID = NAME . 2858: </PRE> 2859: <BLOCKQUOTE class="example"> 2860: <P> 2861: <STRONG>Example:</STRONG></P> 2862: <P> 1.3 cvs 2863: When editing a report, it might be useful have views of the table of contents 2864: and of the mathematical formulas, in addition to the principal view which shows 2865: the document in its entirety. To achieve this, a presentation schema for the 2866: Report class would have the following <TT>VIEWS</TT> section:</P> 1.1 cvs 2867: <PRE> 2868: VIEWS 2869: Full_text, Table_of_contents, Formulas; 2870: </PRE> 2871: <P> 2872: The contents of these views are specified in the presentation rules of the 2873: schema.</P> 2874: </BLOCKQUOTE> 2875: </DIV> 2876: 2877: <DIV class="subsection"> 1.6 cvs 2878: <H3><A name=sectc423>Print Views</A></H3> 1.1 cvs 2879: 2880: <P> 2881: When editing a document, each view is presented in a different window. In 2882: addition to the views specified by the <TT>VIEWS</TT> instruction, the user 2883: can display the associated elements with one window for each type of 2884: associated element.</P> 2885: <P> 2886: When printing a document, it is possible to print any number of views, chosen 2887: from among all the views which the editor can display (views in the strict 2888: sense or associated elements). Print views, as well as the order in which 2889: they must be printed, are indicated by the <TT>PRINT</TT> instruction. It 2890: appears after the <TT>VIEWS</TT> instruction and is formed of the keyword 2891: <TT>PRINT</TT> followed by the ordered list of print view names. The print 2892: view names are separated by commas and followed by a semi-colon. A print view 2893: name is either a view name declared in the <TT>VIEWS</TT> instruction or the 2894: name of an associated element type (with an ``s'' added to the end). The 2895: associated element must have been declared in the <TT>ASSOC</TT> section of 2896: the structure schema.</P> 2897: <PRE> 2898: 'PRINT' PrintViewSeq 2899: PrintViewSeq = PrintView < ',' PrintView > ';' . 2900: PrintView = ViewID / ElemID . 2901: </PRE> 2902: <P> 2903: If the <TT>PRINT</TT> instruction is absent, the printing program will print 2904: only the principal view (the first view specified by the <TT>VIEWS</TT> 2905: instruction or the single, unnamed view when there is no <TT>VIEWS</TT> 2906: instruction).</P> 2907: <BLOCKQUOTE class="example"> 2908: <P> 2909: <STRONG>Example:</STRONG></P> 2910: <P> 1.3 cvs 2911: Consider a Report presentation using the view declarations from the preceding 2912: example. Suppose we want to print the full text and table of contents views, 2913: but not the Formulas view, which is only useful when editing. In addition, 2914: suppose that we also want to print the bibliographic citations, which are 2915: associated elements (of type <TT>Citation</TT>). A sensible printing order 2916: would be to print the full text then the bibliography and finally the table of 2917: contents. To obtain this result when printing, the presentation schema would 1.1 cvs 2918: say:</P> 2919: <PRE> 2920: PRINT 2921: Full_text, Citations, Table_of_contents; 2922: </PRE> 2923: </BLOCKQUOTE> 2924: </DIV> 2925: 2926: <DIV class="subsection"> 1.6 cvs 2927: <H3><A name=sectc424>Counters</A></H3> 1.1 cvs 2928: 2929: <P> 2930: A presentation has a <EM>counter</EM> for each type of number in the 2931: presentation. All counters, and therefore all types of numbers, used in the 2932: schema must be declared after the <TT>COUNTERS</TT> keyword.</P> 2933: <P> 2934: Each counter declaration is composed of a name identifying the counter 2935: followed by a colon and the counting function to be applied to the counter. 2936: The counter declaration ends with a semi-colon.</P> 2937: <P> 2938: The counting function indicates how the counter values will be calculated. 2939: Three types of counting functions are available. The first type is used to 2940: count the elements of a list or aggregate: it assigns to the counter the rank 2941: of the element in the list or aggregate. More precisely, the function</P> 2942: <PRE> 2943: RANK OF ElemID [ LevelAsc ] [ INIT AttrID ] 2944: [ 'REINIT' AttrID ] 2945: </PRE> 2946: <P> 1.5 cvs 2947: indicates that when an element creates, by a creation rule (see the <A 1.6 cvs 2948: href="#sectc4232"><TT>Create</TT> instructions</A>), a presentation box 1.5 cvs 2949: containing the counter value, this value is the rank of the creating element, 2950: if it is of type <TT>ElemID</TT>, otherwise the rank of the first element of 2951: type <TT>ElemID</TT> which encloses the creating element in the logical 1.1 cvs 2952: structure of the document.</P> 2953: <P> 2954: The type name can be preceded by a star in the special case where the 2955: structure schema defines an element of whose <TT>ElemID</TT> is the same as 1.6 cvs 2956: that of an <A href="#sectd3284">inclusion</A> without expansion or with 1.1 cvs 2957: partial expansion. To resolve this ambiguity, the <TT>ElemID</TT> alone 2958: refers to the type defined in the structure schema while the <TT>ElemID</TT> 2959: preceded by a star refers to the included type.</P> 2960: <P> 2961: The type name <TT>ElemID</TT> can be followed by an integer. That number 2962: represents the relative level, among the ancestors of the creating element, of 2963: the element whose rank is asked. If that relative level <I>n</I> is unsigned, 2964: the <I>n</I><SUP>th</SUP> element of type <TT>ElemID</TT> encountered when 2965: travelling the logical structure from the root to the creating element is 2966: taken into account. If the relative level is negative, the logical structure 2967: is travelled in the other direction, from the creating element to the 2968: root.</P> 2969: <P> 2970: The function can end with the keyword <TT>INIT</TT> followed by the name of a 2971: numeric attribute (and only a numeric attribute). Then, the rank of the first 2972: element of the list or aggregate is considered to be the value of this 2973: attribute, rather than the default value of 1, and the rank of the other 2974: elements is shifted accordingly. The attribute which determines the initial 2975: value is searched on the element itself and on its ancestors.</P> 2976: <P> 2977: The function can end with the keyword <TT>REINIT</TT> followed by the name of 2978: a numeric attribute (and only a numeric attribute). Then, if an element to be 2979: counted has this attribute, the counter value for this element is the 2980: attribute value and the following elements are numbered starting from this 2981: value.</P> 2982: <P> 2983: When the <TT>RANK</TT> function is written</P> 2984: <PRE> 2985: RANK OF Page [ ViewID ] [ INIT AttrID ] 2986: </PRE> 2987: <P> 1.5 cvs 2988: (<TT>Page</TT>is a keyword of the P language), the counter takes as its value 2989: the number of the page on which the element which creates the presentation box 2990: containing the number appears. This is done as if the pages of the document 2991: form a list for each view. The counter only takes into account the pages of 2992: the relevant view, that is the view displaying the presentation box whose 2993: contents take the value of the number. However, if the keyword <TT>Page</TT> 2994: is followed by the name of a view (between parentheses), it is the pages of 2995: that view that are taken into account. As in the preceding form, the 2996: <TT>RANK</TT> function applied to pages can end with the <TT>INIT</TT> keyword 2997: followed by the name of a numeric attribute which sets the value of the first 2998: page's number. This attribute must be a local attribute of the document 2999: itself, and not of one of its components.</P> 1.1 cvs 3000: <P> 3001: The second counting function is used to count the occurrences of a certain 3002: element type in a specified context. The instruction</P> 3003: <PRE> 3004: SET n ON Type1 ADD m ON Type2 [ INIT AttrID ] 3005: </PRE> 3006: <P> 1.5 cvs 3007: says that when the document is traversed from beginning to end (in the order 3008: induced by the logical structure), the counter is assigned the value <TT>n</TT> 3009: each time an element of type <TT>Type1</TT> is encountered, no matter 3010: what the current value of the counter, and the value <TT>m</TT> is added to the 3011: current value of the counter each time an element of type <TT>Type2</TT> is 1.1 cvs 3012: encountered.</P> 3013: <P> 3014: As with the <TT>RANK</TT> function, the type names can be preceded by a star 3015: to resolve the ambiguity of included elements.</P> 3016: <P> 3017: If the function ends with the keyword <TT>INIT</TT> followed by the name of an 3018: attribute and if the document possesses this attribute, the value of this 3019: attribute is used in place of <TT>n</TT>. The attribute must be numeric. It 3020: is searched on the element itself and on its ancestors.</P> 3021: <P> 3022: This function can also be used with the <TT>Page</TT> keyword in the place of 3023: <TT>Type1</TT> or <TT>Type2</TT>. In the first case, the counter is 3024: reinitialized on each page with the value <TT>n</TT>, while in the second 3025: case, it is incremented by <TT>m</TT> on each page. As with the preceding 3026: counting function, the word <TT>Page</TT> can be followed by a name between 3027: parentheses. In this case, the name specifies a view whose pages are taken 3028: into account.</P> 3029: <P> 3030: The definition of a counter can contain several <TT>SET</TT> functions and 3031: several <TT>ADD</TT> functions, each with a different value. The total number 3032: of counting functions must not be greater than 6.</P> 3033: <P> 3034: The third counting function is used to count the elements of a certain type 3035: encountered when travelling from the creating element to the root of the 3036: logical structure. The creating element is included if it is of that type. 3037: That function is written</P> 3038: <PRE> 3039: RLEVEL OF Type 3040: </PRE> 3041: <P> 1.5 cvs 3042: where <TT>Type</TT> represents the type of the elements to be counted.</P> 1.1 cvs 3043: <P> 3044: The formal definition of counter declarations is:</P> 3045: <PRE> 3046: 'COUNTERS' CounterSeq 3047: CounterSeq = Counter < Counter > . 3048: Counter = CounterID ':' CounterFunc ';' . 3049: CounterID = NAME . 3050: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ] 3051: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] / 3052: SetFunction < SetFunction > 3053: AddFunction < AddFunction > 3054: [ 'INIT' AttrID ] / 3055: 'RLEVEL' 'OF' ElemID . 3056: SLevelAsc = [ '-' ] LevelAsc . 3057: LevelAsc = NUMBER . 3058: SetFunction = 'SET' CounterValue 'ON' TypeOrPage . 3059: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . 3060: TypeOrPage = 'Page' [ '(' ViewID ')' ] / 3061: [ '*' ] ElemID . 3062: CounterValue = NUMBER . 3063: </PRE> 3064: <BLOCKQUOTE class="example"> 3065: <P> 3066: <STRONG>Example:</STRONG></P> 3067: <P> 1.3 cvs 3068: If the body of a chapter is defined as a sequence of sections in the structure 1.1 cvs 3069: schema:</P> 3070: <PRE> 3071: Chapter_body = LIST OF (Section = 3072: BEGIN 3073: Section_Title = Text; 3074: Section_Body = Paragraphs; 3075: END 3076: ); 3077: </PRE> 3078: <P> 3079: the section counter is declared:</P> 3080: <PRE> 3081: SectionCtr : RANK OF Section; 3082: </PRE> 3083: <P> 1.4 cvs 3084: and the display of the section number before the section title is obtained by a 1.6 cvs 3085: <A href="#sectc4232"><TT>CreateBefore</TT> rule</A> attached the 1.4 cvs 3086: <TT>Section_Title</TT> type, which creates a presentation box whose content is 3087: the value of the <TT>SectionCtr</TT> counter (see the <A 1.6 cvs 3088: href="#sectc4231"><TT>Content</TT> instruction</A>).</P> 1.1 cvs 3089: <P> 3090: In order to number the formulas separately within each chapter, the formula 3091: counter is declared:</P> 3092: <PRE> 3093: FormulaCtr : SET 0 ON Chapter ADD 1 ON Formula; 3094: </PRE> 3095: <P> 1.4 cvs 3096: and the display of the formula number in the right margin, alongside each 3097: formula, is obtained by a <TT>CreateAfter</TT> instruction attached to the 3098: <TT>Formula</TT> type, which creates a presentation box whose content is the 3099: value of the <TT>FormulaCtr</TT> counter.</P> 1.1 cvs 3100: <P> 3101: To number the page chapter by chapter, with the first page of each chapter 3102: having the number 1, the counter definition would be</P> 3103: <PRE> 3104: ChapterPageCtr : SET 0 ON Chapter ADD 1 ON Page; 3105: </PRE> 3106: <P> 3107: If there is also a chapter counter</P> 3108: <PRE> 3109: ChapterCtr : RANK OF Chapter; 3110: </PRE> 3111: <P> 1.6 cvs 3112: the <A href="#sectc4231">content</A> of a presentation box created at the top of 1.1 cvs 3113: each page could be defined as:</P> 3114: <PRE> 3115: Content : (VALUE(ChapterCtr, URoman) TEXT '-' 3116: VALUE(ChapterPageCtr, Arabic)); 3117: </PRE> 3118: <P> 1.5 cvs 3119: Thus, the presentation box contains the number of the chapter in upper-case 1.4 cvs 3120: roman numerals followed by a hyphen and the number of the page within 3121: the chapter in arabic numerals.</P> 1.1 cvs 3122: </BLOCKQUOTE> 3123: <BLOCKQUOTE class="example"> 3124: <P> 3125: <STRONG>Example:</STRONG></P> 3126: <P> 1.3 cvs 3127: To count tables and figures together in a document of the chapter type, a 1.1 cvs 3128: counter could be defined using:</P> 3129: <PRE> 3130: CommonCtr : SET 0 ON Chapter ADD 1 ON Table 3131: ADD 1 ON Figure; 3132: </PRE> 3133: </BLOCKQUOTE> 3134: </DIV> 3135: 3136: <DIV class="subsection"> 1.6 cvs 3137: <H3><A name=sectc425>Presentation constants</A></H3> 1.1 cvs 3138: 3139: <P> 3140: Presentation constants are used in the definition of the content of 1.6 cvs 3141: presentation boxes. This content is used in <A href="#sectc426">variable 3142: definitions</A> and in the <A href="#sectc4231"><TT>Content</TT> rule</A>. The 1.1 cvs 3143: only presentation constants which can be used are character strings, 1.2 cvs 3144: mathematical symbols, graphical elements, and pictures, that is to say, base 1.1 cvs 3145: elements.</P> 3146: <P> 3147: Constants can be defined directly in the variables or presentation boxes 3148: (<TT>Content</TT> rule) which use them. But it is only necessary them to 3149: declare once, in the constant declaration section, even though they are used 3150: in many variables or boxes. Thus, each declared constant has a name, which 3151: allows it to be designated whenever it is used, a type (one of the four base 3152: types) and a value (a character string or a single character for mathematical 3153: symbols and graphical elements).</P> 3154: <P> 3155: The constant declarations appear after the keyword <TT>CONST</TT>. Each 3156: declaration is composed of the name of the constant, an equals sign, a keyword 3157: representing its type (<TT>Text</TT>, <TT>Symbol</TT>, <TT>Graphics</TT> or 3158: <TT>Picture</TT>) and the string representing its value. A semi-colon 3159: terminates each declaration.</P> 3160: <P> 3161: In the case of a character string, the keyword <TT>Text</TT> can be followed 3162: by the name of an alphabet (for example, <TT>Greek</TT> or <TT>Latin</TT>) in 3163: which the constant's text should be expressed. If the alphabet name is 3164: absent, the Latin alphabet is used. When the alphabet name is present, only 3165: the first letter of the alphabet name is interpreted. Thus, the words 3166: <TT>Greek</TT> and <TT>Grec</TT> designate the same alphabet. In current 3167: versions of Thot, only the Greek and Latin alphabets are available.</P> 3168: <PRE> 3169: 'CONST' ConstSeq 3170: ConstSeq = Const < Const > . 3171: Const = ConstID '=' ConstType ConstValue ';' . 3172: ConstID = NAME . 3173: ConstType ='Text' [ Alphabet ] / 'Symbol' / 3174: 'Graphics' / 'Picture' . 3175: ConstValue = STRING . 3176: Alphabet = NAME . 3177: </PRE> 3178: <P> 1.5 cvs 3179: For character strings in the Latin alphabet (ISO Latin-1 character set), 1.1 cvs 3180: characters having codes higher than 127 (decimal) are represented by their 3181: code in octal.</P> 3182: <P> 3183: In the case of a symbol or graphical element, the value only contains a single 3184: character, between apostrophes, which indicates the form of the element which 3185: must be drawn in the box whose content is the constant. The symbol or 3186: graphical element takes the dimensions of the box, which are determined by the 1.6 cvs 3187: <TT>Height</TT> and <TT>Width</TT> rules. See <A href="#sectb72">table of 1.1 cvs 3188: codes</A> for the symbols and graphical elements.</P> 3189: <BLOCKQUOTE class="example"> 3190: <P> 3191: <STRONG>Example:</STRONG></P> 3192: <P> 1.3 cvs 3193: The constants ``Summary:'' and fraction bar, which were described earlier, are 1.1 cvs 3194: declared:</P> 3195: <PRE> 3196: CONST 3197: SummaryConst = Text 'Summary:'; 3198: Bar = Graphics 'h'; 3199: </PRE> 3200: </BLOCKQUOTE> 3201: </DIV> 3202: 3203: <DIV class="subsection"> 1.6 cvs 3204: <H3><A name=sectc426>Variables</A></H3> 1.1 cvs 3205: 3206: <P> 3207: Variables permit the definition of computed content for presentation boxes. A 3208: variable is associated with a presentation box by a <TT>Content</TT> rule; but 3209: before being used in a <TT>Content</TT> rule, a variable can be defined in the 3210: <TT>VAR</TT> section. It is also possible to define a variable at the time of 3211: its use in a <TT>Content</TT> rule, as can be done with a constant.</P> 3212: <P> 3213: A variable has a name and a value which is a character string resulting from 3214: the concatenation of the values of a sequence of functions. Each variable 3215: declaration is composed of the variable name followed by a colon and the 3216: sequence of functions which produces its value, separated by spaces. Each 3217: declaration is terminated by a semi-colon.</P> 3218: <PRE> 3219: 'VAR' VarSeq 3220: VarSeq = Variable < Variable > . 3221: Variable = VarID ':' FunctionSeq ';' . 3222: VarID = NAME . 3223: FunctionSeq = Function < Function > . 3224: </PRE> 3225: <P> 3226: Several functions are available. The first two return, in the form of a 3227: character string, the current date. <TT>DATE</TT> returns the date in 3228: English, while <TT>FDATE</TT> returns the date in french.</P> 3229: <P> 3230: Two other functions, <TT>DocName</TT> and <TT>DirName</TT>, return the 3231: document name and the directory where the document is stored.</P> 3232: <P> 3233: Function <TT>ElemName</TT> returns the type of the element which created the 3234: presentation box whose contents are the variable.</P> 3235: <P> 3236: Another function simply returns the value of a presentation constant. For any 3237: constant declared in the <TT>CONST</TT> section, it is sufficient to give the 3238: name of the constant. Otherwise, the type and value of the constant must be 1.6 cvs 3239: given, using the same form as in a <A href="#sectc425">constant 1.1 cvs 3240: declaration</A>. If the constant is not of type text, (types <TT>Symbol</TT>, 3241: <TT>Graphics</TT> or <TT>Picture</TT>), it must be alone in the variable 3242: definition; only constants of type <TT>Text</TT> can be mixed with other 3243: functions.</P> 3244: <P> 3245: It is also possible to obtain the value of an attribute, simply by mentioning 3246: the attribute's name. The value of this function is the value of the 3247: attribute for the element which created the presentation box whose contents 3248: are the variable. If the creating element does not have the indicated 3249: attribute, the value is an empty string. In the case of a numeric attribute, 3250: the attribute is translated into a decimal number in arabic numerals. If 3251: another form is desired, the <TT>VALUE</TT> function must be used.</P> 3252: <P> 3253: The last available function returns, as a character string, the value of a 3254: counter, an attribute or a page number. This value can be presented in 3255: different styles. The keyword <TT>VALUE</TT> is followed (between 3256: parentheses) by the name of the counter, the name of the attribute, or the 3257: keyword <TT>PageNumber</TT> and the desired style, the two parameters being 3258: separated by a comma. The style is a keyword which indicates whether the 3259: value should be presented in arabic numerals (<TT>Arabic</TT>), lower-case 3260: roman numerals (<TT>LRoman</TT>), or upper-case roman numerals 3261: (<TT>URoman</TT>), or by an upper-case letter (<TT>Uppercase</TT>) or 3262: lower-case letter (<TT>Lowercase</TT>).</P> 3263: <P> 3264: For a page counter, the keyword <TT>PageNumber</TT> can be followed, between 3265: parentheses, by the name of the view from which to obtain the page number. By 3266: default, the first view declared in the <TT>VIEWS</TT> section is used. The 3267: value obtained is the number of the page on which is found the element that is 3268: using the variable in a <TT>Content</TT> rule.</P> 3269: <P> 3270: For an ordinary counter, the name of the counter can be preceded by the 3271: keyword <TT>MaxRangeVal</TT> or <TT>MinRangeVal</TT>. These keywords mean 3272: that the value returned by the function is the maximum (minimum resp.) value 3273: taken by the counter in the whole document, not the value for the element 3274: concerned by the function.</P> 3275: <PRE> 1.6 cvs 3276: Function = 'DATE' / 'FDATE' / 1.1 cvs 3277: 'DocName' / 'DirName' / 3278: 'ElemName' / 'AttributeName' / 3279: ConstID / ConstType ConstValue / 3280: AttrID / 3281: 'VALUE' '(' PageAttrCtr ',' 3282: CounterStyle ')' . 1.6 cvs 3283: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] / 1.1 cvs 3284: [ MinMax ] CounterID / AttrID . 3285: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' / 3286: 'Uppercase' / 'Lowercase' . 1.6 cvs 3287: MinMax = 'MaxRangeVal' / 'MinRangeVal' . 1.1 cvs 3288: </PRE> 3289: <BLOCKQUOTE class="example"> 3290: <P> 3291: <STRONG>Example:</STRONG></P> 3292: <P> 1.3 cvs 3293: To make today's date appear at the top of the first page of a report, a <A 1.6 cvs 3294: href="#sectc4232"><TT>CREATE</TT> rule</A> associated with the Report_Title 1.3 cvs 3295: element type generates a presentation box whose content (specified by the 3296: <TT>Content</TT> rule of that presentation box) is the variable:</P> 1.1 cvs 3297: <PRE> 3298: VAR 3299: Todays_date : TEXT 'Version of ' DATE; 3300: </PRE> 3301: <P> 3302: To produce, before each section title, the chapter number (in upper-case roman 3303: numerals) followed by the section number (in arabic numerals), two counters 3304: must be defined:</P> 3305: <PRE> 3306: COUNTERS 3307: ChapterCtr : RANK OF Chapter; 3308: SectionCtr : RANK OF Section; 3309: </PRE> 3310: <P> 1.4 cvs 3311: and the Section_Title element must create a presentation box whose content is 1.1 cvs 3312: the variable</P> 3313: <PRE> 3314: VAR 3315: SectionNum : VALUE (ChapterCtr, URoman) TEXT '-' 3316: VALUE (SectionCtr, Arabic); 3317: </PRE> 3318: <P> 3319: In order to make the page number on which each section begins appear in the 3320: table of contents view next to the section title, each Section_Title element 3321: must create a presentation box, visible only in the table of contents view, 3322: whose content is the variable:</P> 3323: <PRE> 3324: VAR 3325: TitlePageNume : 3326: VALUE (PageNumber(Full_text), Arabic); 3327: </PRE> 3328: </BLOCKQUOTE> 3329: </DIV> 3330: 3331: <DIV class="subsection"> 1.6 cvs 3332: <H3><A name=sectc427>Default presentation rules</A></H3> 1.1 cvs 3333: 3334: <P> 3335: In order to avoid having to specify, for each element type defined in the 3336: structure schema, values for every one of the numerous presentation 3337: parameters, the presentation schema allows the definition of a set of default 3338: presentation rules. These rules apply to all the boxes of the elements 3339: defined in the structure schema and to the presentation boxes and page layout 3340: boxes defined in the presentation schema. Only rules which differ from these 3341: default need to be specified in other sections of the presentation schema.</P> 3342: <P> 3343: For the primary view, the default rules can define every presentation 3344: parameter, but not the <A href="#presfunct">presentation functions</A> or the 1.6 cvs 3345: <A href="#sectc4223">linebreaking conditions</A> (the <TT>NoBreak1</TT>, 1.1 cvs 3346: <TT>NoBreak2</TT>, and <TT>Gather</TT> rules).</P> 3347: <P> 3348: In a presentation schema, the default presentation rules section is optional; 3349: in this case, the <TT>DEFAULT</TT> keyword is also absent and the following 3350: rules are considered to be the default rules:</P> 3351: <PRE> 1.6 cvs 3352: Visibility: Enclosing =; 3353: VertRef: * . Left; 3354: HorizRef: Enclosed . HRef; 3355: Height: Enclosed . Height; 3356: Width: Enclosed . Width; 3357: VertPos: Top = Previous . Bottom; 3358: HorizPos: Left = Enclosing . Left; 3359: VertOverflow: No; 1.1 cvs 3360: HorizOverflow: No; 1.6 cvs 3361: Size: Enclosing =; 3362: Style: Enclosing =; 3363: Font: Enclosing =; 3364: Underline: Enclosing =; 3365: Thickness: Enclosing =; 3366: Indent: Enclosing =; 3367: LineSpacing: Enclosing =; 3368: Adjust: Enclosing =; 3369: Justify: Enclosing =; 3370: Hyphenate: Enclosing =; 3371: PageBreak: Yes; 3372: LineBreak: Yes; 3373: InLine: Yes; 3374: Depth: 0; 3375: LineStyle: Enclosing =; 3376: LineWeight: Enclosing =; 3377: FillPattern: Enclosing =; 3378: Background: Enclosing =; 3379: Foreground: Enclosing =; 1.1 cvs 3380: </PRE> 3381: <P> 3382: If other values are desired for the default rules, they must be defined 3383: explicitly in the default rules section. In fact, it is only necessary to 3384: define those default rules which differ from the ones above, since the rules 3385: above will be used whenever a rule is not explicitly named.</P> 3386: <P> 3387: Default rules for views other than the primary view can also be specified. 3388: Otherwise, the default rules for the primary views are applied to the other 3389: views.</P> 3390: <P> 1.6 cvs 3391: Default rules are expressed in the same way as <A href="#sectc4215">explicit 1.1 cvs 3392: rules for document elements</A>.</P> 3393: </DIV> 3394: 3395: <DIV class="subsection"> 1.6 cvs 3396: <H3><A name=sectc428>Presentation and page layout boxes</A></H3> 1.1 cvs 3397: 3398: <P> 3399: The presentation process uses elements which are not part of the logical 3400: structure of the document, such as pages (which are the page layout boxes) or 3401: alternatively, rules, numbers, or words introducing certain parts of the 3402: document, such as ``Summary'', ``Appendices'', ``Bibliography'', etc. (which 3403: are presentation boxes).</P> 3404: <P> 3405: After the word <TT>BOXES</TT>, each presentation or page layout box is defined 3406: by its name and a sequence of presentation rules which indicate how they must 3407: be displayed. These rules are the same as those which define the boxes 3408: associated with element of the logical structure of the document, with a 1.6 cvs 3409: single exception, the <A href="#sectc4231"><TT>Content</TT> rule</A> which is 1.1 cvs 3410: used only to specify the content of presentation boxes. The content of boxes 3411: associated with elements of the document structure is defined in each document 3412: or object and thus is not specified in the presentation schema, which applies 3413: to all documents or objects of a class.</P> 3414: <P> 3415: Among the rules which define a presentation box, certain ones can refer to 3416: another presentation box (for example, in their positional rules). If the 3417: designated box is defined after the box which designates it, a 3418: <TT>FORWARD</TT> instruction followed by the name of the designated box must 3419: appear before the designation.</P> 3420: <PRE> 1.6 cvs 3421: 'BOXES' BoxSeq 1.1 cvs 3422: BoxSeq = Box < Box > . 3423: Box ='FORWARD' BoxID ';' / 3424: BoxID ':' ViewRuleSeq . 3425: BoxID = NAME . 3426: </PRE> 3427: </DIV> 3428: 3429: <DIV class="subsection"> 1.6 cvs 3430: <H3><A name=sectc429>Presentation of structured elements</A></H3> 1.1 cvs 3431: 3432: <P> 3433: After the words <TT>RULES</TT>, the presentation schema gives the presentation 3434: rules that apply to the elements whose types are defined in the structure 3435: schema. Only those rules which differ from the <A 1.6 cvs 3436: href="#sectc427">default</A> must be specified in the <TT>RULES</TT> 1.1 cvs 3437: section.</P> 3438: <P> 3439: The rule definitions for each element type are composed of the name of the 3440: element type (as specified in the structure schema) followed by a colon and 3441: the set of rules specific to that type.</P> 3442: <P> 3443: The type name can be preceded by a star in the special case where the 1.6 cvs 3444: structure schema defines an <A href="#sectd3284">inclusion</A> without 1.1 cvs 3445: expansion (or with partial expansion) of a type with the same name as an 3446: element of defined in the structure schema.</P> 3447: <P> 1.6 cvs 3448: In the case where the element is a <A href="#sectd3285">mark pair</A>, but only in 1.1 cvs 3449: this case, the type name can be preceded by the keywords <TT>First</TT> or 3450: <TT>Second</TT>. These keywords indicate whether the rules that follow apply 3451: to the first or second mark of the pair.</P> 3452: <PRE> 1.6 cvs 3453: 'RULES' PresentSeq 1.1 cvs 3454: PresentSeq = Present < Present > . 1.6 cvs 3455: Present = [ '*' ] [ FirstSec ] ElemID ':' 3456: ViewRuleSeq . 3457: FirstSec = 'First' / 'Second' . 1.1 cvs 3458: </PRE> 3459: <P> 3460: A presentation schema can define presentation rules for base elements, which 3461: are defined implicitly in the structure schemas. In the English version of 3462: the presentation schema compiler, the base type names are the same as in the S 3463: language, but they are terminated by the <TT>_UNIT</TT> suffix: 3464: <TT>TEXT_UNIT</TT>, <TT>PICTURE_UNIT</TT>, <TT>SYMBOL_UNIT</TT>, 1.2 cvs 3465: <TT>GRAPHICS_UNIT</TT>. The base type names are written in upper-case 3466: letters.</P> 1.1 cvs 3467: </DIV> 3468: 3469: <DIV class="subsection"> 1.6 cvs 3470: <H3><A name=sectc4210>Logical attribute presentation</A></H3> 1.1 cvs 3471: 3472: <P> 3473: After the keyword <TT>ATTRIBUTES</TT>, all attributes which are to have some 3474: effect on the presentation of the element to which they are attached must be 3475: mentioned, along with the corresponding presentation rules. This is true for 3476: both global attributes (which can be attached to all element types) and local 3477: attributes (which can only be attached to certain element types).</P> 3478: <P> 3479: Also mentioned in this section are attributes which imply an effect on 3480: elements in the subtree of the element to which they are attached. The 3481: presentation of these descendants can be modified as a function of the value 3482: of the attribute which they inherit, just as if it was attached to them 3483: directly.</P> 3484: <P> 3485: The specification for each attribute includes the attribute's name, followed 3486: by an optional value specification and, after a colon, a set of rules. The 3487: set of rules must contain at least one rule.</P> 3488: <P> 3489: When there is no value specification, the rules are applied to all elements 3490: which carry the attribute, no matter what their value. When the rules must 3491: only apply when the attribute has certain values, these values must be 3492: specified. Thus, the same attribute can appear in the <TT>ATTRIBUTES</TT> 3493: section several times, with each appearance having a different value 3494: specification. However, reference attributes never have a value specification 3495: and, as a result, can only appear once in the <TT>ATTRIBUTES</TT> section.</P> 3496: <P> 3497: To specify that the presentation rules apply to some of the descendants of the 3498: element having the attribute, the name of the affected element type is given, 3499: between parentheses, after the attribute name. This way, the presentation 3500: rules for the attribute will be applied to the element having the attribute, 3501: if it is of the given type, and to all of its descendants of the given type. 1.6 cvs 3502: In the case where this type is a <A href="#sectd3285">mark pair</A>, but only in 1.1 cvs 3503: this case, the type name can be preceded by the keywords <TT>First</TT> or 3504: <TT>Second</TT>. These keywords indicate whether the rules that follow apply 3505: to the first or second mark of the pair. If the rule must apply to several 3506: different element types, the specification must be repeated for each element 3507: type.</P> 3508: <P> 3509: The specification of values for which the presentation rules will be applied 3510: varies according to the type of the attribute:</P> 3511: <DL> 3512: <DT>numeric attribute</DT> 1.2 cvs 3513: <DD>If the rules are to apply for one value of the attribute, then the 3514: attribute name is followed by an equals sign and this value. If the rules are 3515: to apply for all values less than (or greater than) a threshold value, 3516: non-inclusive, the attribute name followed by a '<' sign (or a '>' sign, 3517: respectively) and the threshold value. If the rules must apply to a range of 3518: values, the attribute name is followed by the word '<TT>IN</TT>' and the 3519: two bounds of the range, enclosed in brackets and separated by two 3520: periods ('<TT>..</TT>'). In the case of ranges, the values of the bounds 3521: are included in the range. 1.1 cvs 3522: <P> 3523: The threshold value in the comparisons can be the value of an attribute 3524: attached to an ancestor element. In this case, the attribute name is given 3525: instead of a constant value.</P> 3526: <P> 3527: It is also possible to write rules which apply only when a comparison between 3528: two different attributes of the element's ancestors is true. In this case, the 3529: first attribute name is followed by a comparison keyword and the name of the 3530: second attribute. The comparison keywords are <TT>EQUAL</TT> (simple 3531: equality), <TT>LESS</TT> (non-inclusive less than), and <TT>GREATER</TT> 3532: (non-inclusive greater than).</P> 3533: </DD> 3534: <DT>text attribute</DT> 1.2 cvs 3535: <DD>If the rules are to apply for one value of the attribute, then the 3536: attribute name is followed by an equals sign and this value. 1.1 cvs 3537: </DD> 3538: <DT>reference attribute</DT> 1.2 cvs 3539: <DD>There is never a value specification; the rules apply no matter what 1.1 cvs 3540: element is designated by the attribute. 3541: </DD> 3542: <DT>enumerated attribute</DT> 1.2 cvs 3543: <DD>If the rules are to apply for one value of the attribute, then the 3544: attribute name is followed by an equals sign and this value. 1.1 cvs 3545: </DD> 3546: </DL> 3547: <P> 3548: The order in which the rules associated with a numeric attribute are defined 3549: is important. When multiple sets of rules can be applied, the first set 3550: declared is the one used.</P> 3551: <P> 3552: Rules for attributes have priority over both default rules and rules 3553: associated with element types. The attribute rules apply to the element to 3554: which the attribute is attached. It is the rules which apply to the 3555: surrounding elements (and especially to the descendants) which determine the 3556: effect of the attribute rules on the environment ( and especially on the 3557: terminal elements of the structure).</P> 3558: <PRE> 3559: 'ATTRIBUTES' PresAttrSeq 3560: PresAttrSeq = PresAttr < PresAttr > . 3561: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ] 3562: [ AttrRelation ] ':' ViewRuleSeq . 3563: AttrID = NAME . 3564: AttrRelation ='=' AttrVal / 3565: '>' [ '-' ] MinValue / 3566: '<' [ '-' ] MaxValue / 3567: 'IN' '[' [ '-' ] LowerBound '..' 3568: [ '-' ] UpperBound ']' / 3569: 'GREATER' AttrID / 3570: 'EQUAL' AttrID / 3571: 'LESS' AttrID . 3572: AttrVal = [ '-' ] EqualNum / EqualText / 3573: AttrValue . 3574: MinValue = NUMBER . 3575: MaxValue = NUMBER . 3576: LowerBound = NUMBER . 3577: UpperBound = NUMBER. 3578: EqualNum = NUMBER . 3579: EqualText = STRING . 3580: AttrValue = NAME . 3581: </PRE> 3582: <P> 3583: In presentation rules associated with a numeric attribute (and only in such 3584: rules), the attribute name can be used in place of a numeric value. In this 3585: case, the value of the attribute is used in the application of the rule. Thus, 3586: the attribute can represent a relation between the size of two boxes, the 3587: height and width of a box, the height of an area where page breaks are 3588: prohibited, the distance between two boxes, the position of the reference axis 3589: of a box, the interline spacing, the indentation of the first line, the 3590: visibility, the depth (z-order), or the character set.</P> 3591: <P> 3592: The presentation rules associated with reference attributes, it is possible to 3593: use the element designated by the attribute as a reference box in a positional 3594: or extent rule. This element is represented in the <A 1.6 cvs 3595: href="#sectc4218">position</A> or <A href="#sectc4219">extent</A> rule by the 1.1 cvs 3596: keyword <TT>Referred</TT>.</P> 3597: <BLOCKQUOTE class="example"> 3598: <P> 3599: <STRONG>Example:</STRONG></P> 3600: <P> 1.3 cvs 3601: In all structure schemas, there is a global Language attribute defined as 1.1 cvs 3602: follows:</P> 3603: <PRE> 3604: ATTR 3605: Language = TEXT; 3606: </PRE> 3607: <P> 1.4 cvs 3608: The following rules would make French text be displayed in roman characters and 1.1 cvs 3609: English text be displayed in italics:</P> 3610: <PRE> 3611: ATTRIBUTES 3612: Language = 'French' : 1.6 cvs 3613: Style : Roman; 1.1 cvs 3614: Language = 'English' : 1.6 cvs 3615: Style : Italics; 1.1 cvs 3616: </PRE> 3617: <P> 1.4 cvs 3618: Using these rules, when the user puts the Language attribute with the value 3619: 'English' on the summary of a document, every character string (terminal 3620: elements) contained in the summary are displayed in italics. See the <A 1.7 cvs 3621: href="#sectd42252"><TT>Style</TT> rule</A>.</P> 1.1 cvs 3622: </BLOCKQUOTE> 3623: <BLOCKQUOTE class="example"> 3624: <P> 3625: <STRONG>Example:</STRONG></P> 3626: <P> 1.3 cvs 3627: A numeric attribute representing the importance of the part of the document to 1.1 cvs 3628: which it is attached can be defined:</P> 3629: <PRE> 3630: ATTR 3631: Importance = INTEGER; 3632: </PRE> 3633: <P> 1.4 cvs 3634: In the presentation schema, the importance of an element is reflected in the 1.1 cvs 3635: choice of character size, using the following rules.</P> 3636: <PRE> 3637: ATTRIBUTES 3638: Importance < 2 : 3639: Size : 1; 3640: Importance IN [2..4] : 3641: Size : Importance; 3642: Importance = 10 : 3643: Size : 5; 3644: Importance > 4 : 3645: Size : 4; 3646: </PRE> 3647: <P> 1.4 cvs 3648: Thus, the character size corresponds to the value of the Importance attribute; 1.1 cvs 3649: its value is</P> 3650: <UL> 1.2 cvs 3651: <LI>the value of the Importance attribute when the value is between 2 and 4 1.1 cvs 3652: (inclusive), 3653: <LI>1, when the value of the Importance attribute is less than 2, 1.5 cvs 3654: <LI>4, when the value of the Importance attribute is greater than 4, 1.1 cvs 3655: <LI>5, when the value of the Importance attribute is 10. 3656: </UL> 3657: <P> 1.4 cvs 3658: The last case (value 5) must be defined before the case which handles all 3659: Importance values greater than 4, because the two rules are not disjoint and 3660: the first one defined will have priority. Otherwise, when the Importance 1.1 cvs 3661: attribute has value 10, the font size will be 4.</P> 3662: </BLOCKQUOTE> 3663: <BLOCKQUOTE class="example"> 3664: <P> 3665: <STRONG>Example:</STRONG></P> 3666: <P> 1.3 cvs 3667: Suppose the structure defines a list element which can have an attribute 1.1 cvs 3668: defining the type of list (numbered or not):</P> 3669: <PRE> 3670: STRUCT 3671: list (ATTR list_type = enumeration, dash) 3672: = LIST OF (list_item = TEXT); 3673: </PRE> 3674: <P> 1.4 cvs 3675: Then, the presentation schema could use the attribute placed on the list 3676: element to put either a dash or a number before the each element of the 1.1 cvs 3677: list:</P> 3678: <PRE> 3679: ATTRIBUTES 3680: list_type (list_item) = enumeration : 3681: CreateBefore (NumberBox); 3682: list_type (list_item) = dash : 3683: CreateBefore (DashBox); 3684: </PRE> 3685: </BLOCKQUOTE> 3686: <BLOCKQUOTE class="example"> 3687: <P> 3688: <STRONG>Example:</STRONG></P> 3689: <P> 1.3 cvs 3690: Suppose that two attributes are defined in the structure schema. The first is 3691: a numeric global attribute called ``version''. The other is a local attribute 3692: defined on the root of the document called ``Document_version'':</P> 1.1 cvs 3693: <PRE> 3694: STRUCTURE Document 3695: ATTR 3696: version = INTEGER; 3697: STRUCT 3698: Document (ATTR Document_version = INTEGER) = 3699: BEGIN 3700: SomeElement ; 3701: ... 3702: SomeOtherElement ; 3703: END ; 3704: ... 3705: </PRE> 3706: <P> 1.4 cvs 3707: These attributes can be used in the presentation schema to place change bars in 3708: the margin next to elements whose version attribute has a value equal to the 3709: Document_version attribute of the root and to place a star in margin of 3710: elements whose version attribute is less than the value of the root's 1.1 cvs 3711: Document_version attribute:</P> 3712: <PRE> 3713: ATTRIBUTES 3714: version EQUAL Document_version : 3715: CreateBefore (ChangeBarBox) ; 3716: version LESS Document_version : 3717: CreateBefore (StarBox) ; 3718: </PRE> 3719: </BLOCKQUOTE> 3720: </DIV> 3721: 3722: <DIV class="subsection"> 1.6 cvs 3723: <H3><A name=sectc4212>Value transmission rules</A></H3> 1.1 cvs 3724: 3725: <P> 3726: The last section of a presentation schema, which is optional, serves to 3727: defines the way in which a document transmits certain values to its 3728: sub-documents. A sub-document is an document <A 3729: href="#inclusion">included</A> without expansion or with partial expansion. 3730: The primary document can transmit to its sub-documents the values of certain 3731: counters or the textual content of certain of its elements, as a function of 3732: their type.</P> 3733: <P> 3734: The sub-documents receive these values in attributes which must be defined in 3735: their structure schema as local attributes of the root element. The types of 3736: these attributes must correspond to the type of the value which they receive: 3737: numeric attributes for receiving the value of a counter, textual attributes 3738: for receiving the content of an element.</P> 3739: <P> 3740: In the structure schema of the primary document, there appears at the end, 3741: after the <TT>TRANSMIT</TT> keyword, a sequence of transmission rules. Each 3742: rule begins with the name of the counter to transmit or of the element type 3743: whose textual content will be transmitted. This name is followed by the 3744: keyword <TT>To</TT> and the name of the attribute of the sub-document to which 3745: the value is transmitted. The sub-document class is indicated between 3746: parentheses after the name of the attribute. The transmission rule ends with 3747: a semicolon.</P> 3748: <PRE> 3749: TransmitSeq = Transmit < Transmit > . 3750: Transmit = TypeOrCounter 'To' ExternAttr 3751: '(' ElemID ')' ';' . 3752: TypeOrCounter = CounterID / ElemID . 3753: ExternAttr = NAME . 3754: </PRE> 3755: <BLOCKQUOTE class="example"> 3756: <P> 3757: <STRONG>Example:</STRONG></P> 3758: <P> 1.3 cvs 3759: Consider a Book document class which includes instances of the Chapter document 1.1 cvs 3760: class. These classes might have the following schemas:</P> 3761: <PRE> 3762: STRUCTURE Book 3763: STRUCT 3764: Book = BEGIN 3765: Title = Text; 3766: Body = LIST OF (Chapter INCLUDED); 3767: END; 3768: ... 3769: 3770: STRUCTURE Chapter 3771: STRUCT 3772: Chapter (ATTR FirstPageNum = Integer; 3773: ChapterNum = Integer; 3774: CurrentTitle = Text) = 1.6 cvs 3775: BEGIN 3776: ChapterTitle = Text; 3777: ... 3778: END; 1.1 cvs 3779: ... 3780: </PRE> 3781: <P> 3782: Then the presentation schema for books could define chapter and page counters. 3783: The following transmission rules in the book presentation schema would 3784: transmit values for the three attributes defined at the root of each chapter 3785: sub-document.</P> 3786: <PRE> 3787: PRESENTATION Book; 3788: VIEWS 3789: Full_text; 3790: COUNTERS 3791: ChapterCtr: Rank of Chapter; 3792: PageCtr: Rank of Page(Full_text); 3793: ... 3794: TRANSMIT 3795: PageCtr TO FirstPageNum(Chapter); 3796: ChapterCtr TO ChapterNum(Chapter); 3797: Title TO CurrentTitle(Chapter); 3798: END 3799: </PRE> 3800: <P> 3801: Thus, each chapter included in a book can number its pages as a function of 3802: the number of pages preceding it in the book, can make the chapter's number 3803: appear before the number of each of its sections, or can place the title of 3804: the book at the top of each page.</P> 3805: </BLOCKQUOTE> 3806: </DIV> 3807: 3808: <DIV class="subsection"> 1.6 cvs 3809: <H3><A name=sectc4213>Presentation rules</A></H3> 1.1 cvs 3810: 3811: <P> 3812: Whether defining the appearance of a presentation or page layout box, an 3813: element type, or an attribute value, the set of presentation rules that apply 3814: is always defined in the same way.</P> 3815: <P> 3816: Normally, a set of presentation rules is placed between the keywords 3817: <TT>BEGIN</TT> and <TT>END</TT>, the keyword <TT>END</TT> being followed by a 3818: semicolon. The first section of this block defines the rules that apply to 1.6 cvs 3819: the primary view, if the <A href="#sectc427">default rules</A> are not 1.1 cvs 3820: completely suitable. Next comes the rules which apply to specific other 3821: views, with a rule sequence for each view for which the default rules are not 3822: satisfactory. If the default rules are suitable for the non-primary views, 3823: there will not be any specific rules for these views. If there is only one 3824: rule which applies to all views then the keywords <TT>BEGIN</TT> and 3825: <TT>END</TT> need not appear.</P> 3826: <P> 3827: For each view, it is only necessary to specify those rules which differ from 3828: the default rules for the view, so that for certain views (or even all views), 3829: there may be no specific rules.</P> 3830: <P> 3831: The specific rules for a non-primary view are introduced by the <A 3832: name="inkeyword"><TT>IN</TT> keyword</A>, followed by the view name. The 3833: rules for that view follow, delimited by the keywords <TT>BEGIN</TT> and 3834: <TT>END</TT>, or without these two keywords when there is only one rule.</P> 3835: <P> 3836: <STRONG>Note:</STRONG> the view name which follows the <TT>IN</TT> keyword 3837: must not be the name of the primary view, since the rules for that view are 3838: found before the rules for the other views.</P> 3839: <P> 3840: Within each block concerning a view, other blocks can appear, delimited by the 3841: same keywords <TT>BEGIN</TT> and <TT>END</TT>. Each of these blocks gathers 3842: the presentation rules that apply, for a given view, only when a given 3843: condition is satisfied. Each block is preceded by a condition introduced by 3844: the <TT>IF</TT> keyword. If such a conditional block contains only one rule, 3845: the keywords <TT>BEGIN</TT> and <TT>END</TT> can be omitted.</P> 3846: <P> 3847: Although the syntax allows any presentation rule to appear in a conditional 1.6 cvs 3848: block, only <A href="#sectc4232">creation rules</A> are allowed after any 1.1 cvs 3849: condition; other rules are allowed only after conditions <TT>Within</TT> and 3850: ElemID. In addition, the following rules cannot be conditional: 3851: <TT>PageBreak, LineBreak, Inline, Gather</TT>.</P> 3852: <P> 3853: For a given view, the rules that apply without any condition must appear 3854: before the first conditional block. If some rules apply only when none of the 3855: specified condition holds, they are grouped in a block preceded by the keyword 3856: <TT>Otherwise</TT>, and that block must appear after the last conditionnal 3857: block concerning the same view.</P> 3858: <PRE> 3859: ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules > 3860: 'END' ';' / 3861: ViewRules / CondRules / Rule . 3862: RulesAndCond = CondRules / Rule . 3863: ViewRules = 'IN' ViewID CondRuleSeq . 3864: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' / 3865: CondRules / Rule . 3866: CondRules = CondRule < CondRule > 3867: [ 'Otherwise' RuleSeq ] . 3868: CondRule = 'IF' ConditionSeq RuleSeq . 3869: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / 3870: Rule . 3871: </PRE> 3872: <BLOCKQUOTE class="example"> 3873: <P> 3874: <STRONG>Example:</STRONG></P> 3875: <P> 1.3 cvs 3876: The following rules for a report's title make the title visible in the primary 3877: view and invisible in the table of contents and in the formula views (see the 1.6 cvs 3878: <A href="#sectc4224"><TT>Visibility</TT> rule</A>).</P> 1.1 cvs 3879: <PRE> 3880: Title : BEGIN 3881: Visibility : 1; 3882: ... {Other rules for the primary view} 3883: IN Table_of_contents 3884: Visibility : 0; 3885: IN Formulas 3886: Visibility : 0; 3887: END; 3888: </PRE> 3889: </BLOCKQUOTE> 3890: </DIV> 3891: 3892: <DIV class="subsection"> 1.6 cvs 3893: <H3><A name=sectc4214>Conditions applying to presentation rules</A></H3> 1.1 cvs 3894: 3895: <P> 3896: Many conditions can be applied to presentation rules. Conditions allow 3897: certain presentation rules to apply only in certain cases. These conditions 3898: can be based on the structural position of the element. They can be based on 3899: whether the element has references, and what type of references, whether the 3900: element has attributes, whether the element is empty or not. They can also be 3901: based on the value of a counter.</P> 3902: <P> 3903: It is possible to specify several conditions which must all be true for the 3904: rules to apply.</P> 3905: <P> 3906: A set of conditions is specified by the <TT>IF</TT> keyword. This keyword is 3907: followed by the sequence of conditions, separated by the <TT>AND</TT> keyword. 3908: Each condition is specified by a keyword which defines the condition type. In 3909: some cases, the keyword is followed by other data, which specify the condition 3910: more precisely.</P> 3911: <P> 3912: An elementary condition can be negative; it is then preceded by the 3913: <TT>NOT</TT> keyword.</P> 3914: <P> 3915: When the presentation rule(s) controlled by the condition apply to a reference 3916: element or a reference attribute, an elementary condition can also apply to 3917: element referred by this reference. The <TT>Target</TT> keyword is used for 3918: that purpose. It must appear before the keyword defining the condition 3919: type.</P> 3920: <PRE> 1.6 cvs 3921: CondRule ='IF' ConditionSeq RuleSeq . 1.1 cvs 3922: ConditionSeq = Condition < 'AND' Condition > . 3923: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem . 3924: ConditionElem ='First' / 'Last' / 3925: [ 'Immediately' ] 'Within' [ NumParent ] 3926: ElemID [ ExtStruct ] / 3927: ElemID / 3928: 'Referred' / 'FirstRef' / 'LastRef' / 3929: 'ExternalRef' / 'InternalRef' / 'CopyRef' / 3930: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' / 3931: 'UserPage' / 'StartPage' / 'ComputedPage' / 3932: 'Empty' / 3933: '(' [ MinMax ] CounterName CounterCond ')' / 3934: CondPage '(' CounterID ')' . 3935: NumParent = [ GreaterLess ] NParent . 1.6 cvs 3936: GreaterLess ='>' / '<' . 1.1 cvs 3937: NParent = NUMBER. 1.6 cvs 3938: ExtStruct ='(' ElemID ')' . 1.1 cvs 3939: CounterCond ='<' MaxCtrVal / '>' MinCtrVal / 3940: '=' EqCtrVal / 3941: 'IN' '[' ['-'] MinCtrBound '.' '.' 3942: ['-'] MaxCtrBound ']' . 3943: PageCond ='Even' / 'Odd' / 'One' . 3944: MaxCtrVal = NUMBER . 3945: MinCtrVal = NUMBER . 3946: EqCtrVal = NUMBER . 3947: MaxCtrBound = NUMBER . 3948: MinCtrBound = NUMBER . 3949: </PRE> 3950: 3951: <DIV class="subsubsection"> 1.6 cvs 3952: <H4><A name=sectd42141>Conditions based on the logical position of the element</A></H4> 1.1 cvs 3953: 3954: <P> 3955: The condition can be on the position of the element in the document's logical 3956: structure tree. It is possible to test whether the element is the first 3957: (<TT>First</TT>) or last (<TT>Last</TT>) among its siblings or if it is not 3958: the first (<TT>NOT First</TT>) or not the last (<TT>NOT Last</TT>). These 1.6 cvs 3959: conditions can be associated only with <A href="#sectc4232">creation 1.1 cvs 3960: rules</A>.</P> 3961: <P> 3962: It is also possible to test if the element is contained in an element of a 3963: given type (<TT>Within</TT>) or if it is not (<TT>NOT Within</TT>). The type 3964: is indicated after the keyword <TT>Within</TT>. If that element type is 3965: defined in a structure schema which is not the one which corresponds to the 3966: presentation schema, the type name of this element must be followed, between 3967: parentheses, by the name of the structure schema which defines it.</P> 3968: <P> 3969: If the keyword <TT>Within</TT> is preceded by <TT>Immediately</TT>, the 3970: condition is satisfied only if the <EM>parent</EM> element has the type 3971: indicated. If the word <TT>Immediately</TT> is missing, the condition is 3972: satisfied if any <EM>ancestor</EM> has the type indicated.</P> 3973: <P> 3974: An integer <I>n</I> can appear between the keyword <TT>Within</TT> and the 3975: type. It specifies the number of ancestors of the indicated type that must be 3976: present for the condition to be satisfied. If the keyword 3977: <TT>Immediately</TT> is also present, the <I>n</I> immediate ancestors of the 3978: element must have the indicated type. The integer <I>n</I> must be positive 3979: or zero. It can be preceded by <TT><</TT> or <TT>></TT> to indicate a 3980: maximum or minimum number of ancestors. If these symbols are missing, the 3981: condition is satisfied only if it exists exactly <I>n</I> ancestors. When 3982: this number is missing, it is equivalent to > 0.</P> 3983: <P> 3984: If the condition applies to presentation rules associated with an attribute, 3985: in the <TT>ATTRIBUTES</TT> section of the presentation schema, the condition 3986: can be simply an element name. Presentation rules are then executed only if 3987: the attribute is attached to an element of that type. The keyword <TT>NOT</TT> 3988: before the element name indicates that the presentation rules must be executed 3989: only if the element is not of the type indicated.</P> 3990: </DIV> 3991: 3992: <DIV class="subsubsection"> 1.6 cvs 3993: <H4><A name=sectd42142>Conditions on references</A></H4> 1.1 cvs 3994: 3995: <P> 3996: References may be taken into account in conditions, which can be based on the 3997: fact that the element, or one of its ancestors, is designated by a at least 3998: one reference (<TT>Referred</TT>) or by none (<TT>NOT Referred</TT>).</P> 3999: <P> 4000: If the element or attribute to which the condition is attached is a reference, 4001: the condition can be based on the fact that it acts as the first reference to 4002: the designated element (<TT>FirstRef</TT>), or as the last (<TT>LastRef</TT>), 4003: or as a reference to an element located in another document 4004: (<TT>ExternalRef</TT>) or in the same document (<TT>InternalRef</TT>).</P> 4005: <P> 4006: The condition can also be based on the fact that the element is an <A 4007: href="#inclusion">inclusion</A>. This is noted (<TT>CopyRef</TT>).</P> 4008: <P> 4009: Like all conditions, conditions on references can be inverted by the 4010: <TT>NOT</TT> keyword. These conditions can be associated only with <A 1.6 cvs 4011: href="#sectc4232">creation rules</A>.</P> 1.1 cvs 4012: </DIV> 4013: 4014: <DIV class="subsubsection"> 1.6 cvs 4015: <H4><A name=sectd42143>Conditions on logical attributes</A></H4> 1.1 cvs 4016: 4017: <P> 4018: The condition can be based on the presence or absence of attributes associated 4019: with the element, no matter what the attributes or their values. The 4020: <TT>AnyAttributes</TT> keyword expresses this condition.</P> 4021: <P> 4022: If the condition appears in the presentation rules of an attribute, the 4023: <TT>FirstAttr</TT> and <TT>LastAttr</TT> keywords can be used to indicate that 4024: the rules must only be applied if this attribute is the first attribute for 4025: the element or if it is the last (respectively). These conditions can also be 4026: inverted by the <TT>NOT</TT> keyword. These conditions can be associated only 1.6 cvs 4027: with <A href="#sectc4232">creation rules</A>.</P> 1.1 cvs 4028: <P> 4029: It is also possible to apply certain presentation rules only when the element 4030: being processed or one of its ancestors has a certain attribute, perhaps with 4031: a certain value. This can be done in the <A 1.6 cvs 4032: href="#sectc4210"><TT>ATTRIBUTES</TT> section</A>.</P> 1.1 cvs 4033: </DIV> 4034: 4035: <DIV class="subsubsection"> 1.6 cvs 4036: <H4><A name=sectd42144>Conditions on page breaks</A></H4> 1.1 cvs 4037: 4038: <P> 4039: The page break base type (and only this type) can use the following 4040: conditions: <TT>ComputedPage</TT>, <TT>StartPage</TT>, and <TT>UserPage</TT>. 4041: The <TT>ComputedPage</TT> condition indicates that the presentation rule(s) 4042: should apply if the page break was created automatically by Thot; the 4043: <TT>StartPage</TT> condition is true if the page break is generated before the 4044: element by the <TT>Page</TT> rule; and the <TT>UserPage</TT> condition applies 4045: if the page break was inserted by the user.</P> 4046: <P> 1.6 cvs 4047: These conditions can be associated only with <A href="#sectc4232">creation 1.1 cvs 4048: rules</A>.</P> 4049: </DIV> 4050: 4051: <DIV class="subsubsection"> 1.6 cvs 4052: <H4><A name=sectd42145>Conditions on the element's content</A></H4> 1.1 cvs 4053: 4054: <P> 4055: The condition can be based on whether or not the element is empty. An element 4056: which has no children or whose leaves are all empty is considered to be empty 4057: itself. This condition is expressed by the <TT>Empty</TT> keyword, optionally 4058: preceded by the <TT>NOT</TT> keyword. This condition can be associated only 1.6 cvs 4059: with <A href="#sectc4232">creation rules</A>.</P> 1.1 cvs 4060: </DIV> 4061: 4062: <DIV class="subsubsection"> 1.6 cvs 4063: <H4><A name=sectd42146>Conditions on counters</A></H4> 1.1 cvs 4064: 4065: <P> 4066: Presentation rules can apply when the counter's value is one, is even or odd, 4067: is equal, greater than or less than a given value or falls in a range of 4068: values. This is particularly useful for creating header and footer boxes. 1.6 cvs 4069: These conditions can be associated only with <A href="#sectc4232">creation 1.1 cvs 4070: rules</A>.</P> 4071: <P> 4072: To compare the value of a counter to a given value, a comparison is given 4073: between parentheses. The comparison is composed of the counter name followed 4074: by an equals, greater than, or less than sign and the value to which the 4075: counter will be compared. A test for whether or not a counter's value falls 4076: in a range also appears within parentheses. In this case, the counter name is 4077: followed by the <TT>IN</TT> keyword and the range definition within brackets. 4078: The <TT>Even</TT>, <TT>Odd</TT> and <TT>One</TT> are used to test a counter's 4079: value and are followed by the counter name between parentheses.</P> 4080: <P> 4081: The list of possible conditions on counters is:</P> 4082: <DL> 4083: <DT><TT>Even (Counter)</TT></DT> 1.2 cvs 4084: <DD>the box is created only if the counter has an even value. 1.1 cvs 4085: </DD> 4086: <DT><TT>Odd (Counter)</TT></DT> 1.2 cvs 4087: <DD>the box is created only if the counter has an odd value. 1.1 cvs 4088: </DD> 4089: <DT><TT>One (Counter)</TT></DT> 1.2 cvs 4090: <DD>the box is created only the counter's value is 1. 1.1 cvs 4091: </DD> 4092: <DT><TT>NOT One (Counter)</TT></DT> 1.5 cvs 4093: <DD>the box is created, unless the counter's value is 1. 1.1 cvs 4094: </DD> 4095: <DT><TT>(Counter < Value)</TT></DT> 1.5 cvs 4096: <DD>the box is created only if the counter's value is less than Value. 1.1 cvs 4097: </DD> 4098: <DT><TT>(Counter > Value)</TT></DT> 1.5 cvs 4099: <DD>the box is created only if the counter's value is greater than Value. 1.1 cvs 4100: </DD> 4101: <DT><TT>(Counter = Value)</TT></DT> 1.5 cvs 4102: <DD>the box is created only if the counter's value is equal to Value. 1.1 cvs 4103: </DD> 4104: <DT><TT>NOT (Counter = Value)</TT></DT> 1.5 cvs 4105: <DD>the is created only if the counter's value is different than Value. 1.1 cvs 4106: </DD> 4107: <DT><TT>(Counter IN [MinValue..MaxValue])</TT></DT> 1.5 cvs 4108: <DD>the box is created only if the counter's value falls in the range bounded 4109: by MinValue and MaxValue (inclusive). 1.1 cvs 4110: </DD> 4111: <DT><TT>NOT (Counter IN [MinValue..MaxValue])</TT></DT> 1.5 cvs 4112: <DD>the box is created only if the value of the counter does not fall in the 4113: range bounded by MinValue and MaxValue (inclusive). 1.1 cvs 4114: </DD> 4115: </DL> 4116: <P> 4117: <STRONG>Note:</STRONG> the <TT>NOT Even</TT> and <TT>NOT Odd</TT> conditions 4118: are syntactically correct but can be expressed more simply by <TT>Odd</TT> and 4119: <TT>Even</TT>, respectively.</P> 4120: </DIV> 4121: </DIV> 4122: 4123: <DIV class="subsection"> 1.6 cvs 4124: <H3><A name=sectc4215>A presentation rule</A></H3> 1.1 cvs 4125: 4126: <P> 4127: A presentation rule defines either a presentation parameter or presentation 4128: function. The parameters are:</P> 4129: <UL> 1.2 cvs 4130: <LI>the position of the vertical and horizontal reference axes of the box, 1.1 cvs 4131: <LI>the position of the box in relation to other boxes, 4132: <LI>the height or width of the box, with overflow exceptions, 1.2 cvs 4133: <LI>the characteristics of the lines contained in the box: linespacing, 1.1 cvs 4134: indentation of the first line, justification, hyphenation, 4135: <LI>the conditions for breaking the box across pages, 1.2 cvs 4136: <LI>the characteristics of the characters contained in the box: size, font, 1.1 cvs 4137: style, underlining, 1.2 cvs 4138: <LI>the depth of the box among overlapping boxes (often called stacking 4139: order), 4140: <LI>the characteristics of graphic elements contained in the box: style and 1.1 cvs 4141: thickness of lines, fill pattern for closed objects, 1.2 cvs 4142: <LI>the colors in text, graphics, pictures, and symbols contained in the box 4143: are displayed or printed, 1.1 cvs 4144: <LI>for presentation boxes only, the contents of the box. 4145: </UL> 4146: <P> 4147: The <A name="presfunct">presentation functions</A>are:</P> 4148: <UL> 4149: <LI>the creation of a presentation box 4150: <LI>the line-breaking or page-breaking style, 4151: <LI>the copying of another box. 4152: </UL> 4153: <P> 4154: For each box and each view, every presentation parameter is defined once and 1.6 cvs 4155: only once, either explicitly or by the <A href="#sectc427">default 1.1 cvs 4156: rules</A>. In contrast, presentation functions are not obligatory and can 4157: appear many times for the same element. for example an element can create 4158: many presentation boxes. Another element may not use any presentation 4159: functions.</P> 4160: <P> 4161: Each rule defining a presentation parameter begins with a keyword followed by 4162: a colon. the keyword indicates the parameter which is the subject of the rule. 4163: After the keyword and the colon, the remainder of the rule varies. All rules 4164: are terminated by a semicolon.</P> 4165: <PRE> 1.6 cvs 4166: Rule = PresParam ';' / PresFunc ';' . 4167: PresParam ='VertRef' ':' PositionHoriz / 4168: 'HorizRef' ':' PositionVert / 4169: 'VertPos' ':' VPos / 4170: 'HorizPos' ':' HPos / 4171: 'Height' ':' Dimension / 4172: 'Width' ':' Dimension / 4173: 'VertOverflow' ':' Boolean / 1.1 cvs 4174: 'HorizOverflow' ':' Boolean / 1.6 cvs 4175: 'LineSpacing' ':' DistanceInherit / 4176: 'Indent' ':' DistanceInherit / 4177: 'Adjust' ':' AdjustInherit / 4178: 'Justify' ':' BoolInherit / 4179: 'Hyphenate' ':' BoolInherit / 4180: 'PageBreak' ':' Boolean / 4181: 'LineBreak' ':' Boolean / 4182: 'InLine' ':' Boolean / 4183: 'NoBreak1' ':' AbsDist / 4184: 'NoBreak2' ':' AbsDist / 4185: 'Gather' ':' Boolean / 4186: 'Visibility' ':' NumberInherit / 4187: 'Size' ':' SizeInherit / 4188: 'Font' ':' NameInherit / 4189: 'Style' ':' StyleInherit / 4190: 'Underline' ':' UnderLineInherit / 4191: 'Thickness' ':' ThicknessInherit / 4192: 'Depth' ':' NumberInherit / 4193: 'LineStyle' ':' LineStyleInherit / 4194: 'LineWeight' ':' DistanceInherit / 4195: 'FillPattern' ':' NameInherit / 4196: 'Background' ':' NameInherit / 4197: 'Foreground' ':' NameInherit . 4198: 'Content' ':' VarConst . 1.1 cvs 4199: PresFunc = Creation '(' BoxID ')' / 4200: 'Line' / 4201: 'NoLine' / 4202: 'Page' '(' BoxID ')' / 4203: 'Copy' '(' BoxTypeToCopy ')' . 4204: </PRE> 4205: </DIV> 4206: 4207: <DIV class="subsection"> 1.6 cvs 4208: <H3><A name=sectc4216>Box axes</A></H3> 1.1 cvs 4209: 4210: <P> 4211: The position of the middle axes <TT>VMiddle</TT> and <TT>HMiddle</TT> in 4212: relation to their box is always calculated automatically as a function of the 4213: height and width of the box and is not specified by the presentation rules. In 4214: the presentation schema, these middle axes are used only to position their box 4215: with respect to another by specifying the distance between the middle axis and 1.6 cvs 4216: an axis or a side of another box (see the <A href="#sectc4218">relative 1.1 cvs 4217: position</A>).</P> 4218: <P> 4219: The reference axes of a box are also used to position their box in relation to 4220: another, but in contrast to the middle axes, the presentation schema must make 4221: their position explicit, either in relation to a side or the middle axis of 4222: the box itself, or in relation to an axis of an enclosed box.</P> 4223: <P> 4224: Only boxes of base elements have predefined reference axes. For character 4225: string boxes, the horizontal reference axis is the baseline of the characters 4226: (the line which passes immediately under the upper-case letters, ignoring the 4227: letter Q) and the vertical reference axis is at the left edge of the first 4228: character of the string.</P> 4229: <P> 4230: The positions of a box's reference axes are defined by the <TT>VertRef</TT> 4231: and <TT>HorizRef</TT> rules which specify the <A href="#distance">distance</A> 4232: between the reference axis and an axis or parallel side of the same box or of 4233: an enclosed box.</P> 4234: <PRE> 1.6 cvs 4235: 'VertRef' ':' PositionHoriz 1.1 cvs 4236: 'HorizRef' ':' PositionVert 4237: </PRE> 4238: <BLOCKQUOTE class="example"> 4239: <P> 4240: <STRONG>Example:</STRONG></P> 4241: <P> 1.3 cvs 4242: If, in the structure schema for mathematical formulas, the fraction element is 1.1 cvs 4243: defined by</P> 4244: <PRE> 4245: Fraction = BEGIN 4246: Numerator = Expression; 4247: Denominator = Expression; 4248: END; 4249: </PRE> 4250: <P> 1.3 cvs 4251: then the horizontal reference axis of the fraction can be positioned on top of 1.1 cvs 4252: the denominator by the rule:</P> 4253: <PRE> 4254: Fraction : 4255: BEGIN 4256: HorizRef : Enclosed Denominator . Top; 4257: ... 4258: END; 4259: </PRE> 4260: <P> 4261: To put the horizontal reference axis of a column at its middle:</P> 4262: <PRE> 4263: Column : 4264: BEGIN 4265: HorizRef : * . HMiddle; 4266: ... 4267: END; 4268: </PRE> 4269: </BLOCKQUOTE> 4270: </DIV> 4271: 4272: <DIV class="subsection"> 1.6 cvs 4273: <H3><A name=sectc4217>Distance units</A></H3> 1.1 cvs 4274: 4275: <P> 4276: Some distances and dimensions appear in many rules of a presentation schema, 4277: especially in position rules (<TT>VertPos, HorizPos</TT>), in extent rules for 4278: boxes (<TT>Height, Width</TT>), in rules defining lines (<TT>LineSpacing, 4279: Indent</TT>), in rules controlling pagination (<TT>NoBreak1, NoBreak2</TT>) 4280: and in rules specifying the thickness of strokes (<TT>LineWeight</TT>).</P> 4281: <P> 4282: In all these rules, the distance or extent can be expressed</P> 4283: <UL> 1.2 cvs 4284: <LI>either in relative units, which depend on the size of the characters in 4285: the current font: height of the element's font or height of the letter 'x', 4286: <LI>or in absolute units: centimeter, millimeter, inch, typographer's point, 1.1 cvs 4287: pica or pixel. 4288: </UL> 4289: <P> 1.5 cvs 4290: Units can be chosen freely. Thus, it is possible to use relative units in one 4291: rule, centimeters in the next rule, and typographer's points in another.</P> 1.1 cvs 4292: <P> 4293: Absolute units are used to set rigid rules for the appearance of documents. In 4294: contrast, relative units allow changes of scale. The editor lets the value of 4295: relative units be changed dynamically. Such changes affect every box using 4296: relative units simultaneously and in the same proportion. Changing the value 4297: of the relative units affects the size of the characters and graphical 4298: elements, and the size of the boxes and the distances between them.</P> 4299: <P> 4300: A <A name="distance">distance</A> or extent is specified by a number, which 4301: may be followed by one or more spaces and a units keyword. When there is no 4302: units keyword, the number specifies the number of relative units, where a 4303: relative unit is the height of a character in the current font (an em). When 4304: the number is followed by a units keyword, the keyword indicates the type of 4305: absolute units:</P> 4306: <UL> 4307: <LI><TT>em</TT>: height of the element's font, 4308: <LI><TT>ex</TT>: height of the letter 'x', 4309: <LI><TT>cm</TT>: centimeter, 4310: <LI><TT>mm</TT>: millimeter, 4311: <LI><TT>in</TT>: inch (1 in = 2.54 cm), 4312: <LI><TT>pt</TT>: point (1 pt = 1/72 in), 4313: <LI><TT>pc</TT>: pica (1 pc = 12 pt), 4314: <LI><TT>px</TT>: pixel. 4315: </UL> 4316: <P> 4317: Whatever the chosen unit, relative or absolute, the number is not necessarily 4318: an integer and may be expressed in fixed point notation (using the American 4319: convention of a period to express the decimal point).</P> 4320: <P> 4321: If the distance appears in a presentation rule for a numeric attribute, the 4322: number can be replaced by the name of an attribute. In this case, the value 4323: of the attribute is used. Obviously, the attribute name cannot be followed by 4324: a decimal point and a fractional part, but it can be followed a units keyword. 4325: However, the choice of units is limited to em, ex, pt and px.</P> 4326: <PRE> 4327: Distance = [ Sign ] AbsDist . 4328: Sign ='+' / '-' . 4329: AbsDist = IntegerOrAttr [ '.' DecimalPart ] 4330: [ Unit ]. 4331: IntegerOrAttr = IntegerPart / AttrID . 4332: IntegerPart = NUMBER . 4333: DecimalPart = NUMBER . 4334: Unit ='em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' / 4335: 'pc' / 'px' / '%' . 4336: </PRE> 4337: <BLOCKQUOTE class="example"> 4338: <P> 4339: <STRONG>Example:</STRONG></P> 4340: <P> 1.3 cvs 4341: The following rules specify that a box has a height of 10.5 centimeters and a 1.1 cvs 4342: width of 5.3 ems:</P> 4343: <PRE> 4344: Height : 10.5 cm; 1.6 cvs 4345: Width : 5.3; 1.1 cvs 4346: </PRE> 4347: </BLOCKQUOTE> 4348: </DIV> 4349: 4350: <DIV class="subsection"> 1.6 cvs 4351: <H3><A name=sectc4218>Relative positions</A></H3> 1.1 cvs 4352: 4353: <P> 4354: The positioning of boxes uses the eight axes and sides, the sides generally 4355: being used to define the juxtapositioning (vertical or horizontal) of boxes, 4356: the middle axes being used to define centering, and the reference axes being 4357: used for alignment.</P> 4358: <P> 4359: Two rules allow a box to placed relative to other boxes. The <TT>VertPos</TT> 4360: rule positions the box vertically. The <TT>HorizPos</TT> rule positions the 4361: box horizontally. It is possible that a box's position could be entirely 4362: determined by other boxes positioned relative to it. In this case, the 4363: position is implicit and the word <TT>nil</TT> can be used to specify that no 4364: position rule is needed. Otherwise, an explicit rule must be given by 4365: indicating the axis or side which defines the position of the box, followed by 4366: an equals sign and the distance between between this axis or side and a 4367: parallel axis or side of another box, called the reference box. The box for 4368: which the rule is written will be positioned relative to the reference 4369: box.</P> 4370: <PRE> 1.6 cvs 4371: 'VertPos' ':' VPos 4372: 'HorizPos' ':' HPos 4373: HPos = 'nil' / VertAxis '=' HorizPosition 4374: [ 'UserSpecified' ]. 4375: VPos = 'nil' / HorizAxis '=' VertPosition 4376: [ 'UserSpecified' ]. 1.1 cvs 4377: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' . 4378: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' . 4379: </PRE> 4380: <P> 4381: The reference box is an adjacent box: enclosing, enclosed or adjacent. When a 4382: rule is associated with a reference type attribute (and only in this case), it 4383: can be a box of the element designated by the attribute. The reference box 4384: can be either a presentation box previously defined in the <TT>BOXES</TT> 4385: section of the schema and created by a creation function, or the box 4386: associated with a structured element.</P> 4387: <P> 4388: The structural position of the reference box (relative to the box for which 4389: the rule is being written) is indicated by a keyword: <TT>Enclosing</TT>, 4390: <TT>Enclosed</TT>, or, for sibling boxes, <TT>Previous</TT> or <TT>Next</TT>. 4391: The reference attributes, or presentation boxes created by a reference 4392: attribute, the <TT>Referred</TT> keyword may be used to designate the element 4393: which the reference points to. The keyword <TT>Creator</TT> can be used in 4394: rules for presentation boxes to designate the box of the element which created 4395: the presentation box. Finally, the <TT>Root</TT> keyword can be used to 4396: designate the root of the document.</P> 4397: <P> 4398: When the keyword is ambiguous, it is followed by a name of a type or 4399: presentation box which resolves the ambiguity (the <TT>Creator</TT> and 4400: <TT>Root</TT> keywords are never ambiguous). If this name is not given, then 4401: the first box encountered is used as the reference box. It is also possible to 4402: use just the name of a type or presentation box without an initial keyword. In 4403: this case, a sibling having that name will be used. If the name is preceded 4404: by the keyword <TT>NOT</TT>, then the reference box will be the first box 4405: whose type is not the named one. In place of the box or type name, the 4406: keywords <TT>AnyElem</TT> and <TT>AnyBox</TT> can be used, representing 4407: respectively, any structured element box and any presentation box. A type 4408: name may be preceded by a star in order to resolve the ambiguity in the 4409: special case where the structure schema defines an <A 1.6 cvs 4410: href="#sectd3284">inclusion</A> without expansion (or with partial expansion) 1.1 cvs 4411: of the same type as an element of the scheme. For mark pairs (and only for <A 1.6 cvs 4412: href="#sectd3285">mark pairs</A>) the type name <EM>must</EM> be preceded by the 1.1 cvs 4413: <TT>First</TT> or <TT>Second</TT> keyword, which indicates which of the two 4414: marks of the pair should be used as the reference box.</P> 4415: <P> 4416: The star character ('<TT>*</TT>') used alone designates the box to which the 4417: rule applies (in this case, it is obviously useless to specify the type of the 4418: reference box).</P> 4419: <P> 4420: The keywords <TT>Enclosing</TT> and <TT>Enclosed</TT> can be used no matter 4421: what constructor defines the type to which the rule applies. When applied to 4422: the element which represents the entire document, <TT>Enclosing</TT> 4423: designates the window or page in which the document's image is displayed for 4424: the view to which the rule applies. A box or type name without a keyword is 4425: used for aggregate elements and designates another element of the same 4426: aggregate. It can also be used to designate a presentation or page layout 4427: box. The keywords <TT>Previous</TT> and <TT>Next</TT> are primarily used to 4428: denote list elements, but can also be used to denote elements of an 4429: aggregate.</P> 4430: <P> 4431: In the position rule, the structural position relative to the reference box is 4432: followed, after a period, by the name of an axis or side. The rule specifies 4433: its node's position as being some distance from this axis or side of the 4434: reference box. If this distance is zero, then the distance does not appear in 4435: the rule. Otherwise, it does appear as a positive or negative number (the 4436: sign is required for negative numbers). The sign takes into account the 4437: orientation of the coordinate axes: for top to bottom for the vertical axis 4438: and from left to right for the horizontal axis. Thus, a negative distance in 4439: a vertical position indicates that the side or axis specified in the rule is 4440: above the side or axis of the reference box.</P> 4441: <P> 4442: The distance can be followed by the <TT>UserSpecified</TT> keyword (even if 4443: the distance is nil and does not appear, the <TT>UserSpecified</TT> keyword 4444: can be used). It indicates that when the element to which the rule applies is 4445: being created, the editor will ask the user to specify the distance himself, 4446: using the mouse. In this case, the distance specified in the rule is a 4447: default distance which is suggested to the user but can be modified. The 4448: <TT>UserSpecified</TT> keyword can be used either in the vertical position 4449: rule, the horizontal position rule, or both.</P> 4450: <PRE> 4451: VertPosition = Reference '.' HorizAxis [ Distance ] . 4452: HorizPosition = Reference '.' VertAxis [ Distance ] . 4453: Reference ='Enclosing' [ BoxTypeNot ] / 4454: 'Enclosed' [ BoxTypeNot ] / 4455: 'Previous' [ BoxTypeNot ] / 4456: 'Next' [ BoxTypeNot ] / 4457: 'Referred' [ BoxTypeNot ] / 4458: 'Creator' / 4459: 'Root' / 4460: '*' / 4461: BoxOrType . 4462: BoxOrType = BoxID / 4463: [ '*' ] [ FirstSec ] ElemID / 4464: 'AnyElem' / 'AnyBox' . 4465: BoxTypeNot = [ 'NOT' ] BoxOrType . 4466: </PRE> 4467: <BLOCKQUOTE class="example"> 4468: <P> 4469: <STRONG>Example:</STRONG></P> 4470: <P> 1.5 cvs 4471: If a <A name="expos1">report</A> is defined by the following 1.3 cvs 4472: structure schema:</P> 1.1 cvs 4473: <PRE> 4474: Report = BEGIN 1.6 cvs 4475: Title = Text; 4476: Summary = Text; 4477: Keywords = Text; 4478: ... 4479: END; 1.1 cvs 4480: </PRE> 4481: <P> 4482: then the presentation schema could contain the rules:</P> 4483: <PRE> 4484: Report : BEGIN 1.6 cvs 4485: VertPos : Top = Enclosing . Top; 4486: HorizPos : Left = Enclosing . Left; 4487: ... 4488: END; 1.1 cvs 4489: </PRE> 4490: <P> 1.3 cvs 4491: These rules place the <A name="reportexample">report</A> in the upper left 4492: corner of the enclosing box, which is the window in which the document is being 1.1 cvs 4493: edited.</P> 4494: <PRE> 1.6 cvs 4495: Title : BEGIN 4496: VertPos : Top = Enclosing . Top + 1; 4497: HorizPos : VMiddle = Enclosing . VMiddle; 4498: ... 4499: END; 1.1 cvs 4500: </PRE> 4501: <P> 1.3 cvs 4502: The top of the title is one line (a line has the height of the characters of 4503: the title) from the top of the report, which is also the top of the editing 4504: window. The title is centered horizontally in the window (see <A 1.1 cvs 4505: href="#posdim">figure</A>).</P> 4506: <PRE> 1.6 cvs 4507: Summary : BEGIN 1.1 cvs 4508: VertPos : Top = Title . Bottom + 1.5; 4509: HorizPos : Left = Enclosing . Left + 2 cm; 4510: ... 4511: END; 4512: </PRE> 4513: <P> 1.3 cvs 4514: The top of the summary is place a line and a half below the bottom of the title 1.1 cvs 4515: and is shifted two centimeters from the side of the window.</P> 4516: </BLOCKQUOTE> 4517: <BLOCKQUOTE class="example"> 4518: <P> 4519: <STRONG>Example:</STRONG></P> 4520: <P> 1.3 cvs 4521: Suppose there is a <A name="expos2">Design</A> logical structure which contains 1.1 cvs 4522: graphical elements:</P> 4523: <PRE> 4524: Design = LIST OF (ElemGraph = GRAPHICS); 4525: </PRE> 4526: <P> 1.3 cvs 4527: The following rules allow the user to freely choose the position of each 1.1 cvs 4528: element when it is created:</P> 4529: <PRE> 4530: ElemGraph = 4531: BEGIN 4532: VertPos : Top = Enclosing . Top + 1 cm UserSpecified; 4533: HorizPos: Left = Enclosing . Left UserSpecified; 4534: ... 4535: END; 4536: </PRE> 4537: <P> 1.3 cvs 4538: Thus, when a graphical element is created, its default placement is at the left 4539: of the window and 1 cm from the top, but the user can move it immediately, 1.1 cvs 4540: simply by moving the mouse.</P> 4541: </BLOCKQUOTE> 4542: </DIV> 4543: 4544: <DIV class="subsection"> 1.6 cvs 4545: <H3><A name=sectc4219>Box extents</A></H3> 1.1 cvs 4546: 4547: <P> 4548: The extents (height and width) of each box are defined by the two rules 4549: <TT>Height</TT> and <TT>Width</TT>. There are three types of extents: fixed, 4550: relative, and elastic.</P> 4551: 4552: <DIV class="subsubsection"> 1.6 cvs 4553: <H4><A name=sectd42191>Fixed extents</A></H4> 1.1 cvs 4554: 4555: <P> 4556: A fixed dimension sets the height or width of the box independently of all 1.6 cvs 4557: other boxes. It is expressed in <A href="#sectc4217">distance units</A>. The 1.1 cvs 4558: extent can be followed by the <TT>UserSpecified</TT> keyword which indicates 4559: that when the element to which the rule applies is being created, the editor 4560: will ask the user to specify the extent himself, using the mouse. In this 4561: case, the extent specified in the rule is a default extent which is suggested 4562: to the user but can be modified. The <TT>UserSpecified</TT> keyword can be 4563: used either in the <TT>Height</TT> rule, the <TT>Width</TT> rule, or both.</P> 4564: <P> 4565: A fixed extent rule can be ended by the <TT>Min</TT> keyword, which signifies 4566: that the indicated value is a minimum, and that, if the contents of the box 4567: require it, a larger extent is possible.</P> 4568: <PRE> 4569: 'Height' ':' Dimension 4570: 'Width' ':' Dimension 4571: Dimension = AbsDist [ 'UserSpecified' ] [ 'Min' ] / 4572: ... 4573: </PRE> 4574: <BLOCKQUOTE class="example"> 4575: <P> 4576: <STRONG>Example:</STRONG></P> 4577: <P> 1.3 cvs 4578: Continuing with the <A href="#expos2">previous example</A>, it is possible to 4579: allow the user to choose the size of each graphical element as it is 1.1 cvs 4580: created:</P> 4581: <PRE> 4582: ElemGraph : BEGIN 1.6 cvs 4583: Width : 2 cm UserSpecified; 1.1 cvs 4584: Height : 1 cm UserSpecified; 4585: ... 4586: END; 4587: </PRE> 4588: <P> 4589: Thus, when a graphical element is create, it is drawn by default with a width 4590: of 2 cm and a height of 1 cm, but the user is free to resize it immediately 4591: with the mouse.</P> 4592: <PRE> 4593: Summary : BEGIN 4594: Height : 5 cm Min; 4595: ... 4596: END; 4597: Keywords : BEGIN 4598: VertPos : Top = Summary . Bottom; 4599: ... 4600: END; 4601: </PRE> 4602: </BLOCKQUOTE> 4603: </DIV> 4604: 4605: <DIV class="subsubsection"> 1.6 cvs 4606: <H4><A name=sectd42192>Relative extents</A></H4> 1.1 cvs 4607: 4608: <P> 4609: A relative extent determines the extent as a function of the extent of another 4610: box, just as a relative position places a box in relation to another. The 4611: reference box in an extent rule is designated using the same syntax as is used 4612: in a relative position rule. It is followed by a period and a <TT>Height</TT> 4613: or <TT>Width</TT> keyword, depending on the extent being referred to. Next 4614: comes the relation between the extent being defined and the extent of the 4615: reference box. This relation can be either a percentage or a difference.</P> 4616: <P> 4617: A percentage is indicated by a star (the multiplication symbol) followed by 4618: the numeric percentage value (which may be greater than or less than 100) and 4619: the percent (`%') character. A difference is simply indicated by a signed 4620: difference.</P> 4621: <P> 4622: If the rule appears in the presentation rules of a numeric attribute, the 4623: percentage value can be replaced by the name of the attribute. This attribute 4624: is then used as a percentage. The attribute can also be used as part of a <A 4625: href="#distance">difference</A>.</P> 4626: <P> 4627: Just as with a fixed extent, a relative extent rule can end with the 4628: <TT>Min</TT> keyword, which signifies that the extent is a minimum and that, 4629: if the contents of the box require it, a larger extent is possible.</P> 4630: <P> 4631: A special case of relative extent rules is:</P> 4632: <PRE> 4633: Height : Enclosed . Height; 4634: </PRE> 4635: <P> 4636: or</P> 4637: <PRE> 4638: Width : Enclosed . Width; 4639: </PRE> 4640: <P> 1.5 cvs 4641: which specifies that the box has a height (or width) such that it encloses all 4642: the boxes which it contains, excluding boxes having a rule <TT>VertOverflow: 4643: Yes;</TT> or <TT>HorizOverflow: Yes;</TT>.</P> 1.1 cvs 4644: <P> 4645: <STRONG>Note:</STRONG> character strings (type <TT>TEXT_UNIT</TT>) generally 4646: must use the sum of the widths of the characters which compose them as their 4647: width, which is expressed by the rule:</P> 4648: <PRE> 4649: TEXT_UNIT : 1.6 cvs 4650: Width : Enclosed . Width; 1.1 cvs 4651: </PRE> 4652: <P> 1.5 cvs 4653: If this rule is not the default <TT>Width</TT> rule, it must be given 4654: explicitly in the <TT>RULES</TT> section which defines the presentation rules 4655: of the logical elements.</P> 1.1 cvs 4656: <PRE> 4657: 'Height' ':' Extent 4658: 'Width' ':' Extent 4659: Extent = Reference '.' HeightWidth [ Relation ] 4660: [ 'Min' ] / ... 4661: HeightWidth ='Height' / 'Width' . 4662: Relation ='*' ExtentAttr '%' / Distance . 4663: ExtentAttr = ExtentVal / AttrID . 4664: ExtentVal = NUMBER . 4665: </PRE> 4666: <BLOCKQUOTE class="example"> 4667: <P> 4668: <STRONG>Example:</STRONG></P> 4669: <P> 1.3 cvs 4670: Completing the <A href="#expos1">above example</A>, it is possible to specify 4671: that the report takes its width from the editing window and its height from the 4672: size of its contents (this can obviously be greater than that of the 1.1 cvs 4673: window):</P> 4674: <PRE> 4675: Report : BEGIN 4676: Width : Enclosing . Width; 4677: Height : Enclosed . Height; 4678: ... 4679: END; 4680: </PRE> 4681: <P> 1.3 cvs 4682: Then, the following rules make the title occupy 60% of the width of the report 4683: (which is that of the window) and is broken into centered lines of this width 1.6 cvs 4684: (see the <A href="#sectc4222"><TT>Line</TT> rule</A>).</P> 1.1 cvs 4685: <PRE> 4686: Title : BEGIN 4687: Width : Enclosing . Width * 60%; 4688: Height : Enclosed . Height; 4689: Line; 4690: Adjust : VMiddle; 4691: ... 4692: END; 4693: </PRE> 4694: <P> 1.5 cvs 4695: The summary occupy the entire width of the window, with the exception of a 2 cm 1.1 cvs 4696: margin reserved by the horizontal position rule:</P> 4697: <PRE> 4698: Summary : BEGIN 4699: Width : Enclosing . Width - 2 cm; 4700: Height : Enclosed . Height; 4701: ... 4702: END; 4703: </PRE> 4704: <P> 4705: This set of rules, plus the <A href="#reportexample">position rules given 4706: above</A>, produce the layout of boxes shown in the following<A 4707: href="#posdim">figure</A>.</P> 4708: 4709: <DIV class="figure"> 4710: <HR> 4711: <PRE> 4712: ------------------------------------------------------------- 4713: | Window and Report ^ | 4714: | | 1 line | 4715: | v | 4716: | ------------------------------------- | 4717: | | | | 4718: : 20% : Title : 20% : 4719: :<--------->: :<--------->: 4720: : : 60% : : 4721: : :<--------------------------------->: : 4722: | | | | 4723: | ------------------------------------- | 4724: | ^ | 4725: | | 1.5 line | 4726: | | | 4727: | v | 4728: | ---------------------------------------------------| 4729: | 2 cm | | 4730: |<------>| Summary | 4731: : : : 4732: </PRE> 4733: <P align=center> 4734: <EM><A name="posdim">Box position and extent</A><EM></EM></EM></P> 4735: <HR> 4736: </DIV> 4737: </BLOCKQUOTE> 4738: </DIV> 4739: 4740: <DIV class="subsubsection"> 1.6 cvs 4741: <H4><A name=sectd42193>Elastic extents</A></H4> 1.1 cvs 4742: 4743: <P> 4744: The last type of extent is the elastic extent. Either one or both extents can 4745: be elastic. A box has an elastic extent when two opposite sides are linked by 4746: distance constraints to two sides or axes of other boxes.</P> 4747: <P> 4748: One of the sides of the elastic box is linked by a position rule 4749: (<TT>VertPos</TT> or <TT>HorizPos</TT>) to a neighboring box. The other side 4750: is link to another box by a <TT>Height</TT> or <TT>Width</TT> rule, which 4751: takes the same form as the position rule. For the elastic box itself, the 4752: notions of sides (left or right, top or bottom) are fuzzy, since the movement 4753: of either one of the two reference boxes can, for example, make the left side 4754: of the elastic box move to the right of its right side. This is not 4755: important. The only requirement is that the two sides of the elastic box used 4756: in the position and extent rule are opposite sides of the box.</P> 4757: <PRE> 1.6 cvs 4758: 'Height' ':' Extent 4759: 'Width' ':' Extent 4760: Extent = HPos / VPos / ... 1.1 cvs 4761: </PRE> 4762: <BLOCKQUOTE class="example"> 4763: <P> 4764: <STRONG>Example:</STRONG></P> 4765: <P> 1.3 cvs 4766: Suppose we want to draw an elastic arrow or line between the middle of the 4767: bottom side of box A and the upper left corner of box B. To do this, we would 4768: define a graphics box whose upper left corner coincides with the middle of the 4769: bottom side of A (a position rule) and whose lower right corner coincides with 4770: with the upper left corner of B (dimension rules):</P> 1.1 cvs 4771: <PRE> 4772: LinkedBox : 4773: BEGIN 1.6 cvs 4774: VertPos : Top = A .Bottom; 1.1 cvs 4775: HorizPos : Left = A . VMiddle; 1.6 cvs 4776: Height : Bottom = B . Top; 4777: Width : Right = B . Left; 1.1 cvs 4778: END; 4779: </PRE> 4780: </BLOCKQUOTE> 4781: <BLOCKQUOTE class="example"> 4782: <P> 4783: <STRONG>Example:</STRONG></P> 4784: <P> 1.3 cvs 4785: The element SectionTitle creates a presentation box called SectionNum which 4786: contains the number of the section. Suppose we want to align the SectionNum 4787: and SectionTitle horizontally, have the SectionNum take its width from its 4788: contents (the section number), have the SectionTitle box begin 0.5 cm to the 4789: right of the SectionNum box and end at the right edge of its enclosing box. 4790: This would make the SectionTitle box elastic, since its width is defined by the 4791: position of its left and right sides. The following rules produce this 1.1 cvs 4792: effect:</P> 4793: <PRE> 4794: SectionNum : 4795: BEGIN 4796: HorizPos : Left = Enclosing . Left; 4797: Width : Enclosed . Width; 4798: ... 4799: END; 4800: 4801: SectionTitle : 4802: BEGIN 4803: HorizPos : Left = SectionNum . Right + 0.5 cm; 4804: Width : Right = Enclosing . Right; 4805: ... 4806: END; 4807: </PRE> 4808: </BLOCKQUOTE> 4809: </DIV> 4810: </DIV> 4811: 4812: <DIV class="subsection"> 1.6 cvs 4813: <H3><A name="sectc4220">Overflow</A></H3> 1.1 cvs 4814: 4815: <P> 4816: A boxes corresponding to a structural element normally contain all boxes 4817: corresponding to the elements of its subtree. However, in some cases, it 4818: could be necessary to allow a box to jut out from its parent box. Two 4819: presentation rules indicate that such an overflow is allowed, one for 4820: horizontal overflow, one for vertical overflow.</P> 4821: <P> 4822: Each of these rules is expressed by a keyword followed by a colon and the 4823: keyword <TT>Yes</TT> or <TT>No</TT>.</P> 4824: <PRE> 4825: 'VertOverflow' ':' Boolean / 4826: 'HorizOverflow' ':' Boolean . 4827: Boolean = 'Yes' / 'No' . 4828: </PRE> 4829: </DIV> 4830: 4831: <DIV class="subsection"> 1.6 cvs 4832: <H3><A name=sectc4221>Inheritance</A></H3> 1.1 cvs 4833: 4834: <P> 4835: A presentation parameter can be defined by reference to the same parameter of 4836: another box in the tree of boxes. These structural links are expressed by 4837: kinship. The reference box can be that of the element immediately above in 4838: the structure (<TT>Enclosing</TT>), two levels above (<TT>GrandFather</TT>), 4839: immediately below (<TT>Enclosed</TT>) or immediately before 4840: (<TT>Previous</TT>). In the case of a presentation box, and only in that 4841: case, the reference box may be the element which created the presentation box 4842: (<TT>Creator</TT>).</P> 4843: <P> 4844: Kinship is expressed in terms of the logical structure of the document and not 4845: in terms of the tree of boxes. The presentation box cannot transmit any of 4846: their parameters by inheritance; only structured element boxes can do so. As 4847: an example, consider an element B which follows an element A in the logical 4848: structure. The element B creates a presentation box P in front of itself, 1.6 cvs 4849: using the <TT>CreateBefore</TT> rule (see the <A href="#sectc4232">creation 1.1 cvs 4850: rules</A>). If element B's box inherits its character style using the 4851: <TT>Previous</TT> kinship operation, it gets its character style from A's box, 4852: not from P's box. Inheritance works differently for positions and extents, 4853: which can refer to presentation boxes.</P> 4854: <P> 4855: The inherited parameter value can be the same as that of the reference box. 4856: This is indicated by an equals sign. However, for numeric parameters, a 4857: different value can be obtained by adding or subtracting a number from the 4858: reference box's parameter value. Addition is indicated by a plus sign before 4859: the number, while subtraction is specified with a minus sign. The value of a 4860: parameter can also be given a maximum (if the sign is a plus) or minimum (if 4861: the sign is a minus).</P> 4862: <P> 4863: If the rule is being applied to a numeric attribute, the number to add or 4864: subtract can be replaced by the attribute name. The value of a maximum or 4865: minimum may also be replaced by an attribute name. In these cases, the value 4866: of the attribute is used.</P> 4867: <PRE> 1.6 cvs 4868: Inheritance = Kinship InheritedValue . 4869: Kinship ='Enclosing' / 'GrandFather' / 'Enclosed' / 4870: 'Previous' / 'Creator' . 1.1 cvs 4871: InheritedValue ='+' PosIntAttr [ 'Max' maximumA ] / 1.6 cvs 4872: '-' NegIntAttr [ 'Min' minimumA ] / 4873: '=' . 4874: PosIntAttr = PosInt / AttrID . 4875: PosInt = NUMBER . 4876: NegIntAttr = NegInt / AttrID . 4877: NegInt = NUMBER . 4878: maximumA = maximum / AttrID . 4879: maximum = NUMBER . 4880: minimumA = minimum / AttrID . 4881: minimum = NUMBER . 1.1 cvs 4882: </PRE> 4883: <P> 4884: The parameters which can be obtained by inheritance are justification, 4885: hyphenation, interline spacing, character font (font family), font style, font 4886: size, visibility, indentation, underlining, alignment of text, stacking order 4887: of objects, the style and thickness of lines, fill pattern and the colors of 4888: lines and characters.</P> 4889: </DIV> 4890: 4891: <DIV class="subsection"> 1.6 cvs 4892: <H3><A name=sectc4222>Line breaking</A></H3> 1.1 cvs 4893: 4894: <P> 4895: The <TT>Line</TT> rule specifies that the contents of the box should be broken 4896: into lines: the boxes included in the box to which this rule is attached are 4897: displayed one after the other, from left to right, with their horizontal 4898: reference axes aligned so that they form a series of lines. The length of 4899: these lines is equal to the width of the box to which the <TT>Line</TT> rule 4900: is attached.</P> 4901: <P> 4902: When an included box overflows the current line, it is either carried forward 4903: to the next line, cur, or left the way it is. The <A 1.6 cvs 4904: href="#sectc4223"><TT>LineBreak</TT> rule</A> is used to allow or prevent the 1.1 cvs 4905: breaking of included boxes. If the included box is not breakable but is 4906: longer than the space remaining on the line, it is left as is. When a 4907: character string box is breakable, the line is broken between words or, if 1.6 cvs 4908: necessary, by <A href="#sectd42225">hyphenating a word</A>. When a 1.1 cvs 4909: compound box is breakable, the box is transparent in regard to line breaking. 4910: The boxes included in the compound box are treated just like included boxes 4911: which have the <TT>LineBreak</TT> rule. Thus, it is possible to traverse a 4912: complete subtree of boxes to line break the text leaves of a complex 4913: structure.</P> 4914: <P> 4915: The relative position rules of the included boxes are ignored, since the boxes 4916: will be placed according to the line breaking rules.</P> 4917: <P> 4918: The <TT>Line</TT> rule does not have a parameter. The characteristics of the 4919: lines that will be constructed are determined by the <TT>LineSpacing</TT>, 4920: <TT>Indent</TT>, <TT>Adjust</TT>, <TT>Justify</TT>, and <TT>Hyphenate</TT> 1.6 cvs 4921: rules. Moreover, the <A href="#insectd42226"><TT>Inline</TT> rule</A> permits 1.1 cvs 4922: the exclusion of certain elements from the line breaking process.</P> 4923: <P> 4924: When the <TT>Line</TT> rule appears in the rules sequence of a non-primary 4925: view, it applies only to that view, but when the <TT>Line</TT> rule appears in 4926: the rules sequence of the primary view, it also applies to the other views by 4927: default, except for those views which explicitly invoke the <TT>NoLine</TT> 4928: rule. Thus, the <TT>NoLine</TT> rule can be used in a non-primary view to 4929: override the primary view's <TT>Line</TT> rule. The <TT>NoLine</TT> rule must 4930: not be used with the primary view because the absence of the <TT>Line</TT> 4931: rule has the same effect. Like the <TT>Line</TT> rule, the <TT>NoLine</TT> 4932: rule does not take any parameters.</P> 4933: <PRE> 1.6 cvs 4934: 'Line' 4935: 'NoLine' 1.1 cvs 4936: </PRE> 4937: 4938: <DIV class="subsubsection"> 1.6 cvs 4939: <H4><A name=sectd42221>Line spacing</A></H4> 1.1 cvs 4940: 4941: <P> 4942: The <TT>LineSpacing</TT> rule defines the line spacing to be used in the line 4943: breaking process. The line spacing is the distance between the baselines 4944: (horizontal reference axis) of the successive lines produced by the 4945: <TT>Line</TT> rule. The value of the line spacing can be specified as a 4946: constant or by inheritance. It is expressed in any of the available <A 1.6 cvs 4947: href="#sectc4217">distance units</A>.</P> 1.1 cvs 4948: <P> 4949: Inheritance allows the value to be obtained from a relative in the structure 4950: tree, either without change (an equals sign appears after the inheritance 4951: keyword), with a positive difference (a plus sign), or a negative difference 4952: (a minus sign). When the rule uses a difference, the value of the difference 1.6 cvs 4953: follows the sign and is expressed as a <A href="#sectc4217">distance</A>.</P> 1.1 cvs 4954: <PRE> 1.6 cvs 4955: 'LineSpacing' ':' DistOrInherit 4956: DistOrInherit = Kinship InheritedDist / Distance . 1.1 cvs 4957: InheritedDist = '=' / '+' AbsDist / '-' AbsDist . 4958: </PRE> 4959: <P> 4960: When the line spacing value (or its difference from another element) is 4961: expressed in relative units, it changes with the size of the characters. Thus, 4962: when a larger font is chosen for a part of the document, the line spacing of 4963: that part expands proportionally. In contrast, when the line spacing value is 4964: expressed in absolute units (centimeters, inches, typographer's points), it is 4965: independent of the characters, which permits the maintenance of a consistent 4966: line spacing, whatever the character font. Either approach can be taken, 4967: depending on the desired effect.</P> 4968: </DIV> 4969: 4970: <DIV class="subsubsection"> 1.6 cvs 4971: <H4><A name=sectd42222>First line indentation</A></H4> 1.1 cvs 4972: 4973: <P> 4974: The <TT>Indent</TT> rule is used to specify the indentation of the first line 4975: of the elements broken into lines by the <TT>Line</TT> function. The 4976: indentation determines how far the first line of the element is shifted with 4977: respect to the other lines of the same element. It can be specified as a 4978: constant or by inheritance. The constant value is a positive integer (shifted 4979: to the right; the sign is optional), a negative integer (shifted to the left) 1.6 cvs 4980: or zero (no shift). All available <A href="#sectc4217">units</A> can be 1.1 cvs 4981: used.</P> 4982: <P> 4983: Indentation can be defined for any box, regardless of whether the box is line 4984: broken, and transmitted by inheritance to elements that are line broken. The 4985: size of the indentation is specified in the same manner as the <A 1.6 cvs 4986: href="#sectd42221">line spacing</A>.</P> 1.1 cvs 4987: <PRE> 1.6 cvs 4988: 'Indent' ':' DistOrInherit 1.1 cvs 4989: </PRE> 4990: </DIV> 4991: 4992: <DIV class="subsubsection"> 1.6 cvs 4993: <H4><A name=sectd42223>Alignment</A></H4> 1.1 cvs 4994: 4995: <P> 4996: The alignment style of the lines constructed during line breaking is defined 4997: by the <TT>Adjust</TT> rule. The alignment value can be a constant or 4998: inherited. A constant value is specified by a keyword:</P> 4999: <UL> 5000: <LI><TT>Left</TT>: at the left edge, 5001: <LI><TT>Right</TT>: at the right edge, 5002: <LI><TT>VMiddle</TT>: centered 1.2 cvs 5003: <LI><TT>LeftWithDots</TT>: at the left edge with a dotted line filling out the 1.1 cvs 5004: last line up to the right edge of the line breaking box. 5005: </UL> 5006: <P> 5007: An inherited value can only be the same as that of the reference box and is 5008: specified by a kinship keyword followed by an equals sign.</P> 5009: <PRE> 1.6 cvs 5010: 'Adjust' ':' AlignOrInherit 1.1 cvs 5011: AlignOrInherit = Kinship '=' / Alignment . 5012: Alignment = 'Left' / 'Right' / 'VMiddle' / 5013: 'LeftWithDots' . 5014: </PRE> 5015: </DIV> 5016: 5017: <DIV class="subsubsection"> 1.6 cvs 5018: <H4><A name=sectd42224>Justification</A></H4> 1.1 cvs 5019: 5020: <P> 5021: The <TT>Justify</TT> rule indicates whether the lines contained in the box and 5022: produced by a <TT>Line</TT> rule should be extended horizontally to occupy the 5023: entire width of their enclosing box. The first and last lines are treated 5024: specially: the position of the beginning of the first line is fixed by the 5025: <TT>Indent</TT> rule and last line is not extended. The justification 5026: parameter defined by this rule takes a boolean value, which can be a constant 5027: or inherited. A constant boolean value is expressed by either the 5028: <TT>Yes</TT> or the <TT>No</TT> keyword. An inherited value can only be the 5029: same as that of the reference box and is specified by a kinship keyword 5030: followed by an equals sign.</P> 5031: <PRE> 1.6 cvs 5032: 'Justify' ':' BoolInherit 1.1 cvs 5033: BoolInherit = Boolean / Kinship '=' . 1.6 cvs 5034: Boolean ='Yes' / 'No' . 1.1 cvs 5035: </PRE> 5036: <P> 5037: When the lines are justified, the alignment parameter specified in the 5038: <TT>Adjust</TT> rule has no influence, other than on the last line produced. 5039: This occurs because, when the other are extended to the limits of the box, the 5040: alignment style is no longer perceptible.</P> 5041: <BLOCKQUOTE class="example"> 5042: <P> 5043: <STRONG>Example:</STRONG></P> 5044: <P> 1.3 cvs 5045: An important use of inheritance is to vary the characteristics of lines for an 5046: element type (for example, Paragraph) according to the enclosing environment 5047: (for example, Summary or Section), and thus obtain different line breaking 5048: styles for the same elements when they appear in different environments. The 5049: following rules specify that paragraphs inherit their alignment, justification, 1.1 cvs 5050: and line spacing:</P> 5051: <PRE> 5052: Paragraph : 5053: BEGIN 5054: Justify : Enclosing = ; 5055: LineSpacing : Enclosing = ; 5056: Adjust : Enclosing =; 5057: Line; 5058: END; 5059: </PRE> 5060: <P> 1.5 cvs 5061: If the alignment, justification, and line spacing of the Section and Summary 1.1 cvs 5062: elements is fixed:</P> 5063: <PRE> 5064: Section : 5065: BEGIN 5066: Adjust : Left; 5067: Justify : Yes; 5068: LineSpacing : 1; 5069: END; 5070: Summary : 5071: BEGIN 5072: Adjust : VMiddle; 5073: Justify : No; 5074: LineSpacing : 1.3; 5075: END; 5076: </PRE> 5077: <P> 1.4 cvs 5078: then the paragraphs appearing in sections are justified with a simple line 5079: spacing while those appearing in summaries are centered and not justified and 5080: have a larger line spacing. These are nevertheless the very same type of 1.1 cvs 5081: paragraph defined in the logical structure schema.</P> 5082: </BLOCKQUOTE> 5083: </DIV> 5084: 5085: <DIV class="subsubsection"> 1.6 cvs 5086: <H4><A name=sectd42225>Hyphenation</A></H4> 1.1 cvs 5087: 5088: <P> 5089: The <TT>Hyphenate</TT> rule indicates whether or not words should be broken by 5090: hyphenation at the end of lines. It affects the lines produced by the 5091: <TT>Line</TT> rule and contained in the box carrying the <TT>Hyphenate</TT> 5092: rule.</P> 5093: <P> 5094: The hyphenation parameter takes a boolean value, which can be either constant 5095: or inherited. A constant boolean value is expressed by either the 5096: <TT>Yes</TT> or the <TT>No</TT> keyword. An inherited value can only be the 5097: same as that of the reference box and is specified by a kinship keyword 5098: followed by an equals sign.</P> 5099: <PRE> 5100: 'Hyphenate' ':' BoolInherit 5101: BoolInherit = Boolean / Kinship '=' . 5102: Boolean = 'Yes' / 'No' . 5103: </PRE> 5104: </DIV> 5105: 5106: <DIV class="subsubsection"> 1.6 cvs 5107: <H4><A name=sectd42226>Avoiding line breaking</A></H4> 1.1 cvs 5108: 5109: <P> 5110: The <TT>InLine</TT> rule is used to specify that a box that would otherwise 5111: participate in line breaking asked for by the <TT>Line</TT> rule of an 5112: enclosing box, instead avoids the line breaking process and positions itself 5113: according to the <TT>HorizPos</TT> and <TT>VertPos</TT> rules that apply to 5114: it. When the <TT>InLine</TT> rule applies to a box which would not be line 5115: broken, it has no effect.</P> 5116: <P> 5117: The rule is expressed by the <TT>InLine</TT> keyword followed by a colon and 5118: the keyword <TT>Yes</TT>, if the box should participate in line breaking, or 5119: the keyword <TT>No</TT>, if it should not. This is the only form possible: 5120: this rule cannot be inherited. Moreover, it can only appear in the rules of 5121: the primary view and applies to all views defined in the presentation 5122: schema.</P> 5123: <PRE> 5124: 'InLine' ':' Boolean . 5125: Boolean = 'Yes' / 'No' . 5126: </PRE> 5127: <BLOCKQUOTE class="example"> 5128: <P> 5129: <STRONG>Example:</STRONG></P> 5130: <P> 5131: Suppose the structure schema defines a logical attribute 1.3 cvs 5132: called <TT>New</TT> which is used to identify the passages in a document which 1.5 cvs 5133: were recently modified. It would be nice to have the presentation schema make 5134: a bar appear in the left margin next to each passage having 1.3 cvs 5135: the <TT>New</TT> attribute. A new passage can be an entire element, such as a 5136: paragraph or section, or it can be some words in the middle of a paragraph. To 5137: produce the desired effect, the <TT>New</TT> attribute is given a creation rule 5138: which generates a <TT>VerticalBar</TT> presentation box.</P> 1.1 cvs 5139: <P> 5140: When the <TT>New</TT> attribute is attached to a character string which is 5141: inside a line broken element (inside a paragraph, for example), the bar is one 5142: of the elements which participates in line breaking and it is placed normally 5143: in the current line, at the end of the character string which has the 5144: attribute. To avoid this, the <TT>InLine</TT> rule is used in the following 5145: way:</P> 5146: <PRE> 5147: BOXES 5148: VerticalBar: 5149: BEGIN 5150: Content: Graphics 'l'; 5151: HorizPos: Left = Root . Left; 5152: VertPos: Top = Creator . Top; 5153: Height: Bottom = Creator . Bottom; 5154: Width: 1 pt; 5155: InLine: No; 5156: ... 5157: END; 5158: ... 5159: ATTRIBUTES 5160: Nouveau: 5161: BEGIN 5162: CreateAfter(VerticalBar); 5163: END; 5164: </PRE> 5165: </BLOCKQUOTE> 5166: </DIV> 5167: </DIV> 5168: 5169: <DIV class="subsection"> 1.6 cvs 5170: <H3><A name=sectc4223>Page breaking and line breaking conditions</A></H3> 1.1 cvs 5171: 5172: <P> 5173: Pages are constructed by the editor in accordance with the model specified by 1.6 cvs 5174: a <A href="#sectc4233"><TT>Page</TT> rule</A>. The page model describes only the 1.1 cvs 5175: composition of the pages but does not give any rules for breaking different 5176: element types across pages. Now, it is possible that certain elements must 5177: not be cut by page breaks, while others can be cut anywhere. The 5178: <TT>PageBreak</TT>, <TT>NoBreak1</TT>, and <TT>NoBreak2</TT> rules are used to 5179: specify the conditions under which each element type can be cut.</P> 5180: <P> 5181: The <TT>PageBreak</TT> rule is used to indicate whether or not the box can be 5182: cut during the construction of pages. If cutting is authorized, the box can 5183: be cut, with one part appearing at the bottom of a page and the other part 5184: appearing at the top of the next page. The rule is formed by the 5185: <TT>PageBreak</TT> keyword followed by a colon and a constant boolean value 5186: (<TT>Yes</TT> or <TT>No</TT>). This is the only form possible: this rule 5187: cannot be inherited. Moreover, it can only appear in the rules of the primary 5188: view and applies to all views defined in the presentation schema.</P> 5189: <P> 5190: Whether objects can be cut by line breaks can be controlled in a similar way 5191: using the <TT>LineBreak</TT> rule. This rule allows the specification of 5192: whether or not the box can be cut during the construction of lines. If 5193: cutting is authorized, the box can be cut, with one part appearing at the end 5194: of a line and the other part appearing at the beginning of the next line. The 5195: rule is formed by the <TT>LineBreak</TT> keyword followed by a colon and a 5196: constant boolean value (<TT>Yes</TT> or <TT>No</TT>). This is the only form 5197: possible: this rule cannot be inherited. Moreover, it can only appear in the 5198: rules of the primary view and applies to all views defined in the presentation 5199: schema.</P> 5200: <PRE> 5201: 'PageBreak' ':' Boolean . 5202: 'LineBreak' ':' Boolean . 5203: Boolean = 'Yes' / 'No' . 5204: </PRE> 5205: <P> 5206: When a box can be cut by a page break, it is possible that a page break will 5207: fall an inappropriate spot, creating, for example, a widow or orphan, or 5208: separating the title of a section from the first paragraph of the section. The 5209: <TT>NoBreak1</TT> and <TT>NoBreak2</TT> rules are used to avoid this. They 1.12 ! cvs 5210: specify that the box of the element to which they apply cannot be cut within ! 5211: a certain zone at the top (<TT>NoBreak1</TT> rule) or at the bottom 1.1 cvs 5212: (<TT>NoBreak2</TT> rule). These two rules specify the height of the zones in 5213: which page breaks are prohibited.</P> 5214: <P> 5215: The <TT>NoBreak1</TT> and <TT>NoBreak2</TT> rules give the height of the zone 5216: in which page breaking is prohibited. The height is given as a constant value 1.6 cvs 5217: using any of the <A href="#sectc4217">available units</A>, absolute or 1.1 cvs 5218: relative. The value may not be inherited.</P> 5219: <PRE> 5220: 'NoBreak1' ':' AbsDist . 5221: 'NoBreak2' ':' AbsDist . 5222: </PRE> 5223: <BLOCKQUOTE class="example"> 5224: <P> 5225: <STRONG>Example:</STRONG></P> 5226: <P> 1.3 cvs 5227: The following rules prevent widows and orphans in a paragraph:</P> 1.1 cvs 5228: <PRE> 5229: Paragraph : 5230: BEGIN 5231: NoBreak1 : 2; 5232: NoBreak2 : 2; 5233: END; 5234: </PRE> 5235: <P> 1.3 cvs 5236: This rule prevents a section title from becoming separated from the first 5237: paragraph of the section by prohibiting page breaks at the beginning of the 1.1 cvs 5238: section rule:</P> 5239: <PRE> 5240: Section : 5241: NoBreak1 : 1.5 cm; 5242: </PRE> 5243: <P> 5244: Finally, this rule prevents a figure from being page broken in any way:</P> 5245: <PRE> 5246: Figure : 5247: PageBreak : No; 5248: </PRE> 5249: </BLOCKQUOTE> 5250: <P> 5251: The Thot editor constructs the document images displayed on the screen 5252: dynamically. As the user moves in the document or makes the document scroll 5253: in a window, the editor constructs the image to be displayed in little bits, 5254: filling the gaps which are produced in the course of these operations. It 5255: stops filling in the image when an element reaches the edge of the window in 5256: which the gap appears. If the appearance of the document is complex, it is 5257: possible that the image in incomplete, even though the edge of the window was 5258: reached. For example, an element might need to be presented to the side of 5259: the last element displayed, but its image was not constructed. The user will 5260: not know whether the element is really absent or if its image has simply not 5261: been constructed.</P> 5262: <P> 5263: The <TT>Gather</TT> rule is used to remedy this problem. When the rule 5264: <TT>Gather : Yes;</TT> is associated with an element type, the image of such 5265: elements is constructed as a block by the editor: it is never split up.</P> 5266: <P> 5267: The <TT>Gather</TT> rule may not appear in the <A 1.6 cvs 5268: href="#sectc427">default rules</A>. Elements which do not have the 1.1 cvs 5269: <TT>Gather</TT> rule are considered susceptible to being split up during 5270: display. Thus, it is not necessary to use the <TT>Gather : No;</TT> form. 5271: This rule must be used prudently and only for those elements which truly need 5272: it. If used incorrectly, it can pointlessly increase the size of the image 5273: constructed by the editor and lead to excessive memory consumption by the 5274: editor.</P> 5275: <P> 5276: Like the <TT>PageBreak</TT> and <TT>LineBreak</TT> rules, the <TT>Gather</TT> 5277: rule can only appear in rules of the primary view and applies to all views 5278: defined in the presentation schema.</P> 5279: <PRE> 5280: 'Gather' ':' Boolean . 5281: </PRE> 5282: </DIV> 5283: 5284: <DIV class="subsection"> 1.6 cvs 5285: <H3><A name=sectc4224>Visibility</A></H3> 1.1 cvs 5286: 5287: <P> 5288: The visibility parameter is used to control which elements should or should 5289: not be displayed, based on context. An element can have different 5290: visibilities in different views. If an element's visibility is zero for a 5291: view, that element is not displayed in that view and does not occupy any space 5292: (its extents are zero).</P> 5293: <P> 5294: Visibility takes non-negative integer values (positive or zero). If values 5295: greater than 1 are used, they allow the user to choose a degree of visibility 5296: and, thus, to see only those boxes whose visibility parameter exceeds a 5297: certain threshold. This gives the user control over the granularity of the 1.2 cvs 5298: displayed pictures.</P> 1.1 cvs 5299: <P> 5300: The visibility parameter can be defined as a constant or by inheritance. If 5301: defined by inheritance, it cannot be based on the value of the next or 5302: previous box. Visibility can only be inherited from above.</P> 5303: <P> 5304: If it is a numeric attribute's presentation rule, the visibility can be 5305: specified by the attribute's name, in which case the value of the attribute is 5306: used.</P> 5307: <PRE> 1.6 cvs 5308: 'Visibility' ':' NumberInherit 1.1 cvs 5309: NumberInherit = Integer / AttrID / Inheritance . 1.6 cvs 5310: Integer = NUMBER . 1.1 cvs 5311: </PRE> 5312: <BLOCKQUOTE class="example"> 5313: <P> 5314: <STRONG>Example:</STRONG></P> 5315: <P> 1.3 cvs 5316: Suppose that only <TT>Formula</TT> elements should be displayed in 5317: the <TT>MathView</TT> view. Then, the default rules should include:</P> 1.1 cvs 5318: <PRE> 5319: DEFAULT 5320: IN MathView Visibility:0; 5321: </PRE> 5322: <P> 1.3 cvs 5323: which makes all elements invisible in the <TT>MathView</TT> view. However, the 5324: <TT>Formula</TT> element also has a <TT>Visibility</TT> rule:</P> 1.1 cvs 5325: <PRE> 5326: Formula : 5327: IN MathView Visibility:5; 5328: </PRE> 5329: <P> 5330: which makes formulas, and only formulas, visible.</P> 5331: </BLOCKQUOTE> 5332: </DIV> 5333: 5334: <DIV class="subsection"> 1.6 cvs 5335: <H3><A name=sectc4225>Character style parameters</A></H3> 1.1 cvs 5336: 5337: <P> 5338: Four parameters are used to determine which characters are used to display 5339: text. They are size, font, style, and underlining.</P> 5340: 5341: <DIV class="subsubsection"> 1.6 cvs 5342: <H4><A name=sectd42251>Character size</A></H4> 1.1 cvs 5343: 5344: <P> 5345: The size parameter has two effects. First, it is used to specify the actual 1.6 cvs 5346: size and distance units for boxes defined in <A href="#sectc4217">relative 1.1 cvs 5347: units</A>. Second, it defines the size of the characters contained in the 5348: box.</P> 5349: <P> 5350: As a distance or length, the size can be expressed in abstract or absolute 5351: units. It can also be inherited. If it is not inherited, it is expressed 5352: simply as an integer followed by the <TT>pt</TT> keyword, which indicates that 5353: the size is expressed in typographer's points. The absence of the <TT>pt</TT> 5354: keyword indicates that it is in abstract units in which the value 1 represents 5355: the smallest size while the value 16 is the largest size. The relationship 5356: between these abstract sizes and the real character sizes is controlled by a 5357: table which can be modified statically or even dynamically during the 5358: execution of the Thot editor.</P> 5359: <P> 5360: If it is a numeric attribute's presentation rule, the value of the size 5361: parameter can be specified by the attribute's name, in which case the value of 5362: the attribute is used.</P> 5363: <P> 5364: <STRONG>Note:</STRONG> the only unit available for defining an absolute size 5365: is the typographer's point. Centimeters and inches may not be used.</P> 5366: <P> 5367: If the size is inherited, the rule must specify the relative from which to 5368: inherit and any difference from that relative's value. The difference can be 5369: expressed in either typographer's points or in abstract units. The maximum or 5370: minimum size can also be specified, but without specifying the type of unit: 5371: it is the same as was specified for the difference.</P> 5372: <P> 5373: In a numeric attribute's presentation rule, the difference in size can be 5374: indicated by the attribute's name, which means that the attribute's value 5375: should be used as the difference. The attribute can also be used as the 5376: minimum or maximum size.</P> 5377: <PRE> 5378: 'Size' ':' SizeInherit 5379: SizeInherit = SizeAttr [ 'pt' ] / 5380: Kinship InheritedSize . 5381: InheritedSize ='+' SizeAttr [ 'pt' ] 5382: [ 'Max' MaxSizeAttr ] / 5383: '-' SizeAttr [ 'pt' ] 5384: [ 'Min' MinSizeAttr ] / 5385: '=' . 1.6 cvs 5386: SizeAttr = Size / AttrID . 5387: Size = NUMBER . 5388: MaxSizeAttr = MaxSize / AttrID . 5389: MaxSize = NUMBER . 5390: MinSizeAttr = MinSize / AttrID . 5391: MinSize = NUMBER . 1.1 cvs 5392: </PRE> 5393: <BLOCKQUOTE class="example"> 5394: <P> 5395: <STRONG>Example:</STRONG></P> 5396: <P> 5397: The rule</P> 5398: <PRE> 5399: Size : Enclosing - 2 pt Min 7; 5400: </PRE> 5401: <P> 1.3 cvs 5402: states that the character size is 2 points less than that of the enclosing box, 5403: but that it may not be less than 7 points, whatever the enclosing box's 1.1 cvs 5404: value.</P> 5405: <P> 5406: The following rules make the text of a report be displayed with medium-sized 5407: characters (for example, size 5), while the title is displayed with larger 5408: characters and the summary is displayed with smaller characters:</P> 5409: <PRE> 5410: Report : 5411: Size : 5; 5412: Title : 5413: Size : Enclosing + 2; 5414: Summary : 5415: Size : Enclosing - 1; 5416: </PRE> 5417: <P> 1.4 cvs 5418: Thus, the character sizes in the entire document can be changed by changing the 5419: size parameter of the Report element, while preserving the relationships 1.1 cvs 5420: between the sizes of the different elements.</P> 5421: </BLOCKQUOTE> 5422: </DIV> 5423: 5424: <DIV class="subsubsection"> 1.6 cvs 5425: <H4><A name=sectd42252>Font and character style</A></H4> 1.1 cvs 5426: 5427: <P> 5428: The <TT>Font</TT> rule determines the font family to be used to display the 5429: characters contained in the box, while the <TT>Style</TT> rule determines 5430: their style. Thot recognizes three character fonts (Times, Helvetica, and 5431: Courier) and six styles: Roman, Italics, Bold, BoldItalics, Oblique, and 5432: BoldOblique.</P> 5433: <P> 5434: The font family and style can specified by a named constant or can be 5435: inherited. For the name of the font family only the first character is 5436: used.</P> 5437: <P> 5438: Only identical inheritance is allowed: the box takes the same font or style as 5439: the box from which it inherits. This is indicated by an equals sign after the 5440: kinship specification.</P> 5441: <BLOCKQUOTE class="example"> 5442: <P> 5443: <STRONG>Example:</STRONG></P> 5444: <P> 1.3 cvs 5445: To specify that the summary uses the font family of the rest of the document, 1.1 cvs 5446: but in the italic style, the following rules are used:</P> 5447: <PRE> 5448: Summary : 5449: BEGIN 5450: Font : Enclosing =; 5451: Style : Italics; 5452: END; 5453: </PRE> 5454: </BLOCKQUOTE> 5455: </DIV> 5456: 5457: <DIV class="subsubsection"> 1.6 cvs 5458: <H4><A name=sectd42253>Underlining</A></H4> 1.1 cvs 5459: 5460: <P> 5461: The <TT>Underline</TT> rule is used to specify if the characters contained in 5462: a box should have lines drawn on or near them. There are four underlining 5463: styles: <TT>Underlined</TT>, <TT>Overlined</TT>, <TT>CrossedOut</TT>, and 5464: <TT>NoUnderline</TT>. The <TT>Thickness</TT> rule specifies the thickness of 5465: the line, <TT>Thin</TT> or <TT>Thick</TT>.</P> 5466: <P> 5467: As with font family and style, only identical inheritance is allowed: the box 5468: has the same underlining type as the box from which it inherits the value. 5469: This is indicated by an equals sign after the kinship specification.</P> 5470: <PRE> 5471: 'Underline' ':' UnderLineInherit / 5472: 'Thickness' ':' ThicknessInherit / 5473: 5474: UnderLineInherit = Kinship '=' / 'NoUnderline' / 5475: 'Underlined' / 5476: 'Overlined' / 'CrossedOut' . 5477: ThicknessInherit = Kinship '=' / 'Thick' / 'Thin' . 5478: </PRE> 5479: </DIV> 5480: </DIV> 5481: 5482: <DIV class="subsection"> 1.6 cvs 5483: <H3><A name=sectc4226>Stacking order</A></H3> 1.1 cvs 5484: 5485: <P> 5486: The <TT>Depth</TT> rule is used to define the stacking order of terminal boxes 5487: when multiple boxes at least partially overlap. This rule defines how the 5488: depth parameter, which is zero or a positive integer, is calculated. The 5489: depth parameter has a value for all boxes. For terminal boxes in the 5490: structure and for presentation boxes, the depth value is used during display 5491: and printing: the boxes with the lowest value overlap those with higher 5492: depths. For non-terminal boxes, the depth is not interpreted during display, 5493: but it is used to calculate the depth of terminal boxes by inheritance.</P> 5494: <P> 5495: Like most other rules, the depth rule is defined in the <A 1.6 cvs 5496: href="#sectc427">default rules</A> of each presentation schema. Thus, 1.1 cvs 5497: there is always a depth value, even when it is not necessary because there is 5498: no overlapping. To avoid useless operations, a zero value can be given to the 5499: depth parameter, which signifies that overlapping is never a problem.</P> 5500: <P> 1.6 cvs 5501: The depth rule has the same form as the <A href="#sectc4224">visibility rule</A>. 1.1 cvs 5502: It can be defined by inheritance or by a constant numeric value. When the rule 5503: is attached to a numeric attribute, it can take the value of that 5504: attribute.</P> 5505: <PRE> 5506: 'Depth' ':' NumberInherit 5507: </PRE> 5508: <BLOCKQUOTE class="example"> 5509: <P> 5510: <STRONG>Example:</STRONG></P> 5511: <P> 1.3 cvs 5512: For a purely textual document, in which overlapping never poses a problem, a 1.5 cvs 5513: single default <TT>Depth</TT> rule in the presentation schema is 5514: sufficient:</P> 1.1 cvs 5515: <PRE> 5516: DEFAULT 5517: Depth : 0; 5518: ... 5519: </PRE> 5520: <P> 5521: To make the text of examples appear on a light blue background, a presentation 5522: box is defined:</P> 5523: <PRE> 5524: BOXES 5525: BlueBG : 5526: BEGIN 5527: Content : Graphics 'R'; 5528: Background : LightBlue3; 5529: FillPattern: backgroundcolor; 5530: Depth : 2; 5531: ... 5532: END; 5533: </PRE> 5534: <P> 1.3 cvs 5535: and is created by the <TT>Example</TT> element, which has the rules:</P> 1.1 cvs 5536: <PRE> 5537: RULES 5538: Example : 5539: BEGIN 5540: CreateFirst (BlueBG); 5541: Depth : 1; 5542: ... 5543: END; 5544: </PRE> 5545: <P> 5546: In this way, the text of an example (if it inherits its depth from 1.5 cvs 5547: its ancestor) will be superimposed on a light blue background, and not 5548: the reverse).</P> 1.1 cvs 5549: </BLOCKQUOTE> 5550: </DIV> 5551: 5552: <DIV class="subsection"> 1.6 cvs 5553: <H3><A name=sectc4227>Line Style</A></H3> 1.1 cvs 5554: 5555: <P> 5556: The <TT>LineStyle</TT> rule determines the style of line which should be used 5557: to draw all the elements contained in the box. The line style can be 5558: indicated by a name (<TT>Solid</TT>, <TT>Dashed</TT>, <TT>Dotted</TT>) or it 5559: can be inherited. Only elements of the graphic base type are affected by this 5560: rule, but it can be attached to any box and transmitted by inheritance to the 5561: graphic elements.</P> 5562: <P> 5563: Only identical inheritance is allowed: the box takes the same line style as 5564: the box from which it inherits. This is indicated by an equals sign after the 5565: kinship specification.</P> 5566: <PRE> 5567: 'LineStyle' ':' LineStyleInherit 5568: LineStyleInherit = Kinship '=' / 5569: 'Solid' / 'Dashed' / 'Dotted' . 5570: </PRE> 5571: <BLOCKQUOTE class="example"> 5572: <P> 5573: <STRONG>Example:</STRONG></P> 5574: <P> 1.3 cvs 5575: To specify that, in Figures, the graphical parts should be drawn in solid 5576: lines, the Figure element is given a rule using the <TT>Solid</TT> name:</P> 1.1 cvs 5577: <PRE> 5578: Figure : 5579: LineStyle : Solid; 5580: </PRE> 5581: <P> 5582: and the elements composing figures are given an inheritance rule:</P> 5583: <PRE> 5584: LineStyle : Enclosing =; 5585: </PRE> 5586: </BLOCKQUOTE> 5587: </DIV> 5588: 5589: <DIV class="subsection"> 1.6 cvs 5590: <H3><A name=sectc4228>Line thickness</A></H3> 1.1 cvs 5591: 5592: <P> 5593: The <TT>LineWeight</TT> rule determines the thickness of the lines of all 5594: graphical elements which appear in the box, no matter what their line style. 5595: Line thickness can be specified by a constant value or by inheritance. A 5596: constant value is a positive number followed by an optional unit specification 5597: (which is absent when using relative units). All available <A 1.6 cvs 5598: href="#sectc4217">distance units</A> can be used. Line thickness is expressed 5599: in the same way as <A href="#sectd42221">line spacing</A>.</P> 1.1 cvs 5600: <PRE> 5601: 'LineWeight' ':' DistOrInherit 5602: </PRE> 5603: <P> 5604: Only elements of the graphic base type are affected by this rule, but it can 5605: be attached to any box and transmitted by inheritance to the graphic 5606: elements.</P> 5607: <BLOCKQUOTE class="example"> 5608: <P> 5609: <STRONG>Example:</STRONG></P> 5610: <P> 1.3 cvs 5611: To specify that, in Figures, the graphical parts should be drawn with lines 0.3 1.1 cvs 5612: pt thick, the Figure element is given this rule:</P> 5613: <PRE> 5614: Figure : 5615: LineWeight : 0.3 pt; 5616: </PRE> 5617: <P> 5618: and the elements composing figures are given an inheritance rule:</P> 5619: <PRE> 5620: LineWeight : Enclosing =; 5621: </PRE> 5622: </BLOCKQUOTE> 5623: </DIV> 5624: 5625: <DIV class="subsection"> 1.6 cvs 5626: <H3><A name=sectc4229>Fill pattern</A></H3> 1.1 cvs 5627: 5628: <P> 5629: The <TT>FillPattern</TT> rule determines the pattern used to fill closed 5630: graphical elements (circles, rectangles, etc.) which appear in the box. This 5631: pattern can be indicated by a named constant or by inheritance. The named 5632: constant identifies one of the patterns available in Thot. The names of the 5633: available patterns are: nopattern, foregroundcolor, backgroundcolor, gray1, 5634: gray2, gray3, gray4, gray5, gray6, gray7, horiz1, horiz2, horiz3, vert1, 5635: vert2, vert3, left1, left2, left3, right1, right2, right3, square1, square2, 5636: square3, lozenge, brick, tile, sea, basket.</P> 5637: <P> 5638: Like the other rules peculiar to graphics, <TT>LineStyle</TT> and 5639: <TT>LineWeight</TT>, only elements of the graphic base type are affected by 5640: the <TT>FillPattern</TT> rule, but the rule can be attached to any box and 5641: transmitted by inheritance to the graphic elements. As with the other rules 5642: specific to graphics, only identical inheritance is allowed.</P> 5643: <P> 5644: The <TT>FillPattern</TT> rule can also be used to determine whether or not 1.12 ! cvs 5645: text characters, symbols and pictures should be colored. For these element ! 5646: types (text, symbols, and pictures), the only valid values are ! 5647: <TT>nopattern</TT>, <TT>foregroundcolor</TT>, and ! 5648: <TT>backgroundcolor</TT>. When <TT>FillPattern</TT> has the value 1.1 cvs 5649: <TT>backgroundcolor</TT>, text characters, symbols, and bitmaps are given the 1.6 cvs 5650: color specified by the <A href="#sectc4230"><TT>Background</TT> rule</A> which 1.1 cvs 5651: applies to these elements. When <TT>FillPattern</TT> has the value 5652: <TT>foregroundcolor</TT>, these same elements are given the color specified by 1.6 cvs 5653: the <A href="#sectc4230"><TT>Foreground</TT> rule</A> which applies to these 1.1 cvs 5654: elements. In all other case, text characters are not colored.</P> 5655: <PRE> 5656: 'FillPattern' ':' NameInherit 5657: </PRE> 5658: <BLOCKQUOTE class="example"> 5659: <P> 5660: <STRONG>Example:</STRONG></P> 5661: <P> 1.3 cvs 5662: To specify that, in Figures, the closed graphical elements should be filled 5663: with a pattern resembling a brick wall, the Figure element is given this 1.1 cvs 5664: rule:</P> 5665: <PRE> 5666: Figure : 5667: FillPattern : brick; 5668: </PRE> 5669: <P> 5670: and the elements composing figures are given an inheritance rule:</P> 5671: <PRE> 5672: FillPattern : Enclosing =; 5673: </PRE> 5674: </BLOCKQUOTE> 5675: </DIV> 5676: 5677: <DIV class="subsection"> 1.6 cvs 5678: <H3><A name=sectc4230>Colors</A></H3> 1.1 cvs 5679: 5680: <P> 5681: The <TT>Foreground</TT> and <TT>Background</TT> rules determine the foreground 5682: and background colors of the base elements which appear in the box. These 5683: colors cancan be specified with a named constant or by inheritance. The named 5684: constants specify one of the available colors in Thot. The available color 5685: names can be found in the file <TT>thot.color</TT>.</P> 5686: <P> 5687: In contrast to the preceding rules, the color rules affect all base elements 1.2 cvs 5688: the same way, no matter what their type (text, graphics, pictures, symbols), 5689: but they only affect base elements. The color rules can nevertheless be 1.1 cvs 5690: associated with any box and can be transmitted to the base elements by 5691: inheritance. Like the preceding rules, only inheritance of the same value is 5692: allowed.</P> 5693: <PRE> 5694: 'Foreground' ':' NameInherit 5695: 'Background' ':' NameInherit 5696: </PRE> 5697: <P> 5698: <STRONG>Note:</STRONG> text colors only appear for text elements whose <A 1.6 cvs 5699: href="#sectc4229">fill pattern</A> does not prevent the use of color.</P> 1.1 cvs 5700: <BLOCKQUOTE class="example"> 5701: <P> 5702: <STRONG>Example:</STRONG></P> 5703: <P> 1.3 cvs 5704: To specify that, in Figures, everything must be drawn in blue on a background 1.5 cvs 5705: of yellow, the Figure element is given these rules:</P> 1.1 cvs 5706: <PRE> 5707: Figure : 5708: BEGIN 5709: Foreground : Blue; 5710: Background : Yellow; 5711: Fillpattern : backgroundcolor; 5712: END; 5713: </PRE> 5714: <P> 5715: and the elements composing figures are given inheritance rules:</P> 5716: <PRE> 5717: Foreground : Enclosing =; 5718: Background : Enclosing =; 5719: FillPattern : Enclosing =; 5720: </PRE> 5721: </BLOCKQUOTE> 5722: </DIV> 5723: 5724: <DIV class="subsection"> 1.6 cvs 5725: <H3><A name=sectc4231>Presentation box content</A></H3> 1.1 cvs 5726: 5727: <P> 5728: The <TT>Content</TT> rule applies to presentation boxes. It indicates the 5729: content given to a box. This content is either a variable's value or a 1.6 cvs 5730: constant value. In the special case of <A href="#sectc4233">header or footer 1.1 cvs 5731: boxes</A>, the content can also be a structured element type.</P> 5732: <P> 5733: If the content is a constant, it can be specified, as in a variable 5734: declaration, either by the name of a constant declared in the <TT>CONST</TT> 5735: section or by direct specification of the type and value of the box's 5736: content.</P> 5737: <P> 5738: Similarly, if it is a variable, the name of a variable declared in 5739: <TT>VAR</TT> section can be given or the variable may be defined within 5740: parentheses. The content inside the parentheses has the same syntax as a <A 1.6 cvs 5741: href="#sectc426">variable declaration</A>.</P> 1.1 cvs 5742: <P> 5743: When the content is a structured element type, the name of the element type is 5744: given after the colon. In this case, the box's content is all elements of 5745: the named type which are designated by references which are part of the page 5746: on which the header or footer with this <TT>Content</TT> rule appears. Only 5747: associated elements can appear in a <TT>Content</TT> rule and the structure 5748: must provide references to these elements. Moreover, the box whose content 5749: they are must be a header or footer box generated by a page box of the primary 5750: view.</P> 5751: <PRE> 5752: 'Content' ':' VarConst 5753: VarConst = ConstID / ConstType ConstValue / 5754: VarID / '(' FunctionSeq ')' / 5755: ElemID . 5756: </PRE> 5757: <P> 5758: A presentation box can have only one <TT>Content</TT> rule, which means that 5759: the content of a presentation box cannot vary from view to view. However, such 5760: an effect can be achieved by creating several presentation boxes, each with 5761: different content and visible in different views.</P> 5762: <P> 5763: The <TT>Content</TT> rule also applies to elements defined as references in 5764: the structure schema. In this case, the content defined by the rule must be 5765: a constant. It is this content which appears on the screen or paper to 5766: represent references of the type to which the rule applies. A reference can 1.6 cvs 5767: have a <TT>Content</TT> rule or a <A href="#sectc4234"><TT>Copy</TT> rule</A> 1.1 cvs 5768: for each view. If neither of these rules appears, the reference is displayed 5769: as <TT>[*]</TT>, which is equivalent to the rule:</P> 5770: <PRE> 5771: Content: Text '[*]'; 5772: </PRE> 5773: <BLOCKQUOTE class="example"> 5774: <P> 5775: <STRONG>Example:</STRONG></P> 5776: <P> 1.3 cvs 5777: The content of the presentation box created to make the chapter number and 5778: section number appear before each section title can be defined by:</P> 1.1 cvs 5779: <PRE> 5780: BOXES 5781: SectionNumBox : 5782: BEGIN 5783: Content : NumSection; 5784: ... 5785: END; 5786: </PRE> 5787: <P> 1.5 cvs 5788: if the <TT>NumSection</TT> variable has been defined in the variable definition 1.3 cvs 5789: section of the presentation schema. Otherwise the <TT>Content</TT> would be 1.1 cvs 5790: written:</P> 5791: <PRE> 5792: BOXES 5793: SectionNumBox : 5794: BEGIN 5795: Content : (VALUE (ChapterCtr, Roman) TEXT '.' 5796: VALUE (SectionCtr, Arabic)); 5797: ... 5798: END; 5799: </PRE> 5800: <P> 5801: To specify that a page footer should contain all elements of the <TT>Note</TT> 5802: type are referred to in the page, the following rule is written:</P> 5803: <PRE> 5804: BOXES 5805: NotesFooterBox : 5806: BEGIN 5807: Content : Note; 5808: ... 5809: END; 5810: </PRE> 5811: <P> 1.5 cvs 5812: <TT>Note</TT> is defined as an associated element in the structure schema and 1.1 cvs 5813: NotesFooterBox is created by a page box of the primary view.</P> 5814: </BLOCKQUOTE> 5815: </DIV> 5816: 5817: <DIV class="subsection"> 1.6 cvs 5818: <H3><A name=sectc4232>Presentation box creation</A></H3> 1.1 cvs 5819: 5820: <P> 5821: A creation rule specifies that a presentation box should be created when an 5822: element of the type to which the rule is attached appears in the document.</P> 5823: <P> 5824: A keyword specifies the position, relative to the creating box, at which the 5825: created box will be placed in the structure:</P> 5826: <DL> 5827: <DT><TT>CreateFirst</TT></DT> 1.2 cvs 5828: <DD>specifies that the box should be created as the first box of the next lower 5829: level, before any already existing boxes, and only if the beginning of the 1.1 cvs 5830: creating element is visible; 5831: </DD> 5832: <DT><TT>CreateLast</TT></DT> 1.2 cvs 5833: <DD>specifies that the box should be created as the last box of the next lower 5834: level, after any existing boxes, and only if the end of the creating element is 1.1 cvs 5835: visible; 5836: </DD> 5837: <DT><TT>CreateBefore</TT></DT> 1.2 cvs 5838: <DD>specifies that the box should be created before the creating box, on the 5839: same level as the creating box, and only if the beginning of the creating 1.1 cvs 5840: element is visible; 5841: </DD> 5842: <DT><TT>CreateAfter</TT></DT> 1.2 cvs 5843: <DD>specifies that the box should be created after the creating box, on the 5844: same level as the creating box, and only if the beginning of the creating 1.1 cvs 5845: element is visible; 5846: </DD> 5847: <DT><TT>CreateEnclosing</TT></DT> 1.2 cvs 5848: <DD>specifies that the box should be created at the upper level relatively to 5849: the creating box, and that it must contain that creating box and all 5850: presentation boxes created by the same creating box. 1.1 cvs 5851: </DD> 5852: </DL> 5853: <P> 5854: This keyword can be followed by the <TT>Repeated</TT> keyword to indicate that 5855: the box must be created for each part of the creating element. These parts 5856: result from the division of the element by page breaks or column changes. If 5857: the <TT>Repeated</TT> keyword is missing, the box is only created for the 5858: first part of the creating element (<TT>CreateFirst</TT> and 5859: <TT>CreateBefore</TT> rules) or for the last part (<TT>CreateLast</TT> and 5860: <TT>CreateAfter</TT> rules).</P> 5861: <P> 5862: The type of presentation to be created is specified at the end of the rule 5863: between parentheses.</P> 5864: <P> 1.6 cvs 5865: Creation rules cannot appear in the <A href="#sectc427">default 1.1 cvs 5866: presentation rules</A>. The boxes being created should have a 5867: <TT>Content</TT> rule which indicates their <A 1.6 cvs 5868: href="#sectc4231">content</A>.</P> 1.1 cvs 5869: <P> 5870: Creation rules can only appear in the block of rules for the primary view; 5871: creation is provoked by a document element for all views. However, for each 5872: view, the presentation box is only created if the creating element is itself a 5873: box in the view. Moreover, the visibility parameter of the presentation box 5874: can be adjusted to control the creation of the box on a view-by-view 5875: basis.</P> 5876: <PRE> 5877: Creation '(' BoxID ')' 5878: Creation = Create [ 'Repeated' ] . 5879: Create ='CreateFirst' / 'CreateLast' / 5880: 'CreateBefore' / 'CreateAfter' / 5881: 'CreateEnclosing' . 5882: </PRE> 5883: <BLOCKQUOTE class="example"> 5884: <P> 5885: <STRONG>Example:</STRONG></P> 5886: <P> 1.3 cvs 5887: Let us define an object type, called Table, which is composed of a sequence of 5888: columns, all having the same fixed width, where the columns are separated by 5889: vertical lines. There is a line to the left of the first column and one to the 5890: right of the last. Each column has a variable number of cells, placed one on 5891: top of the other and separated by horizontal lines. There are no horizontal 5892: lines above the first cell or below the last cell. The text contained in 1.5 cvs 5893: each cell is broken into lines and these lines are centered horizontally in 5894: the cell. The logical structure of this object is defined by:</P> 1.1 cvs 5895: <PRE> 5896: Table = LIST OF (Column); 5897: Column = LIST OF (Cell = Text); 5898: </PRE> 5899: 5900: <DIV class="figure"> 5901: <HR> 5902: <PRE> 5903: | | | | 5904: | xx xxxx xxxx |x xxxx xxx xxxxx| x xxx x xxx | 5905: | xxx xxx xxxx x | x xx x xxx | xxxxx xxxx xx | 5906: | xxxxx xxxx |----------------| xxx xxxxx x | 5907: | xxxxx xxx xxxx | xxxx xx xx xxx | xx xx | 5908: | xxx xxxx x xxx | xxxx x xxx x |---------------| 5909: |----------------| xxx xxxx xxxxx | xxxxx xxxxx | 5910: | xxx xxx xxxxxx |----------------| xxx xxxx xxxx | 5911: | xxxx xxxx xx | xxxx xx x xx | xxx xx x xx | 5912: |----------------| xxx xxxxx xxxx | xxxx xxxx xxx | 5913: | xxxxx xxx xxxx | xxxx xx x xx | xxxxx xxx | 5914: |xxxx xx x xxxxxx| xxxx xx xxxxxx | xxxxx xxxxx | 5915: </PRE> 5916: <P align=center> 5917: <EM><A name="table">The design of a table</A></EM></P> 5918: <HR> 5919: </DIV> 5920: <P> 5921: The presentation of the table should resemble the design of the above <A 5922: href="#table">figure</A>. It is defined by the following presentation schema 5923: fragment:</P> 5924: <PRE> 5925: BOXES 5926: VertLine : BEGIN 5927: Width : 0.3 cm; 5928: Height : Enclosing . Height; 5929: VertPos : Top = Enclosing . Top; 5930: HorizPos : Left = Previous . Right; 5931: Content : Graphics 'v'; 5932: END; 5933: 5934: HorizLine: BEGIN 5935: Width : Enclosing . Width; 5936: Height : 0.3 cm; 5937: VertPos : Top = Previous . Bottom; 5938: HorizPos : Left = Enclosing . Left; 5939: Content : Graphics 'h'; 5940: END; 5941: 5942: RULES 1.6 cvs 5943: Column : BEGIN 5944: CreateBefore (VertLine); 5945: IF LAST CreateAfter (VertLine); 5946: Width : 2.8 cm; 5947: Height : Enclosed . Height; 5948: VertPos : Top = Enclosing . Top; 5949: HorizPos : Left = Previous . Right; 5950: END; 5951: 5952: Cell : BEGIN 5953: IF NOT FIRST CreateBefore (HorizLine); 5954: Width : Enclosing . Width; 5955: Height : Enclosed . Height; 5956: VertPos : Top = Previous . Bottom; 5957: HorizPos : Left = Enclosing . Left; 5958: Line; 5959: Adjust : VMiddle; 5960: END; 1.1 cvs 5961: </PRE> 5962: <P> 5963: It is useful to note that the horizontal position rule of the first vertical 5964: line will not be applied, since there is no preceding box. In this case, the 5965: box is simply placed on the left side of the enclosing box.</P> 5966: </BLOCKQUOTE> 5967: </DIV> 5968: 5969: <DIV class="subsection"> 1.6 cvs 5970: <H3><A name=sectc4233>Page layout</A></H3> 1.1 cvs 5971: 5972: <P> 5973: The page models specified in the <TT>Page</TT> rule are defined by boxes 5974: declared in the <TT>BOXES</TT> section of the presentation schema. Pages are 5975: not described as frames which will be filled by the document's text, but as 5976: element are inserted in the flow of the document and which mark the page 5977: breaks. Each of these page break elements contains presentation boxes which 5978: represent the footer boxes of a page followed by header boxes of the next 5979: page. The page box itself is the simple line which separates two pages on the 5980: screen. Both the footer and header boxes placed themselves with respect to 5981: this page box, with the footer being placed above it and the header boxes 5982: being placed above it.</P> 5983: <P> 5984: The boxes created by a page box are headers and footers and can only place 5985: themselves vertically with respect to the page box itself (which is in fact 5986: the separation between two pages). Besides, it is their vertical position 5987: rule which determines whether they are header or footer boxes. Header and 5988: footer boxes must have an explicit vertical position rule (they must not use 5989: the default rule).</P> 5990: <P> 5991: Footer boxes must have an absolute height or inherit the height of their 5992: contents:</P> 5993: <PRE> 5994: Height : Enclosed . Height; 5995: </PRE> 5996: <P> 5997: A page box must have height and width rules and these two rules must be 5998: specified with constant values, expressed in centimeters, inches, or 5999: typographer's points. These two rules are interpreted in a special way for 6000: page boxes: they determine the width of the page and the vertical distance 6001: between two page separators, which is the height of the page and its header 6002: and footer together.</P> 6003: <P> 6004: A page box should also have vertical and horizontal position rules and these 6005: two rules should specify the position on the sheet of paper of the rectangle 6006: enclosing the page's contents. These two rules must position the upper left 6007: corner of the enclosing rectangle in relation to the upper left corner of the 6008: sheet of paper, considered to be the enclosing element. In both rules, 6009: distances must be expressed in fixed units: centimeters (<TT>cm</TT>), inches 6010: (<TT>in</TT>), or typographer's points (<TT>pt</TT>). Thus, rules similar to 6011: the following should be found in the rules for a page box:</P> 6012: <PRE> 6013: BOXES 6014: ThePage : 6015: BEGIN 6016: VertPos : Top = Enclosing . Top + 3 cm; 6017: HorizPos : Left = Enclosing . Left + 2.5 cm; 6018: Width : 16 cm; 6019: Height : 22.5 cm; 6020: END; 6021: </PRE> 6022: <P> 6023: When a document must be page broken, the page models to be constructed are 6024: defined in the <TT>BOXES</TT> section of the presentation schema by declaring 6025: page boxes and header and footer boxes. Also, the <TT>Page</TT> rule is used 6026: to specify to which parts of the document and to which views each model should 6027: be applied.</P> 6028: <P> 6029: The <TT>Page</TT> rule has only one parameter, given between parentheses after 6030: the <TT>Page</TT> keyword. This parameter is the name of the box which must 6031: serve as the model for page construction. When a <TT>Page</TT> rule is 6032: attached to an element type, each time such an element appears in a document, 6033: a page break takes place and the page model indicated in the rule is applied 6034: to all following pages, until reaching the next element which has a 6035: <TT>Page</TT> rule.</P> 6036: <P> 6037: The <TT>Page</TT> rule applies to only one view; if it appears in the primary 6038: view's block of rules, a <TT>Page</TT> rule applies only to that view. Thus, 6039: different page models can be defined for the full document and for its table 6040: of contents, which is another view of the same document. Some views can be 6041: specified with pages, and other views of the same document can be specified 6042: without pages.</P> 6043: <PRE> 6044: 'Page' '(' BoxID ')' 6045: </PRE> 6046: </DIV> 6047: 6048: <DIV class="subsection"> 1.6 cvs 6049: <H3><A name=sectc4234>Box copies</A></H3> 1.1 cvs 6050: 6051: <P> 6052: The <TT>Copy</TT> rule can be used for an element which is defined as a 1.7 cvs 6053: reference in the structure schema. In this case, the rule specifies, between 6054: parenthesis, the name of the box (declared in the <TT>BOXES</TT> section) 1.1 cvs 6055: which must be produced when this reference appears in the structure of a 6056: document. The box produced is a copy (same contents, but possible different 6057: presentation) of the box type indicated by the parameter between parentheses, 6058: and which is in the element designated by the reference. The name of a box 6059: can be replaced by type name. Then what is copied is the contents of the 6060: element of this type which is inside the referenced element.</P> 6061: <P> 6062: Whether a box name or type name is given, it may be followed by the name of a 6063: structure schema between parentheses. This signifies that the box or type is 6064: defined in the indicated structure schema and not in the structure schema with 6065: which the rule's presentation schema is associated.</P> 6066: <P> 6067: The <TT>Copy</TT> rule can also be applied to a presentation box. If the 6068: presentation box was created by a reference attribute, the rule is applied as 6069: in the case of a reference element: the contents of the box having the 6070: <TT>Copy</TT> rule are based on the element designated by the reference 6071: attribute. For other presentation boxes, the <TT>Copy</TT> rule takes a type 6072: name parameter which can be followed, between parentheses, by the name of the 6073: structure schema in which the type is defined, if it is not defined in the 6074: same schema. The contents of the box which has this rule are a copy of the 6075: element of this type which is in the element creating the presentation box, or 6076: by default, the box of this type which precedes the presentation box. This 6077: last facility is used, for example, to define the running titles in headers or 6078: footers.</P> 6079: <PRE> 1.6 cvs 6080: 'Copy' '(' BoxTypeToCopy ')' . 1.1 cvs 6081: BoxTypeToCopy = BoxID [ ExtStruct ] / 1.6 cvs 6082: ElemID [ ExtStruct ] . 6083: ExtStruct = '(' ElemID ')' . 1.1 cvs 6084: </PRE> 6085: <P> 6086: Like the creation rules, the <TT>Copy</TT> rule cannot appear in the <A 1.6 cvs 6087: href="#sectc427">default presentation rules</A>. Moreover, this rule 1.1 cvs 6088: can only appear in the primary view's block of rules; the copy rule is applied 6089: to all views.</P> 6090: <BLOCKQUOTE class="example"> 6091: <P> 6092: <STRONG>Example:</STRONG></P> 6093: <P> 6094: If the following definitions are in the structure schema:</P> 6095: <PRE> 6096: Body = LIST OF (Chapter = 6097: BEGIN 6098: ChapterTitle = Text; 6099: ChapterBody = SectionSeq; 6100: END); 6101: RefChapter = REFERENCE (Chapter); 6102: </PRE> 6103: <P> 6104: then the following presentation rules (among many other rules in 1.3 cvs 6105: the presentation schema) can be specified:</P> 1.1 cvs 6106: <PRE> 6107: COUNTERS 6108: ChapterCtr : RANK OF Chapter; 6109: BOXES 6110: ChapterNumber : 6111: BEGIN 6112: Content : (VALUE (ChapterCtr, URoman)); 6113: ... 6114: END; 6115: RULES 6116: Chapter : 6117: BEGIN 6118: CreateFirst (ChapterNumber); 6119: ... 6120: END; 6121: RefChapter : 6122: BEGIN 6123: Copy (ChapterNumber); 6124: ... 6125: END; 6126: </PRE> 6127: <P> 1.4 cvs 6128: which makes the number of the chapter designated by the reference appear in 6129: uppercase roman numerals, in place of the reference to a chapter itself. 6130: Alternatively, the chapter title can be made to appear in place of the 1.1 cvs 6131: reference by writing this <TT>Copy</TT>rule:</P> 6132: <PRE> 6133: Copy (ChapterTitle); 6134: </PRE> 6135: <P> 6136: To define a header box, named <TT>RunningTitle</TT>, which contains the title 6137: of the current chapter, the box's contents are defined in this way:</P> 6138: <PRE> 6139: BOXES 6140: RunningTitle : 6141: Copy (ChapterTitle); 6142: </PRE> 6143: </BLOCKQUOTE> 6144: </DIV> 6145: </DIV> 6146: <HR> 6147: </DIV> 6148: 6149: <DIV class="chapter"> 1.6 cvs 6150: <H1><A name=sect5>The T language</A></H1> 1.1 cvs 6151: 6152: 6153: <DIV class="section"> 1.6 cvs 6154: <H2><A name=sectb51>Document translation</A></H2> 1.1 cvs 6155: 6156: <P> 6157: Because of its document model, Thot can produce documents in a high-level 6158: abstract form. This form, called the <EM>canonical form</EM> is specific to 6159: Thot; it is well suited to the editor's manipulations, but it does not 6160: necessarily suit other operations which might be applied to documents. Because 6161: of this, the Thot editor offers the choice of saving documents in its own form 6162: (the canonical form) or a format defined by the user. In the latter case, the 6163: Thot document is transformed by the translation program. This facility can 6164: also be used to export documents from Thot to systems using other 6165: formalisms.</P> 6166: 6167: <DIV class="subsection"> 1.6 cvs 6168: <H3><A name=sectc511>Translation principles</A></H3> 1.1 cvs 6169: 6170: <P> 6171: Document translation allows the export of documents to other systems which do 6172: not accept Thot's canonical form. Translation can be used to export document 6173: to source-based formatters like T<SUB><BIG>E</BIG></SUB>X, 6174: L<SUP>A</SUP>T<SUB><BIG>E</BIG></SUB>X, and <TT>troff</TT>. It can also be 6175: used to translate documents into interchange formats like SGML or HTML. To 6176: allow the widest range of possible exports, Thot does not limit the choice of 6177: translations, but rather allows the user to define the formalisms into which 6178: documents can be translated.</P> 6179: <P> 6180: For each document or object class, a set of translation rules can be defined, 6181: specifying how the canonical form should be transformed into a given 6182: formalism. These translation rules are grouped into <EM>translation 6183: schemas</EM>, each schema containing the rules necessary to translate a 6184: generic logical structure (document or object structure) into a particular 6185: formalism. The same generic logical structure can have several different 6186: translation schemas, each defining translation rules for a different 6187: formalism.</P> 6188: <P> 6189: Like presentation schemas, translation schemas are generic. Thus, they apply 6190: to an entire object or document class and permit translation of all documents 6191: or objects of that class.</P> 6192: </DIV> 6193: 6194: <DIV class="subsection"> 1.6 cvs 6195: <H3><A name=sectc512>Translation procedure</A></H3> 1.1 cvs 6196: 6197: <P> 6198: The translator works on the specific logical structure of the document being 6199: translated. It traverses the primary tree of this logical structure in 6200: pre-order and, at each node encountered, it applies the corresponding 6201: translation rules defined in the translation schema. Translation can be 6202: associated:</P> 6203: <UL> 6204: <LI>with element types defined in the structure schema, 6205: <LI>with global or local attributes defined in the structure schema, 6206: <LI>with specific presentation rules, 1.2 cvs 6207: <LI>with the content of the leaves of the structure (characters, symbols and 1.1 cvs 6208: graphical elements) 6209: </UL> 6210: <P> 6211: Thus, for each node, the translator applies all rules associated with the 6212: element type, all rules associated with each attribute (local or global) 6213: carried by the element, and if the element is a leaf of the tree, it also 1.10 cvs 6214: applies translation rules for characters, symbols, or graphical elements, 1.1 cvs 6215: depending on the type of the leaf.</P> 6216: <P> 6217: Rules associated with the content of leaves are different from all other 6218: rules: they specify only how to translate character strings, symbols, and 6219: graphical elements. All other rules, whether associated with element types, 6220: with specific presentation rules or with attributes, are treated similarly. 6221: These rules primarily allow:</P> 6222: <UL> 1.2 cvs 6223: <LI>generation of a text constant or variable before or after the contents of 1.1 cvs 6224: an element, 1.2 cvs 6225: <LI>modification of the order in which elements appear after translation, 1.1 cvs 6226: <LI>removal of an element in the translated document, 6227: <LI>and writing messages on the user's terminal during translation. 6228: </UL> 6229: </DIV> 6230: </DIV> 6231: 6232: <DIV class="section"> 1.6 cvs 6233: <H2><A name=sectb52>Translation definition language</A></H2> 1.1 cvs 6234: 6235: <P> 6236: Translation schemas are written in a custom language, called T, which is 6237: described in the rest of this chapter. The grammar of T is specified using 1.6 cvs 6238: the same <A href="#sectc321">meta-language</A> as was used for the S and P 1.1 cvs 6239: languages and the translation schemas are written using the same conventions 6240: as the structure and presentation schemas. In particular, the keywords of the 6241: T language (the stings between apostrophes in the following syntax rules) can 6242: be written in any combination of upper-case and lower-case letters, but 6243: identifiers created by the programmer must always be written in the same 6244: way.</P> 6245: 6246: <DIV class="subsection"> 1.6 cvs 6247: <H3><A name=sectc521>Organization of a translation schema</A></H3> 1.1 cvs 6248: 6249: <P> 6250: A translation schema is begun by the <TT>TRANSLATION</TT> keyword and is 6251: terminated by the <TT>END</TT> keyword. The <TT>TRANSLATION</TT> keyword is 6252: followed by the name of the generic structure for which a translation is being 6253: defined and a semicolon. This name must be identical to the name which 6254: appears after the <TT>STRUCTURE</TT> keyword in the corresponding structure 6255: schema.</P> 6256: <P> 6257: After this declaration of the structure, the following material appears in 6258: order:</P> 6259: <UL> 6260: <LI>the length of lines produced by the translation, 6261: <LI>the character delimiting the end of the line, 6262: <LI>the character string which the translator will insert if it must 6263: line-break the translated text, 6264: <LI>declarations of 6265: <UL> 6266: <LI>buffers, 6267: <LI>counters, 6268: <LI>constants, 6269: <LI>variables, 6270: </UL> 6271: <LI>translation rules associated with element types, 6272: <LI>translation rules associated with attributes, 6273: <LI>translation rules associated with specific presentation rules, 6274: <LI>translation rules associated with characters strings, symbols and 6275: graphical elements. 6276: </UL> 6277: <P> 6278: Each of these sections is introduced by a keyword followed by a sequence of 6279: declarations. All of these sections are optional, expect for the translation 6280: rules associated with element types. Many <TT>TEXTTRANSLATE</TT> sections can 6281: appear, each defining the rules for translating character strings of a 6282: particular alphabet.</P> 6283: <PRE> 6284: TransSchema ='TRANSLATION' ElemID ';' 6285: [ 'LINELENGTH' LineLength ';' ] 6286: [ 'LINEEND' CHARACTER ';' ] 6287: [ 'LINEENDINSERT' STRING ';' ] 6288: [ 'BUFFERS' BufferSeq ] 6289: [ 'COUNTERS' CounterSeq ] 6290: [ 'CONST' ConstSeq ] 6291: [ 'VAR' VariableSeq ] 6292: 'RULES' ElemSeq 6293: [ 'ATTRIBUTES' AttrSeq ] 6294: [ 'PRESENTATION' PresSeq ] 6295: < 'TEXTTRANSLATE' TextTransSeq > 6296: [ 'SYMBTRANSLATE' TransSeq ] 6297: [ 'GRAPHTRANSLATE' TransSeq ] 6298: 'END' . 6299: </PRE> 6300: </DIV> 6301: 6302: <DIV class="subsection"> 1.6 cvs 6303: <H3><A name=sectc522>Line length</A></H3> 1.1 cvs 6304: 6305: <P> 6306: If a <TT>LINELENGTH</TT> instruction is present after the structure 6307: declaration, the translator divides the text it produces into lines, each line 6308: having a length less than or equal to the integer which follows the 6309: <TT>LINELENGTH</TT> keyword. This maximum line length is expressed as a 6310: number of characters. The end of the line is marked by the character defined 6311: by the <TT>LINEEND</TT> instruction. When the translator breaks the lines on 6312: a space character in generated text, this space will be replaced by the 6313: character string defined by the <TT>LINEENDINSERT</TT> instruction.</P> 6314: <P> 6315: If the <TT>LINEEND</TT> instruction is not defined then the linefeed character 6316: (octal code 12) is used as the default line end character. If the 6317: <TT>LINEENDINSERT</TT> instruction is not defined, the linefeed character is 6318: inserted at the end of the produced lines. If there is no <TT>LINELENGTH</TT> 6319: instruction, the translated text is not divided into lines. Otherwise, if the 6320: translation rules generate line end marks, these marks remain in the 6321: translated text, but the length of the lines is not controlled by the 6322: translator.</P> 6323: <PRE> 6324: LineLength = NUMBER . 6325: </PRE> 6326: <BLOCKQUOTE class="example"> 6327: <P> 6328: <STRONG>Example:</STRONG></P> 6329: <P> 1.3 cvs 6330: To limit the lines produced by the translator to a length of 80 characters, the 6331: following rule is written at the beginning of the translation schema.</P> 1.1 cvs 6332: <PRE> 6333: LineLength 80; 6334: </PRE> 6335: </BLOCKQUOTE> 6336: </DIV> 6337: 6338: <DIV class="subsection"> 1.6 cvs 6339: <H3><A name=sectc523>Buffers</A></H3> 1.1 cvs 6340: 6341: <P> 6342: A buffer is a unit of memory managed by the translator, which can either 6343: contain text read from the terminal during the translation (see the <A 1.6 cvs 6344: href="#sectc5212"><TT>Read</TT> rule</A>), or the name of the last picture 1.1 cvs 6345: (bit-map) encountered by the translator in its traversal of the document. 1.2 cvs 6346: Remember the pictures are stored in files that are separate for the document 1.1 cvs 6347: files and that the canonical form contains only the names of the files in 1.2 cvs 6348: which the pictures are found.</P> 1.1 cvs 6349: <P> 6350: Thus, there are two types of buffers: buffers for reading from the terminal 1.2 cvs 6351: (filled by the <TT>Read</TT> rule) and the buffer of picture names (containing 6352: the name of the last picture encountered). A translation schema can use 6353: either type, one or several read buffers and one (and only one) picture name 1.1 cvs 6354: buffer.</P> 6355: <P> 6356: If any buffers are used, the <TT>BUFFERS</TT> keyword must be present, 6357: followed by declarations of every buffer used in the translation schema. Each 6358: buffer declaration is composed only of the name of the buffer, chosen freely 1.2 cvs 6359: by the programmer. The picture name buffer is identified by the 1.1 cvs 6360: <TT>Picture</TT> keyword, between parentheses, following the buffer name. The 6361: <TT>Picture</TT> keyword may only appear once. Each buffer declaration is 6362: terminated by a semicolon.</P> 6363: <PRE> 6364: BufferSeq = Buffer < Buffer > . 6365: Buffer = BufferID [ '(' 'Picture' ')' ] ';' . 6366: BufferID = NAME . 6367: </PRE> 6368: <BLOCKQUOTE class="example"> 6369: <P> 6370: <STRONG>Example:</STRONG></P> 6371: <P> 1.3 cvs 6372: The following buffer declarations create a picture name buffer named 1.2 cvs 6373: <TT>pictureName</TT> and a read buffer named <A 1.1 cvs 6374: name="destname"><TT>DestName</TT></A>:</P> 6375: <PRE> 6376: BUFFERS 1.2 cvs 6377: pictureName (Picture); DestName; 1.1 cvs 6378: </PRE> 6379: </BLOCKQUOTE> 6380: </DIV> 6381: 6382: <DIV class="subsection"> 1.6 cvs 6383: <H3><A name=sectc524>Counters</A></H3> 1.1 cvs 6384: 6385: <P> 6386: Certain translation rules generate text that varies according to the context 6387: of the element to which the rules apply. Variable text is defined either in 1.6 cvs 6388: the <A href="#sectc526"><TT>VAR</TT> section</A> of the translation schema or 1.1 cvs 6389: in the rule itself (see the <TT>Create</TT> and <TT>Write</TT> rules). Both 6390: types of definition rely on counters for the calculation of variable 6391: material.</P> 6392: <P> 6393: There are two types of counter: counters whose value is explicitely computed 1.6 cvs 6394: by applying <A href="#sectc5221"><TT>Set</TT> and <TT>Add</TT> rules</A>, and 1.1 cvs 6395: counters whose value is computed by a function associated with the counter. 6396: Those functions allow the same calculations as can be used in presentation 6397: schemas. As in a presentation schema, counters must be defined in the 6398: <TT>COUNTERS</TT> section of the translation schema before they are used.</P> 6399: <P> 6400: When counters are used in a translation schema, the <TT>COUNTERS</TT> keyword 6401: is followed by the declarations of every counter used. Each declaration is 6402: composed of the counter's name possibly followed by a colon and the counting 6403: function to be used for the counter. The declaration is terminated by a 6404: semi-colon. If the counter is explicitely computed by <TT>Set</TT> and 6405: <TT>Add</TT> rules, no counting function is indicated. If a counting function 6406: is indicated, <TT>Set</TT> and <TT>Add</TT> rules cannot be applied to that 6407: counter.</P> 6408: <P> 6409: The counting function indicates how the counter's value will be computed. 6410: Three functions are available: <TT>Rank</TT>, <TT>Rlevel</TT>, and 6411: <TT>Set</TT>.</P> 6412: <UL> 1.5 cvs 6413: <LI><TT>Rank of ElemID</TT> indicates that the counter's value is the rank of 6414: the element of type <TT>ElemID</TT> which encloses the element for which the 1.2 cvs 6415: counter is being evaluated. For the purposes of this function, an element of 1.5 cvs 6416: type <TT>ElemID</TT> is considered to enclose itself. This function is 6417: primarily used when the element of type <TT>ElemID</TT> is part of an 1.2 cvs 6418: aggregate or list, in which case the counter's value is the element's rank in 1.5 cvs 6419: its list or aggregate. Note that, unlike the <TT>Rank</TT> function for 6420: presentation schemas, the <TT>Page</TT> keyword cannot be used in place of the 1.1 cvs 6421: <TT>ElemID</TT>. 6422: <P> 6423: The type name <TT>ElemID</TT> can be followed by an integer. That number 6424: represents the relative level, among the ancestors of the concerned element, 6425: of the element whose rank is asked. If that relative level <I>n</I> is 1.5 cvs 6426: unsigned, the <I>n<SUP>th</SUP></I> element of type <TT>ElemID</TT> encountered 6427: when travelling the logical structure from the root to the concerned element is 1.1 cvs 6428: taken into account. If the relative level is negative, the logical structure 6429: is travelled in the other direction, from the concerned element to the 6430: root.</P> 1.5 cvs 6431: <LI><TT>Rlevel of ElemID</TT> indicates that the counter's values is the 1.2 cvs 6432: relative level in the tree of the element for which the counter is being 6433: evaluated. The counter counts the number of elements of type <TT>ElemID</TT> 6434: which are found on the path between the root of the document's logical 6435: structure tree and the element (inclusive). 1.5 cvs 6436: <LI><TT>Set n on Type1 Add m on Type2</TT> indicates that the counter's value 1.2 cvs 6437: is calculated as follows: in traversing the document from the beginning to 6438: the element for which the counter is being evaluated, the counter is set to 1.5 cvs 6439: the value <TT>n</TT> each time a <TT>Type1</TT> element is encountered and is 6440: incremented by the amount <TT>m</TT> each time a <TT>Type2</TT> element is 6441: encountered. The initial value <TT>n</TT> and the increment <TT>m</TT> are 1.1 cvs 6442: integers. 6443: </UL> 6444: <P> 6445: As in a presentation schema, the <TT>Rank</TT> and <TT>Set</TT> functions can 6446: be modified by a numeric attribute which changes their initial value. This is 6447: indicated by the <TT>Init</TT> keyword followed by the numeric attribute's 6448: name. The <TT>Set</TT> function takes the value of the attribute instead of 6449: the <TT>InitValue</TT> (<TT>n</TT>). For the <TT>Rank</TT> function, the 6450: value of the attribute is considered to be the rank of the first element of 6451: the list (rather than the normal value of 1). Subsequent items in the list 6452: have their ranks shifted accordingly. In both cases, the attribute must be 6453: numeric and must be a local attribute of the root of the document itself.</P> 6454: <PRE> 6455: CounterSeq = Counter < Counter > . 6456: Counter = CounterID [ ':' CounterFunc ] ';' . 6457: CounterID = NAME . 6458: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ] 6459: [ 'Init' AttrID ] / 6460: 'Rlevel' 'of' ElemID / 6461: 'Set' InitValue 'On' ElemID 6462: 'Add' Increment 'On' ElemID 6463: [ 'Init' AttrID ] . 6464: SLevelAsc = [ '-' ] LevelAsc . 6465: LevelAsc = NUMBER . 6466: InitValue = NUMBER . 6467: Increment = NUMBER . 6468: ElemID = NAME . 6469: AttrID = NAME . 6470: </PRE> 6471: <BLOCKQUOTE class="example"> 6472: <P> 6473: <STRONG>Example:</STRONG></P> 6474: <P> 6475: If the body of a chapter is defined in the structure schema by:</P> 6476: <PRE> 6477: Chapter_Body = LIST OF 6478: (Section = BEGIN 6479: Section_Title = Text; 6480: Section_Body = BEGIN 6481: Paragraphs; 6482: Section; 6483: END; 6484: END 6485: ); 6486: </PRE> 6487: <P> 1.3 cvs 6488: (sections are defined recursively), a counter can be defined giving the <A 1.4 cvs 6489: name="sectnum">number of a section</A> within its level in the hierarchy:</P> 1.1 cvs 6490: <PRE> 6491: COUNTERS 6492: SectionNumber : Rank of Section; 6493: </PRE> 6494: <P> 6495: A counter holding the hierarchic level of a section:</P> 6496: <PRE> 6497: SectionLevel : Rlevel of Section; 6498: </PRE> 6499: <P> 1.5 cvs 6500: A <A name="uniquenum">counter</A> which sequentially numbers all the document's 1.1 cvs 6501: sections, whatever their hierarchic level:</P> 6502: <PRE> 6503: UniqueSectNum : Set 0 on Document Add 1 on Section; 6504: </PRE> 6505: </BLOCKQUOTE> 6506: </DIV> 6507: 6508: <DIV class="subsection"> 1.6 cvs 6509: <H3><A name=sectc525>Constants</A></H3> 1.1 cvs 6510: 6511: <P> 6512: A common feature of translation rules is the generation of constant text. This 6513: text can be defined in the rule that generates it (see for example the <A 1.6 cvs 6514: href="#sectc5210"><TT>Create</TT></A> and <A href="#sectc5211"><TT>Write</TT></A> 1.1 cvs 6515: rules); but it can also be defined once in the constant declaration section 6516: and used many times in different rules. The latter option is preferable when 6517: the same text is used in several rules or several <A 1.6 cvs 6518: href="#sectc526">variables</A>.</P> 1.1 cvs 6519: <P> 6520: The <TT>CONST</TT> keyword begins the constant declaration section of the 6521: translation schema. It must be omitted if no constants are declared. Each 6522: constant declaration is composed of the constant name, an equals sign, and the 6523: constant's value, which is a character string between apostrophes. A constant 6524: declaration is terminated by a semicolon.</P> 6525: <PRE> 6526: ConstSeq = Const < Const > . 6527: Const = ConstID '=' ConstValue ';' . 6528: ConstID = NAME . 6529: ConstValue = STRING . 6530: </PRE> 6531: <BLOCKQUOTE class="example"> 6532: <P> 6533: <STRONG><A name="levelexample">Example:</A></STRONG></P> 6534: <P> 1.5 cvs 6535: The following rule assigns the name <TT>TxtLevel</TT> to the character string 1.1 cvs 6536: ``Level'':</P> 6537: <PRE> 6538: CONST 6539: TxtLevel = 'Level'; 6540: </PRE> 6541: </BLOCKQUOTE> 6542: </DIV> 6543: 6544: <DIV class="subsection"> 1.6 cvs 6545: <H3><A name=sectc526>Variables</A></H3> 1.1 cvs 6546: 6547: <P> 1.10 cvs 6548: Variables allow to define variable text which is generated by the 6549: <TT>Create</TT> and <TT>Write</TT> rules. They are also used to define 6550: file names which are used in the <TT>Create</TT>, <TT>ChangeMainFile</TT>, 6551: and <TT>Indent</TT> rules. Variables can be defined either 1.1 cvs 6552: in the <TT>VAR</TT> section of the translation schema or directly in the rules 1.10 cvs 6553: which use them. Variables that define file names must be declared in the 1.1 cvs 6554: <TT>VAR</TT> section, and when the same variable is used several times in the 6555: translation schema, it makes sense to define it globally in the <TT>VAR</TT> 6556: section. This section is only present if at least one variable is defined 6557: globally.</P> 6558: <P> 6559: After the <TT>VAR</TT> keyword, each global variable is defined by its name, a 6560: colon separator and a sequence of functions (at least one function). Each 6561: variable definition is terminated by a semicolon. Functions determine the 6562: different parts which together give the value of the variable. The value is 6563: obtained by concatenating the strings produced by each of the functions. Seven 6564: types of functions are available. Each variable definition may use any number 6565: of functions of each type.</P> 6566: <UL> 1.2 cvs 6567: <LI>The function <TT>Value(Counter)</TT>returns a string representing the 6568: value taken by the counter when it is evaluated for the element in whose rule 6569: the variable is used. The counter must have been declared in the 1.5 cvs 6570: <TT>COUNTERS</TT> section of the translation schema. When the counter is 1.2 cvs 6571: expressed in arabic numerals, the counter name can be followed by a colon and 6572: an integer indicating a minimum length (number of characters) for the string; 6573: if the counter's value is normally expressed with fewer characters than the 6574: required minimum, zeroes are added to the front of the string to achieve the 1.5 cvs 6575: minimum length. 1.1 cvs 6576: <P> 6577: By default, the counter value is written in arabic digits. If another 6578: representation of that value is needed, the counter name must be followed by a 6579: comma and one of the following keywords:</P> 6580: <UL> 6581: <LI><TT>Arabic</TT>: arabic numerals (default value), 6582: <LI><TT>LRoman</TT>: lower-case roman numerals, 6583: <LI><TT>URoman</TT>: upper-case roman numerals, 6584: <LI><TT>Uppercase</TT>: upper-case letter, 6585: <LI><TT>Lowercase</TT>: lower-case letter. 6586: </UL> 1.2 cvs 6587: <LI>The function <TT>FileDir</TT>, without parameter, returns a string 6588: representing the name of the directory of the output file that has been given 6589: as a parameter to the translation program. The string includes a character '/' 6590: at the end. 6591: <LI>The function <TT>FileName</TT>, without parameter, returns a string 6592: representing the name of the output file that has been given as a parameter to 6593: the translation program. The file extension (the character string that 6594: terminate the file name, after a dot) is not part of that string. 6595: <LI>The function <TT>Extension</TT>, without parameter, returns a string 6596: representing the extension of the file name. That string is empty if the file 6597: name that has been given as a parameter to the translation program has no 6598: extension. If there is an extension, its first character is a dot. 6599: <LI>The function <TT>DocumentName</TT>, without parameter, returns a string 6600: representing the name of the document being translated. 6601: <LI>The function <TT>DocumentDir</TT>, without parameter, returns a string 6602: representing the directory containing the document being translated. 6603: <LI>The function formed by the name of a constant returns that constant's 1.1 cvs 6604: value. 1.2 cvs 6605: <LI>The function formed by a character string between apostrophes returns that 1.1 cvs 6606: string. 1.2 cvs 6607: <LI>The function formed by the name of a buffer returns the contents of that 6608: buffer. If the named buffer is the picture buffer, then the name of the last 6609: picture encountered is returned. Otherwise, the buffer is a read buffer and 6610: the value returned is text previously read from the terminal. If the buffer 6611: is empty (no picture has been encountered or the <TT>Read</TT> rule has not 6612: been executed for the buffer), then the empty string is returned. 6613: <LI>The function formed by an attribute name takes the value of the indicated 6614: attribute for the element to which the variable applies. If the element does 6615: not have that attribute, then the element's ancestor are searched toward the 6616: root of the tree. If one of the ancestors does have the attribute then its 6617: value is used. If no ancestors have the attribute, then the value of the 1.1 cvs 6618: function is the empty string. 6619: </UL> 6620: <PRE> 6621: VariableSeq = Variable < Variable > . 6622: Variable = VarID ':' Function < Function > ';' . 6623: VarID = NAME . 6624: Function ='Value' '(' CounterID [ ':' Length ] 6625: [ ',' CounterStyle ] ')' / 6626: 'FileDir' / 'FileName' / 'Extension' / 6627: 'DocumentName' / 'DocumentDir' / 6628: ConstID / CharString / 6629: BufferID / AttrID . 6630: Length = NUMBER . 6631: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' / 6632: 'Uppercase' / 'Lowercase' . 6633: CharString = STRING . 6634: </PRE> 6635: <BLOCKQUOTE class="example"> 6636: <P> 6637: <STRONG>Example:</STRONG></P> 6638: <P> 1.3 cvs 6639: To create, at the beginning of each section of the translated document, text 6640: composed of the string ``Section'' followed by the section number, the 1.5 cvs 6641: following <A name="varsectexample">variable definition</A> might be used:</P> 1.1 cvs 6642: <PRE> 6643: VAR 6644: SectionVar : 'Section' Value(SectionNumber); 6645: </PRE> 6646: <P> 6647: (see the definition of <A href="#sectnum"><TT>SectionNumber</TT></A>).</P> 6648: <P> 6649: The following variable definition can be used to create, at the beginning of 6650: each section, the text ``Level'' followed by the hierarchical level of the 6651: section. It used the constant defined above.</P> 6652: <PRE> 6653: LevelVar : TxtLevel Value(SectionLevel); 6654: </PRE> 6655: <P> 1.5 cvs 6656: (see the definitions of <A href="#sectnum"><TT>SectionLevel</TT></A> and of 6657: <A href="#levelexample"><TT>TxtLevel</TT></A>).</P> 1.1 cvs 6658: <P> 1.5 cvs 6659: To generate the translation of each section in a different file (see 1.6 cvs 6660: <A href="#sectc5220">rule <TT>ChangeMainFile</TT></A>), the name of these 1.1 cvs 6661: files might be defined by the following variable:</P> 6662: <PRE> 6663: VarOutpuFile : FileName Value(SectionNumber) 6664: Extension; 6665: </PRE> 6666: <P> 1.4 cvs 6667: If <TT>output.txt</TT> is the name of the <A name="varoutputfile">output 6668: file</A> specified when starting the translation program, translated sections 6669: are written in files <TT>output1.txt</TT>, <TT>output2.txt</TT>, etc.</P> 1.1 cvs 6670: </BLOCKQUOTE> 6671: </DIV> 6672: 6673: <DIV class="subsection"> 1.6 cvs 6674: <H3><A name=sectc527>Translating structure elements</A></H3> 1.1 cvs 6675: 6676: <P> 6677: The <TT>RULES</TT> keyword introduces the translation rules which will be 6678: applied to the various structured element types. Translation rules can be 6679: specified for each element type defined in the structure schema, including the 6680: base types defined implicitly, whose names are <TT>TEXT_UNIT</TT>, 6681: <TT>PICTURE_UNIT</TT>, <TT>SYMBOL_UNIT</TT>, <TT>GRAPHIC_UNIT</TT> and 1.2 cvs 6682: <TT>PAGE_UNIT</TT>. But it is not necessary to specify rules for every 6683: defined type.</P> 1.1 cvs 6684: <P> 6685: If there are no translation rules for an element type, the elements that it 6686: contains (and which may have rules themselves) will still be translated, but 6687: the translator will produce nothing for the element itself. To make the 6688: translator completely ignore the content of an element the <A 1.6 cvs 6689: href="#sectc5217"><TT>Remove</TT> rule</A> must be used.</P> 1.1 cvs 6690: <P> 6691: The translation rules for an element type defined in the structure schema are 6692: written using the name of the type followed by a colon and the list of 1.6 cvs 6693: applicable rules. When the element type is a <A href="#sectd3285">mark pair</A>, 1.1 cvs 6694: but only in this case, the type name must be preceded by the <TT>First</TT> or 6695: <TT>Second</TT> keyword. This keyword indicates whether the rules that follow 6696: apply to the first or second mark of the pair.</P> 6697: <P> 6698: The list of rules can take several forms. It may be a simple non-conditional 6699: rule. It can also be formed by a condition followed by one or more simple 6700: rules. Or it can be a block of rules beginning with the <TT>BEGIN</TT> 6701: keyword and ending with the <TT>END</TT> keyword and a semicolon. This block 6702: of rules can contain one or more simple rules and/or one or more conditions, 6703: each followed by one or more simple rules.</P> 6704: <PRE> 6705: ElemSeq = TransType < TransType > . 6706: TransType = [ FirstSec ] ElemID ':' RuleSeq . 6707: FirstSec = 'First' / 'Second' . 6708: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' . 6709: Rule = SimpleRule / ConditionBlock . 6710: ConditionBlock = 'IF' ConditionSeq SimpleRuleSeq . 6711: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' / 6712: SimpleRule . 6713: </PRE> 6714: </DIV> 6715: 6716: <DIV class="subsection"> 1.6 cvs 6717: <H3><A name=sectc528>Conditional rules</A></H3> 1.1 cvs 6718: 6719: <P> 6720: In a translation schema, the translation rules are either associated with 6721: element types or with attribute values or with a specific presentation. They 6722: are applied by the translator each time an element of the corresponding type 6723: is encountered in the translated document or each time the attribute value is 6724: carried by an element or also, each time the specific translation is attached 6725: to an element. This systematic application of the rules can be relaxed: it is 6726: possible to add a condition to one or more rules, so that these rules are only 6727: applied when the condition is true.</P> 6728: <P> 6729: A condition begins with the keyword <TT>IF</TT>, followed by a sequence of 6730: elementary conditions. Elementary conditions are separated from each other by 6731: the <TT>AND</TT> keyword. If there is only one elementary condition, this 6732: keyword is absent. The rules are only applied if all the elementary 6733: conditions are true. The elementary condition can be negative; it is then 6734: preceded by the <TT>NOT</TT> keyword.</P> 6735: <P> 6736: When the translation rule(s) controlled by the condition apply to a reference 6737: element or a reference attribute, an elementary condition can also apply to 6738: element referred by this reference. The <TT>Target</TT> keyword is used for 6739: that purpose. It must appear before the keyword defining the condition 6740: type.</P> 6741: <P> 6742: Depending on their type, some conditions may apply either to the element with 1.5 cvs 6743: which they are associated, or to one of its ancestor. In the case of an 1.1 cvs 6744: ancestor, the key word <TT>Ancestor</TT> must be used, followed by</P> 6745: <UL> 1.2 cvs 6746: <LI>either an integer which represents the number of levels in the tree 6747: between the element and the ancestor of interest, 6748: <LI>or the type name of the ancestor of interest. If that type is defined in 6749: a separate structure schema, the name of that schema must follow between 1.1 cvs 6750: parentheses. 6751: </UL> 6752: <P> 1.2 cvs 6753: There is a special case for the parent element, which can be simply written 1.5 cvs 6754: <TT>Parent</TT> instead of <TT>Ancestor 1</TT>.</P> 1.1 cvs 6755: <P> 6756: Only conditions <TT>First</TT>, <TT>Last</TT>, <TT>Referred</TT>, 6757: <TT>Within</TT>, <TT>Attributes</TT>, <TT>Presentation</TT>, <TT>Comment</TT> 6758: and those concerning an attribute or a specific presentation can apply to an 6759: ancestor. Conditions <TT>Defined</TT>, <TT>FirstRef</TT>, <TT>LastRef</TT>, 6760: <TT>ExternalRef</TT>, <TT>Alphabet</TT>, <TT>FirstAttr</TT>, 6761: <TT>LastAttr</TT>, <TT>ComputedPage</TT>, <TT>StartPage</TT>, 6762: <TT>UserPage</TT>, <TT>ReminderPage</TT>, <TT>Empty</TT> cannot be preceded by 6763: keywords <TT>Parent</TT> or <TT>Ancestor</TT>.</P> 6764: <P> 6765: In condition <TT>Referred</TT> and in the condition that applies to a named 1.5 cvs 6766: attribute, a symbol '<TT>*</TT>' can indicate that the condition is related 6767: only to the element itself. If this symbol is not present, not only the 6768: element is considered, but also its ancestor, at any level.</P> 1.1 cvs 6769: <P> 6770: The form of an elementary condition varies according to the type of 6771: condition.</P> 6772: 6773: <DIV class="subsubsection"> 1.6 cvs 6774: <H4><A name=sectd5281>Conditions based on the logical position of the element</A></H4> 1.1 cvs 6775: 6776: <P> 6777: The condition can be on the position of the element in the document's logical 6778: structure tree. It is possible to test whether the element is the first 6779: (<TT>First</TT>) or last (<TT>Last</TT>) among its siblings or if it is not 6780: the first (<TT>NOT First</TT>) or not the last (<TT>NOT Last</TT>).</P> 6781: <P> 6782: It is also possible to test if the element is contained in an element of a 6783: given type (<TT>Within</TT>) or if it is not (<TT>NOT Within</TT>). If that 6784: element type is defined in a structure schema which is not the one which 6785: corresponds to the translation schema, the type name of this element must be 6786: followed, between parentheses, by the name of the structure schema which 6787: defines it.</P> 6788: <P> 6789: If the keyword <TT>Within</TT> is preceded by <TT>Immediately</TT>, the 6790: condition is satisfied only if the <EM>parent</EM> element has the type 6791: indicated. If the word <TT>Immediately</TT> is missing, the condition is 6792: satisfied if any <EM>ancestor</EM> has the type indicated.</P> 6793: <P> 6794: An integer <I>n</I> can appear between the keyword <TT>Within</TT> and the 6795: type. It specifies the number of ancestors of the indicated type that must be 6796: present for the condition to be satisfied. If the keyword 6797: <TT>Immediately</TT> is also present, the <I>n</I> immediate ancestors of the 6798: element must have the indicated type. The integer <I>n</I> must be positive 6799: or zero. It can be preceded by <TT><</TT> or <TT>></TT> to indicate a 6800: maximum or minimum number of ancestors. If these symbols are missing, the 6801: condition is satisfied only if it exists exactly <I>n</I> ancestors. When 6802: this number is missing, it is equivalent to > 0.</P> 1.11 cvs 6803: <P> 6804: If the condition applies to translation rules associated with an attribute, 6805: i.e. if it is in the <TT>ATTRIBUTES</TT> section of the presentation schema, 6806: the condition can be simply an element name. Translation rules are then 6807: executed only if the attribute is attached to an element of that type. 6808: The keyword <TT>NOT</TT> before the element name indicates that the 6809: translation rules must be executed only if the element is not of the type 6810: indicated.</P> 1.1 cvs 6811: </DIV> 6812: 6813: <DIV class="subsubsection"> 1.6 cvs 6814: <H4><A name=sectd5282>Conditions on references</A></H4> 1.1 cvs 6815: 6816: <P> 6817: References may be taken into account in conditions, which can be based on the 6818: fact that the element, or one of its ancestors (unless symbol <TT>*</TT> is 6819: present), is designated by a at least one reference (<TT>Referred</TT>) or by 6820: none (<TT>NOT Referred</TT>). If the element or attribute to which the 6821: condition is attached is a reference, the condition can be based on the fact 6822: that it acts as the first reference to the designated element 6823: (<TT>FirstRef</TT>), or as the last (<TT>LastRef</TT>), or as a reference to 6824: an element located in another document (<TT>ExternalRef</TT>). Like all 6825: conditions, conditions on references can be inverted by the <TT>NOT</TT> 6826: keyword.</P> 6827: </DIV> 6828: 6829: <DIV class="subsubsection"> 1.6 cvs 6830: <H4><A name=sectd5283>Conditions on the parameters</A></H4> 1.1 cvs 6831: 6832: <P> 1.6 cvs 6833: Elements which are <A href="#sectc326">parameters</A> can be given a particular 1.1 cvs 6834: condition which is based on whether or not the parameter is given a value in 6835: the document (<TT>Defined</TT> or <TT>NOT Defined</TT>, respectively).</P> 6836: </DIV> 6837: 6838: <DIV class="subsubsection"> 1.6 cvs 6839: <H4><A name=sectd5284>Conditions on the alphabets</A></H4> 1.1 cvs 6840: 6841: <P> 6842: The character string base type (and only this type) can use the condition 6843: <TT>Alphabet = a</TT> which indicates that the translation rule(s) should only 6844: apply if the alphabet of the character string is the one whose name appears 6845: after the equals sign (or is not, if there is a preceding <TT>NOT</TT> 6846: keyword). This condition cannot be applied to translation rules of an 6847: attribute.</P> 6848: <P> 6849: In the current implementation of Thot, the available alphabets are the 6850: <TT>Latin</TT> alphabet and the <TT>Greek</TT> alphabet.</P> 6851: </DIV> 6852: 6853: <DIV class="subsubsection"> 1.6 cvs 6854: <H4><A name=sectd5285>Conditions on page breaks</A></H4> 1.1 cvs 6855: 6856: <P> 6857: The page break base type (and only this type) can use the following 6858: conditions: <TT>ComputedPage</TT>, <TT>StartPage</TT>, <TT>UserPage</TT>, and 6859: <TT>ReminderPage</TT>. The <TT>ComputedPage</TT> condition indicates that the 6860: translation rule(s) should apply if the page break was created automatically 6861: by Thot; the <TT>StartPage</TT> condition is true if the page break is 6862: generated before the element by the <TT>Page</TT> rule of the P language; the 6863: <TT>UserPage</TT> condition applies if the page break was inserted by the 6864: user; and the <TT>ReminderPage</TT> is applied if the page break is a reminder 6865: of page breaking.</P> 6866: </DIV> 6867: 6868: <DIV class="subsubsection"> 1.6 cvs 6869: <H4><A name=sectd5286>Conditions on the element's content</A></H4> 1.1 cvs 6870: 6871: <P> 6872: The condition can be based on whether or not the element is empty. An element 6873: which has no children or whose leaves are all empty is considered to be empty 6874: itself. This condition is expressed by the <TT>Empty</TT> keyword, optionally 6875: preceded by the <TT>NOT</TT> keyword.</P> 6876: </DIV> 6877: 6878: <DIV class="subsubsection"> 1.6 cvs 6879: <H4><A name=sectd5287>Conditions on the presence of comments</A></H4> 1.1 cvs 6880: 6881: <P> 6882: The condition can be based on the presence or absence of comments associated 6883: with the translated element. This condition is expressed by the keyword 6884: <TT>Comment</TT>, optionally preceded by the keyword <TT>NOT</TT>.</P> 6885: </DIV> 6886: 6887: <DIV class="subsubsection"> 1.6 cvs 6888: <H4><A name=sectd5288>Conditions on the presence of specific presentation rules</A></H4> 1.1 cvs 6889: 6890: <P> 6891: The condition can be based on the presence or absence of specific presentation 6892: rules associated with the translated element, whatever the rules, their value 6893: or their number. This condition is expressed by the keyword 6894: <TT>Presentation</TT>, optionally preceded by the <TT>NOT</TT> keyword.</P> 6895: </DIV> 6896: 6897: <DIV class="subsubsection"> 1.6 cvs 6898: <H4><A name=sectd5289>Conditions on the presence of logical attributes</A></H4> 1.1 cvs 6899: 6900: <P> 6901: In the same way, the condition can be based on the presence or absence of 6902: attributes associated with the translated elements, no matter what the 6903: attributes or their values. The <TT>Attributes</TT> keyword expresses this 6904: condition.</P> 6905: </DIV> 6906: 6907: <DIV class="subsubsection"> 1.6 cvs 6908: <H4><A name=sectd52810>Conditions on logical attributes</A></H4> 1.1 cvs 6909: 6910: <P> 6911: If the condition appears in the translation rules of an attribute, the 6912: <TT>FirstAttr</TT> and <TT>LastAttr</TT> keywords can be used to indicate that 6913: the rules must only be applied if this attribute is the first attribute for 6914: the translated element or if it is the last (respectively). These conditions 6915: can also be inverted by the <TT>NOT</TT> keyword.</P> 6916: <P> 6917: Another type of condition can only be applied to the translation rules when 6918: the element being processed (or one of its ancestors if symbol <TT>*</TT> is 6919: missing) has a certain attribute, perhaps with a certain value or, in 6920: contrast, when the element does not have this attribute with this value. The 6921: condition is specified by writing the name of the attribute after the keyword 6922: <TT>IF</TT> or <TT>AND</TT>. The <TT>NOT</TT> keyword can be used to invert 6923: the condition. If the translation rules must be applied to any element which 6924: has this attribute (or does not have it, if the condition is inverted) no 6925: matter what the attribute's value, the condition is complete. If, in 6926: contrast, the condition applies to one or more values of the attribute, these 6927: are indicated after the name of the attribute, except for reference attributes 6928: which do not have values.</P> 6929: <P> 6930: The representation of the values of an <A name="relattr">attribute</A> in a 6931: condition depends on the attribute's type. For attributes with enumerated or 6932: textual types, the value (a name or character string between apostrophes, 6933: respectively) is simply preceded by an equals sign. For numeric attributes, 6934: the condition can be based on a single value or on a range of values. In the 6935: case of a unique value, this value (an integer) is simply preceded by an 6936: equals sign. Conditions based on ranges of values have several forms:</P> 6937: <UL> 1.2 cvs 6938: <LI>all values less than a given value (the value is preceded by a ``less 1.1 cvs 6939: than'' sign). 1.2 cvs 6940: <LI>all values greater than a given value (the value is preceded by a 6941: ``greater than'' sign). 6942: <LI>all values falling in an interval, bounds included. The range of values 6943: is then specified <TT>IN [</TT>Minimum <TT>..</TT>Maximum<TT>]</TT>, where 6944: Minimum and Maximum are integers. 1.1 cvs 6945: </UL> 6946: <P> 1.2 cvs 6947: All numeric values may be negative. The integer is simply preceded by a minus 1.1 cvs 6948: sign.</P> 6949: <P> 6950: Both local and global attributes can be used in conditions.</P> 6951: </DIV> 6952: 6953: <DIV class="subsubsection"> 1.6 cvs 6954: <H4><A name=sectd52811>Conditions on specific presentation rules</A></H4> 1.1 cvs 6955: 6956: <P> 6957: It is possible to apply translation rules only when the element being 6958: processed has or does not have a specific presentation rule, possibly with a 6959: certain value. The condition is specified by writing the name of the 6960: presentation rule after the keyword <TT>IF</TT> or <TT>AND</TT>. The 6961: <TT>NOT</TT> keyword can be used to invert the condition. If the translation 6962: rules must be applied to any element which has this presentation rule (or does 6963: not have it, if the condition is inverted) no matter what the rule's value, 6964: the condition is complete. If, in contrast, the condition applies to one or 6965: more values of the rule, these are indicated after the name of the 6966: attribute.</P> 6967: <P> 6968: The representation of presentation rule values in a condition is similar to 6969: that for attribute values. The representation of these values depend on the 6970: type of the presentation rule. There are three categories of presentation 6971: rules:</P> 6972: <UL> 6973: <LI>those taking numeric values (<TT>Size, Indent, LineSpacing, 6974: LineWeight</TT>), 6975: <LI>those with values taken from a predefined list (<TT>Adjust, Justify, 6976: Hyphenate, Style, Font, UnderLine, Thickness, LineStyle</TT>), 6977: <LI>those whose value is a name (<TT>FillPattern, Background, 6978: Foreground</TT>). 6979: </UL> 6980: <P> 6981: For presentation rules which take numeric values, the condition can take a 6982: unique value or a range of values. In the case of a unique value, this value 6983: (an integer) is simply preceded by an equals sign. Conditions based on ranges 6984: of values have several forms:</P> 6985: <UL> 1.2 cvs 6986: <LI>all values less than a given value (the value is preceded by a ``less 1.1 cvs 6987: than'' sign). 1.2 cvs 6988: <LI>all values greater than a given value (the value is preceded by a 6989: ``greater than'' sign). 6990: <LI>all values falling in an interval, bounds included. The range of values 6991: is then specified <TT>IN [</TT>Minimum <TT>..</TT>Maximum<TT>]</TT>, where 6992: Minimum and Maximum are integers. 1.1 cvs 6993: </UL> 6994: <P> 1.2 cvs 6995: Values for the <TT>Indent</TT>rule may be negative. The integer is then 6996: simply preceded by a minus sign and represents how far the first line starts 6997: to the left of the other lines.</P> 1.1 cvs 6998: <P> 6999: For presentation rules whose values are taken from predefined lists, the value 7000: which satisfies the condition is indicated by an equals sign followed by the 7001: name of the value.</P> 7002: <P> 7003: For presentation rule whose values are names, the value which satisfies the 7004: condition is indicated by the equals sign followed by the value's name. The 7005: names of fill patterns (the <TT>FillPattern</TT> rule) and of colors (the 7006: <TT>Foreground</TT> and <TT>Background</TT> rules) known to Thot are the same 7007: as in the P language.</P> 7008: <P> 7009: The syntax of conditions based on the specific presentation is the same as the 1.6 cvs 7010: syntax used to express the <A href="#sectc5224">translation of specific 1.1 cvs 7011: presentation rules</A>.</P> 7012: <P> 7013: When a condition has only one rule, the condition is simply followed by that 7014: rule. If it has several rules, they are placed after the condition between 7015: the keywords <TT>BEGIN</TT> and <TT>END</TT>.</P> 7016: <PRE> 7017: ConditionSeq = Condition [ 'AND' Condition ] . 7018: Condition = [ 'NOT' ] [ 'Target' ] Cond . 7019: Cond = CondElem / CondAscend . 7020: CondElem ='FirstRef' / 'LastRef' / 7021: 'ExternalRef' / 7022: 'Defined' / 7023: 'Alphabet' '=' Alphabet / 7024: 'ComputedPage' / 'StartPage' / 7025: 'UserPage' / 'ReminderPage' / 7026: 'Empty' / 1.11 cvs 7027: ElemID / 1.1 cvs 7028: 'FirstAttr' / 'LastAttr' . 7029: CondAscend = [ Ascend ] CondOnAscend . 7030: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType . 7031: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] . 7032: CondRelLevel = NUMBER . 7033: CondOnAscend ='First' / 'Last' / 7034: 'Referred' / 7035: [ 'Immediately' ] 'Within' [ NumParent ] 7036: ElemID [ ExtStruct ] / 7037: 'Attributes' / 7038: AttrID [ RelatAttr ] / 7039: 'Presentation' / 7040: PresRule / 7041: 'Comment' . 7042: NumParent = [ GreaterLess ] NParent . 7043: GreaterLess = '>' / '<' . 7044: NParent = NUMBER. 7045: ExtStruct = '(' ElemID ')' . 7046: Alphabet = NAME . 7047: RelatAttr ='=' Value / 7048: '>' [ '-' ] Minimum / 7049: '<' [ '-' ] Maximum / 7050: 'IN' '[' [ '-' ] MinInterval '..' 7051: [ '-' ] MaxInterval ']' . 7052: Value = [ '-' ] IntegerVal / TextVal / AttrValue . 7053: Minimum = NUMBER . 7054: Maximum = NUMBER . 7055: MinInterval = NUMBER . 7056: MaxInterval = NUMBER . 7057: IntegerVal = NUMBER . 7058: TextVal = STRING . 7059: AttrValue = NAME . 7060: </PRE> 7061: <BLOCKQUOTE class="example"> 7062: <P> 7063: <STRONG>Example:</STRONG></P> 7064: <P> 1.3 cvs 7065: Suppose that after each element of type Section_Title it is useful to produce 7066: the text <TT>\label{SectX}</TT> where <TT>X</TT> represents the section number, 7067: but only if the section is designated by one or more references in the 7068: document. The following conditional rule produces this effect:</P> 1.1 cvs 7069: <PRE> 7070: RULES 7071: Section_Title : 7072: IF Referred 1.5 cvs 7073: Create ('\label{Sect' Value(UniqueSectNum) '}\12') After; 1.1 cvs 7074: </PRE> 7075: <P> 1.6 cvs 7076: (the declaration of the <A href="#sectc5224"><TT>UniqueSectNum</TT> 1.3 cvs 7077: counter</A> is given above). The string <TT>\12</TT> represents a line 1.1 cvs 7078: break.</P> 7079: </BLOCKQUOTE> 7080: <BLOCKQUOTE class="example"> 7081: <P> 7082: <STRONG>Example:</STRONG></P> 7083: <P> 1.3 cvs 7084: Suppose that for elements of the Elmnt type it would be useful to produce a 7085: character indicating the value of the numeric attribute Level associated with 7086: the element: an ``A'' for all values of Level less than 3, a ``B'' for values 7087: between 3 and 10 and a ``C'' for values greater than 10. This can be achieved 7088: by writing the following rules for the Elmnt type:</P> 1.1 cvs 7089: <PRE> 7090: RULES 7091: Elmnt : 7092: BEGIN 7093: IF Level < 3 7094: Create 'A'; 7095: IF Level IN [3..10] 7096: Create 'B'; 7097: IF Level > 10 7098: Create 'C'; 7099: END; 7100: </PRE> 7101: </BLOCKQUOTE> 7102: </DIV> 7103: </DIV> 7104: 7105: <DIV class="subsection"> 1.6 cvs 7106: <H3><A name=sectc529>Translation rules</A></H3> 1.1 cvs 7107: 7108: <P> 1.10 cvs 7109: Fourteen types of translation rules can be associated with element types and 1.1 cvs 7110: attribute values. They are the <TT>Create</TT>, <TT>Write</TT>, 7111: <TT>Read</TT>, <TT>Include</TT>, <TT>Get</TT>, <TT>Copy</TT>, <TT>Use</TT>, 7112: <TT>Remove</TT>, <TT>NoTranslation</TT>, <TT>NoLineBreak</TT>, 1.10 cvs 7113: <TT>ChangeMainFile</TT>, <TT>Set</TT>, <TT>Add</TT>, <TT>Indent</TT> rules. 7114: Each rule has its own syntax, although they are all based on very similar 7115: models.</P> 1.1 cvs 7116: <PRE> 7117: SimpleRule = 'Create' [ 'IN' VarID ] Object 7118: [ Position ] ';' / 7119: 'Write' Object [ Position ] ';' / 7120: 'Read' BufferID [ Position ] ';' / 7121: 'Include' File [ Position ] ';' / 7122: 'Get' [ RelPosition ] ElemID 7123: [ ExtStruct ] 7124: [ Position ] ';' / 7125: 'Copy' [ RelPosition ] ElemID 7126: [ ExtStruct ] 7127: [ Position ] ';' / 7128: 'Use' TrSchema [ 'For' ElemID ] ';' / 7129: 'Remove' ';' / 7130: 'NoTranslation' ';' / 7131: 'NoLineBreak' ';' / 7132: 'ChangeMainFile' VarID [ Position ] ';' / 1.10 cvs 7133: 'Set' CounterID InitValue [ Position ] ';' / 7134: 'Add' CounterID Increment [ Position ] ';' / 7135: 'Indent' [ 'IN' VarID ] [ IndentSign ] 7136: IndentValue [ Position ] ';' . 1.1 cvs 7137: </PRE> 7138: </DIV> 7139: 7140: <DIV class="subsection"> 1.6 cvs 7141: <H3><A name=sectc5210>The <TT>Create</TT> rule</A></H3> 1.1 cvs 7142: 7143: <P> 7144: The most frequently used rule is undoubtedly the <TT>Create</TT> rule, which 7145: generates fixed or variable text (called an <EM>object</EM>) in the output 7146: file. The generated text can be made to appear either before or after the 7147: content of the element to which the rule applies. The rule begins with the 7148: <TT>Create</TT> keyword, followed by a specifier for the object and a keyword 7149: (<TT>Before</TT> or <TT>After</TT>) indicating the position of the generated 1.6 cvs 7150: text (<A href="#sectc5222">before or after</A> the element's content). If the 1.1 cvs 7151: position is not indicated, the object will be generated before the element's 7152: content. This rule, like all translation rules, is terminated by a 7153: semicolon.</P> 7154: <P> 7155: The <TT>Create</TT> keyword can be followed by the <TT>IN</TT> keyword and by 7156: the name of a variable. This means that the text generated by the rule must 7157: not be written in the main output file, but in the file whose name is 7158: specified by the variable.</P> 7159: <P> 7160: This allows the translation program to generate text in different files during 7161: the same run. These files do not need to be explicetely declared or opened. 7162: They do not need to be closed either. As soon as the translation program 7163: executes a <TT>Create</TT> rule for a file that is not yet open, it opens the 7164: file. These files are closed when the translation is finished.</P> 7165: <PRE> 7166: 'Create' [ 'IN' VarID ] Object 7167: [ Position ] ';' 7168: Object = ConstID / CharString / 7169: BufferID / 7170: VarID / 7171: '(' Function < Function > ')' / 7172: AttrID / 7173: 'Value' / 7174: 'Content' / 7175: 'Comment' / 7176: 'Attributes' / 7177: 'Presentation' / 7178: 'RefId' / 7179: 'PairId' / 7180: 'FileDir' / 7181: 'FileName' / 7182: 'Extension' / 7183: 'DocumentName' / 7184: 'DocumentDir' / 7185: [ 'Referred' ] ReferredObject . 7186: Position ='After' / 'Before' . 7187: 7188: ReferredObject = VarID / 7189: ElemID [ ExtStruct ] / 7190: 'RefId' / 7191: 'DocumentName' / 7192: 'DocumentDir' . 7193: </PRE> 7194: <P> 7195: The object to be generated can be:</P> 7196: <UL> 1.2 cvs 7197: <LI>a constant string, specified by its name if it is declared in the schema's 1.5 cvs 7198: <TT>CONST</TT> section, or given directly as a value between apostrophes; 1.1 cvs 7199: <LI>the contents of a buffer, designated by the name of the buffer; 1.2 cvs 7200: <LI>a variable, designated by its name if it is declared in the translation 1.5 cvs 7201: schema's <TT>VAR</TT> section, or given directly between parentheses. The text 1.2 cvs 7202: generated is the value of that variable evaluated for the element to which the 1.1 cvs 7203: rule applies. 1.2 cvs 7204: <LI>the value of an attribute, if the element being translated has this 7205: attribute. The attribute is specified by its name; 7206: <LI>the value of a specific presentation rule. This object can only be 1.1 cvs 7207: generated if the translation rule is for a <A href="#prestransl">specific 1.2 cvs 7208: presentation rule</A>. It is specified by the <TT>Value</TT> keyword; 7209: <LI>the element's content. That is, the content of the leaves of the subtree 7210: of the translated element. This is specified by the <TT>Content</TT> keyword; 7211: <LI>the comment attached to the element. When the element doesn't have a 7212: comment, nothing is generated. This is indicated by the <TT>Comment</TT> 7213: keyword; 7214: <LI>the translation of all attributes of the element (which is primarily used 1.6 cvs 7215: to apply the attribute translation rules <A href="#sectc5222">before</A> those of 1.2 cvs 7216: the element type). This is specified by the <TT>Attributes</TT> keyword. 7217: <LI>the translation of all of the element's specific presentation rules (which 7218: is primarily used to apply the translation rules for the specific presentation 1.6 cvs 7219: rules <A href="#sectc5222">before</A> those of the element or its attributes). 1.2 cvs 7220: This option is specified by the <TT>Presentation</TT> keyword; 1.5 cvs 7221: <LI>The value of the reference's identifier.<BR>Thot associates a unique 1.2 cvs 7222: identifier with each element in a document. This identifier (called 7223: <EM>reference's identifier</EM> or <EM>label</EM>) is a character string 7224: containing the letter `L' followed by digits. Thot uses it in references for 7225: identifying the referred element.<BR>The <TT>RefId</TT> keyword produces the 7226: reference's identifier of the element to which the translation rule is 7227: applied, or the reference's identifier of its first ancestor that is referred 7228: by a reference or that can be referred by a reference. 7229: <LI>the value of a mark pair's unique identifier. This may only be used for 1.6 cvs 7230: <A href="#sectd3285">mark pairs</A> and is indicated by the <TT>PairId</TT> 1.2 cvs 7231: keyword. 7232: <LI>the directory containing the file being generated (this string includes an 7233: ending '/', if it is not empty). This is indicated by the <TT>FileDir</TT> 7234: keyword. 7235: <LI>the name of the file being generated (only the name, without the directory 7236: and without the extension). This is indicated by the <TT>FileName</TT> 7237: keyword. 7238: <LI>the extension of the file being generated (this string starts with a dot, 7239: if it is not empty). This is indicated by the <TT>Extension</TT> keyword. 7240: <LI>the name of the document being translated. This is indicated by the 7241: <TT>DocumentName</TT> keyword. 7242: <LI>the directory containing the document being translated. This is indicated 7243: by the <TT>DocumentDir</TT> keyword. 1.1 cvs 7244: </UL> 7245: <P> 7246: When the rule applies to a reference (an element or an attribute defined as a 7247: reference in the structure schema), it can generate a text related to the 7248: element referred by that reference. The rule name is then followed the 7249: <TT>Referred</TT> keyword and a specification of the object to be generated 7250: for the referred element. This specification can be:</P> 7251: <UL> 1.2 cvs 7252: <LI>the name of a variable. The rule generates the value of that variable, 1.1 cvs 7253: computed for the referred element. 1.2 cvs 7254: <LI>an element type. The rule generates the translation of the element of 7255: that type, which is in the subtree of the referred element. If this element 7256: is not defined in the structure schema which corresponds to the translation 7257: schema (that is, an object defined in another schema), the element's type name 7258: must be followed by the name of its structure schema between parentheses. 7259: <LI>the <TT>RefId</TT> keyword. The rule generates the reference's identifier 1.1 cvs 7260: of the referred element. 1.2 cvs 7261: <LI>the <TT>DocumentName</TT> keyword. The rule generates the name of the 1.1 cvs 7262: document to which the referred element belongs. 1.2 cvs 7263: <LI>the <TT>DocumentDir</TT> keyword. The rule generates the name of the 1.1 cvs 7264: directory that contains the document of the referred element. 7265: </UL> 7266: </DIV> 7267: 7268: <DIV class="subsection"> 1.6 cvs 7269: <H3><A name=sectc5211>The <TT>Write</TT> rule</A></H3> 1.1 cvs 7270: 7271: <P> 7272: The <TT>Write</TT> has the same syntax as the <TT>Create</TT> rule. It also 7273: produces the same effect, but the generated text is displayed on the user's 7274: terminal during the translation of the document, instead of being produced in 7275: the translated document. This is useful for helping the user keep track of 7276: the progress of the translation and for prompting the user on the terminal for 7277: input required by the <TT>Read</TT> rule.</P> 7278: <PRE> 7279: 'Write' Object [ Position ] ';' 7280: </PRE> 7281: <P> 7282: Notice: if the translator is launched by the editor (by the ``Save as'' 7283: command), messages produced by the <TT>Write</TT> rule are not displayed.</P> 7284: <BLOCKQUOTE class="example"> 7285: <P> 7286: <STRONG>Example:</STRONG></P> 7287: <P> 1.3 cvs 7288: To make the translator display the number of each section being translated on 7289: the user's terminal, the following rule is specified for the 7290: <TT>Section</TT> element type:</P> 1.1 cvs 7291: <PRE> 7292: Section : BEGIN 7293: Write VarSection; 7294: ... 7295: END; 7296: </PRE> 7297: <P> 1.3 cvs 7298: (see <A href="#varsectexample">above</A> for the definition of 7299: the <TT>VarSection</TT> variable).</P> 1.1 cvs 7300: <P> 7301: To display text on the terminal before issuing a read operation with the 7302: <TT>Read</TT> rule, the following rule is used:</P> 7303: <PRE> 7304: BEGIN 7305: Write 'Enter the name of the destination: '; 7306: ... 7307: END; 7308: </PRE> 7309: </BLOCKQUOTE> 7310: </DIV> 7311: 7312: <DIV class="subsection"> 1.6 cvs 7313: <H3><A name=sectc5212>The <TT>Read</TT> rule</A></H3> 1.1 cvs 7314: 7315: <P> 7316: The <TT>Read</TT> rule reads text from the terminal during the translation of 7317: the document and saves the text read in one of the buffers declared in the 7318: <TT>BUFFERS</TT> section of the schema. The buffer to be used is indicated by 7319: its name, after the <TT>READ</TT> keyword. This name can be followed, as in 7320: the <TT>Create</TT> and <TT>Write</TT> rules, by a keyword indicating if the 7321: read operation must be performed <TT>Before</TT> or <TT>After</TT> the 7322: translation of the element's content. If this keyword is absent, the read 7323: operation is done beforehand. The text is read into the buffer and remains 1.5 cvs 7324: there until a rule using the same buffer - possibly the same rule - is 1.1 cvs 7325: applied.</P> 7326: <PRE> 7327: 'Read' BufferID [ Position ] ';' 7328: </PRE> 7329: <BLOCKQUOTE class="example"> 7330: <P> 7331: <STRONG>Example:</STRONG></P> 7332: <P> 1.3 cvs 7333: The following set of rules tells the user that the translator is waiting for 7334: the entry of some text, reads this text into a buffer and copies the text into 1.1 cvs 7335: the translated document.</P> 7336: <PRE> 7337: BEGIN 7338: Write 'Enter the name of the destination: '; 7339: Read DestName; 7340: Create DestName; 7341: ... 7342: END; 7343: </PRE> 7344: <P> 1.5 cvs 7345: (see <A href="#destname">above</A> the definition of <TT>DestName</TT>).</P> 1.1 cvs 7346: </BLOCKQUOTE> 7347: </DIV> 7348: 7349: <DIV class="subsection"> 1.6 cvs 7350: <H3><A name=sectc5213>The <TT>Include</TT> rule</A></H3> 1.1 cvs 7351: 7352: <P> 7353: The <TT>Include</TT> rule, like the <TT>Create</TT> rule, is used to produce 7354: text in the translated document. It inserts constant text which is not 7355: defined in the translation schema, but is instead taken from a file. The 7356: file's name is specified after the <TT>Include</TT> keyword, either directly 7357: as a character string between apostrophes or as the name of one of the buffers 7358: declared in the <TT>BUFFERS</TT> section of the schema. In the latter case, 7359: the buffer is assumed to contain the file's name. This can be used when the 7360: included file's name is known only at the moment of translation. This only 7361: requires that the <TT>Include</TT> rule is preceded by a <TT>Read</TT> rule 7362: which puts the name of the file desired by the user into the buffer.</P> 7363: <P> 7364: Like the other rules, it is possible to specify whether the inclusion will 7365: occur before or after the element's content, with the default being before. 7366: The file inclusion is only done at the moment of translation, not during the 7367: compilation of the translation schema. Thus, the file to be included need not 7368: exist during the compilation, but it must be accessible at the time of 7369: translation. Its contents can also be modified between two translations, thus 7370: producing different results, even if neither the document or the translation 7371: schema are modified.</P> 7372: <P> 7373: During translation, the file to be included is searched for along the schema 7374: directory path (indicated by the environment variable <TT>THOTSCH</TT>). The 7375: file name is normally only composed of a simple name, without specification of 1.12 ! cvs 7376: a complete file path. However, if the filename starts with a '/', it is ! 7377: considered as an absolute path.</P> 1.1 cvs 7378: <PRE> 1.6 cvs 7379: 'Include' File [ Position ] ';' 7380: File = FileName / BufferID . 7381: FileName = STRING . 1.1 cvs 7382: </PRE> 7383: <BLOCKQUOTE class="example"> 7384: <P> 7385: <STRONG>Example:</STRONG></P> 7386: <P> 1.3 cvs 7387: Suppose that it is desirable to print documents of the Article class with a 7388: formatter which requires a number of declarations and definitions at the 7389: beginning of the file. The <TT>Include</TT>rule can be used to achieve this. 7390: All the declarations and definitions a replaced in a file called 7391: <TT>DeclarArt</TT> and then the <TT>Article</TT> element type is given the 1.1 cvs 7392: following rule:</P> 7393: <PRE> 7394: Article : BEGIN 7395: Include 'DeclarArt' Before; 7396: ... 7397: END; 7398: </PRE> 7399: </BLOCKQUOTE> 7400: </DIV> 7401: 7402: <DIV class="subsection"> 1.6 cvs 7403: <H3><A name=sectc5214>The <TT>Get</TT> rule</A></H3> 1.1 cvs 7404: 7405: <P> 7406: The <TT>Get</TT> rule is used to change the order in which the elements appear 7407: in the translated document. More precisely, it produces the translation of a 7408: specified element before or after the translation of the content of the 7409: element to which the rule applies. The <TT>Before</TT> and <TT>After</TT> 7410: keywords are placed at the end of the rule to specify whether the operation 7411: should be performed before or after translation of the rule's element (the 7412: default is before). The type of the element to be moved must be specified 7413: after the <TT>Get</TT> keyword, optionally preceded by a keyword indicating 7414: where the element will be found in the logical structure of the document:</P> 7415: <DL> 7416: <DT><TT>Included</TT></DT> 1.2 cvs 7417: <DD>The element to be moved is the first element of the indicated type which is 1.1 cvs 7418: found inside the element to which the rule applies. 7419: </DD> 7420: <DT><TT>Referred</TT></DT> 1.2 cvs 7421: <DD>This keyword can only be used if the rule applies to a reference element. 7422: The element to be moved is either the element designated by the reference (if 7423: that element is of the specified type), or the first element of the desired 7424: type contained within the element designated by the reference. 1.1 cvs 7425: </DD> 7426: <DT>no keyword</DT> 1.2 cvs 7427: <DD>If the element to be moved is an associated element, defined in the <A 1.6 cvs 7428: href="#sectc314"><TT>ASSOC</TT> section</A> of the structure schema, all 1.2 cvs 7429: associated elements of this type which have not been translated yet are then 7430: translated. Certain elements may in fact have already been translated by a 7431: <TT>Get Referred</TT> rule. 1.1 cvs 7432: <P> 7433: If the element to be moved is not an associated element, the translator takes 7434: the first element of the indicated type from among the siblings of the rule's 7435: element. This is primarily used to change the order of the components of an 7436: aggregate.</P> 7437: </DD> 7438: </DL> 7439: <P> 7440: If the element to be moved is defined in a structure schema which is not the 7441: one which corresponds to the translation schema (in the case of an included 7442: object with a different schema), the type name of this element must be 7443: followed, between parentheses, by the name of the structure schema which 7444: defines it.</P> 7445: <PRE> 1.6 cvs 7446: 'Get' [ RelPosition ] ElemID 7447: [ ExtStruct ] 7448: [ Position ] ';' / 7449: RelPosition = 'Included' / 'Referred' . 1.1 cvs 7450: ExtStruct = '(' ElemID ')' . 7451: </PRE> 7452: <P> 7453: The <TT>Get</TT> rule has no effect if the element which it is supposed to 7454: move has already been translated. Thus, the element will not be duplicated. 7455: It is generally best to associate the rule with the first element which will 7456: be encountered by the translator in its traversal of the document. Suppose an 7457: aggregate has two elements <TT>A</TT> and <TT>B</TT>, with <TT>A</TT> 7458: appearing first in the logical structure. To permute these two elements, a 7459: <TT>Get B before</TT> rule should be associated with the <TT>A</TT> element 7460: type, not the inverse. Similarly, a rule of the form <TT>Get Included X 7461: After</TT>, even though syntactically correct, makes no sense since, by the 7462: time it will be applied, after the translation of the contents of the element 7463: to which it is attached, the <TT>X</TT> element will already have been 7464: translated.</P> 7465: <P> 7466: The <TT>Get</TT> rule is the only way to obtain the translation of the 7467: associated elements. In fact, the translator only traverses the primary tree 7468: of the document and thus does not translate the associated elements, except 7469: when the translation is explicitly required by a <TT>Get Referred Type</TT> or 7470: <TT>Get Type</TT> rule where <TT>Type</TT> is an associated element type.</P> 7471: <BLOCKQUOTE class="example"> 7472: <P> 7473: <STRONG>Example:</STRONG></P> 7474: <P> 1.3 cvs 7475: The structure schema defined figures as associated element which are composed 7476: of some content and a caption. Moreover, it is possible to make references to 7477: figures, using elements of the <TT>RefFigure</TT> type:</P> 1.1 cvs 7478: <PRE> 7479: ... 7480: RefFigure = REFERENCE(Figure); 7481: ASSOC 1.6 cvs 7482: Figure = BEGIN 7483: Content = NATURE; 7484: Caption = Text; 7485: END; 1.1 cvs 7486: ... 7487: </PRE> 7488: <P> 1.3 cvs 7489: Suppose it would be useful to make a figure appear in the translated document 7490: at the place in the text where the first reference to the figure is made. If 7491: some figures are not referenced, then they would appear at the end of the 7492: document. Also, each figure's caption should appear before the content. The 7493: following rules in the translation schema will produce this result:</P> 1.1 cvs 7494: <PRE> 7495: Article : BEGIN 7496: ... 7497: Get Figures After; 7498: END; 7499: RefFigure : BEGIN 7500: If FirstRef Get Referred Figure; 7501: ... 7502: END; 7503: Content : BEGIN 7504: Get Caption Before; 7505: ... 7506: END; 7507: </PRE> 7508: </BLOCKQUOTE> 7509: </DIV> 7510: 7511: <DIV class="subsection"> 1.6 cvs 7512: <H3><A name=sectc5215>The <TT>Copy</TT> rule</A></H3> 1.1 cvs 7513: 7514: <P> 7515: Like the <TT>Get</TT> rule, the <TT>Copy</TT> rule generates the translation 7516: of a specified element, but it acts even if the element has already been 7517: translated and it allows to copy it or to translate it later. Both rules have 7518: the same syntax.</P> 7519: <PRE> 7520: 'Copy' [ RelPosition ] ElemID 7521: [ ExtStruct ] [ Position ] ';' 7522: </PRE> 7523: </DIV> 7524: 7525: <DIV class="subsection"> 1.6 cvs 7526: <H3><A name=sectc5216>The <TT>Use</TT> rule</A></H3> 1.1 cvs 7527: 7528: <P> 7529: The <TT>Use</TT> rule specifies the translation schema to be applied to 7530: objects of a certain class that are part of the document. This rule only 7531: appears in the rules for the root element of the document (the first type 7532: defined after the <TT>STRUCT</TT> keyword in the structure schema) or the 7533: rules of an element defined by an external structure (by another structure 7534: schema). Also, the <TT>Use</TT> rule cannot be conditional.</P> 7535: <P> 7536: If the rule is applied to an element defined by an external structure, the 7537: <TT>Use</TT> keyword is simply followed by the name of the translation schema 7538: to be used for element constructed according to that external structure. If 7539: the rule is applied to the document's root element, it is formed by the 7540: <TT>Use</TT> keyword followed by the translation schema's name, the 7541: <TT>For</TT> keyword and the name of the external structure to which the 7542: indicated translation schema should be applied.</P> 7543: <PRE> 7544: 'Use' TrSchema [ 'For' ElemID ] ';' 7545: TrSchema = NAME . 7546: </PRE> 7547: <P> 7548: If no <TT>Use</TT> rule defines the translation schema to be used for an 7549: external structure which appears in a document, the translator asks the user, 7550: during the translation process, which schema should be used. Thus, it is not 7551: necessary to give the translation schema a <TT>Use</TT> rule for every 7552: external structure used, especially when the choice of translation schemas is 7553: to be left to the user.</P> 7554: <P> 7555: Notice: if the translator is launched by the editor (by the ``Save as'' 7556: command), prompts are not displayed.</P> 7557: <BLOCKQUOTE class="example"> 7558: <P> 7559: <STRONG>Example:</STRONG></P> 7560: <P> 1.4 cvs 7561: The <TT>Article</TT> structure schema uses the 7562: <TT>Formula</TT> external structure, defined by another structure schema, for 1.1 cvs 7563: mathematical formulas:</P> 7564: <PRE> 7565: STRUCTURE Article; 7566: ... 7567: STRUCT 7568: Article = ... 7569: ... 7570: Formula_in_text = Formula; 7571: Isolated_formula = Formula; 7572: ... 7573: END 7574: </PRE> 7575: <P> 1.3 cvs 7576: Suppose that it would be useful to use the <TT>FormulaT</TT> translation schema 7577: for the formulas of an article. This can be expressed in two different ways in 1.4 cvs 7578: the <TT>Article</TT> class translation schema, using the rules:</P> 1.1 cvs 7579: <PRE> 7580: RULES 7581: Article : 7582: Use FormulaT for Formula; 7583: </PRE> 7584: <P> 7585: or:</P> 7586: <PRE> 7587: RULES 7588: ... 7589: Formula : 7590: Use FormulaT; 7591: </PRE> 7592: </BLOCKQUOTE> 7593: </DIV> 7594: 7595: <DIV class="subsection"> 1.6 cvs 7596: <H3><A name=sectc5217>The <TT>Remove</TT> rule</A></H3> 1.1 cvs 7597: 7598: <P> 7599: The <TT>Remove</TT> rule indicates that nothing should be generated, in the 7600: translated document, for the content of the element to which the rule applies. 7601: The content of that element is simply ignored by the translator. This does 7602: not prevent the generation of text for the element itself, using the 7603: <TT>Create</TT> or <TT>Include</TT> rules, for example.</P> 7604: <P> 7605: The <TT>Remove</TT> rule is simply written with the <TT>Remove</TT> keyword. 7606: It is terminated, like all rules, by a semicolon.</P> 7607: <PRE> 7608: 'Remove' ';' 7609: </PRE> 7610: </DIV> 7611: 7612: <DIV class="subsection"> 1.6 cvs 7613: <H3><A name=sectc5218>The <TT>NoTranslation</TT> rule</A></H3> 1.1 cvs 7614: 7615: <P> 7616: The <TT>NoTranslation</TT> rule indicates to the translator that it must not 7617: translate the content of the leaves of the element to which it applies. In 7618: contrast to the <TT>Remove</TT> rule, it does not suppress the content of the 7619: element, but it inhibits the translation of character strings, symbols, and 7620: graphical elements contained in the element. These are retrieved so that 7621: after the translation of the document, the rules of the <A 1.6 cvs 7622: href="#sectc5225"><TT>TEXTTRANSLATE</TT>, <TT>SYMBTRANSLATE</TT> and 1.1 cvs 7623: <TT>GRAPHTRANSLATE</TT> sections</A> will not be applied to them.</P> 7624: <P> 7625: The <TT>NoTranslation</TT> rule is written with the <TT>NoTranslation</TT> 7626: keyword followed by a semicolon.</P> 7627: <PRE> 7628: 'NoTranslation' ';' 7629: </PRE> 7630: </DIV> 7631: 7632: <DIV class="subsection"> 1.6 cvs 7633: <H3><A name=sectc5219>The <TT>NoLineBreak</TT> rule</A></H3> 1.1 cvs 7634: 7635: <P> 7636: The <TT>NoLineBreak</TT> rule indicates to the translator that it must not 7637: generate additional line breaks in the output produced for the element to 1.6 cvs 7638: which it applies. This is as if it was an <A href="#sectc522">instruction 1.1 cvs 7639: <TT>LINELENGTH 0;</TT></A> at the beginning of the translation schema, but 7640: only for the current element.</P> 7641: <P> 7642: The <TT>NoLineBreak</TT> rule is written with the <TT>NoLineBreak</TT> keyword 7643: followed by a semicolon.</P> 7644: <PRE> 7645: 'NoLineBreak' ';' 7646: </PRE> 7647: </DIV> 7648: 7649: <DIV class="subsection"> 1.6 cvs 7650: <H3><A name=sectc5220>The <TT>ChangeMainFile</TT> rule</A></H3> 1.1 cvs 7651: 7652: <P> 7653: When the translation program starts, it opens a main output file, whose name 1.6 cvs 7654: is given as a parameter of the program. All <A href="#sectc5210"><TT>Create</TT> 1.1 cvs 7655: rules</A> without explicit indication of the output file write sequentially in 7656: this file. When a <TT>ChangeMainFile</TT> rule is executed, the main output 7657: file is closed and it is replaced by a new one, whose name is specified in the 7658: <TT>ChangeMainFile</TT> rule. The <TT>Create</TT> rules without indication of 7659: the output file that are then executed write in this new file. Several 7660: <TT>ChangeMainFile</TT> rules can be executed during the same translation, for 7661: dividing the main output into several files.</P> 7662: <P> 7663: This rule is written with the <TT>ChangeMainFile</TT> keyword followed by the 7664: name of a variable that specify the name of the new main file. The keyword 7665: <TT>Before</TT> or <TT>After</TT> can be placed at the end of the rule to 7666: specify whether the operation should be performed before or after translation 7667: of the rule's element (the default is before). This rule, like all translation 7668: rules, is terminated by a semicolon.</P> 7669: <PRE> 7670: 'ChangeMainFile' VarID [ Position ] ';' 7671: </PRE> 7672: <BLOCKQUOTE class="example"> 7673: <P> 7674: <STRONG>Example:</STRONG></P> 7675: <P> 1.3 cvs 7676: To generate the translation of each section in a different file, the following 7677: rule can be associated with type <TT>Section</TT>. That rule uses the <A 7678: href="#varoutputfile"><TT>VarOutpuFile</TT> variable</A> defined above.</P> 1.1 cvs 7679: <PRE> 7680: Section: 7681: ChangeMainFile VarOutpuFile Before; 7682: </PRE> 7683: <P> 1.3 cvs 7684: If <TT>output.txt</TT> is the name of the output file specified when starting 7685: the translation program, translated sections are written in files 1.1 cvs 7686: <TT>output1.txt</TT>, <TT>output2.txt</TT>, etc.</P> 7687: </BLOCKQUOTE> 7688: </DIV> 7689: 7690: <DIV class="subsection"> 1.6 cvs 7691: <H3><A name=sectc5221>The <TT>Set</TT> and <TT>Add</TT> rules</A></H3> 1.1 cvs 7692: 7693: <P> 7694: The <TT>Set</TT> and <TT>Add</TT> rules are used for modifying the value of 1.6 cvs 7695: counters that have no <A href="#sectc524">counting function</A>. Only this 1.1 cvs 7696: type of counter can be used in the <TT>Set</TT> and <TT>Add</TT> rules.</P> 7697: <P> 7698: Both rules have the same syntax: after the keyword <TT>Set</TT> or 7699: <TT>Add</TT> appear the counter name and the value to assign to the counter 7700: (<TT>Set</TT> rule) or the value to be added to the counter (<TT>Add</TT> 7701: rule). The keyword <TT>Before</TT> or <TT>After</TT> can follo9w that value to 7702: indicate when the rule must be applied: before or after the element's content 7703: is translated. By default, <TT>Before</TT> is assumed. A semicolon terminates 7704: the rule.</P> 7705: <PRE> 7706: 'Set' CounterID InitValue [ Position ] ';' / 7707: 'Add' CounterID Increment [ Position ] ';' 7708: </PRE> 7709: </DIV> 7710: 7711: <DIV class="subsection"> 1.10 cvs 7712: <H3><A name=sectc5221a>The <TT>Indent</TT> rule</A></H3> 7713: 7714: <P> 7715: The <TT>Indent</TT> rule is used to modify the value of text indentation 7716: in the output files.</P> 7717: <P> 7718: Each time the translator creates a new line in an output file, it generates 7719: a variable number of space characters at the beginning of the new line. By 7720: default, the number of these characters (the indentation) is 0. It can be 7721: changed with the <TT>Indent</TT> rule.</P> 7722: <P> 7723: The rule begins with the <TT>Indent</TT> keyword, followed by the indentation 7724: sign (optional) and value and a keyword <TT>Before</TT> or <TT>After</TT> 7725: indicating that the indentation should be changed <A href="#sectc5222">before 7726: or after</A> the element's content is generated. If the position is not 7727: indicated, the indentation is changed before the element's content is 7728: generated. This rule, like all translation rules, is terminated by a 7729: semicolon.</P> 7730: <P> 7731: The indentation value is indicated by an integer, which is the number of 7732: space characters to be generated at the beginning of each new line. 7733: A sign (<TT>+</TT> or <TT>-</TT>) can appear before the integer to indicate 7734: that the value is relative: the current value of indentation is incremented 7735: (if sign is <TT>+</TT>) or decremented (if sign is <TT>-</TT>) by the 7736: specified value. 7737: <P> 7738: Like the <A href="#sectc5210"><TT>Create</TT> rule</A>, the <TT>Indent</TT> 7739: keyword can be followed by the <TT>IN</TT> keyword and by the name of a 7740: <A href="#sectc526">variable</A>. This means that the rule must not change 7741: indentation in the main output file, but in the file whose name is specified 7742: by the variable (by default, indentation is changed in the main output 7743: file).</P> 7744: <PRE> 7745: 'Indent' [ 'IN' VarID ] [ IndentSign ] 7746: IndentValue [ Position ] ';' . 7747: 7748: IndentSign = '+' / '-' . 7749: IndentValue = NUMBER . 7750: </PRE> 7751: </DIV> 7752: 7753: <DIV class="subsection"> 1.6 cvs 7754: <H3><A name=sectc5222>Rule application order</A></H3> 1.1 cvs 7755: 7756: <P> 7757: The translator translates the elements which comprise the document in the 7758: order induced by the tree structure, except when the <TT>Get</TT> rule is used 7759: to change the order of translation. For each element, the translator first 7760: applies the rules specified for the element's type that must be applied before 7761: translation of the element's content (rules ending with the <TT>Before</TT> 7762: keyword or which have no position keyword). If several rules meet these 7763: criteria, the translator applies them in the order in where they appear in the 7764: translation schema.</P> 7765: <P> 1.6 cvs 7766: It then applies all <A href="#sectc5223">rules for the attributes</A> which 1.1 cvs 7767: the element has and which must be applied before the translation of the 7768: element's content (rules ending with the <TT>Before</TT> keyword or which have 7769: no position keyword). For one attribute value, the translator applies the 7770: rules in the order in which they are defined in the translation schema.</P> 7771: <P> 7772: The same procedure is followed with translation rules for specific 7773: presentations.</P> 7774: <P> 7775: Next, the element's content is translated, as long as a <TT>Remove</TT> rule 7776: does not apply.</P> 7777: <P> 7778: In the next step, the translator applies rules for the specific presentation 7779: of the element that are to be applied after translation of the content (rules 7780: which end with the <TT>After</TT> keyword). The rules for each type of 7781: presentation rule or each value are applied in the order in which the 7782: translation appear in the schema.</P> 7783: <P> 7784: Then, the same procedure is followed for translation rules for attributes of 7785: the element.</P> 7786: <P> 7787: Finally, the translator applies rules for the element which must be applied 7788: after translation of the element's content. These rules are applied in the 7789: order that they appear in the translation schema. When the translation of an 7790: element is done, the translator procedes to translate the following 7791: element.</P> 7792: <P> 7793: This order can be changed with the <TT>Attributes</TT> and 1.6 cvs 7794: <TT>Presentation</TT> options of the <A href="#sectc5210"><TT>Create</TT> 1.1 cvs 7795: rule</A>.</P> 7796: </DIV> 7797: 7798: <DIV class="subsection"> 1.6 cvs 7799: <H3><A name=sectc5223>Translation of logical attributes</A></H3> 1.1 cvs 7800: 7801: <P> 7802: After the rules for the element types, the translation schema defines rules 7803: for attribute values. This section begins with the <TT>ATTRIBUTES</TT> 7804: keyword and is composed of a sequence of rule blocks each preceded by an 7805: attribute name and an optional value or value range.</P> 7806: <P> 7807: If the attribute's name appears alone before the rule block, the rule are 7808: applied to all element which have the attribute, no matter what value the 7809: attribute has. In this case, the attribute name is followed by a colon before 7810: the beginning of the rule block.</P> 7811: <P> 7812: The attribute's name can be followed by the name of an element type between 7813: parentheses. This says, as in presentation schemas, that the rule block which 7814: follows applies not to the element which has the attribute, but to its 7815: descendants of the type indicated between the parentheses.</P> 7816: <P> 7817: If values are given after the attribute name (or after the name of the element 7818: type), the rules are applied only when the attribute has the indicated values. 7819: The same attribute can appear several times, with different values and 7820: different translation rules. Attribute values are indicated in the same way 1.6 cvs 7821: as in <A href="#sectc528">conditions</A> and are followed by a colon before 1.1 cvs 7822: the block of rules.</P> 7823: <P> 7824: The rule block associated with an attribute is either a simple rule or a 7825: sequence of rules delimited by the <TT>BEGIN</TT> and <TT>END</TT> keywords. 7826: Note that rules associated with attribute values cannot be conditional.</P> 7827: <P> 7828: Translation rules are not required for all attributes (or their values) 7829: defined in a structure schema. Only those attributes for which a particular 7830: action must be performed by the translator must have such rules. The rules 7831: that can be used are those described above, from <A 1.6 cvs 7832: href="#sectc5210"><TT>Create</TT></A> to <A 7833: href="#sectc5218"><TT>NoTranslation</TT></A>.</P> 1.1 cvs 7834: <PRE> 7835: AttrSeq = TransAttr < TransAttr > . 7836: TransAttr = AttrID [ '(' ElemID ')' ] 7837: [ RelatAttr ] ':' RuleSeq . 7838: AttrID = NAME . 7839: ElemID = NAME . 7840: </PRE> 7841: <BLOCKQUOTE class="example"> 7842: <P> 7843: <STRONG>Example:</STRONG></P> 7844: <P> 1.3 cvs 7845: The structure defined the ``Language'' attribute which can take the values 7846: ``French'' and ``English''. To have the French parts of the original document 7847: removed and prevent the translation of the leaves of the English parts, the 1.1 cvs 7848: following rules would be used:</P> 7849: <PRE> 7850: ATTRIBUTES 7851: Language=French : 7852: Remove; 7853: Language=English : 7854: NoTranslation; 7855: </PRE> 7856: </BLOCKQUOTE> 7857: </DIV> 7858: 7859: <DIV class="subsection"> 1.6 cvs 7860: <H3><A name=sectc5224>Translation of specific presentations</A></H3> 1.1 cvs 7861: 7862: <P> 7863: After the rules for attributes, the translation schema defines rules for the 7864: specific presentation. This section begins with the <TT>PRESENTATION</TT> 7865: keyword and is composed of a sequence of translation rule blocks each preceded 7866: by a presentation rule name, optionally accompanied by a part which depends on 7867: the particular presentation rule.</P> 7868: <P> 7869: Each of these translation rule blocks is applied when the translator operates 7870: on an element which has a specific presentation rule of the type indicated at 7871: the head of the block. Depending on the type of the specific presentation 7872: rule, it is possible to specify values of the presentation rule for which the 7873: translation rule block should be applied.</P> 7874: <P> 7875: There are three categories of the presentation rules:</P> 7876: <UL> 1.2 cvs 7877: <LI>rules taking numeric values: <TT>Size</TT>, <TT>Indent</TT>, 7878: <TT>LineSpacing</TT>, <TT>LineWeight</TT>, 7879: <LI>rules whose values are taken from a predefined list (i.e. whose type is an 1.1 cvs 7880: enumeration): <TT>Adjust</TT>, <TT>Justify</TT>, <TT>Hyphenate,/TT>, 7881: <TT>Style</TT>, <TT>Font</TT>, <TT>UnderLine</TT>, <TT>Thickness</TT>, 7882: <TT>LineStyle</TT>,</TT> 1.2 cvs 7883: <LI>rules whose value is a name: <TT>FillPattern</TT>, <TT>Background</TT>, 7884: <TT>Foreground</TT>. 1.1 cvs 7885: </UL> 7886: <P> 7887: For presentation rules of the first category, the values which provoke 7888: application of the translation rules are indicated in the same manner as for 7889: <A href="#relattr">numeric attributes</A>. This can be either a unique value 7890: or range of values. For a unique value, the value (an integer) is simply 7891: preceded by an equals sign. Value ranges can be specified in one of three 7892: ways:</P> 7893: <UL> 1.2 cvs 7894: <LI>all values less than a given value (this value is preceded by a ``less 1.5 cvs 7895: than'' sign '<TT><</TT>'), 1.2 cvs 7896: <LI>all values greater than a given value (this value is preceded by a` 1.5 cvs 7897: `greater than'' sign '<TT>></TT>'), 1.2 cvs 7898: <LI>all values falling in an interval, bounds included. The range of values 7899: is then specified <TT>IN [</TT>Minimum<TT>..</TT>Maximum<TT>]</TT>, where 7900: Minimum and Maximum are integers. 1.1 cvs 7901: </UL> 7902: <P> 1.2 cvs 7903: All numeric values can be negative, in which case the integer is preceded by a 7904: minus sign. All values must be given in typographers points.</P> 1.1 cvs 7905: <P> 7906: For presentation rules whose values are taken from a predefined list, the 7907: value which provokes application of the translation rules is simply indicated 7908: by the equals sign followed by the name of the value.</P> 7909: <P> 7910: For presentation rules whose values are names, the value which provokes the 7911: application of translation rules is simply indicated by the equals sign 7912: followed by the name of the value. The names of the fill patterns (the 7913: <TT>FillPattern</TT> rule) and of the colors (the <TT>Foreground</TT> and 7914: <TT>Background</TT> rules) used in Thot are the same as in the P language.</P> 7915: <PRE> 7916: PresSeq = PresTrans < PresTrans > . 7917: PresTrans = PresRule ':' RuleSeq . 7918: PresRule = 'Size' [ PresRelation ] / 7919: 'Indent' [ PresRelation ] / 7920: 'LineSpacing' [ PresRelation ] / 7921: 'Adjust' [ '=' AdjustVal ] / 7922: 'Justify' [ '=' BoolVal ] / 7923: 'Hyphenate' [ '=' BoolVal ] / 7924: 'Style' [ '=' StyleVal ] / 7925: 'Font' [ '=' FontVal ] / 7926: 'UnderLine' [ '=' UnderLineVal ] / 7927: 'Thickness' [ '=' ThicknessVal ] / 7928: 'LineStyle' [ '=' LineStyleVal ] / 7929: 'LineWeight' [ PresRelation ] / 7930: 'FillPattern' [ '=' Pattern ] / 7931: 'Background' [ '=' Color ] / 7932: 'Foreground' [ '=' Color ] . 7933: 7934: PresRelation = '=' PresValue / 7935: '>' [ '-' ] PresMinimum / 7936: '<' [ '-' ] PresMaximum / 7937: 'IN' '[' [ '-' ] PresIntervalMin '..' 7938: [ '-' ] PresIntervalMax ']' . 7939: AdjustVal = 'Left' / 'Right' / 'VMiddle' / 7940: 'LeftWithDots' . 7941: BoolVal = 'Yes' / 'No' . 7942: StyleVal = 'Bold' / 'Italics' / 'Roman' / 7943: 'BoldItalics' / 'Oblique' / 7944: 'BoldOblique' . 7945: FontVal = 'Times' / 'Helvetica' / 'Courier' . 7946: UnderLineVal = 'NoUnderline' / 'UnderLined' / 7947: 'OverLined' / 'CrossedOut' . 7948: ThicknessVal = 'Thick' / 'Thin' . 1.6 cvs 7949: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' . 1.1 cvs 7950: Pattern = NAME . 7951: Color = NAME . 7952: PresMinimum = NUMBER . 7953: PresMaximum = NUMBER . 7954: PresIntervalMin= NUMBER . 7955: PresIntervalMax= NUMBER . 7956: PresValue = [ '-' ] PresVal . 7957: PresVal = NUMBER . 7958: </PRE> 7959: <P> 7960: The <A name="prestransl">translation rules associated with specific 7961: presentation rules</A> can use the value of the specific presentation rule 7962: that causes them to be applied. This behavior is designated by the keyword 7963: <TT>Value</TT>. For numerically-valued presentation rules, the numeric value 7964: is produced. For other presentation rules, the name of the value is 7965: produced.</P> 7966: <P> 7967: It should be noted that modifications to the layout of the document's elements 7968: that are made using the combination of the control key and a mouse button will 7969: have no effect on the translation of the document.</P> 7970: <BLOCKQUOTE class="example"> 7971: <P> 7972: <STRONG>Example:</STRONG></P> 7973: <P> 1.3 cvs 7974: Suppose that it is desirable to use the same font sizes as in the specific 7975: presentation, but the font size must be between 10 and 18 typographer's points. 7976: If font size is set in the translated document by the string 7977: <TT>pointsize=n</TT> where <TT>n</TT> is the font size in typographer's points 1.1 cvs 7978: then the following rules will suffice:</P> 7979: <PRE> 7980: PRESENTATION 7981: Size < 10 : 7982: Create 'pointsize=10'; 7983: Size in [10..18] : 7984: BEGIN 7985: Create 'pointsize='; 7986: Create Value; 7987: END; 7988: Size > 18 : 7989: Create 'pointsize=18'; 7990: </PRE> 7991: </BLOCKQUOTE> 7992: </DIV> 7993: 7994: <DIV class="subsection"> 1.6 cvs 7995: <H3><A name=sectc5225>Recoding of characters, symbols and graphics</A></H3> 1.1 cvs 7996: 7997: <P> 7998: The coding of characters, graphical elements and symbols as defined in Thot 7999: does not necessarily correspond to what is required by an application to which 8000: a Thot document must be exported. Because of this the translator can recode 8001: these terminal elements of the documents structure. The last sections of a 8002: translation schema are intended for this purpose, each specifying the recoding 8003: rules for one type of terminal element.</P> 8004: <P> 8005: The recoding rules for character strings are grouped by alphabets. There is a 8006: group of rules for each alphabet of the Thot document that must be translated. 8007: Each such group of rules begins with the <TT>TEXTTRANSLATE</TT> keyword, 8008: followed by the specification of the alphabet to translate and the recoding 8009: rules, between the <TT>BEGIN</TT> and <TT>END</TT> keywords unless there is 8010: only one recoding rule for the alphabet. The specification of the alphabet is 8011: not required: by default it is assumed to the Latin alphabet (the ISO Latin-1 8012: character set).</P> 8013: <P> 8014: Each recoding rule is formed by a source string between apostrophes and a 8015: target string, also between apostrophes, the two strings being separated by 8016: the arrow symbol (<TT>-></TT>), formed by the ``minus'' and ``greater than'' 8017: characters. The rule is terminated by a semi-colon.</P> 8018: <PRE> 8019: TextTransSeq = [ Alphabet ] TransSeq . 8020: Alphabet = NAME . 8021: TransSeq ='BEGIN' < Translation > 'END' ';' / 8022: Translation . 8023: Translation = Source [ '->' Target ] ';' . 8024: Source = STRING . 8025: Target = STRING . 8026: </PRE> 8027: <P> 8028: One such rule signifies that when the source string appears in a text leaf of 8029: the document being translated, the translator must replace it, in the 8030: translated document, with the target string. The source string and the target 8031: string can have different lengths and the target string can be empty. In this 8032: last case, the translator simply suppresses every occurrence of the source 8033: string in the translated document.</P> 8034: <P> 8035: For a given alphabet, the order of the rules is not important and has no 8036: significance because the T language compiler reorders the rules in ways that 8037: speed up the translator's work. The total number of recoding rules is limited 8038: by the compiler as is the maximum length of the source and target strings.</P> 8039: <P> 8040: The recoding rules for symbols and graphical elements are written in the same 8041: manner as the recoding rules for character strings. They are preceded, 8042: respectively, by the <TT>SYMBTRANSLATE</TT> and <TT>GRAPHTRANSLATE</TT> and so 8043: not require a specification of the alphabet. Their source string is limited to 8044: one character, since, in Thot, each symbol and each graphical element is 8045: represented by a single character. The symbol and graphical element codes are 1.6 cvs 8046: defined along with the <A href="#sect7">non-standard character 1.1 cvs 8047: codes</A>.</P> 8048: <BLOCKQUOTE class="example"> 8049: <P> 8050: <STRONG>Example:</STRONG></P> 8051: <P> 8052: In a translation schema producing documents destined for use with 1.3 cvs 8053: the L<SUP>A</SUP>T<SUB><BIG>E</BIG></SUB>X formatter, the Latin 1.1 cvs 8054: characters``é'' (octal code 351 in Thot) and ``è'' (octal code 1.3 cvs 8055: 350 in Thot) must be converted to their representation 8056: in L<SUP>A</SUP>T<SUB><BIG>E</BIG></SUB>X:</P> 1.1 cvs 8057: <PRE> 1.6 cvs 8058: TEXTTRANSLATE Latin 1.1 cvs 8059: BEGIN 8060: '\350' -> '\`{e}'; { e grave } 8061: '\351' -> '\''{e}'; { e acute } 8062: END; 8063: </PRE> 8064: </BLOCKQUOTE> 8065: </DIV> 8066: </DIV> 8067: <HR> 8068: </DIV> 8069: 8070: <DIV class="chapter"> 1.6 cvs 8071: <H1><A name=sect6>Language grammars</A></H1> 1.1 cvs 8072: 8073: <P> 8074: This chapter gives the complete grammars of the languages of Thot. The 8075: grammars were presented and described in the preceding chapters, which also 8076: specify the semantics of the languages. This section gives only the 8077: syntax.</P> 8078: 8079: <DIV class="section"> 1.6 cvs 8080: <H2><A name=sectb61>The M meta-language</A></H2> 1.1 cvs 8081: 8082: <P> 8083: The language grammars are all expressed in the same formalism, the M 8084: meta-language, which is defined in this section.</P> 8085: <PRE> 8086: { Any text between braces is a comment. } 8087: Grammar = Rule < Rule > 'END' . 8088: { The < and > signs indicate zero } 8089: { or more repetitions. } 8090: { END marks the end of the grammar. } 8091: Rule = Ident '=' RightPart '.' . 8092: { The period indicates the end of a rule } 8093: RightPart = RtTerminal / RtIntermed . 8094: { The slash indicates a choice } 8095: RtTerminal ='NAME' / 'STRING' / 'NUMBER' . 8096: { Right part of a terminal rule } 8097: RtIntermed = Possibility < '/' Possibility > . 8098: { Right part of an intermediate rule } 8099: Possibility = ElemOpt < ElemOpt > . 8100: ElemOpt = Element / '[' Element < Element > ']' / 8101: '<' Element < Element > '>' . 8102: { Brackets delimit optional parts } 8103: Element = Ident / KeyWord . 8104: Ident = NAME . 8105: { Identifier, sequence of characters 8106: KeyWord = STRING . 8107: { Character string delimited by apostrophes } 8108: END 8109: </PRE> 8110: </DIV> 8111: 8112: <DIV class="section"> 1.6 cvs 8113: <H2><A name=sectb62>The S language</A></H2> 1.1 cvs 8114: 8115: <P> 8116: The S language is used to write structure schemas, which contain the generic 8117: logical structures of document and object classes. It is described here in 8118: the M meta-language.</P> 8119: <PRE> 8120: StructSchema = 'STRUCTURE' [ 'EXTENSION' ] ElemID ';' 8121: 'DEFPRES' PresID ';' 8122: [ 'ATTR' AttrSeq ] 8123: [ 'PARAM' RulesSeq ] 8124: [ 'STRUCT' RulesSeq ] 8125: [ 'EXTENS' ExtensRuleSeq ] 8126: [ 'ASSOC' RulesSeq ] 8127: [ 'UNITS' RulesSeq ] 8128: [ 'EXPORT' SkeletonSeq ] 8129: [ 'EXCEPT' ExceptSeq ] 8130: 'END' . 8131: 8132: ElemID = NAME . 8133: PresID = NAME . 8134: 8135: AttrSeq = Attribute < Attribute > . 8136: Attribute = AttrID '=' AttrType ';' . 8137: AttrType = 'INTEGER' / 'TEXT' / 8138: 'REFERENCE' '(' RefType ')' / 8139: ValueSeq . 8140: RefType = 'ANY' / 8141: [ FirstSec ] ElemID [ ExtStruct ] . 8142: ValueSeq = AttrVal < ',' AttrVal > . 8143: AttrID = NAME . 8144: FirstSec = 'First' / 'Second' . 8145: ExtStruct = '(' ElemID ')' . 8146: AttrVal = NAME . 8147: 8148: RulesSeq = Rule < Rule > . 8149: Rule = ElemID [ LocAttrSeq ] '=' 8150: DefWithAttr ';' . 8151: LocAttrSeq = '(' 'ATTR' LocalAttr 8152: < ';' LocalAttr > ')' . 8153: LocalAttr = [ '!' ] AttrID [ '=' AttrType ] . 8154: DefWithAttr = Definition 8155: [ '+' '(' ExtensionSeq ')' ] 8156: [ '-' '(' RestrictSeq ')' ] 8157: [ 'WITH' FixedAttrSeq ] . 8158: ExtensionSeq = ExtensionElem < ',' ExtensionElem > . 8159: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' / 8160: 'SYMBOL' / 'PICTURE' . 8161: RestrictSeq = RestrictElem < ',' RestrictElem > . 8162: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' / 8163: 'SYMBOL' / 'PICTURE' . 8164: FixedAttrSeq = FixedAttr < ',' FixedAttr > . 8165: FixedAttr = AttrID [ FixedOrModifVal ] . 8166: FixedOrModifVal= [ '?' ] '=' FixedValue . 8167: FixedValue = [ '-' ] NumValue / TextValue / AttrVal . 8168: NumValue = NUMBER . 8169: TextValue = STRING . 8170: 8171: Definition = BaseType [ LocAttrSeq ] / Constr / 8172: Element . 8173: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 8174: 'PICTURE' / 'UNIT' / 'NATURE' . 8175: Element = ElemID [ ExtOrDef ] . 8176: ExtOrDef = 'EXTERN' / 'INCLUDED' / 8177: [ LocAttrSeq ] '=' Definition . 8178: 8179: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF' 8180: '(' DefWithAttr ')' / 8181: 'BEGIN' DefOptSeq 'END' / 8182: 'AGGREGATE' DefOptSeq 'END' / 8183: 'CASE' 'OF' DefSeq 'END' / 8184: 'REFERENCE' '(' RefType ')' / 8185: 'PAIR' . 8186: 8187: min = Integer / '*' . 8188: max = Integer / '*' . 8189: Integer = NUMBER . 8190: 8191: DefOptSeq = DefOpt ';' < DefOpt ';' > . 8192: DefOpt = [ '?' ] DefWithAttr . 8193: 8194: DefSeq = DefWithAttr ';' < DefWithAttr ';' > . 8195: 8196: SkeletonSeq = SkeletonElem < ',' SkeletonElem > ';' . 8197: SkeletonElem = ElemID [ 'WITH' Contents ] . 8198: Contents = 'Nothing' / ElemID [ ExtStruct ] . 8199: 8200: ExceptSeq = Except ';' < Except ';' > . 8201: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr ':' 8202: ExcValSeq . 8203: ExcTypeOrAttr = ElemID / AttrID . 8204: ExcValSeq = ExcValue < ',' ExcValue > . 8205: ExcValue = 'NoCut' / 'NoCreate' / 8206: 'NoHMove' / 'NoVMove' / 'NoMove' / 8207: 'NoHResize' / 'NoVResize' / 'NoResize' / 8208: 'NewWidth' / 'NewHeight' / 8209: 'NewHPos' / 'NewVPos' / 8210: 'Invisible' / 'NoSelect' / 8211: 'Hidden' / 'ActiveRef' / 8212: 'ImportLine' / 'ImportParagraph' / 1.9 cvs 8213: 'NoPaginate' / 'ParagraphBreak' / 8214: 'HighlightChildren' / 'ExtendedSelection' / 8215: 'ReturnCreateNL' . 1.1 cvs 8216: 8217: ExtensRuleSeq = ExtensRule ';' < ExtensRule ';' > . 8218: ExtensRule = RootOrElem [ LocAttrSeq ] 8219: [ '+' '(' ExtensionSeq ')' ] 8220: [ '-' '(' RestrictSeq ')' ] 8221: [ 'WITH' FixedAttrSeq ] . 8222: RootOrElem = 'Root' / ElemID . 8223: 8224: END 8225: </PRE> 8226: </DIV> 8227: 8228: <DIV class="section"> 1.6 cvs 8229: <H2><A name=sectb63>The P language</A></H2> 1.1 cvs 8230: 8231: <P> 8232: The P language is used to write presentation schemas, which define the 8233: graphical presentation rules to be applied to different classes of documents 8234: and objects. It is described here in the M meta-language.</P> 8235: <PRE> 8236: PresSchema = 'PRESENTATION' ElemID ';' 8237: [ 'VIEWS' ViewSeq ] 8238: [ 'PRINT' PrintViewSeq ] 8239: [ 'COUNTERS' CounterSeq ] 8240: [ 'CONST' ConstSeq ] 8241: [ 'VAR' VarSeq ] 8242: [ 'DEFAULT' ViewRuleSeq ] 8243: [ 'BOXES' BoxSeq ] 8244: [ 'RULES' PresentSeq ] 8245: [ 'ATTRIBUTES' PresAttrSeq ] 8246: [ 'TRANSMIT' TransmitSeq ] 8247: 'END' . 8248: 8249: ElemID = NAME . 8250: 8251: ViewSeq = ViewDeclaration 8252: < ',' ViewDeclaration > ';' . 8253: ViewDeclaration = ViewID [ 'EXPORT' ] . 8254: ViewID = NAME . 8255: 8256: PrintViewSeq = PrintView < ',' PrintView > ';' . 8257: PrintView = ViewID / ElemID . 8258: 8259: CounterSeq = Counter < Counter > . 8260: Counter = CounterID ':' CounterFunc ';' . 8261: CounterID = NAME . 8262: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ] 8263: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] / 8264: SetFunction < SetFunction > 8265: AddFunction < AddFunction > 8266: [ 'INIT' AttrID ] / 8267: 'RLEVEL' 'OF' ElemID . 8268: SLevelAsc = [ '-' ] LevelAsc . 8269: LevelAsc = NUMBER . 8270: SetFunction = 'SET' CounterValue 'ON' TypeOrPage . 8271: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . 8272: TypeOrPage = 'Page' [ '(' ViewID ')' ] / 8273: [ '*' ] ElemID . 8274: CounterValue = NUMBER . 8275: 8276: ConstSeq = Const < Const > . 8277: Const = ConstID '=' ConstType ConstValue ';' . 8278: ConstID = NAME . 8279: ConstType = 'Text' [ Alphabet ] / 'Symbol' / 8280: 'Graphics' / 'Picture' . 8281: ConstValue = STRING . 8282: Alphabet = NAME . 8283: 8284: VarSeq = Variable < Variable > . 8285: Variable = VarID ':' FunctionSeq ';' . 8286: VarID = NAME . 8287: FunctionSeq = Function < Function > . 8288: Function = 'DATE' / 'FDATE' / 8289: 'DocName' / 'DirName' / 8290: 'ElemName' / 'AttributeName' / 8291: ConstID / ConstType ConstValue / 8292: AttrID / 8293: 'VALUE' '(' PageAttrCtr ',' 8294: CounterStyle ')' . 8295: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] / 8296: [ MinMax ] CounterID / AttrID . 8297: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' / 8298: 'Uppercase' / 'Lowercase' . 8299: MinMax = 'MaxRangeVal' / 'MinRangeVal' . 8300: 8301: BoxSeq = Box < Box > . 8302: Box = 'FORWARD' BoxID ';' / 8303: BoxID ':' ViewRuleSeq . 8304: BoxID = NAME . 8305: 8306: PresentSeq = Present < Present > . 8307: Present = [ '*' ] [ FirstSec ] ElemID ':' 8308: ViewRuleSeq . 8309: FirstSec = 'First' / 'Second' . 8310: 8311: PresAttrSeq = PresAttr < PresAttr > . 8312: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ] 8313: [ AttrRelation ] ':' ViewRuleSeq . 8314: AttrID = NAME . 8315: AttrRelation = '=' AttrVal / 8316: '>' [ '-' ] MinValue / 8317: '<' [ '-' ] MaxValue / 8318: 'IN' '[' [ '-' ] LowerBound '..' 8319: [ '-' ] UpperBound ']' / 8320: 'GREATER' AttrID / 8321: 'EQUAL' AttrID / 8322: 'LESS' AttrID . 8323: AttrVal = [ '-' ] EqualNum / EqualText / AttrValue . 8324: MinValue = NUMBER . 8325: MaxValue = NUMBER . 8326: LowerBound = NUMBER . 8327: UpperBound = NUMBER. 8328: EqualNum = NUMBER . 8329: EqualText = STRING . 8330: AttrValue = NAME . 8331: 8332: ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules > 8333: 'END' ';' / 8334: ViewRules / CondRules / Rule . 8335: RulesAndCond = CondRules / Rule . 8336: ViewRules = 'IN' ViewID CondRuleSeq . 8337: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' / 8338: CondRules / Rule . 8339: CondRules = CondRule < CondRule > 8340: [ 'Otherwise' RuleSeq ] . 8341: CondRule = 'IF' ConditionSeq RuleSeq . 8342: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / Rule . 8343: 1.6 cvs 8344: ConditionSeq = Condition < 'AND' Condition > . 8345: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem . 8346: ConditionElem = 'First' / 'Last' / 8347: [ 'Immediately' ] 'Within' [ NumParent ] 8348: ElemID [ ExtStruct ] / 8349: ElemID / 8350: 'Referred' / 'FirstRef' / 'LastRef' / 8351: 'ExternalRef' / 'InternalRef' / 'CopyRef' / 8352: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' / 8353: 'UserPage' / 'StartPage' / 'ComputedPage' / 8354: 'Empty' / 8355: '(' [ MinMax ] CounterName CounterCond ')' / 8356: CondPage '(' CounterID ')' . 8357: NumParent = [ GreaterLess ] NParent . 8358: GreaterLess = '>' / '<' . 8359: NParent = NUMBER. 8360: CounterCond = '<' MaxCtrVal / '>' MinCtrVal / 8361: '=' EqCtrVal / 8362: 'IN' '[' ['-'] MinCtrBound '..' 8363: ['-'] MaxCtrBound ']' . 8364: PageCond = 'Even' / 'Odd' / 'One' . 8365: MaxCtrVal = NUMBER . 8366: MinCtrVal = NUMBER . 8367: EqCtrVal = NUMBER . 8368: MaxCtrBound = NUMBER . 8369: MinCtrBound = NUMBER . 1.1 cvs 8370: 8371: Rule = PresParam ';' / PresFunc ';' . 8372: PresParam = 'VertRef' ':' HorizPosition / 8373: 'HorizRef' ':' VertPosition / 8374: 'VertPos' ':' VPos / 8375: 'HorizPos' ':' HPos / 8376: 'Height' ':' Extent / 8377: 'Width' ':' Extent / 8378: 'VertOverflow' ':' Boolean / 8379: 'HorizOverflow' ':' Boolean / 8380: 'LineSpacing' ':' DistOrInherit / 8381: 'Indent' ':' DistOrInherit / 8382: 'Adjust' ':' AlignOrInherit / 8383: 'Justify' ':' BoolInherit / 8384: 'Hyphenate' ':' BoolInherit / 8385: 'PageBreak' ':' Boolean / 8386: 'LineBreak' ':' Boolean / 8387: 'InLine' ':' Boolean / 8388: 'NoBreak1' ':' AbsDist / 8389: 'NoBreak2' ':' AbsDist / 8390: 'Gather' ':' Boolean / 8391: 'Visibility' ':' NumberInherit / 8392: 'Size' ':' SizeInherit / 8393: 'Font' ':' NameInherit / 8394: 'Style' ':' StyleInherit / 8395: 'Underline' ':' UnderLineInherit / 8396: 'Thickness' ':' ThicknessInherit / 8397: 'Depth' ':' NumberInherit / 8398: 'LineStyle' ':' LineStyleInherit / 8399: 'LineWeight' ':' DistOrInherit / 8400: 'FillPattern' ':' NameInherit / 8401: 'Background' ':' NameInherit / 8402: 'Foreground' ':' NameInherit . 8403: 'Content' ':' VarConst . 8404: PresFunc = Creation '(' BoxID ')' / 8405: 'Line' / 8406: 'NoLine' / 8407: 'Page' '(' BoxID ')' / 8408: 'Copy' '(' BoxTypeToCopy ')' . 8409: 8410: BoxTypeToCopy = BoxID [ ExtStruct ] / 8411: ElemID [ ExtStruct ] . 8412: ExtStruct = '(' ElemID ')' . 8413: 8414: Distance = [ Sign ] AbsDist . 8415: Sign = '+' / '-' . 8416: AbsDist = IntegerOrAttr [ '.' DecimalPart ] 8417: [ Unit ] . 8418: IntegerOrAttr = IntegerPart / AttrID . 8419: IntegerPart = NUMBER . 8420: DecimalPart = NUMBER . 8421: Unit = 'em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' / 8422: 'pc' / 'px' / '%' . 8423: 8424: HPos = 'nil' / VertAxis '=' HorizPosition 8425: [ 'UserSpecified' ] . 8426: VPos = 'nil' / HorizAxis '=' VertPosition 8427: [ 'UserSpecified' ] . 8428: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' . 8429: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' . 8430: 1.6 cvs 8431: VertPosition = Reference '.' HorizAxis [ Distance ] . 8432: HorizPosition = Reference '.' VertAxis [ Distance ] . 8433: Reference = 'Enclosing' [ BoxTypeNot ] / 8434: 'Enclosed' [ BoxTypeNot ] / 8435: 'Previous' [ BoxTypeNot ] / 8436: 'Next' [ BoxTypeNot ] / 8437: 'Referred' [ BoxTypeNot ] / 8438: 'Creator' / 8439: 'Root' / 8440: '*' / 8441: BoxOrType . 8442: BoxOrType = BoxID / 8443: [ '*' ] [ FirstSec ] ElemID / 8444: 'AnyElem' / 'AnyBox' . 8445: BoxTypeNot = [ 'NOT' ] BoxOrType . 8446: 8447: Extent = Reference '.' HeightWidth 8448: [ Relation ] [ 'Min' ] / 8449: AbsDist [ 'UserSpecified' ] [ 'Min' ] / 8450: HPos / VPos . 8451: HeightWidth = 'Height' / 'Width' . 8452: Relation = '*' ExtentAttr '%' / Distance . 8453: ExtentAttr = ExtentVal / AttrID . 8454: ExtentVal = NUMBER . 8455: 8456: Inheritance = Kinship InheritedValue . 8457: Kinship = 'Enclosing' / 'GrandFather'/ 'Enclosed' / 8458: 'Previous' / 'Creator' . 8459: InheritedValue = '+' PosIntAttr [ 'Max' maximumA ] / 8460: '-' NegIntAttr [ 'Min' minimumA ] / 8461: '=' . 8462: PosIntAttr = PosInt / AttrID . 8463: PosInt = NUMBER . 8464: NegIntAttr = NegInt / AttrID . 8465: NegInt = NUMBER . 8466: maximumA = maximum / AttrID . 8467: maximum = NUMBER . 8468: minimumA = minimum / AttrID . 8469: minimum = NUMBER . 8470: 8471: AlignOrInherit = Kinship '=' / Alignment . 8472: Alignment = 'Left' / 'Right' / 'VMiddle' / 8473: 'LeftWithDots' . 1.1 cvs 8474: 1.6 cvs 8475: DistOrInherit = Kinship InheritedDist / Distance . 8476: InheritedDist = '=' / '+' AbsDist / '-' AbsDist . 1.1 cvs 8477: 1.6 cvs 8478: BoolInherit = Boolean / Kinship '=' . 8479: Boolean = 'Yes' / 'No' . 1.1 cvs 8480: 1.6 cvs 8481: NumberInherit = Integer / AttrID / Inheritance . 8482: Integer = NUMBER . 1.1 cvs 8483: 8484: LineStyleInherit= Kinship '=' / 'Solid' / 'Dashed' / 8485: 'Dotted' . 8486: 1.6 cvs 8487: SizeInherit = SizeAttr [ 'pt' ] / Kinship InheritedSize . 8488: InheritedSize = '+' SizeAttr [ 'pt' ] 8489: [ 'Max' MaxSizeAttr ] / 8490: '-' SizeAttr [ 'pt' ] 8491: [ 'Min' MinSizeAttr ] / 8492: '=' . 8493: SizeAttr = Size / AttrID . 8494: Size = NUMBER . 8495: MaxSizeAttr = MaxSize / AttrID . 8496: MaxSize = NUMBER . 8497: MinSizeAttr = MinSize / AttrID . 8498: MinSize = NUMBER . 8499: 8500: NameInherit = Kinship '=' / FontName . 8501: FontName = NAME . 8502: StyleInherit = Kinship '=' / 8503: 'Roman' / 'Bold' / 'Italics' / 8504: 'BoldItalics' / 'Oblique' / 'BoldOblique' . 1.1 cvs 8505: UnderLineInherit= Kinship '=' / 1.6 cvs 8506: 'NoUnderline' / 'Underlined' / 8507: 'Overlined' / 'CrossedOut' . 1.1 cvs 8508: ThicknessInherit= Kinship '=' / 'Thick' / 'Thin' . 8509: 1.6 cvs 8510: VarConst = ConstID / ConstType ConstValue / 8511: VarID / '(' FunctionSeq ')' / 8512: ElemID . 8513: 8514: Creation = Create [ 'Repeated' ] . 8515: Create = 'CreateFirst' / 'CreateLast' / 8516: 'CreateBefore' / 'CreateAfter' / 8517: 'CreateEnclosing' . 8518: 8519: TransmitSeq = Transmit < Transmit > . 8520: Transmit = TypeOrCounter 'To' ExternAttr 8521: '(' ElemID ')' ';' . 8522: TypeOrCounter = CounterID / ElemID . 8523: ExternAttr = NAME . 1.1 cvs 8524: 8525: END 8526: </PRE> 8527: </DIV> 8528: 8529: <DIV class="section"> 1.6 cvs 8530: <H2><A name=sectb64>The T language</A></H2> 1.1 cvs 8531: 8532: <PRE> 8533: TransSchema = 'TRANSLATION' ElemID ';' 8534: [ 'LINELENGTH' LineLength ';' ] 8535: [ 'LINEEND' CHARACTER ';' ] 8536: [ 'LINEENDINSERT' STRING ';' ] 8537: [ 'BUFFERS' BufferSeq ] 8538: [ 'COUNTERS' CounterSeq ] 8539: [ 'CONST' ConstSeq ] 8540: [ 'VAR' VariableSeq ] 8541: 'RULES' ElemSeq 8542: [ 'ATTRIBUTES' AttrSeq ] 8543: [ 'PRESENTATION' PresSeq ] 8544: < 'TEXTTRANSLATE' TextTransSeq > 8545: [ 'SYMBTRANSLATE' TransSeq ] 8546: [ 'GRAPHTRANSLATE' TransSeq ] 8547: 'END' . 8548: 8549: LineLength = NUMBER . 8550: 8551: BufferSeq = Buffer < Buffer > . 8552: Buffer = BufferID [ '(' 'Picture' ')' ] ';' . 8553: BufferID = NAME . 8554: 8555: CounterSeq = Counter < Counter > . 8556: Counter = CounterID [ ':' CounterFunc ] ';' . 8557: CounterID = NAME . 8558: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ] 8559: [ 'Init' AttrID ] / 8560: 'Rlevel' 'of' ElemID / 8561: 'Set' InitValue 'On' ElemID 8562: 'Add' Increment 'On' ElemID 8563: [ 'Init' AttrID ] . 8564: SLevelAsc = [ '-' ] LevelAsc . 8565: LevelAsc = NUMBER . 8566: InitValue = NUMBER . 8567: Increment = NUMBER . 8568: ElemID = NAME . 8569: AttrID = NAME . 8570: 8571: ConstSeq = Const < Const > . 8572: Const = ConstID '=' ConstValue ';' . 8573: ConstID = NAME . 8574: ConstValue = STRING . 8575: 8576: VariableSeq = Variable < Variable > . 8577: Variable = VarID ':' Function < Function > ';' . 8578: VarID = NAME . 8579: Function = 'Value' '(' CounterID [ ':' Length ] 8580: [ ',' CounterStyle ] ')' / 8581: 'FileDir' / 'FileName' / 'Extension' / 8582: 'DocumentName' / 'DocumentDir' / 8583: ConstID / CharString / 8584: BufferID / AttrID . 8585: Length = NUMBER . 8586: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' / 8587: 'Uppercase' / 'Lowercase' . 8588: CharString = STRING . 8589: 8590: ElemSeq = TransType < TransType > . 8591: TransType = [ FirstSec ] ElemID ':' RuleSeq . 8592: FirstSec = 'First' / 'Second' . 8593: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' . 8594: Rule = SimpleRule / ConditionBlock . 8595: ConditionBlock= 'IF' ConditionSeq SimpleRuleSeq . 8596: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' / 8597: SimpleRule . 8598: 8599: ConditionSeq = Condition [ 'AND' Condition ] . 8600: Condition = [ 'NOT' ] [ 'Target' ] Cond . 8601: Cond = CondElem / CondAscend . 8602: CondElem = 'FirstRef' / 'LastRef' / 8603: 'ExternalRef' / 8604: 'Defined' / 8605: 'Alphabet' '=' Alphabet / 8606: 'ComputedPage' / 'StartPage' / 8607: 'UserPage' / 'ReminderPage' / 8608: 'Empty' / 1.11 cvs 8609: ElemID / 1.1 cvs 8610: 'FirstAttr' / 'LastAttr' . 8611: CondAscend = [ Ascend ] CondOnAscend . 8612: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType . 8613: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] . 8614: CondRelLevel = NUMBER . 8615: CondOnAscend = 'First' / 'Last' / 8616: 'Referred' / 8617: [ 'Immediately' ] 'Within' [ NumParent ] 8618: ElemID [ ExtStruct ] / 8619: 'Attributes' / 8620: AttrID [ RelatAttr ] / 8621: 'Presentation' / 8622: PresRule / 8623: 'Comment' . 8624: NumParent = [ GreaterLess ] NParent . 8625: GreaterLess = '>' / '<' . 8626: NParent = NUMBER. 8627: Alphabet = NAME . 8628: RelatAttr = '=' Value / 8629: '>' [ '-' ] Minimum / 8630: '<' [ '-' ] Maximum / 8631: 'IN' '[' [ '-' ] MinInterval '..' 8632: [ '-' ] MaxInterval ']' . 8633: Value = [ '-' ] IntegerVal / TextVal / AttrValue . 8634: Minimum = NUMBER . 8635: Maximum = NUMBER . 8636: MinInterval = NUMBER . 8637: MaxInterval = NUMBER . 8638: IntegerVal = NUMBER . 8639: TextVal = STRING . 8640: AttrValue = NAME . 8641: 8642: SimpleRule = 'Create' [ 'IN' VarID ] Object 8643: [ Position ] ';' / 8644: 'Write' Object [ Position ] ';' / 8645: 'Read' BufferID [ Position ] ';' / 8646: 'Include' File [ Position ] ';' / 1.6 cvs 8647: 'Get' [ RelPosition ] ElemID 8648: [ ExtStruct ] 8649: [ Position ] ';' / 1.1 cvs 8650: 'Copy' [ RelPosition ] ElemID 8651: [ ExtStruct ] 8652: [ Position ] ';' / 8653: 'Use' TrSchema [ 'For' ElemID ] ';' / 8654: 'Remove' ';' / 8655: 'NoTranslation' ';' / 8656: 'NoLineBreak' ';' / 8657: 'ChangeMainFile' VarID [ Position ] ';' / 1.10 cvs 8658: 'Set' CounterID InitValue [ Position ] ';' / 8659: 'Add' CounterID Increment [ Position ] ';' / 8660: 'Indent' [ 'IN' VarID ] [ IndentSign ] 8661: IndentValue [ Position ] ';' . 8662: 8663: IndentSign = '+' / '-' . 8664: IndentValue = NUMBER . 1.1 cvs 8665: 8666: Object = ConstID / CharString / 8667: BufferID / 8668: VarID / 8669: '(' Function < Function > ')' / 8670: AttrID / 8671: 'Value' / 8672: 'Content' / 8673: 'Comment' / 8674: 'Attributes' / 8675: 'Presentation' / 8676: 'RefId' / 8677: 'PairId' / 8678: 'FileDir' / 'FileName' / 'Extension' / 8679: 'DocumentName' / 'DocumentDir' / 8680: [ 'Referred' ] ReferredObject . 8681: Position = 'After' / 'Before' . 8682: 1.6 cvs 8683: ReferredObject= VarID / 8684: ElemID [ ExtStruct ] / 8685: 'RefId' / 8686: 'DocumentName' / 'DocumentDir' . 1.1 cvs 8687: 1.6 cvs 8688: File = FileName / BufferID . 8689: FileName = STRING . 1.1 cvs 8690: 1.6 cvs 8691: RelPosition = 'Included' / 'Referred' . 8692: ExtStruct = '(' ElemID ')' . 1.1 cvs 8693: 1.6 cvs 8694: TrSchema = NAME . 8695: 8696: AttrSeq = TransAttr < TransAttr > . 8697: TransAttr = AttrID [ '(' ElemID ')' ] 8698: [ RelatAttr ] ':' RuleSeq . 8699: 8700: PresSeq = PresTrans < PresTrans > . 8701: PresTrans = PresRule ':' RuleSeq . 8702: PresRule = 'Size' [ PresRelation ] / 8703: 'Indent' [ PresRelation ] / 8704: 'LineSpacing' [ PresRelation ] / 8705: 'Adjust' [ '=' AdjustVal ] / 8706: 'Justify' [ '=' BoolVal ] / 8707: 'Hyphenate' [ '=' BoolVal ] / 8708: 'Style' [ '=' StyleVal ] / 8709: 'Font' [ '=' FontVal ] / 8710: 'UnderLine' [ '=' UnderLineVal ] / 8711: 'Thickness' [ '=' ThicknessVal ] / 8712: 'LineStyle' [ '=' LineStyleVal ] / 8713: 'LineWeight' [ PresRelation ] / 8714: 'FillPattern' [ '=' Pattern ] / 8715: 'Background' [ '=' Color ] / 8716: 'Foreground' [ '=' Color ] . 8717: 8718: PresRelation = '=' PresValue / 8719: '>' [ '-' ] PresMinimum / 8720: '<' [ '-' ] PresMaximum / 8721: 'IN' '[' [ '-' ] PresIntervalMin '..' 8722: [ '-' ] PresIntervalMax ']' . 8723: AdjustVal = 'Left' / 'Right' / 'VMiddle' / 8724: 'LeftWithDots' . 8725: BoolVal = 'Yes' / 'No' . 8726: StyleVal = 'Bold' / 'Italics' / 'Roman' / 8727: 'BoldItalics' / 'Oblique' / 8728: 'BoldOblique' . 8729: FontVal = 'Times' / 'Helvetica' / 'Courier' . 8730: UnderLineVal = 'NoUnderline' / 'UnderLined' / 8731: 'OverLined' / 'CrossedOut' . 8732: ThicknessVal = 'Thick' / 'Thin' . 8733: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' . 8734: Pattern = NAME . 8735: Color = NAME . 8736: PresMinimum = NUMBER . 8737: PresMaximum = NUMBER . 1.1 cvs 8738: PresIntervalMin= NUMBER . 8739: PresIntervalMax= NUMBER . 1.6 cvs 8740: PresValue = [ '-' ] PresVal . 8741: PresVal = NUMBER . 1.1 cvs 8742: 1.6 cvs 8743: TextTransSeq = [ Alphabet ] TransSeq . 8744: Alphabet = NAME . 8745: TransSeq = 'BEGIN' < Translation > 'END' ';' / 8746: Translation . 8747: Translation = Source [ '->' Target ] ';' . 8748: Source = STRING . 8749: Target = STRING . 1.1 cvs 8750: </PRE> 8751: </DIV> 8752: <HR> 8753: </DIV> 8754: 8755: <DIV class="chapter"> 1.6 cvs 8756: <H1><A name=sect7>Character coding</A></H1> 1.1 cvs 8757: 8758: 8759: <DIV class="section"> 1.6 cvs 8760: <H2><A name=sectb71>Characters</A></H2> 1.1 cvs 8761: 8762: <P> 8763: The characters of the Latin alphabet follow the encoding defined in the ISO 1.5 cvs 8764: 8859-1 (ISO Latin-1) standard. The characters of the Greek alphabet follow 1.1 cvs 8765: the encoding defined by Adobe for its Symbol font (Adobe FontSpecific).</P> 8766: <P> 8767: Characters whose octal code is greater than 0200 are written in the form of 8768: their octal code preceded by a backslash character (``\''). For example, the 1.5 cvs 8769: French word 'Résumé' is written <TT>R\351sum\351</TT>.</P> 1.1 cvs 8770: <P> 1.2 cvs 8771: To the ISO 8859-1 encoding four characters with the following codes have been 1.1 cvs 8772: added:<BR><TT>212</TT>: line break<BR><TT>240</TT>: sticky 1.2 cvs 8773: space<BR><TT>201</TT>: thin space<BR><TT>202</TT>: en space</P> 1.1 cvs 8774: <P> 8775: The <TT>212</TT> character is a ``line break'' character which forces a line 8776: break. The <TT>240</TT> character is a ``sticky space'', which cannot be 8777: replaced by a line break.</P> 8778: </DIV> 8779: 8780: <DIV class="section"> 1.6 cvs 8781: <H2><A name=sectb72>Symbols</A></H2> 1.1 cvs 8782: 8783: <P> 8784: The table below gives the codes for the symbols of Thot. Symbols can be used 8785: in presentation schemas constants and in transcoding rules of translation 8786: schemas. Each symbol is represented by a single character.</P> 8787: <UL> 8788: <LI><TT>r</TT>: a radical 8789: <LI><TT>i</TT>: a simple integral 8790: <LI><TT>c</TT>: a curvilinear integral 8791: <LI><TT>d</TT>: a double integral 8792: <LI><TT>t</TT>: a triple integral 8793: <LI><TT>S</TT>: the summation symbol 8794: <LI><TT>P</TT>: the product symbol 8795: <LI><TT>U</TT>: the union symbol 8796: <LI><TT>I</TT>: the intersection symbol 8797: <LI><TT>></TT>: a right arrow 8798: <LI><TT><</TT>: a left arrow 8799: <LI><TT>^</TT>: an up arrow 8800: <LI><TT>V</TT>: a down arrow 8801: <LI><TT>(</TT>: an opening parenthesis 8802: <LI><TT>)</TT>: a closing parenthesis 8803: <LI><TT>{</TT>: an opening brace 8804: <LI><TT>}</TT>: a closing brace 8805: <LI><TT>[</TT>: an opening bracket 8806: <LI><TT>]</TT>: a closing bracket 8807: </UL> 8808: </DIV> 8809: 8810: <DIV class="section"> 1.6 cvs 8811: <H2><A name=sectb73>Graphical elements</A></H2> 1.1 cvs 8812: 8813: <P> 8814: The table below gives the codes for the graphical elements of Thot. These 8815: elements can be used in presentation schemas constants and in transcoding 8816: rules of translation schemas. Each graphical element is represented by a 8817: single character.</P> 8818: <UL> 8819: <LI><TT>c</TT>: an ellipse inscribed in the box 8820: <LI><TT>R</TT>: a rectangle which is the shape of the box 8821: <LI><TT>C</TT>: a rectangle with rounded corners 8822: <LI><TT>t</TT>: a horizontal line along the upper side of the box 8823: <LI><TT>h</TT>: a horizontal line as wide as the box and placed in its middle 8824: <LI><TT>b</TT>: a horizontal line along the lower side of the box 8825: <LI><TT>></TT>: a right arrow as long as the box's width and in its middle 8826: <LI><TT>></TT>: a left arrow as long as the box's width and in its middle 8827: <LI><TT>l</TT>: a vertical line on the left side of the box 8828: <LI><TT>v</TT>: a vertical line as tall as the box and placed in its middle 8829: <LI><TT>r</TT>: a vertical line on the right side of the box 8830: <LI><TT>^</TT>: an up arrow as tall as the box and in its middle 8831: <LI><TT>V</TT>: a down arrow as tall as the box and in its middle 8832: <LI><TT>/</TT>: The southwest/northeast diagonal of the box 8833: <LI><TT>\</TT>: the northwest/southeast diagonal of the box 1.2 cvs 8834: <LI><TT>O</TT>: The northwest/southeast diagonal of the box with an arrowhead 1.1 cvs 8835: at the top 1.2 cvs 8836: <LI><TT>e</TT>: The northwest/southeast diagonal of the box with an arrowhead 1.1 cvs 8837: at the bottom 1.2 cvs 8838: <LI><TT>E</TT>: The southwest/northeast diagonal of the box with an arrowhead 1.1 cvs 8839: at the top 1.2 cvs 8840: <LI><TT>o</TT>: The southwest/northeast diagonal of the box with an arrowhead 1.1 cvs 8841: at the bottom 8842: <LI><TT>space</TT>: a transparent element 1.2 cvs 8843: <LI><TT>P</TT>: a rectangle with round corners and a horizontal bar at the top 1.1 cvs 8844: <LI><TT>Q</TT>: an ellipse with a horizontal bar at the top 8845: <LI><TT>L</TT>: a lozenge 8846: <LI><TT>W</TT>: the upper right corner 8847: <LI><TT>X</TT>: the lower right corner 8848: <LI><TT>Y</TT>: the lower left corner 8849: <LI><TT>Z</TT>: the upper left corner 8850: <LI><TT>p</TT>: a polygon 8851: <LI><TT>S</TT>: an open broken line 8852: <LI><TT>N</TT>: an open broken line with an arrow head at start 8853: <LI><TT>U</TT>: an open broken line with an arrow head at the end 8854: <LI><TT>M</TT>: an open broken line with two arrow heads 8855: <LI><TT>s</TT>: a closed curve 8856: <LI><TT>B</TT>: an open curve 8857: <LI><TT>F</TT>: an open curve with an arrow head at start 8858: <LI><TT>A</TT>: an open curve with an arrow head at the end 8859: <LI><TT>D</TT>: an open curve with two arrow heads 8860: </UL> 1.5 cvs 8861: <HR> 1.1 cvs 8862: </DIV> 8863: </DIV> 8864: </BODY> 8865: </HTML>