Return to languages.html CVS log | Up to [Public] / Amaya / doc |
1.21 cvs 1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" 2: "http://www.w3.org/TR/REC-html40/loose.dtd"> 1.18 cvs 3: <html> 4: <head> 1.21 cvs 5: <title>The Languages of Thot</title> 1.18 cvs 6: </head> 7: <body> 8: 1.19 cvs 9: <div class="frontmatter" align="center"> 1.18 cvs 10: 11: <h1>The Languages of Thot</h1> 12: 13: <h3>Vincent Quint</h3> 14: 15: <h4>Translated from French by Ethan Munson</h4> 16: 1.26 cvs 17: <h4>Version of January 14, 2000</h4> 1.18 cvs 18: <p> 19: © 1996 INRIA</p> 20: <hr> 1.19 cvs 21: 1.18 cvs 22: </div> 23: 24: <div class="tableofcontents"> 25: 26: <h2><a href="languages.toc.html">Contents</a></h2> 27: <ul> 28: <li> 29: <big><a href="#sect2">The document model of Thot</a></big> 30: <ul> 31: <li> 32: <strong><a href="#sectb21">The logical structure of documents</a></strong> 1.19 cvs 33: </li> 1.18 cvs 34: <li> 35: <strong><a href="#sectb22">Generic and specific structures</a></strong> 1.19 cvs 36: </li> 1.18 cvs 37: <li> 38: <strong><a href="#sectb23">Logical structure and physical 39: structure</a></strong> 1.19 cvs 40: </li> 1.18 cvs 41: <li> 42: <strong><a href="#sectb24">Document structures and object 43: structures</a></strong> 1.19 cvs 44: </li> 1.18 cvs 45: </ul> 1.19 cvs 46: </li> 1.18 cvs 47: <li> 48: <big><a href="#sect3">The S language</a></big> 49: <ul> 50: <li> 51: <strong><a href="#sectb31">Document meta-structure</a></strong> 52: <ul> 53: <li> 54: <a href="#sectc311">The basic types</a> 1.19 cvs 55: </li> 1.18 cvs 56: <li> 57: <a href="#sectc312">Constructed elements</a> 1.19 cvs 58: </li> 1.18 cvs 59: <li> 60: <a href="#sectc313">Logical structure constructors</a> 61: <ul> 62: <li> 63: <small><a href="#sectd3131">Aggregate and List</a></small> 1.19 cvs 64: </li> 1.18 cvs 65: <li> 66: <small><a href="#sectd3132">Choice, Schema, and Unit</a></small> 1.19 cvs 67: </li> 1.18 cvs 68: <li> 69: <small><a href="#sectd3133">Reference and Inclusion</a></small> 1.19 cvs 70: </li> 1.18 cvs 71: <li> 72: <small><a href="#sectd3134">Mark pairs</a></small> 1.19 cvs 73: </li> 1.18 cvs 74: <li> 75: <small><a href="#sectd3135">Restrictions and Extensions</a></small> 1.19 cvs 76: </li> 1.18 cvs 77: <li> 78: <small><a href="#sectd3136">Summary</a></small> 1.19 cvs 79: </li> 1.18 cvs 80: </ul> 1.19 cvs 81: </li> 1.18 cvs 82: <li> 83: <a href="#sectc314">Associated Elements</a> 1.19 cvs 84: </li> 1.18 cvs 85: <li> 86: <a href="#sectc315">Attributes</a> 1.19 cvs 87: </li> 1.18 cvs 88: <li> 89: <a href="#sectc316">Discussion of the model</a> 1.19 cvs 90: </li> 1.18 cvs 91: </ul> 1.19 cvs 92: </li> 1.18 cvs 93: <li> 94: <strong><a href="#sectb32">The definition language for generic 95: structures</a></strong> 96: <ul> 97: <li> 98: <a href="#sectc321">Writing Conventions</a> 1.19 cvs 99: </li> 1.18 cvs 100: <li> 101: <a href="#sectc322">Extension schemas</a> 1.19 cvs 102: </li> 1.18 cvs 103: <li> 104: <a href="#sectc323">The general organization of structure schemas</a> 1.19 cvs 105: </li> 1.18 cvs 106: <li> 107: <a href="#sectc324">The default presentation</a> 1.19 cvs 108: </li> 1.18 cvs 109: <li> 110: <a href="#sectc325">Global Attributes</a> 1.19 cvs 111: </li> 1.18 cvs 112: <li> 113: <a href="#sectc326">Parameters</a> 1.19 cvs 114: </li> 1.18 cvs 115: <li> 116: <a href="#sectc327">Structured elements</a> 1.19 cvs 117: </li> 1.18 cvs 118: <li> 119: <a href="#sectc328">Structure definitions</a> 120: <ul> 121: <li> 122: <small><a href="#sectd3281">List</a></small> 1.19 cvs 123: </li> 1.18 cvs 124: <li> 125: <small><a href="#sectd3282">Aggregate</a></small> 1.19 cvs 126: </li> 1.18 cvs 127: <li> 128: <small><a href="#sectd3283">Choice</a></small> 1.19 cvs 129: </li> 1.18 cvs 130: <li> 131: <small><a href="#sectd3284">Reference</a></small> 1.19 cvs 132: </li> 1.18 cvs 133: <li> 134: <small><a href="#sectd3285">Mark pairs</a></small> 1.19 cvs 135: </li> 1.18 cvs 136: </ul> 1.19 cvs 137: </li> 1.18 cvs 138: <li> 139: <a href="#sectc329">Imports</a> 1.19 cvs 140: </li> 1.18 cvs 141: <li> 142: <a href="#sectc3210">Extension rules</a> 1.19 cvs 143: </li> 1.18 cvs 144: <li> 145: <a href="#sectc3211">Associated elements</a> 1.19 cvs 146: </li> 1.18 cvs 147: <li> 148: <a href="#sectc3212">Units</a> 1.19 cvs 149: </li> 1.18 cvs 150: <li> 151: <a href="#sectc3213">Skeleton elements</a> 1.19 cvs 152: </li> 1.18 cvs 153: <li> 154: <a href="#sectc3214">Exceptions</a> 1.19 cvs 155: </li> 1.18 cvs 156: </ul> 1.19 cvs 157: </li> 1.18 cvs 158: <li> 159: <strong><a href="#sectb33">Some examples</a></strong> 160: <ul> 161: <li> 162: <a href="#sectc331">A class of documents: articles</a> 1.19 cvs 163: </li> 1.18 cvs 164: <li> 165: <a href="#sectc332">A class of objects: mathematical formulas</a> 1.19 cvs 166: </li> 1.18 cvs 167: </ul> 1.19 cvs 168: </li> 1.18 cvs 169: </ul> 1.19 cvs 170: </li> 1.18 cvs 171: <li> 172: <big><a href="#sect4">The P language</a></big> 173: <ul> 174: <li> 175: <strong><a href="#sectb41">Document presentation</a></strong> 176: <ul> 177: <li> 178: <a href="#sectc411">Two levels of presentation</a> 1.19 cvs 179: </li> 1.18 cvs 180: <li> 181: <a href="#sectc412">Boxes</a> 1.19 cvs 182: </li> 1.18 cvs 183: <li> 184: <a href="#sectc413">Views and visibility</a> 1.19 cvs 185: </li> 1.18 cvs 186: <li> 187: <a href="#sectc414">Pages</a> 1.19 cvs 188: </li> 1.18 cvs 189: <li> 190: <a href="#sectc415">Numbering</a> 1.19 cvs 191: </li> 1.18 cvs 192: <li> 193: <a href="#sectc416">Presentation parameters</a> 1.19 cvs 194: </li> 1.18 cvs 195: </ul> 1.19 cvs 196: </li> 1.18 cvs 197: <li> 198: <strong><a href="#sectb42">Presentation description language</a></strong> 199: <ul> 200: <li> 201: <a href="#sectc421">The organization of a presentation schema</a> 1.19 cvs 202: </li> 1.18 cvs 203: <li> 204: <a href="#sectc422">Views</a> 1.19 cvs 205: </li> 1.18 cvs 206: <li> 207: <a href="#sectc423">Print Views</a> 1.19 cvs 208: </li> 1.18 cvs 209: <li> 210: <a href="#sectc424">Counters</a> 1.19 cvs 211: </li> 1.18 cvs 212: <li> 213: <a href="#sectc425">Presentation constants</a> 1.19 cvs 214: </li> 1.18 cvs 215: <li> 216: <a href="#sectc426">Variables</a> 1.19 cvs 217: </li> 1.18 cvs 218: <li> 219: <a href="#sectc427">Default presentation rules</a> 1.19 cvs 220: </li> 1.18 cvs 221: <li> 222: <a href="#sectc428">Presentation and page layout boxes</a> 1.19 cvs 223: </li> 1.18 cvs 224: <li> 225: <a href="#sectc429">Presentation of structured elements</a> 1.19 cvs 226: </li> 1.18 cvs 227: <li> 228: <a href="#sectc4210">Logical attribute presentation</a> 1.19 cvs 229: </li> 1.18 cvs 230: <li> 231: <a href="#sectc4212">Value transmission rules</a> 1.19 cvs 232: </li> 1.18 cvs 233: <li> 234: <a href="#sectc4213">Presentation rules</a> 1.19 cvs 235: </li> 1.18 cvs 236: <li> 237: <a href="#sectc4214">Conditions applying to presentation rules</a> 238: <ul> 239: <li> 240: <small><a href="#sectd42141">Conditions based on the logical position of the 241: element</a></small> 1.19 cvs 242: </li> 1.18 cvs 243: <li> 244: <small><a href="#sectd42142">Conditions on references</a></small> 1.19 cvs 245: </li> 1.18 cvs 246: <li> 247: <small><a href="#sectd42143">Conditions on logical attributes</a></small> 1.19 cvs 248: </li> 1.18 cvs 249: <li> 250: <small><a href="#sectd42144">Conditions on page breaks</a></small> 1.19 cvs 251: </li> 1.18 cvs 252: <li> 253: <small><a href="#sectd42145">Conditions on the element's content</a></small> 1.19 cvs 254: </li> 1.18 cvs 255: <li> 256: <small><a href="#sectd42146">Conditions on counters</a></small> 1.19 cvs 257: </li> 1.18 cvs 258: </ul> 1.19 cvs 259: </li> 1.18 cvs 260: <li> 261: <a href="#sectc4215">A presentation rule</a> 1.19 cvs 262: </li> 1.18 cvs 263: <li> 264: <a href="#sectc4216">Box axes</a> 1.19 cvs 265: </li> 1.18 cvs 266: <li> 267: <a href="#sectc4217">Distance units</a> 1.19 cvs 268: </li> 1.18 cvs 269: <li> 270: <a href="#sectc4218">Relative positions</a> 1.19 cvs 271: </li> 1.18 cvs 272: <li> 273: <a href="#sectc4219">Box extents</a> 274: <ul> 275: <li> 276: <small><a href="#sectd42191">Fixed extents</a></small> 1.19 cvs 277: </li> 1.18 cvs 278: <li> 279: <small><a href="#sectd42192">Relative extents</a></small> 1.19 cvs 280: </li> 1.18 cvs 281: <li> 282: <small><a href="#sectd42193">Elastic extents</a></small> 1.19 cvs 283: </li> 1.18 cvs 284: </ul> 1.19 cvs 285: </li> 1.18 cvs 286: <li> 287: <a href="#sectc4220">Overflow</a> 1.19 cvs 288: </li> 1.18 cvs 289: <li> 290: <a href="#sectc4221">Inheritance</a> 1.19 cvs 291: </li> 1.18 cvs 292: <li> 293: <a href="#sectc4222">Line breaking</a> 294: <ul> 295: <li> 296: <small><a href="#sectd42221">Line spacing</a></small> 1.19 cvs 297: </li> 1.18 cvs 298: <li> 299: <small><a href="#sectd42222">First line indentation</a></small> 1.19 cvs 300: </li> 1.18 cvs 301: <li> 302: <small><a href="#sectd42223">Alignment</a></small> 1.19 cvs 303: </li> 1.18 cvs 304: <li> 305: <small><a href="#sectd42224">Justification</a></small> 1.19 cvs 306: </li> 1.18 cvs 307: <li> 308: <small><a href="#sectd42225">Hyphenation</a></small> 1.19 cvs 309: </li> 1.18 cvs 310: <li> 311: <small><a href="#sectd42226">Avoiding line breaking</a></small> 1.19 cvs 312: </li> 1.18 cvs 313: </ul> 1.19 cvs 314: </li> 1.18 cvs 315: <li> 316: <a href="#sectc4223">Page breaking and line breaking conditions</a> 1.19 cvs 317: </li> 1.18 cvs 318: <li> 319: <a href="#sectc4224">Visibility</a> 1.19 cvs 320: </li> 1.18 cvs 321: <li> 322: <a href="#sectc4225">Character style parameters</a> 323: <ul> 324: <li> 325: <small><a href="#sectd42251">Character size</a></small> 1.19 cvs 326: </li> 1.18 cvs 327: <li> 328: <small><a href="#sectd42252">Font and character style</a></small> 1.19 cvs 329: </li> 1.18 cvs 330: <li> 331: <small><a href="#sectd42253">Underlining</a></small> 1.19 cvs 332: </li> 1.18 cvs 333: </ul> 1.19 cvs 334: </li> 1.18 cvs 335: <li> 336: <a href="#sectc4226">Stacking order</a> 1.19 cvs 337: </li> 1.18 cvs 338: <li> 339: <a href="#sectc4227">Line style</a> 1.19 cvs 340: </li> 1.18 cvs 341: <li> 342: <a href="#sectc4228">Line thickness</a> 1.19 cvs 343: </li> 1.18 cvs 344: <li> 345: <a href="#sectc4229">Fill pattern</a> 1.19 cvs 346: </li> 1.18 cvs 347: <li> 348: <a href="#sectc4230">Colors</a> 1.19 cvs 349: </li> 1.18 cvs 350: <li> 351: <a href="#sectc4230a">Background color and border</a> 1.19 cvs 352: </li> 1.18 cvs 353: <li> 354: <a href="#sectc4230b">Background pictures</a> 1.19 cvs 355: </li> 1.18 cvs 356: <li> 357: <a href="#sectc4231">Presentation box content</a> 1.19 cvs 358: </li> 1.18 cvs 359: <li> 360: <a href="#sectc4232">Presentation box creation</a> 1.19 cvs 361: </li> 1.18 cvs 362: <li> 363: <a href="#sectc4233">Page layout</a> 1.19 cvs 364: </li> 1.18 cvs 365: <li> 366: <a href="#sectc4234">Box copies</a> 1.19 cvs 367: </li> 1.18 cvs 368: </ul> 1.19 cvs 369: </li> 1.18 cvs 370: </ul> 1.19 cvs 371: </li> 1.18 cvs 372: <li> 373: <big><a href="#sect5">The T language</a></big> 374: <ul> 375: <li> 376: <strong><a href="#sectb51">Document translation</a></strong> 377: <ul> 378: <li> 379: <a href="#sectc511">Translation principles</a> 1.19 cvs 380: </li> 1.18 cvs 381: <li> 382: <a href="#sectc512">Translation procedure</a> 1.19 cvs 383: </li> 1.18 cvs 384: </ul> 1.19 cvs 385: </li> 1.18 cvs 386: <li> 387: <strong><a href="#sectb52">Translation definition language</a></strong> 388: <ul> 389: <li> 390: <a href="#sectc521">Organization of a translation schema</a> 1.19 cvs 391: </li> 1.18 cvs 392: <li> 393: <a href="#sectc522">Line length</a> 1.19 cvs 394: </li> 1.18 cvs 395: <li> 396: <a href="#sectc523">Buffers</a> 1.19 cvs 397: </li> 1.18 cvs 398: <li> 399: <a href="#sectc524">Counters</a> 1.19 cvs 400: </li> 1.18 cvs 401: <li> 402: <a href="#sectc525">Constants</a> 1.19 cvs 403: </li> 1.18 cvs 404: <li> 405: <a href="#sectc526">Variables</a> 1.19 cvs 406: </li> 1.18 cvs 407: <li> 408: <a href="#sectc527">Translating structure elements</a> 1.19 cvs 409: </li> 1.18 cvs 410: <li> 411: <a href="#sectc528">Conditional rules</a> 412: <ul> 413: <li> 414: <small><a href="#sectd5281">Conditions based on the logical position of the 415: element</a></small> 1.19 cvs 416: </li> 1.18 cvs 417: <li> 418: <small><a href="#sectd5282">Conditions on references</a></small> 1.19 cvs 419: </li> 1.18 cvs 420: <li> 421: <small><a href="#sectd5283">Conditions on the parameters</a></small> 1.19 cvs 422: </li> 1.18 cvs 423: <li> 424: <small><a href="#sectd5284">Conditions on the alphabets</a></small> 1.19 cvs 425: </li> 1.18 cvs 426: <li> 427: <small><a href="#sectd5285">Conditions on page breaks</a></small> 1.19 cvs 428: </li> 1.18 cvs 429: <li> 430: <small><a href="#sectd5286">Conditions on the element's content</a></small> 1.19 cvs 431: </li> 1.18 cvs 432: <li> 433: <small><a href="#sectd5287">Conditions on the presence of comments</a></small> 1.19 cvs 434: </li> 1.18 cvs 435: <li> 436: <small><a href="#sectd5288">Conditions on the presence of specific 437: presentation rules</a></small> 1.19 cvs 438: </li> 1.18 cvs 439: <li> 440: <small><a href="#sectd5289">Conditions on the presence of logical 441: attributes</a></small> 1.19 cvs 442: </li> 1.18 cvs 443: <li> 444: <small><a href="#sectd52810">Conditions on logical attributes</a></small> 1.19 cvs 445: </li> 1.18 cvs 446: <li> 447: <small><a href="#sectd52811">Conditions on specific presentation 448: rules</a></small> 1.19 cvs 449: </li> 1.18 cvs 450: </ul> 1.19 cvs 451: </li> 1.18 cvs 452: <li> 453: <a href="#sectc529">Translation rules</a> 1.19 cvs 454: </li> 1.18 cvs 455: <li> 456: <a href="#sectc5210">The <tt>Create</tt> rule</a> 1.19 cvs 457: </li> 1.18 cvs 458: <li> 459: <a href="#sectc5211">The <tt>Write</tt> rule</a> 1.19 cvs 460: </li> 1.18 cvs 461: <li> 462: <a href="#sectc5212">The <tt>Read</tt> rule</a> 1.19 cvs 463: </li> 1.18 cvs 464: <li> 465: <a href="#sectc5213">The <tt>Include</tt> rule</a> 1.19 cvs 466: </li> 1.18 cvs 467: <li> 468: <a href="#sectc5214">The <tt>Get</tt> rule</a> 1.19 cvs 469: </li> 1.18 cvs 470: <li> 471: <a href="#sectc5215">The <tt>Copy</tt> rule</a> 1.19 cvs 472: </li> 1.18 cvs 473: <li> 474: <a href="#sectc5216">The <tt>Use</tt> rule</a> 1.19 cvs 475: </li> 1.18 cvs 476: <li> 477: <a href="#sectc5217">The <tt>Remove</tt> rule</a> 1.19 cvs 478: </li> 1.18 cvs 479: <li> 480: <a href="#sectc5218">The <tt>NoTranslation</tt> rule</a> 1.19 cvs 481: </li> 1.18 cvs 482: <li> 483: <a href="#sectc5219">The <tt>NoLineBreak</tt> rule</a> 1.19 cvs 484: </li> 1.18 cvs 485: <li> 486: <a href="#sectc5220">The <tt>ChangeMainFile</tt> rule</a> 1.19 cvs 487: </li> 1.18 cvs 488: <li> 489: <a href="#sectc5220a">The <tt>RemoveFile</tt> rule</a> 1.19 cvs 490: </li> 1.18 cvs 491: <li> 492: <a href="#sectc5221">The <tt>Set</tt> and <tt>Add</tt> rules</a> 1.19 cvs 493: </li> 1.18 cvs 494: <li> 495: <a href="#sectc5221a">The <tt>Indent</tt> rule</a> 1.19 cvs 496: </li> 1.18 cvs 497: <li> 498: <a href="#sectc5222">Rule application order</a> 1.19 cvs 499: </li> 1.18 cvs 500: <li> 501: <a href="#sectc5223">Translation of logical attributes</a> 1.19 cvs 502: </li> 1.18 cvs 503: <li> 504: <a href="#sectc5224">Translation of specific presentations</a> 1.19 cvs 505: </li> 1.18 cvs 506: <li> 507: <a href="#sectc5225">Recoding of characters, symbols and graphics</a> 1.19 cvs 508: </li> 1.18 cvs 509: </ul> 1.19 cvs 510: </li> 1.18 cvs 511: </ul> 1.19 cvs 512: </li> 1.18 cvs 513: <li> 514: <big><a href="#sect6">Language grammars</a></big> 515: <ul> 516: <li> 517: <strong><a href="#sectb61">The M meta-language</a></strong> 1.19 cvs 518: </li> 1.18 cvs 519: <li> 520: <strong><a href="#sectb62">The S language</a></strong> 1.19 cvs 521: </li> 1.18 cvs 522: <li> 523: <strong><a href="#sectb63">The P language</a></strong> 1.19 cvs 524: </li> 1.18 cvs 525: <li> 526: <strong><a href="#sectb64">The T language</a></strong> 1.19 cvs 527: </li> 1.18 cvs 528: </ul> 1.19 cvs 529: </li> 1.18 cvs 530: <li> 531: <big><a href="#sect7">Character coding</a></big> 532: <ul> 533: <li> 534: <strong><a href="#sectb71">Characters</a></strong> 1.19 cvs 535: </li> 1.18 cvs 536: <li> 537: <strong><a href="#sectb72">Symbols</a></strong> 1.19 cvs 538: </li> 1.18 cvs 539: <li> 540: <strong><a href="#sectb73">Graphical elements</a></strong> 1.19 cvs 541: </li> 1.18 cvs 542: </ul> 1.19 cvs 543: </li> 1.18 cvs 544: </ul> 545: <hr> 1.19 cvs 546: 1.18 cvs 547: </div> 1.1 cvs 548: 1.18 cvs 549: <div class="chapter"> 1.1 cvs 550: 1.18 cvs 551: <h1><a name="sect2">The document model of Thot</a></h1> 552: <p> 1.1 cvs 553: All of the services which Thot provides to the user are based on the system's 554: internal document representation. This representation is itself derived from 555: the document model which underlies Thot. The model is presented here, prior 556: to the description of the languages which permit the generic specification of 1.18 cvs 557: documents.</p> 1.1 cvs 558: 1.18 cvs 559: <div class="section"> 1.1 cvs 560: 1.18 cvs 561: <h2><a name="sectb21">The logical structure of documents</a></h2> 562: <p> 1.1 cvs 563: The document model of Thot is primarily designed to allow the user to operate 1.5 cvs 564: on those entities which s/he has in mind when s/he works on a document. The 565: model makes no assumptions about the nature of these entities. It is 566: essentially these logical entities, such as paragraphs, sections, chapters, 567: notes, titles, and cross-references which give a document its logical 1.18 cvs 568: structure.</p> 569: <p> 1.5 cvs 570: Because of this model, the author can divide the document into chapters, 1.1 cvs 571: giving each one a title. The content of these chapters can be further divided 1.2 cvs 572: into sections, subsections, etc. The text is organized into successive 573: paragraphs, according to the content. In the writing phase, the lines, pages, 574: margins, spacing, fonts, and character styles are not very important. In fact, 575: if the system requires documents to be written in these terms, it gets in the 576: way. So, Thot's model is primarily based on the logical aspect of documents. 1.18 cvs 577: The creation of a model of this type essentially requires the definition :</p> 578: <ul> 579: <li> 580: of the entities which can appear in the documents, 1.19 cvs 581: </li> 1.18 cvs 582: <li> 583: and the relations between these entities. 1.19 cvs 584: </li> 1.18 cvs 585: </ul> 586: <p> 1.1 cvs 587: The choice of entities to include in the model can be subtle. Some documents 588: require chapters, while others only need various levels of sections. Certain 589: documents contain appendices, others don't. In different documents the same 590: logical entity may go by different names (e.g. ``Conclusion'' and 591: ``Summary''). Certain entities which are absolutely necessary in some 592: documents, such as clauses in a contract or the address of the recipient in a 1.18 cvs 593: letter, are useless in most other cases.</p> 594: <p> 1.1 cvs 595: The differences between documents result from more than just the entities that 596: appear in them, but also from the relationships between these entities and the 597: ways that they are linked. In certain documents, notes are spread throughout 598: the document, for example at the bottom of the page containing the 599: cross-reference to them, while in other documents they are collected at the 600: end of each chapter or even at the end of the work. As another example, the 601: introduction of some documents can contain many sections, while in other 602: documents, the introduction is restricted to be a short sequence of 1.18 cvs 603: paragraphs.</p> 604: <p> 1.1 cvs 605: All of this makes it unlikely that a single model can describe any document at 606: a relatively high level. It is obviously tempting to make up a list of widely 607: used entities, such as chapters, sections, paragraphs, and titles, and then 608: map all other entities onto the available choices. In this way, an 609: introduction can be supported as a chapter and a contract clause supported as 610: a paragraph or section. However, in trying to widen the range of usage of 611: certain entities, their meaning can be lost and the power of the model 612: reduced. In addition, while this widening partially solves the problem of 613: choosing entities, it does not solve the problem of their organization: when a 614: chapter must be composed of sections, how does one indicate that an 615: introduction has none when it is merely another chapter? One solution is to 616: include introductions in the list of supported entities. But then, how does 617: one distinguish those introductions which are allowed to have sections from 618: those which are not. Perhaps this could be done by defining two types of 619: introduction. Clearly, this approach risks an infinite expansion of the list 1.18 cvs 620: of widely used entities.</p> 621: </div> 1.1 cvs 622: 1.18 cvs 623: <div class="section"> 1.1 cvs 624: 1.18 cvs 625: <h2><a name="sectb22">Generic and specific structures</a></h2> 626: <p> 1.1 cvs 627: Thus, it is apparently impossible to construct an exhaustive inventory of all 1.2 cvs 628: those entities which are necessary and sufficient to precisely describe any 629: document. It also seems impossible to specify all possible arrangements of 1.18 cvs 630: these entities in a document. This is why Thot uses a <em>meta-model</em> 631: instead, which permits the description of numerous <em>models</em>, each one 632: describing a <em>class</em> of documents.</p> 633: <p> 634: A <em>class</em> is a set of documents having very similar structure. Thus, 1.1 cvs 635: the collection of research reports published by a laboratory constitutes a 636: class; the set of commercial proposals by the sales department of a company 637: constitutes another class; the set of articles published by a journal 638: constitutes a third class. Clearly, it is not possible to enumerate every 639: possible document class. It is also clear that new document classes must be 1.18 cvs 640: created to satisfy new needs and applications.</p> 641: <p> 1.1 cvs 642: To give a more rigorous definition of classes, we must introduce the ideas of 1.18 cvs 643: <em>generic structure</em> and <em>specific structure</em>. Each document has 644: a <em>specific structure</em> which organizes the various parts which comprise 1.1 cvs 645: it. We illustrate this with the help of a simple example comparing two 1.18 cvs 646: reports, A and B (<a href="#specstruct">see Figure</a>). The report A contains 1.1 cvs 647: an introduction followed by three chapters and a conclusion. The first 648: chapter contains two sections, the second, three sections. That is the 1.18 cvs 649: <em>specific</em> structure of document A. Similarly, the structure of 1.1 cvs 650: document B is: an introduction, two chapters, a conclusion; Chapter 1 has 651: three sections while Chapter 2 has four. The specific structures of these two 1.18 cvs 652: documents are thus different.</p> 1.1 cvs 653: 1.18 cvs 654: <div class="figure"> 655: <hr> 1.19 cvs 656: 1.18 cvs 657: <pre> Report A Report B 1.1 cvs 658: Introduction Introduction 659: Chapter 1 Chapter 1 660: Section 1.1 Section 1.1 661: Section 1.2 Section 1.2 662: Chapter 2 Section 1.3 663: Section 2.1 Chapter 2 664: Section 2.2 Section 2.1 665: Section 2.3 Section 2.2 666: Chapter 3 Section 2.3 667: Conclusion Section 2.4 1.18 cvs 668: Conclusion</pre> 1.19 cvs 669: <p align="center"> 1.18 cvs 670: <em><a name="specstruct">Two specific structures</a></em></p> 671: <hr> 1.19 cvs 672: 1.18 cvs 673: </div> 674: <p> 675: The <em>generic structure</em> defines the ways in which specific structures 1.1 cvs 676: can be constructed. It specifies how to generate specific structures. The 677: reports A and B, though different, are constructed in accordance with the same 678: generic structure, which specifies that a report contains an introduction 679: followed by a variable number of chapters and a conclusion, with each chapter 1.18 cvs 680: containing a variable number of sections.</p> 681: <p> 1.1 cvs 682: There is a one-to-one correspondence between a class and a generic structure: 683: all the documents of a class are constructed in accordance with the same 684: generic structure. Hence the definition of the class: a class is a set of 685: documents whose specific structure is constructed in accordance with the same 1.18 cvs 686: generic structure. A class is characterized by its generic structure.</p> 687: <p> 1.1 cvs 688: Thus, a generic structure can be considered to be a model at the level which 689: interests us, but only for one class of documents. When the definition is 690: limited to a single class of documents, it is possible to define a model which 691: does a good job of representing the documents of the class, including the 692: necessary entities and unencumbered by useless entities. The description of 693: the organization of the documents in the class can then be sufficiently 1.18 cvs 694: precise.</p> 695: </div> 1.1 cvs 696: 1.18 cvs 697: <div class="section"> 1.1 cvs 698: 1.18 cvs 699: <h2><a name="sectb23">Logical structure and physical structure</a></h2> 700: <p> 701: Generic structures only describe the <em>logical</em> organization of 702: documents, not their <em>physical</em> presentation on a screen or on sheets 1.1 cvs 703: of paper. However, for a document to be displayed or printed, its graphic 1.18 cvs 704: presentation must be taken into account.</p> 705: <p> 1.1 cvs 706: An examination of current printed documents shows that the details of 707: presentation essentially serve to bring out their logical structure. Outside 708: of some particular domains, notably advertising, the presentation is rarely 709: independent of the logical organization of the text. Moreover, the art of 710: typography consists of enhancing the organization of the text being set, 711: without catching the eye of the reader with overly pronounced effects. Thus, 712: italic and boldface type are used to emphasize words or expressions which have 713: greater significance than the rest of the text: keywords, new ideas, 714: citations, book titles, etc. Other effects highlight the organization of the 715: text: vertical space, margin changes, page breaks, centering, eventually 716: combined with the changes in the shapes or weight of the characters. These 717: effects serve to indicate the transitions between paragraphs, sections, or 718: chapters: an object's level in the logical structure of the document is shown 1.18 cvs 719: by the markedness of the effects.</p> 720: <p> 1.1 cvs 721: Since the model permits the description of all of the logical structure of the 722: document, the presentation can be derived from the model without being 723: submerged in the document itself. It suffices to use the logical structure of 724: the document to make the desired changes in its presentation: changes in type 1.18 cvs 725: size, type style, spacing, margin, centering, etc.</p> 726: <p> 1.1 cvs 727: Just as one cannot define a unique generic logical structure for all document 728: classes, one cannot define universal presentation rules which can be applied 729: to all document classes. For certain types of documents the chapter titles 730: will be centered on the page and printed in large, bold type. For other 731: documents, the same chapter titles will be printed in small, italic type and 1.18 cvs 732: aligned on the left margin.</p> 733: <p> 1.1 cvs 734: Therefore, it is necessary to base the presentation specifications for 735: documents on their class. Such a specification can be very fine-grained, 736: because the presentation is expressed in terms of the entities defined in the 737: generic logical structure of the class. Thus, it is possible to specify a 738: different presentation for the chapter titles and the section titles, and 739: similarly to specify titles for the sections according to their level in the 740: section hierarchy. The set of rules which specify the presentation of all the 1.18 cvs 741: elements defined in a generic logical structure is called a <em>generic 742: presentation</em>.</p> 743: <p> 1.1 cvs 744: There are several advantages derived from having a presentation linked to the 745: generic structure and described by a generic presentation. Homogeneity is the 746: first. Since every document in a class corresponds to the same generic 747: logical structure, a homogenous presentation for different documents of the 748: same class can be assured by applying the same generic presentation to all 749: documents of the class. Homogeneity of presentation can also be found among 1.2 cvs 750: the entities of a single document: every section heading will be presented in 1.1 cvs 751: the same way, the first line of every paragraph of the same type will have the 1.18 cvs 752: same indentation, etc.</p> 753: <p> 1.1 cvs 754: Another advantage of this approach to presentation is that it facilitates 755: changes to the graphical aspect of documents. A change to the generic 756: presentation rules attached to each type of entity will alter the presentation 757: of the entire document, and will do so homogenously. In this case, the 758: internal homogeneity of the class is no longer assured, but the way to control 759: it is simple. It suffices to adopt a single generic presentation for the 1.18 cvs 760: entire class.</p> 761: <p> 1.1 cvs 762: If the presentation of the class does not have to be homogenous, then the 763: appearance of the document can be adapted to the way it will be used or to the 764: device used to render it. This quality is sufficient to allow the existence 1.18 cvs 765: of <a name="mulpres">many generic presentations</a> for the same document 1.1 cvs 766: class. By applying one or the other of these presentations to it, the document 767: can be seen under different graphical aspects. It must be emphasized that 768: this type of modification of the presentation is not a change to the document 769: itself (in its specific logical structure or its content), but only in its 1.18 cvs 770: appearance at the time of editing or printing.</p> 771: </div> 1.1 cvs 772: 1.18 cvs 773: <div class="section"> 1.1 cvs 774: 1.18 cvs 775: <h2><a name="sectb24">Document structures and object structures</a></h2> 776: <p> 1.1 cvs 777: So far, we have only discussed the global structure of documents and have not 778: considered the contents found in that structure. We could limit ourselves to 779: purely textual contents by assuming that a title or a paragraph contains a 780: simple linear text. But this model would be too restrictive. In fact, 781: certain documents contain not only text, but also contain tables, diagrams, 782: photographs, mathematical formulas, and program fragments. The model must 1.18 cvs 783: permit the representation of such <em>objects</em>.</p> 784: <p> 1.1 cvs 785: Just as with the whole of the document, the model takes into account the 786: logical structure of objects of this type. Some are clearly structured, 787: others are less so. Logical structure can be recognized in mathematical 788: formulas, in tables, and in certain types of diagrams. On the other hand, it 789: is difficult to define the structure of a photograph or of some drawings. But 790: in any case, it does not seem possible to define one unique structure which 791: can represent every one of these types of objects. The approach taken in the 792: definition of meta-structure and document classes also applies to objects. 793: Object classes can be defined which put together objects of similar type, 1.18 cvs 794: constructed from the same generic logical structure.</p> 795: <p> 1.1 cvs 796: Thus, a mathematical class can be defined and have a generic logical structure 797: associated with it. But even if a single generic structure can represent a 798: sufficient variety of mathematical formulas, for other objects with less 799: rigorous structure, multiple classes must be defined. As for documents, using 800: multiple classes assures that the model can describe the full range of objects 801: to be presented. It also permits the system to support objects which were not 802: initially anticipated. Moreover, this comment applies equally to mathematics: 803: different classes of formulas can be described depending on the domain of 1.18 cvs 804: mathematics being described.</p> 805: <p> 1.1 cvs 806: Since objects have the same level of logical representation as documents, they 807: gain the same advantages. In particular, it is possible to define the 808: presentation separately from the objects themselves and attach it to the 809: class. Thus, as for documents, objects of the same type have a uniform 810: presentation and the presentation of every object in a given class can be 811: changed simply by changing the generic presentation of the class. Another 812: advantage of using this document model is that the system does not bother the 813: user with the details of presentation, but rather allows the user to 1.18 cvs 814: concentrate on the logical aspect of the document and the objects.</p> 815: <p> 1.1 cvs 816: It is clear that the documents in a class do not necessarily use the same 817: classes of objects: one technical report will contain tables while another 818: report will have no tables but will use mathematical formulas. The usable 1.2 cvs 819: object classes are not always mentioned in a limiting way in the generic 820: logical structure of documents. Rather, they can be chosen freely from a 1.18 cvs 821: large set, independent of the document class.</p> 822: <p> 1.1 cvs 823: Thus, the object classes will be made commonplace and usable in every 824: document. The notion of ``object'' can be enlarged to include not only 825: non-textual elements, but also certain types of textual elements which can 826: appear in practically every document, whatever their class. Among these 1.2 cvs 827: textual elements, one can mention enumerations, descriptions, examples, 1.18 cvs 828: quotations, even paragraphs.</p> 829: <p> 1.1 cvs 830: Thus, the document model is not a single, general model describing every type 831: of document in one place. Rather, it is a meta-model which can be used to 832: describe many different models each of which represents either a class of 833: similar documents or a class of similar objects which every document can 1.18 cvs 834: include.</p> 835: </div> 836: <hr> 1.19 cvs 837: 1.18 cvs 838: </div> 1.1 cvs 839: 1.18 cvs 840: <div class="chapter"> 1.1 cvs 841: 1.18 cvs 842: <h1><a name="sect3">The S language</a></h1> 1.1 cvs 843: 1.18 cvs 844: <div class="section"> 1.1 cvs 845: 1.18 cvs 846: <h2><a name="sectb31">Document meta-structure</a></h2> 847: <p> 1.1 cvs 848: Since the concept of meta-structure is well suited to the task of describing 849: documents at a high level of abstraction, this meta-structure must be 850: precisely defined. Toward that end this section first presents the basic 851: elements from which documents and structured objects are composed and then 852: specifies the ways in which these basic elements are assembled into structures 1.18 cvs 853: representing complete documents and objects.</p> 1.1 cvs 854: 1.18 cvs 855: <div class="subsection"> 1.1 cvs 856: 1.18 cvs 857: <h3><a name="sectc311">The basic types</a></h3> 858: <p> 1.1 cvs 859: At the lowest level of a document's structure, the first atom considered is 860: the character. However, since characters are seldom isolated, usually 861: appearing as part of a linear sequence, and in order to reduce the complexity 1.18 cvs 862: of the document structure, <em>character strings</em> are used as atoms and 1.1 cvs 863: consecutive characters belonging to the same structural element are grouped in 1.18 cvs 864: the same character string.</p> 865: <p> 1.1 cvs 866: If the structure of a document is not refined to go down to the level of 867: words or phrases, the contents of a simple paragraph can be considered to be a 868: single character string. On the other hand, the title of a chapter, the title 869: of the first section of that chapter, and the text of the first paragraph of 870: that section constitute three different character strings, because they belong 1.18 cvs 871: to distinct structural elements.</p> 872: <p> 1.1 cvs 873: If, instead, a very fine-grained representation for the structure of a 874: document is sought, character strings could be defined to contain only a 875: single word, or even just a single character. This is the case, for example, 876: in programs, for which one wants to retain a structure very close to the 1.2 cvs 877: syntax of the programming language. In this case, an assignment statement 1.1 cvs 878: initializing a simple variable to zero would be composed of two structural 879: elements, the identifier of the variable (a short character string) and the 1.18 cvs 880: assigned value (a string of a single character, `0').</p> 881: <p> 1.1 cvs 882: The character string is not the only atom necessary for representing those 883: documents that interest us. It suffices for purely textual documents, but as 884: soon as the non-textual objects which we have considered arise, there must be 885: other atoms; the number of objects which are to be represented determines the 1.18 cvs 886: number of types of atoms that are necessary.</p> 887: <p> 888: Primitive <em>graphical elements</em> are used for tables and figures of 1.1 cvs 889: different types. These elements are simple geometric shapes like horizontal 890: or vertical lines, which are sufficient for tables, or even oblique lines, 1.2 cvs 891: arrows, rectangles, circles, polygons, and curves for use in figures. From 892: these elements and character strings, graphical objects and tables can be 1.18 cvs 893: constructed.</p> 894: <p> 1.1 cvs 895: Photographs, though having very little structure, must still appear in 1.18 cvs 896: documents. They are supported by <em>picture</em> elements, which are 897: represented as matrices of pixels.</p> 898: <p> 1.1 cvs 899: Finally, mathematical notations require certain elements which are 1.18 cvs 900: simultaneously characters and graphical elements, the <em>symbols</em>. By way 1.2 cvs 901: of example, radicals, integration signs, or even large parentheses are 1.1 cvs 902: examples of this type of atom. The size of each of these symbols is 903: determined by its environment, that is to say, by the expression to which it 1.18 cvs 904: is attached.</p> 905: <p> 1.1 cvs 906: To summarize, the primitive elements which are used in the construction of 1.18 cvs 907: documents and structured objects are:</p> 908: <ul> 909: <li> 910: character strings, 1.19 cvs 911: </li> 1.18 cvs 912: <li> 913: graphical elements, 1.19 cvs 914: </li> 1.18 cvs 915: <li> 916: pictures, 1.19 cvs 917: </li> 1.18 cvs 918: <li> 919: and mathematical symbols. 1.19 cvs 920: </li> 1.18 cvs 921: </ul> 922: </div> 1.1 cvs 923: 1.18 cvs 924: <div class="subsection"> 1.1 cvs 925: 1.18 cvs 926: <h3><a name="sectc312">Constructed elements</a></h3> 927: <p> 1.1 cvs 928: A document is evidently formed from primitive elements. But the model of Thot 929: also proposes higher level elements. Thus, in a document composed of several 930: chapters, each chapter is an element, and in the chapters each section is also 1.18 cvs 931: an element, and so on. A document is thus an organized set of elements.</p> 932: <p> 1.1 cvs 933: In a document there are different sorts of elements. Each element has a 1.18 cvs 934: <em>type</em> which indicates the role of the element within the document as a 1.1 cvs 935: whole. Thus, we have, for example, the chapter and section types. The 936: document is made up of typed elements: elements of the type chapter and 937: elements of the type section, among others, but also character string elements 938: and graphical elements: the primitive elements are typed elements just as 939: well. At the other extreme, the document itself is also considered to be a 1.18 cvs 940: typed element.</p> 941: <p> 1.1 cvs 942: The important difference between the primitive elements and the other elements 943: of the document is that the primitive elements are atoms (they cannot be 1.18 cvs 944: decomposed), whereas the others, called <em>constructed elements</em>, are 1.1 cvs 945: composed of other elements, which can either be primitive elements or 946: constructed elements. A constructed element of type chapter (or more simply, 947: ``a chapter'') is composed of sections, which are also constructed elements. A 948: paragraph, a constructed element, can be made up of character strings, which 1.18 cvs 949: are primitive elements, and of equations, which are constructed elements.</p> 950: <p> 1.1 cvs 951: A document is also a constructed element. This is an important point. In 952: particular, it allows a document to be treated as part of another document, 953: and conversely, permits a part of a document to be treated as a complete 954: document. Thus, an article presented in a journal is treated by its author as 955: a document in itself, while the editor of the journal considers it to be part 956: of an issue. A table or a figure appearing in a document can be extracted and 957: treated as a complete document, for example to prepare transparencies for a 1.18 cvs 958: conference.</p> 959: <p> 1.1 cvs 960: These thoughts about types and constructed elements apply just as well to 961: objects as they do to documents. A table is a constructed element made up of 962: other constructed elements, rows and columns. A row is formed of cells, which 963: are also constructed elements which contain primitive elements (character 1.18 cvs 964: strings) and/or constructed elements like equations.</p> 965: </div> 1.1 cvs 966: 1.18 cvs 967: <div class="subsection"> 1.1 cvs 968: 1.18 cvs 969: <h3><a name="sectc313">Logical structure constructors</a></h3> 970: <p> 1.1 cvs 971: Having defined the primitive elements and the constructed elements, it is now 972: time to define the types of organization which allow the building of 1.18 cvs 973: structures. For this, we rely on the notion of the <em>constructor</em>. A 1.1 cvs 974: constructor defines a way of assembling certain elements in a structure. It 975: resides at the level of the meta-structure: it does not describe the existing 976: relations in a given structure, but rather defines how elements are assembled 1.18 cvs 977: to build a structure that conforms to a model.</p> 978: <p> 1.1 cvs 979: In defining the overall organization of documents, the first two constructors 1.18 cvs 980: considered are the aggregate and the list.</p> 1.1 cvs 981: 1.18 cvs 982: <div class="subsubsection"> 1.1 cvs 983: 1.18 cvs 984: <h4><a name="sectd3131">Aggregate and List</a></h4> 985: <p> 986: The <em>aggregate</em> constructor is used to define constructed element types 1.1 cvs 987: which are collections of a given number of other elements. These collections 988: may or may not be ordered. The elements may be either constructed or 989: primitive and are specified by their type. A report (that is, a constructed 990: element of the report type) has an aggregate structure. It is formed from a 991: title, an author's name, an introduction, a body, and a conclusion, making it 992: a collection of five element types. This type of constructor is found in 1.18 cvs 993: practically every document, and generally at several levels in a document.</p> 994: <p> 995: The <em>list</em> constructor is used to define constructed elements which are 1.1 cvs 996: ordered sequences of elements (constructed or primitive) having the same type. 997: The minimum and maximum numbers of elements for the sequence can be specified 998: in the list constructor or the number of elements can be left unconstrained. 999: The body of a report is a list of chapters and is typically required to 1000: contain a minimum of two chapters (is a chapter useful if it is the only one 1001: in the report?) The chapter itself can contain a list of sections, each 1.2 cvs 1002: section containing a list of paragraphs. In the same way as the aggregate, 1.18 cvs 1003: the list is a very frequently used constructor in every type of document. 1.2 cvs 1004: However, these two constructors are not sufficient to describe every document 1.18 cvs 1005: structure; thus other constructors supplement them.</p> 1006: </div> 1.1 cvs 1007: 1.18 cvs 1008: <div class="subsubsection"> 1.1 cvs 1009: 1.18 cvs 1010: <h4><a name="sectd3132">Choice, Schema, and Unit</a></h4> 1011: <p> 1012: The <em>choice</em> constructor is used to define the structure of an element 1.1 cvs 1013: type for which one alternative is chosen from several possibilities. Thus, a 1014: paragraph can be either a simple text paragraph, or an enumeration, or a 1.18 cvs 1015: citation.</p> 1016: <p> 1.1 cvs 1017: The choice constructor indicates the complete list of possible options, which 1018: can be too restrictive in certain cases, the paragraph being one such case. 1.18 cvs 1019: Two constructors, <em>unit</em> and <em>schema</em>, address this 1.1 cvs 1020: inconvenience. They allow more freedom in the choice of an element type. If 1021: a paragraph is defined by a schema constructor, it is possible to put in the 1022: place of a paragraph a table, an equation, a drawing or any other object 1023: defined by another generic logical structure. It is also possible to define a 1024: paragraph as a sequence of units, which could be character strings, symbols, 1.2 cvs 1025: or pictures. The choice constructor alone defines a generic logical structure 1.1 cvs 1026: that is relatively constrained; in contrast, using units and schemas, a very 1.18 cvs 1027: open structure can be defined.</p> 1028: <p> 1029: The <em>schema</em> constructor represents an object defined by a generic 1030: logical structure chosen freely from among those available.</p> 1031: <p> 1032: The <em>unit</em> constructor represents an element whose type can be either a 1.1 cvs 1033: primitive type or an element type defined as a unit in the generic logical 1034: structure of the document, or in another generic logical structure used in the 1035: document. Such an element may be used in document objects constructed 1.18 cvs 1036: according to other generic structures.</p> 1037: <p> 1.1 cvs 1038: Thus, for example, if a cross-reference to a footnote is defined in the 1039: generic logical structure ``Article'' as a unit, a table (an object defined by 1040: another generic structure) can contain cross-references to footnotes, when 1041: they appear in an article. In another type of document, a table defined by 1042: the same generic structure can contain other types of elements, depending on 1043: the type of document into which the table is inserted. All that is needed is 1044: to declare, in the generic structure for tables, that the contents of cells 1045: are units. In this way, the generic structure of objects is divided up 1046: between different types of documents which are able to adapt themselves to the 1.18 cvs 1047: environment into which they are inserted.</p> 1048: </div> 1.1 cvs 1049: 1.18 cvs 1050: <div class="subsubsection"> 1.1 cvs 1051: 1.18 cvs 1052: <h4><a name="sectd3133">Reference and Inclusion</a></h4> 1053: <p> 1054: The <em>reference</em> is used to define document elements that are 1055: cross-references to other elements, such as a section, a chapter, a 1056: bibliographic citation, or a figure. The reference is bi-directional. It can 1057: be used to access both the element being cross-referenced and each of the 1058: elements which make use of the cross-reference.</p> 1059: <p> 1060: References can be either <em>internal</em> or <em>external</em>. That is, 1.1 cvs 1061: they can designate elements which appear in the same document or in another 1.18 cvs 1062: document.</p> 1063: <p> 1064: The <em><a name="inclusion">inclusion</a></em> constructor is a special type 1.1 cvs 1065: of reference. Like the reference, it is an internal or external bidirectional 1066: link, but it is not a cross-reference. This link represents the ``live'' 1067: inclusion of the designated element; it accesses the most recent version of 1068: that element and not a ``dead'' copy, fixed in the state in which it was found 1069: at the moment the copy was made. As soon as an element is modified, all of 1070: its inclusions are automatically brought up to date. It must be noted that, 1.18 cvs 1071: in addition to inclusion, Thot permits the creation of ``dead'' copies.</p> 1072: <p> 1.1 cvs 1073: There are three types of inclusions: inclusions with full expansion, 1074: inclusions with partial expansion, and inclusions without expansion. During 1075: editing, inclusions without expansion are represented on the screen by the 1076: name of the included document, in a special color, while inclusions with 1077: expansion (full or partial) are represented by a copy (full or partial) of the 1078: included element (also in a special color). The on-screen representation of a 1.18 cvs 1079: partial inclusion is a <a href="#sectc3213">``skeleton''</a> image of the 1080: included document.</p> 1081: <p> 1.1 cvs 1082: Inclusion with complete expansion can be used to include parts of the same 1083: document or of other documents. Thus, it can be either an internal or an 1084: external link. It can be used to include certain bibliographic entries of a 1085: scientific article in another article, or to copy part of a mathematical 1086: formula into another formula of the same document, thus assuring that both 1.18 cvs 1087: copies will remain synchronized.</p> 1088: <p> 1.1 cvs 1089: Inclusion without expansion or with partial expansion is used to include 1090: complete documents. It is always an external link. It is used primarily to 1091: divide very large documents into sub-documents that are easier to manipulate, 1092: especially when there are many authors. So, a book can include some chapters, 1093: where each chapter is a different document which can be edited separately. 1094: When viewing the book on the screen, it might be desirable to see only the 1095: titles of the chapters and sections. This can be achieved using inclusion 1.18 cvs 1096: with partial expansion.</p> 1097: <p> 1.1 cvs 1098: During printing, inclusions without expansion or with partial expansion can be 1099: represented either as they were shown on the screen or by a complete (and 1.18 cvs 1100: up-to-date) copy of the included element or document.</p> 1101: <p> 1.1 cvs 1102: The inclusion constructor, whatever its type, respects the generic structure: 1103: only those elements authorized by the generic structure can be included at a 1.18 cvs 1104: given position in a document.</p> 1105: </div> 1.1 cvs 1106: 1.18 cvs 1107: <div class="subsubsection"> 1.1 cvs 1108: 1.18 cvs 1109: <h4><a name="sectd3134">Mark pairs</a></h4> 1110: <p> 1.1 cvs 1111: It is often useful to delimit certain parts of a document independently from 1112: the logical structure. For example, one might wish to attach some information 1.18 cvs 1113: (in the form of an <a href="#sectc315">attribute</a>) or a particular 1114: treatment to a group of words or a set of consecutive paragraphs. <em>Mark 1115: pairs</em> are used to do this.</p> 1116: <p> 1.1 cvs 1117: Mark pairs are elements which are always paired and are terminals in the 1118: logical structure of the document. Their position in the structure of the 1119: document is defined in the generic structure. It is important to note that 1.18 cvs 1120: when the terminals of a mark pair are <em>extensions</em> (see the next 1121: section), they can be used quite freely.</p> 1122: </div> 1.1 cvs 1123: 1.18 cvs 1124: <div class="subsubsection"> 1.1 cvs 1125: 1.18 cvs 1126: <h4><a name="sectd3135">Restrictions and Extensions</a></h4> 1127: <p> 1.1 cvs 1128: The primitive types and the constructors presented so far permit the 1129: definition of the logical structure of documents and objects in a rigorous 1130: way. But this definition can be very cumbersome in certain cases, notably 1131: when trying to constrain or extend the authorized element types in a 1.18 cvs 1132: particular context. <em>Restrictions</em> and <em>extensions</em> are used to 1133: cope with these cases.</p> 1134: <p> 1135: A restriction associates with a particular element type <em>A</em>, a list of 1136: those element types which elements of type <em>A</em> may not contain, even if 1137: the definition of type <em>A</em> and those of its components authorize them 1.1 cvs 1138: otherwise. This simplifies the writing of generic logical structures and 1139: allows limitations to be placed, when necessary, on the choices offered by the 1.18 cvs 1140: schema and unit constructors.</p> 1141: <p> 1.1 cvs 1142: Extensions are the inverse of restrictions. They identify a list of element 1.18 cvs 1143: types whose presence <em>is</em> permitted, even if its definition and those 1144: of its components do not authorize them otherwise.</p> 1145: </div> 1146: 1147: <div class="subsubsection"> 1148: 1149: <h4><a name="sectd3136">Summary</a></h4> 1150: <p> 1151: Thus, four constructors are used to construct a document:</p> 1152: <ul> 1153: <li> 1154: the aggregate constructor (ordered or not), 1.19 cvs 1155: </li> 1.18 cvs 1156: <li> 1157: the list constructor, 1.19 cvs 1158: </li> 1.18 cvs 1159: <li> 1160: the choice constructor and its extensions, the unit and schema constructors, 1.19 cvs 1161: </li> 1.18 cvs 1162: <li> 1163: the reference constructor and its variant, the inclusion. 1.19 cvs 1164: </li> 1.18 cvs 1165: </ul> 1166: <p> 1.1 cvs 1167: These constructors are also sufficient for objects. Thus, these constructors 1168: provide a homogenous meta-model which can describe both the organization of 1169: the document as a whole and that of the various types of objects which it 1170: contains. After presenting the description language for generic structures, 1171: we will present several examples which illustrate the appropriateness of the 1.18 cvs 1172: model.</p> 1173: <p> 1.1 cvs 1174: The first three constructors (aggregate, list and choice) lead to tree-like 1175: structures for documents and objects, the objects being simply the subtrees of 1176: the tree of a document (or even of other objects' subtrees). The reference 1177: constructor introduces other, non-hierarchical, relations which augment those 1178: of the tree: when a paragraph makes reference to a chapter or a section, that 1179: relation leaves the purely tree-like structure. Moreover, external reference 1180: and inclusion constructors permit the establishment of links between different 1.18 cvs 1181: documents, thus creating a hypertext structure.</p> 1182: </div> 1183: </div> 1.1 cvs 1184: 1.18 cvs 1185: <div class="subsection"> 1.1 cvs 1186: 1.18 cvs 1187: <h3><a name="sectc314">Associated Elements</a></h3> 1188: <p> 1.1 cvs 1189: Thanks to the list, aggregate and choice constructors, the organization of the 1190: document is specified rigorously, using constructed and primitive elements. 1191: But a document is made up of more than just its elements; it clearly also 1192: contains links between them. There exist elements whose position in the 1193: document's structure is not determinable. This is notably the case for 1194: figures and notes. A figure can be designated at many points in the same 1195: document and its place in the physical document can vary over the life of the 1196: document without any effect on the meaning or clarity of the document. At one 1197: time, it can be placed at the end of the document along with all other 1198: figures. At another time, it can appear at the top of the page which follows 1199: the first mention of the figure. The figures can be dispersed throughout the 1200: document or can be grouped together. The situation is similar for notes, 1201: which can be printed at the bottom of the page on which they are mentioned or 1202: assembled together at the end of the chapter or even the end of the work. Of 1203: course, this brings up questions of the physical position of elements in 1204: documents that are broken into pages, but this reflects the structural 1205: instability of these elements. They cannot be treated the same way as 1206: elements like paragraphs or sections, whose position in the structure is 1.18 cvs 1207: directly linked to the semantics of the document.</p> 1208: <p> 1.1 cvs 1209: Those elements whose position in the structure of the document is not fixed, 1210: even though they are definitely part of the document, are called 1.18 cvs 1211: <em>associated elements</em>. Associated elements are themselves structures, 1.1 cvs 1212: which is to say that their content can be organized logically by the 1.18 cvs 1213: constructors from primitive and constructed elements.</p> 1214: <p> 1.1 cvs 1215: It can happen that the associated elements are totally disconnected from the 1216: structure of the document, as in a commentary or appraisal of the entire work. 1217: But more often, the associated elements are linked to the content of the 1218: document by references. This is generally the case for notes and figures, 1.18 cvs 1219: among others.</p> 1220: <p> 1.1 cvs 1221: Thus, associated elements introduce a new use for the reference constructor. 1222: It not only serves to create links between elements of the principal structure 1223: of the document, but also serves to link the associated elements to the 1.18 cvs 1224: primary structure.</p> 1225: </div> 1.1 cvs 1226: 1.18 cvs 1227: <div class="subsection"> 1.1 cvs 1228: 1.18 cvs 1229: <h3><a name="sectc315">Attributes</a></h3> 1230: <p> 1.1 cvs 1231: There remain logical aspects of documents that are not entirely described by 1232: the structure. Certain types of semantic information, which are not stated 1233: explicitly in the text, must also be taken into account. In particular, such 1234: information is shown by typographic effects which do not correspond to a 1235: change between structural elements. In fact, certain titles are set in bold 1236: or italic or are printed in a different typeface from the rest of the text in 1237: order to mark them as structurally distinct. But these same effects 1238: frequently appear in the middle of continuous text (e.g. in the interior of a 1239: paragraph). In this case, there is no change between structural elements; the 1240: effect serves to highlight a word, expression, or phrase. The notion of an 1.18 cvs 1241: <em>attribute</em> is used to express this type of information.</p> 1242: <p> 1.1 cvs 1243: An attribute is a piece of information attached to a structural element which 1244: augments the type of the element and clarifies its function in the document. 1245: Keywords, foreign language words, and titles of other works can all be 1246: represented by character strings with attached attributes. Attributes may 1247: also be attached to constructed elements. Thus, an attribute indicating the 1248: language can be attached to a single word or to a large part of a 1.18 cvs 1249: document.</p> 1250: <p> 1.1 cvs 1251: In fact, an attribute can be any piece of information which is linked to a 1252: part of a document and which can be used by agents which work on the document. 1253: For example, the language in which the document is written determines the set 1254: of characters used by an editor or formatter. It also determines the 1255: algorithm or hyphenation dictionary to be used. The attribute ``keyword'' 1256: facilitates the work of an information retrieval system. The attribute 1257: ``index word'' allows a formatter to automatically construct an index at the 1.18 cvs 1258: end of the document.</p> 1259: <p> 1.1 cvs 1260: As with the types of constructed elements, the attributes and the values they 1261: can take are defined separately in each generic logical structure, not in the 1262: meta-model, according to the needs of the document class or the nature of the 1.18 cvs 1263: object.</p> 1264: <p> 1.1 cvs 1265: Many types of attributes are offered: numeric, textual, references, and 1.18 cvs 1266: enumerations:</p> 1267: <ul> 1268: <li> 1269: <em>Numeric attributes</em> can take integer values (negative, positive, or 1270: null). 1.19 cvs 1271: </li> 1.18 cvs 1272: <li> 1273: <em>Textual attributes</em> have as their values character strings. 1.19 cvs 1274: </li> 1.18 cvs 1275: <li> 1276: <em>Reference attributes</em> designate an element of the logical structure. 1.19 cvs 1277: </li> 1.18 cvs 1278: <li> 1279: <em>Enumeration attributes</em> can take one value from a limited list of 1.1 cvs 1280: possible values, each value being a name. 1.19 cvs 1281: </li> 1.18 cvs 1282: </ul> 1283: <p> 1284: In a generic structure, there is a distinction between <em>global 1285: attributes</em> and <em>local attributes</em>. A global attribute can be 1.1 cvs 1286: applied to every element type defined in the generic structure where it is 1287: specified. In contrast, a local attribute can only be applied to certain 1288: types of elements, even only a single type. The ``language'' attribute 1289: presented above is an example of a global attribute. An example of a local 1290: attribute is the rank of an author (principal author of the document or 1291: secondary author): this attribute can only be applied sensibly to an element 1.18 cvs 1292: of the ``author'' type.</p> 1293: <p> 1.1 cvs 1294: Attributes can be assigned to the elements which make up the document in many 1295: different ways. The author can freely and dynamically place them on any part 1.18 cvs 1296: of the document in order to attach supplementary information of his/her 1297: choice. However, attributes may only be assigned in accordance with the rules 1298: of the generic structure; in particular, local attributes can only be assigned 1299: to those element types for which they are defined.</p> 1300: <p> 1.1 cvs 1301: In the generic structure, certain local attributes can be made mandatory for 1.2 cvs 1302: certain element types. In this case, Thot automatically associates the 1303: attribute with the elements of this type and it requires the user to provide a 1.18 cvs 1304: value for this attribute.</p> 1305: <p> 1.1 cvs 1306: Attributes can also be automatically assigned, with a given value, by every 1307: application processing the document in order to systematically add a piece of 1308: information to certain predefined elements of the document. By way of 1309: example, in a report containing a French abstract and an English abstract, 1310: each of the two abstracts is defined as a sequence of paragraphs. The first 1311: abstract has a value of ``French'' for the ``language'' attribute while the 1.18 cvs 1312: second abstract's ``language'' attribute has a value of ``English''.</p> 1313: <p> 1.1 cvs 1314: In the case of mark pairs, attributes are logically associated with the pair 1.18 cvs 1315: as a whole, but are actually attached to the first mark.</p> 1316: </div> 1.1 cvs 1317: 1.18 cvs 1318: <div class="subsection"> 1.1 cvs 1319: 1.18 cvs 1320: <h3><a name="sectc316">Discussion of the model</a></h3> 1321: <p> 1.1 cvs 1322: The notions of attribute, constructor, structured element, and associated 1323: element are used in the definition of generic logical structures of documents 1324: and objects. The problem is to assemble them to form generic structures. In 1325: fact, many types of elements and attributes can be found in a variety of 1326: generic structures. Rather than redefine them for each structure in which 1327: they appear, it is best to share them between structures. The object classes 1328: already fill this sharing function. If a mathematical class is defined, its 1329: formulas can be used in many different document classes, without redefining 1330: the structure of each class. This problem arises not only for the objects 1331: considered here; it also arises for the commonplace textual elements found in 1332: many document classes. This is the reason why the notion of object is so 1333: broad and why paragraphs and enumerations are also considered to be objects. 1334: These object classes not only permit the sharing of the structures of 1.18 cvs 1335: elements, but also of the attributes defined in the generic structures.</p> 1336: <p> 1.1 cvs 1337: Structure, such as that presented here, can appear very rigid, and it is 1338: possible to imagine that a document editing system based on this model could 1339: prove very constraining to the user. This is, in fact, a common criticism of 1340: syntax-directed editors. This defect can be avoided with Thot, primarily for 1.18 cvs 1341: three reasons:</p> 1342: <ul> 1343: <li> 1344: the generic structures are not fixed in the model itself, 1.19 cvs 1345: </li> 1.18 cvs 1346: <li> 1347: the model takes the dynamics of documents into account, 1.19 cvs 1348: </li> 1.18 cvs 1349: <li> 1350: the constructors offer great flexibility. 1.19 cvs 1351: </li> 1.18 cvs 1352: </ul> 1353: <p> 1.1 cvs 1354: When the generic structure of a document is not predefined, but rather is 1355: constructed specifically for each document class, it can be carefully adapted 1356: to the current needs. In cases where the generic structure is inadequate for 1357: a particular document of the class, it is always possible either to create a 1358: new class with a generic structure well suited to the new case or to extend 1359: the generic structure of the existing class to take into account the specifics 1360: of the document which poses the problem. These two solutions can also be 1.18 cvs 1361: applied to objects whose structures prove to be poorly designed.</p> 1362: <p> 1.1 cvs 1363: The model is sufficiently flexible to take into account all the phases of the 1364: life of the document. When a generic structure specifies that a report must 1365: contain a title, an abstract, an introduction, at least two chapters, and a 1.18 cvs 1366: conclusion, this means only that a report, <em>upon completion</em>, will have 1.1 cvs 1367: to contain all of these elements. When the author begins writing, none of 1.2 cvs 1368: these elements is present. Thot uses this model. Therefore, it tolerates 1369: documents which do not conform strictly to the generic structure of their 1370: class; it also considers the generic logical structure to be a way of helping 1.18 cvs 1371: the user in the construction of a complex document.</p> 1372: <p> 1.1 cvs 1373: In contrast, other applications may reject a document which does not conform 1374: strictly to its generic structure. This is, for example, what is done by 1375: compilers which refuse to generate code for a program which is not 1376: syntactically correct. This might also occur when using a document 1.18 cvs 1377: application for a report which does not have an abstract or title.</p> 1378: <p> 1.1 cvs 1379: The constructors of the document model bring a great flexibility to the 1380: generic structures. A choice constructor (and even more, a unit or schema 1381: constructor) can represent several, very different elements. The list 1382: constructor permits the addition of more elements of the same type. Used 1383: together, these two constructors permit any series of elements of different 1384: types. Of course, this flexibility can be reduced wherever necessary since a 1385: generic structure can limit the choices or the number of elements in a 1.18 cvs 1386: list.</p> 1387: <p> 1.1 cvs 1388: Another difficulty linked to the use of structure in the document model 1389: resides in the choice of the level of the structure. The structure of a 1390: discussion could be extracted from the text itself via linguistic analysis. 1391: Some studies are exploring this approach, but the model of Thot excludes this 1392: type of structure. It only takes into account the logical structure provided 1.18 cvs 1393: explicitly by the author.</p> 1394: <p> 1.1 cvs 1395: However, the level of structure of the model is not imposed. Each generic 1396: structure defines its own level of structure, adapted to the document class or 1397: object and to the ways in which it will be processed. If it will only be 1398: edited and printed, a relatively simple structure suffices. If more 1399: specialized processing will be applied to it, the structure must represent the 1400: element types on which this processing must act. By way of example, a simple 1401: structure is sufficient for printing formulas, but a more complex structure is 1402: required to perform symbolic or numeric calculations on the mathematical 1.18 cvs 1403: expressions. The document model of Thot allows both types of structure.</p> 1404: </div> 1405: </div> 1.1 cvs 1406: 1.18 cvs 1407: <div class="section"> 1.1 cvs 1408: 1.18 cvs 1409: <h2><a name="sectb32">The definition language for generic structures</a></h2> 1410: <p> 1.1 cvs 1411: Generic structures, which form the basis of the document model of Thot, are 1412: specified using a special language. This definition language, called S, is 1.18 cvs 1413: described in this section.</p> 1414: <p> 1.1 cvs 1415: Each generic structure, which defines a class of documents or objects, is 1.2 cvs 1416: specified by a file, written in the S language, which is called a 1.18 cvs 1417: <em>structure schema</em>. Structure schemas are compiled into tables, called 1418: structure tables, which are used by Thot and which determine its behavior.</p> 1.1 cvs 1419: 1.18 cvs 1420: <div class="subsection"> 1.1 cvs 1421: 1.18 cvs 1422: <h3><a name="sectc321">Writing Conventions</a></h3> 1423: <p> 1.1 cvs 1424: The grammar of S, like those of the languages P and T presented later, is 1425: described using the meta-language M, derived from the Backus-Naur Form 1.18 cvs 1426: (BNF).</p> 1427: <p> 1.1 cvs 1428: In this meta-language each rule of the grammar is composed of a grammar symbol 1429: followed by an equals sign (`=') and the right part of the rule. The equals 1430: sign plays the same role as the traditional `::=' of BNF: it indicates that 1.18 cvs 1431: the right part defines the symbol of the left part. In the right part,</p> 1432: <dl> 1433: <dt>concatenation</dt> 1434: <dd> 1435: is shown by the juxtaposition of symbols; 1436: </dd> 1437: <dt>character strings</dt> 1438: <dd> 1439: between apostrophes ' represent terminal symbols, that is, keywords in the 1.2 cvs 1440: language defined. Keywords are written here in upper-case letters, but can be 1441: written in any combination of upper and lower-case letters. For example, the 1.18 cvs 1442: keyword <tt>DEFPRES</tt> of S can also be written as <tt>defpres</tt> or 1443: <tt>DefPres</tt>. 1444: </dd> 1445: <dt>material between brackets</dt> 1446: <dd> 1447: (`[' and `]') is optional; 1448: </dd> 1449: <dt>material between angle brackets</dt> 1450: <dd> 1451: (`<' and `>') can be repeated many times or omitted; 1452: </dd> 1453: <dt>the slash</dt> 1454: <dd> 1455: (`/') indicates an alternative, a choice between the options separated by the 1456: slash character; 1457: </dd> 1458: <dt>the period</dt> 1459: <dd> 1460: marks the end of a rule; 1461: </dd> 1462: <dt>text between braces</dt> 1463: <dd> 1464: (`{' and `}') is simply a comment. 1465: </dd> 1466: </dl> 1467: <p> 1.1 cvs 1468: The M meta-language also uses the concepts of identifiers, strings, and 1.18 cvs 1469: integers:</p> 1470: <dl> 1471: <dt><tt>NAME</tt></dt> 1472: <dd> 1473: represents an identifier, a sequence of letters (upper or lower-case), digits, 1474: and underline characters (`_'), beginning with a letter. Also considered a 1475: letter is the sequence of characters `<tt>\nnn</tt>' where the letter 1476: <tt>n</tt> represents the ISO Latin-1 code of the letter in octal. It is thus 1477: possible to use accented letters in identifiers. The maximum length of 1478: identifiers is fixed by the compiler. It is normally 31 characters. 1479: <p> 1.1 cvs 1480: Unlike keywords, upper and lower-case letters are distinct in identifiers. 1.18 cvs 1481: Thus, <tt>Title</tt>, <tt>TITLE</tt>, and <tt>title</tt> are considered 1482: different identifiers.</p> 1483: </dd> 1484: <dt><tt>STRING</tt></dt> 1485: <dd> 1486: represents a string. This is a string of characters delimited by apostrophes. 1487: If an apostrophe must appear in a string, it is doubled. As with identifiers, 1488: strings can contain characters represented by their octal code (after a 1489: backslash). As with apostrophes, if a backslash must appear in a string, it 1490: is doubled. 1491: </dd> 1492: <dt><tt>NUMBER</tt></dt> 1493: <dd> 1494: represents a positive integer or zero (without a sign), or said another way, a 1495: sequence of decimal digits. 1496: </dd> 1497: </dl> 1498: <p> 1499: The M language can be used to define itself as follows:</p> 1500: <pre>{ Any text between braces is a comment. } 1.1 cvs 1501: Grammar = Rule < Rule > 'END' . 1502: { The < and > signs indicate zero } 1503: { or more repetitions. } 1504: { END marks the end of the grammar. } 1505: Rule = Ident '=' RightPart '.' . 1506: { The period indicates the end of a rule } 1507: RightPart = RtTerminal / RtIntermed . 1508: { The slash indicates a choice } 1509: RtTerminal ='NAME' / 'STRING' / 'NUMBER' . 1510: { Right part of a terminal rule } 1511: RtIntermed = Possibility < '/' Possibility > . 1512: { Right part of an intermediate rule } 1513: Possibility = ElemOpt < ElemOpt > . 1514: ElemOpt = Element / '[' Element < Element > ']' / 1515: '<' Element < Element > '>' . 1516: { Brackets delimit optional parts } 1517: Element = Ident / KeyWord . 1518: Ident = NAME . 1519: { Identifier, sequence of characters } 1520: KeyWord = STRING . 1521: { Character string delimited by apostrophes } 1.18 cvs 1522: END</pre> 1523: </div> 1.1 cvs 1524: 1.18 cvs 1525: <div class="subsection"> 1.1 cvs 1526: 1.18 cvs 1527: <h3><a name="sectc322">Extension schemas</a></h3> 1528: <p> 1.1 cvs 1529: A structure schema defines the generic logical structure of a class of 1530: documents or objects, independent of the operations which can be performed on 1531: the documents. However, certain applications may require particular 1532: information to be represented by the structure for the documents that they 1533: operate on. Thus a document version manager will need to indicate in the 1534: document the parts which belong to one version or another. An indexing system 1535: will add highly-structured index tables as well as the links between these 1.18 cvs 1536: tables and the rest of the document.</p> 1537: <p> 1.2 cvs 1538: Thus, many applications need to extend the generic structure of the documents 1539: on which they operate to introduce new attributes, associated elements or 1.1 cvs 1540: element types. These additions are specific to each application and must be 1541: able to be applied to any generic structure: users will want to manage 1542: versions or construct indices for many types of documents. Extension schemas 1543: fulfill this role: they define attributes, elements, associated elements, 1544: units, etc., but they can only be used jointly with a structure schema that 1545: they complete. Otherwise, structure schemas can always be used without these 1.18 cvs 1546: extensions when the corresponding applications are not available.</p> 1547: </div> 1.1 cvs 1548: 1.18 cvs 1549: <div class="subsection"> 1.1 cvs 1550: 1.18 cvs 1551: <h3><a name="sectc323">The general organization of structure schemas</a></h3> 1552: <p> 1553: Every structure schema begins with the keyword <tt>STRUCTURE</tt> and ends 1554: with the keyword <tt>END</tt>. The keyword <tt>STRUCTURE</tt> is followed by 1555: the keyword <tt>EXTENSION</tt> in the case where the schema defines an 1.1 cvs 1556: extension, then by the name of the generic structure which the schema defines 1557: (the name of the document or object class). The name of the structure is 1.18 cvs 1558: followed by a semicolon.</p> 1559: <p> 1.1 cvs 1560: In the case of a complete schema (that is, a schema which is not an 1561: extension), the definition of the name of the structure is followed by the 1562: declarations of the default presentation schema, the global attributes, the 1563: parameters, the structure rules, the associated elements, the units, the 1564: skeleton elements and the exceptions. Only the definition of the structure 1565: rules is required. Each series of declarations begins with a keyword: 1.18 cvs 1566: <tt>DEFPRES</tt>, <tt>ATTR</tt>, <tt>PARAM</tt>, <tt>STRUCT</tt>, 1567: <tt>ASSOC</tt>, <tt>UNITS</tt>, <tt>EXPORT</tt>, <tt>EXCEPT</tt>.</p> 1568: <p> 1.1 cvs 1569: In the case of an extension schema, there are neither parameters nor skeleton 1.18 cvs 1570: elements and the <tt>STRUCT</tt> section is optional, while that section is 1.1 cvs 1571: required in a schema that is not an extension. On the other hand, extension 1.18 cvs 1572: schemas can contain an <tt>EXTENS</tt> section, which must not appear in a 1.1 cvs 1573: schema which is not an extension; this section defines the complements to 1574: attach to the rules found in the schema to which the extension will be added. 1.18 cvs 1575: The sections <tt>ATTR</tt>, <tt>STRUCT</tt>, <tt>ASSOC</tt>, and 1576: <tt>UNITS</tt> define new attributes, new elements, new associated elements, 1577: and new units which add their definitions to the principal schema.</p> 1578: <pre> StructSchema ='STRUCTURE' ElemID ';' 1.1 cvs 1579: 'DEFPRES' PresID ';' 1580: [ 'ATTR' AttrSeq ] 1581: [ 'PARAM' RulesSeq ] 1582: 'STRUCT' RulesSeq 1583: [ 'ASSOC' RulesSeq ] 1584: [ 'UNITS' RulesSeq ] 1585: [ 'EXPORT' SkeletonSeq ] 1586: [ 'EXCEPT' ExceptSeq ] 1587: 'END' . 1.18 cvs 1588: ElemID = NAME .</pre> 1589: <p> 1590: or</p> 1591: <pre> ExtensSchema ='STRUCTURE' 'EXTENSION' ElemID ';' 1.1 cvs 1592: 'DEFPRES' PresID ';' 1593: [ 'ATTR' AttrSeq ] 1594: [ 'STRUCT' RulesSeq ] 1595: [ 'EXTENS' ExtensRuleSeq ] 1596: [ 'ASSOC' RulesSeq ] 1597: [ 'UNITS' RulesSeq ] 1598: [ 'EXCEPT' ExceptSeq ] 1599: 'END' . 1.18 cvs 1600: ElemID = NAME .</pre> 1601: </div> 1.1 cvs 1602: 1.18 cvs 1603: <div class="subsection"> 1.1 cvs 1604: 1.18 cvs 1605: <h3><a name="sectc324">The default presentation</a></h3> 1606: <p> 1607: It was shown <a href="#mulpres">above</a> that many different presentations 1.1 cvs 1608: are possible for documents and objects of the same class. The structure 1.18 cvs 1609: schema defines a preferred presentation for the class, called the <em>default 1610: presentation</em>. Like generic structures, presentations are described by 1611: programs, called <em>presentation schemas</em>, which are written in a 1612: specific language, P, presented <a href="#sectb42">later</a> in this document. 1613: The name appearing after the keyword <tt>DEFPRES</tt> is the name of the 1.2 cvs 1614: default presentation schema. When a new document is created, Thot will use 1615: this presentation schema by default, but the user remains free to choose 1.18 cvs 1616: another if s/he wishes.</p> 1617: <pre> PresID = NAME .</pre> 1618: </div> 1.1 cvs 1619: 1.18 cvs 1620: <div class="subsection"> 1.1 cvs 1621: 1.18 cvs 1622: <h3><a name="sectc325">Global Attributes</a></h3> 1623: <p> 1.1 cvs 1624: If the generic structure includes global attributes of its own, they are 1.18 cvs 1625: declared after the keyword <tt>ATTR</tt>. Each global attribute is defined by 1.1 cvs 1626: its name, followed by an equals sign and the definition of its type. The 1.18 cvs 1627: declaration of a global attribute is terminated by a semi-colon.</p> 1628: <p> 1.1 cvs 1629: For attributes of the numeric, textual, or reference types, the type is 1.18 cvs 1630: indicated by a keyword, <tt>INTEGER</tt>, <tt>TEXT</tt>, or <tt>REFERENCE</tt> 1631: respectively.</p> 1632: <p> 1633: In the case of a reference attribute, the keyword <tt>REFERENCE</tt> is 1.1 cvs 1634: followed by the type of the referenced element in parentheses. It can refer 1.18 cvs 1635: to any type at all, specified by using the keyword <tt>ANY</tt>, or to a 1.1 cvs 1636: specific type. In the latter case, the element type designated by the 1.18 cvs 1637: reference can be defined either in the <a href="#sectc327"><tt>STRUCT</tt> 1638: section</a> of the same structure schema or in the <tt>STRUCT</tt> section of 1.1 cvs 1639: another structure schema. When the type is defined in another schema, the 1640: element type is followed by the name of the structure schema (within 1641: parentheses) in which it is defined. The name of the designated element type 1.18 cvs 1642: can be preceded by the keyword <tt>First</tt> or <tt>Second</tt>, but only in 1643: the case where the type is defined as <a href="#sectd3285">a pair</a>. These 1.1 cvs 1644: keywords indicate whether the attribute must designate the first mark of the 1645: pair or the second. If the reference refers to a pair and neither of these 1.18 cvs 1646: two keywords is present, then the first mark is used.</p> 1647: <p> 1.1 cvs 1648: In the case of an enumeration attribute, the equals sign is followed by the 1649: list of names representing the possible values of the attribute, the names 1650: being separated from each other by commas. An enumeration attribute has at 1651: least one possible value; the maximum number of values is defined by the 1.18 cvs 1652: compiler for the S language.</p> 1653: <pre> AttrSeq = Attribute < Attribute > . 1.1 cvs 1654: Attribute = AttrID '=' AttrType ';' . 1655: AttrType = 'INTEGER' / 'TEXT' / 1656: 'REFERENCE' '(' RefType ')' / 1657: ValueSeq . 1658: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] . 1659: FirstSec = 'First' / 'Second' . 1660: ExtStruct = '(' ElemID ')' . 1661: ValueSeq = AttrVal < ',' AttrVal > . 1662: AttrID = NAME . 1.18 cvs 1663: AttrVal = NAME .</pre> 1664: <p> 1665: There is a predefined global text attribute, the <em>language</em>, which is 1.2 cvs 1666: automatically added to every Thot structure schema. This attribute allows 1667: Thot to perform certain actions, such as hyphenation and spell-checking, which 1668: cannot be performed without knowing the language in which each part of the 1669: document is written. This attribute can be used just like any explicitly 1.18 cvs 1670: declared attribute: the system acts as if every structure schema contains</p> 1671: <pre>ATTR 1672: Language = TEXT;</pre> 1673: <blockquote class="example"> 1674: <p> 1675: <strong>Example:</strong></p> 1676: <p> 1.2 cvs 1677: The following specification defines the global enumeration attribute 1.18 cvs 1678: WordType.</p> 1679: <pre>ATTR 1680: WordType = Definition, IndexWord, DocumentTitle;</pre> 1681: </blockquote> 1682: </div> 1.1 cvs 1683: 1.18 cvs 1684: <div class="subsection"> 1.1 cvs 1685: 1.18 cvs 1686: <h3><a name="sectc326">Parameters</a></h3> 1687: <p> 1.1 cvs 1688: A parameter is a document element which can appear many times in the document, 1689: but always has the same value. This value can only be modified in a 1690: controlled way by certain applications. For example, in an advertising 1691: circular, the name of the recipient may appear in the address part and in the 1692: text of the circular. If the recipient's name were a parameter, it might only 1.18 cvs 1693: be able to be changed by a ``mail-merge'' application.</p> 1694: <p> 1.1 cvs 1695: Parameters are not needed for every document class, but if the schema includes 1.18 cvs 1696: parameters they are declared after the keyword <tt>PARAM</tt>. Each parameter 1697: declaration is made in the same way as a <a href="#sectc327">structure element 1698: declaration</a>.</p> 1699: <p> 1.1 cvs 1700: During editing, Thot permits the insertion of parameters wherever the 1701: structure schema allows; it also permits the removal of parameters which are 1702: already in the document but does not allow the modification of the parameter's 1.2 cvs 1703: content in any way. The content is generated automatically by Thot during the 1704: creation of the parameter, based on the value of the parameter in the 1.18 cvs 1705: document.</p> 1706: </div> 1.1 cvs 1707: 1.18 cvs 1708: <div class="subsection"> 1.1 cvs 1709: 1.18 cvs 1710: <h3><a name="sectc327">Structured elements</a></h3> 1711: <p> 1.1 cvs 1712: The rules for defining structured elements are required, except in an 1713: extension schema: they constitute the core of a structure schema, since they 1714: define the structure of the different types of elements that occur in a 1.18 cvs 1715: document or object of the class defined by the schema.</p> 1716: <p> 1717: The first structure rule after the keyword <tt>STRUCT</tt> must define the 1.1 cvs 1718: structure of the class whose name appears in the first instruction 1.18 cvs 1719: (<tt>STRUCTURE</tt>) of the schema. This is the root rule of the schema, 1720: defining the root of the document tree or object tree.</p> 1721: <p> 1.1 cvs 1722: The remaining rules may be placed in any order, since the language permits the 1723: definition of element types before or after their use, or even in the same 1724: instruction in which they are used. This last case allows the definition of 1.18 cvs 1725: recursive structures.</p> 1726: <p> 1.1 cvs 1727: Each rule is composed of a name (the name of the element type whose structure 1.18 cvs 1728: is being defined) followed by an equals sign and a structure definition.</p> 1729: <p> 1.1 cvs 1730: If any local attributes are associated with the element type defined by the 1.2 cvs 1731: rule, they appear between parentheses after the type name and before the 1.18 cvs 1732: equals sign. The parentheses contain, first, the keyword <tt>ATTR</tt>, then 1.2 cvs 1733: the list of local attributes, separated by commas. Each local attribute is 1734: composed of the name of the attribute followed by an equals sign and the 1.18 cvs 1735: definition of the attribute's type, just as in the definition of <a 1736: href="#sectc325">global attributes</a>. The name of the attribute can be 1.2 cvs 1737: preceded by an exclamation point to indicate that the attribute must always be 1738: present for this element type. The same attribute, identified by its name, 1739: can be defined as a local attribute for multiple element types. In this 1740: case, the equals sign and definition of the attribute type need only appear in 1741: the first occurrence of the attribute. It should be noted that global 1.18 cvs 1742: attributes cannot also be defined as local attributes.</p> 1743: <p> 1744: If any <a href="#sectd3135">extensions</a> are defined for this element type, 1745: a plus sign follows the structure definition and the names of the extension 1746: element types appear between parentheses after the plus. If there are 1747: multiple extensions, they are separated by commas. These types can either be 1748: defined in the same schema, defined in other schemas, or they may be base 1749: types identified by the keywords <tt>TEXT</tt>, <tt>GRAPHICS</tt>, 1750: <tt>SYMBOL</tt>, or <tt>PICTURE</tt>.</p> 1751: <p> 1752: <a href="#sectd3135">Restrictions</a> are indicated in the same manner as 1753: extensions, but they are introduced by a minus sign and they come after the 1754: extensions, or if there are no extensions, after the structure definition.</p> 1755: <p> 1.1 cvs 1756: If the values of attributes must be attached systematically to this element 1.18 cvs 1757: type, they are introduced by the keyword <tt>WITH</tt> and declared in the 1.1 cvs 1758: form of a list of fixed-value attributes. When such definitions of fixed 1.18 cvs 1759: attribute values appear, they are always the last part of the rule.</p> 1760: <p> 1761: The rule is terminated by a semicolon.</p> 1762: <pre> RuleSeq = Rule < Rule > . 1.1 cvs 1763: Rule = ElemID [ LocAttrSeq ] '=' DefWithAttr ';'. 1764: LocAttrSeq = '(' 'ATTR' LocAttr < ';' LocAttr > ')' . 1765: LocAttr = [ '!' ] AttrID [ '=' AttrType ] . 1766: DefWithAttr = Definition 1767: [ '+' '(' ExtensionSeq ')' ] 1768: [ '-' '(' RestrictSeq ')' ] 1769: [ 'WITH' FixedAttrSeq ] . 1770: ExtensionSeq = ExtensionElem < ',' ExtensionElem > . 1771: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' / 1772: 'SYMBOL' / 'PICTURE' . 1773: RestrictSeq = RestrictElem < ',' RestrictElem > . 1774: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' / 1.18 cvs 1775: 'SYMBOL' / 'PICTURE' .</pre> 1776: <p> 1.1 cvs 1777: The list of fixed-value attributes is composed of a sequence of 1778: attribute-value pairs separated by commas. Each pair contains the name of the 1779: attribute and the fixed value for this element type, the two being separated 1780: by an equals sign. If the sign is preceded by a question mark the given value 1781: is only an initial value that may be modified later rather than a value fixed 1782: for all time. Reference attributes are an exception to this norm. They 1783: cannot be assigned a fixed value, but when the name of such an attribute 1784: appears this indicates that this element type must have a valid value for the 1.2 cvs 1785: attribute. For the other attribute types, the fixed value is indicated by a 1.1 cvs 1786: signed integer (numeric attributes), a character string between apostrophes 1.18 cvs 1787: (textual attributes) or the name of a value (enumeration attributes).</p> 1788: <p> 1789: Fixed-value attributes can either be <a href="#sectc325">global</a> or local 1.1 cvs 1790: to the element type for which they are fixed, but they must be declared before 1.18 cvs 1791: they are used.</p> 1792: <pre> FixedAttrSeq = FixedAttr < ',' FixedAttr > . 1.1 cvs 1793: FixedAttr = AttrID [ FixedOrModifVal ] . 1794: FixedOrModifVal = [ '?' ] '=' FixedValue . 1795: FixedValue = [ '-' ] NumValue / TextVal / AttrVal . 1796: NumValue = NUMBER . 1.18 cvs 1797: TextVal = STRING .</pre> 1798: </div> 1.1 cvs 1799: 1.18 cvs 1800: <div class="subsection"> 1.1 cvs 1801: 1.18 cvs 1802: <h3><a name="sectc328">Structure definitions</a></h3> 1803: <p> 1.1 cvs 1804: The structure of an element type can be a simple base type or a constructed 1.18 cvs 1805: type.</p> 1806: <p> 1.1 cvs 1807: For constructed types, it is frequently the case that similar structures 1808: appear in many places in a document. For example the contents of the 1809: abstract, of the introduction, and of a section can have the same structure, 1810: that of a sequence of paragraphs. In this case, a single, common structure 1811: can be defined (the paragraph sequence in this example), and the schema is 1812: written to indicate that each element type possesses this structure, as 1.18 cvs 1813: follows:</p> 1814: <pre> Abstract = Paragraph_sequence; 1.1 cvs 1815: Introduction = Paragraph_sequence; 1.18 cvs 1816: Section_contents = Paragraph_sequence;</pre> 1817: <p> 1818: The equals sign means ``has the same structure as''.</p> 1819: <p> 1.1 cvs 1820: If the element type defined is a simple base type, this is indicated by one of 1.18 cvs 1821: the keywords <tt>TEXT</tt>, <tt>GRAPHICS</tt>, <tt>SYMBOL</tt>, or 1822: <tt>PICTURE</tt>. If some local attributes must be associated with a base 1.1 cvs 1823: type, the keyword of the base type is followed by the declaration of the local 1.18 cvs 1824: attributes using the syntax <a href="#sectc327">presented above.</a></p> 1825: <p> 1.1 cvs 1826: In the case of an open choice, the type is indicated by the keyword 1.18 cvs 1827: <tt>UNIT</tt> for units or the keyword <tt>NATURE</tt> for objects having a 1828: structure defined by any other schema.</p> 1829: <p> 1830: A unit represents one of the two following categories:</p> 1831: <ul> 1832: <li> 1833: a base type: text, graphical element, symbol, picture, 1.19 cvs 1834: </li> 1.18 cvs 1835: <li> 1836: an element whose type is chosen from among the types defined as units in the 1837: <tt>UNITS</tt> section of the document's structure schema. It can also be 1838: chosen from among the types defined as <a href="#sectd3132">units</a> in the 1839: <a href="#sectc3212"><tt>UNITS</tt> section</a> of the structure schemas that 1.2 cvs 1840: defines the ancestors of the element to which the rule is applied. 1.19 cvs 1841: </li> 1.18 cvs 1842: </ul> 1843: <p> 1.2 cvs 1844: Before the creation of an element defined as a unit, Thot asks the user to 1.18 cvs 1845: choose between the categories of elements.</p> 1846: <p> 1.1 cvs 1847: Thus, the contents of a paragraph can be specified as a sequence of units, 1848: which will permit the inclusion in the paragraphs of character strings, 1849: symbols, and various elements, such as cross-references, if these are defined 1.18 cvs 1850: as units.</p> 1851: <p> 1852: A schema object (keyword <tt>NATURE</tt>) represents an object defined by a 1.1 cvs 1853: structure schema freely chosen from among the available schemas; in the case 1854: the element type is defined by the first rule (the root rule) of the chosen 1.18 cvs 1855: schema.</p> 1856: <p> 1.1 cvs 1857: If the element type defined is a constructed type, the list, aggregate, 1858: choice, and reference constructors are used. In this case the definition 1859: begins with a keyword identifying the constructor. This keyword is followed 1.18 cvs 1860: by a syntax specific to each constructor.</p> 1861: <p> 1.1 cvs 1862: The local attribute definitions appear after the name of the element type 1.18 cvs 1863: being defined, if this element type has <a href="#sectc327">local 1864: attributes</a>.</p> 1865: <pre> Definition = BaseType [ LocAttrSeq ] / Constr / Element . 1.1 cvs 1866: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 'PICTURE' / 1867: 'UNIT' / 'NATURE' . 1868: Element = ElemID [ ExtOrDef ] . 1869: ExtOrDef = 'EXTERN' / 'INCLUDED' / 1870: [ LocAttrSeq ] '=' Definition . 1871: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF' 1872: '(' DefWithAttr ')' / 1873: 'BEGIN' DefOptSeq 'END' / 1874: 'AGGREGATE' DefOptSeq 'END' / 1875: 'CASE' 'OF' DefSeq 'END' / 1876: 'REFERENCE' '(' RefType ')' / 1.18 cvs 1877: 'PAIR' .</pre> 1.1 cvs 1878: 1.18 cvs 1879: <div class="subsubsection"> 1.1 cvs 1880: 1.18 cvs 1881: <h4><a name="sectd3281">List</a></h4> 1882: <p> 1.1 cvs 1883: The list constructor permits the definition of an element type composed of a 1884: list of elements, all of the same type. A list definition begins with the 1.18 cvs 1885: <tt>LIST</tt> keyword followed by an optional range, the keyword <tt>OF</tt>, 1.1 cvs 1886: and the definition, between parentheses, of the element type which must 1887: compose the list. The optional range is composed of the minimum and maximum 1888: number of elements for the list separated by two periods and enclosed by 1889: brackets. If the range is not present, the number of list elements is 1890: unconstrained. When only one of the two bounds of the range is unconstrained, 1891: it is represented by a star ('*') character. Even when both bounds are 1.18 cvs 1892: unconstrained, they can be specified by <tt>[*..*]</tt>, but it is simpler not 1893: to specify any bound.</p> 1894: <pre> 'LIST' [ '[' min '..' max ']' ] 1.1 cvs 1895: 'OF' '(' DefWithAttr ')' 1896: min = Integer / '*' . 1897: max = Integer / '*' . 1.18 cvs 1898: Integer = NUMBER .</pre> 1899: <p> 1.2 cvs 1900: Before the document is edited, Thot creates the minimum number of elements for 1901: the list. If no minimum was given, it creates a single element. If a maximum 1902: number of elements is given and that number is attained, the editor refuses to 1.18 cvs 1903: create new elements for the list.</p> 1904: <blockquote class="example"> 1905: <p> 1906: <strong>Example:</strong></p> 1907: <p> 1.3 cvs 1908: The following two instructions define the body of a document as a sequence of 1909: at least two chapters and the contents of a section as a sequence of 1.18 cvs 1910: paragraphs. A single paragraph can be the entire contents of a section.</p> 1911: <pre>Body = LIST [2..*] OF (Chapter); 1912: Section_contents = LIST OF (Paragraph);</pre> 1913: </blockquote> 1914: </div> 1.1 cvs 1915: 1.18 cvs 1916: <div class="subsubsection"> 1.1 cvs 1917: 1.18 cvs 1918: <h4><a name="sectd3282">Aggregate</a></h4> 1919: <p> 1.1 cvs 1920: The aggregate constructor is used to define an element type as a collection of 1921: sub-elements, each having a fixed type. The collection may be ordered or 1922: unordered. The elements composing the collection are called 1.18 cvs 1923: <em>components</em>. In the definition of an aggregate, a keyword indicates 1924: whether or not the aggregate is ordered: <tt>BEGIN</tt> for an ordered 1925: aggregate, <tt>AGGREGATE</tt> for an unordered aggregate. This keyword is 1.1 cvs 1926: followed by the list of component type definitions which is terminated by the 1.18 cvs 1927: <tt>END</tt> keyword. The component type definitions are separated by 1928: commas.</p> 1929: <p> 1.1 cvs 1930: Before creating an aggregate, the Thot editor creates all the aggregate's 1931: components in the order they appear in the structure schema, even for 1932: unordered aggregates. However, unlike ordered aggregates, the components of 1933: an unordered aggregate may be rearranged using operations of the Thot editor. 1934: The exceptions to the rule are any components whose name was preceded by a 1935: question mark character ('?'). These components, which are optional, can be 1936: created by explicit request, possibly at the time the aggregate is created, 1.18 cvs 1937: but they are not created automatically <em>prior</em> to the creation of the 1938: aggregate.</p> 1939: <pre> 'BEGIN' DefOptSeq 'END' 1.1 cvs 1940: DefOptSeq = DefOpt ';' < DefOpt ';' > . 1.18 cvs 1941: DefOpt = [ '?' ] DefWithAttr .</pre> 1942: <blockquote class="example"> 1943: <p> 1944: <strong>Example:</strong></p> 1945: <p> 1.3 cvs 1946: In a bilingual document, each paragraph has an English version and a French 1947: version. In certain cases, the translator wants to add a marginal note, but 1948: this note is present in very few paragraphs. Thus, it must not be created 1949: systematically for every paragraph. A bilingual paragraph of this type is 1.18 cvs 1950: declared:</p> 1951: <pre>Bilingual_paragraph = BEGIN 1.1 cvs 1952: French_paragraph = TEXT; 1953: English_paragraph = TEXT; 1954: ? Note = TEXT; 1.18 cvs 1955: END;</pre> 1956: </blockquote> 1957: </div> 1.1 cvs 1958: 1.18 cvs 1959: <div class="subsubsection"> 1.1 cvs 1960: 1.18 cvs 1961: <h4><a name="sectd3283">Choice</a></h4> 1962: <p> 1.1 cvs 1963: The choice constructor permits the definition of an element type which is 1.18 cvs 1964: chosen from among a set of possible types. The keywords <tt>CASE</tt> and 1965: <tt>OF</tt> are followed by a list of definitions of possible types, which are 1966: separated by semicolons and terminated by the <tt>END</tt> keyword.</p> 1967: <pre> 'CASE' 'OF' DefSeq 'END' 1968: DefSeq = DefWithAttr ';' < DefWithAttr ';' > .</pre> 1969: <p> 1.1 cvs 1970: Before the creation of an element defined as a choice, the Thot editor 1971: presents the list of possible types for the element to the user. The user has 1.18 cvs 1972: only to select the element type that s/he wants to create from this list.</p> 1973: <p> 1.1 cvs 1974: The order of the type declarations is important. It determines the order of 1975: the list presented to the user before the creation of the element. Also, when 1976: a Choice element is being created automatically, the first type in the list is 1977: used. In fact, using the Thot editor, when an empty Choice element is 1978: selected, it is possible to select this element and to enter its text from 1979: keyboard. In this case, the editor uses the first element type which can 1.18 cvs 1980: contain an atom of the character string type.</p> 1981: <p> 1982: The two special cases of the choice constructor, the <a 1983: href="#sectc328"><em>schema</em></a> and the <a 1984: href="#sectc3212"><em>unit</em></a> are discussed elsewhere.</p> 1985: <blockquote class="example"> 1986: <p> 1987: <strong>Example:</strong></p> 1988: <p> 1.3 cvs 1989: It is common in documents to treat a variety of objects as if they were 1990: ordinary paragraphs. Thus, a ``Paragraph'' might actually be composed of a 1991: block of text (an ordinary paragraph), or a mathematical formula whose 1992: structure is defined by another structure schema named Math, or a table, also 1993: defined by another structure schema. Here is a definition of such a 1.18 cvs 1994: paragraph:</p> 1995: <pre>Paragraph = CASE OF 1.1 cvs 1996: Simple_text = TEXT; 1997: Formula = Math; 1998: Table_para = Table; 1.18 cvs 1999: END;</pre> 2000: </blockquote> 2001: </div> 1.1 cvs 2002: 1.18 cvs 2003: <div class="subsubsection"> 1.1 cvs 2004: 1.18 cvs 2005: <h4><a name="sectd3284">Reference</a></h4> 2006: <p> 1.1 cvs 2007: Like all elements in Thot, references are typed. An element type defined as a 2008: reference is a cross-reference to an element of some other given type. The 1.18 cvs 2009: keyword <tt>REFERENCE</tt> is followed by the name of a type enclosed in 1.1 cvs 2010: parentheses. When the type which is being cross-referenced is defined in 2011: another structure schema, the type name is itself followed by the name of the 1.18 cvs 2012: external structure schema in which it is defined.</p> 2013: <p> 2014: When the designated element type is a <a href="#sectd3285">mark pair</a>, it 2015: can be preceded by a <tt>FIRST</tt> or <tt>SECOND</tt> keyword. These 2016: keywords indicate whether the reference points to the first or second mark of 2017: the pair. If the reference points to a pair and neither of these two keywords 2018: is present, the reference is considered to point to the first mark of the 2019: pair.</p> 2020: <p> 1.1 cvs 2021: There is an exception to the principle of typed references: it is possible to 2022: define a reference which designates an element of any type, which can either 2023: be in the same document or another document. In this case, it suffices to put 1.18 cvs 2024: the keyword <tt>ANY</tt> in the parentheses which indicate the referenced 2025: element type.</p> 2026: <pre> 'REFERENCE' '(' RefType ')' 2027: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] .</pre> 2028: <p> 2029: When defining an inclusion, the <tt>REFERENCE</tt> keyword is not used. 1.1 cvs 2030: Inclusions with complete expansion are not declared as such in the structure 2031: schemas, since any element defined in a structure schema can be replaced by an 2032: element of the same type. Instead, inclusions without expansion or with 2033: partial expansion must be declared explicitly whenever they will include a 2034: complete object ( and not a part of an object). In this case, the object type 2035: to be included (that is, the name of its structure schema) is followed by a 1.18 cvs 2036: keyword: <tt>EXTERN</tt> for inclusion without expansion and <tt>INCLUDED</tt> 2037: for partial expansion.</p> 2038: <p> 1.1 cvs 2039: Before creating a cross-reference or an inclusion, the Thot editor asks the 2040: user to choose, from the document images displayed, the referenced or included 1.18 cvs 2041: element.</p> 2042: <blockquote class="example"> 2043: <p> 2044: <strong>Example:</strong></p> 2045: <p> 1.3 cvs 2046: If the types Note and Section are defined in the Article structure schema, it 2047: is possible to define, in the same structure schema, a reference to a note and 1.18 cvs 2048: a reference to a section in this manner:</p> 2049: <pre>Ref_note = REFERENCE (Note); 2050: Ref_section = REFERENCE (Section);</pre> 2051: <p> 1.1 cvs 2052: It is also possible to define the generic structure of a collection of 2053: articles, which include (with partial expansion) objects of the Article class 2054: and which possess an introduction which may include cross-references to 2055: sections of the included articles. In the Collection structure schema, the 1.18 cvs 2056: definitions are:</p> 2057: <pre>Collection = BEGIN 1.6 cvs 2058: Collection_title = TEXT; 2059: Introduction = LIST OF (Elem = CASE OF 1.1 cvs 2060: TEXT; 2061: Ref_sect; 2062: END); 1.6 cvs 2063: Body = LIST OF (Article INCLUDED); 2064: END; 1.18 cvs 2065: Ref_sect = REFERENCE (Section (Article));</pre> 2066: <p> 1.1 cvs 2067: Here we define a Folder document class which has a title and includes 1.18 cvs 2068: documents of different types, particularly Folders:</p> 2069: <pre>Folder = BEGIN 1.6 cvs 2070: Folder_title = TEXT; 2071: Folder_contents = LIST OF (Document); 2072: END; 1.1 cvs 2073: 2074: Document = CASE OF 2075: Article EXTERN; 2076: Collection EXTERN; 2077: Folder EXTERN; 1.18 cvs 2078: END;</pre> 2079: <p> 1.1 cvs 2080: Under this definition, Folder represents either an aggregate which contains a 2081: folder title and the list of included documents or an included folder. To 2082: resolve this ambiguity, in the P language, the placement of a star character 1.18 cvs 2083: in front of the type name (here, Folder) indicates an included document.</p> 2084: </blockquote> 2085: </div> 1.1 cvs 2086: 1.18 cvs 2087: <div class="subsubsection"> 1.1 cvs 2088: 1.18 cvs 2089: <h4><a name="sectd3285">Mark pairs</a></h4> 2090: <p> 1.1 cvs 2091: Like other elements, mark pairs are typed. The two marks of the pair have the 2092: same type, but there exist two predefined subtypes which apply to all mark 1.18 cvs 2093: pairs: the first mark of the pair (called <tt>First</tt> in the P and T 2094: languages) and the second mark (called <tt>Second</tt>).</p> 2095: <p> 2096: In the S language, a mark pair is noted simply by the <tt>PAIR</tt> 2097: keyword.</p> 2098: <p> 1.1 cvs 2099: In the Thot editor, marks are always moved or destroyed together. The two 2100: marks of a pair have the same identifier, unique within the document, which 1.18 cvs 2101: permits intertwining mark pairs without risk of ambiguity.</p> 2102: </div> 2103: </div> 1.1 cvs 2104: 1.18 cvs 2105: <div class="subsection"> 1.1 cvs 2106: 1.18 cvs 2107: <h3><a name="sectc329">Imports</a></h3> 2108: <p> 1.1 cvs 2109: Because of schema constructors, it is possible, before editing a document, to 2110: use classes defined by other structure schemas whenever they are needed. It is 2111: also possible to assign specific document classes to certain element types. In 2112: this case, these classes are simply designated by their name. In fact, if a 2113: type name is not defined in the structure schema, it is assumed that it 1.18 cvs 2114: specifies a structure defined by another structure schema.</p> 2115: <blockquote class="example"> 2116: <p> 2117: <strong>Example:</strong></p> 2118: <p> 1.3 cvs 2119: If the types Math and Table don't appear in the left part of a structure rule 2120: in the schema, the following two rules indicate that a formula has the 2121: structure of an object defined by the structure schema Math and that a table 1.18 cvs 2122: element has the structure of an object defined by the Table schema.</p> 2123: <pre>Formula = Math; 2124: Table_elem = Table;</pre> 2125: </blockquote> 2126: </div> 2127: 2128: <div class="subsection"> 2129: 2130: <h3><a name="sectc3210">Extension rules</a></h3> 2131: <p> 2132: The <tt>EXTENS</tt> section, which can only appear in an extension schema, 1.1 cvs 2133: defines complements to the rules in the primary schema (i.e. the structure 2134: schema to which the extension schema will be applied). More precisely, this 2135: section permits the addition to an existing type of local attributes, 1.18 cvs 2136: extensions, restrictions and fixed-value attributes.</p> 2137: <p> 1.1 cvs 2138: These additions can be applied to the root rule of the primary schema, 1.18 cvs 2139: designated by the keyword <tt>Root</tt>, or to any other explicitly named 2140: rule.</p> 2141: <p> 1.1 cvs 2142: Extension rules are separated from each other by a semicolon and each 1.18 cvs 2143: extension rule has the same syntax as a <a href="#sectc327">structure 2144: rule</a>, but the part which defines the constructor is absent.</p> 2145: <pre> ExtenRuleSeq = ExtensRule ';' < ExtensRule ';' > . 1.6 cvs 2146: ExtensRule = RootOrElem [ LocAttrSeq ] 2147: [ '+' '(' ExtensionSeq ')' ] 2148: [ '-' '(' RestrictSeq ')' ] 2149: [ 'WITH' FixedAttrSeq ] . 1.18 cvs 2150: RootOrElem = 'Root' / ElemID .</pre> 2151: </div> 1.1 cvs 2152: 1.18 cvs 2153: <div class="subsection"> 1.1 cvs 2154: 1.18 cvs 2155: <h3><a name="sectc3211">Associated elements</a></h3> 2156: <p> 1.1 cvs 2157: If associated elements are necessary, they must be declared in a specific 1.18 cvs 2158: section of the structure schema, introduced by the keyword <tt>ASSOC</tt>. 1.1 cvs 2159: Each associated element type is specified like any other structured element. 2160: However, these types must not appear in any other element types of the schema, 1.18 cvs 2161: except in <tt>REFERENCE</tt> rules.</p> 2162: </div> 1.1 cvs 2163: 1.18 cvs 2164: <div class="subsection"> 1.1 cvs 2165: 1.18 cvs 2166: <h3><a name="sectc3212">Units</a></h3> 2167: <p> 2168: The <tt>UNITS</tt> section of the structure schema contains the declarations 1.1 cvs 2169: of the element types which can be used in the external objects making up parts 2170: of the document or in objects of the class defined by the schema. As with 2171: associated elements, these element types are defined just like other 2172: structured element types. They can be used in the other element types of the 1.18 cvs 2173: schema, but they can also be used in any other rule of the schema.</p> 2174: <blockquote class="example"> 2175: <p> 2176: <strong>Example:</strong></p> 2177: <p> 2178: If references to notes are declared as units:</p> 2179: <pre>UNITS 2180: Ref_note = REFERENCE (Note);</pre> 2181: <p> 1.3 cvs 2182: then it is possible to use references to notes in a cell of a table, even when 1.18 cvs 2183: <tt>Table</tt> is an external structure schema. The <tt>Table</tt> schema 2184: must declare a cell to be a sequence of units, which can then be base element 2185: types (text, for example) or references to notes in the document.</p> 2186: <pre>Cell = LIST OF (UNITS);</pre> 2187: </blockquote> 2188: </div> 1.1 cvs 2189: 1.18 cvs 2190: <div class="subsection"> 1.1 cvs 2191: 1.18 cvs 2192: <h3><a name="sectc3213">Skeleton elements</a></h3> 2193: <p> 1.1 cvs 2194: When editing a document which contains or must contain external references to 2195: several other documents, it may be necessary to load a large number of 2196: documents, simply to see the parts designated by the external references of 2197: the document while editing, or to access the source of included elements. In 2198: this case, the external documents are not modified and it is only necessary to 2199: see the elements of these documents which could be referenced. Because of 2200: this, the editor will suggest that the documents be loaded in ``skeleton'' 2201: form. This form contains only the elements of the document explicitly 1.18 cvs 2202: mentioned in the <tt>EXPORT</tt> section of their structure schema and, for 1.1 cvs 2203: these elements, only the part of the contents specified in that section. This 2204: form has the advantage of being very compact, thus requiring very few 2205: resources from the editor. This is also the skeleton form which constitutes 1.18 cvs 2206: the expanded form of <a href="#inclusion">inclusions</a> with partial 2207: expansion.</p> 2208: <p> 2209: Skeleton elements must be declared explicitly in the <tt>EXPORT</tt> section 1.1 cvs 2210: of the structure schema that defines them. This section begins with the 1.18 cvs 2211: keyword <tt>EXPORT</tt> followed by a comma-separated list of the element 1.1 cvs 2212: types which must appear in the skeleton form and ending with a semicolon. 1.18 cvs 2213: These types must have been previously declared in the schema.</p> 2214: <p> 1.1 cvs 2215: For each skeleton element type, the part of the contents which is loaded by 2216: the editor, and therefore displayable, can be specified by putting the keyword 1.18 cvs 2217: <tt>WITH</tt> and the name of the contained element type to be loaded after 1.1 cvs 2218: the name of the skeleton element type. In this case only that named element, 2219: among all the elements contained in the exportable element type, will be 1.18 cvs 2220: loaded. If the <tt>WITH</tt> is absent, the entire contents of the skeleton 1.1 cvs 2221: element will be loaded by the editor. If instead, it is better that the 2222: skeleton form not load the contents of a particular element type, the keyword 1.18 cvs 2223: <tt>WITH</tt> must be followed by the word <tt>Nothing</tt>.</p> 2224: <pre> [ 'EXPORT' SkeletonSeq ] 1.1 cvs 2225: 2226: SkeletonSeq = SkelElem < ',' SkelElem > ';' . 2227: SkelElem = ElemID [ 'WITH' Contents ] . 1.18 cvs 2228: Contents = 'Nothing' / ElemID [ ExtStruct ] .</pre> 2229: <blockquote class="example"> 2230: <p> 2231: <strong>Example:</strong></p> 2232: <p> 1.3 cvs 2233: Suppose that, in documents of the article class, the element types 2234: Article_title, Figure, Section, Paragraph, and Biblio should appear in the 2235: skeleton form in order to make it easier to create external references to them 2236: from other documents. When loading an article in its skeleton form, all of 2237: these element types will be loaded except for paragraphs, but only the article 1.18 cvs 2238: title will be loaded in its entirety. For figures, the caption will be 2239: loaded, while for sections, the title will be loaded, and for bibliographic 2240: entries, only the title that they contain will be loaded. Note that 1.3 cvs 2241: bibliographic elements are defined in another structure schema, RefBib. To 2242: produce this result, the following declarations should be placed in the 1.18 cvs 2243: Article structure schema:</p> 2244: <pre>EXPORT 1.1 cvs 2245: Article_title, 1.5 cvs 2246: Figure With Caption, 1.1 cvs 2247: Section With Section_title, 2248: Paragraph With Nothing, 1.18 cvs 2249: Biblio With Biblio_title(RefBib);</pre> 2250: </blockquote> 2251: </div> 1.1 cvs 2252: 1.18 cvs 2253: <div class="subsection"> 1.1 cvs 2254: 1.18 cvs 2255: <h3><a name="sectc3214">Exceptions</a></h3> 2256: <p> 1.1 cvs 2257: The behavior of the Thot editor and the actions that it performs are 2258: determined by the structure schemas. These actions are applied to all 2259: document and object types in accordance with their generic structure. For 2260: certain object types, such as tables and graphics, these actions are not 2261: sufficient or are poorly adapted and some special actions must be added to or 2262: substituted for certain standard actions. These special actions are called 1.18 cvs 2263: <em>exceptions</em>.</p> 2264: <p> 1.1 cvs 2265: Exceptions only inhibit or modify certain standard actions, but they can be 1.18 cvs 2266: used freely in every structure schema.</p> 2267: <p> 1.1 cvs 2268: Each structure schema can contain a section defining exceptions. It begins 1.18 cvs 2269: with the keyword <tt>EXCEPT</tt> and is composed of a sequence of exception 1.1 cvs 2270: declarations, separated by semicolons. Each declaration of an exception 2271: begins with the name of an element type or attribute followed by a colon. This 2272: indicates the element type or attribute to which the following exceptions 1.18 cvs 2273: apply. When the given element type name is a <a href="#sectd3285">mark 2274: pair</a>, and only in this case, the type name can be preceded by the keyword 2275: <tt>First</tt> or <tt>Second</tt>, to indicate if the exceptions which follow 1.1 cvs 2276: are associated with the first mark of the pair or the second. In the absence 1.18 cvs 2277: of this keyword, the first mark is used.</p> 2278: <p> 2279: When placed in an <a href="#sectc322">extension schema</a>, the keyword 2280: <tt>EXTERN</tt> indicates that the type name which follows is found in the 1.1 cvs 2281: principal schema (the schema being extended by the extension schema). The 1.18 cvs 2282: exceptions are indicated by a name. They are separated by semicolons.</p> 2283: <pre> [ 'EXCEPT' ExceptSeq ] 1.1 cvs 2284: 2285: ExceptSeq = Except ';' < Except ';' > . 2286: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr 2287: ':' ExcValSeq . 2288: ExcTypeOrAttr = ElemID / AttrID . 2289: ExcValSeq = ExcValue < ',' ExcValue > . 1.19 cvs 2290: ExcValue ='NoCut' / 'NoCreate' / 'NoHMove' / 2291: 'NoVMove' / 'NoHResize' / 'NoVResize' / 2292: 'NoMove' / 'NoResize' / 'MoveResize' / 2293: 'NewWidth' / 'NewHeight' / 'NewHPos' / 2294: 'NewVPos' / 'Invisible' / 1.28 ! cvs 2295: 'NoSelect' / 'NoSpellCheck' / 1.1 cvs 2296: 'Hidden' / 'ActiveRef' / 2297: 'ImportLine' / 'ImportParagraph' / 2298: 'NoPaginate' / 'ParagraphBreak' / 1.19 cvs 2299: 'PageBreak' / 'PageBreakAllowed' / 'PageBreakPlace' / 2300: 'PageBreakRepetition' / 'PageBreakRepBefore' / 1.9 cvs 2301: 'HighlightChildren' / 'ExtendedSelection' / 1.19 cvs 2302: 'ReturnCreateNL' / 'IsDraw' / 'IsTable' / 2303: 'IsRow' / 'IsColHead' / 'IsCell' / 2304: 'NewPercentWidth' / 'ColRef' / 'ColSpan' / 2305: 'RowSpan' / 'SaveDocument' / 'Shadow' .</pre> 1.18 cvs 2306: <p> 2307: The following are the available exceptions:</p> 2308: <dl> 2309: <dt><tt>NoCut</tt></dt> 2310: <dd> 2311: This exception can only be applied to element types. Elements of a type to 1.13 cvs 2312: which this exception is applied cannot be deleted by the editor. 1.18 cvs 2313: </dd> 2314: <dt><tt>NoCreate</tt></dt> 2315: <dd> 2316: This exception can only be applied to element types. Elements of a type to 1.2 cvs 2317: which this exception is applied cannot be created by ordinary commands for 2318: creating new elements. These elements are usually created by special actions 1.13 cvs 2319: associated with other exceptions. 1.18 cvs 2320: </dd> 2321: <dt><tt>NoHMove</tt></dt> 2322: <dd> 2323: This exception can only be applied to element types. Elements of a type to 2324: which this exception is applied cannot be moved horizontally with the mouse. 2325: Their children elements cannot be moved either. 2326: </dd> 2327: <dt><tt>NoVMove</tt></dt> 2328: <dd> 2329: This exception can only be applied to element types. Elements of a type to 2330: which this exception is applied cannot be moved vertically with the mouse. 2331: Their children elements cannot be moved either. 2332: </dd> 2333: <dt><tt>NoMove</tt></dt> 2334: <dd> 2335: This exception can only be applied to element types. Elements of a type to 1.2 cvs 2336: which this exception is applied cannot be moved in any direction with the 1.13 cvs 2337: mouse. Their children elements cannot be moved either. 1.18 cvs 2338: </dd> 2339: <dt><tt>NoHResize</tt></dt> 2340: <dd> 2341: This exception can only be applied to element types. Elements of a type to 2342: which this exception is applied cannot be resized horizontally with the mouse. 2343: Their children elements cannot be resized either. 2344: </dd> 2345: <dt><tt>NoVResize</tt></dt> 2346: <dd> 2347: This exception can only be applied to element types. Elements of a type to 2348: which this exception is applied cannot be resized vertically with the mouse. 2349: Their children elements cannot be resized either. 2350: </dd> 2351: <dt><tt>NoResize</tt></dt> 2352: <dd> 2353: This exception can only be applied to element types. Elements of a type to 1.2 cvs 2354: which this exception is applied cannot be resized in any direction with the 1.13 cvs 2355: mouse. Their children elements cannot be resized either. 1.18 cvs 2356: </dd> 2357: <dt><tt>MoveResize</tt></dt> 2358: <dd> 2359: This exception can only be applied to element types. Elements of a type to 2360: which this exception is applied can be moved and resized in any direction with 2361: the mouse, even if one of their ancestor element has an exception that 1.13 cvs 2362: prevents moving or resizing. Their children elements can also be resized or 2363: moved. 1.18 cvs 2364: </dd> 2365: <dt><tt>NewWidth</tt></dt> 2366: <dd> 2367: This exception can only be applied to numeric attributes. If the width of an 2368: element which has this attribute is modified with the mouse, the value of the 2369: new width will be assigned to the attribute. 2370: </dd> 2371: <dt><tt>NewHeight</tt></dt> 2372: <dd> 2373: This exception can only be applied to numeric attributes. If the height of an 2374: element which has this attribute is modified with the mouse, the value of the 2375: new height will be assigned to the attribute. 2376: </dd> 2377: <dt><tt>NewHPos</tt></dt> 2378: <dd> 2379: This exception can only be applied to numeric attributes. If the horizontal 2380: position of an element which has this attribute is modified with the mouse, 2381: the value of the new horizontal position will be assigned to the attribute. 2382: </dd> 2383: <dt><tt>NewVPos</tt></dt> 2384: <dd> 2385: This exception can only be applied to numeric attributes. If the vertical 2386: position of an element which has this attribute is modified with the mouse, 2387: the value of the new vertical position will be assigned to the attribute. 2388: </dd> 2389: <dt><tt>Invisible</tt></dt> 2390: <dd> 2391: This exception can only be applied to attributes, but can be applied to all 1.2 cvs 2392: attribute types. It indicates that the attribute must not be seen by the user 2393: and that its value must not be changed directly. This exception is usually 1.5 cvs 2394: used when another exception manipulates the value of an attribute. 1.18 cvs 2395: </dd> 1.19 cvs 2396: <dt><tt>NoSelect</tt></dt> 2397: <dd> 2398: This exception can only be applied to element types. Elements of a type to 2399: which this exception is applied cannot be selected directly with the mouse, 2400: but they can be selected by other methods provided by the editor. 2401: </dd> 2402: <dt>NoSpellCheck</dt> 2403: <dd> 2404: This exception can only be applied to element types. Elements of a type to 2405: which this exception is applied are not taken into account by the spell 2406: checker. 2407: </dd> 1.18 cvs 2408: <dt><tt>Hidden</tt></dt> 2409: <dd> 2410: This exception can only be applied to element types. It indicates that 1.2 cvs 2411: elements of this type, although present in the document's structure, must not 1.18 cvs 2412: be shown to the user of the editor. In particular, the creation menus must 2413: not propose this type and the selection message must not pick it. 2414: </dd> 2415: <dt><tt>ActiveRef</tt></dt> 2416: <dd> 2417: This exception can only be applied to attributes of the reference type. It 1.2 cvs 2418: indicates that when the user of the editor makes a double click on an element 2419: which possesses a reference attribute having this exception, the element 2420: designated by the reference attribute will be selected. 1.18 cvs 2421: </dd> 2422: <dt><tt>ImportLine</tt></dt> 2423: <dd> 2424: This exception can only be applied to element types. It indicates that 1.2 cvs 2425: elements of this type should receive the content of imported text files. An 2426: element is created for each line of the imported file. A structure schema 1.18 cvs 2427: cannot contain several exceptions <tt>ImportLine</tt> and, if it contains one, 2428: it should not contain any exception <tt>ImportParagraph</tt>. 2429: </dd> 2430: <dt><tt>ImportParagraph</tt></dt> 2431: <dd> 2432: This exception can only be applied to element types. It indicates that 1.2 cvs 2433: elements of this type should receive the content of imported text files. An 2434: element is created for each paragraph of the imported file. A paragraph is a 2435: sequence of lines without any empty line. A structure schema cannot contain 1.18 cvs 2436: several exceptions <tt>ImportParagraph</tt> and, if it contains one, it should 2437: not contain any exception <tt>ImportLine</tt>. 2438: </dd> 2439: <dt><tt>NoPaginate</tt></dt> 2440: <dd> 2441: This exception can only be applied to the root element, i.e. the name that 2442: appear after the keyword <tt>STRUCTURE</tt> at the beginning of the structure 1.2 cvs 2443: schema. It indicates that the editor should not allow the user to paginate 1.1 cvs 2444: documents of that type. 1.18 cvs 2445: </dd> 2446: <dt><tt>ParagraphBreak</tt></dt> 2447: <dd> 2448: This exception can only be applied to element types. When the caret is within 2449: an element of a type to which this exception is applied, it is that element 2450: that will be split when the user hits the Return key. 2451: </dd> 2452: <dt><tt>ReturnCreateNL</tt></dt> 2453: <dd> 2454: This exception can only be applied to element types. When the caret is within 2455: an element of a type to which this exception is applied, the Return key simply 2456: inserts a New line character (code \212) at the current position. The Return 2457: key does not create a new element; it does not split the current element 2458: either. 2459: </dd> 2460: <dt><tt>HighlightChildren</tt></dt> 2461: <dd> 2462: This exception can only be applied to element types. Elements of a type to 1.2 cvs 2463: which this exception is applied are not highlighted themselves when they are 2464: selected, but all their children are highlighted instead. 1.18 cvs 2465: </dd> 2466: <dt><tt>ExtendedSelection</tt></dt> 2467: <dd> 2468: This exception can only be applied to element types. The selection extension 2469: command (middle button of the mouse) only add the clicked element (if it has 2470: that exception) to the current selection, without selecting other elements 2471: between the current selection and the clicked element. 2472: </dd> 1.19 cvs 2473: <dt>IsDraw, IsTable, IsColHead, IsRow, IsCell</dt> 2474: <dd> 2475: These exceptions can only be applied to element types. Elements of a type to 2476: which these exceptions are applied are identified as Draws, Tables, Colheads, 2477: Rows or Cells and specific processing are applied to them. 2478: </dd> 2479: <dt>ColRef</dt> 2480: <dd> 2481: This exception can only be applied to attributes of the reference type. It 2482: indicates that this attribute refers to the column head (see exception 2483: IsColHead) which the element belongs to. 2484: </dd> 2485: <dt>ColSpan, RowSpan</dt> 2486: <dd> 2487: These exceptions can only be applied to numeric attributes of cells. They 2488: indicate that attribute values give how many columns or rows the element 1.20 cvs 2489: spans. 1.19 cvs 2490: </dd> 2491: <dt>Shadow</dt> 2492: <dd> 2493: This exception can only be applied to element types. Text of elements of a 2494: type to which this exception is applied are displayed and printed as a set of 2495: stars ('*'). 2496: </dd> 1.18 cvs 2497: </dl> 2498: <blockquote class="example"> 2499: <p> 2500: <strong>Example:</strong></p> 2501: <p> 1.3 cvs 2502: Consider a structure schema for object-style graphics which defines the 1.18 cvs 2503: Graphic_object element type with the associated Height and Weight numeric 2504: attributes. Suppose that we want documents of this class to have the 2505: following qualities:</p> 2506: <ul> 2507: <li> 2508: Whenever the width or height of an object is changed using the mouse, the new 2509: values are stored in the object's Width and Height attributes. 1.19 cvs 2510: </li> 1.18 cvs 2511: <li> 2512: The user should not be able to change the values of the Width and Height 1.5 cvs 2513: attributes via the Attributes menu of the Thot editor. 1.19 cvs 2514: </li> 1.18 cvs 2515: </ul> 2516: <p> 2517: The following exceptions will produce this effect.</p> 2518: <pre>STRUCT 1.1 cvs 2519: ... 1.5 cvs 2520: Graphics_object (ATTR Height = Integer; Width = Integer) 1.1 cvs 2521: = GRAPHICS with Height ?= 10, Width ?= 10; 2522: ... 2523: EXCEPT 2524: Height: NewHeight, Invisible; 1.18 cvs 2525: Width: NewWidth, Invisible;</pre> 2526: </blockquote> 2527: </div> 2528: </div> 1.1 cvs 2529: 1.18 cvs 2530: <div class="section"> 1.1 cvs 2531: 1.18 cvs 2532: <h2><a name="sectb33">Some examples</a></h2> 2533: <p> 1.1 cvs 2534: In order to illustrate the principles of the document model and the syntax of 2535: the S language, this section presents two examples of structure schemas. One 1.18 cvs 2536: defines a class of documents, the other defines a class of objects.</p> 1.1 cvs 2537: 1.18 cvs 2538: <div class="subsection"> 1.1 cvs 2539: 1.18 cvs 2540: <h3><a name="sectc331">A class of documents: articles</a></h3> 2541: <p> 1.1 cvs 2542: This example shows a possible structure for articles published in a journal. 1.18 cvs 2543: Text between braces is comments.</p> 2544: <pre>STRUCTURE Article; { This schema defines the Article class } 1.1 cvs 2545: DEFPRES ArticleP; { The default presentation schema is 2546: ArticleP } 2547: ATTR { Global attribute definitions } 2548: WordType = Definition, IndexWord, DocumentTitle; 2549: { A single global attribute is defined, with three values } 2550: STRUCT { Definition of the generic structure } 2551: Article = BEGIN { The Article class has an aggregate 2552: structure } 2553: Title = BEGIN { The title is an aggregate } 2554: French_title = 2555: Text WITH Language='Fran\347ais'; 2556: English_title = 2557: Text WITH Language='English'; 2558: END; 2559: Authors = 2560: LIST OF (Author 2561: (ATTR Author_type=principal,secondary) 2562: { The Author type has a local attribute } 2563: = BEGIN 2564: Author_name = Text; 2565: Info = Paragraphs ; 2566: { Paragraphs is defined later } 2567: Address = Text; 2568: END 2569: ); 2570: Keywords = Text; 2571: { The journal's editor introduces the article 2572: with a short introduction, in French and 2573: in English } 2574: Introduction = 2575: BEGIN 2576: French_intr = Paragraphs WITH 2577: Language='Fran\347ais'; 2578: English_intr = Paragraphs WITH 2579: Language='English'; 2580: END; 2581: Body = Sections; { Sections are defined later } 2582: { Appendixes are only created on demand } 2583: ? Appendices = 2584: LIST OF (Appendix = 2585: BEGIN 2586: Appendix_Title = Text; 2587: Appendix_Contents = Paragraphs; 2588: END 2589: ); 2590: END; { End of the Article aggregate } 2591: 2592: Sections = LIST [2..*] OF ( 2593: Section = { At least 2 sections } 2594: BEGIN 2595: Section_title = Text; 2596: Section_contents = 2597: BEGIN 2598: Paragraphs; 2599: Sections; { Sections at a lower level } 2600: END; 2601: END 2602: ); 2603: 2604: Paragraphs = LIST OF (Paragraph = CASE OF 2605: Enumeration = 2606: LIST [2..*] OF 2607: (Item = Paragraphs); 2608: Isolated_formula = Formula; 2609: LIST OF (UNIT); 2610: END 2611: ); 2612: 2613: ASSOC { Associated elements definitions } 2614: 2615: Figure = BEGIN 1.5 cvs 2616: Figure_caption = Text; 1.1 cvs 2617: Illustration = NATURE; 2618: END; 2619: 2620: Biblio_citation = CASE OF 2621: Ref_Article = 2622: BEGIN 2623: Authors_Bib = Text; 2624: Article_Title = Text; 2625: Journal = Text; 2626: Page_Numbers = Text; 2627: Date = Text; 2628: END; 2629: Ref_Livre = 2630: BEGIN 2631: Authors_Bib; { Defined above } 2632: Book_Title = Text; 2633: Editor = Text; 2634: Date; { Defined above } 2635: END; 2636: END; 2637: 2638: Note = Paragraphs - (Ref_note); 2639: 2640: UNITS { Elements which can be used in objects } 2641: 2642: Ref_note = REFERENCE (Note); 2643: Ref_biblio = REFERENCE (Biblio_citation); 2644: Ref_figure = REFERENCE (Figure); 2645: Ref_formula = REFERENCE (Isolated_formula); 2646: 2647: EXPORT { Skeleton elements } 2648: 2649: Title, 1.5 cvs 2650: Figure with Figure_caption, 1.1 cvs 2651: Section With Section_title; 2652: 1.18 cvs 2653: END { End of the structure schema }</pre> 2654: <p> 1.1 cvs 2655: This schema is very complete since it defines both paragraphs and 2656: bibliographic citations. These element types could just as well be defined in 1.18 cvs 2657: other structure schemas, as is the case with the <tt>Formula</tt> class. All 1.1 cvs 2658: sorts of other elements can be inserted into an article, since a paragraph can 2659: contain any type of unit. Similarly, figures can be any class of document or 1.18 cvs 2660: object that the user chooses.</p> 2661: <p> 1.1 cvs 2662: Generally, an article doesn't contain appendices, but it is possible to add 2663: them on explicit request: this is the effect of the question mark before the 1.18 cvs 2664: word Appendices.</p> 2665: <p> 1.1 cvs 2666: The Figure, Biblio_citation and Note elements are associated elements. Thus, 1.18 cvs 2667: they are only used in <tt>REFERENCE</tt> statements.</p> 2668: <p> 1.1 cvs 2669: Various types of cross-references can be put in paragraphs. They can also be 2670: placed the objects which are part of the article, since the cross-references 1.18 cvs 2671: are defined as units (<tt>UNITS</tt>).</p> 2672: <p> 1.1 cvs 2673: There is a single restriction to prevent the creation of Ref_note elements 1.18 cvs 2674: within notes.</p> 2675: <p> 1.1 cvs 2676: It is worth noting that the S language permits the definition of recursive 2677: structures like sections: a section can contain other sections (which are thus 2678: at the next lower level of the document tree). Paragraphs are also recursive 2679: elements, since a paragraph can contain an enumeration in which each element 1.18 cvs 2680: (<tt>Item</tt>) is composed of paragraphs.</p> 2681: </div> 1.1 cvs 2682: 1.18 cvs 2683: <div class="subsection"> 1.1 cvs 2684: 1.18 cvs 2685: <h3><a name="sectc332">A class of objects: mathematical formulas</a></h3> 2686: <p> 2687: The example below defines the <tt>Formula</tt> class which is used in Article 1.1 cvs 2688: documents. This class represents mathematical formulas with a rather simple 2689: structure, but sufficient to produce a correct rendition on the screen or 2690: printer. To support more elaborate operations (formal or numeric 2691: calculations), a finer structure should be defined. This class doesn't use any 1.18 cvs 2692: other class and doesn't define any associated elements or units.</p> 2693: <pre>STRUCTURE Formula; 1.1 cvs 2694: DEFPRES FormulaP; 2695: 2696: ATTR 2697: String_type = Function_name, Variable_name; 2698: 2699: STRUCT 2700: Formula = Expression; 2701: Expression = LIST OF (Construction); 2702: Construction = CASE OF 2703: TEXT; { Simple character string } 2704: Index = Expression; 2705: Exponent = Expression; 2706: Fraction = 2707: BEGIN 1.6 cvs 2708: Numerator = Expression; 1.1 cvs 2709: Denominator = Expression; 2710: END; 2711: Root = 2712: BEGIN 2713: ? Order = TEXT; 2714: Root_Contents = Expression; 2715: END; 2716: Integral = 2717: BEGIN 2718: Integration_Symbol = SYMBOL; 2719: Lower_Bound = Expression; 2720: Upper_Bound = Expression; 2721: END; 2722: Triple = 2723: BEGIN 2724: Princ_Expression = Expression; 2725: Lower_Expression = Expression; 2726: Upper_Expression = Expression; 2727: END; 2728: Column = LIST [2..*] OF 2729: (Element = Expression); 2730: Parentheses_Block = 2731: BEGIN 2732: Opening = SYMBOL; 2733: Contents = Expression; 2734: Closing = SYMBOL; 2735: END; 2736: END; { End of Choice Constructor } 1.18 cvs 2737: END { End of Structure Schema }</pre> 2738: <p> 1.1 cvs 2739: This schema defines a single global attribute which allows functions and 2740: variables to be distinguished. In the presentation schema, this attribute can 2741: be used to choose between roman (for functions) and italic characters (for 1.18 cvs 2742: variables).</p> 2743: <p> 1.1 cvs 2744: A formula's structure is that of a mathematical expression, which is itself a 2745: sequence of mathematical constructions. A mathematical construction can be 2746: either a simple character string, an index, an exponent, a fraction, a root, 2747: etc. Each of these mathematical constructions has a sensible structure which 2748: generally includes one or more expressions, thus making the formula class's 1.18 cvs 2749: structure definition recursive.</p> 2750: <p> 1.1 cvs 2751: In most cases, the roots which appear in the formulas are square roots and 2752: their order (2) is not specified. This is why the Order component is marked 2753: optional by a question mark. When explicitly requested, it is possible to add 1.18 cvs 2754: an order to a root, for example for cube roots (order = 3).</p> 2755: <p> 1.1 cvs 2756: An integral is formed by an integration symbol, chosen by the user (simple 2757: integral, double, curvilinear, etc.), and two bounds. A more fine-grained 2758: schema would add components for the integrand and the integration variable. 2759: Similarly, the Block_Parentheses construction leaves the choice of opening and 2760: closing symbols to the user. They can be brackets, braces, parentheses, 1.18 cvs 2761: etc.</p> 2762: </div> 2763: </div> 2764: <hr> 1.19 cvs 2765: 1.18 cvs 2766: </div> 1.1 cvs 2767: 1.18 cvs 2768: <div class="chapter"> 1.1 cvs 2769: 1.18 cvs 2770: <h1><a name="sect4">The P Language</a></h1> 1.1 cvs 2771: 1.18 cvs 2772: <div class="section"> 1.1 cvs 2773: 1.18 cvs 2774: <h2><a name="sectb41">Document presentation</a></h2> 2775: <p> 1.1 cvs 2776: Because of the model adopted for Thot, the presentation of documents is 2777: clearly separated from their structure and content. After having presented 2778: the logical structure of documents, we now detail the principles implemented 1.18 cvs 2779: for their presentation. The concept of <em>presentation</em> encompasses what 1.5 cvs 2780: is often called the page layout, the composition, or the document style. It 1.18 cvs 2781: is the set of operations which display the document on the screen or print it 2782: on paper. Like logical structure, document presentation is defined 2783: generically with the help of a language, called P.</p> 1.1 cvs 2784: 1.18 cvs 2785: <div class="subsection"> 1.1 cvs 2786: 1.18 cvs 2787: <h3><a name="sectc411">Two levels of presentation</a></h3> 2788: <p> 1.1 cvs 2789: The link between structure and presentation is clear: the logical organization 2790: of a document is used to carry out its presentation, since the purpose of the 2791: presentation is to make evident the organization of the document. But the 2792: presentation is equally dependent on the device used to render the document. 2793: Certain presentation effects, notably changes of font or character set, cannot 2794: be performed on all printers or on all screens. This is why Thot uses a 2795: two-level approach, where the presentation is first described in abstract 2796: terms, without taking into account each particular device, and then the 1.18 cvs 2797: presentation is realized within the constraints of a given device.</p> 2798: <p> 1.1 cvs 2799: Thus, presentation is only described as a function of the structure of the 2800: documents and the image that would be produced on an idealized device. For 2801: this reason, presentation descriptions do not refer to any device 1.18 cvs 2802: characteristics: they describe <em>abstract presentations</em> which can be 2803: concretized on different devices.</p> 2804: <p> 2805: A presentation description also defines a <em>generic presentation</em>, since 1.1 cvs 2806: it describes the appearance of a class of documents or objects. This generic 2807: presentation must also be applied to document and object instances, each 2808: conforming to its generic logical structure, but with all the allowances that 2809: were called to mind above: missing elements, constructed elements with other 1.18 cvs 2810: logical structures, etc.</p> 2811: <p> 1.1 cvs 2812: In order to preserve the homogeneity between documents and objects, 2813: presentation is described with a single set of tools which support the layout 2814: of a large document as well as the composition of objects like a graphical 2815: figure or mathematical formula. This unity of presentation description tools 2816: contrasts with the traditional approach, which focuses more on documents than 2817: objects and thus is based on the usual typographic conventions, such as the 2818: placement of margins, indentations, vertical spaces, line lengths, 1.18 cvs 2819: justification, font changes, etc.</p> 2820: </div> 1.1 cvs 2821: 1.18 cvs 2822: <div class="subsection"> 1.1 cvs 2823: 1.18 cvs 2824: <h3><a name="sectc412">Boxes</a></h3> 2825: <p> 1.1 cvs 2826: To assure the homogeneity of tools, all presentation in Thot, for documents as 2827: well as for the objects which they contain, is based on the notion of the 1.18 cvs 2828: <em>box</em>, such as was implemented in T<sub><big>E</big></sub>X.</p> 2829: <p> 1.1 cvs 2830: Corresponding to each element of the document is a box, which is the 2831: rectangle enclosing the element on the display device (screen or sheet of 1.18 cvs 2832: paper); the outline of this rectangle is not visible, except when a <a 2833: href="#sectc4230a"><tt>ShowBox</tt> rule</a> applies to the element. The sides 2834: of the box are parallel to the sides of the screen or the sheet of paper. By 2835: way of example, a box is associated with a character string, a line of text, a 2836: page, a paragraph, a title, a mathematical formula, or a table cell.</p> 2837: <p> 1.1 cvs 2838: Whatever element it corresponds to, each box possesses four sides and four 1.18 cvs 2839: axes, which we designate as follows (<a href="#boxes">see figure</a>):</p> 2840: <dl> 2841: <dt><tt>Top</tt></dt> 2842: <dd> 2843: the upper side, 2844: </dd> 2845: <dt><tt>Bottom</tt></dt> 2846: <dd> 2847: the lower side, 2848: </dd> 2849: <dt><tt>Left</tt></dt> 2850: <dd> 2851: the left side, 2852: </dd> 2853: <dt><tt>Right</tt></dt> 2854: <dd> 2855: the right side, 2856: </dd> 2857: <dt><tt>VMiddle</tt></dt> 2858: <dd> 2859: the vertical axis passing through the center of the box, 2860: </dd> 2861: <dt><tt>HMiddle</tt></dt> 2862: <dd> 2863: the horizontal axis passing through the center of the box, 2864: </dd> 2865: <dt><tt>VRef</tt></dt> 2866: <dd> 2867: the vertical reference axis, 2868: </dd> 2869: <dt><tt>HRef</tt></dt> 2870: <dd> 2871: the horizontal reference axis. 2872: </dd> 2873: </dl> 2874: 2875: <div class="figure"> 2876: <hr> 1.19 cvs 2877: 1.18 cvs 2878: <pre> Left VRef VMiddle Right 1.1 cvs 2879: : : 2880: Top ----------------------------- 2881: | : : | 2882: | : : | 2883: | : : | 2884: | : : | 2885: | : : | 2886: HMiddle ..|...........................|.. 2887: | : : | 2888: | : : | 2889: HRef ..|...........................|.. 2890: | : : | 2891: | : : | 2892: Bottom ----------------------------- 1.18 cvs 2893: : :</pre> 1.19 cvs 2894: <p align="center"> 1.18 cvs 2895: <em><a name="boxes">The sides and axes of boxes</a><em></em></em></p> 2896: <hr> 1.19 cvs 2897: 1.18 cvs 2898: </div> 2899: <p> 1.1 cvs 2900: The principal role of boxes is to set the extent and position of the images of 2901: the different elements of a document with respect to each other on the 2902: reproduction device. This is done by defining relations between the boxes of 2903: different elements which give relative extents and positions to these 1.18 cvs 2904: boxes.</p> 2905: <p> 2906: There are three types of boxes:</p> 2907: <ul> 2908: <li> 2909: boxes corresponding to structural elements of the document, 1.19 cvs 2910: </li> 1.18 cvs 2911: <li> 2912: presentation boxes, 1.19 cvs 2913: </li> 1.18 cvs 2914: <li> 2915: page layout boxes. 1.19 cvs 2916: </li> 1.18 cvs 2917: </ul> 2918: <p> 2919: <strong>Boxes corresponding to structural elements of the document</strong> 1.1 cvs 2920: are those which linked to each of the elements (base or structured) of the 2921: logical structure of the document. Such a box contains all the contents of 1.18 cvs 2922: the element to which it corresponds (there is an exception: see <a 2923: href="#sectc4220">rules <tt>VertOverflow</tt> and <tt>HorizOverflow</tt></a>). 2924: These boxes form a tree-like structure, identical to that of the structural 2925: elements to which they correspond. This tree expresses the inclusion 2926: relationships between the boxes: a box includes all the boxes of its subtree. 2927: On the other hand, there are no predefined rules for the relative positions of 2928: the included boxes. If they are at the same level, they can overlap, be 2929: contiguous, or be disjoint. The rules expressed in the generic presentation 2930: specify their relative positions.</p> 2931: <p> 2932: <strong>Presentation boxes</strong> represent elements which are not found in 1.1 cvs 2933: the logical structure of the document but which are added to meet the needs of 2934: presentation. These boxes are linked to the elements of the logical structure 2935: that are best suited to bringing them out. For example, they are used to add 2936: the character string ``Summary:'' before the summary in the presentation of a 2937: report or to represent the fraction bar in a formula, or also to make the 2938: title of a field in a form appear. These elements have no role in the logical 2939: structure of the document: the presence of a Summary element in the document 2940: does not require the creation of another structural object to hold the word 2941: ``Summary''. Similarly, if a Fraction element contains both a Numerator 2942: element and a Denominator element, the fraction bar has no purpose 2943: structurally. On the other hand, these elements of the presentation are 2944: important for the reader of the reproduced document or for the user of an 2945: editor. This is why they must appear in the document's image. It is the 2946: generic presentation which specifies the presentation boxes to add by 2947: indicating their content (a base element for which the value is specified) and 2948: the position that they must take in the tree of boxes. During editing, these 1.18 cvs 2949: boxes cannot be modified by the user.</p> 2950: <p> 2951: <strong>Page layout boxes</strong> are boxes created implicitly by the page 1.1 cvs 2952: layout rules. These rules indicate how the contents of a structured element 2953: must be broken into lines and pages. In contrast to presentation boxes, these 2954: line and page boxes do not depend on the logical structure of the document, 1.18 cvs 2955: but rather on the physical constraints of the output devices: character size, 2956: height and width of the window on the screen or of the sheet of paper.</p> 2957: </div> 1.1 cvs 2958: 1.18 cvs 2959: <div class="subsection"> 1.1 cvs 2960: 1.18 cvs 2961: <h3><a name="sectc413">Views and visibility</a></h3> 2962: <p> 1.1 cvs 2963: One of the operations that one might wish to perform on a document is to view 2964: it is different ways. For this reason, it is possible to define several 1.18 cvs 2965: <em>views</em> for the same document, or better yet, for all documents of the 1.1 cvs 2966: same class. A view is not a different presentation of the document, but 2967: rather a filter which only allows the display of certain parts of the 2968: document. For example, it might be desirable to see only the titles of 2969: chapters and sections in order to be able to move rapidly through the 2970: document. Such a view could be called a ``table of contents''. It might also 2971: be desirable to see only the mathematical formulas of a document in order to 2972: avoid being distracted by the non-mathematical aspects of the document. A 1.18 cvs 2973: ``mathematics'' view could provide this service.</p> 2974: <p> 1.1 cvs 2975: Views, like presentation, are based on the generic logical structure. Each 2976: document class, and each generic presentation, can be provided with views 2977: which are particularly useful for that class or presentation. For each view, 1.18 cvs 2978: the <em>visibility</em> of elements is defined, indicated whether or not the 1.1 cvs 2979: elements must be presented to the user. The visibility is calculated as a 2980: function of the type of the elements or their hierarchical position in the 2981: structure of the document. Thus, for a table of contents, all the ``Chapter 2982: Title'' and ``Section Title'' elements are made visible. However, the 2983: hierarchical level could be used to make the section titles invisible below a 2984: certain threshold level. By varying this threshold, the granularity of the 2985: view can be varied. In the ``mathematics'' view, only Formula elements would 1.18 cvs 2986: be made visible, no matter what their hierarchical level.</p> 2987: <p> 1.1 cvs 2988: Because views are especially useful for producing a synthetic image of the 2989: document, it is necessary to adapt the presentation of the elements to the 2990: view in which they appear. For example, it is inappropriate to have a page 2991: break before every chapter title in the table of contents. Thus, generic 2992: presentations take into account the possible views and permit each element 1.18 cvs 2993: type's presentation to vary according the view in which its image appears.</p> 2994: <p> 2995: <a name="views">Views</a> are also used, when editing documents, to display 1.1 cvs 2996: the associated elements. So, in addition to the primary view of the document, 2997: there can be a ``notes'' view and a ``figures'' view which contain, 2998: respectively, the associated elements of the Note and Figure types. In this 2999: way, it is possible to see simultaneously the text which refers to these 3000: elements and the elements themselves, even if they will be separated when 1.18 cvs 3001: printed.</p> 3002: </div> 1.1 cvs 3003: 1.18 cvs 3004: <div class="subsection"> 1.1 cvs 3005: 1.18 cvs 3006: <h3><a name="sectc414">Pages</a></h3> 3007: <p> 1.1 cvs 3008: Presentation schemas can be defined which display the document as a long 3009: scroll, without page breaks. This type of schema is particularly well-suited 3010: to the initial phase of work on a document, where jumps from page to page 3011: would hinder composing and reading the document on a screen. In this case, 3012: the associated elements (such as notes), which are normally displayed in the 3013: page footer, are presented in a separate window. But, once the document is 3014: written, it may be desirable to display the document on the screen in the same 3015: manner in which it will be printed. So, the presentation schema must define 1.18 cvs 3016: pages.</p> 3017: <p> 1.1 cvs 3018: The P language permits the specification of the dimensions of pages as well as 3019: their composition. It is possible to generate running titles, page numbers, 3020: zones at the bottom of the page for notes, etc. The editor follows this model 3021: and inserts page break marks in the document which are used during printing, 1.18 cvs 3022: insuring that the pages on paper are the same as on the screen.</p> 3023: <p> 1.1 cvs 3024: Once a document has been edited with a presentation schema defining pages, it 3025: contains page marks. But it is always possible to edit the document using a 3026: schema without pages. In this case, the page marks are simply ignored by the 3027: editor. They are considered again as soon as a schema with pages is used. 1.18 cvs 3028: Thus, the user is free to choose between schemas with and without pages.</p> 3029: <p> 1.1 cvs 3030: Thot treats the page break, rather than the page itself, as a box. This page 3031: break box contains all the elements of one page's footer, a rule marking the 3032: edge of this page, and all the elements of the next page's header. The 3033: elements of the header and footer can be running titles, page number, 3034: associated elements (notes, for example), etc. All these elements, as well as 3035: their content and graphical appearance, are defined by the generic 1.18 cvs 3036: presentation.</p> 3037: </div> 1.1 cvs 3038: 1.18 cvs 3039: <div class="subsection"> 1.1 cvs 3040: 1.18 cvs 3041: <h3><a name="sectc415">Numbering</a></h3> 3042: <p> 1.1 cvs 3043: Many elements are numbered in documents: pages, chapters, sections, formulas, 3044: theorems, notes, figures, bibliographic references, exercises, examples, 3045: lemmas, etc. Because Thot has a notion of logical structure, all of these 3046: numbers (with the exception of pages) are redundant with information implicit 3047: in the logical structure of the document. Such numbers are simply a way to 3048: make the structure of the document more visible. So, they are part of the 3049: document's presentation and are calculated by the editor from the logical 3050: structure. The structure does not contain numbers as such; it only defines 3051: relative structural positions between elements, which serve as ordering 1.18 cvs 3052: relations on these elements.</p> 3053: <p> 1.1 cvs 3054: If the structure schema defines the body of a document as a sequence of at 1.18 cvs 3055: least two chapters:</p> 3056: <pre>Body = LIST [2..*] OF Chapter;</pre> 3057: <p> 3058: the sequence defined by the list constructor is ordered and each chapter can 3059: be assigned a number based on its rank in the Body list. Therefore, all 3060: elements contained in lists a the structure of a document can be numbered, but 3061: they are not the only ones. The tree structure induced by the aggregate, 3062: list, and choice constructors (excluding references) defines a total order on 3063: the elements of the document's primary structure. So, it is possible to 3064: define a numbering which uses this order, filtering elements according to 3065: their type so that only certain element types are taken into account in the 3066: numbering. In this way, it possible to number all the theorems and lemmas of 3067: a chapter in the same sequence of numbers, even when they are not part of the 3068: same list constructor and appear at different levels of the document's tree. 3069: By changing the filter, they can be numbered separately: one sequence of 3070: numbers for theorems, another for the lemmas.</p> 3071: <p> 1.1 cvs 3072: Associated elements pose a special problem, since they are not part of the 3073: document's primary structure, but are attached only by references, which 3074: violate the total order of the document. Then, these associated elements are 3075: frequently numbered, precisely because the number is an effective way to 3076: visualize the reference. In order to resolve this problem, Thot implicitly 3077: defines a list constructor for each type of associated element, gathering 3078: together (and ordering) these elements. Thus, the associated elements can be 1.18 cvs 3079: numbered by type.</p> 3080: <p> 1.1 cvs 3081: Since they are calculated from the document's logical structure and only for 3082: the needs of the presentation, numbers are presentation elements, described by 3083: presentation boxes, just like the fraction bar or the word ``Summary''. 3084: Nevertheless, numbers differ from these other boxes because their content 3085: varies from instance to instance, even though they are of the same type, 3086: whereas all fraction bars are horizontal lines and the same word ``Summary'' 1.18 cvs 3087: appears at the head of every document's summary.</p> 3088: </div> 1.1 cvs 3089: 1.18 cvs 3090: <div class="subsection"> 1.1 cvs 3091: 1.18 cvs 3092: <h3><a name="sectc416">Presentation parameters</a></h3> 3093: <p> 1.1 cvs 3094: The principal parameters which determine document presentation are the 1.18 cvs 3095: <em>positions</em> and <em>dimensions</em> of boxes, the <em>font</em>, the 3096: <em>style</em>, the <em>size</em>, the <em>underlining</em> and the 3097: <em>color</em> of their content. From these parameters, and some others of 1.1 cvs 3098: less importance, it is possible to represent the usual typographic parameters 3099: for the textual parts of the document. These same parameters can be used to 3100: describe the geometry of the non-textual elements, even though they are 1.18 cvs 3101: two-dimensional elements unlike the text, which is linear.</p> 3102: <p> 1.1 cvs 3103: As we have already seen, the positions of the boxes always respect the rule 3104: of enclosure: a box in the tree encloses all the boxes of the next lower level 3105: which are attached to it. The positional parameters permit the specification 3106: of the position of each box in relation to the enclosing box or to its sibling 3107: boxes (boxes directly attached to the same enclosing box in the tree of 1.18 cvs 3108: boxes).</p> 3109: <p> 1.1 cvs 3110: The presentation parameters also provide control over the dimensions of the 3111: boxes. The dimensions of a box can depend either on its content or on its 3112: context (its sibling boxes and the enclosing box). Each dimension (height or 1.18 cvs 3113: width) can be defined independently of the other.</p> 3114: <p> 1.1 cvs 3115: Because of the position and dimension parameters, it is possible to do the 3116: same things that are normally done in typography by changing margins, line 3117: lengths, and vertical or horizontal skips. This approach can also align or 1.18 cvs 3118: center elements and groups of elements.</p> 3119: <p> 1.1 cvs 3120: In contrast to the position and dimension parameters, the font, style, size, 3121: underlining, and color do not concern the box itself (the rectangle delimiting 3122: the element), but its content. These parameters indicate the typographic 3123: attributes which must be applied to the text contained in the box, and by 1.18 cvs 3124: extension, to all base elements.</p> 3125: <p> 1.1 cvs 3126: For text, the font parameter is used to change the family of characters 3127: (Times, Helvetica, Courier, etc.); the style is used to obtain italic or 3128: roman, bold or light characters; the size determines the point size of the 3129: characters; underlining defines the type and thickness of the lines drawn 1.18 cvs 3130: above, below, or through the characters.</p> 3131: <p> 1.1 cvs 3132: For graphics, the line style parameter can be either solid, dotted, or dashed; 3133: the line thickness parameter controls the width of the lines; the fill pattern 1.18 cvs 3134: parameter determines how closed geometric figures must be filled.</p> 3135: <p> 1.1 cvs 3136: While some of the parameters which determine the appearance of a box's 3137: contents make sense only for one content type (text or graphic), other 3138: parameters apply to all content types: these are the color parameters. These 1.18 cvs 3139: indicate the color of lines and the background color.</p> 3140: </div> 3141: </div> 1.1 cvs 3142: 1.18 cvs 3143: <div class="section"> 1.1 cvs 3144: 1.18 cvs 3145: <h2><a name="sectb42">Presentation description language</a></h2> 3146: <p> 1.1 cvs 3147: A generic presentation defines the values of presentation parameters (or the 3148: way to calculate those values) for a generic structure, or more precisely, for 3149: all the element types and all the global and local attributes defined in that 3150: generic structure. This definition of the presentation parameters is made 3151: with the P language. A program written in this language, that is a generic 1.18 cvs 3152: presentation expressed in P, is call a <em>presentation schema</em>. This 3153: section describes the syntax and semantics of the language, using the same <a 3154: href="#sectc321">meta-language</a> as was used for the definition of the S 3155: language.</p> 3156: <p> 1.1 cvs 3157: Recall that it is possible to write many different presentation schemas for 3158: the same class of documents or objects. This allows users to choose for a 3159: document the graphical appearance which best suits their type of work or 1.18 cvs 3160: their personal taste.</p> 1.1 cvs 3161: 1.18 cvs 3162: <div class="subsection"> 1.1 cvs 3163: 1.18 cvs 3164: <h3><a name="sectc421">The organization of a presentation schema</a></h3> 3165: <p> 3166: A presentation schema begins with the word <tt>PRESENTATION</tt> and ends with 3167: the word <tt>END</tt>. The word <tt>PRESENTATION</tt> is followed by the name 1.1 cvs 3168: of the generic structure to which the presentation will be applied. This name 1.18 cvs 3169: must be the same as that which follows the keyword <tt>STRUCTURE</tt> in the 3170: structure schema associated with the presentation schema.</p> 3171: <p> 1.1 cvs 3172: After this declaration of the name of the structure, the following sections 1.18 cvs 3173: appear (in order):</p> 3174: <ul> 3175: <li> 3176: Declarations of 3177: <ul> 3178: <li> 3179: all views, 1.19 cvs 3180: </li> 1.18 cvs 3181: <li> 3182: printed views, 1.19 cvs 3183: </li> 1.18 cvs 3184: <li> 3185: counters, 1.19 cvs 3186: </li> 1.18 cvs 3187: <li> 3188: presentation constants, 1.19 cvs 3189: </li> 1.18 cvs 3190: <li> 3191: variables, 1.19 cvs 3192: </li> 1.18 cvs 3193: </ul> 1.19 cvs 3194: </li> 1.18 cvs 3195: <li> 3196: default presentation rules, 1.19 cvs 3197: </li> 1.18 cvs 3198: <li> 3199: presentation box and page layout box definitions, 1.19 cvs 3200: </li> 1.18 cvs 3201: <li> 3202: presentation rules for structured elements, 1.19 cvs 3203: </li> 1.18 cvs 3204: <li> 3205: presentation rules for attributes, 1.19 cvs 3206: </li> 1.18 cvs 3207: <li> 3208: rules for transmitting values to attributes of included documents. 1.19 cvs 3209: </li> 1.18 cvs 3210: </ul> 3211: <p> 1.1 cvs 3212: Each of these sections is introduced by a keyword which is followed by a 1.18 cvs 3213: sequence of declarations. Every section is optional.</p> 3214: <pre> SchemaPres ='PRESENTATION' ElemID ';' 1.1 cvs 3215: [ 'VIEWS' ViewSeq ] 3216: [ 'PRINT' PrintViewSeq ] 3217: [ 'COUNTERS' CounterSeq ] 3218: [ 'CONST' ConstSeq ] 3219: [ 'VAR' VarSeq ] 3220: [ 'DEFAULT' ViewRuleSeq ] 3221: [ 'BOXES' BoxSeq ] 3222: [ 'RULES' PresentSeq ] 3223: [ 'ATTRIBUTES' PresAttrSeq ] 3224: [ 'TRANSMIT' TransmitSeq ] 3225: 'END' . 1.18 cvs 3226: ElemID = NAME .</pre> 3227: </div> 1.1 cvs 3228: 1.18 cvs 3229: <div class="subsection"> 1.1 cvs 3230: 1.18 cvs 3231: <h3><a name="sectc422">Views</a></h3> 3232: <p> 1.1 cvs 3233: Each of the possible views must be declared in the presentation schema. As 1.18 cvs 3234: has <a href="#views">already been described</a>, the presentation rules for an 1.1 cvs 3235: element type can vary according to the view in which the element appears. The 3236: name of the view is used to designate the view to which the presentation rules 1.18 cvs 3237: apply (see the <a href="#inkeyword"><tt>IN</tt> instruction</a>). The 1.1 cvs 3238: definition of the view's contents are dispersed throughout the presentation 3239: rules attached to the different element types and attributes. The 1.18 cvs 3240: <tt>VIEWS</tt> section is simply a sequence of view names separated by commas 3241: and terminated by a semi-colon.</p> 3242: <p> 1.1 cvs 3243: One of the view names (and only one) can be followed by the keyword 1.18 cvs 3244: <tt>EXPORT</tt>. This keyword identifies the view which presents the members 3245: of the document class in <a href="#sectc3213">skeleton form</a>. The 3246: graphical appearance and the content of this view is defined just as with 3247: other views, but it is useless to specify presentation rules concerning this 3248: view for the elements which are not loaded in the skeleton form.</p> 3249: <p> 1.1 cvs 3250: It is not necessary to declare any views; in this case there is a single 3251: unnamed view. If many views are declared, the first view listed is considered 3252: the principal view. The principal view is the one to which all rules that are 1.18 cvs 3253: not preceded by an indication of a view will apply (see the <a 3254: href="#inkeyword">instruction <tt>IN</tt></a>).</p> 3255: <p> 1.1 cvs 3256: The principal view is the the one which the editor presents on the screen when 3257: the user asks to create or edit a document. Thus, it makes sense to put the 3258: most frequently used view at the head of the list. But if the structure 1.18 cvs 3259: schema contains <a href="#sectc3213">skeleton elements</a> and is loaded in 3260: its skeleton form, the view whose name is followed by the keyword 3261: <tt>EXPORT</tt> will be opened and no other views can be opened.</p> 3262: <pre> 'VIEWS' ViewSeq 1.1 cvs 3263: ViewSeq = ViewDeclaration 1.6 cvs 3264: < ',' ViewDeclaration > ';' . 1.1 cvs 3265: ViewDeclaration = ViewID [ 'EXPORT' ] . 1.18 cvs 3266: ViewID = NAME .</pre> 3267: <blockquote class="example"> 3268: <p> 3269: <strong>Example:</strong></p> 3270: <p> 1.3 cvs 3271: When editing a report, it might be useful have views of the table of contents 1.18 cvs 3272: and of the mathematical formulas, in addition to the principal view which 3273: shows the document in its entirety. To achieve this, a presentation schema 3274: for the Report class would have the following <tt>VIEWS</tt> section:</p> 3275: <pre>VIEWS 3276: Full_text, Table_of_contents, Formulas;</pre> 3277: <p> 1.1 cvs 3278: The contents of these views are specified in the presentation rules of the 1.18 cvs 3279: schema.</p> 3280: </blockquote> 3281: </div> 1.1 cvs 3282: 1.18 cvs 3283: <div class="subsection"> 1.1 cvs 3284: 1.18 cvs 3285: <h3><a name="sectc423">Print Views</a></h3> 3286: <p> 1.1 cvs 3287: When editing a document, each view is presented in a different window. In 1.18 cvs 3288: addition to the views specified by the <tt>VIEWS</tt> instruction, the user 1.1 cvs 3289: can display the associated elements with one window for each type of 1.18 cvs 3290: associated element.</p> 3291: <p> 1.1 cvs 3292: When printing a document, it is possible to print any number of views, chosen 3293: from among all the views which the editor can display (views in the strict 3294: sense or associated elements). Print views, as well as the order in which 1.18 cvs 3295: they must be printed, are indicated by the <tt>PRINT</tt> instruction. It 3296: appears after the <tt>VIEWS</tt> instruction and is formed of the keyword 3297: <tt>PRINT</tt> followed by the ordered list of print view names. The print 1.1 cvs 3298: view names are separated by commas and followed by a semi-colon. A print view 1.18 cvs 3299: name is either a view name declared in the <tt>VIEWS</tt> instruction or the 1.1 cvs 3300: name of an associated element type (with an ``s'' added to the end). The 1.18 cvs 3301: associated element must have been declared in the <tt>ASSOC</tt> section of 3302: the structure schema.</p> 3303: <pre> 'PRINT' PrintViewSeq 1.1 cvs 3304: PrintViewSeq = PrintView < ',' PrintView > ';' . 1.18 cvs 3305: PrintView = ViewID / ElemID .</pre> 3306: <p> 3307: If the <tt>PRINT</tt> instruction is absent, the printing program will print 3308: only the principal view (the first view specified by the <tt>VIEWS</tt> 3309: instruction or the single, unnamed view when there is no <tt>VIEWS</tt> 3310: instruction).</p> 3311: <blockquote class="example"> 3312: <p> 3313: <strong>Example:</strong></p> 3314: <p> 1.3 cvs 3315: Consider a Report presentation using the view declarations from the preceding 3316: example. Suppose we want to print the full text and table of contents views, 3317: but not the Formulas view, which is only useful when editing. In addition, 3318: suppose that we also want to print the bibliographic citations, which are 1.18 cvs 3319: associated elements (of type <tt>Citation</tt>). A sensible printing order 1.3 cvs 3320: would be to print the full text then the bibliography and finally the table of 3321: contents. To obtain this result when printing, the presentation schema would 1.18 cvs 3322: say:</p> 3323: <pre>PRINT 3324: Full_text, Citations, Table_of_contents;</pre> 3325: </blockquote> 3326: </div> 3327: 3328: <div class="subsection"> 3329: 3330: <h3><a name="sectc424">Counters</a></h3> 3331: <p> 3332: A presentation has a <em>counter</em> for each type of number in the 1.1 cvs 3333: presentation. All counters, and therefore all types of numbers, used in the 1.18 cvs 3334: schema must be declared after the <tt>COUNTERS</tt> keyword.</p> 3335: <p> 1.1 cvs 3336: Each counter declaration is composed of a name identifying the counter 3337: followed by a colon and the counting function to be applied to the counter. 1.18 cvs 3338: The counter declaration ends with a semi-colon.</p> 3339: <p> 1.1 cvs 3340: The counting function indicates how the counter values will be calculated. 1.16 cvs 3341: Three types of counting functions are available. The first type is used to 3342: count the elements of a list or aggregate: it assigns to the counter the rank 1.18 cvs 3343: of the element in the list or aggregate. More precisely, the function</p> 3344: <pre>RANK OF ElemID [ LevelAsc ] [ INIT AttrID ] 3345: [ 'REINIT' AttrID ]</pre> 3346: <p> 3347: indicates that when an element creates, by a creation rule (see the <a 3348: href="#sectc4232"><tt>Create</tt> instructions</a>), a presentation box 1.5 cvs 3349: containing the counter value, this value is the rank of the creating element, 1.18 cvs 3350: if it is of type <tt>ElemID</tt>, otherwise the rank of the first element of 3351: type <tt>ElemID</tt> which encloses the creating element in the logical 3352: structure of the document.</p> 3353: <p> 1.1 cvs 3354: The type name can be preceded by a star in the special case where the 1.18 cvs 3355: structure schema defines an element of whose <tt>ElemID</tt> is the same as 3356: that of an <a href="#sectd3284">inclusion</a> without expansion or with 3357: partial expansion. To resolve this ambiguity, the <tt>ElemID</tt> alone 3358: refers to the type defined in the structure schema while the <tt>ElemID</tt> 3359: preceded by a star refers to the included type.</p> 3360: <p> 3361: The type name <tt>ElemID</tt> can be followed by an integer. That number 1.1 cvs 3362: represents the relative level, among the ancestors of the creating element, of 1.18 cvs 3363: the element whose rank is asked. If that relative level <i>n</i> is unsigned, 3364: the <i>n</i><sup>th</sup> element of type <tt>ElemID</tt> encountered when 1.1 cvs 3365: travelling the logical structure from the root to the creating element is 1.16 cvs 3366: taken into account. If the relative level is negative, the logical structure 3367: is travelled in the other direction, from the creating element to the 1.18 cvs 3368: root.</p> 3369: <p> 3370: The function can end with the keyword <tt>INIT</tt> followed by the name of a 1.1 cvs 3371: numeric attribute (and only a numeric attribute). Then, the rank of the first 3372: element of the list or aggregate is considered to be the value of this 3373: attribute, rather than the default value of 1, and the rank of the other 3374: elements is shifted accordingly. The attribute which determines the initial 1.18 cvs 3375: value is searched on the element itself and on its ancestors.</p> 3376: <p> 3377: The function can end with the keyword <tt>REINIT</tt> followed by the name of 1.1 cvs 3378: a numeric attribute (and only a numeric attribute). Then, if an element to be 3379: counted has this attribute, the counter value for this element is the 3380: attribute value and the following elements are numbered starting from this 1.18 cvs 3381: value.</p> 3382: <p> 3383: When the <tt>RANK</tt> function is written</p> 3384: <pre>RANK OF Page [ ViewID ] [ INIT AttrID ]</pre> 3385: <p> 3386: (<tt>Page</tt>is a keyword of the P language), the counter takes as its value 1.5 cvs 3387: the number of the page on which the element which creates the presentation box 3388: containing the number appears. This is done as if the pages of the document 3389: form a list for each view. The counter only takes into account the pages of 3390: the relevant view, that is the view displaying the presentation box whose 1.18 cvs 3391: contents take the value of the number. However, if the keyword <tt>Page</tt> 1.5 cvs 3392: is followed by the name of a view (between parentheses), it is the pages of 3393: that view that are taken into account. As in the preceding form, the 1.18 cvs 3394: <tt>RANK</tt> function applied to pages can end with the <tt>INIT</tt> keyword 1.5 cvs 3395: followed by the name of a numeric attribute which sets the value of the first 3396: page's number. This attribute must be a local attribute of the document 1.18 cvs 3397: itself, and not of one of its components.</p> 3398: <p> 1.1 cvs 3399: The second counting function is used to count the occurrences of a certain 1.18 cvs 3400: element type in a specified context. The instruction</p> 3401: <pre>SET n ON Type1 ADD m ON Type2 [ INIT AttrID ]</pre> 3402: <p> 1.5 cvs 3403: says that when the document is traversed from beginning to end (in the order 1.18 cvs 3404: induced by the logical structure), the counter is assigned the value 3405: <tt>n</tt> each time an element of type <tt>Type1</tt> is encountered, no 3406: matter what the current value of the counter, and the value <tt>m</tt> is 3407: added to the current value of the counter each time an element of type 3408: <tt>Type2</tt> is encountered.</p> 3409: <p> 3410: As with the <tt>RANK</tt> function, the type names can be preceded by a star 3411: to resolve the ambiguity of included elements.</p> 3412: <p> 3413: If the function ends with the keyword <tt>INIT</tt> followed by the name of an 1.1 cvs 3414: attribute and if the document possesses this attribute, the value of this 1.18 cvs 3415: attribute is used in place of <tt>n</tt>. The attribute must be numeric. It 3416: is searched on the element itself and on its ancestors.</p> 3417: <p> 3418: This function can also be used with the <tt>Page</tt> keyword in the place of 3419: <tt>Type1</tt> or <tt>Type2</tt>. In the first case, the counter is 3420: reinitialized on each page with the value <tt>n</tt>, while in the second 3421: case, it is incremented by <tt>m</tt> on each page. As with the preceding 3422: counting function, the word <tt>Page</tt> can be followed by a name between 1.1 cvs 3423: parentheses. In this case, the name specifies a view whose pages are taken 1.18 cvs 3424: into account.</p> 3425: <p> 3426: The definition of a counter can contain several <tt>SET</tt> functions and 3427: several <tt>ADD</tt> functions, each with a different value. The total number 3428: of counting functions must not be greater than 6.</p> 3429: <p> 1.1 cvs 3430: The third counting function is used to count the elements of a certain type 1.16 cvs 3431: encountered when travelling from the creating element to the root of the 3432: logical structure. The creating element is included if it is of that type. 1.18 cvs 3433: That function is written</p> 3434: <pre>RLEVEL OF Type</pre> 3435: <p> 3436: where <tt>Type</tt> represents the type of the elements to be counted.</p> 3437: <p> 3438: The formal definition of counter declarations is:</p> 3439: <pre> 'COUNTERS' CounterSeq 1.1 cvs 3440: CounterSeq = Counter < Counter > . 3441: Counter = CounterID ':' CounterFunc ';' . 3442: CounterID = NAME . 3443: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ] 1.16 cvs 3444: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] / 1.1 cvs 3445: SetFunction < SetFunction > 1.16 cvs 3446: AddFunction < AddFunction > 3447: [ 'INIT' AttrID ] / 3448: 'RLEVEL' 'OF' ElemID . 1.1 cvs 3449: SLevelAsc = [ '-' ] LevelAsc . 3450: LevelAsc = NUMBER . 3451: SetFunction = 'SET' CounterValue 'ON' TypeOrPage . 3452: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . 3453: TypeOrPage = 'Page' [ '(' ViewID ')' ] / 1.16 cvs 3454: [ '*' ] ElemID . 1.18 cvs 3455: CounterValue = NUMBER .</pre> 3456: <blockquote class="example"> 3457: <p> 3458: <strong>Example:</strong></p> 3459: <p> 1.3 cvs 3460: If the body of a chapter is defined as a sequence of sections in the structure 1.18 cvs 3461: schema:</p> 3462: <pre>Chapter_body = LIST OF (Section = 1.1 cvs 3463: BEGIN 3464: Section_Title = Text; 3465: Section_Body = Paragraphs; 3466: END 1.18 cvs 3467: );</pre> 3468: <p> 3469: the section counter is declared:</p> 3470: <pre>SectionCtr : RANK OF Section;</pre> 3471: <p> 3472: and the display of the section number before the section title is obtained by 3473: a <a href="#sectc4232"><tt>CreateBefore</tt> rule</a> attached the 3474: <tt>Section_Title</tt> type, which creates a presentation box whose content is 3475: the value of the <tt>SectionCtr</tt> counter (see the <a 3476: href="#sectc4231"><tt>Content</tt> instruction</a>).</p> 3477: <p> 1.1 cvs 3478: In order to number the formulas separately within each chapter, the formula 1.18 cvs 3479: counter is declared:</p> 3480: <pre>FormulaCtr : SET 0 ON Chapter ADD 1 ON Formula;</pre> 3481: <p> 1.4 cvs 3482: and the display of the formula number in the right margin, alongside each 1.18 cvs 3483: formula, is obtained by a <tt>CreateAfter</tt> instruction attached to the 3484: <tt>Formula</tt> type, which creates a presentation box whose content is the 3485: value of the <tt>FormulaCtr</tt> counter.</p> 3486: <p> 1.1 cvs 3487: To number the page chapter by chapter, with the first page of each chapter 1.18 cvs 3488: having the number 1, the counter definition would be</p> 3489: <pre>ChapterPageCtr : SET 0 ON Chapter ADD 1 ON Page;</pre> 3490: <p> 3491: If there is also a chapter counter</p> 3492: <pre>ChapterCtr : RANK OF Chapter;</pre> 3493: <p> 3494: the <a href="#sectc4231">content</a> of a presentation box created at the top 3495: of each page could be defined as:</p> 3496: <pre>Content : (VALUE(ChapterCtr, URoman) TEXT '-' 3497: VALUE(ChapterPageCtr, Arabic));</pre> 3498: <p> 1.5 cvs 3499: Thus, the presentation box contains the number of the chapter in upper-case 1.18 cvs 3500: roman numerals followed by a hyphen and the number of the page within the 3501: chapter in arabic numerals.</p> 3502: </blockquote> 3503: <blockquote class="example"> 3504: <p> 3505: <strong>Example:</strong></p> 3506: <p> 1.3 cvs 3507: To count tables and figures together in a document of the chapter type, a 1.18 cvs 3508: counter could be defined using:</p> 3509: <pre>CommonCtr : SET 0 ON Chapter ADD 1 ON Table 3510: ADD 1 ON Figure;</pre> 3511: </blockquote> 3512: </div> 1.1 cvs 3513: 1.18 cvs 3514: <div class="subsection"> 1.1 cvs 3515: 1.18 cvs 3516: <h3><a name="sectc425">Presentation constants</a></h3> 3517: <p> 1.1 cvs 3518: Presentation constants are used in the definition of the content of 1.18 cvs 3519: presentation boxes. This content is used in <a href="#sectc426">variable 3520: definitions</a> and in the <a href="#sectc4231"><tt>Content</tt> rule</a>. The 1.1 cvs 3521: only presentation constants which can be used are character strings, 1.2 cvs 3522: mathematical symbols, graphical elements, and pictures, that is to say, base 1.18 cvs 3523: elements.</p> 3524: <p> 1.1 cvs 3525: Constants can be defined directly in the variables or presentation boxes 1.18 cvs 3526: (<tt>Content</tt> rule) which use them. But it is only necessary them to 1.1 cvs 3527: declare once, in the constant declaration section, even though they are used 3528: in many variables or boxes. Thus, each declared constant has a name, which 3529: allows it to be designated whenever it is used, a type (one of the four base 3530: types) and a value (a character string or a single character for mathematical 1.18 cvs 3531: symbols and graphical elements).</p> 3532: <p> 3533: The constant declarations appear after the keyword <tt>CONST</tt>. Each 1.1 cvs 3534: declaration is composed of the name of the constant, an equals sign, a keyword 1.18 cvs 3535: representing its type (<tt>Text</tt>, <tt>Symbol</tt>, <tt>Graphics</tt> or 3536: <tt>Picture</tt>) and the string representing its value. A semi-colon 3537: terminates each declaration.</p> 3538: <p> 3539: In the case of a character string, the keyword <tt>Text</tt> can be followed 3540: by the name of an alphabet (for example, <tt>Greek</tt> or <tt>Latin</tt>) in 1.1 cvs 3541: which the constant's text should be expressed. If the alphabet name is 3542: absent, the Latin alphabet is used. When the alphabet name is present, only 3543: the first letter of the alphabet name is interpreted. Thus, the words 1.18 cvs 3544: <tt>Greek</tt> and <tt>Grec</tt> designate the same alphabet. In current 3545: versions of Thot, only the Greek and Latin alphabets are available.</p> 3546: <pre> 'CONST' ConstSeq 1.1 cvs 3547: ConstSeq = Const < Const > . 3548: Const = ConstID '=' ConstType ConstValue ';' . 3549: ConstID = NAME . 3550: ConstType ='Text' [ Alphabet ] / 'Symbol' / 3551: 'Graphics' / 'Picture' . 3552: ConstValue = STRING . 1.18 cvs 3553: Alphabet = NAME .</pre> 3554: <p> 1.5 cvs 3555: For character strings in the Latin alphabet (ISO Latin-1 character set), 1.1 cvs 3556: characters having codes higher than 127 (decimal) are represented by their 1.18 cvs 3557: code in octal.</p> 3558: <p> 1.1 cvs 3559: In the case of a symbol or graphical element, the value only contains a single 3560: character, between apostrophes, which indicates the form of the element which 3561: must be drawn in the box whose content is the constant. The symbol or 3562: graphical element takes the dimensions of the box, which are determined by the 1.18 cvs 3563: <tt>Height</tt> and <tt>Width</tt> rules. See <a href="#sectb72">table of 3564: codes</a> for the symbols and graphical elements.</p> 3565: <blockquote class="example"> 3566: <p> 3567: <strong>Example:</strong></p> 3568: <p> 1.3 cvs 3569: The constants ``Summary:'' and fraction bar, which were described earlier, are 1.18 cvs 3570: declared:</p> 3571: <pre>CONST 1.1 cvs 3572: SummaryConst = Text 'Summary:'; 1.18 cvs 3573: Bar = Graphics 'h';</pre> 3574: </blockquote> 3575: </div> 1.1 cvs 3576: 1.18 cvs 3577: <div class="subsection"> 1.1 cvs 3578: 1.18 cvs 3579: <h3><a name="sectc426">Variables</a></h3> 3580: <p> 1.1 cvs 3581: Variables permit the definition of computed content for presentation boxes. A 1.18 cvs 3582: variable is associated with a presentation box by a <tt>Content</tt> rule; but 3583: before being used in a <tt>Content</tt> rule, a variable can be defined in the 3584: <tt>VAR</tt> section. It is also possible to define a variable at the time of 3585: its use in a <tt>Content</tt> rule, as can be done with a constant.</p> 3586: <p> 1.1 cvs 3587: A variable has a name and a value which is a character string resulting from 3588: the concatenation of the values of a sequence of functions. Each variable 3589: declaration is composed of the variable name followed by a colon and the 3590: sequence of functions which produces its value, separated by spaces. Each 1.18 cvs 3591: declaration is terminated by a semi-colon.</p> 3592: <pre> 'VAR' VarSeq 1.1 cvs 3593: VarSeq = Variable < Variable > . 3594: Variable = VarID ':' FunctionSeq ';' . 3595: VarID = NAME . 1.18 cvs 3596: FunctionSeq = Function < Function > .</pre> 3597: <p> 1.1 cvs 3598: Several functions are available. The first two return, in the form of a 1.18 cvs 3599: character string, the current date. <tt>DATE</tt> returns the date in 3600: English, while <tt>FDATE</tt> returns the date in french.</p> 3601: <p> 3602: Two other functions, <tt>DocName</tt> and <tt>DirName</tt>, return the 3603: document name and the directory where the document is stored.</p> 3604: <p> 3605: Function <tt>ElemName</tt> returns the type of the element which created the 3606: presentation box whose contents are the variable.</p> 3607: <p> 1.1 cvs 3608: Another function simply returns the value of a presentation constant. For any 1.18 cvs 3609: constant declared in the <tt>CONST</tt> section, it is sufficient to give the 1.1 cvs 3610: name of the constant. Otherwise, the type and value of the constant must be 1.18 cvs 3611: given, using the same form as in a <a href="#sectc425">constant 3612: declaration</a>. If the constant is not of type text, (types <tt>Symbol</tt>, 3613: <tt>Graphics</tt> or <tt>Picture</tt>), it must be alone in the variable 3614: definition; only constants of type <tt>Text</tt> can be mixed with other 3615: functions.</p> 3616: <p> 1.1 cvs 3617: It is also possible to obtain the value of an attribute, simply by mentioning 3618: the attribute's name. The value of this function is the value of the 3619: attribute for the element which created the presentation box whose contents 3620: are the variable. If the creating element does not have the indicated 3621: attribute, the value is an empty string. In the case of a numeric attribute, 3622: the attribute is translated into a decimal number in arabic numerals. If 1.18 cvs 3623: another form is desired, the <tt>VALUE</tt> function must be used.</p> 3624: <p> 1.1 cvs 3625: The last available function returns, as a character string, the value of a 3626: counter, an attribute or a page number. This value can be presented in 1.18 cvs 3627: different styles. The keyword <tt>VALUE</tt> is followed (between 1.1 cvs 3628: parentheses) by the name of the counter, the name of the attribute, or the 1.18 cvs 3629: keyword <tt>PageNumber</tt> and the desired style, the two parameters being 1.1 cvs 3630: separated by a comma. The style is a keyword which indicates whether the 1.18 cvs 3631: value should be presented in arabic numerals (<tt>Arabic</tt>), lower-case 3632: roman numerals (<tt>LRoman</tt>), or upper-case roman numerals 3633: (<tt>URoman</tt>), or by an upper-case letter (<tt>Uppercase</tt>) or 3634: lower-case letter (<tt>Lowercase</tt>).</p> 3635: <p> 3636: For a page counter, the keyword <tt>PageNumber</tt> can be followed, between 1.1 cvs 3637: parentheses, by the name of the view from which to obtain the page number. By 1.18 cvs 3638: default, the first view declared in the <tt>VIEWS</tt> section is used. The 1.1 cvs 3639: value obtained is the number of the page on which is found the element that is 1.18 cvs 3640: using the variable in a <tt>Content</tt> rule.</p> 3641: <p> 1.1 cvs 3642: For an ordinary counter, the name of the counter can be preceded by the 1.18 cvs 3643: keyword <tt>MaxRangeVal</tt> or <tt>MinRangeVal</tt>. These keywords mean 1.1 cvs 3644: that the value returned by the function is the maximum (minimum resp.) value 3645: taken by the counter in the whole document, not the value for the element 1.18 cvs 3646: concerned by the function.</p> 3647: <pre> Function = 'DATE' / 'FDATE' / 1.1 cvs 3648: 'DocName' / 'DirName' / 3649: 'ElemName' / 'AttributeName' / 3650: ConstID / ConstType ConstValue / 3651: AttrID / 3652: 'VALUE' '(' PageAttrCtr ',' 3653: CounterStyle ')' . 1.6 cvs 3654: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] / 1.1 cvs 3655: [ MinMax ] CounterID / AttrID . 3656: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' / 3657: 'Uppercase' / 'Lowercase' . 1.18 cvs 3658: MinMax = 'MaxRangeVal' / 'MinRangeVal' .</pre> 3659: <blockquote class="example"> 3660: <p> 3661: <strong>Example:</strong></p> 3662: <p> 3663: To make today's date appear at the top of the first page of a report, a <a 3664: href="#sectc4232"><tt>CREATE</tt> rule</a> associated with the Report_Title 1.3 cvs 3665: element type generates a presentation box whose content (specified by the 1.18 cvs 3666: <tt>Content</tt> rule of that presentation box) is the variable:</p> 3667: <pre>VAR 3668: Todays_date : TEXT 'Version of ' DATE;</pre> 3669: <p> 1.1 cvs 3670: To produce, before each section title, the chapter number (in upper-case roman 3671: numerals) followed by the section number (in arabic numerals), two counters 1.18 cvs 3672: must be defined:</p> 3673: <pre>COUNTERS 1.1 cvs 3674: ChapterCtr : RANK OF Chapter; 1.18 cvs 3675: SectionCtr : RANK OF Section;</pre> 3676: <p> 1.4 cvs 3677: and the Section_Title element must create a presentation box whose content is 1.18 cvs 3678: the variable</p> 3679: <pre>VAR 1.1 cvs 3680: SectionNum : VALUE (ChapterCtr, URoman) TEXT '-' 1.18 cvs 3681: VALUE (SectionCtr, Arabic);</pre> 3682: <p> 1.1 cvs 3683: In order to make the page number on which each section begins appear in the 3684: table of contents view next to the section title, each Section_Title element 3685: must create a presentation box, visible only in the table of contents view, 1.18 cvs 3686: whose content is the variable:</p> 3687: <pre>VAR 1.1 cvs 3688: TitlePageNume : 1.18 cvs 3689: VALUE (PageNumber(Full_text), Arabic);</pre> 3690: </blockquote> 3691: </div> 1.1 cvs 3692: 1.18 cvs 3693: <div class="subsection"> 1.1 cvs 3694: 1.18 cvs 3695: <h3><a name="sectc427">Default presentation rules</a></h3> 3696: <p> 1.1 cvs 3697: In order to avoid having to specify, for each element type defined in the 3698: structure schema, values for every one of the numerous presentation 3699: parameters, the presentation schema allows the definition of a set of default 3700: presentation rules. These rules apply to all the boxes of the elements 3701: defined in the structure schema and to the presentation boxes and page layout 3702: boxes defined in the presentation schema. Only rules which differ from these 1.18 cvs 3703: default need to be specified in other sections of the presentation schema.</p> 3704: <p> 1.1 cvs 3705: For the primary view, the default rules can define every presentation 1.18 cvs 3706: parameter, but not the <a href="#presfunct">presentation functions</a> or the 3707: <a href="#sectc4223">linebreaking conditions</a> (the <tt>NoBreak1</tt>, 3708: <tt>NoBreak2</tt>, and <tt>Gather</tt> rules).</p> 3709: <p> 1.1 cvs 3710: In a presentation schema, the default presentation rules section is optional; 1.18 cvs 3711: in this case, the <tt>DEFAULT</tt> keyword is also absent and the following 3712: rules are considered to be the default rules:</p> 1.26 cvs 3713: <pre> Visibility: Enclosing =; 3714: VertRef: * . Left; 3715: HorizRef: Enclosed . HRef; 3716: Height: Enclosed . Height; 3717: Width: Enclosed . Width; 3718: VertPos: Top = Previous . Bottom; 3719: HorizPos: Left = Enclosing . Left; 3720: MarginTop: 0; 3721: MarginRight: 0; 3722: MarginBottom: 0; 3723: MarginLeft: 0; 3724: PaddingTop: 0; 3725: PaddingRight: 0; 3726: PaddingBottom: 0; 3727: PaddingLeft: 0; 3728: BorderTopWidth: 0; 3729: BorderRightWidth: 0; 3730: BorderBottomWidth: 0; 3731: BorderLeftWidth: 0; 3732: BorderTopColor: Foreground; 3733: BorderRightColor: Foreground; 3734: BorderBottomColor: Foreground; 3735: BorderLeftColor: Foreground; 3736: BorderTopStyle: None; 3737: BorderRightStyle: None; 3738: BorderBottomStyle: None; 3739: BorderLeftStyle: None; 3740: VertOverflow: No; 3741: HorizOverflow: No; 3742: Size: Enclosing =; 3743: Style: Enclosing =; 3744: Weight: Enclosing =; 3745: Font: Enclosing =; 3746: Underline: Enclosing =; 3747: Thickness: Enclosing =; 3748: Indent: Enclosing =; 3749: LineSpacing: Enclosing =; 3750: Adjust: Enclosing =; 3751: Justify: Enclosing =; 3752: Hyphenate: Enclosing =; 3753: PageBreak: Yes; 3754: LineBreak: Yes; 3755: InLine: Yes; 3756: Depth: 0; 3757: LineStyle: Enclosing =; 3758: LineWeight: Enclosing =; 3759: FillPattern: Enclosing =; 3760: Background: Enclosing =; 3761: Foreground: Enclosing =;</pre> 1.18 cvs 3762: <p> 1.1 cvs 3763: If other values are desired for the default rules, they must be defined 3764: explicitly in the default rules section. In fact, it is only necessary to 3765: define those default rules which differ from the ones above, since the rules 1.18 cvs 3766: above will be used whenever a rule is not explicitly named.</p> 3767: <p> 1.1 cvs 3768: Default rules for views other than the primary view can also be specified. 3769: Otherwise, the default rules for the primary views are applied to the other 1.18 cvs 3770: views.</p> 3771: <p> 3772: Default rules are expressed in the same way as <a href="#sectc4215">explicit 3773: rules for document elements</a>.</p> 3774: </div> 1.1 cvs 3775: 1.18 cvs 3776: <div class="subsection"> 1.1 cvs 3777: 1.18 cvs 3778: <h3><a name="sectc428">Presentation and page layout boxes</a></h3> 3779: <p> 1.1 cvs 3780: The presentation process uses elements which are not part of the logical 3781: structure of the document, such as pages (which are the page layout boxes) or 3782: alternatively, rules, numbers, or words introducing certain parts of the 3783: document, such as ``Summary'', ``Appendices'', ``Bibliography'', etc. (which 1.18 cvs 3784: are presentation boxes).</p> 3785: <p> 3786: After the word <tt>BOXES</tt>, each presentation or page layout box is defined 1.1 cvs 3787: by its name and a sequence of presentation rules which indicate how they must 3788: be displayed. These rules are the same as those which define the boxes 3789: associated with element of the logical structure of the document, with a 1.18 cvs 3790: single exception, the <a href="#sectc4231"><tt>Content</tt> rule</a> which is 1.1 cvs 3791: used only to specify the content of presentation boxes. The content of boxes 3792: associated with elements of the document structure is defined in each document 3793: or object and thus is not specified in the presentation schema, which applies 1.18 cvs 3794: to all documents or objects of a class.</p> 3795: <p> 1.1 cvs 3796: Among the rules which define a presentation box, certain ones can refer to 3797: another presentation box (for example, in their positional rules). If the 3798: designated box is defined after the box which designates it, a 1.18 cvs 3799: <tt>FORWARD</tt> instruction followed by the name of the designated box must 3800: appear before the designation.</p> 3801: <pre> 'BOXES' BoxSeq 1.1 cvs 3802: BoxSeq = Box < Box > . 3803: Box ='FORWARD' BoxID ';' / 3804: BoxID ':' ViewRuleSeq . 1.18 cvs 3805: BoxID = NAME .</pre> 3806: </div> 1.1 cvs 3807: 1.18 cvs 3808: <div class="subsection"> 1.1 cvs 3809: 1.18 cvs 3810: <h3><a name="sectc429">Presentation of structured elements</a></h3> 3811: <p> 3812: After the words <tt>RULES</tt>, the presentation schema gives the presentation 1.1 cvs 3813: rules that apply to the elements whose types are defined in the structure 1.18 cvs 3814: schema. Only those rules which differ from the <a 3815: href="#sectc427">default</a> must be specified in the <tt>RULES</tt> 3816: section.</p> 3817: <p> 1.1 cvs 3818: The rule definitions for each element type are composed of the name of the 3819: element type (as specified in the structure schema) followed by a colon and 1.18 cvs 3820: the set of rules specific to that type.</p> 3821: <p> 1.1 cvs 3822: The type name can be preceded by a star in the special case where the 1.18 cvs 3823: structure schema defines an <a href="#sectd3284">inclusion</a> without 1.1 cvs 3824: expansion (or with partial expansion) of a type with the same name as an 1.18 cvs 3825: element of defined in the structure schema.</p> 3826: <p> 3827: In the case where the element is a <a href="#sectd3285">mark pair</a>, but 3828: only in this case, the type name can be preceded by the keywords 3829: <tt>First</tt> or <tt>Second</tt>. These keywords indicate whether the rules 3830: that follow apply to the first or second mark of the pair.</p> 3831: <pre> 'RULES' PresentSeq 1.1 cvs 3832: PresentSeq = Present < Present > . 1.6 cvs 3833: Present = [ '*' ] [ FirstSec ] ElemID ':' 3834: ViewRuleSeq . 1.18 cvs 3835: FirstSec = 'First' / 'Second' .</pre> 3836: <p> 1.1 cvs 3837: A presentation schema can define presentation rules for base elements, which 3838: are defined implicitly in the structure schemas. In the English version of 3839: the presentation schema compiler, the base type names are the same as in the S 1.18 cvs 3840: language, but they are terminated by the <tt>_UNIT</tt> suffix: 3841: <tt>TEXT_UNIT</tt>, <tt>PICTURE_UNIT</tt>, <tt>SYMBOL_UNIT</tt>, 3842: <tt>GRAPHICS_UNIT</tt>. The base type names are written in upper-case 3843: letters.</p> 3844: </div> 3845: 3846: <div class="subsection"> 3847: 3848: <h3><a name="sectc4210">Logical attribute presentation</a></h3> 3849: <p> 3850: After the keyword <tt>ATTRIBUTES</tt>, all attributes which are to have some 1.1 cvs 3851: effect on the presentation of the element to which they are attached must be 3852: mentioned, along with the corresponding presentation rules. This is true for 3853: both global attributes (which can be attached to all element types) and local 1.18 cvs 3854: attributes (which can only be attached to certain element types).</p> 3855: <p> 1.1 cvs 3856: Also mentioned in this section are attributes which imply an effect on 3857: elements in the subtree of the element to which they are attached. The 3858: presentation of these descendants can be modified as a function of the value 3859: of the attribute which they inherit, just as if it was attached to them 1.18 cvs 3860: directly.</p> 3861: <p> 1.1 cvs 3862: The specification for each attribute includes the attribute's name, followed 3863: by an optional value specification and, after a colon, a set of rules. The 1.18 cvs 3864: set of rules must contain at least one rule.</p> 3865: <p> 1.1 cvs 3866: When there is no value specification, the rules are applied to all elements 3867: which carry the attribute, no matter what their value. When the rules must 3868: only apply when the attribute has certain values, these values must be 1.18 cvs 3869: specified. Thus, the same attribute can appear in the <tt>ATTRIBUTES</tt> 1.1 cvs 3870: section several times, with each appearance having a different value 3871: specification. However, reference attributes never have a value specification 1.18 cvs 3872: and, as a result, can only appear once in the <tt>ATTRIBUTES</tt> section.</p> 3873: <p> 1.1 cvs 3874: To specify that the presentation rules apply to some of the descendants of the 3875: element having the attribute, the name of the affected element type is given, 3876: between parentheses, after the attribute name. This way, the presentation 3877: rules for the attribute will be applied to the element having the attribute, 3878: if it is of the given type, and to all of its descendants of the given type. 1.18 cvs 3879: In the case where this type is a <a href="#sectd3285">mark pair</a>, but only 3880: in this case, the type name can be preceded by the keywords <tt>First</tt> or 3881: <tt>Second</tt>. These keywords indicate whether the rules that follow apply 1.1 cvs 3882: to the first or second mark of the pair. If the rule must apply to several 3883: different element types, the specification must be repeated for each element 1.18 cvs 3884: type.</p> 3885: <p> 1.1 cvs 3886: The specification of values for which the presentation rules will be applied 1.18 cvs 3887: varies according to the type of the attribute:</p> 3888: <dl> 3889: <dt>numeric attribute</dt> 3890: <dd> 3891: If the rules are to apply for one value of the attribute, then the attribute 3892: name is followed by an equals sign and this value. If the rules are to apply 3893: for all values less than (or greater than) a threshold value, non-inclusive, 3894: the attribute name followed by a '<' sign (or a '>' sign, respectively) and 3895: the threshold value. If the rules must apply to a range of values, the 3896: attribute name is followed by the word '<tt>IN</tt>' and the two bounds of the 3897: range, enclosed in brackets and separated by two periods ('<tt>..</tt>'). In 3898: the case of ranges, the values of the bounds are included in the range. 3899: <p> 1.1 cvs 3900: The threshold value in the comparisons can be the value of an attribute 3901: attached to an ancestor element. In this case, the attribute name is given 1.18 cvs 3902: instead of a constant value.</p> 3903: <p> 1.1 cvs 3904: It is also possible to write rules which apply only when a comparison between 3905: two different attributes of the element's ancestors is true. In this case, the 3906: first attribute name is followed by a comparison keyword and the name of the 1.18 cvs 3907: second attribute. The comparison keywords are <tt>EQUAL</tt> (simple 3908: equality), <tt>LESS</tt> (non-inclusive less than), and <tt>GREATER</tt> 3909: (non-inclusive greater than).</p> 3910: </dd> 3911: <dt>text attribute</dt> 3912: <dd> 3913: If the rules are to apply for one value of the attribute, then the attribute 3914: name is followed by an equals sign and this value. 3915: </dd> 3916: <dt>reference attribute</dt> 3917: <dd> 3918: There is never a value specification; the rules apply no matter what element 3919: is designated by the attribute. 3920: </dd> 3921: <dt>enumerated attribute</dt> 3922: <dd> 3923: If the rules are to apply for one value of the attribute, then the attribute 3924: name is followed by an equals sign and this value. 3925: </dd> 3926: </dl> 3927: <p> 1.1 cvs 3928: The order in which the rules associated with a numeric attribute are defined 3929: is important. When multiple sets of rules can be applied, the first set 1.18 cvs 3930: declared is the one used.</p> 3931: <p> 1.1 cvs 3932: Rules for attributes have priority over both default rules and rules 3933: associated with element types. The attribute rules apply to the element to 3934: which the attribute is attached. It is the rules which apply to the 3935: surrounding elements (and especially to the descendants) which determine the 3936: effect of the attribute rules on the environment ( and especially on the 1.18 cvs 3937: terminal elements of the structure).</p> 3938: <pre> 'ATTRIBUTES' PresAttrSeq 1.1 cvs 3939: PresAttrSeq = PresAttr < PresAttr > . 3940: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ] 3941: [ AttrRelation ] ':' ViewRuleSeq . 3942: AttrID = NAME . 3943: AttrRelation ='=' AttrVal / 3944: '>' [ '-' ] MinValue / 3945: '<' [ '-' ] MaxValue / 3946: 'IN' '[' [ '-' ] LowerBound '..' 3947: [ '-' ] UpperBound ']' / 3948: 'GREATER' AttrID / 3949: 'EQUAL' AttrID / 3950: 'LESS' AttrID . 3951: AttrVal = [ '-' ] EqualNum / EqualText / 3952: AttrValue . 3953: MinValue = NUMBER . 3954: MaxValue = NUMBER . 3955: LowerBound = NUMBER . 3956: UpperBound = NUMBER. 3957: EqualNum = NUMBER . 3958: EqualText = STRING . 1.18 cvs 3959: AttrValue = NAME .</pre> 3960: <p> 1.1 cvs 3961: In presentation rules associated with a numeric attribute (and only in such 3962: rules), the attribute name can be used in place of a numeric value. In this 3963: case, the value of the attribute is used in the application of the rule. Thus, 3964: the attribute can represent a relation between the size of two boxes, the 3965: height and width of a box, the height of an area where page breaks are 3966: prohibited, the distance between two boxes, the position of the reference axis 3967: of a box, the interline spacing, the indentation of the first line, the 1.18 cvs 3968: visibility, the depth (z-order), or the character set.</p> 3969: <p> 1.1 cvs 3970: The presentation rules associated with reference attributes, it is possible to 3971: use the element designated by the attribute as a reference box in a positional 1.18 cvs 3972: or extent rule. This element is represented in the <a 3973: href="#sectc4218">position</a> or <a href="#sectc4219">extent</a> rule by the 3974: keyword <tt>Referred</tt>.</p> 3975: <blockquote class="example"> 3976: <p> 3977: <strong>Example:</strong></p> 3978: <p> 1.3 cvs 3979: In all structure schemas, there is a global Language attribute defined as 1.18 cvs 3980: follows:</p> 3981: <pre>ATTR 3982: Language = TEXT;</pre> 3983: <p> 3984: The following rules would make French text be displayed in roman characters 3985: and English text be displayed in italics:</p> 3986: <pre>ATTRIBUTES 1.1 cvs 3987: Language = 'French' : 1.6 cvs 3988: Style : Roman; 1.1 cvs 3989: Language = 'English' : 1.18 cvs 3990: Style : Italics;</pre> 3991: <p> 1.4 cvs 3992: Using these rules, when the user puts the Language attribute with the value 3993: 'English' on the summary of a document, every character string (terminal 1.18 cvs 3994: elements) contained in the summary are displayed in italics. See the <a 3995: href="#sectd42252"><tt>Style</tt> rule</a>.</p> 3996: </blockquote> 3997: <blockquote class="example"> 3998: <p> 3999: <strong>Example:</strong></p> 4000: <p> 1.3 cvs 4001: A numeric attribute representing the importance of the part of the document to 1.18 cvs 4002: which it is attached can be defined:</p> 4003: <pre>ATTR 4004: Importance = INTEGER;</pre> 4005: <p> 1.4 cvs 4006: In the presentation schema, the importance of an element is reflected in the 1.18 cvs 4007: choice of character size, using the following rules.</p> 4008: <pre>ATTRIBUTES 1.1 cvs 4009: Importance < 2 : 4010: Size : 1; 4011: Importance IN [2..4] : 4012: Size : Importance; 4013: Importance = 10 : 4014: Size : 5; 4015: Importance > 4 : 1.18 cvs 4016: Size : 4;</pre> 4017: <p> 1.4 cvs 4018: Thus, the character size corresponds to the value of the Importance attribute; 1.18 cvs 4019: its value is</p> 4020: <ul> 4021: <li> 4022: the value of the Importance attribute when the value is between 2 and 4 1.1 cvs 4023: (inclusive), 1.19 cvs 4024: </li> 1.18 cvs 4025: <li> 4026: 1, when the value of the Importance attribute is less than 2, 1.19 cvs 4027: </li> 1.18 cvs 4028: <li> 4029: 4, when the value of the Importance attribute is greater than 4, 1.19 cvs 4030: </li> 1.18 cvs 4031: <li> 4032: 5, when the value of the Importance attribute is 10. 1.19 cvs 4033: </li> 1.18 cvs 4034: </ul> 4035: <p> 1.4 cvs 4036: The last case (value 5) must be defined before the case which handles all 4037: Importance values greater than 4, because the two rules are not disjoint and 4038: the first one defined will have priority. Otherwise, when the Importance 1.18 cvs 4039: attribute has value 10, the font size will be 4.</p> 4040: </blockquote> 4041: <blockquote class="example"> 4042: <p> 4043: <strong>Example:</strong></p> 4044: <p> 1.3 cvs 4045: Suppose the structure defines a list element which can have an attribute 1.18 cvs 4046: defining the type of list (numbered or not):</p> 4047: <pre>STRUCT 1.1 cvs 4048: list (ATTR list_type = enumeration, dash) 1.18 cvs 4049: = LIST OF (list_item = TEXT);</pre> 4050: <p> 1.4 cvs 4051: Then, the presentation schema could use the attribute placed on the list 4052: element to put either a dash or a number before the each element of the 1.18 cvs 4053: list:</p> 4054: <pre>ATTRIBUTES 1.1 cvs 4055: list_type (list_item) = enumeration : 4056: CreateBefore (NumberBox); 4057: list_type (list_item) = dash : 1.18 cvs 4058: CreateBefore (DashBox);</pre> 4059: </blockquote> 4060: <blockquote class="example"> 4061: <p> 4062: <strong>Example:</strong></p> 4063: <p> 1.3 cvs 4064: Suppose that two attributes are defined in the structure schema. The first is 4065: a numeric global attribute called ``version''. The other is a local attribute 1.18 cvs 4066: defined on the root of the document called ``Document_version'':</p> 4067: <pre>STRUCTURE Document 1.1 cvs 4068: ATTR 4069: version = INTEGER; 4070: STRUCT 4071: Document (ATTR Document_version = INTEGER) = 4072: BEGIN 4073: SomeElement ; 4074: ... 4075: SomeOtherElement ; 4076: END ; 1.18 cvs 4077: ...</pre> 4078: <p> 4079: These attributes can be used in the presentation schema to place change bars 4080: in the margin next to elements whose version attribute has a value equal to 4081: the Document_version attribute of the root and to place a star in margin of 1.4 cvs 4082: elements whose version attribute is less than the value of the root's 1.18 cvs 4083: Document_version attribute:</p> 4084: <pre>ATTRIBUTES 1.1 cvs 4085: version EQUAL Document_version : 4086: CreateBefore (ChangeBarBox) ; 4087: version LESS Document_version : 1.18 cvs 4088: CreateBefore (StarBox) ;</pre> 4089: </blockquote> 4090: </div> 1.1 cvs 4091: 1.18 cvs 4092: <div class="subsection"> 1.1 cvs 4093: 1.18 cvs 4094: <h3><a name="sectc4212">Value transmission rules</a></h3> 4095: <p> 1.1 cvs 4096: The last section of a presentation schema, which is optional, serves to 4097: defines the way in which a document transmits certain values to its 1.18 cvs 4098: sub-documents. A sub-document is an document <a 4099: href="#inclusion">included</a> without expansion or with partial expansion. 1.1 cvs 4100: The primary document can transmit to its sub-documents the values of certain 4101: counters or the textual content of certain of its elements, as a function of 1.18 cvs 4102: their type.</p> 4103: <p> 1.1 cvs 4104: The sub-documents receive these values in attributes which must be defined in 4105: their structure schema as local attributes of the root element. The types of 4106: these attributes must correspond to the type of the value which they receive: 4107: numeric attributes for receiving the value of a counter, textual attributes 1.18 cvs 4108: for receiving the content of an element.</p> 4109: <p> 1.1 cvs 4110: In the structure schema of the primary document, there appears at the end, 1.18 cvs 4111: after the <tt>TRANSMIT</tt> keyword, a sequence of transmission rules. Each 1.1 cvs 4112: rule begins with the name of the counter to transmit or of the element type 4113: whose textual content will be transmitted. This name is followed by the 1.18 cvs 4114: keyword <tt>To</tt> and the name of the attribute of the sub-document to which 1.1 cvs 4115: the value is transmitted. The sub-document class is indicated between 4116: parentheses after the name of the attribute. The transmission rule ends with 1.18 cvs 4117: a semicolon.</p> 4118: <pre> TransmitSeq = Transmit < Transmit > . 1.1 cvs 4119: Transmit = TypeOrCounter 'To' ExternAttr 4120: '(' ElemID ')' ';' . 4121: TypeOrCounter = CounterID / ElemID . 1.18 cvs 4122: ExternAttr = NAME .</pre> 4123: <blockquote class="example"> 4124: <p> 4125: <strong>Example:</strong></p> 4126: <p> 4127: Consider a Book document class which includes instances of the Chapter 4128: document class. These classes might have the following schemas:</p> 4129: <pre>STRUCTURE Book 1.1 cvs 4130: STRUCT 4131: Book = BEGIN 4132: Title = Text; 4133: Body = LIST OF (Chapter INCLUDED); 4134: END; 4135: ... 4136: 4137: STRUCTURE Chapter 4138: STRUCT 4139: Chapter (ATTR FirstPageNum = Integer; 4140: ChapterNum = Integer; 4141: CurrentTitle = Text) = 1.6 cvs 4142: BEGIN 4143: ChapterTitle = Text; 4144: ... 4145: END; 1.18 cvs 4146: ...</pre> 4147: <p> 1.1 cvs 4148: Then the presentation schema for books could define chapter and page counters. 4149: The following transmission rules in the book presentation schema would 4150: transmit values for the three attributes defined at the root of each chapter 1.18 cvs 4151: sub-document.</p> 4152: <pre>PRESENTATION Book; 1.1 cvs 4153: VIEWS 4154: Full_text; 4155: COUNTERS 4156: ChapterCtr: Rank of Chapter; 4157: PageCtr: Rank of Page(Full_text); 4158: ... 4159: TRANSMIT 4160: PageCtr TO FirstPageNum(Chapter); 4161: ChapterCtr TO ChapterNum(Chapter); 4162: Title TO CurrentTitle(Chapter); 1.18 cvs 4163: END</pre> 4164: <p> 1.1 cvs 4165: Thus, each chapter included in a book can number its pages as a function of 4166: the number of pages preceding it in the book, can make the chapter's number 4167: appear before the number of each of its sections, or can place the title of 1.18 cvs 4168: the book at the top of each page.</p> 4169: </blockquote> 4170: </div> 1.1 cvs 4171: 1.18 cvs 4172: <div class="subsection"> 1.1 cvs 4173: 1.18 cvs 4174: <h3><a name="sectc4213">Presentation rules</a></h3> 4175: <p> 1.1 cvs 4176: Whether defining the appearance of a presentation or page layout box, an 4177: element type, or an attribute value, the set of presentation rules that apply 1.18 cvs 4178: is always defined in the same way.</p> 4179: <p> 1.1 cvs 4180: Normally, a set of presentation rules is placed between the keywords 1.18 cvs 4181: <tt>BEGIN</tt> and <tt>END</tt>, the keyword <tt>END</tt> being followed by a 1.1 cvs 4182: semicolon. The first section of this block defines the rules that apply to 1.18 cvs 4183: the primary view, if the <a href="#sectc427">default rules</a> are not 1.1 cvs 4184: completely suitable. Next comes the rules which apply to specific other 4185: views, with a rule sequence for each view for which the default rules are not 4186: satisfactory. If the default rules are suitable for the non-primary views, 4187: there will not be any specific rules for these views. If there is only one 1.18 cvs 4188: rule which applies to all views then the keywords <tt>BEGIN</tt> and 4189: <tt>END</tt> need not appear.</p> 4190: <p> 1.1 cvs 4191: For each view, it is only necessary to specify those rules which differ from 4192: the default rules for the view, so that for certain views (or even all views), 1.18 cvs 4193: there may be no specific rules.</p> 4194: <p> 4195: The specific rules for a non-primary view are introduced by the <a 4196: name="inkeyword"><tt>IN</tt> keyword</a>, followed by the view name. The 4197: rules for that view follow, delimited by the keywords <tt>BEGIN</tt> and 4198: <tt>END</tt>, or without these two keywords when there is only one rule.</p> 4199: <p> 4200: <strong>Note:</strong> the view name which follows the <tt>IN</tt> keyword 1.1 cvs 4201: must not be the name of the primary view, since the rules for that view are 1.18 cvs 4202: found before the rules for the other views.</p> 4203: <p> 1.1 cvs 4204: Within each block concerning a view, other blocks can appear, delimited by the 1.18 cvs 4205: same keywords <tt>BEGIN</tt> and <tt>END</tt>. Each of these blocks gathers 1.1 cvs 4206: the presentation rules that apply, for a given view, only when a given 4207: condition is satisfied. Each block is preceded by a condition introduced by 1.18 cvs 4208: the <tt>IF</tt> keyword. If such a conditional block contains only one rule, 4209: the keywords <tt>BEGIN</tt> and <tt>END</tt> can be omitted.</p> 4210: <p> 1.1 cvs 4211: Although the syntax allows any presentation rule to appear in a conditional 1.18 cvs 4212: block, only <a href="#sectc4232">creation rules</a> are allowed after any 4213: condition; other rules are allowed only after conditions <tt>Within</tt> and 1.1 cvs 4214: ElemID. In addition, the following rules cannot be conditional: 1.18 cvs 4215: <tt>PageBreak, LineBreak, Inline, Gather</tt>.</p> 4216: <p> 1.1 cvs 4217: For a given view, the rules that apply without any condition must appear 4218: before the first conditional block. If some rules apply only when none of the 4219: specified condition holds, they are grouped in a block preceded by the keyword 1.18 cvs 4220: <tt>Otherwise</tt>, and that block must appear after the last conditionnal 4221: block concerning the same view.</p> 4222: <pre> ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules > 1.1 cvs 4223: 'END' ';' / 4224: ViewRules / CondRules / Rule . 4225: RulesAndCond = CondRules / Rule . 4226: ViewRules = 'IN' ViewID CondRuleSeq . 4227: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' / 4228: CondRules / Rule . 4229: CondRules = CondRule < CondRule > 4230: [ 'Otherwise' RuleSeq ] . 4231: CondRule = 'IF' ConditionSeq RuleSeq . 4232: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / 1.18 cvs 4233: Rule .</pre> 4234: <blockquote class="example"> 4235: <p> 4236: <strong>Example:</strong></p> 4237: <p> 1.3 cvs 4238: The following rules for a report's title make the title visible in the primary 4239: view and invisible in the table of contents and in the formula views (see the 1.18 cvs 4240: <a href="#sectc4224"><tt>Visibility</tt> rule</a>).</p> 4241: <pre>Title : BEGIN 1.1 cvs 4242: Visibility : 1; 4243: ... {Other rules for the primary view} 4244: IN Table_of_contents 4245: Visibility : 0; 4246: IN Formulas 4247: Visibility : 0; 1.18 cvs 4248: END;</pre> 4249: </blockquote> 4250: </div> 1.1 cvs 4251: 1.18 cvs 4252: <div class="subsection"> 1.1 cvs 4253: 1.18 cvs 4254: <h3><a name="sectc4214">Conditions applying to presentation rules</a></h3> 4255: <p> 1.1 cvs 4256: Many conditions can be applied to presentation rules. Conditions allow 4257: certain presentation rules to apply only in certain cases. These conditions 4258: can be based on the structural position of the element. They can be based on 4259: whether the element has references, and what type of references, whether the 4260: element has attributes, whether the element is empty or not. They can also be 1.18 cvs 4261: based on the value of a counter.</p> 4262: <p> 1.1 cvs 4263: It is possible to specify several conditions which must all be true for the 1.18 cvs 4264: rules to apply.</p> 4265: <p> 4266: A set of conditions is specified by the <tt>IF</tt> keyword. This keyword is 4267: followed by the sequence of conditions, separated by the <tt>AND</tt> keyword. 1.1 cvs 4268: Each condition is specified by a keyword which defines the condition type. In 4269: some cases, the keyword is followed by other data, which specify the condition 1.18 cvs 4270: more precisely.</p> 4271: <p> 1.1 cvs 4272: An elementary condition can be negative; it is then preceded by the 1.18 cvs 4273: <tt>NOT</tt> keyword.</p> 4274: <p> 1.1 cvs 4275: When the presentation rule(s) controlled by the condition apply to a reference 4276: element or a reference attribute, an elementary condition can also apply to 1.18 cvs 4277: element referred by this reference. The <tt>Target</tt> keyword is used for 1.1 cvs 4278: that purpose. It must appear before the keyword defining the condition 1.18 cvs 4279: type.</p> 4280: <pre> CondRule ='IF' ConditionSeq RuleSeq . 1.1 cvs 4281: ConditionSeq = Condition < 'AND' Condition > . 4282: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem . 4283: ConditionElem ='First' / 'Last' / 4284: [ 'Immediately' ] 'Within' [ NumParent ] 4285: ElemID [ ExtStruct ] / 4286: ElemID / 4287: 'Referred' / 'FirstRef' / 'LastRef' / 4288: 'ExternalRef' / 'InternalRef' / 'CopyRef' / 4289: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' / 4290: 'UserPage' / 'StartPage' / 'ComputedPage' / 4291: 'Empty' / 4292: '(' [ MinMax ] CounterName CounterCond ')' / 4293: CondPage '(' CounterID ')' . 4294: NumParent = [ GreaterLess ] NParent . 1.6 cvs 4295: GreaterLess ='>' / '<' . 1.1 cvs 4296: NParent = NUMBER. 1.6 cvs 4297: ExtStruct ='(' ElemID ')' . 1.1 cvs 4298: CounterCond ='<' MaxCtrVal / '>' MinCtrVal / 4299: '=' EqCtrVal / 4300: 'IN' '[' ['-'] MinCtrBound '.' '.' 4301: ['-'] MaxCtrBound ']' . 4302: PageCond ='Even' / 'Odd' / 'One' . 4303: MaxCtrVal = NUMBER . 4304: MinCtrVal = NUMBER . 4305: EqCtrVal = NUMBER . 4306: MaxCtrBound = NUMBER . 1.18 cvs 4307: MinCtrBound = NUMBER .</pre> 1.1 cvs 4308: 1.18 cvs 4309: <div class="subsubsection"> 1.1 cvs 4310: 1.18 cvs 4311: <h4><a name="sectd42141">Conditions based on the logical position of the 4312: element</a></h4> 4313: <p> 1.1 cvs 4314: The condition can be on the position of the element in the document's logical 4315: structure tree. It is possible to test whether the element is the first 1.18 cvs 4316: (<tt>First</tt>) or last (<tt>Last</tt>) among its siblings or if it is not 4317: the first (<tt>NOT First</tt>) or not the last (<tt>NOT Last</tt>). These 4318: conditions can be associated only with <a href="#sectc4232">creation 4319: rules</a>.</p> 4320: <p> 1.1 cvs 4321: It is also possible to test if the element is contained in an element of a 1.18 cvs 4322: given type (<tt>Within</tt>) or if it is not (<tt>NOT Within</tt>). The type 4323: is indicated after the keyword <tt>Within</tt>. If that element type is 1.1 cvs 4324: defined in a structure schema which is not the one which corresponds to the 4325: presentation schema, the type name of this element must be followed, between 1.18 cvs 4326: parentheses, by the name of the structure schema which defines it.</p> 4327: <p> 4328: If the keyword <tt>Within</tt> is preceded by <tt>Immediately</tt>, the 4329: condition is satisfied only if the <em>parent</em> element has the type 4330: indicated. If the word <tt>Immediately</tt> is missing, the condition is 4331: satisfied if any <em>ancestor</em> has the type indicated.</p> 4332: <p> 4333: An integer <i>n</i> can appear between the keyword <tt>Within</tt> and the 1.1 cvs 4334: type. It specifies the number of ancestors of the indicated type that must be 4335: present for the condition to be satisfied. If the keyword 1.18 cvs 4336: <tt>Immediately</tt> is also present, the <i>n</i> immediate ancestors of the 4337: element must have the indicated type. The integer <i>n</i> must be positive 4338: or zero. It can be preceded by <tt><</tt> or <tt>></tt> to indicate a 1.1 cvs 4339: maximum or minimum number of ancestors. If these symbols are missing, the 1.18 cvs 4340: condition is satisfied only if it exists exactly <i>n</i> ancestors. When 4341: this number is missing, it is equivalent to > 0.</p> 4342: <p> 1.1 cvs 4343: If the condition applies to presentation rules associated with an attribute, 1.18 cvs 4344: in the <tt>ATTRIBUTES</tt> section of the presentation schema, the condition 1.1 cvs 4345: can be simply an element name. Presentation rules are then executed only if 1.18 cvs 4346: the attribute is attached to an element of that type. The keyword <tt>NOT</tt> 1.1 cvs 4347: before the element name indicates that the presentation rules must be executed 1.18 cvs 4348: only if the element is not of the type indicated.</p> 4349: </div> 1.1 cvs 4350: 1.18 cvs 4351: <div class="subsubsection"> 1.1 cvs 4352: 1.18 cvs 4353: <h4><a name="sectd42142">Conditions on references</a></h4> 4354: <p> 1.1 cvs 4355: References may be taken into account in conditions, which can be based on the 4356: fact that the element, or one of its ancestors, is designated by a at least 1.18 cvs 4357: one reference (<tt>Referred</tt>) or by none (<tt>NOT Referred</tt>).</p> 4358: <p> 1.1 cvs 4359: If the element or attribute to which the condition is attached is a reference, 4360: the condition can be based on the fact that it acts as the first reference to 1.18 cvs 4361: the designated element (<tt>FirstRef</tt>), or as the last (<tt>LastRef</tt>), 1.1 cvs 4362: or as a reference to an element located in another document 1.18 cvs 4363: (<tt>ExternalRef</tt>) or in the same document (<tt>InternalRef</tt>).</p> 4364: <p> 4365: The condition can also be based on the fact that the element is an <a 4366: href="#inclusion">inclusion</a>. This is noted (<tt>CopyRef</tt>).</p> 4367: <p> 1.1 cvs 4368: Like all conditions, conditions on references can be inverted by the 1.18 cvs 4369: <tt>NOT</tt> keyword. These conditions can be associated only with <a 4370: href="#sectc4232">creation rules</a>.</p> 4371: </div> 1.1 cvs 4372: 1.18 cvs 4373: <div class="subsubsection"> 1.1 cvs 4374: 1.18 cvs 4375: <h4><a name="sectd42143">Conditions on logical attributes</a></h4> 4376: <p> 1.1 cvs 4377: The condition can be based on the presence or absence of attributes associated 4378: with the element, no matter what the attributes or their values. The 1.18 cvs 4379: <tt>AnyAttributes</tt> keyword expresses this condition.</p> 4380: <p> 1.1 cvs 4381: If the condition appears in the presentation rules of an attribute, the 1.18 cvs 4382: <tt>FirstAttr</tt> and <tt>LastAttr</tt> keywords can be used to indicate that 1.1 cvs 4383: the rules must only be applied if this attribute is the first attribute for 4384: the element or if it is the last (respectively). These conditions can also be 1.18 cvs 4385: inverted by the <tt>NOT</tt> keyword. These conditions can be associated only 4386: with <a href="#sectc4232">creation rules</a>.</p> 4387: <p> 1.1 cvs 4388: It is also possible to apply certain presentation rules only when the element 4389: being processed or one of its ancestors has a certain attribute, perhaps with 1.18 cvs 4390: a certain value. This can be done in the <a 4391: href="#sectc4210"><tt>ATTRIBUTES</tt> section</a>.</p> 4392: </div> 1.1 cvs 4393: 1.18 cvs 4394: <div class="subsubsection"> 1.1 cvs 4395: 1.18 cvs 4396: <h4><a name="sectd42144">Conditions on page breaks</a></h4> 4397: <p> 1.1 cvs 4398: The page break base type (and only this type) can use the following 1.18 cvs 4399: conditions: <tt>ComputedPage</tt>, <tt>StartPage</tt>, and <tt>UserPage</tt>. 4400: The <tt>ComputedPage</tt> condition indicates that the presentation rule(s) 1.1 cvs 4401: should apply if the page break was created automatically by Thot; the 1.18 cvs 4402: <tt>StartPage</tt> condition is true if the page break is generated before the 4403: element by the <tt>Page</tt> rule; and the <tt>UserPage</tt> condition applies 4404: if the page break was inserted by the user.</p> 4405: <p> 4406: These conditions can be associated only with <a href="#sectc4232">creation 4407: rules</a>.</p> 4408: </div> 1.1 cvs 4409: 1.18 cvs 4410: <div class="subsubsection"> 1.1 cvs 4411: 1.18 cvs 4412: <h4><a name="sectd42145">Conditions on the element's content</a></h4> 4413: <p> 1.1 cvs 4414: The condition can be based on whether or not the element is empty. An element 4415: which has no children or whose leaves are all empty is considered to be empty 1.18 cvs 4416: itself. This condition is expressed by the <tt>Empty</tt> keyword, optionally 4417: preceded by the <tt>NOT</tt> keyword. This condition can be associated only 4418: with <a href="#sectc4232">creation rules</a>.</p> 4419: </div> 1.1 cvs 4420: 1.18 cvs 4421: <div class="subsubsection"> 1.1 cvs 4422: 1.18 cvs 4423: <h4><a name="sectd42146">Conditions on counters</a></h4> 4424: <p> 1.1 cvs 4425: Presentation rules can apply when the counter's value is one, is even or odd, 4426: is equal, greater than or less than a given value or falls in a range of 4427: values. This is particularly useful for creating header and footer boxes. 1.18 cvs 4428: These conditions can be associated only with <a href="#sectc4232">creation 4429: rules</a>.</p> 4430: <p> 1.1 cvs 4431: To compare the value of a counter to a given value, a comparison is given 4432: between parentheses. The comparison is composed of the counter name followed 4433: by an equals, greater than, or less than sign and the value to which the 4434: counter will be compared. A test for whether or not a counter's value falls 4435: in a range also appears within parentheses. In this case, the counter name is 1.18 cvs 4436: followed by the <tt>IN</tt> keyword and the range definition within brackets. 4437: The <tt>Even</tt>, <tt>Odd</tt> and <tt>One</tt> are used to test a counter's 4438: value and are followed by the counter name between parentheses.</p> 4439: <p> 4440: The list of possible conditions on counters is:</p> 4441: <dl> 4442: <dt><tt>Even (Counter)</tt></dt> 4443: <dd> 4444: the box is created only if the counter has an even value. 4445: </dd> 4446: <dt><tt>Odd (Counter)</tt></dt> 4447: <dd> 4448: the box is created only if the counter has an odd value. 4449: </dd> 4450: <dt><tt>One (Counter)</tt></dt> 4451: <dd> 4452: the box is created only the counter's value is 1. 4453: </dd> 4454: <dt><tt>NOT One (Counter)</tt></dt> 4455: <dd> 4456: the box is created, unless the counter's value is 1. 4457: </dd> 4458: <dt><tt>(Counter < Value)</tt></dt> 4459: <dd> 4460: the box is created only if the counter's value is less than Value. 4461: </dd> 4462: <dt><tt>(Counter > Value)</tt></dt> 4463: <dd> 4464: the box is created only if the counter's value is greater than Value. 4465: </dd> 4466: <dt><tt>(Counter = Value)</tt></dt> 4467: <dd> 4468: the box is created only if the counter's value is equal to Value. 4469: </dd> 4470: <dt><tt>NOT (Counter = Value)</tt></dt> 4471: <dd> 4472: the is created only if the counter's value is different than Value. 4473: </dd> 4474: <dt><tt>(Counter IN [MinValue..MaxValue])</tt></dt> 4475: <dd> 4476: the box is created only if the counter's value falls in the range bounded by 4477: MinValue and MaxValue (inclusive). 4478: </dd> 4479: <dt><tt>NOT (Counter IN [MinValue..MaxValue])</tt></dt> 4480: <dd> 4481: the box is created only if the value of the counter does not fall in the range 4482: bounded by MinValue and MaxValue (inclusive). 4483: </dd> 4484: </dl> 4485: <p> 4486: <strong>Note:</strong> the <tt>NOT Even</tt> and <tt>NOT Odd</tt> conditions 4487: are syntactically correct but can be expressed more simply by <tt>Odd</tt> and 4488: <tt>Even</tt>, respectively.</p> 4489: </div> 4490: </div> 1.1 cvs 4491: 1.18 cvs 4492: <div class="subsection"> 1.1 cvs 4493: 1.18 cvs 4494: <h3><a name="sectc4215">A presentation rule</a></h3> 4495: <p> 1.1 cvs 4496: A presentation rule defines either a presentation parameter or presentation 1.18 cvs 4497: function. The parameters are:</p> 4498: <ul> 4499: <li> 4500: the position of the vertical and horizontal reference axes of the box, 1.19 cvs 4501: </li> 1.18 cvs 4502: <li> 4503: the position of the box in relation to other boxes, 1.19 cvs 4504: </li> 1.18 cvs 4505: <li> 4506: the height or width of the box, with overflow exceptions, 1.19 cvs 4507: </li> 1.18 cvs 4508: <li> 1.26 cvs 4509: the margins, padding and borders of the box, 4510: </li> 4511: <li> 1.18 cvs 4512: the characteristics of the lines contained in the box: linespacing, 1.1 cvs 4513: indentation of the first line, justification, hyphenation, 1.19 cvs 4514: </li> 1.18 cvs 4515: <li> 4516: the conditions for breaking the box across pages, 1.19 cvs 4517: </li> 1.18 cvs 4518: <li> 4519: the characteristics of the characters contained in the box: size, font, style, 4520: underlining, 1.19 cvs 4521: </li> 1.18 cvs 4522: <li> 4523: the depth of the box among overlapping boxes (often called stacking order), 1.19 cvs 4524: </li> 1.18 cvs 4525: <li> 4526: the characteristics of graphic elements contained in the box: style and 1.1 cvs 4527: thickness of lines, fill pattern for closed objects, 1.19 cvs 4528: </li> 1.18 cvs 4529: <li> 4530: the colors in text, graphics, pictures, and symbols contained in the box are 4531: displayed or printed, 1.19 cvs 4532: </li> 1.18 cvs 4533: <li> 4534: for presentation boxes only, the contents of the box. 1.19 cvs 4535: </li> 1.18 cvs 4536: </ul> 4537: <p> 4538: The <a name="presfunct">presentation functions</a> are:</p> 4539: <ul> 4540: <li> 4541: the creation of a presentation box 1.19 cvs 4542: </li> 1.18 cvs 4543: <li> 4544: the line-breaking or page-breaking style, 1.19 cvs 4545: </li> 1.18 cvs 4546: <li> 4547: the copying of another box, 1.19 cvs 4548: </li> 1.18 cvs 4549: <li> 4550: the display of the box background and border, 1.19 cvs 4551: </li> 1.18 cvs 4552: <li> 4553: the display of a background picture and its aspect. 1.19 cvs 4554: </li> 1.18 cvs 4555: </ul> 4556: <p> 1.1 cvs 4557: For each box and each view, every presentation parameter is defined once and 1.18 cvs 4558: only once, either explicitly or by the <a href="#sectc427">default rules</a>. 4559: In contrast, presentation functions are not obligatory and can appear many 4560: times for the same element. for example an element can create many 4561: presentation boxes. Another element may not use any presentation 4562: functions.</p> 4563: <p> 1.1 cvs 4564: Each rule defining a presentation parameter begins with a keyword followed by 1.18 cvs 4565: a colon. The keyword indicates the parameter which is the subject of the 4566: rule. After the keyword and the colon, the remainder of the rule varies. All 4567: rules are terminated by a semicolon.</p> 4568: <pre> Rule = PresParam ';' / PresFunc ';' . 1.6 cvs 4569: PresParam ='VertRef' ':' PositionHoriz / 4570: 'HorizRef' ':' PositionVert / 4571: 'VertPos' ':' VPos / 4572: 'HorizPos' ':' HPos / 4573: 'Height' ':' Dimension / 4574: 'Width' ':' Dimension / 4575: 'VertOverflow' ':' Boolean / 1.1 cvs 4576: 'HorizOverflow' ':' Boolean / 1.26 cvs 4577: 'MarginTop' ':' MarginWidth / 4578: 'MarginRight' ':' MarginWidth / 4579: 'MarginBottom' ':' MarginWidth / 4580: 'MarginLeft' ':' MarginWidth / 4581: 'PaddingTop' ':' PaddingWidth / 4582: 'PaddingRight' ':' PaddingWidth / 4583: 'PaddingBottom' ':' PaddingWidth / 4584: 'PaddingLeft' ':' PaddingWidth / 4585: 'BorderTopWidth' ':' BorderWidth / 4586: 'BorderRightWidth' ':' BorderWidth / 4587: 'BorderBottomWidth' ':' BorderWidth / 4588: 'BorderLeftWidth' ':' BorderWidth / 4589: 'BorderTopColor' ':' BorderColor / 4590: 'BorderRightColor' ':' BorderColor / 4591: 'BorderBottomColor' ':' BorderColor / 4592: 'BorderLeftColor' ':' BorderColor / 4593: 'BorderTopStyle' ':' BorderStyle / 4594: 'BorderRightStyle' ':' BorderStyle / 4595: 'BorderBottomStyle' ':' BorderStyle / 4596: 'BorderLeftStyle' ':' BorderStyle . 1.6 cvs 4597: 'LineSpacing' ':' DistanceInherit / 4598: 'Indent' ':' DistanceInherit / 4599: 'Adjust' ':' AdjustInherit / 4600: 'Justify' ':' BoolInherit / 4601: 'Hyphenate' ':' BoolInherit / 4602: 'PageBreak' ':' Boolean / 4603: 'LineBreak' ':' Boolean / 4604: 'InLine' ':' Boolean / 4605: 'NoBreak1' ':' AbsDist / 4606: 'NoBreak2' ':' AbsDist / 4607: 'Gather' ':' Boolean / 4608: 'Visibility' ':' NumberInherit / 4609: 'Size' ':' SizeInherit / 4610: 'Font' ':' NameInherit / 4611: 'Style' ':' StyleInherit / 1.23 cvs 4612: 'Weight' ':' WeightInherit / 1.6 cvs 4613: 'Underline' ':' UnderLineInherit / 4614: 'Thickness' ':' ThicknessInherit / 4615: 'Depth' ':' NumberInherit / 4616: 'LineStyle' ':' LineStyleInherit / 4617: 'LineWeight' ':' DistanceInherit / 4618: 'FillPattern' ':' NameInherit / 4619: 'Background' ':' NameInherit / 1.13 cvs 4620: 'Foreground' ':' NameInherit / 1.6 cvs 4621: 'Content' ':' VarConst . 1.1 cvs 4622: PresFunc = Creation '(' BoxID ')' / 4623: 'Line' / 4624: 'NoLine' / 4625: 'Page' '(' BoxID ')' / 1.13 cvs 4626: 'Copy' '(' BoxTypeToCopy ')' / 4627: 'ShowBox' / 1.18 cvs 4628: 'BackgroundPicture' ':' FileName / 4629: 'PictureMode' ':' PictMode /</pre> 4630: </div> 4631: 4632: <div class="subsection"> 4633: 4634: <h3><a name="sectc4216">Box axes</a></h3> 4635: <p> 4636: The position of the middle axes <tt>VMiddle</tt> and <tt>HMiddle</tt> in 1.1 cvs 4637: relation to their box is always calculated automatically as a function of the 4638: height and width of the box and is not specified by the presentation rules. In 4639: the presentation schema, these middle axes are used only to position their box 4640: with respect to another by specifying the distance between the middle axis and 1.18 cvs 4641: an axis or a side of another box (see the <a href="#sectc4218">relative 4642: position</a>).</p> 4643: <p> 1.1 cvs 4644: The reference axes of a box are also used to position their box in relation to 4645: another, but in contrast to the middle axes, the presentation schema must make 4646: their position explicit, either in relation to a side or the middle axis of 1.18 cvs 4647: the box itself, or in relation to an axis of an enclosed box.</p> 4648: <p> 1.1 cvs 4649: Only boxes of base elements have predefined reference axes. For character 4650: string boxes, the horizontal reference axis is the baseline of the characters 4651: (the line which passes immediately under the upper-case letters, ignoring the 4652: letter Q) and the vertical reference axis is at the left edge of the first 1.18 cvs 4653: character of the string.</p> 4654: <p> 4655: The positions of a box's reference axes are defined by the <tt>VertRef</tt> 4656: and <tt>HorizRef</tt> rules which specify the <a href="#distance">distance</a> 1.1 cvs 4657: between the reference axis and an axis or parallel side of the same box or of 1.18 cvs 4658: an enclosed box.</p> 4659: <pre> 'VertRef' ':' PositionHoriz 4660: 'HorizRef' ':' PositionVert</pre> 4661: <blockquote class="example"> 4662: <p> 4663: <strong>Example:</strong></p> 4664: <p> 1.3 cvs 4665: If, in the structure schema for mathematical formulas, the fraction element is 1.18 cvs 4666: defined by</p> 4667: <pre>Fraction = BEGIN 1.1 cvs 4668: Numerator = Expression; 4669: Denominator = Expression; 1.18 cvs 4670: END;</pre> 4671: <p> 1.3 cvs 4672: then the horizontal reference axis of the fraction can be positioned on top of 1.18 cvs 4673: the denominator by the rule:</p> 4674: <pre>Fraction : 1.1 cvs 4675: BEGIN 4676: HorizRef : Enclosed Denominator . Top; 4677: ... 1.18 cvs 4678: END;</pre> 4679: <p> 4680: To put the horizontal reference axis of a column at its middle:</p> 4681: <pre>Column : 1.1 cvs 4682: BEGIN 4683: HorizRef : * . HMiddle; 4684: ... 1.18 cvs 4685: END;</pre> 4686: </blockquote> 4687: </div> 1.1 cvs 4688: 1.18 cvs 4689: <div class="subsection"> 1.1 cvs 4690: 1.18 cvs 4691: <h3><a name="sectc4217">Distance units</a></h3> 4692: <p> 1.1 cvs 4693: Some distances and dimensions appear in many rules of a presentation schema, 1.18 cvs 4694: especially in position rules (<tt>VertPos, HorizPos</tt>), in extent rules for 4695: boxes (<tt>Height, Width</tt>), in rules defining lines (<tt>LineSpacing, 4696: Indent</tt>), in rules controlling pagination (<tt>NoBreak1, NoBreak2</tt>) 4697: and in rules specifying the thickness of strokes (<tt>LineWeight</tt>).</p> 4698: <p> 4699: In all these rules, the distance or extent can be expressed</p> 4700: <ul> 4701: <li> 4702: either in relative units, which depend on the size of the characters in the 4703: current font: height of the element's font or height of the letter 'x', 1.19 cvs 4704: </li> 1.18 cvs 4705: <li> 4706: or in absolute units: centimeter, millimeter, inch, typographer's point, pica 4707: or pixel. 1.19 cvs 4708: </li> 1.18 cvs 4709: </ul> 4710: <p> 1.5 cvs 4711: Units can be chosen freely. Thus, it is possible to use relative units in one 1.18 cvs 4712: rule, centimeters in the next rule, and typographer's points in another.</p> 4713: <p> 1.1 cvs 4714: Absolute units are used to set rigid rules for the appearance of documents. In 4715: contrast, relative units allow changes of scale. The editor lets the value of 4716: relative units be changed dynamically. Such changes affect every box using 4717: relative units simultaneously and in the same proportion. Changing the value 4718: of the relative units affects the size of the characters and graphical 1.18 cvs 4719: elements, and the size of the boxes and the distances between them.</p> 4720: <p> 4721: A <a name="distance">distance</a> or extent is specified by a number, which 1.1 cvs 4722: may be followed by one or more spaces and a units keyword. When there is no 4723: units keyword, the number specifies the number of relative units, where a 4724: relative unit is the height of a character in the current font (an em). When 4725: the number is followed by a units keyword, the keyword indicates the type of 1.18 cvs 4726: absolute units:</p> 4727: <ul> 4728: <li> 4729: <tt>em</tt>: height of the element's font, 1.19 cvs 4730: </li> 1.18 cvs 4731: <li> 4732: <tt>ex</tt>: height of the letter 'x', 1.19 cvs 4733: </li> 1.18 cvs 4734: <li> 4735: <tt>cm</tt>: centimeter, 1.19 cvs 4736: </li> 1.18 cvs 4737: <li> 4738: <tt>mm</tt>: millimeter, 1.19 cvs 4739: </li> 1.18 cvs 4740: <li> 4741: <tt>in</tt>: inch (1 in = 2.54 cm), 1.19 cvs 4742: </li> 1.18 cvs 4743: <li> 4744: <tt>pt</tt>: point (1 pt = 1/72 in), 1.19 cvs 4745: </li> 1.18 cvs 4746: <li> 4747: <tt>pc</tt>: pica (1 pc = 12 pt), 1.19 cvs 4748: </li> 1.18 cvs 4749: <li> 4750: <tt>px</tt>: pixel. 1.19 cvs 4751: </li> 1.18 cvs 4752: </ul> 4753: <p> 1.1 cvs 4754: Whatever the chosen unit, relative or absolute, the number is not necessarily 4755: an integer and may be expressed in fixed point notation (using the American 1.18 cvs 4756: convention of a period to express the decimal point).</p> 4757: <p> 1.1 cvs 4758: If the distance appears in a presentation rule for a numeric attribute, the 4759: number can be replaced by the name of an attribute. In this case, the value 4760: of the attribute is used. Obviously, the attribute name cannot be followed by 4761: a decimal point and a fractional part, but it can be followed a units keyword. 1.18 cvs 4762: However, the choice of units is limited to em, ex, pt and px.</p> 4763: <pre> Distance = [ Sign ] AbsDist . 1.1 cvs 4764: Sign ='+' / '-' . 4765: AbsDist = IntegerOrAttr [ '.' DecimalPart ] 4766: [ Unit ]. 4767: IntegerOrAttr = IntegerPart / AttrID . 4768: IntegerPart = NUMBER . 4769: DecimalPart = NUMBER . 4770: Unit ='em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' / 1.18 cvs 4771: 'pc' / 'px' / '%' .</pre> 4772: <blockquote class="example"> 4773: <p> 4774: <strong>Example:</strong></p> 4775: <p> 1.3 cvs 4776: The following rules specify that a box has a height of 10.5 centimeters and a 1.18 cvs 4777: width of 5.3 ems:</p> 4778: <pre>Height : 10.5 cm; 4779: Width : 5.3;</pre> 4780: </blockquote> 4781: </div> 1.1 cvs 4782: 1.18 cvs 4783: <div class="subsection"> 1.1 cvs 4784: 1.18 cvs 4785: <h3><a name="sectc4218">Relative positions</a></h3> 4786: <p> 1.1 cvs 4787: The positioning of boxes uses the eight axes and sides, the sides generally 4788: being used to define the juxtapositioning (vertical or horizontal) of boxes, 4789: the middle axes being used to define centering, and the reference axes being 1.18 cvs 4790: used for alignment.</p> 4791: <p> 4792: Two rules allow a box to be placed relative to other boxes. The 4793: <tt>VertPos</tt> rule positions the box vertically. The <tt>HorizPos</tt> 4794: rule positions the box horizontally. It is possible that a box's position 4795: could be entirely determined by other boxes positioned relative to it. In this 4796: case, the position is implicit and the word <tt>nil</tt> can be used to 4797: specify that no position rule is needed. Otherwise, an explicit rule must be 4798: given by indicating the axis or side which defines the position of the box, 4799: followed by an equals sign and the distance between between this axis or side 4800: and a parallel axis or side of another box, called the reference box. The box 4801: for which the rule is written will be positioned relative to the reference 4802: box.</p> 4803: <pre> 'VertPos' ':' VPos 1.6 cvs 4804: 'HorizPos' ':' HPos 4805: HPos = 'nil' / VertAxis '=' HorizPosition 4806: [ 'UserSpecified' ]. 4807: VPos = 'nil' / HorizAxis '=' VertPosition 4808: [ 'UserSpecified' ]. 1.1 cvs 4809: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' . 1.18 cvs 4810: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .</pre> 4811: <p> 1.1 cvs 4812: The reference box is an adjacent box: enclosing, enclosed or adjacent. When a 4813: rule is associated with a reference type attribute (and only in this case), it 4814: can be a box of the element designated by the attribute. The reference box 1.18 cvs 4815: can be either a presentation box previously defined in the <tt>BOXES</tt> 1.1 cvs 4816: section of the schema and created by a creation function, or the box 1.18 cvs 4817: associated with a structured element.</p> 4818: <p> 1.1 cvs 4819: The structural position of the reference box (relative to the box for which 1.18 cvs 4820: the rule is being written) is indicated by a keyword: <tt>Enclosing</tt>, 4821: <tt>Enclosed</tt>, or, for sibling boxes, <tt>Previous</tt> or <tt>Next</tt>. 1.1 cvs 4822: The reference attributes, or presentation boxes created by a reference 1.18 cvs 4823: attribute, the <tt>Referred</tt> keyword may be used to designate the element 4824: which the reference points to. The keyword <tt>Creator</tt> can be used in 1.1 cvs 4825: rules for presentation boxes to designate the box of the element which created 1.18 cvs 4826: the presentation box. Finally, the <tt>Root</tt> keyword can be used to 4827: designate the root of the document.</p> 4828: <p> 4829: When the keyword is ambiguous, it is followed by the name of an element type 4830: or presentation box which resolves the ambiguity (the <tt>Creator</tt> and 4831: <tt>Root</tt> keywords are never ambiguous). If this name is not given, then 1.1 cvs 4832: the first box encountered is used as the reference box. It is also possible to 1.18 cvs 4833: use just the name of an element type or presentation box without an initial 4834: keyword. In this case, a sibling having that name will be used. If the name 4835: is preceded by the keyword <tt>NOT</tt>, then the reference box will be the 4836: first box whose type is not the named one.</p> 4837: <p> 4838: In place of the box or type name, the keywords <tt>AnyElem</tt>, 4839: <tt>AnyBox</tt> and <tt>ElemWithAttr</tt> can be used, representing 1.17 cvs 4840: respectively, any structured element box, any presentation box, and the box 4841: corresponding to any structured element having a particular attribute, 4842: whatever its value; the name of this attribute must follow the keyword 1.18 cvs 4843: <tt>ElemWithAttr</tt>.</p> 4844: <p> 1.17 cvs 4845: A type name may be preceded by a star in order to resolve the ambiguity in the 1.18 cvs 4846: special case where the structure schema defines an <a 4847: href="#sectd3284">inclusion</a> without expansion (or with partial expansion) 4848: of the same type as an element of the scheme. For mark pairs (and only for <a 4849: href="#sectd3285">mark pairs</a>) the type name <em>must</em> be preceded by 4850: the <tt>First</tt> or <tt>Second</tt> keyword, which indicates which of the 4851: two marks of the pair should be used as the reference box.</p> 4852: <p> 4853: The star character ('<tt>*</tt>') used alone designates the box to which the 1.1 cvs 4854: rule applies (in this case, it is obviously useless to specify the type of the 1.18 cvs 4855: reference box).</p> 4856: <p> 4857: The keywords <tt>Enclosing</tt> and <tt>Enclosed</tt> can be used no matter 1.1 cvs 4858: what constructor defines the type to which the rule applies. When applied to 1.18 cvs 4859: the element which represents the entire document, <tt>Enclosing</tt> 1.1 cvs 4860: designates the window or page in which the document's image is displayed for 4861: the view to which the rule applies. A box or type name without a keyword is 4862: used for aggregate elements and designates another element of the same 4863: aggregate. It can also be used to designate a presentation or page layout 1.18 cvs 4864: box. The keywords <tt>Previous</tt> and <tt>Next</tt> are primarily used to 1.1 cvs 4865: denote list elements, but can also be used to denote elements of an 1.18 cvs 4866: aggregate.</p> 4867: <p> 1.1 cvs 4868: In the position rule, the structural position relative to the reference box is 4869: followed, after a period, by the name of an axis or side. The rule specifies 4870: its node's position as being some distance from this axis or side of the 4871: reference box. If this distance is zero, then the distance does not appear in 4872: the rule. Otherwise, it does appear as a positive or negative number (the 4873: sign is required for negative numbers). The sign takes into account the 4874: orientation of the coordinate axes: for top to bottom for the vertical axis 4875: and from left to right for the horizontal axis. Thus, a negative distance in 4876: a vertical position indicates that the side or axis specified in the rule is 1.18 cvs 4877: above the side or axis of the reference box.</p> 4878: <p> 4879: The distance can be followed by the <tt>UserSpecified</tt> keyword (even if 4880: the distance is nil and does not appear, the <tt>UserSpecified</tt> keyword 1.1 cvs 4881: can be used). It indicates that when the element to which the rule applies is 4882: being created, the editor will ask the user to specify the distance himself, 4883: using the mouse. In this case, the distance specified in the rule is a 4884: default distance which is suggested to the user but can be modified. The 1.18 cvs 4885: <tt>UserSpecified</tt> keyword can be used either in the vertical position 4886: rule, the horizontal position rule, or both.</p> 4887: <pre> VertPosition = Reference '.' HorizAxis [ Distance ] . 1.1 cvs 4888: HorizPosition = Reference '.' VertAxis [ Distance ] . 4889: Reference ='Enclosing' [ BoxTypeNot ] / 4890: 'Enclosed' [ BoxTypeNot ] / 4891: 'Previous' [ BoxTypeNot ] / 4892: 'Next' [ BoxTypeNot ] / 4893: 'Referred' [ BoxTypeNot ] / 4894: 'Creator' / 4895: 'Root' / 4896: '*' / 4897: BoxOrType . 4898: BoxOrType = BoxID / 4899: [ '*' ] [ FirstSec ] ElemID / 1.17 cvs 4900: 'AnyElem' / 'AnyBox' / 4901: 'ElemWithAttr' AttrID . 1.18 cvs 4902: BoxTypeNot = [ 'NOT' ] BoxOrType .</pre> 4903: <blockquote class="example"> 4904: <p> 4905: <strong>Example:</strong></p> 4906: <p> 4907: If a <a name="expos1">report</a> is defined by the following structure 4908: schema:</p> 4909: <pre>Report = BEGIN 1.6 cvs 4910: Title = Text; 4911: Summary = Text; 4912: Keywords = Text; 4913: ... 1.18 cvs 4914: END;</pre> 4915: <p> 4916: then the presentation schema could contain the rules:</p> 4917: <pre>Report : BEGIN 1.6 cvs 4918: VertPos : Top = Enclosing . Top; 4919: HorizPos : Left = Enclosing . Left; 4920: ... 1.18 cvs 4921: END;</pre> 4922: <p> 4923: These rules place the <a name="reportexample">report</a> in the upper left 4924: corner of the enclosing box, which is the window in which the document is 4925: being edited.</p> 4926: <pre>Title : BEGIN 1.6 cvs 4927: VertPos : Top = Enclosing . Top + 1; 4928: HorizPos : VMiddle = Enclosing . VMiddle; 4929: ... 1.18 cvs 4930: END;</pre> 4931: <p> 1.3 cvs 4932: The top of the title is one line (a line has the height of the characters of 4933: the title) from the top of the report, which is also the top of the editing 1.18 cvs 4934: window. The title is centered horizontally in the window (see <a 4935: href="#posdim">figure</a>).</p> 4936: <pre>Summary : BEGIN 1.1 cvs 4937: VertPos : Top = Title . Bottom + 1.5; 4938: HorizPos : Left = Enclosing . Left + 2 cm; 4939: ... 1.18 cvs 4940: END;</pre> 4941: <p> 4942: The top of the summary is place a line and a half below the bottom of the 4943: title and is shifted two centimeters from the side of the window.</p> 4944: </blockquote> 4945: <blockquote class="example"> 4946: <p> 4947: <strong>Example:</strong></p> 4948: <p> 4949: Suppose there is a <a name="expos2">Design</a> logical structure which 4950: contains graphical elements:</p> 4951: <pre>Design = LIST OF (ElemGraph = GRAPHICS);</pre> 4952: <p> 1.3 cvs 4953: The following rules allow the user to freely choose the position of each 1.18 cvs 4954: element when it is created:</p> 4955: <pre>ElemGraph = 1.1 cvs 4956: BEGIN 4957: VertPos : Top = Enclosing . Top + 1 cm UserSpecified; 4958: HorizPos: Left = Enclosing . Left UserSpecified; 4959: ... 1.18 cvs 4960: END;</pre> 4961: <p> 4962: Thus, when a graphical element is created, its default placement is at the 4963: left of the window and 1 cm from the top, but the user can move it 4964: immediately, simply by moving the mouse.</p> 4965: </blockquote> 4966: </div> 1.1 cvs 4967: 1.18 cvs 4968: <div class="subsection"> 1.1 cvs 4969: 1.18 cvs 4970: <h3><a name="sectc4219">Box extents</a></h3> 4971: <p> 1.1 cvs 4972: The extents (height and width) of each box are defined by the two rules 1.18 cvs 4973: <tt>Height</tt> and <tt>Width</tt>. There are three types of extents: fixed, 4974: relative, and elastic.</p> 1.1 cvs 4975: 1.18 cvs 4976: <div class="subsubsection"> 1.1 cvs 4977: 1.18 cvs 4978: <h4><a name="sectd42191">Fixed extents</a></h4> 4979: <p> 1.1 cvs 4980: A fixed dimension sets the height or width of the box independently of all 1.18 cvs 4981: other boxes. It is expressed in <a href="#sectc4217">distance units</a>. The 4982: extent can be followed by the <tt>UserSpecified</tt> keyword which indicates 1.1 cvs 4983: that when the element to which the rule applies is being created, the editor 4984: will ask the user to specify the extent himself, using the mouse. In this 4985: case, the extent specified in the rule is a default extent which is suggested 1.18 cvs 4986: to the user but can be modified. The <tt>UserSpecified</tt> keyword can be 4987: used either in the <tt>Height</tt> rule, the <tt>Width</tt> rule, or both.</p> 4988: <p> 4989: A fixed extent rule can be ended by the <tt>Min</tt> keyword, which signifies 1.1 cvs 4990: that the indicated value is a minimum, and that, if the contents of the box 1.18 cvs 4991: require it, a larger extent is possible.</p> 4992: <pre> 'Height' ':' Dimension 1.1 cvs 4993: 'Width' ':' Dimension 4994: Dimension = AbsDist [ 'UserSpecified' ] [ 'Min' ] / 1.18 cvs 4995: ...</pre> 4996: <blockquote class="example"> 4997: <p> 4998: <strong>Example:</strong></p> 4999: <p> 5000: Continuing with the <a href="#expos2">previous example</a>, it is possible to 1.3 cvs 5001: allow the user to choose the size of each graphical element as it is 1.18 cvs 5002: created:</p> 5003: <pre>ElemGraph : BEGIN 1.6 cvs 5004: Width : 2 cm UserSpecified; 1.1 cvs 5005: Height : 1 cm UserSpecified; 5006: ... 1.18 cvs 5007: END;</pre> 5008: <p> 1.1 cvs 5009: Thus, when a graphical element is create, it is drawn by default with a width 5010: of 2 cm and a height of 1 cm, but the user is free to resize it immediately 1.18 cvs 5011: with the mouse.</p> 5012: <pre>Summary : BEGIN 1.1 cvs 5013: Height : 5 cm Min; 5014: ... 5015: END; 5016: Keywords : BEGIN 5017: VertPos : Top = Summary . Bottom; 5018: ... 1.18 cvs 5019: END;</pre> 5020: </blockquote> 5021: </div> 1.1 cvs 5022: 1.18 cvs 5023: <div class="subsubsection"> 1.1 cvs 5024: 1.18 cvs 5025: <h4><a name="sectd42192">Relative extents</a></h4> 5026: <p> 1.1 cvs 5027: A relative extent determines the extent as a function of the extent of another 5028: box, just as a relative position places a box in relation to another. The 5029: reference box in an extent rule is designated using the same syntax as is used 1.18 cvs 5030: in a relative position rule. It is followed by a period and a <tt>Height</tt> 5031: or <tt>Width</tt> keyword, depending on the extent being referred to. Next 1.1 cvs 5032: comes the relation between the extent being defined and the extent of the 1.18 cvs 5033: reference box. This relation can be either a percentage or a difference.</p> 5034: <p> 1.1 cvs 5035: A percentage is indicated by a star (the multiplication symbol) followed by 5036: the numeric percentage value (which may be greater than or less than 100) and 5037: the percent (`%') character. A difference is simply indicated by a signed 1.18 cvs 5038: difference.</p> 5039: <p> 1.1 cvs 5040: If the rule appears in the presentation rules of a numeric attribute, the 5041: percentage value can be replaced by the name of the attribute. This attribute 1.18 cvs 5042: is then used as a percentage. The attribute can also be used as part of a <a 5043: href="#distance">difference</a>.</p> 5044: <p> 1.1 cvs 5045: Just as with a fixed extent, a relative extent rule can end with the 1.18 cvs 5046: <tt>Min</tt> keyword, which signifies that the extent is a minimum and that, 5047: if the contents of the box require it, a larger extent is possible.</p> 5048: <p> 5049: A special case of relative extent rules is:</p> 5050: <pre>Height : Enclosed . Height;</pre> 5051: <p> 5052: or</p> 5053: <pre>Width : Enclosed . Width;</pre> 5054: <p> 1.5 cvs 5055: which specifies that the box has a height (or width) such that it encloses all 1.18 cvs 5056: the boxes which it contains, excluding boxes having a rule <tt>VertOverflow: 5057: Yes;</tt> or <tt>HorizOverflow: Yes;</tt>.</p> 5058: <p> 5059: <strong>Note:</strong> character strings (type <tt>TEXT_UNIT</tt>) generally 1.1 cvs 5060: must use the sum of the widths of the characters which compose them as their 1.18 cvs 5061: width, which is expressed by the rule:</p> 5062: <pre>TEXT_UNIT : 5063: Width : Enclosed . Width;</pre> 5064: <p> 5065: If this rule is not the default <tt>Width</tt> rule, it must be given 5066: explicitly in the <tt>RULES</tt> section which defines the presentation rules 5067: of the logical elements.</p> 5068: <pre> 'Height' ':' Extent 1.1 cvs 5069: 'Width' ':' Extent 5070: Extent = Reference '.' HeightWidth [ Relation ] 5071: [ 'Min' ] / ... 5072: HeightWidth ='Height' / 'Width' . 5073: Relation ='*' ExtentAttr '%' / Distance . 5074: ExtentAttr = ExtentVal / AttrID . 1.18 cvs 5075: ExtentVal = NUMBER .</pre> 5076: <blockquote class="example"> 5077: <p> 5078: <strong>Example:</strong></p> 5079: <p> 5080: Completing the <a href="#expos1">above example</a>, it is possible to specify 5081: that the report takes its width from the editing window and its height from 5082: the size of its contents (this can obviously be greater than that of the 5083: window):</p> 5084: <pre>Report : BEGIN 1.1 cvs 5085: Width : Enclosing . Width; 5086: Height : Enclosed . Height; 5087: ... 1.18 cvs 5088: END;</pre> 5089: <p> 1.3 cvs 5090: Then, the following rules make the title occupy 60% of the width of the report 5091: (which is that of the window) and is broken into centered lines of this width 1.18 cvs 5092: (see the <a href="#sectc4222"><tt>Line</tt> rule</a>).</p> 5093: <pre>Title : BEGIN 1.1 cvs 5094: Width : Enclosing . Width * 60%; 5095: Height : Enclosed . Height; 5096: Line; 5097: Adjust : VMiddle; 5098: ... 1.18 cvs 5099: END;</pre> 5100: <p> 5101: The summary occupy the entire width of the window, with the exception of a 2 5102: cm margin reserved by the horizontal position rule:</p> 5103: <pre>Summary : BEGIN 1.1 cvs 5104: Width : Enclosing . Width - 2 cm; 5105: Height : Enclosed . Height; 5106: ... 1.18 cvs 5107: END;</pre> 5108: <p> 5109: This set of rules, plus the <a href="#reportexample">position rules given 5110: above</a>, produce the layout of boxes shown in the following<a 5111: href="#posdim">figure</a>.</p> 5112: 5113: <div class="figure"> 5114: <hr> 1.19 cvs 5115: 1.18 cvs 5116: <pre>------------------------------------------------------------- 1.1 cvs 5117: | Window and Report ^ | 5118: | | 1 line | 5119: | v | 5120: | ------------------------------------- | 5121: | | | | 5122: : 20% : Title : 20% : 5123: :<--------->: :<--------->: 5124: : : 60% : : 5125: : :<--------------------------------->: : 5126: | | | | 5127: | ------------------------------------- | 5128: | ^ | 5129: | | 1.5 line | 5130: | | | 5131: | v | 5132: | ---------------------------------------------------| 5133: | 2 cm | | 5134: |<------>| Summary | 1.18 cvs 5135: : : :</pre> 1.19 cvs 5136: <p align="center"> 1.18 cvs 5137: <em><a name="posdim">Box position and extent</a><em></em></em></p> 5138: <hr> 1.19 cvs 5139: 1.18 cvs 5140: </div> 5141: </blockquote> 5142: </div> 1.1 cvs 5143: 1.18 cvs 5144: <div class="subsubsection"> 1.1 cvs 5145: 1.18 cvs 5146: <h4><a name="sectd42193">Elastic extents</a></h4> 5147: <p> 1.1 cvs 5148: The last type of extent is the elastic extent. Either one or both extents can 5149: be elastic. A box has an elastic extent when two opposite sides are linked by 1.18 cvs 5150: distance constraints to two sides or axes of other boxes.</p> 5151: <p> 1.1 cvs 5152: One of the sides of the elastic box is linked by a position rule 1.18 cvs 5153: (<tt>VertPos</tt> or <tt>HorizPos</tt>) to a neighboring box. The other side 5154: is link to another box by a <tt>Height</tt> or <tt>Width</tt> rule, which 1.1 cvs 5155: takes the same form as the position rule. For the elastic box itself, the 5156: notions of sides (left or right, top or bottom) are fuzzy, since the movement 5157: of either one of the two reference boxes can, for example, make the left side 5158: of the elastic box move to the right of its right side. This is not 5159: important. The only requirement is that the two sides of the elastic box used 1.18 cvs 5160: in the position and extent rule are opposite sides of the box.</p> 5161: <pre> 'Height' ':' Extent 1.6 cvs 5162: 'Width' ':' Extent 1.18 cvs 5163: Extent = HPos / VPos / ...</pre> 5164: <blockquote class="example"> 5165: <p> 5166: <strong>Example:</strong></p> 5167: <p> 1.3 cvs 5168: Suppose we want to draw an elastic arrow or line between the middle of the 5169: bottom side of box A and the upper left corner of box B. To do this, we would 5170: define a graphics box whose upper left corner coincides with the middle of the 5171: bottom side of A (a position rule) and whose lower right corner coincides with 1.18 cvs 5172: with the upper left corner of B (dimension rules):</p> 5173: <pre>LinkedBox : 1.1 cvs 5174: BEGIN 1.6 cvs 5175: VertPos : Top = A .Bottom; 1.1 cvs 5176: HorizPos : Left = A . VMiddle; 1.6 cvs 5177: Height : Bottom = B . Top; 5178: Width : Right = B . Left; 1.18 cvs 5179: END;</pre> 5180: </blockquote> 5181: <blockquote class="example"> 5182: <p> 5183: <strong>Example:</strong></p> 5184: <p> 1.3 cvs 5185: The element SectionTitle creates a presentation box called SectionNum which 5186: contains the number of the section. Suppose we want to align the SectionNum 5187: and SectionTitle horizontally, have the SectionNum take its width from its 5188: contents (the section number), have the SectionTitle box begin 0.5 cm to the 5189: right of the SectionNum box and end at the right edge of its enclosing box. 1.18 cvs 5190: This would make the SectionTitle box elastic, since its width is defined by 5191: the position of its left and right sides. The following rules produce this 5192: effect:</p> 5193: <pre>SectionNum : 1.1 cvs 5194: BEGIN 5195: HorizPos : Left = Enclosing . Left; 5196: Width : Enclosed . Width; 5197: ... 5198: END; 5199: 5200: SectionTitle : 5201: BEGIN 5202: HorizPos : Left = SectionNum . Right + 0.5 cm; 5203: Width : Right = Enclosing . Right; 5204: ... 1.18 cvs 5205: END;</pre> 5206: </blockquote> 5207: </div> 5208: </div> 1.1 cvs 5209: 1.18 cvs 5210: <div class="subsection"> 1.1 cvs 5211: 1.18 cvs 5212: <h3><a name="sectc4220">Overflow</a></h3> 5213: <p> 1.1 cvs 5214: A boxes corresponding to a structural element normally contain all boxes 5215: corresponding to the elements of its subtree. However, in some cases, it 5216: could be necessary to allow a box to jut out from its parent box. Two 5217: presentation rules indicate that such an overflow is allowed, one for 1.18 cvs 5218: horizontal overflow, one for vertical overflow.</p> 5219: <p> 1.1 cvs 5220: Each of these rules is expressed by a keyword followed by a colon and the 1.18 cvs 5221: keyword <tt>Yes</tt> or <tt>No</tt>.</p> 5222: <pre> 'VertOverflow' ':' Boolean / 1.1 cvs 5223: 'HorizOverflow' ':' Boolean . 1.18 cvs 5224: Boolean = 'Yes' / 'No' .</pre> 5225: </div> 1.1 cvs 5226: 1.26 cvs 5227: <p>@@@@@ ****** </p> 5228: <p>Explain Margin, Padding and Border. Refer to CSS2.</p> 5229: <pre> 'MarginTop' ':' MarginWidth / 5230: 'MarginRight' ':' MarginWidth / 5231: 'MarginBottom' ':' MarginWidth / 5232: 'MarginLeft' ':' MarginWidth / 5233: 'PaddingTop' ':' PaddingWidth / 5234: 'PaddingRight' ':' PaddingWidth / 5235: 'PaddingBottom' ':' PaddingWidth / 5236: 'PaddingLeft' ':' PaddingWidth / 5237: 'BorderTopWidth' ':' BorderWidth / 5238: 'BorderRightWidth' ':' BorderWidth / 5239: 'BorderBottomWidth' ':' BorderWidth / 5240: 'BorderLeftWidth' ':' BorderWidth / 5241: 'BorderTopColor' ':' BorderColor / 5242: 'BorderRightColor' ':' BorderColor / 5243: 'BorderBottomColor' ':' BorderColor / 5244: 'BorderLeftColor' ':' BorderColor / 5245: 'BorderTopStyle' ':' BorderStyle / 5246: 'BorderRightStyle' ':' BorderStyle / 5247: 'BorderBottomStyle' ':' BorderStyle / 5248: 'BorderLeftStyle' ':' BorderStyle . 5249: 5250: MarginWidth = InheritParent / 'Auto' / Distance . 5251: PaddingWidth = InheritParent / Distance . 5252: BorderWidth = InheritParent / 'Thin' / 'Medium' / 'Thick' / Distance . 5253: BorderColor = InheritParent / 'Transparent' / 'Foreground' / 5254: ColorName . 5255: BorderStyle = InheritParent / 5256: 'None' / 'Hidden' / 'Dotted' / 'Dashed' / 'Solid' / 5257: 'Double' / 'Groove' / 'Ridge' / 'Inset' / 'Outset' . 1.27 cvs 5258: InheritParent = 'Enclosing' '=' / 'Creator' '=' . 1.26 cvs 5259: ColorName = NAME .</pre> 5260: <p>@@@@@ ****** </p> 5261: 1.18 cvs 5262: <div class="subsection"> 1.1 cvs 5263: 1.18 cvs 5264: <h3><a name="sectc4221">Inheritance</a></h3> 5265: <p> 1.1 cvs 5266: A presentation parameter can be defined by reference to the same parameter of 5267: another box in the tree of boxes. These structural links are expressed by 5268: kinship. The reference box can be that of the element immediately above in 1.18 cvs 5269: the structure (<tt>Enclosing</tt>), two levels above (<tt>GrandFather</tt>), 5270: immediately below (<tt>Enclosed</tt>) or immediately before 5271: (<tt>Previous</tt>). In the case of a presentation box, and only in that 1.1 cvs 5272: case, the reference box may be the element which created the presentation box 1.18 cvs 5273: (<tt>Creator</tt>).</p> 5274: <p> 1.1 cvs 5275: Kinship is expressed in terms of the logical structure of the document and not 5276: in terms of the tree of boxes. The presentation box cannot transmit any of 5277: their parameters by inheritance; only structured element boxes can do so. As 5278: an example, consider an element B which follows an element A in the logical 5279: structure. The element B creates a presentation box P in front of itself, 1.18 cvs 5280: using the <tt>CreateBefore</tt> rule (see the <a href="#sectc4232">creation 5281: rules</a>). If element B's box inherits its character style using the 5282: <tt>Previous</tt> kinship operation, it gets its character style from A's box, 1.1 cvs 5283: not from P's box. Inheritance works differently for positions and extents, 1.18 cvs 5284: which can refer to presentation boxes.</p> 5285: <p> 1.1 cvs 5286: The inherited parameter value can be the same as that of the reference box. 5287: This is indicated by an equals sign. However, for numeric parameters, a 5288: different value can be obtained by adding or subtracting a number from the 5289: reference box's parameter value. Addition is indicated by a plus sign before 5290: the number, while subtraction is specified with a minus sign. The value of a 5291: parameter can also be given a maximum (if the sign is a plus) or minimum (if 1.18 cvs 5292: the sign is a minus).</p> 5293: <p> 1.1 cvs 5294: If the rule is being applied to a numeric attribute, the number to add or 5295: subtract can be replaced by the attribute name. The value of a maximum or 5296: minimum may also be replaced by an attribute name. In these cases, the value 1.18 cvs 5297: of the attribute is used.</p> 5298: <pre> Inheritance = Kinship InheritedValue . 1.6 cvs 5299: Kinship ='Enclosing' / 'GrandFather' / 'Enclosed' / 5300: 'Previous' / 'Creator' . 1.1 cvs 5301: InheritedValue ='+' PosIntAttr [ 'Max' maximumA ] / 1.6 cvs 5302: '-' NegIntAttr [ 'Min' minimumA ] / 5303: '=' . 5304: PosIntAttr = PosInt / AttrID . 5305: PosInt = NUMBER . 5306: NegIntAttr = NegInt / AttrID . 5307: NegInt = NUMBER . 5308: maximumA = maximum / AttrID . 5309: maximum = NUMBER . 5310: minimumA = minimum / AttrID . 1.18 cvs 5311: minimum = NUMBER .</pre> 5312: <p> 1.1 cvs 5313: The parameters which can be obtained by inheritance are justification, 5314: hyphenation, interline spacing, character font (font family), font style, font 5315: size, visibility, indentation, underlining, alignment of text, stacking order 5316: of objects, the style and thickness of lines, fill pattern and the colors of 1.18 cvs 5317: lines and characters.</p> 5318: </div> 1.1 cvs 5319: 1.18 cvs 5320: <div class="subsection"> 1.1 cvs 5321: 1.18 cvs 5322: <h3><a name="sectc4222">Line breaking</a></h3> 5323: <p> 5324: The <tt>Line</tt> rule specifies that the contents of the box should be broken 1.1 cvs 5325: into lines: the boxes included in the box to which this rule is attached are 5326: displayed one after the other, from left to right, with their horizontal 5327: reference axes aligned so that they form a series of lines. The length of 1.18 cvs 5328: these lines is equal to the width of the box to which the <tt>Line</tt> rule 5329: is attached.</p> 5330: <p> 1.1 cvs 5331: When an included box overflows the current line, it is either carried forward 1.18 cvs 5332: to the next line, cur, or left the way it is. The <a 5333: href="#sectc4223"><tt>LineBreak</tt> rule</a> is used to allow or prevent the 1.1 cvs 5334: breaking of included boxes. If the included box is not breakable but is 5335: longer than the space remaining on the line, it is left as is. When a 5336: character string box is breakable, the line is broken between words or, if 1.18 cvs 5337: necessary, by <a href="#sectd42225">hyphenating a word</a>. When a compound 5338: box is breakable, the box is transparent in regard to line breaking. The boxes 5339: included in the compound box are treated just like included boxes which have 5340: the <tt>LineBreak</tt> rule. Thus, it is possible to traverse a complete 5341: subtree of boxes to line break the text leaves of a complex structure.</p> 5342: <p> 1.1 cvs 5343: The relative position rules of the included boxes are ignored, since the boxes 1.18 cvs 5344: will be placed according to the line breaking rules.</p> 5345: <p> 5346: The <tt>Line</tt> rule does not have a parameter. The characteristics of the 5347: lines that will be constructed are determined by the <tt>LineSpacing</tt>, 5348: <tt>Indent</tt>, <tt>Adjust</tt>, <tt>Justify</tt>, and <tt>Hyphenate</tt> 5349: rules. Moreover, the <a href="#insectd42226"><tt>Inline</tt> rule</a> permits 5350: the exclusion of certain elements from the line breaking process.</p> 5351: <p> 5352: When the <tt>Line</tt> rule appears in the rules sequence of a non-primary 5353: view, it applies only to that view, but when the <tt>Line</tt> rule appears in 1.1 cvs 5354: the rules sequence of the primary view, it also applies to the other views by 1.18 cvs 5355: default, except for those views which explicitly invoke the <tt>NoLine</tt> 5356: rule. Thus, the <tt>NoLine</tt> rule can be used in a non-primary view to 5357: override the primary view's <tt>Line</tt> rule. The <tt>NoLine</tt> rule must 5358: not be used with the primary view because the absence of the <tt>Line</tt> 5359: rule has the same effect. Like the <tt>Line</tt> rule, the <tt>NoLine</tt> 5360: rule does not take any parameters.</p> 5361: <pre> 'Line' 5362: 'NoLine'</pre> 5363: 5364: <div class="subsubsection"> 5365: 5366: <h4><a name="sectd42221">Line spacing</a></h4> 5367: <p> 5368: The <tt>LineSpacing</tt> rule defines the line spacing to be used in the line 1.1 cvs 5369: breaking process. The line spacing is the distance between the baselines 5370: (horizontal reference axis) of the successive lines produced by the 1.18 cvs 5371: <tt>Line</tt> rule. The value of the line spacing can be specified as a 5372: constant or by inheritance. It is expressed in any of the available <a 5373: href="#sectc4217">distance units</a>.</p> 5374: <p> 1.1 cvs 5375: Inheritance allows the value to be obtained from a relative in the structure 5376: tree, either without change (an equals sign appears after the inheritance 5377: keyword), with a positive difference (a plus sign), or a negative difference 5378: (a minus sign). When the rule uses a difference, the value of the difference 1.18 cvs 5379: follows the sign and is expressed as a <a href="#sectc4217">distance</a>.</p> 5380: <pre> 'LineSpacing' ':' DistOrInherit 1.6 cvs 5381: DistOrInherit = Kinship InheritedDist / Distance . 1.18 cvs 5382: InheritedDist = '=' / '+' AbsDist / '-' AbsDist .</pre> 5383: <p> 1.1 cvs 5384: When the line spacing value (or its difference from another element) is 5385: expressed in relative units, it changes with the size of the characters. Thus, 5386: when a larger font is chosen for a part of the document, the line spacing of 5387: that part expands proportionally. In contrast, when the line spacing value is 5388: expressed in absolute units (centimeters, inches, typographer's points), it is 5389: independent of the characters, which permits the maintenance of a consistent 5390: line spacing, whatever the character font. Either approach can be taken, 1.18 cvs 5391: depending on the desired effect.</p> 5392: </div> 1.1 cvs 5393: 1.18 cvs 5394: <div class="subsubsection"> 1.1 cvs 5395: 1.18 cvs 5396: <h4><a name="sectd42222">First line indentation</a></h4> 5397: <p> 5398: The <tt>Indent</tt> rule is used to specify the indentation of the first line 5399: of the elements broken into lines by the <tt>Line</tt> function. The 1.1 cvs 5400: indentation determines how far the first line of the element is shifted with 5401: respect to the other lines of the same element. It can be specified as a 5402: constant or by inheritance. The constant value is a positive integer (shifted 5403: to the right; the sign is optional), a negative integer (shifted to the left) 1.18 cvs 5404: or zero (no shift). All available <a href="#sectc4217">units</a> can be 5405: used.</p> 5406: <p> 1.1 cvs 5407: Indentation can be defined for any box, regardless of whether the box is line 5408: broken, and transmitted by inheritance to elements that are line broken. The 1.18 cvs 5409: size of the indentation is specified in the same manner as the <a 5410: href="#sectd42221">line spacing</a>.</p> 5411: <pre> 'Indent' ':' DistOrInherit</pre> 5412: </div> 1.1 cvs 5413: 1.18 cvs 5414: <div class="subsubsection"> 1.1 cvs 5415: 1.18 cvs 5416: <h4><a name="sectd42223">Alignment</a></h4> 5417: <p> 1.1 cvs 5418: The alignment style of the lines constructed during line breaking is defined 1.18 cvs 5419: by the <tt>Adjust</tt> rule. The alignment value can be a constant or 5420: inherited. A constant value is specified by a keyword:</p> 5421: <ul> 5422: <li> 5423: <tt>Left</tt>: at the left edge, 1.19 cvs 5424: </li> 1.18 cvs 5425: <li> 5426: <tt>Right</tt>: at the right edge, 1.19 cvs 5427: </li> 1.18 cvs 5428: <li> 5429: <tt>VMiddle</tt>: centered 1.19 cvs 5430: </li> 1.18 cvs 5431: <li> 5432: <tt>LeftWithDots</tt>: at the left edge with a dotted line filling out the 1.1 cvs 5433: last line up to the right edge of the line breaking box. 1.19 cvs 5434: </li> 1.18 cvs 5435: </ul> 5436: <p> 1.1 cvs 5437: An inherited value can only be the same as that of the reference box and is 1.18 cvs 5438: specified by a kinship keyword followed by an equals sign.</p> 5439: <pre> 'Adjust' ':' AlignOrInherit 1.1 cvs 5440: AlignOrInherit = Kinship '=' / Alignment . 5441: Alignment = 'Left' / 'Right' / 'VMiddle' / 1.18 cvs 5442: 'LeftWithDots' .</pre> 5443: </div> 1.1 cvs 5444: 1.18 cvs 5445: <div class="subsubsection"> 1.1 cvs 5446: 1.18 cvs 5447: <h4><a name="sectd42224">Justification</a></h4> 5448: <p> 5449: The <tt>Justify</tt> rule indicates whether the lines contained in the box and 5450: produced by a <tt>Line</tt> rule should be extended horizontally to occupy the 1.1 cvs 5451: entire width of their enclosing box. The first and last lines are treated 5452: specially: the position of the beginning of the first line is fixed by the 1.18 cvs 5453: <tt>Indent</tt> rule and last line is not extended. The justification 1.1 cvs 5454: parameter defined by this rule takes a boolean value, which can be a constant 5455: or inherited. A constant boolean value is expressed by either the 1.18 cvs 5456: <tt>Yes</tt> or the <tt>No</tt> keyword. An inherited value can only be the 1.1 cvs 5457: same as that of the reference box and is specified by a kinship keyword 1.18 cvs 5458: followed by an equals sign.</p> 5459: <pre> 'Justify' ':' BoolInherit 1.1 cvs 5460: BoolInherit = Boolean / Kinship '=' . 1.18 cvs 5461: Boolean ='Yes' / 'No' .</pre> 5462: <p> 1.1 cvs 5463: When the lines are justified, the alignment parameter specified in the 1.18 cvs 5464: <tt>Adjust</tt> rule has no influence, other than on the last line produced. 1.1 cvs 5465: This occurs because, when the other are extended to the limits of the box, the 1.18 cvs 5466: alignment style is no longer perceptible.</p> 5467: <blockquote class="example"> 5468: <p> 5469: <strong>Example:</strong></p> 5470: <p> 1.3 cvs 5471: An important use of inheritance is to vary the characteristics of lines for an 5472: element type (for example, Paragraph) according to the enclosing environment 5473: (for example, Summary or Section), and thus obtain different line breaking 5474: styles for the same elements when they appear in different environments. The 1.18 cvs 5475: following rules specify that paragraphs inherit their alignment, 5476: justification, and line spacing:</p> 5477: <pre>Paragraph : 1.1 cvs 5478: BEGIN 5479: Justify : Enclosing = ; 5480: LineSpacing : Enclosing = ; 5481: Adjust : Enclosing =; 5482: Line; 1.18 cvs 5483: END;</pre> 5484: <p> 1.5 cvs 5485: If the alignment, justification, and line spacing of the Section and Summary 1.18 cvs 5486: elements is fixed:</p> 5487: <pre>Section : 1.1 cvs 5488: BEGIN 5489: Adjust : Left; 5490: Justify : Yes; 5491: LineSpacing : 1; 5492: END; 5493: Summary : 5494: BEGIN 5495: Adjust : VMiddle; 5496: Justify : No; 5497: LineSpacing : 1.3; 1.18 cvs 5498: END;</pre> 5499: <p> 1.4 cvs 5500: then the paragraphs appearing in sections are justified with a simple line 5501: spacing while those appearing in summaries are centered and not justified and 5502: have a larger line spacing. These are nevertheless the very same type of 1.18 cvs 5503: paragraph defined in the logical structure schema.</p> 5504: </blockquote> 5505: </div> 5506: 5507: <div class="subsubsection"> 5508: 5509: <h4><a name="sectd42225">Hyphenation</a></h4> 5510: <p> 5511: The <tt>Hyphenate</tt> rule indicates whether or not words should be broken by 1.1 cvs 5512: hyphenation at the end of lines. It affects the lines produced by the 1.18 cvs 5513: <tt>Line</tt> rule and contained in the box carrying the <tt>Hyphenate</tt> 5514: rule.</p> 5515: <p> 1.1 cvs 5516: The hyphenation parameter takes a boolean value, which can be either constant 5517: or inherited. A constant boolean value is expressed by either the 1.18 cvs 5518: <tt>Yes</tt> or the <tt>No</tt> keyword. An inherited value can only be the 1.1 cvs 5519: same as that of the reference box and is specified by a kinship keyword 1.18 cvs 5520: followed by an equals sign.</p> 5521: <pre> 'Hyphenate' ':' BoolInherit 1.1 cvs 5522: BoolInherit = Boolean / Kinship '=' . 1.18 cvs 5523: Boolean = 'Yes' / 'No' .</pre> 5524: </div> 5525: 5526: <div class="subsubsection"> 5527: 5528: <h4><a name="sectd42226">Avoiding line breaking</a></h4> 5529: <p> 5530: The <tt>InLine</tt> rule is used to specify that a box that would otherwise 5531: participate in line breaking asked for by the <tt>Line</tt> rule of an 1.1 cvs 5532: enclosing box, instead avoids the line breaking process and positions itself 1.18 cvs 5533: according to the <tt>HorizPos</tt> and <tt>VertPos</tt> rules that apply to 5534: it. When the <tt>InLine</tt> rule applies to a box which would not be line 5535: broken, it has no effect.</p> 5536: <p> 5537: The rule is expressed by the <tt>InLine</tt> keyword followed by a colon and 5538: the keyword <tt>Yes</tt>, if the box should participate in line breaking, or 5539: the keyword <tt>No</tt>, if it should not. This is the only form possible: 1.1 cvs 5540: this rule cannot be inherited. Moreover, it can only appear in the rules of 5541: the primary view and applies to all views defined in the presentation 1.18 cvs 5542: schema.</p> 5543: <pre> 'InLine' ':' Boolean . 5544: Boolean = 'Yes' / 'No' .</pre> 5545: <blockquote class="example"> 5546: <p> 5547: <strong>Example:</strong></p> 5548: <p> 5549: Suppose the structure schema defines a logical attribute called <tt>New</tt> 5550: which is used to identify the passages in a document which were recently 5551: modified. It would be nice to have the presentation schema make a bar appear 5552: in the left margin next to each passage having the <tt>New</tt> attribute. A 5553: new passage can be an entire element, such as a paragraph or section, or it 5554: can be some words in the middle of a paragraph. To produce the desired 5555: effect, the <tt>New</tt> attribute is given a creation rule which generates a 5556: <tt>VerticalBar</tt> presentation box.</p> 5557: <p> 5558: When the <tt>New</tt> attribute is attached to a character string which is 1.1 cvs 5559: inside a line broken element (inside a paragraph, for example), the bar is one 5560: of the elements which participates in line breaking and it is placed normally 5561: in the current line, at the end of the character string which has the 1.18 cvs 5562: attribute. To avoid this, the <tt>InLine</tt> rule is used in the following 5563: way:</p> 5564: <pre>BOXES 1.1 cvs 5565: VerticalBar: 5566: BEGIN 5567: Content: Graphics 'l'; 5568: HorizPos: Left = Root . Left; 5569: VertPos: Top = Creator . Top; 5570: Height: Bottom = Creator . Bottom; 5571: Width: 1 pt; 5572: InLine: No; 5573: ... 5574: END; 5575: ... 5576: ATTRIBUTES 5577: Nouveau: 5578: BEGIN 5579: CreateAfter(VerticalBar); 1.18 cvs 5580: END;</pre> 5581: </blockquote> 5582: </div> 5583: </div> 1.1 cvs 5584: 1.18 cvs 5585: <div class="subsection"> 1.1 cvs 5586: 1.18 cvs 5587: <h3><a name="sectc4223">Page breaking and line breaking conditions</a></h3> 5588: <p> 1.1 cvs 5589: Pages are constructed by the editor in accordance with the model specified by 1.18 cvs 5590: a <a href="#sectc4233"><tt>Page</tt> rule</a>. The page model describes only 5591: the composition of the pages but does not give any rules for breaking 5592: different element types across pages. Now, it is possible that certain 5593: elements must not be cut by page breaks, while others can be cut anywhere. The 5594: <tt>PageBreak</tt>, <tt>NoBreak1</tt>, and <tt>NoBreak2</tt> rules are used to 5595: specify the conditions under which each element type can be cut.</p> 5596: <p> 5597: The <tt>PageBreak</tt> rule is used to indicate whether or not the box can be 1.1 cvs 5598: cut during the construction of pages. If cutting is authorized, the box can 5599: be cut, with one part appearing at the bottom of a page and the other part 5600: appearing at the top of the next page. The rule is formed by the 1.18 cvs 5601: <tt>PageBreak</tt> keyword followed by a colon and a constant boolean value 5602: (<tt>Yes</tt> or <tt>No</tt>). This is the only form possible: this rule 1.1 cvs 5603: cannot be inherited. Moreover, it can only appear in the rules of the primary 1.18 cvs 5604: view and applies to all views defined in the presentation schema.</p> 5605: <p> 1.1 cvs 5606: Whether objects can be cut by line breaks can be controlled in a similar way 1.18 cvs 5607: using the <tt>LineBreak</tt> rule. This rule allows the specification of 1.1 cvs 5608: whether or not the box can be cut during the construction of lines. If 5609: cutting is authorized, the box can be cut, with one part appearing at the end 5610: of a line and the other part appearing at the beginning of the next line. The 1.18 cvs 5611: rule is formed by the <tt>LineBreak</tt> keyword followed by a colon and a 5612: constant boolean value (<tt>Yes</tt> or <tt>No</tt>). This is the only form 1.1 cvs 5613: possible: this rule cannot be inherited. Moreover, it can only appear in the 5614: rules of the primary view and applies to all views defined in the presentation 1.18 cvs 5615: schema.</p> 5616: <pre> 'PageBreak' ':' Boolean . 1.1 cvs 5617: 'LineBreak' ':' Boolean . 1.18 cvs 5618: Boolean = 'Yes' / 'No' .</pre> 5619: <p> 1.1 cvs 5620: When a box can be cut by a page break, it is possible that a page break will 5621: fall an inappropriate spot, creating, for example, a widow or orphan, or 5622: separating the title of a section from the first paragraph of the section. The 1.18 cvs 5623: <tt>NoBreak1</tt> and <tt>NoBreak2</tt> rules are used to avoid this. They 5624: specify that the box of the element to which they apply cannot be cut within a 5625: certain zone at the top (<tt>NoBreak1</tt> rule) or at the bottom 5626: (<tt>NoBreak2</tt> rule). These two rules specify the height of the zones in 5627: which page breaks are prohibited.</p> 5628: <p> 5629: The <tt>NoBreak1</tt> and <tt>NoBreak2</tt> rules give the height of the zone 1.1 cvs 5630: in which page breaking is prohibited. The height is given as a constant value 1.18 cvs 5631: using any of the <a href="#sectc4217">available units</a>, absolute or 5632: relative. The value may not be inherited.</p> 5633: <pre> 'NoBreak1' ':' AbsDist . 5634: 'NoBreak2' ':' AbsDist .</pre> 5635: <blockquote class="example"> 5636: <p> 5637: <strong>Example:</strong></p> 5638: <p> 5639: The following rules prevent widows and orphans in a paragraph:</p> 5640: <pre>Paragraph : 1.1 cvs 5641: BEGIN 5642: NoBreak1 : 2; 5643: NoBreak2 : 2; 1.18 cvs 5644: END;</pre> 5645: <p> 1.3 cvs 5646: This rule prevents a section title from becoming separated from the first 5647: paragraph of the section by prohibiting page breaks at the beginning of the 1.18 cvs 5648: section rule:</p> 5649: <pre>Section : 5650: NoBreak1 : 1.5 cm;</pre> 5651: <p> 5652: Finally, this rule prevents a figure from being page broken in any way:</p> 5653: <pre>Figure : 5654: PageBreak : No;</pre> 5655: </blockquote> 5656: <p> 1.1 cvs 5657: The Thot editor constructs the document images displayed on the screen 5658: dynamically. As the user moves in the document or makes the document scroll 5659: in a window, the editor constructs the image to be displayed in little bits, 5660: filling the gaps which are produced in the course of these operations. It 5661: stops filling in the image when an element reaches the edge of the window in 5662: which the gap appears. If the appearance of the document is complex, it is 5663: possible that the image in incomplete, even though the edge of the window was 5664: reached. For example, an element might need to be presented to the side of 5665: the last element displayed, but its image was not constructed. The user will 5666: not know whether the element is really absent or if its image has simply not 1.18 cvs 5667: been constructed.</p> 5668: <p> 5669: The <tt>Gather</tt> rule is used to remedy this problem. When the rule 5670: <tt>Gather : Yes;</tt> is associated with an element type, the image of such 5671: elements is constructed as a block by the editor: it is never split up.</p> 5672: <p> 5673: The <tt>Gather</tt> rule may not appear in the <a href="#sectc427">default 5674: rules</a>. Elements which do not have the <tt>Gather</tt> rule are considered 5675: susceptible to being split up during display. Thus, it is not necessary to 5676: use the <tt>Gather : No;</tt> form. This rule must be used prudently and only 5677: for those elements which truly need it. If used incorrectly, it can 5678: pointlessly increase the size of the image constructed by the editor and lead 5679: to excessive memory consumption by the editor.</p> 5680: <p> 5681: Like the <tt>PageBreak</tt> and <tt>LineBreak</tt> rules, the <tt>Gather</tt> 1.1 cvs 5682: rule can only appear in rules of the primary view and applies to all views 1.18 cvs 5683: defined in the presentation schema.</p> 5684: <pre> 'Gather' ':' Boolean .</pre> 5685: </div> 1.1 cvs 5686: 1.18 cvs 5687: <div class="subsection"> 1.1 cvs 5688: 1.18 cvs 5689: <h3><a name="sectc4224">Visibility</a></h3> 5690: <p> 1.1 cvs 5691: The visibility parameter is used to control which elements should or should 5692: not be displayed, based on context. An element can have different 5693: visibilities in different views. If an element's visibility is zero for a 5694: view, that element is not displayed in that view and does not occupy any space 1.18 cvs 5695: (its extents are zero).</p> 5696: <p> 1.1 cvs 5697: Visibility takes non-negative integer values (positive or zero). If values 5698: greater than 1 are used, they allow the user to choose a degree of visibility 5699: and, thus, to see only those boxes whose visibility parameter exceeds a 5700: certain threshold. This gives the user control over the granularity of the 1.18 cvs 5701: displayed pictures.</p> 5702: <p> 1.1 cvs 5703: The visibility parameter can be defined as a constant or by inheritance. If 5704: defined by inheritance, it cannot be based on the value of the next or 1.18 cvs 5705: previous box. Visibility can only be inherited from above.</p> 5706: <p> 1.1 cvs 5707: If it is a numeric attribute's presentation rule, the visibility can be 5708: specified by the attribute's name, in which case the value of the attribute is 1.18 cvs 5709: used.</p> 5710: <pre> 'Visibility' ':' NumberInherit 1.1 cvs 5711: NumberInherit = Integer / AttrID / Inheritance . 1.18 cvs 5712: Integer = NUMBER .</pre> 5713: <blockquote class="example"> 5714: <p> 5715: <strong>Example:</strong></p> 5716: <p> 5717: Suppose that only <tt>Formula</tt> elements should be displayed in the 5718: <tt>MathView</tt> view. Then, the default rules should include:</p> 5719: <pre>DEFAULT 5720: IN MathView Visibility:0;</pre> 5721: <p> 5722: which makes all elements invisible in the <tt>MathView</tt> view. However, 5723: the <tt>Formula</tt> element also has a <tt>Visibility</tt> rule:</p> 5724: <pre>Formula : 5725: IN MathView Visibility:5;</pre> 5726: <p> 5727: which makes formulas, and only formulas, visible.</p> 5728: </blockquote> 5729: </div> 1.1 cvs 5730: 1.18 cvs 5731: <div class="subsection"> 1.1 cvs 5732: 1.18 cvs 5733: <h3><a name="sectc4225">Character style parameters</a></h3> 5734: <p> 1.1 cvs 5735: Four parameters are used to determine which characters are used to display 1.18 cvs 5736: text. They are size, font, style, and underlining.</p> 1.1 cvs 5737: 1.18 cvs 5738: <div class="subsubsection"> 1.1 cvs 5739: 1.18 cvs 5740: <h4><a name="sectd42251">Character size</a></h4> 5741: <p> 1.1 cvs 5742: The size parameter has two effects. First, it is used to specify the actual 1.18 cvs 5743: size and distance units for boxes defined in <a href="#sectc4217">relative 5744: units</a>. Second, it defines the size of the characters contained in the 5745: box.</p> 5746: <p> 1.1 cvs 5747: As a distance or length, the size can be expressed in abstract or absolute 5748: units. It can also be inherited. If it is not inherited, it is expressed 1.18 cvs 5749: simply as an integer followed by the <tt>pt</tt> keyword, which indicates that 5750: the size is expressed in typographer's points. The absence of the <tt>pt</tt> 1.1 cvs 5751: keyword indicates that it is in abstract units in which the value 1 represents 5752: the smallest size while the value 16 is the largest size. The relationship 5753: between these abstract sizes and the real character sizes is controlled by a 5754: table which can be modified statically or even dynamically during the 1.18 cvs 5755: execution of the Thot editor.</p> 5756: <p> 1.22 cvs 5757: If the <tt>Size</tt> rule is a numeric attribute's presentation rule, the 5758: value of the size parameter can be specified by the attribute's name, in 5759: which case the value of the attribute is used.</p> 1.18 cvs 5760: <p> 5761: <strong>Note:</strong> the only unit available for defining an absolute size 5762: is the typographer's point. Centimeters and inches may not be used.</p> 5763: <p> 1.1 cvs 5764: If the size is inherited, the rule must specify the relative from which to 1.22 cvs 5765: inherit and any percentage or difference from that relative's value. 1.25 cvs 5766: A percentage is indicated by a <tt>*</tt> followed by the value of the 1.22 cvs 5767: percentage and a <tt>%</tt>. 5768: A difference can be expressed in either typographer's points or in abstract 5769: units and the maximum or minimum size can be specified, but without 5770: specifying the unit: it is the same as was specified for the difference.</p> 5771: <p> 5772: In a numeric attribute's presentation rule, the difference in size or the 5773: percentage can be indicated by the attribute's name instead of the numeric 5774: value, which means that the attribute's value should be used as the difference 5775: or percentage. The attribute can also be used as the minimum or maximum size 5776: for a difference.</p> 5777: <pre> 'Size' ':' SizeInherit 5778: SizeInherit = SizeAttr [ 'pt' ] / 5779: Kinship InheritedSize . 5780: InheritedSize ='+' SizeAttr [ 'pt' ] 5781: [ 'Max' MaxSizeAttr ] / 5782: '-' SizeAttr [ 'pt' ] 5783: [ 'Min' MinSizeAttr ] / 5784: '*' PercentSizeAttr '%' / 5785: '=' . 5786: SizeAttr = Size / AttrID . 5787: Size = NUMBER . 5788: MaxSizeAttr = MaxSize / AttrID . 5789: MaxSize = NUMBER . 5790: MinSizeAttr = MinSize / AttrID . 5791: MinSize = NUMBER . 5792: PercentSizeAttr = PercentSize / AttrID . 5793: PercentSize = NUMBER .</pre> 1.18 cvs 5794: <blockquote class="example"> 5795: <p> 5796: <strong>Example:</strong></p> 5797: <p> 5798: The rule</p> 5799: <pre>Size : Enclosing - 2 pt Min 7;</pre> 5800: <p> 5801: states that the character size is 2 points less than that of the enclosing 5802: box, but that it may not be less than 7 points, whatever the enclosing box's 5803: value.</p> 5804: <p> 1.1 cvs 5805: The following rules make the text of a report be displayed with medium-sized 5806: characters (for example, size 5), while the title is displayed with larger 1.18 cvs 5807: characters and the summary is displayed with smaller characters:</p> 5808: <pre>Report : 1.1 cvs 5809: Size : 5; 5810: Title : 5811: Size : Enclosing + 2; 5812: Summary : 1.18 cvs 5813: Size : Enclosing - 1;</pre> 5814: <p> 5815: Thus, the character sizes in the entire document can be changed by changing 5816: the size parameter of the Report element, while preserving the relationships 5817: between the sizes of the different elements.</p> 5818: </blockquote> 5819: </div> 5820: 5821: <div class="subsubsection"> 5822: 5823: <h4><a name="sectd42252">Font and character style</a></h4> 5824: <p> 5825: The <tt>Font</tt> rule determines the font family to be used to display the 5826: characters contained in the box, while the <tt>Style</tt> rule determines 1.23 cvs 5827: their style and the <tt>Weight</tt> rule determines their weight. Thot 5828: recognizes three character fonts (Times, Helvetica, and Courier), three 5829: styles: Roman, Italics, and Oblique, and two weights: Normal and Bold.</p> 5830: <p> 5831: The font family, style and weight can be specified by a named constant or 5832: can be inherited. For the name of the font family only the first character 5833: is used.</p> 5834: <p> 5835: Only identical inheritance is allowed: the box takes the same font, style or 5836: weight as the box from which it inherits. This is indicated by an equals 5837: sign after the kinship specification.</p> 5838: <pre> 'Font' ':' NameInherit / 5839: 'Style' ':' StyleInherit / 5840: 'Weight' ':' WeightInherit / 5841: 5842: NameInherit = Kinship '=' / FontName . 5843: FontName = NAME . 5844: StyleInherit = Kinship '=' / 5845: 'Roman' / 'Italics' / 'Oblique' . 5846: WeightInherit = Kinship '=' / 5847: 'Normal' / 'Bold' .</pre> 1.18 cvs 5848: <blockquote class="example"> 5849: <p> 5850: <strong>Example:</strong></p> 5851: <p> 1.3 cvs 5852: To specify that the summary uses the font family of the rest of the document, 1.18 cvs 5853: but in the italic style, the following rules are used:</p> 5854: <pre>Summary : 1.1 cvs 5855: BEGIN 5856: Font : Enclosing =; 5857: Style : Italics; 1.18 cvs 5858: END;</pre> 5859: </blockquote> 5860: </div> 5861: 5862: <div class="subsubsection"> 5863: 5864: <h4><a name="sectd42253">Underlining</a></h4> 5865: <p> 5866: The <tt>Underline</tt> rule is used to specify if the characters contained in 1.1 cvs 5867: a box should have lines drawn on or near them. There are four underlining 1.18 cvs 5868: styles: <tt>Underlined</tt>, <tt>Overlined</tt>, <tt>CrossedOut</tt>, and 5869: <tt>NoUnderline</tt>. The <tt>Thickness</tt> rule specifies the thickness of 5870: the line, <tt>Thin</tt> or <tt>Thick</tt>.</p> 5871: <p> 1.1 cvs 5872: As with font family and style, only identical inheritance is allowed: the box 5873: has the same underlining type as the box from which it inherits the value. 1.18 cvs 5874: This is indicated by an equals sign after the kinship specification.</p> 5875: <pre> 'Underline' ':' UnderLineInherit / 1.1 cvs 5876: 'Thickness' ':' ThicknessInherit / 5877: 5878: UnderLineInherit = Kinship '=' / 'NoUnderline' / 5879: 'Underlined' / 5880: 'Overlined' / 'CrossedOut' . 1.18 cvs 5881: ThicknessInherit = Kinship '=' / 'Thick' / 'Thin' .</pre> 5882: </div> 5883: </div> 5884: 5885: <div class="subsection"> 5886: 5887: <h3><a name="sectc4226">Stacking order</a></h3> 5888: <p> 5889: The <tt>Depth</tt> rule is used to define the stacking order of terminal boxes 1.1 cvs 5890: when multiple boxes at least partially overlap. This rule defines how the 5891: depth parameter, which is zero or a positive integer, is calculated. The 5892: depth parameter has a value for all boxes. For terminal boxes in the 5893: structure and for presentation boxes, the depth value is used during display 5894: and printing: the boxes with the lowest value overlap those with higher 5895: depths. For non-terminal boxes, the depth is not interpreted during display, 1.18 cvs 5896: but it is used to calculate the depth of terminal boxes by inheritance.</p> 5897: <p> 5898: Like most other rules, the depth rule is defined in the <a 5899: href="#sectc427">default rules</a> of each presentation schema. Thus, there 5900: is always a depth value, even when it is not necessary because there is no 5901: overlapping. To avoid useless operations, a zero value can be given to the 5902: depth parameter, which signifies that overlapping is never a problem.</p> 5903: <p> 5904: The depth rule has the same form as the <a href="#sectc4224">visibility 5905: rule</a>. It can be defined by inheritance or by a constant numeric value. 5906: When the rule is attached to a numeric attribute, it can take the value of 5907: that attribute.</p> 5908: <pre> 'Depth' ':' NumberInherit</pre> 5909: <blockquote class="example"> 5910: <p> 5911: <strong>Example:</strong></p> 5912: <p> 1.3 cvs 5913: For a purely textual document, in which overlapping never poses a problem, a 1.18 cvs 5914: single default <tt>Depth</tt> rule in the presentation schema is 5915: sufficient:</p> 5916: <pre>DEFAULT 1.1 cvs 5917: Depth : 0; 1.18 cvs 5918: ...</pre> 5919: <p> 1.1 cvs 5920: To make the text of examples appear on a light blue background, a presentation 1.18 cvs 5921: box is defined:</p> 5922: <pre>BOXES 1.1 cvs 5923: BlueBG : 5924: BEGIN 5925: Content : Graphics 'R'; 5926: Background : LightBlue3; 5927: FillPattern: backgroundcolor; 5928: Depth : 2; 5929: ... 1.18 cvs 5930: END;</pre> 5931: <p> 5932: and is created by the <tt>Example</tt> element, which has the rules:</p> 5933: <pre>RULES 1.1 cvs 5934: Example : 5935: BEGIN 5936: CreateFirst (BlueBG); 5937: Depth : 1; 5938: ... 1.18 cvs 5939: END;</pre> 5940: <p> 5941: In this way, the text of an example (if it inherits its depth from its 5942: ancestor) will be superimposed on a light blue background, and not the 5943: reverse).</p> 5944: </blockquote> 5945: </div> 5946: 5947: <div class="subsection"> 5948: 5949: <h3><a name="sectc4227">Line style</a></h3> 5950: <p> 5951: The <tt>LineStyle</tt> rule determines the style of line which should be used 5952: to draw all the elements contained in the box and the box itself, if it has a 5953: <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. The line style can be 5954: indicated by a name (<tt>Solid</tt>, <tt>Dashed</tt>, <tt>Dotted</tt>) or it 1.13 cvs 5955: can be inherited. All elements of the graphic base type are affected by this 1.1 cvs 5956: rule, but it can be attached to any box and transmitted by inheritance to the 1.18 cvs 5957: graphic elements. The border of elements having a <a 5958: href="#sectc4230a"><tt>ShowBox</tt> rule</a> is drawn according to the line 5959: style specified by this rule.</p> 5960: <p> 1.1 cvs 5961: Only identical inheritance is allowed: the box takes the same line style as 5962: the box from which it inherits. This is indicated by an equals sign after the 1.18 cvs 5963: kinship specification.</p> 5964: <pre> 'LineStyle' ':' LineStyleInherit 1.1 cvs 5965: LineStyleInherit = Kinship '=' / 1.18 cvs 5966: 'Solid' / 'Dashed' / 'Dotted' .</pre> 5967: <blockquote class="example"> 5968: <p> 5969: <strong>Example:</strong></p> 5970: <p> 1.3 cvs 5971: To specify that, in Figures, the graphical parts should be drawn in solid 1.18 cvs 5972: lines, the Figure element is given a rule using the <tt>Solid</tt> name:</p> 5973: <pre>Figure : 5974: LineStyle : Solid;</pre> 5975: <p> 5976: and the elements composing figures are given an inheritance rule:</p> 5977: <pre> LineStyle : Enclosing =;</pre> 5978: </blockquote> 5979: </div> 5980: 5981: <div class="subsection"> 5982: 5983: <h3><a name="sectc4228">Line thickness</a></h3> 5984: <p> 5985: The <tt>LineWeight</tt> rule determines the thickness of the lines of all 1.1 cvs 5986: graphical elements which appear in the box, no matter what their line style. 5987: Line thickness can be specified by a constant value or by inheritance. A 5988: constant value is a positive number followed by an optional unit specification 1.18 cvs 5989: (which is absent when using relative units). All available <a 5990: href="#sectc4217">distance units</a> can be used. Line thickness is expressed 5991: in the same way as <a href="#sectd42221">line spacing</a>.</p> 5992: <pre> 'LineWeight' ':' DistOrInherit</pre> 5993: <p> 5994: All elements of the graphic base type are affected by this rule, but it can be 5995: attached to any box and transmitted by inheritance to the graphic elements. 5996: The border of element having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a> 5997: is also drawn according to the thickness specified by this rule.</p> 5998: <blockquote class="example"> 5999: <p> 6000: <strong>Example:</strong></p> 6001: <p> 6002: To specify that, in Figures, the graphical parts should be drawn with lines 6003: 0.3 pt thick, the Figure element is given this rule:</p> 6004: <pre>Figure : 6005: LineWeight : 0.3 pt;</pre> 6006: <p> 6007: and the elements composing figures are given an inheritance rule:</p> 6008: <pre> LineWeight : Enclosing =;</pre> 6009: </blockquote> 6010: </div> 6011: 6012: <div class="subsection"> 6013: 6014: <h3><a name="sectc4229">Fill pattern</a></h3> 6015: <p> 6016: The <tt>FillPattern</tt> rule determines the pattern used to fill closed 1.1 cvs 6017: graphical elements (circles, rectangles, etc.) which appear in the box. This 1.18 cvs 6018: rule also specifies the pattern used to fill the box associated with elements 6019: having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a><a>. This pattern can 6020: be indicated by a named constant or by inheritance. The named constant 6021: identifies one of the patterns available in Thot. The names of the available 6022: patterns are: nopattern, foregroundcolor, backgroundcolor, gray1, gray2, 6023: gray3, gray4, gray5, gray6, gray7, horiz1, horiz2, horiz3, vert1, vert2, 6024: vert3, left1, left2, left3, right1, right2, right3, square1, square2, square3, 6025: lozenge, brick, tile, sea, basket.</a></p> 6026: <p> 6027: Like the other rules peculiar to graphics, <tt>LineStyle</tt> and 6028: <tt>LineWeight</tt>, only elements of the graphic base type are affected by 6029: the <tt>FillPattern</tt> rule, but the rule can be attached to any box and 1.1 cvs 6030: transmitted by inheritance to the graphic elements. As with the other rules 1.18 cvs 6031: specific to graphics, only identical inheritance is allowed.</p> 6032: <p> 6033: The <tt>FillPattern</tt> rule can also be used to determine whether or not 1.12 cvs 6034: text characters, symbols and pictures should be colored. For these element 6035: types (text, symbols, and pictures), the only valid values are 1.18 cvs 6036: <tt>nopattern</tt>, <tt>foregroundcolor</tt>, and <tt>backgroundcolor</tt>. 6037: When <tt>FillPattern</tt> has the value <tt>backgroundcolor</tt>, text 6038: characters, symbols, and bitmaps are given the color specified by the <a 6039: href="#sectc4230"><tt>Background</tt> rule</a> which applies to these 6040: elements. When <tt>FillPattern</tt> has the value <tt>foregroundcolor</tt>, 6041: these same elements are given the color specified by the <a 6042: href="#sectc4230"><tt>Foreground</tt> rule</a> which applies to these 6043: elements. In all other case, text characters are not colored.</p> 6044: <pre> 'FillPattern' ':' NameInherit</pre> 6045: <blockquote class="example"> 6046: <p> 6047: <strong>Example:</strong></p> 6048: <p> 1.3 cvs 6049: To specify that, in Figures, the closed graphical elements should be filled 6050: with a pattern resembling a brick wall, the Figure element is given this 1.18 cvs 6051: rule:</p> 6052: <pre>Figure : 6053: FillPattern : brick;</pre> 6054: <p> 6055: and the elements composing figures are given an inheritance rule:</p> 6056: <pre> FillPattern : Enclosing =;</pre> 6057: </blockquote> 6058: </div> 6059: 6060: <div class="subsection"> 6061: 6062: <h3><a name="sectc4230">Colors</a></h3> 6063: <p> 6064: The <tt>Foreground</tt> and <tt>Background</tt> rules determine the foreground 1.13 cvs 6065: and background colors of the base elements which appear in the box. They also 1.18 cvs 6066: control the color of boxes associated with elements having a <a 6067: href="#sectc4230a"><tt>ShowBox</tt> rule</a>. These colors can be specified 6068: with a named constant or by inheritance. The named constants specify one of 6069: the available colors in Thot. The available color names can be found in the 6070: file <tt>thot.color</tt>.</p> 6071: <p> 6072: The color rules affect the same way all base elements and elements having a <a 6073: href="#sectc4230a"><tt>ShowBox</tt> rule</a>, no matter what their type (text, 6074: graphics, pictures, symbols). The color rules can be associated with any box 6075: and can be transmitted by inheritance to the base elements or the elements 6076: having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. Like the preceding 6077: rules, only inheritance of the same value is allowed.</p> 6078: <pre> 'Foreground' ':' NameInherit 6079: 'Background' ':' NameInherit</pre> 6080: <p> 6081: <strong>Note:</strong> text colors only appear for text elements whose <a 6082: href="#sectc4229">fill pattern</a> does not prevent the use of color.</p> 6083: <blockquote class="example"> 6084: <p> 6085: <strong>Example:</strong></p> 6086: <p> 1.3 cvs 6087: To specify that, in Figures, everything must be drawn in blue on a background 1.18 cvs 6088: of yellow, the Figure element is given these rules:</p> 6089: <pre>Figure : 1.1 cvs 6090: BEGIN 6091: Foreground : Blue; 6092: Background : Yellow; 6093: Fillpattern : backgroundcolor; 1.18 cvs 6094: END;</pre> 6095: <p> 6096: and the elements composing figures are given inheritance rules:</p> 6097: <pre> Foreground : Enclosing =; 1.1 cvs 6098: Background : Enclosing =; 1.18 cvs 6099: FillPattern : Enclosing =;</pre> 6100: </blockquote> 6101: </div> 6102: 6103: <div class="subsection"> 6104: 6105: <h3><a name="sectc4230a">Background color and border</a></h3> 6106: <p> 6107: Boxes associated with structural elements are normally not visible, but it is 6108: possible to draw their border and/or to paint their area when it is needed. 6109: This is achieved by associating the <tt>ShowBox</tt> rule with the concerned 1.13 cvs 6110: element. This rule has no parameter and no value. It is simply written 1.18 cvs 6111: <tt>Showbox;</tt>. It is not inherited nor transmitted to any other element. 6112: It applies only to the element with which it is associated.</p> 6113: <pre> 'ShowBox'</pre> 6114: <p> 6115: When an element has a <tt>ShowBox</tt> rule, the border is drawn only if the 6116: <tt>LineWeight</tt> rule that applies to that element has a non-zero value 6117: (this value can be inherited). The color, style and thickness of the border 6118: are defined by the <tt>Foreground</tt>, <tt>LineStyle</tt>, and 6119: <tt>LineWeight</tt> rules that apply to the element.</p> 6120: <p> 6121: When an element has a <tt>ShowBox</tt> rule, the background of this element is 6122: paint only if the value of the <tt>FillPattern</tt> rule that applies to that 6123: element is not <tt>nopattern</tt>. The pattern and color(s) of the background 6124: are defined by the <tt>FillPattern</tt>, <tt>Background</tt>, and 6125: <tt>Foreground</tt> rules that apply to the element.</p> 6126: </div> 6127: 6128: <div class="subsection"> 6129: 6130: <h3><a name="sectc4230b">Background pictures</a></h3> 6131: <p> 6132: The <tt>BackgroundPicture</tt> rule allows to display a picture as the 1.13 cvs 6133: background of an element. It has a single parameter, the file name of the 1.18 cvs 6134: picture. This is a string delimited by single quotes. If the first character 6135: in this string is '/', it is considered as an absolute path, otherwise the 6136: file is searched for along the schema directory path. This file may contain a 6137: picture in any format accepted by Thot (xbm, xpm, gif, jpeg, png, etc.)</p> 6138: <p> 6139: The <tt>BackgroundPicture</tt> and <tt>PictureMode</tt> rules apply only to 1.13 cvs 6140: the element with which they are associated. They are not inherited nor 1.18 cvs 6141: transmitted to children elements.</p> 6142: <p> 1.13 cvs 6143: The background picture has not always the same size as the element's box. 6144: There are diffrent ways to fill the element box with the picture. This is 1.18 cvs 6145: specified by the <tt>PictureMode</tt> rule, which should be associated to the 6146: same element. This rule may take one of the following values:</p> 6147: <dl> 6148: <dt><tt>NormalSize</tt></dt> 6149: <dd> 6150: The picture is centered in the box, and clipped if it is too large. 6151: </dd> 6152: <dt><tt>Scale</tt></dt> 6153: <dd> 6154: The picture is zoomed to fit the box size. 6155: </dd> 6156: <dt><tt>RepeatX</tt></dt> 6157: <dd> 6158: The picture is repeated horizontally to fit the box width. 6159: </dd> 6160: <dt><tt>RepeatY</tt></dt> 6161: <dd> 6162: The picture is repeated vertically to fit the box height. 6163: </dd> 6164: <dt><tt>RepeatXY</tt></dt> 6165: <dd> 6166: The picture is repeated both horizontally and vertically to fill the box. 6167: </dd> 6168: </dl> 6169: <p> 6170: If an element has a <tt>BackgroundPicture</tt> rule and no 6171: <tt>PictureMode</tt> rule, the <tt>NormalSize</tt> value is assumed.</p> 6172: <pre> 'BackgroundPicture' ':' FileName / 1.13 cvs 6173: 'PictureMode' ':' PictMode . 6174: 6175: FileName = STRING . 1.18 cvs 6176: PictMode = 'NormalSize' / 'Scale' / 'RepeatXY' / 'RepeatX' / 'RepeatY' .</pre> 6177: <p> 6178: The <tt>BackgroundPicture</tt> and <tt>PictureMode</tt> rules apply only to 1.13 cvs 6179: the element with which they are associated. They are not inherited nor 1.18 cvs 6180: transmitted to children elements.</p> 6181: </div> 1.13 cvs 6182: 1.18 cvs 6183: <div class="subsection"> 1.1 cvs 6184: 1.18 cvs 6185: <h3><a name="sectc4231">Presentation box content</a></h3> 6186: <p> 6187: The <tt>Content</tt> rule applies to presentation boxes. It indicates the 1.1 cvs 6188: content given to a box. This content is either a variable's value or a 1.18 cvs 6189: constant value. In the special case of <a href="#sectc4233">header or footer 6190: boxes</a>, the content can also be a structured element type.</p> 6191: <p> 1.1 cvs 6192: If the content is a constant, it can be specified, as in a variable 1.18 cvs 6193: declaration, either by the name of a constant declared in the <tt>CONST</tt> 1.1 cvs 6194: section or by direct specification of the type and value of the box's 1.18 cvs 6195: content.</p> 6196: <p> 1.1 cvs 6197: Similarly, if it is a variable, the name of a variable declared in 1.18 cvs 6198: <tt>VAR</tt> section can be given or the variable may be defined within 6199: parentheses. The content inside the parentheses has the same syntax as a <a 6200: href="#sectc426">variable declaration</a>.</p> 6201: <p> 1.1 cvs 6202: When the content is a structured element type, the name of the element type is 6203: given after the colon. In this case, the box's content is all elements of 6204: the named type which are designated by references which are part of the page 1.18 cvs 6205: on which the header or footer with this <tt>Content</tt> rule appears. Only 6206: associated elements can appear in a <tt>Content</tt> rule and the structure 1.1 cvs 6207: must provide references to these elements. Moreover, the box whose content 6208: they are must be a header or footer box generated by a page box of the primary 1.18 cvs 6209: view.</p> 6210: <pre> 'Content' ':' VarConst 1.1 cvs 6211: VarConst = ConstID / ConstType ConstValue / 6212: VarID / '(' FunctionSeq ')' / 1.18 cvs 6213: ElemID .</pre> 6214: <p> 6215: A presentation box can have only one <tt>Content</tt> rule, which means that 1.1 cvs 6216: the content of a presentation box cannot vary from view to view. However, such 6217: an effect can be achieved by creating several presentation boxes, each with 1.18 cvs 6218: different content and visible in different views.</p> 6219: <p> 6220: The <tt>Content</tt> rule also applies to elements defined as references in 1.1 cvs 6221: the structure schema. In this case, the content defined by the rule must be 6222: a constant. It is this content which appears on the screen or paper to 6223: represent references of the type to which the rule applies. A reference can 1.18 cvs 6224: have a <tt>Content</tt> rule or a <a href="#sectc4234"><tt>Copy</tt> rule</a> 1.1 cvs 6225: for each view. If neither of these rules appears, the reference is displayed 1.18 cvs 6226: as <tt>[*]</tt>, which is equivalent to the rule:</p> 6227: <pre> Content: Text '[*]';</pre> 6228: <blockquote class="example"> 6229: <p> 6230: <strong>Example:</strong></p> 6231: <p> 1.3 cvs 6232: The content of the presentation box created to make the chapter number and 1.18 cvs 6233: section number appear before each section title can be defined by:</p> 6234: <pre>BOXES 1.1 cvs 6235: SectionNumBox : 6236: BEGIN 6237: Content : NumSection; 6238: ... 1.18 cvs 6239: END;</pre> 6240: <p> 6241: if the <tt>NumSection</tt> variable has been defined in the variable 6242: definition section of the presentation schema. Otherwise the <tt>Content</tt> 6243: would be written:</p> 6244: <pre>BOXES 1.1 cvs 6245: SectionNumBox : 6246: BEGIN 6247: Content : (VALUE (ChapterCtr, Roman) TEXT '.' 6248: VALUE (SectionCtr, Arabic)); 6249: ... 1.18 cvs 6250: END;</pre> 6251: <p> 6252: To specify that a page footer should contain all elements of the <tt>Note</tt> 6253: type are referred to in the page, the following rule is written:</p> 6254: <pre>BOXES 1.1 cvs 6255: NotesFooterBox : 6256: BEGIN 6257: Content : Note; 6258: ... 1.18 cvs 6259: END;</pre> 6260: <p> 6261: <tt>Note</tt> is defined as an associated element in the structure schema and 6262: NotesFooterBox is created by a page box of the primary view.</p> 6263: </blockquote> 6264: </div> 1.1 cvs 6265: 1.18 cvs 6266: <div class="subsection"> 1.1 cvs 6267: 1.18 cvs 6268: <h3><a name="sectc4232">Presentation box creation</a></h3> 6269: <p> 1.1 cvs 6270: A creation rule specifies that a presentation box should be created when an 1.18 cvs 6271: element of the type to which the rule is attached appears in the document.</p> 6272: <p> 1.1 cvs 6273: A keyword specifies the position, relative to the creating box, at which the 1.18 cvs 6274: created box will be placed in the structure:</p> 6275: <dl> 6276: <dt><tt>CreateFirst</tt></dt> 6277: <dd> 6278: specifies that the box should be created as the first box of the next lower 1.2 cvs 6279: level, before any already existing boxes, and only if the beginning of the 1.1 cvs 6280: creating element is visible; 1.18 cvs 6281: </dd> 6282: <dt><tt>CreateLast</tt></dt> 6283: <dd> 6284: specifies that the box should be created as the last box of the next lower 6285: level, after any existing boxes, and only if the end of the creating element 6286: is visible; 6287: </dd> 6288: <dt><tt>CreateBefore</tt></dt> 6289: <dd> 6290: specifies that the box should be created before the creating box, on the same 6291: level as the creating box, and only if the beginning of the creating element 6292: is visible; 6293: </dd> 6294: <dt><tt>CreateAfter</tt></dt> 6295: <dd> 6296: specifies that the box should be created after the creating box, on the same 6297: level as the creating box, and only if the beginning of the creating element 6298: is visible; 6299: </dd> 6300: <dt><tt>CreateEnclosing</tt></dt> 6301: <dd> 6302: specifies that the box should be created at the upper level relatively to the 6303: creating box, and that it must contain that creating box and all presentation 6304: boxes created by the same creating box. 6305: </dd> 6306: </dl> 6307: <p> 6308: This keyword can be followed by the <tt>Repeated</tt> keyword to indicate that 1.1 cvs 6309: the box must be created for each part of the creating element. These parts 6310: result from the division of the element by page breaks or column changes. If 1.18 cvs 6311: the <tt>Repeated</tt> keyword is missing, the box is only created for the 6312: first part of the creating element (<tt>CreateFirst</tt> and 6313: <tt>CreateBefore</tt> rules) or for the last part (<tt>CreateLast</tt> and 6314: <tt>CreateAfter</tt> rules).</p> 6315: <p> 1.1 cvs 6316: The type of presentation to be created is specified at the end of the rule 1.18 cvs 6317: between parentheses.</p> 6318: <p> 6319: Creation rules cannot appear in the <a href="#sectc427">default presentation 6320: rules</a>. The boxes being created should have a <tt>Content</tt> rule which 6321: indicates their <a href="#sectc4231">content</a>.</p> 6322: <p> 1.1 cvs 6323: Creation rules can only appear in the block of rules for the primary view; 6324: creation is provoked by a document element for all views. However, for each 6325: view, the presentation box is only created if the creating element is itself a 6326: box in the view. Moreover, the visibility parameter of the presentation box 6327: can be adjusted to control the creation of the box on a view-by-view 1.18 cvs 6328: basis.</p> 6329: <pre> Creation '(' BoxID ')' 1.1 cvs 6330: Creation = Create [ 'Repeated' ] . 6331: Create ='CreateFirst' / 'CreateLast' / 6332: 'CreateBefore' / 'CreateAfter' / 1.18 cvs 6333: 'CreateEnclosing' .</pre> 6334: <blockquote class="example"> 6335: <p> 6336: <strong>Example:</strong></p> 6337: <p> 1.3 cvs 6338: Let us define an object type, called Table, which is composed of a sequence of 6339: columns, all having the same fixed width, where the columns are separated by 1.18 cvs 6340: vertical lines. There is a line to the left of the first column and one to 6341: the right of the last. Each column has a variable number of cells, placed one 6342: on top of the other and separated by horizontal lines. There are no 6343: horizontal lines above the first cell or below the last cell. The text 6344: contained in each cell is broken into lines and these lines are centered 6345: horizontally in the cell. The logical structure of this object is defined 6346: by:</p> 6347: <pre>Table = LIST OF (Column); 6348: Column = LIST OF (Cell = Text);</pre> 6349: 6350: <div class="figure"> 6351: <hr> 1.19 cvs 6352: 1.18 cvs 6353: <pre>| | | | 1.1 cvs 6354: | xx xxxx xxxx |x xxxx xxx xxxxx| x xxx x xxx | 6355: | xxx xxx xxxx x | x xx x xxx | xxxxx xxxx xx | 6356: | xxxxx xxxx |----------------| xxx xxxxx x | 6357: | xxxxx xxx xxxx | xxxx xx xx xxx | xx xx | 6358: | xxx xxxx x xxx | xxxx x xxx x |---------------| 6359: |----------------| xxx xxxx xxxxx | xxxxx xxxxx | 6360: | xxx xxx xxxxxx |----------------| xxx xxxx xxxx | 6361: | xxxx xxxx xx | xxxx xx x xx | xxx xx x xx | 6362: |----------------| xxx xxxxx xxxx | xxxx xxxx xxx | 6363: | xxxxx xxx xxxx | xxxx xx x xx | xxxxx xxx | 1.18 cvs 6364: |xxxx xx x xxxxxx| xxxx xx xxxxxx | xxxxx xxxxx |</pre> 1.19 cvs 6365: <p align="center"> 1.18 cvs 6366: <em><a name="table">The design of a table</a></em></p> 6367: <hr> 1.19 cvs 6368: 1.18 cvs 6369: </div> 6370: <p> 6371: The presentation of the table should resemble the design of the above <a 6372: href="#table">figure</a>. It is defined by the following presentation schema 6373: fragment:</p> 6374: <pre>BOXES 1.1 cvs 6375: VertLine : BEGIN 6376: Width : 0.3 cm; 6377: Height : Enclosing . Height; 6378: VertPos : Top = Enclosing . Top; 6379: HorizPos : Left = Previous . Right; 6380: Content : Graphics 'v'; 6381: END; 6382: 6383: HorizLine: BEGIN 6384: Width : Enclosing . Width; 6385: Height : 0.3 cm; 6386: VertPos : Top = Previous . Bottom; 6387: HorizPos : Left = Enclosing . Left; 6388: Content : Graphics 'h'; 6389: END; 6390: 6391: RULES 1.6 cvs 6392: Column : BEGIN 6393: CreateBefore (VertLine); 6394: IF LAST CreateAfter (VertLine); 6395: Width : 2.8 cm; 6396: Height : Enclosed . Height; 6397: VertPos : Top = Enclosing . Top; 6398: HorizPos : Left = Previous . Right; 6399: END; 6400: 6401: Cell : BEGIN 6402: IF NOT FIRST CreateBefore (HorizLine); 6403: Width : Enclosing . Width; 6404: Height : Enclosed . Height; 6405: VertPos : Top = Previous . Bottom; 6406: HorizPos : Left = Enclosing . Left; 6407: Line; 6408: Adjust : VMiddle; 1.18 cvs 6409: END;</pre> 6410: <p> 1.1 cvs 6411: It is useful to note that the horizontal position rule of the first vertical 6412: line will not be applied, since there is no preceding box. In this case, the 1.18 cvs 6413: box is simply placed on the left side of the enclosing box.</p> 6414: </blockquote> 6415: </div> 6416: 6417: <div class="subsection"> 6418: 6419: <h3><a name="sectc4233">Page layout</a></h3> 6420: <p> 6421: The page models specified in the <tt>Page</tt> rule are defined by boxes 6422: declared in the <tt>BOXES</tt> section of the presentation schema. Pages are 1.1 cvs 6423: not described as frames which will be filled by the document's text, but as 6424: element are inserted in the flow of the document and which mark the page 6425: breaks. Each of these page break elements contains presentation boxes which 6426: represent the footer boxes of a page followed by header boxes of the next 6427: page. The page box itself is the simple line which separates two pages on the 6428: screen. Both the footer and header boxes placed themselves with respect to 6429: this page box, with the footer being placed above it and the header boxes 1.18 cvs 6430: being placed above it.</p> 6431: <p> 1.1 cvs 6432: The boxes created by a page box are headers and footers and can only place 6433: themselves vertically with respect to the page box itself (which is in fact 6434: the separation between two pages). Besides, it is their vertical position 6435: rule which determines whether they are header or footer boxes. Header and 6436: footer boxes must have an explicit vertical position rule (they must not use 1.18 cvs 6437: the default rule).</p> 6438: <p> 1.1 cvs 6439: Footer boxes must have an absolute height or inherit the height of their 1.18 cvs 6440: contents:</p> 6441: <pre>Height : Enclosed . Height;</pre> 6442: <p> 1.1 cvs 6443: A page box must have height and width rules and these two rules must be 6444: specified with constant values, expressed in centimeters, inches, or 6445: typographer's points. These two rules are interpreted in a special way for 6446: page boxes: they determine the width of the page and the vertical distance 6447: between two page separators, which is the height of the page and its header 1.18 cvs 6448: and footer together.</p> 6449: <p> 1.1 cvs 6450: A page box should also have vertical and horizontal position rules and these 6451: two rules should specify the position on the sheet of paper of the rectangle 6452: enclosing the page's contents. These two rules must position the upper left 6453: corner of the enclosing rectangle in relation to the upper left corner of the 6454: sheet of paper, considered to be the enclosing element. In both rules, 1.18 cvs 6455: distances must be expressed in fixed units: centimeters (<tt>cm</tt>), inches 6456: (<tt>in</tt>), or typographer's points (<tt>pt</tt>). Thus, rules similar to 6457: the following should be found in the rules for a page box:</p> 6458: <pre>BOXES 1.1 cvs 6459: ThePage : 6460: BEGIN 6461: VertPos : Top = Enclosing . Top + 3 cm; 6462: HorizPos : Left = Enclosing . Left + 2.5 cm; 6463: Width : 16 cm; 6464: Height : 22.5 cm; 1.18 cvs 6465: END;</pre> 6466: <p> 1.1 cvs 6467: When a document must be page broken, the page models to be constructed are 1.18 cvs 6468: defined in the <tt>BOXES</tt> section of the presentation schema by declaring 6469: page boxes and header and footer boxes. Also, the <tt>Page</tt> rule is used 1.1 cvs 6470: to specify to which parts of the document and to which views each model should 1.18 cvs 6471: be applied.</p> 6472: <p> 6473: The <tt>Page</tt> rule has only one parameter, given between parentheses after 6474: the <tt>Page</tt> keyword. This parameter is the name of the box which must 6475: serve as the model for page construction. When a <tt>Page</tt> rule is 1.1 cvs 6476: attached to an element type, each time such an element appears in a document, 6477: a page break takes place and the page model indicated in the rule is applied 6478: to all following pages, until reaching the next element which has a 1.18 cvs 6479: <tt>Page</tt> rule.</p> 6480: <p> 6481: The <tt>Page</tt> rule applies to only one view; if it appears in the primary 6482: view's block of rules, a <tt>Page</tt> rule applies only to that view. Thus, 1.1 cvs 6483: different page models can be defined for the full document and for its table 6484: of contents, which is another view of the same document. Some views can be 6485: specified with pages, and other views of the same document can be specified 1.18 cvs 6486: without pages.</p> 6487: <pre> 'Page' '(' BoxID ')'</pre> 6488: </div> 6489: 6490: <div class="subsection"> 6491: 6492: <h3><a name="sectc4234">Box copies</a></h3> 6493: <p> 6494: The <tt>Copy</tt> rule can be used for an element which is defined as a 1.7 cvs 6495: reference in the structure schema. In this case, the rule specifies, between 1.18 cvs 6496: parenthesis, the name of the box (declared in the <tt>BOXES</tt> section) 1.1 cvs 6497: which must be produced when this reference appears in the structure of a 6498: document. The box produced is a copy (same contents, but possible different 6499: presentation) of the box type indicated by the parameter between parentheses, 6500: and which is in the element designated by the reference. The name of a box 6501: can be replaced by type name. Then what is copied is the contents of the 1.18 cvs 6502: element of this type which is inside the referenced element.</p> 6503: <p> 1.1 cvs 6504: Whether a box name or type name is given, it may be followed by the name of a 6505: structure schema between parentheses. This signifies that the box or type is 6506: defined in the indicated structure schema and not in the structure schema with 1.18 cvs 6507: which the rule's presentation schema is associated.</p> 6508: <p> 6509: The <tt>Copy</tt> rule can also be applied to a presentation box. If the 1.1 cvs 6510: presentation box was created by a reference attribute, the rule is applied as 6511: in the case of a reference element: the contents of the box having the 1.18 cvs 6512: <tt>Copy</tt> rule are based on the element designated by the reference 6513: attribute. For other presentation boxes, the <tt>Copy</tt> rule takes a type 1.1 cvs 6514: name parameter which can be followed, between parentheses, by the name of the 6515: structure schema in which the type is defined, if it is not defined in the 6516: same schema. The contents of the box which has this rule are a copy of the 6517: element of this type which is in the element creating the presentation box, or 6518: by default, the box of this type which precedes the presentation box. This 6519: last facility is used, for example, to define the running titles in headers or 1.18 cvs 6520: footers.</p> 6521: <pre> 'Copy' '(' BoxTypeToCopy ')' . 1.1 cvs 6522: BoxTypeToCopy = BoxID [ ExtStruct ] / 1.6 cvs 6523: ElemID [ ExtStruct ] . 1.18 cvs 6524: ExtStruct = '(' ElemID ')' .</pre> 6525: <p> 6526: Like the creation rules, the <tt>Copy</tt> rule cannot appear in the <a 6527: href="#sectc427">default presentation rules</a>. Moreover, this rule can only 6528: appear in the primary view's block of rules; the copy rule is applied to all 6529: views.</p> 6530: <blockquote class="example"> 6531: <p> 6532: <strong>Example:</strong></p> 6533: <p> 6534: If the following definitions are in the structure schema:</p> 6535: <pre>Body = LIST OF (Chapter = 1.1 cvs 6536: BEGIN 6537: ChapterTitle = Text; 6538: ChapterBody = SectionSeq; 6539: END); 1.18 cvs 6540: RefChapter = REFERENCE (Chapter);</pre> 6541: <p> 6542: then the following presentation rules (among many other rules in the 6543: presentation schema) can be specified:</p> 6544: <pre>COUNTERS 1.1 cvs 6545: ChapterCtr : RANK OF Chapter; 6546: BOXES 6547: ChapterNumber : 6548: BEGIN 6549: Content : (VALUE (ChapterCtr, URoman)); 6550: ... 6551: END; 6552: RULES 6553: Chapter : 6554: BEGIN 6555: CreateFirst (ChapterNumber); 6556: ... 6557: END; 6558: RefChapter : 6559: BEGIN 6560: Copy (ChapterNumber); 6561: ... 1.18 cvs 6562: END;</pre> 6563: <p> 1.4 cvs 6564: which makes the number of the chapter designated by the reference appear in 6565: uppercase roman numerals, in place of the reference to a chapter itself. 6566: Alternatively, the chapter title can be made to appear in place of the 1.18 cvs 6567: reference by writing this <tt>Copy</tt>rule:</p> 6568: <pre> Copy (ChapterTitle);</pre> 6569: <p> 6570: To define a header box, named <tt>RunningTitle</tt>, which contains the title 6571: of the current chapter, the box's contents are defined in this way:</p> 6572: <pre>BOXES 1.1 cvs 6573: RunningTitle : 1.18 cvs 6574: Copy (ChapterTitle);</pre> 6575: </blockquote> 6576: </div> 6577: </div> 6578: <hr> 1.19 cvs 6579: 1.18 cvs 6580: </div> 1.1 cvs 6581: 1.18 cvs 6582: <div class="chapter"> 1.1 cvs 6583: 1.18 cvs 6584: <h1><a name="sect5">The T language</a></h1> 1.1 cvs 6585: 1.18 cvs 6586: <div class="section"> 1.1 cvs 6587: 1.18 cvs 6588: <h2><a name="sectb51">Document translation</a></h2> 6589: <p> 1.1 cvs 6590: Because of its document model, Thot can produce documents in a high-level 1.18 cvs 6591: abstract form. This form, called the <em>canonical form</em> is specific to 1.1 cvs 6592: Thot; it is well suited to the editor's manipulations, but it does not 6593: necessarily suit other operations which might be applied to documents. Because 6594: of this, the Thot editor offers the choice of saving documents in its own form 6595: (the canonical form) or a format defined by the user. In the latter case, the 6596: Thot document is transformed by the translation program. This facility can 6597: also be used to export documents from Thot to systems using other 1.18 cvs 6598: formalisms.</p> 1.1 cvs 6599: 1.18 cvs 6600: <div class="subsection"> 1.1 cvs 6601: 1.18 cvs 6602: <h3><a name="sectc511">Translation principles</a></h3> 6603: <p> 1.1 cvs 6604: Document translation allows the export of documents to other systems which do 6605: not accept Thot's canonical form. Translation can be used to export document 1.18 cvs 6606: to source-based formatters like T<sub><big>E</big></sub>X, 6607: L<sup>A</sup>T<sub><big>E</big></sub>X, and <tt>troff</tt>. It can also be 1.1 cvs 6608: used to translate documents into interchange formats like SGML or HTML. To 6609: allow the widest range of possible exports, Thot does not limit the choice of 6610: translations, but rather allows the user to define the formalisms into which 1.18 cvs 6611: documents can be translated.</p> 6612: <p> 1.1 cvs 6613: For each document or object class, a set of translation rules can be defined, 6614: specifying how the canonical form should be transformed into a given 1.18 cvs 6615: formalism. These translation rules are grouped into <em>translation 6616: schemas</em>, each schema containing the rules necessary to translate a 1.1 cvs 6617: generic logical structure (document or object structure) into a particular 6618: formalism. The same generic logical structure can have several different 6619: translation schemas, each defining translation rules for a different 1.18 cvs 6620: formalism.</p> 6621: <p> 1.1 cvs 6622: Like presentation schemas, translation schemas are generic. Thus, they apply 6623: to an entire object or document class and permit translation of all documents 1.18 cvs 6624: or objects of that class.</p> 6625: </div> 1.1 cvs 6626: 1.18 cvs 6627: <div class="subsection"> 1.1 cvs 6628: 1.18 cvs 6629: <h3><a name="sectc512">Translation procedure</a></h3> 6630: <p> 1.1 cvs 6631: The translator works on the specific logical structure of the document being 6632: translated. It traverses the primary tree of this logical structure in 6633: pre-order and, at each node encountered, it applies the corresponding 6634: translation rules defined in the translation schema. Translation can be 1.18 cvs 6635: associated:</p> 6636: <ul> 6637: <li> 6638: with element types defined in the structure schema, 1.19 cvs 6639: </li> 1.18 cvs 6640: <li> 6641: with global or local attributes defined in the structure schema, 1.19 cvs 6642: </li> 1.18 cvs 6643: <li> 6644: with specific presentation rules, 1.19 cvs 6645: </li> 1.18 cvs 6646: <li> 6647: with the content of the leaves of the structure (characters, symbols and 1.1 cvs 6648: graphical elements) 1.19 cvs 6649: </li> 1.18 cvs 6650: </ul> 6651: <p> 1.1 cvs 6652: Thus, for each node, the translator applies all rules associated with the 6653: element type, all rules associated with each attribute (local or global) 6654: carried by the element, and if the element is a leaf of the tree, it also 1.10 cvs 6655: applies translation rules for characters, symbols, or graphical elements, 1.18 cvs 6656: depending on the type of the leaf.</p> 6657: <p> 1.1 cvs 6658: Rules associated with the content of leaves are different from all other 6659: rules: they specify only how to translate character strings, symbols, and 6660: graphical elements. All other rules, whether associated with element types, 6661: with specific presentation rules or with attributes, are treated similarly. 1.18 cvs 6662: These rules primarily allow:</p> 6663: <ul> 6664: <li> 6665: generation of a text constant or variable before or after the contents of an 6666: element, 1.19 cvs 6667: </li> 1.18 cvs 6668: <li> 6669: modification of the order in which elements appear after translation, 1.19 cvs 6670: </li> 1.18 cvs 6671: <li> 6672: removal of an element in the translated document, 1.19 cvs 6673: </li> 1.18 cvs 6674: <li> 6675: and writing messages on the user's terminal during translation. 1.19 cvs 6676: </li> 1.18 cvs 6677: </ul> 6678: </div> 6679: </div> 1.1 cvs 6680: 1.18 cvs 6681: <div class="section"> 1.1 cvs 6682: 1.18 cvs 6683: <h2><a name="sectb52">Translation definition language</a></h2> 6684: <p> 1.1 cvs 6685: Translation schemas are written in a custom language, called T, which is 6686: described in the rest of this chapter. The grammar of T is specified using 1.18 cvs 6687: the same <a href="#sectc321">meta-language</a> as was used for the S and P 1.1 cvs 6688: languages and the translation schemas are written using the same conventions 6689: as the structure and presentation schemas. In particular, the keywords of the 6690: T language (the stings between apostrophes in the following syntax rules) can 6691: be written in any combination of upper-case and lower-case letters, but 6692: identifiers created by the programmer must always be written in the same 1.18 cvs 6693: way.</p> 1.1 cvs 6694: 1.18 cvs 6695: <div class="subsection"> 1.1 cvs 6696: 1.18 cvs 6697: <h3><a name="sectc521">Organization of a translation schema</a></h3> 6698: <p> 6699: A translation schema is begun by the <tt>TRANSLATION</tt> keyword and is 6700: terminated by the <tt>END</tt> keyword. The <tt>TRANSLATION</tt> keyword is 1.1 cvs 6701: followed by the name of the generic structure for which a translation is being 6702: defined and a semicolon. This name must be identical to the name which 1.18 cvs 6703: appears after the <tt>STRUCTURE</tt> keyword in the corresponding structure 6704: schema.</p> 6705: <p> 1.1 cvs 6706: After this declaration of the structure, the following material appears in 1.18 cvs 6707: order:</p> 6708: <ul> 6709: <li> 6710: the length of lines produced by the translation, 1.19 cvs 6711: </li> 1.18 cvs 6712: <li> 6713: the character delimiting the end of the line, 1.19 cvs 6714: </li> 1.18 cvs 6715: <li> 6716: the character string which the translator will insert if it must line-break 6717: the translated text, 1.19 cvs 6718: </li> 1.18 cvs 6719: <li> 6720: declarations of 6721: <ul> 6722: <li> 6723: buffers, 1.19 cvs 6724: </li> 1.18 cvs 6725: <li> 6726: counters, 1.19 cvs 6727: </li> 1.18 cvs 6728: <li> 6729: constants, 1.19 cvs 6730: </li> 1.18 cvs 6731: <li> 6732: variables, 1.19 cvs 6733: </li> 1.18 cvs 6734: </ul> 1.19 cvs 6735: </li> 1.18 cvs 6736: <li> 6737: translation rules associated with element types, 1.19 cvs 6738: </li> 1.18 cvs 6739: <li> 6740: translation rules associated with attributes, 1.19 cvs 6741: </li> 1.18 cvs 6742: <li> 6743: translation rules associated with specific presentation rules, 1.19 cvs 6744: </li> 1.18 cvs 6745: <li> 6746: translation rules associated with characters strings, symbols and graphical 6747: elements. 1.19 cvs 6748: </li> 1.18 cvs 6749: </ul> 6750: <p> 1.1 cvs 6751: Each of these sections is introduced by a keyword followed by a sequence of 6752: declarations. All of these sections are optional, expect for the translation 1.18 cvs 6753: rules associated with element types. Many <tt>TEXTTRANSLATE</tt> sections can 1.1 cvs 6754: appear, each defining the rules for translating character strings of a 1.18 cvs 6755: particular alphabet.</p> 6756: <pre> TransSchema ='TRANSLATION' ElemID ';' 1.1 cvs 6757: [ 'LINELENGTH' LineLength ';' ] 6758: [ 'LINEEND' CHARACTER ';' ] 6759: [ 'LINEENDINSERT' STRING ';' ] 6760: [ 'BUFFERS' BufferSeq ] 6761: [ 'COUNTERS' CounterSeq ] 6762: [ 'CONST' ConstSeq ] 6763: [ 'VAR' VariableSeq ] 6764: 'RULES' ElemSeq 6765: [ 'ATTRIBUTES' AttrSeq ] 6766: [ 'PRESENTATION' PresSeq ] 6767: < 'TEXTTRANSLATE' TextTransSeq > 6768: [ 'SYMBTRANSLATE' TransSeq ] 6769: [ 'GRAPHTRANSLATE' TransSeq ] 1.18 cvs 6770: 'END' .</pre> 6771: </div> 1.1 cvs 6772: 1.18 cvs 6773: <div class="subsection"> 1.1 cvs 6774: 1.18 cvs 6775: <h3><a name="sectc522">Line length</a></h3> 6776: <p> 6777: If a <tt>LINELENGTH</tt> instruction is present after the structure 1.1 cvs 6778: declaration, the translator divides the text it produces into lines, each line 6779: having a length less than or equal to the integer which follows the 1.18 cvs 6780: <tt>LINELENGTH</tt> keyword. This maximum line length is expressed as a 1.1 cvs 6781: number of characters. The end of the line is marked by the character defined 1.18 cvs 6782: by the <tt>LINEEND</tt> instruction. When the translator breaks the lines on 1.1 cvs 6783: a space character in generated text, this space will be replaced by the 1.18 cvs 6784: character string defined by the <tt>LINEENDINSERT</tt> instruction.</p> 6785: <p> 6786: If the <tt>LINEEND</tt> instruction is not defined then the linefeed character 1.1 cvs 6787: (octal code 12) is used as the default line end character. If the 1.18 cvs 6788: <tt>LINEENDINSERT</tt> instruction is not defined, the linefeed character is 6789: inserted at the end of the produced lines. If there is no <tt>LINELENGTH</tt> 1.1 cvs 6790: instruction, the translated text is not divided into lines. Otherwise, if the 6791: translation rules generate line end marks, these marks remain in the 6792: translated text, but the length of the lines is not controlled by the 1.18 cvs 6793: translator.</p> 6794: <pre> LineLength = NUMBER .</pre> 6795: <blockquote class="example"> 6796: <p> 6797: <strong>Example:</strong></p> 6798: <p> 6799: To limit the lines produced by the translator to a length of 80 characters, 6800: the following rule is written at the beginning of the translation schema.</p> 6801: <pre>LineLength 80;</pre> 6802: </blockquote> 6803: </div> 1.1 cvs 6804: 1.18 cvs 6805: <div class="subsection"> 1.1 cvs 6806: 1.18 cvs 6807: <h3><a name="sectc523">Buffers</a></h3> 6808: <p> 1.1 cvs 6809: A buffer is a unit of memory managed by the translator, which can either 1.18 cvs 6810: contain text read from the terminal during the translation (see the <a 6811: href="#sectc5212"><tt>Read</tt> rule</a>), or the name of the last picture 1.1 cvs 6812: (bit-map) encountered by the translator in its traversal of the document. 1.2 cvs 6813: Remember the pictures are stored in files that are separate for the document 1.1 cvs 6814: files and that the canonical form contains only the names of the files in 1.18 cvs 6815: which the pictures are found.</p> 6816: <p> 1.1 cvs 6817: Thus, there are two types of buffers: buffers for reading from the terminal 1.18 cvs 6818: (filled by the <tt>Read</tt> rule) and the buffer of picture names (containing 1.2 cvs 6819: the name of the last picture encountered). A translation schema can use 6820: either type, one or several read buffers and one (and only one) picture name 1.18 cvs 6821: buffer.</p> 6822: <p> 6823: If any buffers are used, the <tt>BUFFERS</tt> keyword must be present, 1.1 cvs 6824: followed by declarations of every buffer used in the translation schema. Each 6825: buffer declaration is composed only of the name of the buffer, chosen freely 1.2 cvs 6826: by the programmer. The picture name buffer is identified by the 1.18 cvs 6827: <tt>Picture</tt> keyword, between parentheses, following the buffer name. The 6828: <tt>Picture</tt> keyword may only appear once. Each buffer declaration is 6829: terminated by a semicolon.</p> 6830: <pre> BufferSeq = Buffer < Buffer > . 1.1 cvs 6831: Buffer = BufferID [ '(' 'Picture' ')' ] ';' . 1.18 cvs 6832: BufferID = NAME .</pre> 6833: <blockquote class="example"> 6834: <p> 6835: <strong>Example:</strong></p> 6836: <p> 1.3 cvs 6837: The following buffer declarations create a picture name buffer named 1.18 cvs 6838: <tt>pictureName</tt> and a read buffer named <a 6839: name="destname"><tt>DestName</tt></a>:</p> 6840: <pre>BUFFERS 6841: pictureName (Picture); DestName;</pre> 6842: </blockquote> 6843: </div> 1.1 cvs 6844: 1.18 cvs 6845: <div class="subsection"> 1.1 cvs 6846: 1.18 cvs 6847: <h3><a name="sectc524">Counters</a></h3> 6848: <p> 1.1 cvs 6849: Certain translation rules generate text that varies according to the context 6850: of the element to which the rules apply. Variable text is defined either in 1.18 cvs 6851: the <a href="#sectc526"><tt>VAR</tt> section</a> of the translation schema or 6852: in the rule itself (see the <tt>Create</tt> and <tt>Write</tt> rules). Both 1.1 cvs 6853: types of definition rely on counters for the calculation of variable 1.18 cvs 6854: material.</p> 6855: <p> 1.1 cvs 6856: There are two types of counter: counters whose value is explicitely computed 1.18 cvs 6857: by applying <a href="#sectc5221"><tt>Set</tt> and <tt>Add</tt> rules</a>, and 1.1 cvs 6858: counters whose value is computed by a function associated with the counter. 6859: Those functions allow the same calculations as can be used in presentation 6860: schemas. As in a presentation schema, counters must be defined in the 1.18 cvs 6861: <tt>COUNTERS</tt> section of the translation schema before they are used.</p> 6862: <p> 6863: When counters are used in a translation schema, the <tt>COUNTERS</tt> keyword 1.1 cvs 6864: is followed by the declarations of every counter used. Each declaration is 6865: composed of the counter's name possibly followed by a colon and the counting 6866: function to be used for the counter. The declaration is terminated by a 1.18 cvs 6867: semi-colon. If the counter is explicitely computed by <tt>Set</tt> and 6868: <tt>Add</tt> rules, no counting function is indicated. If a counting function 6869: is indicated, <tt>Set</tt> and <tt>Add</tt> rules cannot be applied to that 6870: counter.</p> 6871: <p> 1.1 cvs 6872: The counting function indicates how the counter's value will be computed. 1.18 cvs 6873: Three functions are available: <tt>Rank</tt>, <tt>Rlevel</tt>, and 6874: <tt>Set</tt>.</p> 6875: <ul> 6876: <li> 6877: <tt>Rank of ElemID</tt> indicates that the counter's value is the rank of the 6878: element of type <tt>ElemID</tt> which encloses the element for which the 1.2 cvs 6879: counter is being evaluated. For the purposes of this function, an element of 1.18 cvs 6880: type <tt>ElemID</tt> is considered to enclose itself. This function is 6881: primarily used when the element of type <tt>ElemID</tt> is part of an 1.2 cvs 6882: aggregate or list, in which case the counter's value is the element's rank in 1.18 cvs 6883: its list or aggregate. Note that, unlike the <tt>Rank</tt> function for 6884: presentation schemas, the <tt>Page</tt> keyword cannot be used in place of the 6885: <tt>ElemID</tt>. 6886: <p> 6887: The type name <tt>ElemID</tt> can be followed by an integer. That number 1.1 cvs 6888: represents the relative level, among the ancestors of the concerned element, 1.18 cvs 6889: of the element whose rank is asked. If that relative level <i>n</i> is 6890: unsigned, the <i>n<sup>th</sup></i> element of type <tt>ElemID</tt> 6891: encountered when travelling the logical structure from the root to the 6892: concerned element is taken into account. If the relative level is negative, 6893: the logical structure is travelled in the other direction, from the concerned 6894: element to the root.</p> 1.19 cvs 6895: </li> 1.18 cvs 6896: <li> 6897: <tt>Rlevel of ElemID</tt> indicates that the counter's values is the relative 6898: level in the tree of the element for which the counter is being evaluated. The 6899: counter counts the number of elements of type <tt>ElemID</tt> which are found 6900: on the path between the root of the document's logical structure tree and the 6901: element (inclusive). 1.19 cvs 6902: </li> 1.18 cvs 6903: <li> 6904: <tt>Set n on Type1 Add m on Type2</tt> indicates that the counter's value is 6905: calculated as follows: in traversing the document from the beginning to the 6906: element for which the counter is being evaluated, the counter is set to the 6907: value <tt>n</tt> each time a <tt>Type1</tt> element is encountered and is 6908: incremented by the amount <tt>m</tt> each time a <tt>Type2</tt> element is 6909: encountered. The initial value <tt>n</tt> and the increment <tt>m</tt> are 1.1 cvs 6910: integers. 1.19 cvs 6911: </li> 1.18 cvs 6912: </ul> 6913: <p> 6914: As in a presentation schema, the <tt>Rank</tt> and <tt>Set</tt> functions can 1.1 cvs 6915: be modified by a numeric attribute which changes their initial value. This is 1.18 cvs 6916: indicated by the <tt>Init</tt> keyword followed by the numeric attribute's 6917: name. The <tt>Set</tt> function takes the value of the attribute instead of 6918: the <tt>InitValue</tt> (<tt>n</tt>). For the <tt>Rank</tt> function, the 1.1 cvs 6919: value of the attribute is considered to be the rank of the first element of 6920: the list (rather than the normal value of 1). Subsequent items in the list 6921: have their ranks shifted accordingly. In both cases, the attribute must be 1.18 cvs 6922: numeric and must be a local attribute of the root of the document itself.</p> 6923: <pre> CounterSeq = Counter < Counter > . 1.1 cvs 6924: Counter = CounterID [ ':' CounterFunc ] ';' . 6925: CounterID = NAME . 6926: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ] 6927: [ 'Init' AttrID ] / 6928: 'Rlevel' 'of' ElemID / 6929: 'Set' InitValue 'On' ElemID 6930: 'Add' Increment 'On' ElemID 6931: [ 'Init' AttrID ] . 6932: SLevelAsc = [ '-' ] LevelAsc . 6933: LevelAsc = NUMBER . 6934: InitValue = NUMBER . 6935: Increment = NUMBER . 6936: ElemID = NAME . 1.18 cvs 6937: AttrID = NAME .</pre> 6938: <blockquote class="example"> 6939: <p> 6940: <strong>Example:</strong></p> 6941: <p> 6942: If the body of a chapter is defined in the structure schema by:</p> 6943: <pre>Chapter_Body = LIST OF 1.1 cvs 6944: (Section = BEGIN 6945: Section_Title = Text; 6946: Section_Body = BEGIN 6947: Paragraphs; 6948: Section; 6949: END; 6950: END 1.18 cvs 6951: );</pre> 6952: <p> 6953: (sections are defined recursively), a counter can be defined giving the <a 6954: name="sectnum">number of a section</a> within its level in the hierarchy:</p> 6955: <pre>COUNTERS 6956: SectionNumber : Rank of Section;</pre> 6957: <p> 6958: A counter holding the hierarchic level of a section:</p> 6959: <pre> SectionLevel : Rlevel of Section;</pre> 6960: <p> 6961: A <a name="uniquenum">counter</a> which sequentially numbers all the 6962: document's sections, whatever their hierarchic level:</p> 6963: <pre> UniqueSectNum : Set 0 on Document Add 1 on Section;</pre> 6964: </blockquote> 6965: </div> 1.1 cvs 6966: 1.18 cvs 6967: <div class="subsection"> 1.1 cvs 6968: 1.18 cvs 6969: <h3><a name="sectc525">Constants</a></h3> 6970: <p> 1.1 cvs 6971: A common feature of translation rules is the generation of constant text. This 1.18 cvs 6972: text can be defined in the rule that generates it (see for example the <a 6973: href="#sectc5210"><tt>Create</tt></a> and <a 6974: href="#sectc5211"><tt>Write</tt></a> rules); but it can also be defined once 6975: in the constant declaration section and used many times in different rules. 6976: The latter option is preferable when the same text is used in several rules or 6977: several <a href="#sectc526">variables</a>.</p> 6978: <p> 6979: The <tt>CONST</tt> keyword begins the constant declaration section of the 1.1 cvs 6980: translation schema. It must be omitted if no constants are declared. Each 6981: constant declaration is composed of the constant name, an equals sign, and the 6982: constant's value, which is a character string between apostrophes. A constant 1.18 cvs 6983: declaration is terminated by a semicolon.</p> 6984: <pre> ConstSeq = Const < Const > . 1.1 cvs 6985: Const = ConstID '=' ConstValue ';' . 6986: ConstID = NAME . 1.18 cvs 6987: ConstValue = STRING .</pre> 6988: <blockquote class="example"> 6989: <p> 6990: <strong><a name="levelexample">Example:</a></strong></p> 6991: <p> 6992: The following rule assigns the name <tt>TxtLevel</tt> to the character string 6993: ``Level'':</p> 6994: <pre>CONST 6995: TxtLevel = 'Level';</pre> 6996: </blockquote> 6997: </div> 1.1 cvs 6998: 1.18 cvs 6999: <div class="subsection"> 1.1 cvs 7000: 1.18 cvs 7001: <h3><a name="sectc526">Variables</a></h3> 7002: <p> 1.10 cvs 7003: Variables allow to define variable text which is generated by the 1.18 cvs 7004: <tt>Create</tt> and <tt>Write</tt> rules. They are also used to define file 7005: names which are used in the <tt>Create</tt>, <tt>ChangeMainFile</tt>, 7006: <tt>RemoveFile</tt>, and <tt>Indent</tt> rules. Variables can be defined 7007: either in the <tt>VAR</tt> section of the translation schema or directly in 7008: the rules which use them. Variables that define file names must be declared 7009: in the <tt>VAR</tt> section, and when the same variable is used several times 7010: in the translation schema, it makes sense to define it globally in the 7011: <tt>VAR</tt> section. This section is only present if at least one variable 7012: is defined globally.</p> 7013: <p> 7014: After the <tt>VAR</tt> keyword, each global variable is defined by its name, a 1.1 cvs 7015: colon separator and a sequence of functions (at least one function). Each 7016: variable definition is terminated by a semicolon. Functions determine the 7017: different parts which together give the value of the variable. The value is 7018: obtained by concatenating the strings produced by each of the functions. Seven 7019: types of functions are available. Each variable definition may use any number 1.18 cvs 7020: of functions of each type.</p> 7021: <ul> 7022: <li> 7023: The function <tt>Value(Counter)</tt>returns a string representing the value 7024: taken by the counter when it is evaluated for the element in whose rule the 7025: variable is used. The counter must have been declared in the 7026: <tt>COUNTERS</tt> section of the translation schema. When the counter is 1.2 cvs 7027: expressed in arabic numerals, the counter name can be followed by a colon and 7028: an integer indicating a minimum length (number of characters) for the string; 7029: if the counter's value is normally expressed with fewer characters than the 7030: required minimum, zeroes are added to the front of the string to achieve the 1.5 cvs 7031: minimum length. 1.18 cvs 7032: <p> 1.1 cvs 7033: By default, the counter value is written in arabic digits. If another 7034: representation of that value is needed, the counter name must be followed by a 1.18 cvs 7035: comma and one of the following keywords:</p> 7036: <ul> 7037: <li> 7038: <tt>Arabic</tt>: arabic numerals (default value), 1.19 cvs 7039: </li> 1.18 cvs 7040: <li> 7041: <tt>LRoman</tt>: lower-case roman numerals, 1.19 cvs 7042: </li> 1.18 cvs 7043: <li> 7044: <tt>URoman</tt>: upper-case roman numerals, 1.19 cvs 7045: </li> 1.18 cvs 7046: <li> 7047: <tt>Uppercase</tt>: upper-case letter, 1.19 cvs 7048: </li> 1.18 cvs 7049: <li> 7050: <tt>Lowercase</tt>: lower-case letter. 1.19 cvs 7051: </li> 1.18 cvs 7052: </ul> 1.19 cvs 7053: </li> 1.18 cvs 7054: <li> 7055: The function <tt>FileDir</tt>, without parameter, returns a string 1.2 cvs 7056: representing the name of the directory of the output file that has been given 7057: as a parameter to the translation program. The string includes a character '/' 7058: at the end. 1.19 cvs 7059: </li> 1.18 cvs 7060: <li> 7061: The function <tt>FileName</tt>, without parameter, returns a string 1.2 cvs 7062: representing the name of the output file that has been given as a parameter to 7063: the translation program. The file extension (the character string that 7064: terminate the file name, after a dot) is not part of that string. 1.19 cvs 7065: </li> 1.18 cvs 7066: <li> 7067: The function <tt>Extension</tt>, without parameter, returns a string 1.2 cvs 7068: representing the extension of the file name. That string is empty if the file 7069: name that has been given as a parameter to the translation program has no 7070: extension. If there is an extension, its first character is a dot. 1.19 cvs 7071: </li> 1.18 cvs 7072: <li> 7073: The function <tt>DocumentName</tt>, without parameter, returns a string 1.2 cvs 7074: representing the name of the document being translated. 1.19 cvs 7075: </li> 1.18 cvs 7076: <li> 7077: The function <tt>DocumentDir</tt>, without parameter, returns a string 1.2 cvs 7078: representing the directory containing the document being translated. 1.19 cvs 7079: </li> 1.18 cvs 7080: <li> 7081: The function formed by the name of a constant returns that constant's value. 1.19 cvs 7082: </li> 1.18 cvs 7083: <li> 7084: The function formed by a character string between apostrophes returns that 1.1 cvs 7085: string. 1.19 cvs 7086: </li> 1.18 cvs 7087: <li> 7088: The function formed by the name of a buffer returns the contents of that 1.2 cvs 7089: buffer. If the named buffer is the picture buffer, then the name of the last 7090: picture encountered is returned. Otherwise, the buffer is a read buffer and 7091: the value returned is text previously read from the terminal. If the buffer 1.18 cvs 7092: is empty (no picture has been encountered or the <tt>Read</tt> rule has not 1.2 cvs 7093: been executed for the buffer), then the empty string is returned. 1.19 cvs 7094: </li> 1.18 cvs 7095: <li> 7096: The function formed by an attribute name takes the value of the indicated 1.2 cvs 7097: attribute for the element to which the variable applies. If the element does 7098: not have that attribute, then the element's ancestor are searched toward the 7099: root of the tree. If one of the ancestors does have the attribute then its 7100: value is used. If no ancestors have the attribute, then the value of the 1.1 cvs 7101: function is the empty string. 1.19 cvs 7102: </li> 1.18 cvs 7103: </ul> 7104: <pre> VariableSeq = Variable < Variable > . 1.1 cvs 7105: Variable = VarID ':' Function < Function > ';' . 7106: VarID = NAME . 7107: Function ='Value' '(' CounterID [ ':' Length ] 7108: [ ',' CounterStyle ] ')' / 7109: 'FileDir' / 'FileName' / 'Extension' / 7110: 'DocumentName' / 'DocumentDir' / 7111: ConstID / CharString / 7112: BufferID / AttrID . 7113: Length = NUMBER . 7114: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' / 7115: 'Uppercase' / 'Lowercase' . 1.18 cvs 7116: CharString = STRING .</pre> 7117: <blockquote class="example"> 7118: <p> 7119: <strong>Example:</strong></p> 7120: <p> 1.3 cvs 7121: To create, at the beginning of each section of the translated document, text 7122: composed of the string ``Section'' followed by the section number, the 1.18 cvs 7123: following <a name="varsectexample">variable definition</a> might be used:</p> 7124: <pre>VAR 7125: SectionVar : 'Section' Value(SectionNumber);</pre> 7126: <p> 7127: (see the definition of <a href="#sectnum"><tt>SectionNumber</tt></a>).</p> 7128: <p> 1.1 cvs 7129: The following variable definition can be used to create, at the beginning of 7130: each section, the text ``Level'' followed by the hierarchical level of the 1.18 cvs 7131: section. It used the constant defined above.</p> 7132: <pre> LevelVar : TxtLevel Value(SectionLevel);</pre> 7133: <p> 7134: (see the definitions of <a href="#sectnum"><tt>SectionLevel</tt></a> and of <a 7135: href="#levelexample"><tt>TxtLevel</tt></a>).</p> 7136: <p> 7137: To generate the translation of each section in a different file (see <a 7138: href="#sectc5220">rule <tt>ChangeMainFile</tt></a>), the name of these files 7139: might be defined by the following variable:</p> 7140: <pre> VarOutpuFile : FileName Value(SectionNumber) 7141: Extension;</pre> 7142: <p> 7143: If <tt>output.txt</tt> is the name of the <a name="varoutputfile">output 7144: file</a> specified when starting the translation program, translated sections 7145: are written in files <tt>output1.txt</tt>, <tt>output2.txt</tt>, etc.</p> 7146: </blockquote> 7147: </div> 7148: 7149: <div class="subsection"> 7150: 7151: <h3><a name="sectc527">Translating structure elements</a></h3> 7152: <p> 7153: The <tt>RULES</tt> keyword introduces the translation rules which will be 1.1 cvs 7154: applied to the various structured element types. Translation rules can be 7155: specified for each element type defined in the structure schema, including the 1.18 cvs 7156: base types defined implicitly, whose names are <tt>TEXT_UNIT</tt>, 7157: <tt>PICTURE_UNIT</tt>, <tt>SYMBOL_UNIT</tt>, <tt>GRAPHIC_UNIT</tt> and 7158: <tt>PAGE_UNIT</tt>. But it is not necessary to specify rules for every 7159: defined type.</p> 7160: <p> 1.1 cvs 7161: If there are no translation rules for an element type, the elements that it 7162: contains (and which may have rules themselves) will still be translated, but 7163: the translator will produce nothing for the element itself. To make the 1.18 cvs 7164: translator completely ignore the content of an element the <a 7165: href="#sectc5217"><tt>Remove</tt> rule</a> must be used.</p> 7166: <p> 1.1 cvs 7167: The translation rules for an element type defined in the structure schema are 7168: written using the name of the type followed by a colon and the list of 1.18 cvs 7169: applicable rules. When the element type is a <a href="#sectd3285">mark 7170: pair</a>, but only in this case, the type name must be preceded by the 7171: <tt>First</tt> or <tt>Second</tt> keyword. This keyword indicates whether the 7172: rules that follow apply to the first or second mark of the pair.</p> 7173: <p> 1.1 cvs 7174: The list of rules can take several forms. It may be a simple non-conditional 7175: rule. It can also be formed by a condition followed by one or more simple 1.18 cvs 7176: rules. Or it can be a block of rules beginning with the <tt>BEGIN</tt> 7177: keyword and ending with the <tt>END</tt> keyword and a semicolon. This block 1.1 cvs 7178: of rules can contain one or more simple rules and/or one or more conditions, 1.18 cvs 7179: each followed by one or more simple rules.</p> 7180: <pre> ElemSeq = TransType < TransType > . 1.1 cvs 7181: TransType = [ FirstSec ] ElemID ':' RuleSeq . 7182: FirstSec = 'First' / 'Second' . 7183: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' . 7184: Rule = SimpleRule / ConditionBlock . 7185: ConditionBlock = 'IF' ConditionSeq SimpleRuleSeq . 7186: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' / 1.18 cvs 7187: SimpleRule .</pre> 7188: </div> 1.1 cvs 7189: 1.18 cvs 7190: <div class="subsection"> 1.1 cvs 7191: 1.18 cvs 7192: <h3><a name="sectc528">Conditional rules</a></h3> 7193: <p> 1.1 cvs 7194: In a translation schema, the translation rules are either associated with 7195: element types or with attribute values or with a specific presentation. They 7196: are applied by the translator each time an element of the corresponding type 7197: is encountered in the translated document or each time the attribute value is 7198: carried by an element or also, each time the specific translation is attached 7199: to an element. This systematic application of the rules can be relaxed: it is 7200: possible to add a condition to one or more rules, so that these rules are only 1.18 cvs 7201: applied when the condition is true.</p> 7202: <p> 7203: A condition begins with the keyword <tt>IF</tt>, followed by a sequence of 1.1 cvs 7204: elementary conditions. Elementary conditions are separated from each other by 1.18 cvs 7205: the <tt>AND</tt> keyword. If there is only one elementary condition, this 1.1 cvs 7206: keyword is absent. The rules are only applied if all the elementary 7207: conditions are true. The elementary condition can be negative; it is then 1.18 cvs 7208: preceded by the <tt>NOT</tt> keyword.</p> 7209: <p> 1.1 cvs 7210: When the translation rule(s) controlled by the condition apply to a reference 7211: element or a reference attribute, an elementary condition can also apply to 1.18 cvs 7212: element referred by this reference. The <tt>Target</tt> keyword is used for 1.1 cvs 7213: that purpose. It must appear before the keyword defining the condition 1.18 cvs 7214: type.</p> 7215: <p> 1.1 cvs 7216: Depending on their type, some conditions may apply either to the element with 1.5 cvs 7217: which they are associated, or to one of its ancestor. In the case of an 1.18 cvs 7218: ancestor, the key word <tt>Ancestor</tt> must be used, followed by</p> 7219: <ul> 7220: <li> 7221: either an integer which represents the number of levels in the tree between 7222: the element and the ancestor of interest, 1.19 cvs 7223: </li> 1.18 cvs 7224: <li> 7225: or the type name of the ancestor of interest. If that type is defined in a 7226: separate structure schema, the name of that schema must follow between 1.1 cvs 7227: parentheses. 1.19 cvs 7228: </li> 1.18 cvs 7229: </ul> 7230: <p> 1.2 cvs 7231: There is a special case for the parent element, which can be simply written 1.18 cvs 7232: <tt>Parent</tt> instead of <tt>Ancestor 1</tt>.</p> 7233: <p> 7234: Only conditions <tt>First</tt>, <tt>Last</tt>, <tt>Referred</tt>, 7235: <tt>Within</tt>, <tt>Attributes</tt>, <tt>Presentation</tt>, <tt>Comment</tt> 1.1 cvs 7236: and those concerning an attribute or a specific presentation can apply to an 1.18 cvs 7237: ancestor. Conditions <tt>Defined</tt>, <tt>FirstRef</tt>, <tt>LastRef</tt>, 7238: <tt>ExternalRef</tt>, <tt>Alphabet</tt>, <tt>FirstAttr</tt>, 7239: <tt>LastAttr</tt>, <tt>ComputedPage</tt>, <tt>StartPage</tt>, 7240: <tt>UserPage</tt>, <tt>ReminderPage</tt>, <tt>Empty</tt> cannot be preceded by 7241: keywords <tt>Parent</tt> or <tt>Ancestor</tt>.</p> 7242: <p> 7243: In condition <tt>Referred</tt> and in the condition that applies to a named 7244: attribute, a symbol '<tt>*</tt>' can indicate that the condition is related 1.5 cvs 7245: only to the element itself. If this symbol is not present, not only the 1.18 cvs 7246: element is considered, but also its ancestor, at any level.</p> 7247: <p> 1.1 cvs 7248: The form of an elementary condition varies according to the type of 1.18 cvs 7249: condition.</p> 1.1 cvs 7250: 1.18 cvs 7251: <div class="subsubsection"> 1.1 cvs 7252: 1.18 cvs 7253: <h4><a name="sectd5281">Conditions based on the logical position of the 7254: element</a></h4> 7255: <p> 1.1 cvs 7256: The condition can be on the position of the element in the document's logical 7257: structure tree. It is possible to test whether the element is the first 1.18 cvs 7258: (<tt>First</tt>) or last (<tt>Last</tt>) among its siblings or if it is not 7259: the first (<tt>NOT First</tt>) or not the last (<tt>NOT Last</tt>).</p> 7260: <p> 1.1 cvs 7261: It is also possible to test if the element is contained in an element of a 1.18 cvs 7262: given type (<tt>Within</tt>) or if it is not (<tt>NOT Within</tt>). If that 1.1 cvs 7263: element type is defined in a structure schema which is not the one which 7264: corresponds to the translation schema, the type name of this element must be 7265: followed, between parentheses, by the name of the structure schema which 1.18 cvs 7266: defines it.</p> 7267: <p> 7268: If the keyword <tt>Within</tt> is preceded by <tt>Immediately</tt>, the 7269: condition is satisfied only if the <em>parent</em> element has the type 7270: indicated. If the word <tt>Immediately</tt> is missing, the condition is 7271: satisfied if any <em>ancestor</em> has the type indicated.</p> 7272: <p> 7273: An integer <i>n</i> can appear between the keyword <tt>Within</tt> and the 1.1 cvs 7274: type. It specifies the number of ancestors of the indicated type that must be 7275: present for the condition to be satisfied. If the keyword 1.18 cvs 7276: <tt>Immediately</tt> is also present, the <i>n</i> immediate ancestors of the 7277: element must have the indicated type. The integer <i>n</i> must be positive 7278: or zero. It can be preceded by <tt><</tt> or <tt>></tt> to indicate a 1.1 cvs 7279: maximum or minimum number of ancestors. If these symbols are missing, the 1.18 cvs 7280: condition is satisfied only if it exists exactly <i>n</i> ancestors. When 7281: this number is missing, it is equivalent to > 0.</p> 7282: <p> 1.11 cvs 7283: If the condition applies to translation rules associated with an attribute, 1.18 cvs 7284: i.e. if it is in the <tt>ATTRIBUTES</tt> section of the presentation schema, 1.11 cvs 7285: the condition can be simply an element name. Translation rules are then 1.18 cvs 7286: executed only if the attribute is attached to an element of that type. The 7287: keyword <tt>NOT</tt> before the element name indicates that the translation 7288: rules must be executed only if the element is not of the type indicated.</p> 7289: </div> 1.1 cvs 7290: 1.18 cvs 7291: <div class="subsubsection"> 1.1 cvs 7292: 1.18 cvs 7293: <h4><a name="sectd5282">Conditions on references</a></h4> 7294: <p> 1.1 cvs 7295: References may be taken into account in conditions, which can be based on the 1.18 cvs 7296: fact that the element, or one of its ancestors (unless symbol <tt>*</tt> is 7297: present), is designated by a at least one reference (<tt>Referred</tt>) or by 7298: none (<tt>NOT Referred</tt>). If the element or attribute to which the 1.1 cvs 7299: condition is attached is a reference, the condition can be based on the fact 7300: that it acts as the first reference to the designated element 1.18 cvs 7301: (<tt>FirstRef</tt>), or as the last (<tt>LastRef</tt>), or as a reference to 7302: an element located in another document (<tt>ExternalRef</tt>). Like all 7303: conditions, conditions on references can be inverted by the <tt>NOT</tt> 7304: keyword.</p> 7305: </div> 7306: 7307: <div class="subsubsection"> 7308: 7309: <h4><a name="sectd5283">Conditions on the parameters</a></h4> 7310: <p> 7311: Elements which are <a href="#sectc326">parameters</a> can be given a 7312: particular condition which is based on whether or not the parameter is given a 7313: value in the document (<tt>Defined</tt> or <tt>NOT Defined</tt>, 7314: respectively).</p> 7315: </div> 1.1 cvs 7316: 1.18 cvs 7317: <div class="subsubsection"> 1.1 cvs 7318: 1.18 cvs 7319: <h4><a name="sectd5284">Conditions on the alphabets</a></h4> 7320: <p> 1.1 cvs 7321: The character string base type (and only this type) can use the condition 1.18 cvs 7322: <tt>Alphabet = a</tt> which indicates that the translation rule(s) should only 1.1 cvs 7323: apply if the alphabet of the character string is the one whose name appears 1.18 cvs 7324: after the equals sign (or is not, if there is a preceding <tt>NOT</tt> 1.1 cvs 7325: keyword). This condition cannot be applied to translation rules of an 1.18 cvs 7326: attribute.</p> 7327: <p> 1.1 cvs 7328: In the current implementation of Thot, the available alphabets are the 1.18 cvs 7329: <tt>Latin</tt> alphabet and the <tt>Greek</tt> alphabet.</p> 7330: </div> 1.1 cvs 7331: 1.18 cvs 7332: <div class="subsubsection"> 1.1 cvs 7333: 1.18 cvs 7334: <h4><a name="sectd5285">Conditions on page breaks</a></h4> 7335: <p> 1.1 cvs 7336: The page break base type (and only this type) can use the following 1.18 cvs 7337: conditions: <tt>ComputedPage</tt>, <tt>StartPage</tt>, <tt>UserPage</tt>, and 7338: <tt>ReminderPage</tt>. The <tt>ComputedPage</tt> condition indicates that the 1.1 cvs 7339: translation rule(s) should apply if the page break was created automatically 1.18 cvs 7340: by Thot; the <tt>StartPage</tt> condition is true if the page break is 7341: generated before the element by the <tt>Page</tt> rule of the P language; the 7342: <tt>UserPage</tt> condition applies if the page break was inserted by the 7343: user; and the <tt>ReminderPage</tt> is applied if the page break is a reminder 7344: of page breaking.</p> 7345: </div> 1.1 cvs 7346: 1.18 cvs 7347: <div class="subsubsection"> 1.1 cvs 7348: 1.18 cvs 7349: <h4><a name="sectd5286">Conditions on the element's content</a></h4> 7350: <p> 1.1 cvs 7351: The condition can be based on whether or not the element is empty. An element 7352: which has no children or whose leaves are all empty is considered to be empty 1.18 cvs 7353: itself. This condition is expressed by the <tt>Empty</tt> keyword, optionally 7354: preceded by the <tt>NOT</tt> keyword.</p> 7355: </div> 1.1 cvs 7356: 1.18 cvs 7357: <div class="subsubsection"> 1.1 cvs 7358: 1.18 cvs 7359: <h4><a name="sectd5287">Conditions on the presence of comments</a></h4> 7360: <p> 1.1 cvs 7361: The condition can be based on the presence or absence of comments associated 7362: with the translated element. This condition is expressed by the keyword 1.18 cvs 7363: <tt>Comment</tt>, optionally preceded by the keyword <tt>NOT</tt>.</p> 7364: </div> 1.1 cvs 7365: 1.18 cvs 7366: <div class="subsubsection"> 1.1 cvs 7367: 1.18 cvs 7368: <h4><a name="sectd5288">Conditions on the presence of specific presentation 7369: rules</a></h4> 7370: <p> 1.1 cvs 7371: The condition can be based on the presence or absence of specific presentation 7372: rules associated with the translated element, whatever the rules, their value 7373: or their number. This condition is expressed by the keyword 1.18 cvs 7374: <tt>Presentation</tt>, optionally preceded by the <tt>NOT</tt> keyword.</p> 7375: </div> 1.1 cvs 7376: 1.18 cvs 7377: <div class="subsubsection"> 1.1 cvs 7378: 1.18 cvs 7379: <h4><a name="sectd5289">Conditions on the presence of logical 7380: attributes</a></h4> 7381: <p> 1.1 cvs 7382: In the same way, the condition can be based on the presence or absence of 7383: attributes associated with the translated elements, no matter what the 1.18 cvs 7384: attributes or their values. The <tt>Attributes</tt> keyword expresses this 7385: condition.</p> 7386: </div> 1.1 cvs 7387: 1.18 cvs 7388: <div class="subsubsection"> 1.1 cvs 7389: 1.18 cvs 7390: <h4><a name="sectd52810">Conditions on logical attributes</a></h4> 7391: <p> 1.1 cvs 7392: If the condition appears in the translation rules of an attribute, the 1.18 cvs 7393: <tt>FirstAttr</tt> and <tt>LastAttr</tt> keywords can be used to indicate that 1.1 cvs 7394: the rules must only be applied if this attribute is the first attribute for 7395: the translated element or if it is the last (respectively). These conditions 1.18 cvs 7396: can also be inverted by the <tt>NOT</tt> keyword.</p> 7397: <p> 1.1 cvs 7398: Another type of condition can only be applied to the translation rules when 1.18 cvs 7399: the element being processed (or one of its ancestors if symbol <tt>*</tt> is 1.1 cvs 7400: missing) has a certain attribute, perhaps with a certain value or, in 7401: contrast, when the element does not have this attribute with this value. The 7402: condition is specified by writing the name of the attribute after the keyword 1.18 cvs 7403: <tt>IF</tt> or <tt>AND</tt>. The <tt>NOT</tt> keyword can be used to invert 1.1 cvs 7404: the condition. If the translation rules must be applied to any element which 7405: has this attribute (or does not have it, if the condition is inverted) no 7406: matter what the attribute's value, the condition is complete. If, in 7407: contrast, the condition applies to one or more values of the attribute, these 7408: are indicated after the name of the attribute, except for reference attributes 1.18 cvs 7409: which do not have values.</p> 7410: <p> 7411: The representation of the values of an <a name="relattr">attribute</a> in a 1.1 cvs 7412: condition depends on the attribute's type. For attributes with enumerated or 7413: textual types, the value (a name or character string between apostrophes, 7414: respectively) is simply preceded by an equals sign. For numeric attributes, 7415: the condition can be based on a single value or on a range of values. In the 7416: case of a unique value, this value (an integer) is simply preceded by an 1.18 cvs 7417: equals sign. Conditions based on ranges of values have several forms:</p> 7418: <ul> 7419: <li> 7420: all values less than a given value (the value is preceded by a ``less than'' 7421: sign). 1.19 cvs 7422: </li> 1.18 cvs 7423: <li> 7424: all values greater than a given value (the value is preceded by a ``greater 1.1 cvs 7425: than'' sign). 1.19 cvs 7426: </li> 1.18 cvs 7427: <li> 7428: all values falling in an interval, bounds included. The range of values is 7429: then specified <tt>IN [</tt>Minimum <tt>..</tt>Maximum<tt>]</tt>, where 1.2 cvs 7430: Minimum and Maximum are integers. 1.19 cvs 7431: </li> 1.18 cvs 7432: </ul> 7433: <p> 1.2 cvs 7434: All numeric values may be negative. The integer is simply preceded by a minus 1.18 cvs 7435: sign.</p> 7436: <p> 7437: Both local and global attributes can be used in conditions.</p> 7438: </div> 1.1 cvs 7439: 1.18 cvs 7440: <div class="subsubsection"> 1.1 cvs 7441: 1.18 cvs 7442: <h4><a name="sectd52811">Conditions on specific presentation rules</a></h4> 7443: <p> 1.1 cvs 7444: It is possible to apply translation rules only when the element being 7445: processed has or does not have a specific presentation rule, possibly with a 7446: certain value. The condition is specified by writing the name of the 1.18 cvs 7447: presentation rule after the keyword <tt>IF</tt> or <tt>AND</tt>. The 7448: <tt>NOT</tt> keyword can be used to invert the condition. If the translation 1.1 cvs 7449: rules must be applied to any element which has this presentation rule (or does 7450: not have it, if the condition is inverted) no matter what the rule's value, 7451: the condition is complete. If, in contrast, the condition applies to one or 7452: more values of the rule, these are indicated after the name of the 1.18 cvs 7453: attribute.</p> 7454: <p> 1.1 cvs 7455: The representation of presentation rule values in a condition is similar to 7456: that for attribute values. The representation of these values depend on the 7457: type of the presentation rule. There are three categories of presentation 1.18 cvs 7458: rules:</p> 7459: <ul> 7460: <li> 7461: those taking numeric values (<tt>Size, Indent, LineSpacing, LineWeight</tt>), 1.19 cvs 7462: </li> 1.18 cvs 7463: <li> 7464: those with values taken from a predefined list (<tt>Adjust, Justify, 1.24 cvs 7465: Hyphenate, Style, Weight, Font, UnderLine, Thickness, LineStyle</tt>), 1.19 cvs 7466: </li> 1.18 cvs 7467: <li> 7468: those whose value is a name (<tt>FillPattern, Background, Foreground</tt>). 1.19 cvs 7469: </li> 1.18 cvs 7470: </ul> 7471: <p> 1.1 cvs 7472: For presentation rules which take numeric values, the condition can take a 7473: unique value or a range of values. In the case of a unique value, this value 7474: (an integer) is simply preceded by an equals sign. Conditions based on ranges 1.18 cvs 7475: of values have several forms:</p> 7476: <ul> 7477: <li> 7478: all values less than a given value (the value is preceded by a ``less than'' 7479: sign). 1.19 cvs 7480: </li> 1.18 cvs 7481: <li> 7482: all values greater than a given value (the value is preceded by a ``greater 1.1 cvs 7483: than'' sign). 1.19 cvs 7484: </li> 1.18 cvs 7485: <li> 7486: all values falling in an interval, bounds included. The range of values is 7487: then specified <tt>IN [</tt>Minimum <tt>..</tt>Maximum<tt>]</tt>, where 1.2 cvs 7488: Minimum and Maximum are integers. 1.19 cvs 7489: </li> 1.18 cvs 7490: </ul> 7491: <p> 7492: Values for the <tt>Indent</tt>rule may be negative. The integer is then 1.2 cvs 7493: simply preceded by a minus sign and represents how far the first line starts 1.18 cvs 7494: to the left of the other lines.</p> 7495: <p> 1.1 cvs 7496: For presentation rules whose values are taken from predefined lists, the value 7497: which satisfies the condition is indicated by an equals sign followed by the 1.18 cvs 7498: name of the value.</p> 7499: <p> 1.1 cvs 7500: For presentation rule whose values are names, the value which satisfies the 7501: condition is indicated by the equals sign followed by the value's name. The 1.18 cvs 7502: names of fill patterns (the <tt>FillPattern</tt> rule) and of colors (the 7503: <tt>Foreground</tt> and <tt>Background</tt> rules) known to Thot are the same 7504: as in the P language.</p> 7505: <p> 1.1 cvs 7506: The syntax of conditions based on the specific presentation is the same as the 1.18 cvs 7507: syntax used to express the <a href="#sectc5224">translation of specific 7508: presentation rules</a>.</p> 7509: <p> 1.1 cvs 7510: When a condition has only one rule, the condition is simply followed by that 7511: rule. If it has several rules, they are placed after the condition between 1.18 cvs 7512: the keywords <tt>BEGIN</tt> and <tt>END</tt>.</p> 7513: <pre> ConditionSeq = Condition [ 'AND' Condition ] . 1.1 cvs 7514: Condition = [ 'NOT' ] [ 'Target' ] Cond . 7515: Cond = CondElem / CondAscend . 7516: CondElem ='FirstRef' / 'LastRef' / 7517: 'ExternalRef' / 7518: 'Defined' / 7519: 'Alphabet' '=' Alphabet / 7520: 'ComputedPage' / 'StartPage' / 7521: 'UserPage' / 'ReminderPage' / 7522: 'Empty' / 1.11 cvs 7523: ElemID / 1.1 cvs 7524: 'FirstAttr' / 'LastAttr' . 7525: CondAscend = [ Ascend ] CondOnAscend . 7526: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType . 7527: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] . 7528: CondRelLevel = NUMBER . 7529: CondOnAscend ='First' / 'Last' / 7530: 'Referred' / 7531: [ 'Immediately' ] 'Within' [ NumParent ] 7532: ElemID [ ExtStruct ] / 7533: 'Attributes' / 7534: AttrID [ RelatAttr ] / 7535: 'Presentation' / 7536: PresRule / 7537: 'Comment' . 7538: NumParent = [ GreaterLess ] NParent . 7539: GreaterLess = '>' / '<' . 7540: NParent = NUMBER. 7541: ExtStruct = '(' ElemID ')' . 7542: Alphabet = NAME . 7543: RelatAttr ='=' Value / 7544: '>' [ '-' ] Minimum / 7545: '<' [ '-' ] Maximum / 7546: 'IN' '[' [ '-' ] MinInterval '..' 7547: [ '-' ] MaxInterval ']' . 7548: Value = [ '-' ] IntegerVal / TextVal / AttrValue . 7549: Minimum = NUMBER . 7550: Maximum = NUMBER . 7551: MinInterval = NUMBER . 7552: MaxInterval = NUMBER . 7553: IntegerVal = NUMBER . 7554: TextVal = STRING . 1.18 cvs 7555: AttrValue = NAME .</pre> 7556: <blockquote class="example"> 7557: <p> 7558: <strong>Example:</strong></p> 7559: <p> 1.3 cvs 7560: Suppose that after each element of type Section_Title it is useful to produce 1.18 cvs 7561: the text <tt>\label{SectX}</tt> where <tt>X</tt> represents the section 7562: number, but only if the section is designated by one or more references in the 7563: document. The following conditional rule produces this effect:</p> 7564: <pre>RULES 1.1 cvs 7565: Section_Title : 7566: IF Referred 1.18 cvs 7567: Create ('\label{Sect' Value(UniqueSectNum) '}\12') After;</pre> 7568: <p> 7569: (the declaration of the <a href="#sectc5224"><tt>UniqueSectNum</tt> 7570: counter</a> is given above). The string <tt>\12</tt> represents a line 7571: break.</p> 7572: </blockquote> 7573: <blockquote class="example"> 7574: <p> 7575: <strong>Example:</strong></p> 7576: <p> 1.3 cvs 7577: Suppose that for elements of the Elmnt type it would be useful to produce a 7578: character indicating the value of the numeric attribute Level associated with 7579: the element: an ``A'' for all values of Level less than 3, a ``B'' for values 7580: between 3 and 10 and a ``C'' for values greater than 10. This can be achieved 1.18 cvs 7581: by writing the following rules for the Elmnt type:</p> 7582: <pre>RULES 1.1 cvs 7583: Elmnt : 7584: BEGIN 7585: IF Level < 3 7586: Create 'A'; 7587: IF Level IN [3..10] 7588: Create 'B'; 7589: IF Level > 10 7590: Create 'C'; 1.18 cvs 7591: END;</pre> 7592: </blockquote> 7593: </div> 7594: </div> 1.1 cvs 7595: 1.18 cvs 7596: <div class="subsection"> 1.1 cvs 7597: 1.18 cvs 7598: <h3><a name="sectc529">Translation rules</a></h3> 7599: <p> 1.14 cvs 7600: Fifteen types of translation rules can be associated with element types and 1.18 cvs 7601: attribute values. They are the <tt>Create</tt>, <tt>Write</tt>, 7602: <tt>Read</tt>, <tt>Include</tt>, <tt>Get</tt>, <tt>Copy</tt>, <tt>Use</tt>, 7603: <tt>Remove</tt>, <tt>NoTranslation</tt>, <tt>NoLineBreak</tt>, 7604: <tt>ChangeMainFile</tt>, <tt>RemoveFile</tt>, <tt>Set</tt>, <tt>Add</tt>, 7605: <tt>Indent</tt>, rules. Each rule has its own syntax, although they are all 7606: based on very similar models.</p> 7607: <pre> SimpleRule = 'Create' [ 'IN' VarID ] Object 1.1 cvs 7608: [ Position ] ';' / 7609: 'Write' Object [ Position ] ';' / 7610: 'Read' BufferID [ Position ] ';' / 7611: 'Include' File [ Position ] ';' / 7612: 'Get' [ RelPosition ] ElemID 7613: [ ExtStruct ] 7614: [ Position ] ';' / 7615: 'Copy' [ RelPosition ] ElemID 7616: [ ExtStruct ] 7617: [ Position ] ';' / 7618: 'Use' TrSchema [ 'For' ElemID ] ';' / 7619: 'Remove' ';' / 7620: 'NoTranslation' ';' / 7621: 'NoLineBreak' ';' / 7622: 'ChangeMainFile' VarID [ Position ] ';' / 1.14 cvs 7623: 'RemoveFile' VarID [ Position ] ';' / 1.10 cvs 7624: 'Set' CounterID InitValue [ Position ] ';' / 7625: 'Add' CounterID Increment [ Position ] ';' / 1.25 cvs 7626: 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' .</pre> 1.18 cvs 7627: </div> 7628: 7629: <div class="subsection"> 7630: 7631: <h3><a name="sectc5210">The <tt>Create</tt> rule</a></h3> 7632: <p> 7633: The most frequently used rule is undoubtedly the <tt>Create</tt> rule, which 7634: generates fixed or variable text (called an <em>object</em>) in the output 1.1 cvs 7635: file. The generated text can be made to appear either before or after the 7636: content of the element to which the rule applies. The rule begins with the 1.18 cvs 7637: <tt>Create</tt> keyword, followed by a specifier for the object and a keyword 7638: (<tt>Before</tt> or <tt>After</tt>) indicating the position of the generated 7639: text (<a href="#sectc5222">before or after</a> the element's content). If the 1.1 cvs 7640: position is not indicated, the object will be generated before the element's 7641: content. This rule, like all translation rules, is terminated by a 1.18 cvs 7642: semicolon.</p> 7643: <p> 7644: The <tt>Create</tt> keyword can be followed by the <tt>IN</tt> keyword and by 1.1 cvs 7645: the name of a variable. This means that the text generated by the rule must 7646: not be written in the main output file, but in the file whose name is 1.18 cvs 7647: specified by the variable.</p> 7648: <p> 1.1 cvs 7649: This allows the translation program to generate text in different files during 1.14 cvs 7650: the same run. These files do not need to be explicitely declared or opened. 1.18 cvs 7651: They do not need to be closed either, but if they contain temporary data, they 7652: can be removed (see the <a href="#sectc5220a"><tt>RemoveFile</tt> rule</a>). 7653: As soon as the translation program executes a <tt>Create</tt> rule for a file 7654: that is not yet open, it opens the file. These files are closed when the 7655: translation is finished.</p> 7656: <pre> 'Create' [ 'IN' VarID ] Object 1.1 cvs 7657: [ Position ] ';' 7658: Object = ConstID / CharString / 7659: BufferID / 7660: VarID / 7661: '(' Function < Function > ')' / 1.21 cvs 7662: [ 'Translated' ] AttrID / 1.1 cvs 7663: 'Value' / 7664: 'Content' / 7665: 'Comment' / 7666: 'Attributes' / 7667: 'Presentation' / 7668: 'RefId' / 7669: 'PairId' / 7670: 'FileDir' / 7671: 'FileName' / 7672: 'Extension' / 7673: 'DocumentName' / 7674: 'DocumentDir' / 7675: [ 'Referred' ] ReferredObject . 7676: Position ='After' / 'Before' . 7677: 7678: ReferredObject = VarID / 7679: ElemID [ ExtStruct ] / 7680: 'RefId' / 7681: 'DocumentName' / 1.18 cvs 7682: 'DocumentDir' .</pre> 7683: <p> 7684: The object to be generated can be:</p> 7685: <ul> 7686: <li> 7687: a constant string, specified by its name if it is declared in the schema's 7688: <tt>CONST</tt> section, or given directly as a value between apostrophes; 1.19 cvs 7689: </li> 1.18 cvs 7690: <li> 7691: the contents of a buffer, designated by the name of the buffer; 1.19 cvs 7692: </li> 1.18 cvs 7693: <li> 7694: a variable, designated by its name if it is declared in the translation 7695: schema's <tt>VAR</tt> section, or given directly between parentheses. The 7696: text generated is the value of that variable evaluated for the element to 7697: which the rule applies. 1.19 cvs 7698: </li> 1.18 cvs 7699: <li> 7700: the value of an attribute, if the element being translated has this attribute. 1.21 cvs 7701: The attribute is specified by its name. If it's a text attribute, it can be 7702: preceded by the <code>Translated</code> keyword, which causes the attribute 7703: value to be recoded using the text translation table defined by section 7704: <code><a href="#sectc5225">TEXTTRANSLATE</a></code>; 1.19 cvs 7705: </li> 1.18 cvs 7706: <li> 7707: the value of a specific presentation rule. This object can only be generated 7708: if the translation rule is for a <a href="#prestransl">specific presentation 7709: rule</a>. It is specified by the <tt>Value</tt> keyword; 1.19 cvs 7710: </li> 1.18 cvs 7711: <li> 7712: the element's content. That is, the content of the leaves of the subtree of 7713: the translated element. This is specified by the <tt>Content</tt> keyword; 1.19 cvs 7714: </li> 1.18 cvs 7715: <li> 7716: the comment attached to the element. When the element doesn't have a comment, 7717: nothing is generated. This is indicated by the <tt>Comment</tt> keyword; 1.19 cvs 7718: </li> 1.18 cvs 7719: <li> 7720: the translation of all attributes of the element (which is primarily used to 7721: apply the attribute translation rules <a href="#sectc5222">before</a> those of 7722: the element type). This is specified by the <tt>Attributes</tt> keyword. 1.19 cvs 7723: </li> 1.18 cvs 7724: <li> 7725: the translation of all of the element's specific presentation rules (which is 7726: primarily used to apply the translation rules for the specific presentation 7727: rules <a href="#sectc5222">before</a> those of the element or its attributes). 7728: This option is specified by the <tt>Presentation</tt> keyword; 1.19 cvs 7729: </li> 1.18 cvs 7730: <li> 7731: The value of the reference's identifier.<br> 7732: Thot associates a unique identifier with each element in a document. This 7733: identifier (called <em>reference's identifier</em> or <em>label</em>) is a 7734: character string containing the letter `L' followed by digits. Thot uses it 7735: in references for identifying the referred element.<br> 7736: The <tt>RefId</tt> keyword produces the reference's identifier of the element 7737: to which the translation rule is applied, or the reference's identifier of its 7738: first ancestor that is referred by a reference or that can be referred by a 7739: reference. 1.19 cvs 7740: </li> 1.18 cvs 7741: <li> 7742: the value of a mark pair's unique identifier. This may only be used for <a 7743: href="#sectd3285">mark pairs</a> and is indicated by the <tt>PairId</tt> 1.2 cvs 7744: keyword. 1.19 cvs 7745: </li> 1.18 cvs 7746: <li> 7747: the directory containing the file being generated (this string includes an 7748: ending '/', if it is not empty). This is indicated by the <tt>FileDir</tt> 1.2 cvs 7749: keyword. 1.19 cvs 7750: </li> 1.18 cvs 7751: <li> 7752: the name of the file being generated (only the name, without the directory and 7753: without the extension). This is indicated by the <tt>FileName</tt> keyword. 1.19 cvs 7754: </li> 1.18 cvs 7755: <li> 7756: the extension of the file being generated (this string starts with a dot, if 7757: it is not empty). This is indicated by the <tt>Extension</tt> keyword. 1.19 cvs 7758: </li> 1.18 cvs 7759: <li> 7760: the name of the document being translated. This is indicated by the 7761: <tt>DocumentName</tt> keyword. 1.19 cvs 7762: </li> 1.18 cvs 7763: <li> 7764: the directory containing the document being translated. This is indicated by 7765: the <tt>DocumentDir</tt> keyword. 1.19 cvs 7766: </li> 1.18 cvs 7767: </ul> 7768: <p> 1.1 cvs 7769: When the rule applies to a reference (an element or an attribute defined as a 7770: reference in the structure schema), it can generate a text related to the 1.21 cvs 7771: element referred by that reference. The rule name is then followed by the 1.18 cvs 7772: <tt>Referred</tt> keyword and a specification of the object to be generated 7773: for the referred element. This specification can be:</p> 7774: <ul> 7775: <li> 7776: the name of a variable. The rule generates the value of that variable, 1.1 cvs 7777: computed for the referred element. 1.19 cvs 7778: </li> 1.18 cvs 7779: <li> 7780: an element type. The rule generates the translation of the element of that 7781: type, which is in the subtree of the referred element. If this element is not 7782: defined in the structure schema which corresponds to the translation schema 7783: (that is, an object defined in another schema), the element's type name must 7784: be followed by the name of its structure schema between parentheses. 1.19 cvs 7785: </li> 1.18 cvs 7786: <li> 7787: the <tt>RefId</tt> keyword. The rule generates the reference's identifier of 7788: the referred element. 1.19 cvs 7789: </li> 1.18 cvs 7790: <li> 7791: the <tt>DocumentName</tt> keyword. The rule generates the name of the 1.1 cvs 7792: document to which the referred element belongs. 1.19 cvs 7793: </li> 1.18 cvs 7794: <li> 7795: the <tt>DocumentDir</tt> keyword. The rule generates the name of the 1.1 cvs 7796: directory that contains the document of the referred element. 1.19 cvs 7797: </li> 1.18 cvs 7798: </ul> 7799: </div> 1.1 cvs 7800: 1.18 cvs 7801: <div class="subsection"> 1.1 cvs 7802: 1.18 cvs 7803: <h3><a name="sectc5211">The <tt>Write</tt> rule</a></h3> 7804: <p> 7805: The <tt>Write</tt> has the same syntax as the <tt>Create</tt> rule. It also 1.1 cvs 7806: produces the same effect, but the generated text is displayed on the user's 7807: terminal during the translation of the document, instead of being produced in 7808: the translated document. This is useful for helping the user keep track of 7809: the progress of the translation and for prompting the user on the terminal for 1.18 cvs 7810: input required by the <tt>Read</tt> rule.</p> 7811: <pre> 'Write' Object [ Position ] ';'</pre> 7812: <p> 1.1 cvs 7813: Notice: if the translator is launched by the editor (by the ``Save as'' 1.18 cvs 7814: command), messages produced by the <tt>Write</tt> rule are not displayed.</p> 7815: <blockquote class="example"> 7816: <p> 7817: <strong>Example:</strong></p> 7818: <p> 1.3 cvs 7819: To make the translator display the number of each section being translated on 1.18 cvs 7820: the user's terminal, the following rule is specified for the <tt>Section</tt> 7821: element type:</p> 7822: <pre>Section : BEGIN 1.1 cvs 7823: Write VarSection; 7824: ... 1.18 cvs 7825: END;</pre> 7826: <p> 7827: (see <a href="#varsectexample">above</a> for the definition of the 7828: <tt>VarSection</tt> variable).</p> 7829: <p> 1.1 cvs 7830: To display text on the terminal before issuing a read operation with the 1.18 cvs 7831: <tt>Read</tt> rule, the following rule is used:</p> 7832: <pre>BEGIN 1.1 cvs 7833: Write 'Enter the name of the destination: '; 7834: ... 1.18 cvs 7835: END;</pre> 7836: </blockquote> 7837: </div> 7838: 7839: <div class="subsection"> 7840: 7841: <h3><a name="sectc5212">The <tt>Read</tt> rule</a></h3> 7842: <p> 7843: The <tt>Read</tt> rule reads text from the terminal during the translation of 1.1 cvs 7844: the document and saves the text read in one of the buffers declared in the 1.18 cvs 7845: <tt>BUFFERS</tt> section of the schema. The buffer to be used is indicated by 7846: its name, after the <tt>READ</tt> keyword. This name can be followed, as in 7847: the <tt>Create</tt> and <tt>Write</tt> rules, by a keyword indicating if the 7848: read operation must be performed <tt>Before</tt> or <tt>After</tt> the 1.1 cvs 7849: translation of the element's content. If this keyword is absent, the read 7850: operation is done beforehand. The text is read into the buffer and remains 1.5 cvs 7851: there until a rule using the same buffer - possibly the same rule - is 1.18 cvs 7852: applied.</p> 7853: <pre> 'Read' BufferID [ Position ] ';'</pre> 7854: <blockquote class="example"> 7855: <p> 7856: <strong>Example:</strong></p> 7857: <p> 1.3 cvs 7858: The following set of rules tells the user that the translator is waiting for 7859: the entry of some text, reads this text into a buffer and copies the text into 1.18 cvs 7860: the translated document.</p> 7861: <pre>BEGIN 1.1 cvs 7862: Write 'Enter the name of the destination: '; 7863: Read DestName; 7864: Create DestName; 7865: ... 1.18 cvs 7866: END;</pre> 7867: <p> 7868: (see <a href="#destname">above</a> the definition of <tt>DestName</tt>).</p> 7869: </blockquote> 7870: </div> 7871: 7872: <div class="subsection"> 7873: 7874: <h3><a name="sectc5213">The <tt>Include</tt> rule</a></h3> 7875: <p> 7876: The <tt>Include</tt> rule, like the <tt>Create</tt> rule, is used to produce 1.1 cvs 7877: text in the translated document. It inserts constant text which is not 7878: defined in the translation schema, but is instead taken from a file. The 1.18 cvs 7879: file's name is specified after the <tt>Include</tt> keyword, either directly 1.1 cvs 7880: as a character string between apostrophes or as the name of one of the buffers 1.18 cvs 7881: declared in the <tt>BUFFERS</tt> section of the schema. In the latter case, 1.1 cvs 7882: the buffer is assumed to contain the file's name. This can be used when the 7883: included file's name is known only at the moment of translation. This only 1.18 cvs 7884: requires that the <tt>Include</tt> rule is preceded by a <tt>Read</tt> rule 7885: which puts the name of the file desired by the user into the buffer.</p> 7886: <p> 1.1 cvs 7887: Like the other rules, it is possible to specify whether the inclusion will 7888: occur before or after the element's content, with the default being before. 7889: The file inclusion is only done at the moment of translation, not during the 7890: compilation of the translation schema. Thus, the file to be included need not 7891: exist during the compilation, but it must be accessible at the time of 7892: translation. Its contents can also be modified between two translations, thus 7893: producing different results, even if neither the document or the translation 1.18 cvs 7894: schema are modified.</p> 7895: <p> 1.1 cvs 7896: During translation, the file to be included is searched for along the schema 1.18 cvs 7897: directory path (indicated by the environment variable <tt>THOTSCH</tt>). The 1.1 cvs 7898: file name is normally only composed of a simple name, without specification of 1.12 cvs 7899: a complete file path. However, if the filename starts with a '/', it is 1.18 cvs 7900: considered as an absolute path.</p> 7901: <pre> 'Include' File [ Position ] ';' 1.6 cvs 7902: File = FileName / BufferID . 1.18 cvs 7903: FileName = STRING .</pre> 7904: <blockquote class="example"> 7905: <p> 7906: <strong>Example:</strong></p> 7907: <p> 1.3 cvs 7908: Suppose that it is desirable to print documents of the Article class with a 7909: formatter which requires a number of declarations and definitions at the 1.18 cvs 7910: beginning of the file. The <tt>Include</tt>rule can be used to achieve this. 1.3 cvs 7911: All the declarations and definitions a replaced in a file called 1.18 cvs 7912: <tt>DeclarArt</tt> and then the <tt>Article</tt> element type is given the 7913: following rule:</p> 7914: <pre>Article : BEGIN 1.1 cvs 7915: Include 'DeclarArt' Before; 7916: ... 1.18 cvs 7917: END;</pre> 7918: </blockquote> 7919: </div> 7920: 7921: <div class="subsection"> 7922: 7923: <h3><a name="sectc5214">The <tt>Get</tt> rule</a></h3> 7924: <p> 7925: The <tt>Get</tt> rule is used to change the order in which the elements appear 1.1 cvs 7926: in the translated document. More precisely, it produces the translation of a 7927: specified element before or after the translation of the content of the 1.18 cvs 7928: element to which the rule applies. The <tt>Before</tt> and <tt>After</tt> 1.1 cvs 7929: keywords are placed at the end of the rule to specify whether the operation 7930: should be performed before or after translation of the rule's element (the 7931: default is before). The type of the element to be moved must be specified 1.18 cvs 7932: after the <tt>Get</tt> keyword, optionally preceded by a keyword indicating 7933: where the element will be found in the logical structure of the document:</p> 7934: <dl> 7935: <dt><tt>Included</tt></dt> 7936: <dd> 7937: The element to be moved is the first element of the indicated type which is 1.1 cvs 7938: found inside the element to which the rule applies. 1.18 cvs 7939: </dd> 7940: <dt><tt>Referred</tt></dt> 7941: <dd> 7942: This keyword can only be used if the rule applies to a reference element. The 7943: element to be moved is either the element designated by the reference (if that 7944: element is of the specified type), or the first element of the desired type 7945: contained within the element designated by the reference. 7946: </dd> 7947: <dt>no keyword</dt> 7948: <dd> 7949: If the element to be moved is an associated element, defined in the <a 7950: href="#sectc314"><tt>ASSOC</tt> section</a> of the structure schema, all 1.2 cvs 7951: associated elements of this type which have not been translated yet are then 7952: translated. Certain elements may in fact have already been translated by a 1.18 cvs 7953: <tt>Get Referred</tt> rule. 7954: <p> 1.1 cvs 7955: If the element to be moved is not an associated element, the translator takes 7956: the first element of the indicated type from among the siblings of the rule's 7957: element. This is primarily used to change the order of the components of an 1.18 cvs 7958: aggregate.</p> 7959: </dd> 7960: </dl> 7961: <p> 1.1 cvs 7962: If the element to be moved is defined in a structure schema which is not the 7963: one which corresponds to the translation schema (in the case of an included 7964: object with a different schema), the type name of this element must be 7965: followed, between parentheses, by the name of the structure schema which 1.18 cvs 7966: defines it.</p> 7967: <pre> 'Get' [ RelPosition ] ElemID 1.6 cvs 7968: [ ExtStruct ] 7969: [ Position ] ';' / 7970: RelPosition = 'Included' / 'Referred' . 1.18 cvs 7971: ExtStruct = '(' ElemID ')' .</pre> 7972: <p> 7973: The <tt>Get</tt> rule has no effect if the element which it is supposed to 1.1 cvs 7974: move has already been translated. Thus, the element will not be duplicated. 7975: It is generally best to associate the rule with the first element which will 7976: be encountered by the translator in its traversal of the document. Suppose an 1.18 cvs 7977: aggregate has two elements <tt>A</tt> and <tt>B</tt>, with <tt>A</tt> 1.1 cvs 7978: appearing first in the logical structure. To permute these two elements, a 1.18 cvs 7979: <tt>Get B before</tt> rule should be associated with the <tt>A</tt> element 7980: type, not the inverse. Similarly, a rule of the form <tt>Get Included X 7981: After</tt>, even though syntactically correct, makes no sense since, by the 1.1 cvs 7982: time it will be applied, after the translation of the contents of the element 1.18 cvs 7983: to which it is attached, the <tt>X</tt> element will already have been 7984: translated.</p> 7985: <p> 7986: The <tt>Get</tt> rule is the only way to obtain the translation of the 1.1 cvs 7987: associated elements. In fact, the translator only traverses the primary tree 7988: of the document and thus does not translate the associated elements, except 1.18 cvs 7989: when the translation is explicitly required by a <tt>Get Referred Type</tt> or 7990: <tt>Get Type</tt> rule where <tt>Type</tt> is an associated element type.</p> 7991: <blockquote class="example"> 7992: <p> 7993: <strong>Example:</strong></p> 7994: <p> 1.3 cvs 7995: The structure schema defined figures as associated element which are composed 7996: of some content and a caption. Moreover, it is possible to make references to 1.18 cvs 7997: figures, using elements of the <tt>RefFigure</tt> type:</p> 7998: <pre> ... 1.1 cvs 7999: RefFigure = REFERENCE(Figure); 8000: ASSOC 1.6 cvs 8001: Figure = BEGIN 8002: Content = NATURE; 8003: Caption = Text; 8004: END; 1.18 cvs 8005: ...</pre> 8006: <p> 1.3 cvs 8007: Suppose it would be useful to make a figure appear in the translated document 8008: at the place in the text where the first reference to the figure is made. If 8009: some figures are not referenced, then they would appear at the end of the 8010: document. Also, each figure's caption should appear before the content. The 1.18 cvs 8011: following rules in the translation schema will produce this result:</p> 8012: <pre>Article : BEGIN 1.1 cvs 8013: ... 8014: Get Figures After; 8015: END; 8016: RefFigure : BEGIN 8017: If FirstRef Get Referred Figure; 8018: ... 8019: END; 8020: Content : BEGIN 8021: Get Caption Before; 8022: ... 1.18 cvs 8023: END;</pre> 8024: </blockquote> 8025: </div> 8026: 8027: <div class="subsection"> 8028: 8029: <h3><a name="sectc5215">The <tt>Copy</tt> rule</a></h3> 8030: <p> 8031: Like the <tt>Get</tt> rule, the <tt>Copy</tt> rule generates the translation 1.1 cvs 8032: of a specified element, but it acts even if the element has already been 8033: translated and it allows to copy it or to translate it later. Both rules have 1.18 cvs 8034: the same syntax.</p> 8035: <pre> 'Copy' [ RelPosition ] ElemID 8036: [ ExtStruct ] [ Position ] ';'</pre> 8037: </div> 8038: 8039: <div class="subsection"> 8040: 8041: <h3><a name="sectc5216">The <tt>Use</tt> rule</a></h3> 8042: <p> 8043: The <tt>Use</tt> rule specifies the translation schema to be applied to 1.1 cvs 8044: objects of a certain class that are part of the document. This rule only 8045: appears in the rules for the root element of the document (the first type 1.18 cvs 8046: defined after the <tt>STRUCT</tt> keyword in the structure schema) or the 1.1 cvs 8047: rules of an element defined by an external structure (by another structure 1.18 cvs 8048: schema). Also, the <tt>Use</tt> rule cannot be conditional.</p> 8049: <p> 1.1 cvs 8050: If the rule is applied to an element defined by an external structure, the 1.18 cvs 8051: <tt>Use</tt> keyword is simply followed by the name of the translation schema 1.1 cvs 8052: to be used for element constructed according to that external structure. If 8053: the rule is applied to the document's root element, it is formed by the 1.18 cvs 8054: <tt>Use</tt> keyword followed by the translation schema's name, the 8055: <tt>For</tt> keyword and the name of the external structure to which the 8056: indicated translation schema should be applied.</p> 8057: <pre> 'Use' TrSchema [ 'For' ElemID ] ';' 8058: TrSchema = NAME .</pre> 8059: <p> 8060: If no <tt>Use</tt> rule defines the translation schema to be used for an 1.1 cvs 8061: external structure which appears in a document, the translator asks the user, 8062: during the translation process, which schema should be used. Thus, it is not 1.18 cvs 8063: necessary to give the translation schema a <tt>Use</tt> rule for every 1.1 cvs 8064: external structure used, especially when the choice of translation schemas is 1.18 cvs 8065: to be left to the user.</p> 8066: <p> 1.1 cvs 8067: Notice: if the translator is launched by the editor (by the ``Save as'' 1.18 cvs 8068: command), prompts are not displayed.</p> 8069: <blockquote class="example"> 8070: <p> 8071: <strong>Example:</strong></p> 8072: <p> 8073: The <tt>Article</tt> structure schema uses the <tt>Formula</tt> external 8074: structure, defined by another structure schema, for mathematical formulas:</p> 8075: <pre>STRUCTURE Article; 1.1 cvs 8076: ... 8077: STRUCT 8078: Article = ... 8079: ... 8080: Formula_in_text = Formula; 8081: Isolated_formula = Formula; 8082: ... 1.18 cvs 8083: END</pre> 8084: <p> 8085: Suppose that it would be useful to use the <tt>FormulaT</tt> translation 8086: schema for the formulas of an article. This can be expressed in two different 8087: ways in the <tt>Article</tt> class translation schema, using the rules:</p> 8088: <pre>RULES 1.1 cvs 8089: Article : 1.18 cvs 8090: Use FormulaT for Formula;</pre> 8091: <p> 8092: or:</p> 8093: <pre>RULES 1.1 cvs 8094: ... 8095: Formula : 1.18 cvs 8096: Use FormulaT;</pre> 8097: </blockquote> 8098: </div> 8099: 8100: <div class="subsection"> 8101: 8102: <h3><a name="sectc5217">The <tt>Remove</tt> rule</a></h3> 8103: <p> 8104: The <tt>Remove</tt> rule indicates that nothing should be generated, in the 1.1 cvs 8105: translated document, for the content of the element to which the rule applies. 8106: The content of that element is simply ignored by the translator. This does 8107: not prevent the generation of text for the element itself, using the 1.18 cvs 8108: <tt>Create</tt> or <tt>Include</tt> rules, for example.</p> 8109: <p> 8110: The <tt>Remove</tt> rule is simply written with the <tt>Remove</tt> keyword. 8111: It is terminated, like all rules, by a semicolon.</p> 8112: <pre> 'Remove' ';'</pre> 8113: </div> 8114: 8115: <div class="subsection"> 8116: 8117: <h3><a name="sectc5218">The <tt>NoTranslation</tt> rule</a></h3> 8118: <p> 8119: The <tt>NoTranslation</tt> rule indicates to the translator that it must not 1.1 cvs 8120: translate the content of the leaves of the element to which it applies. In 1.18 cvs 8121: contrast to the <tt>Remove</tt> rule, it does not suppress the content of the 1.1 cvs 8122: element, but it inhibits the translation of character strings, symbols, and 8123: graphical elements contained in the element. These are retrieved so that 1.18 cvs 8124: after the translation of the document, the rules of the <a 8125: href="#sectc5225"><tt>TEXTTRANSLATE</tt>, <tt>SYMBTRANSLATE</tt> and 8126: <tt>GRAPHTRANSLATE</tt> sections</a> will not be applied to them.</p> 8127: <p> 8128: The <tt>NoTranslation</tt> rule is written with the <tt>NoTranslation</tt> 8129: keyword followed by a semicolon.</p> 8130: <pre> 'NoTranslation' ';'</pre> 8131: </div> 8132: 8133: <div class="subsection"> 8134: 8135: <h3><a name="sectc5219">The <tt>NoLineBreak</tt> rule</a></h3> 8136: <p> 8137: The <tt>NoLineBreak</tt> rule indicates to the translator that it must not 1.1 cvs 8138: generate additional line breaks in the output produced for the element to 1.18 cvs 8139: which it applies. This is as if it was an <a href="#sectc522">instruction 8140: <tt>LINELENGTH 0;</tt></a> at the beginning of the translation schema, but 8141: only for the current element.</p> 8142: <p> 8143: The <tt>NoLineBreak</tt> rule is written with the <tt>NoLineBreak</tt> keyword 8144: followed by a semicolon.</p> 8145: <pre> 'NoLineBreak' ';'</pre> 8146: </div> 1.1 cvs 8147: 1.18 cvs 8148: <div class="subsection"> 1.1 cvs 8149: 1.18 cvs 8150: <h3><a name="sectc5220">The <tt>ChangeMainFile</tt> rule</a></h3> 8151: <p> 1.1 cvs 8152: When the translation program starts, it opens a main output file, whose name 1.18 cvs 8153: is given as a parameter of the translator. All <a 8154: href="#sectc5210"><tt>Create</tt> rules</a> without explicit indication of the 8155: output file write sequentially in this file. When a <tt>ChangeMainFile</tt> 8156: rule is executed, the main output file is closed and it is replaced by a new 8157: one, whose name is specified in the <tt>ChangeMainFile</tt> rule. The 8158: <tt>Create</tt> rules without indication of the output file that are then 8159: executed write in this new file. Several <tt>ChangeMainFile</tt> rules can be 8160: executed during the same translation, for dividing the main output into 8161: several files.</p> 8162: <p> 8163: This rule is written with the <tt>ChangeMainFile</tt> keyword followed by the 1.14 cvs 8164: name of a variable that specifies the name of the new main file. The keyword 1.18 cvs 8165: <tt>Before</tt> or <tt>After</tt> can be placed at the end of the rule to 1.1 cvs 8166: specify whether the operation should be performed before or after translation 8167: of the rule's element (the default is before). This rule, like all translation 1.18 cvs 8168: rules, is terminated by a semicolon.</p> 8169: <pre> 'ChangeMainFile' VarID [ Position ] ';'</pre> 8170: <blockquote class="example"> 8171: <p> 8172: <strong>Example:</strong></p> 8173: <p> 1.3 cvs 8174: To generate the translation of each section in a different file, the following 1.18 cvs 8175: rule can be associated with type <tt>Section</tt>. That rule uses the <a 8176: href="#varoutputfile"><tt>VarOutpuFile</tt> variable</a> defined above.</p> 8177: <pre> Section: 8178: ChangeMainFile VarOutpuFile Before;</pre> 8179: <p> 8180: If <tt>output.txt</tt> is the name of the output file specified when starting 1.3 cvs 8181: the translation program, translated sections are written in files 1.18 cvs 8182: <tt>output1.txt</tt>, <tt>output2.txt</tt>, etc.</p> 8183: </blockquote> 8184: </div> 1.1 cvs 8185: 1.18 cvs 8186: <div class="subsection"> 1.14 cvs 8187: 1.18 cvs 8188: <h3><a name="sectc5220a">The <tt>RemoveFile</tt> rule</a></h3> 8189: <p> 1.14 cvs 8190: Files may be used for storing temporary data that are no longer needed when 1.18 cvs 8191: the translation of a document is complete. These files may be removed by the 8192: <tt>RemoveFile</tt> rule.</p> 8193: <p> 8194: This rule is written with the <tt>RemoveFile</tt> keyword followed by the name 8195: of a variable that specifies the name of the file to be removed. The keyword 8196: <tt>Before</tt> or <tt>After</tt> can be placed at the end of the rule to 8197: specify whether the operation should be performed before or after translation 8198: of the rule's element (the default is before). This rule, like all 8199: translation rules, is terminated by a semicolon.</p> 8200: <pre> 'RemoveFile' VarID [ Position ] ';'</pre> 8201: </div> 8202: 8203: <div class="subsection"> 8204: 8205: <h3><a name="sectc5221">The <tt>Set</tt> and <tt>Add</tt> rules</a></h3> 8206: <p> 8207: The <tt>Set</tt> and <tt>Add</tt> rules are used for modifying the value of 8208: counters that have no <a href="#sectc524">counting function</a>. Only this 8209: type of counter can be used in the <tt>Set</tt> and <tt>Add</tt> rules.</p> 8210: <p> 8211: Both rules have the same syntax: after the keyword <tt>Set</tt> or 8212: <tt>Add</tt> appear the counter name and the value to assign to the counter 8213: (<tt>Set</tt> rule) or the value to be added to the counter (<tt>Add</tt> 8214: rule). The keyword <tt>Before</tt> or <tt>After</tt> can follow that value to 1.1 cvs 8215: indicate when the rule must be applied: before or after the element's content 1.18 cvs 8216: is translated. By default, <tt>Before</tt> is assumed. A semicolon terminates 8217: the rule.</p> 8218: <pre> 'Set' CounterID InitValue [ Position ] ';' / 8219: 'Add' CounterID Increment [ Position ] ';'</pre> 8220: </div> 8221: 8222: <div class="subsection"> 8223: 8224: <h3><a name="sectc5221a">The <tt>Indent</tt> rule</a></h3> 8225: <p> 8226: The <tt>Indent</tt> rule is used to modify the value of text indentation in 8227: the output files.</p> 8228: <p> 8229: Each time the translator creates a new line in an output file, it generates a 8230: variable number of space characters at the beginning of the new line. By 1.25 cvs 8231: default, the number of these characters (the indentation value) is 0. It can 8232: be changed with the <tt>Indent</tt> rule.</p> 1.18 cvs 8233: <p> 1.25 cvs 8234: In its simple form, the rule begins with the <tt>Indent</tt> keyword, 8235: followed by the indentation sign (optional) and value and a keyword 8236: <tt>Before</tt> or <tt>After</tt> indicating that the indentation should 8237: be changed <a href="#sectc5222">before or after</a> the element's content 8238: is generated. If the position is not indicated, the indentation is changed 8239: before the element's content is generated. This rule, like all translation 8240: rules, is terminated by a semicolon.</p> 1.18 cvs 8241: <p> 8242: The indentation value is indicated by an integer, which is the number of space 8243: characters to be generated at the beginning of each new line. A sign 8244: (<tt>+</tt> or <tt>-</tt>) can appear before the integer to indicate that the 8245: value is relative: the current value of indentation is incremented (if sign is 8246: <tt>+</tt>) or decremented (if sign is <tt>-</tt>) by the specified value.</p> 8247: <p> 1.25 cvs 8248: Keyword <tt>Suspend</tt> or <tt>Resume</tt> can appear instead of the 8249: (possibly signed) identation value. <tt>Suspend</tt> means that the new 8250: indentation value to be used is zero until another <tt>Indent</tt> rule 8251: is executed and changes the indentation value. <tt>Resume</tt> means that 8252: the indentation value that was used before the last <tt>Indent Suspend</tt> 8253: was executed becomes the new value. Only one <tt>Suspend</tt> can be used 8254: before a <tt>Resume</tt>; <tt>Supend</tt>-<tt>Resume</tt> pairs can not be 8255: nested. 8256: <p> 1.18 cvs 8257: Like the <a href="#sectc5210"><tt>Create</tt> rule</a>, the <tt>Indent</tt> 8258: keyword can be followed by the <tt>IN</tt> keyword and by the name of a <a 8259: href="#sectc526">variable</a>. This means that the rule must not change 1.10 cvs 8260: indentation in the main output file, but in the file whose name is specified 8261: by the variable (by default, indentation is changed in the main output 1.18 cvs 8262: file).</p> 1.25 cvs 8263: <pre> 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' . 1.10 cvs 8264: 1.25 cvs 8265: Indent = 'Suspend' / 'Resume' / [ IndentSign ] IndentValue . 1.10 cvs 8266: IndentSign = '+' / '-' . 1.18 cvs 8267: IndentValue = NUMBER .</pre> 8268: </div> 1.10 cvs 8269: 1.18 cvs 8270: <div class="subsection"> 1.1 cvs 8271: 1.18 cvs 8272: <h3><a name="sectc5222">Rule application order</a></h3> 8273: <p> 1.1 cvs 8274: The translator translates the elements which comprise the document in the 1.18 cvs 8275: order induced by the tree structure, except when the <tt>Get</tt> rule is used 1.1 cvs 8276: to change the order of translation. For each element, the translator first 8277: applies the rules specified for the element's type that must be applied before 1.18 cvs 8278: translation of the element's content (rules ending with the <tt>Before</tt> 1.1 cvs 8279: keyword or which have no position keyword). If several rules meet these 8280: criteria, the translator applies them in the order in where they appear in the 1.18 cvs 8281: translation schema.</p> 8282: <p> 8283: It then applies all <a href="#sectc5223">rules for the attributes</a> which 1.1 cvs 8284: the element has and which must be applied before the translation of the 1.18 cvs 8285: element's content (rules ending with the <tt>Before</tt> keyword or which have 1.1 cvs 8286: no position keyword). For one attribute value, the translator applies the 1.18 cvs 8287: rules in the order in which they are defined in the translation schema.</p> 8288: <p> 1.1 cvs 8289: The same procedure is followed with translation rules for specific 1.18 cvs 8290: presentations.</p> 8291: <p> 8292: Next, the element's content is translated, as long as a <tt>Remove</tt> rule 8293: does not apply.</p> 8294: <p> 1.1 cvs 8295: In the next step, the translator applies rules for the specific presentation 8296: of the element that are to be applied after translation of the content (rules 1.18 cvs 8297: which end with the <tt>After</tt> keyword). The rules for each type of 1.1 cvs 8298: presentation rule or each value are applied in the order in which the 1.18 cvs 8299: translation appear in the schema.</p> 8300: <p> 1.1 cvs 8301: Then, the same procedure is followed for translation rules for attributes of 1.18 cvs 8302: the element.</p> 8303: <p> 1.1 cvs 8304: Finally, the translator applies rules for the element which must be applied 8305: after translation of the element's content. These rules are applied in the 8306: order that they appear in the translation schema. When the translation of an 8307: element is done, the translator procedes to translate the following 1.18 cvs 8308: element.</p> 8309: <p> 8310: This order can be changed with the <tt>Attributes</tt> and 8311: <tt>Presentation</tt> options of the <a href="#sectc5210"><tt>Create</tt> 8312: rule</a>.</p> 8313: </div> 1.1 cvs 8314: 1.18 cvs 8315: <div class="subsection"> 1.1 cvs 8316: 1.18 cvs 8317: <h3><a name="sectc5223">Translation of logical attributes</a></h3> 8318: <p> 1.1 cvs 8319: After the rules for the element types, the translation schema defines rules 1.18 cvs 8320: for attribute values. This section begins with the <tt>ATTRIBUTES</tt> 1.1 cvs 8321: keyword and is composed of a sequence of rule blocks each preceded by an 1.18 cvs 8322: attribute name and an optional value or value range.</p> 8323: <p> 1.1 cvs 8324: If the attribute's name appears alone before the rule block, the rule are 8325: applied to all element which have the attribute, no matter what value the 8326: attribute has. In this case, the attribute name is followed by a colon before 1.18 cvs 8327: the beginning of the rule block.</p> 8328: <p> 1.1 cvs 8329: The attribute's name can be followed by the name of an element type between 8330: parentheses. This says, as in presentation schemas, that the rule block which 8331: follows applies not to the element which has the attribute, but to its 1.18 cvs 8332: descendants of the type indicated between the parentheses.</p> 8333: <p> 1.1 cvs 8334: If values are given after the attribute name (or after the name of the element 8335: type), the rules are applied only when the attribute has the indicated values. 8336: The same attribute can appear several times, with different values and 8337: different translation rules. Attribute values are indicated in the same way 1.18 cvs 8338: as in <a href="#sectc528">conditions</a> and are followed by a colon before 8339: the block of rules.</p> 8340: <p> 1.1 cvs 8341: The rule block associated with an attribute is either a simple rule or a 1.18 cvs 8342: sequence of rules delimited by the <tt>BEGIN</tt> and <tt>END</tt> keywords. 8343: Note that rules associated with attribute values cannot be conditional.</p> 8344: <p> 1.1 cvs 8345: Translation rules are not required for all attributes (or their values) 8346: defined in a structure schema. Only those attributes for which a particular 8347: action must be performed by the translator must have such rules. The rules 1.18 cvs 8348: that can be used are those described above, from <a 8349: href="#sectc5210"><tt>Create</tt></a> to <a 8350: href="#sectc5218"><tt>NoTranslation</tt></a>.</p> 8351: <pre> AttrSeq = TransAttr < TransAttr > . 1.1 cvs 8352: TransAttr = AttrID [ '(' ElemID ')' ] 8353: [ RelatAttr ] ':' RuleSeq . 8354: AttrID = NAME . 1.18 cvs 8355: ElemID = NAME .</pre> 8356: <blockquote class="example"> 8357: <p> 8358: <strong>Example:</strong></p> 8359: <p> 1.3 cvs 8360: The structure defined the ``Language'' attribute which can take the values 8361: ``French'' and ``English''. To have the French parts of the original document 8362: removed and prevent the translation of the leaves of the English parts, the 1.18 cvs 8363: following rules would be used:</p> 8364: <pre>ATTRIBUTES 1.1 cvs 8365: Language=French : 8366: Remove; 8367: Language=English : 1.18 cvs 8368: NoTranslation;</pre> 8369: </blockquote> 8370: </div> 1.1 cvs 8371: 1.18 cvs 8372: <div class="subsection"> 1.1 cvs 8373: 1.18 cvs 8374: <h3><a name="sectc5224">Translation of specific presentations</a></h3> 8375: <p> 1.1 cvs 8376: After the rules for attributes, the translation schema defines rules for the 1.18 cvs 8377: specific presentation. This section begins with the <tt>PRESENTATION</tt> 1.1 cvs 8378: keyword and is composed of a sequence of translation rule blocks each preceded 8379: by a presentation rule name, optionally accompanied by a part which depends on 1.18 cvs 8380: the particular presentation rule.</p> 8381: <p> 1.1 cvs 8382: Each of these translation rule blocks is applied when the translator operates 8383: on an element which has a specific presentation rule of the type indicated at 8384: the head of the block. Depending on the type of the specific presentation 8385: rule, it is possible to specify values of the presentation rule for which the 1.18 cvs 8386: translation rule block should be applied.</p> 8387: <p> 8388: There are three categories of the presentation rules:</p> 8389: <ul> 8390: <li> 8391: rules taking numeric values: <tt>Size</tt>, <tt>Indent</tt>, 8392: <tt>LineSpacing</tt>, <tt>LineWeight</tt>, 1.19 cvs 8393: </li> 1.18 cvs 8394: <li> 8395: rules whose values are taken from a predefined list (i.e. whose type is an 8396: enumeration): <tt>Adjust</tt>, <tt>Justify</tt>, <tt>Hyphenate,/TT>, 1.24 cvs 8397: <tt>Style</tt>, <tt>Weight</tt>, <tt>Font</tt>, <tt>UnderLine</tt>, 8398: <tt>Thickness</tt>, <tt>LineStyle</tt>,</tt> 1.19 cvs 8399: </li> 1.18 cvs 8400: <li> 8401: rules whose value is a name: <tt>FillPattern</tt>, <tt>Background</tt>, 8402: <tt>Foreground</tt>. 1.19 cvs 8403: </li> 1.18 cvs 8404: </ul> 8405: <p> 1.1 cvs 8406: For presentation rules of the first category, the values which provoke 8407: application of the translation rules are indicated in the same manner as for 1.18 cvs 8408: <a href="#relattr">numeric attributes</a>. This can be either a unique value 1.1 cvs 8409: or range of values. For a unique value, the value (an integer) is simply 8410: preceded by an equals sign. Value ranges can be specified in one of three 1.18 cvs 8411: ways:</p> 8412: <ul> 8413: <li> 8414: all values less than a given value (this value is preceded by a ``less than'' 8415: sign '<tt><</tt>'), 1.19 cvs 8416: </li> 1.18 cvs 8417: <li> 8418: all values greater than a given value (this value is preceded by a` `greater 8419: than'' sign '<tt>></tt>'), 1.19 cvs 8420: </li> 1.18 cvs 8421: <li> 8422: all values falling in an interval, bounds included. The range of values is 8423: then specified <tt>IN [</tt>Minimum<tt>..</tt>Maximum<tt>]</tt>, where Minimum 8424: and Maximum are integers. 1.19 cvs 8425: </li> 1.18 cvs 8426: </ul> 8427: <p> 1.2 cvs 8428: All numeric values can be negative, in which case the integer is preceded by a 1.18 cvs 8429: minus sign. All values must be given in typographers points.</p> 8430: <p> 1.1 cvs 8431: For presentation rules whose values are taken from a predefined list, the 8432: value which provokes application of the translation rules is simply indicated 1.18 cvs 8433: by the equals sign followed by the name of the value.</p> 8434: <p> 1.1 cvs 8435: For presentation rules whose values are names, the value which provokes the 8436: application of translation rules is simply indicated by the equals sign 8437: followed by the name of the value. The names of the fill patterns (the 1.18 cvs 8438: <tt>FillPattern</tt> rule) and of the colors (the <tt>Foreground</tt> and 8439: <tt>Background</tt> rules) used in Thot are the same as in the P language.</p> 8440: <pre> PresSeq = PresTrans < PresTrans > . 1.1 cvs 8441: PresTrans = PresRule ':' RuleSeq . 8442: PresRule = 'Size' [ PresRelation ] / 8443: 'Indent' [ PresRelation ] / 8444: 'LineSpacing' [ PresRelation ] / 8445: 'Adjust' [ '=' AdjustVal ] / 8446: 'Justify' [ '=' BoolVal ] / 8447: 'Hyphenate' [ '=' BoolVal ] / 8448: 'Style' [ '=' StyleVal ] / 1.24 cvs 8449: 'Weight' [ '=' WeightVal ] / 1.1 cvs 8450: 'Font' [ '=' FontVal ] / 8451: 'UnderLine' [ '=' UnderLineVal ] / 8452: 'Thickness' [ '=' ThicknessVal ] / 8453: 'LineStyle' [ '=' LineStyleVal ] / 8454: 'LineWeight' [ PresRelation ] / 8455: 'FillPattern' [ '=' Pattern ] / 8456: 'Background' [ '=' Color ] / 8457: 'Foreground' [ '=' Color ] . 8458: 8459: PresRelation = '=' PresValue / 8460: '>' [ '-' ] PresMinimum / 8461: '<' [ '-' ] PresMaximum / 8462: 'IN' '[' [ '-' ] PresIntervalMin '..' 8463: [ '-' ] PresIntervalMax ']' . 8464: AdjustVal = 'Left' / 'Right' / 'VMiddle' / 8465: 'LeftWithDots' . 8466: BoolVal = 'Yes' / 'No' . 1.24 cvs 8467: StyleVal = 'Roman' / 'Italics' / 'Oblique' . 8468: WeightVal = 'Normal' / 'Bold' . 1.1 cvs 8469: FontVal = 'Times' / 'Helvetica' / 'Courier' . 8470: UnderLineVal = 'NoUnderline' / 'UnderLined' / 8471: 'OverLined' / 'CrossedOut' . 8472: ThicknessVal = 'Thick' / 'Thin' . 1.6 cvs 8473: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' . 1.1 cvs 8474: Pattern = NAME . 8475: Color = NAME . 8476: PresMinimum = NUMBER . 8477: PresMaximum = NUMBER . 8478: PresIntervalMin= NUMBER . 8479: PresIntervalMax= NUMBER . 8480: PresValue = [ '-' ] PresVal . 1.18 cvs 8481: PresVal = NUMBER .</pre> 8482: <p> 8483: The <a name="prestransl">translation rules associated with specific 8484: presentation rules</a> can use the value of the specific presentation rule 1.1 cvs 8485: that causes them to be applied. This behavior is designated by the keyword 1.18 cvs 8486: <tt>Value</tt>. For numerically-valued presentation rules, the numeric value 1.1 cvs 8487: is produced. For other presentation rules, the name of the value is 1.18 cvs 8488: produced.</p> 8489: <p> 1.1 cvs 8490: It should be noted that modifications to the layout of the document's elements 8491: that are made using the combination of the control key and a mouse button will 1.18 cvs 8492: have no effect on the translation of the document.</p> 8493: <blockquote class="example"> 8494: <p> 8495: <strong>Example:</strong></p> 8496: <p> 1.3 cvs 8497: Suppose that it is desirable to use the same font sizes as in the specific 1.18 cvs 8498: presentation, but the font size must be between 10 and 18 typographer's 8499: points. If font size is set in the translated document by the string 8500: <tt>pointsize=n</tt> where <tt>n</tt> is the font size in typographer's points 8501: then the following rules will suffice:</p> 8502: <pre>PRESENTATION 1.1 cvs 8503: Size < 10 : 8504: Create 'pointsize=10'; 8505: Size in [10..18] : 8506: BEGIN 8507: Create 'pointsize='; 8508: Create Value; 8509: END; 8510: Size > 18 : 1.18 cvs 8511: Create 'pointsize=18';</pre> 8512: </blockquote> 8513: </div> 1.1 cvs 8514: 1.18 cvs 8515: <div class="subsection"> 1.1 cvs 8516: 1.18 cvs 8517: <h3><a name="sectc5225">Recoding of characters, symbols and graphics</a></h3> 8518: <p> 1.1 cvs 8519: The coding of characters, graphical elements and symbols as defined in Thot 8520: does not necessarily correspond to what is required by an application to which 8521: a Thot document must be exported. Because of this the translator can recode 8522: these terminal elements of the documents structure. The last sections of a 8523: translation schema are intended for this purpose, each specifying the recoding 1.18 cvs 8524: rules for one type of terminal element.</p> 8525: <p> 1.1 cvs 8526: The recoding rules for character strings are grouped by alphabets. There is a 8527: group of rules for each alphabet of the Thot document that must be translated. 1.18 cvs 8528: Each such group of rules begins with the <tt>TEXTTRANSLATE</tt> keyword, 1.1 cvs 8529: followed by the specification of the alphabet to translate and the recoding 1.18 cvs 8530: rules, between the <tt>BEGIN</tt> and <tt>END</tt> keywords unless there is 1.1 cvs 8531: only one recoding rule for the alphabet. The specification of the alphabet is 8532: not required: by default it is assumed to the Latin alphabet (the ISO Latin-1 1.18 cvs 8533: character set).</p> 8534: <p> 1.1 cvs 8535: Each recoding rule is formed by a source string between apostrophes and a 8536: target string, also between apostrophes, the two strings being separated by 1.18 cvs 8537: the arrow symbol (<tt>-></tt>), formed by the ``minus'' and ``greater than'' 8538: characters. The rule is terminated by a semi-colon.</p> 8539: <pre> TextTransSeq = [ Alphabet ] TransSeq . 1.1 cvs 8540: Alphabet = NAME . 8541: TransSeq ='BEGIN' < Translation > 'END' ';' / 8542: Translation . 8543: Translation = Source [ '->' Target ] ';' . 8544: Source = STRING . 1.18 cvs 8545: Target = STRING .</pre> 8546: <p> 1.1 cvs 8547: One such rule signifies that when the source string appears in a text leaf of 8548: the document being translated, the translator must replace it, in the 8549: translated document, with the target string. The source string and the target 8550: string can have different lengths and the target string can be empty. In this 8551: last case, the translator simply suppresses every occurrence of the source 1.18 cvs 8552: string in the translated document.</p> 8553: <p> 1.1 cvs 8554: For a given alphabet, the order of the rules is not important and has no 8555: significance because the T language compiler reorders the rules in ways that 8556: speed up the translator's work. The total number of recoding rules is limited 1.18 cvs 8557: by the compiler as is the maximum length of the source and target strings.</p> 8558: <p> 1.1 cvs 8559: The recoding rules for symbols and graphical elements are written in the same 8560: manner as the recoding rules for character strings. They are preceded, 1.18 cvs 8561: respectively, by the <tt>SYMBTRANSLATE</tt> and <tt>GRAPHTRANSLATE</tt> and so 1.1 cvs 8562: not require a specification of the alphabet. Their source string is limited to 8563: one character, since, in Thot, each symbol and each graphical element is 8564: represented by a single character. The symbol and graphical element codes are 1.18 cvs 8565: defined along with the <a href="#sect7">non-standard character codes</a>.</p> 8566: <blockquote class="example"> 8567: <p> 8568: <strong>Example:</strong></p> 8569: <p> 8570: In a translation schema producing documents destined for use with the 8571: L<sup>A</sup>T<sub><big>E</big></sub>X formatter, the Latin 1.1 cvs 8572: characters``é'' (octal code 351 in Thot) and ``è'' (octal code 1.18 cvs 8573: 350 in Thot) must be converted to their representation in 8574: L<sup>A</sup>T<sub><big>E</big></sub>X:</p> 8575: <pre>TEXTTRANSLATE Latin 1.1 cvs 8576: BEGIN 8577: '\350' -> '\`{e}'; { e grave } 8578: '\351' -> '\''{e}'; { e acute } 1.18 cvs 8579: END;</pre> 8580: </blockquote> 8581: </div> 8582: </div> 8583: <hr> 1.19 cvs 8584: 1.18 cvs 8585: </div> 1.1 cvs 8586: 1.18 cvs 8587: <div class="chapter"> 1.1 cvs 8588: 1.18 cvs 8589: <h1><a name="sect6">Language grammars</a></h1> 8590: <p> 1.1 cvs 8591: This chapter gives the complete grammars of the languages of Thot. The 8592: grammars were presented and described in the preceding chapters, which also 8593: specify the semantics of the languages. This section gives only the 1.18 cvs 8594: syntax.</p> 1.1 cvs 8595: 1.18 cvs 8596: <div class="section"> 1.1 cvs 8597: 1.18 cvs 8598: <h2><a name="sectb61">The M meta-language</a></h2> 8599: <p> 1.1 cvs 8600: The language grammars are all expressed in the same formalism, the M 1.18 cvs 8601: meta-language, which is defined in this section.</p> 8602: <pre>{ Any text between braces is a comment. } 1.1 cvs 8603: Grammar = Rule < Rule > 'END' . 8604: { The < and > signs indicate zero } 8605: { or more repetitions. } 8606: { END marks the end of the grammar. } 8607: Rule = Ident '=' RightPart '.' . 8608: { The period indicates the end of a rule } 8609: RightPart = RtTerminal / RtIntermed . 8610: { The slash indicates a choice } 8611: RtTerminal ='NAME' / 'STRING' / 'NUMBER' . 8612: { Right part of a terminal rule } 8613: RtIntermed = Possibility < '/' Possibility > . 8614: { Right part of an intermediate rule } 8615: Possibility = ElemOpt < ElemOpt > . 8616: ElemOpt = Element / '[' Element < Element > ']' / 8617: '<' Element < Element > '>' . 8618: { Brackets delimit optional parts } 8619: Element = Ident / KeyWord . 8620: Ident = NAME . 8621: { Identifier, sequence of characters 8622: KeyWord = STRING . 8623: { Character string delimited by apostrophes } 1.18 cvs 8624: END</pre> 8625: </div> 1.1 cvs 8626: 1.18 cvs 8627: <div class="section"> 1.1 cvs 8628: 1.18 cvs 8629: <h2><a name="sectb62">The S language</a></h2> 8630: <p> 1.1 cvs 8631: The S language is used to write structure schemas, which contain the generic 8632: logical structures of document and object classes. It is described here in 1.18 cvs 8633: the M meta-language.</p> 8634: <pre>StructSchema = 'STRUCTURE' [ 'EXTENSION' ] ElemID ';' 1.1 cvs 8635: 'DEFPRES' PresID ';' 8636: [ 'ATTR' AttrSeq ] 8637: [ 'PARAM' RulesSeq ] 8638: [ 'STRUCT' RulesSeq ] 8639: [ 'EXTENS' ExtensRuleSeq ] 8640: [ 'ASSOC' RulesSeq ] 8641: [ 'UNITS' RulesSeq ] 8642: [ 'EXPORT' SkeletonSeq ] 8643: [ 'EXCEPT' ExceptSeq ] 8644: 'END' . 8645: 8646: ElemID = NAME . 8647: PresID = NAME . 8648: 8649: AttrSeq = Attribute < Attribute > . 8650: Attribute = AttrID '=' AttrType ';' . 8651: AttrType = 'INTEGER' / 'TEXT' / 8652: 'REFERENCE' '(' RefType ')' / 8653: ValueSeq . 8654: RefType = 'ANY' / 8655: [ FirstSec ] ElemID [ ExtStruct ] . 8656: ValueSeq = AttrVal < ',' AttrVal > . 8657: AttrID = NAME . 8658: FirstSec = 'First' / 'Second' . 8659: ExtStruct = '(' ElemID ')' . 8660: AttrVal = NAME . 8661: 8662: RulesSeq = Rule < Rule > . 8663: Rule = ElemID [ LocAttrSeq ] '=' 8664: DefWithAttr ';' . 8665: LocAttrSeq = '(' 'ATTR' LocalAttr 8666: < ';' LocalAttr > ')' . 8667: LocalAttr = [ '!' ] AttrID [ '=' AttrType ] . 8668: DefWithAttr = Definition 8669: [ '+' '(' ExtensionSeq ')' ] 8670: [ '-' '(' RestrictSeq ')' ] 8671: [ 'WITH' FixedAttrSeq ] . 8672: ExtensionSeq = ExtensionElem < ',' ExtensionElem > . 8673: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' / 8674: 'SYMBOL' / 'PICTURE' . 8675: RestrictSeq = RestrictElem < ',' RestrictElem > . 8676: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' / 8677: 'SYMBOL' / 'PICTURE' . 8678: FixedAttrSeq = FixedAttr < ',' FixedAttr > . 8679: FixedAttr = AttrID [ FixedOrModifVal ] . 8680: FixedOrModifVal= [ '?' ] '=' FixedValue . 8681: FixedValue = [ '-' ] NumValue / TextValue / AttrVal . 8682: NumValue = NUMBER . 8683: TextValue = STRING . 8684: 8685: Definition = BaseType [ LocAttrSeq ] / Constr / 8686: Element . 8687: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 8688: 'PICTURE' / 'UNIT' / 'NATURE' . 8689: Element = ElemID [ ExtOrDef ] . 8690: ExtOrDef = 'EXTERN' / 'INCLUDED' / 8691: [ LocAttrSeq ] '=' Definition . 8692: 8693: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF' 8694: '(' DefWithAttr ')' / 8695: 'BEGIN' DefOptSeq 'END' / 8696: 'AGGREGATE' DefOptSeq 'END' / 8697: 'CASE' 'OF' DefSeq 'END' / 8698: 'REFERENCE' '(' RefType ')' / 8699: 'PAIR' . 8700: 8701: min = Integer / '*' . 8702: max = Integer / '*' . 8703: Integer = NUMBER . 8704: 8705: DefOptSeq = DefOpt ';' < DefOpt ';' > . 8706: DefOpt = [ '?' ] DefWithAttr . 8707: 8708: DefSeq = DefWithAttr ';' < DefWithAttr ';' > . 8709: 8710: SkeletonSeq = SkeletonElem < ',' SkeletonElem > ';' . 8711: SkeletonElem = ElemID [ 'WITH' Contents ] . 8712: Contents = 'Nothing' / ElemID [ ExtStruct ] . 8713: 8714: ExceptSeq = Except ';' < Except ';' > . 8715: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr ':' 8716: ExcValSeq . 8717: ExcTypeOrAttr = ElemID / AttrID . 8718: ExcValSeq = ExcValue < ',' ExcValue > . 8719: ExcValue = 'NoCut' / 'NoCreate' / 8720: 'NoHMove' / 'NoVMove' / 'NoMove' / 8721: 'NoHResize' / 'NoVResize' / 'NoResize' / 1.18 cvs 8722: 'MoveResize' / 1.1 cvs 8723: 'NewWidth' / 'NewHeight' / 8724: 'NewHPos' / 'NewVPos' / 8725: 'Invisible' / 'NoSelect' / 8726: 'Hidden' / 'ActiveRef' / 8727: 'ImportLine' / 'ImportParagraph' / 1.9 cvs 8728: 'NoPaginate' / 'ParagraphBreak' / 8729: 'HighlightChildren' / 'ExtendedSelection' / 8730: 'ReturnCreateNL' . 1.1 cvs 8731: 8732: ExtensRuleSeq = ExtensRule ';' < ExtensRule ';' > . 8733: ExtensRule = RootOrElem [ LocAttrSeq ] 8734: [ '+' '(' ExtensionSeq ')' ] 8735: [ '-' '(' RestrictSeq ')' ] 8736: [ 'WITH' FixedAttrSeq ] . 8737: RootOrElem = 'Root' / ElemID . 8738: 1.18 cvs 8739: END</pre> 8740: </div> 1.1 cvs 8741: 1.18 cvs 8742: <div class="section"> 1.1 cvs 8743: 1.18 cvs 8744: <h2><a name="sectb63">The P language</a></h2> 8745: <p> 1.1 cvs 8746: The P language is used to write presentation schemas, which define the 8747: graphical presentation rules to be applied to different classes of documents 1.18 cvs 8748: and objects. It is described here in the M meta-language.</p> 8749: <pre>PresSchema = 'PRESENTATION' ElemID ';' 1.1 cvs 8750: [ 'VIEWS' ViewSeq ] 8751: [ 'PRINT' PrintViewSeq ] 8752: [ 'COUNTERS' CounterSeq ] 8753: [ 'CONST' ConstSeq ] 8754: [ 'VAR' VarSeq ] 8755: [ 'DEFAULT' ViewRuleSeq ] 8756: [ 'BOXES' BoxSeq ] 8757: [ 'RULES' PresentSeq ] 8758: [ 'ATTRIBUTES' PresAttrSeq ] 8759: [ 'TRANSMIT' TransmitSeq ] 8760: 'END' . 8761: 8762: ElemID = NAME . 8763: 8764: ViewSeq = ViewDeclaration 8765: < ',' ViewDeclaration > ';' . 8766: ViewDeclaration = ViewID [ 'EXPORT' ] . 8767: ViewID = NAME . 8768: 8769: PrintViewSeq = PrintView < ',' PrintView > ';' . 8770: PrintView = ViewID / ElemID . 8771: 8772: CounterSeq = Counter < Counter > . 8773: Counter = CounterID ':' CounterFunc ';' . 8774: CounterID = NAME . 8775: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ] 8776: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] / 8777: SetFunction < SetFunction > 8778: AddFunction < AddFunction > 8779: [ 'INIT' AttrID ] / 1.16 cvs 8780: 'RLEVEL' 'OF' ElemID . 1.1 cvs 8781: SLevelAsc = [ '-' ] LevelAsc . 8782: LevelAsc = NUMBER . 8783: SetFunction = 'SET' CounterValue 'ON' TypeOrPage . 8784: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . 8785: TypeOrPage = 'Page' [ '(' ViewID ')' ] / 1.16 cvs 8786: [ '*' ] ElemID . 1.1 cvs 8787: CounterValue = NUMBER . 8788: 8789: ConstSeq = Const < Const > . 8790: Const = ConstID '=' ConstType ConstValue ';' . 8791: ConstID = NAME . 8792: ConstType = 'Text' [ Alphabet ] / 'Symbol' / 8793: 'Graphics' / 'Picture' . 8794: ConstValue = STRING . 8795: Alphabet = NAME . 8796: 8797: VarSeq = Variable < Variable > . 8798: Variable = VarID ':' FunctionSeq ';' . 8799: VarID = NAME . 8800: FunctionSeq = Function < Function > . 8801: Function = 'DATE' / 'FDATE' / 8802: 'DocName' / 'DirName' / 8803: 'ElemName' / 'AttributeName' / 8804: ConstID / ConstType ConstValue / 8805: AttrID / 8806: 'VALUE' '(' PageAttrCtr ',' 8807: CounterStyle ')' . 8808: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] / 8809: [ MinMax ] CounterID / AttrID . 8810: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' / 8811: 'Uppercase' / 'Lowercase' . 8812: MinMax = 'MaxRangeVal' / 'MinRangeVal' . 8813: 8814: BoxSeq = Box < Box > . 8815: Box = 'FORWARD' BoxID ';' / 8816: BoxID ':' ViewRuleSeq . 8817: BoxID = NAME . 8818: 8819: PresentSeq = Present < Present > . 8820: Present = [ '*' ] [ FirstSec ] ElemID ':' 8821: ViewRuleSeq . 8822: FirstSec = 'First' / 'Second' . 8823: 8824: PresAttrSeq = PresAttr < PresAttr > . 8825: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ] 8826: [ AttrRelation ] ':' ViewRuleSeq . 8827: AttrID = NAME . 8828: AttrRelation = '=' AttrVal / 8829: '>' [ '-' ] MinValue / 8830: '<' [ '-' ] MaxValue / 8831: 'IN' '[' [ '-' ] LowerBound '..' 8832: [ '-' ] UpperBound ']' / 8833: 'GREATER' AttrID / 8834: 'EQUAL' AttrID / 8835: 'LESS' AttrID . 8836: AttrVal = [ '-' ] EqualNum / EqualText / AttrValue . 8837: MinValue = NUMBER . 8838: MaxValue = NUMBER . 8839: LowerBound = NUMBER . 8840: UpperBound = NUMBER. 8841: EqualNum = NUMBER . 8842: EqualText = STRING . 8843: AttrValue = NAME . 8844: 8845: ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules > 8846: 'END' ';' / 8847: ViewRules / CondRules / Rule . 8848: RulesAndCond = CondRules / Rule . 8849: ViewRules = 'IN' ViewID CondRuleSeq . 8850: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' / 8851: CondRules / Rule . 8852: CondRules = CondRule < CondRule > 8853: [ 'Otherwise' RuleSeq ] . 8854: CondRule = 'IF' ConditionSeq RuleSeq . 8855: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / Rule . 8856: 1.6 cvs 8857: ConditionSeq = Condition < 'AND' Condition > . 8858: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem . 8859: ConditionElem = 'First' / 'Last' / 8860: [ 'Immediately' ] 'Within' [ NumParent ] 8861: ElemID [ ExtStruct ] / 8862: ElemID / 8863: 'Referred' / 'FirstRef' / 'LastRef' / 8864: 'ExternalRef' / 'InternalRef' / 'CopyRef' / 8865: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' / 8866: 'UserPage' / 'StartPage' / 'ComputedPage' / 8867: 'Empty' / 8868: '(' [ MinMax ] CounterName CounterCond ')' / 8869: CondPage '(' CounterID ')' . 8870: NumParent = [ GreaterLess ] NParent . 8871: GreaterLess = '>' / '<' . 8872: NParent = NUMBER. 8873: CounterCond = '<' MaxCtrVal / '>' MinCtrVal / 8874: '=' EqCtrVal / 8875: 'IN' '[' ['-'] MinCtrBound '..' 8876: ['-'] MaxCtrBound ']' . 8877: PageCond = 'Even' / 'Odd' / 'One' . 8878: MaxCtrVal = NUMBER . 8879: MinCtrVal = NUMBER . 8880: EqCtrVal = NUMBER . 8881: MaxCtrBound = NUMBER . 8882: MinCtrBound = NUMBER . 1.1 cvs 8883: 8884: Rule = PresParam ';' / PresFunc ';' . 8885: PresParam = 'VertRef' ':' HorizPosition / 8886: 'HorizRef' ':' VertPosition / 8887: 'VertPos' ':' VPos / 8888: 'HorizPos' ':' HPos / 8889: 'Height' ':' Extent / 8890: 'Width' ':' Extent / 8891: 'VertOverflow' ':' Boolean / 8892: 'HorizOverflow' ':' Boolean / 1.26 cvs 8893: 'MarginTop' ':' MarginWidth / 8894: 'MarginRight' ':' MarginWidth / 8895: 'MarginBottom' ':' MarginWidth / 8896: 'MarginLeft' ':' MarginWidth / 8897: 'PaddingTop' ':' PaddingWidth / 8898: 'PaddingRight' ':' PaddingWidth / 8899: 'PaddingBottom' ':' PaddingWidth / 8900: 'PaddingLeft' ':' PaddingWidth / 8901: 'BorderTopWidth' ':' BorderWidth / 8902: 'BorderRightWidth' ':' BorderWidth / 8903: 'BorderBottomWidth' ':' BorderWidth / 8904: 'BorderLeftWidth' ':' BorderWidth / 8905: 'BorderTopColor' ':' BorderColor / 8906: 'BorderRightColor' ':' BorderColor / 8907: 'BorderBottomColor' ':' BorderColor / 8908: 'BorderLeftColor' ':' BorderColor / 8909: 'BorderTopStyle' ':' BorderStyle / 8910: 'BorderRightStyle' ':' BorderStyle / 8911: 'BorderBottomStyle' ':' BorderStyle / 8912: 'BorderLeftStyle' ':' BorderStyle . 1.1 cvs 8913: 'LineSpacing' ':' DistOrInherit / 8914: 'Indent' ':' DistOrInherit / 8915: 'Adjust' ':' AlignOrInherit / 8916: 'Justify' ':' BoolInherit / 8917: 'Hyphenate' ':' BoolInherit / 8918: 'PageBreak' ':' Boolean / 8919: 'LineBreak' ':' Boolean / 8920: 'InLine' ':' Boolean / 8921: 'NoBreak1' ':' AbsDist / 8922: 'NoBreak2' ':' AbsDist / 8923: 'Gather' ':' Boolean / 8924: 'Visibility' ':' NumberInherit / 8925: 'Size' ':' SizeInherit / 8926: 'Font' ':' NameInherit / 8927: 'Style' ':' StyleInherit / 1.23 cvs 8928: 'Weight' ':' WeightInherit / 1.1 cvs 8929: 'Underline' ':' UnderLineInherit / 8930: 'Thickness' ':' ThicknessInherit / 8931: 'Depth' ':' NumberInherit / 8932: 'LineStyle' ':' LineStyleInherit / 8933: 'LineWeight' ':' DistOrInherit / 8934: 'FillPattern' ':' NameInherit / 8935: 'Background' ':' NameInherit / 1.13 cvs 8936: 'Foreground' ':' NameInherit / 1.1 cvs 8937: 'Content' ':' VarConst . 8938: PresFunc = Creation '(' BoxID ')' / 8939: 'Line' / 8940: 'NoLine' / 8941: 'Page' '(' BoxID ')' / 1.13 cvs 8942: 'Copy' '(' BoxTypeToCopy ')' / 8943: 'ShowBox' / 1.18 cvs 8944: 'BackgroundPicture' ':' FileName / 8945: 'PictureMode' ':' PictMode . 1.1 cvs 8946: 8947: BoxTypeToCopy = BoxID [ ExtStruct ] / 8948: ElemID [ ExtStruct ] . 8949: ExtStruct = '(' ElemID ')' . 8950: 8951: Distance = [ Sign ] AbsDist . 8952: Sign = '+' / '-' . 8953: AbsDist = IntegerOrAttr [ '.' DecimalPart ] 8954: [ Unit ] . 8955: IntegerOrAttr = IntegerPart / AttrID . 8956: IntegerPart = NUMBER . 8957: DecimalPart = NUMBER . 8958: Unit = 'em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' / 8959: 'pc' / 'px' / '%' . 8960: 8961: HPos = 'nil' / VertAxis '=' HorizPosition 8962: [ 'UserSpecified' ] . 8963: VPos = 'nil' / HorizAxis '=' VertPosition 8964: [ 'UserSpecified' ] . 8965: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' . 8966: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' . 8967: 1.6 cvs 8968: VertPosition = Reference '.' HorizAxis [ Distance ] . 8969: HorizPosition = Reference '.' VertAxis [ Distance ] . 8970: Reference = 'Enclosing' [ BoxTypeNot ] / 8971: 'Enclosed' [ BoxTypeNot ] / 8972: 'Previous' [ BoxTypeNot ] / 8973: 'Next' [ BoxTypeNot ] / 8974: 'Referred' [ BoxTypeNot ] / 8975: 'Creator' / 8976: 'Root' / 8977: '*' / 8978: BoxOrType . 8979: BoxOrType = BoxID / 8980: [ '*' ] [ FirstSec ] ElemID / 1.17 cvs 8981: 'AnyElem' / 'AnyBox' / 8982: 'ElemWithAttr' AttrID . 1.6 cvs 8983: BoxTypeNot = [ 'NOT' ] BoxOrType . 8984: 8985: Extent = Reference '.' HeightWidth 8986: [ Relation ] [ 'Min' ] / 8987: AbsDist [ 'UserSpecified' ] [ 'Min' ] / 8988: HPos / VPos . 8989: HeightWidth = 'Height' / 'Width' . 8990: Relation = '*' ExtentAttr '%' / Distance . 8991: ExtentAttr = ExtentVal / AttrID . 8992: ExtentVal = NUMBER . 1.26 cvs 8993: 8994: MarginWidth = InheritParent / 'Auto' / Distance . 8995: PaddingWidth = InheritParent / Distance . 8996: BorderWidth = InheritParent / 'Thin' / 'Medium' / 'Thick' / Distance . 8997: BorderColor = InheritParent / 'Transparent' / 'Foreground' / 8998: ColorName . 8999: BorderStyle = InheritParent / 9000: 'None' / 'Hidden' / 'Dotted' / 'Dashed' / 'Solid' / 9001: 'Double' / 'Groove' / 'Ridge' / 'Inset' / 'Outset' . 1.27 cvs 9002: InheritParent = 'Enclosing' '=' / 'Creator' '=' . 1.26 cvs 9003: ColorName = NAME . 1.6 cvs 9004: 9005: Inheritance = Kinship InheritedValue . 9006: Kinship = 'Enclosing' / 'GrandFather'/ 'Enclosed' / 9007: 'Previous' / 'Creator' . 9008: InheritedValue = '+' PosIntAttr [ 'Max' maximumA ] / 9009: '-' NegIntAttr [ 'Min' minimumA ] / 9010: '=' . 9011: PosIntAttr = PosInt / AttrID . 9012: PosInt = NUMBER . 9013: NegIntAttr = NegInt / AttrID . 9014: NegInt = NUMBER . 9015: maximumA = maximum / AttrID . 9016: maximum = NUMBER . 9017: minimumA = minimum / AttrID . 9018: minimum = NUMBER . 9019: 9020: AlignOrInherit = Kinship '=' / Alignment . 9021: Alignment = 'Left' / 'Right' / 'VMiddle' / 9022: 'LeftWithDots' . 1.1 cvs 9023: 1.6 cvs 9024: DistOrInherit = Kinship InheritedDist / Distance . 9025: InheritedDist = '=' / '+' AbsDist / '-' AbsDist . 1.1 cvs 9026: 1.6 cvs 9027: BoolInherit = Boolean / Kinship '=' . 9028: Boolean = 'Yes' / 'No' . 1.1 cvs 9029: 1.6 cvs 9030: NumberInherit = Integer / AttrID / Inheritance . 9031: Integer = NUMBER . 1.1 cvs 9032: 9033: LineStyleInherit= Kinship '=' / 'Solid' / 'Dashed' / 9034: 'Dotted' . 9035: 1.6 cvs 9036: SizeInherit = SizeAttr [ 'pt' ] / Kinship InheritedSize . 9037: InheritedSize = '+' SizeAttr [ 'pt' ] 9038: [ 'Max' MaxSizeAttr ] / 9039: '-' SizeAttr [ 'pt' ] 9040: [ 'Min' MinSizeAttr ] / 1.22 cvs 9041: '*' PercentSizeAttr '%' / 1.6 cvs 9042: '=' . 9043: SizeAttr = Size / AttrID . 9044: Size = NUMBER . 9045: MaxSizeAttr = MaxSize / AttrID . 9046: MaxSize = NUMBER . 9047: MinSizeAttr = MinSize / AttrID . 9048: MinSize = NUMBER . 1.22 cvs 9049: PercentSizeAttr = PercentSize / AttrID . 9050: PercentSize = NUMBER . 1.6 cvs 9051: 9052: NameInherit = Kinship '=' / FontName . 9053: FontName = NAME . 9054: StyleInherit = Kinship '=' / 1.23 cvs 9055: 'Roman' / 'Italics' / 'Oblique' . 9056: WeightInherit = Kinship '=' / 9057: 'Normal' / 'Bold' . 1.1 cvs 9058: UnderLineInherit= Kinship '=' / 1.6 cvs 9059: 'NoUnderline' / 'Underlined' / 9060: 'Overlined' / 'CrossedOut' . 1.1 cvs 9061: ThicknessInherit= Kinship '=' / 'Thick' / 'Thin' . 1.13 cvs 9062: 9063: FileName = STRING . 9064: PictMode = 'NormalSize' / 'Scale' / 9065: 'RepeatXY' / 'RepeatX' / 'RepeatY' . 1.1 cvs 9066: 1.6 cvs 9067: VarConst = ConstID / ConstType ConstValue / 9068: VarID / '(' FunctionSeq ')' / 9069: ElemID . 9070: 9071: Creation = Create [ 'Repeated' ] . 9072: Create = 'CreateFirst' / 'CreateLast' / 9073: 'CreateBefore' / 'CreateAfter' / 9074: 'CreateEnclosing' . 9075: 9076: TransmitSeq = Transmit < Transmit > . 9077: Transmit = TypeOrCounter 'To' ExternAttr 9078: '(' ElemID ')' ';' . 9079: TypeOrCounter = CounterID / ElemID . 9080: ExternAttr = NAME . 1.1 cvs 9081: 1.18 cvs 9082: END</pre> 9083: </div> 1.1 cvs 9084: 1.18 cvs 9085: <div class="section"> 1.1 cvs 9086: 1.18 cvs 9087: <h2><a name="sectb64">The T language</a></h2> 9088: <pre>TransSchema = 'TRANSLATION' ElemID ';' 1.1 cvs 9089: [ 'LINELENGTH' LineLength ';' ] 9090: [ 'LINEEND' CHARACTER ';' ] 9091: [ 'LINEENDINSERT' STRING ';' ] 9092: [ 'BUFFERS' BufferSeq ] 9093: [ 'COUNTERS' CounterSeq ] 9094: [ 'CONST' ConstSeq ] 9095: [ 'VAR' VariableSeq ] 9096: 'RULES' ElemSeq 9097: [ 'ATTRIBUTES' AttrSeq ] 9098: [ 'PRESENTATION' PresSeq ] 9099: < 'TEXTTRANSLATE' TextTransSeq > 9100: [ 'SYMBTRANSLATE' TransSeq ] 9101: [ 'GRAPHTRANSLATE' TransSeq ] 9102: 'END' . 9103: 9104: LineLength = NUMBER . 9105: 9106: BufferSeq = Buffer < Buffer > . 9107: Buffer = BufferID [ '(' 'Picture' ')' ] ';' . 9108: BufferID = NAME . 9109: 9110: CounterSeq = Counter < Counter > . 9111: Counter = CounterID [ ':' CounterFunc ] ';' . 9112: CounterID = NAME . 9113: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ] 9114: [ 'Init' AttrID ] / 9115: 'Rlevel' 'of' ElemID / 9116: 'Set' InitValue 'On' ElemID 9117: 'Add' Increment 'On' ElemID 9118: [ 'Init' AttrID ] . 9119: SLevelAsc = [ '-' ] LevelAsc . 9120: LevelAsc = NUMBER . 9121: InitValue = NUMBER . 9122: Increment = NUMBER . 9123: ElemID = NAME . 9124: AttrID = NAME . 9125: 9126: ConstSeq = Const < Const > . 9127: Const = ConstID '=' ConstValue ';' . 9128: ConstID = NAME . 9129: ConstValue = STRING . 9130: 9131: VariableSeq = Variable < Variable > . 9132: Variable = VarID ':' Function < Function > ';' . 9133: VarID = NAME . 9134: Function = 'Value' '(' CounterID [ ':' Length ] 9135: [ ',' CounterStyle ] ')' / 9136: 'FileDir' / 'FileName' / 'Extension' / 9137: 'DocumentName' / 'DocumentDir' / 9138: ConstID / CharString / 9139: BufferID / AttrID . 9140: Length = NUMBER . 9141: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' / 9142: 'Uppercase' / 'Lowercase' . 9143: CharString = STRING . 9144: 9145: ElemSeq = TransType < TransType > . 9146: TransType = [ FirstSec ] ElemID ':' RuleSeq . 9147: FirstSec = 'First' / 'Second' . 9148: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' . 9149: Rule = SimpleRule / ConditionBlock . 9150: ConditionBlock= 'IF' ConditionSeq SimpleRuleSeq . 9151: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' / 9152: SimpleRule . 9153: 9154: ConditionSeq = Condition [ 'AND' Condition ] . 9155: Condition = [ 'NOT' ] [ 'Target' ] Cond . 9156: Cond = CondElem / CondAscend . 9157: CondElem = 'FirstRef' / 'LastRef' / 9158: 'ExternalRef' / 9159: 'Defined' / 9160: 'Alphabet' '=' Alphabet / 9161: 'ComputedPage' / 'StartPage' / 9162: 'UserPage' / 'ReminderPage' / 9163: 'Empty' / 1.18 cvs 9164: ElemID / 1.1 cvs 9165: 'FirstAttr' / 'LastAttr' . 9166: CondAscend = [ Ascend ] CondOnAscend . 9167: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType . 9168: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] . 9169: CondRelLevel = NUMBER . 9170: CondOnAscend = 'First' / 'Last' / 9171: 'Referred' / 9172: [ 'Immediately' ] 'Within' [ NumParent ] 9173: ElemID [ ExtStruct ] / 9174: 'Attributes' / 9175: AttrID [ RelatAttr ] / 9176: 'Presentation' / 9177: PresRule / 9178: 'Comment' . 9179: NumParent = [ GreaterLess ] NParent . 9180: GreaterLess = '>' / '<' . 9181: NParent = NUMBER. 9182: Alphabet = NAME . 9183: RelatAttr = '=' Value / 9184: '>' [ '-' ] Minimum / 9185: '<' [ '-' ] Maximum / 9186: 'IN' '[' [ '-' ] MinInterval '..' 9187: [ '-' ] MaxInterval ']' . 9188: Value = [ '-' ] IntegerVal / TextVal / AttrValue . 9189: Minimum = NUMBER . 9190: Maximum = NUMBER . 9191: MinInterval = NUMBER . 9192: MaxInterval = NUMBER . 9193: IntegerVal = NUMBER . 9194: TextVal = STRING . 9195: AttrValue = NAME . 9196: 9197: SimpleRule = 'Create' [ 'IN' VarID ] Object 9198: [ Position ] ';' / 9199: 'Write' Object [ Position ] ';' / 9200: 'Read' BufferID [ Position ] ';' / 9201: 'Include' File [ Position ] ';' / 1.6 cvs 9202: 'Get' [ RelPosition ] ElemID 9203: [ ExtStruct ] 9204: [ Position ] ';' / 1.1 cvs 9205: 'Copy' [ RelPosition ] ElemID 9206: [ ExtStruct ] 9207: [ Position ] ';' / 9208: 'Use' TrSchema [ 'For' ElemID ] ';' / 9209: 'Remove' ';' / 9210: 'NoTranslation' ';' / 9211: 'NoLineBreak' ';' / 9212: 'ChangeMainFile' VarID [ Position ] ';' / 1.14 cvs 9213: 'RemoveFile' VarID [ Position ] ';' / 1.10 cvs 9214: 'Set' CounterID InitValue [ Position ] ';' / 9215: 'Add' CounterID Increment [ Position ] ';' / 1.25 cvs 9216: 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' . 1.10 cvs 9217: 1.25 cvs 9218: Indent = 'Suspend' / 'Resume' / [ IndentSign ] IndentValue . 1.10 cvs 9219: IndentSign = '+' / '-' . 9220: IndentValue = NUMBER . 1.1 cvs 9221: 9222: Object = ConstID / CharString / 9223: BufferID / 9224: VarID / 9225: '(' Function < Function > ')' / 1.21 cvs 9226: [ 'Translated' ] AttrID / 1.1 cvs 9227: 'Value' / 9228: 'Content' / 9229: 'Comment' / 9230: 'Attributes' / 9231: 'Presentation' / 9232: 'RefId' / 9233: 'PairId' / 9234: 'FileDir' / 'FileName' / 'Extension' / 9235: 'DocumentName' / 'DocumentDir' / 9236: [ 'Referred' ] ReferredObject . 9237: Position = 'After' / 'Before' . 9238: 1.6 cvs 9239: ReferredObject= VarID / 9240: ElemID [ ExtStruct ] / 9241: 'RefId' / 9242: 'DocumentName' / 'DocumentDir' . 1.1 cvs 9243: 1.6 cvs 9244: File = FileName / BufferID . 9245: FileName = STRING . 1.1 cvs 9246: 1.6 cvs 9247: RelPosition = 'Included' / 'Referred' . 9248: ExtStruct = '(' ElemID ')' . 1.1 cvs 9249: 1.6 cvs 9250: TrSchema = NAME . 9251: 9252: AttrSeq = TransAttr < TransAttr > . 9253: TransAttr = AttrID [ '(' ElemID ')' ] 9254: [ RelatAttr ] ':' RuleSeq . 9255: 9256: PresSeq = PresTrans < PresTrans > . 9257: PresTrans = PresRule ':' RuleSeq . 9258: PresRule = 'Size' [ PresRelation ] / 9259: 'Indent' [ PresRelation ] / 9260: 'LineSpacing' [ PresRelation ] / 9261: 'Adjust' [ '=' AdjustVal ] / 9262: 'Justify' [ '=' BoolVal ] / 9263: 'Hyphenate' [ '=' BoolVal ] / 9264: 'Style' [ '=' StyleVal ] / 1.24 cvs 9265: 'Weight' [ '=' WeightVal ] / 1.6 cvs 9266: 'Font' [ '=' FontVal ] / 9267: 'UnderLine' [ '=' UnderLineVal ] / 9268: 'Thickness' [ '=' ThicknessVal ] / 9269: 'LineStyle' [ '=' LineStyleVal ] / 9270: 'LineWeight' [ PresRelation ] / 9271: 'FillPattern' [ '=' Pattern ] / 9272: 'Background' [ '=' Color ] / 9273: 'Foreground' [ '=' Color ] . 9274: 9275: PresRelation = '=' PresValue / 9276: '>' [ '-' ] PresMinimum / 9277: '<' [ '-' ] PresMaximum / 9278: 'IN' '[' [ '-' ] PresIntervalMin '..' 9279: [ '-' ] PresIntervalMax ']' . 9280: AdjustVal = 'Left' / 'Right' / 'VMiddle' / 9281: 'LeftWithDots' . 9282: BoolVal = 'Yes' / 'No' . 1.24 cvs 9283: StyleVal = 'Roman' / 'Italics' / 'Oblique' . 9284: WeightVal = 'Normal' / 'Bold' . 1.6 cvs 9285: FontVal = 'Times' / 'Helvetica' / 'Courier' . 9286: UnderLineVal = 'NoUnderline' / 'UnderLined' / 9287: 'OverLined' / 'CrossedOut' . 9288: ThicknessVal = 'Thick' / 'Thin' . 9289: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' . 9290: Pattern = NAME . 9291: Color = NAME . 9292: PresMinimum = NUMBER . 9293: PresMaximum = NUMBER . 1.1 cvs 9294: PresIntervalMin= NUMBER . 9295: PresIntervalMax= NUMBER . 1.6 cvs 9296: PresValue = [ '-' ] PresVal . 9297: PresVal = NUMBER . 1.1 cvs 9298: 1.6 cvs 9299: TextTransSeq = [ Alphabet ] TransSeq . 9300: Alphabet = NAME . 9301: TransSeq = 'BEGIN' < Translation > 'END' ';' / 9302: Translation . 9303: Translation = Source [ '->' Target ] ';' . 9304: Source = STRING . 1.18 cvs 9305: Target = STRING .</pre> 9306: </div> 9307: <hr> 1.19 cvs 9308: 1.18 cvs 9309: </div> 1.1 cvs 9310: 1.18 cvs 9311: <div class="chapter"> 1.1 cvs 9312: 1.18 cvs 9313: <h1><a name="sect7">Character coding</a></h1> 1.1 cvs 9314: 1.18 cvs 9315: <div class="section"> 1.1 cvs 9316: 1.18 cvs 9317: <h2><a name="sectb71">Characters</a></h2> 9318: <p> 1.1 cvs 9319: The characters of the Latin alphabet follow the encoding defined in the ISO 1.5 cvs 9320: 8859-1 (ISO Latin-1) standard. The characters of the Greek alphabet follow 1.18 cvs 9321: the encoding defined by Adobe for its Symbol font (Adobe FontSpecific).</p> 9322: <p> 1.1 cvs 9323: Characters whose octal code is greater than 0200 are written in the form of 9324: their octal code preceded by a backslash character (``\''). For example, the 1.18 cvs 9325: French word 'Résumé' is written <tt>R\351sum\351</tt>.</p> 9326: <p> 1.2 cvs 9327: To the ISO 8859-1 encoding four characters with the following codes have been 1.18 cvs 9328: added:<br> 9329: <tt>212</tt>: line break<br> 9330: <tt>240</tt>: sticky space<br> 9331: <tt>201</tt>: thin space<br> 9332: <tt>202</tt>: en space</p> 9333: <p> 9334: The <tt>212</tt> character is a ``line break'' character which forces a line 9335: break. The <tt>240</tt> character is a ``sticky space'', which cannot be 9336: replaced by a line break.</p> 9337: </div> 1.1 cvs 9338: 1.18 cvs 9339: <div class="section"> 1.1 cvs 9340: 1.18 cvs 9341: <h2><a name="sectb72">Symbols</a></h2> 9342: <p> 1.1 cvs 9343: The table below gives the codes for the symbols of Thot. Symbols can be used 9344: in presentation schemas constants and in transcoding rules of translation 1.18 cvs 9345: schemas. Each symbol is represented by a single character.</p> 9346: <ul> 9347: <li> 9348: <tt>r</tt>: a radical 1.19 cvs 9349: </li> 1.18 cvs 9350: <li> 9351: <tt>i</tt>: a simple integral 1.19 cvs 9352: </li> 1.18 cvs 9353: <li> 9354: <tt>c</tt>: a curvilinear integral 1.19 cvs 9355: </li> 1.18 cvs 9356: <li> 9357: <tt>d</tt>: a double integral 1.19 cvs 9358: </li> 1.18 cvs 9359: <li> 9360: <tt>t</tt>: a triple integral 1.19 cvs 9361: </li> 1.18 cvs 9362: <li> 9363: <tt>S</tt>: the summation symbol 1.19 cvs 9364: </li> 1.18 cvs 9365: <li> 9366: <tt>P</tt>: the product symbol 1.19 cvs 9367: </li> 1.18 cvs 9368: <li> 9369: <tt>U</tt>: the union symbol 1.19 cvs 9370: </li> 1.18 cvs 9371: <li> 9372: <tt>I</tt>: the intersection symbol 1.19 cvs 9373: </li> 1.18 cvs 9374: <li> 9375: <tt>></tt>: a right arrow 1.19 cvs 9376: </li> 1.18 cvs 9377: <li> 9378: <tt><</tt>: a left arrow 1.19 cvs 9379: </li> 1.18 cvs 9380: <li> 9381: <tt>^</tt>: an up arrow 1.19 cvs 9382: </li> 1.18 cvs 9383: <li> 9384: <tt>V</tt>: a down arrow 1.19 cvs 9385: </li> 1.18 cvs 9386: <li> 9387: <tt>(</tt>: an opening parenthesis 1.19 cvs 9388: </li> 1.18 cvs 9389: <li> 9390: <tt>)</tt>: a closing parenthesis 1.19 cvs 9391: </li> 1.18 cvs 9392: <li> 9393: <tt>{</tt>: an opening brace 1.19 cvs 9394: </li> 1.18 cvs 9395: <li> 9396: <tt>}</tt>: a closing brace 1.19 cvs 9397: </li> 1.18 cvs 9398: <li> 9399: <tt>[</tt>: an opening bracket 1.19 cvs 9400: </li> 1.18 cvs 9401: <li> 9402: <tt>]</tt>: a closing bracket 1.19 cvs 9403: </li> 1.18 cvs 9404: </ul> 9405: </div> 1.1 cvs 9406: 1.18 cvs 9407: <div class="section"> 1.1 cvs 9408: 1.18 cvs 9409: <h2><a name="sectb73">Graphical elements</a></h2> 9410: <p> 1.1 cvs 9411: The table below gives the codes for the graphical elements of Thot. These 9412: elements can be used in presentation schemas constants and in transcoding 9413: rules of translation schemas. Each graphical element is represented by a 1.18 cvs 9414: single character.</p> 9415: <ul> 9416: <li> 9417: a: a circle 1.19 cvs 9418: </li> 1.18 cvs 9419: <li><p> 9420: <tt>A</tt>: an open curve with an arrow head at the end</p> 1.19 cvs 9421: </li> 1.18 cvs 9422: <li> 9423: <tt>b</tt>: a horizontal line along the lower side of the box 1.19 cvs 9424: </li> 1.18 cvs 9425: <li> 9426: <tt>B</tt>: an open curve 1.19 cvs 9427: </li> 1.18 cvs 9428: <li> 9429: <tt>c</tt>: an ellipse inscribed in the box 1.19 cvs 9430: </li> 1.18 cvs 9431: <li> 9432: <tt>C</tt>: a rectangle with rounded corners 1.19 cvs 9433: </li> 1.18 cvs 9434: <li> 9435: <tt>D</tt>: an open curve with two arrow heads 1.19 cvs 9436: </li> 1.18 cvs 9437: <li> 9438: <tt>e</tt>: The northwest/southeast diagonal of the box with an arrowhead at 9439: the bottom 1.19 cvs 9440: </li> 1.18 cvs 9441: <li> 9442: <tt>E</tt>: The southwest/northeast diagonal of the box with an arrowhead at 9443: the top 1.19 cvs 9444: </li> 1.18 cvs 9445: <li> 9446: <tt>F</tt>: an open curve with an arrow head at start 1.28 ! cvs 9447: </li> ! 9448: <li> ! 9449: <tt>g</tt>: a line from the origin of the box to its opposite corner 1.19 cvs 9450: </li> 1.18 cvs 9451: <li> 9452: <tt>h</tt>: a horizontal line as wide as the box and placed in its middle 1.19 cvs 9453: </li> 1.18 cvs 9454: <li> 9455: <tt>l</tt>: a vertical line on the left side of the box 1.19 cvs 9456: </li> 1.18 cvs 9457: <li> 9458: <tt>L</tt>: a lozenge 1.19 cvs 9459: </li> 1.18 cvs 9460: <li> 9461: <tt>M</tt>: an open broken line with two arrow heads 1.19 cvs 9462: </li> 1.18 cvs 9463: <li> 9464: <tt>N</tt>: an open broken line with an arrow head at start 1.19 cvs 9465: </li> 1.18 cvs 9466: <li> 9467: <tt>o</tt>: The southwest/northeast diagonal of the box with an arrowhead at 9468: the bottom 1.19 cvs 9469: </li> 1.18 cvs 9470: <li> 9471: <tt>O</tt>: The northwest/southeast diagonal of the box with an arrowhead at 9472: the top 1.19 cvs 9473: </li> 1.18 cvs 9474: <li> 9475: <tt>p</tt>: a polygon 1.19 cvs 9476: </li> 1.18 cvs 9477: <li> 9478: <tt>P</tt>: a rectangle with round corners and a horizontal bar at the top 1.19 cvs 9479: </li> 1.18 cvs 9480: <li> 9481: <tt>Q</tt>: an ellipse with a horizontal bar at the top 1.19 cvs 9482: </li> 1.18 cvs 9483: <li> 9484: <tt>r</tt>: a vertical line on the right side of the box 1.19 cvs 9485: </li> 1.18 cvs 9486: <li> 9487: <tt>R</tt>: a rectangle which is the shape of the box 1.19 cvs 9488: </li> 1.18 cvs 9489: <li> 9490: <tt>s</tt>: a closed curve 1.19 cvs 9491: </li> 1.18 cvs 9492: <li> 9493: <tt>S</tt>: an open broken line 1.19 cvs 9494: </li> 1.18 cvs 9495: <li> 9496: <tt>t</tt>: a horizontal line along the upper side of the box 1.19 cvs 9497: </li> 1.18 cvs 9498: <li> 9499: <tt>U</tt>: an open broken line with an arrow head at the end 1.19 cvs 9500: </li> 1.18 cvs 9501: <li> 9502: <tt>v</tt>: a vertical line as tall as the box and placed in its middle 1.19 cvs 9503: </li> 1.18 cvs 9504: <li> 9505: <tt>V</tt>: a down arrow as tall as the box and in its middle 1.19 cvs 9506: </li> 1.18 cvs 9507: <li> 9508: w: a segment (2 points) 1.19 cvs 9509: </li> 1.18 cvs 9510: <li> 9511: <tt>W</tt>: the upper right corner 1.19 cvs 9512: </li> 1.18 cvs 9513: <li> 9514: x: a segment (2 points) with an arrow head at the end 1.19 cvs 9515: </li> 1.18 cvs 9516: <li> 9517: <tt>X</tt>: the lower right corner 1.19 cvs 9518: </li> 1.18 cvs 9519: <li> 9520: y: a segment (2 points) with an arrow head at the end 1.19 cvs 9521: </li> 1.18 cvs 9522: <li> 9523: <tt>Y</tt>: the lower left corner 1.19 cvs 9524: </li> 1.18 cvs 9525: <li> 9526: z: a segment (2 points) with an arrow head at the end 1.19 cvs 9527: </li> 1.18 cvs 9528: <li> 9529: <tt>Z</tt>: the upper left corner 1.19 cvs 9530: </li> 1.18 cvs 9531: <li> 9532: <tt>space</tt>: a transparent element 1.19 cvs 9533: </li> 1.18 cvs 9534: <li> 9535: <tt>^</tt>: an up arrow as tall as the box and in its middle 1.19 cvs 9536: </li> 1.18 cvs 9537: <li> 9538: <tt>></tt>: a right arrow as long as the box's width and in its middle 1.19 cvs 9539: </li> 1.18 cvs 9540: <li> 9541: <tt>></tt>: a left arrow as long as the box's width and in its middle 1.19 cvs 9542: </li> 1.18 cvs 9543: <li> 9544: <tt>/</tt>: The southwest/northeast diagonal of the box 1.19 cvs 9545: </li> 1.18 cvs 9546: <li> 9547: <tt>\</tt>: the northwest/southeast diagonal of the box 1.19 cvs 9548: </li> 1.18 cvs 9549: </ul> 9550: <hr> 1.19 cvs 9551: 1.18 cvs 9552: </div> 9553: </div> 9554: </body> 9555: </html>