Home

Trnum - Welcome to nob.cs.ucdavis.edu!

image

Contents

1.
2. symbol This is a sequence of alphanumeric characters which names the symbol There is no default format This character indicates in what form the number associated with the 66499 counter and symbol is to be printed and it is preceded by colon The available formats are Format Numbering Sequence 1 0 1 2 3 4 5 001 000 001 002 003 004 005 i 0 1 i 111 1V V I O LILII IV V a 0 a b c Z aa ab 2Z aaa A 0 A B C Z AA AB ZZ AAA An Arabic format having n digits specifies a field width of n digits see the entry for 001 in the table Note the formats are the same as for the macro af in NROFF and TROFF The default format is format 1 Arabic num bers in the form of line of the above table suffix This is a sequence of characters preceded by and terminated by gt It is appended to the label number associated with the counter and symbol The default suffix is the null string 66 99 66 99 66 29 c6 29 c6 29 Notice that any character except 3 lt gt and may appear in the prefix and the suffix to put of these characters called control characters in the prefix or suffix precede it with the quote character For example in the prefix will set the prefix to Only letters both upper and lower case digits and the underscore character may appear in counter and symbol names In
3. lt q e s sub q lt 1 over q EN By our assumption q e is an integer Since by lt equation e1 gt EQ lt equation e4 gt q s sub q q 17 17 1 over 2 47 7 1 over q EN is an integer we see that q e s sub q is an integer As q gt 1 lt equation e3 gt implies there is an integer between 0 and 1 contradiction which produces Recall e5 1 k 0 K Choose n 1 Da 2 k K By 2 and 1 we see 1 O0 lt e s lt 3 nin Assume e is rational then e 2 where p and q are positive integers By 3 q 1 0 lt q e s lt 4 q By our assumption q e is an integer Since by 2 1 1 qisg qid 1 gt e 5 2 q is an integer we see that qe s is an integer As q 21 4 implies there is an integer between 0 and 1 contradiction This covers the basics of trnum the first sections of this guide explain some other less often used features In case you ever want to see what labels you have defined the line trnum print lt gt will cause all defined labels to be printed on the standard error You can restrict the print ing to one counter by naming it as A trnum print lt countername gt The other forms of this statement are less useful and are documented in the second sec tion The subject of naming things deserves mention The characters which may be used to name symbols and counters are all letters
4. quote and suffix ignore any text after the first character of the next word If there is no nonblank word following those verbs the appropriate character is turned off so it cannot be matched since no two con trol characters may be the same this is necessary to change one control character to another For example if the control character beginning pairs is lt the control charac ter ending pairs is gt and they are to be interchanged the appropriate sequence of com mands is trnum begin trnum end lt trnum begin gt As another example the following changes the characters which begin and end pairs and separate counter names from symbol names trnum begin A tmum end trum separ After these three lines a1 b2 will be recognized as a pair however lt al b2 gt will not V Use To run trnum under UNIX simply type trum followed by a list of files If no files are specified or the file is encountered trnum reads from the standard input Output is written on the standard output With the NROFF and TROFF text processors trnum should come before any other pre processor for example trnum file refer pic tbl eqn troff see 2 3 4 and 5 There are four options to trnum The option C causes trnum to accept input for an earlier version of that preprocessor see the next section for details For version 2 and later the option I pri
5. you can turn off a control character by defin ing it to be null that is trnum begin Acknowledgements This program grew out of a similar but simpler version written at Purdue University Subhash Agrawal suggested the idea and helped debug and refine the original program References 1 Ossanna Joseph F NROFF TROFF User s Manual internal memorandum Bell Laboratories Murray Hill NJ 07974 January 1979 2 Tuthill Bill Refer A Bibliography System UNIX User s Manual Volume 2 Computer Science Division Department of Electrical Engineering and Computer Science University of California Berkeley CA 94720 July 1984 3 Kernighan Brian W PIC A Graphics Language for Typesetting User Manual internal memorandum Bell Laboratories Murray Hill NJ 07974 March 1982 4 Lesk M E Tbl A Program to Format Tables internal memorandum Bell Lab oratories Murray Hill NJ 07974 January 1979 5 Kernighan Brian W and Cherry Lorinda L Typesetting Mathematics User s Guide Second Edition internal memorandum Bell Laboratories Murray Hill NJ 07974 August 1978 6 Knuth Donald E The TEXbook Addison Wesley Publishing Company 1984 7 Kernighan Brian W and Plauger P J The Elements of Programming Style McGraw Hill Inc 1978 8 Rudin Walter Principles of Mathematical Analysis Third Edition McGraw Hill Inc 1976
6. Thus we must write trnum define lt table table I gt and the text would look like trnum define lt table table I gt trnum define lt table attributes gt The next tables give information about the attributes which affect the definitions of counters Notice that lt table defaults gt contains the default settings for the attributes in lt table attributes 00 gt TS box center tab cs cB2Ic cB211 lt table attributes gt Attributes Name Meaning prefix prepended to label counter counter name symbol symbol name format how to print label suffix appended to label TE TS center box tab cs cB2 Ic cB2 Ic cB2 1 1 lt table defaults gt Defaults What Default VY Values prefix f2null string fP format f3 1 fP counter f3default fP suffix f2null string fP As a final example here is the text of a proof of the irrationality of e the base of the natural logarithms 8 A trnum define lt equation 1 gt Recall EQ lt equation edef gt e sum from k 0 to inf 1 over k EN Choose EQ lt equation e1 gt s sub n sum from k 0 ton 1 over k EN By lt equation e1 gt and lt equation edef gt we see EQ lt equation e2 gt 0 lt e ssubn lt 7 lovern n EN Assume le is rational then e p over q where Ip and Iq are positive integers By lt equation e2 gt EQ lt equation e3 gt 0
7. both cases all digits and underscore _ The characters which may be used in prefixes and suffixes are any except the control characters lt 7 17 gt and and these may be used by prefixing them with the quote character This is done specifically to allow string registers to be named in the prefix or suffix strings So to print the contents of the string register BF before the label and the contents of the string register AF before the label you would type lt BF countername symbolname AF gt A word of warning when quoting characters trnum recognizes the quote character only when the next character begins a pair or when within a pair In these cases it throws away the quote character and accepts the next character literally any special effects which would normally take place such as beginning another part of the pair are ignored Further if the quote character precedes a character which would normally begin a pair the quote character is not printed and no pair is begun In all other cases the quote char acter is simply copied through The characters which quote characters begin and end pairs and separate parts of a pair may be reset but they must not be reset to a character which is one of the control characters Hence you could reset the character indicating the beginning of a pair to but not to To get around this
8. that the blank in the prefix need not be quoted In this case the text Figure I would replace the pair If the counter had been encountered before for this example suppose fifo_queue were the fourth symbol defined for that counter regardless of the attributes associated with the counter fig the pair would be replaced by Figure IV since any attributes named explicitly in the pair override the default attributes associated with the counter Thus to suppress the prefix and suffix and force Arabic format give explicitly null attributes for the above example lt fig fifo_queue gt will suppress all default attributes and use the default Arabic format lt maintheorem gt This defines a symbol maintheorem which is associated with the default counter It will be printed as an Arabic numeral If the pair lt maintheorem i gt is encountered later on the number associated with the symbol maintheorem and counter default will be printed as a lower case Roman numeral IV Verbs Occasionally it is useful to be able to exercise more detailed control over counters and their component symbols For example when beginning a new chapter of a thesis certain counters such as a subsection number counter should be reset Trnum offers these capabilities by means of verbs A verb is a command indicating that special action is to be taken It is given on a line beginning w
9. the user chooses a symbol may be defined in as many counters as the user likes Each counter and symbol pair represents a different label two different counters may have symbols with the same name but the numbers associated with the two pairs need not be the same When a counter is created certain attributes associated with that counter are set as indicated by that pair These attributes are the prefix a string which is printed before the number associated with the pair the suffix a string which is printed after the number associated with the pair and the format a character indicating how the number associ ated with the pair is to be printed Whenever this counter is referenced unless new val ues of these attributes are given in the pair referencing that counter the values used will be those associated with the counter III Pairs A counter and symbol is referred to by a sequence of characters called a pair which has the following format lt prefix counter symbol format suffix gt The brackets enclose parts of the pair associated with one another In detail the parts are prefix This is a sequence of characters terminated by It is prepended to the number associated with the counter and symbol The default is the null string counter This is a sequence of alphanumeric characters terminated by period It names the counter to which the symbol refers The default is the counter default
10. Trnum A Program To Number Figures Matt Bishop Research Institute for Advanced Computer Science NASA Ames Research Center Moffett Field CA 94035 ABSTRACT Trnum is a preprocessor for NROFF and TROFF text which enables users to label figures displays tables and equations symbolically This program then translates the labels into consecutive integers which may be printed in a variety of formats In addition prefixes and suffixes may be defined in such a way that they are automatically prepended or appended to the number A number of different counters may be used and the sym bols may appear anywhere in the body of the paper This document con tains a tutorial as well as a detailed description of the program July 1986 Trnum A Program To Number Figures Matt Bishop Research Institute for Advanced Computer Science NASA Ames Research Center Moffett Field CA 94035 I Introduction A problem which authors of papers often face is that of numbering figures tables sections equations and the liket while the paper is being written One often finds that a new display must be inserted between two others as a result the numbering of all such displays after the newly inserted one is not correct Tracking down and correcting the erroneous numbers is very time consuming and painstaking More often than not one will overlook a number the result may be that the reader will become confused Trnum alleviates this problem The
11. addition the for mat string must be one of the ones described there that is 1 IT a A or a string of 1 or more Arabic digits erroneous formats are not caught If a sequence of characters does not meet the description above trnum will assume the sequence is not a pair and simply copy it to the output In general this is trnum s approach to all input if it is a pair replace it otherwise copy it One of the symbol and counter names must be present any of the other parts of the pair may be omitted In all cases where a symbol name is present the appropriate default associated with the counter is used when something is omitted If the counter name is omitted the name default is used If the symbol name is omitted but the counter name is present the pair is copied to the output but any counter referenced by it the one named default if no name is given explicitly is created and initialized This is most useful when the default attributes of the counter are to be set differently than the values required the first time the counter is used Here are some examples of pairs lt Figure fig fifo_queue I gt A counter is defined whenever it is first encountered so if the counter fig has not been used before this pair occurs this pair will define it and set the default prefix suffix and format for that counter to the strings Figure and T respectively Notice
12. author labels his displays with a pair of names when a new display is inserted the numbers corresponding to the pairs following the insertion will be updated automatically The user need not change any of the pairs in the text because trnum numbers pairs in the order in which they occur At no time does trnum generate commands targeted for the text processing program rather it generates the required labels itself Thus it can be used with any text processing program or indeed any program requiring items to be numbered The next three sections describe the mechanics of controlling trnum The two sec tions after that describe how trnum is invoked under UNIX and some lessons learned These will be called displays throughout this paper UNIX is a Trademark of Bell Laboratories from its development and use The last section is a tutorial on using trnum complete with examples using the text processors NROFF and TROFF 1 II Overview Trnum copies most text from its input files to the standard output certain strings called pairs which are described in the next section are replaced by labels and lines beginning with trnum allow the user to force certain actions to occur These will be discussed separately Trnum maintains 101 counters each of which begins at 1 and increases as new sym bols are defined The user may name these counters as he pleases Each counter allows 2039 different symbols the names of which
13. bel the 00 it will be printed as a two digit Arabic numeral The next tables give information about the attributes which affect the definitions of counters Notice that table II contains the default settings for the attributes in table 01 Attributes Name Meaning prefix prepended to label counter counter name symbol symbol name format how to print label suffix appended to label II Defaults Default vaf Values prefix null string format 1 counter default suffix null string Notice that only the label with the 00 format indicator given explicitly is affected There are two other attributes which may be set a prefix which is prepended to every label which uses that counter and a suffix which is appended to every label which uses that counter The prefix precedes the counter name and is followed by a plus sign the suffix follows the format indicator and is preceded by a minus sign As with the format indicator the defaults may be explicitly overridden in any label Going back to our perennial example notice in the two lines of text the table num ber is preceded by the word table and a blank To get this prefix prepended automati cally we would define the counter by trnum define lt table table I gt Then the sample text becomes trnum define lt table table I gt trnum define lt table a
14. he first equation as 1 the first table as 1 the next equation as 2 and then refer to them as equation 1 table 1 and so forth To enable you to do this trnum has several different counters each starts at 1 To name a particular counter prefix the symbol with the counter name followed by a period In the above example if we wanted to use a counter named table to keep track of the tables we would write lt table attributes gt and lt table defaults gt instead of lt attributes gt and lt defaults gt respectively Like symbols a counter is initialized when it is first encoun tered unlike symbols when a counter is initialized it always starts at 1 You can define up to 101 different counters and if you omit the counter name a default counter is used This counter s name incidentally is default Sometimes you would like to restart a counter at 1 There are two ways to do this You could delete the counter and then redefine it with A trnum undefine lt countername gt trnum define lt countername gt Alternatively you could say A trnum reset lt countername gt which does the same thing Note the you have to have it or trnum will think you mean the symbol countername and not the counter Omitting the symbol causes the action to affect the counter rather than a symbol Also the string is passed through trnum unlike strings involving symbols it
15. he number of registers available within NROFF and TROFF as trnum does not use these registers the user need not worry about these internal limits All these advantages vindicate the decision to write trnum as a preprocessor There are a few visible differences between this version of trnum and the earlier ver sion In the earlier version prefixes and suffixes could consist only of letters digits underscores and quoted characters because of the nature of NROFF and TROFF com mands this was changed Also the default quote character was rather than This was changed because is used to indicate to NROFF and TROFF the need for special actions such as interpolating a special character or the value contained in a register For example to use the contents of the string register Ab as a prefix and the contents of the number register Cd as a suffix both separated from the number by a space one had to type lt Ab counter symbol n Cd gt to the first version of trnum To later versions one need type only lt Ab counter symbol n Cd gt because one need not worry about trnum stripping off any V characters The sign was chosen because it has no special meaning to NROFF and TROFF except when used in titles and then only when escaped In version 1 verbs were placed on lines beginning with the NROFF and TROFF macro NU For example to change the character separating counters and symbols to a co
16. is not replaced by anything Be aware that when you reset or undefine a counter it undefines all symbols for that counter too Incidentally you can delete a symbol too Each counter can have 2039 symbols defined for it this should be more than enough for most people However if it is not to delete a symbol say A tmum undefine lt countername symbolname gt Resetting a symbol just undefines it and then redefines it Normally numbers are printed in Arabic format without any leading zeroes This is not always what you want for instance some people prefer that tables be numbered with Roman numerals Trnum allows you to control how a counter is printed by a format field The format field follows the symbol name and is preceded by a colon For exam ple to print the table labels as Roman numerals in the example above we would write lt table attributes I gt and lt table defaults I gt the I indicates capital Roman numer als Other formats available are lower case Roman numerals the format indicator is 7 capital letters format indicator A lower case letters format indicator a and Arabic numerals with or without leading zeroes indicate this by an Arabic number con taining as many digits as you want printed including leading zeroes The format indica tor is an attribute of the counter not of the symbol This last comment deserves explanation When a c
17. ith trnum immediately following the colon blank spaces may be put between the colon and the verb Note these lines are treated as comment lines by NROFF and TROFF and so are ignored Only enough of the verb to identify it uniquely need be given Any arguments to the verb are placed after it The verbs are begin control define end format Change the character indicating that a pair begins to the first character of the first argument to the verb for example trnum begin indicates that pairs will begin with Initially this character is lt This macro prints on the error output usually the terminal the control characters and verbs This verb indicates the pairs named as arguments are to be defined It is useful when pairs must be numbered in an order other than that in which they occur If the symbol name in a pair is omitted the counter is initial ized but no symbol is entered Change the character indicating that a pair ends to the first character of the first argument to the verb for example trum end indicates that pairs will end with Initially this character is gt Change the character indicating the format begins to the first character of the first argument to the verb for example off on prefix print quote trnum format indicates that the format description will begin with Initially this 66499 characte
18. mma one used to write NU separator rather than trnum separator as one would now There seemed to be no good reason for using a NROFF and TROFF macro register when trnum was run as a preprocessor more importantly when the macro NU was defined NROFF and TROFF output was not what was expected Lines beginning with the string are comments in NROFF and TROFF and so will always be ignored With other programs just use the s option to suppress these lines To enable documents written to use version trnum to be run without changes give the C flag Note that the new verbs will be recognized but the quote character and verb line indicator will be what the earlier version expects To determine the version being run give the command trnum I On the earlier version this will produce the message trnum bad switch I and leave trnum waiting for input just type your end of file symbol usually control D to cause it to exit on this and future versions it will print a version number and date VII A Tutorial Suppose you are typing a paper and you decide that you want to number your tables Pick a symbol say format Then whenever you refer to this table rather than saying table number 1 you would say table number lt format gt Trnum will replace lt format gt with the appropriate number wherever it occurs If you left off the angle brackets lt gt trnum wo
19. nts the version number and date of trnum on the standard output on version 1 this switch does not exist and the program prints an error message The option v prints pairs on the error output as they are encountered in the text it is useful for making tables of symbols and counters And the option s causes trnum not to print control lines which is necessary when using trnum with TEX 6 VI History and Experience Trnum was written in 1983 to number sections and equations in Ph D dissertations and since then has been used at Purdue University the University of California at Santa Barbara and the Research Institute for Advanced Computer Science From the experi ences of the users some lessons have become clear Because of the power of the NROFF and TROFF command language it is entirely pos sible to implement a numbering facility using the number and string registers within those text processors rather than writing a separate preprocessor However the resulting mechanism is neither so general nor so powerful as that provided by trnum Specifically the numbering is tied to NROFF and TROFF it could be used with TEX for example Labels are restricted to two characters because NROFF and TROFF only permits one or two character register names this limit hampers users in remembering what the appropriate label is called just as one or two character variable names confuse programmers 7 Moreover there is an internal limit on t
20. ounter is initialized several attributes are created one of which is the format indicator we ll deal with the others below The format specified in the label which creates the counter becomes the default format for that counter It can be overridden for any label by specifying a format explicitly in that label but if no format indicator is given the default one will be used trnum define lt table I gt trnum define lt table attributes gt The next tables give information about the attributes which affect the definitions of counters Notice that table lt table defaults gt contains the default settings for the attributes in table lt table attributes 00 gt TS box center tab cs cB2Ic cB211 lt table attributes gt Attributes Name Meaning prefix prepended to label counter counter name symbol symbol name format how to print label suffix appended to label TE TS center box tab cs cB2 Ic cB2 Ic cB2 11 lt table defaults gt Defaults What Default VY Values prefix fInull string fP format fB 1 fP counter fBdefault fP suffix fInull string fP TE In this text all table numbers will be printed as Roman numerals because when the counter table is created by the first trnum its format indicator is I How ever when the number for the label lt table attributes 00 gt is printed since there is an explicit format indicator with the la
21. r is colon This verb turns off the interpretation of pairs trnum just copies the input to the output until interpretation is turned back on see on below It is useful when escaping character sequences which look like pairs but are not pairs and which trnum would otherwise replace with numbers An alter native is to quote the beginning character of the pair This verb turns on the interpretation of pairs See off above Change the character terminating the prefix of the first argument to the verb for example A trnum prefix indicates that prefixes will end with Initially this character is This macro prints to the error output usually the terminal the label asso ciated with any pairs given as arguments If the symbol name is omitted the labels of all symbols associated with the named counter are printed if the counter name is omitted the labels of all symbols with that name in all counters are printed and if both the symbol and counter names are omitted the labels of all defined pairs are printed Change the quote character to the first character of the first argument to the verb for example trnum quote indicates that the quote character will be Initially this character is reset separator suffix terse undefine verbose Q This macro indicates the pairs named as arguments are to be reset it is identical to undefining the pair then defining i
22. t again and is included as a convenience Change the character separating the counter name from the symbol name to the first character of the first argument to the verb for example trnum separator indicates that the counter name and the symbol name will be separated by 66 99 66 99 Initially this character is Change the character indicating the suffix begins to the first character of the first argument to the verb for example A trnum suffix indicates that suffixes will begin with Initially this character is This turns off verbose mode This verb indicates the pairs named as arguments are to be undefined It deletes them from the appropriate counters Pairs occurring as arguments are replaced by their definition before being undefined If the symbol name in a pair is omitted the counter is undefined this deletes both the counter and all its symbols This verb turns on verbose mode In verbose mode every pair encoun tered is printed this is most useful for debugging input text By default this mode is off the command line option v will turn it on for all the input This mode may be turned on with this verb and turned off with the verb terse Note that the control lines are copied to the output but pairs occurring on them are not replaced The verbs define undefine reset and print may have more than one argu ment but the verbs begin end separator format prefix
23. ttributes gt The next tables give information about the attributes which affect the definitions of counters Notice that lt table defaults gt contains the default settings for the attributes in lt table attributes 00 gt TS box center tab cs cB2Ic cB211 lt table attributes gt Attributes Name Meaning prefix prepended to label counter counter name symbol symbol name format how to print label suffix appended to label TE TS center box tab cs cB2lc cB2 1c cB2 11 lt table defaults gt Defaults What Default Values prefix null string format 1 counter default suffix null string TE notice the explicitly null prefixes within the tables themselves and prints as The next tables give information about the attributes which affect the definitions of counters Notice that table II contains the default settings for the attributes in table 01 I Attributes Name Meaning prefix prepended to label counter counter name symbol symbol name format how to print label suffix appended to label II Defaults Default Wiat Values prefix null string format 1 counter default suffix null string Suffixes are handled the same way Note that within the same text the table num bers in the body of the tables end with a period However since a period separates the counter and symbol it is a control character and hence must be escaped
24. uld not replace anything The angle brackets signal trnum to look at what they enclose if it is a legal string we ll get to what s legal in a bit then and only then does trnum do the replacement Trnum assigns a number to a symbol the first time it is seen hence you do have to be careful in what order you refer to labelled things For example in the input The next tables give information about the attributes which affect the definitions of counters Notice that table lt defaults gt contains the default settings for the attributes in table lt attributes gt TS box center tab cs cB2Ic cB211 lt attributes gt Attributes Name Meaning prefix prepended to label counter counter name symbol symbol name format how to print label suffix appended to label TE TS center box tab cs cB2 Ic cB2 Ic cB2 11 lt defaults gt Defaults What Default Y Values prefix fInull string fP format fB 1 fP counter fBdefault fP suffix fInull string fP TE the label lt defaults gt will be replaced by 1 and the label lt attributes gt by 2 because that is the order the labels occur in the text The next tables give information about the attributes which affect the definitions of counters Notice that table 1 contains the default settings for the attributes in table 2 2 Attributes Name Meaning prefix prepended to label counter counter name symbol s
25. ymbol name format how to print label suffix appended to label 1 Defaults Default What Values prefix null string format 1 counter default suffix null string Unfortunately it s also backwards table 1 should precede table 2 To allow this trnum lets you define labels on command lines which begin with trnum Notice that these are ignored by NROFF and TROFF since they are comments So to get the labels to come out right in the above example just before the first line insert the line trnum define lt attributes gt Then since lt attributes gt came before lt defaults gt it will be defined as 1 and the tables will be numbered in the order they appear The next tables give information about the attributes which affect the definitions of counters Notice that table 2 contains the default settings for the attributes in table 1 1 Attributes Name Meaning prefix prepended to label counter counter name symbol symbol name format how to print label suffix appended to label 2 Defaults Default at Values prefix null string format 1 counter default suffix null string Usually you want to keep several counts going at the same time for example you rarely want to number an equation as 1 the next table as 2 the next equation as 3 and so forth What you usually want is to number t

Download Pdf Manuals

image

Related Search

Related Contents

平成19年5月15日号(PDFファイル2.4メガバイト)  血液利用の制度と技術  INCIDENTE No - Ministerio de Hacienda    Advent ADV38 User's Manual  DOSSIER LE TEMPS DE L`ÉVÉNEMENT |`  um estudo exploratório na área da reabilitação tóxica    TU3-5-10-0137-fra - Publications du gouvernement du Canada  ACC-8M______________________________Mini  

Copyright © All rights reserved.
Failed to retrieve file