summaryrefslogtreecommitdiff
path: root/macros/inrstex/inrsdoc/thauto.tex
blob: f21b5973ceadfd8e308bc6816fce9933f72869d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
%-*-tex-*-
\ifundefined{writestatus} \input status \relax \fi %
\chcode{auto}
\marginnotestrue

\def\cqu{\cquote{Words are sensible signs necessary for
understanding.}{Concerning Human Understanding, Book III, Chap. II, 
John~Locke (1632-1704)}}


\chapterhead{auto}{AUTONUMBERING\cr REFERENCING\cr and TAGGING}
\intex\ provides facilities for automatic numbering and referencing of
chapters, sections, equations, figures, and tables. 
Both the number of a chapter, equation, \dots\ and its page may be
referenced. 
In addition there are
general features for defining your own special numbers and tags. For
instance, it is possible to obtain a new number for, say problem exercises,
by just calling |\newautonum{ex}|. This will create all the commands
necessary for referencing, resetting, and autoincrementing these numbers.

Chapters, sections, subsections, {\it etc}, are also autonumbered and can be
referenced through tags. For instance this chapter has the tag |auto|. To
insert the value of the tag in the text, it is only necessary to type
|\ref{auto}|, which in this case gives \ref{auto} without any extra braces
brackets or periods.  
Details of creating tags for chapters and sections are discussed in 
Chapter~\ref{shead} starting on page \pref{shead}.

\intex\ also supplies facilities for automatically numbering and creating
paper or journal citations (sometimes called confusingly, at least here, {\it
references}). These are discussed in Chapter \ref{cite}, page \pref{cite}. 
The facilities for creating lists of tables or figures are found in Chapter
\ref{toc} starting on page \pref{toc}\footnote{\dagger}{One must be careful
not to overdo an easily used facility.}. 

\shead{autocomlist}{Command List}
\begintwocolumn
\ext|\aneq|
\ext|\aneqtag|
\ext|\autonumberingon|
\ext|\autonumberingoff|
\ext|\autoreferencingon|
\ext|\autoreferencingoff|
\ext\@|\autoeqnum|
\ext\@|\autotblnum|
\ext\@|\autofignum|
\ext|\auto<type>num|
\ext|\inputtagfiles|
\ext|\newautonum|
\ext|\newtag|
\ext|\numberbychapter|
\ext|\numberbysection|
\ext|\Prerefform|
\ext|\Postrefform|
\ext|\pageref \pref|
\ext|\pagequietref \pqref|
\ext|\pagetagsoff|
\ext|\pagetagson|
\ext|\quietref \qref|
\ext|\ref|
\ext|\silent|
\ext|\specialnumberscontinuous|
\ext\@|\<type>tagrefformat|
\ext\@|\<type>num|
\ext\@|\<type>tagreplaceformat|
\ext\@|\<type>numform|
\endthreecolumn

\shead{tagcon}{Tagging Conventions}
Such items as section heads, equations, figures, and tables may be given
symbolic ``tags'' so that references to them will be correct even if there
are deletions, insertions, or shufflings. ``Normal'' tags refer to the
section, equation, or figure numbers while ``page'' tags refer to the page
where the item occurred. Page tags are turned on with the \@|\pagetagson|
command and turned off with \@|\pagetagsoff|. The default is |\pagetagsoff|. 

The tagging system within \intex\ is designed to work best when the
autonumbering  features are on. 
It is designed so that both forward and
backward references are possible. This is done by saving the tags in a file
while \tex\ is processing. The next time the document is processed, the use
of the command |\autonumberingon| or 
|\autoreferencingon| will bring in the latest version of the tag
file. As tags are generated, the new definitions and values replace the old
ones. When there is a reference to a tag that has not
yet been (newly) defined, the old value is used. To guarantee that the tag
references are correct, the document should be processed twice. This, of
course is only necessary on the ``final'' version.


All tags, whether they are for chapters, sections, equations, citations,
or specials
{\bf must be unique within the entire document}. This allows for the value of
a tag, which is usually a number, may be referred to by |\ref{<tag>}| 
or |\quietref{<tag>}| and the page number where it occurred by
|\pref{<tag>}| or |\pqref{<tag>}|, no
matter the type being tagged. The quiet forms of the refs do not create
margin notes and do not check to see if a tag actually exists. Thus both
|\qref{<tag>}| and |\pqref{<tag>}| will give an error 
if |<tag>| does not exist. 
The quiet forms {\bf must} be used inside  section heads and are recommended
whenever the ref is passed as a parameter to som other command. 
The tag value does not have
any additional brackets or braces around it. For instance, if an equation was
given a tag of |theq|, and that was eventually given the value of 2.11 where
the first number is the section or chapter and the second is the equation
number, then |\ref{theq}| would insert 2.11 into the text. To obtain ``Eq.
(2.11)'' in the text it is necessary to type |``Eq. (\ref{theq})''|, the 
(\dots) being put in explicitly. 

