Annotation of Amaya/doc/languages.html, revision 1.14
1.6 cvs 1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
1.1 cvs 2: <HTML>
3: <HEAD>
4: <TITLE>The Languages of Thot</TITLE>
5: </HEAD>
6: <BODY>
7:
8: <DIV class="frontmatter" align=center>
9: <H1>The Languages of Thot</H1>
10:
11: <H3>Vincent Quint</H3>
12:
1.6 cvs 13: <H4>Translated from French by Ethan Munson</H4>
1.1 cvs 14:
1.14 ! cvs 15: <H4>Version of April 1st, 1997</H4>
1.1 cvs 16:
1.6 cvs 17: <P>© 1996 INRIA
18:
19: <HR>
20: </DIV>
21:
22: <DIV class="tableofcontents">
23: <H2><A href="languages.toc.html">Contents</A></H2>
24: <UL>
25: <LI><BIG><A href="#sect2">The document model of Thot</A></BIG>
26: <UL>
27: <LI><STRONG><A href="#sectb21">The logical structure of documents</A></STRONG>
28: <LI><STRONG><A href="#sectb22">Generic and specific structures</A></STRONG>
29: <LI><STRONG><A href="#sectb23">Logical structure and physical structure</A></STRONG>
30: <LI><STRONG><A href="#sectb24">Document structures and object structures</A></STRONG>
31: </UL>
32:
33: <LI><BIG><A href="#sect3">The S language</A></BIG>
34: <UL>
35: <LI><STRONG><A href="#sectb31">Document meta-structure</A></STRONG>
36: <UL>
37: <LI><A href="#sectc311">The basic types</A>
38: <LI><A href="#sectc312">Constructed elements</A>
39: <LI><A href="#sectc313">Logical structure constructors</A>
40: <UL>
41: <LI><SMALL><A href="#sectd3131">Aggregate and List</A></SMALL>
42: <LI><SMALL><A href="#sectd3132">Choice, Schema, and Unit</A></SMALL>
43: <LI><SMALL><A href="#sectd3133">Reference and Inclusion</A></SMALL>
44: <LI><SMALL><A href="#sectd3134">Mark pairs</A></SMALL>
45: <LI><SMALL><A href="#sectd3135">Restrictions and Extensions</A></SMALL>
46: <LI><SMALL><A href="#sectd3136">Summary</A></SMALL>
47: </UL>
48: <LI><A href="#sectc314">Associated Elements</A>
49: <LI><A href="#sectc315">Attributes</A>
50: <LI><A href="#sectc316">Discussion of the model</A>
51: </UL>
52: <LI><STRONG><A href="#sectb32">The definition language for generic structures</A></STRONG>
53: <UL>
54: <LI><A href="#sectc321">Writing Conventions</A>
55: <LI><A href="#sectc322">Extension schemas</A>
56: <LI><A href="#sectc323">The general organization of structure schemas</A>
57: <LI><A href="#sectc324">The default presentation</A>
58: <LI><A href="#sectc325">Global Attributes</A>
59: <LI><A href="#sectc326">Parameters</A>
60: <LI><A href="#sectc327">Structured elements</A>
61: <LI><A href="#sectc328">Structure definitions</A>
62: <UL>
63: <LI><SMALL><A href="#sectd3281">List</A></SMALL>
64: <LI><SMALL><A href="#sectd3282">Aggregate</A></SMALL>
65: <LI><SMALL><A href="#sectd3283">Choice</A></SMALL>
66: <LI><SMALL><A href="#sectd3284">Reference</A></SMALL>
67: <LI><SMALL><A href="#sectd3285">Mark pairs</A></SMALL>
68: </UL>
69: <LI><A href="#sectc329">Imports</A>
70: <LI><A href="#sectc3210">Extension rules</A>
71: <LI><A href="#sectc3211">Associated elements</A>
72: <LI><A href="#sectc3212">Units</A>
73: <LI><A href="#sectc3213">Skeleton elements</A>
74: <LI><A href="#sectc3214">Exceptions</A>
75: </UL>
76: <LI><STRONG><A href="#sectb33">Some examples</A></STRONG>
77: <UL>
78: <LI><A href="#sectc331">A class of documents: articles</A>
79: <LI><A href="#sectc332">A class of objects: mathematical formulas</A>
1.8 cvs 80: </UL>
1.6 cvs 81: </UL>
82:
1.8 cvs 83: <LI><BIG><A href="#sect4">The P language</A></BIG>
1.6 cvs 84: <UL>
85: <LI><STRONG><A href="#sectb41">Document presentation</A></STRONG>
86: <UL>
87: <LI><A href="#sectc411">Two levels of presentation</A>
88: <LI><A href="#sectc412">Boxes</A>
89: <LI><A href="#sectc413">Views and visibility</A>
90: <LI><A href="#sectc414">Pages</A>
91: <LI><A href="#sectc415">Numbering</A>
92: <LI><A href="#sectc416">Presentation parameters</A>
93: </UL>
94: <LI><STRONG><A href="#sectb42">Presentation description language</A></STRONG>
95: <UL>
96: <LI><A href="#sectc421">The organization of a presentation schema</A>
97: <LI><A href="#sectc422">Views</A>
98: <LI><A href="#sectc423">Print Views</A>
99: <LI><A href="#sectc424">Counters</A>
100: <LI><A href="#sectc425">Presentation constants</A>
101: <LI><A href="#sectc426">Variables</A>
102: <LI><A href="#sectc427">Default presentation rules</A>
103: <LI><A href="#sectc428">Presentation and page layout boxes</A>
104: <LI><A href="#sectc429">Presentation of structured elements</A>
105: <LI><A href="#sectc4210">Logical attribute presentation</A>
106: <LI><A href="#sectc4212">Value transmission rules</A>
107: <LI><A href="#sectc4213">Presentation rules</A>
108: <LI><A href="#sectc4214">Conditions applying to presentation rules</A>
109: <UL>
110: <LI><SMALL><A href="#sectd42141">Conditions based on the logical position of the element</A></SMALL>
111: <LI><SMALL><A href="#sectd42142">Conditions on references</A></SMALL>
112: <LI><SMALL><A href="#sectd42143">Conditions on logical attributes</A></SMALL>
113: <LI><SMALL><A href="#sectd42144">Conditions on page breaks</A></SMALL>
114: <LI><SMALL><A href="#sectd42145">Conditions on the element's content</A></SMALL>
115: <LI><SMALL><A href="#sectd42146">Conditions on counters</A></SMALL>
116: </UL>
117: <LI><A href="#sectc4215">A presentation rule</A>
118: <LI><A href="#sectc4216">Box axes</A>
119: <LI><A href="#sectc4217">Distance units</A>
120: <LI><A href="#sectc4218">Relative positions</A>
121: <LI><A href="#sectc4219">Box extents</A>
122: <UL>
123: <LI><SMALL><A href="#sectd42191">Fixed extents</A></SMALL>
124: <LI><SMALL><A href="#sectd42192">Relative extents</A></SMALL>
125: <LI><SMALL><A href="#sectd42193">Elastic extents</A></SMALL>
126: </UL>
127: <LI><A href="#sectc4220">Overflow</A>
128: <LI><A href="#sectc4221">Inheritance</A>
129: <LI><A href="#sectc4222">Line breaking</A>
130: <UL>
131: <LI><SMALL><A href="#sectd42221">Line spacing</A></SMALL>
132: <LI><SMALL><A href="#sectd42222">First line indentation</A></SMALL>
133: <LI><SMALL><A href="#sectd42223">Alignment</A></SMALL>
134: <LI><SMALL><A href="#sectd42224">Justification</A></SMALL>
135: <LI><SMALL><A href="#sectd42225">Hyphenation</A></SMALL>
136: <LI><SMALL><A href="#sectd42226">Avoiding line breaking</A></SMALL>
137: </UL>
138: <LI><A href="#sectc4223">Page breaking and line breaking conditions</A>
139: <LI><A href="#sectc4224">Visibility</A>
140: <LI><A href="#sectc4225">Character style parameters</A>
141: <UL>
142: <LI><SMALL><A href="#sectd42251">Character size</A></SMALL>
143: <LI><SMALL><A href="#sectd42252">Font and character style</A></SMALL>
144: <LI><SMALL><A href="#sectd42253">Underlining</A></SMALL>
145: </UL>
146: <LI><A href="#sectc4226">Stacking order</A>
1.13 cvs 147: <LI><A href="#sectc4227">Line style</A>
1.6 cvs 148: <LI><A href="#sectc4228">Line thickness</A>
149: <LI><A href="#sectc4229">Fill pattern</A>
150: <LI><A href="#sectc4230">Colors</A>
1.13 cvs 151: <LI><A href="#sectc4230a">Background color and border</A>
152: <LI><A href="#sectc4230b">Background pictures</A>
1.6 cvs 153: <LI><A href="#sectc4231">Presentation box content</A>
154: <LI><A href="#sectc4232">Presentation box creation</A>
155: <LI><A href="#sectc4233">Page layout</A>
156: <LI><A href="#sectc4234">Box copies</A>
157: </UL>
158: </UL>
159:
160: <LI><BIG><A href="#sect5">The T language</A></BIG>
161: <UL>
162: <LI><STRONG><A href="#sectb51">Document translation</A></STRONG>
163: <UL>
164: <LI><A href="#sectc511">Translation principles</A>
165: <LI><A href="#sectc512">Translation procedure</A>
166: </UL>
167: <LI><STRONG><A href="#sectb52">Translation definition language</A></STRONG>
168: <UL>
169: <LI><A href="#sectc521">Organization of a translation schema</A>
170: <LI><A href="#sectc522">Line length</A>
171: <LI><A href="#sectc523">Buffers</A>
172: <LI><A href="#sectc524">Counters</A>
173: <LI><A href="#sectc525">Constants</A>
174: <LI><A href="#sectc526">Variables</A>
175: <LI><A href="#sectc527">Translating structure elements</A>
176: <LI><A href="#sectc528">Conditional rules</A>
177: <UL>
178: <LI><SMALL><A href="#sectd5281">Conditions based on the logical position of the element</A></SMALL>
179: <LI><SMALL><A href="#sectd5282">Conditions on references</A></SMALL>
180: <LI><SMALL><A href="#sectd5283">Conditions on the parameters</A></SMALL>
181: <LI><SMALL><A href="#sectd5284">Conditions on the alphabets</A></SMALL>
182: <LI><SMALL><A href="#sectd5285">Conditions on page breaks</A></SMALL>
183: <LI><SMALL><A href="#sectd5286">Conditions on the element's content</A></SMALL>
184: <LI><SMALL><A href="#sectd5287">Conditions on the presence of comments</A></SMALL>
185: <LI><SMALL><A href="#sectd5288">Conditions on the presence of specific presentation rules</A></SMALL>
186: <LI><SMALL><A href="#sectd5289">Conditions on the presence of logical attributes</A></SMALL>
187: <LI><SMALL><A href="#sectd52810">Conditions on logical attributes</A></SMALL>
188: <LI><SMALL><A href="#sectd52811">Conditions on specific presentation rules</A></SMALL>
189: </UL>
190: <LI><A href="#sectc529">Translation rules</A>
191: <LI><A href="#sectc5210">The <TT>Create</TT> rule</A>
192: <LI><A href="#sectc5211">The <TT>Write</TT> rule</A>
193: <LI><A href="#sectc5212">The <TT>Read</TT> rule</A>
194: <LI><A href="#sectc5213">The <TT>Include</TT> rule</A>
195: <LI><A href="#sectc5214">The <TT>Get</TT> rule</A>
196: <LI><A href="#sectc5215">The <TT>Copy</TT> rule</A>
197: <LI><A href="#sectc5216">The <TT>Use</TT> rule</A>
198: <LI><A href="#sectc5217">The <TT>Remove</TT> rule</A>
199: <LI><A href="#sectc5218">The <TT>NoTranslation</TT> rule</A>
200: <LI><A href="#sectc5219">The <TT>NoLineBreak</TT> rule</A>
201: <LI><A href="#sectc5220">The <TT>ChangeMainFile</TT> rule</A>
1.14 ! cvs 202: <LI><A href="#sectc5220a">The <TT>RemoveFile</TT> rule</A>
1.6 cvs 203: <LI><A href="#sectc5221">The <TT>Set</TT> and <TT>Add</TT> rules</A>
1.10 cvs 204: <LI><A href="#sectc5221a">The <TT>Indent</TT> rule</A>
1.6 cvs 205: <LI><A href="#sectc5222">Rule application order</A>
206: <LI><A href="#sectc5223">Translation of logical attributes</A>
207: <LI><A href="#sectc5224">Translation of specific presentations</A>
208: <LI><A href="#sectc5225">Recoding of characters, symbols and graphics</A>
209: </UL>
210: </UL>
211:
212: <LI><BIG><A href="#sect6">Language grammars</A></BIG>
213: <UL>
214: <LI><STRONG><A href="#sectb61">The M meta-language</A></STRONG>
215: <LI><STRONG><A href="#sectb62">The S language</A></STRONG>
216: <LI><STRONG><A href="#sectb63">The P language</A></STRONG>
217: <LI><STRONG><A href="#sectb64">The T language</A></STRONG>
218: </UL>
219:
220: <LI><BIG><A href="#sect7">Character coding</A></BIG>
221: <UL>
222: <LI><STRONG><A href="#sectb71">Characters</A></STRONG>
223: <LI><STRONG><A href="#sectb72">Symbols</A></STRONG>
224: <LI><STRONG><A href="#sectb73">Graphical elements</A></STRONG>
225: </UL>
226: </UL>
1.1 cvs 227: <HR>
228: </DIV>
229:
230: <DIV class="chapter">
1.6 cvs 231: <H1><A name=sect2>The document model of Thot</A></H1>
1.1 cvs 232:
233: <P>
234: All of the services which Thot provides to the user are based on the system's
235: internal document representation. This representation is itself derived from
236: the document model which underlies Thot. The model is presented here, prior
237: to the description of the languages which permit the generic specification of
238: documents.</P>
239:
240: <DIV class="section">
1.6 cvs 241: <H2><A name=sectb21>The logical structure of documents</A></H2>
1.1 cvs 242:
243: <P>
244: The document model of Thot is primarily designed to allow the user to operate
1.5 cvs 245: on those entities which s/he has in mind when s/he works on a document. The
246: model makes no assumptions about the nature of these entities. It is
247: essentially these logical entities, such as paragraphs, sections, chapters,
248: notes, titles, and cross-references which give a document its logical
249: structure.</P>
1.1 cvs 250: <P>
1.5 cvs 251: Because of this model, the author can divide the document into chapters,
1.1 cvs 252: giving each one a title. The content of these chapters can be further divided
1.2 cvs 253: into sections, subsections, etc. The text is organized into successive
254: paragraphs, according to the content. In the writing phase, the lines, pages,
255: margins, spacing, fonts, and character styles are not very important. In fact,
256: if the system requires documents to be written in these terms, it gets in the
257: way. So, Thot's model is primarily based on the logical aspect of documents.
258: The creation of a model of this type essentially requires the definition :</P>
1.1 cvs 259: <UL>
260: <LI>of the entities which can appear in the documents,
261: <LI>and the relations between these entities.
262: </UL>
263: <P>
264: The choice of entities to include in the model can be subtle. Some documents
265: require chapters, while others only need various levels of sections. Certain
266: documents contain appendices, others don't. In different documents the same
267: logical entity may go by different names (e.g. ``Conclusion'' and
268: ``Summary''). Certain entities which are absolutely necessary in some
269: documents, such as clauses in a contract or the address of the recipient in a
270: letter, are useless in most other cases.</P>
271: <P>
272: The differences between documents result from more than just the entities that
273: appear in them, but also from the relationships between these entities and the
274: ways that they are linked. In certain documents, notes are spread throughout
275: the document, for example at the bottom of the page containing the
276: cross-reference to them, while in other documents they are collected at the
277: end of each chapter or even at the end of the work. As another example, the
278: introduction of some documents can contain many sections, while in other
279: documents, the introduction is restricted to be a short sequence of
280: paragraphs.</P>
281: <P>
282: All of this makes it unlikely that a single model can describe any document at
283: a relatively high level. It is obviously tempting to make up a list of widely
284: used entities, such as chapters, sections, paragraphs, and titles, and then
285: map all other entities onto the available choices. In this way, an
286: introduction can be supported as a chapter and a contract clause supported as
287: a paragraph or section. However, in trying to widen the range of usage of
288: certain entities, their meaning can be lost and the power of the model
289: reduced. In addition, while this widening partially solves the problem of
290: choosing entities, it does not solve the problem of their organization: when a
291: chapter must be composed of sections, how does one indicate that an
292: introduction has none when it is merely another chapter? One solution is to
293: include introductions in the list of supported entities. But then, how does
294: one distinguish those introductions which are allowed to have sections from
295: those which are not. Perhaps this could be done by defining two types of
296: introduction. Clearly, this approach risks an infinite expansion of the list
297: of widely used entities.</P>
298: </DIV>
299:
300: <DIV class="section">
1.6 cvs 301: <H2><A name=sectb22>Generic and specific structures</A></H2>
1.1 cvs 302:
303: <P>
304: Thus, it is apparently impossible to construct an exhaustive inventory of all
1.2 cvs 305: those entities which are necessary and sufficient to precisely describe any
306: document. It also seems impossible to specify all possible arrangements of
307: these entities in a document. This is why Thot uses a <EM>meta-model</EM>
308: instead, which permits the description of numerous <EM>models</EM>, each one
309: describing a <EM>class</EM> of documents.</P>
1.1 cvs 310: <P>
311: A <EM>class</EM> is a set of documents having very similar structure. Thus,
312: the collection of research reports published by a laboratory constitutes a
313: class; the set of commercial proposals by the sales department of a company
314: constitutes another class; the set of articles published by a journal
315: constitutes a third class. Clearly, it is not possible to enumerate every
316: possible document class. It is also clear that new document classes must be
317: created to satisfy new needs and applications.</P>
318: <P>
319: To give a more rigorous definition of classes, we must introduce the ideas of
320: <EM>generic structure</EM> and <EM>specific structure</EM>. Each document has
321: a <EM>specific structure</EM> which organizes the various parts which comprise
322: it. We illustrate this with the help of a simple example comparing two
323: reports, A and B (<A href="#specstruct">see Figure</A>). The report A contains
324: an introduction followed by three chapters and a conclusion. The first
325: chapter contains two sections, the second, three sections. That is the
326: <EM>specific</EM> structure of document A. Similarly, the structure of
327: document B is: an introduction, two chapters, a conclusion; Chapter 1 has
328: three sections while Chapter 2 has four. The specific structures of these two
329: documents are thus different.</P>
330:
331: <DIV class="figure">
332: <HR>
333: <PRE>
334: Report A Report B
335: Introduction Introduction
336: Chapter 1 Chapter 1
337: Section 1.1 Section 1.1
338: Section 1.2 Section 1.2
339: Chapter 2 Section 1.3
340: Section 2.1 Chapter 2
341: Section 2.2 Section 2.1
342: Section 2.3 Section 2.2
343: Chapter 3 Section 2.3
344: Conclusion Section 2.4
345: Conclusion
346: </PRE>
347: <P align=center>
348: <EM><A name="specstruct">Two specific structures</A></EM></P>
349: <HR>
350: </DIV>
351: <P>
352: The <EM>generic structure</EM> defines the ways in which specific structures
353: can be constructed. It specifies how to generate specific structures. The
354: reports A and B, though different, are constructed in accordance with the same
355: generic structure, which specifies that a report contains an introduction
356: followed by a variable number of chapters and a conclusion, with each chapter
357: containing a variable number of sections.</P>
358: <P>
359: There is a one-to-one correspondence between a class and a generic structure:
360: all the documents of a class are constructed in accordance with the same
361: generic structure. Hence the definition of the class: a class is a set of
362: documents whose specific structure is constructed in accordance with the same
363: generic structure. A class is characterized by its generic structure.</P>
364: <P>
365: Thus, a generic structure can be considered to be a model at the level which
366: interests us, but only for one class of documents. When the definition is
367: limited to a single class of documents, it is possible to define a model which
368: does a good job of representing the documents of the class, including the
369: necessary entities and unencumbered by useless entities. The description of
370: the organization of the documents in the class can then be sufficiently
371: precise.</P>
372: </DIV>
373:
374: <DIV class="section">
1.6 cvs 375: <H2><A name=sectb23>Logical structure and physical structure</A></H2>
1.1 cvs 376:
377: <P>
378: Generic structures only describe the <EM>logical</EM> organization of
379: documents, not their <EM>physical</EM> presentation on a screen or on sheets
380: of paper. However, for a document to be displayed or printed, its graphic
381: presentation must be taken into account.</P>
382: <P>
383: An examination of current printed documents shows that the details of
384: presentation essentially serve to bring out their logical structure. Outside
385: of some particular domains, notably advertising, the presentation is rarely
386: independent of the logical organization of the text. Moreover, the art of
387: typography consists of enhancing the organization of the text being set,
388: without catching the eye of the reader with overly pronounced effects. Thus,
389: italic and boldface type are used to emphasize words or expressions which have
390: greater significance than the rest of the text: keywords, new ideas,
391: citations, book titles, etc. Other effects highlight the organization of the
392: text: vertical space, margin changes, page breaks, centering, eventually
393: combined with the changes in the shapes or weight of the characters. These
394: effects serve to indicate the transitions between paragraphs, sections, or
395: chapters: an object's level in the logical structure of the document is shown
396: by the markedness of the effects.</P>
397: <P>
398: Since the model permits the description of all of the logical structure of the
399: document, the presentation can be derived from the model without being
400: submerged in the document itself. It suffices to use the logical structure of
401: the document to make the desired changes in its presentation: changes in type
402: size, type style, spacing, margin, centering, etc.</P>
403: <P>
404: Just as one cannot define a unique generic logical structure for all document
405: classes, one cannot define universal presentation rules which can be applied
406: to all document classes. For certain types of documents the chapter titles
407: will be centered on the page and printed in large, bold type. For other
408: documents, the same chapter titles will be printed in small, italic type and
409: aligned on the left margin.</P>
410: <P>
411: Therefore, it is necessary to base the presentation specifications for
412: documents on their class. Such a specification can be very fine-grained,
413: because the presentation is expressed in terms of the entities defined in the
414: generic logical structure of the class. Thus, it is possible to specify a
415: different presentation for the chapter titles and the section titles, and
416: similarly to specify titles for the sections according to their level in the
417: section hierarchy. The set of rules which specify the presentation of all the
418: elements defined in a generic logical structure is called a <EM>generic
419: presentation</EM>.</P>
420: <P>
421: There are several advantages derived from having a presentation linked to the
422: generic structure and described by a generic presentation. Homogeneity is the
423: first. Since every document in a class corresponds to the same generic
424: logical structure, a homogenous presentation for different documents of the
425: same class can be assured by applying the same generic presentation to all
426: documents of the class. Homogeneity of presentation can also be found among
1.2 cvs 427: the entities of a single document: every section heading will be presented in
1.1 cvs 428: the same way, the first line of every paragraph of the same type will have the
429: same indentation, etc.</P>
430: <P>
431: Another advantage of this approach to presentation is that it facilitates
432: changes to the graphical aspect of documents. A change to the generic
433: presentation rules attached to each type of entity will alter the presentation
434: of the entire document, and will do so homogenously. In this case, the
435: internal homogeneity of the class is no longer assured, but the way to control
436: it is simple. It suffices to adopt a single generic presentation for the
437: entire class.</P>
438: <P>
439: If the presentation of the class does not have to be homogenous, then the
440: appearance of the document can be adapted to the way it will be used or to the
441: device used to render it. This quality is sufficient to allow the existence
442: of <A name="mulpres">many generic presentations</A> for the same document
443: class. By applying one or the other of these presentations to it, the document
444: can be seen under different graphical aspects. It must be emphasized that
445: this type of modification of the presentation is not a change to the document
446: itself (in its specific logical structure or its content), but only in its
447: appearance at the time of editing or printing.</P>
448: </DIV>
449:
450: <DIV class="section">
1.6 cvs 451: <H2><A name=sectb24>Document structures and object structures</A></H2>
1.1 cvs 452:
453: <P>
454: So far, we have only discussed the global structure of documents and have not
455: considered the contents found in that structure. We could limit ourselves to
456: purely textual contents by assuming that a title or a paragraph contains a
457: simple linear text. But this model would be too restrictive. In fact,
458: certain documents contain not only text, but also contain tables, diagrams,
459: photographs, mathematical formulas, and program fragments. The model must
460: permit the representation of such <EM>objects</EM>.</P>
461: <P>
462: Just as with the whole of the document, the model takes into account the
463: logical structure of objects of this type. Some are clearly structured,
464: others are less so. Logical structure can be recognized in mathematical
465: formulas, in tables, and in certain types of diagrams. On the other hand, it
466: is difficult to define the structure of a photograph or of some drawings. But
467: in any case, it does not seem possible to define one unique structure which
468: can represent every one of these types of objects. The approach taken in the
469: definition of meta-structure and document classes also applies to objects.
470: Object classes can be defined which put together objects of similar type,
471: constructed from the same generic logical structure.</P>
472: <P>
473: Thus, a mathematical class can be defined and have a generic logical structure
474: associated with it. But even if a single generic structure can represent a
475: sufficient variety of mathematical formulas, for other objects with less
476: rigorous structure, multiple classes must be defined. As for documents, using
477: multiple classes assures that the model can describe the full range of objects
478: to be presented. It also permits the system to support objects which were not
479: initially anticipated. Moreover, this comment applies equally to mathematics:
480: different classes of formulas can be described depending on the domain of
481: mathematics being described.</P>
482: <P>
483: Since objects have the same level of logical representation as documents, they
484: gain the same advantages. In particular, it is possible to define the
485: presentation separately from the objects themselves and attach it to the
486: class. Thus, as for documents, objects of the same type have a uniform
487: presentation and the presentation of every object in a given class can be
488: changed simply by changing the generic presentation of the class. Another
489: advantage of using this document model is that the system does not bother the
490: user with the details of presentation, but rather allows the user to
491: concentrate on the logical aspect of the document and the objects.</P>
492: <P>
493: It is clear that the documents in a class do not necessarily use the same
494: classes of objects: one technical report will contain tables while another
495: report will have no tables but will use mathematical formulas. The usable
1.2 cvs 496: object classes are not always mentioned in a limiting way in the generic
497: logical structure of documents. Rather, they can be chosen freely from a
498: large set, independent of the document class.</P>
1.1 cvs 499: <P>
500: Thus, the object classes will be made commonplace and usable in every
501: document. The notion of ``object'' can be enlarged to include not only
502: non-textual elements, but also certain types of textual elements which can
503: appear in practically every document, whatever their class. Among these
1.2 cvs 504: textual elements, one can mention enumerations, descriptions, examples,
505: quotations, even paragraphs.</P>
1.1 cvs 506: <P>
507: Thus, the document model is not a single, general model describing every type
508: of document in one place. Rather, it is a meta-model which can be used to
509: describe many different models each of which represents either a class of
510: similar documents or a class of similar objects which every document can
511: include.</P>
512: </DIV>
513: <HR>
514: </DIV>
515:
516: <DIV class="chapter">
1.6 cvs 517: <H1><A name=sect3>The S language</A></H1>
1.1 cvs 518:
519:
520: <DIV class="section">
1.6 cvs 521: <H2><A name=sectb31>Document meta-structure</A></H2>
1.1 cvs 522:
523: <P>
524: Since the concept of meta-structure is well suited to the task of describing
525: documents at a high level of abstraction, this meta-structure must be
526: precisely defined. Toward that end this section first presents the basic
527: elements from which documents and structured objects are composed and then
528: specifies the ways in which these basic elements are assembled into structures
529: representing complete documents and objects.</P>
530:
531: <DIV class="subsection">
1.6 cvs 532: <H3><A name=sectc311>The basic types</A></H3>
1.1 cvs 533:
534: <P>
535: At the lowest level of a document's structure, the first atom considered is
536: the character. However, since characters are seldom isolated, usually
537: appearing as part of a linear sequence, and in order to reduce the complexity
538: of the document structure, <EM>character strings</EM> are used as atoms and
539: consecutive characters belonging to the same structural element are grouped in
540: the same character string.</P>
541: <P>
542: If the structure of a document is not refined to go down to the level of
543: words or phrases, the contents of a simple paragraph can be considered to be a
544: single character string. On the other hand, the title of a chapter, the title
545: of the first section of that chapter, and the text of the first paragraph of
546: that section constitute three different character strings, because they belong
547: to distinct structural elements.</P>
548: <P>
549: If, instead, a very fine-grained representation for the structure of a
550: document is sought, character strings could be defined to contain only a
551: single word, or even just a single character. This is the case, for example,
552: in programs, for which one wants to retain a structure very close to the
1.2 cvs 553: syntax of the programming language. In this case, an assignment statement
1.1 cvs 554: initializing a simple variable to zero would be composed of two structural
555: elements, the identifier of the variable (a short character string) and the
556: assigned value (a string of a single character, `0').</P>
557: <P>
558: The character string is not the only atom necessary for representing those
559: documents that interest us. It suffices for purely textual documents, but as
560: soon as the non-textual objects which we have considered arise, there must be
561: other atoms; the number of objects which are to be represented determines the
562: number of types of atoms that are necessary.</P>
563: <P>
564: Primitive <EM>graphical elements</EM> are used for tables and figures of
565: different types. These elements are simple geometric shapes like horizontal
566: or vertical lines, which are sufficient for tables, or even oblique lines,
1.2 cvs 567: arrows, rectangles, circles, polygons, and curves for use in figures. From
568: these elements and character strings, graphical objects and tables can be
569: constructed.</P>
1.1 cvs 570: <P>
571: Photographs, though having very little structure, must still appear in
1.2 cvs 572: documents. They are supported by <EM>picture</EM> elements, which are
573: represented as matrices of pixels.</P>
1.1 cvs 574: <P>
575: Finally, mathematical notations require certain elements which are
576: simultaneously characters and graphical elements, the <EM>symbols</EM>. By way
1.2 cvs 577: of example, radicals, integration signs, or even large parentheses are
1.1 cvs 578: examples of this type of atom. The size of each of these symbols is
579: determined by its environment, that is to say, by the expression to which it
580: is attached.</P>
581: <P>
582: To summarize, the primitive elements which are used in the construction of
583: documents and structured objects are:</P>
584: <UL>
585: <LI>character strings,
586: <LI>graphical elements,
1.2 cvs 587: <LI>pictures,
1.1 cvs 588: <LI>and mathematical symbols.
589: </UL>
590: </DIV>
591:
592: <DIV class="subsection">
1.6 cvs 593: <H3><A name=sectc312>Constructed elements</A></H3>
1.1 cvs 594:
595: <P>
596: A document is evidently formed from primitive elements. But the model of Thot
597: also proposes higher level elements. Thus, in a document composed of several
598: chapters, each chapter is an element, and in the chapters each section is also
599: an element, and so on. A document is thus an organized set of elements.</P>
600: <P>
601: In a document there are different sorts of elements. Each element has a
602: <EM>type</EM> which indicates the role of the element within the document as a
603: whole. Thus, we have, for example, the chapter and section types. The
604: document is made up of typed elements: elements of the type chapter and
605: elements of the type section, among others, but also character string elements
606: and graphical elements: the primitive elements are typed elements just as
607: well. At the other extreme, the document itself is also considered to be a
608: typed element.</P>
609: <P>
610: The important difference between the primitive elements and the other elements
611: of the document is that the primitive elements are atoms (they cannot be
612: decomposed), whereas the others, called <EM>constructed elements</EM>, are
613: composed of other elements, which can either be primitive elements or
614: constructed elements. A constructed element of type chapter (or more simply,
615: ``a chapter'') is composed of sections, which are also constructed elements. A
616: paragraph, a constructed element, can be made up of character strings, which
617: are primitive elements, and of equations, which are constructed elements.</P>
618: <P>
619: A document is also a constructed element. This is an important point. In
620: particular, it allows a document to be treated as part of another document,
621: and conversely, permits a part of a document to be treated as a complete
622: document. Thus, an article presented in a journal is treated by its author as
623: a document in itself, while the editor of the journal considers it to be part
624: of an issue. A table or a figure appearing in a document can be extracted and
625: treated as a complete document, for example to prepare transparencies for a
626: conference.</P>
627: <P>
628: These thoughts about types and constructed elements apply just as well to
629: objects as they do to documents. A table is a constructed element made up of
630: other constructed elements, rows and columns. A row is formed of cells, which
631: are also constructed elements which contain primitive elements (character
632: strings) and/or constructed elements like equations.</P>
633: </DIV>
634:
635: <DIV class="subsection">
1.6 cvs 636: <H3><A name=sectc313>Logical structure constructors</A></H3>
1.1 cvs 637:
638: <P>
639: Having defined the primitive elements and the constructed elements, it is now
640: time to define the types of organization which allow the building of
641: structures. For this, we rely on the notion of the <EM>constructor</EM>. A
642: constructor defines a way of assembling certain elements in a structure. It
643: resides at the level of the meta-structure: it does not describe the existing
644: relations in a given structure, but rather defines how elements are assembled
1.2 cvs 645: to build a structure that conforms to a model.</P>
1.1 cvs 646: <P>
647: In defining the overall organization of documents, the first two constructors
648: considered are the aggregate and the list.</P>
649:
650: <DIV class="subsubsection">
1.6 cvs 651: <H4><A name=sectd3131>Aggregate and List</A></H4>
1.1 cvs 652:
653: <P>
654: The <EM>aggregate</EM> constructor is used to define constructed element types
655: which are collections of a given number of other elements. These collections
656: may or may not be ordered. The elements may be either constructed or
657: primitive and are specified by their type. A report (that is, a constructed
658: element of the report type) has an aggregate structure. It is formed from a
659: title, an author's name, an introduction, a body, and a conclusion, making it
660: a collection of five element types. This type of constructor is found in
661: practically every document, and generally at several levels in a document.</P>
662: <P>
663: The <EM>list</EM> constructor is used to define constructed elements which are
664: ordered sequences of elements (constructed or primitive) having the same type.
665: The minimum and maximum numbers of elements for the sequence can be specified
666: in the list constructor or the number of elements can be left unconstrained.
667: The body of a report is a list of chapters and is typically required to
668: contain a minimum of two chapters (is a chapter useful if it is the only one
669: in the report?) The chapter itself can contain a list of sections, each
1.2 cvs 670: section containing a list of paragraphs. In the same way as the aggregate,
671: the list is a very frequently used constructor in every type of document.
672: However, these two constructors are not sufficient to describe every document
673: structure; thus other constructors supplement them.</P>
1.1 cvs 674: </DIV>
675:
676: <DIV class="subsubsection">
1.6 cvs 677: <H4><A name=sectd3132>Choice, Schema, and Unit</A></H4>
1.1 cvs 678:
679: <P>
680: The <EM>choice</EM> constructor is used to define the structure of an element
681: type for which one alternative is chosen from several possibilities. Thus, a
682: paragraph can be either a simple text paragraph, or an enumeration, or a
1.2 cvs 683: citation.</P>
1.1 cvs 684: <P>
685: The choice constructor indicates the complete list of possible options, which
686: can be too restrictive in certain cases, the paragraph being one such case.
687: Two constructors, <EM>unit</EM> and <EM>schema</EM>, address this
688: inconvenience. They allow more freedom in the choice of an element type. If
689: a paragraph is defined by a schema constructor, it is possible to put in the
690: place of a paragraph a table, an equation, a drawing or any other object
691: defined by another generic logical structure. It is also possible to define a
692: paragraph as a sequence of units, which could be character strings, symbols,
1.2 cvs 693: or pictures. The choice constructor alone defines a generic logical structure
1.1 cvs 694: that is relatively constrained; in contrast, using units and schemas, a very
695: open structure can be defined.</P>
696: <P>
697: The <EM>schema</EM> constructor represents an object defined by a generic
698: logical structure chosen freely from among those available.</P>
699: <P>
700: The <EM>unit</EM> constructor represents an element whose type can be either a
701: primitive type or an element type defined as a unit in the generic logical
702: structure of the document, or in another generic logical structure used in the
703: document. Such an element may be used in document objects constructed
704: according to other generic structures.</P>
705: <P>
706: Thus, for example, if a cross-reference to a footnote is defined in the
707: generic logical structure ``Article'' as a unit, a table (an object defined by
708: another generic structure) can contain cross-references to footnotes, when
709: they appear in an article. In another type of document, a table defined by
710: the same generic structure can contain other types of elements, depending on
711: the type of document into which the table is inserted. All that is needed is
712: to declare, in the generic structure for tables, that the contents of cells
713: are units. In this way, the generic structure of objects is divided up
714: between different types of documents which are able to adapt themselves to the
715: environment into which they are inserted.</P>
716: </DIV>
717:
718: <DIV class="subsubsection">
1.6 cvs 719: <H4><A name=sectd3133>Reference and Inclusion</A></H4>
1.1 cvs 720:
721: <P>
1.5 cvs 722: The <EM>reference</EM> is used to define document
1.1 cvs 723: elements that are cross-references to other elements, such as a section, a
1.2 cvs 724: chapter, a bibliographic citation, or a figure. The reference is
725: bi-directional. It can be used to access both the element being
1.1 cvs 726: cross-referenced and each of the elements which make use of the
727: cross-reference.</P>
728: <P>
729: References can be either <EM>internal</EM> or <EM>external</EM>. That is,
730: they can designate elements which appear in the same document or in another
731: document.</P>
732: <P>
733: The <EM><A name="inclusion">inclusion</A></EM> constructor is a special type
734: of reference. Like the reference, it is an internal or external bidirectional
735: link, but it is not a cross-reference. This link represents the ``live''
736: inclusion of the designated element; it accesses the most recent version of
737: that element and not a ``dead'' copy, fixed in the state in which it was found
738: at the moment the copy was made. As soon as an element is modified, all of
739: its inclusions are automatically brought up to date. It must be noted that,
1.2 cvs 740: in addition to inclusion, Thot permits the creation of ``dead'' copies.</P>
1.1 cvs 741: <P>
742: There are three types of inclusions: inclusions with full expansion,
743: inclusions with partial expansion, and inclusions without expansion. During
744: editing, inclusions without expansion are represented on the screen by the
745: name of the included document, in a special color, while inclusions with
746: expansion (full or partial) are represented by a copy (full or partial) of the
747: included element (also in a special color). The on-screen representation of a
1.6 cvs 748: partial inclusion is a <A href="#sectc3213">``skeleton''</A> image of the
1.1 cvs 749: included document.</P>
750: <P>
751: Inclusion with complete expansion can be used to include parts of the same
752: document or of other documents. Thus, it can be either an internal or an
753: external link. It can be used to include certain bibliographic entries of a
754: scientific article in another article, or to copy part of a mathematical
755: formula into another formula of the same document, thus assuring that both
756: copies will remain synchronized.</P>
757: <P>
758: Inclusion without expansion or with partial expansion is used to include
759: complete documents. It is always an external link. It is used primarily to
760: divide very large documents into sub-documents that are easier to manipulate,
761: especially when there are many authors. So, a book can include some chapters,
762: where each chapter is a different document which can be edited separately.
763: When viewing the book on the screen, it might be desirable to see only the
764: titles of the chapters and sections. This can be achieved using inclusion
765: with partial expansion.</P>
766: <P>
767: During printing, inclusions without expansion or with partial expansion can be
768: represented either as they were shown on the screen or by a complete (and
769: up-to-date) copy of the included element or document.</P>
770: <P>
771: The inclusion constructor, whatever its type, respects the generic structure:
772: only those elements authorized by the generic structure can be included at a
773: given position in a document.</P>
774: </DIV>
775:
776: <DIV class="subsubsection">
1.6 cvs 777: <H4><A name=sectd3134>Mark pairs</A></H4>
1.1 cvs 778:
779: <P>
780: It is often useful to delimit certain parts of a document independently from
781: the logical structure. For example, one might wish to attach some information
1.6 cvs 782: (in the form of an <A href="#sectc315">attribute</A>) or a particular
1.1 cvs 783: treatment to a group of words or a set of consecutive paragraphs. <EM>Mark
784: pairs</EM> are used to do this.</P>
785: <P>
786: Mark pairs are elements which are always paired and are terminals in the
787: logical structure of the document. Their position in the structure of the
788: document is defined in the generic structure. It is important to note that
789: when the terminals of a mark pair are <EM>extensions</EM> (see the next
790: section), they can be used quite freely.</P>
791: </DIV>
792:
793: <DIV class="subsubsection">
1.6 cvs 794: <H4><A name=sectd3135>Restrictions and Extensions</A></H4>
1.1 cvs 795:
796: <P>
797: The primitive types and the constructors presented so far permit the
798: definition of the logical structure of documents and objects in a rigorous
799: way. But this definition can be very cumbersome in certain cases, notably
800: when trying to constrain or extend the authorized element types in a
801: particular context. <EM>Restrictions</EM> and <EM>extensions</EM> are used to
1.2 cvs 802: cope with these cases.</P>
1.1 cvs 803: <P>
804: A restriction associates with a particular element type <EM>A</EM>, a list of
805: those element types which elements of type <EM>A</EM> may not contain, even if
806: the definition of type <EM>A</EM> and those of its components authorize them
807: otherwise. This simplifies the writing of generic logical structures and
808: allows limitations to be placed, when necessary, on the choices offered by the
809: schema and unit constructors.</P>
810: <P>
811: Extensions are the inverse of restrictions. They identify a list of element
812: types whose presence <EM>is</EM> permitted, even if its definition and those
813: of its components do not authorize them otherwise.</P>
814: </DIV>
815:
816: <DIV class="subsubsection">
1.6 cvs 817: <H4><A name=sectd3136>Summary</A></H4>
1.1 cvs 818:
819: <P>
820: Thus, four constructors are used to construct a document:</P>
821: <UL>
1.2 cvs 822: <LI>the aggregate constructor (ordered or not),
1.1 cvs 823: <LI>the list constructor,
1.2 cvs 824: <LI>the choice constructor and its extensions, the unit and schema
825: constructors,
1.1 cvs 826: <LI>the reference constructor and its variant, the inclusion.
827: </UL>
828: <P>
829: These constructors are also sufficient for objects. Thus, these constructors
830: provide a homogenous meta-model which can describe both the organization of
831: the document as a whole and that of the various types of objects which it
832: contains. After presenting the description language for generic structures,
833: we will present several examples which illustrate the appropriateness of the
834: model.</P>
835: <P>
836: The first three constructors (aggregate, list and choice) lead to tree-like
837: structures for documents and objects, the objects being simply the subtrees of
838: the tree of a document (or even of other objects' subtrees). The reference
839: constructor introduces other, non-hierarchical, relations which augment those
840: of the tree: when a paragraph makes reference to a chapter or a section, that
841: relation leaves the purely tree-like structure. Moreover, external reference
842: and inclusion constructors permit the establishment of links between different
843: documents, thus creating a hypertext structure.</P>
844: </DIV>
845: </DIV>
846:
847: <DIV class="subsection">
1.6 cvs 848: <H3><A name=sectc314>Associated Elements</A></H3>
1.1 cvs 849:
850: <P>
851: Thanks to the list, aggregate and choice constructors, the organization of the
852: document is specified rigorously, using constructed and primitive elements.
853: But a document is made up of more than just its elements; it clearly also
854: contains links between them. There exist elements whose position in the
855: document's structure is not determinable. This is notably the case for
856: figures and notes. A figure can be designated at many points in the same
857: document and its place in the physical document can vary over the life of the
858: document without any effect on the meaning or clarity of the document. At one
859: time, it can be placed at the end of the document along with all other
860: figures. At another time, it can appear at the top of the page which follows
861: the first mention of the figure. The figures can be dispersed throughout the
862: document or can be grouped together. The situation is similar for notes,
863: which can be printed at the bottom of the page on which they are mentioned or
864: assembled together at the end of the chapter or even the end of the work. Of
865: course, this brings up questions of the physical position of elements in
866: documents that are broken into pages, but this reflects the structural
867: instability of these elements. They cannot be treated the same way as
868: elements like paragraphs or sections, whose position in the structure is
869: directly linked to the semantics of the document.</P>
870: <P>
871: Those elements whose position in the structure of the document is not fixed,
872: even though they are definitely part of the document, are called
873: <EM>associated elements</EM>. Associated elements are themselves structures,
874: which is to say that their content can be organized logically by the
875: constructors from primitive and constructed elements.</P>
876: <P>
877: It can happen that the associated elements are totally disconnected from the
878: structure of the document, as in a commentary or appraisal of the entire work.
879: But more often, the associated elements are linked to the content of the
880: document by references. This is generally the case for notes and figures,
881: among others.</P>
882: <P>
883: Thus, associated elements introduce a new use for the reference constructor.
884: It not only serves to create links between elements of the principal structure
885: of the document, but also serves to link the associated elements to the
886: primary structure.</P>
887: </DIV>
888:
889: <DIV class="subsection">
1.6 cvs 890: <H3><A name=sectc315>Attributes</A></H3>
1.1 cvs 891:
892: <P>
893: There remain logical aspects of documents that are not entirely described by
894: the structure. Certain types of semantic information, which are not stated
895: explicitly in the text, must also be taken into account. In particular, such
896: information is shown by typographic effects which do not correspond to a
897: change between structural elements. In fact, certain titles are set in bold
898: or italic or are printed in a different typeface from the rest of the text in
899: order to mark them as structurally distinct. But these same effects
900: frequently appear in the middle of continuous text (e.g. in the interior of a
901: paragraph). In this case, there is no change between structural elements; the
902: effect serves to highlight a word, expression, or phrase. The notion of an
903: <EM>attribute</EM> is used to express this type of information.</P>
904: <P>
905: An attribute is a piece of information attached to a structural element which
906: augments the type of the element and clarifies its function in the document.
907: Keywords, foreign language words, and titles of other works can all be
908: represented by character strings with attached attributes. Attributes may
909: also be attached to constructed elements. Thus, an attribute indicating the
910: language can be attached to a single word or to a large part of a
911: document.</P>
912: <P>
913: In fact, an attribute can be any piece of information which is linked to a
914: part of a document and which can be used by agents which work on the document.
915: For example, the language in which the document is written determines the set
916: of characters used by an editor or formatter. It also determines the
917: algorithm or hyphenation dictionary to be used. The attribute ``keyword''
918: facilitates the work of an information retrieval system. The attribute
919: ``index word'' allows a formatter to automatically construct an index at the
920: end of the document.</P>
921: <P>
922: As with the types of constructed elements, the attributes and the values they
923: can take are defined separately in each generic logical structure, not in the
924: meta-model, according to the needs of the document class or the nature of the
925: object.</P>
926: <P>
927: Many types of attributes are offered: numeric, textual, references, and
928: enumerations:</P>
929: <UL>
1.2 cvs 930: <LI><EM>Numeric attributes</EM> can take integer values (negative, positive,
931: or null).
1.1 cvs 932: <LI><EM>Textual attributes</EM> have as their values character strings.
1.2 cvs 933: <LI><EM>Reference attributes</EM> designate an element of the logical
934: structure.
935: <LI><EM>Enumeration attributes</EM> can take one value from a limited list of
1.1 cvs 936: possible values, each value being a name.
937: </UL>
938: <P>
939: In a generic structure, there is a distinction between <EM>global
940: attributes</EM> and <EM>local attributes</EM>. A global attribute can be
941: applied to every element type defined in the generic structure where it is
942: specified. In contrast, a local attribute can only be applied to certain
943: types of elements, even only a single type. The ``language'' attribute
944: presented above is an example of a global attribute. An example of a local
945: attribute is the rank of an author (principal author of the document or
946: secondary author): this attribute can only be applied sensibly to an element
947: of the ``author'' type.</P>
948: <P>
949: Attributes can be assigned to the elements which make up the document in many
950: different ways. The author can freely and dynamically place them on any part
1.5 cvs 951: of the document in order to attach supplementary information of his/her choice.
1.1 cvs 952: However, attributes may only be assigned in accordance with the rules of the
953: generic structure; in particular, local attributes can only be assigned to
954: those element types for which they are defined.</P>
955: <P>
956: In the generic structure, certain local attributes can be made mandatory for
1.2 cvs 957: certain element types. In this case, Thot automatically associates the
958: attribute with the elements of this type and it requires the user to provide a
959: value for this attribute.</P>
1.1 cvs 960: <P>
961: Attributes can also be automatically assigned, with a given value, by every
962: application processing the document in order to systematically add a piece of
963: information to certain predefined elements of the document. By way of
964: example, in a report containing a French abstract and an English abstract,
965: each of the two abstracts is defined as a sequence of paragraphs. The first
966: abstract has a value of ``French'' for the ``language'' attribute while the
967: second abstract's ``language'' attribute has a value of ``English''.</P>
968: <P>
969: In the case of mark pairs, attributes are logically associated with the pair
970: as a whole, but are actually attached to the first mark.</P>
971: </DIV>
972:
973: <DIV class="subsection">
1.6 cvs 974: <H3><A name=sectc316>Discussion of the model</A></H3>
1.1 cvs 975:
976: <P>
977: The notions of attribute, constructor, structured element, and associated
978: element are used in the definition of generic logical structures of documents
979: and objects. The problem is to assemble them to form generic structures. In
980: fact, many types of elements and attributes can be found in a variety of
981: generic structures. Rather than redefine them for each structure in which
982: they appear, it is best to share them between structures. The object classes
983: already fill this sharing function. If a mathematical class is defined, its
984: formulas can be used in many different document classes, without redefining
985: the structure of each class. This problem arises not only for the objects
986: considered here; it also arises for the commonplace textual elements found in
987: many document classes. This is the reason why the notion of object is so
988: broad and why paragraphs and enumerations are also considered to be objects.
989: These object classes not only permit the sharing of the structures of
990: elements, but also of the attributes defined in the generic structures.</P>
991: <P>
992: Structure, such as that presented here, can appear very rigid, and it is
993: possible to imagine that a document editing system based on this model could
994: prove very constraining to the user. This is, in fact, a common criticism of
995: syntax-directed editors. This defect can be avoided with Thot, primarily for
996: three reasons:</P>
997: <UL>
998: <LI>the generic structures are not fixed in the model itself,
999: <LI>the model takes the dynamics of documents into account,
1000: <LI>the constructors offer great flexibility.
1001: </UL>
1002: <P>
1003: When the generic structure of a document is not predefined, but rather is
1004: constructed specifically for each document class, it can be carefully adapted
1005: to the current needs. In cases where the generic structure is inadequate for
1006: a particular document of the class, it is always possible either to create a
1007: new class with a generic structure well suited to the new case or to extend
1008: the generic structure of the existing class to take into account the specifics
1009: of the document which poses the problem. These two solutions can also be
1010: applied to objects whose structures prove to be poorly designed.</P>
1011: <P>
1012: The model is sufficiently flexible to take into account all the phases of the
1013: life of the document. When a generic structure specifies that a report must
1014: contain a title, an abstract, an introduction, at least two chapters, and a
1015: conclusion, this means only that a report, <EM>upon completion</EM>, will have
1016: to contain all of these elements. When the author begins writing, none of
1.2 cvs 1017: these elements is present. Thot uses this model. Therefore, it tolerates
1018: documents which do not conform strictly to the generic structure of their
1019: class; it also considers the generic logical structure to be a way of helping
1020: the user in the construction of a complex document.</P>
1.1 cvs 1021: <P>
1022: In contrast, other applications may reject a document which does not conform
1023: strictly to its generic structure. This is, for example, what is done by
1024: compilers which refuse to generate code for a program which is not
1025: syntactically correct. This might also occur when using a document
1026: application for a report which does not have an abstract or title.</P>
1027: <P>
1028: The constructors of the document model bring a great flexibility to the
1029: generic structures. A choice constructor (and even more, a unit or schema
1030: constructor) can represent several, very different elements. The list
1031: constructor permits the addition of more elements of the same type. Used
1032: together, these two constructors permit any series of elements of different
1033: types. Of course, this flexibility can be reduced wherever necessary since a
1034: generic structure can limit the choices or the number of elements in a
1035: list.</P>
1036: <P>
1037: Another difficulty linked to the use of structure in the document model
1038: resides in the choice of the level of the structure. The structure of a
1039: discussion could be extracted from the text itself via linguistic analysis.
1040: Some studies are exploring this approach, but the model of Thot excludes this
1041: type of structure. It only takes into account the logical structure provided
1042: explicitly by the author.</P>
1043: <P>
1044: However, the level of structure of the model is not imposed. Each generic
1045: structure defines its own level of structure, adapted to the document class or
1046: object and to the ways in which it will be processed. If it will only be
1047: edited and printed, a relatively simple structure suffices. If more
1048: specialized processing will be applied to it, the structure must represent the
1049: element types on which this processing must act. By way of example, a simple
1050: structure is sufficient for printing formulas, but a more complex structure is
1051: required to perform symbolic or numeric calculations on the mathematical
1052: expressions. The document model of Thot allows both types of structure.</P>
1053: </DIV>
1054: </DIV>
1055:
1056: <DIV class="section">
1.6 cvs 1057: <H2><A name=sectb32>The definition language for generic structures</A></H2>
1.1 cvs 1058:
1059: <P>
1060: Generic structures, which form the basis of the document model of Thot, are
1061: specified using a special language. This definition language, called S, is
1062: described in this section.</P>
1063: <P>
1064: Each generic structure, which defines a class of documents or objects, is
1.2 cvs 1065: specified by a file, written in the S language, which is called a
1.1 cvs 1066: <EM>structure schema</EM>. Structure schemas are compiled into tables, called
1.2 cvs 1067: structure tables, which are used by Thot and which determine its behavior.</P>
1.1 cvs 1068:
1069: <DIV class="subsection">
1.6 cvs 1070: <H3><A name=sectc321>Writing Conventions</A></H3>
1.1 cvs 1071:
1072: <P>
1073: The grammar of S, like those of the languages P and T presented later, is
1074: described using the meta-language M, derived from the Backus-Naur Form
1075: (BNF).</P>
1076: <P>
1077: In this meta-language each rule of the grammar is composed of a grammar symbol
1078: followed by an equals sign (`=') and the right part of the rule. The equals
1079: sign plays the same role as the traditional `::=' of BNF: it indicates that
1080: the right part defines the symbol of the left part. In the right part,</P>
1081: <DL>
1082: <DT>concatenation</DT>
1083: <DD>is shown by the juxtaposition of symbols;
1084: </DD>
1085: <DT>character strings</DT>
1.2 cvs 1086: <DD>between apostrophes ' represent terminal symbols, that is, keywords in the
1087: language defined. Keywords are written here in upper-case letters, but can be
1088: written in any combination of upper and lower-case letters. For example, the
1089: keyword <TT>DEFPRES</TT> of S can also be written as <TT>defpres</TT> or
1090: <TT>DefPres</TT>.
1.1 cvs 1091: </DD>
1092: <DT>material between brackets</DT>
1093: <DD>(`[' and `]') is optional;
1094: </DD>
1095: <DT>material between angle brackets</DT>
1.2 cvs 1096: <DD>(`<' and `>') can be repeated many times or omitted;
1.1 cvs 1097: </DD>
1098: <DT>the slash</DT>
1.2 cvs 1099: <DD>(`/') indicates an alternative, a choice between the options separated by
1.1 cvs 1100: the slash character;
1101: </DD>
1102: <DT>the period</DT>
1103: <DD>marks the end of a rule;
1104: </DD>
1105: <DT>text between braces</DT>
1106: <DD>(`{' and `}') is simply a comment.
1107: </DD>
1108: </DL>
1109: <P>
1110: The M meta-language also uses the concepts of identifiers, strings, and
1111: integers:</P>
1112: <DL>
1113: <DT><TT>NAME</TT></DT>
1.2 cvs 1114: <DD>represents an identifier, a sequence of letters (upper or lower-case),
1115: digits, and underline characters (`_'), beginning with a letter. Also
1116: considered a letter is the sequence of characters `<TT>\nnn</TT>' where the
1.5 cvs 1117: letter <TT>n</TT> represents the ISO Latin-1 code of the letter in octal. It
1.2 cvs 1118: is thus possible to use accented letters in identifiers. The maximum length
1119: of identifiers is fixed by the compiler. It is normally 31 characters.
1.1 cvs 1120: <P>
1121: Unlike keywords, upper and lower-case letters are distinct in identifiers.
1122: Thus, <TT>Title</TT>, <TT>TITLE</TT>, and <TT>title</TT> are considered
1123: different identifiers.</P>
1124: </DD>
1125: <DT><TT>STRING</TT></DT>
1.2 cvs 1126: <DD>represents a string. This is a string of characters delimited by
1127: apostrophes. If an apostrophe must appear in a string, it is doubled. As
1128: with identifiers, strings can contain characters represented by their octal
1129: code (after a backslash). As with apostrophes, if a backslash must appear in
1130: a string, it is doubled.
1.1 cvs 1131: </DD>
1132: <DT><TT>NUMBER</TT></DT>
1.2 cvs 1133: <DD>represents a positive integer or zero (without a sign), or said another
1.1 cvs 1134: way, a sequence of decimal digits.
1135: </DD>
1136: </DL>
1137: <P>
1138: The M language can be used to define itself as follows:</P>
1139: <PRE>
1140: { Any text between braces is a comment. }
1141: Grammar = Rule < Rule > 'END' .
1142: { The < and > signs indicate zero }
1143: { or more repetitions. }
1144: { END marks the end of the grammar. }
1145: Rule = Ident '=' RightPart '.' .
1146: { The period indicates the end of a rule }
1147: RightPart = RtTerminal / RtIntermed .
1148: { The slash indicates a choice }
1149: RtTerminal ='NAME' / 'STRING' / 'NUMBER' .
1150: { Right part of a terminal rule }
1151: RtIntermed = Possibility < '/' Possibility > .
1152: { Right part of an intermediate rule }
1153: Possibility = ElemOpt < ElemOpt > .
1154: ElemOpt = Element / '[' Element < Element > ']' /
1155: '<' Element < Element > '>' .
1156: { Brackets delimit optional parts }
1157: Element = Ident / KeyWord .
1158: Ident = NAME .
1159: { Identifier, sequence of characters }
1160: KeyWord = STRING .
1161: { Character string delimited by apostrophes }
1162: END
1163: </PRE>
1164: </DIV>
1165:
1166: <DIV class="subsection">
1.6 cvs 1167: <H3><A name=sectc322>Extension schemas</A></H3>
1.1 cvs 1168:
1169: <P>
1170: A structure schema defines the generic logical structure of a class of
1171: documents or objects, independent of the operations which can be performed on
1172: the documents. However, certain applications may require particular
1173: information to be represented by the structure for the documents that they
1174: operate on. Thus a document version manager will need to indicate in the
1175: document the parts which belong to one version or another. An indexing system
1176: will add highly-structured index tables as well as the links between these
1177: tables and the rest of the document.</P>
1178: <P>
1.2 cvs 1179: Thus, many applications need to extend the generic structure of the documents
1180: on which they operate to introduce new attributes, associated elements or
1.1 cvs 1181: element types. These additions are specific to each application and must be
1182: able to be applied to any generic structure: users will want to manage
1183: versions or construct indices for many types of documents. Extension schemas
1184: fulfill this role: they define attributes, elements, associated elements,
1185: units, etc., but they can only be used jointly with a structure schema that
1186: they complete. Otherwise, structure schemas can always be used without these
1187: extensions when the corresponding applications are not available.</P>
1188: </DIV>
1189:
1190: <DIV class="subsection">
1.6 cvs 1191: <H3><A name=sectc323>The general organization of structure schemas</A></H3>
1.1 cvs 1192:
1193: <P>
1194: Every structure schema begins with the keyword <TT>STRUCTURE</TT> and ends
1195: with the keyword <TT>END</TT>. The keyword <TT>STRUCTURE</TT> is followed by
1196: the keyword <TT>EXTENSION</TT> in the case where the schema defines an
1197: extension, then by the name of the generic structure which the schema defines
1198: (the name of the document or object class). The name of the structure is
1199: followed by a semicolon.</P>
1200: <P>
1201: In the case of a complete schema (that is, a schema which is not an
1202: extension), the definition of the name of the structure is followed by the
1203: declarations of the default presentation schema, the global attributes, the
1204: parameters, the structure rules, the associated elements, the units, the
1205: skeleton elements and the exceptions. Only the definition of the structure
1206: rules is required. Each series of declarations begins with a keyword:
1207: <TT>DEFPRES</TT>, <TT>ATTR</TT>, <TT>PARAM</TT>, <TT>STRUCT</TT>,
1208: <TT>ASSOC</TT>, <TT>UNITS</TT>, <TT>EXPORT</TT>, <TT>EXCEPT</TT>.</P>
1209: <P>
1210: In the case of an extension schema, there are neither parameters nor skeleton
1211: elements and the <TT>STRUCT</TT> section is optional, while that section is
1212: required in a schema that is not an extension. On the other hand, extension
1213: schemas can contain an <TT>EXTENS</TT> section, which must not appear in a
1214: schema which is not an extension; this section defines the complements to
1215: attach to the rules found in the schema to which the extension will be added.
1216: The sections <TT>ATTR</TT>, <TT>STRUCT</TT>, <TT>ASSOC</TT>, and
1217: <TT>UNITS</TT> define new attributes, new elements, new associated elements,
1218: and new units which add their definitions to the principal schema.</P>
1219: <PRE>
1220: StructSchema ='STRUCTURE' ElemID ';'
1221: 'DEFPRES' PresID ';'
1222: [ 'ATTR' AttrSeq ]
1223: [ 'PARAM' RulesSeq ]
1224: 'STRUCT' RulesSeq
1225: [ 'ASSOC' RulesSeq ]
1226: [ 'UNITS' RulesSeq ]
1227: [ 'EXPORT' SkeletonSeq ]
1228: [ 'EXCEPT' ExceptSeq ]
1229: 'END' .
1230: ElemID = NAME .
1231: </PRE>
1232: <P>
1233: or</P>
1234: <PRE>
1235: ExtensSchema ='STRUCTURE' 'EXTENSION' ElemID ';'
1236: 'DEFPRES' PresID ';'
1237: [ 'ATTR' AttrSeq ]
1238: [ 'STRUCT' RulesSeq ]
1239: [ 'EXTENS' ExtensRuleSeq ]
1240: [ 'ASSOC' RulesSeq ]
1241: [ 'UNITS' RulesSeq ]
1242: [ 'EXCEPT' ExceptSeq ]
1243: 'END' .
1244: ElemID = NAME .
1245: </PRE>
1246: </DIV>
1247:
1248: <DIV class="subsection">
1.6 cvs 1249: <H3><A name=sectc324>The default presentation</A></H3>
1.1 cvs 1250:
1251: <P>
1252: It was shown <A href="#mulpres">above</A> that many different presentations
1253: are possible for documents and objects of the same class. The structure
1254: schema defines a preferred presentation for the class, called the <EM>default
1255: presentation</EM>. Like generic structures, presentations are described by
1256: programs, called <EM>presentation schemas</EM>, which are written in a
1.6 cvs 1257: specific language, P, presented <A href="#sectb42">later</A> in this document.
1.1 cvs 1258: The name appearing after the keyword <TT>DEFPRES</TT> is the name of the
1.2 cvs 1259: default presentation schema. When a new document is created, Thot will use
1260: this presentation schema by default, but the user remains free to choose
1.5 cvs 1261: another if s/he wishes.</P>
1.1 cvs 1262: <PRE>
1263: PresID = NAME .
1264: </PRE>
1265: </DIV>
1266:
1267: <DIV class="subsection">
1.6 cvs 1268: <H3><A name=sectc325>Global Attributes</A></H3>
1.1 cvs 1269:
1270: <P>
1271: If the generic structure includes global attributes of its own, they are
1272: declared after the keyword <TT>ATTR</TT>. Each global attribute is defined by
1273: its name, followed by an equals sign and the definition of its type. The
1274: declaration of a global attribute is terminated by a semi-colon.</P>
1275: <P>
1276: For attributes of the numeric, textual, or reference types, the type is
1277: indicated by a keyword, <TT>INTEGER</TT>, <TT>TEXT</TT>, or <TT>REFERENCE</TT>
1278: respectively.</P>
1279: <P>
1280: In the case of a reference attribute, the keyword <TT>REFERENCE</TT> is
1281: followed by the type of the referenced element in parentheses. It can refer
1282: to any type at all, specified by using the keyword <TT>ANY</TT>, or to a
1283: specific type. In the latter case, the element type designated by the
1.6 cvs 1284: reference can be defined either in the <A href="#sectc327"><TT>STRUCT</TT>
1.1 cvs 1285: section</A> of the same structure schema or in the <TT>STRUCT</TT> section of
1286: another structure schema. When the type is defined in another schema, the
1287: element type is followed by the name of the structure schema (within
1288: parentheses) in which it is defined. The name of the designated element type
1289: can be preceded by the keyword <TT>First</TT> or <TT>Second</TT>, but only in
1.6 cvs 1290: the case where the type is defined as <A href="#sectd3285">a pair</A>. These
1.1 cvs 1291: keywords indicate whether the attribute must designate the first mark of the
1292: pair or the second. If the reference refers to a pair and neither of these
1293: two keywords is present, then the first mark is used.</P>
1294: <P>
1295: In the case of an enumeration attribute, the equals sign is followed by the
1296: list of names representing the possible values of the attribute, the names
1297: being separated from each other by commas. An enumeration attribute has at
1298: least one possible value; the maximum number of values is defined by the
1299: compiler for the S language.</P>
1300: <PRE>
1301: AttrSeq = Attribute < Attribute > .
1302: Attribute = AttrID '=' AttrType ';' .
1303: AttrType = 'INTEGER' / 'TEXT' /
1304: 'REFERENCE' '(' RefType ')' /
1305: ValueSeq .
1306: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] .
1307: FirstSec = 'First' / 'Second' .
1308: ExtStruct = '(' ElemID ')' .
1309: ValueSeq = AttrVal < ',' AttrVal > .
1310: AttrID = NAME .
1311: AttrVal = NAME .
1312: </PRE>
1313: <P>
1314: There is a predefined global text attribute, the <EM>language</EM>, which is
1.2 cvs 1315: automatically added to every Thot structure schema. This attribute allows
1316: Thot to perform certain actions, such as hyphenation and spell-checking, which
1317: cannot be performed without knowing the language in which each part of the
1318: document is written. This attribute can be used just like any explicitly
1.1 cvs 1319: declared attribute: the system acts as if every structure schema contains</P>
1320: <PRE>
1321: ATTR
1322: Language = TEXT;
1323: </PRE>
1324: <BLOCKQUOTE class="example">
1325: <P>
1326: <STRONG>Example:</STRONG></P>
1327: <P>
1.2 cvs 1328: The following specification defines the global enumeration attribute
1329: WordType.</P>
1.1 cvs 1330: <PRE>
1331: ATTR
1.6 cvs 1332: WordType = Definition, IndexWord, DocumentTitle;
1.1 cvs 1333: </PRE>
1334: </BLOCKQUOTE>
1335: </DIV>
1336:
1337: <DIV class="subsection">
1.6 cvs 1338: <H3><A name=sectc326>Parameters</A></H3>
1.1 cvs 1339:
1340: <P>
1341: A parameter is a document element which can appear many times in the document,
1342: but always has the same value. This value can only be modified in a
1343: controlled way by certain applications. For example, in an advertising
1344: circular, the name of the recipient may appear in the address part and in the
1345: text of the circular. If the recipient's name were a parameter, it might only
1346: be able to be changed by a ``mail-merge'' application.</P>
1347: <P>
1348: Parameters are not needed for every document class, but if the schema includes
1349: parameters they are declared after the keyword <TT>PARAM</TT>. Each parameter
1.6 cvs 1350: declaration is made in the same way as a <A href="#sectc327">structure
1.1 cvs 1351: element declaration</A>.</P>
1352: <P>
1353: During editing, Thot permits the insertion of parameters wherever the
1354: structure schema allows; it also permits the removal of parameters which are
1355: already in the document but does not allow the modification of the parameter's
1.2 cvs 1356: content in any way. The content is generated automatically by Thot during the
1357: creation of the parameter, based on the value of the parameter in the
1358: document.</P>
1.1 cvs 1359: </DIV>
1360:
1361: <DIV class="subsection">
1.6 cvs 1362: <H3><A name=sectc327>Structured elements</A></H3>
1.1 cvs 1363:
1364: <P>
1365: The rules for defining structured elements are required, except in an
1366: extension schema: they constitute the core of a structure schema, since they
1367: define the structure of the different types of elements that occur in a
1368: document or object of the class defined by the schema.</P>
1369: <P>
1370: The first structure rule after the keyword <TT>STRUCT</TT> must define the
1371: structure of the class whose name appears in the first instruction
1372: (<TT>STRUCTURE</TT>) of the schema. This is the root rule of the schema,
1373: defining the root of the document tree or object tree.</P>
1374: <P>
1375: The remaining rules may be placed in any order, since the language permits the
1376: definition of element types before or after their use, or even in the same
1377: instruction in which they are used. This last case allows the definition of
1378: recursive structures.</P>
1379: <P>
1380: Each rule is composed of a name (the name of the element type whose structure
1381: is being defined) followed by an equals sign and a structure definition.</P>
1382: <P>
1383: If any local attributes are associated with the element type defined by the
1.2 cvs 1384: rule, they appear between parentheses after the type name and before the
1385: equals sign. The parentheses contain, first, the keyword <TT>ATTR</TT>, then
1386: the list of local attributes, separated by commas. Each local attribute is
1387: composed of the name of the attribute followed by an equals sign and the
1388: definition of the attribute's type, just as in the definition of <A
1.6 cvs 1389: href="#sectc325">global attributes</A>. The name of the attribute can be
1.2 cvs 1390: preceded by an exclamation point to indicate that the attribute must always be
1391: present for this element type. The same attribute, identified by its name,
1392: can be defined as a local attribute for multiple element types. In this
1393: case, the equals sign and definition of the attribute type need only appear in
1394: the first occurrence of the attribute. It should be noted that global
1395: attributes cannot also be defined as local attributes.</P>
1.1 cvs 1396: <P>
1.6 cvs 1397: If any <A href="#sectd3135">extensions</A> are defined for this
1.1 cvs 1398: element type, a plus sign follows the structure definition and the names of
1399: the extension element types appear between parentheses after the plus. If
1400: there are multiple extensions, they are separated by commas. These types can
1401: either be defined in the same schema, defined in other schemas, or they may be
1402: base types identified by the keywords <TT>TEXT</TT>, <TT>GRAPHICS</TT>,
1403: <TT>SYMBOL</TT>, or <TT>PICTURE</TT>.</P>
1404: <P>
1.6 cvs 1405: <A href="#sectd3135">Restrictions</A> are indicated in the same
1.1 cvs 1406: manner as extensions, but they are introduced by a minus sign and they come
1407: after the extensions, or if there are no extensions, after the structure
1408: definition.</P>
1409: <P>
1410: If the values of attributes must be attached systematically to this element
1411: type, they are introduced by the keyword <TT>WITH</TT> and declared in the
1412: form of a list of fixed-value attributes. When such definitions of fixed
1413: attribute values appear, they are always the last part of the rule.</P>
1414: <P>
1415: The rule is terminated by a semicolon.</P>
1416: <PRE>
1417: RuleSeq = Rule < Rule > .
1418: Rule = ElemID [ LocAttrSeq ] '=' DefWithAttr ';'.
1419: LocAttrSeq = '(' 'ATTR' LocAttr < ';' LocAttr > ')' .
1420: LocAttr = [ '!' ] AttrID [ '=' AttrType ] .
1421: DefWithAttr = Definition
1422: [ '+' '(' ExtensionSeq ')' ]
1423: [ '-' '(' RestrictSeq ')' ]
1424: [ 'WITH' FixedAttrSeq ] .
1425: ExtensionSeq = ExtensionElem < ',' ExtensionElem > .
1426: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' /
1427: 'SYMBOL' / 'PICTURE' .
1428: RestrictSeq = RestrictElem < ',' RestrictElem > .
1429: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' /
1430: 'SYMBOL' / 'PICTURE' .
1431: </PRE>
1432: <P>
1433: The list of fixed-value attributes is composed of a sequence of
1434: attribute-value pairs separated by commas. Each pair contains the name of the
1435: attribute and the fixed value for this element type, the two being separated
1436: by an equals sign. If the sign is preceded by a question mark the given value
1437: is only an initial value that may be modified later rather than a value fixed
1438: for all time. Reference attributes are an exception to this norm. They
1439: cannot be assigned a fixed value, but when the name of such an attribute
1440: appears this indicates that this element type must have a valid value for the
1.2 cvs 1441: attribute. For the other attribute types, the fixed value is indicated by a
1.1 cvs 1442: signed integer (numeric attributes), a character string between apostrophes
1443: (textual attributes) or the name of a value (enumeration attributes).</P>
1444: <P>
1.6 cvs 1445: Fixed-value attributes can either be <A href="#sectc325">global</A> or local
1.1 cvs 1446: to the element type for which they are fixed, but they must be declared before
1447: they are used.</P>
1448: <PRE>
1449: FixedAttrSeq = FixedAttr < ',' FixedAttr > .
1450: FixedAttr = AttrID [ FixedOrModifVal ] .
1451: FixedOrModifVal = [ '?' ] '=' FixedValue .
1452: FixedValue = [ '-' ] NumValue / TextVal / AttrVal .
1453: NumValue = NUMBER .
1454: TextVal = STRING .
1455: </PRE>
1456: </DIV>
1457:
1458: <DIV class="subsection">
1.6 cvs 1459: <H3><A name=sectc328>Structure definitions</A></H3>
1.1 cvs 1460:
1461: <P>
1462: The structure of an element type can be a simple base type or a constructed
1463: type.</P>
1464: <P>
1465: For constructed types, it is frequently the case that similar structures
1466: appear in many places in a document. For example the contents of the
1467: abstract, of the introduction, and of a section can have the same structure,
1468: that of a sequence of paragraphs. In this case, a single, common structure
1469: can be defined (the paragraph sequence in this example), and the schema is
1470: written to indicate that each element type possesses this structure, as
1471: follows:</P>
1472: <PRE>
1473: Abstract = Paragraph_sequence;
1474: Introduction = Paragraph_sequence;
1475: Section_contents = Paragraph_sequence;
1476: </PRE>
1477: <P>
1478: The equals sign means ``has the same structure as''.</P>
1479: <P>
1480: If the element type defined is a simple base type, this is indicated by one of
1481: the keywords <TT>TEXT</TT>, <TT>GRAPHICS</TT>, <TT>SYMBOL</TT>, or
1482: <TT>PICTURE</TT>. If some local attributes must be associated with a base
1483: type, the keyword of the base type is followed by the declaration of the local
1.6 cvs 1484: attributes using the syntax <A href="#sectc327">presented above.</A></P>
1.1 cvs 1485: <P>
1486: In the case of an open choice, the type is indicated by the keyword
1.2 cvs 1487: <TT>UNIT</TT> for units or the keyword <TT>NATURE</TT> for objects having a
1488: structure defined by any other schema.</P>
1.1 cvs 1489: <P>
1490: A unit represents one of the two following categories:</P>
1491: <UL>
1.2 cvs 1492: <LI>a base type: text, graphical element, symbol, picture,
1493: <LI>an element whose type is chosen from among the types defined as units in
1.5 cvs 1494: the <TT>UNITS</TT> section of the document's structure schema. It can also be
1.6 cvs 1495: chosen from among the types defined as <A href="#sectd3132">units</A> in
1496: the <A href="#sectc3212"><TT>UNITS</TT> section</A> of the structure schemas that
1.2 cvs 1497: defines the ancestors of the element to which the rule is applied.
1.1 cvs 1498: </UL>
1499: <P>
1.2 cvs 1500: Before the creation of an element defined as a unit, Thot asks the user to
1501: choose between the categories of elements.</P>
1.1 cvs 1502: <P>
1503: Thus, the contents of a paragraph can be specified as a sequence of units,
1504: which will permit the inclusion in the paragraphs of character strings,
1505: symbols, and various elements, such as cross-references, if these are defined
1506: as units.</P>
1507: <P>
1508: A schema object (keyword <TT>NATURE</TT>) represents an object defined by a
1509: structure schema freely chosen from among the available schemas; in the case
1510: the element type is defined by the first rule (the root rule) of the chosen
1511: schema.</P>
1512: <P>
1513: If the element type defined is a constructed type, the list, aggregate,
1514: choice, and reference constructors are used. In this case the definition
1515: begins with a keyword identifying the constructor. This keyword is followed
1516: by a syntax specific to each constructor.</P>
1517: <P>
1518: The local attribute definitions appear after the name of the element type
1.6 cvs 1519: being defined, if this element type has <A href="#sectc327">local
1.1 cvs 1520: attributes</A>.</P>
1521: <PRE>
1522: Definition = BaseType [ LocAttrSeq ] / Constr / Element .
1523: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 'PICTURE' /
1524: 'UNIT' / 'NATURE' .
1525: Element = ElemID [ ExtOrDef ] .
1526: ExtOrDef = 'EXTERN' / 'INCLUDED' /
1527: [ LocAttrSeq ] '=' Definition .
1528: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF'
1529: '(' DefWithAttr ')' /
1530: 'BEGIN' DefOptSeq 'END' /
1531: 'AGGREGATE' DefOptSeq 'END' /
1532: 'CASE' 'OF' DefSeq 'END' /
1533: 'REFERENCE' '(' RefType ')' /
1534: 'PAIR' .
1535: </PRE>
1536:
1537: <DIV class="subsubsection">
1.6 cvs 1538: <H4><A name=sectd3281>List</A></H4>
1.1 cvs 1539:
1540: <P>
1541: The list constructor permits the definition of an element type composed of a
1542: list of elements, all of the same type. A list definition begins with the
1543: <TT>LIST</TT> keyword followed by an optional range, the keyword <TT>OF</TT>,
1544: and the definition, between parentheses, of the element type which must
1545: compose the list. The optional range is composed of the minimum and maximum
1546: number of elements for the list separated by two periods and enclosed by
1547: brackets. If the range is not present, the number of list elements is
1548: unconstrained. When only one of the two bounds of the range is unconstrained,
1549: it is represented by a star ('*') character. Even when both bounds are
1550: unconstrained, they can be specified by <TT>[*..*]</TT>, but it is simpler not
1551: to specify any bound.</P>
1552: <PRE>
1553: 'LIST' [ '[' min '..' max ']' ]
1554: 'OF' '(' DefWithAttr ')'
1555: min = Integer / '*' .
1556: max = Integer / '*' .
1557: Integer = NUMBER .
1558: </PRE>
1559: <P>
1.2 cvs 1560: Before the document is edited, Thot creates the minimum number of elements for
1561: the list. If no minimum was given, it creates a single element. If a maximum
1562: number of elements is given and that number is attained, the editor refuses to
1563: create new elements for the list.</P>
1.1 cvs 1564: <BLOCKQUOTE class="example">
1565: <P>
1566: <STRONG>Example:</STRONG></P>
1567: <P>
1.3 cvs 1568: The following two instructions define the body of a document as a sequence of
1569: at least two chapters and the contents of a section as a sequence of
1570: paragraphs. A single paragraph can be the entire contents of a section.</P>
1.1 cvs 1571: <PRE>
1572: Body = LIST [2..*] OF (Chapter);
1573: Section_contents = LIST OF (Paragraph);
1574: </PRE>
1575: </BLOCKQUOTE>
1576: </DIV>
1577:
1578: <DIV class="subsubsection">
1.6 cvs 1579: <H4><A name=sectd3282>Aggregate</A></H4>
1.1 cvs 1580:
1581: <P>
1582: The aggregate constructor is used to define an element type as a collection of
1583: sub-elements, each having a fixed type. The collection may be ordered or
1584: unordered. The elements composing the collection are called
1585: <EM>components</EM>. In the definition of an aggregate, a keyword indicates
1586: whether or not the aggregate is ordered: <TT>BEGIN</TT> for an ordered
1587: aggregate, <TT>AGGREGATE</TT> for an unordered aggregate. This keyword is
1588: followed by the list of component type definitions which is terminated by the
1589: <TT>END</TT> keyword. The component type definitions are separated by
1590: commas.</P>
1591: <P>
1592: Before creating an aggregate, the Thot editor creates all the aggregate's
1593: components in the order they appear in the structure schema, even for
1594: unordered aggregates. However, unlike ordered aggregates, the components of
1595: an unordered aggregate may be rearranged using operations of the Thot editor.
1596: The exceptions to the rule are any components whose name was preceded by a
1597: question mark character ('?'). These components, which are optional, can be
1598: created by explicit request, possibly at the time the aggregate is created,
1599: but they are not created automatically <EM>prior</EM> to the creation of the
1600: aggregate.</P>
1601: <PRE>
1602: 'BEGIN' DefOptSeq 'END'
1603: DefOptSeq = DefOpt ';' < DefOpt ';' > .
1604: DefOpt = [ '?' ] DefWithAttr .
1605: </PRE>
1606: <BLOCKQUOTE class="example">
1607: <P>
1608: <STRONG>Example:</STRONG></P>
1609: <P>
1.3 cvs 1610: In a bilingual document, each paragraph has an English version and a French
1611: version. In certain cases, the translator wants to add a marginal note, but
1612: this note is present in very few paragraphs. Thus, it must not be created
1613: systematically for every paragraph. A bilingual paragraph of this type is
1.1 cvs 1614: declared:</P>
1615: <PRE>
1616: Bilingual_paragraph = BEGIN
1617: French_paragraph = TEXT;
1618: English_paragraph = TEXT;
1619: ? Note = TEXT;
1620: END;
1621: </PRE>
1622: </BLOCKQUOTE>
1623: </DIV>
1624:
1625: <DIV class="subsubsection">
1.6 cvs 1626: <H4><A name=sectd3283>Choice</A></H4>
1.1 cvs 1627:
1628: <P>
1629: The choice constructor permits the definition of an element type which is
1630: chosen from among a set of possible types. The keywords <TT>CASE</TT> and
1631: <TT>OF</TT> are followed by a list of definitions of possible types, which are
1632: separated by semicolons and terminated by the <TT>END</TT> keyword.</P>
1633: <PRE>
1634: 'CASE' 'OF' DefSeq 'END'
1635: DefSeq = DefWithAttr ';' < DefWithAttr ';' > .
1636: </PRE>
1637: <P>
1638: Before the creation of an element defined as a choice, the Thot editor
1639: presents the list of possible types for the element to the user. The user has
1.5 cvs 1640: only to select the element type that s/he wants to create from this list.</P>
1.1 cvs 1641: <P>
1642: The order of the type declarations is important. It determines the order of
1643: the list presented to the user before the creation of the element. Also, when
1644: a Choice element is being created automatically, the first type in the list is
1645: used. In fact, using the Thot editor, when an empty Choice element is
1646: selected, it is possible to select this element and to enter its text from
1647: keyboard. In this case, the editor uses the first element type which can
1648: contain an atom of the character string type.</P>
1649: <P>
1650: The two special cases of the choice constructor, the <A
1.6 cvs 1651: href="#sectc328"><EM>schema</EM></A> and the <A
1652: href="#sectc3212"><EM>unit</EM></A> are discussed elsewhere.</P>
1.1 cvs 1653: <BLOCKQUOTE class="example">
1654: <P>
1655: <STRONG>Example:</STRONG></P>
1656: <P>
1.3 cvs 1657: It is common in documents to treat a variety of objects as if they were
1658: ordinary paragraphs. Thus, a ``Paragraph'' might actually be composed of a
1659: block of text (an ordinary paragraph), or a mathematical formula whose
1660: structure is defined by another structure schema named Math, or a table, also
1661: defined by another structure schema. Here is a definition of such a
1.1 cvs 1662: paragraph:</P>
1663: <PRE>
1664: Paragraph = CASE OF
1665: Simple_text = TEXT;
1666: Formula = Math;
1667: Table_para = Table;
1668: END;
1669: </PRE>
1670: </BLOCKQUOTE>
1671: </DIV>
1672:
1673: <DIV class="subsubsection">
1.6 cvs 1674: <H4><A name=sectd3284>Reference</A></H4>
1.1 cvs 1675:
1676: <P>
1677: Like all elements in Thot, references are typed. An element type defined as a
1678: reference is a cross-reference to an element of some other given type. The
1679: keyword <TT>REFERENCE</TT> is followed by the name of a type enclosed in
1680: parentheses. When the type which is being cross-referenced is defined in
1681: another structure schema, the type name is itself followed by the name of the
1682: external structure schema in which it is defined.</P>
1683: <P>
1.6 cvs 1684: When the designated element type is a <A href="#sectd3285">mark pair</A>, it can
1.1 cvs 1685: be preceded by a <TT>FIRST</TT> or <TT>SECOND</TT> keyword. These keywords
1686: indicate whether the reference points to the first or second mark of the pair.
1687: If the reference points to a pair and neither of these two keywords is
1688: present, the reference is considered to point to the first mark of the
1689: pair.</P>
1690: <P>
1691: There is an exception to the principle of typed references: it is possible to
1692: define a reference which designates an element of any type, which can either
1693: be in the same document or another document. In this case, it suffices to put
1694: the keyword <TT>ANY</TT> in the parentheses which indicate the referenced
1695: element type.</P>
1696: <PRE>
1697: 'REFERENCE' '(' RefType ')'
1698: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] .
1699: </PRE>
1700: <P>
1701: When defining an inclusion, the <TT>REFERENCE</TT> keyword is not used.
1702: Inclusions with complete expansion are not declared as such in the structure
1703: schemas, since any element defined in a structure schema can be replaced by an
1704: element of the same type. Instead, inclusions without expansion or with
1705: partial expansion must be declared explicitly whenever they will include a
1706: complete object ( and not a part of an object). In this case, the object type
1707: to be included (that is, the name of its structure schema) is followed by a
1708: keyword: <TT>EXTERN</TT> for inclusion without expansion and <TT>INCLUDED</TT>
1709: for partial expansion.</P>
1710: <P>
1711: Before creating a cross-reference or an inclusion, the Thot editor asks the
1712: user to choose, from the document images displayed, the referenced or included
1713: element.</P>
1714: <BLOCKQUOTE class="example">
1715: <P>
1716: <STRONG>Example:</STRONG></P>
1717: <P>
1.3 cvs 1718: If the types Note and Section are defined in the Article structure schema, it
1719: is possible to define, in the same structure schema, a reference to a note and
1720: a reference to a section in this manner:</P>
1.1 cvs 1721: <PRE>
1722: Ref_note = REFERENCE (Note);
1723: Ref_section = REFERENCE (Section);
1724: </PRE>
1725: <P>
1726: It is also possible to define the generic structure of a collection of
1727: articles, which include (with partial expansion) objects of the Article class
1728: and which possess an introduction which may include cross-references to
1729: sections of the included articles. In the Collection structure schema, the
1730: definitions are:</P>
1731: <PRE>
1732: Collection = BEGIN
1.6 cvs 1733: Collection_title = TEXT;
1734: Introduction = LIST OF (Elem = CASE OF
1.1 cvs 1735: TEXT;
1736: Ref_sect;
1737: END);
1.6 cvs 1738: Body = LIST OF (Article INCLUDED);
1739: END;
1740: Ref_sect = REFERENCE (Section (Article));
1.1 cvs 1741: </PRE>
1742: <P>
1743: Here we define a Folder document class which has a title and includes
1744: documents of different types, particularly Folders:</P>
1745: <PRE>
1.6 cvs 1746: Folder = BEGIN
1747: Folder_title = TEXT;
1748: Folder_contents = LIST OF (Document);
1749: END;
1.1 cvs 1750:
1751: Document = CASE OF
1752: Article EXTERN;
1753: Collection EXTERN;
1754: Folder EXTERN;
1755: END;
1756: </PRE>
1757: <P>
1758: Under this definition, Folder represents either an aggregate which contains a
1759: folder title and the list of included documents or an included folder. To
1760: resolve this ambiguity, in the P language, the placement of a star character
1761: in front of the type name (here, Folder) indicates an included document.</P>
1762: </BLOCKQUOTE>
1763: </DIV>
1764:
1765: <DIV class="subsubsection">
1.6 cvs 1766: <H4><A name=sectd3285>Mark pairs</A></H4>
1.1 cvs 1767:
1768: <P>
1769: Like other elements, mark pairs are typed. The two marks of the pair have the
1770: same type, but there exist two predefined subtypes which apply to all mark
1771: pairs: the first mark of the pair (called <TT>First</TT> in the P and T
1772: languages) and the second mark (called <TT>Second</TT>).</P>
1773: <P>
1774: In the S language, a mark pair is noted simply by the <TT>PAIR</TT>
1775: keyword.</P>
1776: <P>
1777: In the Thot editor, marks are always moved or destroyed together. The two
1778: marks of a pair have the same identifier, unique within the document, which
1779: permits intertwining mark pairs without risk of ambiguity.</P>
1780: </DIV>
1781: </DIV>
1782:
1783: <DIV class="subsection">
1.6 cvs 1784: <H3><A name=sectc329>Imports</A></H3>
1.1 cvs 1785:
1786: <P>
1787: Because of schema constructors, it is possible, before editing a document, to
1788: use classes defined by other structure schemas whenever they are needed. It is
1789: also possible to assign specific document classes to certain element types. In
1790: this case, these classes are simply designated by their name. In fact, if a
1791: type name is not defined in the structure schema, it is assumed that it
1792: specifies a structure defined by another structure schema.</P>
1793: <BLOCKQUOTE class="example">
1794: <P>
1795: <STRONG>Example:</STRONG></P>
1796: <P>
1.3 cvs 1797: If the types Math and Table don't appear in the left part of a structure rule
1798: in the schema, the following two rules indicate that a formula has the
1799: structure of an object defined by the structure schema Math and that a table
1800: element has the structure of an object defined by the Table schema.</P>
1.1 cvs 1801: <PRE>
1.6 cvs 1802: Formula = Math;
1.1 cvs 1803: Table_elem = Table;
1804: </PRE>
1805: </BLOCKQUOTE>
1806: </DIV>
1807:
1808: <DIV class="subsection">
1.6 cvs 1809: <H3><A name=sectc3210>Extension rules</A></H3>
1.1 cvs 1810:
1811: <P>
1812: The <TT>EXTENS</TT> section, which can only appear in an extension schema,
1813: defines complements to the rules in the primary schema (i.e. the structure
1814: schema to which the extension schema will be applied). More precisely, this
1815: section permits the addition to an existing type of local attributes,
1816: extensions, restrictions and fixed-value attributes.</P>
1817: <P>
1818: These additions can be applied to the root rule of the primary schema,
1819: designated by the keyword <TT>Root</TT>, or to any other explicitly named
1820: rule.</P>
1821: <P>
1822: Extension rules are separated from each other by a semicolon and each
1.6 cvs 1823: extension rule has the same syntax as a <A href="#sectc327">structure
1.1 cvs 1824: rule</A>, but the part which defines the constructor is absent.</P>
1825: <PRE>
1826: ExtenRuleSeq = ExtensRule ';' < ExtensRule ';' > .
1.6 cvs 1827: ExtensRule = RootOrElem [ LocAttrSeq ]
1828: [ '+' '(' ExtensionSeq ')' ]
1829: [ '-' '(' RestrictSeq ')' ]
1830: [ 'WITH' FixedAttrSeq ] .
1831: RootOrElem = 'Root' / ElemID .
1.1 cvs 1832: </PRE>
1833: </DIV>
1834:
1835: <DIV class="subsection">
1.6 cvs 1836: <H3><A name=sectc3211>Associated elements</A></H3>
1.1 cvs 1837:
1838: <P>
1839: If associated elements are necessary, they must be declared in a specific
1840: section of the structure schema, introduced by the keyword <TT>ASSOC</TT>.
1841: Each associated element type is specified like any other structured element.
1842: However, these types must not appear in any other element types of the schema,
1843: except in <TT>REFERENCE</TT> rules.</P>
1844: </DIV>
1845:
1846: <DIV class="subsection">
1.6 cvs 1847: <H3><A name=sectc3212>Units</A></H3>
1.1 cvs 1848:
1849: <P>
1850: The <TT>UNITS</TT> section of the structure schema contains the declarations
1851: of the element types which can be used in the external objects making up parts
1852: of the document or in objects of the class defined by the schema. As with
1853: associated elements, these element types are defined just like other
1854: structured element types. They can be used in the other element types of the
1855: schema, but they can also be used in any other rule of the schema.</P>
1856: <BLOCKQUOTE class="example">
1857: <P>
1858: <STRONG>Example:</STRONG></P>
1859: <P>
1860: If references to notes are declared as units:</P>
1861: <PRE>
1862: UNITS
1863: Ref_note = REFERENCE (Note);
1864: </PRE>
1865: <P>
1.3 cvs 1866: then it is possible to use references to notes in a cell of a table, even when
1.5 cvs 1867: <TT>Table</TT> is an external structure schema. The <TT>Table</TT> schema must
1.1 cvs 1868: declare a cell to be a sequence of units, which can then be base element types
1.6 cvs 1869: (text, for example) or references to notes in the document.</P>
1870: <PRE>
1.1 cvs 1871: Cell = LIST OF (UNITS);
1872: </PRE>
1873: </BLOCKQUOTE>
1874: </DIV>
1875:
1876: <DIV class="subsection">
1.6 cvs 1877: <H3><A name=sectc3213>Skeleton elements</A></H3>
1.1 cvs 1878:
1879: <P>
1880: When editing a document which contains or must contain external references to
1881: several other documents, it may be necessary to load a large number of
1882: documents, simply to see the parts designated by the external references of
1883: the document while editing, or to access the source of included elements. In
1884: this case, the external documents are not modified and it is only necessary to
1885: see the elements of these documents which could be referenced. Because of
1886: this, the editor will suggest that the documents be loaded in ``skeleton''
1887: form. This form contains only the elements of the document explicitly
1888: mentioned in the <TT>EXPORT</TT> section of their structure schema and, for
1889: these elements, only the part of the contents specified in that section. This
1890: form has the advantage of being very compact, thus requiring very few
1891: resources from the editor. This is also the skeleton form which constitutes
1892: the expanded form of <A href="#inclusion">inclusions</A> with partial
1893: expansion.</P>
1894: <P>
1895: Skeleton elements must be declared explicitly in the <TT>EXPORT</TT> section
1896: of the structure schema that defines them. This section begins with the
1897: keyword <TT>EXPORT</TT> followed by a comma-separated list of the element
1898: types which must appear in the skeleton form and ending with a semicolon.
1899: These types must have been previously declared in the schema.</P>
1900: <P>
1901: For each skeleton element type, the part of the contents which is loaded by
1902: the editor, and therefore displayable, can be specified by putting the keyword
1903: <TT>WITH</TT> and the name of the contained element type to be loaded after
1904: the name of the skeleton element type. In this case only that named element,
1905: among all the elements contained in the exportable element type, will be
1906: loaded. If the <TT>WITH</TT> is absent, the entire contents of the skeleton
1907: element will be loaded by the editor. If instead, it is better that the
1908: skeleton form not load the contents of a particular element type, the keyword
1909: <TT>WITH</TT> must be followed by the word <TT>Nothing</TT>.</P>
1910: <PRE>
1911: [ 'EXPORT' SkeletonSeq ]
1912:
1913: SkeletonSeq = SkelElem < ',' SkelElem > ';' .
1914: SkelElem = ElemID [ 'WITH' Contents ] .
1915: Contents = 'Nothing' / ElemID [ ExtStruct ] .
1916: </PRE>
1917: <BLOCKQUOTE class="example">
1918: <P>
1919: <STRONG>Example:</STRONG></P>
1920: <P>
1.3 cvs 1921: Suppose that, in documents of the article class, the element types
1922: Article_title, Figure, Section, Paragraph, and Biblio should appear in the
1923: skeleton form in order to make it easier to create external references to them
1924: from other documents. When loading an article in its skeleton form, all of
1925: these element types will be loaded except for paragraphs, but only the article
1.5 cvs 1926: title will be loaded in its entirety. For figures, the caption will be loaded,
1.3 cvs 1927: while for sections, the title will be loaded, and for bibliographic entries,
1928: only the title that they contain will be loaded. Note that
1929: bibliographic elements are defined in another structure schema, RefBib. To
1930: produce this result, the following declarations should be placed in the
1931: Article structure schema:</P>
1.1 cvs 1932: <PRE>
1933: EXPORT
1934: Article_title,
1.5 cvs 1935: Figure With Caption,
1.1 cvs 1936: Section With Section_title,
1937: Paragraph With Nothing,
1938: Biblio With Biblio_title(RefBib);
1939: </PRE>
1940: </BLOCKQUOTE>
1941: </DIV>
1942:
1943: <DIV class="subsection">
1.6 cvs 1944: <H3><A name=sectc3214>Exceptions</A></H3>
1.1 cvs 1945:
1946: <P>
1947: The behavior of the Thot editor and the actions that it performs are
1948: determined by the structure schemas. These actions are applied to all
1949: document and object types in accordance with their generic structure. For
1950: certain object types, such as tables and graphics, these actions are not
1951: sufficient or are poorly adapted and some special actions must be added to or
1952: substituted for certain standard actions. These special actions are called
1953: <EM>exceptions</EM>.</P>
1954: <P>
1955: Exceptions only inhibit or modify certain standard actions, but they can be
1956: used freely in every structure schema.</P>
1957: <P>
1958: Each structure schema can contain a section defining exceptions. It begins
1959: with the keyword <TT>EXCEPT</TT> and is composed of a sequence of exception
1960: declarations, separated by semicolons. Each declaration of an exception
1961: begins with the name of an element type or attribute followed by a colon. This
1962: indicates the element type or attribute to which the following exceptions
1.6 cvs 1963: apply. When the given element type name is a <A href="#sectd3285">mark pair</A>,
1.1 cvs 1964: and only in this case, the type name can be preceded by the keyword
1965: <TT>First</TT> or <TT>Second</TT>, to indicate if the exceptions which follow
1966: are associated with the first mark of the pair or the second. In the absence
1967: of this keyword, the first mark is used.</P>
1968: <P>
1.6 cvs 1969: When placed in an <A href="#sectc322">extension schema</A>, the keyword
1.1 cvs 1970: <TT>EXTERN</TT> indicates that the type name which follows is found in the
1971: principal schema (the schema being extended by the extension schema). The
1972: exceptions are indicated by a name. They are separated by semicolons.</P>
1973: <PRE>
1974: [ 'EXCEPT' ExceptSeq ]
1975:
1976: ExceptSeq = Except ';' < Except ';' > .
1977: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr
1978: ':' ExcValSeq .
1979: ExcTypeOrAttr = ElemID / AttrID .
1980: ExcValSeq = ExcValue < ',' ExcValue > .
1981: ExcValue ='NoCut' / 'NoCreate' /
1982: 'NoHMove' / 'NoVMove' / 'NoMove' /
1983: 'NoHResize' / 'NoVResize' / 'NoResize' /
1.13 cvs 1984: 'MoveResize' /
1.1 cvs 1985: 'NewWidth' / 'NewHeight' /
1986: 'NewHPos' / 'NewVPos' /
1987: 'Invisible' / 'NoSelect' /
1988: 'Hidden' / 'ActiveRef' /
1989: 'ImportLine' / 'ImportParagraph' /
1990: 'NoPaginate' / 'ParagraphBreak' /
1.9 cvs 1991: 'HighlightChildren' / 'ExtendedSelection' /
1992: 'ReturnCreateNL' .
1.1 cvs 1993: </PRE>
1994: <P>
1995: The following are the available exceptions:</P>
1996: <DL>
1997: <DT><TT>NoCut</TT></DT>
1.2 cvs 1998: <DD>This exception can only be applied to element types. Elements of a type to
1.13 cvs 1999: which this exception is applied cannot be deleted by the editor.
1.1 cvs 2000: </DD>
2001: <DT><TT>NoCreate</TT></DT>
1.2 cvs 2002: <DD>This exception can only be applied to element types. Elements of a type to
2003: which this exception is applied cannot be created by ordinary commands for
2004: creating new elements. These elements are usually created by special actions
1.13 cvs 2005: associated with other exceptions.
1.1 cvs 2006: </DD>
2007: <DT><TT>NoHMove</TT></DT>
1.2 cvs 2008: <DD>This exception can only be applied to element types. Elements of a type to
1.13 cvs 2009: which this exception is applied cannot be moved horizontally with the
2010: mouse. Their children elements cannot be moved either.
1.1 cvs 2011: </DD>
2012: <DT><TT>NoVMove</TT></DT>
1.2 cvs 2013: <DD>This exception can only be applied to element types. Elements of a type to
1.13 cvs 2014: which this exception is applied cannot be moved vertically with the
2015: mouse. Their children elements cannot be moved either.
1.1 cvs 2016: </DD>
2017: <DT><TT>NoMove</TT></DT>
1.2 cvs 2018: <DD>This exception can only be applied to element types. Elements of a type to
2019: which this exception is applied cannot be moved in any direction with the
1.13 cvs 2020: mouse. Their children elements cannot be moved either.
1.1 cvs 2021: </DD>
2022: <DT><TT>NoHResize</TT></DT>
1.2 cvs 2023: <DD>This exception can only be applied to element types. Elements of a type to
1.13 cvs 2024: which this exception is applied cannot be resized horizontally with the
2025: mouse. Their children elements cannot be resized either.
1.1 cvs 2026: </DD>
2027: <DT><TT>NoVResize</TT></DT>
1.2 cvs 2028: <DD>This exception can only be applied to element types. Elements of a type to
1.13 cvs 2029: which this exception is applied cannot be resized vertically with the
2030: mouse. Their children elements cannot be resized either.
1.1 cvs 2031: </DD>
2032: <DT><TT>NoResize</TT></DT>
1.2 cvs 2033: <DD>This exception can only be applied to element types. Elements of a type to
2034: which this exception is applied cannot be resized in any direction with the
1.13 cvs 2035: mouse. Their children elements cannot be resized either.
2036: </DD>
2037: <DT><TT>MoveResize</TT></DT>
2038: <DD>This exception can only be applied to element types. Elements of a type to
2039: which this exception is applied can be moved and resized in any direction
2040: with the mouse, even if one of their ancestor element has an exception that
2041: prevents moving or resizing. Their children elements can also be resized or
2042: moved.
1.1 cvs 2043: </DD>
2044: <DT><TT>NoSelect</TT></DT>
1.2 cvs 2045: <DD>This exception can only be applied to element types. Elements of a type to
2046: which this exception is applied cannot be selected directly with the mouse, but
2047: they can be selected by other methods provided by the editor.
1.1 cvs 2048: </DD>
2049: <DT><TT>NewWidth</TT></DT>
1.2 cvs 2050: <DD>This exception can only be applied to numeric attributes. If the width of
2051: an element which has this attribute is modified with the mouse, the value of
2052: the new width will be assigned to the attribute.
1.1 cvs 2053: </DD>
2054: <DT><TT>NewHeight</TT></DT>
1.2 cvs 2055: <DD>This exception can only be applied to numeric attributes. If the height of
2056: an element which has this attribute is modified with the mouse, the value of
2057: the new height will be assigned to the attribute.
1.1 cvs 2058: </DD>
2059: <DT><TT>NewHPos</TT></DT>
1.2 cvs 2060: <DD>This exception can only be applied to numeric attributes. If the
2061: horizontal position of an element which has this attribute is modified with the
2062: mouse, the value of the new horizontal position will be assigned to the
1.1 cvs 2063: attribute.
2064: </DD>
2065: <DT><TT>NewVPos</TT></DT>
1.2 cvs 2066: <DD>This exception can only be applied to numeric attributes. If the vertical
2067: position of an element which has this attribute is modified with the mouse, the
2068: value of the new vertical position will be assigned to the attribute.
1.1 cvs 2069: </DD>
2070: <DT><TT>Invisible</TT></DT>
1.2 cvs 2071: <DD>This exception can only be applied to attributes, but can be applied to all
2072: attribute types. It indicates that the attribute must not be seen by the user
2073: and that its value must not be changed directly. This exception is usually
1.5 cvs 2074: used when another exception manipulates the value of an attribute.
1.1 cvs 2075: </DD>
2076: <DT><TT>Hidden</TT></DT>
1.2 cvs 2077: <DD>This exception can only be applied to element types. It indicates that
2078: elements of this type, although present in the document's structure, must not
2079: be shown to the user of the editor. In particular, the creation menus must not
2080: propose this type and the selection message must not pick it.
1.1 cvs 2081: </DD>
2082: <DT><TT>ActiveRef</TT></DT>
1.2 cvs 2083: <DD>This exception can only be applied to attributes of the reference type. It
2084: indicates that when the user of the editor makes a double click on an element
2085: which possesses a reference attribute having this exception, the element
2086: designated by the reference attribute will be selected.
1.1 cvs 2087: </DD>
2088: <DT><TT>ImportLine</TT></DT>
1.2 cvs 2089: <DD>This exception can only be applied to element types. It indicates that
2090: elements of this type should receive the content of imported text files. An
2091: element is created for each line of the imported file. A structure schema
2092: cannot contain several exceptions <TT>ImportLine</TT> and, if it contains one,
2093: it should not contain any exception <TT>ImportParagraph</TT>.
1.1 cvs 2094: </DD>
2095: <DT><TT>ImportParagraph</TT></DT>
1.2 cvs 2096: <DD>This exception can only be applied to element types. It indicates that
2097: elements of this type should receive the content of imported text files. An
2098: element is created for each paragraph of the imported file. A paragraph is a
2099: sequence of lines without any empty line. A structure schema cannot contain
2100: several exceptions <TT>ImportParagraph</TT> and, if it contains one, it should
2101: not contain any exception <TT>ImportLine</TT>.
1.1 cvs 2102: </DD>
2103: <DT><TT>NoPaginate</TT></DT>
1.2 cvs 2104: <DD>This exception can only be applied to the root element, i.e. the name that
2105: appear after the keyword <TT>STRUCTURE</TT> at the beginning of the structure
2106: schema. It indicates that the editor should not allow the user to paginate
1.1 cvs 2107: documents of that type.
2108: </DD>
2109: <DT><TT>ParagraphBreak</TT></DT>
1.2 cvs 2110: <DD>This exception can only be applied to element types. When the caret is
2111: within an element of a type to which this exception is applied, it is that
2112: element that will be split when the user hits the Return key.
1.1 cvs 2113: </DD>
1.9 cvs 2114: <DT><TT>ReturnCreateNL</TT></DT>
2115: <DD>This exception can only be applied to element types. When the caret is
2116: within an element of a type to which this exception is applied, the Return
2117: key simply inserts a New line character (code \212) at the current position.
2118: The Return key does not create a new element; it does not split the current
2119: element either.
2120: </DD>
1.1 cvs 2121: <DT><TT>HighlightChildren</TT></DT>
1.2 cvs 2122: <DD>This exception can only be applied to element types. Elements of a type to
2123: which this exception is applied are not highlighted themselves when they are
2124: selected, but all their children are highlighted instead.
1.1 cvs 2125: </DD>
2126: <DT><TT>ExtendedSelection</TT></DT>
1.2 cvs 2127: <DD>This exception can only be applied to element types. The selection
2128: extension command (middle button of the mouse) only add the clicked element (if
2129: it has that exception) to the current selection, without selecting other
2130: elements between the current selection and the clicked element.
1.1 cvs 2131: </DD>
2132: </DL>
2133: <BLOCKQUOTE class="example">
2134: <P>
2135: <STRONG>Example:</STRONG></P>
2136: <P>
1.3 cvs 2137: Consider a structure schema for object-style graphics which defines the
1.1 cvs 2138: Graphic_object element type with the associated Height and Weight
1.3 cvs 2139: numeric attributes. Suppose that we want documents of this class to have
2140: the following qualities:</P>
1.1 cvs 2141: <UL>
1.2 cvs 2142: <LI>Whenever the width or height of an object is changed using the mouse, the
2143: new values are stored in the object's Width and Height attributes.
2144: <LI>The user should not be able to change the values of the Width and Height
1.5 cvs 2145: attributes via the Attributes menu of the Thot editor.
1.1 cvs 2146: </UL>
2147: <P>
2148: The following exceptions will produce this effect.</P>
2149: <PRE>
2150: STRUCT
2151: ...
1.5 cvs 2152: Graphics_object (ATTR Height = Integer; Width = Integer)
1.1 cvs 2153: = GRAPHICS with Height ?= 10, Width ?= 10;
2154: ...
2155: EXCEPT
2156: Height: NewHeight, Invisible;
2157: Width: NewWidth, Invisible;
2158: </PRE>
2159: </BLOCKQUOTE>
2160: </DIV>
2161: </DIV>
2162:
2163: <DIV class="section">
1.6 cvs 2164: <H2><A name=sectb33>Some examples</A></H2>
1.1 cvs 2165:
2166: <P>
2167: In order to illustrate the principles of the document model and the syntax of
2168: the S language, this section presents two examples of structure schemas. One
2169: defines a class of documents, the other defines a class of objects.</P>
2170:
2171: <DIV class="subsection">
1.6 cvs 2172: <H3><A name=sectc331>A class of documents: articles</A></H3>
1.1 cvs 2173:
2174: <P>
2175: This example shows a possible structure for articles published in a journal.
2176: Text between braces is comments.</P>
2177: <PRE>
2178: STRUCTURE Article; { This schema defines the Article class }
2179: DEFPRES ArticleP; { The default presentation schema is
2180: ArticleP }
2181: ATTR { Global attribute definitions }
2182: WordType = Definition, IndexWord, DocumentTitle;
2183: { A single global attribute is defined, with three values }
2184: STRUCT { Definition of the generic structure }
2185: Article = BEGIN { The Article class has an aggregate
2186: structure }
2187: Title = BEGIN { The title is an aggregate }
2188: French_title =
2189: Text WITH Language='Fran\347ais';
2190: English_title =
2191: Text WITH Language='English';
2192: END;
2193: Authors =
2194: LIST OF (Author
2195: (ATTR Author_type=principal,secondary)
2196: { The Author type has a local attribute }
2197: = BEGIN
2198: Author_name = Text;
2199: Info = Paragraphs ;
2200: { Paragraphs is defined later }
2201: Address = Text;
2202: END
2203: );
2204: Keywords = Text;
2205: { The journal's editor introduces the article
2206: with a short introduction, in French and
2207: in English }
2208: Introduction =
2209: BEGIN
2210: French_intr = Paragraphs WITH
2211: Language='Fran\347ais';
2212: English_intr = Paragraphs WITH
2213: Language='English';
2214: END;
2215: Body = Sections; { Sections are defined later }
2216: { Appendixes are only created on demand }
2217: ? Appendices =
2218: LIST OF (Appendix =
2219: BEGIN
2220: Appendix_Title = Text;
2221: Appendix_Contents = Paragraphs;
2222: END
2223: );
2224: END; { End of the Article aggregate }
2225:
2226: Sections = LIST [2..*] OF (
2227: Section = { At least 2 sections }
2228: BEGIN
2229: Section_title = Text;
2230: Section_contents =
2231: BEGIN
2232: Paragraphs;
2233: Sections; { Sections at a lower level }
2234: END;
2235: END
2236: );
2237:
2238: Paragraphs = LIST OF (Paragraph = CASE OF
2239: Enumeration =
2240: LIST [2..*] OF
2241: (Item = Paragraphs);
2242: Isolated_formula = Formula;
2243: LIST OF (UNIT);
2244: END
2245: );
2246:
2247: ASSOC { Associated elements definitions }
2248:
2249: Figure = BEGIN
1.5 cvs 2250: Figure_caption = Text;
1.1 cvs 2251: Illustration = NATURE;
2252: END;
2253:
2254: Biblio_citation = CASE OF
2255: Ref_Article =
2256: BEGIN
2257: Authors_Bib = Text;
2258: Article_Title = Text;
2259: Journal = Text;
2260: Page_Numbers = Text;
2261: Date = Text;
2262: END;
2263: Ref_Livre =
2264: BEGIN
2265: Authors_Bib; { Defined above }
2266: Book_Title = Text;
2267: Editor = Text;
2268: Date; { Defined above }
2269: END;
2270: END;
2271:
2272: Note = Paragraphs - (Ref_note);
2273:
2274: UNITS { Elements which can be used in objects }
2275:
2276: Ref_note = REFERENCE (Note);
2277: Ref_biblio = REFERENCE (Biblio_citation);
2278: Ref_figure = REFERENCE (Figure);
2279: Ref_formula = REFERENCE (Isolated_formula);
2280:
2281: EXPORT { Skeleton elements }
2282:
2283: Title,
1.5 cvs 2284: Figure with Figure_caption,
1.1 cvs 2285: Section With Section_title;
2286:
2287: END { End of the structure schema }
2288: </PRE>
2289: <P>
2290: This schema is very complete since it defines both paragraphs and
2291: bibliographic citations. These element types could just as well be defined in
2292: other structure schemas, as is the case with the <TT>Formula</TT> class. All
2293: sorts of other elements can be inserted into an article, since a paragraph can
2294: contain any type of unit. Similarly, figures can be any class of document or
2295: object that the user chooses.</P>
2296: <P>
2297: Generally, an article doesn't contain appendices, but it is possible to add
2298: them on explicit request: this is the effect of the question mark before the
2299: word Appendices.</P>
2300: <P>
2301: The Figure, Biblio_citation and Note elements are associated elements. Thus,
2302: they are only used in <TT>REFERENCE</TT> statements.</P>
2303: <P>
2304: Various types of cross-references can be put in paragraphs. They can also be
2305: placed the objects which are part of the article, since the cross-references
2306: are defined as units (<TT>UNITS</TT>).</P>
2307: <P>
2308: There is a single restriction to prevent the creation of Ref_note elements
2309: within notes.</P>
2310: <P>
2311: It is worth noting that the S language permits the definition of recursive
2312: structures like sections: a section can contain other sections (which are thus
2313: at the next lower level of the document tree). Paragraphs are also recursive
2314: elements, since a paragraph can contain an enumeration in which each element
2315: (<TT>Item</TT>) is composed of paragraphs.</P>
2316: </DIV>
2317:
2318: <DIV class="subsection">
1.6 cvs 2319: <H3><A name=sectc332>A class of objects: mathematical formulas</A></H3>
1.1 cvs 2320:
2321: <P>
2322: The example below defines the <TT>Formula</TT> class which is used in Article
2323: documents. This class represents mathematical formulas with a rather simple
2324: structure, but sufficient to produce a correct rendition on the screen or
2325: printer. To support more elaborate operations (formal or numeric
2326: calculations), a finer structure should be defined. This class doesn't use any
2327: other class and doesn't define any associated elements or units.</P>
2328: <PRE>
2329: STRUCTURE Formula;
2330: DEFPRES FormulaP;
2331:
2332: ATTR
2333: String_type = Function_name, Variable_name;
2334:
2335: STRUCT
2336: Formula = Expression;
2337: Expression = LIST OF (Construction);
2338: Construction = CASE OF
2339: TEXT; { Simple character string }
2340: Index = Expression;
2341: Exponent = Expression;
2342: Fraction =
2343: BEGIN
1.6 cvs 2344: Numerator = Expression;
1.1 cvs 2345: Denominator = Expression;
2346: END;
2347: Root =
2348: BEGIN
2349: ? Order = TEXT;
2350: Root_Contents = Expression;
2351: END;
2352: Integral =
2353: BEGIN
2354: Integration_Symbol = SYMBOL;
2355: Lower_Bound = Expression;
2356: Upper_Bound = Expression;
2357: END;
2358: Triple =
2359: BEGIN
2360: Princ_Expression = Expression;
2361: Lower_Expression = Expression;
2362: Upper_Expression = Expression;
2363: END;
2364: Column = LIST [2..*] OF
2365: (Element = Expression);
2366: Parentheses_Block =
2367: BEGIN
2368: Opening = SYMBOL;
2369: Contents = Expression;
2370: Closing = SYMBOL;
2371: END;
2372: END; { End of Choice Constructor }
2373: END { End of Structure Schema }
2374: </PRE>
2375: <P>
2376: This schema defines a single global attribute which allows functions and
2377: variables to be distinguished. In the presentation schema, this attribute can
2378: be used to choose between roman (for functions) and italic characters (for
2379: variables).</P>
2380: <P>
2381: A formula's structure is that of a mathematical expression, which is itself a
2382: sequence of mathematical constructions. A mathematical construction can be
2383: either a simple character string, an index, an exponent, a fraction, a root,
2384: etc. Each of these mathematical constructions has a sensible structure which
2385: generally includes one or more expressions, thus making the formula class's
2386: structure definition recursive.</P>
2387: <P>
2388: In most cases, the roots which appear in the formulas are square roots and
2389: their order (2) is not specified. This is why the Order component is marked
2390: optional by a question mark. When explicitly requested, it is possible to add
2391: an order to a root, for example for cube roots (order = 3).</P>
2392: <P>
2393: An integral is formed by an integration symbol, chosen by the user (simple
2394: integral, double, curvilinear, etc.), and two bounds. A more fine-grained
2395: schema would add components for the integrand and the integration variable.
2396: Similarly, the Block_Parentheses construction leaves the choice of opening and
2397: closing symbols to the user. They can be brackets, braces, parentheses,
2398: etc.</P>
2399: </DIV>
2400: </DIV>
2401: <HR>
2402: </DIV>
2403:
2404: <DIV class="chapter">
1.6 cvs 2405: <H1><A name=sect4>The P Language</A></H1>
1.1 cvs 2406:
2407:
2408: <DIV class="section">
1.6 cvs 2409: <H2><A name=sectb41>Document presentation</A></H2>
1.1 cvs 2410:
2411: <P>
2412: Because of the model adopted for Thot, the presentation of documents is
2413: clearly separated from their structure and content. After having presented
2414: the logical structure of documents, we now detail the principles implemented
2415: for their presentation. The concept of <EM>presentation</EM> encompasses what
1.5 cvs 2416: is often called the page layout, the composition, or the document style. It
2417: is the set of operations which display the document on the screen or print
2418: it on paper. Like logical structure, document presentation is defined
2419: generically with the help of a language, called P.</P>
1.1 cvs 2420:
2421: <DIV class="subsection">
1.6 cvs 2422: <H3><A name=sectc411>Two levels of presentation</A></H3>
1.1 cvs 2423:
2424: <P>
2425: The link between structure and presentation is clear: the logical organization
2426: of a document is used to carry out its presentation, since the purpose of the
2427: presentation is to make evident the organization of the document. But the
2428: presentation is equally dependent on the device used to render the document.
2429: Certain presentation effects, notably changes of font or character set, cannot
2430: be performed on all printers or on all screens. This is why Thot uses a
2431: two-level approach, where the presentation is first described in abstract
2432: terms, without taking into account each particular device, and then the
2433: presentation is realized within the constraints of a given device.</P>
2434: <P>
2435: Thus, presentation is only described as a function of the structure of the
2436: documents and the image that would be produced on an idealized device. For
2437: this reason, presentation descriptions do not refer to any device
2438: characteristics: they describe <EM>abstract presentations</EM> which can be
2439: concretized on different devices.</P>
2440: <P>
2441: A presentation description also defines a <EM>generic presentation</EM>, since
2442: it describes the appearance of a class of documents or objects. This generic
2443: presentation must also be applied to document and object instances, each
2444: conforming to its generic logical structure, but with all the allowances that
2445: were called to mind above: missing elements, constructed elements with other
2446: logical structures, etc.</P>
2447: <P>
2448: In order to preserve the homogeneity between documents and objects,
2449: presentation is described with a single set of tools which support the layout
2450: of a large document as well as the composition of objects like a graphical
2451: figure or mathematical formula. This unity of presentation description tools
2452: contrasts with the traditional approach, which focuses more on documents than
2453: objects and thus is based on the usual typographic conventions, such as the
2454: placement of margins, indentations, vertical spaces, line lengths,
2455: justification, font changes, etc.</P>
2456: </DIV>
2457:
2458: <DIV class="subsection">
1.6 cvs 2459: <H3><A name=sectc412>Boxes</A></H3>
1.1 cvs 2460:
2461: <P>
2462: To assure the homogeneity of tools, all presentation in Thot, for documents as
2463: well as for the objects which they contain, is based on the notion of the
2464: <EM>box</EM>, such as was implemented in T<SUB><BIG>E</BIG></SUB>X.</P>
2465: <P>
2466: Corresponding to each element of the document is a box, which is the
2467: rectangle enclosing the element on the display device (screen or sheet of
1.13 cvs 2468: paper); the outline of this rectangle is not visible, except when a
2469: <A href="#sectc4230a"><TT>ShowBox</TT> rule</A> applies to the element. The
2470: sides of
1.1 cvs 2471: the box are parallel to the sides of the screen or the sheet of paper. By way
2472: of example, a box is associated with a character string, a line of text, a
2473: page, a paragraph, a title, a mathematical formula, or a table cell.</P>
2474: <P>
2475: Whatever element it corresponds to, each box possesses four sides and four
2476: axes, which we designate as follows (<A href="#boxes">see figure</A>):</P>
2477: <DL>
2478: <DT><TT> Top</TT></DT>
2479: <DD>the upper side,
2480: </DD>
2481: <DT><TT> Bottom</TT></DT>
2482: <DD>the lower side,
2483: </DD>
2484: <DT><TT> Left</TT></DT>
2485: <DD>the left side,
2486: </DD>
2487: <DT><TT> Right</TT></DT>
2488: <DD>the right side,
2489: </DD>
2490: <DT><TT> VMiddle</TT></DT>
1.2 cvs 2491: <DD>the vertical axis passing through the center of the box,
1.1 cvs 2492: </DD>
2493: <DT><TT> HMiddle</TT></DT>
1.2 cvs 2494: <DD>the horizontal axis passing through the center of the box,
1.1 cvs 2495: </DD>
2496: <DT><TT> VRef</TT></DT>
2497: <DD>the vertical reference axis,
2498: </DD>
2499: <DT><TT> HRef</TT></DT>
2500: <DD>the horizontal reference axis.
2501: </DD>
2502: </DL>
2503:
2504: <DIV class="figure">
2505: <HR>
2506: <PRE>
2507: Left VRef VMiddle Right
2508: : :
2509: Top -----------------------------
2510: | : : |
2511: | : : |
2512: | : : |
2513: | : : |
2514: | : : |
2515: HMiddle ..|...........................|..
2516: | : : |
2517: | : : |
2518: HRef ..|...........................|..
2519: | : : |
2520: | : : |
2521: Bottom -----------------------------
2522: : :
2523: </PRE>
2524: <P align=center>
2525: <EM><A name="boxes">The sides and axes of boxes</A><EM></EM></EM></P>
2526: <HR>
2527: </DIV>
2528: <P>
2529: The principal role of boxes is to set the extent and position of the images of
2530: the different elements of a document with respect to each other on the
2531: reproduction device. This is done by defining relations between the boxes of
2532: different elements which give relative extents and positions to these
2533: boxes.</P>
2534: <P>
2535: There are three types of boxes:</P>
2536: <UL>
2537: <LI>boxes corresponding to structural elements of the document,
2538: <LI>presentation boxes,
2539: <LI>page layout boxes.
2540: </UL>
2541: <P>
2542: <STRONG>Boxes corresponding to structural elements of the document</STRONG>
2543: are those which linked to each of the elements (base or structured) of the
2544: logical structure of the document. Such a box contains all the contents of
1.5 cvs 2545: the element to which it corresponds (there is an exception: see
1.6 cvs 2546: <A href="#sectc4220">rules <TT>VertOverflow</TT> and
1.5 cvs 2547: <TT>HorizOverflow</TT></A>). These boxes form a
1.1 cvs 2548: tree-like structure, identical to that of the structural elements to which
2549: they correspond. This tree expresses the inclusion relationships between the
2550: boxes: a box includes all the boxes of its subtree. On the other hand, there
2551: are no predefined rules for the relative positions of the included boxes. If
2552: they are at the same level, they can overlap, be contiguous, or be disjoint.
2553: The rules expressed in the generic presentation specify their relative
2554: positions.</P>
2555: <P>
2556: <STRONG>Presentation boxes</STRONG> represent elements which are not found in
2557: the logical structure of the document but which are added to meet the needs of
2558: presentation. These boxes are linked to the elements of the logical structure
2559: that are best suited to bringing them out. For example, they are used to add
2560: the character string ``Summary:'' before the summary in the presentation of a
2561: report or to represent the fraction bar in a formula, or also to make the
2562: title of a field in a form appear. These elements have no role in the logical
2563: structure of the document: the presence of a Summary element in the document
2564: does not require the creation of another structural object to hold the word
2565: ``Summary''. Similarly, if a Fraction element contains both a Numerator
2566: element and a Denominator element, the fraction bar has no purpose
2567: structurally. On the other hand, these elements of the presentation are
2568: important for the reader of the reproduced document or for the user of an
2569: editor. This is why they must appear in the document's image. It is the
2570: generic presentation which specifies the presentation boxes to add by
2571: indicating their content (a base element for which the value is specified) and
2572: the position that they must take in the tree of boxes. During editing, these
2573: boxes cannot be modified by the user.</P>
2574: <P>
2575: <STRONG>Page layout boxes</STRONG> are boxes created implicitly by the page
2576: layout rules. These rules indicate how the contents of a structured element
2577: must be broken into lines and pages. In contrast to presentation boxes, these
2578: line and page boxes do not depend on the logical structure of the document,
1.5 cvs 2579: but rather on the physical constraints of the output devices: character
1.1 cvs 2580: size, height and width of the window on the screen or of the sheet of
2581: paper.</P>
2582: </DIV>
2583:
2584: <DIV class="subsection">
1.6 cvs 2585: <H3><A name=sectc413>Views and visibility</A></H3>
1.1 cvs 2586:
2587: <P>
2588: One of the operations that one might wish to perform on a document is to view
2589: it is different ways. For this reason, it is possible to define several
2590: <EM>views</EM> for the same document, or better yet, for all documents of the
2591: same class. A view is not a different presentation of the document, but
2592: rather a filter which only allows the display of certain parts of the
2593: document. For example, it might be desirable to see only the titles of
2594: chapters and sections in order to be able to move rapidly through the
2595: document. Such a view could be called a ``table of contents''. It might also
2596: be desirable to see only the mathematical formulas of a document in order to
2597: avoid being distracted by the non-mathematical aspects of the document. A
2598: ``mathematics'' view could provide this service.</P>
2599: <P>
2600: Views, like presentation, are based on the generic logical structure. Each
2601: document class, and each generic presentation, can be provided with views
2602: which are particularly useful for that class or presentation. For each view,
2603: the <EM>visibility</EM> of elements is defined, indicated whether or not the
2604: elements must be presented to the user. The visibility is calculated as a
2605: function of the type of the elements or their hierarchical position in the
2606: structure of the document. Thus, for a table of contents, all the ``Chapter
2607: Title'' and ``Section Title'' elements are made visible. However, the
2608: hierarchical level could be used to make the section titles invisible below a
2609: certain threshold level. By varying this threshold, the granularity of the
2610: view can be varied. In the ``mathematics'' view, only Formula elements would
2611: be made visible, no matter what their hierarchical level.</P>
2612: <P>
2613: Because views are especially useful for producing a synthetic image of the
2614: document, it is necessary to adapt the presentation of the elements to the
2615: view in which they appear. For example, it is inappropriate to have a page
2616: break before every chapter title in the table of contents. Thus, generic
2617: presentations take into account the possible views and permit each element
2618: type's presentation to vary according the view in which its image appears.</P>
2619: <P>
2620: <A name="views">Views</A> are also used, when editing documents, to display
2621: the associated elements. So, in addition to the primary view of the document,
2622: there can be a ``notes'' view and a ``figures'' view which contain,
2623: respectively, the associated elements of the Note and Figure types. In this
2624: way, it is possible to see simultaneously the text which refers to these
2625: elements and the elements themselves, even if they will be separated when
2626: printed.</P>
2627: </DIV>
2628:
2629: <DIV class="subsection">
1.6 cvs 2630: <H3><A name=sectc414>Pages</A></H3>
1.1 cvs 2631:
2632: <P>
2633: Presentation schemas can be defined which display the document as a long
2634: scroll, without page breaks. This type of schema is particularly well-suited
2635: to the initial phase of work on a document, where jumps from page to page
2636: would hinder composing and reading the document on a screen. In this case,
2637: the associated elements (such as notes), which are normally displayed in the
2638: page footer, are presented in a separate window. But, once the document is
2639: written, it may be desirable to display the document on the screen in the same
2640: manner in which it will be printed. So, the presentation schema must define
2641: pages.</P>
2642: <P>
2643: The P language permits the specification of the dimensions of pages as well as
2644: their composition. It is possible to generate running titles, page numbers,
2645: zones at the bottom of the page for notes, etc. The editor follows this model
2646: and inserts page break marks in the document which are used during printing,
2647: insuring that the pages on paper are the same as on the screen.</P>
2648: <P>
2649: Once a document has been edited with a presentation schema defining pages, it
2650: contains page marks. But it is always possible to edit the document using a
2651: schema without pages. In this case, the page marks are simply ignored by the
2652: editor. They are considered again as soon as a schema with pages is used.
2653: Thus, the user is free to choose between schemas with and without pages.</P>
2654: <P>
2655: Thot treats the page break, rather than the page itself, as a box. This page
2656: break box contains all the elements of one page's footer, a rule marking the
2657: edge of this page, and all the elements of the next page's header. The
2658: elements of the header and footer can be running titles, page number,
2659: associated elements (notes, for example), etc. All these elements, as well as
2660: their content and graphical appearance, are defined by the generic
2661: presentation.</P>
2662: </DIV>
2663:
2664: <DIV class="subsection">
1.6 cvs 2665: <H3><A name=sectc415>Numbering</A></H3>
1.1 cvs 2666:
2667: <P>
2668: Many elements are numbered in documents: pages, chapters, sections, formulas,
2669: theorems, notes, figures, bibliographic references, exercises, examples,
2670: lemmas, etc. Because Thot has a notion of logical structure, all of these
2671: numbers (with the exception of pages) are redundant with information implicit
2672: in the logical structure of the document. Such numbers are simply a way to
2673: make the structure of the document more visible. So, they are part of the
2674: document's presentation and are calculated by the editor from the logical
2675: structure. The structure does not contain numbers as such; it only defines
2676: relative structural positions between elements, which serve as ordering
2677: relations on these elements.</P>
2678: <P>
2679: If the structure schema defines the body of a document as a sequence of at
2680: least two chapters:</P>
2681: <PRE>
1.6 cvs 2682: Body = LIST [2..*] OF Chapter;
1.1 cvs 2683: </PRE>
2684: <P>
1.5 cvs 2685: the sequence defined by the list constructor is ordered and each chapter can be
2686: assigned a number based on its rank in the Body list. Therefore, all elements
2687: contained in lists a the structure of a document can be numbered, but they are
2688: not the only ones. The tree structure induced by the aggregate, list, and
2689: choice constructors (excluding references) defines a total order on the
2690: elements of the document's primary structure. So, it is possible to define
2691: a numbering which uses this order, filtering elements according to their type
2692: so that only certain element types are taken into account in the numbering. In
2693: this way, it possible to number all the theorems and lemmas of a chapter in the
2694: same sequence of numbers, even when they are not part of the same list
2695: constructor and appear at different levels of the document's tree. By changing
2696: the filter, they can be numbered separately: one sequence of numbers for
2697: theorems, another for the lemmas.</P>
1.1 cvs 2698: <P>
2699: Associated elements pose a special problem, since they are not part of the
2700: document's primary structure, but are attached only by references, which
2701: violate the total order of the document. Then, these associated elements are
2702: frequently numbered, precisely because the number is an effective way to
2703: visualize the reference. In order to resolve this problem, Thot implicitly
2704: defines a list constructor for each type of associated element, gathering
2705: together (and ordering) these elements. Thus, the associated elements can be
2706: numbered by type.</P>
2707: <P>
2708: Since they are calculated from the document's logical structure and only for
2709: the needs of the presentation, numbers are presentation elements, described by
2710: presentation boxes, just like the fraction bar or the word ``Summary''.
2711: Nevertheless, numbers differ from these other boxes because their content
2712: varies from instance to instance, even though they are of the same type,
2713: whereas all fraction bars are horizontal lines and the same word ``Summary''
2714: appears at the head of every document's summary.</P>
2715: </DIV>
2716:
2717: <DIV class="subsection">
1.6 cvs 2718: <H3><A name=sectc416>Presentation parameters</A></H3>
1.1 cvs 2719:
2720: <P>
2721: The principal parameters which determine document presentation are the
2722: <EM>positions</EM> and <EM>dimensions</EM> of boxes, the <EM>font</EM>, the
2723: <EM>style</EM>, the <EM>size</EM>, the <EM>underlining</EM> and the
2724: <EM>color</EM> of their content. From these parameters, and some others of
2725: less importance, it is possible to represent the usual typographic parameters
2726: for the textual parts of the document. These same parameters can be used to
2727: describe the geometry of the non-textual elements, even though they are
2728: two-dimensional elements unlike the text, which is linear.</P>
2729: <P>
2730: As we have already seen, the positions of the boxes always respect the rule
2731: of enclosure: a box in the tree encloses all the boxes of the next lower level
2732: which are attached to it. The positional parameters permit the specification
2733: of the position of each box in relation to the enclosing box or to its sibling
2734: boxes (boxes directly attached to the same enclosing box in the tree of
2735: boxes).</P>
2736: <P>
2737: The presentation parameters also provide control over the dimensions of the
2738: boxes. The dimensions of a box can depend either on its content or on its
2739: context (its sibling boxes and the enclosing box). Each dimension (height or
2740: width) can be defined independently of the other.</P>
2741: <P>
2742: Because of the position and dimension parameters, it is possible to do the
2743: same things that are normally done in typography by changing margins, line
2744: lengths, and vertical or horizontal skips. This approach can also align or
2745: center elements and groups of elements.</P>
2746: <P>
2747: In contrast to the position and dimension parameters, the font, style, size,
2748: underlining, and color do not concern the box itself (the rectangle delimiting
2749: the element), but its content. These parameters indicate the typographic
2750: attributes which must be applied to the text contained in the box, and by
2751: extension, to all base elements.</P>
2752: <P>
2753: For text, the font parameter is used to change the family of characters
2754: (Times, Helvetica, Courier, etc.); the style is used to obtain italic or
2755: roman, bold or light characters; the size determines the point size of the
2756: characters; underlining defines the type and thickness of the lines drawn
2757: above, below, or through the characters.</P>
2758: <P>
2759: For graphics, the line style parameter can be either solid, dotted, or dashed;
2760: the line thickness parameter controls the width of the lines; the fill pattern
2761: parameter determines how closed geometric figures must be filled.</P>
2762: <P>
2763: While some of the parameters which determine the appearance of a box's
2764: contents make sense only for one content type (text or graphic), other
2765: parameters apply to all content types: these are the color parameters. These
2766: indicate the color of lines and the background color.</P>
2767: </DIV>
2768: </DIV>
2769:
2770: <DIV class="section">
1.6 cvs 2771: <H2><A name=sectb42>Presentation description language</A></H2>
1.1 cvs 2772:
2773: <P>
2774: A generic presentation defines the values of presentation parameters (or the
2775: way to calculate those values) for a generic structure, or more precisely, for
2776: all the element types and all the global and local attributes defined in that
2777: generic structure. This definition of the presentation parameters is made
2778: with the P language. A program written in this language, that is a generic
2779: presentation expressed in P, is call a <EM>presentation schema</EM>. This
2780: section describes the syntax and semantics of the language, using the same <A
1.6 cvs 2781: href="#sectc321">meta-language</A> as was used for the definition of the S
1.1 cvs 2782: language.</P>
2783: <P>
2784: Recall that it is possible to write many different presentation schemas for
2785: the same class of documents or objects. This allows users to choose for a
2786: document the graphical appearance which best suits their type of work or
2787: their personal taste.</P>
2788:
2789: <DIV class="subsection">
1.6 cvs 2790: <H3><A name=sectc421>The organization of a presentation schema</A></H3>
1.1 cvs 2791:
2792: <P>
2793: A presentation schema begins with the word <TT>PRESENTATION</TT> and ends with
2794: the word <TT>END</TT>. The word <TT>PRESENTATION</TT> is followed by the name
2795: of the generic structure to which the presentation will be applied. This name
2796: must be the same as that which follows the keyword <TT>STRUCTURE</TT> in the
2797: structure schema associated with the presentation schema.</P>
2798: <P>
2799: After this declaration of the name of the structure, the following sections
2800: appear (in order):</P>
2801: <UL>
2802: <LI>Declarations of
2803: <UL>
2804: <LI>all views,
2805: <LI>printed views,
2806: <LI>counters,
2807: <LI>presentation constants,
2808: <LI>variables,
2809: </UL>
2810: <LI>default presentation rules,
2811: <LI>presentation box and page layout box definitions,
2812: <LI>presentation rules for structured elements,
2813: <LI>presentation rules for attributes,
2814: <LI>rules for transmitting values to attributes of included documents.
2815: </UL>
2816: <P>
2817: Each of these sections is introduced by a keyword which is followed by a
2818: sequence of declarations. Every section is optional.</P>
2819: <PRE>
2820: SchemaPres ='PRESENTATION' ElemID ';'
2821: [ 'VIEWS' ViewSeq ]
2822: [ 'PRINT' PrintViewSeq ]
2823: [ 'COUNTERS' CounterSeq ]
2824: [ 'CONST' ConstSeq ]
2825: [ 'VAR' VarSeq ]
2826: [ 'DEFAULT' ViewRuleSeq ]
2827: [ 'BOXES' BoxSeq ]
2828: [ 'RULES' PresentSeq ]
2829: [ 'ATTRIBUTES' PresAttrSeq ]
2830: [ 'TRANSMIT' TransmitSeq ]
2831: 'END' .
1.6 cvs 2832: ElemID = NAME .
1.1 cvs 2833: </PRE>
2834: </DIV>
2835:
2836: <DIV class="subsection">
1.6 cvs 2837: <H3><A name=sectc422>Views</A></H3>
1.1 cvs 2838:
2839: <P>
2840: Each of the possible views must be declared in the presentation schema. As
2841: has <A href="#views">already been described</A>, the presentation rules for an
2842: element type can vary according to the view in which the element appears. The
2843: name of the view is used to designate the view to which the presentation rules
2844: apply (see the <A href="#inkeyword"><TT>IN</TT> instruction</A>). The
2845: definition of the view's contents are dispersed throughout the presentation
2846: rules attached to the different element types and attributes. The
2847: <TT>VIEWS</TT> section is simply a sequence of view names separated by commas
2848: and terminated by a semi-colon.</P>
2849: <P>
2850: One of the view names (and only one) can be followed by the keyword
2851: <TT>EXPORT</TT>. This keyword identifies the view which presents the members
1.6 cvs 2852: of the document class in <A href="#sectc3213">skeleton form</A>. The graphical
1.1 cvs 2853: appearance and the content of this view is defined just as with other views,
2854: but it is useless to specify presentation rules concerning this view for the
2855: elements which are not loaded in the skeleton form.</P>
2856: <P>
2857: It is not necessary to declare any views; in this case there is a single
2858: unnamed view. If many views are declared, the first view listed is considered
2859: the principal view. The principal view is the one to which all rules that are
2860: not preceded by an indication of a view will apply (see the <A
2861: href="#inkeyword">instruction <TT>IN</TT></A>).</P>
2862: <P>
2863: The principal view is the the one which the editor presents on the screen when
2864: the user asks to create or edit a document. Thus, it makes sense to put the
2865: most frequently used view at the head of the list. But if the structure
1.6 cvs 2866: schema contains <A href="#sectc3213">skeleton elements</A> and is loaded in its
1.1 cvs 2867: skeleton form, the view whose name is followed by the keyword <TT>EXPORT</TT>
2868: will be opened and no other views can be opened.</P>
2869: <PRE>
1.6 cvs 2870: 'VIEWS' ViewSeq
1.1 cvs 2871: ViewSeq = ViewDeclaration
1.6 cvs 2872: < ',' ViewDeclaration > ';' .
1.1 cvs 2873: ViewDeclaration = ViewID [ 'EXPORT' ] .
2874: ViewID = NAME .
2875: </PRE>
2876: <BLOCKQUOTE class="example">
2877: <P>
2878: <STRONG>Example:</STRONG></P>
2879: <P>
1.3 cvs 2880: When editing a report, it might be useful have views of the table of contents
2881: and of the mathematical formulas, in addition to the principal view which shows
2882: the document in its entirety. To achieve this, a presentation schema for the
2883: Report class would have the following <TT>VIEWS</TT> section:</P>
1.1 cvs 2884: <PRE>
2885: VIEWS
2886: Full_text, Table_of_contents, Formulas;
2887: </PRE>
2888: <P>
2889: The contents of these views are specified in the presentation rules of the
2890: schema.</P>
2891: </BLOCKQUOTE>
2892: </DIV>
2893:
2894: <DIV class="subsection">
1.6 cvs 2895: <H3><A name=sectc423>Print Views</A></H3>
1.1 cvs 2896:
2897: <P>
2898: When editing a document, each view is presented in a different window. In
2899: addition to the views specified by the <TT>VIEWS</TT> instruction, the user
2900: can display the associated elements with one window for each type of
2901: associated element.</P>
2902: <P>
2903: When printing a document, it is possible to print any number of views, chosen
2904: from among all the views which the editor can display (views in the strict
2905: sense or associated elements). Print views, as well as the order in which
2906: they must be printed, are indicated by the <TT>PRINT</TT> instruction. It
2907: appears after the <TT>VIEWS</TT> instruction and is formed of the keyword
2908: <TT>PRINT</TT> followed by the ordered list of print view names. The print
2909: view names are separated by commas and followed by a semi-colon. A print view
2910: name is either a view name declared in the <TT>VIEWS</TT> instruction or the
2911: name of an associated element type (with an ``s'' added to the end). The
2912: associated element must have been declared in the <TT>ASSOC</TT> section of
2913: the structure schema.</P>
2914: <PRE>
2915: 'PRINT' PrintViewSeq
2916: PrintViewSeq = PrintView < ',' PrintView > ';' .
2917: PrintView = ViewID / ElemID .
2918: </PRE>
2919: <P>
2920: If the <TT>PRINT</TT> instruction is absent, the printing program will print
2921: only the principal view (the first view specified by the <TT>VIEWS</TT>
2922: instruction or the single, unnamed view when there is no <TT>VIEWS</TT>
2923: instruction).</P>
2924: <BLOCKQUOTE class="example">
2925: <P>
2926: <STRONG>Example:</STRONG></P>
2927: <P>
1.3 cvs 2928: Consider a Report presentation using the view declarations from the preceding
2929: example. Suppose we want to print the full text and table of contents views,
2930: but not the Formulas view, which is only useful when editing. In addition,
2931: suppose that we also want to print the bibliographic citations, which are
2932: associated elements (of type <TT>Citation</TT>). A sensible printing order
2933: would be to print the full text then the bibliography and finally the table of
2934: contents. To obtain this result when printing, the presentation schema would
1.1 cvs 2935: say:</P>
2936: <PRE>
2937: PRINT
2938: Full_text, Citations, Table_of_contents;
2939: </PRE>
2940: </BLOCKQUOTE>
2941: </DIV>
2942:
2943: <DIV class="subsection">
1.6 cvs 2944: <H3><A name=sectc424>Counters</A></H3>
1.1 cvs 2945:
2946: <P>
2947: A presentation has a <EM>counter</EM> for each type of number in the
2948: presentation. All counters, and therefore all types of numbers, used in the
2949: schema must be declared after the <TT>COUNTERS</TT> keyword.</P>
2950: <P>
2951: Each counter declaration is composed of a name identifying the counter
2952: followed by a colon and the counting function to be applied to the counter.
2953: The counter declaration ends with a semi-colon.</P>
2954: <P>
2955: The counting function indicates how the counter values will be calculated.
2956: Three types of counting functions are available. The first type is used to
2957: count the elements of a list or aggregate: it assigns to the counter the rank
2958: of the element in the list or aggregate. More precisely, the function</P>
2959: <PRE>
2960: RANK OF ElemID [ LevelAsc ] [ INIT AttrID ]
2961: [ 'REINIT' AttrID ]
2962: </PRE>
2963: <P>
1.5 cvs 2964: indicates that when an element creates, by a creation rule (see the <A
1.6 cvs 2965: href="#sectc4232"><TT>Create</TT> instructions</A>), a presentation box
1.5 cvs 2966: containing the counter value, this value is the rank of the creating element,
2967: if it is of type <TT>ElemID</TT>, otherwise the rank of the first element of
2968: type <TT>ElemID</TT> which encloses the creating element in the logical
1.1 cvs 2969: structure of the document.</P>
2970: <P>
2971: The type name can be preceded by a star in the special case where the
2972: structure schema defines an element of whose <TT>ElemID</TT> is the same as
1.6 cvs 2973: that of an <A href="#sectd3284">inclusion</A> without expansion or with
1.1 cvs 2974: partial expansion. To resolve this ambiguity, the <TT>ElemID</TT> alone
2975: refers to the type defined in the structure schema while the <TT>ElemID</TT>
2976: preceded by a star refers to the included type.</P>
2977: <P>
2978: The type name <TT>ElemID</TT> can be followed by an integer. That number
2979: represents the relative level, among the ancestors of the creating element, of
2980: the element whose rank is asked. If that relative level <I>n</I> is unsigned,
2981: the <I>n</I><SUP>th</SUP> element of type <TT>ElemID</TT> encountered when
2982: travelling the logical structure from the root to the creating element is
2983: taken into account. If the relative level is negative, the logical structure
2984: is travelled in the other direction, from the creating element to the
2985: root.</P>
2986: <P>
2987: The function can end with the keyword <TT>INIT</TT> followed by the name of a
2988: numeric attribute (and only a numeric attribute). Then, the rank of the first
2989: element of the list or aggregate is considered to be the value of this
2990: attribute, rather than the default value of 1, and the rank of the other
2991: elements is shifted accordingly. The attribute which determines the initial
2992: value is searched on the element itself and on its ancestors.</P>
2993: <P>
2994: The function can end with the keyword <TT>REINIT</TT> followed by the name of
2995: a numeric attribute (and only a numeric attribute). Then, if an element to be
2996: counted has this attribute, the counter value for this element is the
2997: attribute value and the following elements are numbered starting from this
2998: value.</P>
2999: <P>
3000: When the <TT>RANK</TT> function is written</P>
3001: <PRE>
3002: RANK OF Page [ ViewID ] [ INIT AttrID ]
3003: </PRE>
3004: <P>
1.5 cvs 3005: (<TT>Page</TT>is a keyword of the P language), the counter takes as its value
3006: the number of the page on which the element which creates the presentation box
3007: containing the number appears. This is done as if the pages of the document
3008: form a list for each view. The counter only takes into account the pages of
3009: the relevant view, that is the view displaying the presentation box whose
3010: contents take the value of the number. However, if the keyword <TT>Page</TT>
3011: is followed by the name of a view (between parentheses), it is the pages of
3012: that view that are taken into account. As in the preceding form, the
3013: <TT>RANK</TT> function applied to pages can end with the <TT>INIT</TT> keyword
3014: followed by the name of a numeric attribute which sets the value of the first
3015: page's number. This attribute must be a local attribute of the document
3016: itself, and not of one of its components.</P>
1.1 cvs 3017: <P>
3018: The second counting function is used to count the occurrences of a certain
3019: element type in a specified context. The instruction</P>
3020: <PRE>
3021: SET n ON Type1 ADD m ON Type2 [ INIT AttrID ]
3022: </PRE>
3023: <P>
1.5 cvs 3024: says that when the document is traversed from beginning to end (in the order
3025: induced by the logical structure), the counter is assigned the value <TT>n</TT>
3026: each time an element of type <TT>Type1</TT> is encountered, no matter
3027: what the current value of the counter, and the value <TT>m</TT> is added to the
3028: current value of the counter each time an element of type <TT>Type2</TT> is
1.1 cvs 3029: encountered.</P>
3030: <P>
3031: As with the <TT>RANK</TT> function, the type names can be preceded by a star
3032: to resolve the ambiguity of included elements.</P>
3033: <P>
3034: If the function ends with the keyword <TT>INIT</TT> followed by the name of an
3035: attribute and if the document possesses this attribute, the value of this
3036: attribute is used in place of <TT>n</TT>. The attribute must be numeric. It
3037: is searched on the element itself and on its ancestors.</P>
3038: <P>
3039: This function can also be used with the <TT>Page</TT> keyword in the place of
3040: <TT>Type1</TT> or <TT>Type2</TT>. In the first case, the counter is
3041: reinitialized on each page with the value <TT>n</TT>, while in the second
3042: case, it is incremented by <TT>m</TT> on each page. As with the preceding
3043: counting function, the word <TT>Page</TT> can be followed by a name between
3044: parentheses. In this case, the name specifies a view whose pages are taken
3045: into account.</P>
3046: <P>
3047: The definition of a counter can contain several <TT>SET</TT> functions and
3048: several <TT>ADD</TT> functions, each with a different value. The total number
3049: of counting functions must not be greater than 6.</P>
3050: <P>
3051: The third counting function is used to count the elements of a certain type
3052: encountered when travelling from the creating element to the root of the
3053: logical structure. The creating element is included if it is of that type.
3054: That function is written</P>
3055: <PRE>
3056: RLEVEL OF Type
3057: </PRE>
3058: <P>
1.5 cvs 3059: where <TT>Type</TT> represents the type of the elements to be counted.</P>
1.1 cvs 3060: <P>
3061: The formal definition of counter declarations is:</P>
3062: <PRE>
3063: 'COUNTERS' CounterSeq
3064: CounterSeq = Counter < Counter > .
3065: Counter = CounterID ':' CounterFunc ';' .
3066: CounterID = NAME .
3067: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ]
3068: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] /
3069: SetFunction < SetFunction >
3070: AddFunction < AddFunction >
3071: [ 'INIT' AttrID ] /
3072: 'RLEVEL' 'OF' ElemID .
3073: SLevelAsc = [ '-' ] LevelAsc .
3074: LevelAsc = NUMBER .
3075: SetFunction = 'SET' CounterValue 'ON' TypeOrPage .
3076: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage .
3077: TypeOrPage = 'Page' [ '(' ViewID ')' ] /
3078: [ '*' ] ElemID .
3079: CounterValue = NUMBER .
3080: </PRE>
3081: <BLOCKQUOTE class="example">
3082: <P>
3083: <STRONG>Example:</STRONG></P>
3084: <P>
1.3 cvs 3085: If the body of a chapter is defined as a sequence of sections in the structure
1.1 cvs 3086: schema:</P>
3087: <PRE>
3088: Chapter_body = LIST OF (Section =
3089: BEGIN
3090: Section_Title = Text;
3091: Section_Body = Paragraphs;
3092: END
3093: );
3094: </PRE>
3095: <P>
3096: the section counter is declared:</P>
3097: <PRE>
3098: SectionCtr : RANK OF Section;
3099: </PRE>
3100: <P>
1.4 cvs 3101: and the display of the section number before the section title is obtained by a
1.6 cvs 3102: <A href="#sectc4232"><TT>CreateBefore</TT> rule</A> attached the
1.4 cvs 3103: <TT>Section_Title</TT> type, which creates a presentation box whose content is
3104: the value of the <TT>SectionCtr</TT> counter (see the <A
1.6 cvs 3105: href="#sectc4231"><TT>Content</TT> instruction</A>).</P>
1.1 cvs 3106: <P>
3107: In order to number the formulas separately within each chapter, the formula
3108: counter is declared:</P>
3109: <PRE>
3110: FormulaCtr : SET 0 ON Chapter ADD 1 ON Formula;
3111: </PRE>
3112: <P>
1.4 cvs 3113: and the display of the formula number in the right margin, alongside each
3114: formula, is obtained by a <TT>CreateAfter</TT> instruction attached to the
3115: <TT>Formula</TT> type, which creates a presentation box whose content is the
3116: value of the <TT>FormulaCtr</TT> counter.</P>
1.1 cvs 3117: <P>
3118: To number the page chapter by chapter, with the first page of each chapter
3119: having the number 1, the counter definition would be</P>
3120: <PRE>
3121: ChapterPageCtr : SET 0 ON Chapter ADD 1 ON Page;
3122: </PRE>
3123: <P>
3124: If there is also a chapter counter</P>
3125: <PRE>
3126: ChapterCtr : RANK OF Chapter;
3127: </PRE>
3128: <P>
1.6 cvs 3129: the <A href="#sectc4231">content</A> of a presentation box created at the top of
1.1 cvs 3130: each page could be defined as:</P>
3131: <PRE>
3132: Content : (VALUE(ChapterCtr, URoman) TEXT '-'
3133: VALUE(ChapterPageCtr, Arabic));
3134: </PRE>
3135: <P>
1.5 cvs 3136: Thus, the presentation box contains the number of the chapter in upper-case
1.4 cvs 3137: roman numerals followed by a hyphen and the number of the page within
3138: the chapter in arabic numerals.</P>
1.1 cvs 3139: </BLOCKQUOTE>
3140: <BLOCKQUOTE class="example">
3141: <P>
3142: <STRONG>Example:</STRONG></P>
3143: <P>
1.3 cvs 3144: To count tables and figures together in a document of the chapter type, a
1.1 cvs 3145: counter could be defined using:</P>
3146: <PRE>
3147: CommonCtr : SET 0 ON Chapter ADD 1 ON Table
3148: ADD 1 ON Figure;
3149: </PRE>
3150: </BLOCKQUOTE>
3151: </DIV>
3152:
3153: <DIV class="subsection">
1.6 cvs 3154: <H3><A name=sectc425>Presentation constants</A></H3>
1.1 cvs 3155:
3156: <P>
3157: Presentation constants are used in the definition of the content of
1.6 cvs 3158: presentation boxes. This content is used in <A href="#sectc426">variable
3159: definitions</A> and in the <A href="#sectc4231"><TT>Content</TT> rule</A>. The
1.1 cvs 3160: only presentation constants which can be used are character strings,
1.2 cvs 3161: mathematical symbols, graphical elements, and pictures, that is to say, base
1.1 cvs 3162: elements.</P>
3163: <P>
3164: Constants can be defined directly in the variables or presentation boxes
3165: (<TT>Content</TT> rule) which use them. But it is only necessary them to
3166: declare once, in the constant declaration section, even though they are used
3167: in many variables or boxes. Thus, each declared constant has a name, which
3168: allows it to be designated whenever it is used, a type (one of the four base
3169: types) and a value (a character string or a single character for mathematical
3170: symbols and graphical elements).</P>
3171: <P>
3172: The constant declarations appear after the keyword <TT>CONST</TT>. Each
3173: declaration is composed of the name of the constant, an equals sign, a keyword
3174: representing its type (<TT>Text</TT>, <TT>Symbol</TT>, <TT>Graphics</TT> or
3175: <TT>Picture</TT>) and the string representing its value. A semi-colon
3176: terminates each declaration.</P>
3177: <P>
3178: In the case of a character string, the keyword <TT>Text</TT> can be followed
3179: by the name of an alphabet (for example, <TT>Greek</TT> or <TT>Latin</TT>) in
3180: which the constant's text should be expressed. If the alphabet name is
3181: absent, the Latin alphabet is used. When the alphabet name is present, only
3182: the first letter of the alphabet name is interpreted. Thus, the words
3183: <TT>Greek</TT> and <TT>Grec</TT> designate the same alphabet. In current
3184: versions of Thot, only the Greek and Latin alphabets are available.</P>
3185: <PRE>
3186: 'CONST' ConstSeq
3187: ConstSeq = Const < Const > .
3188: Const = ConstID '=' ConstType ConstValue ';' .
3189: ConstID = NAME .
3190: ConstType ='Text' [ Alphabet ] / 'Symbol' /
3191: 'Graphics' / 'Picture' .
3192: ConstValue = STRING .
3193: Alphabet = NAME .
3194: </PRE>
3195: <P>
1.5 cvs 3196: For character strings in the Latin alphabet (ISO Latin-1 character set),
1.1 cvs 3197: characters having codes higher than 127 (decimal) are represented by their
3198: code in octal.</P>
3199: <P>
3200: In the case of a symbol or graphical element, the value only contains a single
3201: character, between apostrophes, which indicates the form of the element which
3202: must be drawn in the box whose content is the constant. The symbol or
3203: graphical element takes the dimensions of the box, which are determined by the
1.6 cvs 3204: <TT>Height</TT> and <TT>Width</TT> rules. See <A href="#sectb72">table of
1.1 cvs 3205: codes</A> for the symbols and graphical elements.</P>
3206: <BLOCKQUOTE class="example">
3207: <P>
3208: <STRONG>Example:</STRONG></P>
3209: <P>
1.3 cvs 3210: The constants ``Summary:'' and fraction bar, which were described earlier, are
1.1 cvs 3211: declared:</P>
3212: <PRE>
3213: CONST
3214: SummaryConst = Text 'Summary:';
3215: Bar = Graphics 'h';
3216: </PRE>
3217: </BLOCKQUOTE>
3218: </DIV>
3219:
3220: <DIV class="subsection">
1.6 cvs 3221: <H3><A name=sectc426>Variables</A></H3>
1.1 cvs 3222:
3223: <P>
3224: Variables permit the definition of computed content for presentation boxes. A
3225: variable is associated with a presentation box by a <TT>Content</TT> rule; but
3226: before being used in a <TT>Content</TT> rule, a variable can be defined in the
3227: <TT>VAR</TT> section. It is also possible to define a variable at the time of
3228: its use in a <TT>Content</TT> rule, as can be done with a constant.</P>
3229: <P>
3230: A variable has a name and a value which is a character string resulting from
3231: the concatenation of the values of a sequence of functions. Each variable
3232: declaration is composed of the variable name followed by a colon and the
3233: sequence of functions which produces its value, separated by spaces. Each
3234: declaration is terminated by a semi-colon.</P>
3235: <PRE>
3236: 'VAR' VarSeq
3237: VarSeq = Variable < Variable > .
3238: Variable = VarID ':' FunctionSeq ';' .
3239: VarID = NAME .
3240: FunctionSeq = Function < Function > .
3241: </PRE>
3242: <P>
3243: Several functions are available. The first two return, in the form of a
3244: character string, the current date. <TT>DATE</TT> returns the date in
3245: English, while <TT>FDATE</TT> returns the date in french.</P>
3246: <P>
3247: Two other functions, <TT>DocName</TT> and <TT>DirName</TT>, return the
3248: document name and the directory where the document is stored.</P>
3249: <P>
3250: Function <TT>ElemName</TT> returns the type of the element which created the
3251: presentation box whose contents are the variable.</P>
3252: <P>
3253: Another function simply returns the value of a presentation constant. For any
3254: constant declared in the <TT>CONST</TT> section, it is sufficient to give the
3255: name of the constant. Otherwise, the type and value of the constant must be
1.6 cvs 3256: given, using the same form as in a <A href="#sectc425">constant
1.1 cvs 3257: declaration</A>. If the constant is not of type text, (types <TT>Symbol</TT>,
3258: <TT>Graphics</TT> or <TT>Picture</TT>), it must be alone in the variable
3259: definition; only constants of type <TT>Text</TT> can be mixed with other
3260: functions.</P>
3261: <P>
3262: It is also possible to obtain the value of an attribute, simply by mentioning
3263: the attribute's name. The value of this function is the value of the
3264: attribute for the element which created the presentation box whose contents
3265: are the variable. If the creating element does not have the indicated
3266: attribute, the value is an empty string. In the case of a numeric attribute,
3267: the attribute is translated into a decimal number in arabic numerals. If
3268: another form is desired, the <TT>VALUE</TT> function must be used.</P>
3269: <P>
3270: The last available function returns, as a character string, the value of a
3271: counter, an attribute or a page number. This value can be presented in
3272: different styles. The keyword <TT>VALUE</TT> is followed (between
3273: parentheses) by the name of the counter, the name of the attribute, or the
3274: keyword <TT>PageNumber</TT> and the desired style, the two parameters being
3275: separated by a comma. The style is a keyword which indicates whether the
3276: value should be presented in arabic numerals (<TT>Arabic</TT>), lower-case
3277: roman numerals (<TT>LRoman</TT>), or upper-case roman numerals
3278: (<TT>URoman</TT>), or by an upper-case letter (<TT>Uppercase</TT>) or
3279: lower-case letter (<TT>Lowercase</TT>).</P>
3280: <P>
3281: For a page counter, the keyword <TT>PageNumber</TT> can be followed, between
3282: parentheses, by the name of the view from which to obtain the page number. By
3283: default, the first view declared in the <TT>VIEWS</TT> section is used. The
3284: value obtained is the number of the page on which is found the element that is
3285: using the variable in a <TT>Content</TT> rule.</P>
3286: <P>
3287: For an ordinary counter, the name of the counter can be preceded by the
3288: keyword <TT>MaxRangeVal</TT> or <TT>MinRangeVal</TT>. These keywords mean
3289: that the value returned by the function is the maximum (minimum resp.) value
3290: taken by the counter in the whole document, not the value for the element
3291: concerned by the function.</P>
3292: <PRE>
1.6 cvs 3293: Function = 'DATE' / 'FDATE' /
1.1 cvs 3294: 'DocName' / 'DirName' /
3295: 'ElemName' / 'AttributeName' /
3296: ConstID / ConstType ConstValue /
3297: AttrID /
3298: 'VALUE' '(' PageAttrCtr ','
3299: CounterStyle ')' .
1.6 cvs 3300: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] /
1.1 cvs 3301: [ MinMax ] CounterID / AttrID .
3302: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' /
3303: 'Uppercase' / 'Lowercase' .
1.6 cvs 3304: MinMax = 'MaxRangeVal' / 'MinRangeVal' .
1.1 cvs 3305: </PRE>
3306: <BLOCKQUOTE class="example">
3307: <P>
3308: <STRONG>Example:</STRONG></P>
3309: <P>
1.3 cvs 3310: To make today's date appear at the top of the first page of a report, a <A
1.6 cvs 3311: href="#sectc4232"><TT>CREATE</TT> rule</A> associated with the Report_Title
1.3 cvs 3312: element type generates a presentation box whose content (specified by the
3313: <TT>Content</TT> rule of that presentation box) is the variable:</P>
1.1 cvs 3314: <PRE>
3315: VAR
3316: Todays_date : TEXT 'Version of ' DATE;
3317: </PRE>
3318: <P>
3319: To produce, before each section title, the chapter number (in upper-case roman
3320: numerals) followed by the section number (in arabic numerals), two counters
3321: must be defined:</P>
3322: <PRE>
3323: COUNTERS
3324: ChapterCtr : RANK OF Chapter;
3325: SectionCtr : RANK OF Section;
3326: </PRE>
3327: <P>
1.4 cvs 3328: and the Section_Title element must create a presentation box whose content is
1.1 cvs 3329: the variable</P>
3330: <PRE>
3331: VAR
3332: SectionNum : VALUE (ChapterCtr, URoman) TEXT '-'
3333: VALUE (SectionCtr, Arabic);
3334: </PRE>
3335: <P>
3336: In order to make the page number on which each section begins appear in the
3337: table of contents view next to the section title, each Section_Title element
3338: must create a presentation box, visible only in the table of contents view,
3339: whose content is the variable:</P>
3340: <PRE>
3341: VAR
3342: TitlePageNume :
3343: VALUE (PageNumber(Full_text), Arabic);
3344: </PRE>
3345: </BLOCKQUOTE>
3346: </DIV>
3347:
3348: <DIV class="subsection">
1.6 cvs 3349: <H3><A name=sectc427>Default presentation rules</A></H3>
1.1 cvs 3350:
3351: <P>
3352: In order to avoid having to specify, for each element type defined in the
3353: structure schema, values for every one of the numerous presentation
3354: parameters, the presentation schema allows the definition of a set of default
3355: presentation rules. These rules apply to all the boxes of the elements
3356: defined in the structure schema and to the presentation boxes and page layout
3357: boxes defined in the presentation schema. Only rules which differ from these
3358: default need to be specified in other sections of the presentation schema.</P>
3359: <P>
3360: For the primary view, the default rules can define every presentation
3361: parameter, but not the <A href="#presfunct">presentation functions</A> or the
1.6 cvs 3362: <A href="#sectc4223">linebreaking conditions</A> (the <TT>NoBreak1</TT>,
1.1 cvs 3363: <TT>NoBreak2</TT>, and <TT>Gather</TT> rules).</P>
3364: <P>
3365: In a presentation schema, the default presentation rules section is optional;
3366: in this case, the <TT>DEFAULT</TT> keyword is also absent and the following
3367: rules are considered to be the default rules:</P>
3368: <PRE>
1.6 cvs 3369: Visibility: Enclosing =;
3370: VertRef: * . Left;
3371: HorizRef: Enclosed . HRef;
3372: Height: Enclosed . Height;
3373: Width: Enclosed . Width;
3374: VertPos: Top = Previous . Bottom;
3375: HorizPos: Left = Enclosing . Left;
3376: VertOverflow: No;
1.1 cvs 3377: HorizOverflow: No;
1.6 cvs 3378: Size: Enclosing =;
3379: Style: Enclosing =;
3380: Font: Enclosing =;
3381: Underline: Enclosing =;
3382: Thickness: Enclosing =;
3383: Indent: Enclosing =;
3384: LineSpacing: Enclosing =;
3385: Adjust: Enclosing =;
3386: Justify: Enclosing =;
3387: Hyphenate: Enclosing =;
3388: PageBreak: Yes;
3389: LineBreak: Yes;
3390: InLine: Yes;
3391: Depth: 0;
3392: LineStyle: Enclosing =;
3393: LineWeight: Enclosing =;
3394: FillPattern: Enclosing =;
3395: Background: Enclosing =;
3396: Foreground: Enclosing =;
1.1 cvs 3397: </PRE>
3398: <P>
3399: If other values are desired for the default rules, they must be defined
3400: explicitly in the default rules section. In fact, it is only necessary to
3401: define those default rules which differ from the ones above, since the rules
3402: above will be used whenever a rule is not explicitly named.</P>
3403: <P>
3404: Default rules for views other than the primary view can also be specified.
3405: Otherwise, the default rules for the primary views are applied to the other
3406: views.</P>
3407: <P>
1.6 cvs 3408: Default rules are expressed in the same way as <A href="#sectc4215">explicit
1.1 cvs 3409: rules for document elements</A>.</P>
3410: </DIV>
3411:
3412: <DIV class="subsection">
1.6 cvs 3413: <H3><A name=sectc428>Presentation and page layout boxes</A></H3>
1.1 cvs 3414:
3415: <P>
3416: The presentation process uses elements which are not part of the logical
3417: structure of the document, such as pages (which are the page layout boxes) or
3418: alternatively, rules, numbers, or words introducing certain parts of the
3419: document, such as ``Summary'', ``Appendices'', ``Bibliography'', etc. (which
3420: are presentation boxes).</P>
3421: <P>
3422: After the word <TT>BOXES</TT>, each presentation or page layout box is defined
3423: by its name and a sequence of presentation rules which indicate how they must
3424: be displayed. These rules are the same as those which define the boxes
3425: associated with element of the logical structure of the document, with a
1.6 cvs 3426: single exception, the <A href="#sectc4231"><TT>Content</TT> rule</A> which is
1.1 cvs 3427: used only to specify the content of presentation boxes. The content of boxes
3428: associated with elements of the document structure is defined in each document
3429: or object and thus is not specified in the presentation schema, which applies
3430: to all documents or objects of a class.</P>
3431: <P>
3432: Among the rules which define a presentation box, certain ones can refer to
3433: another presentation box (for example, in their positional rules). If the
3434: designated box is defined after the box which designates it, a
3435: <TT>FORWARD</TT> instruction followed by the name of the designated box must
3436: appear before the designation.</P>
3437: <PRE>
1.6 cvs 3438: 'BOXES' BoxSeq
1.1 cvs 3439: BoxSeq = Box < Box > .
3440: Box ='FORWARD' BoxID ';' /
3441: BoxID ':' ViewRuleSeq .
3442: BoxID = NAME .
3443: </PRE>
3444: </DIV>
3445:
3446: <DIV class="subsection">
1.6 cvs 3447: <H3><A name=sectc429>Presentation of structured elements</A></H3>
1.1 cvs 3448:
3449: <P>
3450: After the words <TT>RULES</TT>, the presentation schema gives the presentation
3451: rules that apply to the elements whose types are defined in the structure
3452: schema. Only those rules which differ from the <A
1.6 cvs 3453: href="#sectc427">default</A> must be specified in the <TT>RULES</TT>
1.1 cvs 3454: section.</P>
3455: <P>
3456: The rule definitions for each element type are composed of the name of the
3457: element type (as specified in the structure schema) followed by a colon and
3458: the set of rules specific to that type.</P>
3459: <P>
3460: The type name can be preceded by a star in the special case where the
1.6 cvs 3461: structure schema defines an <A href="#sectd3284">inclusion</A> without
1.1 cvs 3462: expansion (or with partial expansion) of a type with the same name as an
3463: element of defined in the structure schema.</P>
3464: <P>
1.6 cvs 3465: In the case where the element is a <A href="#sectd3285">mark pair</A>, but only in
1.1 cvs 3466: this case, the type name can be preceded by the keywords <TT>First</TT> or
3467: <TT>Second</TT>. These keywords indicate whether the rules that follow apply
3468: to the first or second mark of the pair.</P>
3469: <PRE>
1.6 cvs 3470: 'RULES' PresentSeq
1.1 cvs 3471: PresentSeq = Present < Present > .
1.6 cvs 3472: Present = [ '*' ] [ FirstSec ] ElemID ':'
3473: ViewRuleSeq .
3474: FirstSec = 'First' / 'Second' .
1.1 cvs 3475: </PRE>
3476: <P>
3477: A presentation schema can define presentation rules for base elements, which
3478: are defined implicitly in the structure schemas. In the English version of
3479: the presentation schema compiler, the base type names are the same as in the S
3480: language, but they are terminated by the <TT>_UNIT</TT> suffix:
3481: <TT>TEXT_UNIT</TT>, <TT>PICTURE_UNIT</TT>, <TT>SYMBOL_UNIT</TT>,
1.2 cvs 3482: <TT>GRAPHICS_UNIT</TT>. The base type names are written in upper-case
3483: letters.</P>
1.1 cvs 3484: </DIV>
3485:
3486: <DIV class="subsection">
1.6 cvs 3487: <H3><A name=sectc4210>Logical attribute presentation</A></H3>
1.1 cvs 3488:
3489: <P>
3490: After the keyword <TT>ATTRIBUTES</TT>, all attributes which are to have some
3491: effect on the presentation of the element to which they are attached must be
3492: mentioned, along with the corresponding presentation rules. This is true for
3493: both global attributes (which can be attached to all element types) and local
3494: attributes (which can only be attached to certain element types).</P>
3495: <P>
3496: Also mentioned in this section are attributes which imply an effect on
3497: elements in the subtree of the element to which they are attached. The
3498: presentation of these descendants can be modified as a function of the value
3499: of the attribute which they inherit, just as if it was attached to them
3500: directly.</P>
3501: <P>
3502: The specification for each attribute includes the attribute's name, followed
3503: by an optional value specification and, after a colon, a set of rules. The
3504: set of rules must contain at least one rule.</P>
3505: <P>
3506: When there is no value specification, the rules are applied to all elements
3507: which carry the attribute, no matter what their value. When the rules must
3508: only apply when the attribute has certain values, these values must be
3509: specified. Thus, the same attribute can appear in the <TT>ATTRIBUTES</TT>
3510: section several times, with each appearance having a different value
3511: specification. However, reference attributes never have a value specification
3512: and, as a result, can only appear once in the <TT>ATTRIBUTES</TT> section.</P>
3513: <P>
3514: To specify that the presentation rules apply to some of the descendants of the
3515: element having the attribute, the name of the affected element type is given,
3516: between parentheses, after the attribute name. This way, the presentation
3517: rules for the attribute will be applied to the element having the attribute,
3518: if it is of the given type, and to all of its descendants of the given type.
1.6 cvs 3519: In the case where this type is a <A href="#sectd3285">mark pair</A>, but only in
1.1 cvs 3520: this case, the type name can be preceded by the keywords <TT>First</TT> or
3521: <TT>Second</TT>. These keywords indicate whether the rules that follow apply
3522: to the first or second mark of the pair. If the rule must apply to several
3523: different element types, the specification must be repeated for each element
3524: type.</P>
3525: <P>
3526: The specification of values for which the presentation rules will be applied
3527: varies according to the type of the attribute:</P>
3528: <DL>
3529: <DT>numeric attribute</DT>
1.2 cvs 3530: <DD>If the rules are to apply for one value of the attribute, then the
3531: attribute name is followed by an equals sign and this value. If the rules are
3532: to apply for all values less than (or greater than) a threshold value,
3533: non-inclusive, the attribute name followed by a '<' sign (or a '>' sign,
3534: respectively) and the threshold value. If the rules must apply to a range of
3535: values, the attribute name is followed by the word '<TT>IN</TT>' and the
3536: two bounds of the range, enclosed in brackets and separated by two
3537: periods ('<TT>..</TT>'). In the case of ranges, the values of the bounds
3538: are included in the range.
1.1 cvs 3539: <P>
3540: The threshold value in the comparisons can be the value of an attribute
3541: attached to an ancestor element. In this case, the attribute name is given
3542: instead of a constant value.</P>
3543: <P>
3544: It is also possible to write rules which apply only when a comparison between
3545: two different attributes of the element's ancestors is true. In this case, the
3546: first attribute name is followed by a comparison keyword and the name of the
3547: second attribute. The comparison keywords are <TT>EQUAL</TT> (simple
3548: equality), <TT>LESS</TT> (non-inclusive less than), and <TT>GREATER</TT>
3549: (non-inclusive greater than).</P>
3550: </DD>
3551: <DT>text attribute</DT>
1.2 cvs 3552: <DD>If the rules are to apply for one value of the attribute, then the
3553: attribute name is followed by an equals sign and this value.
1.1 cvs 3554: </DD>
3555: <DT>reference attribute</DT>
1.2 cvs 3556: <DD>There is never a value specification; the rules apply no matter what
1.1 cvs 3557: element is designated by the attribute.
3558: </DD>
3559: <DT>enumerated attribute</DT>
1.2 cvs 3560: <DD>If the rules are to apply for one value of the attribute, then the
3561: attribute name is followed by an equals sign and this value.
1.1 cvs 3562: </DD>
3563: </DL>
3564: <P>
3565: The order in which the rules associated with a numeric attribute are defined
3566: is important. When multiple sets of rules can be applied, the first set
3567: declared is the one used.</P>
3568: <P>
3569: Rules for attributes have priority over both default rules and rules
3570: associated with element types. The attribute rules apply to the element to
3571: which the attribute is attached. It is the rules which apply to the
3572: surrounding elements (and especially to the descendants) which determine the
3573: effect of the attribute rules on the environment ( and especially on the
3574: terminal elements of the structure).</P>
3575: <PRE>
3576: 'ATTRIBUTES' PresAttrSeq
3577: PresAttrSeq = PresAttr < PresAttr > .
3578: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ]
3579: [ AttrRelation ] ':' ViewRuleSeq .
3580: AttrID = NAME .
3581: AttrRelation ='=' AttrVal /
3582: '>' [ '-' ] MinValue /
3583: '<' [ '-' ] MaxValue /
3584: 'IN' '[' [ '-' ] LowerBound '..'
3585: [ '-' ] UpperBound ']' /
3586: 'GREATER' AttrID /
3587: 'EQUAL' AttrID /
3588: 'LESS' AttrID .
3589: AttrVal = [ '-' ] EqualNum / EqualText /
3590: AttrValue .
3591: MinValue = NUMBER .
3592: MaxValue = NUMBER .
3593: LowerBound = NUMBER .
3594: UpperBound = NUMBER.
3595: EqualNum = NUMBER .
3596: EqualText = STRING .
3597: AttrValue = NAME .
3598: </PRE>
3599: <P>
3600: In presentation rules associated with a numeric attribute (and only in such
3601: rules), the attribute name can be used in place of a numeric value. In this
3602: case, the value of the attribute is used in the application of the rule. Thus,
3603: the attribute can represent a relation between the size of two boxes, the
3604: height and width of a box, the height of an area where page breaks are
3605: prohibited, the distance between two boxes, the position of the reference axis
3606: of a box, the interline spacing, the indentation of the first line, the
3607: visibility, the depth (z-order), or the character set.</P>
3608: <P>
3609: The presentation rules associated with reference attributes, it is possible to
3610: use the element designated by the attribute as a reference box in a positional
3611: or extent rule. This element is represented in the <A
1.6 cvs 3612: href="#sectc4218">position</A> or <A href="#sectc4219">extent</A> rule by the
1.1 cvs 3613: keyword <TT>Referred</TT>.</P>
3614: <BLOCKQUOTE class="example">
3615: <P>
3616: <STRONG>Example:</STRONG></P>
3617: <P>
1.3 cvs 3618: In all structure schemas, there is a global Language attribute defined as
1.1 cvs 3619: follows:</P>
3620: <PRE>
3621: ATTR
3622: Language = TEXT;
3623: </PRE>
3624: <P>
1.4 cvs 3625: The following rules would make French text be displayed in roman characters and
1.1 cvs 3626: English text be displayed in italics:</P>
3627: <PRE>
3628: ATTRIBUTES
3629: Language = 'French' :
1.6 cvs 3630: Style : Roman;
1.1 cvs 3631: Language = 'English' :
1.6 cvs 3632: Style : Italics;
1.1 cvs 3633: </PRE>
3634: <P>
1.4 cvs 3635: Using these rules, when the user puts the Language attribute with the value
3636: 'English' on the summary of a document, every character string (terminal
3637: elements) contained in the summary are displayed in italics. See the <A
1.7 cvs 3638: href="#sectd42252"><TT>Style</TT> rule</A>.</P>
1.1 cvs 3639: </BLOCKQUOTE>
3640: <BLOCKQUOTE class="example">
3641: <P>
3642: <STRONG>Example:</STRONG></P>
3643: <P>
1.3 cvs 3644: A numeric attribute representing the importance of the part of the document to
1.1 cvs 3645: which it is attached can be defined:</P>
3646: <PRE>
3647: ATTR
3648: Importance = INTEGER;
3649: </PRE>
3650: <P>
1.4 cvs 3651: In the presentation schema, the importance of an element is reflected in the
1.1 cvs 3652: choice of character size, using the following rules.</P>
3653: <PRE>
3654: ATTRIBUTES
3655: Importance < 2 :
3656: Size : 1;
3657: Importance IN [2..4] :
3658: Size : Importance;
3659: Importance = 10 :
3660: Size : 5;
3661: Importance > 4 :
3662: Size : 4;
3663: </PRE>
3664: <P>
1.4 cvs 3665: Thus, the character size corresponds to the value of the Importance attribute;
1.1 cvs 3666: its value is</P>
3667: <UL>
1.2 cvs 3668: <LI>the value of the Importance attribute when the value is between 2 and 4
1.1 cvs 3669: (inclusive),
3670: <LI>1, when the value of the Importance attribute is less than 2,
1.5 cvs 3671: <LI>4, when the value of the Importance attribute is greater than 4,
1.1 cvs 3672: <LI>5, when the value of the Importance attribute is 10.
3673: </UL>
3674: <P>
1.4 cvs 3675: The last case (value 5) must be defined before the case which handles all
3676: Importance values greater than 4, because the two rules are not disjoint and
3677: the first one defined will have priority. Otherwise, when the Importance
1.1 cvs 3678: attribute has value 10, the font size will be 4.</P>
3679: </BLOCKQUOTE>
3680: <BLOCKQUOTE class="example">
3681: <P>
3682: <STRONG>Example:</STRONG></P>
3683: <P>
1.3 cvs 3684: Suppose the structure defines a list element which can have an attribute
1.1 cvs 3685: defining the type of list (numbered or not):</P>
3686: <PRE>
3687: STRUCT
3688: list (ATTR list_type = enumeration, dash)
3689: = LIST OF (list_item = TEXT);
3690: </PRE>
3691: <P>
1.4 cvs 3692: Then, the presentation schema could use the attribute placed on the list
3693: element to put either a dash or a number before the each element of the
1.1 cvs 3694: list:</P>
3695: <PRE>
3696: ATTRIBUTES
3697: list_type (list_item) = enumeration :
3698: CreateBefore (NumberBox);
3699: list_type (list_item) = dash :
3700: CreateBefore (DashBox);
3701: </PRE>
3702: </BLOCKQUOTE>
3703: <BLOCKQUOTE class="example">
3704: <P>
3705: <STRONG>Example:</STRONG></P>
3706: <P>
1.3 cvs 3707: Suppose that two attributes are defined in the structure schema. The first is
3708: a numeric global attribute called ``version''. The other is a local attribute
3709: defined on the root of the document called ``Document_version'':</P>
1.1 cvs 3710: <PRE>
3711: STRUCTURE Document
3712: ATTR
3713: version = INTEGER;
3714: STRUCT
3715: Document (ATTR Document_version = INTEGER) =
3716: BEGIN
3717: SomeElement ;
3718: ...
3719: SomeOtherElement ;
3720: END ;
3721: ...
3722: </PRE>
3723: <P>
1.4 cvs 3724: These attributes can be used in the presentation schema to place change bars in
3725: the margin next to elements whose version attribute has a value equal to the
3726: Document_version attribute of the root and to place a star in margin of
3727: elements whose version attribute is less than the value of the root's
1.1 cvs 3728: Document_version attribute:</P>
3729: <PRE>
3730: ATTRIBUTES
3731: version EQUAL Document_version :
3732: CreateBefore (ChangeBarBox) ;
3733: version LESS Document_version :
3734: CreateBefore (StarBox) ;
3735: </PRE>
3736: </BLOCKQUOTE>
3737: </DIV>
3738:
3739: <DIV class="subsection">
1.6 cvs 3740: <H3><A name=sectc4212>Value transmission rules</A></H3>
1.1 cvs 3741:
3742: <P>
3743: The last section of a presentation schema, which is optional, serves to
3744: defines the way in which a document transmits certain values to its
3745: sub-documents. A sub-document is an document <A
3746: href="#inclusion">included</A> without expansion or with partial expansion.
3747: The primary document can transmit to its sub-documents the values of certain
3748: counters or the textual content of certain of its elements, as a function of
3749: their type.</P>
3750: <P>
3751: The sub-documents receive these values in attributes which must be defined in
3752: their structure schema as local attributes of the root element. The types of
3753: these attributes must correspond to the type of the value which they receive:
3754: numeric attributes for receiving the value of a counter, textual attributes
3755: for receiving the content of an element.</P>
3756: <P>
3757: In the structure schema of the primary document, there appears at the end,
3758: after the <TT>TRANSMIT</TT> keyword, a sequence of transmission rules. Each
3759: rule begins with the name of the counter to transmit or of the element type
3760: whose textual content will be transmitted. This name is followed by the
3761: keyword <TT>To</TT> and the name of the attribute of the sub-document to which
3762: the value is transmitted. The sub-document class is indicated between
3763: parentheses after the name of the attribute. The transmission rule ends with
3764: a semicolon.</P>
3765: <PRE>
3766: TransmitSeq = Transmit < Transmit > .
3767: Transmit = TypeOrCounter 'To' ExternAttr
3768: '(' ElemID ')' ';' .
3769: TypeOrCounter = CounterID / ElemID .
3770: ExternAttr = NAME .
3771: </PRE>
3772: <BLOCKQUOTE class="example">
3773: <P>
3774: <STRONG>Example:</STRONG></P>
3775: <P>
1.3 cvs 3776: Consider a Book document class which includes instances of the Chapter document
1.1 cvs 3777: class. These classes might have the following schemas:</P>
3778: <PRE>
3779: STRUCTURE Book
3780: STRUCT
3781: Book = BEGIN
3782: Title = Text;
3783: Body = LIST OF (Chapter INCLUDED);
3784: END;
3785: ...
3786:
3787: STRUCTURE Chapter
3788: STRUCT
3789: Chapter (ATTR FirstPageNum = Integer;
3790: ChapterNum = Integer;
3791: CurrentTitle = Text) =
1.6 cvs 3792: BEGIN
3793: ChapterTitle = Text;
3794: ...
3795: END;
1.1 cvs 3796: ...
3797: </PRE>
3798: <P>
3799: Then the presentation schema for books could define chapter and page counters.
3800: The following transmission rules in the book presentation schema would
3801: transmit values for the three attributes defined at the root of each chapter
3802: sub-document.</P>
3803: <PRE>
3804: PRESENTATION Book;
3805: VIEWS
3806: Full_text;
3807: COUNTERS
3808: ChapterCtr: Rank of Chapter;
3809: PageCtr: Rank of Page(Full_text);
3810: ...
3811: TRANSMIT
3812: PageCtr TO FirstPageNum(Chapter);
3813: ChapterCtr TO ChapterNum(Chapter);
3814: Title TO CurrentTitle(Chapter);
3815: END
3816: </PRE>
3817: <P>
3818: Thus, each chapter included in a book can number its pages as a function of
3819: the number of pages preceding it in the book, can make the chapter's number
3820: appear before the number of each of its sections, or can place the title of
3821: the book at the top of each page.</P>
3822: </BLOCKQUOTE>
3823: </DIV>
3824:
3825: <DIV class="subsection">
1.6 cvs 3826: <H3><A name=sectc4213>Presentation rules</A></H3>
1.1 cvs 3827:
3828: <P>
3829: Whether defining the appearance of a presentation or page layout box, an
3830: element type, or an attribute value, the set of presentation rules that apply
3831: is always defined in the same way.</P>
3832: <P>
3833: Normally, a set of presentation rules is placed between the keywords
3834: <TT>BEGIN</TT> and <TT>END</TT>, the keyword <TT>END</TT> being followed by a
3835: semicolon. The first section of this block defines the rules that apply to
1.6 cvs 3836: the primary view, if the <A href="#sectc427">default rules</A> are not
1.1 cvs 3837: completely suitable. Next comes the rules which apply to specific other
3838: views, with a rule sequence for each view for which the default rules are not
3839: satisfactory. If the default rules are suitable for the non-primary views,
3840: there will not be any specific rules for these views. If there is only one
3841: rule which applies to all views then the keywords <TT>BEGIN</TT> and
3842: <TT>END</TT> need not appear.</P>
3843: <P>
3844: For each view, it is only necessary to specify those rules which differ from
3845: the default rules for the view, so that for certain views (or even all views),
3846: there may be no specific rules.</P>
3847: <P>
3848: The specific rules for a non-primary view are introduced by the <A
3849: name="inkeyword"><TT>IN</TT> keyword</A>, followed by the view name. The
3850: rules for that view follow, delimited by the keywords <TT>BEGIN</TT> and
3851: <TT>END</TT>, or without these two keywords when there is only one rule.</P>
3852: <P>
3853: <STRONG>Note:</STRONG> the view name which follows the <TT>IN</TT> keyword
3854: must not be the name of the primary view, since the rules for that view are
3855: found before the rules for the other views.</P>
3856: <P>
3857: Within each block concerning a view, other blocks can appear, delimited by the
3858: same keywords <TT>BEGIN</TT> and <TT>END</TT>. Each of these blocks gathers
3859: the presentation rules that apply, for a given view, only when a given
3860: condition is satisfied. Each block is preceded by a condition introduced by
3861: the <TT>IF</TT> keyword. If such a conditional block contains only one rule,
3862: the keywords <TT>BEGIN</TT> and <TT>END</TT> can be omitted.</P>
3863: <P>
3864: Although the syntax allows any presentation rule to appear in a conditional
1.6 cvs 3865: block, only <A href="#sectc4232">creation rules</A> are allowed after any
1.1 cvs 3866: condition; other rules are allowed only after conditions <TT>Within</TT> and
3867: ElemID. In addition, the following rules cannot be conditional:
3868: <TT>PageBreak, LineBreak, Inline, Gather</TT>.</P>
3869: <P>
3870: For a given view, the rules that apply without any condition must appear
3871: before the first conditional block. If some rules apply only when none of the
3872: specified condition holds, they are grouped in a block preceded by the keyword
3873: <TT>Otherwise</TT>, and that block must appear after the last conditionnal
3874: block concerning the same view.</P>
3875: <PRE>
3876: ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules >
3877: 'END' ';' /
3878: ViewRules / CondRules / Rule .
3879: RulesAndCond = CondRules / Rule .
3880: ViewRules = 'IN' ViewID CondRuleSeq .
3881: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' /
3882: CondRules / Rule .
3883: CondRules = CondRule < CondRule >
3884: [ 'Otherwise' RuleSeq ] .
3885: CondRule = 'IF' ConditionSeq RuleSeq .
3886: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' /
3887: Rule .
3888: </PRE>
3889: <BLOCKQUOTE class="example">
3890: <P>
3891: <STRONG>Example:</STRONG></P>
3892: <P>
1.3 cvs 3893: The following rules for a report's title make the title visible in the primary
3894: view and invisible in the table of contents and in the formula views (see the
1.6 cvs 3895: <A href="#sectc4224"><TT>Visibility</TT> rule</A>).</P>
1.1 cvs 3896: <PRE>
3897: Title : BEGIN
3898: Visibility : 1;
3899: ... {Other rules for the primary view}
3900: IN Table_of_contents
3901: Visibility : 0;
3902: IN Formulas
3903: Visibility : 0;
3904: END;
3905: </PRE>
3906: </BLOCKQUOTE>
3907: </DIV>
3908:
3909: <DIV class="subsection">
1.6 cvs 3910: <H3><A name=sectc4214>Conditions applying to presentation rules</A></H3>
1.1 cvs 3911:
3912: <P>
3913: Many conditions can be applied to presentation rules. Conditions allow
3914: certain presentation rules to apply only in certain cases. These conditions
3915: can be based on the structural position of the element. They can be based on
3916: whether the element has references, and what type of references, whether the
3917: element has attributes, whether the element is empty or not. They can also be
3918: based on the value of a counter.</P>
3919: <P>
3920: It is possible to specify several conditions which must all be true for the
3921: rules to apply.</P>
3922: <P>
3923: A set of conditions is specified by the <TT>IF</TT> keyword. This keyword is
3924: followed by the sequence of conditions, separated by the <TT>AND</TT> keyword.
3925: Each condition is specified by a keyword which defines the condition type. In
3926: some cases, the keyword is followed by other data, which specify the condition
3927: more precisely.</P>
3928: <P>
3929: An elementary condition can be negative; it is then preceded by the
3930: <TT>NOT</TT> keyword.</P>
3931: <P>
3932: When the presentation rule(s) controlled by the condition apply to a reference
3933: element or a reference attribute, an elementary condition can also apply to
3934: element referred by this reference. The <TT>Target</TT> keyword is used for
3935: that purpose. It must appear before the keyword defining the condition
3936: type.</P>
3937: <PRE>
1.6 cvs 3938: CondRule ='IF' ConditionSeq RuleSeq .
1.1 cvs 3939: ConditionSeq = Condition < 'AND' Condition > .
3940: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem .
3941: ConditionElem ='First' / 'Last' /
3942: [ 'Immediately' ] 'Within' [ NumParent ]
3943: ElemID [ ExtStruct ] /
3944: ElemID /
3945: 'Referred' / 'FirstRef' / 'LastRef' /
3946: 'ExternalRef' / 'InternalRef' / 'CopyRef' /
3947: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' /
3948: 'UserPage' / 'StartPage' / 'ComputedPage' /
3949: 'Empty' /
3950: '(' [ MinMax ] CounterName CounterCond ')' /
3951: CondPage '(' CounterID ')' .
3952: NumParent = [ GreaterLess ] NParent .
1.6 cvs 3953: GreaterLess ='>' / '<' .
1.1 cvs 3954: NParent = NUMBER.
1.6 cvs 3955: ExtStruct ='(' ElemID ')' .
1.1 cvs 3956: CounterCond ='<' MaxCtrVal / '>' MinCtrVal /
3957: '=' EqCtrVal /
3958: 'IN' '[' ['-'] MinCtrBound '.' '.'
3959: ['-'] MaxCtrBound ']' .
3960: PageCond ='Even' / 'Odd' / 'One' .
3961: MaxCtrVal = NUMBER .
3962: MinCtrVal = NUMBER .
3963: EqCtrVal = NUMBER .
3964: MaxCtrBound = NUMBER .
3965: MinCtrBound = NUMBER .
3966: </PRE>
3967:
3968: <DIV class="subsubsection">
1.6 cvs 3969: <H4><A name=sectd42141>Conditions based on the logical position of the element</A></H4>
1.1 cvs 3970:
3971: <P>
3972: The condition can be on the position of the element in the document's logical
3973: structure tree. It is possible to test whether the element is the first
3974: (<TT>First</TT>) or last (<TT>Last</TT>) among its siblings or if it is not
3975: the first (<TT>NOT First</TT>) or not the last (<TT>NOT Last</TT>). These
1.6 cvs 3976: conditions can be associated only with <A href="#sectc4232">creation
1.1 cvs 3977: rules</A>.</P>
3978: <P>
3979: It is also possible to test if the element is contained in an element of a
3980: given type (<TT>Within</TT>) or if it is not (<TT>NOT Within</TT>). The type
3981: is indicated after the keyword <TT>Within</TT>. If that element type is
3982: defined in a structure schema which is not the one which corresponds to the
3983: presentation schema, the type name of this element must be followed, between
3984: parentheses, by the name of the structure schema which defines it.</P>
3985: <P>
3986: If the keyword <TT>Within</TT> is preceded by <TT>Immediately</TT>, the
3987: condition is satisfied only if the <EM>parent</EM> element has the type
3988: indicated. If the word <TT>Immediately</TT> is missing, the condition is
3989: satisfied if any <EM>ancestor</EM> has the type indicated.</P>
3990: <P>
3991: An integer <I>n</I> can appear between the keyword <TT>Within</TT> and the
3992: type. It specifies the number of ancestors of the indicated type that must be
3993: present for the condition to be satisfied. If the keyword
3994: <TT>Immediately</TT> is also present, the <I>n</I> immediate ancestors of the
3995: element must have the indicated type. The integer <I>n</I> must be positive
3996: or zero. It can be preceded by <TT><</TT> or <TT>></TT> to indicate a
3997: maximum or minimum number of ancestors. If these symbols are missing, the
3998: condition is satisfied only if it exists exactly <I>n</I> ancestors. When
3999: this number is missing, it is equivalent to > 0.</P>
4000: <P>
4001: If the condition applies to presentation rules associated with an attribute,
4002: in the <TT>ATTRIBUTES</TT> section of the presentation schema, the condition
4003: can be simply an element name. Presentation rules are then executed only if
4004: the attribute is attached to an element of that type. The keyword <TT>NOT</TT>
4005: before the element name indicates that the presentation rules must be executed
4006: only if the element is not of the type indicated.</P>
4007: </DIV>
4008:
4009: <DIV class="subsubsection">
1.6 cvs 4010: <H4><A name=sectd42142>Conditions on references</A></H4>
1.1 cvs 4011:
4012: <P>
4013: References may be taken into account in conditions, which can be based on the
4014: fact that the element, or one of its ancestors, is designated by a at least
4015: one reference (<TT>Referred</TT>) or by none (<TT>NOT Referred</TT>).</P>
4016: <P>
4017: If the element or attribute to which the condition is attached is a reference,
4018: the condition can be based on the fact that it acts as the first reference to
4019: the designated element (<TT>FirstRef</TT>), or as the last (<TT>LastRef</TT>),
4020: or as a reference to an element located in another document
4021: (<TT>ExternalRef</TT>) or in the same document (<TT>InternalRef</TT>).</P>
4022: <P>
4023: The condition can also be based on the fact that the element is an <A
4024: href="#inclusion">inclusion</A>. This is noted (<TT>CopyRef</TT>).</P>
4025: <P>
4026: Like all conditions, conditions on references can be inverted by the
4027: <TT>NOT</TT> keyword. These conditions can be associated only with <A
1.6 cvs 4028: href="#sectc4232">creation rules</A>.</P>
1.1 cvs 4029: </DIV>
4030:
4031: <DIV class="subsubsection">
1.6 cvs 4032: <H4><A name=sectd42143>Conditions on logical attributes</A></H4>
1.1 cvs 4033:
4034: <P>
4035: The condition can be based on the presence or absence of attributes associated
4036: with the element, no matter what the attributes or their values. The
4037: <TT>AnyAttributes</TT> keyword expresses this condition.</P>
4038: <P>
4039: If the condition appears in the presentation rules of an attribute, the
4040: <TT>FirstAttr</TT> and <TT>LastAttr</TT> keywords can be used to indicate that
4041: the rules must only be applied if this attribute is the first attribute for
4042: the element or if it is the last (respectively). These conditions can also be
4043: inverted by the <TT>NOT</TT> keyword. These conditions can be associated only
1.6 cvs 4044: with <A href="#sectc4232">creation rules</A>.</P>
1.1 cvs 4045: <P>
4046: It is also possible to apply certain presentation rules only when the element
4047: being processed or one of its ancestors has a certain attribute, perhaps with
4048: a certain value. This can be done in the <A
1.6 cvs 4049: href="#sectc4210"><TT>ATTRIBUTES</TT> section</A>.</P>
1.1 cvs 4050: </DIV>
4051:
4052: <DIV class="subsubsection">
1.6 cvs 4053: <H4><A name=sectd42144>Conditions on page breaks</A></H4>
1.1 cvs 4054:
4055: <P>
4056: The page break base type (and only this type) can use the following
4057: conditions: <TT>ComputedPage</TT>, <TT>StartPage</TT>, and <TT>UserPage</TT>.
4058: The <TT>ComputedPage</TT> condition indicates that the presentation rule(s)
4059: should apply if the page break was created automatically by Thot; the
4060: <TT>StartPage</TT> condition is true if the page break is generated before the
4061: element by the <TT>Page</TT> rule; and the <TT>UserPage</TT> condition applies
4062: if the page break was inserted by the user.</P>
4063: <P>
1.6 cvs 4064: These conditions can be associated only with <A href="#sectc4232">creation
1.1 cvs 4065: rules</A>.</P>
4066: </DIV>
4067:
4068: <DIV class="subsubsection">
1.6 cvs 4069: <H4><A name=sectd42145>Conditions on the element's content</A></H4>
1.1 cvs 4070:
4071: <P>
4072: The condition can be based on whether or not the element is empty. An element
4073: which has no children or whose leaves are all empty is considered to be empty
4074: itself. This condition is expressed by the <TT>Empty</TT> keyword, optionally
4075: preceded by the <TT>NOT</TT> keyword. This condition can be associated only
1.6 cvs 4076: with <A href="#sectc4232">creation rules</A>.</P>
1.1 cvs 4077: </DIV>
4078:
4079: <DIV class="subsubsection">
1.6 cvs 4080: <H4><A name=sectd42146>Conditions on counters</A></H4>
1.1 cvs 4081:
4082: <P>
4083: Presentation rules can apply when the counter's value is one, is even or odd,
4084: is equal, greater than or less than a given value or falls in a range of
4085: values. This is particularly useful for creating header and footer boxes.
1.6 cvs 4086: These conditions can be associated only with <A href="#sectc4232">creation
1.1 cvs 4087: rules</A>.</P>
4088: <P>
4089: To compare the value of a counter to a given value, a comparison is given
4090: between parentheses. The comparison is composed of the counter name followed
4091: by an equals, greater than, or less than sign and the value to which the
4092: counter will be compared. A test for whether or not a counter's value falls
4093: in a range also appears within parentheses. In this case, the counter name is
4094: followed by the <TT>IN</TT> keyword and the range definition within brackets.
4095: The <TT>Even</TT>, <TT>Odd</TT> and <TT>One</TT> are used to test a counter's
4096: value and are followed by the counter name between parentheses.</P>
4097: <P>
4098: The list of possible conditions on counters is:</P>
4099: <DL>
4100: <DT><TT>Even (Counter)</TT></DT>
1.2 cvs 4101: <DD>the box is created only if the counter has an even value.
1.1 cvs 4102: </DD>
4103: <DT><TT>Odd (Counter)</TT></DT>
1.2 cvs 4104: <DD>the box is created only if the counter has an odd value.
1.1 cvs 4105: </DD>
4106: <DT><TT>One (Counter)</TT></DT>
1.2 cvs 4107: <DD>the box is created only the counter's value is 1.
1.1 cvs 4108: </DD>
4109: <DT><TT>NOT One (Counter)</TT></DT>
1.5 cvs 4110: <DD>the box is created, unless the counter's value is 1.
1.1 cvs 4111: </DD>
4112: <DT><TT>(Counter < Value)</TT></DT>
1.5 cvs 4113: <DD>the box is created only if the counter's value is less than Value.
1.1 cvs 4114: </DD>
4115: <DT><TT>(Counter > Value)</TT></DT>
1.5 cvs 4116: <DD>the box is created only if the counter's value is greater than Value.
1.1 cvs 4117: </DD>
4118: <DT><TT>(Counter = Value)</TT></DT>
1.5 cvs 4119: <DD>the box is created only if the counter's value is equal to Value.
1.1 cvs 4120: </DD>
4121: <DT><TT>NOT (Counter = Value)</TT></DT>
1.5 cvs 4122: <DD>the is created only if the counter's value is different than Value.
1.1 cvs 4123: </DD>
4124: <DT><TT>(Counter IN [MinValue..MaxValue])</TT></DT>
1.5 cvs 4125: <DD>the box is created only if the counter's value falls in the range bounded
4126: by MinValue and MaxValue (inclusive).
1.1 cvs 4127: </DD>
4128: <DT><TT>NOT (Counter IN [MinValue..MaxValue])</TT></DT>
1.5 cvs 4129: <DD>the box is created only if the value of the counter does not fall in the
4130: range bounded by MinValue and MaxValue (inclusive).
1.1 cvs 4131: </DD>
4132: </DL>
4133: <P>
4134: <STRONG>Note:</STRONG> the <TT>NOT Even</TT> and <TT>NOT Odd</TT> conditions
4135: are syntactically correct but can be expressed more simply by <TT>Odd</TT> and
4136: <TT>Even</TT>, respectively.</P>
4137: </DIV>
4138: </DIV>
4139:
4140: <DIV class="subsection">
1.6 cvs 4141: <H3><A name=sectc4215>A presentation rule</A></H3>
1.1 cvs 4142:
4143: <P>
4144: A presentation rule defines either a presentation parameter or presentation
4145: function. The parameters are:</P>
4146: <UL>
1.2 cvs 4147: <LI>the position of the vertical and horizontal reference axes of the box,
1.1 cvs 4148: <LI>the position of the box in relation to other boxes,
4149: <LI>the height or width of the box, with overflow exceptions,
1.2 cvs 4150: <LI>the characteristics of the lines contained in the box: linespacing,
1.1 cvs 4151: indentation of the first line, justification, hyphenation,
4152: <LI>the conditions for breaking the box across pages,
1.2 cvs 4153: <LI>the characteristics of the characters contained in the box: size, font,
1.1 cvs 4154: style, underlining,
1.2 cvs 4155: <LI>the depth of the box among overlapping boxes (often called stacking
4156: order),
4157: <LI>the characteristics of graphic elements contained in the box: style and
1.1 cvs 4158: thickness of lines, fill pattern for closed objects,
1.2 cvs 4159: <LI>the colors in text, graphics, pictures, and symbols contained in the box
4160: are displayed or printed,
1.1 cvs 4161: <LI>for presentation boxes only, the contents of the box.
4162: </UL>
4163: <P>
1.13 cvs 4164: The <A name="presfunct">presentation functions</A> are:</P>
1.1 cvs 4165: <UL>
4166: <LI>the creation of a presentation box
4167: <LI>the line-breaking or page-breaking style,
1.13 cvs 4168: <LI>the copying of another box,
4169: <LI>the display of the box background and border,
4170: <LI>the display of a background picture and its aspect.
1.1 cvs 4171: </UL>
4172: <P>
4173: For each box and each view, every presentation parameter is defined once and
1.6 cvs 4174: only once, either explicitly or by the <A href="#sectc427">default
1.1 cvs 4175: rules</A>. In contrast, presentation functions are not obligatory and can
4176: appear many times for the same element. for example an element can create
4177: many presentation boxes. Another element may not use any presentation
4178: functions.</P>
4179: <P>
4180: Each rule defining a presentation parameter begins with a keyword followed by
1.13 cvs 4181: a colon. The keyword indicates the parameter which is the subject of the rule.
1.1 cvs 4182: After the keyword and the colon, the remainder of the rule varies. All rules
4183: are terminated by a semicolon.</P>
4184: <PRE>
1.6 cvs 4185: Rule = PresParam ';' / PresFunc ';' .
4186: PresParam ='VertRef' ':' PositionHoriz /
4187: 'HorizRef' ':' PositionVert /
4188: 'VertPos' ':' VPos /
4189: 'HorizPos' ':' HPos /
4190: 'Height' ':' Dimension /
4191: 'Width' ':' Dimension /
4192: 'VertOverflow' ':' Boolean /
1.1 cvs 4193: 'HorizOverflow' ':' Boolean /
1.6 cvs 4194: 'LineSpacing' ':' DistanceInherit /
4195: 'Indent' ':' DistanceInherit /
4196: 'Adjust' ':' AdjustInherit /
4197: 'Justify' ':' BoolInherit /
4198: 'Hyphenate' ':' BoolInherit /
4199: 'PageBreak' ':' Boolean /
4200: 'LineBreak' ':' Boolean /
4201: 'InLine' ':' Boolean /
4202: 'NoBreak1' ':' AbsDist /
4203: 'NoBreak2' ':' AbsDist /
4204: 'Gather' ':' Boolean /
4205: 'Visibility' ':' NumberInherit /
4206: 'Size' ':' SizeInherit /
4207: 'Font' ':' NameInherit /
4208: 'Style' ':' StyleInherit /
4209: 'Underline' ':' UnderLineInherit /
4210: 'Thickness' ':' ThicknessInherit /
4211: 'Depth' ':' NumberInherit /
4212: 'LineStyle' ':' LineStyleInherit /
4213: 'LineWeight' ':' DistanceInherit /
4214: 'FillPattern' ':' NameInherit /
4215: 'Background' ':' NameInherit /
1.13 cvs 4216: 'Foreground' ':' NameInherit /
1.6 cvs 4217: 'Content' ':' VarConst .
1.1 cvs 4218: PresFunc = Creation '(' BoxID ')' /
4219: 'Line' /
4220: 'NoLine' /
4221: 'Page' '(' BoxID ')' /
1.13 cvs 4222: 'Copy' '(' BoxTypeToCopy ')' /
4223: 'ShowBox' /
4224: 'BackgroundPicture' ':' FileName /
4225: 'PictureMode' ':' PictMode /
1.1 cvs 4226: </PRE>
4227: </DIV>
4228:
4229: <DIV class="subsection">
1.6 cvs 4230: <H3><A name=sectc4216>Box axes</A></H3>
1.1 cvs 4231:
4232: <P>
4233: The position of the middle axes <TT>VMiddle</TT> and <TT>HMiddle</TT> in
4234: relation to their box is always calculated automatically as a function of the
4235: height and width of the box and is not specified by the presentation rules. In
4236: the presentation schema, these middle axes are used only to position their box
4237: with respect to another by specifying the distance between the middle axis and
1.6 cvs 4238: an axis or a side of another box (see the <A href="#sectc4218">relative
1.1 cvs 4239: position</A>).</P>
4240: <P>
4241: The reference axes of a box are also used to position their box in relation to
4242: another, but in contrast to the middle axes, the presentation schema must make
4243: their position explicit, either in relation to a side or the middle axis of
4244: the box itself, or in relation to an axis of an enclosed box.</P>
4245: <P>
4246: Only boxes of base elements have predefined reference axes. For character
4247: string boxes, the horizontal reference axis is the baseline of the characters
4248: (the line which passes immediately under the upper-case letters, ignoring the
4249: letter Q) and the vertical reference axis is at the left edge of the first
4250: character of the string.</P>
4251: <P>
4252: The positions of a box's reference axes are defined by the <TT>VertRef</TT>
4253: and <TT>HorizRef</TT> rules which specify the <A href="#distance">distance</A>
4254: between the reference axis and an axis or parallel side of the same box or of
4255: an enclosed box.</P>
4256: <PRE>
1.6 cvs 4257: 'VertRef' ':' PositionHoriz
1.1 cvs 4258: 'HorizRef' ':' PositionVert
4259: </PRE>
4260: <BLOCKQUOTE class="example">
4261: <P>
4262: <STRONG>Example:</STRONG></P>
4263: <P>
1.3 cvs 4264: If, in the structure schema for mathematical formulas, the fraction element is
1.1 cvs 4265: defined by</P>
4266: <PRE>
4267: Fraction = BEGIN
4268: Numerator = Expression;
4269: Denominator = Expression;
4270: END;
4271: </PRE>
4272: <P>
1.3 cvs 4273: then the horizontal reference axis of the fraction can be positioned on top of
1.1 cvs 4274: the denominator by the rule:</P>
4275: <PRE>
4276: Fraction :
4277: BEGIN
4278: HorizRef : Enclosed Denominator . Top;
4279: ...
4280: END;
4281: </PRE>
4282: <P>
4283: To put the horizontal reference axis of a column at its middle:</P>
4284: <PRE>
4285: Column :
4286: BEGIN
4287: HorizRef : * . HMiddle;
4288: ...
4289: END;
4290: </PRE>
4291: </BLOCKQUOTE>
4292: </DIV>
4293:
4294: <DIV class="subsection">
1.6 cvs 4295: <H3><A name=sectc4217>Distance units</A></H3>
1.1 cvs 4296:
4297: <P>
4298: Some distances and dimensions appear in many rules of a presentation schema,
4299: especially in position rules (<TT>VertPos, HorizPos</TT>), in extent rules for
4300: boxes (<TT>Height, Width</TT>), in rules defining lines (<TT>LineSpacing,
4301: Indent</TT>), in rules controlling pagination (<TT>NoBreak1, NoBreak2</TT>)
4302: and in rules specifying the thickness of strokes (<TT>LineWeight</TT>).</P>
4303: <P>
4304: In all these rules, the distance or extent can be expressed</P>
4305: <UL>
1.2 cvs 4306: <LI>either in relative units, which depend on the size of the characters in
4307: the current font: height of the element's font or height of the letter 'x',
4308: <LI>or in absolute units: centimeter, millimeter, inch, typographer's point,
1.1 cvs 4309: pica or pixel.
4310: </UL>
4311: <P>
1.5 cvs 4312: Units can be chosen freely. Thus, it is possible to use relative units in one
4313: rule, centimeters in the next rule, and typographer's points in another.</P>
1.1 cvs 4314: <P>
4315: Absolute units are used to set rigid rules for the appearance of documents. In
4316: contrast, relative units allow changes of scale. The editor lets the value of
4317: relative units be changed dynamically. Such changes affect every box using
4318: relative units simultaneously and in the same proportion. Changing the value
4319: of the relative units affects the size of the characters and graphical
4320: elements, and the size of the boxes and the distances between them.</P>
4321: <P>
4322: A <A name="distance">distance</A> or extent is specified by a number, which
4323: may be followed by one or more spaces and a units keyword. When there is no
4324: units keyword, the number specifies the number of relative units, where a
4325: relative unit is the height of a character in the current font (an em). When
4326: the number is followed by a units keyword, the keyword indicates the type of
4327: absolute units:</P>
4328: <UL>
4329: <LI><TT>em</TT>: height of the element's font,
4330: <LI><TT>ex</TT>: height of the letter 'x',
4331: <LI><TT>cm</TT>: centimeter,
4332: <LI><TT>mm</TT>: millimeter,
4333: <LI><TT>in</TT>: inch (1 in = 2.54 cm),
4334: <LI><TT>pt</TT>: point (1 pt = 1/72 in),
4335: <LI><TT>pc</TT>: pica (1 pc = 12 pt),
4336: <LI><TT>px</TT>: pixel.
4337: </UL>
4338: <P>
4339: Whatever the chosen unit, relative or absolute, the number is not necessarily
4340: an integer and may be expressed in fixed point notation (using the American
4341: convention of a period to express the decimal point).</P>
4342: <P>
4343: If the distance appears in a presentation rule for a numeric attribute, the
4344: number can be replaced by the name of an attribute. In this case, the value
4345: of the attribute is used. Obviously, the attribute name cannot be followed by
4346: a decimal point and a fractional part, but it can be followed a units keyword.
4347: However, the choice of units is limited to em, ex, pt and px.</P>
4348: <PRE>
4349: Distance = [ Sign ] AbsDist .
4350: Sign ='+' / '-' .
4351: AbsDist = IntegerOrAttr [ '.' DecimalPart ]
4352: [ Unit ].
4353: IntegerOrAttr = IntegerPart / AttrID .
4354: IntegerPart = NUMBER .
4355: DecimalPart = NUMBER .
4356: Unit ='em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' /
4357: 'pc' / 'px' / '%' .
4358: </PRE>
4359: <BLOCKQUOTE class="example">
4360: <P>
4361: <STRONG>Example:</STRONG></P>
4362: <P>
1.3 cvs 4363: The following rules specify that a box has a height of 10.5 centimeters and a
1.1 cvs 4364: width of 5.3 ems:</P>
4365: <PRE>
4366: Height : 10.5 cm;
1.6 cvs 4367: Width : 5.3;
1.1 cvs 4368: </PRE>
4369: </BLOCKQUOTE>
4370: </DIV>
4371:
4372: <DIV class="subsection">
1.6 cvs 4373: <H3><A name=sectc4218>Relative positions</A></H3>
1.1 cvs 4374:
4375: <P>
4376: The positioning of boxes uses the eight axes and sides, the sides generally
4377: being used to define the juxtapositioning (vertical or horizontal) of boxes,
4378: the middle axes being used to define centering, and the reference axes being
4379: used for alignment.</P>
4380: <P>
4381: Two rules allow a box to placed relative to other boxes. The <TT>VertPos</TT>
4382: rule positions the box vertically. The <TT>HorizPos</TT> rule positions the
4383: box horizontally. It is possible that a box's position could be entirely
4384: determined by other boxes positioned relative to it. In this case, the
4385: position is implicit and the word <TT>nil</TT> can be used to specify that no
4386: position rule is needed. Otherwise, an explicit rule must be given by
4387: indicating the axis or side which defines the position of the box, followed by
4388: an equals sign and the distance between between this axis or side and a
4389: parallel axis or side of another box, called the reference box. The box for
4390: which the rule is written will be positioned relative to the reference
4391: box.</P>
4392: <PRE>
1.6 cvs 4393: 'VertPos' ':' VPos
4394: 'HorizPos' ':' HPos
4395: HPos = 'nil' / VertAxis '=' HorizPosition
4396: [ 'UserSpecified' ].
4397: VPos = 'nil' / HorizAxis '=' VertPosition
4398: [ 'UserSpecified' ].
1.1 cvs 4399: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' .
4400: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .
4401: </PRE>
4402: <P>
4403: The reference box is an adjacent box: enclosing, enclosed or adjacent. When a
4404: rule is associated with a reference type attribute (and only in this case), it
4405: can be a box of the element designated by the attribute. The reference box
4406: can be either a presentation box previously defined in the <TT>BOXES</TT>
4407: section of the schema and created by a creation function, or the box
4408: associated with a structured element.</P>
4409: <P>
4410: The structural position of the reference box (relative to the box for which
4411: the rule is being written) is indicated by a keyword: <TT>Enclosing</TT>,
4412: <TT>Enclosed</TT>, or, for sibling boxes, <TT>Previous</TT> or <TT>Next</TT>.
4413: The reference attributes, or presentation boxes created by a reference
4414: attribute, the <TT>Referred</TT> keyword may be used to designate the element
4415: which the reference points to. The keyword <TT>Creator</TT> can be used in
4416: rules for presentation boxes to designate the box of the element which created
4417: the presentation box. Finally, the <TT>Root</TT> keyword can be used to
4418: designate the root of the document.</P>
4419: <P>
4420: When the keyword is ambiguous, it is followed by a name of a type or
4421: presentation box which resolves the ambiguity (the <TT>Creator</TT> and
4422: <TT>Root</TT> keywords are never ambiguous). If this name is not given, then
4423: the first box encountered is used as the reference box. It is also possible to
4424: use just the name of a type or presentation box without an initial keyword. In
4425: this case, a sibling having that name will be used. If the name is preceded
4426: by the keyword <TT>NOT</TT>, then the reference box will be the first box
4427: whose type is not the named one. In place of the box or type name, the
4428: keywords <TT>AnyElem</TT> and <TT>AnyBox</TT> can be used, representing
4429: respectively, any structured element box and any presentation box. A type
4430: name may be preceded by a star in order to resolve the ambiguity in the
4431: special case where the structure schema defines an <A
1.6 cvs 4432: href="#sectd3284">inclusion</A> without expansion (or with partial expansion)
1.1 cvs 4433: of the same type as an element of the scheme. For mark pairs (and only for <A
1.6 cvs 4434: href="#sectd3285">mark pairs</A>) the type name <EM>must</EM> be preceded by the
1.1 cvs 4435: <TT>First</TT> or <TT>Second</TT> keyword, which indicates which of the two
4436: marks of the pair should be used as the reference box.</P>
4437: <P>
4438: The star character ('<TT>*</TT>') used alone designates the box to which the
4439: rule applies (in this case, it is obviously useless to specify the type of the
4440: reference box).</P>
4441: <P>
4442: The keywords <TT>Enclosing</TT> and <TT>Enclosed</TT> can be used no matter
4443: what constructor defines the type to which the rule applies. When applied to
4444: the element which represents the entire document, <TT>Enclosing</TT>
4445: designates the window or page in which the document's image is displayed for
4446: the view to which the rule applies. A box or type name without a keyword is
4447: used for aggregate elements and designates another element of the same
4448: aggregate. It can also be used to designate a presentation or page layout
4449: box. The keywords <TT>Previous</TT> and <TT>Next</TT> are primarily used to
4450: denote list elements, but can also be used to denote elements of an
4451: aggregate.</P>
4452: <P>
4453: In the position rule, the structural position relative to the reference box is
4454: followed, after a period, by the name of an axis or side. The rule specifies
4455: its node's position as being some distance from this axis or side of the
4456: reference box. If this distance is zero, then the distance does not appear in
4457: the rule. Otherwise, it does appear as a positive or negative number (the
4458: sign is required for negative numbers). The sign takes into account the
4459: orientation of the coordinate axes: for top to bottom for the vertical axis
4460: and from left to right for the horizontal axis. Thus, a negative distance in
4461: a vertical position indicates that the side or axis specified in the rule is
4462: above the side or axis of the reference box.</P>
4463: <P>
4464: The distance can be followed by the <TT>UserSpecified</TT> keyword (even if
4465: the distance is nil and does not appear, the <TT>UserSpecified</TT> keyword
4466: can be used). It indicates that when the element to which the rule applies is
4467: being created, the editor will ask the user to specify the distance himself,
4468: using the mouse. In this case, the distance specified in the rule is a
4469: default distance which is suggested to the user but can be modified. The
4470: <TT>UserSpecified</TT> keyword can be used either in the vertical position
4471: rule, the horizontal position rule, or both.</P>
4472: <PRE>
4473: VertPosition = Reference '.' HorizAxis [ Distance ] .
4474: HorizPosition = Reference '.' VertAxis [ Distance ] .
4475: Reference ='Enclosing' [ BoxTypeNot ] /
4476: 'Enclosed' [ BoxTypeNot ] /
4477: 'Previous' [ BoxTypeNot ] /
4478: 'Next' [ BoxTypeNot ] /
4479: 'Referred' [ BoxTypeNot ] /
4480: 'Creator' /
4481: 'Root' /
4482: '*' /
4483: BoxOrType .
4484: BoxOrType = BoxID /
4485: [ '*' ] [ FirstSec ] ElemID /
4486: 'AnyElem' / 'AnyBox' .
4487: BoxTypeNot = [ 'NOT' ] BoxOrType .
4488: </PRE>
4489: <BLOCKQUOTE class="example">
4490: <P>
4491: <STRONG>Example:</STRONG></P>
4492: <P>
1.5 cvs 4493: If a <A name="expos1">report</A> is defined by the following
1.3 cvs 4494: structure schema:</P>
1.1 cvs 4495: <PRE>
4496: Report = BEGIN
1.6 cvs 4497: Title = Text;
4498: Summary = Text;
4499: Keywords = Text;
4500: ...
4501: END;
1.1 cvs 4502: </PRE>
4503: <P>
4504: then the presentation schema could contain the rules:</P>
4505: <PRE>
4506: Report : BEGIN
1.6 cvs 4507: VertPos : Top = Enclosing . Top;
4508: HorizPos : Left = Enclosing . Left;
4509: ...
4510: END;
1.1 cvs 4511: </PRE>
4512: <P>
1.3 cvs 4513: These rules place the <A name="reportexample">report</A> in the upper left
4514: corner of the enclosing box, which is the window in which the document is being
1.1 cvs 4515: edited.</P>
4516: <PRE>
1.6 cvs 4517: Title : BEGIN
4518: VertPos : Top = Enclosing . Top + 1;
4519: HorizPos : VMiddle = Enclosing . VMiddle;
4520: ...
4521: END;
1.1 cvs 4522: </PRE>
4523: <P>
1.3 cvs 4524: The top of the title is one line (a line has the height of the characters of
4525: the title) from the top of the report, which is also the top of the editing
4526: window. The title is centered horizontally in the window (see <A
1.1 cvs 4527: href="#posdim">figure</A>).</P>
4528: <PRE>
1.6 cvs 4529: Summary : BEGIN
1.1 cvs 4530: VertPos : Top = Title . Bottom + 1.5;
4531: HorizPos : Left = Enclosing . Left + 2 cm;
4532: ...
4533: END;
4534: </PRE>
4535: <P>
1.3 cvs 4536: The top of the summary is place a line and a half below the bottom of the title
1.1 cvs 4537: and is shifted two centimeters from the side of the window.</P>
4538: </BLOCKQUOTE>
4539: <BLOCKQUOTE class="example">
4540: <P>
4541: <STRONG>Example:</STRONG></P>
4542: <P>
1.3 cvs 4543: Suppose there is a <A name="expos2">Design</A> logical structure which contains
1.1 cvs 4544: graphical elements:</P>
4545: <PRE>
4546: Design = LIST OF (ElemGraph = GRAPHICS);
4547: </PRE>
4548: <P>
1.3 cvs 4549: The following rules allow the user to freely choose the position of each
1.1 cvs 4550: element when it is created:</P>
4551: <PRE>
4552: ElemGraph =
4553: BEGIN
4554: VertPos : Top = Enclosing . Top + 1 cm UserSpecified;
4555: HorizPos: Left = Enclosing . Left UserSpecified;
4556: ...
4557: END;
4558: </PRE>
4559: <P>
1.3 cvs 4560: Thus, when a graphical element is created, its default placement is at the left
4561: of the window and 1 cm from the top, but the user can move it immediately,
1.1 cvs 4562: simply by moving the mouse.</P>
4563: </BLOCKQUOTE>
4564: </DIV>
4565:
4566: <DIV class="subsection">
1.6 cvs 4567: <H3><A name=sectc4219>Box extents</A></H3>
1.1 cvs 4568:
4569: <P>
4570: The extents (height and width) of each box are defined by the two rules
4571: <TT>Height</TT> and <TT>Width</TT>. There are three types of extents: fixed,
4572: relative, and elastic.</P>
4573:
4574: <DIV class="subsubsection">
1.6 cvs 4575: <H4><A name=sectd42191>Fixed extents</A></H4>
1.1 cvs 4576:
4577: <P>
4578: A fixed dimension sets the height or width of the box independently of all
1.6 cvs 4579: other boxes. It is expressed in <A href="#sectc4217">distance units</A>. The
1.1 cvs 4580: extent can be followed by the <TT>UserSpecified</TT> keyword which indicates
4581: that when the element to which the rule applies is being created, the editor
4582: will ask the user to specify the extent himself, using the mouse. In this
4583: case, the extent specified in the rule is a default extent which is suggested
4584: to the user but can be modified. The <TT>UserSpecified</TT> keyword can be
4585: used either in the <TT>Height</TT> rule, the <TT>Width</TT> rule, or both.</P>
4586: <P>
4587: A fixed extent rule can be ended by the <TT>Min</TT> keyword, which signifies
4588: that the indicated value is a minimum, and that, if the contents of the box
4589: require it, a larger extent is possible.</P>
4590: <PRE>
4591: 'Height' ':' Dimension
4592: 'Width' ':' Dimension
4593: Dimension = AbsDist [ 'UserSpecified' ] [ 'Min' ] /
4594: ...
4595: </PRE>
4596: <BLOCKQUOTE class="example">
4597: <P>
4598: <STRONG>Example:</STRONG></P>
4599: <P>
1.3 cvs 4600: Continuing with the <A href="#expos2">previous example</A>, it is possible to
4601: allow the user to choose the size of each graphical element as it is
1.1 cvs 4602: created:</P>
4603: <PRE>
4604: ElemGraph : BEGIN
1.6 cvs 4605: Width : 2 cm UserSpecified;
1.1 cvs 4606: Height : 1 cm UserSpecified;
4607: ...
4608: END;
4609: </PRE>
4610: <P>
4611: Thus, when a graphical element is create, it is drawn by default with a width
4612: of 2 cm and a height of 1 cm, but the user is free to resize it immediately
4613: with the mouse.</P>
4614: <PRE>
4615: Summary : BEGIN
4616: Height : 5 cm Min;
4617: ...
4618: END;
4619: Keywords : BEGIN
4620: VertPos : Top = Summary . Bottom;
4621: ...
4622: END;
4623: </PRE>
4624: </BLOCKQUOTE>
4625: </DIV>
4626:
4627: <DIV class="subsubsection">
1.6 cvs 4628: <H4><A name=sectd42192>Relative extents</A></H4>
1.1 cvs 4629:
4630: <P>
4631: A relative extent determines the extent as a function of the extent of another
4632: box, just as a relative position places a box in relation to another. The
4633: reference box in an extent rule is designated using the same syntax as is used
4634: in a relative position rule. It is followed by a period and a <TT>Height</TT>
4635: or <TT>Width</TT> keyword, depending on the extent being referred to. Next
4636: comes the relation between the extent being defined and the extent of the
4637: reference box. This relation can be either a percentage or a difference.</P>
4638: <P>
4639: A percentage is indicated by a star (the multiplication symbol) followed by
4640: the numeric percentage value (which may be greater than or less than 100) and
4641: the percent (`%') character. A difference is simply indicated by a signed
4642: difference.</P>
4643: <P>
4644: If the rule appears in the presentation rules of a numeric attribute, the
4645: percentage value can be replaced by the name of the attribute. This attribute
4646: is then used as a percentage. The attribute can also be used as part of a <A
4647: href="#distance">difference</A>.</P>
4648: <P>
4649: Just as with a fixed extent, a relative extent rule can end with the
4650: <TT>Min</TT> keyword, which signifies that the extent is a minimum and that,
4651: if the contents of the box require it, a larger extent is possible.</P>
4652: <P>
4653: A special case of relative extent rules is:</P>
4654: <PRE>
4655: Height : Enclosed . Height;
4656: </PRE>
4657: <P>
4658: or</P>
4659: <PRE>
4660: Width : Enclosed . Width;
4661: </PRE>
4662: <P>
1.5 cvs 4663: which specifies that the box has a height (or width) such that it encloses all
4664: the boxes which it contains, excluding boxes having a rule <TT>VertOverflow:
4665: Yes;</TT> or <TT>HorizOverflow: Yes;</TT>.</P>
1.1 cvs 4666: <P>
4667: <STRONG>Note:</STRONG> character strings (type <TT>TEXT_UNIT</TT>) generally
4668: must use the sum of the widths of the characters which compose them as their
4669: width, which is expressed by the rule:</P>
4670: <PRE>
4671: TEXT_UNIT :
1.6 cvs 4672: Width : Enclosed . Width;
1.1 cvs 4673: </PRE>
4674: <P>
1.5 cvs 4675: If this rule is not the default <TT>Width</TT> rule, it must be given
4676: explicitly in the <TT>RULES</TT> section which defines the presentation rules
4677: of the logical elements.</P>
1.1 cvs 4678: <PRE>
4679: 'Height' ':' Extent
4680: 'Width' ':' Extent
4681: Extent = Reference '.' HeightWidth [ Relation ]
4682: [ 'Min' ] / ...
4683: HeightWidth ='Height' / 'Width' .
4684: Relation ='*' ExtentAttr '%' / Distance .
4685: ExtentAttr = ExtentVal / AttrID .
4686: ExtentVal = NUMBER .
4687: </PRE>
4688: <BLOCKQUOTE class="example">
4689: <P>
4690: <STRONG>Example:</STRONG></P>
4691: <P>
1.3 cvs 4692: Completing the <A href="#expos1">above example</A>, it is possible to specify
4693: that the report takes its width from the editing window and its height from the
4694: size of its contents (this can obviously be greater than that of the
1.1 cvs 4695: window):</P>
4696: <PRE>
4697: Report : BEGIN
4698: Width : Enclosing . Width;
4699: Height : Enclosed . Height;
4700: ...
4701: END;
4702: </PRE>
4703: <P>
1.3 cvs 4704: Then, the following rules make the title occupy 60% of the width of the report
4705: (which is that of the window) and is broken into centered lines of this width
1.6 cvs 4706: (see the <A href="#sectc4222"><TT>Line</TT> rule</A>).</P>
1.1 cvs 4707: <PRE>
4708: Title : BEGIN
4709: Width : Enclosing . Width * 60%;
4710: Height : Enclosed . Height;
4711: Line;
4712: Adjust : VMiddle;
4713: ...
4714: END;
4715: </PRE>
4716: <P>
1.5 cvs 4717: The summary occupy the entire width of the window, with the exception of a 2 cm
1.1 cvs 4718: margin reserved by the horizontal position rule:</P>
4719: <PRE>
4720: Summary : BEGIN
4721: Width : Enclosing . Width - 2 cm;
4722: Height : Enclosed . Height;
4723: ...
4724: END;
4725: </PRE>
4726: <P>
4727: This set of rules, plus the <A href="#reportexample">position rules given
4728: above</A>, produce the layout of boxes shown in the following<A
4729: href="#posdim">figure</A>.</P>
4730:
4731: <DIV class="figure">
4732: <HR>
4733: <PRE>
4734: -------------------------------------------------------------
4735: | Window and Report ^ |
4736: | | 1 line |
4737: | v |
4738: | ------------------------------------- |
4739: | | | |
4740: : 20% : Title : 20% :
4741: :<--------->: :<--------->:
4742: : : 60% : :
4743: : :<--------------------------------->: :
4744: | | | |
4745: | ------------------------------------- |
4746: | ^ |
4747: | | 1.5 line |
4748: | | |
4749: | v |
4750: | ---------------------------------------------------|
4751: | 2 cm | |
4752: |<------>| Summary |
4753: : : :
4754: </PRE>
4755: <P align=center>
4756: <EM><A name="posdim">Box position and extent</A><EM></EM></EM></P>
4757: <HR>
4758: </DIV>
4759: </BLOCKQUOTE>
4760: </DIV>
4761:
4762: <DIV class="subsubsection">
1.6 cvs 4763: <H4><A name=sectd42193>Elastic extents</A></H4>
1.1 cvs 4764:
4765: <P>
4766: The last type of extent is the elastic extent. Either one or both extents can
4767: be elastic. A box has an elastic extent when two opposite sides are linked by
4768: distance constraints to two sides or axes of other boxes.</P>
4769: <P>
4770: One of the sides of the elastic box is linked by a position rule
4771: (<TT>VertPos</TT> or <TT>HorizPos</TT>) to a neighboring box. The other side
4772: is link to another box by a <TT>Height</TT> or <TT>Width</TT> rule, which
4773: takes the same form as the position rule. For the elastic box itself, the
4774: notions of sides (left or right, top or bottom) are fuzzy, since the movement
4775: of either one of the two reference boxes can, for example, make the left side
4776: of the elastic box move to the right of its right side. This is not
4777: important. The only requirement is that the two sides of the elastic box used
4778: in the position and extent rule are opposite sides of the box.</P>
4779: <PRE>
1.6 cvs 4780: 'Height' ':' Extent
4781: 'Width' ':' Extent
4782: Extent = HPos / VPos / ...
1.1 cvs 4783: </PRE>
4784: <BLOCKQUOTE class="example">
4785: <P>
4786: <STRONG>Example:</STRONG></P>
4787: <P>
1.3 cvs 4788: Suppose we want to draw an elastic arrow or line between the middle of the
4789: bottom side of box A and the upper left corner of box B. To do this, we would
4790: define a graphics box whose upper left corner coincides with the middle of the
4791: bottom side of A (a position rule) and whose lower right corner coincides with
4792: with the upper left corner of B (dimension rules):</P>
1.1 cvs 4793: <PRE>
4794: LinkedBox :
4795: BEGIN
1.6 cvs 4796: VertPos : Top = A .Bottom;
1.1 cvs 4797: HorizPos : Left = A . VMiddle;
1.6 cvs 4798: Height : Bottom = B . Top;
4799: Width : Right = B . Left;
1.1 cvs 4800: END;
4801: </PRE>
4802: </BLOCKQUOTE>
4803: <BLOCKQUOTE class="example">
4804: <P>
4805: <STRONG>Example:</STRONG></P>
4806: <P>
1.3 cvs 4807: The element SectionTitle creates a presentation box called SectionNum which
4808: contains the number of the section. Suppose we want to align the SectionNum
4809: and SectionTitle horizontally, have the SectionNum take its width from its
4810: contents (the section number), have the SectionTitle box begin 0.5 cm to the
4811: right of the SectionNum box and end at the right edge of its enclosing box.
4812: This would make the SectionTitle box elastic, since its width is defined by the
4813: position of its left and right sides. The following rules produce this
1.1 cvs 4814: effect:</P>
4815: <PRE>
4816: SectionNum :
4817: BEGIN
4818: HorizPos : Left = Enclosing . Left;
4819: Width : Enclosed . Width;
4820: ...
4821: END;
4822:
4823: SectionTitle :
4824: BEGIN
4825: HorizPos : Left = SectionNum . Right + 0.5 cm;
4826: Width : Right = Enclosing . Right;
4827: ...
4828: END;
4829: </PRE>
4830: </BLOCKQUOTE>
4831: </DIV>
4832: </DIV>
4833:
4834: <DIV class="subsection">
1.6 cvs 4835: <H3><A name="sectc4220">Overflow</A></H3>
1.1 cvs 4836:
4837: <P>
4838: A boxes corresponding to a structural element normally contain all boxes
4839: corresponding to the elements of its subtree. However, in some cases, it
4840: could be necessary to allow a box to jut out from its parent box. Two
4841: presentation rules indicate that such an overflow is allowed, one for
4842: horizontal overflow, one for vertical overflow.</P>
4843: <P>
4844: Each of these rules is expressed by a keyword followed by a colon and the
4845: keyword <TT>Yes</TT> or <TT>No</TT>.</P>
4846: <PRE>
4847: 'VertOverflow' ':' Boolean /
4848: 'HorizOverflow' ':' Boolean .
4849: Boolean = 'Yes' / 'No' .
4850: </PRE>
4851: </DIV>
4852:
4853: <DIV class="subsection">
1.6 cvs 4854: <H3><A name=sectc4221>Inheritance</A></H3>
1.1 cvs 4855:
4856: <P>
4857: A presentation parameter can be defined by reference to the same parameter of
4858: another box in the tree of boxes. These structural links are expressed by
4859: kinship. The reference box can be that of the element immediately above in
4860: the structure (<TT>Enclosing</TT>), two levels above (<TT>GrandFather</TT>),
4861: immediately below (<TT>Enclosed</TT>) or immediately before
4862: (<TT>Previous</TT>). In the case of a presentation box, and only in that
4863: case, the reference box may be the element which created the presentation box
4864: (<TT>Creator</TT>).</P>
4865: <P>
4866: Kinship is expressed in terms of the logical structure of the document and not
4867: in terms of the tree of boxes. The presentation box cannot transmit any of
4868: their parameters by inheritance; only structured element boxes can do so. As
4869: an example, consider an element B which follows an element A in the logical
4870: structure. The element B creates a presentation box P in front of itself,
1.6 cvs 4871: using the <TT>CreateBefore</TT> rule (see the <A href="#sectc4232">creation
1.1 cvs 4872: rules</A>). If element B's box inherits its character style using the
4873: <TT>Previous</TT> kinship operation, it gets its character style from A's box,
4874: not from P's box. Inheritance works differently for positions and extents,
4875: which can refer to presentation boxes.</P>
4876: <P>
4877: The inherited parameter value can be the same as that of the reference box.
4878: This is indicated by an equals sign. However, for numeric parameters, a
4879: different value can be obtained by adding or subtracting a number from the
4880: reference box's parameter value. Addition is indicated by a plus sign before
4881: the number, while subtraction is specified with a minus sign. The value of a
4882: parameter can also be given a maximum (if the sign is a plus) or minimum (if
4883: the sign is a minus).</P>
4884: <P>
4885: If the rule is being applied to a numeric attribute, the number to add or
4886: subtract can be replaced by the attribute name. The value of a maximum or
4887: minimum may also be replaced by an attribute name. In these cases, the value
4888: of the attribute is used.</P>
4889: <PRE>
1.6 cvs 4890: Inheritance = Kinship InheritedValue .
4891: Kinship ='Enclosing' / 'GrandFather' / 'Enclosed' /
4892: 'Previous' / 'Creator' .
1.1 cvs 4893: InheritedValue ='+' PosIntAttr [ 'Max' maximumA ] /
1.6 cvs 4894: '-' NegIntAttr [ 'Min' minimumA ] /
4895: '=' .
4896: PosIntAttr = PosInt / AttrID .
4897: PosInt = NUMBER .
4898: NegIntAttr = NegInt / AttrID .
4899: NegInt = NUMBER .
4900: maximumA = maximum / AttrID .
4901: maximum = NUMBER .
4902: minimumA = minimum / AttrID .
4903: minimum = NUMBER .
1.1 cvs 4904: </PRE>
4905: <P>
4906: The parameters which can be obtained by inheritance are justification,
4907: hyphenation, interline spacing, character font (font family), font style, font
4908: size, visibility, indentation, underlining, alignment of text, stacking order
4909: of objects, the style and thickness of lines, fill pattern and the colors of
4910: lines and characters.</P>
4911: </DIV>
4912:
4913: <DIV class="subsection">
1.6 cvs 4914: <H3><A name=sectc4222>Line breaking</A></H3>
1.1 cvs 4915:
4916: <P>
4917: The <TT>Line</TT> rule specifies that the contents of the box should be broken
4918: into lines: the boxes included in the box to which this rule is attached are
4919: displayed one after the other, from left to right, with their horizontal
4920: reference axes aligned so that they form a series of lines. The length of
4921: these lines is equal to the width of the box to which the <TT>Line</TT> rule
4922: is attached.</P>
4923: <P>
4924: When an included box overflows the current line, it is either carried forward
4925: to the next line, cur, or left the way it is. The <A
1.6 cvs 4926: href="#sectc4223"><TT>LineBreak</TT> rule</A> is used to allow or prevent the
1.1 cvs 4927: breaking of included boxes. If the included box is not breakable but is
4928: longer than the space remaining on the line, it is left as is. When a
4929: character string box is breakable, the line is broken between words or, if
1.6 cvs 4930: necessary, by <A href="#sectd42225">hyphenating a word</A>. When a
1.1 cvs 4931: compound box is breakable, the box is transparent in regard to line breaking.
4932: The boxes included in the compound box are treated just like included boxes
4933: which have the <TT>LineBreak</TT> rule. Thus, it is possible to traverse a
4934: complete subtree of boxes to line break the text leaves of a complex
4935: structure.</P>
4936: <P>
4937: The relative position rules of the included boxes are ignored, since the boxes
4938: will be placed according to the line breaking rules.</P>
4939: <P>
4940: The <TT>Line</TT> rule does not have a parameter. The characteristics of the
4941: lines that will be constructed are determined by the <TT>LineSpacing</TT>,
4942: <TT>Indent</TT>, <TT>Adjust</TT>, <TT>Justify</TT>, and <TT>Hyphenate</TT>
1.6 cvs 4943: rules. Moreover, the <A href="#insectd42226"><TT>Inline</TT> rule</A> permits
1.1 cvs 4944: the exclusion of certain elements from the line breaking process.</P>
4945: <P>
4946: When the <TT>Line</TT> rule appears in the rules sequence of a non-primary
4947: view, it applies only to that view, but when the <TT>Line</TT> rule appears in
4948: the rules sequence of the primary view, it also applies to the other views by
4949: default, except for those views which explicitly invoke the <TT>NoLine</TT>
4950: rule. Thus, the <TT>NoLine</TT> rule can be used in a non-primary view to
4951: override the primary view's <TT>Line</TT> rule. The <TT>NoLine</TT> rule must
4952: not be used with the primary view because the absence of the <TT>Line</TT>
4953: rule has the same effect. Like the <TT>Line</TT> rule, the <TT>NoLine</TT>
4954: rule does not take any parameters.</P>
4955: <PRE>
1.6 cvs 4956: 'Line'
4957: 'NoLine'
1.1 cvs 4958: </PRE>
4959:
4960: <DIV class="subsubsection">
1.6 cvs 4961: <H4><A name=sectd42221>Line spacing</A></H4>
1.1 cvs 4962:
4963: <P>
4964: The <TT>LineSpacing</TT> rule defines the line spacing to be used in the line
4965: breaking process. The line spacing is the distance between the baselines
4966: (horizontal reference axis) of the successive lines produced by the
4967: <TT>Line</TT> rule. The value of the line spacing can be specified as a
4968: constant or by inheritance. It is expressed in any of the available <A
1.6 cvs 4969: href="#sectc4217">distance units</A>.</P>
1.1 cvs 4970: <P>
4971: Inheritance allows the value to be obtained from a relative in the structure
4972: tree, either without change (an equals sign appears after the inheritance
4973: keyword), with a positive difference (a plus sign), or a negative difference
4974: (a minus sign). When the rule uses a difference, the value of the difference
1.6 cvs 4975: follows the sign and is expressed as a <A href="#sectc4217">distance</A>.</P>
1.1 cvs 4976: <PRE>
1.6 cvs 4977: 'LineSpacing' ':' DistOrInherit
4978: DistOrInherit = Kinship InheritedDist / Distance .
1.1 cvs 4979: InheritedDist = '=' / '+' AbsDist / '-' AbsDist .
4980: </PRE>
4981: <P>
4982: When the line spacing value (or its difference from another element) is
4983: expressed in relative units, it changes with the size of the characters. Thus,
4984: when a larger font is chosen for a part of the document, the line spacing of
4985: that part expands proportionally. In contrast, when the line spacing value is
4986: expressed in absolute units (centimeters, inches, typographer's points), it is
4987: independent of the characters, which permits the maintenance of a consistent
4988: line spacing, whatever the character font. Either approach can be taken,
4989: depending on the desired effect.</P>
4990: </DIV>
4991:
4992: <DIV class="subsubsection">
1.6 cvs 4993: <H4><A name=sectd42222>First line indentation</A></H4>
1.1 cvs 4994:
4995: <P>
4996: The <TT>Indent</TT> rule is used to specify the indentation of the first line
4997: of the elements broken into lines by the <TT>Line</TT> function. The
4998: indentation determines how far the first line of the element is shifted with
4999: respect to the other lines of the same element. It can be specified as a
5000: constant or by inheritance. The constant value is a positive integer (shifted
5001: to the right; the sign is optional), a negative integer (shifted to the left)
1.6 cvs 5002: or zero (no shift). All available <A href="#sectc4217">units</A> can be
1.1 cvs 5003: used.</P>
5004: <P>
5005: Indentation can be defined for any box, regardless of whether the box is line
5006: broken, and transmitted by inheritance to elements that are line broken. The
5007: size of the indentation is specified in the same manner as the <A
1.6 cvs 5008: href="#sectd42221">line spacing</A>.</P>
1.1 cvs 5009: <PRE>
1.6 cvs 5010: 'Indent' ':' DistOrInherit
1.1 cvs 5011: </PRE>
5012: </DIV>
5013:
5014: <DIV class="subsubsection">
1.6 cvs 5015: <H4><A name=sectd42223>Alignment</A></H4>
1.1 cvs 5016:
5017: <P>
5018: The alignment style of the lines constructed during line breaking is defined
5019: by the <TT>Adjust</TT> rule. The alignment value can be a constant or
5020: inherited. A constant value is specified by a keyword:</P>
5021: <UL>
5022: <LI><TT>Left</TT>: at the left edge,
5023: <LI><TT>Right</TT>: at the right edge,
5024: <LI><TT>VMiddle</TT>: centered
1.2 cvs 5025: <LI><TT>LeftWithDots</TT>: at the left edge with a dotted line filling out the
1.1 cvs 5026: last line up to the right edge of the line breaking box.
5027: </UL>
5028: <P>
5029: An inherited value can only be the same as that of the reference box and is
5030: specified by a kinship keyword followed by an equals sign.</P>
5031: <PRE>
1.6 cvs 5032: 'Adjust' ':' AlignOrInherit
1.1 cvs 5033: AlignOrInherit = Kinship '=' / Alignment .
5034: Alignment = 'Left' / 'Right' / 'VMiddle' /
5035: 'LeftWithDots' .
5036: </PRE>
5037: </DIV>
5038:
5039: <DIV class="subsubsection">
1.6 cvs 5040: <H4><A name=sectd42224>Justification</A></H4>
1.1 cvs 5041:
5042: <P>
5043: The <TT>Justify</TT> rule indicates whether the lines contained in the box and
5044: produced by a <TT>Line</TT> rule should be extended horizontally to occupy the
5045: entire width of their enclosing box. The first and last lines are treated
5046: specially: the position of the beginning of the first line is fixed by the
5047: <TT>Indent</TT> rule and last line is not extended. The justification
5048: parameter defined by this rule takes a boolean value, which can be a constant
5049: or inherited. A constant boolean value is expressed by either the
5050: <TT>Yes</TT> or the <TT>No</TT> keyword. An inherited value can only be the
5051: same as that of the reference box and is specified by a kinship keyword
5052: followed by an equals sign.</P>
5053: <PRE>
1.6 cvs 5054: 'Justify' ':' BoolInherit
1.1 cvs 5055: BoolInherit = Boolean / Kinship '=' .
1.6 cvs 5056: Boolean ='Yes' / 'No' .
1.1 cvs 5057: </PRE>
5058: <P>
5059: When the lines are justified, the alignment parameter specified in the
5060: <TT>Adjust</TT> rule has no influence, other than on the last line produced.
5061: This occurs because, when the other are extended to the limits of the box, the
5062: alignment style is no longer perceptible.</P>
5063: <BLOCKQUOTE class="example">
5064: <P>
5065: <STRONG>Example:</STRONG></P>
5066: <P>
1.3 cvs 5067: An important use of inheritance is to vary the characteristics of lines for an
5068: element type (for example, Paragraph) according to the enclosing environment
5069: (for example, Summary or Section), and thus obtain different line breaking
5070: styles for the same elements when they appear in different environments. The
5071: following rules specify that paragraphs inherit their alignment, justification,
1.1 cvs 5072: and line spacing:</P>
5073: <PRE>
5074: Paragraph :
5075: BEGIN
5076: Justify : Enclosing = ;
5077: LineSpacing : Enclosing = ;
5078: Adjust : Enclosing =;
5079: Line;
5080: END;
5081: </PRE>
5082: <P>
1.5 cvs 5083: If the alignment, justification, and line spacing of the Section and Summary
1.1 cvs 5084: elements is fixed:</P>
5085: <PRE>
5086: Section :
5087: BEGIN
5088: Adjust : Left;
5089: Justify : Yes;
5090: LineSpacing : 1;
5091: END;
5092: Summary :
5093: BEGIN
5094: Adjust : VMiddle;
5095: Justify : No;
5096: LineSpacing : 1.3;
5097: END;
5098: </PRE>
5099: <P>
1.4 cvs 5100: then the paragraphs appearing in sections are justified with a simple line
5101: spacing while those appearing in summaries are centered and not justified and
5102: have a larger line spacing. These are nevertheless the very same type of
1.1 cvs 5103: paragraph defined in the logical structure schema.</P>
5104: </BLOCKQUOTE>
5105: </DIV>
5106:
5107: <DIV class="subsubsection">
1.6 cvs 5108: <H4><A name=sectd42225>Hyphenation</A></H4>
1.1 cvs 5109:
5110: <P>
5111: The <TT>Hyphenate</TT> rule indicates whether or not words should be broken by
5112: hyphenation at the end of lines. It affects the lines produced by the
5113: <TT>Line</TT> rule and contained in the box carrying the <TT>Hyphenate</TT>
5114: rule.</P>
5115: <P>
5116: The hyphenation parameter takes a boolean value, which can be either constant
5117: or inherited. A constant boolean value is expressed by either the
5118: <TT>Yes</TT> or the <TT>No</TT> keyword. An inherited value can only be the
5119: same as that of the reference box and is specified by a kinship keyword
5120: followed by an equals sign.</P>
5121: <PRE>
5122: 'Hyphenate' ':' BoolInherit
5123: BoolInherit = Boolean / Kinship '=' .
5124: Boolean = 'Yes' / 'No' .
5125: </PRE>
5126: </DIV>
5127:
5128: <DIV class="subsubsection">
1.6 cvs 5129: <H4><A name=sectd42226>Avoiding line breaking</A></H4>
1.1 cvs 5130:
5131: <P>
5132: The <TT>InLine</TT> rule is used to specify that a box that would otherwise
5133: participate in line breaking asked for by the <TT>Line</TT> rule of an
5134: enclosing box, instead avoids the line breaking process and positions itself
5135: according to the <TT>HorizPos</TT> and <TT>VertPos</TT> rules that apply to
5136: it. When the <TT>InLine</TT> rule applies to a box which would not be line
5137: broken, it has no effect.</P>
5138: <P>
5139: The rule is expressed by the <TT>InLine</TT> keyword followed by a colon and
5140: the keyword <TT>Yes</TT>, if the box should participate in line breaking, or
5141: the keyword <TT>No</TT>, if it should not. This is the only form possible:
5142: this rule cannot be inherited. Moreover, it can only appear in the rules of
5143: the primary view and applies to all views defined in the presentation
5144: schema.</P>
5145: <PRE>
5146: 'InLine' ':' Boolean .
5147: Boolean = 'Yes' / 'No' .
5148: </PRE>
5149: <BLOCKQUOTE class="example">
5150: <P>
5151: <STRONG>Example:</STRONG></P>
5152: <P>
5153: Suppose the structure schema defines a logical attribute
1.3 cvs 5154: called <TT>New</TT> which is used to identify the passages in a document which
1.5 cvs 5155: were recently modified. It would be nice to have the presentation schema make
5156: a bar appear in the left margin next to each passage having
1.3 cvs 5157: the <TT>New</TT> attribute. A new passage can be an entire element, such as a
5158: paragraph or section, or it can be some words in the middle of a paragraph. To
5159: produce the desired effect, the <TT>New</TT> attribute is given a creation rule
5160: which generates a <TT>VerticalBar</TT> presentation box.</P>
1.1 cvs 5161: <P>
5162: When the <TT>New</TT> attribute is attached to a character string which is
5163: inside a line broken element (inside a paragraph, for example), the bar is one
5164: of the elements which participates in line breaking and it is placed normally
5165: in the current line, at the end of the character string which has the
5166: attribute. To avoid this, the <TT>InLine</TT> rule is used in the following
5167: way:</P>
5168: <PRE>
5169: BOXES
5170: VerticalBar:
5171: BEGIN
5172: Content: Graphics 'l';
5173: HorizPos: Left = Root . Left;
5174: VertPos: Top = Creator . Top;
5175: Height: Bottom = Creator . Bottom;
5176: Width: 1 pt;
5177: InLine: No;
5178: ...
5179: END;
5180: ...
5181: ATTRIBUTES
5182: Nouveau:
5183: BEGIN
5184: CreateAfter(VerticalBar);
5185: END;
5186: </PRE>
5187: </BLOCKQUOTE>
5188: </DIV>
5189: </DIV>
5190:
5191: <DIV class="subsection">
1.6 cvs 5192: <H3><A name=sectc4223>Page breaking and line breaking conditions</A></H3>
1.1 cvs 5193:
5194: <P>
5195: Pages are constructed by the editor in accordance with the model specified by
1.6 cvs 5196: a <A href="#sectc4233"><TT>Page</TT> rule</A>. The page model describes only the
1.1 cvs 5197: composition of the pages but does not give any rules for breaking different
5198: element types across pages. Now, it is possible that certain elements must
5199: not be cut by page breaks, while others can be cut anywhere. The
5200: <TT>PageBreak</TT>, <TT>NoBreak1</TT>, and <TT>NoBreak2</TT> rules are used to
5201: specify the conditions under which each element type can be cut.</P>
5202: <P>
5203: The <TT>PageBreak</TT> rule is used to indicate whether or not the box can be
5204: cut during the construction of pages. If cutting is authorized, the box can
5205: be cut, with one part appearing at the bottom of a page and the other part
5206: appearing at the top of the next page. The rule is formed by the
5207: <TT>PageBreak</TT> keyword followed by a colon and a constant boolean value
5208: (<TT>Yes</TT> or <TT>No</TT>). This is the only form possible: this rule
5209: cannot be inherited. Moreover, it can only appear in the rules of the primary
5210: view and applies to all views defined in the presentation schema.</P>
5211: <P>
5212: Whether objects can be cut by line breaks can be controlled in a similar way
5213: using the <TT>LineBreak</TT> rule. This rule allows the specification of
5214: whether or not the box can be cut during the construction of lines. If
5215: cutting is authorized, the box can be cut, with one part appearing at the end
5216: of a line and the other part appearing at the beginning of the next line. The
5217: rule is formed by the <TT>LineBreak</TT> keyword followed by a colon and a
5218: constant boolean value (<TT>Yes</TT> or <TT>No</TT>). This is the only form
5219: possible: this rule cannot be inherited. Moreover, it can only appear in the
5220: rules of the primary view and applies to all views defined in the presentation
5221: schema.</P>
5222: <PRE>
5223: 'PageBreak' ':' Boolean .
5224: 'LineBreak' ':' Boolean .
5225: Boolean = 'Yes' / 'No' .
5226: </PRE>
5227: <P>
5228: When a box can be cut by a page break, it is possible that a page break will
5229: fall an inappropriate spot, creating, for example, a widow or orphan, or
5230: separating the title of a section from the first paragraph of the section. The
5231: <TT>NoBreak1</TT> and <TT>NoBreak2</TT> rules are used to avoid this. They
1.12 cvs 5232: specify that the box of the element to which they apply cannot be cut within
5233: a certain zone at the top (<TT>NoBreak1</TT> rule) or at the bottom
1.1 cvs 5234: (<TT>NoBreak2</TT> rule). These two rules specify the height of the zones in
5235: which page breaks are prohibited.</P>
5236: <P>
5237: The <TT>NoBreak1</TT> and <TT>NoBreak2</TT> rules give the height of the zone
5238: in which page breaking is prohibited. The height is given as a constant value
1.6 cvs 5239: using any of the <A href="#sectc4217">available units</A>, absolute or
1.1 cvs 5240: relative. The value may not be inherited.</P>
5241: <PRE>
5242: 'NoBreak1' ':' AbsDist .
5243: 'NoBreak2' ':' AbsDist .
5244: </PRE>
5245: <BLOCKQUOTE class="example">
5246: <P>
5247: <STRONG>Example:</STRONG></P>
5248: <P>
1.3 cvs 5249: The following rules prevent widows and orphans in a paragraph:</P>
1.1 cvs 5250: <PRE>
5251: Paragraph :
5252: BEGIN
5253: NoBreak1 : 2;
5254: NoBreak2 : 2;
5255: END;
5256: </PRE>
5257: <P>
1.3 cvs 5258: This rule prevents a section title from becoming separated from the first
5259: paragraph of the section by prohibiting page breaks at the beginning of the
1.1 cvs 5260: section rule:</P>
5261: <PRE>
5262: Section :
5263: NoBreak1 : 1.5 cm;
5264: </PRE>
5265: <P>
5266: Finally, this rule prevents a figure from being page broken in any way:</P>
5267: <PRE>
5268: Figure :
5269: PageBreak : No;
5270: </PRE>
5271: </BLOCKQUOTE>
5272: <P>
5273: The Thot editor constructs the document images displayed on the screen
5274: dynamically. As the user moves in the document or makes the document scroll
5275: in a window, the editor constructs the image to be displayed in little bits,
5276: filling the gaps which are produced in the course of these operations. It
5277: stops filling in the image when an element reaches the edge of the window in
5278: which the gap appears. If the appearance of the document is complex, it is
5279: possible that the image in incomplete, even though the edge of the window was
5280: reached. For example, an element might need to be presented to the side of
5281: the last element displayed, but its image was not constructed. The user will
5282: not know whether the element is really absent or if its image has simply not
5283: been constructed.</P>
5284: <P>
5285: The <TT>Gather</TT> rule is used to remedy this problem. When the rule
5286: <TT>Gather : Yes;</TT> is associated with an element type, the image of such
5287: elements is constructed as a block by the editor: it is never split up.</P>
5288: <P>
5289: The <TT>Gather</TT> rule may not appear in the <A
1.6 cvs 5290: href="#sectc427">default rules</A>. Elements which do not have the
1.1 cvs 5291: <TT>Gather</TT> rule are considered susceptible to being split up during
5292: display. Thus, it is not necessary to use the <TT>Gather : No;</TT> form.
5293: This rule must be used prudently and only for those elements which truly need
5294: it. If used incorrectly, it can pointlessly increase the size of the image
5295: constructed by the editor and lead to excessive memory consumption by the
5296: editor.</P>
5297: <P>
5298: Like the <TT>PageBreak</TT> and <TT>LineBreak</TT> rules, the <TT>Gather</TT>
5299: rule can only appear in rules of the primary view and applies to all views
5300: defined in the presentation schema.</P>
5301: <PRE>
5302: 'Gather' ':' Boolean .
5303: </PRE>
5304: </DIV>
5305:
5306: <DIV class="subsection">
1.6 cvs 5307: <H3><A name=sectc4224>Visibility</A></H3>
1.1 cvs 5308:
5309: <P>
5310: The visibility parameter is used to control which elements should or should
5311: not be displayed, based on context. An element can have different
5312: visibilities in different views. If an element's visibility is zero for a
5313: view, that element is not displayed in that view and does not occupy any space
5314: (its extents are zero).</P>
5315: <P>
5316: Visibility takes non-negative integer values (positive or zero). If values
5317: greater than 1 are used, they allow the user to choose a degree of visibility
5318: and, thus, to see only those boxes whose visibility parameter exceeds a
5319: certain threshold. This gives the user control over the granularity of the
1.2 cvs 5320: displayed pictures.</P>
1.1 cvs 5321: <P>
5322: The visibility parameter can be defined as a constant or by inheritance. If
5323: defined by inheritance, it cannot be based on the value of the next or
5324: previous box. Visibility can only be inherited from above.</P>
5325: <P>
5326: If it is a numeric attribute's presentation rule, the visibility can be
5327: specified by the attribute's name, in which case the value of the attribute is
5328: used.</P>
5329: <PRE>
1.6 cvs 5330: 'Visibility' ':' NumberInherit
1.1 cvs 5331: NumberInherit = Integer / AttrID / Inheritance .
1.6 cvs 5332: Integer = NUMBER .
1.1 cvs 5333: </PRE>
5334: <BLOCKQUOTE class="example">
5335: <P>
5336: <STRONG>Example:</STRONG></P>
5337: <P>
1.3 cvs 5338: Suppose that only <TT>Formula</TT> elements should be displayed in
5339: the <TT>MathView</TT> view. Then, the default rules should include:</P>
1.1 cvs 5340: <PRE>
5341: DEFAULT
5342: IN MathView Visibility:0;
5343: </PRE>
5344: <P>
1.3 cvs 5345: which makes all elements invisible in the <TT>MathView</TT> view. However, the
5346: <TT>Formula</TT> element also has a <TT>Visibility</TT> rule:</P>
1.1 cvs 5347: <PRE>
5348: Formula :
5349: IN MathView Visibility:5;
5350: </PRE>
5351: <P>
5352: which makes formulas, and only formulas, visible.</P>
5353: </BLOCKQUOTE>
5354: </DIV>
5355:
5356: <DIV class="subsection">
1.6 cvs 5357: <H3><A name=sectc4225>Character style parameters</A></H3>
1.1 cvs 5358:
5359: <P>
5360: Four parameters are used to determine which characters are used to display
5361: text. They are size, font, style, and underlining.</P>
5362:
5363: <DIV class="subsubsection">
1.6 cvs 5364: <H4><A name=sectd42251>Character size</A></H4>
1.1 cvs 5365:
5366: <P>
5367: The size parameter has two effects. First, it is used to specify the actual
1.6 cvs 5368: size and distance units for boxes defined in <A href="#sectc4217">relative
1.1 cvs 5369: units</A>. Second, it defines the size of the characters contained in the
5370: box.</P>
5371: <P>
5372: As a distance or length, the size can be expressed in abstract or absolute
5373: units. It can also be inherited. If it is not inherited, it is expressed
5374: simply as an integer followed by the <TT>pt</TT> keyword, which indicates that
5375: the size is expressed in typographer's points. The absence of the <TT>pt</TT>
5376: keyword indicates that it is in abstract units in which the value 1 represents
5377: the smallest size while the value 16 is the largest size. The relationship
5378: between these abstract sizes and the real character sizes is controlled by a
5379: table which can be modified statically or even dynamically during the
5380: execution of the Thot editor.</P>
5381: <P>
5382: If it is a numeric attribute's presentation rule, the value of the size
5383: parameter can be specified by the attribute's name, in which case the value of
5384: the attribute is used.</P>
5385: <P>
5386: <STRONG>Note:</STRONG> the only unit available for defining an absolute size
5387: is the typographer's point. Centimeters and inches may not be used.</P>
5388: <P>
5389: If the size is inherited, the rule must specify the relative from which to
5390: inherit and any difference from that relative's value. The difference can be
5391: expressed in either typographer's points or in abstract units. The maximum or
5392: minimum size can also be specified, but without specifying the type of unit:
5393: it is the same as was specified for the difference.</P>
5394: <P>
5395: In a numeric attribute's presentation rule, the difference in size can be
5396: indicated by the attribute's name, which means that the attribute's value
5397: should be used as the difference. The attribute can also be used as the
5398: minimum or maximum size.</P>
5399: <PRE>
5400: 'Size' ':' SizeInherit
5401: SizeInherit = SizeAttr [ 'pt' ] /
5402: Kinship InheritedSize .
5403: InheritedSize ='+' SizeAttr [ 'pt' ]
5404: [ 'Max' MaxSizeAttr ] /
5405: '-' SizeAttr [ 'pt' ]
5406: [ 'Min' MinSizeAttr ] /
5407: '=' .
1.6 cvs 5408: SizeAttr = Size / AttrID .
5409: Size = NUMBER .
5410: MaxSizeAttr = MaxSize / AttrID .
5411: MaxSize = NUMBER .
5412: MinSizeAttr = MinSize / AttrID .
5413: MinSize = NUMBER .
1.1 cvs 5414: </PRE>
5415: <BLOCKQUOTE class="example">
5416: <P>
5417: <STRONG>Example:</STRONG></P>
5418: <P>
5419: The rule</P>
5420: <PRE>
5421: Size : Enclosing - 2 pt Min 7;
5422: </PRE>
5423: <P>
1.3 cvs 5424: states that the character size is 2 points less than that of the enclosing box,
5425: but that it may not be less than 7 points, whatever the enclosing box's
1.1 cvs 5426: value.</P>
5427: <P>
5428: The following rules make the text of a report be displayed with medium-sized
5429: characters (for example, size 5), while the title is displayed with larger
5430: characters and the summary is displayed with smaller characters:</P>
5431: <PRE>
5432: Report :
5433: Size : 5;
5434: Title :
5435: Size : Enclosing + 2;
5436: Summary :
5437: Size : Enclosing - 1;
5438: </PRE>
5439: <P>
1.4 cvs 5440: Thus, the character sizes in the entire document can be changed by changing the
5441: size parameter of the Report element, while preserving the relationships
1.1 cvs 5442: between the sizes of the different elements.</P>
5443: </BLOCKQUOTE>
5444: </DIV>
5445:
5446: <DIV class="subsubsection">
1.6 cvs 5447: <H4><A name=sectd42252>Font and character style</A></H4>
1.1 cvs 5448:
5449: <P>
5450: The <TT>Font</TT> rule determines the font family to be used to display the
5451: characters contained in the box, while the <TT>Style</TT> rule determines
5452: their style. Thot recognizes three character fonts (Times, Helvetica, and
5453: Courier) and six styles: Roman, Italics, Bold, BoldItalics, Oblique, and
5454: BoldOblique.</P>
5455: <P>
5456: The font family and style can specified by a named constant or can be
5457: inherited. For the name of the font family only the first character is
5458: used.</P>
5459: <P>
5460: Only identical inheritance is allowed: the box takes the same font or style as
5461: the box from which it inherits. This is indicated by an equals sign after the
5462: kinship specification.</P>
5463: <BLOCKQUOTE class="example">
5464: <P>
5465: <STRONG>Example:</STRONG></P>
5466: <P>
1.3 cvs 5467: To specify that the summary uses the font family of the rest of the document,
1.1 cvs 5468: but in the italic style, the following rules are used:</P>
5469: <PRE>
5470: Summary :
5471: BEGIN
5472: Font : Enclosing =;
5473: Style : Italics;
5474: END;
5475: </PRE>
5476: </BLOCKQUOTE>
5477: </DIV>
5478:
5479: <DIV class="subsubsection">
1.6 cvs 5480: <H4><A name=sectd42253>Underlining</A></H4>
1.1 cvs 5481:
5482: <P>
5483: The <TT>Underline</TT> rule is used to specify if the characters contained in
5484: a box should have lines drawn on or near them. There are four underlining
5485: styles: <TT>Underlined</TT>, <TT>Overlined</TT>, <TT>CrossedOut</TT>, and
5486: <TT>NoUnderline</TT>. The <TT>Thickness</TT> rule specifies the thickness of
5487: the line, <TT>Thin</TT> or <TT>Thick</TT>.</P>
5488: <P>
5489: As with font family and style, only identical inheritance is allowed: the box
5490: has the same underlining type as the box from which it inherits the value.
5491: This is indicated by an equals sign after the kinship specification.</P>
5492: <PRE>
5493: 'Underline' ':' UnderLineInherit /
5494: 'Thickness' ':' ThicknessInherit /
5495:
5496: UnderLineInherit = Kinship '=' / 'NoUnderline' /
5497: 'Underlined' /
5498: 'Overlined' / 'CrossedOut' .
5499: ThicknessInherit = Kinship '=' / 'Thick' / 'Thin' .
5500: </PRE>
5501: </DIV>
5502: </DIV>
5503:
5504: <DIV class="subsection">
1.6 cvs 5505: <H3><A name=sectc4226>Stacking order</A></H3>
1.1 cvs 5506:
5507: <P>
5508: The <TT>Depth</TT> rule is used to define the stacking order of terminal boxes
5509: when multiple boxes at least partially overlap. This rule defines how the
5510: depth parameter, which is zero or a positive integer, is calculated. The
5511: depth parameter has a value for all boxes. For terminal boxes in the
5512: structure and for presentation boxes, the depth value is used during display
5513: and printing: the boxes with the lowest value overlap those with higher
5514: depths. For non-terminal boxes, the depth is not interpreted during display,
5515: but it is used to calculate the depth of terminal boxes by inheritance.</P>
5516: <P>
5517: Like most other rules, the depth rule is defined in the <A
1.6 cvs 5518: href="#sectc427">default rules</A> of each presentation schema. Thus,
1.1 cvs 5519: there is always a depth value, even when it is not necessary because there is
5520: no overlapping. To avoid useless operations, a zero value can be given to the
5521: depth parameter, which signifies that overlapping is never a problem.</P>
5522: <P>
1.6 cvs 5523: The depth rule has the same form as the <A href="#sectc4224">visibility rule</A>.
1.1 cvs 5524: It can be defined by inheritance or by a constant numeric value. When the rule
5525: is attached to a numeric attribute, it can take the value of that
5526: attribute.</P>
5527: <PRE>
5528: 'Depth' ':' NumberInherit
5529: </PRE>
5530: <BLOCKQUOTE class="example">
5531: <P>
5532: <STRONG>Example:</STRONG></P>
5533: <P>
1.3 cvs 5534: For a purely textual document, in which overlapping never poses a problem, a
1.5 cvs 5535: single default <TT>Depth</TT> rule in the presentation schema is
5536: sufficient:</P>
1.1 cvs 5537: <PRE>
5538: DEFAULT
5539: Depth : 0;
5540: ...
5541: </PRE>
5542: <P>
5543: To make the text of examples appear on a light blue background, a presentation
5544: box is defined:</P>
5545: <PRE>
5546: BOXES
5547: BlueBG :
5548: BEGIN
5549: Content : Graphics 'R';
5550: Background : LightBlue3;
5551: FillPattern: backgroundcolor;
5552: Depth : 2;
5553: ...
5554: END;
5555: </PRE>
5556: <P>
1.3 cvs 5557: and is created by the <TT>Example</TT> element, which has the rules:</P>
1.1 cvs 5558: <PRE>
5559: RULES
5560: Example :
5561: BEGIN
5562: CreateFirst (BlueBG);
5563: Depth : 1;
5564: ...
5565: END;
5566: </PRE>
5567: <P>
5568: In this way, the text of an example (if it inherits its depth from
1.5 cvs 5569: its ancestor) will be superimposed on a light blue background, and not
5570: the reverse).</P>
1.1 cvs 5571: </BLOCKQUOTE>
5572: </DIV>
5573:
5574: <DIV class="subsection">
1.13 cvs 5575: <H3><A name=sectc4227>Line style</A></H3>
1.1 cvs 5576:
5577: <P>
5578: The <TT>LineStyle</TT> rule determines the style of line which should be used
1.13 cvs 5579: to draw all the elements contained in the box and the box itself, if it has
5580: a <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>. The line style can be
1.1 cvs 5581: indicated by a name (<TT>Solid</TT>, <TT>Dashed</TT>, <TT>Dotted</TT>) or it
1.13 cvs 5582: can be inherited. All elements of the graphic base type are affected by this
1.1 cvs 5583: rule, but it can be attached to any box and transmitted by inheritance to the
1.13 cvs 5584: graphic elements. The border of elements having a
5585: <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>
5586: is drawn according to the line style specified by this rule.<P>
1.1 cvs 5587: Only identical inheritance is allowed: the box takes the same line style as
5588: the box from which it inherits. This is indicated by an equals sign after the
5589: kinship specification.</P>
5590: <PRE>
5591: 'LineStyle' ':' LineStyleInherit
5592: LineStyleInherit = Kinship '=' /
5593: 'Solid' / 'Dashed' / 'Dotted' .
5594: </PRE>
5595: <BLOCKQUOTE class="example">
5596: <P>
5597: <STRONG>Example:</STRONG></P>
5598: <P>
1.3 cvs 5599: To specify that, in Figures, the graphical parts should be drawn in solid
5600: lines, the Figure element is given a rule using the <TT>Solid</TT> name:</P>
1.1 cvs 5601: <PRE>
5602: Figure :
5603: LineStyle : Solid;
5604: </PRE>
5605: <P>
5606: and the elements composing figures are given an inheritance rule:</P>
5607: <PRE>
5608: LineStyle : Enclosing =;
5609: </PRE>
5610: </BLOCKQUOTE>
5611: </DIV>
5612:
5613: <DIV class="subsection">
1.6 cvs 5614: <H3><A name=sectc4228>Line thickness</A></H3>
1.1 cvs 5615:
5616: <P>
5617: The <TT>LineWeight</TT> rule determines the thickness of the lines of all
5618: graphical elements which appear in the box, no matter what their line style.
5619: Line thickness can be specified by a constant value or by inheritance. A
5620: constant value is a positive number followed by an optional unit specification
5621: (which is absent when using relative units). All available <A
1.6 cvs 5622: href="#sectc4217">distance units</A> can be used. Line thickness is expressed
5623: in the same way as <A href="#sectd42221">line spacing</A>.</P>
1.1 cvs 5624: <PRE>
5625: 'LineWeight' ':' DistOrInherit
5626: </PRE>
5627: <P>
1.13 cvs 5628: All elements of the graphic base type are affected by this rule, but it can
1.1 cvs 5629: be attached to any box and transmitted by inheritance to the graphic
1.13 cvs 5630: elements. The border of element having a <A href="#sectc4230a"><TT>ShowBox</TT>
5631: rule</A> is also drawn according to the thickness specified by this rule.</P>
1.1 cvs 5632: <BLOCKQUOTE class="example">
5633: <P>
5634: <STRONG>Example:</STRONG></P>
5635: <P>
1.3 cvs 5636: To specify that, in Figures, the graphical parts should be drawn with lines 0.3
1.1 cvs 5637: pt thick, the Figure element is given this rule:</P>
5638: <PRE>
5639: Figure :
5640: LineWeight : 0.3 pt;
5641: </PRE>
5642: <P>
5643: and the elements composing figures are given an inheritance rule:</P>
5644: <PRE>
5645: LineWeight : Enclosing =;
5646: </PRE>
5647: </BLOCKQUOTE>
5648: </DIV>
5649:
5650: <DIV class="subsection">
1.6 cvs 5651: <H3><A name=sectc4229>Fill pattern</A></H3>
1.1 cvs 5652:
5653: <P>
5654: The <TT>FillPattern</TT> rule determines the pattern used to fill closed
5655: graphical elements (circles, rectangles, etc.) which appear in the box. This
1.13 cvs 5656: rule also specifies the pattern used to fill the box associated with
5657: elements having a <A href="#sectc4230a"><TT>ShowBox</TT> rule<A>. This
1.1 cvs 5658: pattern can be indicated by a named constant or by inheritance. The named
5659: constant identifies one of the patterns available in Thot. The names of the
5660: available patterns are: nopattern, foregroundcolor, backgroundcolor, gray1,
5661: gray2, gray3, gray4, gray5, gray6, gray7, horiz1, horiz2, horiz3, vert1,
5662: vert2, vert3, left1, left2, left3, right1, right2, right3, square1, square2,
5663: square3, lozenge, brick, tile, sea, basket.</P>
5664: <P>
5665: Like the other rules peculiar to graphics, <TT>LineStyle</TT> and
5666: <TT>LineWeight</TT>, only elements of the graphic base type are affected by
5667: the <TT>FillPattern</TT> rule, but the rule can be attached to any box and
5668: transmitted by inheritance to the graphic elements. As with the other rules
5669: specific to graphics, only identical inheritance is allowed.</P>
5670: <P>
5671: The <TT>FillPattern</TT> rule can also be used to determine whether or not
1.12 cvs 5672: text characters, symbols and pictures should be colored. For these element
5673: types (text, symbols, and pictures), the only valid values are
5674: <TT>nopattern</TT>, <TT>foregroundcolor</TT>, and
5675: <TT>backgroundcolor</TT>. When <TT>FillPattern</TT> has the value
1.1 cvs 5676: <TT>backgroundcolor</TT>, text characters, symbols, and bitmaps are given the
1.6 cvs 5677: color specified by the <A href="#sectc4230"><TT>Background</TT> rule</A> which
1.1 cvs 5678: applies to these elements. When <TT>FillPattern</TT> has the value
5679: <TT>foregroundcolor</TT>, these same elements are given the color specified by
1.6 cvs 5680: the <A href="#sectc4230"><TT>Foreground</TT> rule</A> which applies to these
1.1 cvs 5681: elements. In all other case, text characters are not colored.</P>
5682: <PRE>
5683: 'FillPattern' ':' NameInherit
5684: </PRE>
5685: <BLOCKQUOTE class="example">
5686: <P>
5687: <STRONG>Example:</STRONG></P>
5688: <P>
1.3 cvs 5689: To specify that, in Figures, the closed graphical elements should be filled
5690: with a pattern resembling a brick wall, the Figure element is given this
1.1 cvs 5691: rule:</P>
5692: <PRE>
5693: Figure :
5694: FillPattern : brick;
5695: </PRE>
5696: <P>
5697: and the elements composing figures are given an inheritance rule:</P>
5698: <PRE>
5699: FillPattern : Enclosing =;
5700: </PRE>
5701: </BLOCKQUOTE>
5702: </DIV>
5703:
5704: <DIV class="subsection">
1.6 cvs 5705: <H3><A name=sectc4230>Colors</A></H3>
1.1 cvs 5706:
5707: <P>
5708: The <TT>Foreground</TT> and <TT>Background</TT> rules determine the foreground
1.13 cvs 5709: and background colors of the base elements which appear in the box. They also
5710: control the color of boxes associated with elements having a
5711: <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>. These
5712: colors can be specified with a named constant or by inheritance. The named
1.1 cvs 5713: constants specify one of the available colors in Thot. The available color
5714: names can be found in the file <TT>thot.color</TT>.</P>
5715: <P>
1.13 cvs 5716: The color rules affect the same way all base elements and elements having a
5717: <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>,
5718: no matter what their type (text, graphics, pictures,
5719: symbols). The color rules can be associated with any box and can be
5720: transmitted by inheritance to the base elements or the elements having
5721: a <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>. Like the preceding rules,
5722: only inheritance of the same value is allowed.</P>
1.1 cvs 5723: <PRE>
5724: 'Foreground' ':' NameInherit
5725: 'Background' ':' NameInherit
5726: </PRE>
5727: <P>
5728: <STRONG>Note:</STRONG> text colors only appear for text elements whose <A
1.6 cvs 5729: href="#sectc4229">fill pattern</A> does not prevent the use of color.</P>
1.1 cvs 5730: <BLOCKQUOTE class="example">
5731: <P>
5732: <STRONG>Example:</STRONG></P>
5733: <P>
1.3 cvs 5734: To specify that, in Figures, everything must be drawn in blue on a background
1.5 cvs 5735: of yellow, the Figure element is given these rules:</P>
1.1 cvs 5736: <PRE>
5737: Figure :
5738: BEGIN
5739: Foreground : Blue;
5740: Background : Yellow;
5741: Fillpattern : backgroundcolor;
5742: END;
5743: </PRE>
5744: <P>
5745: and the elements composing figures are given inheritance rules:</P>
5746: <PRE>
5747: Foreground : Enclosing =;
5748: Background : Enclosing =;
5749: FillPattern : Enclosing =;
5750: </PRE>
5751: </BLOCKQUOTE>
5752: </DIV>
5753:
5754: <DIV class="subsection">
1.13 cvs 5755: <H3><A name=sectc4230a>Background color and border</A></H3>
5756:
5757: <P>
5758: Boxes associated with structural elements are normally not visible, but it
5759: is possible to draw their border and/or to paint their area when it is needed.
5760: This is achieved by associating the <TT>ShowBox</TT> rule with the concerned
5761: element. This rule has no parameter and no value. It is simply written
5762: <TT>Showbox;</TT>. It is not inherited nor transmitted to any other element.
5763: It applies only to the element with which it is associated.</P>
5764: <PRE>
5765: 'ShowBox'
5766: </PRE>
5767: <P>
5768: When an element has a <TT>ShowBox</TT> rule, the border is drawn only if
5769: the <TT>LineWeight</TT> rule that applies to that element has a non-zero
5770: value (this value can be inherited). The color, style and thickness of the
5771: border are defined by the <TT>Foreground</TT>, <TT>LineStyle</TT>, and
5772: <TT>LineWeight</TT> rules that apply to the element.</P>
5773: <P>
5774: When an element has a <TT>ShowBox</TT> rule, the background of this element
5775: is paint only if the value of the <TT>FillPattern</TT> rule that applies to
5776: that element is not <TT>nopattern</TT>. The pattern and color(s) of the
5777: background are defined by the <TT>FillPattern</TT>, <TT>Background</TT>, and
5778: <TT>Foreground</TT> rules that apply to the element.</P>
5779: </DIV>
5780:
5781: <DIV class="subsection">
5782: <H3><A name=sectc4230b>Background pictures</A></H3>
5783:
5784: <P>
5785: The <TT>BackgroundPicture</TT> rule allows to display a picture as the
5786: background of an element. It has a single parameter, the file name of the
5787: picture. This is a string delimited by single quotes. If the first
5788: character in this string is '/', it is considered as an absolute path,
5789: otherwise the file is searched for along the schema directory
5790: path. This file may contain a picture in any format accepted by
5791: Thot (xbm, xpm, gif, jpeg, png, etc.)</P>
5792: <P>
5793: The <TT>BackgroundPicture</TT> and <TT>PictureMode</TT> rules apply only to
5794: the element with which they are associated. They are not inherited nor
5795: transmitted to children elements.</P>
5796: <P>
5797: The background picture has not always the same size as the element's box.
5798: There are diffrent ways to fill the element box with the picture. This is
5799: specified by the <TT>PictureMode</TT> rule, which should be associated to
5800: the same element. This rule may take one of the following values:</P>
5801: <DL>
5802: <DT><TT>NormalSize</TT>
5803: <DD>The picture is centered in the box, and clipped if it is too large.
5804:
5805: <DT><TT>Scale</TT>
5806: <DD>The picture is zoomed to fit the box size.
5807:
5808: <DT><TT>RepeatX</TT>
5809: <DD>The picture is repeated horizontally to fit the box width.
5810:
5811: <DT><TT>RepeatY</TT>
5812: <DD>The picture is repeated vertically to fit the box height.
5813:
5814: <DT><TT>RepeatXY</TT>
5815: <DD>The picture is repeated both horizontally and vertically to fill the box.
5816: </DL>
5817: <P>
5818: If an element has a <TT>BackgroundPicture</TT> rule and no <TT>PictureMode</TT>
5819: rule, the <TT>NormalSize</TT> value is assumed.</P>
5820: <PRE>
5821: 'BackgroundPicture' ':' FileName /
5822: 'PictureMode' ':' PictMode .
5823:
5824: FileName = STRING .
5825: PictMode = 'NormalSize' / 'Scale' / 'RepeatXY' / 'RepeatX' / 'RepeatY' .
5826: </PRE>
5827: <P>
5828: The <TT>BackgroundPicture</TT> and <TT>PictureMode</TT> rules apply only to
5829: the element with which they are associated. They are not inherited nor
5830: transmitted to children elements.</P>
5831: </DIV>
5832:
5833: <DIV class="subsection">
1.6 cvs 5834: <H3><A name=sectc4231>Presentation box content</A></H3>
1.1 cvs 5835:
5836: <P>
5837: The <TT>Content</TT> rule applies to presentation boxes. It indicates the
5838: content given to a box. This content is either a variable's value or a
1.6 cvs 5839: constant value. In the special case of <A href="#sectc4233">header or footer
1.1 cvs 5840: boxes</A>, the content can also be a structured element type.</P>
5841: <P>
5842: If the content is a constant, it can be specified, as in a variable
5843: declaration, either by the name of a constant declared in the <TT>CONST</TT>
5844: section or by direct specification of the type and value of the box's
5845: content.</P>
5846: <P>
5847: Similarly, if it is a variable, the name of a variable declared in
5848: <TT>VAR</TT> section can be given or the variable may be defined within
5849: parentheses. The content inside the parentheses has the same syntax as a <A
1.6 cvs 5850: href="#sectc426">variable declaration</A>.</P>
1.1 cvs 5851: <P>
5852: When the content is a structured element type, the name of the element type is
5853: given after the colon. In this case, the box's content is all elements of
5854: the named type which are designated by references which are part of the page
5855: on which the header or footer with this <TT>Content</TT> rule appears. Only
5856: associated elements can appear in a <TT>Content</TT> rule and the structure
5857: must provide references to these elements. Moreover, the box whose content
5858: they are must be a header or footer box generated by a page box of the primary
5859: view.</P>
5860: <PRE>
5861: 'Content' ':' VarConst
5862: VarConst = ConstID / ConstType ConstValue /
5863: VarID / '(' FunctionSeq ')' /
5864: ElemID .
5865: </PRE>
5866: <P>
5867: A presentation box can have only one <TT>Content</TT> rule, which means that
5868: the content of a presentation box cannot vary from view to view. However, such
5869: an effect can be achieved by creating several presentation boxes, each with
5870: different content and visible in different views.</P>
5871: <P>
5872: The <TT>Content</TT> rule also applies to elements defined as references in
5873: the structure schema. In this case, the content defined by the rule must be
5874: a constant. It is this content which appears on the screen or paper to
5875: represent references of the type to which the rule applies. A reference can
1.6 cvs 5876: have a <TT>Content</TT> rule or a <A href="#sectc4234"><TT>Copy</TT> rule</A>
1.1 cvs 5877: for each view. If neither of these rules appears, the reference is displayed
5878: as <TT>[*]</TT>, which is equivalent to the rule:</P>
5879: <PRE>
5880: Content: Text '[*]';
5881: </PRE>
5882: <BLOCKQUOTE class="example">
5883: <P>
5884: <STRONG>Example:</STRONG></P>
5885: <P>
1.3 cvs 5886: The content of the presentation box created to make the chapter number and
5887: section number appear before each section title can be defined by:</P>
1.1 cvs 5888: <PRE>
5889: BOXES
5890: SectionNumBox :
5891: BEGIN
5892: Content : NumSection;
5893: ...
5894: END;
5895: </PRE>
5896: <P>
1.5 cvs 5897: if the <TT>NumSection</TT> variable has been defined in the variable definition
1.3 cvs 5898: section of the presentation schema. Otherwise the <TT>Content</TT> would be
1.1 cvs 5899: written:</P>
5900: <PRE>
5901: BOXES
5902: SectionNumBox :
5903: BEGIN
5904: Content : (VALUE (ChapterCtr, Roman) TEXT '.'
5905: VALUE (SectionCtr, Arabic));
5906: ...
5907: END;
5908: </PRE>
5909: <P>
5910: To specify that a page footer should contain all elements of the <TT>Note</TT>
5911: type are referred to in the page, the following rule is written:</P>
5912: <PRE>
5913: BOXES
5914: NotesFooterBox :
5915: BEGIN
5916: Content : Note;
5917: ...
5918: END;
5919: </PRE>
5920: <P>
1.5 cvs 5921: <TT>Note</TT> is defined as an associated element in the structure schema and
1.1 cvs 5922: NotesFooterBox is created by a page box of the primary view.</P>
5923: </BLOCKQUOTE>
5924: </DIV>
5925:
5926: <DIV class="subsection">
1.6 cvs 5927: <H3><A name=sectc4232>Presentation box creation</A></H3>
1.1 cvs 5928:
5929: <P>
5930: A creation rule specifies that a presentation box should be created when an
5931: element of the type to which the rule is attached appears in the document.</P>
5932: <P>
5933: A keyword specifies the position, relative to the creating box, at which the
5934: created box will be placed in the structure:</P>
5935: <DL>
5936: <DT><TT>CreateFirst</TT></DT>
1.2 cvs 5937: <DD>specifies that the box should be created as the first box of the next lower
5938: level, before any already existing boxes, and only if the beginning of the
1.1 cvs 5939: creating element is visible;
5940: </DD>
5941: <DT><TT>CreateLast</TT></DT>
1.2 cvs 5942: <DD>specifies that the box should be created as the last box of the next lower
5943: level, after any existing boxes, and only if the end of the creating element is
1.1 cvs 5944: visible;
5945: </DD>
5946: <DT><TT>CreateBefore</TT></DT>
1.2 cvs 5947: <DD>specifies that the box should be created before the creating box, on the
5948: same level as the creating box, and only if the beginning of the creating
1.1 cvs 5949: element is visible;
5950: </DD>
5951: <DT><TT>CreateAfter</TT></DT>
1.2 cvs 5952: <DD>specifies that the box should be created after the creating box, on the
5953: same level as the creating box, and only if the beginning of the creating
1.1 cvs 5954: element is visible;
5955: </DD>
5956: <DT><TT>CreateEnclosing</TT></DT>
1.2 cvs 5957: <DD>specifies that the box should be created at the upper level relatively to
5958: the creating box, and that it must contain that creating box and all
5959: presentation boxes created by the same creating box.
1.1 cvs 5960: </DD>
5961: </DL>
5962: <P>
5963: This keyword can be followed by the <TT>Repeated</TT> keyword to indicate that
5964: the box must be created for each part of the creating element. These parts
5965: result from the division of the element by page breaks or column changes. If
5966: the <TT>Repeated</TT> keyword is missing, the box is only created for the
5967: first part of the creating element (<TT>CreateFirst</TT> and
5968: <TT>CreateBefore</TT> rules) or for the last part (<TT>CreateLast</TT> and
5969: <TT>CreateAfter</TT> rules).</P>
5970: <P>
5971: The type of presentation to be created is specified at the end of the rule
5972: between parentheses.</P>
5973: <P>
1.6 cvs 5974: Creation rules cannot appear in the <A href="#sectc427">default
1.1 cvs 5975: presentation rules</A>. The boxes being created should have a
5976: <TT>Content</TT> rule which indicates their <A
1.6 cvs 5977: href="#sectc4231">content</A>.</P>
1.1 cvs 5978: <P>
5979: Creation rules can only appear in the block of rules for the primary view;
5980: creation is provoked by a document element for all views. However, for each
5981: view, the presentation box is only created if the creating element is itself a
5982: box in the view. Moreover, the visibility parameter of the presentation box
5983: can be adjusted to control the creation of the box on a view-by-view
5984: basis.</P>
5985: <PRE>
5986: Creation '(' BoxID ')'
5987: Creation = Create [ 'Repeated' ] .
5988: Create ='CreateFirst' / 'CreateLast' /
5989: 'CreateBefore' / 'CreateAfter' /
5990: 'CreateEnclosing' .
5991: </PRE>
5992: <BLOCKQUOTE class="example">
5993: <P>
5994: <STRONG>Example:</STRONG></P>
5995: <P>
1.3 cvs 5996: Let us define an object type, called Table, which is composed of a sequence of
5997: columns, all having the same fixed width, where the columns are separated by
5998: vertical lines. There is a line to the left of the first column and one to the
5999: right of the last. Each column has a variable number of cells, placed one on
6000: top of the other and separated by horizontal lines. There are no horizontal
6001: lines above the first cell or below the last cell. The text contained in
1.5 cvs 6002: each cell is broken into lines and these lines are centered horizontally in
6003: the cell. The logical structure of this object is defined by:</P>
1.1 cvs 6004: <PRE>
6005: Table = LIST OF (Column);
6006: Column = LIST OF (Cell = Text);
6007: </PRE>
6008:
6009: <DIV class="figure">
6010: <HR>
6011: <PRE>
6012: | | | |
6013: | xx xxxx xxxx |x xxxx xxx xxxxx| x xxx x xxx |
6014: | xxx xxx xxxx x | x xx x xxx | xxxxx xxxx xx |
6015: | xxxxx xxxx |----------------| xxx xxxxx x |
6016: | xxxxx xxx xxxx | xxxx xx xx xxx | xx xx |
6017: | xxx xxxx x xxx | xxxx x xxx x |---------------|
6018: |----------------| xxx xxxx xxxxx | xxxxx xxxxx |
6019: | xxx xxx xxxxxx |----------------| xxx xxxx xxxx |
6020: | xxxx xxxx xx | xxxx xx x xx | xxx xx x xx |
6021: |----------------| xxx xxxxx xxxx | xxxx xxxx xxx |
6022: | xxxxx xxx xxxx | xxxx xx x xx | xxxxx xxx |
6023: |xxxx xx x xxxxxx| xxxx xx xxxxxx | xxxxx xxxxx |
6024: </PRE>
6025: <P align=center>
6026: <EM><A name="table">The design of a table</A></EM></P>
6027: <HR>
6028: </DIV>
6029: <P>
6030: The presentation of the table should resemble the design of the above <A
6031: href="#table">figure</A>. It is defined by the following presentation schema
6032: fragment:</P>
6033: <PRE>
6034: BOXES
6035: VertLine : BEGIN
6036: Width : 0.3 cm;
6037: Height : Enclosing . Height;
6038: VertPos : Top = Enclosing . Top;
6039: HorizPos : Left = Previous . Right;
6040: Content : Graphics 'v';
6041: END;
6042:
6043: HorizLine: BEGIN
6044: Width : Enclosing . Width;
6045: Height : 0.3 cm;
6046: VertPos : Top = Previous . Bottom;
6047: HorizPos : Left = Enclosing . Left;
6048: Content : Graphics 'h';
6049: END;
6050:
6051: RULES
1.6 cvs 6052: Column : BEGIN
6053: CreateBefore (VertLine);
6054: IF LAST CreateAfter (VertLine);
6055: Width : 2.8 cm;
6056: Height : Enclosed . Height;
6057: VertPos : Top = Enclosing . Top;
6058: HorizPos : Left = Previous . Right;
6059: END;
6060:
6061: Cell : BEGIN
6062: IF NOT FIRST CreateBefore (HorizLine);
6063: Width : Enclosing . Width;
6064: Height : Enclosed . Height;
6065: VertPos : Top = Previous . Bottom;
6066: HorizPos : Left = Enclosing . Left;
6067: Line;
6068: Adjust : VMiddle;
6069: END;
1.1 cvs 6070: </PRE>
6071: <P>
6072: It is useful to note that the horizontal position rule of the first vertical
6073: line will not be applied, since there is no preceding box. In this case, the
6074: box is simply placed on the left side of the enclosing box.</P>
6075: </BLOCKQUOTE>
6076: </DIV>
6077:
6078: <DIV class="subsection">
1.6 cvs 6079: <H3><A name=sectc4233>Page layout</A></H3>
1.1 cvs 6080:
6081: <P>
6082: The page models specified in the <TT>Page</TT> rule are defined by boxes
6083: declared in the <TT>BOXES</TT> section of the presentation schema. Pages are
6084: not described as frames which will be filled by the document's text, but as
6085: element are inserted in the flow of the document and which mark the page
6086: breaks. Each of these page break elements contains presentation boxes which
6087: represent the footer boxes of a page followed by header boxes of the next
6088: page. The page box itself is the simple line which separates two pages on the
6089: screen. Both the footer and header boxes placed themselves with respect to
6090: this page box, with the footer being placed above it and the header boxes
6091: being placed above it.</P>
6092: <P>
6093: The boxes created by a page box are headers and footers and can only place
6094: themselves vertically with respect to the page box itself (which is in fact
6095: the separation between two pages). Besides, it is their vertical position
6096: rule which determines whether they are header or footer boxes. Header and
6097: footer boxes must have an explicit vertical position rule (they must not use
6098: the default rule).</P>
6099: <P>
6100: Footer boxes must have an absolute height or inherit the height of their
6101: contents:</P>
6102: <PRE>
6103: Height : Enclosed . Height;
6104: </PRE>
6105: <P>
6106: A page box must have height and width rules and these two rules must be
6107: specified with constant values, expressed in centimeters, inches, or
6108: typographer's points. These two rules are interpreted in a special way for
6109: page boxes: they determine the width of the page and the vertical distance
6110: between two page separators, which is the height of the page and its header
6111: and footer together.</P>
6112: <P>
6113: A page box should also have vertical and horizontal position rules and these
6114: two rules should specify the position on the sheet of paper of the rectangle
6115: enclosing the page's contents. These two rules must position the upper left
6116: corner of the enclosing rectangle in relation to the upper left corner of the
6117: sheet of paper, considered to be the enclosing element. In both rules,
6118: distances must be expressed in fixed units: centimeters (<TT>cm</TT>), inches
6119: (<TT>in</TT>), or typographer's points (<TT>pt</TT>). Thus, rules similar to
6120: the following should be found in the rules for a page box:</P>
6121: <PRE>
6122: BOXES
6123: ThePage :
6124: BEGIN
6125: VertPos : Top = Enclosing . Top + 3 cm;
6126: HorizPos : Left = Enclosing . Left + 2.5 cm;
6127: Width : 16 cm;
6128: Height : 22.5 cm;
6129: END;
6130: </PRE>
6131: <P>
6132: When a document must be page broken, the page models to be constructed are
6133: defined in the <TT>BOXES</TT> section of the presentation schema by declaring
6134: page boxes and header and footer boxes. Also, the <TT>Page</TT> rule is used
6135: to specify to which parts of the document and to which views each model should
6136: be applied.</P>
6137: <P>
6138: The <TT>Page</TT> rule has only one parameter, given between parentheses after
6139: the <TT>Page</TT> keyword. This parameter is the name of the box which must
6140: serve as the model for page construction. When a <TT>Page</TT> rule is
6141: attached to an element type, each time such an element appears in a document,
6142: a page break takes place and the page model indicated in the rule is applied
6143: to all following pages, until reaching the next element which has a
6144: <TT>Page</TT> rule.</P>
6145: <P>
6146: The <TT>Page</TT> rule applies to only one view; if it appears in the primary
6147: view's block of rules, a <TT>Page</TT> rule applies only to that view. Thus,
6148: different page models can be defined for the full document and for its table
6149: of contents, which is another view of the same document. Some views can be
6150: specified with pages, and other views of the same document can be specified
6151: without pages.</P>
6152: <PRE>
6153: 'Page' '(' BoxID ')'
6154: </PRE>
6155: </DIV>
6156:
6157: <DIV class="subsection">
1.6 cvs 6158: <H3><A name=sectc4234>Box copies</A></H3>
1.1 cvs 6159:
6160: <P>
6161: The <TT>Copy</TT> rule can be used for an element which is defined as a
1.7 cvs 6162: reference in the structure schema. In this case, the rule specifies, between
6163: parenthesis, the name of the box (declared in the <TT>BOXES</TT> section)
1.1 cvs 6164: which must be produced when this reference appears in the structure of a
6165: document. The box produced is a copy (same contents, but possible different
6166: presentation) of the box type indicated by the parameter between parentheses,
6167: and which is in the element designated by the reference. The name of a box
6168: can be replaced by type name. Then what is copied is the contents of the
6169: element of this type which is inside the referenced element.</P>
6170: <P>
6171: Whether a box name or type name is given, it may be followed by the name of a
6172: structure schema between parentheses. This signifies that the box or type is
6173: defined in the indicated structure schema and not in the structure schema with
6174: which the rule's presentation schema is associated.</P>
6175: <P>
6176: The <TT>Copy</TT> rule can also be applied to a presentation box. If the
6177: presentation box was created by a reference attribute, the rule is applied as
6178: in the case of a reference element: the contents of the box having the
6179: <TT>Copy</TT> rule are based on the element designated by the reference
6180: attribute. For other presentation boxes, the <TT>Copy</TT> rule takes a type
6181: name parameter which can be followed, between parentheses, by the name of the
6182: structure schema in which the type is defined, if it is not defined in the
6183: same schema. The contents of the box which has this rule are a copy of the
6184: element of this type which is in the element creating the presentation box, or
6185: by default, the box of this type which precedes the presentation box. This
6186: last facility is used, for example, to define the running titles in headers or
6187: footers.</P>
6188: <PRE>
1.6 cvs 6189: 'Copy' '(' BoxTypeToCopy ')' .
1.1 cvs 6190: BoxTypeToCopy = BoxID [ ExtStruct ] /
1.6 cvs 6191: ElemID [ ExtStruct ] .
6192: ExtStruct = '(' ElemID ')' .
1.1 cvs 6193: </PRE>
6194: <P>
6195: Like the creation rules, the <TT>Copy</TT> rule cannot appear in the <A
1.6 cvs 6196: href="#sectc427">default presentation rules</A>. Moreover, this rule
1.1 cvs 6197: can only appear in the primary view's block of rules; the copy rule is applied
6198: to all views.</P>
6199: <BLOCKQUOTE class="example">
6200: <P>
6201: <STRONG>Example:</STRONG></P>
6202: <P>
6203: If the following definitions are in the structure schema:</P>
6204: <PRE>
6205: Body = LIST OF (Chapter =
6206: BEGIN
6207: ChapterTitle = Text;
6208: ChapterBody = SectionSeq;
6209: END);
6210: RefChapter = REFERENCE (Chapter);
6211: </PRE>
6212: <P>
6213: then the following presentation rules (among many other rules in
1.3 cvs 6214: the presentation schema) can be specified:</P>
1.1 cvs 6215: <PRE>
6216: COUNTERS
6217: ChapterCtr : RANK OF Chapter;
6218: BOXES
6219: ChapterNumber :
6220: BEGIN
6221: Content : (VALUE (ChapterCtr, URoman));
6222: ...
6223: END;
6224: RULES
6225: Chapter :
6226: BEGIN
6227: CreateFirst (ChapterNumber);
6228: ...
6229: END;
6230: RefChapter :
6231: BEGIN
6232: Copy (ChapterNumber);
6233: ...
6234: END;
6235: </PRE>
6236: <P>
1.4 cvs 6237: which makes the number of the chapter designated by the reference appear in
6238: uppercase roman numerals, in place of the reference to a chapter itself.
6239: Alternatively, the chapter title can be made to appear in place of the
1.1 cvs 6240: reference by writing this <TT>Copy</TT>rule:</P>
6241: <PRE>
6242: Copy (ChapterTitle);
6243: </PRE>
6244: <P>
6245: To define a header box, named <TT>RunningTitle</TT>, which contains the title
6246: of the current chapter, the box's contents are defined in this way:</P>
6247: <PRE>
6248: BOXES
6249: RunningTitle :
6250: Copy (ChapterTitle);
6251: </PRE>
6252: </BLOCKQUOTE>
6253: </DIV>
6254: </DIV>
6255: <HR>
6256: </DIV>
6257:
6258: <DIV class="chapter">
1.6 cvs 6259: <H1><A name=sect5>The T language</A></H1>
1.1 cvs 6260:
6261:
6262: <DIV class="section">
1.6 cvs 6263: <H2><A name=sectb51>Document translation</A></H2>
1.1 cvs 6264:
6265: <P>
6266: Because of its document model, Thot can produce documents in a high-level
6267: abstract form. This form, called the <EM>canonical form</EM> is specific to
6268: Thot; it is well suited to the editor's manipulations, but it does not
6269: necessarily suit other operations which might be applied to documents. Because
6270: of this, the Thot editor offers the choice of saving documents in its own form
6271: (the canonical form) or a format defined by the user. In the latter case, the
6272: Thot document is transformed by the translation program. This facility can
6273: also be used to export documents from Thot to systems using other
6274: formalisms.</P>
6275:
6276: <DIV class="subsection">
1.6 cvs 6277: <H3><A name=sectc511>Translation principles</A></H3>
1.1 cvs 6278:
6279: <P>
6280: Document translation allows the export of documents to other systems which do
6281: not accept Thot's canonical form. Translation can be used to export document
6282: to source-based formatters like T<SUB><BIG>E</BIG></SUB>X,
6283: L<SUP>A</SUP>T<SUB><BIG>E</BIG></SUB>X, and <TT>troff</TT>. It can also be
6284: used to translate documents into interchange formats like SGML or HTML. To
6285: allow the widest range of possible exports, Thot does not limit the choice of
6286: translations, but rather allows the user to define the formalisms into which
6287: documents can be translated.</P>
6288: <P>
6289: For each document or object class, a set of translation rules can be defined,
6290: specifying how the canonical form should be transformed into a given
6291: formalism. These translation rules are grouped into <EM>translation
6292: schemas</EM>, each schema containing the rules necessary to translate a
6293: generic logical structure (document or object structure) into a particular
6294: formalism. The same generic logical structure can have several different
6295: translation schemas, each defining translation rules for a different
6296: formalism.</P>
6297: <P>
6298: Like presentation schemas, translation schemas are generic. Thus, they apply
6299: to an entire object or document class and permit translation of all documents
6300: or objects of that class.</P>
6301: </DIV>
6302:
6303: <DIV class="subsection">
1.6 cvs 6304: <H3><A name=sectc512>Translation procedure</A></H3>
1.1 cvs 6305:
6306: <P>
6307: The translator works on the specific logical structure of the document being
6308: translated. It traverses the primary tree of this logical structure in
6309: pre-order and, at each node encountered, it applies the corresponding
6310: translation rules defined in the translation schema. Translation can be
6311: associated:</P>
6312: <UL>
6313: <LI>with element types defined in the structure schema,
6314: <LI>with global or local attributes defined in the structure schema,
6315: <LI>with specific presentation rules,
1.2 cvs 6316: <LI>with the content of the leaves of the structure (characters, symbols and
1.1 cvs 6317: graphical elements)
6318: </UL>
6319: <P>
6320: Thus, for each node, the translator applies all rules associated with the
6321: element type, all rules associated with each attribute (local or global)
6322: carried by the element, and if the element is a leaf of the tree, it also
1.10 cvs 6323: applies translation rules for characters, symbols, or graphical elements,
1.1 cvs 6324: depending on the type of the leaf.</P>
6325: <P>
6326: Rules associated with the content of leaves are different from all other
6327: rules: they specify only how to translate character strings, symbols, and
6328: graphical elements. All other rules, whether associated with element types,
6329: with specific presentation rules or with attributes, are treated similarly.
6330: These rules primarily allow:</P>
6331: <UL>
1.2 cvs 6332: <LI>generation of a text constant or variable before or after the contents of
1.1 cvs 6333: an element,
1.2 cvs 6334: <LI>modification of the order in which elements appear after translation,
1.1 cvs 6335: <LI>removal of an element in the translated document,
6336: <LI>and writing messages on the user's terminal during translation.
6337: </UL>
6338: </DIV>
6339: </DIV>
6340:
6341: <DIV class="section">
1.6 cvs 6342: <H2><A name=sectb52>Translation definition language</A></H2>
1.1 cvs 6343:
6344: <P>
6345: Translation schemas are written in a custom language, called T, which is
6346: described in the rest of this chapter. The grammar of T is specified using
1.6 cvs 6347: the same <A href="#sectc321">meta-language</A> as was used for the S and P
1.1 cvs 6348: languages and the translation schemas are written using the same conventions
6349: as the structure and presentation schemas. In particular, the keywords of the
6350: T language (the stings between apostrophes in the following syntax rules) can
6351: be written in any combination of upper-case and lower-case letters, but
6352: identifiers created by the programmer must always be written in the same
6353: way.</P>
6354:
6355: <DIV class="subsection">
1.6 cvs 6356: <H3><A name=sectc521>Organization of a translation schema</A></H3>
1.1 cvs 6357:
6358: <P>
6359: A translation schema is begun by the <TT>TRANSLATION</TT> keyword and is
6360: terminated by the <TT>END</TT> keyword. The <TT>TRANSLATION</TT> keyword is
6361: followed by the name of the generic structure for which a translation is being
6362: defined and a semicolon. This name must be identical to the name which
6363: appears after the <TT>STRUCTURE</TT> keyword in the corresponding structure
6364: schema.</P>
6365: <P>
6366: After this declaration of the structure, the following material appears in
6367: order:</P>
6368: <UL>
6369: <LI>the length of lines produced by the translation,
6370: <LI>the character delimiting the end of the line,
6371: <LI>the character string which the translator will insert if it must
6372: line-break the translated text,
6373: <LI>declarations of
6374: <UL>
6375: <LI>buffers,
6376: <LI>counters,
6377: <LI>constants,
6378: <LI>variables,
6379: </UL>
6380: <LI>translation rules associated with element types,
6381: <LI>translation rules associated with attributes,
6382: <LI>translation rules associated with specific presentation rules,
6383: <LI>translation rules associated with characters strings, symbols and
6384: graphical elements.
6385: </UL>
6386: <P>
6387: Each of these sections is introduced by a keyword followed by a sequence of
6388: declarations. All of these sections are optional, expect for the translation
6389: rules associated with element types. Many <TT>TEXTTRANSLATE</TT> sections can
6390: appear, each defining the rules for translating character strings of a
6391: particular alphabet.</P>
6392: <PRE>
6393: TransSchema ='TRANSLATION' ElemID ';'
6394: [ 'LINELENGTH' LineLength ';' ]
6395: [ 'LINEEND' CHARACTER ';' ]
6396: [ 'LINEENDINSERT' STRING ';' ]
6397: [ 'BUFFERS' BufferSeq ]
6398: [ 'COUNTERS' CounterSeq ]
6399: [ 'CONST' ConstSeq ]
6400: [ 'VAR' VariableSeq ]
6401: 'RULES' ElemSeq
6402: [ 'ATTRIBUTES' AttrSeq ]
6403: [ 'PRESENTATION' PresSeq ]
6404: < 'TEXTTRANSLATE' TextTransSeq >
6405: [ 'SYMBTRANSLATE' TransSeq ]
6406: [ 'GRAPHTRANSLATE' TransSeq ]
6407: 'END' .
6408: </PRE>
6409: </DIV>
6410:
6411: <DIV class="subsection">
1.6 cvs 6412: <H3><A name=sectc522>Line length</A></H3>
1.1 cvs 6413:
6414: <P>
6415: If a <TT>LINELENGTH</TT> instruction is present after the structure
6416: declaration, the translator divides the text it produces into lines, each line
6417: having a length less than or equal to the integer which follows the
6418: <TT>LINELENGTH</TT> keyword. This maximum line length is expressed as a
6419: number of characters. The end of the line is marked by the character defined
6420: by the <TT>LINEEND</TT> instruction. When the translator breaks the lines on
6421: a space character in generated text, this space will be replaced by the
6422: character string defined by the <TT>LINEENDINSERT</TT> instruction.</P>
6423: <P>
6424: If the <TT>LINEEND</TT> instruction is not defined then the linefeed character
6425: (octal code 12) is used as the default line end character. If the
6426: <TT>LINEENDINSERT</TT> instruction is not defined, the linefeed character is
6427: inserted at the end of the produced lines. If there is no <TT>LINELENGTH</TT>
6428: instruction, the translated text is not divided into lines. Otherwise, if the
6429: translation rules generate line end marks, these marks remain in the
6430: translated text, but the length of the lines is not controlled by the
6431: translator.</P>
6432: <PRE>
6433: LineLength = NUMBER .
6434: </PRE>
6435: <BLOCKQUOTE class="example">
6436: <P>
6437: <STRONG>Example:</STRONG></P>
6438: <P>
1.3 cvs 6439: To limit the lines produced by the translator to a length of 80 characters, the
6440: following rule is written at the beginning of the translation schema.</P>
1.1 cvs 6441: <PRE>
6442: LineLength 80;
6443: </PRE>
6444: </BLOCKQUOTE>
6445: </DIV>
6446:
6447: <DIV class="subsection">
1.6 cvs 6448: <H3><A name=sectc523>Buffers</A></H3>
1.1 cvs 6449:
6450: <P>
6451: A buffer is a unit of memory managed by the translator, which can either
6452: contain text read from the terminal during the translation (see the <A
1.6 cvs 6453: href="#sectc5212"><TT>Read</TT> rule</A>), or the name of the last picture
1.1 cvs 6454: (bit-map) encountered by the translator in its traversal of the document.
1.2 cvs 6455: Remember the pictures are stored in files that are separate for the document
1.1 cvs 6456: files and that the canonical form contains only the names of the files in
1.2 cvs 6457: which the pictures are found.</P>
1.1 cvs 6458: <P>
6459: Thus, there are two types of buffers: buffers for reading from the terminal
1.2 cvs 6460: (filled by the <TT>Read</TT> rule) and the buffer of picture names (containing
6461: the name of the last picture encountered). A translation schema can use
6462: either type, one or several read buffers and one (and only one) picture name
1.1 cvs 6463: buffer.</P>
6464: <P>
6465: If any buffers are used, the <TT>BUFFERS</TT> keyword must be present,
6466: followed by declarations of every buffer used in the translation schema. Each
6467: buffer declaration is composed only of the name of the buffer, chosen freely
1.2 cvs 6468: by the programmer. The picture name buffer is identified by the
1.1 cvs 6469: <TT>Picture</TT> keyword, between parentheses, following the buffer name. The
6470: <TT>Picture</TT> keyword may only appear once. Each buffer declaration is
6471: terminated by a semicolon.</P>
6472: <PRE>
6473: BufferSeq = Buffer < Buffer > .
6474: Buffer = BufferID [ '(' 'Picture' ')' ] ';' .
6475: BufferID = NAME .
6476: </PRE>
6477: <BLOCKQUOTE class="example">
6478: <P>
6479: <STRONG>Example:</STRONG></P>
6480: <P>
1.3 cvs 6481: The following buffer declarations create a picture name buffer named
1.2 cvs 6482: <TT>pictureName</TT> and a read buffer named <A
1.1 cvs 6483: name="destname"><TT>DestName</TT></A>:</P>
6484: <PRE>
6485: BUFFERS
1.2 cvs 6486: pictureName (Picture); DestName;
1.1 cvs 6487: </PRE>
6488: </BLOCKQUOTE>
6489: </DIV>
6490:
6491: <DIV class="subsection">
1.6 cvs 6492: <H3><A name=sectc524>Counters</A></H3>
1.1 cvs 6493:
6494: <P>
6495: Certain translation rules generate text that varies according to the context
6496: of the element to which the rules apply. Variable text is defined either in
1.6 cvs 6497: the <A href="#sectc526"><TT>VAR</TT> section</A> of the translation schema or
1.1 cvs 6498: in the rule itself (see the <TT>Create</TT> and <TT>Write</TT> rules). Both
6499: types of definition rely on counters for the calculation of variable
6500: material.</P>
6501: <P>
6502: There are two types of counter: counters whose value is explicitely computed
1.6 cvs 6503: by applying <A href="#sectc5221"><TT>Set</TT> and <TT>Add</TT> rules</A>, and
1.1 cvs 6504: counters whose value is computed by a function associated with the counter.
6505: Those functions allow the same calculations as can be used in presentation
6506: schemas. As in a presentation schema, counters must be defined in the
6507: <TT>COUNTERS</TT> section of the translation schema before they are used.</P>
6508: <P>
6509: When counters are used in a translation schema, the <TT>COUNTERS</TT> keyword
6510: is followed by the declarations of every counter used. Each declaration is
6511: composed of the counter's name possibly followed by a colon and the counting
6512: function to be used for the counter. The declaration is terminated by a
6513: semi-colon. If the counter is explicitely computed by <TT>Set</TT> and
6514: <TT>Add</TT> rules, no counting function is indicated. If a counting function
6515: is indicated, <TT>Set</TT> and <TT>Add</TT> rules cannot be applied to that
6516: counter.</P>
6517: <P>
6518: The counting function indicates how the counter's value will be computed.
6519: Three functions are available: <TT>Rank</TT>, <TT>Rlevel</TT>, and
6520: <TT>Set</TT>.</P>
6521: <UL>
1.5 cvs 6522: <LI><TT>Rank of ElemID</TT> indicates that the counter's value is the rank of
6523: the element of type <TT>ElemID</TT> which encloses the element for which the
1.2 cvs 6524: counter is being evaluated. For the purposes of this function, an element of
1.5 cvs 6525: type <TT>ElemID</TT> is considered to enclose itself. This function is
6526: primarily used when the element of type <TT>ElemID</TT> is part of an
1.2 cvs 6527: aggregate or list, in which case the counter's value is the element's rank in
1.5 cvs 6528: its list or aggregate. Note that, unlike the <TT>Rank</TT> function for
6529: presentation schemas, the <TT>Page</TT> keyword cannot be used in place of the
1.1 cvs 6530: <TT>ElemID</TT>.
6531: <P>
6532: The type name <TT>ElemID</TT> can be followed by an integer. That number
6533: represents the relative level, among the ancestors of the concerned element,
6534: of the element whose rank is asked. If that relative level <I>n</I> is
1.5 cvs 6535: unsigned, the <I>n<SUP>th</SUP></I> element of type <TT>ElemID</TT> encountered
6536: when travelling the logical structure from the root to the concerned element is
1.1 cvs 6537: taken into account. If the relative level is negative, the logical structure
6538: is travelled in the other direction, from the concerned element to the
6539: root.</P>
1.5 cvs 6540: <LI><TT>Rlevel of ElemID</TT> indicates that the counter's values is the
1.2 cvs 6541: relative level in the tree of the element for which the counter is being
6542: evaluated. The counter counts the number of elements of type <TT>ElemID</TT>
6543: which are found on the path between the root of the document's logical
6544: structure tree and the element (inclusive).
1.5 cvs 6545: <LI><TT>Set n on Type1 Add m on Type2</TT> indicates that the counter's value
1.2 cvs 6546: is calculated as follows: in traversing the document from the beginning to
6547: the element for which the counter is being evaluated, the counter is set to
1.5 cvs 6548: the value <TT>n</TT> each time a <TT>Type1</TT> element is encountered and is
6549: incremented by the amount <TT>m</TT> each time a <TT>Type2</TT> element is
6550: encountered. The initial value <TT>n</TT> and the increment <TT>m</TT> are
1.1 cvs 6551: integers.
6552: </UL>
6553: <P>
6554: As in a presentation schema, the <TT>Rank</TT> and <TT>Set</TT> functions can
6555: be modified by a numeric attribute which changes their initial value. This is
6556: indicated by the <TT>Init</TT> keyword followed by the numeric attribute's
6557: name. The <TT>Set</TT> function takes the value of the attribute instead of
6558: the <TT>InitValue</TT> (<TT>n</TT>). For the <TT>Rank</TT> function, the
6559: value of the attribute is considered to be the rank of the first element of
6560: the list (rather than the normal value of 1). Subsequent items in the list
6561: have their ranks shifted accordingly. In both cases, the attribute must be
6562: numeric and must be a local attribute of the root of the document itself.</P>
6563: <PRE>
6564: CounterSeq = Counter < Counter > .
6565: Counter = CounterID [ ':' CounterFunc ] ';' .
6566: CounterID = NAME .
6567: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ]
6568: [ 'Init' AttrID ] /
6569: 'Rlevel' 'of' ElemID /
6570: 'Set' InitValue 'On' ElemID
6571: 'Add' Increment 'On' ElemID
6572: [ 'Init' AttrID ] .
6573: SLevelAsc = [ '-' ] LevelAsc .
6574: LevelAsc = NUMBER .
6575: InitValue = NUMBER .
6576: Increment = NUMBER .
6577: ElemID = NAME .
6578: AttrID = NAME .
6579: </PRE>
6580: <BLOCKQUOTE class="example">
6581: <P>
6582: <STRONG>Example:</STRONG></P>
6583: <P>
6584: If the body of a chapter is defined in the structure schema by:</P>
6585: <PRE>
6586: Chapter_Body = LIST OF
6587: (Section = BEGIN
6588: Section_Title = Text;
6589: Section_Body = BEGIN
6590: Paragraphs;
6591: Section;
6592: END;
6593: END
6594: );
6595: </PRE>
6596: <P>
1.3 cvs 6597: (sections are defined recursively), a counter can be defined giving the <A
1.4 cvs 6598: name="sectnum">number of a section</A> within its level in the hierarchy:</P>
1.1 cvs 6599: <PRE>
6600: COUNTERS
6601: SectionNumber : Rank of Section;
6602: </PRE>
6603: <P>
6604: A counter holding the hierarchic level of a section:</P>
6605: <PRE>
6606: SectionLevel : Rlevel of Section;
6607: </PRE>
6608: <P>
1.5 cvs 6609: A <A name="uniquenum">counter</A> which sequentially numbers all the document's
1.1 cvs 6610: sections, whatever their hierarchic level:</P>
6611: <PRE>
6612: UniqueSectNum : Set 0 on Document Add 1 on Section;
6613: </PRE>
6614: </BLOCKQUOTE>
6615: </DIV>
6616:
6617: <DIV class="subsection">
1.6 cvs 6618: <H3><A name=sectc525>Constants</A></H3>
1.1 cvs 6619:
6620: <P>
6621: A common feature of translation rules is the generation of constant text. This
6622: text can be defined in the rule that generates it (see for example the <A
1.6 cvs 6623: href="#sectc5210"><TT>Create</TT></A> and <A href="#sectc5211"><TT>Write</TT></A>
1.1 cvs 6624: rules); but it can also be defined once in the constant declaration section
6625: and used many times in different rules. The latter option is preferable when
6626: the same text is used in several rules or several <A
1.6 cvs 6627: href="#sectc526">variables</A>.</P>
1.1 cvs 6628: <P>
6629: The <TT>CONST</TT> keyword begins the constant declaration section of the
6630: translation schema. It must be omitted if no constants are declared. Each
6631: constant declaration is composed of the constant name, an equals sign, and the
6632: constant's value, which is a character string between apostrophes. A constant
6633: declaration is terminated by a semicolon.</P>
6634: <PRE>
6635: ConstSeq = Const < Const > .
6636: Const = ConstID '=' ConstValue ';' .
6637: ConstID = NAME .
6638: ConstValue = STRING .
6639: </PRE>
6640: <BLOCKQUOTE class="example">
6641: <P>
6642: <STRONG><A name="levelexample">Example:</A></STRONG></P>
6643: <P>
1.5 cvs 6644: The following rule assigns the name <TT>TxtLevel</TT> to the character string
1.1 cvs 6645: ``Level'':</P>
6646: <PRE>
6647: CONST
6648: TxtLevel = 'Level';
6649: </PRE>
6650: </BLOCKQUOTE>
6651: </DIV>
6652:
6653: <DIV class="subsection">
1.6 cvs 6654: <H3><A name=sectc526>Variables</A></H3>
1.1 cvs 6655:
6656: <P>
1.10 cvs 6657: Variables allow to define variable text which is generated by the
6658: <TT>Create</TT> and <TT>Write</TT> rules. They are also used to define
6659: file names which are used in the <TT>Create</TT>, <TT>ChangeMainFile</TT>,
1.14 ! cvs 6660: <TT>RemoveFile</TT>, and <TT>Indent</TT> rules. Variables can be defined either
1.1 cvs 6661: in the <TT>VAR</TT> section of the translation schema or directly in the rules
1.10 cvs 6662: which use them. Variables that define file names must be declared in the
1.1 cvs 6663: <TT>VAR</TT> section, and when the same variable is used several times in the
6664: translation schema, it makes sense to define it globally in the <TT>VAR</TT>
6665: section. This section is only present if at least one variable is defined
6666: globally.</P>
6667: <P>
6668: After the <TT>VAR</TT> keyword, each global variable is defined by its name, a
6669: colon separator and a sequence of functions (at least one function). Each
6670: variable definition is terminated by a semicolon. Functions determine the
6671: different parts which together give the value of the variable. The value is
6672: obtained by concatenating the strings produced by each of the functions. Seven
6673: types of functions are available. Each variable definition may use any number
6674: of functions of each type.</P>
6675: <UL>
1.2 cvs 6676: <LI>The function <TT>Value(Counter)</TT>returns a string representing the
6677: value taken by the counter when it is evaluated for the element in whose rule
6678: the variable is used. The counter must have been declared in the
1.5 cvs 6679: <TT>COUNTERS</TT> section of the translation schema. When the counter is
1.2 cvs 6680: expressed in arabic numerals, the counter name can be followed by a colon and
6681: an integer indicating a minimum length (number of characters) for the string;
6682: if the counter's value is normally expressed with fewer characters than the
6683: required minimum, zeroes are added to the front of the string to achieve the
1.5 cvs 6684: minimum length.
1.1 cvs 6685: <P>
6686: By default, the counter value is written in arabic digits. If another
6687: representation of that value is needed, the counter name must be followed by a
6688: comma and one of the following keywords:</P>
6689: <UL>
6690: <LI><TT>Arabic</TT>: arabic numerals (default value),
6691: <LI><TT>LRoman</TT>: lower-case roman numerals,
6692: <LI><TT>URoman</TT>: upper-case roman numerals,
6693: <LI><TT>Uppercase</TT>: upper-case letter,
6694: <LI><TT>Lowercase</TT>: lower-case letter.
6695: </UL>
1.2 cvs 6696: <LI>The function <TT>FileDir</TT>, without parameter, returns a string
6697: representing the name of the directory of the output file that has been given
6698: as a parameter to the translation program. The string includes a character '/'
6699: at the end.
6700: <LI>The function <TT>FileName</TT>, without parameter, returns a string
6701: representing the name of the output file that has been given as a parameter to
6702: the translation program. The file extension (the character string that
6703: terminate the file name, after a dot) is not part of that string.
6704: <LI>The function <TT>Extension</TT>, without parameter, returns a string
6705: representing the extension of the file name. That string is empty if the file
6706: name that has been given as a parameter to the translation program has no
6707: extension. If there is an extension, its first character is a dot.
6708: <LI>The function <TT>DocumentName</TT>, without parameter, returns a string
6709: representing the name of the document being translated.
6710: <LI>The function <TT>DocumentDir</TT>, without parameter, returns a string
6711: representing the directory containing the document being translated.
6712: <LI>The function formed by the name of a constant returns that constant's
1.1 cvs 6713: value.
1.2 cvs 6714: <LI>The function formed by a character string between apostrophes returns that
1.1 cvs 6715: string.
1.2 cvs 6716: <LI>The function formed by the name of a buffer returns the contents of that
6717: buffer. If the named buffer is the picture buffer, then the name of the last
6718: picture encountered is returned. Otherwise, the buffer is a read buffer and
6719: the value returned is text previously read from the terminal. If the buffer
6720: is empty (no picture has been encountered or the <TT>Read</TT> rule has not
6721: been executed for the buffer), then the empty string is returned.
6722: <LI>The function formed by an attribute name takes the value of the indicated
6723: attribute for the element to which the variable applies. If the element does
6724: not have that attribute, then the element's ancestor are searched toward the
6725: root of the tree. If one of the ancestors does have the attribute then its
6726: value is used. If no ancestors have the attribute, then the value of the
1.1 cvs 6727: function is the empty string.
6728: </UL>
6729: <PRE>
6730: VariableSeq = Variable < Variable > .
6731: Variable = VarID ':' Function < Function > ';' .
6732: VarID = NAME .
6733: Function ='Value' '(' CounterID [ ':' Length ]
6734: [ ',' CounterStyle ] ')' /
6735: 'FileDir' / 'FileName' / 'Extension' /
6736: 'DocumentName' / 'DocumentDir' /
6737: ConstID / CharString /
6738: BufferID / AttrID .
6739: Length = NUMBER .
6740: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' /
6741: 'Uppercase' / 'Lowercase' .
6742: CharString = STRING .
6743: </PRE>
6744: <BLOCKQUOTE class="example">
6745: <P>
6746: <STRONG>Example:</STRONG></P>
6747: <P>
1.3 cvs 6748: To create, at the beginning of each section of the translated document, text
6749: composed of the string ``Section'' followed by the section number, the
1.5 cvs 6750: following <A name="varsectexample">variable definition</A> might be used:</P>
1.1 cvs 6751: <PRE>
6752: VAR
6753: SectionVar : 'Section' Value(SectionNumber);
6754: </PRE>
6755: <P>
6756: (see the definition of <A href="#sectnum"><TT>SectionNumber</TT></A>).</P>
6757: <P>
6758: The following variable definition can be used to create, at the beginning of
6759: each section, the text ``Level'' followed by the hierarchical level of the
6760: section. It used the constant defined above.</P>
6761: <PRE>
6762: LevelVar : TxtLevel Value(SectionLevel);
6763: </PRE>
6764: <P>
1.5 cvs 6765: (see the definitions of <A href="#sectnum"><TT>SectionLevel</TT></A> and of
6766: <A href="#levelexample"><TT>TxtLevel</TT></A>).</P>
1.1 cvs 6767: <P>
1.5 cvs 6768: To generate the translation of each section in a different file (see
1.6 cvs 6769: <A href="#sectc5220">rule <TT>ChangeMainFile</TT></A>), the name of these
1.1 cvs 6770: files might be defined by the following variable:</P>
6771: <PRE>
6772: VarOutpuFile : FileName Value(SectionNumber)
6773: Extension;
6774: </PRE>
6775: <P>
1.4 cvs 6776: If <TT>output.txt</TT> is the name of the <A name="varoutputfile">output
6777: file</A> specified when starting the translation program, translated sections
6778: are written in files <TT>output1.txt</TT>, <TT>output2.txt</TT>, etc.</P>
1.1 cvs 6779: </BLOCKQUOTE>
6780: </DIV>
6781:
6782: <DIV class="subsection">
1.6 cvs 6783: <H3><A name=sectc527>Translating structure elements</A></H3>
1.1 cvs 6784:
6785: <P>
6786: The <TT>RULES</TT> keyword introduces the translation rules which will be
6787: applied to the various structured element types. Translation rules can be
6788: specified for each element type defined in the structure schema, including the
6789: base types defined implicitly, whose names are <TT>TEXT_UNIT</TT>,
6790: <TT>PICTURE_UNIT</TT>, <TT>SYMBOL_UNIT</TT>, <TT>GRAPHIC_UNIT</TT> and
1.2 cvs 6791: <TT>PAGE_UNIT</TT>. But it is not necessary to specify rules for every
6792: defined type.</P>
1.1 cvs 6793: <P>
6794: If there are no translation rules for an element type, the elements that it
6795: contains (and which may have rules themselves) will still be translated, but
6796: the translator will produce nothing for the element itself. To make the
6797: translator completely ignore the content of an element the <A
1.6 cvs 6798: href="#sectc5217"><TT>Remove</TT> rule</A> must be used.</P>
1.1 cvs 6799: <P>
6800: The translation rules for an element type defined in the structure schema are
6801: written using the name of the type followed by a colon and the list of
1.6 cvs 6802: applicable rules. When the element type is a <A href="#sectd3285">mark pair</A>,
1.1 cvs 6803: but only in this case, the type name must be preceded by the <TT>First</TT> or
6804: <TT>Second</TT> keyword. This keyword indicates whether the rules that follow
6805: apply to the first or second mark of the pair.</P>
6806: <P>
6807: The list of rules can take several forms. It may be a simple non-conditional
6808: rule. It can also be formed by a condition followed by one or more simple
6809: rules. Or it can be a block of rules beginning with the <TT>BEGIN</TT>
6810: keyword and ending with the <TT>END</TT> keyword and a semicolon. This block
6811: of rules can contain one or more simple rules and/or one or more conditions,
6812: each followed by one or more simple rules.</P>
6813: <PRE>
6814: ElemSeq = TransType < TransType > .
6815: TransType = [ FirstSec ] ElemID ':' RuleSeq .
6816: FirstSec = 'First' / 'Second' .
6817: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' .
6818: Rule = SimpleRule / ConditionBlock .
6819: ConditionBlock = 'IF' ConditionSeq SimpleRuleSeq .
6820: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' /
6821: SimpleRule .
6822: </PRE>
6823: </DIV>
6824:
6825: <DIV class="subsection">
1.6 cvs 6826: <H3><A name=sectc528>Conditional rules</A></H3>
1.1 cvs 6827:
6828: <P>
6829: In a translation schema, the translation rules are either associated with
6830: element types or with attribute values or with a specific presentation. They
6831: are applied by the translator each time an element of the corresponding type
6832: is encountered in the translated document or each time the attribute value is
6833: carried by an element or also, each time the specific translation is attached
6834: to an element. This systematic application of the rules can be relaxed: it is
6835: possible to add a condition to one or more rules, so that these rules are only
6836: applied when the condition is true.</P>
6837: <P>
6838: A condition begins with the keyword <TT>IF</TT>, followed by a sequence of
6839: elementary conditions. Elementary conditions are separated from each other by
6840: the <TT>AND</TT> keyword. If there is only one elementary condition, this
6841: keyword is absent. The rules are only applied if all the elementary
6842: conditions are true. The elementary condition can be negative; it is then
6843: preceded by the <TT>NOT</TT> keyword.</P>
6844: <P>
6845: When the translation rule(s) controlled by the condition apply to a reference
6846: element or a reference attribute, an elementary condition can also apply to
6847: element referred by this reference. The <TT>Target</TT> keyword is used for
6848: that purpose. It must appear before the keyword defining the condition
6849: type.</P>
6850: <P>
6851: Depending on their type, some conditions may apply either to the element with
1.5 cvs 6852: which they are associated, or to one of its ancestor. In the case of an
1.1 cvs 6853: ancestor, the key word <TT>Ancestor</TT> must be used, followed by</P>
6854: <UL>
1.2 cvs 6855: <LI>either an integer which represents the number of levels in the tree
6856: between the element and the ancestor of interest,
6857: <LI>or the type name of the ancestor of interest. If that type is defined in
6858: a separate structure schema, the name of that schema must follow between
1.1 cvs 6859: parentheses.
6860: </UL>
6861: <P>
1.2 cvs 6862: There is a special case for the parent element, which can be simply written
1.5 cvs 6863: <TT>Parent</TT> instead of <TT>Ancestor 1</TT>.</P>
1.1 cvs 6864: <P>
6865: Only conditions <TT>First</TT>, <TT>Last</TT>, <TT>Referred</TT>,
6866: <TT>Within</TT>, <TT>Attributes</TT>, <TT>Presentation</TT>, <TT>Comment</TT>
6867: and those concerning an attribute or a specific presentation can apply to an
6868: ancestor. Conditions <TT>Defined</TT>, <TT>FirstRef</TT>, <TT>LastRef</TT>,
6869: <TT>ExternalRef</TT>, <TT>Alphabet</TT>, <TT>FirstAttr</TT>,
6870: <TT>LastAttr</TT>, <TT>ComputedPage</TT>, <TT>StartPage</TT>,
6871: <TT>UserPage</TT>, <TT>ReminderPage</TT>, <TT>Empty</TT> cannot be preceded by
6872: keywords <TT>Parent</TT> or <TT>Ancestor</TT>.</P>
6873: <P>
6874: In condition <TT>Referred</TT> and in the condition that applies to a named
1.5 cvs 6875: attribute, a symbol '<TT>*</TT>' can indicate that the condition is related
6876: only to the element itself. If this symbol is not present, not only the
6877: element is considered, but also its ancestor, at any level.</P>
1.1 cvs 6878: <P>
6879: The form of an elementary condition varies according to the type of
6880: condition.</P>
6881:
6882: <DIV class="subsubsection">
1.6 cvs 6883: <H4><A name=sectd5281>Conditions based on the logical position of the element</A></H4>
1.1 cvs 6884:
6885: <P>
6886: The condition can be on the position of the element in the document's logical
6887: structure tree. It is possible to test whether the element is the first
6888: (<TT>First</TT>) or last (<TT>Last</TT>) among its siblings or if it is not
6889: the first (<TT>NOT First</TT>) or not the last (<TT>NOT Last</TT>).</P>
6890: <P>
6891: It is also possible to test if the element is contained in an element of a
6892: given type (<TT>Within</TT>) or if it is not (<TT>NOT Within</TT>). If that
6893: element type is defined in a structure schema which is not the one which
6894: corresponds to the translation schema, the type name of this element must be
6895: followed, between parentheses, by the name of the structure schema which
6896: defines it.</P>
6897: <P>
6898: If the keyword <TT>Within</TT> is preceded by <TT>Immediately</TT>, the
6899: condition is satisfied only if the <EM>parent</EM> element has the type
6900: indicated. If the word <TT>Immediately</TT> is missing, the condition is
6901: satisfied if any <EM>ancestor</EM> has the type indicated.</P>
6902: <P>
6903: An integer <I>n</I> can appear between the keyword <TT>Within</TT> and the
6904: type. It specifies the number of ancestors of the indicated type that must be
6905: present for the condition to be satisfied. If the keyword
6906: <TT>Immediately</TT> is also present, the <I>n</I> immediate ancestors of the
6907: element must have the indicated type. The integer <I>n</I> must be positive
6908: or zero. It can be preceded by <TT><</TT> or <TT>></TT> to indicate a
6909: maximum or minimum number of ancestors. If these symbols are missing, the
6910: condition is satisfied only if it exists exactly <I>n</I> ancestors. When
6911: this number is missing, it is equivalent to > 0.</P>
1.11 cvs 6912: <P>
6913: If the condition applies to translation rules associated with an attribute,
6914: i.e. if it is in the <TT>ATTRIBUTES</TT> section of the presentation schema,
6915: the condition can be simply an element name. Translation rules are then
6916: executed only if the attribute is attached to an element of that type.
6917: The keyword <TT>NOT</TT> before the element name indicates that the
6918: translation rules must be executed only if the element is not of the type
6919: indicated.</P>
1.1 cvs 6920: </DIV>
6921:
6922: <DIV class="subsubsection">
1.6 cvs 6923: <H4><A name=sectd5282>Conditions on references</A></H4>
1.1 cvs 6924:
6925: <P>
6926: References may be taken into account in conditions, which can be based on the
6927: fact that the element, or one of its ancestors (unless symbol <TT>*</TT> is
6928: present), is designated by a at least one reference (<TT>Referred</TT>) or by
6929: none (<TT>NOT Referred</TT>). If the element or attribute to which the
6930: condition is attached is a reference, the condition can be based on the fact
6931: that it acts as the first reference to the designated element
6932: (<TT>FirstRef</TT>), or as the last (<TT>LastRef</TT>), or as a reference to
6933: an element located in another document (<TT>ExternalRef</TT>). Like all
6934: conditions, conditions on references can be inverted by the <TT>NOT</TT>
6935: keyword.</P>
6936: </DIV>
6937:
6938: <DIV class="subsubsection">
1.6 cvs 6939: <H4><A name=sectd5283>Conditions on the parameters</A></H4>
1.1 cvs 6940:
6941: <P>
1.6 cvs 6942: Elements which are <A href="#sectc326">parameters</A> can be given a particular
1.1 cvs 6943: condition which is based on whether or not the parameter is given a value in
6944: the document (<TT>Defined</TT> or <TT>NOT Defined</TT>, respectively).</P>
6945: </DIV>
6946:
6947: <DIV class="subsubsection">
1.6 cvs 6948: <H4><A name=sectd5284>Conditions on the alphabets</A></H4>
1.1 cvs 6949:
6950: <P>
6951: The character string base type (and only this type) can use the condition
6952: <TT>Alphabet = a</TT> which indicates that the translation rule(s) should only
6953: apply if the alphabet of the character string is the one whose name appears
6954: after the equals sign (or is not, if there is a preceding <TT>NOT</TT>
6955: keyword). This condition cannot be applied to translation rules of an
6956: attribute.</P>
6957: <P>
6958: In the current implementation of Thot, the available alphabets are the
6959: <TT>Latin</TT> alphabet and the <TT>Greek</TT> alphabet.</P>
6960: </DIV>
6961:
6962: <DIV class="subsubsection">
1.6 cvs 6963: <H4><A name=sectd5285>Conditions on page breaks</A></H4>
1.1 cvs 6964:
6965: <P>
6966: The page break base type (and only this type) can use the following
6967: conditions: <TT>ComputedPage</TT>, <TT>StartPage</TT>, <TT>UserPage</TT>, and
6968: <TT>ReminderPage</TT>. The <TT>ComputedPage</TT> condition indicates that the
6969: translation rule(s) should apply if the page break was created automatically
6970: by Thot; the <TT>StartPage</TT> condition is true if the page break is
6971: generated before the element by the <TT>Page</TT> rule of the P language; the
6972: <TT>UserPage</TT> condition applies if the page break was inserted by the
6973: user; and the <TT>ReminderPage</TT> is applied if the page break is a reminder
6974: of page breaking.</P>
6975: </DIV>
6976:
6977: <DIV class="subsubsection">
1.6 cvs 6978: <H4><A name=sectd5286>Conditions on the element's content</A></H4>
1.1 cvs 6979:
6980: <P>
6981: The condition can be based on whether or not the element is empty. An element
6982: which has no children or whose leaves are all empty is considered to be empty
6983: itself. This condition is expressed by the <TT>Empty</TT> keyword, optionally
6984: preceded by the <TT>NOT</TT> keyword.</P>
6985: </DIV>
6986:
6987: <DIV class="subsubsection">
1.6 cvs 6988: <H4><A name=sectd5287>Conditions on the presence of comments</A></H4>
1.1 cvs 6989:
6990: <P>
6991: The condition can be based on the presence or absence of comments associated
6992: with the translated element. This condition is expressed by the keyword
6993: <TT>Comment</TT>, optionally preceded by the keyword <TT>NOT</TT>.</P>
6994: </DIV>
6995:
6996: <DIV class="subsubsection">
1.6 cvs 6997: <H4><A name=sectd5288>Conditions on the presence of specific presentation rules</A></H4>
1.1 cvs 6998:
6999: <P>
7000: The condition can be based on the presence or absence of specific presentation
7001: rules associated with the translated element, whatever the rules, their value
7002: or their number. This condition is expressed by the keyword
7003: <TT>Presentation</TT>, optionally preceded by the <TT>NOT</TT> keyword.</P>
7004: </DIV>
7005:
7006: <DIV class="subsubsection">
1.6 cvs 7007: <H4><A name=sectd5289>Conditions on the presence of logical attributes</A></H4>
1.1 cvs 7008:
7009: <P>
7010: In the same way, the condition can be based on the presence or absence of
7011: attributes associated with the translated elements, no matter what the
7012: attributes or their values. The <TT>Attributes</TT> keyword expresses this
7013: condition.</P>
7014: </DIV>
7015:
7016: <DIV class="subsubsection">
1.6 cvs 7017: <H4><A name=sectd52810>Conditions on logical attributes</A></H4>
1.1 cvs 7018:
7019: <P>
7020: If the condition appears in the translation rules of an attribute, the
7021: <TT>FirstAttr</TT> and <TT>LastAttr</TT> keywords can be used to indicate that
7022: the rules must only be applied if this attribute is the first attribute for
7023: the translated element or if it is the last (respectively). These conditions
7024: can also be inverted by the <TT>NOT</TT> keyword.</P>
7025: <P>
7026: Another type of condition can only be applied to the translation rules when
7027: the element being processed (or one of its ancestors if symbol <TT>*</TT> is
7028: missing) has a certain attribute, perhaps with a certain value or, in
7029: contrast, when the element does not have this attribute with this value. The
7030: condition is specified by writing the name of the attribute after the keyword
7031: <TT>IF</TT> or <TT>AND</TT>. The <TT>NOT</TT> keyword can be used to invert
7032: the condition. If the translation rules must be applied to any element which
7033: has this attribute (or does not have it, if the condition is inverted) no
7034: matter what the attribute's value, the condition is complete. If, in
7035: contrast, the condition applies to one or more values of the attribute, these
7036: are indicated after the name of the attribute, except for reference attributes
7037: which do not have values.</P>
7038: <P>
7039: The representation of the values of an <A name="relattr">attribute</A> in a
7040: condition depends on the attribute's type. For attributes with enumerated or
7041: textual types, the value (a name or character string between apostrophes,
7042: respectively) is simply preceded by an equals sign. For numeric attributes,
7043: the condition can be based on a single value or on a range of values. In the
7044: case of a unique value, this value (an integer) is simply preceded by an
7045: equals sign. Conditions based on ranges of values have several forms:</P>
7046: <UL>
1.2 cvs 7047: <LI>all values less than a given value (the value is preceded by a ``less
1.1 cvs 7048: than'' sign).
1.2 cvs 7049: <LI>all values greater than a given value (the value is preceded by a
7050: ``greater than'' sign).
7051: <LI>all values falling in an interval, bounds included. The range of values
7052: is then specified <TT>IN [</TT>Minimum <TT>..</TT>Maximum<TT>]</TT>, where
7053: Minimum and Maximum are integers.
1.1 cvs 7054: </UL>
7055: <P>
1.2 cvs 7056: All numeric values may be negative. The integer is simply preceded by a minus
1.1 cvs 7057: sign.</P>
7058: <P>
7059: Both local and global attributes can be used in conditions.</P>
7060: </DIV>
7061:
7062: <DIV class="subsubsection">
1.6 cvs 7063: <H4><A name=sectd52811>Conditions on specific presentation rules</A></H4>
1.1 cvs 7064:
7065: <P>
7066: It is possible to apply translation rules only when the element being
7067: processed has or does not have a specific presentation rule, possibly with a
7068: certain value. The condition is specified by writing the name of the
7069: presentation rule after the keyword <TT>IF</TT> or <TT>AND</TT>. The
7070: <TT>NOT</TT> keyword can be used to invert the condition. If the translation
7071: rules must be applied to any element which has this presentation rule (or does
7072: not have it, if the condition is inverted) no matter what the rule's value,
7073: the condition is complete. If, in contrast, the condition applies to one or
7074: more values of the rule, these are indicated after the name of the
7075: attribute.</P>
7076: <P>
7077: The representation of presentation rule values in a condition is similar to
7078: that for attribute values. The representation of these values depend on the
7079: type of the presentation rule. There are three categories of presentation
7080: rules:</P>
7081: <UL>
7082: <LI>those taking numeric values (<TT>Size, Indent, LineSpacing,
7083: LineWeight</TT>),
7084: <LI>those with values taken from a predefined list (<TT>Adjust, Justify,
7085: Hyphenate, Style, Font, UnderLine, Thickness, LineStyle</TT>),
7086: <LI>those whose value is a name (<TT>FillPattern, Background,
7087: Foreground</TT>).
7088: </UL>
7089: <P>
7090: For presentation rules which take numeric values, the condition can take a
7091: unique value or a range of values. In the case of a unique value, this value
7092: (an integer) is simply preceded by an equals sign. Conditions based on ranges
7093: of values have several forms:</P>
7094: <UL>
1.2 cvs 7095: <LI>all values less than a given value (the value is preceded by a ``less
1.1 cvs 7096: than'' sign).
1.2 cvs 7097: <LI>all values greater than a given value (the value is preceded by a
7098: ``greater than'' sign).
7099: <LI>all values falling in an interval, bounds included. The range of values
7100: is then specified <TT>IN [</TT>Minimum <TT>..</TT>Maximum<TT>]</TT>, where
7101: Minimum and Maximum are integers.
1.1 cvs 7102: </UL>
7103: <P>
1.2 cvs 7104: Values for the <TT>Indent</TT>rule may be negative. The integer is then
7105: simply preceded by a minus sign and represents how far the first line starts
7106: to the left of the other lines.</P>
1.1 cvs 7107: <P>
7108: For presentation rules whose values are taken from predefined lists, the value
7109: which satisfies the condition is indicated by an equals sign followed by the
7110: name of the value.</P>
7111: <P>
7112: For presentation rule whose values are names, the value which satisfies the
7113: condition is indicated by the equals sign followed by the value's name. The
7114: names of fill patterns (the <TT>FillPattern</TT> rule) and of colors (the
7115: <TT>Foreground</TT> and <TT>Background</TT> rules) known to Thot are the same
7116: as in the P language.</P>
7117: <P>
7118: The syntax of conditions based on the specific presentation is the same as the
1.6 cvs 7119: syntax used to express the <A href="#sectc5224">translation of specific
1.1 cvs 7120: presentation rules</A>.</P>
7121: <P>
7122: When a condition has only one rule, the condition is simply followed by that
7123: rule. If it has several rules, they are placed after the condition between
7124: the keywords <TT>BEGIN</TT> and <TT>END</TT>.</P>
7125: <PRE>
7126: ConditionSeq = Condition [ 'AND' Condition ] .
7127: Condition = [ 'NOT' ] [ 'Target' ] Cond .
7128: Cond = CondElem / CondAscend .
7129: CondElem ='FirstRef' / 'LastRef' /
7130: 'ExternalRef' /
7131: 'Defined' /
7132: 'Alphabet' '=' Alphabet /
7133: 'ComputedPage' / 'StartPage' /
7134: 'UserPage' / 'ReminderPage' /
7135: 'Empty' /
1.11 cvs 7136: ElemID /
1.1 cvs 7137: 'FirstAttr' / 'LastAttr' .
7138: CondAscend = [ Ascend ] CondOnAscend .
7139: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType .
7140: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] .
7141: CondRelLevel = NUMBER .
7142: CondOnAscend ='First' / 'Last' /
7143: 'Referred' /
7144: [ 'Immediately' ] 'Within' [ NumParent ]
7145: ElemID [ ExtStruct ] /
7146: 'Attributes' /
7147: AttrID [ RelatAttr ] /
7148: 'Presentation' /
7149: PresRule /
7150: 'Comment' .
7151: NumParent = [ GreaterLess ] NParent .
7152: GreaterLess = '>' / '<' .
7153: NParent = NUMBER.
7154: ExtStruct = '(' ElemID ')' .
7155: Alphabet = NAME .
7156: RelatAttr ='=' Value /
7157: '>' [ '-' ] Minimum /
7158: '<' [ '-' ] Maximum /
7159: 'IN' '[' [ '-' ] MinInterval '..'
7160: [ '-' ] MaxInterval ']' .
7161: Value = [ '-' ] IntegerVal / TextVal / AttrValue .
7162: Minimum = NUMBER .
7163: Maximum = NUMBER .
7164: MinInterval = NUMBER .
7165: MaxInterval = NUMBER .
7166: IntegerVal = NUMBER .
7167: TextVal = STRING .
7168: AttrValue = NAME .
7169: </PRE>
7170: <BLOCKQUOTE class="example">
7171: <P>
7172: <STRONG>Example:</STRONG></P>
7173: <P>
1.3 cvs 7174: Suppose that after each element of type Section_Title it is useful to produce
7175: the text <TT>\label{SectX}</TT> where <TT>X</TT> represents the section number,
7176: but only if the section is designated by one or more references in the
7177: document. The following conditional rule produces this effect:</P>
1.1 cvs 7178: <PRE>
7179: RULES
7180: Section_Title :
7181: IF Referred
1.5 cvs 7182: Create ('\label{Sect' Value(UniqueSectNum) '}\12') After;
1.1 cvs 7183: </PRE>
7184: <P>
1.6 cvs 7185: (the declaration of the <A href="#sectc5224"><TT>UniqueSectNum</TT>
1.3 cvs 7186: counter</A> is given above). The string <TT>\12</TT> represents a line
1.1 cvs 7187: break.</P>
7188: </BLOCKQUOTE>
7189: <BLOCKQUOTE class="example">
7190: <P>
7191: <STRONG>Example:</STRONG></P>
7192: <P>
1.3 cvs 7193: Suppose that for elements of the Elmnt type it would be useful to produce a
7194: character indicating the value of the numeric attribute Level associated with
7195: the element: an ``A'' for all values of Level less than 3, a ``B'' for values
7196: between 3 and 10 and a ``C'' for values greater than 10. This can be achieved
7197: by writing the following rules for the Elmnt type:</P>
1.1 cvs 7198: <PRE>
7199: RULES
7200: Elmnt :
7201: BEGIN
7202: IF Level < 3
7203: Create 'A';
7204: IF Level IN [3..10]
7205: Create 'B';
7206: IF Level > 10
7207: Create 'C';
7208: END;
7209: </PRE>
7210: </BLOCKQUOTE>
7211: </DIV>
7212: </DIV>
7213:
7214: <DIV class="subsection">
1.6 cvs 7215: <H3><A name=sectc529>Translation rules</A></H3>
1.1 cvs 7216:
7217: <P>
1.14 ! cvs 7218: Fifteen types of translation rules can be associated with element types and
1.1 cvs 7219: attribute values. They are the <TT>Create</TT>, <TT>Write</TT>,
7220: <TT>Read</TT>, <TT>Include</TT>, <TT>Get</TT>, <TT>Copy</TT>, <TT>Use</TT>,
7221: <TT>Remove</TT>, <TT>NoTranslation</TT>, <TT>NoLineBreak</TT>,
1.14 ! cvs 7222: <TT>ChangeMainFile</TT>, <TT>RemoveFile</TT>, <TT>Set</TT>, <TT>Add</TT>,
! 7223: <TT>Indent</TT>, rules. Each rule has its own syntax, although they are
! 7224: all based on very similar models.</P>
1.1 cvs 7225: <PRE>
7226: SimpleRule = 'Create' [ 'IN' VarID ] Object
7227: [ Position ] ';' /
7228: 'Write' Object [ Position ] ';' /
7229: 'Read' BufferID [ Position ] ';' /
7230: 'Include' File [ Position ] ';' /
7231: 'Get' [ RelPosition ] ElemID
7232: [ ExtStruct ]
7233: [ Position ] ';' /
7234: 'Copy' [ RelPosition ] ElemID
7235: [ ExtStruct ]
7236: [ Position ] ';' /
7237: 'Use' TrSchema [ 'For' ElemID ] ';' /
7238: 'Remove' ';' /
7239: 'NoTranslation' ';' /
7240: 'NoLineBreak' ';' /
7241: 'ChangeMainFile' VarID [ Position ] ';' /
1.14 ! cvs 7242: 'RemoveFile' VarID [ Position ] ';' /
1.10 cvs 7243: 'Set' CounterID InitValue [ Position ] ';' /
7244: 'Add' CounterID Increment [ Position ] ';' /
7245: 'Indent' [ 'IN' VarID ] [ IndentSign ]
7246: IndentValue [ Position ] ';' .
1.1 cvs 7247: </PRE>
7248: </DIV>
7249:
7250: <DIV class="subsection">
1.6 cvs 7251: <H3><A name=sectc5210>The <TT>Create</TT> rule</A></H3>
1.1 cvs 7252:
7253: <P>
7254: The most frequently used rule is undoubtedly the <TT>Create</TT> rule, which
7255: generates fixed or variable text (called an <EM>object</EM>) in the output
7256: file. The generated text can be made to appear either before or after the
7257: content of the element to which the rule applies. The rule begins with the
7258: <TT>Create</TT> keyword, followed by a specifier for the object and a keyword
7259: (<TT>Before</TT> or <TT>After</TT>) indicating the position of the generated
1.6 cvs 7260: text (<A href="#sectc5222">before or after</A> the element's content). If the
1.1 cvs 7261: position is not indicated, the object will be generated before the element's
7262: content. This rule, like all translation rules, is terminated by a
7263: semicolon.</P>
7264: <P>
7265: The <TT>Create</TT> keyword can be followed by the <TT>IN</TT> keyword and by
7266: the name of a variable. This means that the text generated by the rule must
7267: not be written in the main output file, but in the file whose name is
7268: specified by the variable.</P>
7269: <P>
7270: This allows the translation program to generate text in different files during
1.14 ! cvs 7271: the same run. These files do not need to be explicitely declared or opened.
! 7272: They do not need to be closed either, but if they contain temporary data,
! 7273: they can be removed (see the <A href="#sectc5220a"><TT>RemoveFile</TT>
! 7274: rule</A>). As soon as the translation program
1.1 cvs 7275: executes a <TT>Create</TT> rule for a file that is not yet open, it opens the
7276: file. These files are closed when the translation is finished.</P>
7277: <PRE>
7278: 'Create' [ 'IN' VarID ] Object
7279: [ Position ] ';'
7280: Object = ConstID / CharString /
7281: BufferID /
7282: VarID /
7283: '(' Function < Function > ')' /
7284: AttrID /
7285: 'Value' /
7286: 'Content' /
7287: 'Comment' /
7288: 'Attributes' /
7289: 'Presentation' /
7290: 'RefId' /
7291: 'PairId' /
7292: 'FileDir' /
7293: 'FileName' /
7294: 'Extension' /
7295: 'DocumentName' /
7296: 'DocumentDir' /
7297: [ 'Referred' ] ReferredObject .
7298: Position ='After' / 'Before' .
7299:
7300: ReferredObject = VarID /
7301: ElemID [ ExtStruct ] /
7302: 'RefId' /
7303: 'DocumentName' /
7304: 'DocumentDir' .
7305: </PRE>
7306: <P>
7307: The object to be generated can be:</P>
7308: <UL>
1.2 cvs 7309: <LI>a constant string, specified by its name if it is declared in the schema's
1.5 cvs 7310: <TT>CONST</TT> section, or given directly as a value between apostrophes;
1.1 cvs 7311: <LI>the contents of a buffer, designated by the name of the buffer;
1.2 cvs 7312: <LI>a variable, designated by its name if it is declared in the translation
1.5 cvs 7313: schema's <TT>VAR</TT> section, or given directly between parentheses. The text
1.2 cvs 7314: generated is the value of that variable evaluated for the element to which the
1.1 cvs 7315: rule applies.
1.2 cvs 7316: <LI>the value of an attribute, if the element being translated has this
7317: attribute. The attribute is specified by its name;
7318: <LI>the value of a specific presentation rule. This object can only be
1.1 cvs 7319: generated if the translation rule is for a <A href="#prestransl">specific
1.2 cvs 7320: presentation rule</A>. It is specified by the <TT>Value</TT> keyword;
7321: <LI>the element's content. That is, the content of the leaves of the subtree
7322: of the translated element. This is specified by the <TT>Content</TT> keyword;
7323: <LI>the comment attached to the element. When the element doesn't have a
7324: comment, nothing is generated. This is indicated by the <TT>Comment</TT>
7325: keyword;
7326: <LI>the translation of all attributes of the element (which is primarily used
1.6 cvs 7327: to apply the attribute translation rules <A href="#sectc5222">before</A> those of
1.2 cvs 7328: the element type). This is specified by the <TT>Attributes</TT> keyword.
7329: <LI>the translation of all of the element's specific presentation rules (which
7330: is primarily used to apply the translation rules for the specific presentation
1.6 cvs 7331: rules <A href="#sectc5222">before</A> those of the element or its attributes).
1.2 cvs 7332: This option is specified by the <TT>Presentation</TT> keyword;
1.5 cvs 7333: <LI>The value of the reference's identifier.<BR>Thot associates a unique
1.2 cvs 7334: identifier with each element in a document. This identifier (called
7335: <EM>reference's identifier</EM> or <EM>label</EM>) is a character string
7336: containing the letter `L' followed by digits. Thot uses it in references for
7337: identifying the referred element.<BR>The <TT>RefId</TT> keyword produces the
7338: reference's identifier of the element to which the translation rule is
7339: applied, or the reference's identifier of its first ancestor that is referred
7340: by a reference or that can be referred by a reference.
7341: <LI>the value of a mark pair's unique identifier. This may only be used for
1.6 cvs 7342: <A href="#sectd3285">mark pairs</A> and is indicated by the <TT>PairId</TT>
1.2 cvs 7343: keyword.
7344: <LI>the directory containing the file being generated (this string includes an
7345: ending '/', if it is not empty). This is indicated by the <TT>FileDir</TT>
7346: keyword.
7347: <LI>the name of the file being generated (only the name, without the directory
7348: and without the extension). This is indicated by the <TT>FileName</TT>
7349: keyword.
7350: <LI>the extension of the file being generated (this string starts with a dot,
7351: if it is not empty). This is indicated by the <TT>Extension</TT> keyword.
7352: <LI>the name of the document being translated. This is indicated by the
7353: <TT>DocumentName</TT> keyword.
7354: <LI>the directory containing the document being translated. This is indicated
7355: by the <TT>DocumentDir</TT> keyword.
1.1 cvs 7356: </UL>
7357: <P>
7358: When the rule applies to a reference (an element or an attribute defined as a
7359: reference in the structure schema), it can generate a text related to the
7360: element referred by that reference. The rule name is then followed the
7361: <TT>Referred</TT> keyword and a specification of the object to be generated
7362: for the referred element. This specification can be:</P>
7363: <UL>
1.2 cvs 7364: <LI>the name of a variable. The rule generates the value of that variable,
1.1 cvs 7365: computed for the referred element.
1.2 cvs 7366: <LI>an element type. The rule generates the translation of the element of
7367: that type, which is in the subtree of the referred element. If this element
7368: is not defined in the structure schema which corresponds to the translation
7369: schema (that is, an object defined in another schema), the element's type name
7370: must be followed by the name of its structure schema between parentheses.
7371: <LI>the <TT>RefId</TT> keyword. The rule generates the reference's identifier
1.1 cvs 7372: of the referred element.
1.2 cvs 7373: <LI>the <TT>DocumentName</TT> keyword. The rule generates the name of the
1.1 cvs 7374: document to which the referred element belongs.
1.2 cvs 7375: <LI>the <TT>DocumentDir</TT> keyword. The rule generates the name of the
1.1 cvs 7376: directory that contains the document of the referred element.
7377: </UL>
7378: </DIV>
7379:
7380: <DIV class="subsection">
1.6 cvs 7381: <H3><A name=sectc5211>The <TT>Write</TT> rule</A></H3>
1.1 cvs 7382:
7383: <P>
7384: The <TT>Write</TT> has the same syntax as the <TT>Create</TT> rule. It also
7385: produces the same effect, but the generated text is displayed on the user's
7386: terminal during the translation of the document, instead of being produced in
7387: the translated document. This is useful for helping the user keep track of
7388: the progress of the translation and for prompting the user on the terminal for
7389: input required by the <TT>Read</TT> rule.</P>
7390: <PRE>
7391: 'Write' Object [ Position ] ';'
7392: </PRE>
7393: <P>
7394: Notice: if the translator is launched by the editor (by the ``Save as''
7395: command), messages produced by the <TT>Write</TT> rule are not displayed.</P>
7396: <BLOCKQUOTE class="example">
7397: <P>
7398: <STRONG>Example:</STRONG></P>
7399: <P>
1.3 cvs 7400: To make the translator display the number of each section being translated on
7401: the user's terminal, the following rule is specified for the
7402: <TT>Section</TT> element type:</P>
1.1 cvs 7403: <PRE>
7404: Section : BEGIN
7405: Write VarSection;
7406: ...
7407: END;
7408: </PRE>
7409: <P>
1.3 cvs 7410: (see <A href="#varsectexample">above</A> for the definition of
7411: the <TT>VarSection</TT> variable).</P>
1.1 cvs 7412: <P>
7413: To display text on the terminal before issuing a read operation with the
7414: <TT>Read</TT> rule, the following rule is used:</P>
7415: <PRE>
7416: BEGIN
7417: Write 'Enter the name of the destination: ';
7418: ...
7419: END;
7420: </PRE>
7421: </BLOCKQUOTE>
7422: </DIV>
7423:
7424: <DIV class="subsection">
1.6 cvs 7425: <H3><A name=sectc5212>The <TT>Read</TT> rule</A></H3>
1.1 cvs 7426:
7427: <P>
7428: The <TT>Read</TT> rule reads text from the terminal during the translation of
7429: the document and saves the text read in one of the buffers declared in the
7430: <TT>BUFFERS</TT> section of the schema. The buffer to be used is indicated by
7431: its name, after the <TT>READ</TT> keyword. This name can be followed, as in
7432: the <TT>Create</TT> and <TT>Write</TT> rules, by a keyword indicating if the
7433: read operation must be performed <TT>Before</TT> or <TT>After</TT> the
7434: translation of the element's content. If this keyword is absent, the read
7435: operation is done beforehand. The text is read into the buffer and remains
1.5 cvs 7436: there until a rule using the same buffer - possibly the same rule - is
1.1 cvs 7437: applied.</P>
7438: <PRE>
7439: 'Read' BufferID [ Position ] ';'
7440: </PRE>
7441: <BLOCKQUOTE class="example">
7442: <P>
7443: <STRONG>Example:</STRONG></P>
7444: <P>
1.3 cvs 7445: The following set of rules tells the user that the translator is waiting for
7446: the entry of some text, reads this text into a buffer and copies the text into
1.1 cvs 7447: the translated document.</P>
7448: <PRE>
7449: BEGIN
7450: Write 'Enter the name of the destination: ';
7451: Read DestName;
7452: Create DestName;
7453: ...
7454: END;
7455: </PRE>
7456: <P>
1.5 cvs 7457: (see <A href="#destname">above</A> the definition of <TT>DestName</TT>).</P>
1.1 cvs 7458: </BLOCKQUOTE>
7459: </DIV>
7460:
7461: <DIV class="subsection">
1.6 cvs 7462: <H3><A name=sectc5213>The <TT>Include</TT> rule</A></H3>
1.1 cvs 7463:
7464: <P>
7465: The <TT>Include</TT> rule, like the <TT>Create</TT> rule, is used to produce
7466: text in the translated document. It inserts constant text which is not
7467: defined in the translation schema, but is instead taken from a file. The
7468: file's name is specified after the <TT>Include</TT> keyword, either directly
7469: as a character string between apostrophes or as the name of one of the buffers
7470: declared in the <TT>BUFFERS</TT> section of the schema. In the latter case,
7471: the buffer is assumed to contain the file's name. This can be used when the
7472: included file's name is known only at the moment of translation. This only
7473: requires that the <TT>Include</TT> rule is preceded by a <TT>Read</TT> rule
7474: which puts the name of the file desired by the user into the buffer.</P>
7475: <P>
7476: Like the other rules, it is possible to specify whether the inclusion will
7477: occur before or after the element's content, with the default being before.
7478: The file inclusion is only done at the moment of translation, not during the
7479: compilation of the translation schema. Thus, the file to be included need not
7480: exist during the compilation, but it must be accessible at the time of
7481: translation. Its contents can also be modified between two translations, thus
7482: producing different results, even if neither the document or the translation
7483: schema are modified.</P>
7484: <P>
7485: During translation, the file to be included is searched for along the schema
7486: directory path (indicated by the environment variable <TT>THOTSCH</TT>). The
7487: file name is normally only composed of a simple name, without specification of
1.12 cvs 7488: a complete file path. However, if the filename starts with a '/', it is
7489: considered as an absolute path.</P>
1.1 cvs 7490: <PRE>
1.6 cvs 7491: 'Include' File [ Position ] ';'
7492: File = FileName / BufferID .
7493: FileName = STRING .
1.1 cvs 7494: </PRE>
7495: <BLOCKQUOTE class="example">
7496: <P>
7497: <STRONG>Example:</STRONG></P>
7498: <P>
1.3 cvs 7499: Suppose that it is desirable to print documents of the Article class with a
7500: formatter which requires a number of declarations and definitions at the
7501: beginning of the file. The <TT>Include</TT>rule can be used to achieve this.
7502: All the declarations and definitions a replaced in a file called
7503: <TT>DeclarArt</TT> and then the <TT>Article</TT> element type is given the
1.1 cvs 7504: following rule:</P>
7505: <PRE>
7506: Article : BEGIN
7507: Include 'DeclarArt' Before;
7508: ...
7509: END;
7510: </PRE>
7511: </BLOCKQUOTE>
7512: </DIV>
7513:
7514: <DIV class="subsection">
1.6 cvs 7515: <H3><A name=sectc5214>The <TT>Get</TT> rule</A></H3>
1.1 cvs 7516:
7517: <P>
7518: The <TT>Get</TT> rule is used to change the order in which the elements appear
7519: in the translated document. More precisely, it produces the translation of a
7520: specified element before or after the translation of the content of the
7521: element to which the rule applies. The <TT>Before</TT> and <TT>After</TT>
7522: keywords are placed at the end of the rule to specify whether the operation
7523: should be performed before or after translation of the rule's element (the
7524: default is before). The type of the element to be moved must be specified
7525: after the <TT>Get</TT> keyword, optionally preceded by a keyword indicating
7526: where the element will be found in the logical structure of the document:</P>
7527: <DL>
7528: <DT><TT>Included</TT></DT>
1.2 cvs 7529: <DD>The element to be moved is the first element of the indicated type which is
1.1 cvs 7530: found inside the element to which the rule applies.
7531: </DD>
7532: <DT><TT>Referred</TT></DT>
1.2 cvs 7533: <DD>This keyword can only be used if the rule applies to a reference element.
7534: The element to be moved is either the element designated by the reference (if
7535: that element is of the specified type), or the first element of the desired
7536: type contained within the element designated by the reference.
1.1 cvs 7537: </DD>
7538: <DT>no keyword</DT>
1.2 cvs 7539: <DD>If the element to be moved is an associated element, defined in the <A
1.6 cvs 7540: href="#sectc314"><TT>ASSOC</TT> section</A> of the structure schema, all
1.2 cvs 7541: associated elements of this type which have not been translated yet are then
7542: translated. Certain elements may in fact have already been translated by a
7543: <TT>Get Referred</TT> rule.
1.1 cvs 7544: <P>
7545: If the element to be moved is not an associated element, the translator takes
7546: the first element of the indicated type from among the siblings of the rule's
7547: element. This is primarily used to change the order of the components of an
7548: aggregate.</P>
7549: </DD>
7550: </DL>
7551: <P>
7552: If the element to be moved is defined in a structure schema which is not the
7553: one which corresponds to the translation schema (in the case of an included
7554: object with a different schema), the type name of this element must be
7555: followed, between parentheses, by the name of the structure schema which
7556: defines it.</P>
7557: <PRE>
1.6 cvs 7558: 'Get' [ RelPosition ] ElemID
7559: [ ExtStruct ]
7560: [ Position ] ';' /
7561: RelPosition = 'Included' / 'Referred' .
1.1 cvs 7562: ExtStruct = '(' ElemID ')' .
7563: </PRE>
7564: <P>
7565: The <TT>Get</TT> rule has no effect if the element which it is supposed to
7566: move has already been translated. Thus, the element will not be duplicated.
7567: It is generally best to associate the rule with the first element which will
7568: be encountered by the translator in its traversal of the document. Suppose an
7569: aggregate has two elements <TT>A</TT> and <TT>B</TT>, with <TT>A</TT>
7570: appearing first in the logical structure. To permute these two elements, a
7571: <TT>Get B before</TT> rule should be associated with the <TT>A</TT> element
7572: type, not the inverse. Similarly, a rule of the form <TT>Get Included X
7573: After</TT>, even though syntactically correct, makes no sense since, by the
7574: time it will be applied, after the translation of the contents of the element
7575: to which it is attached, the <TT>X</TT> element will already have been
7576: translated.</P>
7577: <P>
7578: The <TT>Get</TT> rule is the only way to obtain the translation of the
7579: associated elements. In fact, the translator only traverses the primary tree
7580: of the document and thus does not translate the associated elements, except
7581: when the translation is explicitly required by a <TT>Get Referred Type</TT> or
7582: <TT>Get Type</TT> rule where <TT>Type</TT> is an associated element type.</P>
7583: <BLOCKQUOTE class="example">
7584: <P>
7585: <STRONG>Example:</STRONG></P>
7586: <P>
1.3 cvs 7587: The structure schema defined figures as associated element which are composed
7588: of some content and a caption. Moreover, it is possible to make references to
7589: figures, using elements of the <TT>RefFigure</TT> type:</P>
1.1 cvs 7590: <PRE>
7591: ...
7592: RefFigure = REFERENCE(Figure);
7593: ASSOC
1.6 cvs 7594: Figure = BEGIN
7595: Content = NATURE;
7596: Caption = Text;
7597: END;
1.1 cvs 7598: ...
7599: </PRE>
7600: <P>
1.3 cvs 7601: Suppose it would be useful to make a figure appear in the translated document
7602: at the place in the text where the first reference to the figure is made. If
7603: some figures are not referenced, then they would appear at the end of the
7604: document. Also, each figure's caption should appear before the content. The
7605: following rules in the translation schema will produce this result:</P>
1.1 cvs 7606: <PRE>
7607: Article : BEGIN
7608: ...
7609: Get Figures After;
7610: END;
7611: RefFigure : BEGIN
7612: If FirstRef Get Referred Figure;
7613: ...
7614: END;
7615: Content : BEGIN
7616: Get Caption Before;
7617: ...
7618: END;
7619: </PRE>
7620: </BLOCKQUOTE>
7621: </DIV>
7622:
7623: <DIV class="subsection">
1.6 cvs 7624: <H3><A name=sectc5215>The <TT>Copy</TT> rule</A></H3>
1.1 cvs 7625:
7626: <P>
7627: Like the <TT>Get</TT> rule, the <TT>Copy</TT> rule generates the translation
7628: of a specified element, but it acts even if the element has already been
7629: translated and it allows to copy it or to translate it later. Both rules have
7630: the same syntax.</P>
7631: <PRE>
7632: 'Copy' [ RelPosition ] ElemID
7633: [ ExtStruct ] [ Position ] ';'
7634: </PRE>
7635: </DIV>
7636:
7637: <DIV class="subsection">
1.6 cvs 7638: <H3><A name=sectc5216>The <TT>Use</TT> rule</A></H3>
1.1 cvs 7639:
7640: <P>
7641: The <TT>Use</TT> rule specifies the translation schema to be applied to
7642: objects of a certain class that are part of the document. This rule only
7643: appears in the rules for the root element of the document (the first type
7644: defined after the <TT>STRUCT</TT> keyword in the structure schema) or the
7645: rules of an element defined by an external structure (by another structure
7646: schema). Also, the <TT>Use</TT> rule cannot be conditional.</P>
7647: <P>
7648: If the rule is applied to an element defined by an external structure, the
7649: <TT>Use</TT> keyword is simply followed by the name of the translation schema
7650: to be used for element constructed according to that external structure. If
7651: the rule is applied to the document's root element, it is formed by the
7652: <TT>Use</TT> keyword followed by the translation schema's name, the
7653: <TT>For</TT> keyword and the name of the external structure to which the
7654: indicated translation schema should be applied.</P>
7655: <PRE>
7656: 'Use' TrSchema [ 'For' ElemID ] ';'
7657: TrSchema = NAME .
7658: </PRE>
7659: <P>
7660: If no <TT>Use</TT> rule defines the translation schema to be used for an
7661: external structure which appears in a document, the translator asks the user,
7662: during the translation process, which schema should be used. Thus, it is not
7663: necessary to give the translation schema a <TT>Use</TT> rule for every
7664: external structure used, especially when the choice of translation schemas is
7665: to be left to the user.</P>
7666: <P>
7667: Notice: if the translator is launched by the editor (by the ``Save as''
7668: command), prompts are not displayed.</P>
7669: <BLOCKQUOTE class="example">
7670: <P>
7671: <STRONG>Example:</STRONG></P>
7672: <P>
1.4 cvs 7673: The <TT>Article</TT> structure schema uses the
7674: <TT>Formula</TT> external structure, defined by another structure schema, for
1.1 cvs 7675: mathematical formulas:</P>
7676: <PRE>
7677: STRUCTURE Article;
7678: ...
7679: STRUCT
7680: Article = ...
7681: ...
7682: Formula_in_text = Formula;
7683: Isolated_formula = Formula;
7684: ...
7685: END
7686: </PRE>
7687: <P>
1.3 cvs 7688: Suppose that it would be useful to use the <TT>FormulaT</TT> translation schema
7689: for the formulas of an article. This can be expressed in two different ways in
1.4 cvs 7690: the <TT>Article</TT> class translation schema, using the rules:</P>
1.1 cvs 7691: <PRE>
7692: RULES
7693: Article :
7694: Use FormulaT for Formula;
7695: </PRE>
7696: <P>
7697: or:</P>
7698: <PRE>
7699: RULES
7700: ...
7701: Formula :
7702: Use FormulaT;
7703: </PRE>
7704: </BLOCKQUOTE>
7705: </DIV>
7706:
7707: <DIV class="subsection">
1.6 cvs 7708: <H3><A name=sectc5217>The <TT>Remove</TT> rule</A></H3>
1.1 cvs 7709:
7710: <P>
7711: The <TT>Remove</TT> rule indicates that nothing should be generated, in the
7712: translated document, for the content of the element to which the rule applies.
7713: The content of that element is simply ignored by the translator. This does
7714: not prevent the generation of text for the element itself, using the
7715: <TT>Create</TT> or <TT>Include</TT> rules, for example.</P>
7716: <P>
7717: The <TT>Remove</TT> rule is simply written with the <TT>Remove</TT> keyword.
7718: It is terminated, like all rules, by a semicolon.</P>
7719: <PRE>
7720: 'Remove' ';'
7721: </PRE>
7722: </DIV>
7723:
7724: <DIV class="subsection">
1.6 cvs 7725: <H3><A name=sectc5218>The <TT>NoTranslation</TT> rule</A></H3>
1.1 cvs 7726:
7727: <P>
7728: The <TT>NoTranslation</TT> rule indicates to the translator that it must not
7729: translate the content of the leaves of the element to which it applies. In
7730: contrast to the <TT>Remove</TT> rule, it does not suppress the content of the
7731: element, but it inhibits the translation of character strings, symbols, and
7732: graphical elements contained in the element. These are retrieved so that
7733: after the translation of the document, the rules of the <A
1.6 cvs 7734: href="#sectc5225"><TT>TEXTTRANSLATE</TT>, <TT>SYMBTRANSLATE</TT> and
1.1 cvs 7735: <TT>GRAPHTRANSLATE</TT> sections</A> will not be applied to them.</P>
7736: <P>
7737: The <TT>NoTranslation</TT> rule is written with the <TT>NoTranslation</TT>
7738: keyword followed by a semicolon.</P>
7739: <PRE>
7740: 'NoTranslation' ';'
7741: </PRE>
7742: </DIV>
7743:
7744: <DIV class="subsection">
1.6 cvs 7745: <H3><A name=sectc5219>The <TT>NoLineBreak</TT> rule</A></H3>
1.1 cvs 7746:
7747: <P>
7748: The <TT>NoLineBreak</TT> rule indicates to the translator that it must not
7749: generate additional line breaks in the output produced for the element to
1.6 cvs 7750: which it applies. This is as if it was an <A href="#sectc522">instruction
1.1 cvs 7751: <TT>LINELENGTH 0;</TT></A> at the beginning of the translation schema, but
7752: only for the current element.</P>
7753: <P>
7754: The <TT>NoLineBreak</TT> rule is written with the <TT>NoLineBreak</TT> keyword
7755: followed by a semicolon.</P>
7756: <PRE>
7757: 'NoLineBreak' ';'
7758: </PRE>
7759: </DIV>
7760:
7761: <DIV class="subsection">
1.6 cvs 7762: <H3><A name=sectc5220>The <TT>ChangeMainFile</TT> rule</A></H3>
1.1 cvs 7763:
7764: <P>
7765: When the translation program starts, it opens a main output file, whose name
1.14 ! cvs 7766: is given as a parameter of the translator. All <A
! 7767: href="#sectc5210"><TT>Create</TT> rules</A> without explicit indication of
! 7768: the output file write sequentially in this file. When a
! 7769: <TT>ChangeMainFile</TT> rule is executed, the main output file is closed and
! 7770: it is replaced by a new one, whose name is specified in the
! 7771: <TT>ChangeMainFile</TT> rule. The <TT>Create</TT> rules without indication of
! 7772: the output file that are then executed write in this new file. Several
1.1 cvs 7773: <TT>ChangeMainFile</TT> rules can be executed during the same translation, for
7774: dividing the main output into several files.</P>
7775: <P>
7776: This rule is written with the <TT>ChangeMainFile</TT> keyword followed by the
1.14 ! cvs 7777: name of a variable that specifies the name of the new main file. The keyword
1.1 cvs 7778: <TT>Before</TT> or <TT>After</TT> can be placed at the end of the rule to
7779: specify whether the operation should be performed before or after translation
7780: of the rule's element (the default is before). This rule, like all translation
7781: rules, is terminated by a semicolon.</P>
7782: <PRE>
7783: 'ChangeMainFile' VarID [ Position ] ';'
7784: </PRE>
7785: <BLOCKQUOTE class="example">
7786: <P>
7787: <STRONG>Example:</STRONG></P>
7788: <P>
1.3 cvs 7789: To generate the translation of each section in a different file, the following
7790: rule can be associated with type <TT>Section</TT>. That rule uses the <A
7791: href="#varoutputfile"><TT>VarOutpuFile</TT> variable</A> defined above.</P>
1.1 cvs 7792: <PRE>
7793: Section:
7794: ChangeMainFile VarOutpuFile Before;
7795: </PRE>
7796: <P>
1.3 cvs 7797: If <TT>output.txt</TT> is the name of the output file specified when starting
7798: the translation program, translated sections are written in files
1.1 cvs 7799: <TT>output1.txt</TT>, <TT>output2.txt</TT>, etc.</P>
7800: </BLOCKQUOTE>
7801: </DIV>
7802:
7803: <DIV class="subsection">
1.14 ! cvs 7804: <H3><A name=sectc5220a>The <TT>RemoveFile</TT> rule</A></H3>
! 7805:
! 7806: <P>
! 7807: Files may be used for storing temporary data that are no longer needed when
! 7808: the translation of a document is complete. These files may be removed by
! 7809: the <TT>RemoveFile</TT> rule.</P>
! 7810: <P>
! 7811: This rule is written with the <TT>RemoveFile</TT> keyword followed by the
! 7812: name of a variable that specifies the name of the file to be
! 7813: removed. The keyword <TT>Before</TT> or <TT>After</TT> can be placed at the
! 7814: end of the rule to specify whether the operation should be performed before
! 7815: or after translation of the rule's element (the default is before). This
! 7816: rule, like all translation rules, is terminated by a semicolon.</P>
! 7817: <PRE>
! 7818: 'RemoveFile' VarID [ Position ] ';'
! 7819: </PRE>
! 7820: </DIV>
! 7821:
! 7822: <DIV class="subsection">
1.6 cvs 7823: <H3><A name=sectc5221>The <TT>Set</TT> and <TT>Add</TT> rules</A></H3>
1.1 cvs 7824:
7825: <P>
7826: The <TT>Set</TT> and <TT>Add</TT> rules are used for modifying the value of
1.6 cvs 7827: counters that have no <A href="#sectc524">counting function</A>. Only this
1.1 cvs 7828: type of counter can be used in the <TT>Set</TT> and <TT>Add</TT> rules.</P>
7829: <P>
7830: Both rules have the same syntax: after the keyword <TT>Set</TT> or
7831: <TT>Add</TT> appear the counter name and the value to assign to the counter
7832: (<TT>Set</TT> rule) or the value to be added to the counter (<TT>Add</TT>
1.14 ! cvs 7833: rule). The keyword <TT>Before</TT> or <TT>After</TT> can follow that value to
1.1 cvs 7834: indicate when the rule must be applied: before or after the element's content
1.14 ! cvs 7835: is translated. By default, <TT>Before</TT> is assumed. A semicolon terminates
1.1 cvs 7836: the rule.</P>
7837: <PRE>
7838: 'Set' CounterID InitValue [ Position ] ';' /
7839: 'Add' CounterID Increment [ Position ] ';'
7840: </PRE>
7841: </DIV>
7842:
7843: <DIV class="subsection">
1.10 cvs 7844: <H3><A name=sectc5221a>The <TT>Indent</TT> rule</A></H3>
7845:
7846: <P>
7847: The <TT>Indent</TT> rule is used to modify the value of text indentation
7848: in the output files.</P>
7849: <P>
7850: Each time the translator creates a new line in an output file, it generates
7851: a variable number of space characters at the beginning of the new line. By
7852: default, the number of these characters (the indentation) is 0. It can be
7853: changed with the <TT>Indent</TT> rule.</P>
7854: <P>
7855: The rule begins with the <TT>Indent</TT> keyword, followed by the indentation
7856: sign (optional) and value and a keyword <TT>Before</TT> or <TT>After</TT>
7857: indicating that the indentation should be changed <A href="#sectc5222">before
7858: or after</A> the element's content is generated. If the position is not
7859: indicated, the indentation is changed before the element's content is
7860: generated. This rule, like all translation rules, is terminated by a
7861: semicolon.</P>
7862: <P>
7863: The indentation value is indicated by an integer, which is the number of
7864: space characters to be generated at the beginning of each new line.
7865: A sign (<TT>+</TT> or <TT>-</TT>) can appear before the integer to indicate
7866: that the value is relative: the current value of indentation is incremented
7867: (if sign is <TT>+</TT>) or decremented (if sign is <TT>-</TT>) by the
7868: specified value.
7869: <P>
7870: Like the <A href="#sectc5210"><TT>Create</TT> rule</A>, the <TT>Indent</TT>
7871: keyword can be followed by the <TT>IN</TT> keyword and by the name of a
7872: <A href="#sectc526">variable</A>. This means that the rule must not change
7873: indentation in the main output file, but in the file whose name is specified
7874: by the variable (by default, indentation is changed in the main output
7875: file).</P>
7876: <PRE>
7877: 'Indent' [ 'IN' VarID ] [ IndentSign ]
7878: IndentValue [ Position ] ';' .
7879:
7880: IndentSign = '+' / '-' .
7881: IndentValue = NUMBER .
7882: </PRE>
7883: </DIV>
7884:
7885: <DIV class="subsection">
1.6 cvs 7886: <H3><A name=sectc5222>Rule application order</A></H3>
1.1 cvs 7887:
7888: <P>
7889: The translator translates the elements which comprise the document in the
7890: order induced by the tree structure, except when the <TT>Get</TT> rule is used
7891: to change the order of translation. For each element, the translator first
7892: applies the rules specified for the element's type that must be applied before
7893: translation of the element's content (rules ending with the <TT>Before</TT>
7894: keyword or which have no position keyword). If several rules meet these
7895: criteria, the translator applies them in the order in where they appear in the
7896: translation schema.</P>
7897: <P>
1.6 cvs 7898: It then applies all <A href="#sectc5223">rules for the attributes</A> which
1.1 cvs 7899: the element has and which must be applied before the translation of the
7900: element's content (rules ending with the <TT>Before</TT> keyword or which have
7901: no position keyword). For one attribute value, the translator applies the
7902: rules in the order in which they are defined in the translation schema.</P>
7903: <P>
7904: The same procedure is followed with translation rules for specific
7905: presentations.</P>
7906: <P>
7907: Next, the element's content is translated, as long as a <TT>Remove</TT> rule
7908: does not apply.</P>
7909: <P>
7910: In the next step, the translator applies rules for the specific presentation
7911: of the element that are to be applied after translation of the content (rules
7912: which end with the <TT>After</TT> keyword). The rules for each type of
7913: presentation rule or each value are applied in the order in which the
7914: translation appear in the schema.</P>
7915: <P>
7916: Then, the same procedure is followed for translation rules for attributes of
7917: the element.</P>
7918: <P>
7919: Finally, the translator applies rules for the element which must be applied
7920: after translation of the element's content. These rules are applied in the
7921: order that they appear in the translation schema. When the translation of an
7922: element is done, the translator procedes to translate the following
7923: element.</P>
7924: <P>
7925: This order can be changed with the <TT>Attributes</TT> and
1.6 cvs 7926: <TT>Presentation</TT> options of the <A href="#sectc5210"><TT>Create</TT>
1.1 cvs 7927: rule</A>.</P>
7928: </DIV>
7929:
7930: <DIV class="subsection">
1.6 cvs 7931: <H3><A name=sectc5223>Translation of logical attributes</A></H3>
1.1 cvs 7932:
7933: <P>
7934: After the rules for the element types, the translation schema defines rules
7935: for attribute values. This section begins with the <TT>ATTRIBUTES</TT>
7936: keyword and is composed of a sequence of rule blocks each preceded by an
7937: attribute name and an optional value or value range.</P>
7938: <P>
7939: If the attribute's name appears alone before the rule block, the rule are
7940: applied to all element which have the attribute, no matter what value the
7941: attribute has. In this case, the attribute name is followed by a colon before
7942: the beginning of the rule block.</P>
7943: <P>
7944: The attribute's name can be followed by the name of an element type between
7945: parentheses. This says, as in presentation schemas, that the rule block which
7946: follows applies not to the element which has the attribute, but to its
7947: descendants of the type indicated between the parentheses.</P>
7948: <P>
7949: If values are given after the attribute name (or after the name of the element
7950: type), the rules are applied only when the attribute has the indicated values.
7951: The same attribute can appear several times, with different values and
7952: different translation rules. Attribute values are indicated in the same way
1.6 cvs 7953: as in <A href="#sectc528">conditions</A> and are followed by a colon before
1.1 cvs 7954: the block of rules.</P>
7955: <P>
7956: The rule block associated with an attribute is either a simple rule or a
7957: sequence of rules delimited by the <TT>BEGIN</TT> and <TT>END</TT> keywords.
7958: Note that rules associated with attribute values cannot be conditional.</P>
7959: <P>
7960: Translation rules are not required for all attributes (or their values)
7961: defined in a structure schema. Only those attributes for which a particular
7962: action must be performed by the translator must have such rules. The rules
7963: that can be used are those described above, from <A
1.6 cvs 7964: href="#sectc5210"><TT>Create</TT></A> to <A
7965: href="#sectc5218"><TT>NoTranslation</TT></A>.</P>
1.1 cvs 7966: <PRE>
7967: AttrSeq = TransAttr < TransAttr > .
7968: TransAttr = AttrID [ '(' ElemID ')' ]
7969: [ RelatAttr ] ':' RuleSeq .
7970: AttrID = NAME .
7971: ElemID = NAME .
7972: </PRE>
7973: <BLOCKQUOTE class="example">
7974: <P>
7975: <STRONG>Example:</STRONG></P>
7976: <P>
1.3 cvs 7977: The structure defined the ``Language'' attribute which can take the values
7978: ``French'' and ``English''. To have the French parts of the original document
7979: removed and prevent the translation of the leaves of the English parts, the
1.1 cvs 7980: following rules would be used:</P>
7981: <PRE>
7982: ATTRIBUTES
7983: Language=French :
7984: Remove;
7985: Language=English :
7986: NoTranslation;
7987: </PRE>
7988: </BLOCKQUOTE>
7989: </DIV>
7990:
7991: <DIV class="subsection">
1.6 cvs 7992: <H3><A name=sectc5224>Translation of specific presentations</A></H3>
1.1 cvs 7993:
7994: <P>
7995: After the rules for attributes, the translation schema defines rules for the
7996: specific presentation. This section begins with the <TT>PRESENTATION</TT>
7997: keyword and is composed of a sequence of translation rule blocks each preceded
7998: by a presentation rule name, optionally accompanied by a part which depends on
7999: the particular presentation rule.</P>
8000: <P>
8001: Each of these translation rule blocks is applied when the translator operates
8002: on an element which has a specific presentation rule of the type indicated at
8003: the head of the block. Depending on the type of the specific presentation
8004: rule, it is possible to specify values of the presentation rule for which the
8005: translation rule block should be applied.</P>
8006: <P>
8007: There are three categories of the presentation rules:</P>
8008: <UL>
1.2 cvs 8009: <LI>rules taking numeric values: <TT>Size</TT>, <TT>Indent</TT>,
8010: <TT>LineSpacing</TT>, <TT>LineWeight</TT>,
8011: <LI>rules whose values are taken from a predefined list (i.e. whose type is an
1.1 cvs 8012: enumeration): <TT>Adjust</TT>, <TT>Justify</TT>, <TT>Hyphenate,/TT>,
8013: <TT>Style</TT>, <TT>Font</TT>, <TT>UnderLine</TT>, <TT>Thickness</TT>,
8014: <TT>LineStyle</TT>,</TT>
1.2 cvs 8015: <LI>rules whose value is a name: <TT>FillPattern</TT>, <TT>Background</TT>,
8016: <TT>Foreground</TT>.
1.1 cvs 8017: </UL>
8018: <P>
8019: For presentation rules of the first category, the values which provoke
8020: application of the translation rules are indicated in the same manner as for
8021: <A href="#relattr">numeric attributes</A>. This can be either a unique value
8022: or range of values. For a unique value, the value (an integer) is simply
8023: preceded by an equals sign. Value ranges can be specified in one of three
8024: ways:</P>
8025: <UL>
1.2 cvs 8026: <LI>all values less than a given value (this value is preceded by a ``less
1.5 cvs 8027: than'' sign '<TT><</TT>'),
1.2 cvs 8028: <LI>all values greater than a given value (this value is preceded by a`
1.5 cvs 8029: `greater than'' sign '<TT>></TT>'),
1.2 cvs 8030: <LI>all values falling in an interval, bounds included. The range of values
8031: is then specified <TT>IN [</TT>Minimum<TT>..</TT>Maximum<TT>]</TT>, where
8032: Minimum and Maximum are integers.
1.1 cvs 8033: </UL>
8034: <P>
1.2 cvs 8035: All numeric values can be negative, in which case the integer is preceded by a
8036: minus sign. All values must be given in typographers points.</P>
1.1 cvs 8037: <P>
8038: For presentation rules whose values are taken from a predefined list, the
8039: value which provokes application of the translation rules is simply indicated
8040: by the equals sign followed by the name of the value.</P>
8041: <P>
8042: For presentation rules whose values are names, the value which provokes the
8043: application of translation rules is simply indicated by the equals sign
8044: followed by the name of the value. The names of the fill patterns (the
8045: <TT>FillPattern</TT> rule) and of the colors (the <TT>Foreground</TT> and
8046: <TT>Background</TT> rules) used in Thot are the same as in the P language.</P>
8047: <PRE>
8048: PresSeq = PresTrans < PresTrans > .
8049: PresTrans = PresRule ':' RuleSeq .
8050: PresRule = 'Size' [ PresRelation ] /
8051: 'Indent' [ PresRelation ] /
8052: 'LineSpacing' [ PresRelation ] /
8053: 'Adjust' [ '=' AdjustVal ] /
8054: 'Justify' [ '=' BoolVal ] /
8055: 'Hyphenate' [ '=' BoolVal ] /
8056: 'Style' [ '=' StyleVal ] /
8057: 'Font' [ '=' FontVal ] /
8058: 'UnderLine' [ '=' UnderLineVal ] /
8059: 'Thickness' [ '=' ThicknessVal ] /
8060: 'LineStyle' [ '=' LineStyleVal ] /
8061: 'LineWeight' [ PresRelation ] /
8062: 'FillPattern' [ '=' Pattern ] /
8063: 'Background' [ '=' Color ] /
8064: 'Foreground' [ '=' Color ] .
8065:
8066: PresRelation = '=' PresValue /
8067: '>' [ '-' ] PresMinimum /
8068: '<' [ '-' ] PresMaximum /
8069: 'IN' '[' [ '-' ] PresIntervalMin '..'
8070: [ '-' ] PresIntervalMax ']' .
8071: AdjustVal = 'Left' / 'Right' / 'VMiddle' /
8072: 'LeftWithDots' .
8073: BoolVal = 'Yes' / 'No' .
8074: StyleVal = 'Bold' / 'Italics' / 'Roman' /
8075: 'BoldItalics' / 'Oblique' /
8076: 'BoldOblique' .
8077: FontVal = 'Times' / 'Helvetica' / 'Courier' .
8078: UnderLineVal = 'NoUnderline' / 'UnderLined' /
8079: 'OverLined' / 'CrossedOut' .
8080: ThicknessVal = 'Thick' / 'Thin' .
1.6 cvs 8081: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' .
1.1 cvs 8082: Pattern = NAME .
8083: Color = NAME .
8084: PresMinimum = NUMBER .
8085: PresMaximum = NUMBER .
8086: PresIntervalMin= NUMBER .
8087: PresIntervalMax= NUMBER .
8088: PresValue = [ '-' ] PresVal .
8089: PresVal = NUMBER .
8090: </PRE>
8091: <P>
8092: The <A name="prestransl">translation rules associated with specific
8093: presentation rules</A> can use the value of the specific presentation rule
8094: that causes them to be applied. This behavior is designated by the keyword
8095: <TT>Value</TT>. For numerically-valued presentation rules, the numeric value
8096: is produced. For other presentation rules, the name of the value is
8097: produced.</P>
8098: <P>
8099: It should be noted that modifications to the layout of the document's elements
8100: that are made using the combination of the control key and a mouse button will
8101: have no effect on the translation of the document.</P>
8102: <BLOCKQUOTE class="example">
8103: <P>
8104: <STRONG>Example:</STRONG></P>
8105: <P>
1.3 cvs 8106: Suppose that it is desirable to use the same font sizes as in the specific
8107: presentation, but the font size must be between 10 and 18 typographer's points.
8108: If font size is set in the translated document by the string
8109: <TT>pointsize=n</TT> where <TT>n</TT> is the font size in typographer's points
1.1 cvs 8110: then the following rules will suffice:</P>
8111: <PRE>
8112: PRESENTATION
8113: Size < 10 :
8114: Create 'pointsize=10';
8115: Size in [10..18] :
8116: BEGIN
8117: Create 'pointsize=';
8118: Create Value;
8119: END;
8120: Size > 18 :
8121: Create 'pointsize=18';
8122: </PRE>
8123: </BLOCKQUOTE>
8124: </DIV>
8125:
8126: <DIV class="subsection">
1.6 cvs 8127: <H3><A name=sectc5225>Recoding of characters, symbols and graphics</A></H3>
1.1 cvs 8128:
8129: <P>
8130: The coding of characters, graphical elements and symbols as defined in Thot
8131: does not necessarily correspond to what is required by an application to which
8132: a Thot document must be exported. Because of this the translator can recode
8133: these terminal elements of the documents structure. The last sections of a
8134: translation schema are intended for this purpose, each specifying the recoding
8135: rules for one type of terminal element.</P>
8136: <P>
8137: The recoding rules for character strings are grouped by alphabets. There is a
8138: group of rules for each alphabet of the Thot document that must be translated.
8139: Each such group of rules begins with the <TT>TEXTTRANSLATE</TT> keyword,
8140: followed by the specification of the alphabet to translate and the recoding
8141: rules, between the <TT>BEGIN</TT> and <TT>END</TT> keywords unless there is
8142: only one recoding rule for the alphabet. The specification of the alphabet is
8143: not required: by default it is assumed to the Latin alphabet (the ISO Latin-1
8144: character set).</P>
8145: <P>
8146: Each recoding rule is formed by a source string between apostrophes and a
8147: target string, also between apostrophes, the two strings being separated by
8148: the arrow symbol (<TT>-></TT>), formed by the ``minus'' and ``greater than''
8149: characters. The rule is terminated by a semi-colon.</P>
8150: <PRE>
8151: TextTransSeq = [ Alphabet ] TransSeq .
8152: Alphabet = NAME .
8153: TransSeq ='BEGIN' < Translation > 'END' ';' /
8154: Translation .
8155: Translation = Source [ '->' Target ] ';' .
8156: Source = STRING .
8157: Target = STRING .
8158: </PRE>
8159: <P>
8160: One such rule signifies that when the source string appears in a text leaf of
8161: the document being translated, the translator must replace it, in the
8162: translated document, with the target string. The source string and the target
8163: string can have different lengths and the target string can be empty. In this
8164: last case, the translator simply suppresses every occurrence of the source
8165: string in the translated document.</P>
8166: <P>
8167: For a given alphabet, the order of the rules is not important and has no
8168: significance because the T language compiler reorders the rules in ways that
8169: speed up the translator's work. The total number of recoding rules is limited
8170: by the compiler as is the maximum length of the source and target strings.</P>
8171: <P>
8172: The recoding rules for symbols and graphical elements are written in the same
8173: manner as the recoding rules for character strings. They are preceded,
8174: respectively, by the <TT>SYMBTRANSLATE</TT> and <TT>GRAPHTRANSLATE</TT> and so
8175: not require a specification of the alphabet. Their source string is limited to
8176: one character, since, in Thot, each symbol and each graphical element is
8177: represented by a single character. The symbol and graphical element codes are
1.6 cvs 8178: defined along with the <A href="#sect7">non-standard character
1.1 cvs 8179: codes</A>.</P>
8180: <BLOCKQUOTE class="example">
8181: <P>
8182: <STRONG>Example:</STRONG></P>
8183: <P>
8184: In a translation schema producing documents destined for use with
1.3 cvs 8185: the L<SUP>A</SUP>T<SUB><BIG>E</BIG></SUB>X formatter, the Latin
1.1 cvs 8186: characters``é'' (octal code 351 in Thot) and ``è'' (octal code
1.3 cvs 8187: 350 in Thot) must be converted to their representation
8188: in L<SUP>A</SUP>T<SUB><BIG>E</BIG></SUB>X:</P>
1.1 cvs 8189: <PRE>
1.6 cvs 8190: TEXTTRANSLATE Latin
1.1 cvs 8191: BEGIN
8192: '\350' -> '\`{e}'; { e grave }
8193: '\351' -> '\''{e}'; { e acute }
8194: END;
8195: </PRE>
8196: </BLOCKQUOTE>
8197: </DIV>
8198: </DIV>
8199: <HR>
8200: </DIV>
8201:
8202: <DIV class="chapter">
1.6 cvs 8203: <H1><A name=sect6>Language grammars</A></H1>
1.1 cvs 8204:
8205: <P>
8206: This chapter gives the complete grammars of the languages of Thot. The
8207: grammars were presented and described in the preceding chapters, which also
8208: specify the semantics of the languages. This section gives only the
8209: syntax.</P>
8210:
8211: <DIV class="section">
1.6 cvs 8212: <H2><A name=sectb61>The M meta-language</A></H2>
1.1 cvs 8213:
8214: <P>
8215: The language grammars are all expressed in the same formalism, the M
8216: meta-language, which is defined in this section.</P>
8217: <PRE>
8218: { Any text between braces is a comment. }
8219: Grammar = Rule < Rule > 'END' .
8220: { The < and > signs indicate zero }
8221: { or more repetitions. }
8222: { END marks the end of the grammar. }
8223: Rule = Ident '=' RightPart '.' .
8224: { The period indicates the end of a rule }
8225: RightPart = RtTerminal / RtIntermed .
8226: { The slash indicates a choice }
8227: RtTerminal ='NAME' / 'STRING' / 'NUMBER' .
8228: { Right part of a terminal rule }
8229: RtIntermed = Possibility < '/' Possibility > .
8230: { Right part of an intermediate rule }
8231: Possibility = ElemOpt < ElemOpt > .
8232: ElemOpt = Element / '[' Element < Element > ']' /
8233: '<' Element < Element > '>' .
8234: { Brackets delimit optional parts }
8235: Element = Ident / KeyWord .
8236: Ident = NAME .
8237: { Identifier, sequence of characters
8238: KeyWord = STRING .
8239: { Character string delimited by apostrophes }
8240: END
8241: </PRE>
8242: </DIV>
8243:
8244: <DIV class="section">
1.6 cvs 8245: <H2><A name=sectb62>The S language</A></H2>
1.1 cvs 8246:
8247: <P>
8248: The S language is used to write structure schemas, which contain the generic
8249: logical structures of document and object classes. It is described here in
8250: the M meta-language.</P>
8251: <PRE>
8252: StructSchema = 'STRUCTURE' [ 'EXTENSION' ] ElemID ';'
8253: 'DEFPRES' PresID ';'
8254: [ 'ATTR' AttrSeq ]
8255: [ 'PARAM' RulesSeq ]
8256: [ 'STRUCT' RulesSeq ]
8257: [ 'EXTENS' ExtensRuleSeq ]
8258: [ 'ASSOC' RulesSeq ]
8259: [ 'UNITS' RulesSeq ]
8260: [ 'EXPORT' SkeletonSeq ]
8261: [ 'EXCEPT' ExceptSeq ]
8262: 'END' .
8263:
8264: ElemID = NAME .
8265: PresID = NAME .
8266:
8267: AttrSeq = Attribute < Attribute > .
8268: Attribute = AttrID '=' AttrType ';' .
8269: AttrType = 'INTEGER' / 'TEXT' /
8270: 'REFERENCE' '(' RefType ')' /
8271: ValueSeq .
8272: RefType = 'ANY' /
8273: [ FirstSec ] ElemID [ ExtStruct ] .
8274: ValueSeq = AttrVal < ',' AttrVal > .
8275: AttrID = NAME .
8276: FirstSec = 'First' / 'Second' .
8277: ExtStruct = '(' ElemID ')' .
8278: AttrVal = NAME .
8279:
8280: RulesSeq = Rule < Rule > .
8281: Rule = ElemID [ LocAttrSeq ] '='
8282: DefWithAttr ';' .
8283: LocAttrSeq = '(' 'ATTR' LocalAttr
8284: < ';' LocalAttr > ')' .
8285: LocalAttr = [ '!' ] AttrID [ '=' AttrType ] .
8286: DefWithAttr = Definition
8287: [ '+' '(' ExtensionSeq ')' ]
8288: [ '-' '(' RestrictSeq ')' ]
8289: [ 'WITH' FixedAttrSeq ] .
8290: ExtensionSeq = ExtensionElem < ',' ExtensionElem > .
8291: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' /
8292: 'SYMBOL' / 'PICTURE' .
8293: RestrictSeq = RestrictElem < ',' RestrictElem > .
8294: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' /
8295: 'SYMBOL' / 'PICTURE' .
8296: FixedAttrSeq = FixedAttr < ',' FixedAttr > .
8297: FixedAttr = AttrID [ FixedOrModifVal ] .
8298: FixedOrModifVal= [ '?' ] '=' FixedValue .
8299: FixedValue = [ '-' ] NumValue / TextValue / AttrVal .
8300: NumValue = NUMBER .
8301: TextValue = STRING .
8302:
8303: Definition = BaseType [ LocAttrSeq ] / Constr /
8304: Element .
8305: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' /
8306: 'PICTURE' / 'UNIT' / 'NATURE' .
8307: Element = ElemID [ ExtOrDef ] .
8308: ExtOrDef = 'EXTERN' / 'INCLUDED' /
8309: [ LocAttrSeq ] '=' Definition .
8310:
8311: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF'
8312: '(' DefWithAttr ')' /
8313: 'BEGIN' DefOptSeq 'END' /
8314: 'AGGREGATE' DefOptSeq 'END' /
8315: 'CASE' 'OF' DefSeq 'END' /
8316: 'REFERENCE' '(' RefType ')' /
8317: 'PAIR' .
8318:
8319: min = Integer / '*' .
8320: max = Integer / '*' .
8321: Integer = NUMBER .
8322:
8323: DefOptSeq = DefOpt ';' < DefOpt ';' > .
8324: DefOpt = [ '?' ] DefWithAttr .
8325:
8326: DefSeq = DefWithAttr ';' < DefWithAttr ';' > .
8327:
8328: SkeletonSeq = SkeletonElem < ',' SkeletonElem > ';' .
8329: SkeletonElem = ElemID [ 'WITH' Contents ] .
8330: Contents = 'Nothing' / ElemID [ ExtStruct ] .
8331:
8332: ExceptSeq = Except ';' < Except ';' > .
8333: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr ':'
8334: ExcValSeq .
8335: ExcTypeOrAttr = ElemID / AttrID .
8336: ExcValSeq = ExcValue < ',' ExcValue > .
8337: ExcValue = 'NoCut' / 'NoCreate' /
8338: 'NoHMove' / 'NoVMove' / 'NoMove' /
8339: 'NoHResize' / 'NoVResize' / 'NoResize' /
1.13 cvs 8340: 'MoveResize' /
1.1 cvs 8341: 'NewWidth' / 'NewHeight' /
8342: 'NewHPos' / 'NewVPos' /
8343: 'Invisible' / 'NoSelect' /
8344: 'Hidden' / 'ActiveRef' /
8345: 'ImportLine' / 'ImportParagraph' /
1.9 cvs 8346: 'NoPaginate' / 'ParagraphBreak' /
8347: 'HighlightChildren' / 'ExtendedSelection' /
8348: 'ReturnCreateNL' .
1.1 cvs 8349:
8350: ExtensRuleSeq = ExtensRule ';' < ExtensRule ';' > .
8351: ExtensRule = RootOrElem [ LocAttrSeq ]
8352: [ '+' '(' ExtensionSeq ')' ]
8353: [ '-' '(' RestrictSeq ')' ]
8354: [ 'WITH' FixedAttrSeq ] .
8355: RootOrElem = 'Root' / ElemID .
8356:
8357: END
8358: </PRE>
8359: </DIV>
8360:
8361: <DIV class="section">
1.6 cvs 8362: <H2><A name=sectb63>The P language</A></H2>
1.1 cvs 8363:
8364: <P>
8365: The P language is used to write presentation schemas, which define the
8366: graphical presentation rules to be applied to different classes of documents
8367: and objects. It is described here in the M meta-language.</P>
8368: <PRE>
8369: PresSchema = 'PRESENTATION' ElemID ';'
8370: [ 'VIEWS' ViewSeq ]
8371: [ 'PRINT' PrintViewSeq ]
8372: [ 'COUNTERS' CounterSeq ]
8373: [ 'CONST' ConstSeq ]
8374: [ 'VAR' VarSeq ]
8375: [ 'DEFAULT' ViewRuleSeq ]
8376: [ 'BOXES' BoxSeq ]
8377: [ 'RULES' PresentSeq ]
8378: [ 'ATTRIBUTES' PresAttrSeq ]
8379: [ 'TRANSMIT' TransmitSeq ]
8380: 'END' .
8381:
8382: ElemID = NAME .
8383:
8384: ViewSeq = ViewDeclaration
8385: < ',' ViewDeclaration > ';' .
8386: ViewDeclaration = ViewID [ 'EXPORT' ] .
8387: ViewID = NAME .
8388:
8389: PrintViewSeq = PrintView < ',' PrintView > ';' .
8390: PrintView = ViewID / ElemID .
8391:
8392: CounterSeq = Counter < Counter > .
8393: Counter = CounterID ':' CounterFunc ';' .
8394: CounterID = NAME .
8395: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ]
8396: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] /
8397: SetFunction < SetFunction >
8398: AddFunction < AddFunction >
8399: [ 'INIT' AttrID ] /
8400: 'RLEVEL' 'OF' ElemID .
8401: SLevelAsc = [ '-' ] LevelAsc .
8402: LevelAsc = NUMBER .
8403: SetFunction = 'SET' CounterValue 'ON' TypeOrPage .
8404: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage .
8405: TypeOrPage = 'Page' [ '(' ViewID ')' ] /
8406: [ '*' ] ElemID .
8407: CounterValue = NUMBER .
8408:
8409: ConstSeq = Const < Const > .
8410: Const = ConstID '=' ConstType ConstValue ';' .
8411: ConstID = NAME .
8412: ConstType = 'Text' [ Alphabet ] / 'Symbol' /
8413: 'Graphics' / 'Picture' .
8414: ConstValue = STRING .
8415: Alphabet = NAME .
8416:
8417: VarSeq = Variable < Variable > .
8418: Variable = VarID ':' FunctionSeq ';' .
8419: VarID = NAME .
8420: FunctionSeq = Function < Function > .
8421: Function = 'DATE' / 'FDATE' /
8422: 'DocName' / 'DirName' /
8423: 'ElemName' / 'AttributeName' /
8424: ConstID / ConstType ConstValue /
8425: AttrID /
8426: 'VALUE' '(' PageAttrCtr ','
8427: CounterStyle ')' .
8428: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] /
8429: [ MinMax ] CounterID / AttrID .
8430: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' /
8431: 'Uppercase' / 'Lowercase' .
8432: MinMax = 'MaxRangeVal' / 'MinRangeVal' .
8433:
8434: BoxSeq = Box < Box > .
8435: Box = 'FORWARD' BoxID ';' /
8436: BoxID ':' ViewRuleSeq .
8437: BoxID = NAME .
8438:
8439: PresentSeq = Present < Present > .
8440: Present = [ '*' ] [ FirstSec ] ElemID ':'
8441: ViewRuleSeq .
8442: FirstSec = 'First' / 'Second' .
8443:
8444: PresAttrSeq = PresAttr < PresAttr > .
8445: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ]
8446: [ AttrRelation ] ':' ViewRuleSeq .
8447: AttrID = NAME .
8448: AttrRelation = '=' AttrVal /
8449: '>' [ '-' ] MinValue /
8450: '<' [ '-' ] MaxValue /
8451: 'IN' '[' [ '-' ] LowerBound '..'
8452: [ '-' ] UpperBound ']' /
8453: 'GREATER' AttrID /
8454: 'EQUAL' AttrID /
8455: 'LESS' AttrID .
8456: AttrVal = [ '-' ] EqualNum / EqualText / AttrValue .
8457: MinValue = NUMBER .
8458: MaxValue = NUMBER .
8459: LowerBound = NUMBER .
8460: UpperBound = NUMBER.
8461: EqualNum = NUMBER .
8462: EqualText = STRING .
8463: AttrValue = NAME .
8464:
8465: ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules >
8466: 'END' ';' /
8467: ViewRules / CondRules / Rule .
8468: RulesAndCond = CondRules / Rule .
8469: ViewRules = 'IN' ViewID CondRuleSeq .
8470: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' /
8471: CondRules / Rule .
8472: CondRules = CondRule < CondRule >
8473: [ 'Otherwise' RuleSeq ] .
8474: CondRule = 'IF' ConditionSeq RuleSeq .
8475: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / Rule .
8476:
1.6 cvs 8477: ConditionSeq = Condition < 'AND' Condition > .
8478: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem .
8479: ConditionElem = 'First' / 'Last' /
8480: [ 'Immediately' ] 'Within' [ NumParent ]
8481: ElemID [ ExtStruct ] /
8482: ElemID /
8483: 'Referred' / 'FirstRef' / 'LastRef' /
8484: 'ExternalRef' / 'InternalRef' / 'CopyRef' /
8485: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' /
8486: 'UserPage' / 'StartPage' / 'ComputedPage' /
8487: 'Empty' /
8488: '(' [ MinMax ] CounterName CounterCond ')' /
8489: CondPage '(' CounterID ')' .
8490: NumParent = [ GreaterLess ] NParent .
8491: GreaterLess = '>' / '<' .
8492: NParent = NUMBER.
8493: CounterCond = '<' MaxCtrVal / '>' MinCtrVal /
8494: '=' EqCtrVal /
8495: 'IN' '[' ['-'] MinCtrBound '..'
8496: ['-'] MaxCtrBound ']' .
8497: PageCond = 'Even' / 'Odd' / 'One' .
8498: MaxCtrVal = NUMBER .
8499: MinCtrVal = NUMBER .
8500: EqCtrVal = NUMBER .
8501: MaxCtrBound = NUMBER .
8502: MinCtrBound = NUMBER .
1.1 cvs 8503:
8504: Rule = PresParam ';' / PresFunc ';' .
8505: PresParam = 'VertRef' ':' HorizPosition /
8506: 'HorizRef' ':' VertPosition /
8507: 'VertPos' ':' VPos /
8508: 'HorizPos' ':' HPos /
8509: 'Height' ':' Extent /
8510: 'Width' ':' Extent /
8511: 'VertOverflow' ':' Boolean /
8512: 'HorizOverflow' ':' Boolean /
8513: 'LineSpacing' ':' DistOrInherit /
8514: 'Indent' ':' DistOrInherit /
8515: 'Adjust' ':' AlignOrInherit /
8516: 'Justify' ':' BoolInherit /
8517: 'Hyphenate' ':' BoolInherit /
8518: 'PageBreak' ':' Boolean /
8519: 'LineBreak' ':' Boolean /
8520: 'InLine' ':' Boolean /
8521: 'NoBreak1' ':' AbsDist /
8522: 'NoBreak2' ':' AbsDist /
8523: 'Gather' ':' Boolean /
8524: 'Visibility' ':' NumberInherit /
8525: 'Size' ':' SizeInherit /
8526: 'Font' ':' NameInherit /
8527: 'Style' ':' StyleInherit /
8528: 'Underline' ':' UnderLineInherit /
8529: 'Thickness' ':' ThicknessInherit /
8530: 'Depth' ':' NumberInherit /
8531: 'LineStyle' ':' LineStyleInherit /
8532: 'LineWeight' ':' DistOrInherit /
8533: 'FillPattern' ':' NameInherit /
8534: 'Background' ':' NameInherit /
1.13 cvs 8535: 'Foreground' ':' NameInherit /
1.1 cvs 8536: 'Content' ':' VarConst .
8537: PresFunc = Creation '(' BoxID ')' /
8538: 'Line' /
8539: 'NoLine' /
8540: 'Page' '(' BoxID ')' /
1.13 cvs 8541: 'Copy' '(' BoxTypeToCopy ')' /
8542: 'ShowBox' /
8543: 'BackgroundPicture' ':' FileName /
8544: 'PictureMode' ':' PictMode .
1.1 cvs 8545:
8546: BoxTypeToCopy = BoxID [ ExtStruct ] /
8547: ElemID [ ExtStruct ] .
8548: ExtStruct = '(' ElemID ')' .
8549:
8550: Distance = [ Sign ] AbsDist .
8551: Sign = '+' / '-' .
8552: AbsDist = IntegerOrAttr [ '.' DecimalPart ]
8553: [ Unit ] .
8554: IntegerOrAttr = IntegerPart / AttrID .
8555: IntegerPart = NUMBER .
8556: DecimalPart = NUMBER .
8557: Unit = 'em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' /
8558: 'pc' / 'px' / '%' .
8559:
8560: HPos = 'nil' / VertAxis '=' HorizPosition
8561: [ 'UserSpecified' ] .
8562: VPos = 'nil' / HorizAxis '=' VertPosition
8563: [ 'UserSpecified' ] .
8564: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' .
8565: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .
8566:
1.6 cvs 8567: VertPosition = Reference '.' HorizAxis [ Distance ] .
8568: HorizPosition = Reference '.' VertAxis [ Distance ] .
8569: Reference = 'Enclosing' [ BoxTypeNot ] /
8570: 'Enclosed' [ BoxTypeNot ] /
8571: 'Previous' [ BoxTypeNot ] /
8572: 'Next' [ BoxTypeNot ] /
8573: 'Referred' [ BoxTypeNot ] /
8574: 'Creator' /
8575: 'Root' /
8576: '*' /
8577: BoxOrType .
8578: BoxOrType = BoxID /
8579: [ '*' ] [ FirstSec ] ElemID /
8580: 'AnyElem' / 'AnyBox' .
8581: BoxTypeNot = [ 'NOT' ] BoxOrType .
8582:
8583: Extent = Reference '.' HeightWidth
8584: [ Relation ] [ 'Min' ] /
8585: AbsDist [ 'UserSpecified' ] [ 'Min' ] /
8586: HPos / VPos .
8587: HeightWidth = 'Height' / 'Width' .
8588: Relation = '*' ExtentAttr '%' / Distance .
8589: ExtentAttr = ExtentVal / AttrID .
8590: ExtentVal = NUMBER .
8591:
8592: Inheritance = Kinship InheritedValue .
8593: Kinship = 'Enclosing' / 'GrandFather'/ 'Enclosed' /
8594: 'Previous' / 'Creator' .
8595: InheritedValue = '+' PosIntAttr [ 'Max' maximumA ] /
8596: '-' NegIntAttr [ 'Min' minimumA ] /
8597: '=' .
8598: PosIntAttr = PosInt / AttrID .
8599: PosInt = NUMBER .
8600: NegIntAttr = NegInt / AttrID .
8601: NegInt = NUMBER .
8602: maximumA = maximum / AttrID .
8603: maximum = NUMBER .
8604: minimumA = minimum / AttrID .
8605: minimum = NUMBER .
8606:
8607: AlignOrInherit = Kinship '=' / Alignment .
8608: Alignment = 'Left' / 'Right' / 'VMiddle' /
8609: 'LeftWithDots' .
1.1 cvs 8610:
1.6 cvs 8611: DistOrInherit = Kinship InheritedDist / Distance .
8612: InheritedDist = '=' / '+' AbsDist / '-' AbsDist .
1.1 cvs 8613:
1.6 cvs 8614: BoolInherit = Boolean / Kinship '=' .
8615: Boolean = 'Yes' / 'No' .
1.1 cvs 8616:
1.6 cvs 8617: NumberInherit = Integer / AttrID / Inheritance .
8618: Integer = NUMBER .
1.1 cvs 8619:
8620: LineStyleInherit= Kinship '=' / 'Solid' / 'Dashed' /
8621: 'Dotted' .
8622:
1.6 cvs 8623: SizeInherit = SizeAttr [ 'pt' ] / Kinship InheritedSize .
8624: InheritedSize = '+' SizeAttr [ 'pt' ]
8625: [ 'Max' MaxSizeAttr ] /
8626: '-' SizeAttr [ 'pt' ]
8627: [ 'Min' MinSizeAttr ] /
8628: '=' .
8629: SizeAttr = Size / AttrID .
8630: Size = NUMBER .
8631: MaxSizeAttr = MaxSize / AttrID .
8632: MaxSize = NUMBER .
8633: MinSizeAttr = MinSize / AttrID .
8634: MinSize = NUMBER .
8635:
8636: NameInherit = Kinship '=' / FontName .
8637: FontName = NAME .
8638: StyleInherit = Kinship '=' /
8639: 'Roman' / 'Bold' / 'Italics' /
8640: 'BoldItalics' / 'Oblique' / 'BoldOblique' .
1.1 cvs 8641: UnderLineInherit= Kinship '=' /
1.6 cvs 8642: 'NoUnderline' / 'Underlined' /
8643: 'Overlined' / 'CrossedOut' .
1.1 cvs 8644: ThicknessInherit= Kinship '=' / 'Thick' / 'Thin' .
1.13 cvs 8645:
8646: FileName = STRING .
8647: PictMode = 'NormalSize' / 'Scale' /
8648: 'RepeatXY' / 'RepeatX' / 'RepeatY' .
1.1 cvs 8649:
1.6 cvs 8650: VarConst = ConstID / ConstType ConstValue /
8651: VarID / '(' FunctionSeq ')' /
8652: ElemID .
8653:
8654: Creation = Create [ 'Repeated' ] .
8655: Create = 'CreateFirst' / 'CreateLast' /
8656: 'CreateBefore' / 'CreateAfter' /
8657: 'CreateEnclosing' .
8658:
8659: TransmitSeq = Transmit < Transmit > .
8660: Transmit = TypeOrCounter 'To' ExternAttr
8661: '(' ElemID ')' ';' .
8662: TypeOrCounter = CounterID / ElemID .
8663: ExternAttr = NAME .
1.1 cvs 8664:
8665: END
8666: </PRE>
8667: </DIV>
8668:
8669: <DIV class="section">
1.6 cvs 8670: <H2><A name=sectb64>The T language</A></H2>
1.1 cvs 8671:
8672: <PRE>
8673: TransSchema = 'TRANSLATION' ElemID ';'
8674: [ 'LINELENGTH' LineLength ';' ]
8675: [ 'LINEEND' CHARACTER ';' ]
8676: [ 'LINEENDINSERT' STRING ';' ]
8677: [ 'BUFFERS' BufferSeq ]
8678: [ 'COUNTERS' CounterSeq ]
8679: [ 'CONST' ConstSeq ]
8680: [ 'VAR' VariableSeq ]
8681: 'RULES' ElemSeq
8682: [ 'ATTRIBUTES' AttrSeq ]
8683: [ 'PRESENTATION' PresSeq ]
8684: < 'TEXTTRANSLATE' TextTransSeq >
8685: [ 'SYMBTRANSLATE' TransSeq ]
8686: [ 'GRAPHTRANSLATE' TransSeq ]
8687: 'END' .
8688:
8689: LineLength = NUMBER .
8690:
8691: BufferSeq = Buffer < Buffer > .
8692: Buffer = BufferID [ '(' 'Picture' ')' ] ';' .
8693: BufferID = NAME .
8694:
8695: CounterSeq = Counter < Counter > .
8696: Counter = CounterID [ ':' CounterFunc ] ';' .
8697: CounterID = NAME .
8698: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ]
8699: [ 'Init' AttrID ] /
8700: 'Rlevel' 'of' ElemID /
8701: 'Set' InitValue 'On' ElemID
8702: 'Add' Increment 'On' ElemID
8703: [ 'Init' AttrID ] .
8704: SLevelAsc = [ '-' ] LevelAsc .
8705: LevelAsc = NUMBER .
8706: InitValue = NUMBER .
8707: Increment = NUMBER .
8708: ElemID = NAME .
8709: AttrID = NAME .
8710:
8711: ConstSeq = Const < Const > .
8712: Const = ConstID '=' ConstValue ';' .
8713: ConstID = NAME .
8714: ConstValue = STRING .
8715:
8716: VariableSeq = Variable < Variable > .
8717: Variable = VarID ':' Function < Function > ';' .
8718: VarID = NAME .
8719: Function = 'Value' '(' CounterID [ ':' Length ]
8720: [ ',' CounterStyle ] ')' /
8721: 'FileDir' / 'FileName' / 'Extension' /
8722: 'DocumentName' / 'DocumentDir' /
8723: ConstID / CharString /
8724: BufferID / AttrID .
8725: Length = NUMBER .
8726: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' /
8727: 'Uppercase' / 'Lowercase' .
8728: CharString = STRING .
8729:
8730: ElemSeq = TransType < TransType > .
8731: TransType = [ FirstSec ] ElemID ':' RuleSeq .
8732: FirstSec = 'First' / 'Second' .
8733: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' .
8734: Rule = SimpleRule / ConditionBlock .
8735: ConditionBlock= 'IF' ConditionSeq SimpleRuleSeq .
8736: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' /
8737: SimpleRule .
8738:
8739: ConditionSeq = Condition [ 'AND' Condition ] .
8740: Condition = [ 'NOT' ] [ 'Target' ] Cond .
8741: Cond = CondElem / CondAscend .
8742: CondElem = 'FirstRef' / 'LastRef' /
8743: 'ExternalRef' /
8744: 'Defined' /
8745: 'Alphabet' '=' Alphabet /
8746: 'ComputedPage' / 'StartPage' /
8747: 'UserPage' / 'ReminderPage' /
8748: 'Empty' /
1.11 cvs 8749: ElemID /
1.1 cvs 8750: 'FirstAttr' / 'LastAttr' .
8751: CondAscend = [ Ascend ] CondOnAscend .
8752: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType .
8753: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] .
8754: CondRelLevel = NUMBER .
8755: CondOnAscend = 'First' / 'Last' /
8756: 'Referred' /
8757: [ 'Immediately' ] 'Within' [ NumParent ]
8758: ElemID [ ExtStruct ] /
8759: 'Attributes' /
8760: AttrID [ RelatAttr ] /
8761: 'Presentation' /
8762: PresRule /
8763: 'Comment' .
8764: NumParent = [ GreaterLess ] NParent .
8765: GreaterLess = '>' / '<' .
8766: NParent = NUMBER.
8767: Alphabet = NAME .
8768: RelatAttr = '=' Value /
8769: '>' [ '-' ] Minimum /
8770: '<' [ '-' ] Maximum /
8771: 'IN' '[' [ '-' ] MinInterval '..'
8772: [ '-' ] MaxInterval ']' .
8773: Value = [ '-' ] IntegerVal / TextVal / AttrValue .
8774: Minimum = NUMBER .
8775: Maximum = NUMBER .
8776: MinInterval = NUMBER .
8777: MaxInterval = NUMBER .
8778: IntegerVal = NUMBER .
8779: TextVal = STRING .
8780: AttrValue = NAME .
8781:
8782: SimpleRule = 'Create' [ 'IN' VarID ] Object
8783: [ Position ] ';' /
8784: 'Write' Object [ Position ] ';' /
8785: 'Read' BufferID [ Position ] ';' /
8786: 'Include' File [ Position ] ';' /
1.6 cvs 8787: 'Get' [ RelPosition ] ElemID
8788: [ ExtStruct ]
8789: [ Position ] ';' /
1.1 cvs 8790: 'Copy' [ RelPosition ] ElemID
8791: [ ExtStruct ]
8792: [ Position ] ';' /
8793: 'Use' TrSchema [ 'For' ElemID ] ';' /
8794: 'Remove' ';' /
8795: 'NoTranslation' ';' /
8796: 'NoLineBreak' ';' /
8797: 'ChangeMainFile' VarID [ Position ] ';' /
1.14 ! cvs 8798: 'RemoveFile' VarID [ Position ] ';' /
1.10 cvs 8799: 'Set' CounterID InitValue [ Position ] ';' /
8800: 'Add' CounterID Increment [ Position ] ';' /
8801: 'Indent' [ 'IN' VarID ] [ IndentSign ]
8802: IndentValue [ Position ] ';' .
8803:
8804: IndentSign = '+' / '-' .
8805: IndentValue = NUMBER .
1.1 cvs 8806:
8807: Object = ConstID / CharString /
8808: BufferID /
8809: VarID /
8810: '(' Function < Function > ')' /
8811: AttrID /
8812: 'Value' /
8813: 'Content' /
8814: 'Comment' /
8815: 'Attributes' /
8816: 'Presentation' /
8817: 'RefId' /
8818: 'PairId' /
8819: 'FileDir' / 'FileName' / 'Extension' /
8820: 'DocumentName' / 'DocumentDir' /
8821: [ 'Referred' ] ReferredObject .
8822: Position = 'After' / 'Before' .
8823:
1.6 cvs 8824: ReferredObject= VarID /
8825: ElemID [ ExtStruct ] /
8826: 'RefId' /
8827: 'DocumentName' / 'DocumentDir' .
1.1 cvs 8828:
1.6 cvs 8829: File = FileName / BufferID .
8830: FileName = STRING .
1.1 cvs 8831:
1.6 cvs 8832: RelPosition = 'Included' / 'Referred' .
8833: ExtStruct = '(' ElemID ')' .
1.1 cvs 8834:
1.6 cvs 8835: TrSchema = NAME .
8836:
8837: AttrSeq = TransAttr < TransAttr > .
8838: TransAttr = AttrID [ '(' ElemID ')' ]
8839: [ RelatAttr ] ':' RuleSeq .
8840:
8841: PresSeq = PresTrans < PresTrans > .
8842: PresTrans = PresRule ':' RuleSeq .
8843: PresRule = 'Size' [ PresRelation ] /
8844: 'Indent' [ PresRelation ] /
8845: 'LineSpacing' [ PresRelation ] /
8846: 'Adjust' [ '=' AdjustVal ] /
8847: 'Justify' [ '=' BoolVal ] /
8848: 'Hyphenate' [ '=' BoolVal ] /
8849: 'Style' [ '=' StyleVal ] /
8850: 'Font' [ '=' FontVal ] /
8851: 'UnderLine' [ '=' UnderLineVal ] /
8852: 'Thickness' [ '=' ThicknessVal ] /
8853: 'LineStyle' [ '=' LineStyleVal ] /
8854: 'LineWeight' [ PresRelation ] /
8855: 'FillPattern' [ '=' Pattern ] /
8856: 'Background' [ '=' Color ] /
8857: 'Foreground' [ '=' Color ] .
8858:
8859: PresRelation = '=' PresValue /
8860: '>' [ '-' ] PresMinimum /
8861: '<' [ '-' ] PresMaximum /
8862: 'IN' '[' [ '-' ] PresIntervalMin '..'
8863: [ '-' ] PresIntervalMax ']' .
8864: AdjustVal = 'Left' / 'Right' / 'VMiddle' /
8865: 'LeftWithDots' .
8866: BoolVal = 'Yes' / 'No' .
8867: StyleVal = 'Bold' / 'Italics' / 'Roman' /
8868: 'BoldItalics' / 'Oblique' /
8869: 'BoldOblique' .
8870: FontVal = 'Times' / 'Helvetica' / 'Courier' .
8871: UnderLineVal = 'NoUnderline' / 'UnderLined' /
8872: 'OverLined' / 'CrossedOut' .
8873: ThicknessVal = 'Thick' / 'Thin' .
8874: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' .
8875: Pattern = NAME .
8876: Color = NAME .
8877: PresMinimum = NUMBER .
8878: PresMaximum = NUMBER .
1.1 cvs 8879: PresIntervalMin= NUMBER .
8880: PresIntervalMax= NUMBER .
1.6 cvs 8881: PresValue = [ '-' ] PresVal .
8882: PresVal = NUMBER .
1.1 cvs 8883:
1.6 cvs 8884: TextTransSeq = [ Alphabet ] TransSeq .
8885: Alphabet = NAME .
8886: TransSeq = 'BEGIN' < Translation > 'END' ';' /
8887: Translation .
8888: Translation = Source [ '->' Target ] ';' .
8889: Source = STRING .
8890: Target = STRING .
1.1 cvs 8891: </PRE>
8892: </DIV>
8893: <HR>
8894: </DIV>
8895:
8896: <DIV class="chapter">
1.6 cvs 8897: <H1><A name=sect7>Character coding</A></H1>
1.1 cvs 8898:
8899:
8900: <DIV class="section">
1.6 cvs 8901: <H2><A name=sectb71>Characters</A></H2>
1.1 cvs 8902:
8903: <P>
8904: The characters of the Latin alphabet follow the encoding defined in the ISO
1.5 cvs 8905: 8859-1 (ISO Latin-1) standard. The characters of the Greek alphabet follow
1.1 cvs 8906: the encoding defined by Adobe for its Symbol font (Adobe FontSpecific).</P>
8907: <P>
8908: Characters whose octal code is greater than 0200 are written in the form of
8909: their octal code preceded by a backslash character (``\''). For example, the
1.5 cvs 8910: French word 'Résumé' is written <TT>R\351sum\351</TT>.</P>
1.1 cvs 8911: <P>
1.2 cvs 8912: To the ISO 8859-1 encoding four characters with the following codes have been
1.1 cvs 8913: added:<BR><TT>212</TT>: line break<BR><TT>240</TT>: sticky
1.2 cvs 8914: space<BR><TT>201</TT>: thin space<BR><TT>202</TT>: en space</P>
1.1 cvs 8915: <P>
8916: The <TT>212</TT> character is a ``line break'' character which forces a line
8917: break. The <TT>240</TT> character is a ``sticky space'', which cannot be
8918: replaced by a line break.</P>
8919: </DIV>
8920:
8921: <DIV class="section">
1.6 cvs 8922: <H2><A name=sectb72>Symbols</A></H2>
1.1 cvs 8923:
8924: <P>
8925: The table below gives the codes for the symbols of Thot. Symbols can be used
8926: in presentation schemas constants and in transcoding rules of translation
8927: schemas. Each symbol is represented by a single character.</P>
8928: <UL>
8929: <LI><TT>r</TT>: a radical
8930: <LI><TT>i</TT>: a simple integral
8931: <LI><TT>c</TT>: a curvilinear integral
8932: <LI><TT>d</TT>: a double integral
8933: <LI><TT>t</TT>: a triple integral
8934: <LI><TT>S</TT>: the summation symbol
8935: <LI><TT>P</TT>: the product symbol
8936: <LI><TT>U</TT>: the union symbol
8937: <LI><TT>I</TT>: the intersection symbol
8938: <LI><TT>></TT>: a right arrow
8939: <LI><TT><</TT>: a left arrow
8940: <LI><TT>^</TT>: an up arrow
8941: <LI><TT>V</TT>: a down arrow
8942: <LI><TT>(</TT>: an opening parenthesis
8943: <LI><TT>)</TT>: a closing parenthesis
8944: <LI><TT>{</TT>: an opening brace
8945: <LI><TT>}</TT>: a closing brace
8946: <LI><TT>[</TT>: an opening bracket
8947: <LI><TT>]</TT>: a closing bracket
8948: </UL>
8949: </DIV>
8950:
8951: <DIV class="section">
1.6 cvs 8952: <H2><A name=sectb73>Graphical elements</A></H2>
1.1 cvs 8953:
8954: <P>
8955: The table below gives the codes for the graphical elements of Thot. These
8956: elements can be used in presentation schemas constants and in transcoding
8957: rules of translation schemas. Each graphical element is represented by a
8958: single character.</P>
8959: <UL>
8960: <LI><TT>c</TT>: an ellipse inscribed in the box
8961: <LI><TT>R</TT>: a rectangle which is the shape of the box
8962: <LI><TT>C</TT>: a rectangle with rounded corners
8963: <LI><TT>t</TT>: a horizontal line along the upper side of the box
8964: <LI><TT>h</TT>: a horizontal line as wide as the box and placed in its middle
8965: <LI><TT>b</TT>: a horizontal line along the lower side of the box
8966: <LI><TT>></TT>: a right arrow as long as the box's width and in its middle
8967: <LI><TT>></TT>: a left arrow as long as the box's width and in its middle
8968: <LI><TT>l</TT>: a vertical line on the left side of the box
8969: <LI><TT>v</TT>: a vertical line as tall as the box and placed in its middle
8970: <LI><TT>r</TT>: a vertical line on the right side of the box
8971: <LI><TT>^</TT>: an up arrow as tall as the box and in its middle
8972: <LI><TT>V</TT>: a down arrow as tall as the box and in its middle
8973: <LI><TT>/</TT>: The southwest/northeast diagonal of the box
8974: <LI><TT>\</TT>: the northwest/southeast diagonal of the box
1.2 cvs 8975: <LI><TT>O</TT>: The northwest/southeast diagonal of the box with an arrowhead
1.1 cvs 8976: at the top
1.2 cvs 8977: <LI><TT>e</TT>: The northwest/southeast diagonal of the box with an arrowhead
1.1 cvs 8978: at the bottom
1.2 cvs 8979: <LI><TT>E</TT>: The southwest/northeast diagonal of the box with an arrowhead
1.1 cvs 8980: at the top
1.2 cvs 8981: <LI><TT>o</TT>: The southwest/northeast diagonal of the box with an arrowhead
1.1 cvs 8982: at the bottom
8983: <LI><TT>space</TT>: a transparent element
1.2 cvs 8984: <LI><TT>P</TT>: a rectangle with round corners and a horizontal bar at the top
1.1 cvs 8985: <LI><TT>Q</TT>: an ellipse with a horizontal bar at the top
8986: <LI><TT>L</TT>: a lozenge
8987: <LI><TT>W</TT>: the upper right corner
8988: <LI><TT>X</TT>: the lower right corner
8989: <LI><TT>Y</TT>: the lower left corner
8990: <LI><TT>Z</TT>: the upper left corner
8991: <LI><TT>p</TT>: a polygon
8992: <LI><TT>S</TT>: an open broken line
8993: <LI><TT>N</TT>: an open broken line with an arrow head at start
8994: <LI><TT>U</TT>: an open broken line with an arrow head at the end
8995: <LI><TT>M</TT>: an open broken line with two arrow heads
8996: <LI><TT>s</TT>: a closed curve
8997: <LI><TT>B</TT>: an open curve
8998: <LI><TT>F</TT>: an open curve with an arrow head at start
8999: <LI><TT>A</TT>: an open curve with an arrow head at the end
9000: <LI><TT>D</TT>: an open curve with two arrow heads
9001: </UL>
1.5 cvs 9002: <HR>
1.1 cvs 9003: </DIV>
9004: </DIV>
9005: </BODY>
9006: </HTML>
Webmaster