Annotation of Amaya/doc/languages.html, revision 1.17
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.17 ! cvs 15: <H4>Version of December 29, 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.
1.16 cvs 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>
1.1 cvs 2959: <PRE>
1.16 cvs 2960: RANK OF ElemID [ LevelAsc ] [ INIT AttrID ]
1.1 cvs 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>
1.16 cvs 2978: The type name <TT>ElemID</TT> can be followed by an integer. That number
1.1 cvs 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
1.16 cvs 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>
1.1 cvs 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>
1.16 cvs 3021: SET n ON Type1 ADD m ON Type2 [ INIT AttrID ]
1.1 cvs 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
1.16 cvs 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>
1.1 cvs 3055: <PRE>
1.16 cvs 3056: RLEVEL OF Type
1.1 cvs 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 ]
1.16 cvs 3068: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] /
1.1 cvs 3069: SetFunction < SetFunction >
1.16 cvs 3070: AddFunction < AddFunction >
3071: [ 'INIT' AttrID ] /
3072: 'RLEVEL' 'OF' ElemID .
1.1 cvs 3073: SLevelAsc = [ '-' ] LevelAsc .
3074: LevelAsc = NUMBER .
3075: SetFunction = 'SET' CounterValue 'ON' TypeOrPage .
3076: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage .
3077: TypeOrPage = 'Page' [ '(' ViewID ')' ] /
1.16 cvs 3078: [ '*' ] ElemID .
1.1 cvs 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>
1.17 ! cvs 4381: Two rules allow a box to be placed relative to other boxes. The <TT>VertPos</TT>
1.1 cvs 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>
1.17 ! cvs 4420: When the keyword is ambiguous, it is followed by the name of an element type or
1.1 cvs 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
1.17 ! cvs 4424: use just the name of an element type or presentation box without an initial keyword. In
1.1 cvs 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
1.17 ! cvs 4427: whose type is not the named one.
! 4428: <P>
! 4429: In place of the box or type name, the keywords <TT>AnyElem</TT>,
! 4430: <TT>AnyBox</TT> and <TT>ElemWithAttr</TT> can be used, representing
! 4431: respectively, any structured element box, any presentation box, and the box
! 4432: corresponding to any structured element having a particular attribute,
! 4433: whatever its value; the name of this attribute must follow the keyword
! 4434: <TT>ElemWithAttr</TT>.
! 4435: <P>
! 4436: A type name may be preceded by a star in order to resolve the ambiguity in the
1.1 cvs 4437: special case where the structure schema defines an <A
1.6 cvs 4438: href="#sectd3284">inclusion</A> without expansion (or with partial expansion)
1.1 cvs 4439: of the same type as an element of the scheme. For mark pairs (and only for <A
1.6 cvs 4440: href="#sectd3285">mark pairs</A>) the type name <EM>must</EM> be preceded by the
1.1 cvs 4441: <TT>First</TT> or <TT>Second</TT> keyword, which indicates which of the two
4442: marks of the pair should be used as the reference box.</P>
4443: <P>
4444: The star character ('<TT>*</TT>') used alone designates the box to which the
4445: rule applies (in this case, it is obviously useless to specify the type of the
4446: reference box).</P>
4447: <P>
4448: The keywords <TT>Enclosing</TT> and <TT>Enclosed</TT> can be used no matter
4449: what constructor defines the type to which the rule applies. When applied to
4450: the element which represents the entire document, <TT>Enclosing</TT>
4451: designates the window or page in which the document's image is displayed for
4452: the view to which the rule applies. A box or type name without a keyword is
4453: used for aggregate elements and designates another element of the same
4454: aggregate. It can also be used to designate a presentation or page layout
4455: box. The keywords <TT>Previous</TT> and <TT>Next</TT> are primarily used to
4456: denote list elements, but can also be used to denote elements of an
4457: aggregate.</P>
4458: <P>
4459: In the position rule, the structural position relative to the reference box is
4460: followed, after a period, by the name of an axis or side. The rule specifies
4461: its node's position as being some distance from this axis or side of the
4462: reference box. If this distance is zero, then the distance does not appear in
4463: the rule. Otherwise, it does appear as a positive or negative number (the
4464: sign is required for negative numbers). The sign takes into account the
4465: orientation of the coordinate axes: for top to bottom for the vertical axis
4466: and from left to right for the horizontal axis. Thus, a negative distance in
4467: a vertical position indicates that the side or axis specified in the rule is
4468: above the side or axis of the reference box.</P>
4469: <P>
4470: The distance can be followed by the <TT>UserSpecified</TT> keyword (even if
4471: the distance is nil and does not appear, the <TT>UserSpecified</TT> keyword
4472: can be used). It indicates that when the element to which the rule applies is
4473: being created, the editor will ask the user to specify the distance himself,
4474: using the mouse. In this case, the distance specified in the rule is a
4475: default distance which is suggested to the user but can be modified. The
4476: <TT>UserSpecified</TT> keyword can be used either in the vertical position
4477: rule, the horizontal position rule, or both.</P>
4478: <PRE>
4479: VertPosition = Reference '.' HorizAxis [ Distance ] .
4480: HorizPosition = Reference '.' VertAxis [ Distance ] .
4481: Reference ='Enclosing' [ BoxTypeNot ] /
4482: 'Enclosed' [ BoxTypeNot ] /
4483: 'Previous' [ BoxTypeNot ] /
4484: 'Next' [ BoxTypeNot ] /
4485: 'Referred' [ BoxTypeNot ] /
4486: 'Creator' /
4487: 'Root' /
4488: '*' /
4489: BoxOrType .
4490: BoxOrType = BoxID /
4491: [ '*' ] [ FirstSec ] ElemID /
1.17 ! cvs 4492: 'AnyElem' / 'AnyBox' /
! 4493: 'ElemWithAttr' AttrID .
1.1 cvs 4494: BoxTypeNot = [ 'NOT' ] BoxOrType .
4495: </PRE>
4496: <BLOCKQUOTE class="example">
4497: <P>
4498: <STRONG>Example:</STRONG></P>
4499: <P>
1.5 cvs 4500: If a <A name="expos1">report</A> is defined by the following
1.3 cvs 4501: structure schema:</P>
1.1 cvs 4502: <PRE>
4503: Report = BEGIN
1.6 cvs 4504: Title = Text;
4505: Summary = Text;
4506: Keywords = Text;
4507: ...
4508: END;
1.1 cvs 4509: </PRE>
4510: <P>
4511: then the presentation schema could contain the rules:</P>
4512: <PRE>
4513: Report : BEGIN
1.6 cvs 4514: VertPos : Top = Enclosing . Top;
4515: HorizPos : Left = Enclosing . Left;
4516: ...
4517: END;
1.1 cvs 4518: </PRE>
4519: <P>
1.3 cvs 4520: These rules place the <A name="reportexample">report</A> in the upper left
4521: corner of the enclosing box, which is the window in which the document is being
1.1 cvs 4522: edited.</P>
4523: <PRE>
1.6 cvs 4524: Title : BEGIN
4525: VertPos : Top = Enclosing . Top + 1;
4526: HorizPos : VMiddle = Enclosing . VMiddle;
4527: ...
4528: END;
1.1 cvs 4529: </PRE>
4530: <P>
1.3 cvs 4531: The top of the title is one line (a line has the height of the characters of
4532: the title) from the top of the report, which is also the top of the editing
4533: window. The title is centered horizontally in the window (see <A
1.1 cvs 4534: href="#posdim">figure</A>).</P>
4535: <PRE>
1.6 cvs 4536: Summary : BEGIN
1.1 cvs 4537: VertPos : Top = Title . Bottom + 1.5;
4538: HorizPos : Left = Enclosing . Left + 2 cm;
4539: ...
4540: END;
4541: </PRE>
4542: <P>
1.3 cvs 4543: The top of the summary is place a line and a half below the bottom of the title
1.1 cvs 4544: and is shifted two centimeters from the side of the window.</P>
4545: </BLOCKQUOTE>
4546: <BLOCKQUOTE class="example">
4547: <P>
4548: <STRONG>Example:</STRONG></P>
4549: <P>
1.3 cvs 4550: Suppose there is a <A name="expos2">Design</A> logical structure which contains
1.1 cvs 4551: graphical elements:</P>
4552: <PRE>
4553: Design = LIST OF (ElemGraph = GRAPHICS);
4554: </PRE>
4555: <P>
1.3 cvs 4556: The following rules allow the user to freely choose the position of each
1.1 cvs 4557: element when it is created:</P>
4558: <PRE>
4559: ElemGraph =
4560: BEGIN
4561: VertPos : Top = Enclosing . Top + 1 cm UserSpecified;
4562: HorizPos: Left = Enclosing . Left UserSpecified;
4563: ...
4564: END;
4565: </PRE>
4566: <P>
1.3 cvs 4567: Thus, when a graphical element is created, its default placement is at the left
4568: of the window and 1 cm from the top, but the user can move it immediately,
1.1 cvs 4569: simply by moving the mouse.</P>
4570: </BLOCKQUOTE>
4571: </DIV>
4572:
4573: <DIV class="subsection">
1.6 cvs 4574: <H3><A name=sectc4219>Box extents</A></H3>
1.1 cvs 4575:
4576: <P>
4577: The extents (height and width) of each box are defined by the two rules
4578: <TT>Height</TT> and <TT>Width</TT>. There are three types of extents: fixed,
4579: relative, and elastic.</P>
4580:
4581: <DIV class="subsubsection">
1.6 cvs 4582: <H4><A name=sectd42191>Fixed extents</A></H4>
1.1 cvs 4583:
4584: <P>
4585: A fixed dimension sets the height or width of the box independently of all
1.6 cvs 4586: other boxes. It is expressed in <A href="#sectc4217">distance units</A>. The
1.1 cvs 4587: extent can be followed by the <TT>UserSpecified</TT> keyword which indicates
4588: that when the element to which the rule applies is being created, the editor
4589: will ask the user to specify the extent himself, using the mouse. In this
4590: case, the extent specified in the rule is a default extent which is suggested
4591: to the user but can be modified. The <TT>UserSpecified</TT> keyword can be
4592: used either in the <TT>Height</TT> rule, the <TT>Width</TT> rule, or both.</P>
4593: <P>
4594: A fixed extent rule can be ended by the <TT>Min</TT> keyword, which signifies
4595: that the indicated value is a minimum, and that, if the contents of the box
4596: require it, a larger extent is possible.</P>
4597: <PRE>
4598: 'Height' ':' Dimension
4599: 'Width' ':' Dimension
4600: Dimension = AbsDist [ 'UserSpecified' ] [ 'Min' ] /
4601: ...
4602: </PRE>
4603: <BLOCKQUOTE class="example">
4604: <P>
4605: <STRONG>Example:</STRONG></P>
4606: <P>
1.3 cvs 4607: Continuing with the <A href="#expos2">previous example</A>, it is possible to
4608: allow the user to choose the size of each graphical element as it is
1.1 cvs 4609: created:</P>
4610: <PRE>
4611: ElemGraph : BEGIN
1.6 cvs 4612: Width : 2 cm UserSpecified;
1.1 cvs 4613: Height : 1 cm UserSpecified;
4614: ...
4615: END;
4616: </PRE>
4617: <P>
4618: Thus, when a graphical element is create, it is drawn by default with a width
4619: of 2 cm and a height of 1 cm, but the user is free to resize it immediately
4620: with the mouse.</P>
4621: <PRE>
4622: Summary : BEGIN
4623: Height : 5 cm Min;
4624: ...
4625: END;
4626: Keywords : BEGIN
4627: VertPos : Top = Summary . Bottom;
4628: ...
4629: END;
4630: </PRE>
4631: </BLOCKQUOTE>
4632: </DIV>
4633:
4634: <DIV class="subsubsection">
1.6 cvs 4635: <H4><A name=sectd42192>Relative extents</A></H4>
1.1 cvs 4636:
4637: <P>
4638: A relative extent determines the extent as a function of the extent of another
4639: box, just as a relative position places a box in relation to another. The
4640: reference box in an extent rule is designated using the same syntax as is used
4641: in a relative position rule. It is followed by a period and a <TT>Height</TT>
4642: or <TT>Width</TT> keyword, depending on the extent being referred to. Next
4643: comes the relation between the extent being defined and the extent of the
4644: reference box. This relation can be either a percentage or a difference.</P>
4645: <P>
4646: A percentage is indicated by a star (the multiplication symbol) followed by
4647: the numeric percentage value (which may be greater than or less than 100) and
4648: the percent (`%') character. A difference is simply indicated by a signed
4649: difference.</P>
4650: <P>
4651: If the rule appears in the presentation rules of a numeric attribute, the
4652: percentage value can be replaced by the name of the attribute. This attribute
4653: is then used as a percentage. The attribute can also be used as part of a <A
4654: href="#distance">difference</A>.</P>
4655: <P>
4656: Just as with a fixed extent, a relative extent rule can end with the
4657: <TT>Min</TT> keyword, which signifies that the extent is a minimum and that,
4658: if the contents of the box require it, a larger extent is possible.</P>
4659: <P>
4660: A special case of relative extent rules is:</P>
4661: <PRE>
4662: Height : Enclosed . Height;
4663: </PRE>
4664: <P>
4665: or</P>
4666: <PRE>
4667: Width : Enclosed . Width;
4668: </PRE>
4669: <P>
1.5 cvs 4670: which specifies that the box has a height (or width) such that it encloses all
4671: the boxes which it contains, excluding boxes having a rule <TT>VertOverflow:
4672: Yes;</TT> or <TT>HorizOverflow: Yes;</TT>.</P>
1.1 cvs 4673: <P>
4674: <STRONG>Note:</STRONG> character strings (type <TT>TEXT_UNIT</TT>) generally
4675: must use the sum of the widths of the characters which compose them as their
4676: width, which is expressed by the rule:</P>
4677: <PRE>
4678: TEXT_UNIT :
1.6 cvs 4679: Width : Enclosed . Width;
1.1 cvs 4680: </PRE>
4681: <P>
1.5 cvs 4682: If this rule is not the default <TT>Width</TT> rule, it must be given
4683: explicitly in the <TT>RULES</TT> section which defines the presentation rules
4684: of the logical elements.</P>
1.1 cvs 4685: <PRE>
4686: 'Height' ':' Extent
4687: 'Width' ':' Extent
4688: Extent = Reference '.' HeightWidth [ Relation ]
4689: [ 'Min' ] / ...
4690: HeightWidth ='Height' / 'Width' .
4691: Relation ='*' ExtentAttr '%' / Distance .
4692: ExtentAttr = ExtentVal / AttrID .
4693: ExtentVal = NUMBER .
4694: </PRE>
4695: <BLOCKQUOTE class="example">
4696: <P>
4697: <STRONG>Example:</STRONG></P>
4698: <P>
1.3 cvs 4699: Completing the <A href="#expos1">above example</A>, it is possible to specify
4700: that the report takes its width from the editing window and its height from the
4701: size of its contents (this can obviously be greater than that of the
1.1 cvs 4702: window):</P>
4703: <PRE>
4704: Report : BEGIN
4705: Width : Enclosing . Width;
4706: Height : Enclosed . Height;
4707: ...
4708: END;
4709: </PRE>
4710: <P>
1.3 cvs 4711: Then, the following rules make the title occupy 60% of the width of the report
4712: (which is that of the window) and is broken into centered lines of this width
1.6 cvs 4713: (see the <A href="#sectc4222"><TT>Line</TT> rule</A>).</P>
1.1 cvs 4714: <PRE>
4715: Title : BEGIN
4716: Width : Enclosing . Width * 60%;
4717: Height : Enclosed . Height;
4718: Line;
4719: Adjust : VMiddle;
4720: ...
4721: END;
4722: </PRE>
4723: <P>
1.5 cvs 4724: The summary occupy the entire width of the window, with the exception of a 2 cm
1.1 cvs 4725: margin reserved by the horizontal position rule:</P>
4726: <PRE>
4727: Summary : BEGIN
4728: Width : Enclosing . Width - 2 cm;
4729: Height : Enclosed . Height;
4730: ...
4731: END;
4732: </PRE>
4733: <P>
4734: This set of rules, plus the <A href="#reportexample">position rules given
4735: above</A>, produce the layout of boxes shown in the following<A
4736: href="#posdim">figure</A>.</P>
4737:
4738: <DIV class="figure">
4739: <HR>
4740: <PRE>
4741: -------------------------------------------------------------
4742: | Window and Report ^ |
4743: | | 1 line |
4744: | v |
4745: | ------------------------------------- |
4746: | | | |
4747: : 20% : Title : 20% :
4748: :<--------->: :<--------->:
4749: : : 60% : :
4750: : :<--------------------------------->: :
4751: | | | |
4752: | ------------------------------------- |
4753: | ^ |
4754: | | 1.5 line |
4755: | | |
4756: | v |
4757: | ---------------------------------------------------|
4758: | 2 cm | |
4759: |<------>| Summary |
4760: : : :
4761: </PRE>
4762: <P align=center>
4763: <EM><A name="posdim">Box position and extent</A><EM></EM></EM></P>
4764: <HR>
4765: </DIV>
4766: </BLOCKQUOTE>
4767: </DIV>
4768:
4769: <DIV class="subsubsection">
1.6 cvs 4770: <H4><A name=sectd42193>Elastic extents</A></H4>
1.1 cvs 4771:
4772: <P>
4773: The last type of extent is the elastic extent. Either one or both extents can
4774: be elastic. A box has an elastic extent when two opposite sides are linked by
4775: distance constraints to two sides or axes of other boxes.</P>
4776: <P>
4777: One of the sides of the elastic box is linked by a position rule
4778: (<TT>VertPos</TT> or <TT>HorizPos</TT>) to a neighboring box. The other side
4779: is link to another box by a <TT>Height</TT> or <TT>Width</TT> rule, which
4780: takes the same form as the position rule. For the elastic box itself, the
4781: notions of sides (left or right, top or bottom) are fuzzy, since the movement
4782: of either one of the two reference boxes can, for example, make the left side
4783: of the elastic box move to the right of its right side. This is not
4784: important. The only requirement is that the two sides of the elastic box used
4785: in the position and extent rule are opposite sides of the box.</P>
4786: <PRE>
1.6 cvs 4787: 'Height' ':' Extent
4788: 'Width' ':' Extent
4789: Extent = HPos / VPos / ...
1.1 cvs 4790: </PRE>
4791: <BLOCKQUOTE class="example">
4792: <P>
4793: <STRONG>Example:</STRONG></P>
4794: <P>
1.3 cvs 4795: Suppose we want to draw an elastic arrow or line between the middle of the
4796: bottom side of box A and the upper left corner of box B. To do this, we would
4797: define a graphics box whose upper left corner coincides with the middle of the
4798: bottom side of A (a position rule) and whose lower right corner coincides with
4799: with the upper left corner of B (dimension rules):</P>
1.1 cvs 4800: <PRE>
4801: LinkedBox :
4802: BEGIN
1.6 cvs 4803: VertPos : Top = A .Bottom;
1.1 cvs 4804: HorizPos : Left = A . VMiddle;
1.6 cvs 4805: Height : Bottom = B . Top;
4806: Width : Right = B . Left;
1.1 cvs 4807: END;
4808: </PRE>
4809: </BLOCKQUOTE>
4810: <BLOCKQUOTE class="example">
4811: <P>
4812: <STRONG>Example:</STRONG></P>
4813: <P>
1.3 cvs 4814: The element SectionTitle creates a presentation box called SectionNum which
4815: contains the number of the section. Suppose we want to align the SectionNum
4816: and SectionTitle horizontally, have the SectionNum take its width from its
4817: contents (the section number), have the SectionTitle box begin 0.5 cm to the
4818: right of the SectionNum box and end at the right edge of its enclosing box.
4819: This would make the SectionTitle box elastic, since its width is defined by the
4820: position of its left and right sides. The following rules produce this
1.1 cvs 4821: effect:</P>
4822: <PRE>
4823: SectionNum :
4824: BEGIN
4825: HorizPos : Left = Enclosing . Left;
4826: Width : Enclosed . Width;
4827: ...
4828: END;
4829:
4830: SectionTitle :
4831: BEGIN
4832: HorizPos : Left = SectionNum . Right + 0.5 cm;
4833: Width : Right = Enclosing . Right;
4834: ...
4835: END;
4836: </PRE>
4837: </BLOCKQUOTE>
4838: </DIV>
4839: </DIV>
4840:
4841: <DIV class="subsection">
1.6 cvs 4842: <H3><A name="sectc4220">Overflow</A></H3>
1.1 cvs 4843:
4844: <P>
4845: A boxes corresponding to a structural element normally contain all boxes
4846: corresponding to the elements of its subtree. However, in some cases, it
4847: could be necessary to allow a box to jut out from its parent box. Two
4848: presentation rules indicate that such an overflow is allowed, one for
4849: horizontal overflow, one for vertical overflow.</P>
4850: <P>
4851: Each of these rules is expressed by a keyword followed by a colon and the
4852: keyword <TT>Yes</TT> or <TT>No</TT>.</P>
4853: <PRE>
4854: 'VertOverflow' ':' Boolean /
4855: 'HorizOverflow' ':' Boolean .
4856: Boolean = 'Yes' / 'No' .
4857: </PRE>
4858: </DIV>
4859:
4860: <DIV class="subsection">
1.6 cvs 4861: <H3><A name=sectc4221>Inheritance</A></H3>
1.1 cvs 4862:
4863: <P>
4864: A presentation parameter can be defined by reference to the same parameter of
4865: another box in the tree of boxes. These structural links are expressed by
4866: kinship. The reference box can be that of the element immediately above in
4867: the structure (<TT>Enclosing</TT>), two levels above (<TT>GrandFather</TT>),
4868: immediately below (<TT>Enclosed</TT>) or immediately before
4869: (<TT>Previous</TT>). In the case of a presentation box, and only in that
4870: case, the reference box may be the element which created the presentation box
4871: (<TT>Creator</TT>).</P>
4872: <P>
4873: Kinship is expressed in terms of the logical structure of the document and not
4874: in terms of the tree of boxes. The presentation box cannot transmit any of
4875: their parameters by inheritance; only structured element boxes can do so. As
4876: an example, consider an element B which follows an element A in the logical
4877: structure. The element B creates a presentation box P in front of itself,
1.6 cvs 4878: using the <TT>CreateBefore</TT> rule (see the <A href="#sectc4232">creation
1.1 cvs 4879: rules</A>). If element B's box inherits its character style using the
4880: <TT>Previous</TT> kinship operation, it gets its character style from A's box,
4881: not from P's box. Inheritance works differently for positions and extents,
4882: which can refer to presentation boxes.</P>
4883: <P>
4884: The inherited parameter value can be the same as that of the reference box.
4885: This is indicated by an equals sign. However, for numeric parameters, a
4886: different value can be obtained by adding or subtracting a number from the
4887: reference box's parameter value. Addition is indicated by a plus sign before
4888: the number, while subtraction is specified with a minus sign. The value of a
4889: parameter can also be given a maximum (if the sign is a plus) or minimum (if
4890: the sign is a minus).</P>
4891: <P>
4892: If the rule is being applied to a numeric attribute, the number to add or
4893: subtract can be replaced by the attribute name. The value of a maximum or
4894: minimum may also be replaced by an attribute name. In these cases, the value
4895: of the attribute is used.</P>
4896: <PRE>
1.6 cvs 4897: Inheritance = Kinship InheritedValue .
4898: Kinship ='Enclosing' / 'GrandFather' / 'Enclosed' /
4899: 'Previous' / 'Creator' .
1.1 cvs 4900: InheritedValue ='+' PosIntAttr [ 'Max' maximumA ] /
1.6 cvs 4901: '-' NegIntAttr [ 'Min' minimumA ] /
4902: '=' .
4903: PosIntAttr = PosInt / AttrID .
4904: PosInt = NUMBER .
4905: NegIntAttr = NegInt / AttrID .
4906: NegInt = NUMBER .
4907: maximumA = maximum / AttrID .
4908: maximum = NUMBER .
4909: minimumA = minimum / AttrID .
4910: minimum = NUMBER .
1.1 cvs 4911: </PRE>
4912: <P>
4913: The parameters which can be obtained by inheritance are justification,
4914: hyphenation, interline spacing, character font (font family), font style, font
4915: size, visibility, indentation, underlining, alignment of text, stacking order
4916: of objects, the style and thickness of lines, fill pattern and the colors of
4917: lines and characters.</P>
4918: </DIV>
4919:
4920: <DIV class="subsection">
1.6 cvs 4921: <H3><A name=sectc4222>Line breaking</A></H3>
1.1 cvs 4922:
4923: <P>
4924: The <TT>Line</TT> rule specifies that the contents of the box should be broken
4925: into lines: the boxes included in the box to which this rule is attached are
4926: displayed one after the other, from left to right, with their horizontal
4927: reference axes aligned so that they form a series of lines. The length of
4928: these lines is equal to the width of the box to which the <TT>Line</TT> rule
4929: is attached.</P>
4930: <P>
4931: When an included box overflows the current line, it is either carried forward
4932: to the next line, cur, or left the way it is. The <A
1.6 cvs 4933: href="#sectc4223"><TT>LineBreak</TT> rule</A> is used to allow or prevent the
1.1 cvs 4934: breaking of included boxes. If the included box is not breakable but is
4935: longer than the space remaining on the line, it is left as is. When a
4936: character string box is breakable, the line is broken between words or, if
1.6 cvs 4937: necessary, by <A href="#sectd42225">hyphenating a word</A>. When a
1.1 cvs 4938: compound box is breakable, the box is transparent in regard to line breaking.
4939: The boxes included in the compound box are treated just like included boxes
4940: which have the <TT>LineBreak</TT> rule. Thus, it is possible to traverse a
4941: complete subtree of boxes to line break the text leaves of a complex
4942: structure.</P>
4943: <P>
4944: The relative position rules of the included boxes are ignored, since the boxes
4945: will be placed according to the line breaking rules.</P>
4946: <P>
4947: The <TT>Line</TT> rule does not have a parameter. The characteristics of the
4948: lines that will be constructed are determined by the <TT>LineSpacing</TT>,
4949: <TT>Indent</TT>, <TT>Adjust</TT>, <TT>Justify</TT>, and <TT>Hyphenate</TT>
1.6 cvs 4950: rules. Moreover, the <A href="#insectd42226"><TT>Inline</TT> rule</A> permits
1.1 cvs 4951: the exclusion of certain elements from the line breaking process.</P>
4952: <P>
4953: When the <TT>Line</TT> rule appears in the rules sequence of a non-primary
4954: view, it applies only to that view, but when the <TT>Line</TT> rule appears in
4955: the rules sequence of the primary view, it also applies to the other views by
4956: default, except for those views which explicitly invoke the <TT>NoLine</TT>
4957: rule. Thus, the <TT>NoLine</TT> rule can be used in a non-primary view to
4958: override the primary view's <TT>Line</TT> rule. The <TT>NoLine</TT> rule must
4959: not be used with the primary view because the absence of the <TT>Line</TT>
4960: rule has the same effect. Like the <TT>Line</TT> rule, the <TT>NoLine</TT>
4961: rule does not take any parameters.</P>
4962: <PRE>
1.6 cvs 4963: 'Line'
4964: 'NoLine'
1.1 cvs 4965: </PRE>
4966:
4967: <DIV class="subsubsection">
1.6 cvs 4968: <H4><A name=sectd42221>Line spacing</A></H4>
1.1 cvs 4969:
4970: <P>
4971: The <TT>LineSpacing</TT> rule defines the line spacing to be used in the line
4972: breaking process. The line spacing is the distance between the baselines
4973: (horizontal reference axis) of the successive lines produced by the
4974: <TT>Line</TT> rule. The value of the line spacing can be specified as a
4975: constant or by inheritance. It is expressed in any of the available <A
1.6 cvs 4976: href="#sectc4217">distance units</A>.</P>
1.1 cvs 4977: <P>
4978: Inheritance allows the value to be obtained from a relative in the structure
4979: tree, either without change (an equals sign appears after the inheritance
4980: keyword), with a positive difference (a plus sign), or a negative difference
4981: (a minus sign). When the rule uses a difference, the value of the difference
1.6 cvs 4982: follows the sign and is expressed as a <A href="#sectc4217">distance</A>.</P>
1.1 cvs 4983: <PRE>
1.6 cvs 4984: 'LineSpacing' ':' DistOrInherit
4985: DistOrInherit = Kinship InheritedDist / Distance .
1.1 cvs 4986: InheritedDist = '=' / '+' AbsDist / '-' AbsDist .
4987: </PRE>
4988: <P>
4989: When the line spacing value (or its difference from another element) is
4990: expressed in relative units, it changes with the size of the characters. Thus,
4991: when a larger font is chosen for a part of the document, the line spacing of
4992: that part expands proportionally. In contrast, when the line spacing value is
4993: expressed in absolute units (centimeters, inches, typographer's points), it is
4994: independent of the characters, which permits the maintenance of a consistent
4995: line spacing, whatever the character font. Either approach can be taken,
4996: depending on the desired effect.</P>
4997: </DIV>
4998:
4999: <DIV class="subsubsection">
1.6 cvs 5000: <H4><A name=sectd42222>First line indentation</A></H4>
1.1 cvs 5001:
5002: <P>
5003: The <TT>Indent</TT> rule is used to specify the indentation of the first line
5004: of the elements broken into lines by the <TT>Line</TT> function. The
5005: indentation determines how far the first line of the element is shifted with
5006: respect to the other lines of the same element. It can be specified as a
5007: constant or by inheritance. The constant value is a positive integer (shifted
5008: to the right; the sign is optional), a negative integer (shifted to the left)
1.6 cvs 5009: or zero (no shift). All available <A href="#sectc4217">units</A> can be
1.1 cvs 5010: used.</P>
5011: <P>
5012: Indentation can be defined for any box, regardless of whether the box is line
5013: broken, and transmitted by inheritance to elements that are line broken. The
5014: size of the indentation is specified in the same manner as the <A
1.6 cvs 5015: href="#sectd42221">line spacing</A>.</P>
1.1 cvs 5016: <PRE>
1.6 cvs 5017: 'Indent' ':' DistOrInherit
1.1 cvs 5018: </PRE>
5019: </DIV>
5020:
5021: <DIV class="subsubsection">
1.6 cvs 5022: <H4><A name=sectd42223>Alignment</A></H4>
1.1 cvs 5023:
5024: <P>
5025: The alignment style of the lines constructed during line breaking is defined
5026: by the <TT>Adjust</TT> rule. The alignment value can be a constant or
5027: inherited. A constant value is specified by a keyword:</P>
5028: <UL>
5029: <LI><TT>Left</TT>: at the left edge,
5030: <LI><TT>Right</TT>: at the right edge,
5031: <LI><TT>VMiddle</TT>: centered
1.2 cvs 5032: <LI><TT>LeftWithDots</TT>: at the left edge with a dotted line filling out the
1.1 cvs 5033: last line up to the right edge of the line breaking box.
5034: </UL>
5035: <P>
5036: An inherited value can only be the same as that of the reference box and is
5037: specified by a kinship keyword followed by an equals sign.</P>
5038: <PRE>
1.6 cvs 5039: 'Adjust' ':' AlignOrInherit
1.1 cvs 5040: AlignOrInherit = Kinship '=' / Alignment .
5041: Alignment = 'Left' / 'Right' / 'VMiddle' /
5042: 'LeftWithDots' .
5043: </PRE>
5044: </DIV>
5045:
5046: <DIV class="subsubsection">
1.6 cvs 5047: <H4><A name=sectd42224>Justification</A></H4>
1.1 cvs 5048:
5049: <P>
5050: The <TT>Justify</TT> rule indicates whether the lines contained in the box and
5051: produced by a <TT>Line</TT> rule should be extended horizontally to occupy the
5052: entire width of their enclosing box. The first and last lines are treated
5053: specially: the position of the beginning of the first line is fixed by the
5054: <TT>Indent</TT> rule and last line is not extended. The justification
5055: parameter defined by this rule takes a boolean value, which can be a constant
5056: or inherited. A constant boolean value is expressed by either the
5057: <TT>Yes</TT> or the <TT>No</TT> keyword. An inherited value can only be the
5058: same as that of the reference box and is specified by a kinship keyword
5059: followed by an equals sign.</P>
5060: <PRE>
1.6 cvs 5061: 'Justify' ':' BoolInherit
1.1 cvs 5062: BoolInherit = Boolean / Kinship '=' .
1.6 cvs 5063: Boolean ='Yes' / 'No' .
1.1 cvs 5064: </PRE>
5065: <P>
5066: When the lines are justified, the alignment parameter specified in the
5067: <TT>Adjust</TT> rule has no influence, other than on the last line produced.
5068: This occurs because, when the other are extended to the limits of the box, the
5069: alignment style is no longer perceptible.</P>
5070: <BLOCKQUOTE class="example">
5071: <P>
5072: <STRONG>Example:</STRONG></P>
5073: <P>
1.3 cvs 5074: An important use of inheritance is to vary the characteristics of lines for an
5075: element type (for example, Paragraph) according to the enclosing environment
5076: (for example, Summary or Section), and thus obtain different line breaking
5077: styles for the same elements when they appear in different environments. The
5078: following rules specify that paragraphs inherit their alignment, justification,
1.1 cvs 5079: and line spacing:</P>
5080: <PRE>
5081: Paragraph :
5082: BEGIN
5083: Justify : Enclosing = ;
5084: LineSpacing : Enclosing = ;
5085: Adjust : Enclosing =;
5086: Line;
5087: END;
5088: </PRE>
5089: <P>
1.5 cvs 5090: If the alignment, justification, and line spacing of the Section and Summary
1.1 cvs 5091: elements is fixed:</P>
5092: <PRE>
5093: Section :
5094: BEGIN
5095: Adjust : Left;
5096: Justify : Yes;
5097: LineSpacing : 1;
5098: END;
5099: Summary :
5100: BEGIN
5101: Adjust : VMiddle;
5102: Justify : No;
5103: LineSpacing : 1.3;
5104: END;
5105: </PRE>
5106: <P>
1.4 cvs 5107: then the paragraphs appearing in sections are justified with a simple line
5108: spacing while those appearing in summaries are centered and not justified and
5109: have a larger line spacing. These are nevertheless the very same type of
1.1 cvs 5110: paragraph defined in the logical structure schema.</P>
5111: </BLOCKQUOTE>
5112: </DIV>
5113:
5114: <DIV class="subsubsection">
1.6 cvs 5115: <H4><A name=sectd42225>Hyphenation</A></H4>
1.1 cvs 5116:
5117: <P>
5118: The <TT>Hyphenate</TT> rule indicates whether or not words should be broken by
5119: hyphenation at the end of lines. It affects the lines produced by the
5120: <TT>Line</TT> rule and contained in the box carrying the <TT>Hyphenate</TT>
5121: rule.</P>
5122: <P>
5123: The hyphenation parameter takes a boolean value, which can be either constant
5124: or inherited. A constant boolean value is expressed by either the
5125: <TT>Yes</TT> or the <TT>No</TT> keyword. An inherited value can only be the
5126: same as that of the reference box and is specified by a kinship keyword
5127: followed by an equals sign.</P>
5128: <PRE>
5129: 'Hyphenate' ':' BoolInherit
5130: BoolInherit = Boolean / Kinship '=' .
5131: Boolean = 'Yes' / 'No' .
5132: </PRE>
5133: </DIV>
5134:
5135: <DIV class="subsubsection">
1.6 cvs 5136: <H4><A name=sectd42226>Avoiding line breaking</A></H4>
1.1 cvs 5137:
5138: <P>
5139: The <TT>InLine</TT> rule is used to specify that a box that would otherwise
5140: participate in line breaking asked for by the <TT>Line</TT> rule of an
5141: enclosing box, instead avoids the line breaking process and positions itself
5142: according to the <TT>HorizPos</TT> and <TT>VertPos</TT> rules that apply to
5143: it. When the <TT>InLine</TT> rule applies to a box which would not be line
5144: broken, it has no effect.</P>
5145: <P>
5146: The rule is expressed by the <TT>InLine</TT> keyword followed by a colon and
5147: the keyword <TT>Yes</TT>, if the box should participate in line breaking, or
5148: the keyword <TT>No</TT>, if it should not. This is the only form possible:
5149: this rule cannot be inherited. Moreover, it can only appear in the rules of
5150: the primary view and applies to all views defined in the presentation
5151: schema.</P>
5152: <PRE>
5153: 'InLine' ':' Boolean .
5154: Boolean = 'Yes' / 'No' .
5155: </PRE>
5156: <BLOCKQUOTE class="example">
5157: <P>
5158: <STRONG>Example:</STRONG></P>
5159: <P>
5160: Suppose the structure schema defines a logical attribute
1.3 cvs 5161: called <TT>New</TT> which is used to identify the passages in a document which
1.5 cvs 5162: were recently modified. It would be nice to have the presentation schema make
5163: a bar appear in the left margin next to each passage having
1.3 cvs 5164: the <TT>New</TT> attribute. A new passage can be an entire element, such as a
5165: paragraph or section, or it can be some words in the middle of a paragraph. To
5166: produce the desired effect, the <TT>New</TT> attribute is given a creation rule
5167: which generates a <TT>VerticalBar</TT> presentation box.</P>
1.1 cvs 5168: <P>
5169: When the <TT>New</TT> attribute is attached to a character string which is
5170: inside a line broken element (inside a paragraph, for example), the bar is one
5171: of the elements which participates in line breaking and it is placed normally
5172: in the current line, at the end of the character string which has the
5173: attribute. To avoid this, the <TT>InLine</TT> rule is used in the following
5174: way:</P>
5175: <PRE>
5176: BOXES
5177: VerticalBar:
5178: BEGIN
5179: Content: Graphics 'l';
5180: HorizPos: Left = Root . Left;
5181: VertPos: Top = Creator . Top;
5182: Height: Bottom = Creator . Bottom;
5183: Width: 1 pt;
5184: InLine: No;
5185: ...
5186: END;
5187: ...
5188: ATTRIBUTES
5189: Nouveau:
5190: BEGIN
5191: CreateAfter(VerticalBar);
5192: END;
5193: </PRE>
5194: </BLOCKQUOTE>
5195: </DIV>
5196: </DIV>
5197:
5198: <DIV class="subsection">
1.6 cvs 5199: <H3><A name=sectc4223>Page breaking and line breaking conditions</A></H3>
1.1 cvs 5200:
5201: <P>
5202: Pages are constructed by the editor in accordance with the model specified by
1.6 cvs 5203: a <A href="#sectc4233"><TT>Page</TT> rule</A>. The page model describes only the
1.1 cvs 5204: composition of the pages but does not give any rules for breaking different
5205: element types across pages. Now, it is possible that certain elements must
5206: not be cut by page breaks, while others can be cut anywhere. The
5207: <TT>PageBreak</TT>, <TT>NoBreak1</TT>, and <TT>NoBreak2</TT> rules are used to
5208: specify the conditions under which each element type can be cut.</P>
5209: <P>
5210: The <TT>PageBreak</TT> rule is used to indicate whether or not the box can be
5211: cut during the construction of pages. If cutting is authorized, the box can
5212: be cut, with one part appearing at the bottom of a page and the other part
5213: appearing at the top of the next page. The rule is formed by the
5214: <TT>PageBreak</TT> keyword followed by a colon and a constant boolean value
5215: (<TT>Yes</TT> or <TT>No</TT>). This is the only form possible: this rule
5216: cannot be inherited. Moreover, it can only appear in the rules of the primary
5217: view and applies to all views defined in the presentation schema.</P>
5218: <P>
5219: Whether objects can be cut by line breaks can be controlled in a similar way
5220: using the <TT>LineBreak</TT> rule. This rule allows the specification of
5221: whether or not the box can be cut during the construction of lines. If
5222: cutting is authorized, the box can be cut, with one part appearing at the end
5223: of a line and the other part appearing at the beginning of the next line. The
5224: rule is formed by the <TT>LineBreak</TT> keyword followed by a colon and a
5225: constant boolean value (<TT>Yes</TT> or <TT>No</TT>). This is the only form
5226: possible: this rule cannot be inherited. Moreover, it can only appear in the
5227: rules of the primary view and applies to all views defined in the presentation
5228: schema.</P>
5229: <PRE>
5230: 'PageBreak' ':' Boolean .
5231: 'LineBreak' ':' Boolean .
5232: Boolean = 'Yes' / 'No' .
5233: </PRE>
5234: <P>
5235: When a box can be cut by a page break, it is possible that a page break will
5236: fall an inappropriate spot, creating, for example, a widow or orphan, or
5237: separating the title of a section from the first paragraph of the section. The
5238: <TT>NoBreak1</TT> and <TT>NoBreak2</TT> rules are used to avoid this. They
1.12 cvs 5239: specify that the box of the element to which they apply cannot be cut within
5240: a certain zone at the top (<TT>NoBreak1</TT> rule) or at the bottom
1.1 cvs 5241: (<TT>NoBreak2</TT> rule). These two rules specify the height of the zones in
5242: which page breaks are prohibited.</P>
5243: <P>
5244: The <TT>NoBreak1</TT> and <TT>NoBreak2</TT> rules give the height of the zone
5245: in which page breaking is prohibited. The height is given as a constant value
1.6 cvs 5246: using any of the <A href="#sectc4217">available units</A>, absolute or
1.1 cvs 5247: relative. The value may not be inherited.</P>
5248: <PRE>
5249: 'NoBreak1' ':' AbsDist .
5250: 'NoBreak2' ':' AbsDist .
5251: </PRE>
5252: <BLOCKQUOTE class="example">
5253: <P>
5254: <STRONG>Example:</STRONG></P>
5255: <P>
1.3 cvs 5256: The following rules prevent widows and orphans in a paragraph:</P>
1.1 cvs 5257: <PRE>
5258: Paragraph :
5259: BEGIN
5260: NoBreak1 : 2;
5261: NoBreak2 : 2;
5262: END;
5263: </PRE>
5264: <P>
1.3 cvs 5265: This rule prevents a section title from becoming separated from the first
5266: paragraph of the section by prohibiting page breaks at the beginning of the
1.1 cvs 5267: section rule:</P>
5268: <PRE>
5269: Section :
5270: NoBreak1 : 1.5 cm;
5271: </PRE>
5272: <P>
5273: Finally, this rule prevents a figure from being page broken in any way:</P>
5274: <PRE>
5275: Figure :
5276: PageBreak : No;
5277: </PRE>
5278: </BLOCKQUOTE>
5279: <P>
5280: The Thot editor constructs the document images displayed on the screen
5281: dynamically. As the user moves in the document or makes the document scroll
5282: in a window, the editor constructs the image to be displayed in little bits,
5283: filling the gaps which are produced in the course of these operations. It
5284: stops filling in the image when an element reaches the edge of the window in
5285: which the gap appears. If the appearance of the document is complex, it is
5286: possible that the image in incomplete, even though the edge of the window was
5287: reached. For example, an element might need to be presented to the side of
5288: the last element displayed, but its image was not constructed. The user will
5289: not know whether the element is really absent or if its image has simply not
5290: been constructed.</P>
5291: <P>
5292: The <TT>Gather</TT> rule is used to remedy this problem. When the rule
5293: <TT>Gather : Yes;</TT> is associated with an element type, the image of such
5294: elements is constructed as a block by the editor: it is never split up.</P>
5295: <P>
5296: The <TT>Gather</TT> rule may not appear in the <A
1.6 cvs 5297: href="#sectc427">default rules</A>. Elements which do not have the
1.1 cvs 5298: <TT>Gather</TT> rule are considered susceptible to being split up during
5299: display. Thus, it is not necessary to use the <TT>Gather : No;</TT> form.
5300: This rule must be used prudently and only for those elements which truly need
5301: it. If used incorrectly, it can pointlessly increase the size of the image
5302: constructed by the editor and lead to excessive memory consumption by the
5303: editor.</P>
5304: <P>
5305: Like the <TT>PageBreak</TT> and <TT>LineBreak</TT> rules, the <TT>Gather</TT>
5306: rule can only appear in rules of the primary view and applies to all views
5307: defined in the presentation schema.</P>
5308: <PRE>
5309: 'Gather' ':' Boolean .
5310: </PRE>
5311: </DIV>
5312:
5313: <DIV class="subsection">
1.6 cvs 5314: <H3><A name=sectc4224>Visibility</A></H3>
1.1 cvs 5315:
5316: <P>
5317: The visibility parameter is used to control which elements should or should
5318: not be displayed, based on context. An element can have different
5319: visibilities in different views. If an element's visibility is zero for a
5320: view, that element is not displayed in that view and does not occupy any space
5321: (its extents are zero).</P>
5322: <P>
5323: Visibility takes non-negative integer values (positive or zero). If values
5324: greater than 1 are used, they allow the user to choose a degree of visibility
5325: and, thus, to see only those boxes whose visibility parameter exceeds a
5326: certain threshold. This gives the user control over the granularity of the
1.2 cvs 5327: displayed pictures.</P>
1.1 cvs 5328: <P>
5329: The visibility parameter can be defined as a constant or by inheritance. If
5330: defined by inheritance, it cannot be based on the value of the next or
5331: previous box. Visibility can only be inherited from above.</P>
5332: <P>
5333: If it is a numeric attribute's presentation rule, the visibility can be
5334: specified by the attribute's name, in which case the value of the attribute is
5335: used.</P>
5336: <PRE>
1.6 cvs 5337: 'Visibility' ':' NumberInherit
1.1 cvs 5338: NumberInherit = Integer / AttrID / Inheritance .
1.6 cvs 5339: Integer = NUMBER .
1.1 cvs 5340: </PRE>
5341: <BLOCKQUOTE class="example">
5342: <P>
5343: <STRONG>Example:</STRONG></P>
5344: <P>
1.3 cvs 5345: Suppose that only <TT>Formula</TT> elements should be displayed in
5346: the <TT>MathView</TT> view. Then, the default rules should include:</P>
1.1 cvs 5347: <PRE>
5348: DEFAULT
5349: IN MathView Visibility:0;
5350: </PRE>
5351: <P>
1.3 cvs 5352: which makes all elements invisible in the <TT>MathView</TT> view. However, the
5353: <TT>Formula</TT> element also has a <TT>Visibility</TT> rule:</P>
1.1 cvs 5354: <PRE>
5355: Formula :
5356: IN MathView Visibility:5;
5357: </PRE>
5358: <P>
5359: which makes formulas, and only formulas, visible.</P>
5360: </BLOCKQUOTE>
5361: </DIV>
5362:
5363: <DIV class="subsection">
1.6 cvs 5364: <H3><A name=sectc4225>Character style parameters</A></H3>
1.1 cvs 5365:
5366: <P>
5367: Four parameters are used to determine which characters are used to display
5368: text. They are size, font, style, and underlining.</P>
5369:
5370: <DIV class="subsubsection">
1.6 cvs 5371: <H4><A name=sectd42251>Character size</A></H4>
1.1 cvs 5372:
5373: <P>
5374: The size parameter has two effects. First, it is used to specify the actual
1.6 cvs 5375: size and distance units for boxes defined in <A href="#sectc4217">relative
1.1 cvs 5376: units</A>. Second, it defines the size of the characters contained in the
5377: box.</P>
5378: <P>
5379: As a distance or length, the size can be expressed in abstract or absolute
5380: units. It can also be inherited. If it is not inherited, it is expressed
5381: simply as an integer followed by the <TT>pt</TT> keyword, which indicates that
5382: the size is expressed in typographer's points. The absence of the <TT>pt</TT>
5383: keyword indicates that it is in abstract units in which the value 1 represents
5384: the smallest size while the value 16 is the largest size. The relationship
5385: between these abstract sizes and the real character sizes is controlled by a
5386: table which can be modified statically or even dynamically during the
5387: execution of the Thot editor.</P>
5388: <P>
5389: If it is a numeric attribute's presentation rule, the value of the size
5390: parameter can be specified by the attribute's name, in which case the value of
5391: the attribute is used.</P>
5392: <P>
5393: <STRONG>Note:</STRONG> the only unit available for defining an absolute size
5394: is the typographer's point. Centimeters and inches may not be used.</P>
5395: <P>
5396: If the size is inherited, the rule must specify the relative from which to
5397: inherit and any difference from that relative's value. The difference can be
5398: expressed in either typographer's points or in abstract units. The maximum or
5399: minimum size can also be specified, but without specifying the type of unit:
5400: it is the same as was specified for the difference.</P>
5401: <P>
5402: In a numeric attribute's presentation rule, the difference in size can be
5403: indicated by the attribute's name, which means that the attribute's value
5404: should be used as the difference. The attribute can also be used as the
5405: minimum or maximum size.</P>
5406: <PRE>
5407: 'Size' ':' SizeInherit
5408: SizeInherit = SizeAttr [ 'pt' ] /
5409: Kinship InheritedSize .
5410: InheritedSize ='+' SizeAttr [ 'pt' ]
5411: [ 'Max' MaxSizeAttr ] /
5412: '-' SizeAttr [ 'pt' ]
5413: [ 'Min' MinSizeAttr ] /
5414: '=' .
1.6 cvs 5415: SizeAttr = Size / AttrID .
5416: Size = NUMBER .
5417: MaxSizeAttr = MaxSize / AttrID .
5418: MaxSize = NUMBER .
5419: MinSizeAttr = MinSize / AttrID .
5420: MinSize = NUMBER .
1.1 cvs 5421: </PRE>
5422: <BLOCKQUOTE class="example">
5423: <P>
5424: <STRONG>Example:</STRONG></P>
5425: <P>
5426: The rule</P>
5427: <PRE>
5428: Size : Enclosing - 2 pt Min 7;
5429: </PRE>
5430: <P>
1.3 cvs 5431: states that the character size is 2 points less than that of the enclosing box,
5432: but that it may not be less than 7 points, whatever the enclosing box's
1.1 cvs 5433: value.</P>
5434: <P>
5435: The following rules make the text of a report be displayed with medium-sized
5436: characters (for example, size 5), while the title is displayed with larger
5437: characters and the summary is displayed with smaller characters:</P>
5438: <PRE>
5439: Report :
5440: Size : 5;
5441: Title :
5442: Size : Enclosing + 2;
5443: Summary :
5444: Size : Enclosing - 1;
5445: </PRE>
5446: <P>
1.4 cvs 5447: Thus, the character sizes in the entire document can be changed by changing the
5448: size parameter of the Report element, while preserving the relationships
1.1 cvs 5449: between the sizes of the different elements.</P>
5450: </BLOCKQUOTE>
5451: </DIV>
5452:
5453: <DIV class="subsubsection">
1.6 cvs 5454: <H4><A name=sectd42252>Font and character style</A></H4>
1.1 cvs 5455:
5456: <P>
5457: The <TT>Font</TT> rule determines the font family to be used to display the
5458: characters contained in the box, while the <TT>Style</TT> rule determines
5459: their style. Thot recognizes three character fonts (Times, Helvetica, and
5460: Courier) and six styles: Roman, Italics, Bold, BoldItalics, Oblique, and
5461: BoldOblique.</P>
5462: <P>
5463: The font family and style can specified by a named constant or can be
5464: inherited. For the name of the font family only the first character is
5465: used.</P>
5466: <P>
5467: Only identical inheritance is allowed: the box takes the same font or style as
5468: the box from which it inherits. This is indicated by an equals sign after the
5469: kinship specification.</P>
5470: <BLOCKQUOTE class="example">
5471: <P>
5472: <STRONG>Example:</STRONG></P>
5473: <P>
1.3 cvs 5474: To specify that the summary uses the font family of the rest of the document,
1.1 cvs 5475: but in the italic style, the following rules are used:</P>
5476: <PRE>
5477: Summary :
5478: BEGIN
5479: Font : Enclosing =;
5480: Style : Italics;
5481: END;
5482: </PRE>
5483: </BLOCKQUOTE>
5484: </DIV>
5485:
5486: <DIV class="subsubsection">
1.6 cvs 5487: <H4><A name=sectd42253>Underlining</A></H4>
1.1 cvs 5488:
5489: <P>
5490: The <TT>Underline</TT> rule is used to specify if the characters contained in
5491: a box should have lines drawn on or near them. There are four underlining
5492: styles: <TT>Underlined</TT>, <TT>Overlined</TT>, <TT>CrossedOut</TT>, and
5493: <TT>NoUnderline</TT>. The <TT>Thickness</TT> rule specifies the thickness of
5494: the line, <TT>Thin</TT> or <TT>Thick</TT>.</P>
5495: <P>
5496: As with font family and style, only identical inheritance is allowed: the box
5497: has the same underlining type as the box from which it inherits the value.
5498: This is indicated by an equals sign after the kinship specification.</P>
5499: <PRE>
5500: 'Underline' ':' UnderLineInherit /
5501: 'Thickness' ':' ThicknessInherit /
5502:
5503: UnderLineInherit = Kinship '=' / 'NoUnderline' /
5504: 'Underlined' /
5505: 'Overlined' / 'CrossedOut' .
5506: ThicknessInherit = Kinship '=' / 'Thick' / 'Thin' .
5507: </PRE>
5508: </DIV>
5509: </DIV>
5510:
5511: <DIV class="subsection">
1.6 cvs 5512: <H3><A name=sectc4226>Stacking order</A></H3>
1.1 cvs 5513:
5514: <P>
5515: The <TT>Depth</TT> rule is used to define the stacking order of terminal boxes
5516: when multiple boxes at least partially overlap. This rule defines how the
5517: depth parameter, which is zero or a positive integer, is calculated. The
5518: depth parameter has a value for all boxes. For terminal boxes in the
5519: structure and for presentation boxes, the depth value is used during display
5520: and printing: the boxes with the lowest value overlap those with higher
5521: depths. For non-terminal boxes, the depth is not interpreted during display,
5522: but it is used to calculate the depth of terminal boxes by inheritance.</P>
5523: <P>
5524: Like most other rules, the depth rule is defined in the <A
1.6 cvs 5525: href="#sectc427">default rules</A> of each presentation schema. Thus,
1.1 cvs 5526: there is always a depth value, even when it is not necessary because there is
5527: no overlapping. To avoid useless operations, a zero value can be given to the
5528: depth parameter, which signifies that overlapping is never a problem.</P>
5529: <P>
1.6 cvs 5530: The depth rule has the same form as the <A href="#sectc4224">visibility rule</A>.
1.1 cvs 5531: It can be defined by inheritance or by a constant numeric value. When the rule
5532: is attached to a numeric attribute, it can take the value of that
5533: attribute.</P>
5534: <PRE>
5535: 'Depth' ':' NumberInherit
5536: </PRE>
5537: <BLOCKQUOTE class="example">
5538: <P>
5539: <STRONG>Example:</STRONG></P>
5540: <P>
1.3 cvs 5541: For a purely textual document, in which overlapping never poses a problem, a
1.5 cvs 5542: single default <TT>Depth</TT> rule in the presentation schema is
5543: sufficient:</P>
1.1 cvs 5544: <PRE>
5545: DEFAULT
5546: Depth : 0;
5547: ...
5548: </PRE>
5549: <P>
5550: To make the text of examples appear on a light blue background, a presentation
5551: box is defined:</P>
5552: <PRE>
5553: BOXES
5554: BlueBG :
5555: BEGIN
5556: Content : Graphics 'R';
5557: Background : LightBlue3;
5558: FillPattern: backgroundcolor;
5559: Depth : 2;
5560: ...
5561: END;
5562: </PRE>
5563: <P>
1.3 cvs 5564: and is created by the <TT>Example</TT> element, which has the rules:</P>
1.1 cvs 5565: <PRE>
5566: RULES
5567: Example :
5568: BEGIN
5569: CreateFirst (BlueBG);
5570: Depth : 1;
5571: ...
5572: END;
5573: </PRE>
5574: <P>
5575: In this way, the text of an example (if it inherits its depth from
1.5 cvs 5576: its ancestor) will be superimposed on a light blue background, and not
5577: the reverse).</P>
1.1 cvs 5578: </BLOCKQUOTE>
5579: </DIV>
5580:
5581: <DIV class="subsection">
1.13 cvs 5582: <H3><A name=sectc4227>Line style</A></H3>
1.1 cvs 5583:
5584: <P>
5585: The <TT>LineStyle</TT> rule determines the style of line which should be used
1.13 cvs 5586: to draw all the elements contained in the box and the box itself, if it has
5587: a <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>. The line style can be
1.1 cvs 5588: indicated by a name (<TT>Solid</TT>, <TT>Dashed</TT>, <TT>Dotted</TT>) or it
1.13 cvs 5589: can be inherited. All elements of the graphic base type are affected by this
1.1 cvs 5590: rule, but it can be attached to any box and transmitted by inheritance to the
1.13 cvs 5591: graphic elements. The border of elements having a
5592: <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>
5593: is drawn according to the line style specified by this rule.<P>
1.1 cvs 5594: Only identical inheritance is allowed: the box takes the same line style as
5595: the box from which it inherits. This is indicated by an equals sign after the
5596: kinship specification.</P>
5597: <PRE>
5598: 'LineStyle' ':' LineStyleInherit
5599: LineStyleInherit = Kinship '=' /
5600: 'Solid' / 'Dashed' / 'Dotted' .
5601: </PRE>
5602: <BLOCKQUOTE class="example">
5603: <P>
5604: <STRONG>Example:</STRONG></P>
5605: <P>
1.3 cvs 5606: To specify that, in Figures, the graphical parts should be drawn in solid
5607: lines, the Figure element is given a rule using the <TT>Solid</TT> name:</P>
1.1 cvs 5608: <PRE>
5609: Figure :
5610: LineStyle : Solid;
5611: </PRE>
5612: <P>
5613: and the elements composing figures are given an inheritance rule:</P>
5614: <PRE>
5615: LineStyle : Enclosing =;
5616: </PRE>
5617: </BLOCKQUOTE>
5618: </DIV>
5619:
5620: <DIV class="subsection">
1.6 cvs 5621: <H3><A name=sectc4228>Line thickness</A></H3>
1.1 cvs 5622:
5623: <P>
5624: The <TT>LineWeight</TT> rule determines the thickness of the lines of all
5625: graphical elements which appear in the box, no matter what their line style.
5626: Line thickness can be specified by a constant value or by inheritance. A
5627: constant value is a positive number followed by an optional unit specification
5628: (which is absent when using relative units). All available <A
1.6 cvs 5629: href="#sectc4217">distance units</A> can be used. Line thickness is expressed
5630: in the same way as <A href="#sectd42221">line spacing</A>.</P>
1.1 cvs 5631: <PRE>
5632: 'LineWeight' ':' DistOrInherit
5633: </PRE>
5634: <P>
1.13 cvs 5635: All elements of the graphic base type are affected by this rule, but it can
1.1 cvs 5636: be attached to any box and transmitted by inheritance to the graphic
1.13 cvs 5637: elements. The border of element having a <A href="#sectc4230a"><TT>ShowBox</TT>
5638: rule</A> is also drawn according to the thickness specified by this rule.</P>
1.1 cvs 5639: <BLOCKQUOTE class="example">
5640: <P>
5641: <STRONG>Example:</STRONG></P>
5642: <P>
1.3 cvs 5643: To specify that, in Figures, the graphical parts should be drawn with lines 0.3
1.1 cvs 5644: pt thick, the Figure element is given this rule:</P>
5645: <PRE>
5646: Figure :
5647: LineWeight : 0.3 pt;
5648: </PRE>
5649: <P>
5650: and the elements composing figures are given an inheritance rule:</P>
5651: <PRE>
5652: LineWeight : Enclosing =;
5653: </PRE>
5654: </BLOCKQUOTE>
5655: </DIV>
5656:
5657: <DIV class="subsection">
1.6 cvs 5658: <H3><A name=sectc4229>Fill pattern</A></H3>
1.1 cvs 5659:
5660: <P>
5661: The <TT>FillPattern</TT> rule determines the pattern used to fill closed
5662: graphical elements (circles, rectangles, etc.) which appear in the box. This
1.13 cvs 5663: rule also specifies the pattern used to fill the box associated with
5664: elements having a <A href="#sectc4230a"><TT>ShowBox</TT> rule<A>. This
1.1 cvs 5665: pattern can be indicated by a named constant or by inheritance. The named
5666: constant identifies one of the patterns available in Thot. The names of the
5667: available patterns are: nopattern, foregroundcolor, backgroundcolor, gray1,
5668: gray2, gray3, gray4, gray5, gray6, gray7, horiz1, horiz2, horiz3, vert1,
5669: vert2, vert3, left1, left2, left3, right1, right2, right3, square1, square2,
5670: square3, lozenge, brick, tile, sea, basket.</P>
5671: <P>
5672: Like the other rules peculiar to graphics, <TT>LineStyle</TT> and
5673: <TT>LineWeight</TT>, only elements of the graphic base type are affected by
5674: the <TT>FillPattern</TT> rule, but the rule can be attached to any box and
5675: transmitted by inheritance to the graphic elements. As with the other rules
5676: specific to graphics, only identical inheritance is allowed.</P>
5677: <P>
5678: The <TT>FillPattern</TT> rule can also be used to determine whether or not
1.12 cvs 5679: text characters, symbols and pictures should be colored. For these element
5680: types (text, symbols, and pictures), the only valid values are
5681: <TT>nopattern</TT>, <TT>foregroundcolor</TT>, and
5682: <TT>backgroundcolor</TT>. When <TT>FillPattern</TT> has the value
1.1 cvs 5683: <TT>backgroundcolor</TT>, text characters, symbols, and bitmaps are given the
1.6 cvs 5684: color specified by the <A href="#sectc4230"><TT>Background</TT> rule</A> which
1.1 cvs 5685: applies to these elements. When <TT>FillPattern</TT> has the value
5686: <TT>foregroundcolor</TT>, these same elements are given the color specified by
1.6 cvs 5687: the <A href="#sectc4230"><TT>Foreground</TT> rule</A> which applies to these
1.1 cvs 5688: elements. In all other case, text characters are not colored.</P>
5689: <PRE>
5690: 'FillPattern' ':' NameInherit
5691: </PRE>
5692: <BLOCKQUOTE class="example">
5693: <P>
5694: <STRONG>Example:</STRONG></P>
5695: <P>
1.3 cvs 5696: To specify that, in Figures, the closed graphical elements should be filled
5697: with a pattern resembling a brick wall, the Figure element is given this
1.1 cvs 5698: rule:</P>
5699: <PRE>
5700: Figure :
5701: FillPattern : brick;
5702: </PRE>
5703: <P>
5704: and the elements composing figures are given an inheritance rule:</P>
5705: <PRE>
5706: FillPattern : Enclosing =;
5707: </PRE>
5708: </BLOCKQUOTE>
5709: </DIV>
5710:
5711: <DIV class="subsection">
1.6 cvs 5712: <H3><A name=sectc4230>Colors</A></H3>
1.1 cvs 5713:
5714: <P>
5715: The <TT>Foreground</TT> and <TT>Background</TT> rules determine the foreground
1.13 cvs 5716: and background colors of the base elements which appear in the box. They also
5717: control the color of boxes associated with elements having a
5718: <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>. These
5719: colors can be specified with a named constant or by inheritance. The named
1.1 cvs 5720: constants specify one of the available colors in Thot. The available color
5721: names can be found in the file <TT>thot.color</TT>.</P>
5722: <P>
1.13 cvs 5723: The color rules affect the same way all base elements and elements having a
5724: <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>,
5725: no matter what their type (text, graphics, pictures,
5726: symbols). The color rules can be associated with any box and can be
5727: transmitted by inheritance to the base elements or the elements having
5728: a <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>. Like the preceding rules,
5729: only inheritance of the same value is allowed.</P>
1.1 cvs 5730: <PRE>
5731: 'Foreground' ':' NameInherit
5732: 'Background' ':' NameInherit
5733: </PRE>
5734: <P>
5735: <STRONG>Note:</STRONG> text colors only appear for text elements whose <A
1.6 cvs 5736: href="#sectc4229">fill pattern</A> does not prevent the use of color.</P>
1.1 cvs 5737: <BLOCKQUOTE class="example">
5738: <P>
5739: <STRONG>Example:</STRONG></P>
5740: <P>
1.3 cvs 5741: To specify that, in Figures, everything must be drawn in blue on a background
1.5 cvs 5742: of yellow, the Figure element is given these rules:</P>
1.1 cvs 5743: <PRE>
5744: Figure :
5745: BEGIN
5746: Foreground : Blue;
5747: Background : Yellow;
5748: Fillpattern : backgroundcolor;
5749: END;
5750: </PRE>
5751: <P>
5752: and the elements composing figures are given inheritance rules:</P>
5753: <PRE>
5754: Foreground : Enclosing =;
5755: Background : Enclosing =;
5756: FillPattern : Enclosing =;
5757: </PRE>
5758: </BLOCKQUOTE>
5759: </DIV>
5760:
5761: <DIV class="subsection">
1.13 cvs 5762: <H3><A name=sectc4230a>Background color and border</A></H3>
5763:
5764: <P>
5765: Boxes associated with structural elements are normally not visible, but it
5766: is possible to draw their border and/or to paint their area when it is needed.
5767: This is achieved by associating the <TT>ShowBox</TT> rule with the concerned
5768: element. This rule has no parameter and no value. It is simply written
5769: <TT>Showbox;</TT>. It is not inherited nor transmitted to any other element.
5770: It applies only to the element with which it is associated.</P>
5771: <PRE>
5772: 'ShowBox'
5773: </PRE>
5774: <P>
5775: When an element has a <TT>ShowBox</TT> rule, the border is drawn only if
5776: the <TT>LineWeight</TT> rule that applies to that element has a non-zero
5777: value (this value can be inherited). The color, style and thickness of the
5778: border are defined by the <TT>Foreground</TT>, <TT>LineStyle</TT>, and
5779: <TT>LineWeight</TT> rules that apply to the element.</P>
5780: <P>
5781: When an element has a <TT>ShowBox</TT> rule, the background of this element
5782: is paint only if the value of the <TT>FillPattern</TT> rule that applies to
5783: that element is not <TT>nopattern</TT>. The pattern and color(s) of the
5784: background are defined by the <TT>FillPattern</TT>, <TT>Background</TT>, and
5785: <TT>Foreground</TT> rules that apply to the element.</P>
5786: </DIV>
5787:
5788: <DIV class="subsection">
5789: <H3><A name=sectc4230b>Background pictures</A></H3>
5790:
5791: <P>
5792: The <TT>BackgroundPicture</TT> rule allows to display a picture as the
5793: background of an element. It has a single parameter, the file name of the
5794: picture. This is a string delimited by single quotes. If the first
5795: character in this string is '/', it is considered as an absolute path,
5796: otherwise the file is searched for along the schema directory
5797: path. This file may contain a picture in any format accepted by
5798: Thot (xbm, xpm, gif, jpeg, png, etc.)</P>
5799: <P>
5800: The <TT>BackgroundPicture</TT> and <TT>PictureMode</TT> rules apply only to
5801: the element with which they are associated. They are not inherited nor
5802: transmitted to children elements.</P>
5803: <P>
5804: The background picture has not always the same size as the element's box.
5805: There are diffrent ways to fill the element box with the picture. This is
5806: specified by the <TT>PictureMode</TT> rule, which should be associated to
5807: the same element. This rule may take one of the following values:</P>
5808: <DL>
5809: <DT><TT>NormalSize</TT>
5810: <DD>The picture is centered in the box, and clipped if it is too large.
5811:
5812: <DT><TT>Scale</TT>
5813: <DD>The picture is zoomed to fit the box size.
5814:
5815: <DT><TT>RepeatX</TT>
5816: <DD>The picture is repeated horizontally to fit the box width.
5817:
5818: <DT><TT>RepeatY</TT>
5819: <DD>The picture is repeated vertically to fit the box height.
5820:
5821: <DT><TT>RepeatXY</TT>
5822: <DD>The picture is repeated both horizontally and vertically to fill the box.
5823: </DL>
5824: <P>
5825: If an element has a <TT>BackgroundPicture</TT> rule and no <TT>PictureMode</TT>
5826: rule, the <TT>NormalSize</TT> value is assumed.</P>
5827: <PRE>
5828: 'BackgroundPicture' ':' FileName /
5829: 'PictureMode' ':' PictMode .
5830:
5831: FileName = STRING .
5832: PictMode = 'NormalSize' / 'Scale' / 'RepeatXY' / 'RepeatX' / 'RepeatY' .
5833: </PRE>
5834: <P>
5835: The <TT>BackgroundPicture</TT> and <TT>PictureMode</TT> rules apply only to
5836: the element with which they are associated. They are not inherited nor
5837: transmitted to children elements.</P>
5838: </DIV>
5839:
5840: <DIV class="subsection">
1.6 cvs 5841: <H3><A name=sectc4231>Presentation box content</A></H3>
1.1 cvs 5842:
5843: <P>
5844: The <TT>Content</TT> rule applies to presentation boxes. It indicates the
5845: content given to a box. This content is either a variable's value or a
1.6 cvs 5846: constant value. In the special case of <A href="#sectc4233">header or footer
1.1 cvs 5847: boxes</A>, the content can also be a structured element type.</P>
5848: <P>
5849: If the content is a constant, it can be specified, as in a variable
5850: declaration, either by the name of a constant declared in the <TT>CONST</TT>
5851: section or by direct specification of the type and value of the box's
5852: content.</P>
5853: <P>
5854: Similarly, if it is a variable, the name of a variable declared in
5855: <TT>VAR</TT> section can be given or the variable may be defined within
5856: parentheses. The content inside the parentheses has the same syntax as a <A
1.6 cvs 5857: href="#sectc426">variable declaration</A>.</P>
1.1 cvs 5858: <P>
5859: When the content is a structured element type, the name of the element type is
5860: given after the colon. In this case, the box's content is all elements of
5861: the named type which are designated by references which are part of the page
5862: on which the header or footer with this <TT>Content</TT> rule appears. Only
5863: associated elements can appear in a <TT>Content</TT> rule and the structure
5864: must provide references to these elements. Moreover, the box whose content
5865: they are must be a header or footer box generated by a page box of the primary
5866: view.</P>
5867: <PRE>
5868: 'Content' ':' VarConst
5869: VarConst = ConstID / ConstType ConstValue /
5870: VarID / '(' FunctionSeq ')' /
5871: ElemID .
5872: </PRE>
5873: <P>
5874: A presentation box can have only one <TT>Content</TT> rule, which means that
5875: the content of a presentation box cannot vary from view to view. However, such
5876: an effect can be achieved by creating several presentation boxes, each with
5877: different content and visible in different views.</P>
5878: <P>
5879: The <TT>Content</TT> rule also applies to elements defined as references in
5880: the structure schema. In this case, the content defined by the rule must be
5881: a constant. It is this content which appears on the screen or paper to
5882: represent references of the type to which the rule applies. A reference can
1.6 cvs 5883: have a <TT>Content</TT> rule or a <A href="#sectc4234"><TT>Copy</TT> rule</A>
1.1 cvs 5884: for each view. If neither of these rules appears, the reference is displayed
5885: as <TT>[*]</TT>, which is equivalent to the rule:</P>
5886: <PRE>
5887: Content: Text '[*]';
5888: </PRE>
5889: <BLOCKQUOTE class="example">
5890: <P>
5891: <STRONG>Example:</STRONG></P>
5892: <P>
1.3 cvs 5893: The content of the presentation box created to make the chapter number and
5894: section number appear before each section title can be defined by:</P>
1.1 cvs 5895: <PRE>
5896: BOXES
5897: SectionNumBox :
5898: BEGIN
5899: Content : NumSection;
5900: ...
5901: END;
5902: </PRE>
5903: <P>
1.5 cvs 5904: if the <TT>NumSection</TT> variable has been defined in the variable definition
1.3 cvs 5905: section of the presentation schema. Otherwise the <TT>Content</TT> would be
1.1 cvs 5906: written:</P>
5907: <PRE>
5908: BOXES
5909: SectionNumBox :
5910: BEGIN
5911: Content : (VALUE (ChapterCtr, Roman) TEXT '.'
5912: VALUE (SectionCtr, Arabic));
5913: ...
5914: END;
5915: </PRE>
5916: <P>
5917: To specify that a page footer should contain all elements of the <TT>Note</TT>
5918: type are referred to in the page, the following rule is written:</P>
5919: <PRE>
5920: BOXES
5921: NotesFooterBox :
5922: BEGIN
5923: Content : Note;
5924: ...
5925: END;
5926: </PRE>
5927: <P>
1.5 cvs 5928: <TT>Note</TT> is defined as an associated element in the structure schema and
1.1 cvs 5929: NotesFooterBox is created by a page box of the primary view.</P>
5930: </BLOCKQUOTE>
5931: </DIV>
5932:
5933: <DIV class="subsection">
1.6 cvs 5934: <H3><A name=sectc4232>Presentation box creation</A></H3>
1.1 cvs 5935:
5936: <P>
5937: A creation rule specifies that a presentation box should be created when an
5938: element of the type to which the rule is attached appears in the document.</P>
5939: <P>
5940: A keyword specifies the position, relative to the creating box, at which the
5941: created box will be placed in the structure:</P>
5942: <DL>
5943: <DT><TT>CreateFirst</TT></DT>
1.2 cvs 5944: <DD>specifies that the box should be created as the first box of the next lower
5945: level, before any already existing boxes, and only if the beginning of the
1.1 cvs 5946: creating element is visible;
5947: </DD>
5948: <DT><TT>CreateLast</TT></DT>
1.2 cvs 5949: <DD>specifies that the box should be created as the last box of the next lower
5950: level, after any existing boxes, and only if the end of the creating element is
1.1 cvs 5951: visible;
5952: </DD>
5953: <DT><TT>CreateBefore</TT></DT>
1.2 cvs 5954: <DD>specifies that the box should be created before the creating box, on the
5955: same level as the creating box, and only if the beginning of the creating
1.1 cvs 5956: element is visible;
5957: </DD>
5958: <DT><TT>CreateAfter</TT></DT>
1.2 cvs 5959: <DD>specifies that the box should be created after the creating box, on the
5960: same level as the creating box, and only if the beginning of the creating
1.1 cvs 5961: element is visible;
5962: </DD>
5963: <DT><TT>CreateEnclosing</TT></DT>
1.2 cvs 5964: <DD>specifies that the box should be created at the upper level relatively to
5965: the creating box, and that it must contain that creating box and all
5966: presentation boxes created by the same creating box.
1.1 cvs 5967: </DD>
5968: </DL>
5969: <P>
5970: This keyword can be followed by the <TT>Repeated</TT> keyword to indicate that
5971: the box must be created for each part of the creating element. These parts
5972: result from the division of the element by page breaks or column changes. If
5973: the <TT>Repeated</TT> keyword is missing, the box is only created for the
5974: first part of the creating element (<TT>CreateFirst</TT> and
5975: <TT>CreateBefore</TT> rules) or for the last part (<TT>CreateLast</TT> and
5976: <TT>CreateAfter</TT> rules).</P>
5977: <P>
5978: The type of presentation to be created is specified at the end of the rule
5979: between parentheses.</P>
5980: <P>
1.6 cvs 5981: Creation rules cannot appear in the <A href="#sectc427">default
1.1 cvs 5982: presentation rules</A>. The boxes being created should have a
5983: <TT>Content</TT> rule which indicates their <A
1.6 cvs 5984: href="#sectc4231">content</A>.</P>
1.1 cvs 5985: <P>
5986: Creation rules can only appear in the block of rules for the primary view;
5987: creation is provoked by a document element for all views. However, for each
5988: view, the presentation box is only created if the creating element is itself a
5989: box in the view. Moreover, the visibility parameter of the presentation box
5990: can be adjusted to control the creation of the box on a view-by-view
5991: basis.</P>
5992: <PRE>
5993: Creation '(' BoxID ')'
5994: Creation = Create [ 'Repeated' ] .
5995: Create ='CreateFirst' / 'CreateLast' /
5996: 'CreateBefore' / 'CreateAfter' /
5997: 'CreateEnclosing' .
5998: </PRE>
5999: <BLOCKQUOTE class="example">
6000: <P>
6001: <STRONG>Example:</STRONG></P>
6002: <P>
1.3 cvs 6003: Let us define an object type, called Table, which is composed of a sequence of
6004: columns, all having the same fixed width, where the columns are separated by
6005: vertical lines. There is a line to the left of the first column and one to the
6006: right of the last. Each column has a variable number of cells, placed one on
6007: top of the other and separated by horizontal lines. There are no horizontal
6008: lines above the first cell or below the last cell. The text contained in
1.5 cvs 6009: each cell is broken into lines and these lines are centered horizontally in
6010: the cell. The logical structure of this object is defined by:</P>
1.1 cvs 6011: <PRE>
6012: Table = LIST OF (Column);
6013: Column = LIST OF (Cell = Text);
6014: </PRE>
6015:
6016: <DIV class="figure">
6017: <HR>
6018: <PRE>
6019: | | | |
6020: | xx xxxx xxxx |x xxxx xxx xxxxx| x xxx x xxx |
6021: | xxx xxx xxxx x | x xx x xxx | xxxxx xxxx xx |
6022: | xxxxx xxxx |----------------| xxx xxxxx x |
6023: | xxxxx xxx xxxx | xxxx xx xx xxx | xx xx |
6024: | xxx xxxx x xxx | xxxx x xxx x |---------------|
6025: |----------------| xxx xxxx xxxxx | xxxxx xxxxx |
6026: | xxx xxx xxxxxx |----------------| xxx xxxx xxxx |
6027: | xxxx xxxx xx | xxxx xx x xx | xxx xx x xx |
6028: |----------------| xxx xxxxx xxxx | xxxx xxxx xxx |
6029: | xxxxx xxx xxxx | xxxx xx x xx | xxxxx xxx |
6030: |xxxx xx x xxxxxx| xxxx xx xxxxxx | xxxxx xxxxx |
6031: </PRE>
6032: <P align=center>
6033: <EM><A name="table">The design of a table</A></EM></P>
6034: <HR>
6035: </DIV>
6036: <P>
6037: The presentation of the table should resemble the design of the above <A
6038: href="#table">figure</A>. It is defined by the following presentation schema
6039: fragment:</P>
6040: <PRE>
6041: BOXES
6042: VertLine : BEGIN
6043: Width : 0.3 cm;
6044: Height : Enclosing . Height;
6045: VertPos : Top = Enclosing . Top;
6046: HorizPos : Left = Previous . Right;
6047: Content : Graphics 'v';
6048: END;
6049:
6050: HorizLine: BEGIN
6051: Width : Enclosing . Width;
6052: Height : 0.3 cm;
6053: VertPos : Top = Previous . Bottom;
6054: HorizPos : Left = Enclosing . Left;
6055: Content : Graphics 'h';
6056: END;
6057:
6058: RULES
1.6 cvs 6059: Column : BEGIN
6060: CreateBefore (VertLine);
6061: IF LAST CreateAfter (VertLine);
6062: Width : 2.8 cm;
6063: Height : Enclosed . Height;
6064: VertPos : Top = Enclosing . Top;
6065: HorizPos : Left = Previous . Right;
6066: END;
6067:
6068: Cell : BEGIN
6069: IF NOT FIRST CreateBefore (HorizLine);
6070: Width : Enclosing . Width;
6071: Height : Enclosed . Height;
6072: VertPos : Top = Previous . Bottom;
6073: HorizPos : Left = Enclosing . Left;
6074: Line;
6075: Adjust : VMiddle;
6076: END;
1.1 cvs 6077: </PRE>
6078: <P>
6079: It is useful to note that the horizontal position rule of the first vertical
6080: line will not be applied, since there is no preceding box. In this case, the
6081: box is simply placed on the left side of the enclosing box.</P>
6082: </BLOCKQUOTE>
6083: </DIV>
6084:
6085: <DIV class="subsection">
1.6 cvs 6086: <H3><A name=sectc4233>Page layout</A></H3>
1.1 cvs 6087:
6088: <P>
6089: The page models specified in the <TT>Page</TT> rule are defined by boxes
6090: declared in the <TT>BOXES</TT> section of the presentation schema. Pages are
6091: not described as frames which will be filled by the document's text, but as
6092: element are inserted in the flow of the document and which mark the page
6093: breaks. Each of these page break elements contains presentation boxes which
6094: represent the footer boxes of a page followed by header boxes of the next
6095: page. The page box itself is the simple line which separates two pages on the
6096: screen. Both the footer and header boxes placed themselves with respect to
6097: this page box, with the footer being placed above it and the header boxes
6098: being placed above it.</P>
6099: <P>
6100: The boxes created by a page box are headers and footers and can only place
6101: themselves vertically with respect to the page box itself (which is in fact
6102: the separation between two pages). Besides, it is their vertical position
6103: rule which determines whether they are header or footer boxes. Header and
6104: footer boxes must have an explicit vertical position rule (they must not use
6105: the default rule).</P>
6106: <P>
6107: Footer boxes must have an absolute height or inherit the height of their
6108: contents:</P>
6109: <PRE>
6110: Height : Enclosed . Height;
6111: </PRE>
6112: <P>
6113: A page box must have height and width rules and these two rules must be
6114: specified with constant values, expressed in centimeters, inches, or
6115: typographer's points. These two rules are interpreted in a special way for
6116: page boxes: they determine the width of the page and the vertical distance
6117: between two page separators, which is the height of the page and its header
6118: and footer together.</P>
6119: <P>
6120: A page box should also have vertical and horizontal position rules and these
6121: two rules should specify the position on the sheet of paper of the rectangle
6122: enclosing the page's contents. These two rules must position the upper left
6123: corner of the enclosing rectangle in relation to the upper left corner of the
6124: sheet of paper, considered to be the enclosing element. In both rules,
6125: distances must be expressed in fixed units: centimeters (<TT>cm</TT>), inches
6126: (<TT>in</TT>), or typographer's points (<TT>pt</TT>). Thus, rules similar to
6127: the following should be found in the rules for a page box:</P>
6128: <PRE>
6129: BOXES
6130: ThePage :
6131: BEGIN
6132: VertPos : Top = Enclosing . Top + 3 cm;
6133: HorizPos : Left = Enclosing . Left + 2.5 cm;
6134: Width : 16 cm;
6135: Height : 22.5 cm;
6136: END;
6137: </PRE>
6138: <P>
6139: When a document must be page broken, the page models to be constructed are
6140: defined in the <TT>BOXES</TT> section of the presentation schema by declaring
6141: page boxes and header and footer boxes. Also, the <TT>Page</TT> rule is used
6142: to specify to which parts of the document and to which views each model should
6143: be applied.</P>
6144: <P>
6145: The <TT>Page</TT> rule has only one parameter, given between parentheses after
6146: the <TT>Page</TT> keyword. This parameter is the name of the box which must
6147: serve as the model for page construction. When a <TT>Page</TT> rule is
6148: attached to an element type, each time such an element appears in a document,
6149: a page break takes place and the page model indicated in the rule is applied
6150: to all following pages, until reaching the next element which has a
6151: <TT>Page</TT> rule.</P>
6152: <P>
6153: The <TT>Page</TT> rule applies to only one view; if it appears in the primary
6154: view's block of rules, a <TT>Page</TT> rule applies only to that view. Thus,
6155: different page models can be defined for the full document and for its table
6156: of contents, which is another view of the same document. Some views can be
6157: specified with pages, and other views of the same document can be specified
6158: without pages.</P>
6159: <PRE>
6160: 'Page' '(' BoxID ')'
6161: </PRE>
6162: </DIV>
6163:
6164: <DIV class="subsection">
1.6 cvs 6165: <H3><A name=sectc4234>Box copies</A></H3>
1.1 cvs 6166:
6167: <P>
6168: The <TT>Copy</TT> rule can be used for an element which is defined as a
1.7 cvs 6169: reference in the structure schema. In this case, the rule specifies, between
6170: parenthesis, the name of the box (declared in the <TT>BOXES</TT> section)
1.1 cvs 6171: which must be produced when this reference appears in the structure of a
6172: document. The box produced is a copy (same contents, but possible different
6173: presentation) of the box type indicated by the parameter between parentheses,
6174: and which is in the element designated by the reference. The name of a box
6175: can be replaced by type name. Then what is copied is the contents of the
6176: element of this type which is inside the referenced element.</P>
6177: <P>
6178: Whether a box name or type name is given, it may be followed by the name of a
6179: structure schema between parentheses. This signifies that the box or type is
6180: defined in the indicated structure schema and not in the structure schema with
6181: which the rule's presentation schema is associated.</P>
6182: <P>
6183: The <TT>Copy</TT> rule can also be applied to a presentation box. If the
6184: presentation box was created by a reference attribute, the rule is applied as
6185: in the case of a reference element: the contents of the box having the
6186: <TT>Copy</TT> rule are based on the element designated by the reference
6187: attribute. For other presentation boxes, the <TT>Copy</TT> rule takes a type
6188: name parameter which can be followed, between parentheses, by the name of the
6189: structure schema in which the type is defined, if it is not defined in the
6190: same schema. The contents of the box which has this rule are a copy of the
6191: element of this type which is in the element creating the presentation box, or
6192: by default, the box of this type which precedes the presentation box. This
6193: last facility is used, for example, to define the running titles in headers or
6194: footers.</P>
6195: <PRE>
1.6 cvs 6196: 'Copy' '(' BoxTypeToCopy ')' .
1.1 cvs 6197: BoxTypeToCopy = BoxID [ ExtStruct ] /
1.6 cvs 6198: ElemID [ ExtStruct ] .
6199: ExtStruct = '(' ElemID ')' .
1.1 cvs 6200: </PRE>
6201: <P>
6202: Like the creation rules, the <TT>Copy</TT> rule cannot appear in the <A
1.6 cvs 6203: href="#sectc427">default presentation rules</A>. Moreover, this rule
1.1 cvs 6204: can only appear in the primary view's block of rules; the copy rule is applied
6205: to all views.</P>
6206: <BLOCKQUOTE class="example">
6207: <P>
6208: <STRONG>Example:</STRONG></P>
6209: <P>
6210: If the following definitions are in the structure schema:</P>
6211: <PRE>
6212: Body = LIST OF (Chapter =
6213: BEGIN
6214: ChapterTitle = Text;
6215: ChapterBody = SectionSeq;
6216: END);
6217: RefChapter = REFERENCE (Chapter);
6218: </PRE>
6219: <P>
6220: then the following presentation rules (among many other rules in
1.3 cvs 6221: the presentation schema) can be specified:</P>
1.1 cvs 6222: <PRE>
6223: COUNTERS
6224: ChapterCtr : RANK OF Chapter;
6225: BOXES
6226: ChapterNumber :
6227: BEGIN
6228: Content : (VALUE (ChapterCtr, URoman));
6229: ...
6230: END;
6231: RULES
6232: Chapter :
6233: BEGIN
6234: CreateFirst (ChapterNumber);
6235: ...
6236: END;
6237: RefChapter :
6238: BEGIN
6239: Copy (ChapterNumber);
6240: ...
6241: END;
6242: </PRE>
6243: <P>
1.4 cvs 6244: which makes the number of the chapter designated by the reference appear in
6245: uppercase roman numerals, in place of the reference to a chapter itself.
6246: Alternatively, the chapter title can be made to appear in place of the
1.1 cvs 6247: reference by writing this <TT>Copy</TT>rule:</P>
6248: <PRE>
6249: Copy (ChapterTitle);
6250: </PRE>
6251: <P>
6252: To define a header box, named <TT>RunningTitle</TT>, which contains the title
6253: of the current chapter, the box's contents are defined in this way:</P>
6254: <PRE>
6255: BOXES
6256: RunningTitle :
6257: Copy (ChapterTitle);
6258: </PRE>
6259: </BLOCKQUOTE>
6260: </DIV>
6261: </DIV>
6262: <HR>
6263: </DIV>
6264:
6265: <DIV class="chapter">
1.6 cvs 6266: <H1><A name=sect5>The T language</A></H1>
1.1 cvs 6267:
6268:
6269: <DIV class="section">
1.6 cvs 6270: <H2><A name=sectb51>Document translation</A></H2>
1.1 cvs 6271:
6272: <P>
6273: Because of its document model, Thot can produce documents in a high-level
6274: abstract form. This form, called the <EM>canonical form</EM> is specific to
6275: Thot; it is well suited to the editor's manipulations, but it does not
6276: necessarily suit other operations which might be applied to documents. Because
6277: of this, the Thot editor offers the choice of saving documents in its own form
6278: (the canonical form) or a format defined by the user. In the latter case, the
6279: Thot document is transformed by the translation program. This facility can
6280: also be used to export documents from Thot to systems using other
6281: formalisms.</P>
6282:
6283: <DIV class="subsection">
1.6 cvs 6284: <H3><A name=sectc511>Translation principles</A></H3>
1.1 cvs 6285:
6286: <P>
6287: Document translation allows the export of documents to other systems which do
6288: not accept Thot's canonical form. Translation can be used to export document
6289: to source-based formatters like T<SUB><BIG>E</BIG></SUB>X,
6290: L<SUP>A</SUP>T<SUB><BIG>E</BIG></SUB>X, and <TT>troff</TT>. It can also be
6291: used to translate documents into interchange formats like SGML or HTML. To
6292: allow the widest range of possible exports, Thot does not limit the choice of
6293: translations, but rather allows the user to define the formalisms into which
6294: documents can be translated.</P>
6295: <P>
6296: For each document or object class, a set of translation rules can be defined,
6297: specifying how the canonical form should be transformed into a given
6298: formalism. These translation rules are grouped into <EM>translation
6299: schemas</EM>, each schema containing the rules necessary to translate a
6300: generic logical structure (document or object structure) into a particular
6301: formalism. The same generic logical structure can have several different
6302: translation schemas, each defining translation rules for a different
6303: formalism.</P>
6304: <P>
6305: Like presentation schemas, translation schemas are generic. Thus, they apply
6306: to an entire object or document class and permit translation of all documents
6307: or objects of that class.</P>
6308: </DIV>
6309:
6310: <DIV class="subsection">
1.6 cvs 6311: <H3><A name=sectc512>Translation procedure</A></H3>
1.1 cvs 6312:
6313: <P>
6314: The translator works on the specific logical structure of the document being
6315: translated. It traverses the primary tree of this logical structure in
6316: pre-order and, at each node encountered, it applies the corresponding
6317: translation rules defined in the translation schema. Translation can be
6318: associated:</P>
6319: <UL>
6320: <LI>with element types defined in the structure schema,
6321: <LI>with global or local attributes defined in the structure schema,
6322: <LI>with specific presentation rules,
1.2 cvs 6323: <LI>with the content of the leaves of the structure (characters, symbols and
1.1 cvs 6324: graphical elements)
6325: </UL>
6326: <P>
6327: Thus, for each node, the translator applies all rules associated with the
6328: element type, all rules associated with each attribute (local or global)
6329: carried by the element, and if the element is a leaf of the tree, it also
1.10 cvs 6330: applies translation rules for characters, symbols, or graphical elements,
1.1 cvs 6331: depending on the type of the leaf.</P>
6332: <P>
6333: Rules associated with the content of leaves are different from all other
6334: rules: they specify only how to translate character strings, symbols, and
6335: graphical elements. All other rules, whether associated with element types,
6336: with specific presentation rules or with attributes, are treated similarly.
6337: These rules primarily allow:</P>
6338: <UL>
1.2 cvs 6339: <LI>generation of a text constant or variable before or after the contents of
1.1 cvs 6340: an element,
1.2 cvs 6341: <LI>modification of the order in which elements appear after translation,
1.1 cvs 6342: <LI>removal of an element in the translated document,
6343: <LI>and writing messages on the user's terminal during translation.
6344: </UL>
6345: </DIV>
6346: </DIV>
6347:
6348: <DIV class="section">
1.6 cvs 6349: <H2><A name=sectb52>Translation definition language</A></H2>
1.1 cvs 6350:
6351: <P>
6352: Translation schemas are written in a custom language, called T, which is
6353: described in the rest of this chapter. The grammar of T is specified using
1.6 cvs 6354: the same <A href="#sectc321">meta-language</A> as was used for the S and P
1.1 cvs 6355: languages and the translation schemas are written using the same conventions
6356: as the structure and presentation schemas. In particular, the keywords of the
6357: T language (the stings between apostrophes in the following syntax rules) can
6358: be written in any combination of upper-case and lower-case letters, but
6359: identifiers created by the programmer must always be written in the same
6360: way.</P>
6361:
6362: <DIV class="subsection">
1.6 cvs 6363: <H3><A name=sectc521>Organization of a translation schema</A></H3>
1.1 cvs 6364:
6365: <P>
6366: A translation schema is begun by the <TT>TRANSLATION</TT> keyword and is
6367: terminated by the <TT>END</TT> keyword. The <TT>TRANSLATION</TT> keyword is
6368: followed by the name of the generic structure for which a translation is being
6369: defined and a semicolon. This name must be identical to the name which
6370: appears after the <TT>STRUCTURE</TT> keyword in the corresponding structure
6371: schema.</P>
6372: <P>
6373: After this declaration of the structure, the following material appears in
6374: order:</P>
6375: <UL>
6376: <LI>the length of lines produced by the translation,
6377: <LI>the character delimiting the end of the line,
6378: <LI>the character string which the translator will insert if it must
6379: line-break the translated text,
6380: <LI>declarations of
6381: <UL>
6382: <LI>buffers,
6383: <LI>counters,
6384: <LI>constants,
6385: <LI>variables,
6386: </UL>
6387: <LI>translation rules associated with element types,
6388: <LI>translation rules associated with attributes,
6389: <LI>translation rules associated with specific presentation rules,
6390: <LI>translation rules associated with characters strings, symbols and
6391: graphical elements.
6392: </UL>
6393: <P>
6394: Each of these sections is introduced by a keyword followed by a sequence of
6395: declarations. All of these sections are optional, expect for the translation
6396: rules associated with element types. Many <TT>TEXTTRANSLATE</TT> sections can
6397: appear, each defining the rules for translating character strings of a
6398: particular alphabet.</P>
6399: <PRE>
6400: TransSchema ='TRANSLATION' ElemID ';'
6401: [ 'LINELENGTH' LineLength ';' ]
6402: [ 'LINEEND' CHARACTER ';' ]
6403: [ 'LINEENDINSERT' STRING ';' ]
6404: [ 'BUFFERS' BufferSeq ]
6405: [ 'COUNTERS' CounterSeq ]
6406: [ 'CONST' ConstSeq ]
6407: [ 'VAR' VariableSeq ]
6408: 'RULES' ElemSeq
6409: [ 'ATTRIBUTES' AttrSeq ]
6410: [ 'PRESENTATION' PresSeq ]
6411: < 'TEXTTRANSLATE' TextTransSeq >
6412: [ 'SYMBTRANSLATE' TransSeq ]
6413: [ 'GRAPHTRANSLATE' TransSeq ]
6414: 'END' .
6415: </PRE>
6416: </DIV>
6417:
6418: <DIV class="subsection">
1.6 cvs 6419: <H3><A name=sectc522>Line length</A></H3>
1.1 cvs 6420:
6421: <P>
6422: If a <TT>LINELENGTH</TT> instruction is present after the structure
6423: declaration, the translator divides the text it produces into lines, each line
6424: having a length less than or equal to the integer which follows the
6425: <TT>LINELENGTH</TT> keyword. This maximum line length is expressed as a
6426: number of characters. The end of the line is marked by the character defined
6427: by the <TT>LINEEND</TT> instruction. When the translator breaks the lines on
6428: a space character in generated text, this space will be replaced by the
6429: character string defined by the <TT>LINEENDINSERT</TT> instruction.</P>
6430: <P>
6431: If the <TT>LINEEND</TT> instruction is not defined then the linefeed character
6432: (octal code 12) is used as the default line end character. If the
6433: <TT>LINEENDINSERT</TT> instruction is not defined, the linefeed character is
6434: inserted at the end of the produced lines. If there is no <TT>LINELENGTH</TT>
6435: instruction, the translated text is not divided into lines. Otherwise, if the
6436: translation rules generate line end marks, these marks remain in the
6437: translated text, but the length of the lines is not controlled by the
6438: translator.</P>
6439: <PRE>
6440: LineLength = NUMBER .
6441: </PRE>
6442: <BLOCKQUOTE class="example">
6443: <P>
6444: <STRONG>Example:</STRONG></P>
6445: <P>
1.3 cvs 6446: To limit the lines produced by the translator to a length of 80 characters, the
6447: following rule is written at the beginning of the translation schema.</P>
1.1 cvs 6448: <PRE>
6449: LineLength 80;
6450: </PRE>
6451: </BLOCKQUOTE>
6452: </DIV>
6453:
6454: <DIV class="subsection">
1.6 cvs 6455: <H3><A name=sectc523>Buffers</A></H3>
1.1 cvs 6456:
6457: <P>
6458: A buffer is a unit of memory managed by the translator, which can either
6459: contain text read from the terminal during the translation (see the <A
1.6 cvs 6460: href="#sectc5212"><TT>Read</TT> rule</A>), or the name of the last picture
1.1 cvs 6461: (bit-map) encountered by the translator in its traversal of the document.
1.2 cvs 6462: Remember the pictures are stored in files that are separate for the document
1.1 cvs 6463: files and that the canonical form contains only the names of the files in
1.2 cvs 6464: which the pictures are found.</P>
1.1 cvs 6465: <P>
6466: Thus, there are two types of buffers: buffers for reading from the terminal
1.2 cvs 6467: (filled by the <TT>Read</TT> rule) and the buffer of picture names (containing
6468: the name of the last picture encountered). A translation schema can use
6469: either type, one or several read buffers and one (and only one) picture name
1.1 cvs 6470: buffer.</P>
6471: <P>
6472: If any buffers are used, the <TT>BUFFERS</TT> keyword must be present,
6473: followed by declarations of every buffer used in the translation schema. Each
6474: buffer declaration is composed only of the name of the buffer, chosen freely
1.2 cvs 6475: by the programmer. The picture name buffer is identified by the
1.1 cvs 6476: <TT>Picture</TT> keyword, between parentheses, following the buffer name. The
6477: <TT>Picture</TT> keyword may only appear once. Each buffer declaration is
6478: terminated by a semicolon.</P>
6479: <PRE>
6480: BufferSeq = Buffer < Buffer > .
6481: Buffer = BufferID [ '(' 'Picture' ')' ] ';' .
6482: BufferID = NAME .
6483: </PRE>
6484: <BLOCKQUOTE class="example">
6485: <P>
6486: <STRONG>Example:</STRONG></P>
6487: <P>
1.3 cvs 6488: The following buffer declarations create a picture name buffer named
1.2 cvs 6489: <TT>pictureName</TT> and a read buffer named <A
1.1 cvs 6490: name="destname"><TT>DestName</TT></A>:</P>
6491: <PRE>
6492: BUFFERS
1.2 cvs 6493: pictureName (Picture); DestName;
1.1 cvs 6494: </PRE>
6495: </BLOCKQUOTE>
6496: </DIV>
6497:
6498: <DIV class="subsection">
1.6 cvs 6499: <H3><A name=sectc524>Counters</A></H3>
1.1 cvs 6500:
6501: <P>
6502: Certain translation rules generate text that varies according to the context
6503: of the element to which the rules apply. Variable text is defined either in
1.6 cvs 6504: the <A href="#sectc526"><TT>VAR</TT> section</A> of the translation schema or
1.1 cvs 6505: in the rule itself (see the <TT>Create</TT> and <TT>Write</TT> rules). Both
6506: types of definition rely on counters for the calculation of variable
6507: material.</P>
6508: <P>
6509: There are two types of counter: counters whose value is explicitely computed
1.6 cvs 6510: by applying <A href="#sectc5221"><TT>Set</TT> and <TT>Add</TT> rules</A>, and
1.1 cvs 6511: counters whose value is computed by a function associated with the counter.
6512: Those functions allow the same calculations as can be used in presentation
6513: schemas. As in a presentation schema, counters must be defined in the
6514: <TT>COUNTERS</TT> section of the translation schema before they are used.</P>
6515: <P>
6516: When counters are used in a translation schema, the <TT>COUNTERS</TT> keyword
6517: is followed by the declarations of every counter used. Each declaration is
6518: composed of the counter's name possibly followed by a colon and the counting
6519: function to be used for the counter. The declaration is terminated by a
6520: semi-colon. If the counter is explicitely computed by <TT>Set</TT> and
6521: <TT>Add</TT> rules, no counting function is indicated. If a counting function
6522: is indicated, <TT>Set</TT> and <TT>Add</TT> rules cannot be applied to that
6523: counter.</P>
6524: <P>
6525: The counting function indicates how the counter's value will be computed.
6526: Three functions are available: <TT>Rank</TT>, <TT>Rlevel</TT>, and
6527: <TT>Set</TT>.</P>
6528: <UL>
1.5 cvs 6529: <LI><TT>Rank of ElemID</TT> indicates that the counter's value is the rank of
6530: the element of type <TT>ElemID</TT> which encloses the element for which the
1.2 cvs 6531: counter is being evaluated. For the purposes of this function, an element of
1.5 cvs 6532: type <TT>ElemID</TT> is considered to enclose itself. This function is
6533: primarily used when the element of type <TT>ElemID</TT> is part of an
1.2 cvs 6534: aggregate or list, in which case the counter's value is the element's rank in
1.5 cvs 6535: its list or aggregate. Note that, unlike the <TT>Rank</TT> function for
6536: presentation schemas, the <TT>Page</TT> keyword cannot be used in place of the
1.1 cvs 6537: <TT>ElemID</TT>.
6538: <P>
6539: The type name <TT>ElemID</TT> can be followed by an integer. That number
6540: represents the relative level, among the ancestors of the concerned element,
6541: of the element whose rank is asked. If that relative level <I>n</I> is
1.5 cvs 6542: unsigned, the <I>n<SUP>th</SUP></I> element of type <TT>ElemID</TT> encountered
6543: when travelling the logical structure from the root to the concerned element is
1.1 cvs 6544: taken into account. If the relative level is negative, the logical structure
6545: is travelled in the other direction, from the concerned element to the
6546: root.</P>
1.5 cvs 6547: <LI><TT>Rlevel of ElemID</TT> indicates that the counter's values is the
1.2 cvs 6548: relative level in the tree of the element for which the counter is being
6549: evaluated. The counter counts the number of elements of type <TT>ElemID</TT>
6550: which are found on the path between the root of the document's logical
6551: structure tree and the element (inclusive).
1.5 cvs 6552: <LI><TT>Set n on Type1 Add m on Type2</TT> indicates that the counter's value
1.2 cvs 6553: is calculated as follows: in traversing the document from the beginning to
6554: the element for which the counter is being evaluated, the counter is set to
1.5 cvs 6555: the value <TT>n</TT> each time a <TT>Type1</TT> element is encountered and is
6556: incremented by the amount <TT>m</TT> each time a <TT>Type2</TT> element is
6557: encountered. The initial value <TT>n</TT> and the increment <TT>m</TT> are
1.1 cvs 6558: integers.
6559: </UL>
6560: <P>
6561: As in a presentation schema, the <TT>Rank</TT> and <TT>Set</TT> functions can
6562: be modified by a numeric attribute which changes their initial value. This is
6563: indicated by the <TT>Init</TT> keyword followed by the numeric attribute's
6564: name. The <TT>Set</TT> function takes the value of the attribute instead of
6565: the <TT>InitValue</TT> (<TT>n</TT>). For the <TT>Rank</TT> function, the
6566: value of the attribute is considered to be the rank of the first element of
6567: the list (rather than the normal value of 1). Subsequent items in the list
6568: have their ranks shifted accordingly. In both cases, the attribute must be
6569: numeric and must be a local attribute of the root of the document itself.</P>
6570: <PRE>
6571: CounterSeq = Counter < Counter > .
6572: Counter = CounterID [ ':' CounterFunc ] ';' .
6573: CounterID = NAME .
6574: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ]
6575: [ 'Init' AttrID ] /
6576: 'Rlevel' 'of' ElemID /
6577: 'Set' InitValue 'On' ElemID
6578: 'Add' Increment 'On' ElemID
6579: [ 'Init' AttrID ] .
6580: SLevelAsc = [ '-' ] LevelAsc .
6581: LevelAsc = NUMBER .
6582: InitValue = NUMBER .
6583: Increment = NUMBER .
6584: ElemID = NAME .
6585: AttrID = NAME .
6586: </PRE>
6587: <BLOCKQUOTE class="example">
6588: <P>
6589: <STRONG>Example:</STRONG></P>
6590: <P>
6591: If the body of a chapter is defined in the structure schema by:</P>
6592: <PRE>
6593: Chapter_Body = LIST OF
6594: (Section = BEGIN
6595: Section_Title = Text;
6596: Section_Body = BEGIN
6597: Paragraphs;
6598: Section;
6599: END;
6600: END
6601: );
6602: </PRE>
6603: <P>
1.3 cvs 6604: (sections are defined recursively), a counter can be defined giving the <A
1.4 cvs 6605: name="sectnum">number of a section</A> within its level in the hierarchy:</P>
1.1 cvs 6606: <PRE>
6607: COUNTERS
6608: SectionNumber : Rank of Section;
6609: </PRE>
6610: <P>
6611: A counter holding the hierarchic level of a section:</P>
6612: <PRE>
6613: SectionLevel : Rlevel of Section;
6614: </PRE>
6615: <P>
1.5 cvs 6616: A <A name="uniquenum">counter</A> which sequentially numbers all the document's
1.1 cvs 6617: sections, whatever their hierarchic level:</P>
6618: <PRE>
6619: UniqueSectNum : Set 0 on Document Add 1 on Section;
6620: </PRE>
6621: </BLOCKQUOTE>
6622: </DIV>
6623:
6624: <DIV class="subsection">
1.6 cvs 6625: <H3><A name=sectc525>Constants</A></H3>
1.1 cvs 6626:
6627: <P>
6628: A common feature of translation rules is the generation of constant text. This
6629: text can be defined in the rule that generates it (see for example the <A
1.6 cvs 6630: href="#sectc5210"><TT>Create</TT></A> and <A href="#sectc5211"><TT>Write</TT></A>
1.1 cvs 6631: rules); but it can also be defined once in the constant declaration section
6632: and used many times in different rules. The latter option is preferable when
6633: the same text is used in several rules or several <A
1.6 cvs 6634: href="#sectc526">variables</A>.</P>
1.1 cvs 6635: <P>
6636: The <TT>CONST</TT> keyword begins the constant declaration section of the
6637: translation schema. It must be omitted if no constants are declared. Each
6638: constant declaration is composed of the constant name, an equals sign, and the
6639: constant's value, which is a character string between apostrophes. A constant
6640: declaration is terminated by a semicolon.</P>
6641: <PRE>
6642: ConstSeq = Const < Const > .
6643: Const = ConstID '=' ConstValue ';' .
6644: ConstID = NAME .
6645: ConstValue = STRING .
6646: </PRE>
6647: <BLOCKQUOTE class="example">
6648: <P>
6649: <STRONG><A name="levelexample">Example:</A></STRONG></P>
6650: <P>
1.5 cvs 6651: The following rule assigns the name <TT>TxtLevel</TT> to the character string
1.1 cvs 6652: ``Level'':</P>
6653: <PRE>
6654: CONST
6655: TxtLevel = 'Level';
6656: </PRE>
6657: </BLOCKQUOTE>
6658: </DIV>
6659:
6660: <DIV class="subsection">
1.6 cvs 6661: <H3><A name=sectc526>Variables</A></H3>
1.1 cvs 6662:
6663: <P>
1.10 cvs 6664: Variables allow to define variable text which is generated by the
6665: <TT>Create</TT> and <TT>Write</TT> rules. They are also used to define
6666: file names which are used in the <TT>Create</TT>, <TT>ChangeMainFile</TT>,
1.14 cvs 6667: <TT>RemoveFile</TT>, and <TT>Indent</TT> rules. Variables can be defined either
1.1 cvs 6668: in the <TT>VAR</TT> section of the translation schema or directly in the rules
1.10 cvs 6669: which use them. Variables that define file names must be declared in the
1.1 cvs 6670: <TT>VAR</TT> section, and when the same variable is used several times in the
6671: translation schema, it makes sense to define it globally in the <TT>VAR</TT>
6672: section. This section is only present if at least one variable is defined
6673: globally.</P>
6674: <P>
6675: After the <TT>VAR</TT> keyword, each global variable is defined by its name, a
6676: colon separator and a sequence of functions (at least one function). Each
6677: variable definition is terminated by a semicolon. Functions determine the
6678: different parts which together give the value of the variable. The value is
6679: obtained by concatenating the strings produced by each of the functions. Seven
6680: types of functions are available. Each variable definition may use any number
6681: of functions of each type.</P>
6682: <UL>
1.2 cvs 6683: <LI>The function <TT>Value(Counter)</TT>returns a string representing the
6684: value taken by the counter when it is evaluated for the element in whose rule
6685: the variable is used. The counter must have been declared in the
1.5 cvs 6686: <TT>COUNTERS</TT> section of the translation schema. When the counter is
1.2 cvs 6687: expressed in arabic numerals, the counter name can be followed by a colon and
6688: an integer indicating a minimum length (number of characters) for the string;
6689: if the counter's value is normally expressed with fewer characters than the
6690: required minimum, zeroes are added to the front of the string to achieve the
1.5 cvs 6691: minimum length.
1.1 cvs 6692: <P>
6693: By default, the counter value is written in arabic digits. If another
6694: representation of that value is needed, the counter name must be followed by a
6695: comma and one of the following keywords:</P>
6696: <UL>
6697: <LI><TT>Arabic</TT>: arabic numerals (default value),
6698: <LI><TT>LRoman</TT>: lower-case roman numerals,
6699: <LI><TT>URoman</TT>: upper-case roman numerals,
6700: <LI><TT>Uppercase</TT>: upper-case letter,
6701: <LI><TT>Lowercase</TT>: lower-case letter.
6702: </UL>
1.2 cvs 6703: <LI>The function <TT>FileDir</TT>, without parameter, returns a string
6704: representing the name of the directory of the output file that has been given
6705: as a parameter to the translation program. The string includes a character '/'
6706: at the end.
6707: <LI>The function <TT>FileName</TT>, without parameter, returns a string
6708: representing the name of the output file that has been given as a parameter to
6709: the translation program. The file extension (the character string that
6710: terminate the file name, after a dot) is not part of that string.
6711: <LI>The function <TT>Extension</TT>, without parameter, returns a string
6712: representing the extension of the file name. That string is empty if the file
6713: name that has been given as a parameter to the translation program has no
6714: extension. If there is an extension, its first character is a dot.
6715: <LI>The function <TT>DocumentName</TT>, without parameter, returns a string
6716: representing the name of the document being translated.
6717: <LI>The function <TT>DocumentDir</TT>, without parameter, returns a string
6718: representing the directory containing the document being translated.
6719: <LI>The function formed by the name of a constant returns that constant's
1.1 cvs 6720: value.
1.2 cvs 6721: <LI>The function formed by a character string between apostrophes returns that
1.1 cvs 6722: string.
1.2 cvs 6723: <LI>The function formed by the name of a buffer returns the contents of that
6724: buffer. If the named buffer is the picture buffer, then the name of the last
6725: picture encountered is returned. Otherwise, the buffer is a read buffer and
6726: the value returned is text previously read from the terminal. If the buffer
6727: is empty (no picture has been encountered or the <TT>Read</TT> rule has not
6728: been executed for the buffer), then the empty string is returned.
6729: <LI>The function formed by an attribute name takes the value of the indicated
6730: attribute for the element to which the variable applies. If the element does
6731: not have that attribute, then the element's ancestor are searched toward the
6732: root of the tree. If one of the ancestors does have the attribute then its
6733: value is used. If no ancestors have the attribute, then the value of the
1.1 cvs 6734: function is the empty string.
6735: </UL>
6736: <PRE>
6737: VariableSeq = Variable < Variable > .
6738: Variable = VarID ':' Function < Function > ';' .
6739: VarID = NAME .
6740: Function ='Value' '(' CounterID [ ':' Length ]
6741: [ ',' CounterStyle ] ')' /
6742: 'FileDir' / 'FileName' / 'Extension' /
6743: 'DocumentName' / 'DocumentDir' /
6744: ConstID / CharString /
6745: BufferID / AttrID .
6746: Length = NUMBER .
6747: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' /
6748: 'Uppercase' / 'Lowercase' .
6749: CharString = STRING .
6750: </PRE>
6751: <BLOCKQUOTE class="example">
6752: <P>
6753: <STRONG>Example:</STRONG></P>
6754: <P>
1.3 cvs 6755: To create, at the beginning of each section of the translated document, text
6756: composed of the string ``Section'' followed by the section number, the
1.5 cvs 6757: following <A name="varsectexample">variable definition</A> might be used:</P>
1.1 cvs 6758: <PRE>
6759: VAR
6760: SectionVar : 'Section' Value(SectionNumber);
6761: </PRE>
6762: <P>
6763: (see the definition of <A href="#sectnum"><TT>SectionNumber</TT></A>).</P>
6764: <P>
6765: The following variable definition can be used to create, at the beginning of
6766: each section, the text ``Level'' followed by the hierarchical level of the
6767: section. It used the constant defined above.</P>
6768: <PRE>
6769: LevelVar : TxtLevel Value(SectionLevel);
6770: </PRE>
6771: <P>
1.5 cvs 6772: (see the definitions of <A href="#sectnum"><TT>SectionLevel</TT></A> and of
6773: <A href="#levelexample"><TT>TxtLevel</TT></A>).</P>
1.1 cvs 6774: <P>
1.5 cvs 6775: To generate the translation of each section in a different file (see
1.6 cvs 6776: <A href="#sectc5220">rule <TT>ChangeMainFile</TT></A>), the name of these
1.1 cvs 6777: files might be defined by the following variable:</P>
6778: <PRE>
6779: VarOutpuFile : FileName Value(SectionNumber)
6780: Extension;
6781: </PRE>
6782: <P>
1.4 cvs 6783: If <TT>output.txt</TT> is the name of the <A name="varoutputfile">output
6784: file</A> specified when starting the translation program, translated sections
6785: are written in files <TT>output1.txt</TT>, <TT>output2.txt</TT>, etc.</P>
1.1 cvs 6786: </BLOCKQUOTE>
6787: </DIV>
6788:
6789: <DIV class="subsection">
1.6 cvs 6790: <H3><A name=sectc527>Translating structure elements</A></H3>
1.1 cvs 6791:
6792: <P>
6793: The <TT>RULES</TT> keyword introduces the translation rules which will be
6794: applied to the various structured element types. Translation rules can be
6795: specified for each element type defined in the structure schema, including the
6796: base types defined implicitly, whose names are <TT>TEXT_UNIT</TT>,
6797: <TT>PICTURE_UNIT</TT>, <TT>SYMBOL_UNIT</TT>, <TT>GRAPHIC_UNIT</TT> and
1.2 cvs 6798: <TT>PAGE_UNIT</TT>. But it is not necessary to specify rules for every
6799: defined type.</P>
1.1 cvs 6800: <P>
6801: If there are no translation rules for an element type, the elements that it
6802: contains (and which may have rules themselves) will still be translated, but
6803: the translator will produce nothing for the element itself. To make the
6804: translator completely ignore the content of an element the <A
1.6 cvs 6805: href="#sectc5217"><TT>Remove</TT> rule</A> must be used.</P>
1.1 cvs 6806: <P>
6807: The translation rules for an element type defined in the structure schema are
6808: written using the name of the type followed by a colon and the list of
1.6 cvs 6809: applicable rules. When the element type is a <A href="#sectd3285">mark pair</A>,
1.1 cvs 6810: but only in this case, the type name must be preceded by the <TT>First</TT> or
6811: <TT>Second</TT> keyword. This keyword indicates whether the rules that follow
6812: apply to the first or second mark of the pair.</P>
6813: <P>
6814: The list of rules can take several forms. It may be a simple non-conditional
6815: rule. It can also be formed by a condition followed by one or more simple
6816: rules. Or it can be a block of rules beginning with the <TT>BEGIN</TT>
6817: keyword and ending with the <TT>END</TT> keyword and a semicolon. This block
6818: of rules can contain one or more simple rules and/or one or more conditions,
6819: each followed by one or more simple rules.</P>
6820: <PRE>
6821: ElemSeq = TransType < TransType > .
6822: TransType = [ FirstSec ] ElemID ':' RuleSeq .
6823: FirstSec = 'First' / 'Second' .
6824: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' .
6825: Rule = SimpleRule / ConditionBlock .
6826: ConditionBlock = 'IF' ConditionSeq SimpleRuleSeq .
6827: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' /
6828: SimpleRule .
6829: </PRE>
6830: </DIV>
6831:
6832: <DIV class="subsection">
1.6 cvs 6833: <H3><A name=sectc528>Conditional rules</A></H3>
1.1 cvs 6834:
6835: <P>
6836: In a translation schema, the translation rules are either associated with
6837: element types or with attribute values or with a specific presentation. They
6838: are applied by the translator each time an element of the corresponding type
6839: is encountered in the translated document or each time the attribute value is
6840: carried by an element or also, each time the specific translation is attached
6841: to an element. This systematic application of the rules can be relaxed: it is
6842: possible to add a condition to one or more rules, so that these rules are only
6843: applied when the condition is true.</P>
6844: <P>
6845: A condition begins with the keyword <TT>IF</TT>, followed by a sequence of
6846: elementary conditions. Elementary conditions are separated from each other by
6847: the <TT>AND</TT> keyword. If there is only one elementary condition, this
6848: keyword is absent. The rules are only applied if all the elementary
6849: conditions are true. The elementary condition can be negative; it is then
6850: preceded by the <TT>NOT</TT> keyword.</P>
6851: <P>
6852: When the translation rule(s) controlled by the condition apply to a reference
6853: element or a reference attribute, an elementary condition can also apply to
6854: element referred by this reference. The <TT>Target</TT> keyword is used for
6855: that purpose. It must appear before the keyword defining the condition
6856: type.</P>
6857: <P>
6858: Depending on their type, some conditions may apply either to the element with
1.5 cvs 6859: which they are associated, or to one of its ancestor. In the case of an
1.1 cvs 6860: ancestor, the key word <TT>Ancestor</TT> must be used, followed by</P>
6861: <UL>
1.2 cvs 6862: <LI>either an integer which represents the number of levels in the tree
6863: between the element and the ancestor of interest,
6864: <LI>or the type name of the ancestor of interest. If that type is defined in
6865: a separate structure schema, the name of that schema must follow between
1.1 cvs 6866: parentheses.
6867: </UL>
6868: <P>
1.2 cvs 6869: There is a special case for the parent element, which can be simply written
1.5 cvs 6870: <TT>Parent</TT> instead of <TT>Ancestor 1</TT>.</P>
1.1 cvs 6871: <P>
6872: Only conditions <TT>First</TT>, <TT>Last</TT>, <TT>Referred</TT>,
6873: <TT>Within</TT>, <TT>Attributes</TT>, <TT>Presentation</TT>, <TT>Comment</TT>
6874: and those concerning an attribute or a specific presentation can apply to an
6875: ancestor. Conditions <TT>Defined</TT>, <TT>FirstRef</TT>, <TT>LastRef</TT>,
6876: <TT>ExternalRef</TT>, <TT>Alphabet</TT>, <TT>FirstAttr</TT>,
6877: <TT>LastAttr</TT>, <TT>ComputedPage</TT>, <TT>StartPage</TT>,
6878: <TT>UserPage</TT>, <TT>ReminderPage</TT>, <TT>Empty</TT> cannot be preceded by
6879: keywords <TT>Parent</TT> or <TT>Ancestor</TT>.</P>
6880: <P>
6881: In condition <TT>Referred</TT> and in the condition that applies to a named
1.5 cvs 6882: attribute, a symbol '<TT>*</TT>' can indicate that the condition is related
6883: only to the element itself. If this symbol is not present, not only the
6884: element is considered, but also its ancestor, at any level.</P>
1.1 cvs 6885: <P>
6886: The form of an elementary condition varies according to the type of
6887: condition.</P>
6888:
6889: <DIV class="subsubsection">
1.6 cvs 6890: <H4><A name=sectd5281>Conditions based on the logical position of the element</A></H4>
1.1 cvs 6891:
6892: <P>
6893: The condition can be on the position of the element in the document's logical
6894: structure tree. It is possible to test whether the element is the first
6895: (<TT>First</TT>) or last (<TT>Last</TT>) among its siblings or if it is not
6896: the first (<TT>NOT First</TT>) or not the last (<TT>NOT Last</TT>).</P>
6897: <P>
6898: It is also possible to test if the element is contained in an element of a
6899: given type (<TT>Within</TT>) or if it is not (<TT>NOT Within</TT>). If that
6900: element type is defined in a structure schema which is not the one which
6901: corresponds to the translation schema, the type name of this element must be
6902: followed, between parentheses, by the name of the structure schema which
6903: defines it.</P>
6904: <P>
6905: If the keyword <TT>Within</TT> is preceded by <TT>Immediately</TT>, the
6906: condition is satisfied only if the <EM>parent</EM> element has the type
6907: indicated. If the word <TT>Immediately</TT> is missing, the condition is
6908: satisfied if any <EM>ancestor</EM> has the type indicated.</P>
6909: <P>
6910: An integer <I>n</I> can appear between the keyword <TT>Within</TT> and the
6911: type. It specifies the number of ancestors of the indicated type that must be
6912: present for the condition to be satisfied. If the keyword
6913: <TT>Immediately</TT> is also present, the <I>n</I> immediate ancestors of the
6914: element must have the indicated type. The integer <I>n</I> must be positive
6915: or zero. It can be preceded by <TT><</TT> or <TT>></TT> to indicate a
6916: maximum or minimum number of ancestors. If these symbols are missing, the
6917: condition is satisfied only if it exists exactly <I>n</I> ancestors. When
6918: this number is missing, it is equivalent to > 0.</P>
1.11 cvs 6919: <P>
6920: If the condition applies to translation rules associated with an attribute,
6921: i.e. if it is in the <TT>ATTRIBUTES</TT> section of the presentation schema,
6922: the condition can be simply an element name. Translation rules are then
6923: executed only if the attribute is attached to an element of that type.
6924: The keyword <TT>NOT</TT> before the element name indicates that the
6925: translation rules must be executed only if the element is not of the type
6926: indicated.</P>
1.1 cvs 6927: </DIV>
6928:
6929: <DIV class="subsubsection">
1.6 cvs 6930: <H4><A name=sectd5282>Conditions on references</A></H4>
1.1 cvs 6931:
6932: <P>
6933: References may be taken into account in conditions, which can be based on the
6934: fact that the element, or one of its ancestors (unless symbol <TT>*</TT> is
6935: present), is designated by a at least one reference (<TT>Referred</TT>) or by
6936: none (<TT>NOT Referred</TT>). If the element or attribute to which the
6937: condition is attached is a reference, the condition can be based on the fact
6938: that it acts as the first reference to the designated element
6939: (<TT>FirstRef</TT>), or as the last (<TT>LastRef</TT>), or as a reference to
6940: an element located in another document (<TT>ExternalRef</TT>). Like all
6941: conditions, conditions on references can be inverted by the <TT>NOT</TT>
6942: keyword.</P>
6943: </DIV>
6944:
6945: <DIV class="subsubsection">
1.6 cvs 6946: <H4><A name=sectd5283>Conditions on the parameters</A></H4>
1.1 cvs 6947:
6948: <P>
1.6 cvs 6949: Elements which are <A href="#sectc326">parameters</A> can be given a particular
1.1 cvs 6950: condition which is based on whether or not the parameter is given a value in
6951: the document (<TT>Defined</TT> or <TT>NOT Defined</TT>, respectively).</P>
6952: </DIV>
6953:
6954: <DIV class="subsubsection">
1.6 cvs 6955: <H4><A name=sectd5284>Conditions on the alphabets</A></H4>
1.1 cvs 6956:
6957: <P>
6958: The character string base type (and only this type) can use the condition
6959: <TT>Alphabet = a</TT> which indicates that the translation rule(s) should only
6960: apply if the alphabet of the character string is the one whose name appears
6961: after the equals sign (or is not, if there is a preceding <TT>NOT</TT>
6962: keyword). This condition cannot be applied to translation rules of an
6963: attribute.</P>
6964: <P>
6965: In the current implementation of Thot, the available alphabets are the
6966: <TT>Latin</TT> alphabet and the <TT>Greek</TT> alphabet.</P>
6967: </DIV>
6968:
6969: <DIV class="subsubsection">
1.6 cvs 6970: <H4><A name=sectd5285>Conditions on page breaks</A></H4>
1.1 cvs 6971:
6972: <P>
6973: The page break base type (and only this type) can use the following
6974: conditions: <TT>ComputedPage</TT>, <TT>StartPage</TT>, <TT>UserPage</TT>, and
6975: <TT>ReminderPage</TT>. The <TT>ComputedPage</TT> condition indicates that the
6976: translation rule(s) should apply if the page break was created automatically
6977: by Thot; the <TT>StartPage</TT> condition is true if the page break is
6978: generated before the element by the <TT>Page</TT> rule of the P language; the
6979: <TT>UserPage</TT> condition applies if the page break was inserted by the
6980: user; and the <TT>ReminderPage</TT> is applied if the page break is a reminder
6981: of page breaking.</P>
6982: </DIV>
6983:
6984: <DIV class="subsubsection">
1.6 cvs 6985: <H4><A name=sectd5286>Conditions on the element's content</A></H4>
1.1 cvs 6986:
6987: <P>
6988: The condition can be based on whether or not the element is empty. An element
6989: which has no children or whose leaves are all empty is considered to be empty
6990: itself. This condition is expressed by the <TT>Empty</TT> keyword, optionally
6991: preceded by the <TT>NOT</TT> keyword.</P>
6992: </DIV>
6993:
6994: <DIV class="subsubsection">
1.6 cvs 6995: <H4><A name=sectd5287>Conditions on the presence of comments</A></H4>
1.1 cvs 6996:
6997: <P>
6998: The condition can be based on the presence or absence of comments associated
6999: with the translated element. This condition is expressed by the keyword
7000: <TT>Comment</TT>, optionally preceded by the keyword <TT>NOT</TT>.</P>
7001: </DIV>
7002:
7003: <DIV class="subsubsection">
1.6 cvs 7004: <H4><A name=sectd5288>Conditions on the presence of specific presentation rules</A></H4>
1.1 cvs 7005:
7006: <P>
7007: The condition can be based on the presence or absence of specific presentation
7008: rules associated with the translated element, whatever the rules, their value
7009: or their number. This condition is expressed by the keyword
7010: <TT>Presentation</TT>, optionally preceded by the <TT>NOT</TT> keyword.</P>
7011: </DIV>
7012:
7013: <DIV class="subsubsection">
1.6 cvs 7014: <H4><A name=sectd5289>Conditions on the presence of logical attributes</A></H4>
1.1 cvs 7015:
7016: <P>
7017: In the same way, the condition can be based on the presence or absence of
7018: attributes associated with the translated elements, no matter what the
7019: attributes or their values. The <TT>Attributes</TT> keyword expresses this
7020: condition.</P>
7021: </DIV>
7022:
7023: <DIV class="subsubsection">
1.6 cvs 7024: <H4><A name=sectd52810>Conditions on logical attributes</A></H4>
1.1 cvs 7025:
7026: <P>
7027: If the condition appears in the translation rules of an attribute, the
7028: <TT>FirstAttr</TT> and <TT>LastAttr</TT> keywords can be used to indicate that
7029: the rules must only be applied if this attribute is the first attribute for
7030: the translated element or if it is the last (respectively). These conditions
7031: can also be inverted by the <TT>NOT</TT> keyword.</P>
7032: <P>
7033: Another type of condition can only be applied to the translation rules when
7034: the element being processed (or one of its ancestors if symbol <TT>*</TT> is
7035: missing) has a certain attribute, perhaps with a certain value or, in
7036: contrast, when the element does not have this attribute with this value. The
7037: condition is specified by writing the name of the attribute after the keyword
7038: <TT>IF</TT> or <TT>AND</TT>. The <TT>NOT</TT> keyword can be used to invert
7039: the condition. If the translation rules must be applied to any element which
7040: has this attribute (or does not have it, if the condition is inverted) no
7041: matter what the attribute's value, the condition is complete. If, in
7042: contrast, the condition applies to one or more values of the attribute, these
7043: are indicated after the name of the attribute, except for reference attributes
7044: which do not have values.</P>
7045: <P>
7046: The representation of the values of an <A name="relattr">attribute</A> in a
7047: condition depends on the attribute's type. For attributes with enumerated or
7048: textual types, the value (a name or character string between apostrophes,
7049: respectively) is simply preceded by an equals sign. For numeric attributes,
7050: the condition can be based on a single value or on a range of values. In the
7051: case of a unique value, this value (an integer) is simply preceded by an
7052: equals sign. Conditions based on ranges of values have several forms:</P>
7053: <UL>
1.2 cvs 7054: <LI>all values less than a given value (the value is preceded by a ``less
1.1 cvs 7055: than'' sign).
1.2 cvs 7056: <LI>all values greater than a given value (the value is preceded by a
7057: ``greater than'' sign).
7058: <LI>all values falling in an interval, bounds included. The range of values
7059: is then specified <TT>IN [</TT>Minimum <TT>..</TT>Maximum<TT>]</TT>, where
7060: Minimum and Maximum are integers.
1.1 cvs 7061: </UL>
7062: <P>
1.2 cvs 7063: All numeric values may be negative. The integer is simply preceded by a minus
1.1 cvs 7064: sign.</P>
7065: <P>
7066: Both local and global attributes can be used in conditions.</P>
7067: </DIV>
7068:
7069: <DIV class="subsubsection">
1.6 cvs 7070: <H4><A name=sectd52811>Conditions on specific presentation rules</A></H4>
1.1 cvs 7071:
7072: <P>
7073: It is possible to apply translation rules only when the element being
7074: processed has or does not have a specific presentation rule, possibly with a
7075: certain value. The condition is specified by writing the name of the
7076: presentation rule after the keyword <TT>IF</TT> or <TT>AND</TT>. The
7077: <TT>NOT</TT> keyword can be used to invert the condition. If the translation
7078: rules must be applied to any element which has this presentation rule (or does
7079: not have it, if the condition is inverted) no matter what the rule's value,
7080: the condition is complete. If, in contrast, the condition applies to one or
7081: more values of the rule, these are indicated after the name of the
7082: attribute.</P>
7083: <P>
7084: The representation of presentation rule values in a condition is similar to
7085: that for attribute values. The representation of these values depend on the
7086: type of the presentation rule. There are three categories of presentation
7087: rules:</P>
7088: <UL>
7089: <LI>those taking numeric values (<TT>Size, Indent, LineSpacing,
7090: LineWeight</TT>),
7091: <LI>those with values taken from a predefined list (<TT>Adjust, Justify,
7092: Hyphenate, Style, Font, UnderLine, Thickness, LineStyle</TT>),
7093: <LI>those whose value is a name (<TT>FillPattern, Background,
7094: Foreground</TT>).
7095: </UL>
7096: <P>
7097: For presentation rules which take numeric values, the condition can take a
7098: unique value or a range of values. In the case of a unique value, this value
7099: (an integer) is simply preceded by an equals sign. Conditions based on ranges
7100: of values have several forms:</P>
7101: <UL>
1.2 cvs 7102: <LI>all values less than a given value (the value is preceded by a ``less
1.1 cvs 7103: than'' sign).
1.2 cvs 7104: <LI>all values greater than a given value (the value is preceded by a
7105: ``greater than'' sign).
7106: <LI>all values falling in an interval, bounds included. The range of values
7107: is then specified <TT>IN [</TT>Minimum <TT>..</TT>Maximum<TT>]</TT>, where
7108: Minimum and Maximum are integers.
1.1 cvs 7109: </UL>
7110: <P>
1.2 cvs 7111: Values for the <TT>Indent</TT>rule may be negative. The integer is then
7112: simply preceded by a minus sign and represents how far the first line starts
7113: to the left of the other lines.</P>
1.1 cvs 7114: <P>
7115: For presentation rules whose values are taken from predefined lists, the value
7116: which satisfies the condition is indicated by an equals sign followed by the
7117: name of the value.</P>
7118: <P>
7119: For presentation rule whose values are names, the value which satisfies the
7120: condition is indicated by the equals sign followed by the value's name. The
7121: names of fill patterns (the <TT>FillPattern</TT> rule) and of colors (the
7122: <TT>Foreground</TT> and <TT>Background</TT> rules) known to Thot are the same
7123: as in the P language.</P>
7124: <P>
7125: The syntax of conditions based on the specific presentation is the same as the
1.6 cvs 7126: syntax used to express the <A href="#sectc5224">translation of specific
1.1 cvs 7127: presentation rules</A>.</P>
7128: <P>
7129: When a condition has only one rule, the condition is simply followed by that
7130: rule. If it has several rules, they are placed after the condition between
7131: the keywords <TT>BEGIN</TT> and <TT>END</TT>.</P>
7132: <PRE>
7133: ConditionSeq = Condition [ 'AND' Condition ] .
7134: Condition = [ 'NOT' ] [ 'Target' ] Cond .
7135: Cond = CondElem / CondAscend .
7136: CondElem ='FirstRef' / 'LastRef' /
7137: 'ExternalRef' /
7138: 'Defined' /
7139: 'Alphabet' '=' Alphabet /
7140: 'ComputedPage' / 'StartPage' /
7141: 'UserPage' / 'ReminderPage' /
7142: 'Empty' /
1.11 cvs 7143: ElemID /
1.1 cvs 7144: 'FirstAttr' / 'LastAttr' .
7145: CondAscend = [ Ascend ] CondOnAscend .
7146: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType .
7147: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] .
7148: CondRelLevel = NUMBER .
7149: CondOnAscend ='First' / 'Last' /
7150: 'Referred' /
7151: [ 'Immediately' ] 'Within' [ NumParent ]
7152: ElemID [ ExtStruct ] /
7153: 'Attributes' /
7154: AttrID [ RelatAttr ] /
7155: 'Presentation' /
7156: PresRule /
7157: 'Comment' .
7158: NumParent = [ GreaterLess ] NParent .
7159: GreaterLess = '>' / '<' .
7160: NParent = NUMBER.
7161: ExtStruct = '(' ElemID ')' .
7162: Alphabet = NAME .
7163: RelatAttr ='=' Value /
7164: '>' [ '-' ] Minimum /
7165: '<' [ '-' ] Maximum /
7166: 'IN' '[' [ '-' ] MinInterval '..'
7167: [ '-' ] MaxInterval ']' .
7168: Value = [ '-' ] IntegerVal / TextVal / AttrValue .
7169: Minimum = NUMBER .
7170: Maximum = NUMBER .
7171: MinInterval = NUMBER .
7172: MaxInterval = NUMBER .
7173: IntegerVal = NUMBER .
7174: TextVal = STRING .
7175: AttrValue = NAME .
7176: </PRE>
7177: <BLOCKQUOTE class="example">
7178: <P>
7179: <STRONG>Example:</STRONG></P>
7180: <P>
1.3 cvs 7181: Suppose that after each element of type Section_Title it is useful to produce
7182: the text <TT>\label{SectX}</TT> where <TT>X</TT> represents the section number,
7183: but only if the section is designated by one or more references in the
7184: document. The following conditional rule produces this effect:</P>
1.1 cvs 7185: <PRE>
7186: RULES
7187: Section_Title :
7188: IF Referred
1.5 cvs 7189: Create ('\label{Sect' Value(UniqueSectNum) '}\12') After;
1.1 cvs 7190: </PRE>
7191: <P>
1.6 cvs 7192: (the declaration of the <A href="#sectc5224"><TT>UniqueSectNum</TT>
1.3 cvs 7193: counter</A> is given above). The string <TT>\12</TT> represents a line
1.1 cvs 7194: break.</P>
7195: </BLOCKQUOTE>
7196: <BLOCKQUOTE class="example">
7197: <P>
7198: <STRONG>Example:</STRONG></P>
7199: <P>
1.3 cvs 7200: Suppose that for elements of the Elmnt type it would be useful to produce a
7201: character indicating the value of the numeric attribute Level associated with
7202: the element: an ``A'' for all values of Level less than 3, a ``B'' for values
7203: between 3 and 10 and a ``C'' for values greater than 10. This can be achieved
7204: by writing the following rules for the Elmnt type:</P>
1.1 cvs 7205: <PRE>
7206: RULES
7207: Elmnt :
7208: BEGIN
7209: IF Level < 3
7210: Create 'A';
7211: IF Level IN [3..10]
7212: Create 'B';
7213: IF Level > 10
7214: Create 'C';
7215: END;
7216: </PRE>
7217: </BLOCKQUOTE>
7218: </DIV>
7219: </DIV>
7220:
7221: <DIV class="subsection">
1.6 cvs 7222: <H3><A name=sectc529>Translation rules</A></H3>
1.1 cvs 7223:
7224: <P>
1.14 cvs 7225: Fifteen types of translation rules can be associated with element types and
1.1 cvs 7226: attribute values. They are the <TT>Create</TT>, <TT>Write</TT>,
7227: <TT>Read</TT>, <TT>Include</TT>, <TT>Get</TT>, <TT>Copy</TT>, <TT>Use</TT>,
7228: <TT>Remove</TT>, <TT>NoTranslation</TT>, <TT>NoLineBreak</TT>,
1.14 cvs 7229: <TT>ChangeMainFile</TT>, <TT>RemoveFile</TT>, <TT>Set</TT>, <TT>Add</TT>,
7230: <TT>Indent</TT>, rules. Each rule has its own syntax, although they are
7231: all based on very similar models.</P>
1.1 cvs 7232: <PRE>
7233: SimpleRule = 'Create' [ 'IN' VarID ] Object
7234: [ Position ] ';' /
7235: 'Write' Object [ Position ] ';' /
7236: 'Read' BufferID [ Position ] ';' /
7237: 'Include' File [ Position ] ';' /
7238: 'Get' [ RelPosition ] ElemID
7239: [ ExtStruct ]
7240: [ Position ] ';' /
7241: 'Copy' [ RelPosition ] ElemID
7242: [ ExtStruct ]
7243: [ Position ] ';' /
7244: 'Use' TrSchema [ 'For' ElemID ] ';' /
7245: 'Remove' ';' /
7246: 'NoTranslation' ';' /
7247: 'NoLineBreak' ';' /
7248: 'ChangeMainFile' VarID [ Position ] ';' /
1.14 cvs 7249: 'RemoveFile' VarID [ Position ] ';' /
1.10 cvs 7250: 'Set' CounterID InitValue [ Position ] ';' /
7251: 'Add' CounterID Increment [ Position ] ';' /
7252: 'Indent' [ 'IN' VarID ] [ IndentSign ]
7253: IndentValue [ Position ] ';' .
1.1 cvs 7254: </PRE>
7255: </DIV>
7256:
7257: <DIV class="subsection">
1.6 cvs 7258: <H3><A name=sectc5210>The <TT>Create</TT> rule</A></H3>
1.1 cvs 7259:
7260: <P>
7261: The most frequently used rule is undoubtedly the <TT>Create</TT> rule, which
7262: generates fixed or variable text (called an <EM>object</EM>) in the output
7263: file. The generated text can be made to appear either before or after the
7264: content of the element to which the rule applies. The rule begins with the
7265: <TT>Create</TT> keyword, followed by a specifier for the object and a keyword
7266: (<TT>Before</TT> or <TT>After</TT>) indicating the position of the generated
1.6 cvs 7267: text (<A href="#sectc5222">before or after</A> the element's content). If the
1.1 cvs 7268: position is not indicated, the object will be generated before the element's
7269: content. This rule, like all translation rules, is terminated by a
7270: semicolon.</P>
7271: <P>
7272: The <TT>Create</TT> keyword can be followed by the <TT>IN</TT> keyword and by
7273: the name of a variable. This means that the text generated by the rule must
7274: not be written in the main output file, but in the file whose name is
7275: specified by the variable.</P>
7276: <P>
7277: This allows the translation program to generate text in different files during
1.14 cvs 7278: the same run. These files do not need to be explicitely declared or opened.
7279: They do not need to be closed either, but if they contain temporary data,
7280: they can be removed (see the <A href="#sectc5220a"><TT>RemoveFile</TT>
7281: rule</A>). As soon as the translation program
1.1 cvs 7282: executes a <TT>Create</TT> rule for a file that is not yet open, it opens the
7283: file. These files are closed when the translation is finished.</P>
7284: <PRE>
7285: 'Create' [ 'IN' VarID ] Object
7286: [ Position ] ';'
7287: Object = ConstID / CharString /
7288: BufferID /
7289: VarID /
7290: '(' Function < Function > ')' /
7291: AttrID /
7292: 'Value' /
7293: 'Content' /
7294: 'Comment' /
7295: 'Attributes' /
7296: 'Presentation' /
7297: 'RefId' /
7298: 'PairId' /
7299: 'FileDir' /
7300: 'FileName' /
7301: 'Extension' /
7302: 'DocumentName' /
7303: 'DocumentDir' /
7304: [ 'Referred' ] ReferredObject .
7305: Position ='After' / 'Before' .
7306:
7307: ReferredObject = VarID /
7308: ElemID [ ExtStruct ] /
7309: 'RefId' /
7310: 'DocumentName' /
7311: 'DocumentDir' .
7312: </PRE>
7313: <P>
7314: The object to be generated can be:</P>
7315: <UL>
1.2 cvs 7316: <LI>a constant string, specified by its name if it is declared in the schema's
1.5 cvs 7317: <TT>CONST</TT> section, or given directly as a value between apostrophes;
1.1 cvs 7318: <LI>the contents of a buffer, designated by the name of the buffer;
1.2 cvs 7319: <LI>a variable, designated by its name if it is declared in the translation
1.5 cvs 7320: schema's <TT>VAR</TT> section, or given directly between parentheses. The text
1.2 cvs 7321: generated is the value of that variable evaluated for the element to which the
1.1 cvs 7322: rule applies.
1.2 cvs 7323: <LI>the value of an attribute, if the element being translated has this
7324: attribute. The attribute is specified by its name;
7325: <LI>the value of a specific presentation rule. This object can only be
1.1 cvs 7326: generated if the translation rule is for a <A href="#prestransl">specific
1.2 cvs 7327: presentation rule</A>. It is specified by the <TT>Value</TT> keyword;
7328: <LI>the element's content. That is, the content of the leaves of the subtree
7329: of the translated element. This is specified by the <TT>Content</TT> keyword;
7330: <LI>the comment attached to the element. When the element doesn't have a
7331: comment, nothing is generated. This is indicated by the <TT>Comment</TT>
7332: keyword;
7333: <LI>the translation of all attributes of the element (which is primarily used
1.6 cvs 7334: to apply the attribute translation rules <A href="#sectc5222">before</A> those of
1.2 cvs 7335: the element type). This is specified by the <TT>Attributes</TT> keyword.
7336: <LI>the translation of all of the element's specific presentation rules (which
7337: is primarily used to apply the translation rules for the specific presentation
1.6 cvs 7338: rules <A href="#sectc5222">before</A> those of the element or its attributes).
1.2 cvs 7339: This option is specified by the <TT>Presentation</TT> keyword;
1.5 cvs 7340: <LI>The value of the reference's identifier.<BR>Thot associates a unique
1.2 cvs 7341: identifier with each element in a document. This identifier (called
7342: <EM>reference's identifier</EM> or <EM>label</EM>) is a character string
7343: containing the letter `L' followed by digits. Thot uses it in references for
7344: identifying the referred element.<BR>The <TT>RefId</TT> keyword produces the
7345: reference's identifier of the element to which the translation rule is
7346: applied, or the reference's identifier of its first ancestor that is referred
7347: by a reference or that can be referred by a reference.
7348: <LI>the value of a mark pair's unique identifier. This may only be used for
1.6 cvs 7349: <A href="#sectd3285">mark pairs</A> and is indicated by the <TT>PairId</TT>
1.2 cvs 7350: keyword.
7351: <LI>the directory containing the file being generated (this string includes an
7352: ending '/', if it is not empty). This is indicated by the <TT>FileDir</TT>
7353: keyword.
7354: <LI>the name of the file being generated (only the name, without the directory
7355: and without the extension). This is indicated by the <TT>FileName</TT>
7356: keyword.
7357: <LI>the extension of the file being generated (this string starts with a dot,
7358: if it is not empty). This is indicated by the <TT>Extension</TT> keyword.
7359: <LI>the name of the document being translated. This is indicated by the
7360: <TT>DocumentName</TT> keyword.
7361: <LI>the directory containing the document being translated. This is indicated
7362: by the <TT>DocumentDir</TT> keyword.
1.1 cvs 7363: </UL>
7364: <P>
7365: When the rule applies to a reference (an element or an attribute defined as a
7366: reference in the structure schema), it can generate a text related to the
7367: element referred by that reference. The rule name is then followed the
7368: <TT>Referred</TT> keyword and a specification of the object to be generated
7369: for the referred element. This specification can be:</P>
7370: <UL>
1.2 cvs 7371: <LI>the name of a variable. The rule generates the value of that variable,
1.1 cvs 7372: computed for the referred element.
1.2 cvs 7373: <LI>an element type. The rule generates the translation of the element of
7374: that type, which is in the subtree of the referred element. If this element
7375: is not defined in the structure schema which corresponds to the translation
7376: schema (that is, an object defined in another schema), the element's type name
7377: must be followed by the name of its structure schema between parentheses.
7378: <LI>the <TT>RefId</TT> keyword. The rule generates the reference's identifier
1.1 cvs 7379: of the referred element.
1.2 cvs 7380: <LI>the <TT>DocumentName</TT> keyword. The rule generates the name of the
1.1 cvs 7381: document to which the referred element belongs.
1.2 cvs 7382: <LI>the <TT>DocumentDir</TT> keyword. The rule generates the name of the
1.1 cvs 7383: directory that contains the document of the referred element.
7384: </UL>
7385: </DIV>
7386:
7387: <DIV class="subsection">
1.6 cvs 7388: <H3><A name=sectc5211>The <TT>Write</TT> rule</A></H3>
1.1 cvs 7389:
7390: <P>
7391: The <TT>Write</TT> has the same syntax as the <TT>Create</TT> rule. It also
7392: produces the same effect, but the generated text is displayed on the user's
7393: terminal during the translation of the document, instead of being produced in
7394: the translated document. This is useful for helping the user keep track of
7395: the progress of the translation and for prompting the user on the terminal for
7396: input required by the <TT>Read</TT> rule.</P>
7397: <PRE>
7398: 'Write' Object [ Position ] ';'
7399: </PRE>
7400: <P>
7401: Notice: if the translator is launched by the editor (by the ``Save as''
7402: command), messages produced by the <TT>Write</TT> rule are not displayed.</P>
7403: <BLOCKQUOTE class="example">
7404: <P>
7405: <STRONG>Example:</STRONG></P>
7406: <P>
1.3 cvs 7407: To make the translator display the number of each section being translated on
7408: the user's terminal, the following rule is specified for the
7409: <TT>Section</TT> element type:</P>
1.1 cvs 7410: <PRE>
7411: Section : BEGIN
7412: Write VarSection;
7413: ...
7414: END;
7415: </PRE>
7416: <P>
1.3 cvs 7417: (see <A href="#varsectexample">above</A> for the definition of
7418: the <TT>VarSection</TT> variable).</P>
1.1 cvs 7419: <P>
7420: To display text on the terminal before issuing a read operation with the
7421: <TT>Read</TT> rule, the following rule is used:</P>
7422: <PRE>
7423: BEGIN
7424: Write 'Enter the name of the destination: ';
7425: ...
7426: END;
7427: </PRE>
7428: </BLOCKQUOTE>
7429: </DIV>
7430:
7431: <DIV class="subsection">
1.6 cvs 7432: <H3><A name=sectc5212>The <TT>Read</TT> rule</A></H3>
1.1 cvs 7433:
7434: <P>
7435: The <TT>Read</TT> rule reads text from the terminal during the translation of
7436: the document and saves the text read in one of the buffers declared in the
7437: <TT>BUFFERS</TT> section of the schema. The buffer to be used is indicated by
7438: its name, after the <TT>READ</TT> keyword. This name can be followed, as in
7439: the <TT>Create</TT> and <TT>Write</TT> rules, by a keyword indicating if the
7440: read operation must be performed <TT>Before</TT> or <TT>After</TT> the
7441: translation of the element's content. If this keyword is absent, the read
7442: operation is done beforehand. The text is read into the buffer and remains
1.5 cvs 7443: there until a rule using the same buffer - possibly the same rule - is
1.1 cvs 7444: applied.</P>
7445: <PRE>
7446: 'Read' BufferID [ Position ] ';'
7447: </PRE>
7448: <BLOCKQUOTE class="example">
7449: <P>
7450: <STRONG>Example:</STRONG></P>
7451: <P>
1.3 cvs 7452: The following set of rules tells the user that the translator is waiting for
7453: the entry of some text, reads this text into a buffer and copies the text into
1.1 cvs 7454: the translated document.</P>
7455: <PRE>
7456: BEGIN
7457: Write 'Enter the name of the destination: ';
7458: Read DestName;
7459: Create DestName;
7460: ...
7461: END;
7462: </PRE>
7463: <P>
1.5 cvs 7464: (see <A href="#destname">above</A> the definition of <TT>DestName</TT>).</P>
1.1 cvs 7465: </BLOCKQUOTE>
7466: </DIV>
7467:
7468: <DIV class="subsection">
1.6 cvs 7469: <H3><A name=sectc5213>The <TT>Include</TT> rule</A></H3>
1.1 cvs 7470:
7471: <P>
7472: The <TT>Include</TT> rule, like the <TT>Create</TT> rule, is used to produce
7473: text in the translated document. It inserts constant text which is not
7474: defined in the translation schema, but is instead taken from a file. The
7475: file's name is specified after the <TT>Include</TT> keyword, either directly
7476: as a character string between apostrophes or as the name of one of the buffers
7477: declared in the <TT>BUFFERS</TT> section of the schema. In the latter case,
7478: the buffer is assumed to contain the file's name. This can be used when the
7479: included file's name is known only at the moment of translation. This only
7480: requires that the <TT>Include</TT> rule is preceded by a <TT>Read</TT> rule
7481: which puts the name of the file desired by the user into the buffer.</P>
7482: <P>
7483: Like the other rules, it is possible to specify whether the inclusion will
7484: occur before or after the element's content, with the default being before.
7485: The file inclusion is only done at the moment of translation, not during the
7486: compilation of the translation schema. Thus, the file to be included need not
7487: exist during the compilation, but it must be accessible at the time of
7488: translation. Its contents can also be modified between two translations, thus
7489: producing different results, even if neither the document or the translation
7490: schema are modified.</P>
7491: <P>
7492: During translation, the file to be included is searched for along the schema
7493: directory path (indicated by the environment variable <TT>THOTSCH</TT>). The
7494: file name is normally only composed of a simple name, without specification of
1.12 cvs 7495: a complete file path. However, if the filename starts with a '/', it is
7496: considered as an absolute path.</P>
1.1 cvs 7497: <PRE>
1.6 cvs 7498: 'Include' File [ Position ] ';'
7499: File = FileName / BufferID .
7500: FileName = STRING .
1.1 cvs 7501: </PRE>
7502: <BLOCKQUOTE class="example">
7503: <P>
7504: <STRONG>Example:</STRONG></P>
7505: <P>
1.3 cvs 7506: Suppose that it is desirable to print documents of the Article class with a
7507: formatter which requires a number of declarations and definitions at the
7508: beginning of the file. The <TT>Include</TT>rule can be used to achieve this.
7509: All the declarations and definitions a replaced in a file called
7510: <TT>DeclarArt</TT> and then the <TT>Article</TT> element type is given the
1.1 cvs 7511: following rule:</P>
7512: <PRE>
7513: Article : BEGIN
7514: Include 'DeclarArt' Before;
7515: ...
7516: END;
7517: </PRE>
7518: </BLOCKQUOTE>
7519: </DIV>
7520:
7521: <DIV class="subsection">
1.6 cvs 7522: <H3><A name=sectc5214>The <TT>Get</TT> rule</A></H3>
1.1 cvs 7523:
7524: <P>
7525: The <TT>Get</TT> rule is used to change the order in which the elements appear
7526: in the translated document. More precisely, it produces the translation of a
7527: specified element before or after the translation of the content of the
7528: element to which the rule applies. The <TT>Before</TT> and <TT>After</TT>
7529: keywords are placed at the end of the rule to specify whether the operation
7530: should be performed before or after translation of the rule's element (the
7531: default is before). The type of the element to be moved must be specified
7532: after the <TT>Get</TT> keyword, optionally preceded by a keyword indicating
7533: where the element will be found in the logical structure of the document:</P>
7534: <DL>
7535: <DT><TT>Included</TT></DT>
1.2 cvs 7536: <DD>The element to be moved is the first element of the indicated type which is
1.1 cvs 7537: found inside the element to which the rule applies.
7538: </DD>
7539: <DT><TT>Referred</TT></DT>
1.2 cvs 7540: <DD>This keyword can only be used if the rule applies to a reference element.
7541: The element to be moved is either the element designated by the reference (if
7542: that element is of the specified type), or the first element of the desired
7543: type contained within the element designated by the reference.
1.1 cvs 7544: </DD>
7545: <DT>no keyword</DT>
1.2 cvs 7546: <DD>If the element to be moved is an associated element, defined in the <A
1.6 cvs 7547: href="#sectc314"><TT>ASSOC</TT> section</A> of the structure schema, all
1.2 cvs 7548: associated elements of this type which have not been translated yet are then
7549: translated. Certain elements may in fact have already been translated by a
7550: <TT>Get Referred</TT> rule.
1.1 cvs 7551: <P>
7552: If the element to be moved is not an associated element, the translator takes
7553: the first element of the indicated type from among the siblings of the rule's
7554: element. This is primarily used to change the order of the components of an
7555: aggregate.</P>
7556: </DD>
7557: </DL>
7558: <P>
7559: If the element to be moved is defined in a structure schema which is not the
7560: one which corresponds to the translation schema (in the case of an included
7561: object with a different schema), the type name of this element must be
7562: followed, between parentheses, by the name of the structure schema which
7563: defines it.</P>
7564: <PRE>
1.6 cvs 7565: 'Get' [ RelPosition ] ElemID
7566: [ ExtStruct ]
7567: [ Position ] ';' /
7568: RelPosition = 'Included' / 'Referred' .
1.1 cvs 7569: ExtStruct = '(' ElemID ')' .
7570: </PRE>
7571: <P>
7572: The <TT>Get</TT> rule has no effect if the element which it is supposed to
7573: move has already been translated. Thus, the element will not be duplicated.
7574: It is generally best to associate the rule with the first element which will
7575: be encountered by the translator in its traversal of the document. Suppose an
7576: aggregate has two elements <TT>A</TT> and <TT>B</TT>, with <TT>A</TT>
7577: appearing first in the logical structure. To permute these two elements, a
7578: <TT>Get B before</TT> rule should be associated with the <TT>A</TT> element
7579: type, not the inverse. Similarly, a rule of the form <TT>Get Included X
7580: After</TT>, even though syntactically correct, makes no sense since, by the
7581: time it will be applied, after the translation of the contents of the element
7582: to which it is attached, the <TT>X</TT> element will already have been
7583: translated.</P>
7584: <P>
7585: The <TT>Get</TT> rule is the only way to obtain the translation of the
7586: associated elements. In fact, the translator only traverses the primary tree
7587: of the document and thus does not translate the associated elements, except
7588: when the translation is explicitly required by a <TT>Get Referred Type</TT> or
7589: <TT>Get Type</TT> rule where <TT>Type</TT> is an associated element type.</P>
7590: <BLOCKQUOTE class="example">
7591: <P>
7592: <STRONG>Example:</STRONG></P>
7593: <P>
1.3 cvs 7594: The structure schema defined figures as associated element which are composed
7595: of some content and a caption. Moreover, it is possible to make references to
7596: figures, using elements of the <TT>RefFigure</TT> type:</P>
1.1 cvs 7597: <PRE>
7598: ...
7599: RefFigure = REFERENCE(Figure);
7600: ASSOC
1.6 cvs 7601: Figure = BEGIN
7602: Content = NATURE;
7603: Caption = Text;
7604: END;
1.1 cvs 7605: ...
7606: </PRE>
7607: <P>
1.3 cvs 7608: Suppose it would be useful to make a figure appear in the translated document
7609: at the place in the text where the first reference to the figure is made. If
7610: some figures are not referenced, then they would appear at the end of the
7611: document. Also, each figure's caption should appear before the content. The
7612: following rules in the translation schema will produce this result:</P>
1.1 cvs 7613: <PRE>
7614: Article : BEGIN
7615: ...
7616: Get Figures After;
7617: END;
7618: RefFigure : BEGIN
7619: If FirstRef Get Referred Figure;
7620: ...
7621: END;
7622: Content : BEGIN
7623: Get Caption Before;
7624: ...
7625: END;
7626: </PRE>
7627: </BLOCKQUOTE>
7628: </DIV>
7629:
7630: <DIV class="subsection">
1.6 cvs 7631: <H3><A name=sectc5215>The <TT>Copy</TT> rule</A></H3>
1.1 cvs 7632:
7633: <P>
7634: Like the <TT>Get</TT> rule, the <TT>Copy</TT> rule generates the translation
7635: of a specified element, but it acts even if the element has already been
7636: translated and it allows to copy it or to translate it later. Both rules have
7637: the same syntax.</P>
7638: <PRE>
7639: 'Copy' [ RelPosition ] ElemID
7640: [ ExtStruct ] [ Position ] ';'
7641: </PRE>
7642: </DIV>
7643:
7644: <DIV class="subsection">
1.6 cvs 7645: <H3><A name=sectc5216>The <TT>Use</TT> rule</A></H3>
1.1 cvs 7646:
7647: <P>
7648: The <TT>Use</TT> rule specifies the translation schema to be applied to
7649: objects of a certain class that are part of the document. This rule only
7650: appears in the rules for the root element of the document (the first type
7651: defined after the <TT>STRUCT</TT> keyword in the structure schema) or the
7652: rules of an element defined by an external structure (by another structure
7653: schema). Also, the <TT>Use</TT> rule cannot be conditional.</P>
7654: <P>
7655: If the rule is applied to an element defined by an external structure, the
7656: <TT>Use</TT> keyword is simply followed by the name of the translation schema
7657: to be used for element constructed according to that external structure. If
7658: the rule is applied to the document's root element, it is formed by the
7659: <TT>Use</TT> keyword followed by the translation schema's name, the
7660: <TT>For</TT> keyword and the name of the external structure to which the
7661: indicated translation schema should be applied.</P>
7662: <PRE>
7663: 'Use' TrSchema [ 'For' ElemID ] ';'
7664: TrSchema = NAME .
7665: </PRE>
7666: <P>
7667: If no <TT>Use</TT> rule defines the translation schema to be used for an
7668: external structure which appears in a document, the translator asks the user,
7669: during the translation process, which schema should be used. Thus, it is not
7670: necessary to give the translation schema a <TT>Use</TT> rule for every
7671: external structure used, especially when the choice of translation schemas is
7672: to be left to the user.</P>
7673: <P>
7674: Notice: if the translator is launched by the editor (by the ``Save as''
7675: command), prompts are not displayed.</P>
7676: <BLOCKQUOTE class="example">
7677: <P>
7678: <STRONG>Example:</STRONG></P>
7679: <P>
1.4 cvs 7680: The <TT>Article</TT> structure schema uses the
7681: <TT>Formula</TT> external structure, defined by another structure schema, for
1.1 cvs 7682: mathematical formulas:</P>
7683: <PRE>
7684: STRUCTURE Article;
7685: ...
7686: STRUCT
7687: Article = ...
7688: ...
7689: Formula_in_text = Formula;
7690: Isolated_formula = Formula;
7691: ...
7692: END
7693: </PRE>
7694: <P>
1.3 cvs 7695: Suppose that it would be useful to use the <TT>FormulaT</TT> translation schema
7696: for the formulas of an article. This can be expressed in two different ways in
1.4 cvs 7697: the <TT>Article</TT> class translation schema, using the rules:</P>
1.1 cvs 7698: <PRE>
7699: RULES
7700: Article :
7701: Use FormulaT for Formula;
7702: </PRE>
7703: <P>
7704: or:</P>
7705: <PRE>
7706: RULES
7707: ...
7708: Formula :
7709: Use FormulaT;
7710: </PRE>
7711: </BLOCKQUOTE>
7712: </DIV>
7713:
7714: <DIV class="subsection">
1.6 cvs 7715: <H3><A name=sectc5217>The <TT>Remove</TT> rule</A></H3>
1.1 cvs 7716:
7717: <P>
7718: The <TT>Remove</TT> rule indicates that nothing should be generated, in the
7719: translated document, for the content of the element to which the rule applies.
7720: The content of that element is simply ignored by the translator. This does
7721: not prevent the generation of text for the element itself, using the
7722: <TT>Create</TT> or <TT>Include</TT> rules, for example.</P>
7723: <P>
7724: The <TT>Remove</TT> rule is simply written with the <TT>Remove</TT> keyword.
7725: It is terminated, like all rules, by a semicolon.</P>
7726: <PRE>
7727: 'Remove' ';'
7728: </PRE>
7729: </DIV>
7730:
7731: <DIV class="subsection">
1.6 cvs 7732: <H3><A name=sectc5218>The <TT>NoTranslation</TT> rule</A></H3>
1.1 cvs 7733:
7734: <P>
7735: The <TT>NoTranslation</TT> rule indicates to the translator that it must not
7736: translate the content of the leaves of the element to which it applies. In
7737: contrast to the <TT>Remove</TT> rule, it does not suppress the content of the
7738: element, but it inhibits the translation of character strings, symbols, and
7739: graphical elements contained in the element. These are retrieved so that
7740: after the translation of the document, the rules of the <A
1.6 cvs 7741: href="#sectc5225"><TT>TEXTTRANSLATE</TT>, <TT>SYMBTRANSLATE</TT> and
1.1 cvs 7742: <TT>GRAPHTRANSLATE</TT> sections</A> will not be applied to them.</P>
7743: <P>
7744: The <TT>NoTranslation</TT> rule is written with the <TT>NoTranslation</TT>
7745: keyword followed by a semicolon.</P>
7746: <PRE>
7747: 'NoTranslation' ';'
7748: </PRE>
7749: </DIV>
7750:
7751: <DIV class="subsection">
1.6 cvs 7752: <H3><A name=sectc5219>The <TT>NoLineBreak</TT> rule</A></H3>
1.1 cvs 7753:
7754: <P>
7755: The <TT>NoLineBreak</TT> rule indicates to the translator that it must not
7756: generate additional line breaks in the output produced for the element to
1.6 cvs 7757: which it applies. This is as if it was an <A href="#sectc522">instruction
1.1 cvs 7758: <TT>LINELENGTH 0;</TT></A> at the beginning of the translation schema, but
7759: only for the current element.</P>
7760: <P>
7761: The <TT>NoLineBreak</TT> rule is written with the <TT>NoLineBreak</TT> keyword
7762: followed by a semicolon.</P>
7763: <PRE>
7764: 'NoLineBreak' ';'
7765: </PRE>
7766: </DIV>
7767:
7768: <DIV class="subsection">
1.6 cvs 7769: <H3><A name=sectc5220>The <TT>ChangeMainFile</TT> rule</A></H3>
1.1 cvs 7770:
7771: <P>
7772: When the translation program starts, it opens a main output file, whose name
1.14 cvs 7773: is given as a parameter of the translator. All <A
7774: href="#sectc5210"><TT>Create</TT> rules</A> without explicit indication of
7775: the output file write sequentially in this file. When a
7776: <TT>ChangeMainFile</TT> rule is executed, the main output file is closed and
7777: it is replaced by a new one, whose name is specified in the
7778: <TT>ChangeMainFile</TT> rule. The <TT>Create</TT> rules without indication of
7779: the output file that are then executed write in this new file. Several
1.1 cvs 7780: <TT>ChangeMainFile</TT> rules can be executed during the same translation, for
7781: dividing the main output into several files.</P>
7782: <P>
7783: This rule is written with the <TT>ChangeMainFile</TT> keyword followed by the
1.14 cvs 7784: name of a variable that specifies the name of the new main file. The keyword
1.1 cvs 7785: <TT>Before</TT> or <TT>After</TT> can be placed at the end of the rule to
7786: specify whether the operation should be performed before or after translation
7787: of the rule's element (the default is before). This rule, like all translation
7788: rules, is terminated by a semicolon.</P>
7789: <PRE>
7790: 'ChangeMainFile' VarID [ Position ] ';'
7791: </PRE>
7792: <BLOCKQUOTE class="example">
7793: <P>
7794: <STRONG>Example:</STRONG></P>
7795: <P>
1.3 cvs 7796: To generate the translation of each section in a different file, the following
7797: rule can be associated with type <TT>Section</TT>. That rule uses the <A
7798: href="#varoutputfile"><TT>VarOutpuFile</TT> variable</A> defined above.</P>
1.1 cvs 7799: <PRE>
7800: Section:
7801: ChangeMainFile VarOutpuFile Before;
7802: </PRE>
7803: <P>
1.3 cvs 7804: If <TT>output.txt</TT> is the name of the output file specified when starting
7805: the translation program, translated sections are written in files
1.1 cvs 7806: <TT>output1.txt</TT>, <TT>output2.txt</TT>, etc.</P>
7807: </BLOCKQUOTE>
7808: </DIV>
7809:
7810: <DIV class="subsection">
1.14 cvs 7811: <H3><A name=sectc5220a>The <TT>RemoveFile</TT> rule</A></H3>
7812:
7813: <P>
7814: Files may be used for storing temporary data that are no longer needed when
7815: the translation of a document is complete. These files may be removed by
7816: the <TT>RemoveFile</TT> rule.</P>
7817: <P>
7818: This rule is written with the <TT>RemoveFile</TT> keyword followed by the
7819: name of a variable that specifies the name of the file to be
7820: removed. The keyword <TT>Before</TT> or <TT>After</TT> can be placed at the
7821: end of the rule to specify whether the operation should be performed before
7822: or after translation of the rule's element (the default is before). This
7823: rule, like all translation rules, is terminated by a semicolon.</P>
7824: <PRE>
7825: 'RemoveFile' VarID [ Position ] ';'
7826: </PRE>
7827: </DIV>
7828:
7829: <DIV class="subsection">
1.6 cvs 7830: <H3><A name=sectc5221>The <TT>Set</TT> and <TT>Add</TT> rules</A></H3>
1.1 cvs 7831:
7832: <P>
7833: The <TT>Set</TT> and <TT>Add</TT> rules are used for modifying the value of
1.6 cvs 7834: counters that have no <A href="#sectc524">counting function</A>. Only this
1.1 cvs 7835: type of counter can be used in the <TT>Set</TT> and <TT>Add</TT> rules.</P>
7836: <P>
7837: Both rules have the same syntax: after the keyword <TT>Set</TT> or
7838: <TT>Add</TT> appear the counter name and the value to assign to the counter
7839: (<TT>Set</TT> rule) or the value to be added to the counter (<TT>Add</TT>
1.14 cvs 7840: rule). The keyword <TT>Before</TT> or <TT>After</TT> can follow that value to
1.1 cvs 7841: indicate when the rule must be applied: before or after the element's content
1.14 cvs 7842: is translated. By default, <TT>Before</TT> is assumed. A semicolon terminates
1.1 cvs 7843: the rule.</P>
7844: <PRE>
7845: 'Set' CounterID InitValue [ Position ] ';' /
7846: 'Add' CounterID Increment [ Position ] ';'
7847: </PRE>
7848: </DIV>
7849:
7850: <DIV class="subsection">
1.10 cvs 7851: <H3><A name=sectc5221a>The <TT>Indent</TT> rule</A></H3>
7852:
7853: <P>
7854: The <TT>Indent</TT> rule is used to modify the value of text indentation
7855: in the output files.</P>
7856: <P>
7857: Each time the translator creates a new line in an output file, it generates
7858: a variable number of space characters at the beginning of the new line. By
7859: default, the number of these characters (the indentation) is 0. It can be
7860: changed with the <TT>Indent</TT> rule.</P>
7861: <P>
7862: The rule begins with the <TT>Indent</TT> keyword, followed by the indentation
7863: sign (optional) and value and a keyword <TT>Before</TT> or <TT>After</TT>
7864: indicating that the indentation should be changed <A href="#sectc5222">before
7865: or after</A> the element's content is generated. If the position is not
7866: indicated, the indentation is changed before the element's content is
7867: generated. This rule, like all translation rules, is terminated by a
7868: semicolon.</P>
7869: <P>
7870: The indentation value is indicated by an integer, which is the number of
7871: space characters to be generated at the beginning of each new line.
7872: A sign (<TT>+</TT> or <TT>-</TT>) can appear before the integer to indicate
7873: that the value is relative: the current value of indentation is incremented
7874: (if sign is <TT>+</TT>) or decremented (if sign is <TT>-</TT>) by the
7875: specified value.
7876: <P>
7877: Like the <A href="#sectc5210"><TT>Create</TT> rule</A>, the <TT>Indent</TT>
7878: keyword can be followed by the <TT>IN</TT> keyword and by the name of a
7879: <A href="#sectc526">variable</A>. This means that the rule must not change
7880: indentation in the main output file, but in the file whose name is specified
7881: by the variable (by default, indentation is changed in the main output
7882: file).</P>
7883: <PRE>
7884: 'Indent' [ 'IN' VarID ] [ IndentSign ]
7885: IndentValue [ Position ] ';' .
7886:
7887: IndentSign = '+' / '-' .
7888: IndentValue = NUMBER .
7889: </PRE>
7890: </DIV>
7891:
7892: <DIV class="subsection">
1.6 cvs 7893: <H3><A name=sectc5222>Rule application order</A></H3>
1.1 cvs 7894:
7895: <P>
7896: The translator translates the elements which comprise the document in the
7897: order induced by the tree structure, except when the <TT>Get</TT> rule is used
7898: to change the order of translation. For each element, the translator first
7899: applies the rules specified for the element's type that must be applied before
7900: translation of the element's content (rules ending with the <TT>Before</TT>
7901: keyword or which have no position keyword). If several rules meet these
7902: criteria, the translator applies them in the order in where they appear in the
7903: translation schema.</P>
7904: <P>
1.6 cvs 7905: It then applies all <A href="#sectc5223">rules for the attributes</A> which
1.1 cvs 7906: the element has and which must be applied before the translation of the
7907: element's content (rules ending with the <TT>Before</TT> keyword or which have
7908: no position keyword). For one attribute value, the translator applies the
7909: rules in the order in which they are defined in the translation schema.</P>
7910: <P>
7911: The same procedure is followed with translation rules for specific
7912: presentations.</P>
7913: <P>
7914: Next, the element's content is translated, as long as a <TT>Remove</TT> rule
7915: does not apply.</P>
7916: <P>
7917: In the next step, the translator applies rules for the specific presentation
7918: of the element that are to be applied after translation of the content (rules
7919: which end with the <TT>After</TT> keyword). The rules for each type of
7920: presentation rule or each value are applied in the order in which the
7921: translation appear in the schema.</P>
7922: <P>
7923: Then, the same procedure is followed for translation rules for attributes of
7924: the element.</P>
7925: <P>
7926: Finally, the translator applies rules for the element which must be applied
7927: after translation of the element's content. These rules are applied in the
7928: order that they appear in the translation schema. When the translation of an
7929: element is done, the translator procedes to translate the following
7930: element.</P>
7931: <P>
7932: This order can be changed with the <TT>Attributes</TT> and
1.6 cvs 7933: <TT>Presentation</TT> options of the <A href="#sectc5210"><TT>Create</TT>
1.1 cvs 7934: rule</A>.</P>
7935: </DIV>
7936:
7937: <DIV class="subsection">
1.6 cvs 7938: <H3><A name=sectc5223>Translation of logical attributes</A></H3>
1.1 cvs 7939:
7940: <P>
7941: After the rules for the element types, the translation schema defines rules
7942: for attribute values. This section begins with the <TT>ATTRIBUTES</TT>
7943: keyword and is composed of a sequence of rule blocks each preceded by an
7944: attribute name and an optional value or value range.</P>
7945: <P>
7946: If the attribute's name appears alone before the rule block, the rule are
7947: applied to all element which have the attribute, no matter what value the
7948: attribute has. In this case, the attribute name is followed by a colon before
7949: the beginning of the rule block.</P>
7950: <P>
7951: The attribute's name can be followed by the name of an element type between
7952: parentheses. This says, as in presentation schemas, that the rule block which
7953: follows applies not to the element which has the attribute, but to its
7954: descendants of the type indicated between the parentheses.</P>
7955: <P>
7956: If values are given after the attribute name (or after the name of the element
7957: type), the rules are applied only when the attribute has the indicated values.
7958: The same attribute can appear several times, with different values and
7959: different translation rules. Attribute values are indicated in the same way
1.6 cvs 7960: as in <A href="#sectc528">conditions</A> and are followed by a colon before
1.1 cvs 7961: the block of rules.</P>
7962: <P>
7963: The rule block associated with an attribute is either a simple rule or a
7964: sequence of rules delimited by the <TT>BEGIN</TT> and <TT>END</TT> keywords.
7965: Note that rules associated with attribute values cannot be conditional.</P>
7966: <P>
7967: Translation rules are not required for all attributes (or their values)
7968: defined in a structure schema. Only those attributes for which a particular
7969: action must be performed by the translator must have such rules. The rules
7970: that can be used are those described above, from <A
1.6 cvs 7971: href="#sectc5210"><TT>Create</TT></A> to <A
7972: href="#sectc5218"><TT>NoTranslation</TT></A>.</P>
1.1 cvs 7973: <PRE>
7974: AttrSeq = TransAttr < TransAttr > .
7975: TransAttr = AttrID [ '(' ElemID ')' ]
7976: [ RelatAttr ] ':' RuleSeq .
7977: AttrID = NAME .
7978: ElemID = NAME .
7979: </PRE>
7980: <BLOCKQUOTE class="example">
7981: <P>
7982: <STRONG>Example:</STRONG></P>
7983: <P>
1.3 cvs 7984: The structure defined the ``Language'' attribute which can take the values
7985: ``French'' and ``English''. To have the French parts of the original document
7986: removed and prevent the translation of the leaves of the English parts, the
1.1 cvs 7987: following rules would be used:</P>
7988: <PRE>
7989: ATTRIBUTES
7990: Language=French :
7991: Remove;
7992: Language=English :
7993: NoTranslation;
7994: </PRE>
7995: </BLOCKQUOTE>
7996: </DIV>
7997:
7998: <DIV class="subsection">
1.6 cvs 7999: <H3><A name=sectc5224>Translation of specific presentations</A></H3>
1.1 cvs 8000:
8001: <P>
8002: After the rules for attributes, the translation schema defines rules for the
8003: specific presentation. This section begins with the <TT>PRESENTATION</TT>
8004: keyword and is composed of a sequence of translation rule blocks each preceded
8005: by a presentation rule name, optionally accompanied by a part which depends on
8006: the particular presentation rule.</P>
8007: <P>
8008: Each of these translation rule blocks is applied when the translator operates
8009: on an element which has a specific presentation rule of the type indicated at
8010: the head of the block. Depending on the type of the specific presentation
8011: rule, it is possible to specify values of the presentation rule for which the
8012: translation rule block should be applied.</P>
8013: <P>
8014: There are three categories of the presentation rules:</P>
8015: <UL>
1.2 cvs 8016: <LI>rules taking numeric values: <TT>Size</TT>, <TT>Indent</TT>,
8017: <TT>LineSpacing</TT>, <TT>LineWeight</TT>,
8018: <LI>rules whose values are taken from a predefined list (i.e. whose type is an
1.1 cvs 8019: enumeration): <TT>Adjust</TT>, <TT>Justify</TT>, <TT>Hyphenate,/TT>,
8020: <TT>Style</TT>, <TT>Font</TT>, <TT>UnderLine</TT>, <TT>Thickness</TT>,
8021: <TT>LineStyle</TT>,</TT>
1.2 cvs 8022: <LI>rules whose value is a name: <TT>FillPattern</TT>, <TT>Background</TT>,
8023: <TT>Foreground</TT>.
1.1 cvs 8024: </UL>
8025: <P>
8026: For presentation rules of the first category, the values which provoke
8027: application of the translation rules are indicated in the same manner as for
8028: <A href="#relattr">numeric attributes</A>. This can be either a unique value
8029: or range of values. For a unique value, the value (an integer) is simply
8030: preceded by an equals sign. Value ranges can be specified in one of three
8031: ways:</P>
8032: <UL>
1.2 cvs 8033: <LI>all values less than a given value (this value is preceded by a ``less
1.5 cvs 8034: than'' sign '<TT><</TT>'),
1.2 cvs 8035: <LI>all values greater than a given value (this value is preceded by a`
1.5 cvs 8036: `greater than'' sign '<TT>></TT>'),
1.2 cvs 8037: <LI>all values falling in an interval, bounds included. The range of values
8038: is then specified <TT>IN [</TT>Minimum<TT>..</TT>Maximum<TT>]</TT>, where
8039: Minimum and Maximum are integers.
1.1 cvs 8040: </UL>
8041: <P>
1.2 cvs 8042: All numeric values can be negative, in which case the integer is preceded by a
8043: minus sign. All values must be given in typographers points.</P>
1.1 cvs 8044: <P>
8045: For presentation rules whose values are taken from a predefined list, the
8046: value which provokes application of the translation rules is simply indicated
8047: by the equals sign followed by the name of the value.</P>
8048: <P>
8049: For presentation rules whose values are names, the value which provokes the
8050: application of translation rules is simply indicated by the equals sign
8051: followed by the name of the value. The names of the fill patterns (the
8052: <TT>FillPattern</TT> rule) and of the colors (the <TT>Foreground</TT> and
8053: <TT>Background</TT> rules) used in Thot are the same as in the P language.</P>
8054: <PRE>
8055: PresSeq = PresTrans < PresTrans > .
8056: PresTrans = PresRule ':' RuleSeq .
8057: PresRule = 'Size' [ PresRelation ] /
8058: 'Indent' [ PresRelation ] /
8059: 'LineSpacing' [ PresRelation ] /
8060: 'Adjust' [ '=' AdjustVal ] /
8061: 'Justify' [ '=' BoolVal ] /
8062: 'Hyphenate' [ '=' BoolVal ] /
8063: 'Style' [ '=' StyleVal ] /
8064: 'Font' [ '=' FontVal ] /
8065: 'UnderLine' [ '=' UnderLineVal ] /
8066: 'Thickness' [ '=' ThicknessVal ] /
8067: 'LineStyle' [ '=' LineStyleVal ] /
8068: 'LineWeight' [ PresRelation ] /
8069: 'FillPattern' [ '=' Pattern ] /
8070: 'Background' [ '=' Color ] /
8071: 'Foreground' [ '=' Color ] .
8072:
8073: PresRelation = '=' PresValue /
8074: '>' [ '-' ] PresMinimum /
8075: '<' [ '-' ] PresMaximum /
8076: 'IN' '[' [ '-' ] PresIntervalMin '..'
8077: [ '-' ] PresIntervalMax ']' .
8078: AdjustVal = 'Left' / 'Right' / 'VMiddle' /
8079: 'LeftWithDots' .
8080: BoolVal = 'Yes' / 'No' .
8081: StyleVal = 'Bold' / 'Italics' / 'Roman' /
8082: 'BoldItalics' / 'Oblique' /
8083: 'BoldOblique' .
8084: FontVal = 'Times' / 'Helvetica' / 'Courier' .
8085: UnderLineVal = 'NoUnderline' / 'UnderLined' /
8086: 'OverLined' / 'CrossedOut' .
8087: ThicknessVal = 'Thick' / 'Thin' .
1.6 cvs 8088: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' .
1.1 cvs 8089: Pattern = NAME .
8090: Color = NAME .
8091: PresMinimum = NUMBER .
8092: PresMaximum = NUMBER .
8093: PresIntervalMin= NUMBER .
8094: PresIntervalMax= NUMBER .
8095: PresValue = [ '-' ] PresVal .
8096: PresVal = NUMBER .
8097: </PRE>
8098: <P>
8099: The <A name="prestransl">translation rules associated with specific
8100: presentation rules</A> can use the value of the specific presentation rule
8101: that causes them to be applied. This behavior is designated by the keyword
8102: <TT>Value</TT>. For numerically-valued presentation rules, the numeric value
8103: is produced. For other presentation rules, the name of the value is
8104: produced.</P>
8105: <P>
8106: It should be noted that modifications to the layout of the document's elements
8107: that are made using the combination of the control key and a mouse button will
8108: have no effect on the translation of the document.</P>
8109: <BLOCKQUOTE class="example">
8110: <P>
8111: <STRONG>Example:</STRONG></P>
8112: <P>
1.3 cvs 8113: Suppose that it is desirable to use the same font sizes as in the specific
8114: presentation, but the font size must be between 10 and 18 typographer's points.
8115: If font size is set in the translated document by the string
8116: <TT>pointsize=n</TT> where <TT>n</TT> is the font size in typographer's points
1.1 cvs 8117: then the following rules will suffice:</P>
8118: <PRE>
8119: PRESENTATION
8120: Size < 10 :
8121: Create 'pointsize=10';
8122: Size in [10..18] :
8123: BEGIN
8124: Create 'pointsize=';
8125: Create Value;
8126: END;
8127: Size > 18 :
8128: Create 'pointsize=18';
8129: </PRE>
8130: </BLOCKQUOTE>
8131: </DIV>
8132:
8133: <DIV class="subsection">
1.6 cvs 8134: <H3><A name=sectc5225>Recoding of characters, symbols and graphics</A></H3>
1.1 cvs 8135:
8136: <P>
8137: The coding of characters, graphical elements and symbols as defined in Thot
8138: does not necessarily correspond to what is required by an application to which
8139: a Thot document must be exported. Because of this the translator can recode
8140: these terminal elements of the documents structure. The last sections of a
8141: translation schema are intended for this purpose, each specifying the recoding
8142: rules for one type of terminal element.</P>
8143: <P>
8144: The recoding rules for character strings are grouped by alphabets. There is a
8145: group of rules for each alphabet of the Thot document that must be translated.
8146: Each such group of rules begins with the <TT>TEXTTRANSLATE</TT> keyword,
8147: followed by the specification of the alphabet to translate and the recoding
8148: rules, between the <TT>BEGIN</TT> and <TT>END</TT> keywords unless there is
8149: only one recoding rule for the alphabet. The specification of the alphabet is
8150: not required: by default it is assumed to the Latin alphabet (the ISO Latin-1
8151: character set).</P>
8152: <P>
8153: Each recoding rule is formed by a source string between apostrophes and a
8154: target string, also between apostrophes, the two strings being separated by
8155: the arrow symbol (<TT>-></TT>), formed by the ``minus'' and ``greater than''
8156: characters. The rule is terminated by a semi-colon.</P>
8157: <PRE>
8158: TextTransSeq = [ Alphabet ] TransSeq .
8159: Alphabet = NAME .
8160: TransSeq ='BEGIN' < Translation > 'END' ';' /
8161: Translation .
8162: Translation = Source [ '->' Target ] ';' .
8163: Source = STRING .
8164: Target = STRING .
8165: </PRE>
8166: <P>
8167: One such rule signifies that when the source string appears in a text leaf of
8168: the document being translated, the translator must replace it, in the
8169: translated document, with the target string. The source string and the target
8170: string can have different lengths and the target string can be empty. In this
8171: last case, the translator simply suppresses every occurrence of the source
8172: string in the translated document.</P>
8173: <P>
8174: For a given alphabet, the order of the rules is not important and has no
8175: significance because the T language compiler reorders the rules in ways that
8176: speed up the translator's work. The total number of recoding rules is limited
8177: by the compiler as is the maximum length of the source and target strings.</P>
8178: <P>
8179: The recoding rules for symbols and graphical elements are written in the same
8180: manner as the recoding rules for character strings. They are preceded,
8181: respectively, by the <TT>SYMBTRANSLATE</TT> and <TT>GRAPHTRANSLATE</TT> and so
8182: not require a specification of the alphabet. Their source string is limited to
8183: one character, since, in Thot, each symbol and each graphical element is
8184: represented by a single character. The symbol and graphical element codes are
1.6 cvs 8185: defined along with the <A href="#sect7">non-standard character
1.1 cvs 8186: codes</A>.</P>
8187: <BLOCKQUOTE class="example">
8188: <P>
8189: <STRONG>Example:</STRONG></P>
8190: <P>
8191: In a translation schema producing documents destined for use with
1.3 cvs 8192: the L<SUP>A</SUP>T<SUB><BIG>E</BIG></SUB>X formatter, the Latin
1.1 cvs 8193: characters``é'' (octal code 351 in Thot) and ``è'' (octal code
1.3 cvs 8194: 350 in Thot) must be converted to their representation
8195: in L<SUP>A</SUP>T<SUB><BIG>E</BIG></SUB>X:</P>
1.1 cvs 8196: <PRE>
1.6 cvs 8197: TEXTTRANSLATE Latin
1.1 cvs 8198: BEGIN
8199: '\350' -> '\`{e}'; { e grave }
8200: '\351' -> '\''{e}'; { e acute }
8201: END;
8202: </PRE>
8203: </BLOCKQUOTE>
8204: </DIV>
8205: </DIV>
8206: <HR>
8207: </DIV>
8208:
8209: <DIV class="chapter">
1.6 cvs 8210: <H1><A name=sect6>Language grammars</A></H1>
1.1 cvs 8211:
8212: <P>
8213: This chapter gives the complete grammars of the languages of Thot. The
8214: grammars were presented and described in the preceding chapters, which also
8215: specify the semantics of the languages. This section gives only the
8216: syntax.</P>
8217:
8218: <DIV class="section">
1.6 cvs 8219: <H2><A name=sectb61>The M meta-language</A></H2>
1.1 cvs 8220:
8221: <P>
8222: The language grammars are all expressed in the same formalism, the M
8223: meta-language, which is defined in this section.</P>
8224: <PRE>
8225: { Any text between braces is a comment. }
8226: Grammar = Rule < Rule > 'END' .
8227: { The < and > signs indicate zero }
8228: { or more repetitions. }
8229: { END marks the end of the grammar. }
8230: Rule = Ident '=' RightPart '.' .
8231: { The period indicates the end of a rule }
8232: RightPart = RtTerminal / RtIntermed .
8233: { The slash indicates a choice }
8234: RtTerminal ='NAME' / 'STRING' / 'NUMBER' .
8235: { Right part of a terminal rule }
8236: RtIntermed = Possibility < '/' Possibility > .
8237: { Right part of an intermediate rule }
8238: Possibility = ElemOpt < ElemOpt > .
8239: ElemOpt = Element / '[' Element < Element > ']' /
8240: '<' Element < Element > '>' .
8241: { Brackets delimit optional parts }
8242: Element = Ident / KeyWord .
8243: Ident = NAME .
8244: { Identifier, sequence of characters
8245: KeyWord = STRING .
8246: { Character string delimited by apostrophes }
8247: END
8248: </PRE>
8249: </DIV>
8250:
8251: <DIV class="section">
1.6 cvs 8252: <H2><A name=sectb62>The S language</A></H2>
1.1 cvs 8253:
8254: <P>
8255: The S language is used to write structure schemas, which contain the generic
8256: logical structures of document and object classes. It is described here in
8257: the M meta-language.</P>
8258: <PRE>
8259: StructSchema = 'STRUCTURE' [ 'EXTENSION' ] ElemID ';'
8260: 'DEFPRES' PresID ';'
8261: [ 'ATTR' AttrSeq ]
8262: [ 'PARAM' RulesSeq ]
8263: [ 'STRUCT' RulesSeq ]
8264: [ 'EXTENS' ExtensRuleSeq ]
8265: [ 'ASSOC' RulesSeq ]
8266: [ 'UNITS' RulesSeq ]
8267: [ 'EXPORT' SkeletonSeq ]
8268: [ 'EXCEPT' ExceptSeq ]
8269: 'END' .
8270:
8271: ElemID = NAME .
8272: PresID = NAME .
8273:
8274: AttrSeq = Attribute < Attribute > .
8275: Attribute = AttrID '=' AttrType ';' .
8276: AttrType = 'INTEGER' / 'TEXT' /
8277: 'REFERENCE' '(' RefType ')' /
8278: ValueSeq .
8279: RefType = 'ANY' /
8280: [ FirstSec ] ElemID [ ExtStruct ] .
8281: ValueSeq = AttrVal < ',' AttrVal > .
8282: AttrID = NAME .
8283: FirstSec = 'First' / 'Second' .
8284: ExtStruct = '(' ElemID ')' .
8285: AttrVal = NAME .
8286:
8287: RulesSeq = Rule < Rule > .
8288: Rule = ElemID [ LocAttrSeq ] '='
8289: DefWithAttr ';' .
8290: LocAttrSeq = '(' 'ATTR' LocalAttr
8291: < ';' LocalAttr > ')' .
8292: LocalAttr = [ '!' ] AttrID [ '=' AttrType ] .
8293: DefWithAttr = Definition
8294: [ '+' '(' ExtensionSeq ')' ]
8295: [ '-' '(' RestrictSeq ')' ]
8296: [ 'WITH' FixedAttrSeq ] .
8297: ExtensionSeq = ExtensionElem < ',' ExtensionElem > .
8298: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' /
8299: 'SYMBOL' / 'PICTURE' .
8300: RestrictSeq = RestrictElem < ',' RestrictElem > .
8301: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' /
8302: 'SYMBOL' / 'PICTURE' .
8303: FixedAttrSeq = FixedAttr < ',' FixedAttr > .
8304: FixedAttr = AttrID [ FixedOrModifVal ] .
8305: FixedOrModifVal= [ '?' ] '=' FixedValue .
8306: FixedValue = [ '-' ] NumValue / TextValue / AttrVal .
8307: NumValue = NUMBER .
8308: TextValue = STRING .
8309:
8310: Definition = BaseType [ LocAttrSeq ] / Constr /
8311: Element .
8312: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' /
8313: 'PICTURE' / 'UNIT' / 'NATURE' .
8314: Element = ElemID [ ExtOrDef ] .
8315: ExtOrDef = 'EXTERN' / 'INCLUDED' /
8316: [ LocAttrSeq ] '=' Definition .
8317:
8318: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF'
8319: '(' DefWithAttr ')' /
8320: 'BEGIN' DefOptSeq 'END' /
8321: 'AGGREGATE' DefOptSeq 'END' /
8322: 'CASE' 'OF' DefSeq 'END' /
8323: 'REFERENCE' '(' RefType ')' /
8324: 'PAIR' .
8325:
8326: min = Integer / '*' .
8327: max = Integer / '*' .
8328: Integer = NUMBER .
8329:
8330: DefOptSeq = DefOpt ';' < DefOpt ';' > .
8331: DefOpt = [ '?' ] DefWithAttr .
8332:
8333: DefSeq = DefWithAttr ';' < DefWithAttr ';' > .
8334:
8335: SkeletonSeq = SkeletonElem < ',' SkeletonElem > ';' .
8336: SkeletonElem = ElemID [ 'WITH' Contents ] .
8337: Contents = 'Nothing' / ElemID [ ExtStruct ] .
8338:
8339: ExceptSeq = Except ';' < Except ';' > .
8340: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr ':'
8341: ExcValSeq .
8342: ExcTypeOrAttr = ElemID / AttrID .
8343: ExcValSeq = ExcValue < ',' ExcValue > .
8344: ExcValue = 'NoCut' / 'NoCreate' /
8345: 'NoHMove' / 'NoVMove' / 'NoMove' /
8346: 'NoHResize' / 'NoVResize' / 'NoResize' /
1.13 cvs 8347: 'MoveResize' /
1.1 cvs 8348: 'NewWidth' / 'NewHeight' /
8349: 'NewHPos' / 'NewVPos' /
8350: 'Invisible' / 'NoSelect' /
8351: 'Hidden' / 'ActiveRef' /
8352: 'ImportLine' / 'ImportParagraph' /
1.9 cvs 8353: 'NoPaginate' / 'ParagraphBreak' /
8354: 'HighlightChildren' / 'ExtendedSelection' /
8355: 'ReturnCreateNL' .
1.1 cvs 8356:
8357: ExtensRuleSeq = ExtensRule ';' < ExtensRule ';' > .
8358: ExtensRule = RootOrElem [ LocAttrSeq ]
8359: [ '+' '(' ExtensionSeq ')' ]
8360: [ '-' '(' RestrictSeq ')' ]
8361: [ 'WITH' FixedAttrSeq ] .
8362: RootOrElem = 'Root' / ElemID .
8363:
8364: END
8365: </PRE>
8366: </DIV>
8367:
8368: <DIV class="section">
1.6 cvs 8369: <H2><A name=sectb63>The P language</A></H2>
1.1 cvs 8370:
8371: <P>
8372: The P language is used to write presentation schemas, which define the
8373: graphical presentation rules to be applied to different classes of documents
8374: and objects. It is described here in the M meta-language.</P>
8375: <PRE>
8376: PresSchema = 'PRESENTATION' ElemID ';'
8377: [ 'VIEWS' ViewSeq ]
8378: [ 'PRINT' PrintViewSeq ]
8379: [ 'COUNTERS' CounterSeq ]
8380: [ 'CONST' ConstSeq ]
8381: [ 'VAR' VarSeq ]
8382: [ 'DEFAULT' ViewRuleSeq ]
8383: [ 'BOXES' BoxSeq ]
8384: [ 'RULES' PresentSeq ]
8385: [ 'ATTRIBUTES' PresAttrSeq ]
8386: [ 'TRANSMIT' TransmitSeq ]
8387: 'END' .
8388:
8389: ElemID = NAME .
8390:
8391: ViewSeq = ViewDeclaration
8392: < ',' ViewDeclaration > ';' .
8393: ViewDeclaration = ViewID [ 'EXPORT' ] .
8394: ViewID = NAME .
8395:
8396: PrintViewSeq = PrintView < ',' PrintView > ';' .
8397: PrintView = ViewID / ElemID .
8398:
8399: CounterSeq = Counter < Counter > .
8400: Counter = CounterID ':' CounterFunc ';' .
8401: CounterID = NAME .
8402: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ]
8403: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] /
8404: SetFunction < SetFunction >
8405: AddFunction < AddFunction >
8406: [ 'INIT' AttrID ] /
1.16 cvs 8407: 'RLEVEL' 'OF' ElemID .
1.1 cvs 8408: SLevelAsc = [ '-' ] LevelAsc .
8409: LevelAsc = NUMBER .
8410: SetFunction = 'SET' CounterValue 'ON' TypeOrPage .
8411: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage .
8412: TypeOrPage = 'Page' [ '(' ViewID ')' ] /
1.16 cvs 8413: [ '*' ] ElemID .
1.1 cvs 8414: CounterValue = NUMBER .
8415:
8416: ConstSeq = Const < Const > .
8417: Const = ConstID '=' ConstType ConstValue ';' .
8418: ConstID = NAME .
8419: ConstType = 'Text' [ Alphabet ] / 'Symbol' /
8420: 'Graphics' / 'Picture' .
8421: ConstValue = STRING .
8422: Alphabet = NAME .
8423:
8424: VarSeq = Variable < Variable > .
8425: Variable = VarID ':' FunctionSeq ';' .
8426: VarID = NAME .
8427: FunctionSeq = Function < Function > .
8428: Function = 'DATE' / 'FDATE' /
8429: 'DocName' / 'DirName' /
8430: 'ElemName' / 'AttributeName' /
8431: ConstID / ConstType ConstValue /
8432: AttrID /
8433: 'VALUE' '(' PageAttrCtr ','
8434: CounterStyle ')' .
8435: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] /
8436: [ MinMax ] CounterID / AttrID .
8437: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' /
8438: 'Uppercase' / 'Lowercase' .
8439: MinMax = 'MaxRangeVal' / 'MinRangeVal' .
8440:
8441: BoxSeq = Box < Box > .
8442: Box = 'FORWARD' BoxID ';' /
8443: BoxID ':' ViewRuleSeq .
8444: BoxID = NAME .
8445:
8446: PresentSeq = Present < Present > .
8447: Present = [ '*' ] [ FirstSec ] ElemID ':'
8448: ViewRuleSeq .
8449: FirstSec = 'First' / 'Second' .
8450:
8451: PresAttrSeq = PresAttr < PresAttr > .
8452: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ]
8453: [ AttrRelation ] ':' ViewRuleSeq .
8454: AttrID = NAME .
8455: AttrRelation = '=' AttrVal /
8456: '>' [ '-' ] MinValue /
8457: '<' [ '-' ] MaxValue /
8458: 'IN' '[' [ '-' ] LowerBound '..'
8459: [ '-' ] UpperBound ']' /
8460: 'GREATER' AttrID /
8461: 'EQUAL' AttrID /
8462: 'LESS' AttrID .
8463: AttrVal = [ '-' ] EqualNum / EqualText / AttrValue .
8464: MinValue = NUMBER .
8465: MaxValue = NUMBER .
8466: LowerBound = NUMBER .
8467: UpperBound = NUMBER.
8468: EqualNum = NUMBER .
8469: EqualText = STRING .
8470: AttrValue = NAME .
8471:
8472: ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules >
8473: 'END' ';' /
8474: ViewRules / CondRules / Rule .
8475: RulesAndCond = CondRules / Rule .
8476: ViewRules = 'IN' ViewID CondRuleSeq .
8477: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' /
8478: CondRules / Rule .
8479: CondRules = CondRule < CondRule >
8480: [ 'Otherwise' RuleSeq ] .
8481: CondRule = 'IF' ConditionSeq RuleSeq .
8482: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / Rule .
8483:
1.6 cvs 8484: ConditionSeq = Condition < 'AND' Condition > .
8485: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem .
8486: ConditionElem = 'First' / 'Last' /
8487: [ 'Immediately' ] 'Within' [ NumParent ]
8488: ElemID [ ExtStruct ] /
8489: ElemID /
8490: 'Referred' / 'FirstRef' / 'LastRef' /
8491: 'ExternalRef' / 'InternalRef' / 'CopyRef' /
8492: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' /
8493: 'UserPage' / 'StartPage' / 'ComputedPage' /
8494: 'Empty' /
8495: '(' [ MinMax ] CounterName CounterCond ')' /
8496: CondPage '(' CounterID ')' .
8497: NumParent = [ GreaterLess ] NParent .
8498: GreaterLess = '>' / '<' .
8499: NParent = NUMBER.
8500: CounterCond = '<' MaxCtrVal / '>' MinCtrVal /
8501: '=' EqCtrVal /
8502: 'IN' '[' ['-'] MinCtrBound '..'
8503: ['-'] MaxCtrBound ']' .
8504: PageCond = 'Even' / 'Odd' / 'One' .
8505: MaxCtrVal = NUMBER .
8506: MinCtrVal = NUMBER .
8507: EqCtrVal = NUMBER .
8508: MaxCtrBound = NUMBER .
8509: MinCtrBound = NUMBER .
1.1 cvs 8510:
8511: Rule = PresParam ';' / PresFunc ';' .
8512: PresParam = 'VertRef' ':' HorizPosition /
8513: 'HorizRef' ':' VertPosition /
8514: 'VertPos' ':' VPos /
8515: 'HorizPos' ':' HPos /
8516: 'Height' ':' Extent /
8517: 'Width' ':' Extent /
8518: 'VertOverflow' ':' Boolean /
8519: 'HorizOverflow' ':' Boolean /
8520: 'LineSpacing' ':' DistOrInherit /
8521: 'Indent' ':' DistOrInherit /
8522: 'Adjust' ':' AlignOrInherit /
8523: 'Justify' ':' BoolInherit /
8524: 'Hyphenate' ':' BoolInherit /
8525: 'PageBreak' ':' Boolean /
8526: 'LineBreak' ':' Boolean /
8527: 'InLine' ':' Boolean /
8528: 'NoBreak1' ':' AbsDist /
8529: 'NoBreak2' ':' AbsDist /
8530: 'Gather' ':' Boolean /
8531: 'Visibility' ':' NumberInherit /
8532: 'Size' ':' SizeInherit /
8533: 'Font' ':' NameInherit /
8534: 'Style' ':' StyleInherit /
8535: 'Underline' ':' UnderLineInherit /
8536: 'Thickness' ':' ThicknessInherit /
8537: 'Depth' ':' NumberInherit /
8538: 'LineStyle' ':' LineStyleInherit /
8539: 'LineWeight' ':' DistOrInherit /
8540: 'FillPattern' ':' NameInherit /
8541: 'Background' ':' NameInherit /
1.13 cvs 8542: 'Foreground' ':' NameInherit /
1.1 cvs 8543: 'Content' ':' VarConst .
8544: PresFunc = Creation '(' BoxID ')' /
8545: 'Line' /
8546: 'NoLine' /
8547: 'Page' '(' BoxID ')' /
1.13 cvs 8548: 'Copy' '(' BoxTypeToCopy ')' /
8549: 'ShowBox' /
8550: 'BackgroundPicture' ':' FileName /
8551: 'PictureMode' ':' PictMode .
1.1 cvs 8552:
8553: BoxTypeToCopy = BoxID [ ExtStruct ] /
8554: ElemID [ ExtStruct ] .
8555: ExtStruct = '(' ElemID ')' .
8556:
8557: Distance = [ Sign ] AbsDist .
8558: Sign = '+' / '-' .
8559: AbsDist = IntegerOrAttr [ '.' DecimalPart ]
8560: [ Unit ] .
8561: IntegerOrAttr = IntegerPart / AttrID .
8562: IntegerPart = NUMBER .
8563: DecimalPart = NUMBER .
8564: Unit = 'em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' /
8565: 'pc' / 'px' / '%' .
8566:
8567: HPos = 'nil' / VertAxis '=' HorizPosition
8568: [ 'UserSpecified' ] .
8569: VPos = 'nil' / HorizAxis '=' VertPosition
8570: [ 'UserSpecified' ] .
8571: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' .
8572: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .
8573:
1.6 cvs 8574: VertPosition = Reference '.' HorizAxis [ Distance ] .
8575: HorizPosition = Reference '.' VertAxis [ Distance ] .
8576: Reference = 'Enclosing' [ BoxTypeNot ] /
8577: 'Enclosed' [ BoxTypeNot ] /
8578: 'Previous' [ BoxTypeNot ] /
8579: 'Next' [ BoxTypeNot ] /
8580: 'Referred' [ BoxTypeNot ] /
8581: 'Creator' /
8582: 'Root' /
8583: '*' /
8584: BoxOrType .
8585: BoxOrType = BoxID /
8586: [ '*' ] [ FirstSec ] ElemID /
1.17 ! cvs 8587: 'AnyElem' / 'AnyBox' /
! 8588: 'ElemWithAttr' AttrID .
1.6 cvs 8589: BoxTypeNot = [ 'NOT' ] BoxOrType .
8590:
8591: Extent = Reference '.' HeightWidth
8592: [ Relation ] [ 'Min' ] /
8593: AbsDist [ 'UserSpecified' ] [ 'Min' ] /
8594: HPos / VPos .
8595: HeightWidth = 'Height' / 'Width' .
8596: Relation = '*' ExtentAttr '%' / Distance .
8597: ExtentAttr = ExtentVal / AttrID .
8598: ExtentVal = NUMBER .
8599:
8600: Inheritance = Kinship InheritedValue .
8601: Kinship = 'Enclosing' / 'GrandFather'/ 'Enclosed' /
8602: 'Previous' / 'Creator' .
8603: InheritedValue = '+' PosIntAttr [ 'Max' maximumA ] /
8604: '-' NegIntAttr [ 'Min' minimumA ] /
8605: '=' .
8606: PosIntAttr = PosInt / AttrID .
8607: PosInt = NUMBER .
8608: NegIntAttr = NegInt / AttrID .
8609: NegInt = NUMBER .
8610: maximumA = maximum / AttrID .
8611: maximum = NUMBER .
8612: minimumA = minimum / AttrID .
8613: minimum = NUMBER .
8614:
8615: AlignOrInherit = Kinship '=' / Alignment .
8616: Alignment = 'Left' / 'Right' / 'VMiddle' /
8617: 'LeftWithDots' .
1.1 cvs 8618:
1.6 cvs 8619: DistOrInherit = Kinship InheritedDist / Distance .
8620: InheritedDist = '=' / '+' AbsDist / '-' AbsDist .
1.1 cvs 8621:
1.6 cvs 8622: BoolInherit = Boolean / Kinship '=' .
8623: Boolean = 'Yes' / 'No' .
1.1 cvs 8624:
1.6 cvs 8625: NumberInherit = Integer / AttrID / Inheritance .
8626: Integer = NUMBER .
1.1 cvs 8627:
8628: LineStyleInherit= Kinship '=' / 'Solid' / 'Dashed' /
8629: 'Dotted' .
8630:
1.6 cvs 8631: SizeInherit = SizeAttr [ 'pt' ] / Kinship InheritedSize .
8632: InheritedSize = '+' SizeAttr [ 'pt' ]
8633: [ 'Max' MaxSizeAttr ] /
8634: '-' SizeAttr [ 'pt' ]
8635: [ 'Min' MinSizeAttr ] /
8636: '=' .
8637: SizeAttr = Size / AttrID .
8638: Size = NUMBER .
8639: MaxSizeAttr = MaxSize / AttrID .
8640: MaxSize = NUMBER .
8641: MinSizeAttr = MinSize / AttrID .
8642: MinSize = NUMBER .
8643:
8644: NameInherit = Kinship '=' / FontName .
8645: FontName = NAME .
8646: StyleInherit = Kinship '=' /
8647: 'Roman' / 'Bold' / 'Italics' /
8648: 'BoldItalics' / 'Oblique' / 'BoldOblique' .
1.1 cvs 8649: UnderLineInherit= Kinship '=' /
1.6 cvs 8650: 'NoUnderline' / 'Underlined' /
8651: 'Overlined' / 'CrossedOut' .
1.1 cvs 8652: ThicknessInherit= Kinship '=' / 'Thick' / 'Thin' .
1.13 cvs 8653:
8654: FileName = STRING .
8655: PictMode = 'NormalSize' / 'Scale' /
8656: 'RepeatXY' / 'RepeatX' / 'RepeatY' .
1.1 cvs 8657:
1.6 cvs 8658: VarConst = ConstID / ConstType ConstValue /
8659: VarID / '(' FunctionSeq ')' /
8660: ElemID .
8661:
8662: Creation = Create [ 'Repeated' ] .
8663: Create = 'CreateFirst' / 'CreateLast' /
8664: 'CreateBefore' / 'CreateAfter' /
8665: 'CreateEnclosing' .
8666:
8667: TransmitSeq = Transmit < Transmit > .
8668: Transmit = TypeOrCounter 'To' ExternAttr
8669: '(' ElemID ')' ';' .
8670: TypeOrCounter = CounterID / ElemID .
8671: ExternAttr = NAME .
1.1 cvs 8672:
8673: END
8674: </PRE>
8675: </DIV>
8676:
8677: <DIV class="section">
1.6 cvs 8678: <H2><A name=sectb64>The T language</A></H2>
1.1 cvs 8679:
8680: <PRE>
8681: TransSchema = 'TRANSLATION' ElemID ';'
8682: [ 'LINELENGTH' LineLength ';' ]
8683: [ 'LINEEND' CHARACTER ';' ]
8684: [ 'LINEENDINSERT' STRING ';' ]
8685: [ 'BUFFERS' BufferSeq ]
8686: [ 'COUNTERS' CounterSeq ]
8687: [ 'CONST' ConstSeq ]
8688: [ 'VAR' VariableSeq ]
8689: 'RULES' ElemSeq
8690: [ 'ATTRIBUTES' AttrSeq ]
8691: [ 'PRESENTATION' PresSeq ]
8692: < 'TEXTTRANSLATE' TextTransSeq >
8693: [ 'SYMBTRANSLATE' TransSeq ]
8694: [ 'GRAPHTRANSLATE' TransSeq ]
8695: 'END' .
8696:
8697: LineLength = NUMBER .
8698:
8699: BufferSeq = Buffer < Buffer > .
8700: Buffer = BufferID [ '(' 'Picture' ')' ] ';' .
8701: BufferID = NAME .
8702:
8703: CounterSeq = Counter < Counter > .
8704: Counter = CounterID [ ':' CounterFunc ] ';' .
8705: CounterID = NAME .
8706: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ]
8707: [ 'Init' AttrID ] /
8708: 'Rlevel' 'of' ElemID /
8709: 'Set' InitValue 'On' ElemID
8710: 'Add' Increment 'On' ElemID
8711: [ 'Init' AttrID ] .
8712: SLevelAsc = [ '-' ] LevelAsc .
8713: LevelAsc = NUMBER .
8714: InitValue = NUMBER .
8715: Increment = NUMBER .
8716: ElemID = NAME .
8717: AttrID = NAME .
8718:
8719: ConstSeq = Const < Const > .
8720: Const = ConstID '=' ConstValue ';' .
8721: ConstID = NAME .
8722: ConstValue = STRING .
8723:
8724: VariableSeq = Variable < Variable > .
8725: Variable = VarID ':' Function < Function > ';' .
8726: VarID = NAME .
8727: Function = 'Value' '(' CounterID [ ':' Length ]
8728: [ ',' CounterStyle ] ')' /
8729: 'FileDir' / 'FileName' / 'Extension' /
8730: 'DocumentName' / 'DocumentDir' /
8731: ConstID / CharString /
8732: BufferID / AttrID .
8733: Length = NUMBER .
8734: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' /
8735: 'Uppercase' / 'Lowercase' .
8736: CharString = STRING .
8737:
8738: ElemSeq = TransType < TransType > .
8739: TransType = [ FirstSec ] ElemID ':' RuleSeq .
8740: FirstSec = 'First' / 'Second' .
8741: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' .
8742: Rule = SimpleRule / ConditionBlock .
8743: ConditionBlock= 'IF' ConditionSeq SimpleRuleSeq .
8744: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' /
8745: SimpleRule .
8746:
8747: ConditionSeq = Condition [ 'AND' Condition ] .
8748: Condition = [ 'NOT' ] [ 'Target' ] Cond .
8749: Cond = CondElem / CondAscend .
8750: CondElem = 'FirstRef' / 'LastRef' /
8751: 'ExternalRef' /
8752: 'Defined' /
8753: 'Alphabet' '=' Alphabet /
8754: 'ComputedPage' / 'StartPage' /
8755: 'UserPage' / 'ReminderPage' /
8756: 'Empty' /
1.11 cvs 8757: ElemID /
1.1 cvs 8758: 'FirstAttr' / 'LastAttr' .
8759: CondAscend = [ Ascend ] CondOnAscend .
8760: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType .
8761: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] .
8762: CondRelLevel = NUMBER .
8763: CondOnAscend = 'First' / 'Last' /
8764: 'Referred' /
8765: [ 'Immediately' ] 'Within' [ NumParent ]
8766: ElemID [ ExtStruct ] /
8767: 'Attributes' /
8768: AttrID [ RelatAttr ] /
8769: 'Presentation' /
8770: PresRule /
8771: 'Comment' .
8772: NumParent = [ GreaterLess ] NParent .
8773: GreaterLess = '>' / '<' .
8774: NParent = NUMBER.
8775: Alphabet = NAME .
8776: RelatAttr = '=' Value /
8777: '>' [ '-' ] Minimum /
8778: '<' [ '-' ] Maximum /
8779: 'IN' '[' [ '-' ] MinInterval '..'
8780: [ '-' ] MaxInterval ']' .
8781: Value = [ '-' ] IntegerVal / TextVal / AttrValue .
8782: Minimum = NUMBER .
8783: Maximum = NUMBER .
8784: MinInterval = NUMBER .
8785: MaxInterval = NUMBER .
8786: IntegerVal = NUMBER .
8787: TextVal = STRING .
8788: AttrValue = NAME .
8789:
8790: SimpleRule = 'Create' [ 'IN' VarID ] Object
8791: [ Position ] ';' /
8792: 'Write' Object [ Position ] ';' /
8793: 'Read' BufferID [ Position ] ';' /
8794: 'Include' File [ Position ] ';' /
1.6 cvs 8795: 'Get' [ RelPosition ] ElemID
8796: [ ExtStruct ]
8797: [ Position ] ';' /
1.1 cvs 8798: 'Copy' [ RelPosition ] ElemID
8799: [ ExtStruct ]
8800: [ Position ] ';' /
8801: 'Use' TrSchema [ 'For' ElemID ] ';' /
8802: 'Remove' ';' /
8803: 'NoTranslation' ';' /
8804: 'NoLineBreak' ';' /
8805: 'ChangeMainFile' VarID [ Position ] ';' /
1.14 cvs 8806: 'RemoveFile' VarID [ Position ] ';' /
1.10 cvs 8807: 'Set' CounterID InitValue [ Position ] ';' /
8808: 'Add' CounterID Increment [ Position ] ';' /
8809: 'Indent' [ 'IN' VarID ] [ IndentSign ]
8810: IndentValue [ Position ] ';' .
8811:
8812: IndentSign = '+' / '-' .
8813: IndentValue = NUMBER .
1.1 cvs 8814:
8815: Object = ConstID / CharString /
8816: BufferID /
8817: VarID /
8818: '(' Function < Function > ')' /
8819: AttrID /
8820: 'Value' /
8821: 'Content' /
8822: 'Comment' /
8823: 'Attributes' /
8824: 'Presentation' /
8825: 'RefId' /
8826: 'PairId' /
8827: 'FileDir' / 'FileName' / 'Extension' /
8828: 'DocumentName' / 'DocumentDir' /
8829: [ 'Referred' ] ReferredObject .
8830: Position = 'After' / 'Before' .
8831:
1.6 cvs 8832: ReferredObject= VarID /
8833: ElemID [ ExtStruct ] /
8834: 'RefId' /
8835: 'DocumentName' / 'DocumentDir' .
1.1 cvs 8836:
1.6 cvs 8837: File = FileName / BufferID .
8838: FileName = STRING .
1.1 cvs 8839:
1.6 cvs 8840: RelPosition = 'Included' / 'Referred' .
8841: ExtStruct = '(' ElemID ')' .
1.1 cvs 8842:
1.6 cvs 8843: TrSchema = NAME .
8844:
8845: AttrSeq = TransAttr < TransAttr > .
8846: TransAttr = AttrID [ '(' ElemID ')' ]
8847: [ RelatAttr ] ':' RuleSeq .
8848:
8849: PresSeq = PresTrans < PresTrans > .
8850: PresTrans = PresRule ':' RuleSeq .
8851: PresRule = 'Size' [ PresRelation ] /
8852: 'Indent' [ PresRelation ] /
8853: 'LineSpacing' [ PresRelation ] /
8854: 'Adjust' [ '=' AdjustVal ] /
8855: 'Justify' [ '=' BoolVal ] /
8856: 'Hyphenate' [ '=' BoolVal ] /
8857: 'Style' [ '=' StyleVal ] /
8858: 'Font' [ '=' FontVal ] /
8859: 'UnderLine' [ '=' UnderLineVal ] /
8860: 'Thickness' [ '=' ThicknessVal ] /
8861: 'LineStyle' [ '=' LineStyleVal ] /
8862: 'LineWeight' [ PresRelation ] /
8863: 'FillPattern' [ '=' Pattern ] /
8864: 'Background' [ '=' Color ] /
8865: 'Foreground' [ '=' Color ] .
8866:
8867: PresRelation = '=' PresValue /
8868: '>' [ '-' ] PresMinimum /
8869: '<' [ '-' ] PresMaximum /
8870: 'IN' '[' [ '-' ] PresIntervalMin '..'
8871: [ '-' ] PresIntervalMax ']' .
8872: AdjustVal = 'Left' / 'Right' / 'VMiddle' /
8873: 'LeftWithDots' .
8874: BoolVal = 'Yes' / 'No' .
8875: StyleVal = 'Bold' / 'Italics' / 'Roman' /
8876: 'BoldItalics' / 'Oblique' /
8877: 'BoldOblique' .
8878: FontVal = 'Times' / 'Helvetica' / 'Courier' .
8879: UnderLineVal = 'NoUnderline' / 'UnderLined' /
8880: 'OverLined' / 'CrossedOut' .
8881: ThicknessVal = 'Thick' / 'Thin' .
8882: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' .
8883: Pattern = NAME .
8884: Color = NAME .
8885: PresMinimum = NUMBER .
8886: PresMaximum = NUMBER .
1.1 cvs 8887: PresIntervalMin= NUMBER .
8888: PresIntervalMax= NUMBER .
1.6 cvs 8889: PresValue = [ '-' ] PresVal .
8890: PresVal = NUMBER .
1.1 cvs 8891:
1.6 cvs 8892: TextTransSeq = [ Alphabet ] TransSeq .
8893: Alphabet = NAME .
8894: TransSeq = 'BEGIN' < Translation > 'END' ';' /
8895: Translation .
8896: Translation = Source [ '->' Target ] ';' .
8897: Source = STRING .
8898: Target = STRING .
1.1 cvs 8899: </PRE>
8900: </DIV>
8901: <HR>
8902: </DIV>
8903:
8904: <DIV class="chapter">
1.6 cvs 8905: <H1><A name=sect7>Character coding</A></H1>
1.1 cvs 8906:
8907:
8908: <DIV class="section">
1.6 cvs 8909: <H2><A name=sectb71>Characters</A></H2>
1.1 cvs 8910:
8911: <P>
8912: The characters of the Latin alphabet follow the encoding defined in the ISO
1.5 cvs 8913: 8859-1 (ISO Latin-1) standard. The characters of the Greek alphabet follow
1.1 cvs 8914: the encoding defined by Adobe for its Symbol font (Adobe FontSpecific).</P>
8915: <P>
8916: Characters whose octal code is greater than 0200 are written in the form of
8917: their octal code preceded by a backslash character (``\''). For example, the
1.5 cvs 8918: French word 'Résumé' is written <TT>R\351sum\351</TT>.</P>
1.1 cvs 8919: <P>
1.2 cvs 8920: To the ISO 8859-1 encoding four characters with the following codes have been
1.1 cvs 8921: added:<BR><TT>212</TT>: line break<BR><TT>240</TT>: sticky
1.2 cvs 8922: space<BR><TT>201</TT>: thin space<BR><TT>202</TT>: en space</P>
1.1 cvs 8923: <P>
8924: The <TT>212</TT> character is a ``line break'' character which forces a line
8925: break. The <TT>240</TT> character is a ``sticky space'', which cannot be
8926: replaced by a line break.</P>
8927: </DIV>
8928:
8929: <DIV class="section">
1.6 cvs 8930: <H2><A name=sectb72>Symbols</A></H2>
1.1 cvs 8931:
8932: <P>
8933: The table below gives the codes for the symbols of Thot. Symbols can be used
8934: in presentation schemas constants and in transcoding rules of translation
8935: schemas. Each symbol is represented by a single character.</P>
8936: <UL>
8937: <LI><TT>r</TT>: a radical
8938: <LI><TT>i</TT>: a simple integral
8939: <LI><TT>c</TT>: a curvilinear integral
8940: <LI><TT>d</TT>: a double integral
8941: <LI><TT>t</TT>: a triple integral
8942: <LI><TT>S</TT>: the summation symbol
8943: <LI><TT>P</TT>: the product symbol
8944: <LI><TT>U</TT>: the union symbol
8945: <LI><TT>I</TT>: the intersection symbol
8946: <LI><TT>></TT>: a right arrow
8947: <LI><TT><</TT>: a left arrow
8948: <LI><TT>^</TT>: an up arrow
8949: <LI><TT>V</TT>: a down arrow
8950: <LI><TT>(</TT>: an opening parenthesis
8951: <LI><TT>)</TT>: a closing parenthesis
8952: <LI><TT>{</TT>: an opening brace
8953: <LI><TT>}</TT>: a closing brace
8954: <LI><TT>[</TT>: an opening bracket
8955: <LI><TT>]</TT>: a closing bracket
8956: </UL>
8957: </DIV>
8958:
8959: <DIV class="section">
1.6 cvs 8960: <H2><A name=sectb73>Graphical elements</A></H2>
1.1 cvs 8961:
8962: <P>
8963: The table below gives the codes for the graphical elements of Thot. These
8964: elements can be used in presentation schemas constants and in transcoding
8965: rules of translation schemas. Each graphical element is represented by a
8966: single character.</P>
8967: <UL>
8968: <LI><TT>c</TT>: an ellipse inscribed in the box
8969: <LI><TT>R</TT>: a rectangle which is the shape of the box
8970: <LI><TT>C</TT>: a rectangle with rounded corners
8971: <LI><TT>t</TT>: a horizontal line along the upper side of the box
8972: <LI><TT>h</TT>: a horizontal line as wide as the box and placed in its middle
8973: <LI><TT>b</TT>: a horizontal line along the lower side of the box
8974: <LI><TT>></TT>: a right arrow as long as the box's width and in its middle
8975: <LI><TT>></TT>: a left arrow as long as the box's width and in its middle
8976: <LI><TT>l</TT>: a vertical line on the left side of the box
8977: <LI><TT>v</TT>: a vertical line as tall as the box and placed in its middle
8978: <LI><TT>r</TT>: a vertical line on the right side of the box
8979: <LI><TT>^</TT>: an up arrow as tall as the box and in its middle
8980: <LI><TT>V</TT>: a down arrow as tall as the box and in its middle
8981: <LI><TT>/</TT>: The southwest/northeast diagonal of the box
8982: <LI><TT>\</TT>: the northwest/southeast diagonal of the box
1.2 cvs 8983: <LI><TT>O</TT>: The northwest/southeast diagonal of the box with an arrowhead
1.1 cvs 8984: at the top
1.2 cvs 8985: <LI><TT>e</TT>: The northwest/southeast diagonal of the box with an arrowhead
1.1 cvs 8986: at the bottom
1.2 cvs 8987: <LI><TT>E</TT>: The southwest/northeast diagonal of the box with an arrowhead
1.1 cvs 8988: at the top
1.2 cvs 8989: <LI><TT>o</TT>: The southwest/northeast diagonal of the box with an arrowhead
1.1 cvs 8990: at the bottom
8991: <LI><TT>space</TT>: a transparent element
1.2 cvs 8992: <LI><TT>P</TT>: a rectangle with round corners and a horizontal bar at the top
1.1 cvs 8993: <LI><TT>Q</TT>: an ellipse with a horizontal bar at the top
8994: <LI><TT>L</TT>: a lozenge
8995: <LI><TT>W</TT>: the upper right corner
8996: <LI><TT>X</TT>: the lower right corner
8997: <LI><TT>Y</TT>: the lower left corner
8998: <LI><TT>Z</TT>: the upper left corner
8999: <LI><TT>p</TT>: a polygon
9000: <LI><TT>S</TT>: an open broken line
9001: <LI><TT>N</TT>: an open broken line with an arrow head at start
9002: <LI><TT>U</TT>: an open broken line with an arrow head at the end
9003: <LI><TT>M</TT>: an open broken line with two arrow heads
9004: <LI><TT>s</TT>: a closed curve
9005: <LI><TT>B</TT>: an open curve
9006: <LI><TT>F</TT>: an open curve with an arrow head at start
9007: <LI><TT>A</TT>: an open curve with an arrow head at the end
9008: <LI><TT>D</TT>: an open curve with two arrow heads
9009: </UL>
1.5 cvs 9010: <HR>
1.1 cvs 9011: </DIV>
9012: </DIV>
9013: </BODY>
9014: </HTML>
Webmaster