In almost all instances, the actual tag is generated automatically by the
autonumbering forms. However, the |\newtag{<tag>}{<tagvalue>}| command will
create a tag with the name |<tag>| and the value |<tagvalue>| for |\ref| and
the current page number for |\pref|. 

Sometimes it is necessary to create the tag 
{\it silently, ie} without any trace in the text. Although |\newtag| does not insert
into the text, |\auto...num| does. The commands
 \@|{\silenttrue \auto...num{<tag>}}| will cause the
|\...num| to increment but nothing will be placed in the  text. T
his is preferred
to |\silent{<text>}|.
Note that |{\silenttrue <text>}| will normally put the |<text>| in the
document. 

\shead{refformats}{Tag Insertion Formats}
When a new tag and auto number is created, there are a number of reference
forms for that tag that are also created. These are 
\begintt 
\<type>tagrefformat
\<type>tagreplaceformat
\<type>numform 
\endtt
The first governs the format of the initial replacement of the |<tag>| when
it created. The default in |\newautonum{<type>}| is to make it the same as 
|\<type>tagrefformat|. The second,|\<type>tagrefformat| is the format for inserting
the tag value when it is actually referred to in the text.
The third |\<type>numform| is set initially equal to
|\the\<type>num|, the value of the counter corresponding to |<type>|. This
may be modified if something other than simple arabic numerals are wanted.
|\newautonum{<type>}| defines 
|\<type>tagrefformat| to be equivalent to 
``|\Prerefform  \<type>numform  \Postrefform|''. 
The commands |\Prerefform| and |\Postrefform|
are defined by |\numberbysection|, |\numberbychapter| and modified when
inside Appendices. 

\shead{validtag}{Valid Tag Forms}
Any character except the following  ``|\ $ % & _ ^ { } "|  \vrt'' are
valid as, and within tags. 

\shead{numcon}{Numbering Conventions}
There are basically two types of autonumbers in \intex, those that deal with
chapters, sections, subsections, subsubsections, and appendices, and the {\it
special} ones defined for equations, tables, figures, or any created
especially for that document. 

Associated with every autonumber is a {\it count} with the name |\<type>num|.
For instance the count associated with equations is |\eqnum| and that with
subsections is |\sshnum|. However, when the number is actually inserted
into the text, it is not the raw number that is inserted, but rather some
formatted version. The formatting appends to the basic count, either nothing,
or the numbers corresponding the chapter or section where the number was
first created. The actual formatting depends upon what type of numbering
format is in force. 

For instance, for a document with chapters, the ordinary convention is to
number the specials as
``|<chapter number>.<special number>|''. If
the document has sections but no chapters, and if |\numberbysection| has been
called, the format is ``|<section number>.<special number>|''. The default in
\intex\ is neither of these but is continuous numbering. 
This means that the
specials have the form ``|<special number>|'' and are not reset, except in
appendices, throughout the document. Continuous numbering of specials is
forced by |\specialnumberscontinuous|.

Appendices are treated specially. The specials  are reset upon entering an
appendix, and the reference formats always include the appendix number. The
appendix number is usually an uppercase roman letter, although other formats
are possible. 

\shead{autocomforms}{Command Forms}
\beginblockmode
\ext\@|\aneq  \aneqtag{<tag>}|
\nbr
These commands are specials for use in display math mode to create equation
numbers. They increment the equation counter |\eqnum|, and insert either a
left or right hand equation number as appropriate, with the equation number
{\bf surrounded} by brackets like (|<num>|). This is provided to reduce the
amount of typing required. The |\aneqtag{<tag>}| also creates a |<tag>|
possible reference. 

\mbr
\ext\@|\autonumberingon|
\nbr
This command turns automatic numbering on. It brings in the tag file with name
|\jobname.tag|, if it exists, and opens a new version for writing the tags
generated by that \tex\ processing run. The |\jobname| is the file name of
the \tex\ file {\bf without} the normal |.tex| extension.
No errors will result if this command is called several times.

\mbr
\ext\@|\autonumberingoff|
\nbr
This command turns  automatic numbering off and closes the tag file.
\intex\ defaults to |\autonumberingoff|.

\mbr
\ext\@|\autoreferencingon|
\nbr
This command turns automatic referencing on. It brings in the tag file with name
|\jobname.tag|, if it exists. A |\ref{<tag>}| will result in the 
|<tagvalue>| being put in the text. A |\pref{<tag>}| will result in the page
number where |<tag>| was last defined being put in the text. 
No errors will result if this command is called several times.
\intex\ defaults to referencing being active but does not automatically bring
in a |.tag| file. 

\mbr
\ext\@|\autoreferencingingoff|
\nbr
This command turns  referencing off.
Both |\ref{<tag>}| and |\pref{<tag>}| will result in the 
|<tag>| being put in the text.  


\mbr
\ext\@|\auto<type>num{<tag>}|
\nbr
This is the basic command for incrementing the |<type>| number and creating a
tag for that number with the tag name of |<tag>| and the tag value of the
number in the correct format given the numbering form in force. \intex\
defines three basic types, |eq| for equations, |fig|, for figures, and |tbl|
for tables. The tag is written to the |.tag| file.

