Annotation of Amaya/doc/languages.html, revision 1.13
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.13 ! cvs 15: <H4>Version of March 28, 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>
202: <LI><A href="#sectc5221">The <TT>Set</TT> and <TT>Add</TT> rules</A>
1.10 cvs 203: <LI><A href="#sectc5221a">The <TT>Indent</TT> rule</A>
1.6 cvs 204: <LI><A href="#sectc5222">Rule application order</A>
205: <LI><A href="#sectc5223">Translation of logical attributes</A>
206: <LI><A href="#sectc5224">Translation of specific presentations</A>
207: <LI><A href="#sectc5225">Recoding of characters, symbols and graphics</A>
208: </UL>
209: </UL>
210:
211: <LI><BIG><A href="#sect6">Language grammars</A></BIG>
212: <UL>
213: <LI><STRONG><A href="#sectb61">The M meta-language</A></STRONG>
214: <LI><STRONG><A href="#sectb62">The S language</A></STRONG>
215: <LI><STRONG><A href="#sectb63">The P language</A></STRONG>
216: <LI><STRONG><A href="#sectb64">The T language</A></STRONG>
217: </UL>
218:
219: <LI><BIG><A href="#sect7">Character coding</A></BIG>
220: <UL>
221: <LI><STRONG><A href="#sectb71">Characters</A></STRONG>
222: <LI><STRONG><A href="#sectb72">Symbols</A></STRONG>
223: <LI><STRONG><A href="#sectb73">Graphical elements</A></STRONG>
224: </UL>
225: </UL>
1.1 cvs 226: <HR>
227: </DIV>
228:
229: <DIV class="chapter">
1.6 cvs 230: <H1><A name=sect2>The document model of Thot</A></H1>
1.1 cvs 231:
232: <P>
233: All of the services which Thot provides to the user are based on the system's
234: internal document representation. This representation is itself derived from
235: the document model which underlies Thot. The model is presented here, prior
236: to the description of the languages which permit the generic specification of
237: documents.</P>
238:
239: <DIV class="section">
1.6 cvs 240: <H2><A name=sectb21>The logical structure of documents</A></H2>
1.1 cvs 241:
242: <P>
243: The document model of Thot is primarily designed to allow the user to operate
1.5 cvs 244: on those entities which s/he has in mind when s/he works on a document. The
245: model makes no assumptions about the nature of these entities. It is
246: essentially these logical entities, such as paragraphs, sections, chapters,
247: notes, titles, and cross-references which give a document its logical
248: structure.</P>
1.1 cvs 249: <P>
1.5 cvs 250: Because of this model, the author can divide the document into chapters,
1.1 cvs 251: giving each one a title. The content of these chapters can be further divided
1.2 cvs 252: into sections, subsections, etc. The text is organized into successive
253: paragraphs, according to the content. In the writing phase, the lines, pages,
254: margins, spacing, fonts, and character styles are not very important. In fact,
255: if the system requires documents to be written in these terms, it gets in the
256: way. So, Thot's model is primarily based on the logical aspect of documents.
257: The creation of a model of this type essentially requires the definition :</P>
1.1 cvs 258: <UL>
259: <LI>of the entities which can appear in the documents,
260: <LI>and the relations between these entities.
261: </UL>
262: <P>
263: The choice of entities to include in the model can be subtle. Some documents
264: require chapters, while others only need various levels of sections. Certain
265: documents contain appendices, others don't. In different documents the same
266: logical entity may go by different names (e.g. ``Conclusion'' and
267: ``Summary''). Certain entities which are absolutely necessary in some
268: documents, such as clauses in a contract or the address of the recipient in a
269: letter, are useless in most other cases.</P>
270: <P>
271: The differences between documents result from more than just the entities that
272: appear in them, but also from the relationships between these entities and the
273: ways that they are linked. In certain documents, notes are spread throughout
274: the document, for example at the bottom of the page containing the
275: cross-reference to them, while in other documents they are collected at the
276: end of each chapter or even at the end of the work. As another example, the
277: introduction of some documents can contain many sections, while in other
278: documents, the introduction is restricted to be a short sequence of
279: paragraphs.</P>
280: <P>
281: All of this makes it unlikely that a single model can describe any document at
282: a relatively high level. It is obviously tempting to make up a list of widely
283: used entities, such as chapters, sections, paragraphs, and titles, and then
284: map all other entities onto the available choices. In this way, an
285: introduction can be supported as a chapter and a contract clause supported as
286: a paragraph or section. However, in trying to widen the range of usage of
287: certain entities, their meaning can be lost and the power of the model
288: reduced. In addition, while this widening partially solves the problem of
289: choosing entities, it does not solve the problem of their organization: when a
290: chapter must be composed of sections, how does one indicate that an
291: introduction has none when it is merely another chapter? One solution is to
292: include introductions in the list of supported entities. But then, how does
293: one distinguish those introductions which are allowed to have sections from
294: those which are not. Perhaps this could be done by defining two types of
295: introduction. Clearly, this approach risks an infinite expansion of the list
296: of widely used entities.</P>
297: </DIV>
298:
299: <DIV class="section">
1.6 cvs 300: <H2><A name=sectb22>Generic and specific structures</A></H2>
1.1 cvs 301:
302: <P>
303: Thus, it is apparently impossible to construct an exhaustive inventory of all
1.2 cvs 304: those entities which are necessary and sufficient to precisely describe any
305: document. It also seems impossible to specify all possible arrangements of
306: these entities in a document. This is why Thot uses a <EM>meta-model</EM>
307: instead, which permits the description of numerous <EM>models</EM>, each one
308: describing a <EM>class</EM> of documents.</P>
1.1 cvs 309: <P>
310: A <EM>class</EM> is a set of documents having very similar structure. Thus,
311: the collection of research reports published by a laboratory constitutes a
312: class; the set of commercial proposals by the sales department of a company
313: constitutes another class; the set of articles published by a journal
314: constitutes a third class. Clearly, it is not possible to enumerate every
315: possible document class. It is also clear that new document classes must be
316: created to satisfy new needs and applications.</P>
317: <P>
318: To give a more rigorous definition of classes, we must introduce the ideas of
319: <EM>generic structure</EM> and <EM>specific structure</EM>. Each document has
320: a <EM>specific structure</EM> which organizes the various parts which comprise
321: it. We illustrate this with the help of a simple example comparing two
322: reports, A and B (<A href="#specstruct">see Figure</A>). The report A contains
323: an introduction followed by three chapters and a conclusion. The first
324: chapter contains two sections, the second, three sections. That is the
325: <EM>specific</EM> structure of document A. Similarly, the structure of
326: document B is: an introduction, two chapters, a conclusion; Chapter 1 has
327: three sections while Chapter 2 has four. The specific structures of these two
328: documents are thus different.</P>
329:
330: <DIV class="figure">
331: <HR>
332: <PRE>
333: Report A Report B
334: Introduction Introduction
335: Chapter 1 Chapter 1
336: Section 1.1 Section 1.1
337: Section 1.2 Section 1.2
338: Chapter 2 Section 1.3
339: Section 2.1 Chapter 2
340: Section 2.2 Section 2.1
341: Section 2.3 Section 2.2
342: Chapter 3 Section 2.3
343: Conclusion Section 2.4
344: Conclusion
345: </PRE>
346: <P align=center>
347: <EM><A name="specstruct">Two specific structures</A></EM></P>
348: <HR>
349: </DIV>
350: <P>
351: The <EM>generic structure</EM> defines the ways in which specific structures
352: can be constructed. It specifies how to generate specific structures. The
353: reports A and B, though different, are constructed in accordance with the same
354: generic structure, which specifies that a report contains an introduction
355: followed by a variable number of chapters and a conclusion, with each chapter
356: containing a variable number of sections.</P>
357: <P>
358: There is a one-to-one correspondence between a class and a generic structure:
359: all the documents of a class are constructed in accordance with the same
360: generic structure. Hence the definition of the class: a class is a set of
361: documents whose specific structure is constructed in accordance with the same
362: generic structure. A class is characterized by its generic structure.</P>
363: <P>
364: Thus, a generic structure can be considered to be a model at the level which
365: interests us, but only for one class of documents. When the definition is
366: limited to a single class of documents, it is possible to define a model which
367: does a good job of representing the documents of the class, including the
368: necessary entities and unencumbered by useless entities. The description of
369: the organization of the documents in the class can then be sufficiently
370: precise.</P>
371: </DIV>
372:
373: <DIV class="section">
1.6 cvs 374: <H2><A name=sectb23>Logical structure and physical structure</A></H2>
1.1 cvs 375:
376: <P>
377: Generic structures only describe the <EM>logical</EM> organization of
378: documents, not their <EM>physical</EM> presentation on a screen or on sheets
379: of paper. However, for a document to be displayed or printed, its graphic
380: presentation must be taken into account.</P>
381: <P>
382: An examination of current printed documents shows that the details of
383: presentation essentially serve to bring out their logical structure. Outside
384: of some particular domains, notably advertising, the presentation is rarely
385: independent of the logical organization of the text. Moreover, the art of
386: typography consists of enhancing the organization of the text being set,
387: without catching the eye of the reader with overly pronounced effects. Thus,
388: italic and boldface type are used to emphasize words or expressions which have
389: greater significance than the rest of the text: keywords, new ideas,
390: citations, book titles, etc. Other effects highlight the organization of the
391: text: vertical space, margin changes, page breaks, centering, eventually
392: combined with the changes in the shapes or weight of the characters. These
393: effects serve to indicate the transitions between paragraphs, sections, or
394: chapters: an object's level in the logical structure of the document is shown
395: by the markedness of the effects.</P>
396: <P>
397: Since the model permits the description of all of the logical structure of the
398: document, the presentation can be derived from the model without being
399: submerged in the document itself. It suffices to use the logical structure of
400: the document to make the desired changes in its presentation: changes in type
401: size, type style, spacing, margin, centering, etc.</P>
402: <P>
403: Just as one cannot define a unique generic logical structure for all document
404: classes, one cannot define universal presentation rules which can be applied
405: to all document classes. For certain types of documents the chapter titles
406: will be centered on the page and printed in large, bold type. For other
407: documents, the same chapter titles will be printed in small, italic type and
408: aligned on the left margin.</P>
409: <P>
410: Therefore, it is necessary to base the presentation specifications for
411: documents on their class. Such a specification can be very fine-grained,
412: because the presentation is expressed in terms of the entities defined in the
413: generic logical structure of the class. Thus, it is possible to specify a
414: different presentation for the chapter titles and the section titles, and
415: similarly to specify titles for the sections according to their level in the
416: section hierarchy. The set of rules which specify the presentation of all the
417: elements defined in a generic logical structure is called a <EM>generic
418: presentation</EM>.</P>
419: <P>
420: There are several advantages derived from having a presentation linked to the
421: generic structure and described by a generic presentation. Homogeneity is the
422: first. Since every document in a class corresponds to the same generic
423: logical structure, a homogenous presentation for different documents of the
424: same class can be assured by applying the same generic presentation to all
425: documents of the class. Homogeneity of presentation can also be found among
1.2 cvs 426: the entities of a single document: every section heading will be presented in
1.1 cvs 427: the same way, the first line of every paragraph of the same type will have the
428: same indentation, etc.</P>
429: <P>
430: Another advantage of this approach to presentation is that it facilitates
431: changes to the graphical aspect of documents. A change to the generic
432: presentation rules attached to each type of entity will alter the presentation
433: of the entire document, and will do so homogenously. In this case, the
434: internal homogeneity of the class is no longer assured, but the way to control
435: it is simple. It suffices to adopt a single generic presentation for the
436: entire class.</P>
437: <P>
438: If the presentation of the class does not have to be homogenous, then the
439: appearance of the document can be adapted to the way it will be used or to the
440: device used to render it. This quality is sufficient to allow the existence
441: of <A name="mulpres">many generic presentations</A> for the same document
442: class. By applying one or the other of these presentations to it, the document
443: can be seen under different graphical aspects. It must be emphasized that
444: this type of modification of the presentation is not a change to the document
445: itself (in its specific logical structure or its content), but only in its
446: appearance at the time of editing or printing.</P>
447: </DIV>
448:
449: <DIV class="section">
1.6 cvs 450: <H2><A name=sectb24>Document structures and object structures</A></H2>
1.1 cvs 451:
452: <P>
453: So far, we have only discussed the global structure of documents and have not
454: considered the contents found in that structure. We could limit ourselves to
455: purely textual contents by assuming that a title or a paragraph contains a
456: simple linear text. But this model would be too restrictive. In fact,
457: certain documents contain not only text, but also contain tables, diagrams,
458: photographs, mathematical formulas, and program fragments. The model must
459: permit the representation of such <EM>objects</EM>.</P>
460: <P>
461: Just as with the whole of the document, the model takes into account the
462: logical structure of objects of this type. Some are clearly structured,
463: others are less so. Logical structure can be recognized in mathematical
464: formulas, in tables, and in certain types of diagrams. On the other hand, it
465: is difficult to define the structure of a photograph or of some drawings. But
466: in any case, it does not seem possible to define one unique structure which
467: can represent every one of these types of objects. The approach taken in the
468: definition of meta-structure and document classes also applies to objects.
469: Object classes can be defined which put together objects of similar type,
470: constructed from the same generic logical structure.</P>
471: <P>
472: Thus, a mathematical class can be defined and have a generic logical structure
473: associated with it. But even if a single generic structure can represent a
474: sufficient variety of mathematical formulas, for other objects with less
475: rigorous structure, multiple classes must be defined. As for documents, using
476: multiple classes assures that the model can describe the full range of objects
477: to be presented. It also permits the system to support objects which were not
478: initially anticipated. Moreover, this comment applies equally to mathematics:
479: different classes of formulas can be described depending on the domain of
480: mathematics being described.</P>
481: <P>
482: Since objects have the same level of logical representation as documents, they
483: gain the same advantages. In particular, it is possible to define the
484: presentation separately from the objects themselves and attach it to the
485: class. Thus, as for documents, objects of the same type have a uniform
486: presentation and the presentation of every object in a given class can be
487: changed simply by changing the generic presentation of the class. Another
488: advantage of using this document model is that the system does not bother the
489: user with the details of presentation, but rather allows the user to
490: concentrate on the logical aspect of the document and the objects.</P>
491: <P>
492: It is clear that the documents in a class do not necessarily use the same
493: classes of objects: one technical report will contain tables while another
494: report will have no tables but will use mathematical formulas. The usable
1.2 cvs 495: object classes are not always mentioned in a limiting way in the generic
496: logical structure of documents. Rather, they can be chosen freely from a
497: large set, independent of the document class.</P>
1.1 cvs 498: <P>
499: Thus, the object classes will be made commonplace and usable in every
500: document. The notion of ``object'' can be enlarged to include not only
501: non-textual elements, but also certain types of textual elements which can
502: appear in practically every document, whatever their class. Among these
1.2 cvs 503: textual elements, one can mention enumerations, descriptions, examples,
504: quotations, even paragraphs.</P>
1.1 cvs 505: <P>
506: Thus, the document model is not a single, general model describing every type
507: of document in one place. Rather, it is a meta-model which can be used to
508: describe many different models each of which represents either a class of
509: similar documents or a class of similar objects which every document can
510: include.</P>
511: </DIV>
512: <HR>
513: </DIV>
514:
515: <DIV class="chapter">
1.6 cvs 516: <H1><A name=sect3>The S language</A></H1>
1.1 cvs 517:
518:
519: <DIV class="section">
1.6 cvs 520: <H2><A name=sectb31>Document meta-structure</A></H2>
1.1 cvs 521:
522: <P>
523: Since the concept of meta-structure is well suited to the task of describing
524: documents at a high level of abstraction, this meta-structure must be
525: precisely defined. Toward that end this section first presents the basic
526: elements from which documents and structured objects are composed and then
527: specifies the ways in which these basic elements are assembled into structures
528: representing complete documents and objects.</P>
529:
530: <DIV class="subsection">
1.6 cvs 531: <H3><A name=sectc311>The basic types</A></H3>
1.1 cvs 532:
533: <P>
534: At the lowest level of a document's structure, the first atom considered is
535: the character. However, since characters are seldom isolated, usually
536: appearing as part of a linear sequence, and in order to reduce the complexity
537: of the document structure, <EM>character strings</EM> are used as atoms and
538: consecutive characters belonging to the same structural element are grouped in
539: the same character string.</P>
540: <P>
541: If the structure of a document is not refined to go down to the level of
542: words or phrases, the contents of a simple paragraph can be considered to be a
543: single character string. On the other hand, the title of a chapter, the title
544: of the first section of that chapter, and the text of the first paragraph of
545: that section constitute three different character strings, because they belong
546: to distinct structural elements.</P>
547: <P>
548: If, instead, a very fine-grained representation for the structure of a
549: document is sought, character strings could be defined to contain only a
550: single word, or even just a single character. This is the case, for example,
551: in programs, for which one wants to retain a structure very close to the
1.2 cvs 552: syntax of the programming language. In this case, an assignment statement
1.1 cvs 553: initializing a simple variable to zero would be composed of two structural
554: elements, the identifier of the variable (a short character string) and the
555: assigned value (a string of a single character, `0').</P>
556: <P>
557: The character string is not the only atom necessary for representing those
558: documents that interest us. It suffices for purely textual documents, but as
559: soon as the non-textual objects which we have considered arise, there must be
560: other atoms; the number of objects which are to be represented determines the
561: number of types of atoms that are necessary.</P>
562: <P>
563: Primitive <EM>graphical elements</EM> are used for tables and figures of
564: different types. These elements are simple geometric shapes like horizontal
565: or vertical lines, which are sufficient for tables, or even oblique lines,
1.2 cvs 566: arrows, rectangles, circles, polygons, and curves for use in figures. From
567: these elements and character strings, graphical objects and tables can be
568: constructed.</P>
1.1 cvs 569: <P>
570: Photographs, though having very little structure, must still appear in
1.2 cvs 571: documents. They are supported by <EM>picture</EM> elements, which are
572: represented as matrices of pixels.</P>
1.1 cvs 573: <P>
574: Finally, mathematical notations require certain elements which are
575: simultaneously characters and graphical elements, the <EM>symbols</EM>. By way
1.2 cvs 576: of example, radicals, integration signs, or even large parentheses are
1.1 cvs 577: examples of this type of atom. The size of each of these symbols is
578: determined by its environment, that is to say, by the expression to which it
579: is attached.</P>
580: <P>
581: To summarize, the primitive elements which are used in the construction of
582: documents and structured objects are:</P>
583: <UL>
584: <LI>character strings,
585: <LI>graphical elements,
1.2 cvs 586: <LI>pictures,
1.1 cvs 587: <LI>and mathematical symbols.
588: </UL>
589: </DIV>
590:
591: <DIV class="subsection">
1.6 cvs 592: <H3><A name=sectc312>Constructed elements</A></H3>
1.1 cvs 593:
594: <P>
595: A document is evidently formed from primitive elements. But the model of Thot
596: also proposes higher level elements. Thus, in a document composed of several
597: chapters, each chapter is an element, and in the chapters each section is also
598: an element, and so on. A document is thus an organized set of elements.</P>
599: <P>
600: In a document there are different sorts of elements. Each element has a
601: <EM>type</EM> which indicates the role of the element within the document as a
602: whole. Thus, we have, for example, the chapter and section types. The
603: document is made up of typed elements: elements of the type chapter and
604: elements of the type section, among others, but also character string elements
605: and graphical elements: the primitive elements are typed elements just as
606: well. At the other extreme, the document itself is also considered to be a
607: typed element.</P>
608: <P>
609: The important difference between the primitive elements and the other elements
610: of the document is that the primitive elements are atoms (they cannot be
611: decomposed), whereas the others, called <EM>constructed elements</EM>, are
612: composed of other elements, which can either be primitive elements or
613: constructed elements. A constructed element of type chapter (or more simply,
614: ``a chapter'') is composed of sections, which are also constructed elements. A
615: paragraph, a constructed element, can be made up of character strings, which
616: are primitive elements, and of equations, which are constructed elements.</P>
617: <P>
618: A document is also a constructed element. This is an important point. In
619: particular, it allows a document to be treated as part of another document,
620: and conversely, permits a part of a document to be treated as a complete
621: document. Thus, an article presented in a journal is treated by its author as
622: a document in itself, while the editor of the journal considers it to be part
623: of an issue. A table or a figure appearing in a document can be extracted and
624: treated as a complete document, for example to prepare transparencies for a
625: conference.</P>
626: <P>
627: These thoughts about types and constructed elements apply just as well to
628: objects as they do to documents. A table is a constructed element made up of
629: other constructed elements, rows and columns. A row is formed of cells, which
630: are also constructed elements which contain primitive elements (character
631: strings) and/or constructed elements like equations.</P>
632: </DIV>
633:
634: <DIV class="subsection">
1.6 cvs 635: <H3><A name=sectc313>Logical structure constructors</A></H3>
1.1 cvs 636:
637: <P>
638: Having defined the primitive elements and the constructed elements, it is now
639: time to define the types of organization which allow the building of
640: structures. For this, we rely on the notion of the <EM>constructor</EM>. A
641: constructor defines a way of assembling certain elements in a structure. It
642: resides at the level of the meta-structure: it does not describe the existing
643: relations in a given structure, but rather defines how elements are assembled
1.2 cvs 644: to build a structure that conforms to a model.</P>
1.1 cvs 645: <P>
646: In defining the overall organization of documents, the first two constructors
647: considered are the aggregate and the list.</P>
648:
649: <DIV class="subsubsection">
1.6 cvs 650: <H4><A name=sectd3131>Aggregate and List</A></H4>
1.1 cvs 651:
652: <P>
653: The <EM>aggregate</EM> constructor is used to define constructed element types
654: which are collections of a given number of other elements. These collections
655: may or may not be ordered. The elements may be either constructed or
656: primitive and are specified by their type. A report (that is, a constructed
657: element of the report type) has an aggregate structure. It is formed from a
658: title, an author's name, an introduction, a body, and a conclusion, making it
659: a collection of five element types. This type of constructor is found in
660: practically every document, and generally at several levels in a document.</P>
661: <P>
662: The <EM>list</EM> constructor is used to define constructed elements which are
663: ordered sequences of elements (constructed or primitive) having the same type.
664: The minimum and maximum numbers of elements for the sequence can be specified
665: in the list constructor or the number of elements can be left unconstrained.
666: The body of a report is a list of chapters and is typically required to
667: contain a minimum of two chapters (is a chapter useful if it is the only one
668: in the report?) The chapter itself can contain a list of sections, each
1.2 cvs 669: section containing a list of paragraphs. In the same way as the aggregate,
670: the list is a very frequently used constructor in every type of document.
671: However, these two constructors are not sufficient to describe every document
672: structure; thus other constructors supplement them.</P>
1.1 cvs 673: </DIV>
674:
675: <DIV class="subsubsection">
1.6 cvs 676: <H4><A name=sectd3132>Choice, Schema, and Unit</A></H4>
1.1 cvs 677:
678: <P>
679: The <EM>choice</EM> constructor is used to define the structure of an element
680: type for which one alternative is chosen from several possibilities. Thus, a
681: paragraph can be either a simple text paragraph, or an enumeration, or a
1.2 cvs 682: citation.</P>
1.1 cvs 683: <P>
684: The choice constructor indicates the complete list of possible options, which
685: can be too restrictive in certain cases, the paragraph being one such case.
686: Two constructors, <EM>unit</EM> and <EM>schema</EM>, address this
687: inconvenience. They allow more freedom in the choice of an element type. If
688: a paragraph is defined by a schema constructor, it is possible to put in the
689: place of a paragraph a table, an equation, a drawing or any other object
690: defined by another generic logical structure. It is also possible to define a
691: paragraph as a sequence of units, which could be character strings, symbols,
1.2 cvs 692: or pictures. The choice constructor alone defines a generic logical structure
1.1 cvs 693: that is relatively constrained; in contrast, using units and schemas, a very
694: open structure can be defined.</P>
695: <P>
696: The <EM>schema</EM> constructor represents an object defined by a generic
697: logical structure chosen freely from among those available.</P>
698: <P>
699: The <EM>unit</EM> constructor represents an element whose type can be either a
700: primitive type or an element type defined as a unit in the generic logical
701: structure of the document, or in another generic logical structure used in the
702: document. Such an element may be used in document objects constructed
703: according to other generic structures.</P>
704: <P>
705: Thus, for example, if a cross-reference to a footnote is defined in the
706: generic logical structure ``Article'' as a unit, a table (an object defined by
707: another generic structure) can contain cross-references to footnotes, when
708: they appear in an article. In another type of document, a table defined by
709: the same generic structure can contain other types of elements, depending on
710: the type of document into which the table is inserted. All that is needed is
711: to declare, in the generic structure for tables, that the contents of cells
712: are units. In this way, the generic structure of objects is divided up
713: between different types of documents which are able to adapt themselves to the
714: environment into which they are inserted.</P>
715: </DIV>
716:
717: <DIV class="subsubsection">
1.6 cvs 718: <H4><A name=sectd3133>Reference and Inclusion</A></H4>
1.1 cvs 719:
720: <P>
1.5 cvs 721: The <EM>reference</EM> is used to define document
1.1 cvs 722: elements that are cross-references to other elements, such as a section, a
1.2 cvs 723: chapter, a bibliographic citation, or a figure. The reference is
724: bi-directional. It can be used to access both the element being
1.1 cvs 725: cross-referenced and each of the elements which make use of the
726: cross-reference.</P>
727: <P>
728: References can be either <EM>internal</EM> or <EM>external</EM>. That is,
729: they can designate elements which appear in the same document or in another
730: document.</P>
731: <P>
732: The <EM><A name="inclusion">inclusion</A></EM> constructor is a special type
733: of reference. Like the reference, it is an internal or external bidirectional
734: link, but it is not a cross-reference. This link represents the ``live''
735: inclusion of the designated element; it accesses the most recent version of
736: that element and not a ``dead'' copy, fixed in the state in which it was found
737: at the moment the copy was made. As soon as an element is modified, all of
738: its inclusions are automatically brought up to date. It must be noted that,
1.2 cvs 739: in addition to inclusion, Thot permits the creation of ``dead'' copies.</P>
1.1 cvs 740: <P>
741: There are three types of inclusions: inclusions with full expansion,
742: inclusions with partial expansion, and inclusions without expansion. During
743: editing, inclusions without expansion are represented on the screen by the
744: name of the included document, in a special color, while inclusions with
745: expansion (full or partial) are represented by a copy (full or partial) of the
746: included element (also in a special color). The on-screen representation of a
1.6 cvs 747: partial inclusion is a <A href="#sectc3213">``skeleton''</A> image of the
1.1 cvs 748: included document.</P>
749: <P>
750: Inclusion with complete expansion can be used to include parts of the same
751: document or of other documents. Thus, it can be either an internal or an
752: external link. It can be used to include certain bibliographic entries of a
753: scientific article in another article, or to copy part of a mathematical
754: formula into another formula of the same document, thus assuring that both
755: copies will remain synchronized.</P>
756: <P>
757: Inclusion without expansion or with partial expansion is used to include
758: complete documents. It is always an external link. It is used primarily to
759: divide very large documents into sub-documents that are easier to manipulate,
760: especially when there are many authors. So, a book can include some chapters,
761: where each chapter is a different document which can be edited separately.
762: When viewing the book on the screen, it might be desirable to see only the
763: titles of the chapters and sections. This can be achieved using inclusion
764: with partial expansion.</P>
765: <P>
766: During printing, inclusions without expansion or with partial expansion can be
767: represented either as they were shown on the screen or by a complete (and
768: up-to-date) copy of the included element or document.</P>
769: <P>
770: The inclusion constructor, whatever its type, respects the generic structure:
771: only those elements authorized by the generic structure can be included at a
772: given position in a document.</P>
773: </DIV>
774:
775: <DIV class="subsubsection">
1.6 cvs 776: <H4><A name=sectd3134>Mark pairs</A></H4>
1.1 cvs 777:
778: <P>
779: It is often useful to delimit certain parts of a document independently from
780: the logical structure. For example, one might wish to attach some information
1.6 cvs 781: (in the form of an <A href="#sectc315">attribute</A>) or a particular
1.1 cvs 782: treatment to a group of words or a set of consecutive paragraphs. <EM>Mark
783: pairs</EM> are used to do this.</P>
784: <P>
785: Mark pairs are elements which are always paired and are terminals in the
786: logical structure of the document. Their position in the structure of the
787: document is defined in the generic structure. It is important to note that
788: when the terminals of a mark pair are <EM>extensions</EM> (see the next
789: section), they can be used quite freely.</P>
790: </DIV>
791:
792: <DIV class="subsubsection">
1.6 cvs 793: <H4><A name=sectd3135>Restrictions and Extensions</A></H4>
1.1 cvs 794:
795: <P>
796: The primitive types and the constructors presented so far permit the
797: definition of the logical structure of documents and objects in a rigorous
798: way. But this definition can be very cumbersome in certain cases, notably
799: when trying to constrain or extend the authorized element types in a
800: particular context. <EM>Restrictions</EM> and <EM>extensions</EM> are used to
1.2 cvs 801: cope with these cases.</P>
1.1 cvs 802: <P>
803: A restriction associates with a particular element type <EM>A</EM>, a list of
804: those element types which elements of type <EM>A</EM> may not contain, even if
805: the definition of type <EM>A</EM> and those of its components authorize them
806: otherwise. This simplifies the writing of generic logical structures and
807: allows limitations to be placed, when necessary, on the choices offered by the
808: schema and unit constructors.</P>
809: <P>
810: Extensions are the inverse of restrictions. They identify a list of element
811: types whose presence <EM>is</EM> permitted, even if its definition and those
812: of its components do not authorize them otherwise.</P>
813: </DIV>
814:
815: <DIV class="subsubsection">
1.6 cvs 816: <H4><A name=sectd3136>Summary</A></H4>
1.1 cvs 817:
818: <P>
819: Thus, four constructors are used to construct a document:</P>
820: <UL>
1.2 cvs 821: <LI>the aggregate constructor (ordered or not),
1.1 cvs 822: <LI>the list constructor,
1.2 cvs 823: <LI>the choice constructor and its extensions, the unit and schema
824: constructors,
1.1 cvs 825: <LI>the reference constructor and its variant, the inclusion.
826: </UL>
827: <P>
828: These constructors are also sufficient for objects. Thus, these constructors
829: provide a homogenous meta-model which can describe both the organization of
830: the document as a whole and that of the various types of objects which it
831: contains. After presenting the description language for generic structures,
832: we will present several examples which illustrate the appropriateness of the
833: model.</P>
834: <P>
835: The first three constructors (aggregate, list and choice) lead to tree-like
836: structures for documents and objects, the objects being simply the subtrees of
837: the tree of a document (or even of other objects' subtrees). The reference
838: constructor introduces other, non-hierarchical, relations which augment those
839: of the tree: when a paragraph makes reference to a chapter or a section, that
840: relation leaves the purely tree-like structure. Moreover, external reference
841: and inclusion constructors permit the establishment of links between different
842: documents, thus creating a hypertext structure.</P>
843: </DIV>
844: </DIV>
845:
846: <DIV class="subsection">
1.6 cvs 847: <H3><A name=sectc314>Associated Elements</A></H3>
1.1 cvs 848:
849: <P>
850: Thanks to the list, aggregate and choice constructors, the organization of the
851: document is specified rigorously, using constructed and primitive elements.
852: But a document is made up of more than just its elements; it clearly also
853: contains links between them. There exist elements whose position in the
854: document's structure is not determinable. This is notably the case for
855: figures and notes. A figure can be designated at many points in the same
856: document and its place in the physical document can vary over the life of the
857: document without any effect on the meaning or clarity of the document. At one
858: time, it can be placed at the end of the document along with all other
859: figures. At another time, it can appear at the top of the page which follows
860: the first mention of the figure. The figures can be dispersed throughout the
861: document or can be grouped together. The situation is similar for notes,
862: which can be printed at the bottom of the page on which they are mentioned or
863: assembled together at the end of the chapter or even the end of the work. Of
864: course, this brings up questions of the physical position of elements in
865: documents that are broken into pages, but this reflects the structural
866: instability of these elements. They cannot be treated the same way as
867: elements like paragraphs or sections, whose position in the structure is
868: directly linked to the semantics of the document.</P>
869: <P>
870: Those elements whose position in the structure of the document is not fixed,
871: even though they are definitely part of the document, are called
872: <EM>associated elements</EM>. Associated elements are themselves structures,
873: which is to say that their content can be organized logically by the
874: constructors from primitive and constructed elements.</P>
875: <P>
876: It can happen that the associated elements are totally disconnected from the
877: structure of the document, as in a commentary or appraisal of the entire work.
878: But more often, the associated elements are linked to the content of the
879: document by references. This is generally the case for notes and figures,
880: among others.</P>
881: <P>
882: Thus, associated elements introduce a new use for the reference constructor.
883: It not only serves to create links between elements of the principal structure
884: of the document, but also serves to link the associated elements to the
885: primary structure.</P>
886: </DIV>
887:
888: <DIV class="subsection">
1.6 cvs 889: <H3><A name=sectc315>Attributes</A></H3>
1.1 cvs 890:
891: <P>
892: There remain logical aspects of documents that are not entirely described by
893: the structure. Certain types of semantic information, which are not stated
894: explicitly in the text, must also be taken into account. In particular, such
895: information is shown by typographic effects which do not correspond to a
896: change between structural elements. In fact, certain titles are set in bold
897: or italic or are printed in a different typeface from the rest of the text in
898: order to mark them as structurally distinct. But these same effects
899: frequently appear in the middle of continuous text (e.g. in the interior of a
900: paragraph). In this case, there is no change between structural elements; the
901: effect serves to highlight a word, expression, or phrase. The notion of an
902: <EM>attribute</EM> is used to express this type of information.</P>
903: <P>
904: An attribute is a piece of information attached to a structural element which
905: augments the type of the element and clarifies its function in the document.
906: Keywords, foreign language words, and titles of other works can all be
907: represented by character strings with attached attributes. Attributes may
908: also be attached to constructed elements. Thus, an attribute indicating the
909: language can be attached to a single word or to a large part of a
910: document.</P>
911: <P>
912: In fact, an attribute can be any piece of information which is linked to a
913: part of a document and which can be used by agents which work on the document.
914: For example, the language in which the document is written determines the set
915: of characters used by an editor or formatter. It also determines the
916: algorithm or hyphenation dictionary to be used. The attribute ``keyword''
917: facilitates the work of an information retrieval system. The attribute
918: ``index word'' allows a formatter to automatically construct an index at the
919: end of the document.</P>
920: <P>
921: As with the types of constructed elements, the attributes and the values they
922: can take are defined separately in each generic logical structure, not in the
923: meta-model, according to the needs of the document class or the nature of the
924: object.</P>
925: <P>
926: Many types of attributes are offered: numeric, textual, references, and
927: enumerations:</P>
928: <UL>
1.2 cvs 929: <LI><EM>Numeric attributes</EM> can take integer values (negative, positive,
930: or null).
1.1 cvs 931: <LI><EM>Textual attributes</EM> have as their values character strings.
1.2 cvs 932: <LI><EM>Reference attributes</EM> designate an element of the logical
933: structure.
934: <LI><EM>Enumeration attributes</EM> can take one value from a limited list of
1.1 cvs 935: possible values, each value being a name.
936: </UL>
937: <P>
938: In a generic structure, there is a distinction between <EM>global
939: attributes</EM> and <EM>local attributes</EM>. A global attribute can be
940: applied to every element type defined in the generic structure where it is
941: specified. In contrast, a local attribute can only be applied to certain
942: types of elements, even only a single type. The ``language'' attribute
943: presented above is an example of a global attribute. An example of a local
944: attribute is the rank of an author (principal author of the document or
945: secondary author): this attribute can only be applied sensibly to an element
946: of the ``author'' type.</P>
947: <P>
948: Attributes can be assigned to the elements which make up the document in many
949: different ways. The author can freely and dynamically place them on any part
1.5 cvs 950: of the document in order to attach supplementary information of his/her choice.
1.1 cvs 951: However, attributes may only be assigned in accordance with the rules of the
952: generic structure; in particular, local attributes can only be assigned to
953: those element types for which they are defined.</P>
954: <P>
955: In the generic structure, certain local attributes can be made mandatory for
1.2 cvs 956: certain element types. In this case, Thot automatically associates the
957: attribute with the elements of this type and it requires the user to provide a
958: value for this attribute.</P>
1.1 cvs 959: <P>
960: Attributes can also be automatically assigned, with a given value, by every
961: application processing the document in order to systematically add a piece of
962: information to certain predefined elements of the document. By way of
963: example, in a report containing a French abstract and an English abstract,
964: each of the two abstracts is defined as a sequence of paragraphs. The first
965: abstract has a value of ``French'' for the ``language'' attribute while the
966: second abstract's ``language'' attribute has a value of ``English''.</P>
967: <P>
968: In the case of mark pairs, attributes are logically associated with the pair
969: as a whole, but are actually attached to the first mark.</P>
970: </DIV>
971:
972: <DIV class="subsection">
1.6 cvs 973: <H3><A name=sectc316>Discussion of the model</A></H3>
1.1 cvs 974:
975: <P>
976: The notions of attribute, constructor, structured element, and associated
977: element are used in the definition of generic logical structures of documents
978: and objects. The problem is to assemble them to form generic structures. In
979: fact, many types of elements and attributes can be found in a variety of
980: generic structures. Rather than redefine them for each structure in which
981: they appear, it is best to share them between structures. The object classes
982: already fill this sharing function. If a mathematical class is defined, its
983: formulas can be used in many different document classes, without redefining
984: the structure of each class. This problem arises not only for the objects
985: considered here; it also arises for the commonplace textual elements found in
986: many document classes. This is the reason why the notion of object is so
987: broad and why paragraphs and enumerations are also considered to be objects.
988: These object classes not only permit the sharing of the structures of
989: elements, but also of the attributes defined in the generic structures.</P>
990: <P>
991: Structure, such as that presented here, can appear very rigid, and it is
992: possible to imagine that a document editing system based on this model could
993: prove very constraining to the user. This is, in fact, a common criticism of
994: syntax-directed editors. This defect can be avoided with Thot, primarily for
995: three reasons:</P>
996: <UL>
997: <LI>the generic structures are not fixed in the model itself,
998: <LI>the model takes the dynamics of documents into account,
999: <LI>the constructors offer great flexibility.
1000: </UL>
1001: <P>
1002: When the generic structure of a document is not predefined, but rather is
1003: constructed specifically for each document class, it can be carefully adapted
1004: to the current needs. In cases where the generic structure is inadequate for
1005: a particular document of the class, it is always possible either to create a
1006: new class with a generic structure well suited to the new case or to extend
1007: the generic structure of the existing class to take into account the specifics
1008: of the document which poses the problem. These two solutions can also be
1009: applied to objects whose structures prove to be poorly designed.</P>
1010: <P>
1011: The model is sufficiently flexible to take into account all the phases of the
1012: life of the document. When a generic structure specifies that a report must
1013: contain a title, an abstract, an introduction, at least two chapters, and a
1014: conclusion, this means only that a report, <EM>upon completion</EM>, will have
1015: to contain all of these elements. When the author begins writing, none of
1.2 cvs 1016: these elements is present. Thot uses this model. Therefore, it tolerates
1017: documents which do not conform strictly to the generic structure of their
1018: class; it also considers the generic logical structure to be a way of helping
1019: the user in the construction of a complex document.</P>
1.1 cvs 1020: <P>
1021: In contrast, other applications may reject a document which does not conform
1022: strictly to its generic structure. This is, for example, what is done by
1023: compilers which refuse to generate code for a program which is not
1024: syntactically correct. This might also occur when using a document
1025: application for a report which does not have an abstract or title.</P>
1026: <P>
1027: The constructors of the document model bring a great flexibility to the
1028: generic structures. A choice constructor (and even more, a unit or schema
1029: constructor) can represent several, very different elements. The list
1030: constructor permits the addition of more elements of the same type. Used
1031: together, these two constructors permit any series of elements of different
1032: types. Of course, this flexibility can be reduced wherever necessary since a
1033: generic structure can limit the choices or the number of elements in a
1034: list.</P>
1035: <P>
1036: Another difficulty linked to the use of structure in the document model
1037: resides in the choice of the level of the structure. The structure of a
1038: discussion could be extracted from the text itself via linguistic analysis.
1039: Some studies are exploring this approach, but the model of Thot excludes this
1040: type of structure. It only takes into account the logical structure provided
1041: explicitly by the author.</P>
1042: <P>
1043: However, the level of structure of the model is not imposed. Each generic
1044: structure defines its own level of structure, adapted to the document class or
1045: object and to the ways in which it will be processed. If it will only be
1046: edited and printed, a relatively simple structure suffices. If more
1047: specialized processing will be applied to it, the structure must represent the
1048: element types on which this processing must act. By way of example, a simple
1049: structure is sufficient for printing formulas, but a more complex structure is
1050: required to perform symbolic or numeric calculations on the mathematical
1051: expressions. The document model of Thot allows both types of structure.</P>
1052: </DIV>
1053: </DIV>
1054:
1055: <DIV class="section">
1.6 cvs 1056: <H2><A name=sectb32>The definition language for generic structures</A></H2>
1.1 cvs 1057:
1058: <P>
1059: Generic structures, which form the basis of the document model of Thot, are
1060: specified using a special language. This definition language, called S, is
1061: described in this section.</P>
1062: <P>
1063: Each generic structure, which defines a class of documents or objects, is
1.2 cvs 1064: specified by a file, written in the S language, which is called a
1.1 cvs 1065: <EM>structure schema</EM>. Structure schemas are compiled into tables, called
1.2 cvs 1066: structure tables, which are used by Thot and which determine its behavior.</P>
1.1 cvs 1067:
1068: <DIV class="subsection">
1.6 cvs 1069: <H3><A name=sectc321>Writing Conventions</A></H3>
1.1 cvs 1070:
1071: <P>
1072: The grammar of S, like those of the languages P and T presented later, is
1073: described using the meta-language M, derived from the Backus-Naur Form
1074: (BNF).</P>
1075: <P>
1076: In this meta-language each rule of the grammar is composed of a grammar symbol
1077: followed by an equals sign (`=') and the right part of the rule. The equals
1078: sign plays the same role as the traditional `::=' of BNF: it indicates that
1079: the right part defines the symbol of the left part. In the right part,</P>
1080: <DL>
1081: <DT>concatenation</DT>
1082: <DD>is shown by the juxtaposition of symbols;
1083: </DD>
1084: <DT>character strings</DT>
1.2 cvs 1085: <DD>between apostrophes ' represent terminal symbols, that is, keywords in the
1086: language defined. Keywords are written here in upper-case letters, but can be
1087: written in any combination of upper and lower-case letters. For example, the
1088: keyword <TT>DEFPRES</TT> of S can also be written as <TT>defpres</TT> or
1089: <TT>DefPres</TT>.
1.1 cvs 1090: </DD>
1091: <DT>material between brackets</DT>
1092: <DD>(`[' and `]') is optional;
1093: </DD>
1094: <DT>material between angle brackets</DT>
1.2 cvs 1095: <DD>(`<' and `>') can be repeated many times or omitted;
1.1 cvs 1096: </DD>
1097: <DT>the slash</DT>
1.2 cvs 1098: <DD>(`/') indicates an alternative, a choice between the options separated by
1.1 cvs 1099: the slash character;
1100: </DD>
1101: <DT>the period</DT>
1102: <DD>marks the end of a rule;
1103: </DD>
1104: <DT>text between braces</DT>
1105: <DD>(`{' and `}') is simply a comment.
1106: </DD>
1107: </DL>
1108: <P>
1109: The M meta-language also uses the concepts of identifiers, strings, and
1110: integers:</P>
1111: <DL>
1112: <DT><TT>NAME</TT></DT>
1.2 cvs 1113: <DD>represents an identifier, a sequence of letters (upper or lower-case),
1114: digits, and underline characters (`_'), beginning with a letter. Also
1115: considered a letter is the sequence of characters `<TT>\nnn</TT>' where the
1.5 cvs 1116: letter <TT>n</TT> represents the ISO Latin-1 code of the letter in octal. It
1.2 cvs 1117: is thus possible to use accented letters in identifiers. The maximum length
1118: of identifiers is fixed by the compiler. It is normally 31 characters.
1.1 cvs 1119: <P>
1120: Unlike keywords, upper and lower-case letters are distinct in identifiers.
1121: Thus, <TT>Title</TT>, <TT>TITLE</TT>, and <TT>title</TT> are considered
1122: different identifiers.</P>
1123: </DD>
1124: <DT><TT>STRING</TT></DT>
1.2 cvs 1125: <DD>represents a string. This is a string of characters delimited by
1126: apostrophes. If an apostrophe must appear in a string, it is doubled. As
1127: with identifiers, strings can contain characters represented by their octal
1128: code (after a backslash). As with apostrophes, if a backslash must appear in
1129: a string, it is doubled.
1.1 cvs 1130: </DD>
1131: <DT><TT>NUMBER</TT></DT>
1.2 cvs 1132: <DD>represents a positive integer or zero (without a sign), or said another
1.1 cvs 1133: way, a sequence of decimal digits.
1134: </DD>
1135: </DL>
1136: <P>
1137: The M language can be used to define itself as follows:</P>
1138: <PRE>
1139: { Any text between braces is a comment. }
1140: Grammar = Rule < Rule > 'END' .
1141: { The < and > signs indicate zero }
1142: { or more repetitions. }
1143: { END marks the end of the grammar. }
1144: Rule = Ident '=' RightPart '.' .
1145: { The period indicates the end of a rule }
1146: RightPart = RtTerminal / RtIntermed .
1147: { The slash indicates a choice }
1148: RtTerminal ='NAME' / 'STRING' / 'NUMBER' .
1149: { Right part of a terminal rule }
1150: RtIntermed = Possibility < '/' Possibility > .
1151: { Right part of an intermediate rule }
1152: Possibility = ElemOpt < ElemOpt > .
1153: ElemOpt = Element / '[' Element < Element > ']' /
1154: '<' Element < Element > '>' .
1155: { Brackets delimit optional parts }
1156: Element = Ident / KeyWord .
1157: Ident = NAME .
1158: { Identifier, sequence of characters }
1159: KeyWord = STRING .
1160: { Character string delimited by apostrophes }
1161: END
1162: </PRE>
1163: </DIV>
1164:
1165: <DIV class="subsection">
1.6 cvs 1166: <H3><A name=sectc322>Extension schemas</A></H3>
1.1 cvs 1167:
1168: <P>
1169: A structure schema defines the generic logical structure of a class of
1170: documents or objects, independent of the operations which can be performed on
1171: the documents. However, certain applications may require particular
1172: information to be represented by the structure for the documents that they
1173: operate on. Thus a document version manager will need to indicate in the
1174: document the parts which belong to one version or another. An indexing system
1175: will add highly-structured index tables as well as the links between these
1176: tables and the rest of the document.</P>
1177: <P>
1.2 cvs 1178: Thus, many applications need to extend the generic structure of the documents
1179: on which they operate to introduce new attributes, associated elements or
1.1 cvs 1180: element types. These additions are specific to each application and must be
1181: able to be applied to any generic structure: users will want to manage
1182: versions or construct indices for many types of documents. Extension schemas
1183: fulfill this role: they define attributes, elements, associated elements,
1184: units, etc., but they can only be used jointly with a structure schema that
1185: they complete. Otherwise, structure schemas can always be used without these
1186: extensions when the corresponding applications are not available.</P>
1187: </DIV>
1188:
1189: <DIV class="subsection">
1.6 cvs 1190: <H3><A name=sectc323>The general organization of structure schemas</A></H3>
1.1 cvs 1191:
1192: <P>
1193: Every structure schema begins with the keyword <TT>STRUCTURE</TT> and ends
1194: with the keyword <TT>END</TT>. The keyword <TT>STRUCTURE</TT> is followed by
1195: the keyword <TT>EXTENSION</TT> in the case where the schema defines an
1196: extension, then by the name of the generic structure which the schema defines
1197: (the name of the document or object class). The name of the structure is
1198: followed by a semicolon.</P>
1199: <P>
1200: In the case of a complete schema (that is, a schema which is not an
1201: extension), the definition of the name of the structure is followed by the
1202: declarations of the default presentation schema, the global attributes, the
1203: parameters, the structure rules, the associated elements, the units, the
1204: skeleton elements and the exceptions. Only the definition of the structure
1205: rules is required. Each series of declarations begins with a keyword:
1206: <TT>DEFPRES</TT>, <TT>ATTR</TT>, <TT>PARAM</TT>, <TT>STRUCT</TT>,
1207: <TT>ASSOC</TT>, <TT>UNITS</TT>, <TT>EXPORT</TT>, <TT>EXCEPT</TT>.</P>
1208: <P>
1209: In the case of an extension schema, there are neither parameters nor skeleton
1210: elements and the <TT>STRUCT</TT> section is optional, while that section is
1211: required in a schema that is not an extension. On the other hand, extension
1212: schemas can contain an <TT>EXTENS</TT> section, which must not appear in a
1213: schema which is not an extension; this section defines the complements to
1214: attach to the rules found in the schema to which the extension will be added.
1215: The sections <TT>ATTR</TT>, <TT>STRUCT</TT>, <TT>ASSOC</TT>, and
1216: <TT>UNITS</TT> define new attributes, new elements, new associated elements,
1217: and new units which add their definitions to the principal schema.</P>
1218: <PRE>
1219: StructSchema ='STRUCTURE' ElemID ';'
1220: 'DEFPRES' PresID ';'
1221: [ 'ATTR' AttrSeq ]
1222: [ 'PARAM' RulesSeq ]
1223: 'STRUCT' RulesSeq
1224: [ 'ASSOC' RulesSeq ]
1225: [ 'UNITS' RulesSeq ]
1226: [ 'EXPORT' SkeletonSeq ]
1227: [ 'EXCEPT' ExceptSeq ]
1228: 'END' .
1229: ElemID = NAME .
1230: </PRE>
1231: <P>
1232: or</P>
1233: <PRE>
1234: ExtensSchema ='STRUCTURE' 'EXTENSION' ElemID ';'
1235: 'DEFPRES' PresID ';'
1236: [ 'ATTR' AttrSeq ]
1237: [ 'STRUCT' RulesSeq ]
1238: [ 'EXTENS' ExtensRuleSeq ]
1239: [ 'ASSOC' RulesSeq ]
1240: [ 'UNITS' RulesSeq ]
1241: [ 'EXCEPT' ExceptSeq ]
1242: 'END' .
1243: ElemID = NAME .
1244: </PRE>
1245: </DIV>
1246:
1247: <DIV class="subsection">
1.6 cvs 1248: <H3><A name=sectc324>The default presentation</A></H3>
1.1 cvs 1249:
1250: <P>
1251: It was shown <A href="#mulpres">above</A> that many different presentations
1252: are possible for documents and objects of the same class. The structure
1253: schema defines a preferred presentation for the class, called the <EM>default
1254: presentation</EM>. Like generic structures, presentations are described by
1255: programs, called <EM>presentation schemas</EM>, which are written in a
1.6 cvs 1256: specific language, P, presented <A href="#sectb42">later</A> in this document.
1.1 cvs 1257: The name appearing after the keyword <TT>DEFPRES</TT> is the name of the
1.2 cvs 1258: default presentation schema. When a new document is created, Thot will use
1259: this presentation schema by default, but the user remains free to choose
1.5 cvs 1260: another if s/he wishes.</P>
1.1 cvs 1261: <PRE>
1262: PresID = NAME .
1263: </PRE>
1264: </DIV>
1265:
1266: <DIV class="subsection">
1.6 cvs 1267: <H3><A name=sectc325>Global Attributes</A></H3>
1.1 cvs 1268:
1269: <P>
1270: If the generic structure includes global attributes of its own, they are
1271: declared after the keyword <TT>ATTR</TT>. Each global attribute is defined by
1272: its name, followed by an equals sign and the definition of its type. The
1273: declaration of a global attribute is terminated by a semi-colon.</P>
1274: <P>
1275: For attributes of the numeric, textual, or reference types, the type is
1276: indicated by a keyword, <TT>INTEGER</TT>, <TT>TEXT</TT>, or <TT>REFERENCE</TT>
1277: respectively.</P>
1278: <P>
1279: In the case of a reference attribute, the keyword <TT>REFERENCE</TT> is
1280: followed by the type of the referenced element in parentheses. It can refer
1281: to any type at all, specified by using the keyword <TT>ANY</TT>, or to a
1282: specific type. In the latter case, the element type designated by the
1.6 cvs 1283: reference can be defined either in the <A href="#sectc327"><TT>STRUCT</TT>
1.1 cvs 1284: section</A> of the same structure schema or in the <TT>STRUCT</TT> section of
1285: another structure schema. When the type is defined in another schema, the
1286: element type is followed by the name of the structure schema (within
1287: parentheses) in which it is defined. The name of the designated element type
1288: can be preceded by the keyword <TT>First</TT> or <TT>Second</TT>, but only in
1.6 cvs 1289: the case where the type is defined as <A href="#sectd3285">a pair</A>. These
1.1 cvs 1290: keywords indicate whether the attribute must designate the first mark of the
1291: pair or the second. If the reference refers to a pair and neither of these
1292: two keywords is present, then the first mark is used.</P>
1293: <P>
1294: In the case of an enumeration attribute, the equals sign is followed by the
1295: list of names representing the possible values of the attribute, the names
1296: being separated from each other by commas. An enumeration attribute has at
1297: least one possible value; the maximum number of values is defined by the
1298: compiler for the S language.</P>
1299: <PRE>
1300: AttrSeq = Attribute < Attribute > .
1301: Attribute = AttrID '=' AttrType ';' .
1302: AttrType = 'INTEGER' / 'TEXT' /
1303: 'REFERENCE' '(' RefType ')' /
1304: ValueSeq .
1305: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] .
1306: FirstSec = 'First' / 'Second' .
1307: ExtStruct = '(' ElemID ')' .
1308: ValueSeq = AttrVal < ',' AttrVal > .
1309: AttrID = NAME .
1310: AttrVal = NAME .
1311: </PRE>
1312: <P>
1313: There is a predefined global text attribute, the <EM>language</EM>, which is
1.2 cvs 1314: automatically added to every Thot structure schema. This attribute allows
1315: Thot to perform certain actions, such as hyphenation and spell-checking, which
1316: cannot be performed without knowing the language in which each part of the
1317: document is written. This attribute can be used just like any explicitly
1.1 cvs 1318: declared attribute: the system acts as if every structure schema contains</P>
1319: <PRE>
1320: ATTR
1321: Language = TEXT;
1322: </PRE>
1323: <BLOCKQUOTE class="example">
1324: <P>
1325: <STRONG>Example:</STRONG></P>
1326: <P>
1.2 cvs 1327: The following specification defines the global enumeration attribute
1328: WordType.</P>
1.1 cvs 1329: <PRE>
1330: ATTR
1.6 cvs 1331: WordType = Definition, IndexWord, DocumentTitle;
1.1 cvs 1332: </PRE>
1333: </BLOCKQUOTE>
1334: </DIV>
1335:
1336: <DIV class="subsection">
1.6 cvs 1337: <H3><A name=sectc326>Parameters</A></H3>
1.1 cvs 1338:
1339: <P>
1340: A parameter is a document element which can appear many times in the document,
1341: but always has the same value. This value can only be modified in a
1342: controlled way by certain applications. For example, in an advertising
1343: circular, the name of the recipient may appear in the address part and in the
1344: text of the circular. If the recipient's name were a parameter, it might only
1345: be able to be changed by a ``mail-merge'' application.</P>
1346: <P>
1347: Parameters are not needed for every document class, but if the schema includes
1348: parameters they are declared after the keyword <TT>PARAM</TT>. Each parameter
1.6 cvs 1349: declaration is made in the same way as a <A href="#sectc327">structure
1.1 cvs 1350: element declaration</A>.</P>
1351: <P>
1352: During editing, Thot permits the insertion of parameters wherever the
1353: structure schema allows; it also permits the removal of parameters which are
1354: already in the document but does not allow the modification of the parameter's
1.2 cvs 1355: content in any way. The content is generated automatically by Thot during the
1356: creation of the parameter, based on the value of the parameter in the
1357: document.</P>
1.1 cvs 1358: </DIV>
1359:
1360: <DIV class="subsection">
1.6 cvs 1361: <H3><A name=sectc327>Structured elements</A></H3>
1.1 cvs 1362:
1363: <P>
1364: The rules for defining structured elements are required, except in an
1365: extension schema: they constitute the core of a structure schema, since they
1366: define the structure of the different types of elements that occur in a
1367: document or object of the class defined by the schema.</P>
1368: <P>
1369: The first structure rule after the keyword <TT>STRUCT</TT> must define the
1370: structure of the class whose name appears in the first instruction
1371: (<TT>STRUCTURE</TT>) of the schema. This is the root rule of the schema,
1372: defining the root of the document tree or object tree.</P>
1373: <P>
1374: The remaining rules may be placed in any order, since the language permits the
1375: definition of element types before or after their use, or even in the same
1376: instruction in which they are used. This last case allows the definition of
1377: recursive structures.</P>
1378: <P>
1379: Each rule is composed of a name (the name of the element type whose structure
1380: is being defined) followed by an equals sign and a structure definition.</P>
1381: <P>
1382: If any local attributes are associated with the element type defined by the
1.2 cvs 1383: rule, they appear between parentheses after the type name and before the
1384: equals sign. The parentheses contain, first, the keyword <TT>ATTR</TT>, then
1385: the list of local attributes, separated by commas. Each local attribute is
1386: composed of the name of the attribute followed by an equals sign and the
1387: definition of the attribute's type, just as in the definition of <A
1.6 cvs 1388: href="#sectc325">global attributes</A>. The name of the attribute can be
1.2 cvs 1389: preceded by an exclamation point to indicate that the attribute must always be
1390: present for this element type. The same attribute, identified by its name,
1391: can be defined as a local attribute for multiple element types. In this
1392: case, the equals sign and definition of the attribute type need only appear in
1393: the first occurrence of the attribute. It should be noted that global
1394: attributes cannot also be defined as local attributes.</P>
1.1 cvs 1395: <P>
1.6 cvs 1396: If any <A href="#sectd3135">extensions</A> are defined for this
1.1 cvs 1397: element type, a plus sign follows the structure definition and the names of
1398: the extension element types appear between parentheses after the plus. If
1399: there are multiple extensions, they are separated by commas. These types can
1400: either be defined in the same schema, defined in other schemas, or they may be
1401: base types identified by the keywords <TT>TEXT</TT>, <TT>GRAPHICS</TT>,
1402: <TT>SYMBOL</TT>, or <TT>PICTURE</TT>.</P>
1403: <P>
1.6 cvs 1404: <A href="#sectd3135">Restrictions</A> are indicated in the same
1.1 cvs 1405: manner as extensions, but they are introduced by a minus sign and they come
1406: after the extensions, or if there are no extensions, after the structure
1407: definition.</P>
1408: <P>
1409: If the values of attributes must be attached systematically to this element
1410: type, they are introduced by the keyword <TT>WITH</TT> and declared in the
1411: form of a list of fixed-value attributes. When such definitions of fixed
1412: attribute values appear, they are always the last part of the rule.</P>
1413: <P>
1414: The rule is terminated by a semicolon.</P>
1415: <PRE>
1416: RuleSeq = Rule < Rule > .
1417: Rule = ElemID [ LocAttrSeq ] '=' DefWithAttr ';'.
1418: LocAttrSeq = '(' 'ATTR' LocAttr < ';' LocAttr > ')' .
1419: LocAttr = [ '!' ] AttrID [ '=' AttrType ] .
1420: DefWithAttr = Definition
1421: [ '+' '(' ExtensionSeq ')' ]
1422: [ '-' '(' RestrictSeq ')' ]
1423: [ 'WITH' FixedAttrSeq ] .
1424: ExtensionSeq = ExtensionElem < ',' ExtensionElem > .
1425: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' /
1426: 'SYMBOL' / 'PICTURE' .
1427: RestrictSeq = RestrictElem < ',' RestrictElem > .
1428: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' /
1429: 'SYMBOL' / 'PICTURE' .
1430: </PRE>
1431: <P>
1432: The list of fixed-value attributes is composed of a sequence of
1433: attribute-value pairs separated by commas. Each pair contains the name of the
1434: attribute and the fixed value for this element type, the two being separated
1435: by an equals sign. If the sign is preceded by a question mark the given value
1436: is only an initial value that may be modified later rather than a value fixed
1437: for all time. Reference attributes are an exception to this norm. They
1438: cannot be assigned a fixed value, but when the name of such an attribute
1439: appears this indicates that this element type must have a valid value for the
1.2 cvs 1440: attribute. For the other attribute types, the fixed value is indicated by a
1.1 cvs 1441: signed integer (numeric attributes), a character string between apostrophes
1442: (textual attributes) or the name of a value (enumeration attributes).</P>
1443: <P>
1.6 cvs 1444: Fixed-value attributes can either be <A href="#sectc325">global</A> or local
1.1 cvs 1445: to the element type for which they are fixed, but they must be declared before
1446: they are used.</P>
1447: <PRE>
1448: FixedAttrSeq = FixedAttr < ',' FixedAttr > .
1449: FixedAttr = AttrID [ FixedOrModifVal ] .
1450: FixedOrModifVal = [ '?' ] '=' FixedValue .
1451: FixedValue = [ '-' ] NumValue / TextVal / AttrVal .
1452: NumValue = NUMBER .
1453: TextVal = STRING .
1454: </PRE>
1455: </DIV>
1456:
1457: <DIV class="subsection">
1.6 cvs 1458: <H3><A name=sectc328>Structure definitions</A></H3>
1.1 cvs 1459:
1460: <P>
1461: The structure of an element type can be a simple base type or a constructed
1462: type.</P>
1463: <P>
1464: For constructed types, it is frequently the case that similar structures
1465: appear in many places in a document. For example the contents of the
1466: abstract, of the introduction, and of a section can have the same structure,
1467: that of a sequence of paragraphs. In this case, a single, common structure
1468: can be defined (the paragraph sequence in this example), and the schema is
1469: written to indicate that each element type possesses this structure, as
1470: follows:</P>
1471: <PRE>
1472: Abstract = Paragraph_sequence;
1473: Introduction = Paragraph_sequence;
1474: Section_contents = Paragraph_sequence;
1475: </PRE>
1476: <P>
1477: The equals sign means ``has the same structure as''.</P>
1478: <P>
1479: If the element type defined is a simple base type, this is indicated by one of
1480: the keywords <TT>TEXT</TT>, <TT>GRAPHICS</TT>, <TT>SYMBOL</TT>, or
1481: <TT>PICTURE</TT>. If some local attributes must be associated with a base
1482: type, the keyword of the base type is followed by the declaration of the local
1.6 cvs 1483: attributes using the syntax <A href="#sectc327">presented above.</A></P>
1.1 cvs 1484: <P>
1485: In the case of an open choice, the type is indicated by the keyword
1.2 cvs 1486: <TT>UNIT</TT> for units or the keyword <TT>NATURE</TT> for objects having a
1487: structure defined by any other schema.</P>
1.1 cvs 1488: <P>
1489: A unit represents one of the two following categories:</P>
1490: <UL>
1.2 cvs 1491: <LI>a base type: text, graphical element, symbol, picture,
1492: <LI>an element whose type is chosen from among the types defined as units in
1.5 cvs 1493: the <TT>UNITS</TT> section of the document's structure schema. It can also be
1.6 cvs 1494: chosen from among the types defined as <A href="#sectd3132">units</A> in
1495: the <A href="#sectc3212"><TT>UNITS</TT> section</A> of the structure schemas that
1.2 cvs 1496: defines the ancestors of the element to which the rule is applied.
1.1 cvs 1497: </UL>
1498: <P>
1.2 cvs 1499: Before the creation of an element defined as a unit, Thot asks the user to
1500: choose between the categories of elements.</P>
1.1 cvs 1501: <P>
1502: Thus, the contents of a paragraph can be specified as a sequence of units,
1503: which will permit the inclusion in the paragraphs of character strings,
1504: symbols, and various elements, such as cross-references, if these are defined
1505: as units.</P>
1506: <P>
1507: A schema object (keyword <TT>NATURE</TT>) represents an object defined by a
1508: structure schema freely chosen from among the available schemas; in the case
1509: the element type is defined by the first rule (the root rule) of the chosen
1510: schema.</P>
1511: <P>
1512: If the element type defined is a constructed type, the list, aggregate,
1513: choice, and reference constructors are used. In this case the definition
1514: begins with a keyword identifying the constructor. This keyword is followed
1515: by a syntax specific to each constructor.</P>
1516: <P>
1517: The local attribute definitions appear after the name of the element type
1.6 cvs 1518: being defined, if this element type has <A href="#sectc327">local
1.1 cvs 1519: attributes</A>.</P>
1520: <PRE>
1521: Definition = BaseType [ LocAttrSeq ] / Constr / Element .
1522: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 'PICTURE' /
1523: 'UNIT' / 'NATURE' .
1524: Element = ElemID [ ExtOrDef ] .
1525: ExtOrDef = 'EXTERN' / 'INCLUDED' /
1526: [ LocAttrSeq ] '=' Definition .
1527: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF'
1528: '(' DefWithAttr ')' /
1529: 'BEGIN' DefOptSeq 'END' /
1530: 'AGGREGATE' DefOptSeq 'END' /
1531: 'CASE' 'OF' DefSeq 'END' /
1532: 'REFERENCE' '(' RefType ')' /
1533: 'PAIR' .
1534: </PRE>
1535:
1536: <DIV class="subsubsection">
1.6 cvs 1537: <H4><A name=sectd3281>List</A></H4>
1.1 cvs 1538:
1539: <P>
1540: The list constructor permits the definition of an element type composed of a
1541: list of elements, all of the same type. A list definition begins with the
1542: <TT>LIST</TT> keyword followed by an optional range, the keyword <TT>OF</TT>,
1543: and the definition, between parentheses, of the element type which must
1544: compose the list. The optional range is composed of the minimum and maximum
1545: number of elements for the list separated by two periods and enclosed by
1546: brackets. If the range is not present, the number of list elements is
1547: unconstrained. When only one of the two bounds of the range is unconstrained,
1548: it is represented by a star ('*') character. Even when both bounds are
1549: unconstrained, they can be specified by <TT>[*..*]</TT>, but it is simpler not
1550: to specify any bound.</P>
1551: <PRE>
1552: 'LIST' [ '[' min '..' max ']' ]
1553: 'OF' '(' DefWithAttr ')'
1554: min = Integer / '*' .
1555: max = Integer / '*' .
1556: Integer = NUMBER .
1557: </PRE>
1558: <P>
1.2 cvs 1559: Before the document is edited, Thot creates the minimum number of elements for
1560: the list. If no minimum was given, it creates a single element. If a maximum
1561: number of elements is given and that number is attained, the editor refuses to
1562: create new elements for the list.</P>
1.1 cvs 1563: <BLOCKQUOTE class="example">
1564: <P>
1565: <STRONG>Example:</STRONG></P>
1566: <P>
1.3 cvs 1567: The following two instructions define the body of a document as a sequence of
1568: at least two chapters and the contents of a section as a sequence of
1569: paragraphs. A single paragraph can be the entire contents of a section.</P>
1.1 cvs 1570: <PRE>
1571: Body = LIST [2..*] OF (Chapter);
1572: Section_contents = LIST OF (Paragraph);
1573: </PRE>
1574: </BLOCKQUOTE>
1575: </DIV>
1576:
1577: <DIV class="subsubsection">
1.6 cvs 1578: <H4><A name=sectd3282>Aggregate</A></H4>
1.1 cvs 1579:
1580: <P>
1581: The aggregate constructor is used to define an element type as a collection of
1582: sub-elements, each having a fixed type. The collection may be ordered or
1583: unordered. The elements composing the collection are called
1584: <EM>components</EM>. In the definition of an aggregate, a keyword indicates
1585: whether or not the aggregate is ordered: <TT>BEGIN</TT> for an ordered
1586: aggregate, <TT>AGGREGATE</TT> for an unordered aggregate. This keyword is
1587: followed by the list of component type definitions which is terminated by the
1588: <TT>END</TT> keyword. The component type definitions are separated by
1589: commas.</P>
1590: <P>
1591: Before creating an aggregate, the Thot editor creates all the aggregate's
1592: components in the order they appear in the structure schema, even for
1593: unordered aggregates. However, unlike ordered aggregates, the components of
1594: an unordered aggregate may be rearranged using operations of the Thot editor.
1595: The exceptions to the rule are any components whose name was preceded by a
1596: question mark character ('?'). These components, which are optional, can be
1597: created by explicit request, possibly at the time the aggregate is created,
1598: but they are not created automatically <EM>prior</EM> to the creation of the
1599: aggregate.</P>
1600: <PRE>
1601: 'BEGIN' DefOptSeq 'END'
1602: DefOptSeq = DefOpt ';' < DefOpt ';' > .
1603: DefOpt = [ '?' ] DefWithAttr .
1604: </PRE>
1605: <BLOCKQUOTE class="example">
1606: <P>
1607: <STRONG>Example:</STRONG></P>
1608: <P>
1.3 cvs 1609: In a bilingual document, each paragraph has an English version and a French
1610: version. In certain cases, the translator wants to add a marginal note, but
1611: this note is present in very few paragraphs. Thus, it must not be created
1612: systematically for every paragraph. A bilingual paragraph of this type is
1.1 cvs 1613: declared:</P>
1614: <PRE>
1615: Bilingual_paragraph = BEGIN
1616: French_paragraph = TEXT;
1617: English_paragraph = TEXT;
1618: ? Note = TEXT;
1619: END;
1620: </PRE>
1621: </BLOCKQUOTE>
1622: </DIV>
1623:
1624: <DIV class="subsubsection">
1.6 cvs 1625: <H4><A name=sectd3283>Choice</A></H4>
1.1 cvs 1626:
1627: <P>
1628: The choice constructor permits the definition of an element type which is
1629: chosen from among a set of possible types. The keywords <TT>CASE</TT> and
1630: <TT>OF</TT> are followed by a list of definitions of possible types, which are
1631: separated by semicolons and terminated by the <TT>END</TT> keyword.</P>
1632: <PRE>
1633: 'CASE' 'OF' DefSeq 'END'
1634: DefSeq = DefWithAttr ';' < DefWithAttr ';' > .
1635: </PRE>
1636: <P>
1637: Before the creation of an element defined as a choice, the Thot editor
1638: presents the list of possible types for the element to the user. The user has
1.5 cvs 1639: only to select the element type that s/he wants to create from this list.</P>
1.1 cvs 1640: <P>
1641: The order of the type declarations is important. It determines the order of
1642: the list presented to the user before the creation of the element. Also, when
1643: a Choice element is being created automatically, the first type in the list is
1644: used. In fact, using the Thot editor, when an empty Choice element is
1645: selected, it is possible to select this element and to enter its text from
1646: keyboard. In this case, the editor uses the first element type which can
1647: contain an atom of the character string type.</P>
1648: <P>
1649: The two special cases of the choice constructor, the <A
1.6 cvs 1650: href="#sectc328"><EM>schema</EM></A> and the <A
1651: href="#sectc3212"><EM>unit</EM></A> are discussed elsewhere.</P>
1.1 cvs 1652: <BLOCKQUOTE class="example">
1653: <P>
1654: <STRONG>Example:</STRONG></P>
1655: <P>
1.3 cvs 1656: It is common in documents to treat a variety of objects as if they were
1657: ordinary paragraphs. Thus, a ``Paragraph'' might actually be composed of a
1658: block of text (an ordinary paragraph), or a mathematical formula whose
1659: structure is defined by another structure schema named Math, or a table, also
1660: defined by another structure schema. Here is a definition of such a
1.1 cvs 1661: paragraph:</P>
1662: <PRE>
1663: Paragraph = CASE OF
1664: Simple_text = TEXT;
1665: Formula = Math;
1666: Table_para = Table;
1667: END;
1668: </PRE>
1669: </BLOCKQUOTE>
1670: </DIV>
1671:
1672: <DIV class="subsubsection">
1.6 cvs 1673: <H4><A name=sectd3284>Reference</A></H4>
1.1 cvs 1674:
1675: <P>
1676: Like all elements in Thot, references are typed. An element type defined as a
1677: reference is a cross-reference to an element of some other given type. The
1678: keyword <TT>REFERENCE</TT> is followed by the name of a type enclosed in
1679: parentheses. When the type which is being cross-referenced is defined in
1680: another structure schema, the type name is itself followed by the name of the
1681: external structure schema in which it is defined.</P>
1682: <P>
1.6 cvs 1683: When the designated element type is a <A href="#sectd3285">mark pair</A>, it can
1.1 cvs 1684: be preceded by a <TT>FIRST</TT> or <TT>SECOND</TT> keyword. These keywords
1685: indicate whether the reference points to the first or second mark of the pair.
1686: If the reference points to a pair and neither of these two keywords is
1687: present, the reference is considered to point to the first mark of the
1688: pair.</P>
1689: <P>
1690: There is an exception to the principle of typed references: it is possible to
1691: define a reference which designates an element of any type, which can either
1692: be in the same document or another document. In this case, it suffices to put
1693: the keyword <TT>ANY</TT> in the parentheses which indicate the referenced
1694: element type.</P>
1695: <PRE>
1696: 'REFERENCE' '(' RefType ')'
1697: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] .
1698: </PRE>
1699: <P>
1700: When defining an inclusion, the <TT>REFERENCE</TT> keyword is not used.
1701: Inclusions with complete expansion are not declared as such in the structure
1702: schemas, since any element defined in a structure schema can be replaced by an
1703: element of the same type. Instead, inclusions without expansion or with
1704: partial expansion must be declared explicitly whenever they will include a
1705: complete object ( and not a part of an object). In this case, the object type
1706: to be included (that is, the name of its structure schema) is followed by a
1707: keyword: <TT>EXTERN</TT> for inclusion without expansion and <TT>INCLUDED</TT>
1708: for partial expansion.</P>
1709: <P>
1710: Before creating a cross-reference or an inclusion, the Thot editor asks the
1711: user to choose, from the document images displayed, the referenced or included
1712: element.</P>
1713: <BLOCKQUOTE class="example">
1714: <P>
1715: <STRONG>Example:</STRONG></P>
1716: <P>
1.3 cvs 1717: If the types Note and Section are defined in the Article structure schema, it
1718: is possible to define, in the same structure schema, a reference to a note and
1719: a reference to a section in this manner:</P>
1.1 cvs 1720: <PRE>
1721: Ref_note = REFERENCE (Note);
1722: Ref_section = REFERENCE (Section);
1723: </PRE>
1724: <P>
1725: It is also possible to define the generic structure of a collection of
1726: articles, which include (with partial expansion) objects of the Article class
1727: and which possess an introduction which may include cross-references to
1728: sections of the included articles. In the Collection structure schema, the
1729: definitions are:</P>
1730: <PRE>
1731: Collection = BEGIN
1.6 cvs 1732: Collection_title = TEXT;
1733: Introduction = LIST OF (Elem = CASE OF
1.1 cvs 1734: TEXT;
1735: Ref_sect;
1736: END);
1.6 cvs 1737: Body = LIST OF (Article INCLUDED);
1738: END;
1739: Ref_sect = REFERENCE (Section (Article));
1.1 cvs 1740: </PRE>
1741: <P>
1742: Here we define a Folder document class which has a title and includes
1743: documents of different types, particularly Folders:</P>
1744: <PRE>
1.6 cvs 1745: Folder = BEGIN
1746: Folder_title = TEXT;
1747: Folder_contents = LIST OF (Document);
1748: END;
1.1 cvs 1749:
1750: Document = CASE OF
1751: Article EXTERN;
1752: Collection EXTERN;
1753: Folder EXTERN;
1754: END;
1755: </PRE>
1756: <P>
1757: Under this definition, Folder represents either an aggregate which contains a
1758: folder title and the list of included documents or an included folder. To
1759: resolve this ambiguity, in the P language, the placement of a star character
1760: in front of the type name (here, Folder) indicates an included document.</P>
1761: </BLOCKQUOTE>
1762: </DIV>
1763:
1764: <DIV class="subsubsection">
1.6 cvs 1765: <H4><A name=sectd3285>Mark pairs</A></H4>
1.1 cvs 1766:
1767: <P>
1768: Like other elements, mark pairs are typed. The two marks of the pair have the
1769: same type, but there exist two predefined subtypes which apply to all mark
1770: pairs: the first mark of the pair (called <TT>First</TT> in the P and T
1771: languages) and the second mark (called <TT>Second</TT>).</P>
1772: <P>
1773: In the S language, a mark pair is noted simply by the <TT>PAIR</TT>
1774: keyword.</P>
1775: <P>
1776: In the Thot editor, marks are always moved or destroyed together. The two
1777: marks of a pair have the same identifier, unique within the document, which
1778: permits intertwining mark pairs without risk of ambiguity.</P>
1779: </DIV>
1780: </DIV>
1781:
1782: <DIV class="subsection">
1.6 cvs 1783: <H3><A name=sectc329>Imports</A></H3>
1.1 cvs 1784:
1785: <P>
1786: Because of schema constructors, it is possible, before editing a document, to
1787: use classes defined by other structure schemas whenever they are needed. It is
1788: also possible to assign specific document classes to certain element types. In
1789: this case, these classes are simply designated by their name. In fact, if a
1790: type name is not defined in the structure schema, it is assumed that it
1791: specifies a structure defined by another structure schema.</P>
1792: <BLOCKQUOTE class="example">
1793: <P>
1794: <STRONG>Example:</STRONG></P>
1795: <P>
1.3 cvs 1796: If the types Math and Table don't appear in the left part of a structure rule
1797: in the schema, the following two rules indicate that a formula has the
1798: structure of an object defined by the structure schema Math and that a table
1799: element has the structure of an object defined by the Table schema.</P>
1.1 cvs 1800: <PRE>
1.6 cvs 1801: Formula = Math;
1.1 cvs 1802: Table_elem = Table;
1803: </PRE>
1804: </BLOCKQUOTE>
1805: </DIV>
1806:
1807: <DIV class="subsection">
1.6 cvs 1808: <H3><A name=sectc3210>Extension rules</A></H3>
1.1 cvs 1809:
1810: <P>
1811: The <TT>EXTENS</TT> section, which can only appear in an extension schema,
1812: defines complements to the rules in the primary schema (i.e. the structure
1813: schema to which the extension schema will be applied). More precisely, this
1814: section permits the addition to an existing type of local attributes,
1815: extensions, restrictions and fixed-value attributes.</P>
1816: <P>
1817: These additions can be applied to the root rule of the primary schema,
1818: designated by the keyword <TT>Root</TT>, or to any other explicitly named
1819: rule.</P>
1820: <P>
1821: Extension rules are separated from each other by a semicolon and each
1.6 cvs 1822: extension rule has the same syntax as a <A href="#sectc327">structure
1.1 cvs 1823: rule</A>, but the part which defines the constructor is absent.</P>
1824: <PRE>
1825: ExtenRuleSeq = ExtensRule ';' < ExtensRule ';' > .
1.6 cvs 1826: ExtensRule = RootOrElem [ LocAttrSeq ]
1827: [ '+' '(' ExtensionSeq ')' ]
1828: [ '-' '(' RestrictSeq ')' ]
1829: [ 'WITH' FixedAttrSeq ] .
1830: RootOrElem = 'Root' / ElemID .
1.1 cvs 1831: </PRE>
1832: </DIV>
1833:
1834: <DIV class="subsection">
1.6 cvs 1835: <H3><A name=sectc3211>Associated elements</A></H3>
1.1 cvs 1836:
1837: <P>
1838: If associated elements are necessary, they must be declared in a specific
1839: section of the structure schema, introduced by the keyword <TT>ASSOC</TT>.
1840: Each associated element type is specified like any other structured element.
1841: However, these types must not appear in any other element types of the schema,
1842: except in <TT>REFERENCE</TT> rules.</P>
1843: </DIV>
1844:
1845: <DIV class="subsection">
1.6 cvs 1846: <H3><A name=sectc3212>Units</A></H3>
1.1 cvs 1847:
1848: <P>
1849: The <TT>UNITS</TT> section of the structure schema contains the declarations
1850: of the element types which can be used in the external objects making up parts
1851: of the document or in objects of the class defined by the schema. As with
1852: associated elements, these element types are defined just like other
1853: structured element types. They can be used in the other element types of the
1854: schema, but they can also be used in any other rule of the schema.</P>
1855: <BLOCKQUOTE class="example">
1856: <P>
1857: <STRONG>Example:</STRONG></P>
1858: <P>
1859: If references to notes are declared as units:</P>
1860: <PRE>
1861: UNITS
1862: Ref_note = REFERENCE (Note);
1863: </PRE>
1864: <P>
1.3 cvs 1865: then it is possible to use references to notes in a cell of a table, even when
1.5 cvs 1866: <TT>Table</TT> is an external structure schema. The <TT>Table</TT> schema must
1.1 cvs 1867: declare a cell to be a sequence of units, which can then be base element types
1.6 cvs 1868: (text, for example) or references to notes in the document.</P>
1869: <PRE>
1.1 cvs 1870: Cell = LIST OF (UNITS);
1871: </PRE>
1872: </BLOCKQUOTE>
1873: </DIV>
1874:
1875: <DIV class="subsection">
1.6 cvs 1876: <H3><A name=sectc3213>Skeleton elements</A></H3>
1.1 cvs 1877:
1878: <P>
1879: When editing a document which contains or must contain external references to
1880: several other documents, it may be necessary to load a large number of
1881: documents, simply to see the parts designated by the external references of
1882: the document while editing, or to access the source of included elements. In
1883: this case, the external documents are not modified and it is only necessary to
1884: see the elements of these documents which could be referenced. Because of
1885: this, the editor will suggest that the documents be loaded in ``skeleton''
1886: form. This form contains only the elements of the document explicitly
1887: mentioned in the <TT>EXPORT</TT> section of their structure schema and, for
1888: these elements, only the part of the contents specified in that section. This
1889: form has the advantage of being very compact, thus requiring very few
1890: resources from the editor. This is also the skeleton form which constitutes
1891: the expanded form of <A href="#inclusion">inclusions</A> with partial
1892: expansion.</P>
1893: <P>
1894: Skeleton elements must be declared explicitly in the <TT>EXPORT</TT> section
1895: of the structure schema that defines them. This section begins with the
1896: keyword <TT>EXPORT</TT> followed by a comma-separated list of the element
1897: types which must appear in the skeleton form and ending with a semicolon.
1898: These types must have been previously declared in the schema.</P>
1899: <P>
1900: For each skeleton element type, the part of the contents which is loaded by
1901: the editor, and therefore displayable, can be specified by putting the keyword
1902: <TT>WITH</TT> and the name of the contained element type to be loaded after
1903: the name of the skeleton element type. In this case only that named element,
1904: among all the elements contained in the exportable element type, will be
1905: loaded. If the <TT>WITH</TT> is absent, the entire contents of the skeleton
1906: element will be loaded by the editor. If instead, it is better that the
1907: skeleton form not load the contents of a particular element type, the keyword
1908: <TT>WITH</TT> must be followed by the word <TT>Nothing</TT>.</P>
1909: <PRE>
1910: [ 'EXPORT' SkeletonSeq ]
1911:
1912: SkeletonSeq = SkelElem < ',' SkelElem > ';' .
1913: SkelElem = ElemID [ 'WITH' Contents ] .
1914: Contents = 'Nothing' / ElemID [ ExtStruct ] .
1915: </PRE>
1916: <BLOCKQUOTE class="example">
1917: <P>
1918: <STRONG>Example:</STRONG></P>
1919: <P>
1.3 cvs 1920: Suppose that, in documents of the article class, the element types
1921: Article_title, Figure, Section, Paragraph, and Biblio should appear in the
1922: skeleton form in order to make it easier to create external references to them
1923: from other documents. When loading an article in its skeleton form, all of
1924: these element types will be loaded except for paragraphs, but only the article
1.5 cvs 1925: title will be loaded in its entirety. For figures, the caption will be loaded,
1.3 cvs 1926: while for sections, the title will be loaded, and for bibliographic entries,
1927: only the title that they contain will be loaded. Note that
1928: bibliographic elements are defined in another structure schema, RefBib. To
1929: produce this result, the following declarations should be placed in the
1930: Article structure schema:</P>
1.1 cvs 1931: <PRE>
1932: EXPORT
1933: Article_title,
1.5 cvs 1934: Figure With Caption,
1.1 cvs 1935: Section With Section_title,
1936: Paragraph With Nothing,
1937: Biblio With Biblio_title(RefBib);
1938: </PRE>
1939: </BLOCKQUOTE>
1940: </DIV>
1941:
1942: <DIV class="subsection">
1.6 cvs 1943: <H3><A name=sectc3214>Exceptions</A></H3>
1.1 cvs 1944:
1945: <P>
1946: The behavior of the Thot editor and the actions that it performs are
1947: determined by the structure schemas. These actions are applied to all
1948: document and object types in accordance with their generic structure. For
1949: certain object types, such as tables and graphics, these actions are not
1950: sufficient or are poorly adapted and some special actions must be added to or
1951: substituted for certain standard actions. These special actions are called
1952: <EM>exceptions</EM>.</P>
1953: <P>
1954: Exceptions only inhibit or modify certain standard actions, but they can be
1955: used freely in every structure schema.</P>
1956: <P>
1957: Each structure schema can contain a section defining exceptions. It begins
1958: with the keyword <TT>EXCEPT</TT> and is composed of a sequence of exception
1959: declarations, separated by semicolons. Each declaration of an exception
1960: begins with the name of an element type or attribute followed by a colon. This
1961: indicates the element type or attribute to which the following exceptions
1.6 cvs 1962: apply. When the given element type name is a <A href="#sectd3285">mark pair</A>,
1.1 cvs 1963: and only in this case, the type name can be preceded by the keyword
1964: <TT>First</TT> or <TT>Second</TT>, to indicate if the exceptions which follow
1965: are associated with the first mark of the pair or the second. In the absence
1966: of this keyword, the first mark is used.</P>
1967: <P>
1.6 cvs 1968: When placed in an <A href="#sectc322">extension schema</A>, the keyword
1.1 cvs 1969: <TT>EXTERN</TT> indicates that the type name which follows is found in the
1970: principal schema (the schema being extended by the extension schema). The
1971: exceptions are indicated by a name. They are separated by semicolons.</P>
1972: <PRE>
1973: [ 'EXCEPT' ExceptSeq ]
1974:
1975: ExceptSeq = Except ';' < Except ';' > .
1976: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr
1977: ':' ExcValSeq .
1978: ExcTypeOrAttr = ElemID / AttrID .
1979: ExcValSeq = ExcValue < ',' ExcValue > .
1980: ExcValue ='NoCut' / 'NoCreate' /
1981: 'NoHMove' / 'NoVMove' / 'NoMove' /
1982: 'NoHResize' / 'NoVResize' / 'NoResize' /
1.13 ! cvs 1983: 'MoveResize' /
1.1 cvs 1984: 'NewWidth' / 'NewHeight' /
1985: 'NewHPos' / 'NewVPos' /
1986: 'Invisible' / 'NoSelect' /
1987: 'Hidden' / 'ActiveRef' /
1988: 'ImportLine' / 'ImportParagraph' /
1989: 'NoPaginate' / 'ParagraphBreak' /
1.9 cvs 1990: 'HighlightChildren' / 'ExtendedSelection' /
1991: 'ReturnCreateNL' .
1.1 cvs 1992: </PRE>
1993: <P>
1994: The following are the available exceptions:</P>
1995: <DL>
1996: <DT><TT>NoCut</TT></DT>
1.2 cvs 1997: <DD>This exception can only be applied to element types. Elements of a type to
1.13 ! cvs 1998: which this exception is applied cannot be deleted by the editor.
1.1 cvs 1999: </DD>
2000: <DT><TT>NoCreate</TT></DT>
1.2 cvs 2001: <DD>This exception can only be applied to element types. Elements of a type to
2002: which this exception is applied cannot be created by ordinary commands for
2003: creating new elements. These elements are usually created by special actions
1.13 ! cvs 2004: associated with other exceptions.
1.1 cvs 2005: </DD>
2006: <DT><TT>NoHMove</TT></DT>
1.2 cvs 2007: <DD>This exception can only be applied to element types. Elements of a type to
1.13 ! cvs 2008: which this exception is applied cannot be moved horizontally with the
! 2009: mouse. Their children elements cannot be moved either.
1.1 cvs 2010: </DD>
2011: <DT><TT>NoVMove</TT></DT>
1.2 cvs 2012: <DD>This exception can only be applied to element types. Elements of a type to
1.13 ! cvs 2013: which this exception is applied cannot be moved vertically with the
! 2014: mouse. Their children elements cannot be moved either.
1.1 cvs 2015: </DD>
2016: <DT><TT>NoMove</TT></DT>
1.2 cvs 2017: <DD>This exception can only be applied to element types. Elements of a type to
2018: which this exception is applied cannot be moved in any direction with the
1.13 ! cvs 2019: mouse. Their children elements cannot be moved either.
1.1 cvs 2020: </DD>
2021: <DT><TT>NoHResize</TT></DT>
1.2 cvs 2022: <DD>This exception can only be applied to element types. Elements of a type to
1.13 ! cvs 2023: which this exception is applied cannot be resized horizontally with the
! 2024: mouse. Their children elements cannot be resized either.
1.1 cvs 2025: </DD>
2026: <DT><TT>NoVResize</TT></DT>
1.2 cvs 2027: <DD>This exception can only be applied to element types. Elements of a type to
1.13 ! cvs 2028: which this exception is applied cannot be resized vertically with the
! 2029: mouse. Their children elements cannot be resized either.
1.1 cvs 2030: </DD>
2031: <DT><TT>NoResize</TT></DT>
1.2 cvs 2032: <DD>This exception can only be applied to element types. Elements of a type to
2033: which this exception is applied cannot be resized in any direction with the
1.13 ! cvs 2034: mouse. Their children elements cannot be resized either.
! 2035: </DD>
! 2036: <DT><TT>MoveResize</TT></DT>
! 2037: <DD>This exception can only be applied to element types. Elements of a type to
! 2038: which this exception is applied can be moved and resized in any direction
! 2039: with the mouse, even if one of their ancestor element has an exception that
! 2040: prevents moving or resizing. Their children elements can also be resized or
! 2041: moved.
1.1 cvs 2042: </DD>
2043: <DT><TT>NoSelect</TT></DT>
1.2 cvs 2044: <DD>This exception can only be applied to element types. Elements of a type to
2045: which this exception is applied cannot be selected directly with the mouse, but
2046: they can be selected by other methods provided by the editor.
1.1 cvs 2047: </DD>
2048: <DT><TT>NewWidth</TT></DT>
1.2 cvs 2049: <DD>This exception can only be applied to numeric attributes. If the width of
2050: an element which has this attribute is modified with the mouse, the value of
2051: the new width will be assigned to the attribute.
1.1 cvs 2052: </DD>
2053: <DT><TT>NewHeight</TT></DT>
1.2 cvs 2054: <DD>This exception can only be applied to numeric attributes. If the height of
2055: an element which has this attribute is modified with the mouse, the value of
2056: the new height will be assigned to the attribute.
1.1 cvs 2057: </DD>
2058: <DT><TT>NewHPos</TT></DT>
1.2 cvs 2059: <DD>This exception can only be applied to numeric attributes. If the
2060: horizontal position of an element which has this attribute is modified with the
2061: mouse, the value of the new horizontal position will be assigned to the
1.1 cvs 2062: attribute.
2063: </DD>
2064: <DT><TT>NewVPos</TT></DT>
1.2 cvs 2065: <DD>This exception can only be applied to numeric attributes. If the vertical
2066: position of an element which has this attribute is modified with the mouse, the
2067: value of the new vertical position will be assigned to the attribute.
1.1 cvs 2068: </DD>
2069: <DT><TT>Invisible</TT></DT>
1.2 cvs 2070: <DD>This exception can only be applied to attributes, but can be applied to all
2071: attribute types. It indicates that the attribute must not be seen by the user
2072: and that its value must not be changed directly. This exception is usually
1.5 cvs 2073: used when another exception manipulates the value of an attribute.
1.1 cvs 2074: </DD>
2075: <DT><TT>Hidden</TT></DT>
1.2 cvs 2076: <DD>This exception can only be applied to element types. It indicates that
2077: elements of this type, although present in the document's structure, must not
2078: be shown to the user of the editor. In particular, the creation menus must not
2079: propose this type and the selection message must not pick it.
1.1 cvs 2080: </DD>
2081: <DT><TT>ActiveRef</TT></DT>
1.2 cvs 2082: <DD>This exception can only be applied to attributes of the reference type. It
2083: indicates that when the user of the editor makes a double click on an element
2084: which possesses a reference attribute having this exception, the element
2085: designated by the reference attribute will be selected.
1.1 cvs 2086: </DD>
2087: <DT><TT>ImportLine</TT></DT>
1.2 cvs 2088: <DD>This exception can only be applied to element types. It indicates that
2089: elements of this type should receive the content of imported text files. An
2090: element is created for each line of the imported file. A structure schema
2091: cannot contain several exceptions <TT>ImportLine</TT> and, if it contains one,
2092: it should not contain any exception <TT>ImportParagraph</TT>.
1.1 cvs 2093: </DD>
2094: <DT><TT>ImportParagraph</TT></DT>
1.2 cvs 2095: <DD>This exception can only be applied to element types. It indicates that
2096: elements of this type should receive the content of imported text files. An
2097: element is created for each paragraph of the imported file. A paragraph is a
2098: sequence of lines without any empty line. A structure schema cannot contain
2099: several exceptions <TT>ImportParagraph</TT> and, if it contains one, it should
2100: not contain any exception <TT>ImportLine</TT>.
1.1 cvs 2101: </DD>
2102: <DT><TT>NoPaginate</TT></DT>
1.2 cvs 2103: <DD>This exception can only be applied to the root element, i.e. the name that
2104: appear after the keyword <TT>STRUCTURE</TT> at the beginning of the structure
2105: schema. It indicates that the editor should not allow the user to paginate
1.1 cvs 2106: documents of that type.
2107: </DD>
2108: <DT><TT>ParagraphBreak</TT></DT>
1.2 cvs 2109: <DD>This exception can only be applied to element types. When the caret is
2110: within an element of a type to which this exception is applied, it is that
2111: element that will be split when the user hits the Return key.
1.1 cvs 2112: </DD>
1.9 cvs 2113: <DT><TT>ReturnCreateNL</TT></DT>
2114: <DD>This exception can only be applied to element types. When the caret is
2115: within an element of a type to which this exception is applied, the Return
2116: key simply inserts a New line character (code \212) at the current position.
2117: The Return key does not create a new element; it does not split the current
2118: element either.
2119: </DD>
1.1 cvs 2120: <DT><TT>HighlightChildren</TT></DT>
1.2 cvs 2121: <DD>This exception can only be applied to element types. Elements of a type to
2122: which this exception is applied are not highlighted themselves when they are
2123: selected, but all their children are highlighted instead.
1.1 cvs 2124: </DD>
2125: <DT><TT>ExtendedSelection</TT></DT>
1.2 cvs 2126: <DD>This exception can only be applied to element types. The selection
2127: extension command (middle button of the mouse) only add the clicked element (if
2128: it has that exception) to the current selection, without selecting other
2129: elements between the current selection and the clicked element.
1.1 cvs 2130: </DD>
2131: </DL>
2132: <BLOCKQUOTE class="example">
2133: <P>
2134: <STRONG>Example:</STRONG></P>
2135: <P>
1.3 cvs 2136: Consider a structure schema for object-style graphics which defines the
1.1 cvs 2137: Graphic_object element type with the associated Height and Weight
1.3 cvs 2138: numeric attributes. Suppose that we want documents of this class to have
2139: the following qualities:</P>
1.1 cvs 2140: <UL>
1.2 cvs 2141: <LI>Whenever the width or height of an object is changed using the mouse, the
2142: new values are stored in the object's Width and Height attributes.
2143: <LI>The user should not be able to change the values of the Width and Height
1.5 cvs 2144: attributes via the Attributes menu of the Thot editor.
1.1 cvs 2145: </UL>
2146: <P>
2147: The following exceptions will produce this effect.</P>
2148: <PRE>
2149: STRUCT
2150: ...
1.5 cvs 2151: Graphics_object (ATTR Height = Integer; Width = Integer)
1.1 cvs 2152: = GRAPHICS with Height ?= 10, Width ?= 10;
2153: ...
2154: EXCEPT
2155: Height: NewHeight, Invisible;
2156: Width: NewWidth, Invisible;
2157: </PRE>
2158: </BLOCKQUOTE>
2159: </DIV>
2160: </DIV>
2161:
2162: <DIV class="section">
1.6 cvs 2163: <H2><A name=sectb33>Some examples</A></H2>
1.1 cvs 2164:
2165: <P>
2166: In order to illustrate the principles of the document model and the syntax of
2167: the S language, this section presents two examples of structure schemas. One
2168: defines a class of documents, the other defines a class of objects.</P>
2169:
2170: <DIV class="subsection">
1.6 cvs 2171: <H3><A name=sectc331>A class of documents: articles</A></H3>
1.1 cvs 2172:
2173: <P>
2174: This example shows a possible structure for articles published in a journal.
2175: Text between braces is comments.</P>
2176: <PRE>
2177: STRUCTURE Article; { This schema defines the Article class }
2178: DEFPRES ArticleP; { The default presentation schema is
2179: ArticleP }
2180: ATTR { Global attribute definitions }
2181: WordType = Definition, IndexWord, DocumentTitle;
2182: { A single global attribute is defined, with three values }
2183: STRUCT { Definition of the generic structure }
2184: Article = BEGIN { The Article class has an aggregate
2185: structure }
2186: Title = BEGIN { The title is an aggregate }
2187: French_title =
2188: Text WITH Language='Fran\347ais';
2189: English_title =
2190: Text WITH Language='English';
2191: END;
2192: Authors =
2193: LIST OF (Author
2194: (ATTR Author_type=principal,secondary)
2195: { The Author type has a local attribute }
2196: = BEGIN
2197: Author_name = Text;
2198: Info = Paragraphs ;
2199: { Paragraphs is defined later }
2200: Address = Text;
2201: END
2202: );
2203: Keywords = Text;
2204: { The journal's editor introduces the article
2205: with a short introduction, in French and
2206: in English }
2207: Introduction =
2208: BEGIN
2209: French_intr = Paragraphs WITH
2210: Language='Fran\347ais';
2211: English_intr = Paragraphs WITH
2212: Language='English';
2213: END;
2214: Body = Sections; { Sections are defined later }
2215: { Appendixes are only created on demand }
2216: ? Appendices =
2217: LIST OF (Appendix =
2218: BEGIN
2219: Appendix_Title = Text;
2220: Appendix_Contents = Paragraphs;
2221: END
2222: );
2223: END; { End of the Article aggregate }
2224:
2225: Sections = LIST [2..*] OF (
2226: Section = { At least 2 sections }
2227: BEGIN
2228: Section_title = Text;
2229: Section_contents =
2230: BEGIN
2231: Paragraphs;
2232: Sections; { Sections at a lower level }
2233: END;
2234: END
2235: );
2236:
2237: Paragraphs = LIST OF (Paragraph = CASE OF
2238: Enumeration =
2239: LIST [2..*] OF
2240: (Item = Paragraphs);
2241: Isolated_formula = Formula;
2242: LIST OF (UNIT);
2243: END
2244: );
2245:
2246: ASSOC { Associated elements definitions }
2247:
2248: Figure = BEGIN
1.5 cvs 2249: Figure_caption = Text;
1.1 cvs 2250: Illustration = NATURE;
2251: END;
2252:
2253: Biblio_citation = CASE OF
2254: Ref_Article =
2255: BEGIN
2256: Authors_Bib = Text;
2257: Article_Title = Text;
2258: Journal = Text;
2259: Page_Numbers = Text;
2260: Date = Text;
2261: END;
2262: Ref_Livre =
2263: BEGIN
2264: Authors_Bib; { Defined above }
2265: Book_Title = Text;
2266: Editor = Text;
2267: Date; { Defined above }
2268: END;
2269: END;
2270:
2271: Note = Paragraphs - (Ref_note);
2272:
2273: UNITS { Elements which can be used in objects }
2274:
2275: Ref_note = REFERENCE (Note);
2276: Ref_biblio = REFERENCE (Biblio_citation);
2277: Ref_figure = REFERENCE (Figure);
2278: Ref_formula = REFERENCE (Isolated_formula);
2279:
2280: EXPORT { Skeleton elements }
2281:
2282: Title,
1.5 cvs 2283: Figure with Figure_caption,
1.1 cvs 2284: Section With Section_title;
2285:
2286: END { End of the structure schema }
2287: </PRE>
2288: <P>
2289: This schema is very complete since it defines both paragraphs and
2290: bibliographic citations. These element types could just as well be defined in
2291: other structure schemas, as is the case with the <TT>Formula</TT> class. All
2292: sorts of other elements can be inserted into an article, since a paragraph can
2293: contain any type of unit. Similarly, figures can be any class of document or
2294: object that the user chooses.</P>
2295: <P>
2296: Generally, an article doesn't contain appendices, but it is possible to add
2297: them on explicit request: this is the effect of the question mark before the
2298: word Appendices.</P>
2299: <P>
2300: The Figure, Biblio_citation and Note elements are associated elements. Thus,
2301: they are only used in <TT>REFERENCE</TT> statements.</P>
2302: <P>
2303: Various types of cross-references can be put in paragraphs. They can also be
2304: placed the objects which are part of the article, since the cross-references
2305: are defined as units (<TT>UNITS</TT>).</P>
2306: <P>
2307: There is a single restriction to prevent the creation of Ref_note elements
2308: within notes.</P>
2309: <P>
2310: It is worth noting that the S language permits the definition of recursive
2311: structures like sections: a section can contain other sections (which are thus
2312: at the next lower level of the document tree). Paragraphs are also recursive
2313: elements, since a paragraph can contain an enumeration in which each element
2314: (<TT>Item</TT>) is composed of paragraphs.</P>
2315: </DIV>
2316:
2317: <DIV class="subsection">
1.6 cvs 2318: <H3><A name=sectc332>A class of objects: mathematical formulas</A></H3>
1.1 cvs 2319:
2320: <P>
2321: The example below defines the <TT>Formula</TT> class which is used in Article
2322: documents. This class represents mathematical formulas with a rather simple
2323: structure, but sufficient to produce a correct rendition on the screen or
2324: printer. To support more elaborate operations (formal or numeric
2325: calculations), a finer structure should be defined. This class doesn't use any
2326: other class and doesn't define any associated elements or units.</P>
2327: <PRE>
2328: STRUCTURE Formula;
2329: DEFPRES FormulaP;
2330:
2331: ATTR
2332: String_type = Function_name, Variable_name;
2333:
2334: STRUCT
2335: Formula = Expression;
2336: Expression = LIST OF (Construction);
2337: Construction = CASE OF
2338: TEXT; { Simple character string }
2339: Index = Expression;
2340: Exponent = Expression;
2341: Fraction =
2342: BEGIN
1.6 cvs 2343: Numerator = Expression;
1.1 cvs 2344: Denominator = Expression;
2345: END;
2346: Root =
2347: BEGIN
2348: ? Order = TEXT;
2349: Root_Contents = Expression;
2350: END;
2351: Integral =
2352: BEGIN
2353: Integration_Symbol = SYMBOL;
2354: Lower_Bound = Expression;
2355: Upper_Bound = Expression;
2356: END;
2357: Triple =
2358: BEGIN
2359: Princ_Expression = Expression;
2360: Lower_Expression = Expression;
2361: Upper_Expression = Expression;
2362: END;
2363: Column = LIST [2..*] OF
2364: (Element = Expression);
2365: Parentheses_Block =
2366: BEGIN
2367: Opening = SYMBOL;
2368: Contents = Expression;
2369: Closing = SYMBOL;
2370: END;
2371: END; { End of Choice Constructor }
2372: END { End of Structure Schema }
2373: </PRE>
2374: <P>
2375: This schema defines a single global attribute which allows functions and
2376: variables to be distinguished. In the presentation schema, this attribute can
2377: be used to choose between roman (for functions) and italic characters (for
2378: variables).</P>
2379: <P>
2380: A formula's structure is that of a mathematical expression, which is itself a
2381: sequence of mathematical constructions. A mathematical construction can be
2382: either a simple character string, an index, an exponent, a fraction, a root,
2383: etc. Each of these mathematical constructions has a sensible structure which
2384: generally includes one or more expressions, thus making the formula class's
2385: structure definition recursive.</P>
2386: <P>
2387: In most cases, the roots which appear in the formulas are square roots and
2388: their order (2) is not specified. This is why the Order component is marked
2389: optional by a question mark. When explicitly requested, it is possible to add
2390: an order to a root, for example for cube roots (order = 3).</P>
2391: <P>
2392: An integral is formed by an integration symbol, chosen by the user (simple
2393: integral, double, curvilinear, etc.), and two bounds. A more fine-grained
2394: schema would add components for the integrand and the integration variable.
2395: Similarly, the Block_Parentheses construction leaves the choice of opening and
2396: closing symbols to the user. They can be brackets, braces, parentheses,
2397: etc.</P>
2398: </DIV>
2399: </DIV>
2400: <HR>
2401: </DIV>
2402:
2403: <DIV class="chapter">
1.6 cvs 2404: <H1><A name=sect4>The P Language</A></H1>
1.1 cvs 2405:
2406:
2407: <DIV class="section">
1.6 cvs 2408: <H2><A name=sectb41>Document presentation</A></H2>
1.1 cvs 2409:
2410: <P>
2411: Because of the model adopted for Thot, the presentation of documents is
2412: clearly separated from their structure and content. After having presented
2413: the logical structure of documents, we now detail the principles implemented
2414: for their presentation. The concept of <EM>presentation</EM> encompasses what
1.5 cvs 2415: is often called the page layout, the composition, or the document style. It
2416: is the set of operations which display the document on the screen or print
2417: it on paper. Like logical structure, document presentation is defined
2418: generically with the help of a language, called P.</P>
1.1 cvs 2419:
2420: <DIV class="subsection">
1.6 cvs 2421: <H3><A name=sectc411>Two levels of presentation</A></H3>
1.1 cvs 2422:
2423: <P>
2424: The link between structure and presentation is clear: the logical organization
2425: of a document is used to carry out its presentation, since the purpose of the
2426: presentation is to make evident the organization of the document. But the
2427: presentation is equally dependent on the device used to render the document.
2428: Certain presentation effects, notably changes of font or character set, cannot
2429: be performed on all printers or on all screens. This is why Thot uses a
2430: two-level approach, where the presentation is first described in abstract
2431: terms, without taking into account each particular device, and then the
2432: presentation is realized within the constraints of a given device.</P>
2433: <P>
2434: Thus, presentation is only described as a function of the structure of the
2435: documents and the image that would be produced on an idealized device. For
2436: this reason, presentation descriptions do not refer to any device
2437: characteristics: they describe <EM>abstract presentations</EM> which can be
2438: concretized on different devices.</P>
2439: <P>
2440: A presentation description also defines a <EM>generic presentation</EM>, since
2441: it describes the appearance of a class of documents or objects. This generic
2442: presentation must also be applied to document and object instances, each
2443: conforming to its generic logical structure, but with all the allowances that
2444: were called to mind above: missing elements, constructed elements with other
2445: logical structures, etc.</P>
2446: <P>
2447: In order to preserve the homogeneity between documents and objects,
2448: presentation is described with a single set of tools which support the layout
2449: of a large document as well as the composition of objects like a graphical
2450: figure or mathematical formula. This unity of presentation description tools
2451: contrasts with the traditional approach, which focuses more on documents than
2452: objects and thus is based on the usual typographic conventions, such as the
2453: placement of margins, indentations, vertical spaces, line lengths,
2454: justification, font changes, etc.</P>
2455: </DIV>
2456:
2457: <DIV class="subsection">
1.6 cvs 2458: <H3><A name=sectc412>Boxes</A></H3>
1.1 cvs 2459:
2460: <P>
2461: To assure the homogeneity of tools, all presentation in Thot, for documents as
2462: well as for the objects which they contain, is based on the notion of the
2463: <EM>box</EM>, such as was implemented in T<SUB><BIG>E</BIG></SUB>X.</P>
2464: <P>
2465: Corresponding to each element of the document is a box, which is the
2466: rectangle enclosing the element on the display device (screen or sheet of
1.13 ! cvs 2467: paper); the outline of this rectangle is not visible, except when a
! 2468: <A href="#sectc4230a"><TT>ShowBox</TT> rule</A> applies to the element. The
! 2469: sides of
1.1 cvs 2470: the box are parallel to the sides of the screen or the sheet of paper. By way
2471: of example, a box is associated with a character string, a line of text, a
2472: page, a paragraph, a title, a mathematical formula, or a table cell.</P>
2473: <P>
2474: Whatever element it corresponds to, each box possesses four sides and four
2475: axes, which we designate as follows (<A href="#boxes">see figure</A>):</P>
2476: <DL>
2477: <DT><TT> Top</TT></DT>
2478: <DD>the upper side,
2479: </DD>
2480: <DT><TT> Bottom</TT></DT>
2481: <DD>the lower side,
2482: </DD>
2483: <DT><TT> Left</TT></DT>
2484: <DD>the left side,
2485: </DD>
2486: <DT><TT> Right</TT></DT>
2487: <DD>the right side,
2488: </DD>
2489: <DT><TT> VMiddle</TT></DT>
1.2 cvs 2490: <DD>the vertical axis passing through the center of the box,
1.1 cvs 2491: </DD>
2492: <DT><TT> HMiddle</TT></DT>
1.2 cvs 2493: <DD>the horizontal axis passing through the center of the box,
1.1 cvs 2494: </DD>
2495: <DT><TT> VRef</TT></DT>
2496: <DD>the vertical reference axis,
2497: </DD>
2498: <DT><TT> HRef</TT></DT>
2499: <DD>the horizontal reference axis.
2500: </DD>
2501: </DL>
2502:
2503: <DIV class="figure">
2504: <HR>
2505: <PRE>
2506: Left VRef VMiddle Right
2507: : :
2508: Top -----------------------------
2509: | : : |
2510: | : : |
2511: | : : |
2512: | : : |
2513: | : : |
2514: HMiddle ..|...........................|..
2515: | : : |
2516: | : : |
2517: HRef ..|...........................|..
2518: | : : |
2519: | : : |
2520: Bottom -----------------------------
2521: : :
2522: </PRE>
2523: <P align=center>
2524: <EM><A name="boxes">The sides and axes of boxes</A><EM></EM></EM></P>
2525: <HR>
2526: </DIV>
2527: <P>
2528: The principal role of boxes is to set the extent and position of the images of
2529: the different elements of a document with respect to each other on the
2530: reproduction device. This is done by defining relations between the boxes of
2531: different elements which give relative extents and positions to these
2532: boxes.</P>
2533: <P>
2534: There are three types of boxes:</P>
2535: <UL>
2536: <LI>boxes corresponding to structural elements of the document,
2537: <LI>presentation boxes,
2538: <LI>page layout boxes.
2539: </UL>
2540: <P>
2541: <STRONG>Boxes corresponding to structural elements of the document</STRONG>
2542: are those which linked to each of the elements (base or structured) of the
2543: logical structure of the document. Such a box contains all the contents of
1.5 cvs 2544: the element to which it corresponds (there is an exception: see
1.6 cvs 2545: <A href="#sectc4220">rules <TT>VertOverflow</TT> and
1.5 cvs 2546: <TT>HorizOverflow</TT></A>). These boxes form a
1.1 cvs 2547: tree-like structure, identical to that of the structural elements to which
2548: they correspond. This tree expresses the inclusion relationships between the
2549: boxes: a box includes all the boxes of its subtree. On the other hand, there
2550: are no predefined rules for the relative positions of the included boxes. If
2551: they are at the same level, they can overlap, be contiguous, or be disjoint.
2552: The rules expressed in the generic presentation specify their relative
2553: positions.</P>
2554: <P>
2555: <STRONG>Presentation boxes</STRONG> represent elements which are not found in
2556: the logical structure of the document but which are added to meet the needs of
2557: presentation. These boxes are linked to the elements of the logical structure
2558: that are best suited to bringing them out. For example, they are used to add
2559: the character string ``Summary:'' before the summary in the presentation of a
2560: report or to represent the fraction bar in a formula, or also to make the
2561: title of a field in a form appear. These elements have no role in the logical
2562: structure of the document: the presence of a Summary element in the document
2563: does not require the creation of another structural object to hold the word
2564: ``Summary''. Similarly, if a Fraction element contains both a Numerator
2565: element and a Denominator element, the fraction bar has no purpose
2566: structurally. On the other hand, these elements of the presentation are
2567: important for the reader of the reproduced document or for the user of an
2568: editor. This is why they must appear in the document's image. It is the
2569: generic presentation which specifies the presentation boxes to add by
2570: indicating their content (a base element for which the value is specified) and
2571: the position that they must take in the tree of boxes. During editing, these
2572: boxes cannot be modified by the user.</P>
2573: <P>
2574: <STRONG>Page layout boxes</STRONG> are boxes created implicitly by the page
2575: layout rules. These rules indicate how the contents of a structured element
2576: must be broken into lines and pages. In contrast to presentation boxes, these
2577: line and page boxes do not depend on the logical structure of the document,
1.5 cvs 2578: but rather on the physical constraints of the output devices: character
1.1 cvs 2579: size, height and width of the window on the screen or of the sheet of
2580: paper.</P>
2581: </DIV>
2582:
2583: <DIV class="subsection">
1.6 cvs 2584: <H3><A name=sectc413>Views and visibility</A></H3>
1.1 cvs 2585:
2586: <P>
2587: One of the operations that one might wish to perform on a document is to view
2588: it is different ways. For this reason, it is possible to define several
2589: <EM>views</EM> for the same document, or better yet, for all documents of the
2590: same class. A view is not a different presentation of the document, but
2591: rather a filter which only allows the display of certain parts of the
2592: document. For example, it might be desirable to see only the titles of
2593: chapters and sections in order to be able to move rapidly through the
2594: document. Such a view could be called a ``table of contents''. It might also
2595: be desirable to see only the mathematical formulas of a document in order to
2596: avoid being distracted by the non-mathematical aspects of the document. A
2597: ``mathematics'' view could provide this service.</P>
2598: <P>
2599: Views, like presentation, are based on the generic logical structure. Each
2600: document class, and each generic presentation, can be provided with views
2601: which are particularly useful for that class or presentation. For each view,
2602: the <EM>visibility</EM> of elements is defined, indicated whether or not the
2603: elements must be presented to the user. The visibility is calculated as a
2604: function of the type of the elements or their hierarchical position in the
2605: structure of the document. Thus, for a table of contents, all the ``Chapter
2606: Title'' and ``Section Title'' elements are made visible. However, the
2607: hierarchical level could be used to make the section titles invisible below a
2608: certain threshold level. By varying this threshold, the granularity of the
2609: view can be varied. In the ``mathematics'' view, only Formula elements would
2610: be made visible, no matter what their hierarchical level.</P>
2611: <P>
2612: Because views are especially useful for producing a synthetic image of the
2613: document, it is necessary to adapt the presentation of the elements to the
2614: view in which they appear. For example, it is inappropriate to have a page
2615: break before every chapter title in the table of contents. Thus, generic
2616: presentations take into account the possible views and permit each element
2617: type's presentation to vary according the view in which its image appears.</P>
2618: <P>
2619: <A name="views">Views</A> are also used, when editing documents, to display
2620: the associated elements. So, in addition to the primary view of the document,
2621: there can be a ``notes'' view and a ``figures'' view which contain,
2622: respectively, the associated elements of the Note and Figure types. In this
2623: way, it is possible to see simultaneously the text which refers to these
2624: elements and the elements themselves, even if they will be separated when
2625: printed.</P>
2626: </DIV>
2627:
2628: <DIV class="subsection">
1.6 cvs 2629: <H3><A name=sectc414>Pages</A></H3>
1.1 cvs 2630:
2631: <P>
2632: Presentation schemas can be defined which display the document as a long
2633: scroll, without page breaks. This type of schema is particularly well-suited
2634: to the initial phase of work on a document, where jumps from page to page
2635: would hinder composing and reading the document on a screen. In this case,
2636: the associated elements (such as notes), which are normally displayed in the
2637: page footer, are presented in a separate window. But, once the document is
2638: written, it may be desirable to display the document on the screen in the same
2639: manner in which it will be printed. So, the presentation schema must define
2640: pages.</P>
2641: <P>
2642: The P language permits the specification of the dimensions of pages as well as
2643: their composition. It is possible to generate running titles, page numbers,
2644: zones at the bottom of the page for notes, etc. The editor follows this model
2645: and inserts page break marks in the document which are used during printing,
2646: insuring that the pages on paper are the same as on the screen.</P>
2647: <P>
2648: Once a document has been edited with a presentation schema defining pages, it
2649: contains page marks. But it is always possible to edit the document using a
2650: schema without pages. In this case, the page marks are simply ignored by the
2651: editor. They are considered again as soon as a schema with pages is used.
2652: Thus, the user is free to choose between schemas with and without pages.</P>
2653: <P>
2654: Thot treats the page break, rather than the page itself, as a box. This page
2655: break box contains all the elements of one page's footer, a rule marking the
2656: edge of this page, and all the elements of the next page's header. The
2657: elements of the header and footer can be running titles, page number,
2658: associated elements (notes, for example), etc. All these elements, as well as
2659: their content and graphical appearance, are defined by the generic
2660: presentation.</P>
2661: </DIV>
2662:
2663: <DIV class="subsection">
1.6 cvs 2664: <H3><A name=sectc415>Numbering</A></H3>
1.1 cvs 2665:
2666: <P>
2667: Many elements are numbered in documents: pages, chapters, sections, formulas,
2668: theorems, notes, figures, bibliographic references, exercises, examples,
2669: lemmas, etc. Because Thot has a notion of logical structure, all of these
2670: numbers (with the exception of pages) are redundant with information implicit
2671: in the logical structure of the document. Such numbers are simply a way to
2672: make the structure of the document more visible. So, they are part of the
2673: document's presentation and are calculated by the editor from the logical
2674: structure. The structure does not contain numbers as such; it only defines
2675: relative structural positions between elements, which serve as ordering
2676: relations on these elements.</P>
2677: <P>
2678: If the structure schema defines the body of a document as a sequence of at
2679: least two chapters:</P>
2680: <PRE>
1.6 cvs 2681: Body = LIST [2..*] OF Chapter;
1.1 cvs 2682: </PRE>
2683: <P>
1.5 cvs 2684: the sequence defined by the list constructor is ordered and each chapter can be
2685: assigned a number based on its rank in the Body list. Therefore, all elements
2686: contained in lists a the structure of a document can be numbered, but they are
2687: not the only ones. The tree structure induced by the aggregate, list, and
2688: choice constructors (excluding references) defines a total order on the
2689: elements of the document's primary structure. So, it is possible to define
2690: a numbering which uses this order, filtering elements according to their type
2691: so that only certain element types are taken into account in the numbering. In
2692: this way, it possible to number all the theorems and lemmas of a chapter in the
2693: same sequence of numbers, even when they are not part of the same list
2694: constructor and appear at different levels of the document's tree. By changing
2695: the filter, they can be numbered separately: one sequence of numbers for
2696: theorems, another for the lemmas.</P>
1.1 cvs 2697: <P>
2698: Associated elements pose a special problem, since they are not part of the
2699: document's primary structure, but are attached only by references, which
2700: violate the total order of the document. Then, these associated elements are
2701: frequently numbered, precisely because the number is an effective way to
2702: visualize the reference. In order to resolve this problem, Thot implicitly
2703: defines a list constructor for each type of associated element, gathering
2704: together (and ordering) these elements. Thus, the associated elements can be
2705: numbered by type.</P>
2706: <P>
2707: Since they are calculated from the document's logical structure and only for
2708: the needs of the presentation, numbers are presentation elements, described by
2709: presentation boxes, just like the fraction bar or the word ``Summary''.
2710: Nevertheless, numbers differ from these other boxes because their content
2711: varies from instance to instance, even though they are of the same type,
2712: whereas all fraction bars are horizontal lines and the same word ``Summary''
2713: appears at the head of every document's summary.</P>
2714: </DIV>
2715:
2716: <DIV class="subsection">
1.6 cvs 2717: <H3><A name=sectc416>Presentation parameters</A></H3>
1.1 cvs 2718:
2719: <P>
2720: The principal parameters which determine document presentation are the
2721: <EM>positions</EM> and <EM>dimensions</EM> of boxes, the <EM>font</EM>, the
2722: <EM>style</EM>, the <EM>size</EM>, the <EM>underlining</EM> and the
2723: <EM>color</EM> of their content. From these parameters, and some others of
2724: less importance, it is possible to represent the usual typographic parameters
2725: for the textual parts of the document. These same parameters can be used to
2726: describe the geometry of the non-textual elements, even though they are
2727: two-dimensional elements unlike the text, which is linear.</P>
2728: <P>
2729: As we have already seen, the positions of the boxes always respect the rule
2730: of enclosure: a box in the tree encloses all the boxes of the next lower level
2731: which are attached to it. The positional parameters permit the specification
2732: of the position of each box in relation to the enclosing box or to its sibling
2733: boxes (boxes directly attached to the same enclosing box in the tree of
2734: boxes).</P>
2735: <P>
2736: The presentation parameters also provide control over the dimensions of the
2737: boxes. The dimensions of a box can depend either on its content or on its
2738: context (its sibling boxes and the enclosing box). Each dimension (height or
2739: width) can be defined independently of the other.</P>
2740: <P>
2741: Because of the position and dimension parameters, it is possible to do the
2742: same things that are normally done in typography by changing margins, line
2743: lengths, and vertical or horizontal skips. This approach can also align or
2744: center elements and groups of elements.</P>
2745: <P>
2746: In contrast to the position and dimension parameters, the font, style, size,
2747: underlining, and color do not concern the box itself (the rectangle delimiting
2748: the element), but its content. These parameters indicate the typographic
2749: attributes which must be applied to the text contained in the box, and by
2750: extension, to all base elements.</P>
2751: <P>
2752: For text, the font parameter is used to change the family of characters
2753: (Times, Helvetica, Courier, etc.); the style is used to obtain italic or
2754: roman, bold or light characters; the size determines the point size of the
2755: characters; underlining defines the type and thickness of the lines drawn
2756: above, below, or through the characters.</P>
2757: <P>
2758: For graphics, the line style parameter can be either solid, dotted, or dashed;
2759: the line thickness parameter controls the width of the lines; the fill pattern
2760: parameter determines how closed geometric figures must be filled.</P>
2761: <P>
2762: While some of the parameters which determine the appearance of a box's
2763: contents make sense only for one content type (text or graphic), other
2764: parameters apply to all content types: these are the color parameters. These
2765: indicate the color of lines and the background color.</P>
2766: </DIV>
2767: </DIV>
2768:
2769: <DIV class="section">
1.6 cvs 2770: <H2><A name=sectb42>Presentation description language</A></H2>
1.1 cvs 2771:
2772: <P>
2773: A generic presentation defines the values of presentation parameters (or the
2774: way to calculate those values) for a generic structure, or more precisely, for
2775: all the element types and all the global and local attributes defined in that
2776: generic structure. This definition of the presentation parameters is made
2777: with the P language. A program written in this language, that is a generic
2778: presentation expressed in P, is call a <EM>presentation schema</EM>. This
2779: section describes the syntax and semantics of the language, using the same <A
1.6 cvs 2780: href="#sectc321">meta-language</A> as was used for the definition of the S
1.1 cvs 2781: language.</P>
2782: <P>
2783: Recall that it is possible to write many different presentation schemas for
2784: the same class of documents or objects. This allows users to choose for a
2785: document the graphical appearance which best suits their type of work or
2786: their personal taste.</P>
2787:
2788: <DIV class="subsection">
1.6 cvs 2789: <H3><A name=sectc421>The organization of a presentation schema</A></H3>
1.1 cvs 2790:
2791: <P>
2792: A presentation schema begins with the word <TT>PRESENTATION</TT> and ends with
2793: the word <TT>END</TT>. The word <TT>PRESENTATION</TT> is followed by the name
2794: of the generic structure to which the presentation will be applied. This name
2795: must be the same as that which follows the keyword <TT>STRUCTURE</TT> in the
2796: structure schema associated with the presentation schema.</P>
2797: <P>
2798: After this declaration of the name of the structure, the following sections
2799: appear (in order):</P>
2800: <UL>
2801: <LI>Declarations of
2802: <UL>
2803: <LI>all views,
2804: <LI>printed views,
2805: <LI>counters,
2806: <LI>presentation constants,
2807: <LI>variables,
2808: </UL>
2809: <LI>default presentation rules,
2810: <LI>presentation box and page layout box definitions,
2811: <LI>presentation rules for structured elements,
2812: <LI>presentation rules for attributes,
2813: <LI>rules for transmitting values to attributes of included documents.
2814: </UL>
2815: <P>
2816: Each of these sections is introduced by a keyword which is followed by a
2817: sequence of declarations. Every section is optional.</P>
2818: <PRE>
2819: SchemaPres ='PRESENTATION' ElemID ';'
2820: [ 'VIEWS' ViewSeq ]
2821: [ 'PRINT' PrintViewSeq ]
2822: [ 'COUNTERS' CounterSeq ]
2823: [ 'CONST' ConstSeq ]
2824: [ 'VAR' VarSeq ]
2825: [ 'DEFAULT' ViewRuleSeq ]
2826: [ 'BOXES' BoxSeq ]
2827: [ 'RULES' PresentSeq ]
2828: [ 'ATTRIBUTES' PresAttrSeq ]
2829: [ 'TRANSMIT' TransmitSeq ]
2830: 'END' .
1.6 cvs 2831: ElemID = NAME .
1.1 cvs 2832: </PRE>
2833: </DIV>
2834:
2835: <DIV class="subsection">
1.6 cvs 2836: <H3><A name=sectc422>Views</A></H3>
1.1 cvs 2837:
2838: <P>
2839: Each of the possible views must be declared in the presentation schema. As
2840: has <A href="#views">already been described</A>, the presentation rules for an
2841: element type can vary according to the view in which the element appears. The
2842: name of the view is used to designate the view to which the presentation rules
2843: apply (see the <A href="#inkeyword"><TT>IN</TT> instruction</A>). The
2844: definition of the view's contents are dispersed throughout the presentation
2845: rules attached to the different element types and attributes. The
2846: <TT>VIEWS</TT> section is simply a sequence of view names separated by commas
2847: and terminated by a semi-colon.</P>
2848: <P>
2849: One of the view names (and only one) can be followed by the keyword
2850: <TT>EXPORT</TT>. This keyword identifies the view which presents the members
1.6 cvs 2851: of the document class in <A href="#sectc3213">skeleton form</A>. The graphical
1.1 cvs 2852: appearance and the content of this view is defined just as with other views,
2853: but it is useless to specify presentation rules concerning this view for the
2854: elements which are not loaded in the skeleton form.</P>
2855: <P>
2856: It is not necessary to declare any views; in this case there is a single
2857: unnamed view. If many views are declared, the first view listed is considered
2858: the principal view. The principal view is the one to which all rules that are
2859: not preceded by an indication of a view will apply (see the <A
2860: href="#inkeyword">instruction <TT>IN</TT></A>).</P>
2861: <P>
2862: The principal view is the the one which the editor presents on the screen when
2863: the user asks to create or edit a document. Thus, it makes sense to put the
2864: most frequently used view at the head of the list. But if the structure
1.6 cvs 2865: schema contains <A href="#sectc3213">skeleton elements</A> and is loaded in its
1.1 cvs 2866: skeleton form, the view whose name is followed by the keyword <TT>EXPORT</TT>
2867: will be opened and no other views can be opened.</P>
2868: <PRE>
1.6 cvs 2869: 'VIEWS' ViewSeq
1.1 cvs 2870: ViewSeq = ViewDeclaration
1.6 cvs 2871: < ',' ViewDeclaration > ';' .
1.1 cvs 2872: ViewDeclaration = ViewID [ 'EXPORT' ] .
2873: ViewID = NAME .
2874: </PRE>
2875: <BLOCKQUOTE class="example">
2876: <P>
2877: <STRONG>Example:</STRONG></P>
2878: <P>
1.3 cvs 2879: When editing a report, it might be useful have views of the table of contents
2880: and of the mathematical formulas, in addition to the principal view which shows
2881: the document in its entirety. To achieve this, a presentation schema for the
2882: Report class would have the following <TT>VIEWS</TT> section:</P>
1.1 cvs 2883: <PRE>
2884: VIEWS
2885: Full_text, Table_of_contents, Formulas;
2886: </PRE>
2887: <P>
2888: The contents of these views are specified in the presentation rules of the
2889: schema.</P>
2890: </BLOCKQUOTE>
2891: </DIV>
2892:
2893: <DIV class="subsection">
1.6 cvs 2894: <H3><A name=sectc423>Print Views</A></H3>
1.1 cvs 2895:
2896: <P>
2897: When editing a document, each view is presented in a different window. In
2898: addition to the views specified by the <TT>VIEWS</TT> instruction, the user
2899: can display the associated elements with one window for each type of
2900: associated element.</P>
2901: <P>
2902: When printing a document, it is possible to print any number of views, chosen
2903: from among all the views which the editor can display (views in the strict
2904: sense or associated elements). Print views, as well as the order in which
2905: they must be printed, are indicated by the <TT>PRINT</TT> instruction. It
2906: appears after the <TT>VIEWS</TT> instruction and is formed of the keyword
2907: <TT>PRINT</TT> followed by the ordered list of print view names. The print
2908: view names are separated by commas and followed by a semi-colon. A print view
2909: name is either a view name declared in the <TT>VIEWS</TT> instruction or the
2910: name of an associated element type (with an ``s'' added to the end). The
2911: associated element must have been declared in the <TT>ASSOC</TT> section of
2912: the structure schema.</P>
2913: <PRE>
2914: 'PRINT' PrintViewSeq
2915: PrintViewSeq = PrintView < ',' PrintView > ';' .
2916: PrintView = ViewID / ElemID .
2917: </PRE>
2918: <P>
2919: If the <TT>PRINT</TT> instruction is absent, the printing program will print
2920: only the principal view (the first view specified by the <TT>VIEWS</TT>
2921: instruction or the single, unnamed view when there is no <TT>VIEWS</TT>
2922: instruction).</P>
2923: <BLOCKQUOTE class="example">
2924: <P>
2925: <STRONG>Example:</STRONG></P>
2926: <P>
1.3 cvs 2927: Consider a Report presentation using the view declarations from the preceding
2928: example. Suppose we want to print the full text and table of contents views,
2929: but not the Formulas view, which is only useful when editing. In addition,
2930: suppose that we also want to print the bibliographic citations, which are
2931: associated elements (of type <TT>Citation</TT>). A sensible printing order
2932: would be to print the full text then the bibliography and finally the table of
2933: contents. To obtain this result when printing, the presentation schema would
1.1 cvs 2934: say:</P>
2935: <PRE>
2936: PRINT
2937: Full_text, Citations, Table_of_contents;
2938: </PRE>
2939: </BLOCKQUOTE>
2940: </DIV>
2941:
2942: <DIV class="subsection">
1.6 cvs 2943: <H3><A name=sectc424>Counters</A></H3>
1.1 cvs 2944:
2945: <P>
2946: A presentation has a <EM>counter</EM> for each type of number in the
2947: presentation. All counters, and therefore all types of numbers, used in the
2948: schema must be declared after the <TT>COUNTERS</TT> keyword.</P>
2949: <P>
2950: Each counter declaration is composed of a name identifying the counter
2951: followed by a colon and the counting function to be applied to the counter.
2952: The counter declaration ends with a semi-colon.</P>
2953: <P>
2954: The counting function indicates how the counter values will be calculated.
2955: Three types of counting functions are available. The first type is used to
2956: count the elements of a list or aggregate: it assigns to the counter the rank
2957: of the element in the list or aggregate. More precisely, the function</P>
2958: <PRE>
2959: RANK OF ElemID [ LevelAsc ] [ INIT AttrID ]
2960: [ 'REINIT' AttrID ]
2961: </PRE>
2962: <P>
1.5 cvs 2963: indicates that when an element creates, by a creation rule (see the <A
1.6 cvs 2964: href="#sectc4232"><TT>Create</TT> instructions</A>), a presentation box
1.5 cvs 2965: containing the counter value, this value is the rank of the creating element,
2966: if it is of type <TT>ElemID</TT>, otherwise the rank of the first element of
2967: type <TT>ElemID</TT> which encloses the creating element in the logical
1.1 cvs 2968: structure of the document.</P>
2969: <P>
2970: The type name can be preceded by a star in the special case where the
2971: structure schema defines an element of whose <TT>ElemID</TT> is the same as
1.6 cvs 2972: that of an <A href="#sectd3284">inclusion</A> without expansion or with
1.1 cvs 2973: partial expansion. To resolve this ambiguity, the <TT>ElemID</TT> alone
2974: refers to the type defined in the structure schema while the <TT>ElemID</TT>
2975: preceded by a star refers to the included type.</P>
2976: <P>
2977: The type name <TT>ElemID</TT> can be followed by an integer. That number
2978: represents the relative level, among the ancestors of the creating element, of
2979: the element whose rank is asked. If that relative level <I>n</I> is unsigned,
2980: the <I>n</I><SUP>th</SUP> element of type <TT>ElemID</TT> encountered when
2981: travelling the logical structure from the root to the creating element is
2982: taken into account. If the relative level is negative, the logical structure
2983: is travelled in the other direction, from the creating element to the
2984: root.</P>
2985: <P>
2986: The function can end with the keyword <TT>INIT</TT> followed by the name of a
2987: numeric attribute (and only a numeric attribute). Then, the rank of the first
2988: element of the list or aggregate is considered to be the value of this
2989: attribute, rather than the default value of 1, and the rank of the other
2990: elements is shifted accordingly. The attribute which determines the initial
2991: value is searched on the element itself and on its ancestors.</P>
2992: <P>
2993: The function can end with the keyword <TT>REINIT</TT> followed by the name of
2994: a numeric attribute (and only a numeric attribute). Then, if an element to be
2995: counted has this attribute, the counter value for this element is the
2996: attribute value and the following elements are numbered starting from this
2997: value.</P>
2998: <P>
2999: When the <TT>RANK</TT> function is written</P>
3000: <PRE>
3001: RANK OF Page [ ViewID ] [ INIT AttrID ]
3002: </PRE>
3003: <P>
1.5 cvs 3004: (<TT>Page</TT>is a keyword of the P language), the counter takes as its value
3005: the number of the page on which the element which creates the presentation box
3006: containing the number appears. This is done as if the pages of the document
3007: form a list for each view. The counter only takes into account the pages of
3008: the relevant view, that is the view displaying the presentation box whose
3009: contents take the value of the number. However, if the keyword <TT>Page</TT>
3010: is followed by the name of a view (between parentheses), it is the pages of
3011: that view that are taken into account. As in the preceding form, the
3012: <TT>RANK</TT> function applied to pages can end with the <TT>INIT</TT> keyword
3013: followed by the name of a numeric attribute which sets the value of the first
3014: page's number. This attribute must be a local attribute of the document
3015: itself, and not of one of its components.</P>
1.1 cvs 3016: <P>
3017: The second counting function is used to count the occurrences of a certain
3018: element type in a specified context. The instruction</P>
3019: <PRE>
3020: SET n ON Type1 ADD m ON Type2 [ INIT AttrID ]
3021: </PRE>
3022: <P>
1.5 cvs 3023: says that when the document is traversed from beginning to end (in the order
3024: induced by the logical structure), the counter is assigned the value <TT>n</TT>
3025: each time an element of type <TT>Type1</TT> is encountered, no matter
3026: what the current value of the counter, and the value <TT>m</TT> is added to the
3027: current value of the counter each time an element of type <TT>Type2</TT> is
1.1 cvs 3028: encountered.</P>
3029: <P>
3030: As with the <TT>RANK</TT> function, the type names can be preceded by a star
3031: to resolve the ambiguity of included elements.</P>
3032: <P>
3033: If the function ends with the keyword <TT>INIT</TT> followed by the name of an
3034: attribute and if the document possesses this attribute, the value of this
3035: attribute is used in place of <TT>n</TT>. The attribute must be numeric. It
3036: is searched on the element itself and on its ancestors.</P>
3037: <P>
3038: This function can also be used with the <TT>Page</TT> keyword in the place of
3039: <TT>Type1</TT> or <TT>Type2</TT>. In the first case, the counter is
3040: reinitialized on each page with the value <TT>n</TT>, while in the second
3041: case, it is incremented by <TT>m</TT> on each page. As with the preceding
3042: counting function, the word <TT>Page</TT> can be followed by a name between
3043: parentheses. In this case, the name specifies a view whose pages are taken
3044: into account.</P>
3045: <P>
3046: The definition of a counter can contain several <TT>SET</TT> functions and
3047: several <TT>ADD</TT> functions, each with a different value. The total number
3048: of counting functions must not be greater than 6.</P>
3049: <P>
3050: The third counting function is used to count the elements of a certain type
3051: encountered when travelling from the creating element to the root of the
3052: logical structure. The creating element is included if it is of that type.
3053: That function is written</P>
3054: <PRE>
3055: RLEVEL OF Type
3056: </PRE>
3057: <P>
1.5 cvs 3058: where <TT>Type</TT> represents the type of the elements to be counted.</P>
1.1 cvs 3059: <P>
3060: The formal definition of counter declarations is:</P>
3061: <PRE>
3062: 'COUNTERS' CounterSeq
3063: CounterSeq = Counter < Counter > .
3064: Counter = CounterID ':' CounterFunc ';' .
3065: CounterID = NAME .
3066: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ]
3067: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] /
3068: SetFunction < SetFunction >
3069: AddFunction < AddFunction >
3070: [ 'INIT' AttrID ] /
3071: 'RLEVEL' 'OF' ElemID .
3072: SLevelAsc = [ '-' ] LevelAsc .
3073: LevelAsc = NUMBER .
3074: SetFunction = 'SET' CounterValue 'ON' TypeOrPage .
3075: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage .
3076: TypeOrPage = 'Page' [ '(' ViewID ')' ] /
3077: [ '*' ] ElemID .
3078: CounterValue = NUMBER .
3079: </PRE>
3080: <BLOCKQUOTE class="example">
3081: <P>
3082: <STRONG>Example:</STRONG></P>
3083: <P>
1.3 cvs 3084: If the body of a chapter is defined as a sequence of sections in the structure
1.1 cvs 3085: schema:</P>
3086: <PRE>
3087: Chapter_body = LIST OF (Section =
3088: BEGIN
3089: Section_Title = Text;
3090: Section_Body = Paragraphs;
3091: END
3092: );
3093: </PRE>
3094: <P>
3095: the section counter is declared:</P>
3096: <PRE>
3097: SectionCtr : RANK OF Section;
3098: </PRE>
3099: <P>
1.4 cvs 3100: and the display of the section number before the section title is obtained by a
1.6 cvs 3101: <A href="#sectc4232"><TT>CreateBefore</TT> rule</A> attached the
1.4 cvs 3102: <TT>Section_Title</TT> type, which creates a presentation box whose content is
3103: the value of the <TT>SectionCtr</TT> counter (see the <A
1.6 cvs 3104: href="#sectc4231"><TT>Content</TT> instruction</A>).</P>
1.1 cvs 3105: <P>
3106: In order to number the formulas separately within each chapter, the formula
3107: counter is declared:</P>
3108: <PRE>
3109: FormulaCtr : SET 0 ON Chapter ADD 1 ON Formula;
3110: </PRE>
3111: <P>
1.4 cvs 3112: and the display of the formula number in the right margin, alongside each
3113: formula, is obtained by a <TT>CreateAfter</TT> instruction attached to the
3114: <TT>Formula</TT> type, which creates a presentation box whose content is the
3115: value of the <TT>FormulaCtr</TT> counter.</P>
1.1 cvs 3116: <P>
3117: To number the page chapter by chapter, with the first page of each chapter
3118: having the number 1, the counter definition would be</P>
3119: <PRE>
3120: ChapterPageCtr : SET 0 ON Chapter ADD 1 ON Page;
3121: </PRE>
3122: <P>
3123: If there is also a chapter counter</P>
3124: <PRE>
3125: ChapterCtr : RANK OF Chapter;
3126: </PRE>
3127: <P>
1.6 cvs 3128: the <A href="#sectc4231">content</A> of a presentation box created at the top of
1.1 cvs 3129: each page could be defined as:</P>
3130: <PRE>
3131: Content : (VALUE(ChapterCtr, URoman) TEXT '-'
3132: VALUE(ChapterPageCtr, Arabic));
3133: </PRE>
3134: <P>
1.5 cvs 3135: Thus, the presentation box contains the number of the chapter in upper-case
1.4 cvs 3136: roman numerals followed by a hyphen and the number of the page within
3137: the chapter in arabic numerals.</P>
1.1 cvs 3138: </BLOCKQUOTE>
3139: <BLOCKQUOTE class="example">
3140: <P>
3141: <STRONG>Example:</STRONG></P>
3142: <P>
1.3 cvs 3143: To count tables and figures together in a document of the chapter type, a
1.1 cvs 3144: counter could be defined using:</P>
3145: <PRE>
3146: CommonCtr : SET 0 ON Chapter ADD 1 ON Table
3147: ADD 1 ON Figure;
3148: </PRE>
3149: </BLOCKQUOTE>
3150: </DIV>
3151:
3152: <DIV class="subsection">
1.6 cvs 3153: <H3><A name=sectc425>Presentation constants</A></H3>
1.1 cvs 3154:
3155: <P>
3156: Presentation constants are used in the definition of the content of
1.6 cvs 3157: presentation boxes. This content is used in <A href="#sectc426">variable
3158: definitions</A> and in the <A href="#sectc4231"><TT>Content</TT> rule</A>. The
1.1 cvs 3159: only presentation constants which can be used are character strings,
1.2 cvs 3160: mathematical symbols, graphical elements, and pictures, that is to say, base
1.1 cvs 3161: elements.</P>
3162: <P>
3163: Constants can be defined directly in the variables or presentation boxes
3164: (<TT>Content</TT> rule) which use them. But it is only necessary them to
3165: declare once, in the constant declaration section, even though they are used
3166: in many variables or boxes. Thus, each declared constant has a name, which
3167: allows it to be designated whenever it is used, a type (one of the four base
3168: types) and a value (a character string or a single character for mathematical
3169: symbols and graphical elements).</P>
3170: <P>
3171: The constant declarations appear after the keyword <TT>CONST</TT>. Each
3172: declaration is composed of the name of the constant, an equals sign, a keyword
3173: representing its type (<TT>Text</TT>, <TT>Symbol</TT>, <TT>Graphics</TT> or
3174: <TT>Picture</TT>) and the string representing its value. A semi-colon
3175: terminates each declaration.</P>
3176: <P>
3177: In the case of a character string, the keyword <TT>Text</TT> can be followed
3178: by the name of an alphabet (for example, <TT>Greek</TT> or <TT>Latin</TT>) in
3179: which the constant's text should be expressed. If the alphabet name is
3180: absent, the Latin alphabet is used. When the alphabet name is present, only
3181: the first letter of the alphabet name is interpreted. Thus, the words
3182: <TT>Greek</TT> and <TT>Grec</TT> designate the same alphabet. In current
3183: versions of Thot, only the Greek and Latin alphabets are available.</P>
3184: <PRE>
3185: 'CONST' ConstSeq
3186: ConstSeq = Const < Const > .
3187: Const = ConstID '=' ConstType ConstValue ';' .
3188: ConstID = NAME .
3189: ConstType ='Text' [ Alphabet ] / 'Symbol' /
3190: 'Graphics' / 'Picture' .
3191: ConstValue = STRING .
3192: Alphabet = NAME .
3193: </PRE>
3194: <P>
1.5 cvs 3195: For character strings in the Latin alphabet (ISO Latin-1 character set),
1.1 cvs 3196: characters having codes higher than 127 (decimal) are represented by their
3197: code in octal.</P>
3198: <P>
3199: In the case of a symbol or graphical element, the value only contains a single
3200: character, between apostrophes, which indicates the form of the element which
3201: must be drawn in the box whose content is the constant. The symbol or
3202: graphical element takes the dimensions of the box, which are determined by the
1.6 cvs 3203: <TT>Height</TT> and <TT>Width</TT> rules. See <A href="#sectb72">table of
1.1 cvs 3204: codes</A> for the symbols and graphical elements.</P>
3205: <BLOCKQUOTE class="example">
3206: <P>
3207: <STRONG>Example:</STRONG></P>
3208: <P>
1.3 cvs 3209: The constants ``Summary:'' and fraction bar, which were described earlier, are
1.1 cvs 3210: declared:</P>
3211: <PRE>
3212: CONST
3213: SummaryConst = Text 'Summary:';
3214: Bar = Graphics 'h';
3215: </PRE>
3216: </BLOCKQUOTE>
3217: </DIV>
3218:
3219: <DIV class="subsection">
1.6 cvs 3220: <H3><A name=sectc426>Variables</A></H3>
1.1 cvs 3221:
3222: <P>
3223: Variables permit the definition of computed content for presentation boxes. A
3224: variable is associated with a presentation box by a <TT>Content</TT> rule; but
3225: before being used in a <TT>Content</TT> rule, a variable can be defined in the
3226: <TT>VAR</TT> section. It is also possible to define a variable at the time of
3227: its use in a <TT>Content</TT> rule, as can be done with a constant.</P>
3228: <P>
3229: A variable has a name and a value which is a character string resulting from
3230: the concatenation of the values of a sequence of functions. Each variable
3231: declaration is composed of the variable name followed by a colon and the
3232: sequence of functions which produces its value, separated by spaces. Each
3233: declaration is terminated by a semi-colon.</P>
3234: <PRE>
3235: 'VAR' VarSeq
3236: VarSeq = Variable < Variable > .
3237: Variable = VarID ':' FunctionSeq ';' .
3238: VarID = NAME .
3239: FunctionSeq = Function < Function > .
3240: </PRE>
3241: <P>
3242: Several functions are available. The first two return, in the form of a
3243: character string, the current date. <TT>DATE</TT> returns the date in
3244: English, while <TT>FDATE</TT> returns the date in french.</P>
3245: <P>
3246: Two other functions, <TT>DocName</TT> and <TT>DirName</TT>, return the
3247: document name and the directory where the document is stored.</P>
3248: <P>
3249: Function <TT>ElemName</TT> returns the type of the element which created the
3250: presentation box whose contents are the variable.</P>
3251: <P>
3252: Another function simply returns the value of a presentation constant. For any
3253: constant declared in the <TT>CONST</TT> section, it is sufficient to give the
3254: name of the constant. Otherwise, the type and value of the constant must be
1.6 cvs 3255: given, using the same form as in a <A href="#sectc425">constant
1.1 cvs 3256: declaration</A>. If the constant is not of type text, (types <TT>Symbol</TT>,
3257: <TT>Graphics</TT> or <TT>Picture</TT>), it must be alone in the variable
3258: definition; only constants of type <TT>Text</TT> can be mixed with other
3259: functions.</P>
3260: <P>
3261: It is also possible to obtain the value of an attribute, simply by mentioning
3262: the attribute's name. The value of this function is the value of the
3263: attribute for the element which created the presentation box whose contents
3264: are the variable. If the creating element does not have the indicated
3265: attribute, the value is an empty string. In the case of a numeric attribute,
3266: the attribute is translated into a decimal number in arabic numerals. If
3267: another form is desired, the <TT>VALUE</TT> function must be used.</P>
3268: <P>
3269: The last available function returns, as a character string, the value of a
3270: counter, an attribute or a page number. This value can be presented in
3271: different styles. The keyword <TT>VALUE</TT> is followed (between
3272: parentheses) by the name of the counter, the name of the attribute, or the
3273: keyword <TT>PageNumber</TT> and the desired style, the two parameters being
3274: separated by a comma. The style is a keyword which indicates whether the
3275: value should be presented in arabic numerals (<TT>Arabic</TT>), lower-case
3276: roman numerals (<TT>LRoman</TT>), or upper-case roman numerals
3277: (<TT>URoman</TT>), or by an upper-case letter (<TT>Uppercase</TT>) or
3278: lower-case letter (<TT>Lowercase</TT>).</P>
3279: <P>
3280: For a page counter, the keyword <TT>PageNumber</TT> can be followed, between
3281: parentheses, by the name of the view from which to obtain the page number. By
3282: default, the first view declared in the <TT>VIEWS</TT> section is used. The
3283: value obtained is the number of the page on which is found the element that is
3284: using the variable in a <TT>Content</TT> rule.</P>
3285: <P>
3286: For an ordinary counter, the name of the counter can be preceded by the
3287: keyword <TT>MaxRangeVal</TT> or <TT>MinRangeVal</TT>. These keywords mean
3288: that the value returned by the function is the maximum (minimum resp.) value
3289: taken by the counter in the whole document, not the value for the element
3290: concerned by the function.</P>
3291: <PRE>
1.6 cvs 3292: Function = 'DATE' / 'FDATE' /
1.1 cvs 3293: 'DocName' / 'DirName' /
3294: 'ElemName' / 'AttributeName' /
3295: ConstID / ConstType ConstValue /
3296: AttrID /
3297: 'VALUE' '(' PageAttrCtr ','
3298: CounterStyle ')' .
1.6 cvs 3299: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] /
1.1 cvs 3300: [ MinMax ] CounterID / AttrID .
3301: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' /
3302: 'Uppercase' / 'Lowercase' .
1.6 cvs 3303: MinMax = 'MaxRangeVal' / 'MinRangeVal' .
1.1 cvs 3304: </PRE>
3305: <BLOCKQUOTE class="example">
3306: <P>
3307: <STRONG>Example:</STRONG></P>
3308: <P>
1.3 cvs 3309: To make today's date appear at the top of the first page of a report, a <A
1.6 cvs 3310: href="#sectc4232"><TT>CREATE</TT> rule</A> associated with the Report_Title
1.3 cvs 3311: element type generates a presentation box whose content (specified by the
3312: <TT>Content</TT> rule of that presentation box) is the variable:</P>
1.1 cvs 3313: <PRE>
3314: VAR
3315: Todays_date : TEXT 'Version of ' DATE;
3316: </PRE>
3317: <P>
3318: To produce, before each section title, the chapter number (in upper-case roman
3319: numerals) followed by the section number (in arabic numerals), two counters
3320: must be defined:</P>
3321: <PRE>
3322: COUNTERS
3323: ChapterCtr : RANK OF Chapter;
3324: SectionCtr : RANK OF Section;
3325: </PRE>
3326: <P>
1.4 cvs 3327: and the Section_Title element must create a presentation box whose content is
1.1 cvs 3328: the variable</P>
3329: <PRE>
3330: VAR
3331: SectionNum : VALUE (ChapterCtr, URoman) TEXT '-'
3332: VALUE (SectionCtr, Arabic);
3333: </PRE>
3334: <P>
3335: In order to make the page number on which each section begins appear in the
3336: table of contents view next to the section title, each Section_Title element
3337: must create a presentation box, visible only in the table of contents view,
3338: whose content is the variable:</P>
3339: <PRE>
3340: VAR
3341: TitlePageNume :
3342: VALUE (PageNumber(Full_text), Arabic);
3343: </PRE>
3344: </BLOCKQUOTE>
3345: </DIV>
3346:
3347: <DIV class="subsection">
1.6 cvs 3348: <H3><A name=sectc427>Default presentation rules</A></H3>
1.1 cvs 3349:
3350: <P>
3351: In order to avoid having to specify, for each element type defined in the
3352: structure schema, values for every one of the numerous presentation
3353: parameters, the presentation schema allows the definition of a set of default
3354: presentation rules. These rules apply to all the boxes of the elements
3355: defined in the structure schema and to the presentation boxes and page layout
3356: boxes defined in the presentation schema. Only rules which differ from these
3357: default need to be specified in other sections of the presentation schema.</P>
3358: <P>
3359: For the primary view, the default rules can define every presentation
3360: parameter, but not the <A href="#presfunct">presentation functions</A> or the
1.6 cvs 3361: <A href="#sectc4223">linebreaking conditions</A> (the <TT>NoBreak1</TT>,
1.1 cvs 3362: <TT>NoBreak2</TT>, and <TT>Gather</TT> rules).</P>
3363: <P>
3364: In a presentation schema, the default presentation rules section is optional;
3365: in this case, the <TT>DEFAULT</TT> keyword is also absent and the following
3366: rules are considered to be the default rules:</P>
3367: <PRE>
1.6 cvs 3368: Visibility: Enclosing =;
3369: VertRef: * . Left;
3370: HorizRef: Enclosed . HRef;
3371: Height: Enclosed . Height;
3372: Width: Enclosed . Width;
3373: VertPos: Top = Previous . Bottom;
3374: HorizPos: Left = Enclosing . Left;
3375: VertOverflow: No;
1.1 cvs 3376: HorizOverflow: No;
1.6 cvs 3377: Size: Enclosing =;
3378: Style: Enclosing =;
3379: Font: Enclosing =;
3380: Underline: Enclosing =;
3381: Thickness: Enclosing =;
3382: Indent: Enclosing =;
3383: LineSpacing: Enclosing =;
3384: Adjust: Enclosing =;
3385: Justify: Enclosing =;
3386: Hyphenate: Enclosing =;
3387: PageBreak: Yes;
3388: LineBreak: Yes;
3389: InLine: Yes;
3390: Depth: 0;
3391: LineStyle: Enclosing =;
3392: LineWeight: Enclosing =;
3393: FillPattern: Enclosing =;
3394: Background: Enclosing =;
3395: Foreground: Enclosing =;
1.1 cvs 3396: </PRE>
3397: <P>
3398: If other values are desired for the default rules, they must be defined
3399: explicitly in the default rules section. In fact, it is only necessary to
3400: define those default rules which differ from the ones above, since the rules
3401: above will be used whenever a rule is not explicitly named.</P>
3402: <P>
3403: Default rules for views other than the primary view can also be specified.
3404: Otherwise, the default rules for the primary views are applied to the other
3405: views.</P>
3406: <P>
1.6 cvs 3407: Default rules are expressed in the same way as <A href="#sectc4215">explicit
1.1 cvs 3408: rules for document elements</A>.</P>
3409: </DIV>
3410:
3411: <DIV class="subsection">
1.6 cvs 3412: <H3><A name=sectc428>Presentation and page layout boxes</A></H3>
1.1 cvs 3413:
3414: <P>
3415: The presentation process uses elements which are not part of the logical
3416: structure of the document, such as pages (which are the page layout boxes) or
3417: alternatively, rules, numbers, or words introducing certain parts of the
3418: document, such as ``Summary'', ``Appendices'', ``Bibliography'', etc. (which
3419: are presentation boxes).</P>
3420: <P>
3421: After the word <TT>BOXES</TT>, each presentation or page layout box is defined
3422: by its name and a sequence of presentation rules which indicate how they must
3423: be displayed. These rules are the same as those which define the boxes
3424: associated with element of the logical structure of the document, with a
1.6 cvs 3425: single exception, the <A href="#sectc4231"><TT>Content</TT> rule</A> which is
1.1 cvs 3426: used only to specify the content of presentation boxes. The content of boxes
3427: associated with elements of the document structure is defined in each document
3428: or object and thus is not specified in the presentation schema, which applies
3429: to all documents or objects of a class.</P>
3430: <P>
3431: Among the rules which define a presentation box, certain ones can refer to
3432: another presentation box (for example, in their positional rules). If the
3433: designated box is defined after the box which designates it, a
3434: <TT>FORWARD</TT> instruction followed by the name of the designated box must
3435: appear before the designation.</P>
3436: <PRE>
1.6 cvs 3437: 'BOXES' BoxSeq
1.1 cvs 3438: BoxSeq = Box < Box > .
3439: Box ='FORWARD' BoxID ';' /
3440: BoxID ':' ViewRuleSeq .
3441: BoxID = NAME .
3442: </PRE>
3443: </DIV>
3444:
3445: <DIV class="subsection">
1.6 cvs 3446: <H3><A name=sectc429>Presentation of structured elements</A></H3>
1.1 cvs 3447:
3448: <P>
3449: After the words <TT>RULES</TT>, the presentation schema gives the presentation
3450: rules that apply to the elements whose types are defined in the structure
3451: schema. Only those rules which differ from the <A
1.6 cvs 3452: href="#sectc427">default</A> must be specified in the <TT>RULES</TT>
1.1 cvs 3453: section.</P>
3454: <P>
3455: The rule definitions for each element type are composed of the name of the
3456: element type (as specified in the structure schema) followed by a colon and
3457: the set of rules specific to that type.</P>
3458: <P>
3459: The type name can be preceded by a star in the special case where the
1.6 cvs 3460: structure schema defines an <A href="#sectd3284">inclusion</A> without
1.1 cvs 3461: expansion (or with partial expansion) of a type with the same name as an
3462: element of defined in the structure schema.</P>
3463: <P>
1.6 cvs 3464: In the case where the element is a <A href="#sectd3285">mark pair</A>, but only in
1.1 cvs 3465: this case, the type name can be preceded by the keywords <TT>First</TT> or
3466: <TT>Second</TT>. These keywords indicate whether the rules that follow apply
3467: to the first or second mark of the pair.</P>
3468: <PRE>
1.6 cvs 3469: 'RULES' PresentSeq
1.1 cvs 3470: PresentSeq = Present < Present > .
1.6 cvs 3471: Present = [ '*' ] [ FirstSec ] ElemID ':'
3472: ViewRuleSeq .
3473: FirstSec = 'First' / 'Second' .
1.1 cvs 3474: </PRE>
3475: <P>
3476: A presentation schema can define presentation rules for base elements, which
3477: are defined implicitly in the structure schemas. In the English version of
3478: the presentation schema compiler, the base type names are the same as in the S
3479: language, but they are terminated by the <TT>_UNIT</TT> suffix:
3480: <TT>TEXT_UNIT</TT>, <TT>PICTURE_UNIT</TT>, <TT>SYMBOL_UNIT</TT>,
1.2 cvs 3481: <TT>GRAPHICS_UNIT</TT>. The base type names are written in upper-case
3482: letters.</P>
1.1 cvs 3483: </DIV>
3484:
3485: <DIV class="subsection">
1.6 cvs 3486: <H3><A name=sectc4210>Logical attribute presentation</A></H3>
1.1 cvs 3487:
3488: <P>
3489: After the keyword <TT>ATTRIBUTES</TT>, all attributes which are to have some
3490: effect on the presentation of the element to which they are attached must be
3491: mentioned, along with the corresponding presentation rules. This is true for
3492: both global attributes (which can be attached to all element types) and local
3493: attributes (which can only be attached to certain element types).</P>
3494: <P>
3495: Also mentioned in this section are attributes which imply an effect on
3496: elements in the subtree of the element to which they are attached. The
3497: presentation of these descendants can be modified as a function of the value
3498: of the attribute which they inherit, just as if it was attached to them
3499: directly.</P>
3500: <P>
3501: The specification for each attribute includes the attribute's name, followed
3502: by an optional value specification and, after a colon, a set of rules. The
3503: set of rules must contain at least one rule.</P>
3504: <P>
3505: When there is no value specification, the rules are applied to all elements
3506: which carry the attribute, no matter what their value. When the rules must
3507: only apply when the attribute has certain values, these values must be
3508: specified. Thus, the same attribute can appear in the <TT>ATTRIBUTES</TT>
3509: section several times, with each appearance having a different value
3510: specification. However, reference attributes never have a value specification
3511: and, as a result, can only appear once in the <TT>ATTRIBUTES</TT> section.</P>
3512: <P>
3513: To specify that the presentation rules apply to some of the descendants of the
3514: element having the attribute, the name of the affected element type is given,
3515: between parentheses, after the attribute name. This way, the presentation
3516: rules for the attribute will be applied to the element having the attribute,
3517: if it is of the given type, and to all of its descendants of the given type.
1.6 cvs 3518: In the case where this type is a <A href="#sectd3285">mark pair</A>, but only in
1.1 cvs 3519: this case, the type name can be preceded by the keywords <TT>First</TT> or
3520: <TT>Second</TT>. These keywords indicate whether the rules that follow apply
3521: to the first or second mark of the pair. If the rule must apply to several
3522: different element types, the specification must be repeated for each element
3523: type.</P>
3524: <P>
3525: The specification of values for which the presentation rules will be applied
3526: varies according to the type of the attribute:</P>
3527: <DL>
3528: <DT>numeric attribute</DT>
1.2 cvs 3529: <DD>If the rules are to apply for one value of the attribute, then the
3530: attribute name is followed by an equals sign and this value. If the rules are
3531: to apply for all values less than (or greater than) a threshold value,
3532: non-inclusive, the attribute name followed by a '<' sign (or a '>' sign,
3533: respectively) and the threshold value. If the rules must apply to a range of
3534: values, the attribute name is followed by the word '<TT>IN</TT>' and the
3535: two bounds of the range, enclosed in brackets and separated by two
3536: periods ('<TT>..</TT>'). In the case of ranges, the values of the bounds
3537: are included in the range.
1.1 cvs 3538: <P>
3539: The threshold value in the comparisons can be the value of an attribute
3540: attached to an ancestor element. In this case, the attribute name is given
3541: instead of a constant value.</P>
3542: <P>
3543: It is also possible to write rules which apply only when a comparison between
3544: two different attributes of the element's ancestors is true. In this case, the
3545: first attribute name is followed by a comparison keyword and the name of the
3546: second attribute. The comparison keywords are <TT>EQUAL</TT> (simple
3547: equality), <TT>LESS</TT> (non-inclusive less than), and <TT>GREATER</TT>
3548: (non-inclusive greater than).</P>
3549: </DD>
3550: <DT>text attribute</DT>
1.2 cvs 3551: <DD>If the rules are to apply for one value of the attribute, then the
3552: attribute name is followed by an equals sign and this value.
1.1 cvs 3553: </DD>
3554: <DT>reference attribute</DT>
1.2 cvs 3555: <DD>There is never a value specification; the rules apply no matter what
1.1 cvs 3556: element is designated by the attribute.
3557: </DD>
3558: <DT>enumerated attribute</DT>
1.2 cvs 3559: <DD>If the rules are to apply for one value of the attribute, then the
3560: attribute name is followed by an equals sign and this value.
1.1 cvs 3561: </DD>
3562: </DL>
3563: <P>
3564: The order in which the rules associated with a numeric attribute are defined
3565: is important. When multiple sets of rules can be applied, the first set
3566: declared is the one used.</P>
3567: <P>
3568: Rules for attributes have priority over both default rules and rules
3569: associated with element types. The attribute rules apply to the element to
3570: which the attribute is attached. It is the rules which apply to the
3571: surrounding elements (and especially to the descendants) which determine the
3572: effect of the attribute rules on the environment ( and especially on the
3573: terminal elements of the structure).</P>
3574: <PRE>
3575: 'ATTRIBUTES' PresAttrSeq
3576: PresAttrSeq = PresAttr < PresAttr > .
3577: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ]
3578: [ AttrRelation ] ':' ViewRuleSeq .
3579: AttrID = NAME .
3580: AttrRelation ='=' AttrVal /
3581: '>' [ '-' ] MinValue /
3582: '<' [ '-' ] MaxValue /
3583: 'IN' '[' [ '-' ] LowerBound '..'
3584: [ '-' ] UpperBound ']' /
3585: 'GREATER' AttrID /
3586: 'EQUAL' AttrID /
3587: 'LESS' AttrID .
3588: AttrVal = [ '-' ] EqualNum / EqualText /
3589: AttrValue .
3590: MinValue = NUMBER .
3591: MaxValue = NUMBER .
3592: LowerBound = NUMBER .
3593: UpperBound = NUMBER.
3594: EqualNum = NUMBER .
3595: EqualText = STRING .
3596: AttrValue = NAME .
3597: </PRE>
3598: <P>
3599: In presentation rules associated with a numeric attribute (and only in such
3600: rules), the attribute name can be used in place of a numeric value. In this
3601: case, the value of the attribute is used in the application of the rule. Thus,
3602: the attribute can represent a relation between the size of two boxes, the
3603: height and width of a box, the height of an area where page breaks are
3604: prohibited, the distance between two boxes, the position of the reference axis
3605: of a box, the interline spacing, the indentation of the first line, the
3606: visibility, the depth (z-order), or the character set.</P>
3607: <P>
3608: The presentation rules associated with reference attributes, it is possible to
3609: use the element designated by the attribute as a reference box in a positional
3610: or extent rule. This element is represented in the <A
1.6 cvs 3611: href="#sectc4218">position</A> or <A href="#sectc4219">extent</A> rule by the
1.1 cvs 3612: keyword <TT>Referred</TT>.</P>
3613: <BLOCKQUOTE class="example">
3614: <P>
3615: <STRONG>Example:</STRONG></P>
3616: <P>
1.3 cvs 3617: In all structure schemas, there is a global Language attribute defined as
1.1 cvs 3618: follows:</P>
3619: <PRE>
3620: ATTR
3621: Language = TEXT;
3622: </PRE>
3623: <P>
1.4 cvs 3624: The following rules would make French text be displayed in roman characters and
1.1 cvs 3625: English text be displayed in italics:</P>
3626: <PRE>
3627: ATTRIBUTES
3628: Language = 'French' :
1.6 cvs 3629: Style : Roman;
1.1 cvs 3630: Language = 'English' :
1.6 cvs 3631: Style : Italics;
1.1 cvs 3632: </PRE>
3633: <P>
1.4 cvs 3634: Using these rules, when the user puts the Language attribute with the value
3635: 'English' on the summary of a document, every character string (terminal
3636: elements) contained in the summary are displayed in italics. See the <A
1.7 cvs 3637: href="#sectd42252"><TT>Style</TT> rule</A>.</P>
1.1 cvs 3638: </BLOCKQUOTE>
3639: <BLOCKQUOTE class="example">
3640: <P>
3641: <STRONG>Example:</STRONG></P>
3642: <P>
1.3 cvs 3643: A numeric attribute representing the importance of the part of the document to
1.1 cvs 3644: which it is attached can be defined:</P>
3645: <PRE>
3646: ATTR
3647: Importance = INTEGER;
3648: </PRE>
3649: <P>
1.4 cvs 3650: In the presentation schema, the importance of an element is reflected in the
1.1 cvs 3651: choice of character size, using the following rules.</P>
3652: <PRE>
3653: ATTRIBUTES
3654: Importance < 2 :
3655: Size : 1;
3656: Importance IN [2..4] :
3657: Size : Importance;
3658: Importance = 10 :
3659: Size : 5;
3660: Importance > 4 :
3661: Size : 4;
3662: </PRE>
3663: <P>
1.4 cvs 3664: Thus, the character size corresponds to the value of the Importance attribute;
1.1 cvs 3665: its value is</P>
3666: <UL>
1.2 cvs 3667: <LI>the value of the Importance attribute when the value is between 2 and 4
1.1 cvs 3668: (inclusive),
3669: <LI>1, when the value of the Importance attribute is less than 2,
1.5 cvs 3670: <LI>4, when the value of the Importance attribute is greater than 4,
1.1 cvs 3671: <LI>5, when the value of the Importance attribute is 10.
3672: </UL>
3673: <P>
1.4 cvs 3674: The last case (value 5) must be defined before the case which handles all
3675: Importance values greater than 4, because the two rules are not disjoint and
3676: the first one defined will have priority. Otherwise, when the Importance
1.1 cvs 3677: attribute has value 10, the font size will be 4.</P>
3678: </BLOCKQUOTE>
3679: <BLOCKQUOTE class="example">
3680: <P>
3681: <STRONG>Example:</STRONG></P>
3682: <P>
1.3 cvs 3683: Suppose the structure defines a list element which can have an attribute
1.1 cvs 3684: defining the type of list (numbered or not):</P>
3685: <PRE>
3686: STRUCT
3687: list (ATTR list_type = enumeration, dash)
3688: = LIST OF (list_item = TEXT);
3689: </PRE>
3690: <P>
1.4 cvs 3691: Then, the presentation schema could use the attribute placed on the list
3692: element to put either a dash or a number before the each element of the
1.1 cvs 3693: list:</P>
3694: <PRE>
3695: ATTRIBUTES
3696: list_type (list_item) = enumeration :
3697: CreateBefore (NumberBox);
3698: list_type (list_item) = dash :
3699: CreateBefore (DashBox);
3700: </PRE>
3701: </BLOCKQUOTE>
3702: <BLOCKQUOTE class="example">
3703: <P>
3704: <STRONG>Example:</STRONG></P>
3705: <P>
1.3 cvs 3706: Suppose that two attributes are defined in the structure schema. The first is
3707: a numeric global attribute called ``version''. The other is a local attribute
3708: defined on the root of the document called ``Document_version'':</P>
1.1 cvs 3709: <PRE>
3710: STRUCTURE Document
3711: ATTR
3712: version = INTEGER;
3713: STRUCT
3714: Document (ATTR Document_version = INTEGER) =
3715: BEGIN
3716: SomeElement ;
3717: ...
3718: SomeOtherElement ;
3719: END ;
3720: ...
3721: </PRE>
3722: <P>
1.4 cvs 3723: These attributes can be used in the presentation schema to place change bars in
3724: the margin next to elements whose version attribute has a value equal to the
3725: Document_version attribute of the root and to place a star in margin of
3726: elements whose version attribute is less than the value of the root's
1.1 cvs 3727: Document_version attribute:</P>
3728: <PRE>
3729: ATTRIBUTES
3730: version EQUAL Document_version :
3731: CreateBefore (ChangeBarBox) ;
3732: version LESS Document_version :
3733: CreateBefore (StarBox) ;
3734: </PRE>
3735: </BLOCKQUOTE>
3736: </DIV>
3737:
3738: <DIV class="subsection">
1.6 cvs 3739: <H3><A name=sectc4212>Value transmission rules</A></H3>
1.1 cvs 3740:
3741: <P>
3742: The last section of a presentation schema, which is optional, serves to
3743: defines the way in which a document transmits certain values to its
3744: sub-documents. A sub-document is an document <A
3745: href="#inclusion">included</A> without expansion or with partial expansion.
3746: The primary document can transmit to its sub-documents the values of certain
3747: counters or the textual content of certain of its elements, as a function of
3748: their type.</P>
3749: <P>
3750: The sub-documents receive these values in attributes which must be defined in
3751: their structure schema as local attributes of the root element. The types of
3752: these attributes must correspond to the type of the value which they receive:
3753: numeric attributes for receiving the value of a counter, textual attributes
3754: for receiving the content of an element.</P>
3755: <P>
3756: In the structure schema of the primary document, there appears at the end,
3757: after the <TT>TRANSMIT</TT> keyword, a sequence of transmission rules. Each
3758: rule begins with the name of the counter to transmit or of the element type
3759: whose textual content will be transmitted. This name is followed by the
3760: keyword <TT>To</TT> and the name of the attribute of the sub-document to which
3761: the value is transmitted. The sub-document class is indicated between
3762: parentheses after the name of the attribute. The transmission rule ends with
3763: a semicolon.</P>
3764: <PRE>
3765: TransmitSeq = Transmit < Transmit > .
3766: Transmit = TypeOrCounter 'To' ExternAttr
3767: '(' ElemID ')' ';' .
3768: TypeOrCounter = CounterID / ElemID .
3769: ExternAttr = NAME .
3770: </PRE>
3771: <BLOCKQUOTE class="example">
3772: <P>
3773: <STRONG>Example:</STRONG></P>
3774: <P>
1.3 cvs 3775: Consider a Book document class which includes instances of the Chapter document
1.1 cvs 3776: class. These classes might have the following schemas:</P>
3777: <PRE>
3778: STRUCTURE Book
3779: STRUCT
3780: Book = BEGIN
3781: Title = Text;
3782: Body = LIST OF (Chapter INCLUDED);
3783: END;
3784: ...
3785:
3786: STRUCTURE Chapter
3787: STRUCT
3788: Chapter (ATTR FirstPageNum = Integer;
3789: ChapterNum = Integer;
3790: CurrentTitle = Text) =
1.6 cvs 3791: BEGIN
3792: ChapterTitle = Text;
3793: ...
3794: END;
1.1 cvs 3795: ...
3796: </PRE>
3797: <P>
3798: Then the presentation schema for books could define chapter and page counters.
3799: The following transmission rules in the book presentation schema would
3800: transmit values for the three attributes defined at the root of each chapter
3801: sub-document.</P>
3802: <PRE>
3803: PRESENTATION Book;
3804: VIEWS
3805: Full_text;
3806: COUNTERS
3807: ChapterCtr: Rank of Chapter;
3808: PageCtr: Rank of Page(Full_text);
3809: ...
3810: TRANSMIT
3811: PageCtr TO FirstPageNum(Chapter);
3812: ChapterCtr TO ChapterNum(Chapter);
3813: Title TO CurrentTitle(Chapter);
3814: END
3815: </PRE>
3816: <P>
3817: Thus, each chapter included in a book can number its pages as a function of
3818: the number of pages preceding it in the book, can make the chapter's number
3819: appear before the number of each of its sections, or can place the title of
3820: the book at the top of each page.</P>
3821: </BLOCKQUOTE>
3822: </DIV>
3823:
3824: <DIV class="subsection">
1.6 cvs 3825: <H3><A name=sectc4213>Presentation rules</A></H3>
1.1 cvs 3826:
3827: <P>
3828: Whether defining the appearance of a presentation or page layout box, an
3829: element type, or an attribute value, the set of presentation rules that apply
3830: is always defined in the same way.</P>
3831: <P>
3832: Normally, a set of presentation rules is placed between the keywords
3833: <TT>BEGIN</TT> and <TT>END</TT>, the keyword <TT>END</TT> being followed by a
3834: semicolon. The first section of this block defines the rules that apply to
1.6 cvs 3835: the primary view, if the <A href="#sectc427">default rules</A> are not
1.1 cvs 3836: completely suitable. Next comes the rules which apply to specific other
3837: views, with a rule sequence for each view for which the default rules are not
3838: satisfactory. If the default rules are suitable for the non-primary views,
3839: there will not be any specific rules for these views. If there is only one
3840: rule which applies to all views then the keywords <TT>BEGIN</TT> and
3841: <TT>END</TT> need not appear.</P>
3842: <P>
3843: For each view, it is only necessary to specify those rules which differ from
3844: the default rules for the view, so that for certain views (or even all views),
3845: there may be no specific rules.</P>
3846: <P>
3847: The specific rules for a non-primary view are introduced by the <A
3848: name="inkeyword"><TT>IN</TT> keyword</A>, followed by the view name. The
3849: rules for that view follow, delimited by the keywords <TT>BEGIN</TT> and
3850: <TT>END</TT>, or without these two keywords when there is only one rule.</P>
3851: <P>
3852: <STRONG>Note:</STRONG> the view name which follows the <TT>IN</TT> keyword
3853: must not be the name of the primary view, since the rules for that view are
3854: found before the rules for the other views.</P>
3855: <P>
3856: Within each block concerning a view, other blocks can appear, delimited by the
3857: same keywords <TT>BEGIN</TT> and <TT>END</TT>. Each of these blocks gathers
3858: the presentation rules that apply, for a given view, only when a given
3859: condition is satisfied. Each block is preceded by a condition introduced by
3860: the <TT>IF</TT> keyword. If such a conditional block contains only one rule,
3861: the keywords <TT>BEGIN</TT> and <TT>END</TT> can be omitted.</P>
3862: <P>
3863: Although the syntax allows any presentation rule to appear in a conditional
1.6 cvs 3864: block, only <A href="#sectc4232">creation rules</A> are allowed after any
1.1 cvs 3865: condition; other rules are allowed only after conditions <TT>Within</TT> and
3866: ElemID. In addition, the following rules cannot be conditional:
3867: <TT>PageBreak, LineBreak, Inline, Gather</TT>.</P>
3868: <P>
3869: For a given view, the rules that apply without any condition must appear
3870: before the first conditional block. If some rules apply only when none of the
3871: specified condition holds, they are grouped in a block preceded by the keyword
3872: <TT>Otherwise</TT>, and that block must appear after the last conditionnal
3873: block concerning the same view.</P>
3874: <PRE>
3875: ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules >
3876: 'END' ';' /
3877: ViewRules / CondRules / Rule .
3878: RulesAndCond = CondRules / Rule .
3879: ViewRules = 'IN' ViewID CondRuleSeq .
3880: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' /
3881: CondRules / Rule .
3882: CondRules = CondRule < CondRule >
3883: [ 'Otherwise' RuleSeq ] .
3884: CondRule = 'IF' ConditionSeq RuleSeq .
3885: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' /
3886: Rule .
3887: </PRE>
3888: <BLOCKQUOTE class="example">
3889: <P>
3890: <STRONG>Example:</STRONG></P>
3891: <P>
1.3 cvs 3892: The following rules for a report's title make the title visible in the primary
3893: view and invisible in the table of contents and in the formula views (see the
1.6 cvs 3894: <A href="#sectc4224"><TT>Visibility</TT> rule</A>).</P>
1.1 cvs 3895: <PRE>
3896: Title : BEGIN
3897: Visibility : 1;
3898: ... {Other rules for the primary view}
3899: IN Table_of_contents
3900: Visibility : 0;
3901: IN Formulas
3902: Visibility : 0;
3903: END;
3904: </PRE>
3905: </BLOCKQUOTE>
3906: </DIV>
3907:
3908: <DIV class="subsection">
1.6 cvs 3909: <H3><A name=sectc4214>Conditions applying to presentation rules</A></H3>
1.1 cvs 3910:
3911: <P>
3912: Many conditions can be applied to presentation rules. Conditions allow
3913: certain presentation rules to apply only in certain cases. These conditions
3914: can be based on the structural position of the element. They can be based on
3915: whether the element has references, and what type of references, whether the
3916: element has attributes, whether the element is empty or not. They can also be
3917: based on the value of a counter.</P>
3918: <P>
3919: It is possible to specify several conditions which must all be true for the
3920: rules to apply.</P>
3921: <P>
3922: A set of conditions is specified by the <TT>IF</TT> keyword. This keyword is
3923: followed by the sequence of conditions, separated by the <TT>AND</TT> keyword.
3924: Each condition is specified by a keyword which defines the condition type. In
3925: some cases, the keyword is followed by other data, which specify the condition
3926: more precisely.</P>
3927: <P>
3928: An elementary condition can be negative; it is then preceded by the
3929: <TT>NOT</TT> keyword.</P>
3930: <P>
3931: When the presentation rule(s) controlled by the condition apply to a reference
3932: element or a reference attribute, an elementary condition can also apply to
3933: element referred by this reference. The <TT>Target</TT> keyword is used for
3934: that purpose. It must appear before the keyword defining the condition
3935: type.</P>
3936: <PRE>
1.6 cvs 3937: CondRule ='IF' ConditionSeq RuleSeq .
1.1 cvs 3938: ConditionSeq = Condition < 'AND' Condition > .
3939: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem .
3940: ConditionElem ='First' / 'Last' /
3941: [ 'Immediately' ] 'Within' [ NumParent ]
3942: ElemID [ ExtStruct ] /
3943: ElemID /
3944: 'Referred' / 'FirstRef' / 'LastRef' /
3945: 'ExternalRef' / 'InternalRef' / 'CopyRef' /
3946: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' /
3947: 'UserPage' / 'StartPage' / 'ComputedPage' /
3948: 'Empty' /
3949: '(' [ MinMax ] CounterName CounterCond ')' /
3950: CondPage '(' CounterID ')' .
3951: NumParent = [ GreaterLess ] NParent .
1.6 cvs 3952: GreaterLess ='>' / '<' .
1.1 cvs 3953: NParent = NUMBER.
1.6 cvs 3954: ExtStruct ='(' ElemID ')' .
1.1 cvs 3955: CounterCond ='<' MaxCtrVal / '>' MinCtrVal /
3956: '=' EqCtrVal /
3957: 'IN' '[' ['-'] MinCtrBound '.' '.'
3958: ['-'] MaxCtrBound ']' .
3959: PageCond ='Even' / 'Odd' / 'One' .
3960: MaxCtrVal = NUMBER .
3961: MinCtrVal = NUMBER .
3962: EqCtrVal = NUMBER .
3963: MaxCtrBound = NUMBER .
3964: MinCtrBound = NUMBER .
3965: </PRE>
3966:
3967: <DIV class="subsubsection">
1.6 cvs 3968: <H4><A name=sectd42141>Conditions based on the logical position of the element</A></H4>
1.1 cvs 3969:
3970: <P>
3971: The condition can be on the position of the element in the document's logical
3972: structure tree. It is possible to test whether the element is the first
3973: (<TT>First</TT>) or last (<TT>Last</TT>) among its siblings or if it is not
3974: the first (<TT>NOT First</TT>) or not the last (<TT>NOT Last</TT>). These
1.6 cvs 3975: conditions can be associated only with <A href="#sectc4232">creation
1.1 cvs 3976: rules</A>.</P>
3977: <P>
3978: It is also possible to test if the element is contained in an element of a
3979: given type (<TT>Within</TT>) or if it is not (<TT>NOT Within</TT>). The type
3980: is indicated after the keyword <TT>Within</TT>. If that element type is
3981: defined in a structure schema which is not the one which corresponds to the
3982: presentation schema, the type name of this element must be followed, between
3983: parentheses, by the name of the structure schema which defines it.</P>
3984: <P>
3985: If the keyword <TT>Within</TT> is preceded by <TT>Immediately</TT>, the
3986: condition is satisfied only if the <EM>parent</EM> element has the type
3987: indicated. If the word <TT>Immediately</TT> is missing, the condition is
3988: satisfied if any <EM>ancestor</EM> has the type indicated.</P>
3989: <P>
3990: An integer <I>n</I> can appear between the keyword <TT>Within</TT> and the
3991: type. It specifies the number of ancestors of the indicated type that must be
3992: present for the condition to be satisfied. If the keyword
3993: <TT>Immediately</TT> is also present, the <I>n</I> immediate ancestors of the
3994: element must have the indicated type. The integer <I>n</I> must be positive
3995: or zero. It can be preceded by <TT><</TT> or <TT>></TT> to indicate a
3996: maximum or minimum number of ancestors. If these symbols are missing, the
3997: condition is satisfied only if it exists exactly <I>n</I> ancestors. When
3998: this number is missing, it is equivalent to > 0.</P>
3999: <P>
4000: If the condition applies to presentation rules associated with an attribute,
4001: in the <TT>ATTRIBUTES</TT> section of the presentation schema, the condition
4002: can be simply an element name. Presentation rules are then executed only if
4003: the attribute is attached to an element of that type. The keyword <TT>NOT</TT>
4004: before the element name indicates that the presentation rules must be executed
4005: only if the element is not of the type indicated.</P>
4006: </DIV>
4007:
4008: <DIV class="subsubsection">
1.6 cvs 4009: <H4><A name=sectd42142>Conditions on references</A></H4>
1.1 cvs 4010:
4011: <P>
4012: References may be taken into account in conditions, which can be based on the
4013: fact that the element, or one of its ancestors, is designated by a at least
4014: one reference (<TT>Referred</TT>) or by none (<TT>NOT Referred</TT>).</P>
4015: <P>
4016: If the element or attribute to which the condition is attached is a reference,
4017: the condition can be based on the fact that it acts as the first reference to
4018: the designated element (<TT>FirstRef</TT>), or as the last (<TT>LastRef</TT>),
4019: or as a reference to an element located in another document
4020: (<TT>ExternalRef</TT>) or in the same document (<TT>InternalRef</TT>).</P>
4021: <P>
4022: The condition can also be based on the fact that the element is an <A
4023: href="#inclusion">inclusion</A>. This is noted (<TT>CopyRef</TT>).</P>
4024: <P>
4025: Like all conditions, conditions on references can be inverted by the
4026: <TT>NOT</TT> keyword. These conditions can be associated only with <A
1.6 cvs 4027: href="#sectc4232">creation rules</A>.</P>
1.1 cvs 4028: </DIV>
4029:
4030: <DIV class="subsubsection">
1.6 cvs 4031: <H4><A name=sectd42143>Conditions on logical attributes</A></H4>
1.1 cvs 4032:
4033: <P>
4034: The condition can be based on the presence or absence of attributes associated
4035: with the element, no matter what the attributes or their values. The
4036: <TT>AnyAttributes</TT> keyword expresses this condition.</P>
4037: <P>
4038: If the condition appears in the presentation rules of an attribute, the
4039: <TT>FirstAttr</TT> and <TT>LastAttr</TT> keywords can be used to indicate that
4040: the rules must only be applied if this attribute is the first attribute for
4041: the element or if it is the last (respectively). These conditions can also be
4042: inverted by the <TT>NOT</TT> keyword. These conditions can be associated only
1.6 cvs 4043: with <A href="#sectc4232">creation rules</A>.</P>
1.1 cvs 4044: <P>
4045: It is also possible to apply certain presentation rules only when the element
4046: being processed or one of its ancestors has a certain attribute, perhaps with
4047: a certain value. This can be done in the <A
1.6 cvs 4048: href="#sectc4210"><TT>ATTRIBUTES</TT> section</A>.</P>
1.1 cvs 4049: </DIV>
4050:
4051: <DIV class="subsubsection">
1.6 cvs 4052: <H4><A name=sectd42144>Conditions on page breaks</A></H4>
1.1 cvs 4053:
4054: <P>
4055: The page break base type (and only this type) can use the following
4056: conditions: <TT>ComputedPage</TT>, <TT>StartPage</TT>, and <TT>UserPage</TT>.
4057: The <TT>ComputedPage</TT> condition indicates that the presentation rule(s)
4058: should apply if the page break was created automatically by Thot; the
4059: <TT>StartPage</TT> condition is true if the page break is generated before the
4060: element by the <TT>Page</TT> rule; and the <TT>UserPage</TT> condition applies
4061: if the page break was inserted by the user.</P>
4062: <P>
1.6 cvs 4063: These conditions can be associated only with <A href="#sectc4232">creation
1.1 cvs 4064: rules</A>.</P>
4065: </DIV>
4066:
4067: <DIV class="subsubsection">
1.6 cvs 4068: <H4><A name=sectd42145>Conditions on the element's content</A></H4>
1.1 cvs 4069:
4070: <P>
4071: The condition can be based on whether or not the element is empty. An element
4072: which has no children or whose leaves are all empty is considered to be empty
4073: itself. This condition is expressed by the <TT>Empty</TT> keyword, optionally
4074: preceded by the <TT>NOT</TT> keyword. This condition can be associated only
1.6 cvs 4075: with <A href="#sectc4232">creation rules</A>.</P>
1.1 cvs 4076: </DIV>
4077:
4078: <DIV class="subsubsection">
1.6 cvs 4079: <H4><A name=sectd42146>Conditions on counters</A></H4>
1.1 cvs 4080:
4081: <P>
4082: Presentation rules can apply when the counter's value is one, is even or odd,
4083: is equal, greater than or less than a given value or falls in a range of
4084: values. This is particularly useful for creating header and footer boxes.
1.6 cvs 4085: These conditions can be associated only with <A href="#sectc4232">creation
1.1 cvs 4086: rules</A>.</P>
4087: <P>
4088: To compare the value of a counter to a given value, a comparison is given
4089: between parentheses. The comparison is composed of the counter name followed
4090: by an equals, greater than, or less than sign and the value to which the
4091: counter will be compared. A test for whether or not a counter's value falls
4092: in a range also appears within parentheses. In this case, the counter name is
4093: followed by the <TT>IN</TT> keyword and the range definition within brackets.
4094: The <TT>Even</TT>, <TT>Odd</TT> and <TT>One</TT> are used to test a counter's
4095: value and are followed by the counter name between parentheses.</P>
4096: <P>
4097: The list of possible conditions on counters is:</P>
4098: <DL>
4099: <DT><TT>Even (Counter)</TT></DT>
1.2 cvs 4100: <DD>the box is created only if the counter has an even value.
1.1 cvs 4101: </DD>
4102: <DT><TT>Odd (Counter)</TT></DT>
1.2 cvs 4103: <DD>the box is created only if the counter has an odd value.
1.1 cvs 4104: </DD>
4105: <DT><TT>One (Counter)</TT></DT>
1.2 cvs 4106: <DD>the box is created only the counter's value is 1.
1.1 cvs 4107: </DD>
4108: <DT><TT>NOT One (Counter)</TT></DT>
1.5 cvs 4109: <DD>the box is created, unless the counter's value is 1.
1.1 cvs 4110: </DD>
4111: <DT><TT>(Counter < Value)</TT></DT>
1.5 cvs 4112: <DD>the box is created only if the counter's value is less than Value.
1.1 cvs 4113: </DD>
4114: <DT><TT>(Counter > Value)</TT></DT>
1.5 cvs 4115: <DD>the box is created only if the counter's value is greater than Value.
1.1 cvs 4116: </DD>
4117: <DT><TT>(Counter = Value)</TT></DT>
1.5 cvs 4118: <DD>the box is created only if the counter's value is equal to Value.
1.1 cvs 4119: </DD>
4120: <DT><TT>NOT (Counter = Value)</TT></DT>
1.5 cvs 4121: <DD>the is created only if the counter's value is different than Value.
1.1 cvs 4122: </DD>
4123: <DT><TT>(Counter IN [MinValue..MaxValue])</TT></DT>
1.5 cvs 4124: <DD>the box is created only if the counter's value falls in the range bounded
4125: by MinValue and MaxValue (inclusive).
1.1 cvs 4126: </DD>
4127: <DT><TT>NOT (Counter IN [MinValue..MaxValue])</TT></DT>
1.5 cvs 4128: <DD>the box is created only if the value of the counter does not fall in the
4129: range bounded by MinValue and MaxValue (inclusive).
1.1 cvs 4130: </DD>
4131: </DL>
4132: <P>
4133: <STRONG>Note:</STRONG> the <TT>NOT Even</TT> and <TT>NOT Odd</TT> conditions
4134: are syntactically correct but can be expressed more simply by <TT>Odd</TT> and
4135: <TT>Even</TT>, respectively.</P>
4136: </DIV>
4137: </DIV>
4138:
4139: <DIV class="subsection">
1.6 cvs 4140: <H3><A name=sectc4215>A presentation rule</A></H3>
1.1 cvs 4141:
4142: <P>
4143: A presentation rule defines either a presentation parameter or presentation
4144: function. The parameters are:</P>
4145: <UL>
1.2 cvs 4146: <LI>the position of the vertical and horizontal reference axes of the box,
1.1 cvs 4147: <LI>the position of the box in relation to other boxes,
4148: <LI>the height or width of the box, with overflow exceptions,
1.2 cvs 4149: <LI>the characteristics of the lines contained in the box: linespacing,
1.1 cvs 4150: indentation of the first line, justification, hyphenation,
4151: <LI>the conditions for breaking the box across pages,
1.2 cvs 4152: <LI>the characteristics of the characters contained in the box: size, font,
1.1 cvs 4153: style, underlining,
1.2 cvs 4154: <LI>the depth of the box among overlapping boxes (often called stacking
4155: order),
4156: <LI>the characteristics of graphic elements contained in the box: style and
1.1 cvs 4157: thickness of lines, fill pattern for closed objects,
1.2 cvs 4158: <LI>the colors in text, graphics, pictures, and symbols contained in the box
4159: are displayed or printed,
1.1 cvs 4160: <LI>for presentation boxes only, the contents of the box.
4161: </UL>
4162: <P>
1.13 ! cvs 4163: The <A name="presfunct">presentation functions</A> are:</P>
1.1 cvs 4164: <UL>
4165: <LI>the creation of a presentation box
4166: <LI>the line-breaking or page-breaking style,
1.13 ! cvs 4167: <LI>the copying of another box,
! 4168: <LI>the display of the box background and border,
! 4169: <LI>the display of a background picture and its aspect.
1.1 cvs 4170: </UL>
4171: <P>
4172: For each box and each view, every presentation parameter is defined once and
1.6 cvs 4173: only once, either explicitly or by the <A href="#sectc427">default
1.1 cvs 4174: rules</A>. In contrast, presentation functions are not obligatory and can
4175: appear many times for the same element. for example an element can create
4176: many presentation boxes. Another element may not use any presentation
4177: functions.</P>
4178: <P>
4179: Each rule defining a presentation parameter begins with a keyword followed by
1.13 ! cvs 4180: a colon. The keyword indicates the parameter which is the subject of the rule.
1.1 cvs 4181: After the keyword and the colon, the remainder of the rule varies. All rules
4182: are terminated by a semicolon.</P>
4183: <PRE>
1.6 cvs 4184: Rule = PresParam ';' / PresFunc ';' .
4185: PresParam ='VertRef' ':' PositionHoriz /
4186: 'HorizRef' ':' PositionVert /
4187: 'VertPos' ':' VPos /
4188: 'HorizPos' ':' HPos /
4189: 'Height' ':' Dimension /
4190: 'Width' ':' Dimension /
4191: 'VertOverflow' ':' Boolean /
1.1 cvs 4192: 'HorizOverflow' ':' Boolean /
1.6 cvs 4193: 'LineSpacing' ':' DistanceInherit /
4194: 'Indent' ':' DistanceInherit /
4195: 'Adjust' ':' AdjustInherit /
4196: 'Justify' ':' BoolInherit /
4197: 'Hyphenate' ':' BoolInherit /
4198: 'PageBreak' ':' Boolean /
4199: 'LineBreak' ':' Boolean /
4200: 'InLine' ':' Boolean /
4201: 'NoBreak1' ':' AbsDist /
4202: 'NoBreak2' ':' AbsDist /
4203: 'Gather' ':' Boolean /
4204: 'Visibility' ':' NumberInherit /
4205: 'Size' ':' SizeInherit /
4206: 'Font' ':' NameInherit /
4207: 'Style' ':' StyleInherit /
4208: 'Underline' ':' UnderLineInherit /
4209: 'Thickness' ':' ThicknessInherit /
4210: 'Depth' ':' NumberInherit /
4211: 'LineStyle' ':' LineStyleInherit /
4212: 'LineWeight' ':' DistanceInherit /
4213: 'FillPattern' ':' NameInherit /
4214: 'Background' ':' NameInherit /
1.13 ! cvs 4215: 'Foreground' ':' NameInherit /
1.6 cvs 4216: 'Content' ':' VarConst .
1.1 cvs 4217: PresFunc = Creation '(' BoxID ')' /
4218: 'Line' /
4219: 'NoLine' /
4220: 'Page' '(' BoxID ')' /
1.13 ! cvs 4221: 'Copy' '(' BoxTypeToCopy ')' /
! 4222: 'ShowBox' /
! 4223: 'BackgroundPicture' ':' FileName /
! 4224: 'PictureMode' ':' PictMode /
1.1 cvs 4225: </PRE>
4226: </DIV>
4227:
4228: <DIV class="subsection">
1.6 cvs 4229: <H3><A name=sectc4216>Box axes</A></H3>
1.1 cvs 4230:
4231: <P>
4232: The position of the middle axes <TT>VMiddle</TT> and <TT>HMiddle</TT> in
4233: relation to their box is always calculated automatically as a function of the
4234: height and width of the box and is not specified by the presentation rules. In
4235: the presentation schema, these middle axes are used only to position their box
4236: with respect to another by specifying the distance between the middle axis and
1.6 cvs 4237: an axis or a side of another box (see the <A href="#sectc4218">relative
1.1 cvs 4238: position</A>).</P>
4239: <P>
4240: The reference axes of a box are also used to position their box in relation to
4241: another, but in contrast to the middle axes, the presentation schema must make
4242: their position explicit, either in relation to a side or the middle axis of
4243: the box itself, or in relation to an axis of an enclosed box.</P>
4244: <P>
4245: Only boxes of base elements have predefined reference axes. For character
4246: string boxes, the horizontal reference axis is the baseline of the characters
4247: (the line which passes immediately under the upper-case letters, ignoring the
4248: letter Q) and the vertical reference axis is at the left edge of the first
4249: character of the string.</P>
4250: <P>
4251: The positions of a box's reference axes are defined by the <TT>VertRef</TT>
4252: and <TT>HorizRef</TT> rules which specify the <A href="#distance">distance</A>
4253: between the reference axis and an axis or parallel side of the same box or of
4254: an enclosed box.</P>
4255: <PRE>
1.6 cvs 4256: 'VertRef' ':' PositionHoriz
1.1 cvs 4257: 'HorizRef' ':' PositionVert
4258: </PRE>
4259: <BLOCKQUOTE class="example">
4260: <P>
4261: <STRONG>Example:</STRONG></P>
4262: <P>
1.3 cvs 4263: If, in the structure schema for mathematical formulas, the fraction element is
1.1 cvs 4264: defined by</P>
4265: <PRE>
4266: Fraction = BEGIN
4267: Numerator = Expression;
4268: Denominator = Expression;
4269: END;
4270: </PRE>
4271: <P>
1.3 cvs 4272: then the horizontal reference axis of the fraction can be positioned on top of
1.1 cvs 4273: the denominator by the rule:</P>
4274: <PRE>
4275: Fraction :
4276: BEGIN
4277: HorizRef : Enclosed Denominator . Top;
4278: ...
4279: END;
4280: </PRE>
4281: <P>
4282: To put the horizontal reference axis of a column at its middle:</P>
4283: <PRE>
4284: Column :
4285: BEGIN
4286: HorizRef : * . HMiddle;
4287: ...
4288: END;
4289: </PRE>
4290: </BLOCKQUOTE>
4291: </DIV>
4292:
4293: <DIV class="subsection">
1.6 cvs 4294: <H3><A name=sectc4217>Distance units</A></H3>
1.1 cvs 4295:
4296: <P>
4297: Some distances and dimensions appear in many rules of a presentation schema,
4298: especially in position rules (<TT>VertPos, HorizPos</TT>), in extent rules for
4299: boxes (<TT>Height, Width</TT>), in rules defining lines (<TT>LineSpacing,
4300: Indent</TT>), in rules controlling pagination (<TT>NoBreak1, NoBreak2</TT>)
4301: and in rules specifying the thickness of strokes (<TT>LineWeight</TT>).</P>
4302: <P>
4303: In all these rules, the distance or extent can be expressed</P>
4304: <UL>
1.2 cvs 4305: <LI>either in relative units, which depend on the size of the characters in
4306: the current font: height of the element's font or height of the letter 'x',
4307: <LI>or in absolute units: centimeter, millimeter, inch, typographer's point,
1.1 cvs 4308: pica or pixel.
4309: </UL>
4310: <P>
1.5 cvs 4311: Units can be chosen freely. Thus, it is possible to use relative units in one
4312: rule, centimeters in the next rule, and typographer's points in another.</P>
1.1 cvs 4313: <P>
4314: Absolute units are used to set rigid rules for the appearance of documents. In
4315: contrast, relative units allow changes of scale. The editor lets the value of
4316: relative units be changed dynamically. Such changes affect every box using
4317: relative units simultaneously and in the same proportion. Changing the value
4318: of the relative units affects the size of the characters and graphical
4319: elements, and the size of the boxes and the distances between them.</P>
4320: <P>
4321: A <A name="distance">distance</A> or extent is specified by a number, which
4322: may be followed by one or more spaces and a units keyword. When there is no
4323: units keyword, the number specifies the number of relative units, where a
4324: relative unit is the height of a character in the current font (an em). When
4325: the number is followed by a units keyword, the keyword indicates the type of
4326: absolute units:</P>
4327: <UL>
4328: <LI><TT>em</TT>: height of the element's font,
4329: <LI><TT>ex</TT>: height of the letter 'x',
4330: <LI><TT>cm</TT>: centimeter,
4331: <LI><TT>mm</TT>: millimeter,
4332: <LI><TT>in</TT>: inch (1 in = 2.54 cm),
4333: <LI><TT>pt</TT>: point (1 pt = 1/72 in),
4334: <LI><TT>pc</TT>: pica (1 pc = 12 pt),
4335: <LI><TT>px</TT>: pixel.
4336: </UL>
4337: <P>
4338: Whatever the chosen unit, relative or absolute, the number is not necessarily
4339: an integer and may be expressed in fixed point notation (using the American
4340: convention of a period to express the decimal point).</P>
4341: <P>
4342: If the distance appears in a presentation rule for a numeric attribute, the
4343: number can be replaced by the name of an attribute. In this case, the value
4344: of the attribute is used. Obviously, the attribute name cannot be followed by
4345: a decimal point and a fractional part, but it can be followed a units keyword.
4346: However, the choice of units is limited to em, ex, pt and px.</P>
4347: <PRE>
4348: Distance = [ Sign ] AbsDist .
4349: Sign ='+' / '-' .
4350: AbsDist = IntegerOrAttr [ '.' DecimalPart ]
4351: [ Unit ].
4352: IntegerOrAttr = IntegerPart / AttrID .
4353: IntegerPart = NUMBER .
4354: DecimalPart = NUMBER .
4355: Unit ='em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' /
4356: 'pc' / 'px' / '%' .
4357: </PRE>
4358: <BLOCKQUOTE class="example">
4359: <P>
4360: <STRONG>Example:</STRONG></P>
4361: <P>
1.3 cvs 4362: The following rules specify that a box has a height of 10.5 centimeters and a
1.1 cvs 4363: width of 5.3 ems:</P>
4364: <PRE>
4365: Height : 10.5 cm;
1.6 cvs 4366: Width : 5.3;
1.1 cvs 4367: </PRE>
4368: </BLOCKQUOTE>
4369: </DIV>
4370:
4371: <DIV class="subsection">
1.6 cvs 4372: <H3><A name=sectc4218>Relative positions</A></H3>
1.1 cvs 4373:
4374: <P>
4375: The positioning of boxes uses the eight axes and sides, the sides generally
4376: being used to define the juxtapositioning (vertical or horizontal) of boxes,
4377: the middle axes being used to define centering, and the reference axes being
4378: used for alignment.</P>
4379: <P>
4380: Two rules allow a box to placed relative to other boxes. The <TT>VertPos</TT>
4381: rule positions the box vertically. The <TT>HorizPos</TT> rule positions the
4382: box horizontally. It is possible that a box's position could be entirely
4383: determined by other boxes positioned relative to it. In this case, the
4384: position is implicit and the word <TT>nil</TT> can be used to specify that no
4385: position rule is needed. Otherwise, an explicit rule must be given by
4386: indicating the axis or side which defines the position of the box, followed by
4387: an equals sign and the distance between between this axis or side and a
4388: parallel axis or side of another box, called the reference box. The box for
4389: which the rule is written will be positioned relative to the reference
4390: box.</P>
4391: <PRE>
1.6 cvs 4392: 'VertPos' ':' VPos
4393: 'HorizPos' ':' HPos
4394: HPos = 'nil' / VertAxis '=' HorizPosition
4395: [ 'UserSpecified' ].
4396: VPos = 'nil' / HorizAxis '=' VertPosition
4397: [ 'UserSpecified' ].
1.1 cvs 4398: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' .
4399: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .
4400: </PRE>
4401: <P>
4402: The reference box is an adjacent box: enclosing, enclosed or adjacent. When a
4403: rule is associated with a reference type attribute (and only in this case), it
4404: can be a box of the element designated by the attribute. The reference box
4405: can be either a presentation box previously defined in the <TT>BOXES</TT>
4406: section of the schema and created by a creation function, or the box
4407: associated with a structured element.</P>
4408: <P>
4409: The structural position of the reference box (relative to the box for which
4410: the rule is being written) is indicated by a keyword: <TT>Enclosing</TT>,
4411: <TT>Enclosed</TT>, or, for sibling boxes, <TT>Previous</TT> or <TT>Next</TT>.
4412: The reference attributes, or presentation boxes created by a reference
4413: attribute, the <TT>Referred</TT> keyword may be used to designate the element
4414: which the reference points to. The keyword <TT>Creator</TT> can be used in
4415: rules for presentation boxes to designate the box of the element which created
4416: the presentation box. Finally, the <TT>Root</TT> keyword can be used to
4417: designate the root of the document.</P>
4418: <P>
4419: When the keyword is ambiguous, it is followed by a name of a type or
4420: presentation box which resolves the ambiguity (the <TT>Creator</TT> and
4421: <TT>Root</TT> keywords are never ambiguous). If this name is not given, then
4422: the first box encountered is used as the reference box. It is also possible to
4423: use just the name of a type or presentation box without an initial keyword. In
4424: this case, a sibling having that name will be used. If the name is preceded
4425: by the keyword <TT>NOT</TT>, then the reference box will be the first box
4426: whose type is not the named one. In place of the box or type name, the
4427: keywords <TT>AnyElem</TT> and <TT>AnyBox</TT> can be used, representing
4428: respectively, any structured element box and any presentation box. A type
4429: name may be preceded by a star in order to resolve the ambiguity in the
4430: special case where the structure schema defines an <A
1.6 cvs 4431: href="#sectd3284">inclusion</A> without expansion (or with partial expansion)
1.1 cvs 4432: of the same type as an element of the scheme. For mark pairs (and only for <A
1.6 cvs 4433: href="#sectd3285">mark pairs</A>) the type name <EM>must</EM> be preceded by the
1.1 cvs 4434: <TT>First</TT> or <TT>Second</TT> keyword, which indicates which of the two
4435: marks of the pair should be used as the reference box.</P>
4436: <P>
4437: The star character ('<TT>*</TT>') used alone designates the box to which the
4438: rule applies (in this case, it is obviously useless to specify the type of the
4439: reference box).</P>
4440: <P>
4441: The keywords <TT>Enclosing</TT> and <TT>Enclosed</TT> can be used no matter
4442: what constructor defines the type to which the rule applies. When applied to
4443: the element which represents the entire document, <TT>Enclosing</TT>
4444: designates the window or page in which the document's image is displayed for
4445: the view to which the rule applies. A box or type name without a keyword is
4446: used for aggregate elements and designates another element of the same
4447: aggregate. It can also be used to designate a presentation or page layout
4448: box. The keywords <TT>Previous</TT> and <TT>Next</TT> are primarily used to
4449: denote list elements, but can also be used to denote elements of an
4450: aggregate.</P>
4451: <P>
4452: In the position rule, the structural position relative to the reference box is
4453: followed, after a period, by the name of an axis or side. The rule specifies
4454: its node's position as being some distance from this axis or side of the
4455: reference box. If this distance is zero, then the distance does not appear in
4456: the rule. Otherwise, it does appear as a positive or negative number (the
4457: sign is required for negative numbers). The sign takes into account the
4458: orientation of the coordinate axes: for top to bottom for the vertical axis
4459: and from left to right for the horizontal axis. Thus, a negative distance in
4460: a vertical position indicates that the side or axis specified in the rule is
4461: above the side or axis of the reference box.</P>
4462: <P>
4463: The distance can be followed by the <TT>UserSpecified</TT> keyword (even if
4464: the distance is nil and does not appear, the <TT>UserSpecified</TT> keyword
4465: can be used). It indicates that when the element to which the rule applies is
4466: being created, the editor will ask the user to specify the distance himself,
4467: using the mouse. In this case, the distance specified in the rule is a
4468: default distance which is suggested to the user but can be modified. The
4469: <TT>UserSpecified</TT> keyword can be used either in the vertical position
4470: rule, the horizontal position rule, or both.</P>
4471: <PRE>
4472: VertPosition = Reference '.' HorizAxis [ Distance ] .
4473: HorizPosition = Reference '.' VertAxis [ Distance ] .
4474: Reference ='Enclosing' [ BoxTypeNot ] /
4475: 'Enclosed' [ BoxTypeNot ] /
4476: 'Previous' [ BoxTypeNot ] /
4477: 'Next' [ BoxTypeNot ] /
4478: 'Referred' [ BoxTypeNot ] /
4479: 'Creator' /
4480: 'Root' /
4481: '*' /
4482: BoxOrType .
4483: BoxOrType = BoxID /
4484: [ '*' ] [ FirstSec ] ElemID /
4485: 'AnyElem' / 'AnyBox' .
4486: BoxTypeNot = [ 'NOT' ] BoxOrType .
4487: </PRE>
4488: <BLOCKQUOTE class="example">
4489: <P>
4490: <STRONG>Example:</STRONG></P>
4491: <P>
1.5 cvs 4492: If a <A name="expos1">report</A> is defined by the following
1.3 cvs 4493: structure schema:</P>
1.1 cvs 4494: <PRE>
4495: Report = BEGIN
1.6 cvs 4496: Title = Text;
4497: Summary = Text;
4498: Keywords = Text;
4499: ...
4500: END;
1.1 cvs 4501: </PRE>
4502: <P>
4503: then the presentation schema could contain the rules:</P>
4504: <PRE>
4505: Report : BEGIN
1.6 cvs 4506: VertPos : Top = Enclosing . Top;
4507: HorizPos : Left = Enclosing . Left;
4508: ...
4509: END;
1.1 cvs 4510: </PRE>
4511: <P>
1.3 cvs 4512: These rules place the <A name="reportexample">report</A> in the upper left
4513: corner of the enclosing box, which is the window in which the document is being
1.1 cvs 4514: edited.</P>
4515: <PRE>
1.6 cvs 4516: Title : BEGIN
4517: VertPos : Top = Enclosing . Top + 1;
4518: HorizPos : VMiddle = Enclosing . VMiddle;
4519: ...
4520: END;
1.1 cvs 4521: </PRE>
4522: <P>
1.3 cvs 4523: The top of the title is one line (a line has the height of the characters of
4524: the title) from the top of the report, which is also the top of the editing
4525: window. The title is centered horizontally in the window (see <A
1.1 cvs 4526: href="#posdim">figure</A>).</P>
4527: <PRE>
1.6 cvs 4528: Summary : BEGIN
1.1 cvs 4529: VertPos : Top = Title . Bottom + 1.5;
4530: HorizPos : Left = Enclosing . Left + 2 cm;
4531: ...
4532: END;
4533: </PRE>
4534: <P>
1.3 cvs 4535: The top of the summary is place a line and a half below the bottom of the title
1.1 cvs 4536: and is shifted two centimeters from the side of the window.</P>
4537: </BLOCKQUOTE>
4538: <BLOCKQUOTE class="example">
4539: <P>
4540: <STRONG>Example:</STRONG></P>
4541: <P>
1.3 cvs 4542: Suppose there is a <A name="expos2">Design</A> logical structure which contains
1.1 cvs 4543: graphical elements:</P>
4544: <PRE>
4545: Design = LIST OF (ElemGraph = GRAPHICS);
4546: </PRE>
4547: <P>
1.3 cvs 4548: The following rules allow the user to freely choose the position of each
1.1 cvs 4549: element when it is created:</P>
4550: <PRE>
4551: ElemGraph =
4552: BEGIN
4553: VertPos : Top = Enclosing . Top + 1 cm UserSpecified;
4554: HorizPos: Left = Enclosing . Left UserSpecified;
4555: ...
4556: END;
4557: </PRE>
4558: <P>
1.3 cvs 4559: Thus, when a graphical element is created, its default placement is at the left
4560: of the window and 1 cm from the top, but the user can move it immediately,
1.1 cvs 4561: simply by moving the mouse.</P>
4562: </BLOCKQUOTE>
4563: </DIV>
4564:
4565: <DIV class="subsection">
1.6 cvs 4566: <H3><A name=sectc4219>Box extents</A></H3>
1.1 cvs 4567:
4568: <P>
4569: The extents (height and width) of each box are defined by the two rules
4570: <TT>Height</TT> and <TT>Width</TT>. There are three types of extents: fixed,
4571: relative, and elastic.</P>
4572:
4573: <DIV class="subsubsection">
1.6 cvs 4574: <H4><A name=sectd42191>Fixed extents</A></H4>
1.1 cvs 4575:
4576: <P>
4577: A fixed dimension sets the height or width of the box independently of all
1.6 cvs 4578: other boxes. It is expressed in <A href="#sectc4217">distance units</A>. The
1.1 cvs 4579: extent can be followed by the <TT>UserSpecified</TT> keyword which indicates
4580: that when the element to which the rule applies is being created, the editor
4581: will ask the user to specify the extent himself, using the mouse. In this
4582: case, the extent specified in the rule is a default extent which is suggested
4583: to the user but can be modified. The <TT>UserSpecified</TT> keyword can be
4584: used either in the <TT>Height</TT> rule, the <TT>Width</TT> rule, or both.</P>
4585: <P>
4586: A fixed extent rule can be ended by the <TT>Min</TT> keyword, which signifies
4587: that the indicated value is a minimum, and that, if the contents of the box
4588: require it, a larger extent is possible.</P>
4589: <PRE>
4590: 'Height' ':' Dimension
4591: 'Width' ':' Dimension
4592: Dimension = AbsDist [ 'UserSpecified' ] [ 'Min' ] /
4593: ...
4594: </PRE>
4595: <BLOCKQUOTE class="example">
4596: <P>
4597: <STRONG>Example:</STRONG></P>
4598: <P>
1.3 cvs 4599: Continuing with the <A href="#expos2">previous example</A>, it is possible to
4600: allow the user to choose the size of each graphical element as it is
1.1 cvs 4601: created:</P>
4602: <PRE>
4603: ElemGraph : BEGIN
1.6 cvs 4604: Width : 2 cm UserSpecified;
1.1 cvs 4605: Height : 1 cm UserSpecified;
4606: ...
4607: END;
4608: </PRE>
4609: <P>
4610: Thus, when a graphical element is create, it is drawn by default with a width
4611: of 2 cm and a height of 1 cm, but the user is free to resize it immediately
4612: with the mouse.</P>
4613: <PRE>
4614: Summary : BEGIN
4615: Height : 5 cm Min;
4616: ...
4617: END;
4618: Keywords : BEGIN
4619: VertPos : Top = Summary . Bottom;
4620: ...
4621: END;
4622: </PRE>
4623: </BLOCKQUOTE>
4624: </DIV>
4625:
4626: <DIV class="subsubsection">
1.6 cvs 4627: <H4><A name=sectd42192>Relative extents</A></H4>
1.1 cvs 4628:
4629: <P>
4630: A relative extent determines the extent as a function of the extent of another
4631: box, just as a relative position places a box in relation to another. The
4632: reference box in an extent rule is designated using the same syntax as is used
4633: in a relative position rule. It is followed by a period and a <TT>Height</TT>
4634: or <TT>Width</TT> keyword, depending on the extent being referred to. Next
4635: comes the relation between the extent being defined and the extent of the
4636: reference box. This relation can be either a percentage or a difference.</P>
4637: <P>
4638: A percentage is indicated by a star (the multiplication symbol) followed by
4639: the numeric percentage value (which may be greater than or less than 100) and
4640: the percent (`%') character. A difference is simply indicated by a signed
4641: difference.</P>
4642: <P>
4643: If the rule appears in the presentation rules of a numeric attribute, the
4644: percentage value can be replaced by the name of the attribute. This attribute
4645: is then used as a percentage. The attribute can also be used as part of a <A
4646: href="#distance">difference</A>.</P>
4647: <P>
4648: Just as with a fixed extent, a relative extent rule can end with the
4649: <TT>Min</TT> keyword, which signifies that the extent is a minimum and that,
4650: if the contents of the box require it, a larger extent is possible.</P>
4651: <P>
4652: A special case of relative extent rules is:</P>
4653: <PRE>
4654: Height : Enclosed . Height;
4655: </PRE>
4656: <P>
4657: or</P>
4658: <PRE>
4659: Width : Enclosed . Width;
4660: </PRE>
4661: <P>
1.5 cvs 4662: which specifies that the box has a height (or width) such that it encloses all
4663: the boxes which it contains, excluding boxes having a rule <TT>VertOverflow:
4664: Yes;</TT> or <TT>HorizOverflow: Yes;</TT>.</P>
1.1 cvs 4665: <P>
4666: <STRONG>Note:</STRONG> character strings (type <TT>TEXT_UNIT</TT>) generally
4667: must use the sum of the widths of the characters which compose them as their
4668: width, which is expressed by the rule:</P>
4669: <PRE>
4670: TEXT_UNIT :
1.6 cvs 4671: Width : Enclosed . Width;
1.1 cvs 4672: </PRE>
4673: <P>
1.5 cvs 4674: If this rule is not the default <TT>Width</TT> rule, it must be given
4675: explicitly in the <TT>RULES</TT> section which defines the presentation rules
4676: of the logical elements.</P>
1.1 cvs 4677: <PRE>
4678: 'Height' ':' Extent
4679: 'Width' ':' Extent
4680: Extent = Reference '.' HeightWidth [ Relation ]
4681: [ 'Min' ] / ...
4682: HeightWidth ='Height' / 'Width' .
4683: Relation ='*' ExtentAttr '%' / Distance .
4684: ExtentAttr = ExtentVal / AttrID .
4685: ExtentVal = NUMBER .
4686: </PRE>
4687: <BLOCKQUOTE class="example">
4688: <P>
4689: <STRONG>Example:</STRONG></P>
4690: <P>
1.3 cvs 4691: Completing the <A href="#expos1">above example</A>, it is possible to specify
4692: that the report takes its width from the editing window and its height from the
4693: size of its contents (this can obviously be greater than that of the
1.1 cvs 4694: window):</P>
4695: <PRE>
4696: Report : BEGIN
4697: Width : Enclosing . Width;
4698: Height : Enclosed . Height;
4699: ...
4700: END;
4701: </PRE>
4702: <P>
1.3 cvs 4703: Then, the following rules make the title occupy 60% of the width of the report
4704: (which is that of the window) and is broken into centered lines of this width
1.6 cvs 4705: (see the <A href="#sectc4222"><TT>Line</TT> rule</A>).</P>
1.1 cvs 4706: <PRE>
4707: Title : BEGIN
4708: Width : Enclosing . Width * 60%;
4709: Height : Enclosed . Height;
4710: Line;
4711: Adjust : VMiddle;
4712: ...
4713: END;
4714: </PRE>
4715: <P>
1.5 cvs 4716: The summary occupy the entire width of the window, with the exception of a 2 cm
1.1 cvs 4717: margin reserved by the horizontal position rule:</P>
4718: <PRE>
4719: Summary : BEGIN
4720: Width : Enclosing . Width - 2 cm;
4721: Height : Enclosed . Height;
4722: ...
4723: END;
4724: </PRE>
4725: <P>
4726: This set of rules, plus the <A href="#reportexample">position rules given
4727: above</A>, produce the layout of boxes shown in the following<A
4728: href="#posdim">figure</A>.</P>
4729:
4730: <DIV class="figure">
4731: <HR>
4732: <PRE>
4733: -------------------------------------------------------------
4734: | Window and Report ^ |
4735: | | 1 line |
4736: | v |
4737: | ------------------------------------- |
4738: | | | |
4739: : 20% : Title : 20% :
4740: :<--------->: :<--------->:
4741: : : 60% : :
4742: : :<--------------------------------->: :
4743: | | | |
4744: | ------------------------------------- |
4745: | ^ |
4746: | | 1.5 line |
4747: | | |
4748: | v |
4749: | ---------------------------------------------------|
4750: | 2 cm | |
4751: |<------>| Summary |
4752: : : :
4753: </PRE>
4754: <P align=center>
4755: <EM><A name="posdim">Box position and extent</A><EM></EM></EM></P>
4756: <HR>
4757: </DIV>
4758: </BLOCKQUOTE>
4759: </DIV>
4760:
4761: <DIV class="subsubsection">
1.6 cvs 4762: <H4><A name=sectd42193>Elastic extents</A></H4>
1.1 cvs 4763:
4764: <P>
4765: The last type of extent is the elastic extent. Either one or both extents can
4766: be elastic. A box has an elastic extent when two opposite sides are linked by
4767: distance constraints to two sides or axes of other boxes.</P>
4768: <P>
4769: One of the sides of the elastic box is linked by a position rule
4770: (<TT>VertPos</TT> or <TT>HorizPos</TT>) to a neighboring box. The other side
4771: is link to another box by a <TT>Height</TT> or <TT>Width</TT> rule, which
4772: takes the same form as the position rule. For the elastic box itself, the
4773: notions of sides (left or right, top or bottom) are fuzzy, since the movement
4774: of either one of the two reference boxes can, for example, make the left side
4775: of the elastic box move to the right of its right side. This is not
4776: important. The only requirement is that the two sides of the elastic box used
4777: in the position and extent rule are opposite sides of the box.</P>
4778: <PRE>
1.6 cvs 4779: 'Height' ':' Extent
4780: 'Width' ':' Extent
4781: Extent = HPos / VPos / ...
1.1 cvs 4782: </PRE>
4783: <BLOCKQUOTE class="example">
4784: <P>
4785: <STRONG>Example:</STRONG></P>
4786: <P>
1.3 cvs 4787: Suppose we want to draw an elastic arrow or line between the middle of the
4788: bottom side of box A and the upper left corner of box B. To do this, we would
4789: define a graphics box whose upper left corner coincides with the middle of the
4790: bottom side of A (a position rule) and whose lower right corner coincides with
4791: with the upper left corner of B (dimension rules):</P>
1.1 cvs 4792: <PRE>
4793: LinkedBox :
4794: BEGIN
1.6 cvs 4795: VertPos : Top = A .Bottom;
1.1 cvs 4796: HorizPos : Left = A . VMiddle;
1.6 cvs 4797: Height : Bottom = B . Top;
4798: Width : Right = B . Left;
1.1 cvs 4799: END;
4800: </PRE>
4801: </BLOCKQUOTE>
4802: <BLOCKQUOTE class="example">
4803: <P>
4804: <STRONG>Example:</STRONG></P>
4805: <P>
1.3 cvs 4806: The element SectionTitle creates a presentation box called SectionNum which
4807: contains the number of the section. Suppose we want to align the SectionNum
4808: and SectionTitle horizontally, have the SectionNum take its width from its
4809: contents (the section number), have the SectionTitle box begin 0.5 cm to the
4810: right of the SectionNum box and end at the right edge of its enclosing box.
4811: This would make the SectionTitle box elastic, since its width is defined by the
4812: position of its left and right sides. The following rules produce this
1.1 cvs 4813: effect:</P>
4814: <PRE>
4815: SectionNum :
4816: BEGIN
4817: HorizPos : Left = Enclosing . Left;
4818: Width : Enclosed . Width;
4819: ...
4820: END;
4821:
4822: SectionTitle :
4823: BEGIN
4824: HorizPos : Left = SectionNum . Right + 0.5 cm;
4825: Width : Right = Enclosing . Right;
4826: ...
4827: END;
4828: </PRE>
4829: </BLOCKQUOTE>
4830: </DIV>
4831: </DIV>
4832:
4833: <DIV class="subsection">
1.6 cvs 4834: <H3><A name="sectc4220">Overflow</A></H3>
1.1 cvs 4835:
4836: <P>
4837: A boxes corresponding to a structural element normally contain all boxes
4838: corresponding to the elements of its subtree. However, in some cases, it
4839: could be necessary to allow a box to jut out from its parent box. Two
4840: presentation rules indicate that such an overflow is allowed, one for
4841: horizontal overflow, one for vertical overflow.</P>
4842: <P>
4843: Each of these rules is expressed by a keyword followed by a colon and the
4844: keyword <TT>Yes</TT> or <TT>No</TT>.</P>
4845: <PRE>
4846: 'VertOverflow' ':' Boolean /
4847: 'HorizOverflow' ':' Boolean .
4848: Boolean = 'Yes' / 'No' .
4849: </PRE>
4850: </DIV>
4851:
4852: <DIV class="subsection">
1.6 cvs 4853: <H3><A name=sectc4221>Inheritance</A></H3>
1.1 cvs 4854:
4855: <P>
4856: A presentation parameter can be defined by reference to the same parameter of
4857: another box in the tree of boxes. These structural links are expressed by
4858: kinship. The reference box can be that of the element immediately above in
4859: the structure (<TT>Enclosing</TT>), two levels above (<TT>GrandFather</TT>),
4860: immediately below (<TT>Enclosed</TT>) or immediately before
4861: (<TT>Previous</TT>). In the case of a presentation box, and only in that
4862: case, the reference box may be the element which created the presentation box
4863: (<TT>Creator</TT>).</P>
4864: <P>
4865: Kinship is expressed in terms of the logical structure of the document and not
4866: in terms of the tree of boxes. The presentation box cannot transmit any of
4867: their parameters by inheritance; only structured element boxes can do so. As
4868: an example, consider an element B which follows an element A in the logical
4869: structure. The element B creates a presentation box P in front of itself,
1.6 cvs 4870: using the <TT>CreateBefore</TT> rule (see the <A href="#sectc4232">creation
1.1 cvs 4871: rules</A>). If element B's box inherits its character style using the
4872: <TT>Previous</TT> kinship operation, it gets its character style from A's box,
4873: not from P's box. Inheritance works differently for positions and extents,
4874: which can refer to presentation boxes.</P>
4875: <P>
4876: The inherited parameter value can be the same as that of the reference box.
4877: This is indicated by an equals sign. However, for numeric parameters, a
4878: different value can be obtained by adding or subtracting a number from the
4879: reference box's parameter value. Addition is indicated by a plus sign before
4880: the number, while subtraction is specified with a minus sign. The value of a
4881: parameter can also be given a maximum (if the sign is a plus) or minimum (if
4882: the sign is a minus).</P>
4883: <P>
4884: If the rule is being applied to a numeric attribute, the number to add or
4885: subtract can be replaced by the attribute name. The value of a maximum or
4886: minimum may also be replaced by an attribute name. In these cases, the value
4887: of the attribute is used.</P>
4888: <PRE>
1.6 cvs 4889: Inheritance = Kinship InheritedValue .
4890: Kinship ='Enclosing' / 'GrandFather' / 'Enclosed' /
4891: 'Previous' / 'Creator' .
1.1 cvs 4892: InheritedValue ='+' PosIntAttr [ 'Max' maximumA ] /
1.6 cvs 4893: '-' NegIntAttr [ 'Min' minimumA ] /
4894: '=' .
4895: PosIntAttr = PosInt / AttrID .
4896: PosInt = NUMBER .
4897: NegIntAttr = NegInt / AttrID .
4898: NegInt = NUMBER .
4899: maximumA = maximum / AttrID .
4900: maximum = NUMBER .
4901: minimumA = minimum / AttrID .
4902: minimum = NUMBER .
1.1 cvs 4903: </PRE>
4904: <P>
4905: The parameters which can be obtained by inheritance are justification,
4906: hyphenation, interline spacing, character font (font family), font style, font
4907: size, visibility, indentation, underlining, alignment of text, stacking order
4908: of objects, the style and thickness of lines, fill pattern and the colors of
4909: lines and characters.</P>
4910: </DIV>
4911:
4912: <DIV class="subsection">
1.6 cvs 4913: <H3><A name=sectc4222>Line breaking</A></H3>
1.1 cvs 4914:
4915: <P>
4916: The <TT>Line</TT> rule specifies that the contents of the box should be broken
4917: into lines: the boxes included in the box to which this rule is attached are
4918: displayed one after the other, from left to right, with their horizontal
4919: reference axes aligned so that they form a series of lines. The length of
4920: these lines is equal to the width of the box to which the <TT>Line</TT> rule
4921: is attached.</P>
4922: <P>
4923: When an included box overflows the current line, it is either carried forward
4924: to the next line, cur, or left the way it is. The <A
1.6 cvs 4925: href="#sectc4223"><TT>LineBreak</TT> rule</A> is used to allow or prevent the
1.1 cvs 4926: breaking of included boxes. If the included box is not breakable but is
4927: longer than the space remaining on the line, it is left as is. When a
4928: character string box is breakable, the line is broken between words or, if
1.6 cvs 4929: necessary, by <A href="#sectd42225">hyphenating a word</A>. When a
1.1 cvs 4930: compound box is breakable, the box is transparent in regard to line breaking.
4931: The boxes included in the compound box are treated just like included boxes
4932: which have the <TT>LineBreak</TT> rule. Thus, it is possible to traverse a
4933: complete subtree of boxes to line break the text leaves of a complex
4934: structure.</P>
4935: <P>
4936: The relative position rules of the included boxes are ignored, since the boxes
4937: will be placed according to the line breaking rules.</P>
4938: <P>
4939: The <TT>Line</TT> rule does not have a parameter. The characteristics of the
4940: lines that will be constructed are determined by the <TT>LineSpacing</TT>,
4941: <TT>Indent</TT>, <TT>Adjust</TT>, <TT>Justify</TT>, and <TT>Hyphenate</TT>
1.6 cvs 4942: rules. Moreover, the <A href="#insectd42226"><TT>Inline</TT> rule</A> permits
1.1 cvs 4943: the exclusion of certain elements from the line breaking process.</P>
4944: <P>
4945: When the <TT>Line</TT> rule appears in the rules sequence of a non-primary
4946: view, it applies only to that view, but when the <TT>Line</TT> rule appears in
4947: the rules sequence of the primary view, it also applies to the other views by
4948: default, except for those views which explicitly invoke the <TT>NoLine</TT>
4949: rule. Thus, the <TT>NoLine</TT> rule can be used in a non-primary view to
4950: override the primary view's <TT>Line</TT> rule. The <TT>NoLine</TT> rule must
4951: not be used with the primary view because the absence of the <TT>Line</TT>
4952: rule has the same effect. Like the <TT>Line</TT> rule, the <TT>NoLine</TT>
4953: rule does not take any parameters.</P>
4954: <PRE>
1.6 cvs 4955: 'Line'
4956: 'NoLine'
1.1 cvs 4957: </PRE>
4958:
4959: <DIV class="subsubsection">
1.6 cvs 4960: <H4><A name=sectd42221>Line spacing</A></H4>
1.1 cvs 4961:
4962: <P>
4963: The <TT>LineSpacing</TT> rule defines the line spacing to be used in the line
4964: breaking process. The line spacing is the distance between the baselines
4965: (horizontal reference axis) of the successive lines produced by the
4966: <TT>Line</TT> rule. The value of the line spacing can be specified as a
4967: constant or by inheritance. It is expressed in any of the available <A
1.6 cvs 4968: href="#sectc4217">distance units</A>.</P>
1.1 cvs 4969: <P>
4970: Inheritance allows the value to be obtained from a relative in the structure
4971: tree, either without change (an equals sign appears after the inheritance
4972: keyword), with a positive difference (a plus sign), or a negative difference
4973: (a minus sign). When the rule uses a difference, the value of the difference
1.6 cvs 4974: follows the sign and is expressed as a <A href="#sectc4217">distance</A>.</P>
1.1 cvs 4975: <PRE>
1.6 cvs 4976: 'LineSpacing' ':' DistOrInherit
4977: DistOrInherit = Kinship InheritedDist / Distance .
1.1 cvs 4978: InheritedDist = '=' / '+' AbsDist / '-' AbsDist .
4979: </PRE>
4980: <P>
4981: When the line spacing value (or its difference from another element) is
4982: expressed in relative units, it changes with the size of the characters. Thus,
4983: when a larger font is chosen for a part of the document, the line spacing of
4984: that part expands proportionally. In contrast, when the line spacing value is
4985: expressed in absolute units (centimeters, inches, typographer's points), it is
4986: independent of the characters, which permits the maintenance of a consistent
4987: line spacing, whatever the character font. Either approach can be taken,
4988: depending on the desired effect.</P>
4989: </DIV>
4990:
4991: <DIV class="subsubsection">
1.6 cvs 4992: <H4><A name=sectd42222>First line indentation</A></H4>
1.1 cvs 4993:
4994: <P>
4995: The <TT>Indent</TT> rule is used to specify the indentation of the first line
4996: of the elements broken into lines by the <TT>Line</TT> function. The
4997: indentation determines how far the first line of the element is shifted with
4998: respect to the other lines of the same element. It can be specified as a
4999: constant or by inheritance. The constant value is a positive integer (shifted
5000: to the right; the sign is optional), a negative integer (shifted to the left)
1.6 cvs 5001: or zero (no shift). All available <A href="#sectc4217">units</A> can be
1.1 cvs 5002: used.</P>
5003: <P>
5004: Indentation can be defined for any box, regardless of whether the box is line
5005: broken, and transmitted by inheritance to elements that are line broken. The
5006: size of the indentation is specified in the same manner as the <A
1.6 cvs 5007: href="#sectd42221">line spacing</A>.</P>
1.1 cvs 5008: <PRE>
1.6 cvs 5009: 'Indent' ':' DistOrInherit
1.1 cvs 5010: </PRE>
5011: </DIV>
5012:
5013: <DIV class="subsubsection">
1.6 cvs 5014: <H4><A name=sectd42223>Alignment</A></H4>
1.1 cvs 5015:
5016: <P>
5017: The alignment style of the lines constructed during line breaking is defined
5018: by the <TT>Adjust</TT> rule. The alignment value can be a constant or
5019: inherited. A constant value is specified by a keyword:</P>
5020: <UL>
5021: <LI><TT>Left</TT>: at the left edge,
5022: <LI><TT>Right</TT>: at the right edge,
5023: <LI><TT>VMiddle</TT>: centered
1.2 cvs 5024: <LI><TT>LeftWithDots</TT>: at the left edge with a dotted line filling out the
1.1 cvs 5025: last line up to the right edge of the line breaking box.
5026: </UL>
5027: <P>
5028: An inherited value can only be the same as that of the reference box and is
5029: specified by a kinship keyword followed by an equals sign.</P>
5030: <PRE>
1.6 cvs 5031: 'Adjust' ':' AlignOrInherit
1.1 cvs 5032: AlignOrInherit = Kinship '=' / Alignment .
5033: Alignment = 'Left' / 'Right' / 'VMiddle' /
5034: 'LeftWithDots' .
5035: </PRE>
5036: </DIV>
5037:
5038: <DIV class="subsubsection">
1.6 cvs 5039: <H4><A name=sectd42224>Justification</A></H4>
1.1 cvs 5040:
5041: <P>
5042: The <TT>Justify</TT> rule indicates whether the lines contained in the box and
5043: produced by a <TT>Line</TT> rule should be extended horizontally to occupy the
5044: entire width of their enclosing box. The first and last lines are treated
5045: specially: the position of the beginning of the first line is fixed by the
5046: <TT>Indent</TT> rule and last line is not extended. The justification
5047: parameter defined by this rule takes a boolean value, which can be a constant
5048: or inherited. A constant boolean value is expressed by either the
5049: <TT>Yes</TT> or the <TT>No</TT> keyword. An inherited value can only be the
5050: same as that of the reference box and is specified by a kinship keyword
5051: followed by an equals sign.</P>
5052: <PRE>
1.6 cvs 5053: 'Justify' ':' BoolInherit
1.1 cvs 5054: BoolInherit = Boolean / Kinship '=' .
1.6 cvs 5055: Boolean ='Yes' / 'No' .
1.1 cvs 5056: </PRE>
5057: <P>
5058: When the lines are justified, the alignment parameter specified in the
5059: <TT>Adjust</TT> rule has no influence, other than on the last line produced.
5060: This occurs because, when the other are extended to the limits of the box, the
5061: alignment style is no longer perceptible.</P>
5062: <BLOCKQUOTE class="example">
5063: <P>
5064: <STRONG>Example:</STRONG></P>
5065: <P>
1.3 cvs 5066: An important use of inheritance is to vary the characteristics of lines for an
5067: element type (for example, Paragraph) according to the enclosing environment
5068: (for example, Summary or Section), and thus obtain different line breaking
5069: styles for the same elements when they appear in different environments. The
5070: following rules specify that paragraphs inherit their alignment, justification,
1.1 cvs 5071: and line spacing:</P>
5072: <PRE>
5073: Paragraph :
5074: BEGIN
5075: Justify : Enclosing = ;
5076: LineSpacing : Enclosing = ;
5077: Adjust : Enclosing =;
5078: Line;
5079: END;
5080: </PRE>
5081: <P>
1.5 cvs 5082: If the alignment, justification, and line spacing of the Section and Summary
1.1 cvs 5083: elements is fixed:</P>
5084: <PRE>
5085: Section :
5086: BEGIN
5087: Adjust : Left;
5088: Justify : Yes;
5089: LineSpacing : 1;
5090: END;
5091: Summary :
5092: BEGIN
5093: Adjust : VMiddle;
5094: Justify : No;
5095: LineSpacing : 1.3;
5096: END;
5097: </PRE>
5098: <P>
1.4 cvs 5099: then the paragraphs appearing in sections are justified with a simple line
5100: spacing while those appearing in summaries are centered and not justified and
5101: have a larger line spacing. These are nevertheless the very same type of
1.1 cvs 5102: paragraph defined in the logical structure schema.</P>
5103: </BLOCKQUOTE>
5104: </DIV>
5105:
5106: <DIV class="subsubsection">
1.6 cvs 5107: <H4><A name=sectd42225>Hyphenation</A></H4>
1.1 cvs 5108:
5109: <P>
5110: The <TT>Hyphenate</TT> rule indicates whether or not words should be broken by
5111: hyphenation at the end of lines. It affects the lines produced by the
5112: <TT>Line</TT> rule and contained in the box carrying the <TT>Hyphenate</TT>
5113: rule.</P>
5114: <P>
5115: The hyphenation parameter takes a boolean value, which can be either constant
5116: or inherited. A constant boolean value is expressed by either the
5117: <TT>Yes</TT> or the <TT>No</TT> keyword. An inherited value can only be the
5118: same as that of the reference box and is specified by a kinship keyword
5119: followed by an equals sign.</P>
5120: <PRE>
5121: 'Hyphenate' ':' BoolInherit
5122: BoolInherit = Boolean / Kinship '=' .
5123: Boolean = 'Yes' / 'No' .
5124: </PRE>
5125: </DIV>
5126:
5127: <DIV class="subsubsection">
1.6 cvs 5128: <H4><A name=sectd42226>Avoiding line breaking</A></H4>
1.1 cvs 5129:
5130: <P>
5131: The <TT>InLine</TT> rule is used to specify that a box that would otherwise
5132: participate in line breaking asked for by the <TT>Line</TT> rule of an
5133: enclosing box, instead avoids the line breaking process and positions itself
5134: according to the <TT>HorizPos</TT> and <TT>VertPos</TT> rules that apply to
5135: it. When the <TT>InLine</TT> rule applies to a box which would not be line
5136: broken, it has no effect.</P>
5137: <P>
5138: The rule is expressed by the <TT>InLine</TT> keyword followed by a colon and
5139: the keyword <TT>Yes</TT>, if the box should participate in line breaking, or
5140: the keyword <TT>No</TT>, if it should not. This is the only form possible:
5141: this rule cannot be inherited. Moreover, it can only appear in the rules of
5142: the primary view and applies to all views defined in the presentation
5143: schema.</P>
5144: <PRE>
5145: 'InLine' ':' Boolean .
5146: Boolean = 'Yes' / 'No' .
5147: </PRE>
5148: <BLOCKQUOTE class="example">
5149: <P>
5150: <STRONG>Example:</STRONG></P>
5151: <P>
5152: Suppose the structure schema defines a logical attribute
1.3 cvs 5153: called <TT>New</TT> which is used to identify the passages in a document which
1.5 cvs 5154: were recently modified. It would be nice to have the presentation schema make
5155: a bar appear in the left margin next to each passage having
1.3 cvs 5156: the <TT>New</TT> attribute. A new passage can be an entire element, such as a
5157: paragraph or section, or it can be some words in the middle of a paragraph. To
5158: produce the desired effect, the <TT>New</TT> attribute is given a creation rule
5159: which generates a <TT>VerticalBar</TT> presentation box.</P>
1.1 cvs 5160: <P>
5161: When the <TT>New</TT> attribute is attached to a character string which is
5162: inside a line broken element (inside a paragraph, for example), the bar is one
5163: of the elements which participates in line breaking and it is placed normally
5164: in the current line, at the end of the character string which has the
5165: attribute. To avoid this, the <TT>InLine</TT> rule is used in the following
5166: way:</P>
5167: <PRE>
5168: BOXES
5169: VerticalBar:
5170: BEGIN
5171: Content: Graphics 'l';
5172: HorizPos: Left = Root . Left;
5173: VertPos: Top = Creator . Top;
5174: Height: Bottom = Creator . Bottom;
5175: Width: 1 pt;
5176: InLine: No;
5177: ...
5178: END;
5179: ...
5180: ATTRIBUTES
5181: Nouveau:
5182: BEGIN
5183: CreateAfter(VerticalBar);
5184: END;
5185: </PRE>
5186: </BLOCKQUOTE>
5187: </DIV>
5188: </DIV>
5189:
5190: <DIV class="subsection">
1.6 cvs 5191: <H3><A name=sectc4223>Page breaking and line breaking conditions</A></H3>
1.1 cvs 5192:
5193: <P>
5194: Pages are constructed by the editor in accordance with the model specified by
1.6 cvs 5195: a <A href="#sectc4233"><TT>Page</TT> rule</A>. The page model describes only the
1.1 cvs 5196: composition of the pages but does not give any rules for breaking different
5197: element types across pages. Now, it is possible that certain elements must
5198: not be cut by page breaks, while others can be cut anywhere. The
5199: <TT>PageBreak</TT>, <TT>NoBreak1</TT>, and <TT>NoBreak2</TT> rules are used to
5200: specify the conditions under which each element type can be cut.</P>
5201: <P>
5202: The <TT>PageBreak</TT> rule is used to indicate whether or not the box can be
5203: cut during the construction of pages. If cutting is authorized, the box can
5204: be cut, with one part appearing at the bottom of a page and the other part
5205: appearing at the top of the next page. The rule is formed by the
5206: <TT>PageBreak</TT> keyword followed by a colon and a constant boolean value
5207: (<TT>Yes</TT> or <TT>No</TT>). This is the only form possible: this rule
5208: cannot be inherited. Moreover, it can only appear in the rules of the primary
5209: view and applies to all views defined in the presentation schema.</P>
5210: <P>
5211: Whether objects can be cut by line breaks can be controlled in a similar way
5212: using the <TT>LineBreak</TT> rule. This rule allows the specification of
5213: whether or not the box can be cut during the construction of lines. If
5214: cutting is authorized, the box can be cut, with one part appearing at the end
5215: of a line and the other part appearing at the beginning of the next line. The
5216: rule is formed by the <TT>LineBreak</TT> keyword followed by a colon and a
5217: constant boolean value (<TT>Yes</TT> or <TT>No</TT>). This is the only form
5218: possible: this rule cannot be inherited. Moreover, it can only appear in the
5219: rules of the primary view and applies to all views defined in the presentation
5220: schema.</P>
5221: <PRE>
5222: 'PageBreak' ':' Boolean .
5223: 'LineBreak' ':' Boolean .
5224: Boolean = 'Yes' / 'No' .
5225: </PRE>
5226: <P>
5227: When a box can be cut by a page break, it is possible that a page break will
5228: fall an inappropriate spot, creating, for example, a widow or orphan, or
5229: separating the title of a section from the first paragraph of the section. The
5230: <TT>NoBreak1</TT> and <TT>NoBreak2</TT> rules are used to avoid this. They
1.12 cvs 5231: specify that the box of the element to which they apply cannot be cut within
5232: a certain zone at the top (<TT>NoBreak1</TT> rule) or at the bottom
1.1 cvs 5233: (<TT>NoBreak2</TT> rule). These two rules specify the height of the zones in
5234: which page breaks are prohibited.</P>
5235: <P>
5236: The <TT>NoBreak1</TT> and <TT>NoBreak2</TT> rules give the height of the zone
5237: in which page breaking is prohibited. The height is given as a constant value
1.6 cvs 5238: using any of the <A href="#sectc4217">available units</A>, absolute or
1.1 cvs 5239: relative. The value may not be inherited.</P>
5240: <PRE>
5241: 'NoBreak1' ':' AbsDist .
5242: 'NoBreak2' ':' AbsDist .
5243: </PRE>
5244: <BLOCKQUOTE class="example">
5245: <P>
5246: <STRONG>Example:</STRONG></P>
5247: <P>
1.3 cvs 5248: The following rules prevent widows and orphans in a paragraph:</P>
1.1 cvs 5249: <PRE>
5250: Paragraph :
5251: BEGIN
5252: NoBreak1 : 2;
5253: NoBreak2 : 2;
5254: END;
5255: </PRE>
5256: <P>
1.3 cvs 5257: This rule prevents a section title from becoming separated from the first
5258: paragraph of the section by prohibiting page breaks at the beginning of the
1.1 cvs 5259: section rule:</P>
5260: <PRE>
5261: Section :
5262: NoBreak1 : 1.5 cm;
5263: </PRE>
5264: <P>
5265: Finally, this rule prevents a figure from being page broken in any way:</P>
5266: <PRE>
5267: Figure :
5268: PageBreak : No;
5269: </PRE>
5270: </BLOCKQUOTE>
5271: <P>
5272: The Thot editor constructs the document images displayed on the screen
5273: dynamically. As the user moves in the document or makes the document scroll
5274: in a window, the editor constructs the image to be displayed in little bits,
5275: filling the gaps which are produced in the course of these operations. It
5276: stops filling in the image when an element reaches the edge of the window in
5277: which the gap appears. If the appearance of the document is complex, it is
5278: possible that the image in incomplete, even though the edge of the window was
5279: reached. For example, an element might need to be presented to the side of
5280: the last element displayed, but its image was not constructed. The user will
5281: not know whether the element is really absent or if its image has simply not
5282: been constructed.</P>
5283: <P>
5284: The <TT>Gather</TT> rule is used to remedy this problem. When the rule
5285: <TT>Gather : Yes;</TT> is associated with an element type, the image of such
5286: elements is constructed as a block by the editor: it is never split up.</P>
5287: <P>
5288: The <TT>Gather</TT> rule may not appear in the <A
1.6 cvs 5289: href="#sectc427">default rules</A>. Elements which do not have the
1.1 cvs 5290: <TT>Gather</TT> rule are considered susceptible to being split up during
5291: display. Thus, it is not necessary to use the <TT>Gather : No;</TT> form.
5292: This rule must be used prudently and only for those elements which truly need
5293: it. If used incorrectly, it can pointlessly increase the size of the image
5294: constructed by the editor and lead to excessive memory consumption by the
5295: editor.</P>
5296: <P>
5297: Like the <TT>PageBreak</TT> and <TT>LineBreak</TT> rules, the <TT>Gather</TT>
5298: rule can only appear in rules of the primary view and applies to all views
5299: defined in the presentation schema.</P>
5300: <PRE>
5301: 'Gather' ':' Boolean .
5302: </PRE>
5303: </DIV>
5304:
5305: <DIV class="subsection">
1.6 cvs 5306: <H3><A name=sectc4224>Visibility</A></H3>
1.1 cvs 5307:
5308: <P>
5309: The visibility parameter is used to control which elements should or should
5310: not be displayed, based on context. An element can have different
5311: visibilities in different views. If an element's visibility is zero for a
5312: view, that element is not displayed in that view and does not occupy any space
5313: (its extents are zero).</P>
5314: <P>
5315: Visibility takes non-negative integer values (positive or zero). If values
5316: greater than 1 are used, they allow the user to choose a degree of visibility
5317: and, thus, to see only those boxes whose visibility parameter exceeds a
5318: certain threshold. This gives the user control over the granularity of the
1.2 cvs 5319: displayed pictures.</P>
1.1 cvs 5320: <P>
5321: The visibility parameter can be defined as a constant or by inheritance. If
5322: defined by inheritance, it cannot be based on the value of the next or
5323: previous box. Visibility can only be inherited from above.</P>
5324: <P>
5325: If it is a numeric attribute's presentation rule, the visibility can be
5326: specified by the attribute's name, in which case the value of the attribute is
5327: used.</P>
5328: <PRE>
1.6 cvs 5329: 'Visibility' ':' NumberInherit
1.1 cvs 5330: NumberInherit = Integer / AttrID / Inheritance .
1.6 cvs 5331: Integer = NUMBER .
1.1 cvs 5332: </PRE>
5333: <BLOCKQUOTE class="example">
5334: <P>
5335: <STRONG>Example:</STRONG></P>
5336: <P>
1.3 cvs 5337: Suppose that only <TT>Formula</TT> elements should be displayed in
5338: the <TT>MathView</TT> view. Then, the default rules should include:</P>
1.1 cvs 5339: <PRE>
5340: DEFAULT
5341: IN MathView Visibility:0;
5342: </PRE>
5343: <P>
1.3 cvs 5344: which makes all elements invisible in the <TT>MathView</TT> view. However, the
5345: <TT>Formula</TT> element also has a <TT>Visibility</TT> rule:</P>
1.1 cvs 5346: <PRE>
5347: Formula :
5348: IN MathView Visibility:5;
5349: </PRE>
5350: <P>
5351: which makes formulas, and only formulas, visible.</P>
5352: </BLOCKQUOTE>
5353: </DIV>
5354:
5355: <DIV class="subsection">
1.6 cvs 5356: <H3><A name=sectc4225>Character style parameters</A></H3>
1.1 cvs 5357:
5358: <P>
5359: Four parameters are used to determine which characters are used to display
5360: text. They are size, font, style, and underlining.</P>
5361:
5362: <DIV class="subsubsection">
1.6 cvs 5363: <H4><A name=sectd42251>Character size</A></H4>
1.1 cvs 5364:
5365: <P>
5366: The size parameter has two effects. First, it is used to specify the actual
1.6 cvs 5367: size and distance units for boxes defined in <A href="#sectc4217">relative
1.1 cvs 5368: units</A>. Second, it defines the size of the characters contained in the
5369: box.</P>
5370: <P>
5371: As a distance or length, the size can be expressed in abstract or absolute
5372: units. It can also be inherited. If it is not inherited, it is expressed
5373: simply as an integer followed by the <TT>pt</TT> keyword, which indicates that
5374: the size is expressed in typographer's points. The absence of the <TT>pt</TT>
5375: keyword indicates that it is in abstract units in which the value 1 represents
5376: the smallest size while the value 16 is the largest size. The relationship
5377: between these abstract sizes and the real character sizes is controlled by a
5378: table which can be modified statically or even dynamically during the
5379: execution of the Thot editor.</P>
5380: <P>
5381: If it is a numeric attribute's presentation rule, the value of the size
5382: parameter can be specified by the attribute's name, in which case the value of
5383: the attribute is used.</P>
5384: <P>
5385: <STRONG>Note:</STRONG> the only unit available for defining an absolute size
5386: is the typographer's point. Centimeters and inches may not be used.</P>
5387: <P>
5388: If the size is inherited, the rule must specify the relative from which to
5389: inherit and any difference from that relative's value. The difference can be
5390: expressed in either typographer's points or in abstract units. The maximum or
5391: minimum size can also be specified, but without specifying the type of unit:
5392: it is the same as was specified for the difference.</P>
5393: <P>
5394: In a numeric attribute's presentation rule, the difference in size can be
5395: indicated by the attribute's name, which means that the attribute's value
5396: should be used as the difference. The attribute can also be used as the
5397: minimum or maximum size.</P>
5398: <PRE>
5399: 'Size' ':' SizeInherit
5400: SizeInherit = SizeAttr [ 'pt' ] /
5401: Kinship InheritedSize .
5402: InheritedSize ='+' SizeAttr [ 'pt' ]
5403: [ 'Max' MaxSizeAttr ] /
5404: '-' SizeAttr [ 'pt' ]
5405: [ 'Min' MinSizeAttr ] /
5406: '=' .
1.6 cvs 5407: SizeAttr = Size / AttrID .
5408: Size = NUMBER .
5409: MaxSizeAttr = MaxSize / AttrID .
5410: MaxSize = NUMBER .
5411: MinSizeAttr = MinSize / AttrID .
5412: MinSize = NUMBER .
1.1 cvs 5413: </PRE>
5414: <BLOCKQUOTE class="example">
5415: <P>
5416: <STRONG>Example:</STRONG></P>
5417: <P>
5418: The rule</P>
5419: <PRE>
5420: Size : Enclosing - 2 pt Min 7;
5421: </PRE>
5422: <P>
1.3 cvs 5423: states that the character size is 2 points less than that of the enclosing box,
5424: but that it may not be less than 7 points, whatever the enclosing box's
1.1 cvs 5425: value.</P>
5426: <P>
5427: The following rules make the text of a report be displayed with medium-sized
5428: characters (for example, size 5), while the title is displayed with larger
5429: characters and the summary is displayed with smaller characters:</P>
5430: <PRE>
5431: Report :
5432: Size : 5;
5433: Title :
5434: Size : Enclosing + 2;
5435: Summary :
5436: Size : Enclosing - 1;
5437: </PRE>
5438: <P>
1.4 cvs 5439: Thus, the character sizes in the entire document can be changed by changing the
5440: size parameter of the Report element, while preserving the relationships
1.1 cvs 5441: between the sizes of the different elements.</P>
5442: </BLOCKQUOTE>
5443: </DIV>
5444:
5445: <DIV class="subsubsection">
1.6 cvs 5446: <H4><A name=sectd42252>Font and character style</A></H4>
1.1 cvs 5447:
5448: <P>
5449: The <TT>Font</TT> rule determines the font family to be used to display the
5450: characters contained in the box, while the <TT>Style</TT> rule determines
5451: their style. Thot recognizes three character fonts (Times, Helvetica, and
5452: Courier) and six styles: Roman, Italics, Bold, BoldItalics, Oblique, and
5453: BoldOblique.</P>
5454: <P>
5455: The font family and style can specified by a named constant or can be
5456: inherited. For the name of the font family only the first character is
5457: used.</P>
5458: <P>
5459: Only identical inheritance is allowed: the box takes the same font or style as
5460: the box from which it inherits. This is indicated by an equals sign after the
5461: kinship specification.</P>
5462: <BLOCKQUOTE class="example">
5463: <P>
5464: <STRONG>Example:</STRONG></P>
5465: <P>
1.3 cvs 5466: To specify that the summary uses the font family of the rest of the document,
1.1 cvs 5467: but in the italic style, the following rules are used:</P>
5468: <PRE>
5469: Summary :
5470: BEGIN
5471: Font : Enclosing =;
5472: Style : Italics;
5473: END;
5474: </PRE>
5475: </BLOCKQUOTE>
5476: </DIV>
5477:
5478: <DIV class="subsubsection">
1.6 cvs 5479: <H4><A name=sectd42253>Underlining</A></H4>
1.1 cvs 5480:
5481: <P>
5482: The <TT>Underline</TT> rule is used to specify if the characters contained in
5483: a box should have lines drawn on or near them. There are four underlining
5484: styles: <TT>Underlined</TT>, <TT>Overlined</TT>, <TT>CrossedOut</TT>, and
5485: <TT>NoUnderline</TT>. The <TT>Thickness</TT> rule specifies the thickness of
5486: the line, <TT>Thin</TT> or <TT>Thick</TT>.</P>
5487: <P>
5488: As with font family and style, only identical inheritance is allowed: the box
5489: has the same underlining type as the box from which it inherits the value.
5490: This is indicated by an equals sign after the kinship specification.</P>
5491: <PRE>
5492: 'Underline' ':' UnderLineInherit /
5493: 'Thickness' ':' ThicknessInherit /
5494:
5495: UnderLineInherit = Kinship '=' / 'NoUnderline' /
5496: 'Underlined' /
5497: 'Overlined' / 'CrossedOut' .
5498: ThicknessInherit = Kinship '=' / 'Thick' / 'Thin' .
5499: </PRE>
5500: </DIV>
5501: </DIV>
5502:
5503: <DIV class="subsection">
1.6 cvs 5504: <H3><A name=sectc4226>Stacking order</A></H3>
1.1 cvs 5505:
5506: <P>
5507: The <TT>Depth</TT> rule is used to define the stacking order of terminal boxes
5508: when multiple boxes at least partially overlap. This rule defines how the
5509: depth parameter, which is zero or a positive integer, is calculated. The
5510: depth parameter has a value for all boxes. For terminal boxes in the
5511: structure and for presentation boxes, the depth value is used during display
5512: and printing: the boxes with the lowest value overlap those with higher
5513: depths. For non-terminal boxes, the depth is not interpreted during display,
5514: but it is used to calculate the depth of terminal boxes by inheritance.</P>
5515: <P>
5516: Like most other rules, the depth rule is defined in the <A
1.6 cvs 5517: href="#sectc427">default rules</A> of each presentation schema. Thus,
1.1 cvs 5518: there is always a depth value, even when it is not necessary because there is
5519: no overlapping. To avoid useless operations, a zero value can be given to the
5520: depth parameter, which signifies that overlapping is never a problem.</P>
5521: <P>
1.6 cvs 5522: The depth rule has the same form as the <A href="#sectc4224">visibility rule</A>.
1.1 cvs 5523: It can be defined by inheritance or by a constant numeric value. When the rule
5524: is attached to a numeric attribute, it can take the value of that
5525: attribute.</P>
5526: <PRE>
5527: 'Depth' ':' NumberInherit
5528: </PRE>
5529: <BLOCKQUOTE class="example">
5530: <P>
5531: <STRONG>Example:</STRONG></P>
5532: <P>
1.3 cvs 5533: For a purely textual document, in which overlapping never poses a problem, a
1.5 cvs 5534: single default <TT>Depth</TT> rule in the presentation schema is
5535: sufficient:</P>
1.1 cvs 5536: <PRE>
5537: DEFAULT
5538: Depth : 0;
5539: ...
5540: </PRE>
5541: <P>
5542: To make the text of examples appear on a light blue background, a presentation
5543: box is defined:</P>
5544: <PRE>
5545: BOXES
5546: BlueBG :
5547: BEGIN
5548: Content : Graphics 'R';
5549: Background : LightBlue3;
5550: FillPattern: backgroundcolor;
5551: Depth : 2;
5552: ...
5553: END;
5554: </PRE>
5555: <P>
1.3 cvs 5556: and is created by the <TT>Example</TT> element, which has the rules:</P>
1.1 cvs 5557: <PRE>
5558: RULES
5559: Example :
5560: BEGIN
5561: CreateFirst (BlueBG);
5562: Depth : 1;
5563: ...
5564: END;
5565: </PRE>
5566: <P>
5567: In this way, the text of an example (if it inherits its depth from
1.5 cvs 5568: its ancestor) will be superimposed on a light blue background, and not
5569: the reverse).</P>
1.1 cvs 5570: </BLOCKQUOTE>
5571: </DIV>
5572:
5573: <DIV class="subsection">
1.13 ! cvs 5574: <H3><A name=sectc4227>Line style</A></H3>
1.1 cvs 5575:
5576: <P>
5577: The <TT>LineStyle</TT> rule determines the style of line which should be used
1.13 ! cvs 5578: to draw all the elements contained in the box and the box itself, if it has
! 5579: a <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>. The line style can be
1.1 cvs 5580: indicated by a name (<TT>Solid</TT>, <TT>Dashed</TT>, <TT>Dotted</TT>) or it
1.13 ! cvs 5581: can be inherited. All elements of the graphic base type are affected by this
1.1 cvs 5582: rule, but it can be attached to any box and transmitted by inheritance to the
1.13 ! cvs 5583: graphic elements. The border of elements having a
! 5584: <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>
! 5585: is drawn according to the line style specified by this rule.<P>
1.1 cvs 5586: Only identical inheritance is allowed: the box takes the same line style as
5587: the box from which it inherits. This is indicated by an equals sign after the
5588: kinship specification.</P>
5589: <PRE>
5590: 'LineStyle' ':' LineStyleInherit
5591: LineStyleInherit = Kinship '=' /
5592: 'Solid' / 'Dashed' / 'Dotted' .
5593: </PRE>
5594: <BLOCKQUOTE class="example">
5595: <P>
5596: <STRONG>Example:</STRONG></P>
5597: <P>
1.3 cvs 5598: To specify that, in Figures, the graphical parts should be drawn in solid
5599: lines, the Figure element is given a rule using the <TT>Solid</TT> name:</P>
1.1 cvs 5600: <PRE>
5601: Figure :
5602: LineStyle : Solid;
5603: </PRE>
5604: <P>
5605: and the elements composing figures are given an inheritance rule:</P>
5606: <PRE>
5607: LineStyle : Enclosing =;
5608: </PRE>
5609: </BLOCKQUOTE>
5610: </DIV>
5611:
5612: <DIV class="subsection">
1.6 cvs 5613: <H3><A name=sectc4228>Line thickness</A></H3>
1.1 cvs 5614:
5615: <P>
5616: The <TT>LineWeight</TT> rule determines the thickness of the lines of all
5617: graphical elements which appear in the box, no matter what their line style.
5618: Line thickness can be specified by a constant value or by inheritance. A
5619: constant value is a positive number followed by an optional unit specification
5620: (which is absent when using relative units). All available <A
1.6 cvs 5621: href="#sectc4217">distance units</A> can be used. Line thickness is expressed
5622: in the same way as <A href="#sectd42221">line spacing</A>.</P>
1.1 cvs 5623: <PRE>
5624: 'LineWeight' ':' DistOrInherit
5625: </PRE>
5626: <P>
1.13 ! cvs 5627: All elements of the graphic base type are affected by this rule, but it can
1.1 cvs 5628: be attached to any box and transmitted by inheritance to the graphic
1.13 ! cvs 5629: elements. The border of element having a <A href="#sectc4230a"><TT>ShowBox</TT>
! 5630: rule</A> is also drawn according to the thickness specified by this rule.</P>
1.1 cvs 5631: <BLOCKQUOTE class="example">
5632: <P>
5633: <STRONG>Example:</STRONG></P>
5634: <P>
1.3 cvs 5635: To specify that, in Figures, the graphical parts should be drawn with lines 0.3
1.1 cvs 5636: pt thick, the Figure element is given this rule:</P>
5637: <PRE>
5638: Figure :
5639: LineWeight : 0.3 pt;
5640: </PRE>
5641: <P>
5642: and the elements composing figures are given an inheritance rule:</P>
5643: <PRE>
5644: LineWeight : Enclosing =;
5645: </PRE>
5646: </BLOCKQUOTE>
5647: </DIV>
5648:
5649: <DIV class="subsection">
1.6 cvs 5650: <H3><A name=sectc4229>Fill pattern</A></H3>
1.1 cvs 5651:
5652: <P>
5653: The <TT>FillPattern</TT> rule determines the pattern used to fill closed
5654: graphical elements (circles, rectangles, etc.) which appear in the box. This
1.13 ! cvs 5655: rule also specifies the pattern used to fill the box associated with
! 5656: elements having a <A href="#sectc4230a"><TT>ShowBox</TT> rule<A>. This
1.1 cvs 5657: pattern can be indicated by a named constant or by inheritance. The named
5658: constant identifies one of the patterns available in Thot. The names of the
5659: available patterns are: nopattern, foregroundcolor, backgroundcolor, gray1,
5660: gray2, gray3, gray4, gray5, gray6, gray7, horiz1, horiz2, horiz3, vert1,
5661: vert2, vert3, left1, left2, left3, right1, right2, right3, square1, square2,
5662: square3, lozenge, brick, tile, sea, basket.</P>
5663: <P>
5664: Like the other rules peculiar to graphics, <TT>LineStyle</TT> and
5665: <TT>LineWeight</TT>, only elements of the graphic base type are affected by
5666: the <TT>FillPattern</TT> rule, but the rule can be attached to any box and
5667: transmitted by inheritance to the graphic elements. As with the other rules
5668: specific to graphics, only identical inheritance is allowed.</P>
5669: <P>
5670: The <TT>FillPattern</TT> rule can also be used to determine whether or not
1.12 cvs 5671: text characters, symbols and pictures should be colored. For these element
5672: types (text, symbols, and pictures), the only valid values are
5673: <TT>nopattern</TT>, <TT>foregroundcolor</TT>, and
5674: <TT>backgroundcolor</TT>. When <TT>FillPattern</TT> has the value
1.1 cvs 5675: <TT>backgroundcolor</TT>, text characters, symbols, and bitmaps are given the
1.6 cvs 5676: color specified by the <A href="#sectc4230"><TT>Background</TT> rule</A> which
1.1 cvs 5677: applies to these elements. When <TT>FillPattern</TT> has the value
5678: <TT>foregroundcolor</TT>, these same elements are given the color specified by
1.6 cvs 5679: the <A href="#sectc4230"><TT>Foreground</TT> rule</A> which applies to these
1.1 cvs 5680: elements. In all other case, text characters are not colored.</P>
5681: <PRE>
5682: 'FillPattern' ':' NameInherit
5683: </PRE>
5684: <BLOCKQUOTE class="example">
5685: <P>
5686: <STRONG>Example:</STRONG></P>
5687: <P>
1.3 cvs 5688: To specify that, in Figures, the closed graphical elements should be filled
5689: with a pattern resembling a brick wall, the Figure element is given this
1.1 cvs 5690: rule:</P>
5691: <PRE>
5692: Figure :
5693: FillPattern : brick;
5694: </PRE>
5695: <P>
5696: and the elements composing figures are given an inheritance rule:</P>
5697: <PRE>
5698: FillPattern : Enclosing =;
5699: </PRE>
5700: </BLOCKQUOTE>
5701: </DIV>
5702:
5703: <DIV class="subsection">
1.6 cvs 5704: <H3><A name=sectc4230>Colors</A></H3>
1.1 cvs 5705:
5706: <P>
5707: The <TT>Foreground</TT> and <TT>Background</TT> rules determine the foreground
1.13 ! cvs 5708: and background colors of the base elements which appear in the box. They also
! 5709: control the color of boxes associated with elements having a
! 5710: <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>. These
! 5711: colors can be specified with a named constant or by inheritance. The named
1.1 cvs 5712: constants specify one of the available colors in Thot. The available color
5713: names can be found in the file <TT>thot.color</TT>.</P>
5714: <P>
1.13 ! cvs 5715: The color rules affect the same way all base elements and elements having a
! 5716: <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>,
! 5717: no matter what their type (text, graphics, pictures,
! 5718: symbols). The color rules can be associated with any box and can be
! 5719: transmitted by inheritance to the base elements or the elements having
! 5720: a <A href="#sectc4230a"><TT>ShowBox</TT> rule</A>. Like the preceding rules,
! 5721: only inheritance of the same value is allowed.</P>
1.1 cvs 5722: <PRE>
5723: 'Foreground' ':' NameInherit
5724: 'Background' ':' NameInherit
5725: </PRE>
5726: <P>
5727: <STRONG>Note:</STRONG> text colors only appear for text elements whose <A
1.6 cvs 5728: href="#sectc4229">fill pattern</A> does not prevent the use of color.</P>
1.1 cvs 5729: <BLOCKQUOTE class="example">
5730: <P>
5731: <STRONG>Example:</STRONG></P>
5732: <P>
1.3 cvs 5733: To specify that, in Figures, everything must be drawn in blue on a background
1.5 cvs 5734: of yellow, the Figure element is given these rules:</P>
1.1 cvs 5735: <PRE>
5736: Figure :
5737: BEGIN
5738: Foreground : Blue;
5739: Background : Yellow;
5740: Fillpattern : backgroundcolor;
5741: END;
5742: </PRE>
5743: <P>
5744: and the elements composing figures are given inheritance rules:</P>
5745: <PRE>
5746: Foreground : Enclosing =;
5747: Background : Enclosing =;
5748: FillPattern : Enclosing =;
5749: </PRE>
5750: </BLOCKQUOTE>
5751: </DIV>
5752:
5753: <DIV class="subsection">
1.13 ! cvs 5754: <H3><A name=sectc4230a>Background color and border</A></H3>
! 5755:
! 5756: <P>
! 5757: Boxes associated with structural elements are normally not visible, but it
! 5758: is possible to draw their border and/or to paint their area when it is needed.
! 5759: This is achieved by associating the <TT>ShowBox</TT> rule with the concerned
! 5760: element. This rule has no parameter and no value. It is simply written
! 5761: <TT>Showbox;</TT>. It is not inherited nor transmitted to any other element.
! 5762: It applies only to the element with which it is associated.</P>
! 5763: <PRE>
! 5764: 'ShowBox'
! 5765: </PRE>
! 5766: <P>
! 5767: When an element has a <TT>ShowBox</TT> rule, the border is drawn only if
! 5768: the <TT>LineWeight</TT> rule that applies to that element has a non-zero
! 5769: value (this value can be inherited). The color, style and thickness of the
! 5770: border are defined by the <TT>Foreground</TT>, <TT>LineStyle</TT>, and
! 5771: <TT>LineWeight</TT> rules that apply to the element.</P>
! 5772: <P>
! 5773: When an element has a <TT>ShowBox</TT> rule, the background of this element
! 5774: is paint only if the value of the <TT>FillPattern</TT> rule that applies to
! 5775: that element is not <TT>nopattern</TT>. The pattern and color(s) of the
! 5776: background are defined by the <TT>FillPattern</TT>, <TT>Background</TT>, and
! 5777: <TT>Foreground</TT> rules that apply to the element.</P>
! 5778: </DIV>
! 5779:
! 5780: <DIV class="subsection">
! 5781: <H3><A name=sectc4230b>Background pictures</A></H3>
! 5782:
! 5783: <P>
! 5784: The <TT>BackgroundPicture</TT> rule allows to display a picture as the
! 5785: background of an element. It has a single parameter, the file name of the
! 5786: picture. This is a string delimited by single quotes. If the first
! 5787: character in this string is '/', it is considered as an absolute path,
! 5788: otherwise the file is searched for along the schema directory
! 5789: path. This file may contain a picture in any format accepted by
! 5790: Thot (xbm, xpm, gif, jpeg, png, etc.)</P>
! 5791: <P>
! 5792: The <TT>BackgroundPicture</TT> and <TT>PictureMode</TT> rules apply only to
! 5793: the element with which they are associated. They are not inherited nor
! 5794: transmitted to children elements.</P>
! 5795: <P>
! 5796: The background picture has not always the same size as the element's box.
! 5797: There are diffrent ways to fill the element box with the picture. This is
! 5798: specified by the <TT>PictureMode</TT> rule, which should be associated to
! 5799: the same element. This rule may take one of the following values:</P>
! 5800: <DL>
! 5801: <DT><TT>NormalSize</TT>
! 5802: <DD>The picture is centered in the box, and clipped if it is too large.
! 5803:
! 5804: <DT><TT>Scale</TT>
! 5805: <DD>The picture is zoomed to fit the box size.
! 5806:
! 5807: <DT><TT>RepeatX</TT>
! 5808: <DD>The picture is repeated horizontally to fit the box width.
! 5809:
! 5810: <DT><TT>RepeatY</TT>
! 5811: <DD>The picture is repeated vertically to fit the box height.
! 5812:
! 5813: <DT><TT>RepeatXY</TT>
! 5814: <DD>The picture is repeated both horizontally and vertically to fill the box.
! 5815: </DL>
! 5816: <P>
! 5817: If an element has a <TT>BackgroundPicture</TT> rule and no <TT>PictureMode</TT>
! 5818: rule, the <TT>NormalSize</TT> value is assumed.</P>
! 5819: <PRE>
! 5820: 'BackgroundPicture' ':' FileName /
! 5821: 'PictureMode' ':' PictMode .
! 5822:
! 5823: FileName = STRING .
! 5824: PictMode = 'NormalSize' / 'Scale' / 'RepeatXY' / 'RepeatX' / 'RepeatY' .
! 5825: </PRE>
! 5826: <P>
! 5827: The <TT>BackgroundPicture</TT> and <TT>PictureMode</TT> rules apply only to
! 5828: the element with which they are associated. They are not inherited nor
! 5829: transmitted to children elements.</P>
! 5830: </DIV>
! 5831:
! 5832: <DIV class="subsection">
1.6 cvs 5833: <H3><A name=sectc4231>Presentation box content</A></H3>
1.1 cvs 5834:
5835: <P>
5836: The <TT>Content</TT> rule applies to presentation boxes. It indicates the
5837: content given to a box. This content is either a variable's value or a
1.6 cvs 5838: constant value. In the special case of <A href="#sectc4233">header or footer
1.1 cvs 5839: boxes</A>, the content can also be a structured element type.</P>
5840: <P>
5841: If the content is a constant, it can be specified, as in a variable
5842: declaration, either by the name of a constant declared in the <TT>CONST</TT>
5843: section or by direct specification of the type and value of the box's
5844: content.</P>
5845: <P>
5846: Similarly, if it is a variable, the name of a variable declared in
5847: <TT>VAR</TT> section can be given or the variable may be defined within
5848: parentheses. The content inside the parentheses has the same syntax as a <A
1.6 cvs 5849: href="#sectc426">variable declaration</A>.</P>
1.1 cvs 5850: <P>
5851: When the content is a structured element type, the name of the element type is
5852: given after the colon. In this case, the box's content is all elements of
5853: the named type which are designated by references which are part of the page
5854: on which the header or footer with this <TT>Content</TT> rule appears. Only
5855: associated elements can appear in a <TT>Content</TT> rule and the structure
5856: must provide references to these elements. Moreover, the box whose content
5857: they are must be a header or footer box generated by a page box of the primary
5858: view.</P>
5859: <PRE>
5860: 'Content' ':' VarConst
5861: VarConst = ConstID / ConstType ConstValue /
5862: VarID / '(' FunctionSeq ')' /
5863: ElemID .
5864: </PRE>
5865: <P>
5866: A presentation box can have only one <TT>Content</TT> rule, which means that
5867: the content of a presentation box cannot vary from view to view. However, such
5868: an effect can be achieved by creating several presentation boxes, each with
5869: different content and visible in different views.</P>
5870: <P>
5871: The <TT>Content</TT> rule also applies to elements defined as references in
5872: the structure schema. In this case, the content defined by the rule must be
5873: a constant. It is this content which appears on the screen or paper to
5874: represent references of the type to which the rule applies. A reference can
1.6 cvs 5875: have a <TT>Content</TT> rule or a <A href="#sectc4234"><TT>Copy</TT> rule</A>
1.1 cvs 5876: for each view. If neither of these rules appears, the reference is displayed
5877: as <TT>[*]</TT>, which is equivalent to the rule:</P>
5878: <PRE>
5879: Content: Text '[*]';
5880: </PRE>
5881: <BLOCKQUOTE class="example">
5882: <P>
5883: <STRONG>Example:</STRONG></P>
5884: <P>
1.3 cvs 5885: The content of the presentation box created to make the chapter number and
5886: section number appear before each section title can be defined by:</P>
1.1 cvs 5887: <PRE>
5888: BOXES
5889: SectionNumBox :
5890: BEGIN
5891: Content : NumSection;
5892: ...
5893: END;
5894: </PRE>
5895: <P>
1.5 cvs 5896: if the <TT>NumSection</TT> variable has been defined in the variable definition
1.3 cvs 5897: section of the presentation schema. Otherwise the <TT>Content</TT> would be
1.1 cvs 5898: written:</P>
5899: <PRE>
5900: BOXES
5901: SectionNumBox :
5902: BEGIN
5903: Content : (VALUE (ChapterCtr, Roman) TEXT '.'
5904: VALUE (SectionCtr, Arabic));
5905: ...
5906: END;
5907: </PRE>
5908: <P>
5909: To specify that a page footer should contain all elements of the <TT>Note</TT>
5910: type are referred to in the page, the following rule is written:</P>
5911: <PRE>
5912: BOXES
5913: NotesFooterBox :
5914: BEGIN
5915: Content : Note;
5916: ...
5917: END;
5918: </PRE>
5919: <P>
1.5 cvs 5920: <TT>Note</TT> is defined as an associated element in the structure schema and
1.1 cvs 5921: NotesFooterBox is created by a page box of the primary view.</P>
5922: </BLOCKQUOTE>
5923: </DIV>
5924:
5925: <DIV class="subsection">
1.6 cvs 5926: <H3><A name=sectc4232>Presentation box creation</A></H3>
1.1 cvs 5927:
5928: <P>
5929: A creation rule specifies that a presentation box should be created when an
5930: element of the type to which the rule is attached appears in the document.</P>
5931: <P>
5932: A keyword specifies the position, relative to the creating box, at which the
5933: created box will be placed in the structure:</P>
5934: <DL>
5935: <DT><TT>CreateFirst</TT></DT>
1.2 cvs 5936: <DD>specifies that the box should be created as the first box of the next lower
5937: level, before any already existing boxes, and only if the beginning of the
1.1 cvs 5938: creating element is visible;
5939: </DD>
5940: <DT><TT>CreateLast</TT></DT>
1.2 cvs 5941: <DD>specifies that the box should be created as the last box of the next lower
5942: level, after any existing boxes, and only if the end of the creating element is
1.1 cvs 5943: visible;
5944: </DD>
5945: <DT><TT>CreateBefore</TT></DT>
1.2 cvs 5946: <DD>specifies that the box should be created before the creating box, on the
5947: same level as the creating box, and only if the beginning of the creating
1.1 cvs 5948: element is visible;
5949: </DD>
5950: <DT><TT>CreateAfter</TT></DT>
1.2 cvs 5951: <DD>specifies that the box should be created after the creating box, on the
5952: same level as the creating box, and only if the beginning of the creating
1.1 cvs 5953: element is visible;
5954: </DD>
5955: <DT><TT>CreateEnclosing</TT></DT>
1.2 cvs 5956: <DD>specifies that the box should be created at the upper level relatively to
5957: the creating box, and that it must contain that creating box and all
5958: presentation boxes created by the same creating box.
1.1 cvs 5959: </DD>
5960: </DL>
5961: <P>
5962: This keyword can be followed by the <TT>Repeated</TT> keyword to indicate that
5963: the box must be created for each part of the creating element. These parts
5964: result from the division of the element by page breaks or column changes. If
5965: the <TT>Repeated</TT> keyword is missing, the box is only created for the
5966: first part of the creating element (<TT>CreateFirst</TT> and
5967: <TT>CreateBefore</TT> rules) or for the last part (<TT>CreateLast</TT> and
5968: <TT>CreateAfter</TT> rules).</P>
5969: <P>
5970: The type of presentation to be created is specified at the end of the rule
5971: between parentheses.</P>
5972: <P>
1.6 cvs 5973: Creation rules cannot appear in the <A href="#sectc427">default
1.1 cvs 5974: presentation rules</A>. The boxes being created should have a
5975: <TT>Content</TT> rule which indicates their <A
1.6 cvs 5976: href="#sectc4231">content</A>.</P>
1.1 cvs 5977: <P>
5978: Creation rules can only appear in the block of rules for the primary view;
5979: creation is provoked by a document element for all views. However, for each
5980: view, the presentation box is only created if the creating element is itself a
5981: box in the view. Moreover, the visibility parameter of the presentation box
5982: can be adjusted to control the creation of the box on a view-by-view
5983: basis.</P>
5984: <PRE>
5985: Creation '(' BoxID ')'
5986: Creation = Create [ 'Repeated' ] .
5987: Create ='CreateFirst' / 'CreateLast' /
5988: 'CreateBefore' / 'CreateAfter' /
5989: 'CreateEnclosing' .
5990: </PRE>
5991: <BLOCKQUOTE class="example">
5992: <P>
5993: <STRONG>Example:</STRONG></P>
5994: <P>
1.3 cvs 5995: Let us define an object type, called Table, which is composed of a sequence of
5996: columns, all having the same fixed width, where the columns are separated by
5997: vertical lines. There is a line to the left of the first column and one to the
5998: right of the last. Each column has a variable number of cells, placed one on
5999: top of the other and separated by horizontal lines. There are no horizontal
6000: lines above the first cell or below the last cell. The text contained in
1.5 cvs 6001: each cell is broken into lines and these lines are centered horizontally in
6002: the cell. The logical structure of this object is defined by:</P>
1.1 cvs 6003: <PRE>
6004: Table = LIST OF (Column);
6005: Column = LIST OF (Cell = Text);
6006: </PRE>
6007:
6008: <DIV class="figure">
6009: <HR>
6010: <PRE>
6011: | | | |
6012: | xx xxxx xxxx |x xxxx xxx xxxxx| x xxx x xxx |
6013: | xxx xxx xxxx x | x xx x xxx | xxxxx xxxx xx |
6014: | xxxxx xxxx |----------------| xxx xxxxx x |
6015: | xxxxx xxx xxxx | xxxx xx xx xxx | xx xx |
6016: | xxx xxxx x xxx | xxxx x xxx x |---------------|
6017: |----------------| xxx xxxx xxxxx | xxxxx xxxxx |
6018: | xxx xxx xxxxxx |----------------| xxx xxxx xxxx |
6019: | xxxx xxxx xx | xxxx xx x xx | xxx xx x xx |
6020: |----------------| xxx xxxxx xxxx | xxxx xxxx xxx |
6021: | xxxxx xxx xxxx | xxxx xx x xx | xxxxx xxx |
6022: |xxxx xx x xxxxxx| xxxx xx xxxxxx | xxxxx xxxxx |
6023: </PRE>
6024: <P align=center>
6025: <EM><A name="table">The design of a table</A></EM></P>
6026: <HR>
6027: </DIV>
6028: <P>
6029: The presentation of the table should resemble the design of the above <A
6030: href="#table">figure</A>. It is defined by the following presentation schema
6031: fragment:</P>
6032: <PRE>
6033: BOXES
6034: VertLine : BEGIN
6035: Width : 0.3 cm;
6036: Height : Enclosing . Height;
6037: VertPos : Top = Enclosing . Top;
6038: HorizPos : Left = Previous . Right;
6039: Content : Graphics 'v';
6040: END;
6041:
6042: HorizLine: BEGIN
6043: Width : Enclosing . Width;
6044: Height : 0.3 cm;
6045: VertPos : Top = Previous . Bottom;
6046: HorizPos : Left = Enclosing . Left;
6047: Content : Graphics 'h';
6048: END;
6049:
6050: RULES
1.6 cvs 6051: Column : BEGIN
6052: CreateBefore (VertLine);
6053: IF LAST CreateAfter (VertLine);
6054: Width : 2.8 cm;
6055: Height : Enclosed . Height;
6056: VertPos : Top = Enclosing . Top;
6057: HorizPos : Left = Previous . Right;
6058: END;
6059:
6060: Cell : BEGIN
6061: IF NOT FIRST CreateBefore (HorizLine);
6062: Width : Enclosing . Width;
6063: Height : Enclosed . Height;
6064: VertPos : Top = Previous . Bottom;
6065: HorizPos : Left = Enclosing . Left;
6066: Line;
6067: Adjust : VMiddle;
6068: END;
1.1 cvs 6069: </PRE>
6070: <P>
6071: It is useful to note that the horizontal position rule of the first vertical
6072: line will not be applied, since there is no preceding box. In this case, the
6073: box is simply placed on the left side of the enclosing box.</P>
6074: </BLOCKQUOTE>
6075: </DIV>
6076:
6077: <DIV class="subsection">
1.6 cvs 6078: <H3><A name=sectc4233>Page layout</A></H3>
1.1 cvs 6079:
6080: <P>
6081: The page models specified in the <TT>Page</TT> rule are defined by boxes
6082: declared in the <TT>BOXES</TT> section of the presentation schema. Pages are
6083: not described as frames which will be filled by the document's text, but as
6084: element are inserted in the flow of the document and which mark the page
6085: breaks. Each of these page break elements contains presentation boxes which
6086: represent the footer boxes of a page followed by header boxes of the next
6087: page. The page box itself is the simple line which separates two pages on the
6088: screen. Both the footer and header boxes placed themselves with respect to
6089: this page box, with the footer being placed above it and the header boxes
6090: being placed above it.</P>
6091: <P>
6092: The boxes created by a page box are headers and footers and can only place
6093: themselves vertically with respect to the page box itself (which is in fact
6094: the separation between two pages). Besides, it is their vertical position
6095: rule which determines whether they are header or footer boxes. Header and
6096: footer boxes must have an explicit vertical position rule (they must not use
6097: the default rule).</P>
6098: <P>
6099: Footer boxes must have an absolute height or inherit the height of their
6100: contents:</P>
6101: <PRE>
6102: Height : Enclosed . Height;
6103: </PRE>
6104: <P>
6105: A page box must have height and width rules and these two rules must be
6106: specified with constant values, expressed in centimeters, inches, or
6107: typographer's points. These two rules are interpreted in a special way for
6108: page boxes: they determine the width of the page and the vertical distance
6109: between two page separators, which is the height of the page and its header
6110: and footer together.</P>
6111: <P>
6112: A page box should also have vertical and horizontal position rules and these
6113: two rules should specify the position on the sheet of paper of the rectangle
6114: enclosing the page's contents. These two rules must position the upper left
6115: corner of the enclosing rectangle in relation to the upper left corner of the
6116: sheet of paper, considered to be the enclosing element. In both rules,
6117: distances must be expressed in fixed units: centimeters (<TT>cm</TT>), inches
6118: (<TT>in</TT>), or typographer's points (<TT>pt</TT>). Thus, rules similar to
6119: the following should be found in the rules for a page box:</P>
6120: <PRE>
6121: BOXES
6122: ThePage :
6123: BEGIN
6124: VertPos : Top = Enclosing . Top + 3 cm;
6125: HorizPos : Left = Enclosing . Left + 2.5 cm;
6126: Width : 16 cm;
6127: Height : 22.5 cm;
6128: END;
6129: </PRE>
6130: <P>
6131: When a document must be page broken, the page models to be constructed are
6132: defined in the <TT>BOXES</TT> section of the presentation schema by declaring
6133: page boxes and header and footer boxes. Also, the <TT>Page</TT> rule is used
6134: to specify to which parts of the document and to which views each model should
6135: be applied.</P>
6136: <P>
6137: The <TT>Page</TT> rule has only one parameter, given between parentheses after
6138: the <TT>Page</TT> keyword. This parameter is the name of the box which must
6139: serve as the model for page construction. When a <TT>Page</TT> rule is
6140: attached to an element type, each time such an element appears in a document,
6141: a page break takes place and the page model indicated in the rule is applied
6142: to all following pages, until reaching the next element which has a
6143: <TT>Page</TT> rule.</P>
6144: <P>
6145: The <TT>Page</TT> rule applies to only one view; if it appears in the primary
6146: view's block of rules, a <TT>Page</TT> rule applies only to that view. Thus,
6147: different page models can be defined for the full document and for its table
6148: of contents, which is another view of the same document. Some views can be
6149: specified with pages, and other views of the same document can be specified
6150: without pages.</P>
6151: <PRE>
6152: 'Page' '(' BoxID ')'
6153: </PRE>
6154: </DIV>
6155:
6156: <DIV class="subsection">
1.6 cvs 6157: <H3><A name=sectc4234>Box copies</A></H3>
1.1 cvs 6158:
6159: <P>
6160: The <TT>Copy</TT> rule can be used for an element which is defined as a
1.7 cvs 6161: reference in the structure schema. In this case, the rule specifies, between
6162: parenthesis, the name of the box (declared in the <TT>BOXES</TT> section)
1.1 cvs 6163: which must be produced when this reference appears in the structure of a
6164: document. The box produced is a copy (same contents, but possible different
6165: presentation) of the box type indicated by the parameter between parentheses,
6166: and which is in the element designated by the reference. The name of a box
6167: can be replaced by type name. Then what is copied is the contents of the
6168: element of this type which is inside the referenced element.</P>
6169: <P>
6170: Whether a box name or type name is given, it may be followed by the name of a
6171: structure schema between parentheses. This signifies that the box or type is
6172: defined in the indicated structure schema and not in the structure schema with
6173: which the rule's presentation schema is associated.</P>
6174: <P>
6175: The <TT>Copy</TT> rule can also be applied to a presentation box. If the
6176: presentation box was created by a reference attribute, the rule is applied as
6177: in the case of a reference element: the contents of the box having the
6178: <TT>Copy</TT> rule are based on the element designated by the reference
6179: attribute. For other presentation boxes, the <TT>Copy</TT> rule takes a type
6180: name parameter which can be followed, between parentheses, by the name of the
6181: structure schema in which the type is defined, if it is not defined in the
6182: same schema. The contents of the box which has this rule are a copy of the
6183: element of this type which is in the element creating the presentation box, or
6184: by default, the box of this type which precedes the presentation box. This
6185: last facility is used, for example, to define the running titles in headers or
6186: footers.</P>
6187: <PRE>
1.6 cvs 6188: 'Copy' '(' BoxTypeToCopy ')' .
1.1 cvs 6189: BoxTypeToCopy = BoxID [ ExtStruct ] /
1.6 cvs 6190: ElemID [ ExtStruct ] .
6191: ExtStruct = '(' ElemID ')' .
1.1 cvs 6192: </PRE>
6193: <P>
6194: Like the creation rules, the <TT>Copy</TT> rule cannot appear in the <A
1.6 cvs 6195: href="#sectc427">default presentation rules</A>. Moreover, this rule
1.1 cvs 6196: can only appear in the primary view's block of rules; the copy rule is applied
6197: to all views.</P>
6198: <BLOCKQUOTE class="example">
6199: <P>
6200: <STRONG>Example:</STRONG></P>
6201: <P>
6202: If the following definitions are in the structure schema:</P>
6203: <PRE>
6204: Body = LIST OF (Chapter =
6205: BEGIN
6206: ChapterTitle = Text;
6207: ChapterBody = SectionSeq;
6208: END);
6209: RefChapter = REFERENCE (Chapter);
6210: </PRE>
6211: <P>
6212: then the following presentation rules (among many other rules in
1.3 cvs 6213: the presentation schema) can be specified:</P>
1.1 cvs 6214: <PRE>
6215: COUNTERS
6216: ChapterCtr : RANK OF Chapter;
6217: BOXES
6218: ChapterNumber :
6219: BEGIN
6220: Content : (VALUE (ChapterCtr, URoman));
6221: ...
6222: END;
6223: RULES
6224: Chapter :
6225: BEGIN
6226: CreateFirst (ChapterNumber);
6227: ...
6228: END;
6229: RefChapter :
6230: BEGIN
6231: Copy (ChapterNumber);
6232: ...
6233: END;
6234: </PRE>
6235: <P>
1.4 cvs 6236: which makes the number of the chapter designated by the reference appear in
6237: uppercase roman numerals, in place of the reference to a chapter itself.
6238: Alternatively, the chapter title can be made to appear in place of the
1.1 cvs 6239: reference by writing this <TT>Copy</TT>rule:</P>
6240: <PRE>
6241: Copy (ChapterTitle);
6242: </PRE>
6243: <P>
6244: To define a header box, named <TT>RunningTitle</TT>, which contains the title
6245: of the current chapter, the box's contents are defined in this way:</P>
6246: <PRE>
6247: BOXES
6248: RunningTitle :
6249: Copy (ChapterTitle);
6250: </PRE>
6251: </BLOCKQUOTE>
6252: </DIV>
6253: </DIV>
6254: <HR>
6255: </DIV>
6256:
6257: <DIV class="chapter">
1.6 cvs 6258: <H1><A name=sect5>The T language</A></H1>
1.1 cvs 6259:
6260:
6261: <DIV class="section">
1.6 cvs 6262: <H2><A name=sectb51>Document translation</A></H2>
1.1 cvs 6263:
6264: <P>
6265: Because of its document model, Thot can produce documents in a high-level
6266: abstract form. This form, called the <EM>canonical form</EM> is specific to
6267: Thot; it is well suited to the editor's manipulations, but it does not
6268: necessarily suit other operations which might be applied to documents. Because
6269: of this, the Thot editor offers the choice of saving documents in its own form
6270: (the canonical form) or a format defined by the user. In the latter case, the
6271: Thot document is transformed by the translation program. This facility can
6272: also be used to export documents from Thot to systems using other
6273: formalisms.</P>
6274:
6275: <DIV class="subsection">
1.6 cvs 6276: <H3><A name=sectc511>Translation principles</A></H3>
1.1 cvs 6277:
6278: <P>
6279: Document translation allows the export of documents to other systems which do
6280: not accept Thot's canonical form. Translation can be used to export document
6281: to source-based formatters like T<SUB><BIG>E</BIG></SUB>X,
6282: L<SUP>A</SUP>T<SUB><BIG>E</BIG></SUB>X, and <TT>troff</TT>. It can also be
6283: used to translate documents into interchange formats like SGML or HTML. To
6284: allow the widest range of possible exports, Thot does not limit the choice of
6285: translations, but rather allows the user to define the formalisms into which
6286: documents can be translated.</P>
6287: <P>
6288: For each document or object class, a set of translation rules can be defined,
6289: specifying how the canonical form should be transformed into a given
6290: formalism. These translation rules are grouped into <EM>translation
6291: schemas</EM>, each schema containing the rules necessary to translate a
6292: generic logical structure (document or object structure) into a particular
6293: formalism. The same generic logical structure can have several different
6294: translation schemas, each defining translation rules for a different
6295: formalism.</P>
6296: <P>
6297: Like presentation schemas, translation schemas are generic. Thus, they apply
6298: to an entire object or document class and permit translation of all documents
6299: or objects of that class.</P>
6300: </DIV>
6301:
6302: <DIV class="subsection">
1.6 cvs 6303: <H3><A name=sectc512>Translation procedure</A></H3>
1.1 cvs 6304:
6305: <P>
6306: The translator works on the specific logical structure of the document being
6307: translated. It traverses the primary tree of this logical structure in
6308: pre-order and, at each node encountered, it applies the corresponding
6309: translation rules defined in the translation schema. Translation can be
6310: associated:</P>
6311: <UL>
6312: <LI>with element types defined in the structure schema,
6313: <LI>with global or local attributes defined in the structure schema,
6314: <LI>with specific presentation rules,
1.2 cvs 6315: <LI>with the content of the leaves of the structure (characters, symbols and
1.1 cvs 6316: graphical elements)
6317: </UL>
6318: <P>
6319: Thus, for each node, the translator applies all rules associated with the
6320: element type, all rules associated with each attribute (local or global)
6321: carried by the element, and if the element is a leaf of the tree, it also
1.10 cvs 6322: applies translation rules for characters, symbols, or graphical elements,
1.1 cvs 6323: depending on the type of the leaf.</P>
6324: <P>
6325: Rules associated with the content of leaves are different from all other
6326: rules: they specify only how to translate character strings, symbols, and
6327: graphical elements. All other rules, whether associated with element types,
6328: with specific presentation rules or with attributes, are treated similarly.
6329: These rules primarily allow:</P>
6330: <UL>
1.2 cvs 6331: <LI>generation of a text constant or variable before or after the contents of
1.1 cvs 6332: an element,
1.2 cvs 6333: <LI>modification of the order in which elements appear after translation,
1.1 cvs 6334: <LI>removal of an element in the translated document,
6335: <LI>and writing messages on the user's terminal during translation.
6336: </UL>
6337: </DIV>
6338: </DIV>
6339:
6340: <DIV class="section">
1.6 cvs 6341: <H2><A name=sectb52>Translation definition language</A></H2>
1.1 cvs 6342:
6343: <P>
6344: Translation schemas are written in a custom language, called T, which is
6345: described in the rest of this chapter. The grammar of T is specified using
1.6 cvs 6346: the same <A href="#sectc321">meta-language</A> as was used for the S and P
1.1 cvs 6347: languages and the translation schemas are written using the same conventions
6348: as the structure and presentation schemas. In particular, the keywords of the
6349: T language (the stings between apostrophes in the following syntax rules) can
6350: be written in any combination of upper-case and lower-case letters, but
6351: identifiers created by the programmer must always be written in the same
6352: way.</P>
6353:
6354: <DIV class="subsection">
1.6 cvs 6355: <H3><A name=sectc521>Organization of a translation schema</A></H3>
1.1 cvs 6356:
6357: <P>
6358: A translation schema is begun by the <TT>TRANSLATION</TT> keyword and is
6359: terminated by the <TT>END</TT> keyword. The <TT>TRANSLATION</TT> keyword is
6360: followed by the name of the generic structure for which a translation is being
6361: defined and a semicolon. This name must be identical to the name which
6362: appears after the <TT>STRUCTURE</TT> keyword in the corresponding structure
6363: schema.</P>
6364: <P>
6365: After this declaration of the structure, the following material appears in
6366: order:</P>
6367: <UL>
6368: <LI>the length of lines produced by the translation,
6369: <LI>the character delimiting the end of the line,
6370: <LI>the character string which the translator will insert if it must
6371: line-break the translated text,
6372: <LI>declarations of
6373: <UL>
6374: <LI>buffers,
6375: <LI>counters,
6376: <LI>constants,
6377: <LI>variables,
6378: </UL>
6379: <LI>translation rules associated with element types,
6380: <LI>translation rules associated with attributes,
6381: <LI>translation rules associated with specific presentation rules,
6382: <LI>translation rules associated with characters strings, symbols and
6383: graphical elements.
6384: </UL>
6385: <P>
6386: Each of these sections is introduced by a keyword followed by a sequence of
6387: declarations. All of these sections are optional, expect for the translation
6388: rules associated with element types. Many <TT>TEXTTRANSLATE</TT> sections can
6389: appear, each defining the rules for translating character strings of a
6390: particular alphabet.</P>
6391: <PRE>
6392: TransSchema ='TRANSLATION' ElemID ';'
6393: [ 'LINELENGTH' LineLength ';' ]
6394: [ 'LINEEND' CHARACTER ';' ]
6395: [ 'LINEENDINSERT' STRING ';' ]
6396: [ 'BUFFERS' BufferSeq ]
6397: [ 'COUNTERS' CounterSeq ]
6398: [ 'CONST' ConstSeq ]
6399: [ 'VAR' VariableSeq ]
6400: 'RULES' ElemSeq
6401: [ 'ATTRIBUTES' AttrSeq ]
6402: [ 'PRESENTATION' PresSeq ]
6403: < 'TEXTTRANSLATE' TextTransSeq >
6404: [ 'SYMBTRANSLATE' TransSeq ]
6405: [ 'GRAPHTRANSLATE' TransSeq ]
6406: 'END' .
6407: </PRE>
6408: </DIV>
6409:
6410: <DIV class="subsection">
1.6 cvs 6411: <H3><A name=sectc522>Line length</A></H3>
1.1 cvs 6412:
6413: <P>
6414: If a <TT>LINELENGTH</TT> instruction is present after the structure
6415: declaration, the translator divides the text it produces into lines, each line
6416: having a length less than or equal to the integer which follows the
6417: <TT>LINELENGTH</TT> keyword. This maximum line length is expressed as a
6418: number of characters. The end of the line is marked by the character defined
6419: by the <TT>LINEEND</TT> instruction. When the translator breaks the lines on
6420: a space character in generated text, this space will be replaced by the
6421: character string defined by the <TT>LINEENDINSERT</TT> instruction.</P>
6422: <P>
6423: If the <TT>LINEEND</TT> instruction is not defined then the linefeed character
6424: (octal code 12) is used as the default line end character. If the
6425: <TT>LINEENDINSERT</TT> instruction is not defined, the linefeed character is
6426: inserted at the end of the produced lines. If there is no <TT>LINELENGTH</TT>
6427: instruction, the translated text is not divided into lines. Otherwise, if the
6428: translation rules generate line end marks, these marks remain in the
6429: translated text, but the length of the lines is not controlled by the
6430: translator.</P>
6431: <PRE>
6432: LineLength = NUMBER .
6433: </PRE>
6434: <BLOCKQUOTE class="example">
6435: <P>
6436: <STRONG>Example:</STRONG></P>
6437: <P>
1.3 cvs 6438: To limit the lines produced by the translator to a length of 80 characters, the
6439: following rule is written at the beginning of the translation schema.</P>
1.1 cvs 6440: <PRE>
6441: LineLength 80;
6442: </PRE>
6443: </BLOCKQUOTE>
6444: </DIV>
6445:
6446: <DIV class="subsection">
1.6 cvs 6447: <H3><A name=sectc523>Buffers</A></H3>
1.1 cvs 6448:
6449: <P>
6450: A buffer is a unit of memory managed by the translator, which can either
6451: contain text read from the terminal during the translation (see the <A
1.6 cvs 6452: href="#sectc5212"><TT>Read</TT> rule</A>), or the name of the last picture
1.1 cvs 6453: (bit-map) encountered by the translator in its traversal of the document.
1.2 cvs 6454: Remember the pictures are stored in files that are separate for the document
1.1 cvs 6455: files and that the canonical form contains only the names of the files in
1.2 cvs 6456: which the pictures are found.</P>
1.1 cvs 6457: <P>
6458: Thus, there are two types of buffers: buffers for reading from the terminal
1.2 cvs 6459: (filled by the <TT>Read</TT> rule) and the buffer of picture names (containing
6460: the name of the last picture encountered). A translation schema can use
6461: either type, one or several read buffers and one (and only one) picture name
1.1 cvs 6462: buffer.</P>
6463: <P>
6464: If any buffers are used, the <TT>BUFFERS</TT> keyword must be present,
6465: followed by declarations of every buffer used in the translation schema. Each
6466: buffer declaration is composed only of the name of the buffer, chosen freely
1.2 cvs 6467: by the programmer. The picture name buffer is identified by the
1.1 cvs 6468: <TT>Picture</TT> keyword, between parentheses, following the buffer name. The
6469: <TT>Picture</TT> keyword may only appear once. Each buffer declaration is
6470: terminated by a semicolon.</P>
6471: <PRE>
6472: BufferSeq = Buffer < Buffer > .
6473: Buffer = BufferID [ '(' 'Picture' ')' ] ';' .
6474: BufferID = NAME .
6475: </PRE>
6476: <BLOCKQUOTE class="example">
6477: <P>
6478: <STRONG>Example:</STRONG></P>
6479: <P>
1.3 cvs 6480: The following buffer declarations create a picture name buffer named
1.2 cvs 6481: <TT>pictureName</TT> and a read buffer named <A
1.1 cvs 6482: name="destname"><TT>DestName</TT></A>:</P>
6483: <PRE>
6484: BUFFERS
1.2 cvs 6485: pictureName (Picture); DestName;
1.1 cvs 6486: </PRE>
6487: </BLOCKQUOTE>
6488: </DIV>
6489:
6490: <DIV class="subsection">
1.6 cvs 6491: <H3><A name=sectc524>Counters</A></H3>
1.1 cvs 6492:
6493: <P>
6494: Certain translation rules generate text that varies according to the context
6495: of the element to which the rules apply. Variable text is defined either in
1.6 cvs 6496: the <A href="#sectc526"><TT>VAR</TT> section</A> of the translation schema or
1.1 cvs 6497: in the rule itself (see the <TT>Create</TT> and <TT>Write</TT> rules). Both
6498: types of definition rely on counters for the calculation of variable
6499: material.</P>
6500: <P>
6501: There are two types of counter: counters whose value is explicitely computed
1.6 cvs 6502: by applying <A href="#sectc5221"><TT>Set</TT> and <TT>Add</TT> rules</A>, and
1.1 cvs 6503: counters whose value is computed by a function associated with the counter.
6504: Those functions allow the same calculations as can be used in presentation
6505: schemas. As in a presentation schema, counters must be defined in the
6506: <TT>COUNTERS</TT> section of the translation schema before they are used.</P>
6507: <P>
6508: When counters are used in a translation schema, the <TT>COUNTERS</TT> keyword
6509: is followed by the declarations of every counter used. Each declaration is
6510: composed of the counter's name possibly followed by a colon and the counting
6511: function to be used for the counter. The declaration is terminated by a
6512: semi-colon. If the counter is explicitely computed by <TT>Set</TT> and
6513: <TT>Add</TT> rules, no counting function is indicated. If a counting function
6514: is indicated, <TT>Set</TT> and <TT>Add</TT> rules cannot be applied to that
6515: counter.</P>
6516: <P>
6517: The counting function indicates how the counter's value will be computed.
6518: Three functions are available: <TT>Rank</TT>, <TT>Rlevel</TT>, and
6519: <TT>Set</TT>.</P>
6520: <UL>
1.5 cvs 6521: <LI><TT>Rank of ElemID</TT> indicates that the counter's value is the rank of
6522: the element of type <TT>ElemID</TT> which encloses the element for which the
1.2 cvs 6523: counter is being evaluated. For the purposes of this function, an element of
1.5 cvs 6524: type <TT>ElemID</TT> is considered to enclose itself. This function is
6525: primarily used when the element of type <TT>ElemID</TT> is part of an
1.2 cvs 6526: aggregate or list, in which case the counter's value is the element's rank in
1.5 cvs 6527: its list or aggregate. Note that, unlike the <TT>Rank</TT> function for
6528: presentation schemas, the <TT>Page</TT> keyword cannot be used in place of the
1.1 cvs 6529: <TT>ElemID</TT>.
6530: <P>
6531: The type name <TT>ElemID</TT> can be followed by an integer. That number
6532: represents the relative level, among the ancestors of the concerned element,
6533: of the element whose rank is asked. If that relative level <I>n</I> is
1.5 cvs 6534: unsigned, the <I>n<SUP>th</SUP></I> element of type <TT>ElemID</TT> encountered
6535: when travelling the logical structure from the root to the concerned element is
1.1 cvs 6536: taken into account. If the relative level is negative, the logical structure
6537: is travelled in the other direction, from the concerned element to the
6538: root.</P>
1.5 cvs 6539: <LI><TT>Rlevel of ElemID</TT> indicates that the counter's values is the
1.2 cvs 6540: relative level in the tree of the element for which the counter is being
6541: evaluated. The counter counts the number of elements of type <TT>ElemID</TT>
6542: which are found on the path between the root of the document's logical
6543: structure tree and the element (inclusive).
1.5 cvs 6544: <LI><TT>Set n on Type1 Add m on Type2</TT> indicates that the counter's value
1.2 cvs 6545: is calculated as follows: in traversing the document from the beginning to
6546: the element for which the counter is being evaluated, the counter is set to
1.5 cvs 6547: the value <TT>n</TT> each time a <TT>Type1</TT> element is encountered and is
6548: incremented by the amount <TT>m</TT> each time a <TT>Type2</TT> element is
6549: encountered. The initial value <TT>n</TT> and the increment <TT>m</TT> are
1.1 cvs 6550: integers.
6551: </UL>
6552: <P>
6553: As in a presentation schema, the <TT>Rank</TT> and <TT>Set</TT> functions can
6554: be modified by a numeric attribute which changes their initial value. This is
6555: indicated by the <TT>Init</TT> keyword followed by the numeric attribute's
6556: name. The <TT>Set</TT> function takes the value of the attribute instead of
6557: the <TT>InitValue</TT> (<TT>n</TT>). For the <TT>Rank</TT> function, the
6558: value of the attribute is considered to be the rank of the first element of
6559: the list (rather than the normal value of 1). Subsequent items in the list
6560: have their ranks shifted accordingly. In both cases, the attribute must be
6561: numeric and must be a local attribute of the root of the document itself.</P>
6562: <PRE>
6563: CounterSeq = Counter < Counter > .
6564: Counter = CounterID [ ':' CounterFunc ] ';' .
6565: CounterID = NAME .
6566: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ]
6567: [ 'Init' AttrID ] /
6568: 'Rlevel' 'of' ElemID /
6569: 'Set' InitValue 'On' ElemID
6570: 'Add' Increment 'On' ElemID
6571: [ 'Init' AttrID ] .
6572: SLevelAsc = [ '-' ] LevelAsc .
6573: LevelAsc = NUMBER .
6574: InitValue = NUMBER .
6575: Increment = NUMBER .
6576: ElemID = NAME .
6577: AttrID = NAME .
6578: </PRE>
6579: <BLOCKQUOTE class="example">
6580: <P>
6581: <STRONG>Example:</STRONG></P>
6582: <P>
6583: If the body of a chapter is defined in the structure schema by:</P>
6584: <PRE>
6585: Chapter_Body = LIST OF
6586: (Section = BEGIN
6587: Section_Title = Text;
6588: Section_Body = BEGIN
6589: Paragraphs;
6590: Section;
6591: END;
6592: END
6593: );
6594: </PRE>
6595: <P>
1.3 cvs 6596: (sections are defined recursively), a counter can be defined giving the <A
1.4 cvs 6597: name="sectnum">number of a section</A> within its level in the hierarchy:</P>
1.1 cvs 6598: <PRE>
6599: COUNTERS
6600: SectionNumber : Rank of Section;
6601: </PRE>
6602: <P>
6603: A counter holding the hierarchic level of a section:</P>
6604: <PRE>
6605: SectionLevel : Rlevel of Section;
6606: </PRE>
6607: <P>
1.5 cvs 6608: A <A name="uniquenum">counter</A> which sequentially numbers all the document's
1.1 cvs 6609: sections, whatever their hierarchic level:</P>
6610: <PRE>
6611: UniqueSectNum : Set 0 on Document Add 1 on Section;
6612: </PRE>
6613: </BLOCKQUOTE>
6614: </DIV>
6615:
6616: <DIV class="subsection">
1.6 cvs 6617: <H3><A name=sectc525>Constants</A></H3>
1.1 cvs 6618:
6619: <P>
6620: A common feature of translation rules is the generation of constant text. This
6621: text can be defined in the rule that generates it (see for example the <A
1.6 cvs 6622: href="#sectc5210"><TT>Create</TT></A> and <A href="#sectc5211"><TT>Write</TT></A>
1.1 cvs 6623: rules); but it can also be defined once in the constant declaration section
6624: and used many times in different rules. The latter option is preferable when
6625: the same text is used in several rules or several <A
1.6 cvs 6626: href="#sectc526">variables</A>.</P>
1.1 cvs 6627: <P>
6628: The <TT>CONST</TT> keyword begins the constant declaration section of the
6629: translation schema. It must be omitted if no constants are declared. Each
6630: constant declaration is composed of the constant name, an equals sign, and the
6631: constant's value, which is a character string between apostrophes. A constant
6632: declaration is terminated by a semicolon.</P>
6633: <PRE>
6634: ConstSeq = Const < Const > .
6635: Const = ConstID '=' ConstValue ';' .
6636: ConstID = NAME .
6637: ConstValue = STRING .
6638: </PRE>
6639: <BLOCKQUOTE class="example">
6640: <P>
6641: <STRONG><A name="levelexample">Example:</A></STRONG></P>
6642: <P>
1.5 cvs 6643: The following rule assigns the name <TT>TxtLevel</TT> to the character string
1.1 cvs 6644: ``Level'':</P>
6645: <PRE>
6646: CONST
6647: TxtLevel = 'Level';
6648: </PRE>
6649: </BLOCKQUOTE>
6650: </DIV>
6651:
6652: <DIV class="subsection">
1.6 cvs 6653: <H3><A name=sectc526>Variables</A></H3>
1.1 cvs 6654:
6655: <P>
1.10 cvs 6656: Variables allow to define variable text which is generated by the
6657: <TT>Create</TT> and <TT>Write</TT> rules. They are also used to define
6658: file names which are used in the <TT>Create</TT>, <TT>ChangeMainFile</TT>,
6659: and <TT>Indent</TT> rules. Variables can be defined either
1.1 cvs 6660: in the <TT>VAR</TT> section of the translation schema or directly in the rules
1.10 cvs 6661: which use them. Variables that define file names must be declared in the
1.1 cvs 6662: <TT>VAR</TT> section, and when the same variable is used several times in the
6663: translation schema, it makes sense to define it globally in the <TT>VAR</TT>
6664: section. This section is only present if at least one variable is defined
6665: globally.</P>
6666: <P>
6667: After the <TT>VAR</TT> keyword, each global variable is defined by its name, a
6668: colon separator and a sequence of functions (at least one function). Each
6669: variable definition is terminated by a semicolon. Functions determine the
6670: different parts which together give the value of the variable. The value is
6671: obtained by concatenating the strings produced by each of the functions. Seven
6672: types of functions are available. Each variable definition may use any number
6673: of functions of each type.</P>
6674: <UL>
1.2 cvs 6675: <LI>The function <TT>Value(Counter)</TT>returns a string representing the
6676: value taken by the counter when it is evaluated for the element in whose rule
6677: the variable is used. The counter must have been declared in the
1.5 cvs 6678: <TT>COUNTERS</TT> section of the translation schema. When the counter is
1.2 cvs 6679: expressed in arabic numerals, the counter name can be followed by a colon and
6680: an integer indicating a minimum length (number of characters) for the string;
6681: if the counter's value is normally expressed with fewer characters than the
6682: required minimum, zeroes are added to the front of the string to achieve the
1.5 cvs 6683: minimum length.
1.1 cvs 6684: <P>
6685: By default, the counter value is written in arabic digits. If another
6686: representation of that value is needed, the counter name must be followed by a
6687: comma and one of the following keywords:</P>
6688: <UL>
6689: <LI><TT>Arabic</TT>: arabic numerals (default value),
6690: <LI><TT>LRoman</TT>: lower-case roman numerals,
6691: <LI><TT>URoman</TT>: upper-case roman numerals,
6692: <LI><TT>Uppercase</TT>: upper-case letter,
6693: <LI><TT>Lowercase</TT>: lower-case letter.
6694: </UL>
1.2 cvs 6695: <LI>The function <TT>FileDir</TT>, without parameter, returns a string
6696: representing the name of the directory of the output file that has been given
6697: as a parameter to the translation program. The string includes a character '/'
6698: at the end.
6699: <LI>The function <TT>FileName</TT>, without parameter, returns a string
6700: representing the name of the output file that has been given as a parameter to
6701: the translation program. The file extension (the character string that
6702: terminate the file name, after a dot) is not part of that string.
6703: <LI>The function <TT>Extension</TT>, without parameter, returns a string
6704: representing the extension of the file name. That string is empty if the file
6705: name that has been given as a parameter to the translation program has no
6706: extension. If there is an extension, its first character is a dot.
6707: <LI>The function <TT>DocumentName</TT>, without parameter, returns a string
6708: representing the name of the document being translated.
6709: <LI>The function <TT>DocumentDir</TT>, without parameter, returns a string
6710: representing the directory containing the document being translated.
6711: <LI>The function formed by the name of a constant returns that constant's
1.1 cvs 6712: value.
1.2 cvs 6713: <LI>The function formed by a character string between apostrophes returns that
1.1 cvs 6714: string.
1.2 cvs 6715: <LI>The function formed by the name of a buffer returns the contents of that
6716: buffer. If the named buffer is the picture buffer, then the name of the last
6717: picture encountered is returned. Otherwise, the buffer is a read buffer and
6718: the value returned is text previously read from the terminal. If the buffer
6719: is empty (no picture has been encountered or the <TT>Read</TT> rule has not
6720: been executed for the buffer), then the empty string is returned.
6721: <LI>The function formed by an attribute name takes the value of the indicated
6722: attribute for the element to which the variable applies. If the element does
6723: not have that attribute, then the element's ancestor are searched toward the
6724: root of the tree. If one of the ancestors does have the attribute then its
6725: value is used. If no ancestors have the attribute, then the value of the
1.1 cvs 6726: function is the empty string.
6727: </UL>
6728: <PRE>
6729: VariableSeq = Variable < Variable > .
6730: Variable = VarID ':' Function < Function > ';' .
6731: VarID = NAME .
6732: Function ='Value' '(' CounterID [ ':' Length ]
6733: [ ',' CounterStyle ] ')' /
6734: 'FileDir' / 'FileName' / 'Extension' /
6735: 'DocumentName' / 'DocumentDir' /
6736: ConstID / CharString /
6737: BufferID / AttrID .
6738: Length = NUMBER .
6739: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' /
6740: 'Uppercase' / 'Lowercase' .
6741: CharString = STRING .
6742: </PRE>
6743: <BLOCKQUOTE class="example">
6744: <P>
6745: <STRONG>Example:</STRONG></P>
6746: <P>
1.3 cvs 6747: To create, at the beginning of each section of the translated document, text
6748: composed of the string ``Section'' followed by the section number, the
1.5 cvs 6749: following <A name="varsectexample">variable definition</A> might be used:</P>
1.1 cvs 6750: <PRE>
6751: VAR
6752: SectionVar : 'Section' Value(SectionNumber);
6753: </PRE>
6754: <P>
6755: (see the definition of <A href="#sectnum"><TT>SectionNumber</TT></A>).</P>
6756: <P>
6757: The following variable definition can be used to create, at the beginning of
6758: each section, the text ``Level'' followed by the hierarchical level of the
6759: section. It used the constant defined above.</P>
6760: <PRE>
6761: LevelVar : TxtLevel Value(SectionLevel);
6762: </PRE>
6763: <P>
1.5 cvs 6764: (see the definitions of <A href="#sectnum"><TT>SectionLevel</TT></A> and of
6765: <A href="#levelexample"><TT>TxtLevel</TT></A>).</P>
1.1 cvs 6766: <P>
1.5 cvs 6767: To generate the translation of each section in a different file (see
1.6 cvs 6768: <A href="#sectc5220">rule <TT>ChangeMainFile</TT></A>), the name of these
1.1 cvs 6769: files might be defined by the following variable:</P>
6770: <PRE>
6771: VarOutpuFile : FileName Value(SectionNumber)
6772: Extension;
6773: </PRE>
6774: <P>
1.4 cvs 6775: If <TT>output.txt</TT> is the name of the <A name="varoutputfile">output
6776: file</A> specified when starting the translation program, translated sections
6777: are written in files <TT>output1.txt</TT>, <TT>output2.txt</TT>, etc.</P>
1.1 cvs 6778: </BLOCKQUOTE>
6779: </DIV>
6780:
6781: <DIV class="subsection">
1.6 cvs 6782: <H3><A name=sectc527>Translating structure elements</A></H3>
1.1 cvs 6783:
6784: <P>
6785: The <TT>RULES</TT> keyword introduces the translation rules which will be
6786: applied to the various structured element types. Translation rules can be
6787: specified for each element type defined in the structure schema, including the
6788: base types defined implicitly, whose names are <TT>TEXT_UNIT</TT>,
6789: <TT>PICTURE_UNIT</TT>, <TT>SYMBOL_UNIT</TT>, <TT>GRAPHIC_UNIT</TT> and
1.2 cvs 6790: <TT>PAGE_UNIT</TT>. But it is not necessary to specify rules for every
6791: defined type.</P>
1.1 cvs 6792: <P>
6793: If there are no translation rules for an element type, the elements that it
6794: contains (and which may have rules themselves) will still be translated, but
6795: the translator will produce nothing for the element itself. To make the
6796: translator completely ignore the content of an element the <A
1.6 cvs 6797: href="#sectc5217"><TT>Remove</TT> rule</A> must be used.</P>
1.1 cvs 6798: <P>
6799: The translation rules for an element type defined in the structure schema are
6800: written using the name of the type followed by a colon and the list of
1.6 cvs 6801: applicable rules. When the element type is a <A href="#sectd3285">mark pair</A>,
1.1 cvs 6802: but only in this case, the type name must be preceded by the <TT>First</TT> or
6803: <TT>Second</TT> keyword. This keyword indicates whether the rules that follow
6804: apply to the first or second mark of the pair.</P>
6805: <P>
6806: The list of rules can take several forms. It may be a simple non-conditional
6807: rule. It can also be formed by a condition followed by one or more simple
6808: rules. Or it can be a block of rules beginning with the <TT>BEGIN</TT>
6809: keyword and ending with the <TT>END</TT> keyword and a semicolon. This block
6810: of rules can contain one or more simple rules and/or one or more conditions,
6811: each followed by one or more simple rules.</P>
6812: <PRE>
6813: ElemSeq = TransType < TransType > .
6814: TransType = [ FirstSec ] ElemID ':' RuleSeq .
6815: FirstSec = 'First' / 'Second' .
6816: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' .
6817: Rule = SimpleRule / ConditionBlock .
6818: ConditionBlock = 'IF' ConditionSeq SimpleRuleSeq .
6819: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' /
6820: SimpleRule .
6821: </PRE>
6822: </DIV>
6823:
6824: <DIV class="subsection">
1.6 cvs 6825: <H3><A name=sectc528>Conditional rules</A></H3>
1.1 cvs 6826:
6827: <P>
6828: In a translation schema, the translation rules are either associated with
6829: element types or with attribute values or with a specific presentation. They
6830: are applied by the translator each time an element of the corresponding type
6831: is encountered in the translated document or each time the attribute value is
6832: carried by an element or also, each time the specific translation is attached
6833: to an element. This systematic application of the rules can be relaxed: it is
6834: possible to add a condition to one or more rules, so that these rules are only
6835: applied when the condition is true.</P>
6836: <P>
6837: A condition begins with the keyword <TT>IF</TT>, followed by a sequence of
6838: elementary conditions. Elementary conditions are separated from each other by
6839: the <TT>AND</TT> keyword. If there is only one elementary condition, this
6840: keyword is absent. The rules are only applied if all the elementary
6841: conditions are true. The elementary condition can be negative; it is then
6842: preceded by the <TT>NOT</TT> keyword.</P>
6843: <P>
6844: When the translation rule(s) controlled by the condition apply to a reference
6845: element or a reference attribute, an elementary condition can also apply to
6846: element referred by this reference. The <TT>Target</TT> keyword is used for
6847: that purpose. It must appear before the keyword defining the condition
6848: type.</P>
6849: <P>
6850: Depending on their type, some conditions may apply either to the element with
1.5 cvs 6851: which they are associated, or to one of its ancestor. In the case of an
1.1 cvs 6852: ancestor, the key word <TT>Ancestor</TT> must be used, followed by</P>
6853: <UL>
1.2 cvs 6854: <LI>either an integer which represents the number of levels in the tree
6855: between the element and the ancestor of interest,
6856: <LI>or the type name of the ancestor of interest. If that type is defined in
6857: a separate structure schema, the name of that schema must follow between
1.1 cvs 6858: parentheses.
6859: </UL>
6860: <P>
1.2 cvs 6861: There is a special case for the parent element, which can be simply written
1.5 cvs 6862: <TT>Parent</TT> instead of <TT>Ancestor 1</TT>.</P>
1.1 cvs 6863: <P>
6864: Only conditions <TT>First</TT>, <TT>Last</TT>, <TT>Referred</TT>,
6865: <TT>Within</TT>, <TT>Attributes</TT>, <TT>Presentation</TT>, <TT>Comment</TT>
6866: and those concerning an attribute or a specific presentation can apply to an
6867: ancestor. Conditions <TT>Defined</TT>, <TT>FirstRef</TT>, <TT>LastRef</TT>,
6868: <TT>ExternalRef</TT>, <TT>Alphabet</TT>, <TT>FirstAttr</TT>,
6869: <TT>LastAttr</TT>, <TT>ComputedPage</TT>, <TT>StartPage</TT>,
6870: <TT>UserPage</TT>, <TT>ReminderPage</TT>, <TT>Empty</TT> cannot be preceded by
6871: keywords <TT>Parent</TT> or <TT>Ancestor</TT>.</P>
6872: <P>
6873: In condition <TT>Referred</TT> and in the condition that applies to a named
1.5 cvs 6874: attribute, a symbol '<TT>*</TT>' can indicate that the condition is related
6875: only to the element itself. If this symbol is not present, not only the
6876: element is considered, but also its ancestor, at any level.</P>
1.1 cvs 6877: <P>
6878: The form of an elementary condition varies according to the type of
6879: condition.</P>
6880:
6881: <DIV class="subsubsection">
1.6 cvs 6882: <H4><A name=sectd5281>Conditions based on the logical position of the element</A></H4>
1.1 cvs 6883:
6884: <P>
6885: The condition can be on the position of the element in the document's logical
6886: structure tree. It is possible to test whether the element is the first
6887: (<TT>First</TT>) or last (<TT>Last</TT>) among its siblings or if it is not
6888: the first (<TT>NOT First</TT>) or not the last (<TT>NOT Last</TT>).</P>
6889: <P>
6890: It is also possible to test if the element is contained in an element of a
6891: given type (<TT>Within</TT>) or if it is not (<TT>NOT Within</TT>). If that
6892: element type is defined in a structure schema which is not the one which
6893: corresponds to the translation schema, the type name of this element must be
6894: followed, between parentheses, by the name of the structure schema which
6895: defines it.</P>
6896: <P>
6897: If the keyword <TT>Within</TT> is preceded by <TT>Immediately</TT>, the
6898: condition is satisfied only if the <EM>parent</EM> element has the type
6899: indicated. If the word <TT>Immediately</TT> is missing, the condition is
6900: satisfied if any <EM>ancestor</EM> has the type indicated.</P>
6901: <P>
6902: An integer <I>n</I> can appear between the keyword <TT>Within</TT> and the
6903: type. It specifies the number of ancestors of the indicated type that must be
6904: present for the condition to be satisfied. If the keyword
6905: <TT>Immediately</TT> is also present, the <I>n</I> immediate ancestors of the
6906: element must have the indicated type. The integer <I>n</I> must be positive
6907: or zero. It can be preceded by <TT><</TT> or <TT>></TT> to indicate a
6908: maximum or minimum number of ancestors. If these symbols are missing, the
6909: condition is satisfied only if it exists exactly <I>n</I> ancestors. When
6910: this number is missing, it is equivalent to > 0.</P>
1.11 cvs 6911: <P>
6912: If the condition applies to translation rules associated with an attribute,
6913: i.e. if it is in the <TT>ATTRIBUTES</TT> section of the presentation schema,
6914: the condition can be simply an element name. Translation rules are then
6915: executed only if the attribute is attached to an element of that type.
6916: The keyword <TT>NOT</TT> before the element name indicates that the
6917: translation rules must be executed only if the element is not of the type
6918: indicated.</P>
1.1 cvs 6919: </DIV>
6920:
6921: <DIV class="subsubsection">
1.6 cvs 6922: <H4><A name=sectd5282>Conditions on references</A></H4>
1.1 cvs 6923:
6924: <P>
6925: References may be taken into account in conditions, which can be based on the
6926: fact that the element, or one of its ancestors (unless symbol <TT>*</TT> is
6927: present), is designated by a at least one reference (<TT>Referred</TT>) or by
6928: none (<TT>NOT Referred</TT>). If the element or attribute to which the
6929: condition is attached is a reference, the condition can be based on the fact
6930: that it acts as the first reference to the designated element
6931: (<TT>FirstRef</TT>), or as the last (<TT>LastRef</TT>), or as a reference to
6932: an element located in another document (<TT>ExternalRef</TT>). Like all
6933: conditions, conditions on references can be inverted by the <TT>NOT</TT>
6934: keyword.</P>
6935: </DIV>
6936:
6937: <DIV class="subsubsection">
1.6 cvs 6938: <H4><A name=sectd5283>Conditions on the parameters</A></H4>
1.1 cvs 6939:
6940: <P>
1.6 cvs 6941: Elements which are <A href="#sectc326">parameters</A> can be given a particular
1.1 cvs 6942: condition which is based on whether or not the parameter is given a value in
6943: the document (<TT>Defined</TT> or <TT>NOT Defined</TT>, respectively).</P>
6944: </DIV>
6945:
6946: <DIV class="subsubsection">
1.6 cvs 6947: <H4><A name=sectd5284>Conditions on the alphabets</A></H4>
1.1 cvs 6948:
6949: <P>
6950: The character string base type (and only this type) can use the condition
6951: <TT>Alphabet = a</TT> which indicates that the translation rule(s) should only
6952: apply if the alphabet of the character string is the one whose name appears
6953: after the equals sign (or is not, if there is a preceding <TT>NOT</TT>
6954: keyword). This condition cannot be applied to translation rules of an
6955: attribute.</P>
6956: <P>
6957: In the current implementation of Thot, the available alphabets are the
6958: <TT>Latin</TT> alphabet and the <TT>Greek</TT> alphabet.</P>
6959: </DIV>
6960:
6961: <DIV class="subsubsection">
1.6 cvs 6962: <H4><A name=sectd5285>Conditions on page breaks</A></H4>
1.1 cvs 6963:
6964: <P>
6965: The page break base type (and only this type) can use the following
6966: conditions: <TT>ComputedPage</TT>, <TT>StartPage</TT>, <TT>UserPage</TT>, and
6967: <TT>ReminderPage</TT>. The <TT>ComputedPage</TT> condition indicates that the
6968: translation rule(s) should apply if the page break was created automatically
6969: by Thot; the <TT>StartPage</TT> condition is true if the page break is
6970: generated before the element by the <TT>Page</TT> rule of the P language; the
6971: <TT>UserPage</TT> condition applies if the page break was inserted by the
6972: user; and the <TT>ReminderPage</TT> is applied if the page break is a reminder
6973: of page breaking.</P>
6974: </DIV>
6975:
6976: <DIV class="subsubsection">
1.6 cvs 6977: <H4><A name=sectd5286>Conditions on the element's content</A></H4>
1.1 cvs 6978:
6979: <P>
6980: The condition can be based on whether or not the element is empty. An element
6981: which has no children or whose leaves are all empty is considered to be empty
6982: itself. This condition is expressed by the <TT>Empty</TT> keyword, optionally
6983: preceded by the <TT>NOT</TT> keyword.</P>
6984: </DIV>
6985:
6986: <DIV class="subsubsection">
1.6 cvs 6987: <H4><A name=sectd5287>Conditions on the presence of comments</A></H4>
1.1 cvs 6988:
6989: <P>
6990: The condition can be based on the presence or absence of comments associated
6991: with the translated element. This condition is expressed by the keyword
6992: <TT>Comment</TT>, optionally preceded by the keyword <TT>NOT</TT>.</P>
6993: </DIV>
6994:
6995: <DIV class="subsubsection">
1.6 cvs 6996: <H4><A name=sectd5288>Conditions on the presence of specific presentation rules</A></H4>
1.1 cvs 6997:
6998: <P>
6999: The condition can be based on the presence or absence of specific presentation
7000: rules associated with the translated element, whatever the rules, their value
7001: or their number. This condition is expressed by the keyword
7002: <TT>Presentation</TT>, optionally preceded by the <TT>NOT</TT> keyword.</P>
7003: </DIV>
7004:
7005: <DIV class="subsubsection">
1.6 cvs 7006: <H4><A name=sectd5289>Conditions on the presence of logical attributes</A></H4>
1.1 cvs 7007:
7008: <P>
7009: In the same way, the condition can be based on the presence or absence of
7010: attributes associated with the translated elements, no matter what the
7011: attributes or their values. The <TT>Attributes</TT> keyword expresses this
7012: condition.</P>
7013: </DIV>
7014:
7015: <DIV class="subsubsection">
1.6 cvs 7016: <H4><A name=sectd52810>Conditions on logical attributes</A></H4>
1.1 cvs 7017:
7018: <P>
7019: If the condition appears in the translation rules of an attribute, the
7020: <TT>FirstAttr</TT> and <TT>LastAttr</TT> keywords can be used to indicate that
7021: the rules must only be applied if this attribute is the first attribute for
7022: the translated element or if it is the last (respectively). These conditions
7023: can also be inverted by the <TT>NOT</TT> keyword.</P>
7024: <P>
7025: Another type of condition can only be applied to the translation rules when
7026: the element being processed (or one of its ancestors if symbol <TT>*</TT> is
7027: missing) has a certain attribute, perhaps with a certain value or, in
7028: contrast, when the element does not have this attribute with this value. The
7029: condition is specified by writing the name of the attribute after the keyword
7030: <TT>IF</TT> or <TT>AND</TT>. The <TT>NOT</TT> keyword can be used to invert
7031: the condition. If the translation rules must be applied to any element which
7032: has this attribute (or does not have it, if the condition is inverted) no
7033: matter what the attribute's value, the condition is complete. If, in
7034: contrast, the condition applies to one or more values of the attribute, these
7035: are indicated after the name of the attribute, except for reference attributes
7036: which do not have values.</P>
7037: <P>
7038: The representation of the values of an <A name="relattr">attribute</A> in a
7039: condition depends on the attribute's type. For attributes with enumerated or
7040: textual types, the value (a name or character string between apostrophes,
7041: respectively) is simply preceded by an equals sign. For numeric attributes,
7042: the condition can be based on a single value or on a range of values. In the
7043: case of a unique value, this value (an integer) is simply preceded by an
7044: equals sign. Conditions based on ranges of values have several forms:</P>
7045: <UL>
1.2 cvs 7046: <LI>all values less than a given value (the value is preceded by a ``less
1.1 cvs 7047: than'' sign).
1.2 cvs 7048: <LI>all values greater than a given value (the value is preceded by a
7049: ``greater than'' sign).
7050: <LI>all values falling in an interval, bounds included. The range of values
7051: is then specified <TT>IN [</TT>Minimum <TT>..</TT>Maximum<TT>]</TT>, where
7052: Minimum and Maximum are integers.
1.1 cvs 7053: </UL>
7054: <P>
1.2 cvs 7055: All numeric values may be negative. The integer is simply preceded by a minus
1.1 cvs 7056: sign.</P>
7057: <P>
7058: Both local and global attributes can be used in conditions.</P>
7059: </DIV>
7060:
7061: <DIV class="subsubsection">
1.6 cvs 7062: <H4><A name=sectd52811>Conditions on specific presentation rules</A></H4>
1.1 cvs 7063:
7064: <P>
7065: It is possible to apply translation rules only when the element being
7066: processed has or does not have a specific presentation rule, possibly with a
7067: certain value. The condition is specified by writing the name of the
7068: presentation rule after the keyword <TT>IF</TT> or <TT>AND</TT>. The
7069: <TT>NOT</TT> keyword can be used to invert the condition. If the translation
7070: rules must be applied to any element which has this presentation rule (or does
7071: not have it, if the condition is inverted) no matter what the rule's value,
7072: the condition is complete. If, in contrast, the condition applies to one or
7073: more values of the rule, these are indicated after the name of the
7074: attribute.</P>
7075: <P>
7076: The representation of presentation rule values in a condition is similar to
7077: that for attribute values. The representation of these values depend on the
7078: type of the presentation rule. There are three categories of presentation
7079: rules:</P>
7080: <UL>
7081: <LI>those taking numeric values (<TT>Size, Indent, LineSpacing,
7082: LineWeight</TT>),
7083: <LI>those with values taken from a predefined list (<TT>Adjust, Justify,
7084: Hyphenate, Style, Font, UnderLine, Thickness, LineStyle</TT>),
7085: <LI>those whose value is a name (<TT>FillPattern, Background,
7086: Foreground</TT>).
7087: </UL>
7088: <P>
7089: For presentation rules which take numeric values, the condition can take a
7090: unique value or a range of values. In the case of a unique value, this value
7091: (an integer) is simply preceded by an equals sign. Conditions based on ranges
7092: of values have several forms:</P>
7093: <UL>
1.2 cvs 7094: <LI>all values less than a given value (the value is preceded by a ``less
1.1 cvs 7095: than'' sign).
1.2 cvs 7096: <LI>all values greater than a given value (the value is preceded by a
7097: ``greater than'' sign).
7098: <LI>all values falling in an interval, bounds included. The range of values
7099: is then specified <TT>IN [</TT>Minimum <TT>..</TT>Maximum<TT>]</TT>, where
7100: Minimum and Maximum are integers.
1.1 cvs 7101: </UL>
7102: <P>
1.2 cvs 7103: Values for the <TT>Indent</TT>rule may be negative. The integer is then
7104: simply preceded by a minus sign and represents how far the first line starts
7105: to the left of the other lines.</P>
1.1 cvs 7106: <P>
7107: For presentation rules whose values are taken from predefined lists, the value
7108: which satisfies the condition is indicated by an equals sign followed by the
7109: name of the value.</P>
7110: <P>
7111: For presentation rule whose values are names, the value which satisfies the
7112: condition is indicated by the equals sign followed by the value's name. The
7113: names of fill patterns (the <TT>FillPattern</TT> rule) and of colors (the
7114: <TT>Foreground</TT> and <TT>Background</TT> rules) known to Thot are the same
7115: as in the P language.</P>
7116: <P>
7117: The syntax of conditions based on the specific presentation is the same as the
1.6 cvs 7118: syntax used to express the <A href="#sectc5224">translation of specific
1.1 cvs 7119: presentation rules</A>.</P>
7120: <P>
7121: When a condition has only one rule, the condition is simply followed by that
7122: rule. If it has several rules, they are placed after the condition between
7123: the keywords <TT>BEGIN</TT> and <TT>END</TT>.</P>
7124: <PRE>
7125: ConditionSeq = Condition [ 'AND' Condition ] .
7126: Condition = [ 'NOT' ] [ 'Target' ] Cond .
7127: Cond = CondElem / CondAscend .
7128: CondElem ='FirstRef' / 'LastRef' /
7129: 'ExternalRef' /
7130: 'Defined' /
7131: 'Alphabet' '=' Alphabet /
7132: 'ComputedPage' / 'StartPage' /
7133: 'UserPage' / 'ReminderPage' /
7134: 'Empty' /
1.11 cvs 7135: ElemID /
1.1 cvs 7136: 'FirstAttr' / 'LastAttr' .
7137: CondAscend = [ Ascend ] CondOnAscend .
7138: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType .
7139: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] .
7140: CondRelLevel = NUMBER .
7141: CondOnAscend ='First' / 'Last' /
7142: 'Referred' /
7143: [ 'Immediately' ] 'Within' [ NumParent ]
7144: ElemID [ ExtStruct ] /
7145: 'Attributes' /
7146: AttrID [ RelatAttr ] /
7147: 'Presentation' /
7148: PresRule /
7149: 'Comment' .
7150: NumParent = [ GreaterLess ] NParent .
7151: GreaterLess = '>' / '<' .
7152: NParent = NUMBER.
7153: ExtStruct = '(' ElemID ')' .
7154: Alphabet = NAME .
7155: RelatAttr ='=' Value /
7156: '>' [ '-' ] Minimum /
7157: '<' [ '-' ] Maximum /
7158: 'IN' '[' [ '-' ] MinInterval '..'
7159: [ '-' ] MaxInterval ']' .
7160: Value = [ '-' ] IntegerVal / TextVal / AttrValue .
7161: Minimum = NUMBER .
7162: Maximum = NUMBER .
7163: MinInterval = NUMBER .
7164: MaxInterval = NUMBER .
7165: IntegerVal = NUMBER .
7166: TextVal = STRING .
7167: AttrValue = NAME .
7168: </PRE>
7169: <BLOCKQUOTE class="example">
7170: <P>
7171: <STRONG>Example:</STRONG></P>
7172: <P>
1.3 cvs 7173: Suppose that after each element of type Section_Title it is useful to produce
7174: the text <TT>\label{SectX}</TT> where <TT>X</TT> represents the section number,
7175: but only if the section is designated by one or more references in the
7176: document. The following conditional rule produces this effect:</P>
1.1 cvs 7177: <PRE>
7178: RULES
7179: Section_Title :
7180: IF Referred
1.5 cvs 7181: Create ('\label{Sect' Value(UniqueSectNum) '}\12') After;
1.1 cvs 7182: </PRE>
7183: <P>
1.6 cvs 7184: (the declaration of the <A href="#sectc5224"><TT>UniqueSectNum</TT>
1.3 cvs 7185: counter</A> is given above). The string <TT>\12</TT> represents a line
1.1 cvs 7186: break.</P>
7187: </BLOCKQUOTE>
7188: <BLOCKQUOTE class="example">
7189: <P>
7190: <STRONG>Example:</STRONG></P>
7191: <P>
1.3 cvs 7192: Suppose that for elements of the Elmnt type it would be useful to produce a
7193: character indicating the value of the numeric attribute Level associated with
7194: the element: an ``A'' for all values of Level less than 3, a ``B'' for values
7195: between 3 and 10 and a ``C'' for values greater than 10. This can be achieved
7196: by writing the following rules for the Elmnt type:</P>
1.1 cvs 7197: <PRE>
7198: RULES
7199: Elmnt :
7200: BEGIN
7201: IF Level < 3
7202: Create 'A';
7203: IF Level IN [3..10]
7204: Create 'B';
7205: IF Level > 10
7206: Create 'C';
7207: END;
7208: </PRE>
7209: </BLOCKQUOTE>
7210: </DIV>
7211: </DIV>
7212:
7213: <DIV class="subsection">
1.6 cvs 7214: <H3><A name=sectc529>Translation rules</A></H3>
1.1 cvs 7215:
7216: <P>
1.10 cvs 7217: Fourteen types of translation rules can be associated with element types and
1.1 cvs 7218: attribute values. They are the <TT>Create</TT>, <TT>Write</TT>,
7219: <TT>Read</TT>, <TT>Include</TT>, <TT>Get</TT>, <TT>Copy</TT>, <TT>Use</TT>,
7220: <TT>Remove</TT>, <TT>NoTranslation</TT>, <TT>NoLineBreak</TT>,
1.10 cvs 7221: <TT>ChangeMainFile</TT>, <TT>Set</TT>, <TT>Add</TT>, <TT>Indent</TT> rules.
7222: Each rule has its own syntax, although they are all based on very similar
7223: models.</P>
1.1 cvs 7224: <PRE>
7225: SimpleRule = 'Create' [ 'IN' VarID ] Object
7226: [ Position ] ';' /
7227: 'Write' Object [ Position ] ';' /
7228: 'Read' BufferID [ Position ] ';' /
7229: 'Include' File [ Position ] ';' /
7230: 'Get' [ RelPosition ] ElemID
7231: [ ExtStruct ]
7232: [ Position ] ';' /
7233: 'Copy' [ RelPosition ] ElemID
7234: [ ExtStruct ]
7235: [ Position ] ';' /
7236: 'Use' TrSchema [ 'For' ElemID ] ';' /
7237: 'Remove' ';' /
7238: 'NoTranslation' ';' /
7239: 'NoLineBreak' ';' /
7240: 'ChangeMainFile' VarID [ Position ] ';' /
1.10 cvs 7241: 'Set' CounterID InitValue [ Position ] ';' /
7242: 'Add' CounterID Increment [ Position ] ';' /
7243: 'Indent' [ 'IN' VarID ] [ IndentSign ]
7244: IndentValue [ Position ] ';' .
1.1 cvs 7245: </PRE>
7246: </DIV>
7247:
7248: <DIV class="subsection">
1.6 cvs 7249: <H3><A name=sectc5210>The <TT>Create</TT> rule</A></H3>
1.1 cvs 7250:
7251: <P>
7252: The most frequently used rule is undoubtedly the <TT>Create</TT> rule, which
7253: generates fixed or variable text (called an <EM>object</EM>) in the output
7254: file. The generated text can be made to appear either before or after the
7255: content of the element to which the rule applies. The rule begins with the
7256: <TT>Create</TT> keyword, followed by a specifier for the object and a keyword
7257: (<TT>Before</TT> or <TT>After</TT>) indicating the position of the generated
1.6 cvs 7258: text (<A href="#sectc5222">before or after</A> the element's content). If the
1.1 cvs 7259: position is not indicated, the object will be generated before the element's
7260: content. This rule, like all translation rules, is terminated by a
7261: semicolon.</P>
7262: <P>
7263: The <TT>Create</TT> keyword can be followed by the <TT>IN</TT> keyword and by
7264: the name of a variable. This means that the text generated by the rule must
7265: not be written in the main output file, but in the file whose name is
7266: specified by the variable.</P>
7267: <P>
7268: This allows the translation program to generate text in different files during
7269: the same run. These files do not need to be explicetely declared or opened.
7270: They do not need to be closed either. As soon as the translation program
7271: executes a <TT>Create</TT> rule for a file that is not yet open, it opens the
7272: file. These files are closed when the translation is finished.</P>
7273: <PRE>
7274: 'Create' [ 'IN' VarID ] Object
7275: [ Position ] ';'
7276: Object = ConstID / CharString /
7277: BufferID /
7278: VarID /
7279: '(' Function < Function > ')' /
7280: AttrID /
7281: 'Value' /
7282: 'Content' /
7283: 'Comment' /
7284: 'Attributes' /
7285: 'Presentation' /
7286: 'RefId' /
7287: 'PairId' /
7288: 'FileDir' /
7289: 'FileName' /
7290: 'Extension' /
7291: 'DocumentName' /
7292: 'DocumentDir' /
7293: [ 'Referred' ] ReferredObject .
7294: Position ='After' / 'Before' .
7295:
7296: ReferredObject = VarID /
7297: ElemID [ ExtStruct ] /
7298: 'RefId' /
7299: 'DocumentName' /
7300: 'DocumentDir' .
7301: </PRE>
7302: <P>
7303: The object to be generated can be:</P>
7304: <UL>
1.2 cvs 7305: <LI>a constant string, specified by its name if it is declared in the schema's
1.5 cvs 7306: <TT>CONST</TT> section, or given directly as a value between apostrophes;
1.1 cvs 7307: <LI>the contents of a buffer, designated by the name of the buffer;
1.2 cvs 7308: <LI>a variable, designated by its name if it is declared in the translation
1.5 cvs 7309: schema's <TT>VAR</TT> section, or given directly between parentheses. The text
1.2 cvs 7310: generated is the value of that variable evaluated for the element to which the
1.1 cvs 7311: rule applies.
1.2 cvs 7312: <LI>the value of an attribute, if the element being translated has this
7313: attribute. The attribute is specified by its name;
7314: <LI>the value of a specific presentation rule. This object can only be
1.1 cvs 7315: generated if the translation rule is for a <A href="#prestransl">specific
1.2 cvs 7316: presentation rule</A>. It is specified by the <TT>Value</TT> keyword;
7317: <LI>the element's content. That is, the content of the leaves of the subtree
7318: of the translated element. This is specified by the <TT>Content</TT> keyword;
7319: <LI>the comment attached to the element. When the element doesn't have a
7320: comment, nothing is generated. This is indicated by the <TT>Comment</TT>
7321: keyword;
7322: <LI>the translation of all attributes of the element (which is primarily used
1.6 cvs 7323: to apply the attribute translation rules <A href="#sectc5222">before</A> those of
1.2 cvs 7324: the element type). This is specified by the <TT>Attributes</TT> keyword.
7325: <LI>the translation of all of the element's specific presentation rules (which
7326: is primarily used to apply the translation rules for the specific presentation
1.6 cvs 7327: rules <A href="#sectc5222">before</A> those of the element or its attributes).
1.2 cvs 7328: This option is specified by the <TT>Presentation</TT> keyword;
1.5 cvs 7329: <LI>The value of the reference's identifier.<BR>Thot associates a unique
1.2 cvs 7330: identifier with each element in a document. This identifier (called
7331: <EM>reference's identifier</EM> or <EM>label</EM>) is a character string
7332: containing the letter `L' followed by digits. Thot uses it in references for
7333: identifying the referred element.<BR>The <TT>RefId</TT> keyword produces the
7334: reference's identifier of the element to which the translation rule is
7335: applied, or the reference's identifier of its first ancestor that is referred
7336: by a reference or that can be referred by a reference.
7337: <LI>the value of a mark pair's unique identifier. This may only be used for
1.6 cvs 7338: <A href="#sectd3285">mark pairs</A> and is indicated by the <TT>PairId</TT>
1.2 cvs 7339: keyword.
7340: <LI>the directory containing the file being generated (this string includes an
7341: ending '/', if it is not empty). This is indicated by the <TT>FileDir</TT>
7342: keyword.
7343: <LI>the name of the file being generated (only the name, without the directory
7344: and without the extension). This is indicated by the <TT>FileName</TT>
7345: keyword.
7346: <LI>the extension of the file being generated (this string starts with a dot,
7347: if it is not empty). This is indicated by the <TT>Extension</TT> keyword.
7348: <LI>the name of the document being translated. This is indicated by the
7349: <TT>DocumentName</TT> keyword.
7350: <LI>the directory containing the document being translated. This is indicated
7351: by the <TT>DocumentDir</TT> keyword.
1.1 cvs 7352: </UL>
7353: <P>
7354: When the rule applies to a reference (an element or an attribute defined as a
7355: reference in the structure schema), it can generate a text related to the
7356: element referred by that reference. The rule name is then followed the
7357: <TT>Referred</TT> keyword and a specification of the object to be generated
7358: for the referred element. This specification can be:</P>
7359: <UL>
1.2 cvs 7360: <LI>the name of a variable. The rule generates the value of that variable,
1.1 cvs 7361: computed for the referred element.
1.2 cvs 7362: <LI>an element type. The rule generates the translation of the element of
7363: that type, which is in the subtree of the referred element. If this element
7364: is not defined in the structure schema which corresponds to the translation
7365: schema (that is, an object defined in another schema), the element's type name
7366: must be followed by the name of its structure schema between parentheses.
7367: <LI>the <TT>RefId</TT> keyword. The rule generates the reference's identifier
1.1 cvs 7368: of the referred element.
1.2 cvs 7369: <LI>the <TT>DocumentName</TT> keyword. The rule generates the name of the
1.1 cvs 7370: document to which the referred element belongs.
1.2 cvs 7371: <LI>the <TT>DocumentDir</TT> keyword. The rule generates the name of the
1.1 cvs 7372: directory that contains the document of the referred element.
7373: </UL>
7374: </DIV>
7375:
7376: <DIV class="subsection">
1.6 cvs 7377: <H3><A name=sectc5211>The <TT>Write</TT> rule</A></H3>
1.1 cvs 7378:
7379: <P>
7380: The <TT>Write</TT> has the same syntax as the <TT>Create</TT> rule. It also
7381: produces the same effect, but the generated text is displayed on the user's
7382: terminal during the translation of the document, instead of being produced in
7383: the translated document. This is useful for helping the user keep track of
7384: the progress of the translation and for prompting the user on the terminal for
7385: input required by the <TT>Read</TT> rule.</P>
7386: <PRE>
7387: 'Write' Object [ Position ] ';'
7388: </PRE>
7389: <P>
7390: Notice: if the translator is launched by the editor (by the ``Save as''
7391: command), messages produced by the <TT>Write</TT> rule are not displayed.</P>
7392: <BLOCKQUOTE class="example">
7393: <P>
7394: <STRONG>Example:</STRONG></P>
7395: <P>
1.3 cvs 7396: To make the translator display the number of each section being translated on
7397: the user's terminal, the following rule is specified for the
7398: <TT>Section</TT> element type:</P>
1.1 cvs 7399: <PRE>
7400: Section : BEGIN
7401: Write VarSection;
7402: ...
7403: END;
7404: </PRE>
7405: <P>
1.3 cvs 7406: (see <A href="#varsectexample">above</A> for the definition of
7407: the <TT>VarSection</TT> variable).</P>
1.1 cvs 7408: <P>
7409: To display text on the terminal before issuing a read operation with the
7410: <TT>Read</TT> rule, the following rule is used:</P>
7411: <PRE>
7412: BEGIN
7413: Write 'Enter the name of the destination: ';
7414: ...
7415: END;
7416: </PRE>
7417: </BLOCKQUOTE>
7418: </DIV>
7419:
7420: <DIV class="subsection">
1.6 cvs 7421: <H3><A name=sectc5212>The <TT>Read</TT> rule</A></H3>
1.1 cvs 7422:
7423: <P>
7424: The <TT>Read</TT> rule reads text from the terminal during the translation of
7425: the document and saves the text read in one of the buffers declared in the
7426: <TT>BUFFERS</TT> section of the schema. The buffer to be used is indicated by
7427: its name, after the <TT>READ</TT> keyword. This name can be followed, as in
7428: the <TT>Create</TT> and <TT>Write</TT> rules, by a keyword indicating if the
7429: read operation must be performed <TT>Before</TT> or <TT>After</TT> the
7430: translation of the element's content. If this keyword is absent, the read
7431: operation is done beforehand. The text is read into the buffer and remains
1.5 cvs 7432: there until a rule using the same buffer - possibly the same rule - is
1.1 cvs 7433: applied.</P>
7434: <PRE>
7435: 'Read' BufferID [ Position ] ';'
7436: </PRE>
7437: <BLOCKQUOTE class="example">
7438: <P>
7439: <STRONG>Example:</STRONG></P>
7440: <P>
1.3 cvs 7441: The following set of rules tells the user that the translator is waiting for
7442: the entry of some text, reads this text into a buffer and copies the text into
1.1 cvs 7443: the translated document.</P>
7444: <PRE>
7445: BEGIN
7446: Write 'Enter the name of the destination: ';
7447: Read DestName;
7448: Create DestName;
7449: ...
7450: END;
7451: </PRE>
7452: <P>
1.5 cvs 7453: (see <A href="#destname">above</A> the definition of <TT>DestName</TT>).</P>
1.1 cvs 7454: </BLOCKQUOTE>
7455: </DIV>
7456:
7457: <DIV class="subsection">
1.6 cvs 7458: <H3><A name=sectc5213>The <TT>Include</TT> rule</A></H3>
1.1 cvs 7459:
7460: <P>
7461: The <TT>Include</TT> rule, like the <TT>Create</TT> rule, is used to produce
7462: text in the translated document. It inserts constant text which is not
7463: defined in the translation schema, but is instead taken from a file. The
7464: file's name is specified after the <TT>Include</TT> keyword, either directly
7465: as a character string between apostrophes or as the name of one of the buffers
7466: declared in the <TT>BUFFERS</TT> section of the schema. In the latter case,
7467: the buffer is assumed to contain the file's name. This can be used when the
7468: included file's name is known only at the moment of translation. This only
7469: requires that the <TT>Include</TT> rule is preceded by a <TT>Read</TT> rule
7470: which puts the name of the file desired by the user into the buffer.</P>
7471: <P>
7472: Like the other rules, it is possible to specify whether the inclusion will
7473: occur before or after the element's content, with the default being before.
7474: The file inclusion is only done at the moment of translation, not during the
7475: compilation of the translation schema. Thus, the file to be included need not
7476: exist during the compilation, but it must be accessible at the time of
7477: translation. Its contents can also be modified between two translations, thus
7478: producing different results, even if neither the document or the translation
7479: schema are modified.</P>
7480: <P>
7481: During translation, the file to be included is searched for along the schema
7482: directory path (indicated by the environment variable <TT>THOTSCH</TT>). The
7483: file name is normally only composed of a simple name, without specification of
1.12 cvs 7484: a complete file path. However, if the filename starts with a '/', it is
7485: considered as an absolute path.</P>
1.1 cvs 7486: <PRE>
1.6 cvs 7487: 'Include' File [ Position ] ';'
7488: File = FileName / BufferID .
7489: FileName = STRING .
1.1 cvs 7490: </PRE>
7491: <BLOCKQUOTE class="example">
7492: <P>
7493: <STRONG>Example:</STRONG></P>
7494: <P>
1.3 cvs 7495: Suppose that it is desirable to print documents of the Article class with a
7496: formatter which requires a number of declarations and definitions at the
7497: beginning of the file. The <TT>Include</TT>rule can be used to achieve this.
7498: All the declarations and definitions a replaced in a file called
7499: <TT>DeclarArt</TT> and then the <TT>Article</TT> element type is given the
1.1 cvs 7500: following rule:</P>
7501: <PRE>
7502: Article : BEGIN
7503: Include 'DeclarArt' Before;
7504: ...
7505: END;
7506: </PRE>
7507: </BLOCKQUOTE>
7508: </DIV>
7509:
7510: <DIV class="subsection">
1.6 cvs 7511: <H3><A name=sectc5214>The <TT>Get</TT> rule</A></H3>
1.1 cvs 7512:
7513: <P>
7514: The <TT>Get</TT> rule is used to change the order in which the elements appear
7515: in the translated document. More precisely, it produces the translation of a
7516: specified element before or after the translation of the content of the
7517: element to which the rule applies. The <TT>Before</TT> and <TT>After</TT>
7518: keywords are placed at the end of the rule to specify whether the operation
7519: should be performed before or after translation of the rule's element (the
7520: default is before). The type of the element to be moved must be specified
7521: after the <TT>Get</TT> keyword, optionally preceded by a keyword indicating
7522: where the element will be found in the logical structure of the document:</P>
7523: <DL>
7524: <DT><TT>Included</TT></DT>
1.2 cvs 7525: <DD>The element to be moved is the first element of the indicated type which is
1.1 cvs 7526: found inside the element to which the rule applies.
7527: </DD>
7528: <DT><TT>Referred</TT></DT>
1.2 cvs 7529: <DD>This keyword can only be used if the rule applies to a reference element.
7530: The element to be moved is either the element designated by the reference (if
7531: that element is of the specified type), or the first element of the desired
7532: type contained within the element designated by the reference.
1.1 cvs 7533: </DD>
7534: <DT>no keyword</DT>
1.2 cvs 7535: <DD>If the element to be moved is an associated element, defined in the <A
1.6 cvs 7536: href="#sectc314"><TT>ASSOC</TT> section</A> of the structure schema, all
1.2 cvs 7537: associated elements of this type which have not been translated yet are then
7538: translated. Certain elements may in fact have already been translated by a
7539: <TT>Get Referred</TT> rule.
1.1 cvs 7540: <P>
7541: If the element to be moved is not an associated element, the translator takes
7542: the first element of the indicated type from among the siblings of the rule's
7543: element. This is primarily used to change the order of the components of an
7544: aggregate.</P>
7545: </DD>
7546: </DL>
7547: <P>
7548: If the element to be moved is defined in a structure schema which is not the
7549: one which corresponds to the translation schema (in the case of an included
7550: object with a different schema), the type name of this element must be
7551: followed, between parentheses, by the name of the structure schema which
7552: defines it.</P>
7553: <PRE>
1.6 cvs 7554: 'Get' [ RelPosition ] ElemID
7555: [ ExtStruct ]
7556: [ Position ] ';' /
7557: RelPosition = 'Included' / 'Referred' .
1.1 cvs 7558: ExtStruct = '(' ElemID ')' .
7559: </PRE>
7560: <P>
7561: The <TT>Get</TT> rule has no effect if the element which it is supposed to
7562: move has already been translated. Thus, the element will not be duplicated.
7563: It is generally best to associate the rule with the first element which will
7564: be encountered by the translator in its traversal of the document. Suppose an
7565: aggregate has two elements <TT>A</TT> and <TT>B</TT>, with <TT>A</TT>
7566: appearing first in the logical structure. To permute these two elements, a
7567: <TT>Get B before</TT> rule should be associated with the <TT>A</TT> element
7568: type, not the inverse. Similarly, a rule of the form <TT>Get Included X
7569: After</TT>, even though syntactically correct, makes no sense since, by the
7570: time it will be applied, after the translation of the contents of the element
7571: to which it is attached, the <TT>X</TT> element will already have been
7572: translated.</P>
7573: <P>
7574: The <TT>Get</TT> rule is the only way to obtain the translation of the
7575: associated elements. In fact, the translator only traverses the primary tree
7576: of the document and thus does not translate the associated elements, except
7577: when the translation is explicitly required by a <TT>Get Referred Type</TT> or
7578: <TT>Get Type</TT> rule where <TT>Type</TT> is an associated element type.</P>
7579: <BLOCKQUOTE class="example">
7580: <P>
7581: <STRONG>Example:</STRONG></P>
7582: <P>
1.3 cvs 7583: The structure schema defined figures as associated element which are composed
7584: of some content and a caption. Moreover, it is possible to make references to
7585: figures, using elements of the <TT>RefFigure</TT> type:</P>
1.1 cvs 7586: <PRE>
7587: ...
7588: RefFigure = REFERENCE(Figure);
7589: ASSOC
1.6 cvs 7590: Figure = BEGIN
7591: Content = NATURE;
7592: Caption = Text;
7593: END;
1.1 cvs 7594: ...
7595: </PRE>
7596: <P>
1.3 cvs 7597: Suppose it would be useful to make a figure appear in the translated document
7598: at the place in the text where the first reference to the figure is made. If
7599: some figures are not referenced, then they would appear at the end of the
7600: document. Also, each figure's caption should appear before the content. The
7601: following rules in the translation schema will produce this result:</P>
1.1 cvs 7602: <PRE>
7603: Article : BEGIN
7604: ...
7605: Get Figures After;
7606: END;
7607: RefFigure : BEGIN
7608: If FirstRef Get Referred Figure;
7609: ...
7610: END;
7611: Content : BEGIN
7612: Get Caption Before;
7613: ...
7614: END;
7615: </PRE>
7616: </BLOCKQUOTE>
7617: </DIV>
7618:
7619: <DIV class="subsection">
1.6 cvs 7620: <H3><A name=sectc5215>The <TT>Copy</TT> rule</A></H3>
1.1 cvs 7621:
7622: <P>
7623: Like the <TT>Get</TT> rule, the <TT>Copy</TT> rule generates the translation
7624: of a specified element, but it acts even if the element has already been
7625: translated and it allows to copy it or to translate it later. Both rules have
7626: the same syntax.</P>
7627: <PRE>
7628: 'Copy' [ RelPosition ] ElemID
7629: [ ExtStruct ] [ Position ] ';'
7630: </PRE>
7631: </DIV>
7632:
7633: <DIV class="subsection">
1.6 cvs 7634: <H3><A name=sectc5216>The <TT>Use</TT> rule</A></H3>
1.1 cvs 7635:
7636: <P>
7637: The <TT>Use</TT> rule specifies the translation schema to be applied to
7638: objects of a certain class that are part of the document. This rule only
7639: appears in the rules for the root element of the document (the first type
7640: defined after the <TT>STRUCT</TT> keyword in the structure schema) or the
7641: rules of an element defined by an external structure (by another structure
7642: schema). Also, the <TT>Use</TT> rule cannot be conditional.</P>
7643: <P>
7644: If the rule is applied to an element defined by an external structure, the
7645: <TT>Use</TT> keyword is simply followed by the name of the translation schema
7646: to be used for element constructed according to that external structure. If
7647: the rule is applied to the document's root element, it is formed by the
7648: <TT>Use</TT> keyword followed by the translation schema's name, the
7649: <TT>For</TT> keyword and the name of the external structure to which the
7650: indicated translation schema should be applied.</P>
7651: <PRE>
7652: 'Use' TrSchema [ 'For' ElemID ] ';'
7653: TrSchema = NAME .
7654: </PRE>
7655: <P>
7656: If no <TT>Use</TT> rule defines the translation schema to be used for an
7657: external structure which appears in a document, the translator asks the user,
7658: during the translation process, which schema should be used. Thus, it is not
7659: necessary to give the translation schema a <TT>Use</TT> rule for every
7660: external structure used, especially when the choice of translation schemas is
7661: to be left to the user.</P>
7662: <P>
7663: Notice: if the translator is launched by the editor (by the ``Save as''
7664: command), prompts are not displayed.</P>
7665: <BLOCKQUOTE class="example">
7666: <P>
7667: <STRONG>Example:</STRONG></P>
7668: <P>
1.4 cvs 7669: The <TT>Article</TT> structure schema uses the
7670: <TT>Formula</TT> external structure, defined by another structure schema, for
1.1 cvs 7671: mathematical formulas:</P>
7672: <PRE>
7673: STRUCTURE Article;
7674: ...
7675: STRUCT
7676: Article = ...
7677: ...
7678: Formula_in_text = Formula;
7679: Isolated_formula = Formula;
7680: ...
7681: END
7682: </PRE>
7683: <P>
1.3 cvs 7684: Suppose that it would be useful to use the <TT>FormulaT</TT> translation schema
7685: for the formulas of an article. This can be expressed in two different ways in
1.4 cvs 7686: the <TT>Article</TT> class translation schema, using the rules:</P>
1.1 cvs 7687: <PRE>
7688: RULES
7689: Article :
7690: Use FormulaT for Formula;
7691: </PRE>
7692: <P>
7693: or:</P>
7694: <PRE>
7695: RULES
7696: ...
7697: Formula :
7698: Use FormulaT;
7699: </PRE>
7700: </BLOCKQUOTE>
7701: </DIV>
7702:
7703: <DIV class="subsection">
1.6 cvs 7704: <H3><A name=sectc5217>The <TT>Remove</TT> rule</A></H3>
1.1 cvs 7705:
7706: <P>
7707: The <TT>Remove</TT> rule indicates that nothing should be generated, in the
7708: translated document, for the content of the element to which the rule applies.
7709: The content of that element is simply ignored by the translator. This does
7710: not prevent the generation of text for the element itself, using the
7711: <TT>Create</TT> or <TT>Include</TT> rules, for example.</P>
7712: <P>
7713: The <TT>Remove</TT> rule is simply written with the <TT>Remove</TT> keyword.
7714: It is terminated, like all rules, by a semicolon.</P>
7715: <PRE>
7716: 'Remove' ';'
7717: </PRE>
7718: </DIV>
7719:
7720: <DIV class="subsection">
1.6 cvs 7721: <H3><A name=sectc5218>The <TT>NoTranslation</TT> rule</A></H3>
1.1 cvs 7722:
7723: <P>
7724: The <TT>NoTranslation</TT> rule indicates to the translator that it must not
7725: translate the content of the leaves of the element to which it applies. In
7726: contrast to the <TT>Remove</TT> rule, it does not suppress the content of the
7727: element, but it inhibits the translation of character strings, symbols, and
7728: graphical elements contained in the element. These are retrieved so that
7729: after the translation of the document, the rules of the <A
1.6 cvs 7730: href="#sectc5225"><TT>TEXTTRANSLATE</TT>, <TT>SYMBTRANSLATE</TT> and
1.1 cvs 7731: <TT>GRAPHTRANSLATE</TT> sections</A> will not be applied to them.</P>
7732: <P>
7733: The <TT>NoTranslation</TT> rule is written with the <TT>NoTranslation</TT>
7734: keyword followed by a semicolon.</P>
7735: <PRE>
7736: 'NoTranslation' ';'
7737: </PRE>
7738: </DIV>
7739:
7740: <DIV class="subsection">
1.6 cvs 7741: <H3><A name=sectc5219>The <TT>NoLineBreak</TT> rule</A></H3>
1.1 cvs 7742:
7743: <P>
7744: The <TT>NoLineBreak</TT> rule indicates to the translator that it must not
7745: generate additional line breaks in the output produced for the element to
1.6 cvs 7746: which it applies. This is as if it was an <A href="#sectc522">instruction
1.1 cvs 7747: <TT>LINELENGTH 0;</TT></A> at the beginning of the translation schema, but
7748: only for the current element.</P>
7749: <P>
7750: The <TT>NoLineBreak</TT> rule is written with the <TT>NoLineBreak</TT> keyword
7751: followed by a semicolon.</P>
7752: <PRE>
7753: 'NoLineBreak' ';'
7754: </PRE>
7755: </DIV>
7756:
7757: <DIV class="subsection">
1.6 cvs 7758: <H3><A name=sectc5220>The <TT>ChangeMainFile</TT> rule</A></H3>
1.1 cvs 7759:
7760: <P>
7761: When the translation program starts, it opens a main output file, whose name
1.6 cvs 7762: is given as a parameter of the program. All <A href="#sectc5210"><TT>Create</TT>
1.1 cvs 7763: rules</A> without explicit indication of the output file write sequentially in
7764: this file. When a <TT>ChangeMainFile</TT> rule is executed, the main output
7765: file is closed and it is replaced by a new one, whose name is specified in the
7766: <TT>ChangeMainFile</TT> rule. The <TT>Create</TT> rules without indication of
7767: the output file that are then executed write in this new file. Several
7768: <TT>ChangeMainFile</TT> rules can be executed during the same translation, for
7769: dividing the main output into several files.</P>
7770: <P>
7771: This rule is written with the <TT>ChangeMainFile</TT> keyword followed by the
7772: name of a variable that specify the name of the new main file. The keyword
7773: <TT>Before</TT> or <TT>After</TT> can be placed at the end of the rule to
7774: specify whether the operation should be performed before or after translation
7775: of the rule's element (the default is before). This rule, like all translation
7776: rules, is terminated by a semicolon.</P>
7777: <PRE>
7778: 'ChangeMainFile' VarID [ Position ] ';'
7779: </PRE>
7780: <BLOCKQUOTE class="example">
7781: <P>
7782: <STRONG>Example:</STRONG></P>
7783: <P>
1.3 cvs 7784: To generate the translation of each section in a different file, the following
7785: rule can be associated with type <TT>Section</TT>. That rule uses the <A
7786: href="#varoutputfile"><TT>VarOutpuFile</TT> variable</A> defined above.</P>
1.1 cvs 7787: <PRE>
7788: Section:
7789: ChangeMainFile VarOutpuFile Before;
7790: </PRE>
7791: <P>
1.3 cvs 7792: If <TT>output.txt</TT> is the name of the output file specified when starting
7793: the translation program, translated sections are written in files
1.1 cvs 7794: <TT>output1.txt</TT>, <TT>output2.txt</TT>, etc.</P>
7795: </BLOCKQUOTE>
7796: </DIV>
7797:
7798: <DIV class="subsection">
1.6 cvs 7799: <H3><A name=sectc5221>The <TT>Set</TT> and <TT>Add</TT> rules</A></H3>
1.1 cvs 7800:
7801: <P>
7802: The <TT>Set</TT> and <TT>Add</TT> rules are used for modifying the value of
1.6 cvs 7803: counters that have no <A href="#sectc524">counting function</A>. Only this
1.1 cvs 7804: type of counter can be used in the <TT>Set</TT> and <TT>Add</TT> rules.</P>
7805: <P>
7806: Both rules have the same syntax: after the keyword <TT>Set</TT> or
7807: <TT>Add</TT> appear the counter name and the value to assign to the counter
7808: (<TT>Set</TT> rule) or the value to be added to the counter (<TT>Add</TT>
7809: rule). The keyword <TT>Before</TT> or <TT>After</TT> can follo9w that value to
7810: indicate when the rule must be applied: before or after the element's content
7811: is translated. By default, <TT>Before</TT> is assumed. A semicolon terminates
7812: the rule.</P>
7813: <PRE>
7814: 'Set' CounterID InitValue [ Position ] ';' /
7815: 'Add' CounterID Increment [ Position ] ';'
7816: </PRE>
7817: </DIV>
7818:
7819: <DIV class="subsection">
1.10 cvs 7820: <H3><A name=sectc5221a>The <TT>Indent</TT> rule</A></H3>
7821:
7822: <P>
7823: The <TT>Indent</TT> rule is used to modify the value of text indentation
7824: in the output files.</P>
7825: <P>
7826: Each time the translator creates a new line in an output file, it generates
7827: a variable number of space characters at the beginning of the new line. By
7828: default, the number of these characters (the indentation) is 0. It can be
7829: changed with the <TT>Indent</TT> rule.</P>
7830: <P>
7831: The rule begins with the <TT>Indent</TT> keyword, followed by the indentation
7832: sign (optional) and value and a keyword <TT>Before</TT> or <TT>After</TT>
7833: indicating that the indentation should be changed <A href="#sectc5222">before
7834: or after</A> the element's content is generated. If the position is not
7835: indicated, the indentation is changed before the element's content is
7836: generated. This rule, like all translation rules, is terminated by a
7837: semicolon.</P>
7838: <P>
7839: The indentation value is indicated by an integer, which is the number of
7840: space characters to be generated at the beginning of each new line.
7841: A sign (<TT>+</TT> or <TT>-</TT>) can appear before the integer to indicate
7842: that the value is relative: the current value of indentation is incremented
7843: (if sign is <TT>+</TT>) or decremented (if sign is <TT>-</TT>) by the
7844: specified value.
7845: <P>
7846: Like the <A href="#sectc5210"><TT>Create</TT> rule</A>, the <TT>Indent</TT>
7847: keyword can be followed by the <TT>IN</TT> keyword and by the name of a
7848: <A href="#sectc526">variable</A>. This means that the rule must not change
7849: indentation in the main output file, but in the file whose name is specified
7850: by the variable (by default, indentation is changed in the main output
7851: file).</P>
7852: <PRE>
7853: 'Indent' [ 'IN' VarID ] [ IndentSign ]
7854: IndentValue [ Position ] ';' .
7855:
7856: IndentSign = '+' / '-' .
7857: IndentValue = NUMBER .
7858: </PRE>
7859: </DIV>
7860:
7861: <DIV class="subsection">
1.6 cvs 7862: <H3><A name=sectc5222>Rule application order</A></H3>
1.1 cvs 7863:
7864: <P>
7865: The translator translates the elements which comprise the document in the
7866: order induced by the tree structure, except when the <TT>Get</TT> rule is used
7867: to change the order of translation. For each element, the translator first
7868: applies the rules specified for the element's type that must be applied before
7869: translation of the element's content (rules ending with the <TT>Before</TT>
7870: keyword or which have no position keyword). If several rules meet these
7871: criteria, the translator applies them in the order in where they appear in the
7872: translation schema.</P>
7873: <P>
1.6 cvs 7874: It then applies all <A href="#sectc5223">rules for the attributes</A> which
1.1 cvs 7875: the element has and which must be applied before the translation of the
7876: element's content (rules ending with the <TT>Before</TT> keyword or which have
7877: no position keyword). For one attribute value, the translator applies the
7878: rules in the order in which they are defined in the translation schema.</P>
7879: <P>
7880: The same procedure is followed with translation rules for specific
7881: presentations.</P>
7882: <P>
7883: Next, the element's content is translated, as long as a <TT>Remove</TT> rule
7884: does not apply.</P>
7885: <P>
7886: In the next step, the translator applies rules for the specific presentation
7887: of the element that are to be applied after translation of the content (rules
7888: which end with the <TT>After</TT> keyword). The rules for each type of
7889: presentation rule or each value are applied in the order in which the
7890: translation appear in the schema.</P>
7891: <P>
7892: Then, the same procedure is followed for translation rules for attributes of
7893: the element.</P>
7894: <P>
7895: Finally, the translator applies rules for the element which must be applied
7896: after translation of the element's content. These rules are applied in the
7897: order that they appear in the translation schema. When the translation of an
7898: element is done, the translator procedes to translate the following
7899: element.</P>
7900: <P>
7901: This order can be changed with the <TT>Attributes</TT> and
1.6 cvs 7902: <TT>Presentation</TT> options of the <A href="#sectc5210"><TT>Create</TT>
1.1 cvs 7903: rule</A>.</P>
7904: </DIV>
7905:
7906: <DIV class="subsection">
1.6 cvs 7907: <H3><A name=sectc5223>Translation of logical attributes</A></H3>
1.1 cvs 7908:
7909: <P>
7910: After the rules for the element types, the translation schema defines rules
7911: for attribute values. This section begins with the <TT>ATTRIBUTES</TT>
7912: keyword and is composed of a sequence of rule blocks each preceded by an
7913: attribute name and an optional value or value range.</P>
7914: <P>
7915: If the attribute's name appears alone before the rule block, the rule are
7916: applied to all element which have the attribute, no matter what value the
7917: attribute has. In this case, the attribute name is followed by a colon before
7918: the beginning of the rule block.</P>
7919: <P>
7920: The attribute's name can be followed by the name of an element type between
7921: parentheses. This says, as in presentation schemas, that the rule block which
7922: follows applies not to the element which has the attribute, but to its
7923: descendants of the type indicated between the parentheses.</P>
7924: <P>
7925: If values are given after the attribute name (or after the name of the element
7926: type), the rules are applied only when the attribute has the indicated values.
7927: The same attribute can appear several times, with different values and
7928: different translation rules. Attribute values are indicated in the same way
1.6 cvs 7929: as in <A href="#sectc528">conditions</A> and are followed by a colon before
1.1 cvs 7930: the block of rules.</P>
7931: <P>
7932: The rule block associated with an attribute is either a simple rule or a
7933: sequence of rules delimited by the <TT>BEGIN</TT> and <TT>END</TT> keywords.
7934: Note that rules associated with attribute values cannot be conditional.</P>
7935: <P>
7936: Translation rules are not required for all attributes (or their values)
7937: defined in a structure schema. Only those attributes for which a particular
7938: action must be performed by the translator must have such rules. The rules
7939: that can be used are those described above, from <A
1.6 cvs 7940: href="#sectc5210"><TT>Create</TT></A> to <A
7941: href="#sectc5218"><TT>NoTranslation</TT></A>.</P>
1.1 cvs 7942: <PRE>
7943: AttrSeq = TransAttr < TransAttr > .
7944: TransAttr = AttrID [ '(' ElemID ')' ]
7945: [ RelatAttr ] ':' RuleSeq .
7946: AttrID = NAME .
7947: ElemID = NAME .
7948: </PRE>
7949: <BLOCKQUOTE class="example">
7950: <P>
7951: <STRONG>Example:</STRONG></P>
7952: <P>
1.3 cvs 7953: The structure defined the ``Language'' attribute which can take the values
7954: ``French'' and ``English''. To have the French parts of the original document
7955: removed and prevent the translation of the leaves of the English parts, the
1.1 cvs 7956: following rules would be used:</P>
7957: <PRE>
7958: ATTRIBUTES
7959: Language=French :
7960: Remove;
7961: Language=English :
7962: NoTranslation;
7963: </PRE>
7964: </BLOCKQUOTE>
7965: </DIV>
7966:
7967: <DIV class="subsection">
1.6 cvs 7968: <H3><A name=sectc5224>Translation of specific presentations</A></H3>
1.1 cvs 7969:
7970: <P>
7971: After the rules for attributes, the translation schema defines rules for the
7972: specific presentation. This section begins with the <TT>PRESENTATION</TT>
7973: keyword and is composed of a sequence of translation rule blocks each preceded
7974: by a presentation rule name, optionally accompanied by a part which depends on
7975: the particular presentation rule.</P>
7976: <P>
7977: Each of these translation rule blocks is applied when the translator operates
7978: on an element which has a specific presentation rule of the type indicated at
7979: the head of the block. Depending on the type of the specific presentation
7980: rule, it is possible to specify values of the presentation rule for which the
7981: translation rule block should be applied.</P>
7982: <P>
7983: There are three categories of the presentation rules:</P>
7984: <UL>
1.2 cvs 7985: <LI>rules taking numeric values: <TT>Size</TT>, <TT>Indent</TT>,
7986: <TT>LineSpacing</TT>, <TT>LineWeight</TT>,
7987: <LI>rules whose values are taken from a predefined list (i.e. whose type is an
1.1 cvs 7988: enumeration): <TT>Adjust</TT>, <TT>Justify</TT>, <TT>Hyphenate,/TT>,
7989: <TT>Style</TT>, <TT>Font</TT>, <TT>UnderLine</TT>, <TT>Thickness</TT>,
7990: <TT>LineStyle</TT>,</TT>
1.2 cvs 7991: <LI>rules whose value is a name: <TT>FillPattern</TT>, <TT>Background</TT>,
7992: <TT>Foreground</TT>.
1.1 cvs 7993: </UL>
7994: <P>
7995: For presentation rules of the first category, the values which provoke
7996: application of the translation rules are indicated in the same manner as for
7997: <A href="#relattr">numeric attributes</A>. This can be either a unique value
7998: or range of values. For a unique value, the value (an integer) is simply
7999: preceded by an equals sign. Value ranges can be specified in one of three
8000: ways:</P>
8001: <UL>
1.2 cvs 8002: <LI>all values less than a given value (this value is preceded by a ``less
1.5 cvs 8003: than'' sign '<TT><</TT>'),
1.2 cvs 8004: <LI>all values greater than a given value (this value is preceded by a`
1.5 cvs 8005: `greater than'' sign '<TT>></TT>'),
1.2 cvs 8006: <LI>all values falling in an interval, bounds included. The range of values
8007: is then specified <TT>IN [</TT>Minimum<TT>..</TT>Maximum<TT>]</TT>, where
8008: Minimum and Maximum are integers.
1.1 cvs 8009: </UL>
8010: <P>
1.2 cvs 8011: All numeric values can be negative, in which case the integer is preceded by a
8012: minus sign. All values must be given in typographers points.</P>
1.1 cvs 8013: <P>
8014: For presentation rules whose values are taken from a predefined list, the
8015: value which provokes application of the translation rules is simply indicated
8016: by the equals sign followed by the name of the value.</P>
8017: <P>
8018: For presentation rules whose values are names, the value which provokes the
8019: application of translation rules is simply indicated by the equals sign
8020: followed by the name of the value. The names of the fill patterns (the
8021: <TT>FillPattern</TT> rule) and of the colors (the <TT>Foreground</TT> and
8022: <TT>Background</TT> rules) used in Thot are the same as in the P language.</P>
8023: <PRE>
8024: PresSeq = PresTrans < PresTrans > .
8025: PresTrans = PresRule ':' RuleSeq .
8026: PresRule = 'Size' [ PresRelation ] /
8027: 'Indent' [ PresRelation ] /
8028: 'LineSpacing' [ PresRelation ] /
8029: 'Adjust' [ '=' AdjustVal ] /
8030: 'Justify' [ '=' BoolVal ] /
8031: 'Hyphenate' [ '=' BoolVal ] /
8032: 'Style' [ '=' StyleVal ] /
8033: 'Font' [ '=' FontVal ] /
8034: 'UnderLine' [ '=' UnderLineVal ] /
8035: 'Thickness' [ '=' ThicknessVal ] /
8036: 'LineStyle' [ '=' LineStyleVal ] /
8037: 'LineWeight' [ PresRelation ] /
8038: 'FillPattern' [ '=' Pattern ] /
8039: 'Background' [ '=' Color ] /
8040: 'Foreground' [ '=' Color ] .
8041:
8042: PresRelation = '=' PresValue /
8043: '>' [ '-' ] PresMinimum /
8044: '<' [ '-' ] PresMaximum /
8045: 'IN' '[' [ '-' ] PresIntervalMin '..'
8046: [ '-' ] PresIntervalMax ']' .
8047: AdjustVal = 'Left' / 'Right' / 'VMiddle' /
8048: 'LeftWithDots' .
8049: BoolVal = 'Yes' / 'No' .
8050: StyleVal = 'Bold' / 'Italics' / 'Roman' /
8051: 'BoldItalics' / 'Oblique' /
8052: 'BoldOblique' .
8053: FontVal = 'Times' / 'Helvetica' / 'Courier' .
8054: UnderLineVal = 'NoUnderline' / 'UnderLined' /
8055: 'OverLined' / 'CrossedOut' .
8056: ThicknessVal = 'Thick' / 'Thin' .
1.6 cvs 8057: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' .
1.1 cvs 8058: Pattern = NAME .
8059: Color = NAME .
8060: PresMinimum = NUMBER .
8061: PresMaximum = NUMBER .
8062: PresIntervalMin= NUMBER .
8063: PresIntervalMax= NUMBER .
8064: PresValue = [ '-' ] PresVal .
8065: PresVal = NUMBER .
8066: </PRE>
8067: <P>
8068: The <A name="prestransl">translation rules associated with specific
8069: presentation rules</A> can use the value of the specific presentation rule
8070: that causes them to be applied. This behavior is designated by the keyword
8071: <TT>Value</TT>. For numerically-valued presentation rules, the numeric value
8072: is produced. For other presentation rules, the name of the value is
8073: produced.</P>
8074: <P>
8075: It should be noted that modifications to the layout of the document's elements
8076: that are made using the combination of the control key and a mouse button will
8077: have no effect on the translation of the document.</P>
8078: <BLOCKQUOTE class="example">
8079: <P>
8080: <STRONG>Example:</STRONG></P>
8081: <P>
1.3 cvs 8082: Suppose that it is desirable to use the same font sizes as in the specific
8083: presentation, but the font size must be between 10 and 18 typographer's points.
8084: If font size is set in the translated document by the string
8085: <TT>pointsize=n</TT> where <TT>n</TT> is the font size in typographer's points
1.1 cvs 8086: then the following rules will suffice:</P>
8087: <PRE>
8088: PRESENTATION
8089: Size < 10 :
8090: Create 'pointsize=10';
8091: Size in [10..18] :
8092: BEGIN
8093: Create 'pointsize=';
8094: Create Value;
8095: END;
8096: Size > 18 :
8097: Create 'pointsize=18';
8098: </PRE>
8099: </BLOCKQUOTE>
8100: </DIV>
8101:
8102: <DIV class="subsection">
1.6 cvs 8103: <H3><A name=sectc5225>Recoding of characters, symbols and graphics</A></H3>
1.1 cvs 8104:
8105: <P>
8106: The coding of characters, graphical elements and symbols as defined in Thot
8107: does not necessarily correspond to what is required by an application to which
8108: a Thot document must be exported. Because of this the translator can recode
8109: these terminal elements of the documents structure. The last sections of a
8110: translation schema are intended for this purpose, each specifying the recoding
8111: rules for one type of terminal element.</P>
8112: <P>
8113: The recoding rules for character strings are grouped by alphabets. There is a
8114: group of rules for each alphabet of the Thot document that must be translated.
8115: Each such group of rules begins with the <TT>TEXTTRANSLATE</TT> keyword,
8116: followed by the specification of the alphabet to translate and the recoding
8117: rules, between the <TT>BEGIN</TT> and <TT>END</TT> keywords unless there is
8118: only one recoding rule for the alphabet. The specification of the alphabet is
8119: not required: by default it is assumed to the Latin alphabet (the ISO Latin-1
8120: character set).</P>
8121: <P>
8122: Each recoding rule is formed by a source string between apostrophes and a
8123: target string, also between apostrophes, the two strings being separated by
8124: the arrow symbol (<TT>-></TT>), formed by the ``minus'' and ``greater than''
8125: characters. The rule is terminated by a semi-colon.</P>
8126: <PRE>
8127: TextTransSeq = [ Alphabet ] TransSeq .
8128: Alphabet = NAME .
8129: TransSeq ='BEGIN' < Translation > 'END' ';' /
8130: Translation .
8131: Translation = Source [ '->' Target ] ';' .
8132: Source = STRING .
8133: Target = STRING .
8134: </PRE>
8135: <P>
8136: One such rule signifies that when the source string appears in a text leaf of
8137: the document being translated, the translator must replace it, in the
8138: translated document, with the target string. The source string and the target
8139: string can have different lengths and the target string can be empty. In this
8140: last case, the translator simply suppresses every occurrence of the source
8141: string in the translated document.</P>
8142: <P>
8143: For a given alphabet, the order of the rules is not important and has no
8144: significance because the T language compiler reorders the rules in ways that
8145: speed up the translator's work. The total number of recoding rules is limited
8146: by the compiler as is the maximum length of the source and target strings.</P>
8147: <P>
8148: The recoding rules for symbols and graphical elements are written in the same
8149: manner as the recoding rules for character strings. They are preceded,
8150: respectively, by the <TT>SYMBTRANSLATE</TT> and <TT>GRAPHTRANSLATE</TT> and so
8151: not require a specification of the alphabet. Their source string is limited to
8152: one character, since, in Thot, each symbol and each graphical element is
8153: represented by a single character. The symbol and graphical element codes are
1.6 cvs 8154: defined along with the <A href="#sect7">non-standard character
1.1 cvs 8155: codes</A>.</P>
8156: <BLOCKQUOTE class="example">
8157: <P>
8158: <STRONG>Example:</STRONG></P>
8159: <P>
8160: In a translation schema producing documents destined for use with
1.3 cvs 8161: the L<SUP>A</SUP>T<SUB><BIG>E</BIG></SUB>X formatter, the Latin
1.1 cvs 8162: characters``é'' (octal code 351 in Thot) and ``è'' (octal code
1.3 cvs 8163: 350 in Thot) must be converted to their representation
8164: in L<SUP>A</SUP>T<SUB><BIG>E</BIG></SUB>X:</P>
1.1 cvs 8165: <PRE>
1.6 cvs 8166: TEXTTRANSLATE Latin
1.1 cvs 8167: BEGIN
8168: '\350' -> '\`{e}'; { e grave }
8169: '\351' -> '\''{e}'; { e acute }
8170: END;
8171: </PRE>
8172: </BLOCKQUOTE>
8173: </DIV>
8174: </DIV>
8175: <HR>
8176: </DIV>
8177:
8178: <DIV class="chapter">
1.6 cvs 8179: <H1><A name=sect6>Language grammars</A></H1>
1.1 cvs 8180:
8181: <P>
8182: This chapter gives the complete grammars of the languages of Thot. The
8183: grammars were presented and described in the preceding chapters, which also
8184: specify the semantics of the languages. This section gives only the
8185: syntax.</P>
8186:
8187: <DIV class="section">
1.6 cvs 8188: <H2><A name=sectb61>The M meta-language</A></H2>
1.1 cvs 8189:
8190: <P>
8191: The language grammars are all expressed in the same formalism, the M
8192: meta-language, which is defined in this section.</P>
8193: <PRE>
8194: { Any text between braces is a comment. }
8195: Grammar = Rule < Rule > 'END' .
8196: { The < and > signs indicate zero }
8197: { or more repetitions. }
8198: { END marks the end of the grammar. }
8199: Rule = Ident '=' RightPart '.' .
8200: { The period indicates the end of a rule }
8201: RightPart = RtTerminal / RtIntermed .
8202: { The slash indicates a choice }
8203: RtTerminal ='NAME' / 'STRING' / 'NUMBER' .
8204: { Right part of a terminal rule }
8205: RtIntermed = Possibility < '/' Possibility > .
8206: { Right part of an intermediate rule }
8207: Possibility = ElemOpt < ElemOpt > .
8208: ElemOpt = Element / '[' Element < Element > ']' /
8209: '<' Element < Element > '>' .
8210: { Brackets delimit optional parts }
8211: Element = Ident / KeyWord .
8212: Ident = NAME .
8213: { Identifier, sequence of characters
8214: KeyWord = STRING .
8215: { Character string delimited by apostrophes }
8216: END
8217: </PRE>
8218: </DIV>
8219:
8220: <DIV class="section">
1.6 cvs 8221: <H2><A name=sectb62>The S language</A></H2>
1.1 cvs 8222:
8223: <P>
8224: The S language is used to write structure schemas, which contain the generic
8225: logical structures of document and object classes. It is described here in
8226: the M meta-language.</P>
8227: <PRE>
8228: StructSchema = 'STRUCTURE' [ 'EXTENSION' ] ElemID ';'
8229: 'DEFPRES' PresID ';'
8230: [ 'ATTR' AttrSeq ]
8231: [ 'PARAM' RulesSeq ]
8232: [ 'STRUCT' RulesSeq ]
8233: [ 'EXTENS' ExtensRuleSeq ]
8234: [ 'ASSOC' RulesSeq ]
8235: [ 'UNITS' RulesSeq ]
8236: [ 'EXPORT' SkeletonSeq ]
8237: [ 'EXCEPT' ExceptSeq ]
8238: 'END' .
8239:
8240: ElemID = NAME .
8241: PresID = NAME .
8242:
8243: AttrSeq = Attribute < Attribute > .
8244: Attribute = AttrID '=' AttrType ';' .
8245: AttrType = 'INTEGER' / 'TEXT' /
8246: 'REFERENCE' '(' RefType ')' /
8247: ValueSeq .
8248: RefType = 'ANY' /
8249: [ FirstSec ] ElemID [ ExtStruct ] .
8250: ValueSeq = AttrVal < ',' AttrVal > .
8251: AttrID = NAME .
8252: FirstSec = 'First' / 'Second' .
8253: ExtStruct = '(' ElemID ')' .
8254: AttrVal = NAME .
8255:
8256: RulesSeq = Rule < Rule > .
8257: Rule = ElemID [ LocAttrSeq ] '='
8258: DefWithAttr ';' .
8259: LocAttrSeq = '(' 'ATTR' LocalAttr
8260: < ';' LocalAttr > ')' .
8261: LocalAttr = [ '!' ] AttrID [ '=' AttrType ] .
8262: DefWithAttr = Definition
8263: [ '+' '(' ExtensionSeq ')' ]
8264: [ '-' '(' RestrictSeq ')' ]
8265: [ 'WITH' FixedAttrSeq ] .
8266: ExtensionSeq = ExtensionElem < ',' ExtensionElem > .
8267: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' /
8268: 'SYMBOL' / 'PICTURE' .
8269: RestrictSeq = RestrictElem < ',' RestrictElem > .
8270: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' /
8271: 'SYMBOL' / 'PICTURE' .
8272: FixedAttrSeq = FixedAttr < ',' FixedAttr > .
8273: FixedAttr = AttrID [ FixedOrModifVal ] .
8274: FixedOrModifVal= [ '?' ] '=' FixedValue .
8275: FixedValue = [ '-' ] NumValue / TextValue / AttrVal .
8276: NumValue = NUMBER .
8277: TextValue = STRING .
8278:
8279: Definition = BaseType [ LocAttrSeq ] / Constr /
8280: Element .
8281: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' /
8282: 'PICTURE' / 'UNIT' / 'NATURE' .
8283: Element = ElemID [ ExtOrDef ] .
8284: ExtOrDef = 'EXTERN' / 'INCLUDED' /
8285: [ LocAttrSeq ] '=' Definition .
8286:
8287: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF'
8288: '(' DefWithAttr ')' /
8289: 'BEGIN' DefOptSeq 'END' /
8290: 'AGGREGATE' DefOptSeq 'END' /
8291: 'CASE' 'OF' DefSeq 'END' /
8292: 'REFERENCE' '(' RefType ')' /
8293: 'PAIR' .
8294:
8295: min = Integer / '*' .
8296: max = Integer / '*' .
8297: Integer = NUMBER .
8298:
8299: DefOptSeq = DefOpt ';' < DefOpt ';' > .
8300: DefOpt = [ '?' ] DefWithAttr .
8301:
8302: DefSeq = DefWithAttr ';' < DefWithAttr ';' > .
8303:
8304: SkeletonSeq = SkeletonElem < ',' SkeletonElem > ';' .
8305: SkeletonElem = ElemID [ 'WITH' Contents ] .
8306: Contents = 'Nothing' / ElemID [ ExtStruct ] .
8307:
8308: ExceptSeq = Except ';' < Except ';' > .
8309: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr ':'
8310: ExcValSeq .
8311: ExcTypeOrAttr = ElemID / AttrID .
8312: ExcValSeq = ExcValue < ',' ExcValue > .
8313: ExcValue = 'NoCut' / 'NoCreate' /
8314: 'NoHMove' / 'NoVMove' / 'NoMove' /
8315: 'NoHResize' / 'NoVResize' / 'NoResize' /
1.13 ! cvs 8316: 'MoveResize' /
1.1 cvs 8317: 'NewWidth' / 'NewHeight' /
8318: 'NewHPos' / 'NewVPos' /
8319: 'Invisible' / 'NoSelect' /
8320: 'Hidden' / 'ActiveRef' /
8321: 'ImportLine' / 'ImportParagraph' /
1.9 cvs 8322: 'NoPaginate' / 'ParagraphBreak' /
8323: 'HighlightChildren' / 'ExtendedSelection' /
8324: 'ReturnCreateNL' .
1.1 cvs 8325:
8326: ExtensRuleSeq = ExtensRule ';' < ExtensRule ';' > .
8327: ExtensRule = RootOrElem [ LocAttrSeq ]
8328: [ '+' '(' ExtensionSeq ')' ]
8329: [ '-' '(' RestrictSeq ')' ]
8330: [ 'WITH' FixedAttrSeq ] .
8331: RootOrElem = 'Root' / ElemID .
8332:
8333: END
8334: </PRE>
8335: </DIV>
8336:
8337: <DIV class="section">
1.6 cvs 8338: <H2><A name=sectb63>The P language</A></H2>
1.1 cvs 8339:
8340: <P>
8341: The P language is used to write presentation schemas, which define the
8342: graphical presentation rules to be applied to different classes of documents
8343: and objects. It is described here in the M meta-language.</P>
8344: <PRE>
8345: PresSchema = 'PRESENTATION' ElemID ';'
8346: [ 'VIEWS' ViewSeq ]
8347: [ 'PRINT' PrintViewSeq ]
8348: [ 'COUNTERS' CounterSeq ]
8349: [ 'CONST' ConstSeq ]
8350: [ 'VAR' VarSeq ]
8351: [ 'DEFAULT' ViewRuleSeq ]
8352: [ 'BOXES' BoxSeq ]
8353: [ 'RULES' PresentSeq ]
8354: [ 'ATTRIBUTES' PresAttrSeq ]
8355: [ 'TRANSMIT' TransmitSeq ]
8356: 'END' .
8357:
8358: ElemID = NAME .
8359:
8360: ViewSeq = ViewDeclaration
8361: < ',' ViewDeclaration > ';' .
8362: ViewDeclaration = ViewID [ 'EXPORT' ] .
8363: ViewID = NAME .
8364:
8365: PrintViewSeq = PrintView < ',' PrintView > ';' .
8366: PrintView = ViewID / ElemID .
8367:
8368: CounterSeq = Counter < Counter > .
8369: Counter = CounterID ':' CounterFunc ';' .
8370: CounterID = NAME .
8371: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ]
8372: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] /
8373: SetFunction < SetFunction >
8374: AddFunction < AddFunction >
8375: [ 'INIT' AttrID ] /
8376: 'RLEVEL' 'OF' ElemID .
8377: SLevelAsc = [ '-' ] LevelAsc .
8378: LevelAsc = NUMBER .
8379: SetFunction = 'SET' CounterValue 'ON' TypeOrPage .
8380: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage .
8381: TypeOrPage = 'Page' [ '(' ViewID ')' ] /
8382: [ '*' ] ElemID .
8383: CounterValue = NUMBER .
8384:
8385: ConstSeq = Const < Const > .
8386: Const = ConstID '=' ConstType ConstValue ';' .
8387: ConstID = NAME .
8388: ConstType = 'Text' [ Alphabet ] / 'Symbol' /
8389: 'Graphics' / 'Picture' .
8390: ConstValue = STRING .
8391: Alphabet = NAME .
8392:
8393: VarSeq = Variable < Variable > .
8394: Variable = VarID ':' FunctionSeq ';' .
8395: VarID = NAME .
8396: FunctionSeq = Function < Function > .
8397: Function = 'DATE' / 'FDATE' /
8398: 'DocName' / 'DirName' /
8399: 'ElemName' / 'AttributeName' /
8400: ConstID / ConstType ConstValue /
8401: AttrID /
8402: 'VALUE' '(' PageAttrCtr ','
8403: CounterStyle ')' .
8404: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] /
8405: [ MinMax ] CounterID / AttrID .
8406: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' /
8407: 'Uppercase' / 'Lowercase' .
8408: MinMax = 'MaxRangeVal' / 'MinRangeVal' .
8409:
8410: BoxSeq = Box < Box > .
8411: Box = 'FORWARD' BoxID ';' /
8412: BoxID ':' ViewRuleSeq .
8413: BoxID = NAME .
8414:
8415: PresentSeq = Present < Present > .
8416: Present = [ '*' ] [ FirstSec ] ElemID ':'
8417: ViewRuleSeq .
8418: FirstSec = 'First' / 'Second' .
8419:
8420: PresAttrSeq = PresAttr < PresAttr > .
8421: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ]
8422: [ AttrRelation ] ':' ViewRuleSeq .
8423: AttrID = NAME .
8424: AttrRelation = '=' AttrVal /
8425: '>' [ '-' ] MinValue /
8426: '<' [ '-' ] MaxValue /
8427: 'IN' '[' [ '-' ] LowerBound '..'
8428: [ '-' ] UpperBound ']' /
8429: 'GREATER' AttrID /
8430: 'EQUAL' AttrID /
8431: 'LESS' AttrID .
8432: AttrVal = [ '-' ] EqualNum / EqualText / AttrValue .
8433: MinValue = NUMBER .
8434: MaxValue = NUMBER .
8435: LowerBound = NUMBER .
8436: UpperBound = NUMBER.
8437: EqualNum = NUMBER .
8438: EqualText = STRING .
8439: AttrValue = NAME .
8440:
8441: ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules >
8442: 'END' ';' /
8443: ViewRules / CondRules / Rule .
8444: RulesAndCond = CondRules / Rule .
8445: ViewRules = 'IN' ViewID CondRuleSeq .
8446: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' /
8447: CondRules / Rule .
8448: CondRules = CondRule < CondRule >
8449: [ 'Otherwise' RuleSeq ] .
8450: CondRule = 'IF' ConditionSeq RuleSeq .
8451: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / Rule .
8452:
1.6 cvs 8453: ConditionSeq = Condition < 'AND' Condition > .
8454: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem .
8455: ConditionElem = 'First' / 'Last' /
8456: [ 'Immediately' ] 'Within' [ NumParent ]
8457: ElemID [ ExtStruct ] /
8458: ElemID /
8459: 'Referred' / 'FirstRef' / 'LastRef' /
8460: 'ExternalRef' / 'InternalRef' / 'CopyRef' /
8461: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' /
8462: 'UserPage' / 'StartPage' / 'ComputedPage' /
8463: 'Empty' /
8464: '(' [ MinMax ] CounterName CounterCond ')' /
8465: CondPage '(' CounterID ')' .
8466: NumParent = [ GreaterLess ] NParent .
8467: GreaterLess = '>' / '<' .
8468: NParent = NUMBER.
8469: CounterCond = '<' MaxCtrVal / '>' MinCtrVal /
8470: '=' EqCtrVal /
8471: 'IN' '[' ['-'] MinCtrBound '..'
8472: ['-'] MaxCtrBound ']' .
8473: PageCond = 'Even' / 'Odd' / 'One' .
8474: MaxCtrVal = NUMBER .
8475: MinCtrVal = NUMBER .
8476: EqCtrVal = NUMBER .
8477: MaxCtrBound = NUMBER .
8478: MinCtrBound = NUMBER .
1.1 cvs 8479:
8480: Rule = PresParam ';' / PresFunc ';' .
8481: PresParam = 'VertRef' ':' HorizPosition /
8482: 'HorizRef' ':' VertPosition /
8483: 'VertPos' ':' VPos /
8484: 'HorizPos' ':' HPos /
8485: 'Height' ':' Extent /
8486: 'Width' ':' Extent /
8487: 'VertOverflow' ':' Boolean /
8488: 'HorizOverflow' ':' Boolean /
8489: 'LineSpacing' ':' DistOrInherit /
8490: 'Indent' ':' DistOrInherit /
8491: 'Adjust' ':' AlignOrInherit /
8492: 'Justify' ':' BoolInherit /
8493: 'Hyphenate' ':' BoolInherit /
8494: 'PageBreak' ':' Boolean /
8495: 'LineBreak' ':' Boolean /
8496: 'InLine' ':' Boolean /
8497: 'NoBreak1' ':' AbsDist /
8498: 'NoBreak2' ':' AbsDist /
8499: 'Gather' ':' Boolean /
8500: 'Visibility' ':' NumberInherit /
8501: 'Size' ':' SizeInherit /
8502: 'Font' ':' NameInherit /
8503: 'Style' ':' StyleInherit /
8504: 'Underline' ':' UnderLineInherit /
8505: 'Thickness' ':' ThicknessInherit /
8506: 'Depth' ':' NumberInherit /
8507: 'LineStyle' ':' LineStyleInherit /
8508: 'LineWeight' ':' DistOrInherit /
8509: 'FillPattern' ':' NameInherit /
8510: 'Background' ':' NameInherit /
1.13 ! cvs 8511: 'Foreground' ':' NameInherit /
1.1 cvs 8512: 'Content' ':' VarConst .
8513: PresFunc = Creation '(' BoxID ')' /
8514: 'Line' /
8515: 'NoLine' /
8516: 'Page' '(' BoxID ')' /
1.13 ! cvs 8517: 'Copy' '(' BoxTypeToCopy ')' /
! 8518: 'ShowBox' /
! 8519: 'BackgroundPicture' ':' FileName /
! 8520: 'PictureMode' ':' PictMode .
1.1 cvs 8521:
8522: BoxTypeToCopy = BoxID [ ExtStruct ] /
8523: ElemID [ ExtStruct ] .
8524: ExtStruct = '(' ElemID ')' .
8525:
8526: Distance = [ Sign ] AbsDist .
8527: Sign = '+' / '-' .
8528: AbsDist = IntegerOrAttr [ '.' DecimalPart ]
8529: [ Unit ] .
8530: IntegerOrAttr = IntegerPart / AttrID .
8531: IntegerPart = NUMBER .
8532: DecimalPart = NUMBER .
8533: Unit = 'em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' /
8534: 'pc' / 'px' / '%' .
8535:
8536: HPos = 'nil' / VertAxis '=' HorizPosition
8537: [ 'UserSpecified' ] .
8538: VPos = 'nil' / HorizAxis '=' VertPosition
8539: [ 'UserSpecified' ] .
8540: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' .
8541: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .
8542:
1.6 cvs 8543: VertPosition = Reference '.' HorizAxis [ Distance ] .
8544: HorizPosition = Reference '.' VertAxis [ Distance ] .
8545: Reference = 'Enclosing' [ BoxTypeNot ] /
8546: 'Enclosed' [ BoxTypeNot ] /
8547: 'Previous' [ BoxTypeNot ] /
8548: 'Next' [ BoxTypeNot ] /
8549: 'Referred' [ BoxTypeNot ] /
8550: 'Creator' /
8551: 'Root' /
8552: '*' /
8553: BoxOrType .
8554: BoxOrType = BoxID /
8555: [ '*' ] [ FirstSec ] ElemID /
8556: 'AnyElem' / 'AnyBox' .
8557: BoxTypeNot = [ 'NOT' ] BoxOrType .
8558:
8559: Extent = Reference '.' HeightWidth
8560: [ Relation ] [ 'Min' ] /
8561: AbsDist [ 'UserSpecified' ] [ 'Min' ] /
8562: HPos / VPos .
8563: HeightWidth = 'Height' / 'Width' .
8564: Relation = '*' ExtentAttr '%' / Distance .
8565: ExtentAttr = ExtentVal / AttrID .
8566: ExtentVal = NUMBER .
8567:
8568: Inheritance = Kinship InheritedValue .
8569: Kinship = 'Enclosing' / 'GrandFather'/ 'Enclosed' /
8570: 'Previous' / 'Creator' .
8571: InheritedValue = '+' PosIntAttr [ 'Max' maximumA ] /
8572: '-' NegIntAttr [ 'Min' minimumA ] /
8573: '=' .
8574: PosIntAttr = PosInt / AttrID .
8575: PosInt = NUMBER .
8576: NegIntAttr = NegInt / AttrID .
8577: NegInt = NUMBER .
8578: maximumA = maximum / AttrID .
8579: maximum = NUMBER .
8580: minimumA = minimum / AttrID .
8581: minimum = NUMBER .
8582:
8583: AlignOrInherit = Kinship '=' / Alignment .
8584: Alignment = 'Left' / 'Right' / 'VMiddle' /
8585: 'LeftWithDots' .
1.1 cvs 8586:
1.6 cvs 8587: DistOrInherit = Kinship InheritedDist / Distance .
8588: InheritedDist = '=' / '+' AbsDist / '-' AbsDist .
1.1 cvs 8589:
1.6 cvs 8590: BoolInherit = Boolean / Kinship '=' .
8591: Boolean = 'Yes' / 'No' .
1.1 cvs 8592:
1.6 cvs 8593: NumberInherit = Integer / AttrID / Inheritance .
8594: Integer = NUMBER .
1.1 cvs 8595:
8596: LineStyleInherit= Kinship '=' / 'Solid' / 'Dashed' /
8597: 'Dotted' .
8598:
1.6 cvs 8599: SizeInherit = SizeAttr [ 'pt' ] / Kinship InheritedSize .
8600: InheritedSize = '+' SizeAttr [ 'pt' ]
8601: [ 'Max' MaxSizeAttr ] /
8602: '-' SizeAttr [ 'pt' ]
8603: [ 'Min' MinSizeAttr ] /
8604: '=' .
8605: SizeAttr = Size / AttrID .
8606: Size = NUMBER .
8607: MaxSizeAttr = MaxSize / AttrID .
8608: MaxSize = NUMBER .
8609: MinSizeAttr = MinSize / AttrID .
8610: MinSize = NUMBER .
8611:
8612: NameInherit = Kinship '=' / FontName .
8613: FontName = NAME .
8614: StyleInherit = Kinship '=' /
8615: 'Roman' / 'Bold' / 'Italics' /
8616: 'BoldItalics' / 'Oblique' / 'BoldOblique' .
1.1 cvs 8617: UnderLineInherit= Kinship '=' /
1.6 cvs 8618: 'NoUnderline' / 'Underlined' /
8619: 'Overlined' / 'CrossedOut' .
1.1 cvs 8620: ThicknessInherit= Kinship '=' / 'Thick' / 'Thin' .
1.13 ! cvs 8621:
! 8622: FileName = STRING .
! 8623: PictMode = 'NormalSize' / 'Scale' /
! 8624: 'RepeatXY' / 'RepeatX' / 'RepeatY' .
1.1 cvs 8625:
1.6 cvs 8626: VarConst = ConstID / ConstType ConstValue /
8627: VarID / '(' FunctionSeq ')' /
8628: ElemID .
8629:
8630: Creation = Create [ 'Repeated' ] .
8631: Create = 'CreateFirst' / 'CreateLast' /
8632: 'CreateBefore' / 'CreateAfter' /
8633: 'CreateEnclosing' .
8634:
8635: TransmitSeq = Transmit < Transmit > .
8636: Transmit = TypeOrCounter 'To' ExternAttr
8637: '(' ElemID ')' ';' .
8638: TypeOrCounter = CounterID / ElemID .
8639: ExternAttr = NAME .
1.1 cvs 8640:
8641: END
8642: </PRE>
8643: </DIV>
8644:
8645: <DIV class="section">
1.6 cvs 8646: <H2><A name=sectb64>The T language</A></H2>
1.1 cvs 8647:
8648: <PRE>
8649: TransSchema = 'TRANSLATION' ElemID ';'
8650: [ 'LINELENGTH' LineLength ';' ]
8651: [ 'LINEEND' CHARACTER ';' ]
8652: [ 'LINEENDINSERT' STRING ';' ]
8653: [ 'BUFFERS' BufferSeq ]
8654: [ 'COUNTERS' CounterSeq ]
8655: [ 'CONST' ConstSeq ]
8656: [ 'VAR' VariableSeq ]
8657: 'RULES' ElemSeq
8658: [ 'ATTRIBUTES' AttrSeq ]
8659: [ 'PRESENTATION' PresSeq ]
8660: < 'TEXTTRANSLATE' TextTransSeq >
8661: [ 'SYMBTRANSLATE' TransSeq ]
8662: [ 'GRAPHTRANSLATE' TransSeq ]
8663: 'END' .
8664:
8665: LineLength = NUMBER .
8666:
8667: BufferSeq = Buffer < Buffer > .
8668: Buffer = BufferID [ '(' 'Picture' ')' ] ';' .
8669: BufferID = NAME .
8670:
8671: CounterSeq = Counter < Counter > .
8672: Counter = CounterID [ ':' CounterFunc ] ';' .
8673: CounterID = NAME .
8674: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ]
8675: [ 'Init' AttrID ] /
8676: 'Rlevel' 'of' ElemID /
8677: 'Set' InitValue 'On' ElemID
8678: 'Add' Increment 'On' ElemID
8679: [ 'Init' AttrID ] .
8680: SLevelAsc = [ '-' ] LevelAsc .
8681: LevelAsc = NUMBER .
8682: InitValue = NUMBER .
8683: Increment = NUMBER .
8684: ElemID = NAME .
8685: AttrID = NAME .
8686:
8687: ConstSeq = Const < Const > .
8688: Const = ConstID '=' ConstValue ';' .
8689: ConstID = NAME .
8690: ConstValue = STRING .
8691:
8692: VariableSeq = Variable < Variable > .
8693: Variable = VarID ':' Function < Function > ';' .
8694: VarID = NAME .
8695: Function = 'Value' '(' CounterID [ ':' Length ]
8696: [ ',' CounterStyle ] ')' /
8697: 'FileDir' / 'FileName' / 'Extension' /
8698: 'DocumentName' / 'DocumentDir' /
8699: ConstID / CharString /
8700: BufferID / AttrID .
8701: Length = NUMBER .
8702: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' /
8703: 'Uppercase' / 'Lowercase' .
8704: CharString = STRING .
8705:
8706: ElemSeq = TransType < TransType > .
8707: TransType = [ FirstSec ] ElemID ':' RuleSeq .
8708: FirstSec = 'First' / 'Second' .
8709: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' .
8710: Rule = SimpleRule / ConditionBlock .
8711: ConditionBlock= 'IF' ConditionSeq SimpleRuleSeq .
8712: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' /
8713: SimpleRule .
8714:
8715: ConditionSeq = Condition [ 'AND' Condition ] .
8716: Condition = [ 'NOT' ] [ 'Target' ] Cond .
8717: Cond = CondElem / CondAscend .
8718: CondElem = 'FirstRef' / 'LastRef' /
8719: 'ExternalRef' /
8720: 'Defined' /
8721: 'Alphabet' '=' Alphabet /
8722: 'ComputedPage' / 'StartPage' /
8723: 'UserPage' / 'ReminderPage' /
8724: 'Empty' /
1.11 cvs 8725: ElemID /
1.1 cvs 8726: 'FirstAttr' / 'LastAttr' .
8727: CondAscend = [ Ascend ] CondOnAscend .
8728: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType .
8729: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] .
8730: CondRelLevel = NUMBER .
8731: CondOnAscend = 'First' / 'Last' /
8732: 'Referred' /
8733: [ 'Immediately' ] 'Within' [ NumParent ]
8734: ElemID [ ExtStruct ] /
8735: 'Attributes' /
8736: AttrID [ RelatAttr ] /
8737: 'Presentation' /
8738: PresRule /
8739: 'Comment' .
8740: NumParent = [ GreaterLess ] NParent .
8741: GreaterLess = '>' / '<' .
8742: NParent = NUMBER.
8743: Alphabet = NAME .
8744: RelatAttr = '=' Value /
8745: '>' [ '-' ] Minimum /
8746: '<' [ '-' ] Maximum /
8747: 'IN' '[' [ '-' ] MinInterval '..'
8748: [ '-' ] MaxInterval ']' .
8749: Value = [ '-' ] IntegerVal / TextVal / AttrValue .
8750: Minimum = NUMBER .
8751: Maximum = NUMBER .
8752: MinInterval = NUMBER .
8753: MaxInterval = NUMBER .
8754: IntegerVal = NUMBER .
8755: TextVal = STRING .
8756: AttrValue = NAME .
8757:
8758: SimpleRule = 'Create' [ 'IN' VarID ] Object
8759: [ Position ] ';' /
8760: 'Write' Object [ Position ] ';' /
8761: 'Read' BufferID [ Position ] ';' /
8762: 'Include' File [ Position ] ';' /
1.6 cvs 8763: 'Get' [ RelPosition ] ElemID
8764: [ ExtStruct ]
8765: [ Position ] ';' /
1.1 cvs 8766: 'Copy' [ RelPosition ] ElemID
8767: [ ExtStruct ]
8768: [ Position ] ';' /
8769: 'Use' TrSchema [ 'For' ElemID ] ';' /
8770: 'Remove' ';' /
8771: 'NoTranslation' ';' /
8772: 'NoLineBreak' ';' /
8773: 'ChangeMainFile' VarID [ Position ] ';' /
1.10 cvs 8774: 'Set' CounterID InitValue [ Position ] ';' /
8775: 'Add' CounterID Increment [ Position ] ';' /
8776: 'Indent' [ 'IN' VarID ] [ IndentSign ]
8777: IndentValue [ Position ] ';' .
8778:
8779: IndentSign = '+' / '-' .
8780: IndentValue = NUMBER .
1.1 cvs 8781:
8782: Object = ConstID / CharString /
8783: BufferID /
8784: VarID /
8785: '(' Function < Function > ')' /
8786: AttrID /
8787: 'Value' /
8788: 'Content' /
8789: 'Comment' /
8790: 'Attributes' /
8791: 'Presentation' /
8792: 'RefId' /
8793: 'PairId' /
8794: 'FileDir' / 'FileName' / 'Extension' /
8795: 'DocumentName' / 'DocumentDir' /
8796: [ 'Referred' ] ReferredObject .
8797: Position = 'After' / 'Before' .
8798:
1.6 cvs 8799: ReferredObject= VarID /
8800: ElemID [ ExtStruct ] /
8801: 'RefId' /
8802: 'DocumentName' / 'DocumentDir' .
1.1 cvs 8803:
1.6 cvs 8804: File = FileName / BufferID .
8805: FileName = STRING .
1.1 cvs 8806:
1.6 cvs 8807: RelPosition = 'Included' / 'Referred' .
8808: ExtStruct = '(' ElemID ')' .
1.1 cvs 8809:
1.6 cvs 8810: TrSchema = NAME .
8811:
8812: AttrSeq = TransAttr < TransAttr > .
8813: TransAttr = AttrID [ '(' ElemID ')' ]
8814: [ RelatAttr ] ':' RuleSeq .
8815:
8816: PresSeq = PresTrans < PresTrans > .
8817: PresTrans = PresRule ':' RuleSeq .
8818: PresRule = 'Size' [ PresRelation ] /
8819: 'Indent' [ PresRelation ] /
8820: 'LineSpacing' [ PresRelation ] /
8821: 'Adjust' [ '=' AdjustVal ] /
8822: 'Justify' [ '=' BoolVal ] /
8823: 'Hyphenate' [ '=' BoolVal ] /
8824: 'Style' [ '=' StyleVal ] /
8825: 'Font' [ '=' FontVal ] /
8826: 'UnderLine' [ '=' UnderLineVal ] /
8827: 'Thickness' [ '=' ThicknessVal ] /
8828: 'LineStyle' [ '=' LineStyleVal ] /
8829: 'LineWeight' [ PresRelation ] /
8830: 'FillPattern' [ '=' Pattern ] /
8831: 'Background' [ '=' Color ] /
8832: 'Foreground' [ '=' Color ] .
8833:
8834: PresRelation = '=' PresValue /
8835: '>' [ '-' ] PresMinimum /
8836: '<' [ '-' ] PresMaximum /
8837: 'IN' '[' [ '-' ] PresIntervalMin '..'
8838: [ '-' ] PresIntervalMax ']' .
8839: AdjustVal = 'Left' / 'Right' / 'VMiddle' /
8840: 'LeftWithDots' .
8841: BoolVal = 'Yes' / 'No' .
8842: StyleVal = 'Bold' / 'Italics' / 'Roman' /
8843: 'BoldItalics' / 'Oblique' /
8844: 'BoldOblique' .
8845: FontVal = 'Times' / 'Helvetica' / 'Courier' .
8846: UnderLineVal = 'NoUnderline' / 'UnderLined' /
8847: 'OverLined' / 'CrossedOut' .
8848: ThicknessVal = 'Thick' / 'Thin' .
8849: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' .
8850: Pattern = NAME .
8851: Color = NAME .
8852: PresMinimum = NUMBER .
8853: PresMaximum = NUMBER .
1.1 cvs 8854: PresIntervalMin= NUMBER .
8855: PresIntervalMax= NUMBER .
1.6 cvs 8856: PresValue = [ '-' ] PresVal .
8857: PresVal = NUMBER .
1.1 cvs 8858:
1.6 cvs 8859: TextTransSeq = [ Alphabet ] TransSeq .
8860: Alphabet = NAME .
8861: TransSeq = 'BEGIN' < Translation > 'END' ';' /
8862: Translation .
8863: Translation = Source [ '->' Target ] ';' .
8864: Source = STRING .
8865: Target = STRING .
1.1 cvs 8866: </PRE>
8867: </DIV>
8868: <HR>
8869: </DIV>
8870:
8871: <DIV class="chapter">
1.6 cvs 8872: <H1><A name=sect7>Character coding</A></H1>
1.1 cvs 8873:
8874:
8875: <DIV class="section">
1.6 cvs 8876: <H2><A name=sectb71>Characters</A></H2>
1.1 cvs 8877:
8878: <P>
8879: The characters of the Latin alphabet follow the encoding defined in the ISO
1.5 cvs 8880: 8859-1 (ISO Latin-1) standard. The characters of the Greek alphabet follow
1.1 cvs 8881: the encoding defined by Adobe for its Symbol font (Adobe FontSpecific).</P>
8882: <P>
8883: Characters whose octal code is greater than 0200 are written in the form of
8884: their octal code preceded by a backslash character (``\''). For example, the
1.5 cvs 8885: French word 'Résumé' is written <TT>R\351sum\351</TT>.</P>
1.1 cvs 8886: <P>
1.2 cvs 8887: To the ISO 8859-1 encoding four characters with the following codes have been
1.1 cvs 8888: added:<BR><TT>212</TT>: line break<BR><TT>240</TT>: sticky
1.2 cvs 8889: space<BR><TT>201</TT>: thin space<BR><TT>202</TT>: en space</P>
1.1 cvs 8890: <P>
8891: The <TT>212</TT> character is a ``line break'' character which forces a line
8892: break. The <TT>240</TT> character is a ``sticky space'', which cannot be
8893: replaced by a line break.</P>
8894: </DIV>
8895:
8896: <DIV class="section">
1.6 cvs 8897: <H2><A name=sectb72>Symbols</A></H2>
1.1 cvs 8898:
8899: <P>
8900: The table below gives the codes for the symbols of Thot. Symbols can be used
8901: in presentation schemas constants and in transcoding rules of translation
8902: schemas. Each symbol is represented by a single character.</P>
8903: <UL>
8904: <LI><TT>r</TT>: a radical
8905: <LI><TT>i</TT>: a simple integral
8906: <LI><TT>c</TT>: a curvilinear integral
8907: <LI><TT>d</TT>: a double integral
8908: <LI><TT>t</TT>: a triple integral
8909: <LI><TT>S</TT>: the summation symbol
8910: <LI><TT>P</TT>: the product symbol
8911: <LI><TT>U</TT>: the union symbol
8912: <LI><TT>I</TT>: the intersection symbol
8913: <LI><TT>></TT>: a right arrow
8914: <LI><TT><</TT>: a left arrow
8915: <LI><TT>^</TT>: an up arrow
8916: <LI><TT>V</TT>: a down arrow
8917: <LI><TT>(</TT>: an opening parenthesis
8918: <LI><TT>)</TT>: a closing parenthesis
8919: <LI><TT>{</TT>: an opening brace
8920: <LI><TT>}</TT>: a closing brace
8921: <LI><TT>[</TT>: an opening bracket
8922: <LI><TT>]</TT>: a closing bracket
8923: </UL>
8924: </DIV>
8925:
8926: <DIV class="section">
1.6 cvs 8927: <H2><A name=sectb73>Graphical elements</A></H2>
1.1 cvs 8928:
8929: <P>
8930: The table below gives the codes for the graphical elements of Thot. These
8931: elements can be used in presentation schemas constants and in transcoding
8932: rules of translation schemas. Each graphical element is represented by a
8933: single character.</P>
8934: <UL>
8935: <LI><TT>c</TT>: an ellipse inscribed in the box
8936: <LI><TT>R</TT>: a rectangle which is the shape of the box
8937: <LI><TT>C</TT>: a rectangle with rounded corners
8938: <LI><TT>t</TT>: a horizontal line along the upper side of the box
8939: <LI><TT>h</TT>: a horizontal line as wide as the box and placed in its middle
8940: <LI><TT>b</TT>: a horizontal line along the lower side of the box
8941: <LI><TT>></TT>: a right arrow as long as the box's width and in its middle
8942: <LI><TT>></TT>: a left arrow as long as the box's width and in its middle
8943: <LI><TT>l</TT>: a vertical line on the left side of the box
8944: <LI><TT>v</TT>: a vertical line as tall as the box and placed in its middle
8945: <LI><TT>r</TT>: a vertical line on the right side of the box
8946: <LI><TT>^</TT>: an up arrow as tall as the box and in its middle
8947: <LI><TT>V</TT>: a down arrow as tall as the box and in its middle
8948: <LI><TT>/</TT>: The southwest/northeast diagonal of the box
8949: <LI><TT>\</TT>: the northwest/southeast diagonal of the box
1.2 cvs 8950: <LI><TT>O</TT>: The northwest/southeast diagonal of the box with an arrowhead
1.1 cvs 8951: at the top
1.2 cvs 8952: <LI><TT>e</TT>: The northwest/southeast diagonal of the box with an arrowhead
1.1 cvs 8953: at the bottom
1.2 cvs 8954: <LI><TT>E</TT>: The southwest/northeast diagonal of the box with an arrowhead
1.1 cvs 8955: at the top
1.2 cvs 8956: <LI><TT>o</TT>: The southwest/northeast diagonal of the box with an arrowhead
1.1 cvs 8957: at the bottom
8958: <LI><TT>space</TT>: a transparent element
1.2 cvs 8959: <LI><TT>P</TT>: a rectangle with round corners and a horizontal bar at the top
1.1 cvs 8960: <LI><TT>Q</TT>: an ellipse with a horizontal bar at the top
8961: <LI><TT>L</TT>: a lozenge
8962: <LI><TT>W</TT>: the upper right corner
8963: <LI><TT>X</TT>: the lower right corner
8964: <LI><TT>Y</TT>: the lower left corner
8965: <LI><TT>Z</TT>: the upper left corner
8966: <LI><TT>p</TT>: a polygon
8967: <LI><TT>S</TT>: an open broken line
8968: <LI><TT>N</TT>: an open broken line with an arrow head at start
8969: <LI><TT>U</TT>: an open broken line with an arrow head at the end
8970: <LI><TT>M</TT>: an open broken line with two arrow heads
8971: <LI><TT>s</TT>: a closed curve
8972: <LI><TT>B</TT>: an open curve
8973: <LI><TT>F</TT>: an open curve with an arrow head at start
8974: <LI><TT>A</TT>: an open curve with an arrow head at the end
8975: <LI><TT>D</TT>: an open curve with two arrow heads
8976: </UL>
1.5 cvs 8977: <HR>
1.1 cvs 8978: </DIV>
8979: </DIV>
8980: </BODY>
8981: </HTML>
Webmaster