\mbr
\ext\@|\inputtagfiles [=] {<input command><file name> ...}|
\nbr
In some cases it may be useful to bring in a file or list of files
of tags other than those in
|\jobname.tag|. |\inputtagfiles| is a |<token list>| of commands of the type
given. 
For instance the master file for this book was called |th.tex|
while the file for this chapter was called |thauto.tex|. If
|\autonumberingon| is called when \tex ing this chapter by itself, the tag
file brought in will have the name |thauto.tag|. To use the |th.tag| file it
is only necessary to put 
\begintt
\inputtagfiles  = {\inputwithcheck{th.tag} } in the chapter file. 
\endtt


\mbr
\ext\@|\newautonum{<type>}|
\nbr
This command creates all the necessary commands for using and referring to
the autonumber of |<type>|. The |<type>|s defined by \intex\ are |eq|, |fig|,
and |tbl|, corresponding to equations, figures, and tables respectively. It
is recommended, but not required that |<type>| be restricted to 3 or fewer
characters. This allows for a consistent use of |<type>| as the extension of
list file used for eventually creating a table of items for the table of
contents part of a document. 
For instance, the equation numbering was created with |\newautonum{eq}|. This
created the counter |\eqnum|, and the
commands |\eqnumform|, |\eqtagreplaceformat|, and |\eqtagrefformat|. Any of
these can be changes at will. However, care must be taken if consistent
numbering formats is to be maintained. 

\mbr
\ext\@|\newtag{<tag>}{<tag value>}|

\ext\@|\newttag{<tag>}{<tag value>}|

\ext\@|\newptag{<tag>}|
\nbr
This creates a (normal) tag with reference name |<tag>| and value 
|<tag value>| and a page tag with the reference name|<tag>| and the current
page value. These
tags are written out to the |.tag| file if it is open. Page tags will get
lost if they are produced inside a box that is never inserted in the text.
This occurs for {\bf all} text inside a |\silent{<text>}|.
|\newttag{<tag>}{<tag value>}| creates and writes a normal tag while 
|\newptag{<tag>}| creates and writes a page tag. 

\mbr
\ext\@|\numberbychapter|
\nbr
This command will cause {\it specials} to be reset at the beginning of each
new {\bf chapter}, and to append the {\bf chapter} number to any tag reference and to the
original tag replacement.

\mbr
\ext\@|\numberbysection|
\nbr
This command will cause {\it specials} to be reset at the beginning of each
new {\bf section}, and to append the {\bf section} number to any tag reference and to the
original tag replacement.


\mbr
\ext\@|\pagequietref{<tag>} \pqref{<tag>}|
\nbr
This is a putting the page number in the text that corresponds to any
|<tag>| 
that has been previously
defined. It does not attempt to create a margin note nor does it
check to see if the |<tag>| is valid. This allows the 
reference to be used in such places as section heads, titles, captionboxes. 
In fact it {\bf must} be used in {\bf any}  place where the surrounding text is
written to a special file or the terminal. 
Page references {\bf are always from the previous version.}


\mbr
\ext\@|\pageref{<tag>}  \pref{<tag>}|
\nbr
This is the basic command for inserting the 
page number corresponding to any |<tag>| that has been previously
defined. Page references {\bf are always from the previous version.}

\mbr
\ext\@|\pagetagson \pagetagsoff|
\nbr 
These commands turn page tags on and off respectively. The default is off. 
It is important to wait until the page containing the item is actually output
before turning off page tags. The page tags are actually generated when the
page is output \dots\ not before. 


\mbr
\ext\@|\quietref{<tag>} \qref{<tag>}|
\nbr
This is a putting the |<tagvalue>| in the text that corresponds to any
|<tag>| 
that has been previously
defined. It does not attempt to create a margin note nor does it
check to see if the |<tag>| is valid. This allows the 
reference to be used in such places as section heads, titles, captionboxes. 
In fact it {\bf must} be used in {\bf any}  place where the surrounding text is
written to a special file or the terminal. 



\mbr
\ext\@|\ref{<tag>}|
\nbr
This is the basic command for inserting the 
|<tagvalue>| for any |<tag>| that has been previously
defined. 


\mbr
\ext\@|\silent{<text>}|
\nbr
This command expands the |<text>| inside a |vbox|, but without ever having it
enter the document. This is a way to call out a |\figureinsert| in order to
create the normal tags and list files without it actually appearing in the text.
{\bf Page tags will not be created in this case.} 
Note that tags defined inside a |\silent| {\it may} not appear in the 
margin. The actual mechanism used is 
|\setbox0 = \vbox{<text>}|. See Chapter~\ref{basbox} for more details on
|box| commands.

\mbr
\ext\@|\specialnumberscontinuous|
\nbr
This command will prevent the {\it special} numbers from being reset at any
point in the document, except appendices. A reference to a {\it special} number
tag will result in the value of the appropriate counter with no section or
chapter numbers added. {\bf All special numbers are treated the same way.}


\endblockmode

\ejectpage
\marginnotesfalse
\done