source: trunk/third/enscript/README.ESCAPES @ 17620

Revision 17620, 7.4 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r17619, which included commits to RCS files with non-trunk default branches.
Line 
1
2                     Special escapes in enscript
3                     ============================
4
5Enscript supports special escape sequences which can be used to add
6simple page formatting commands to ASCII documents.  As a default,
7special escape interpretation is off, so all ASCII files print out as
8everyone expects.  Special escape interpretation is activated with the
9`-e', `--escapes' option.
10
11This file shows how to use escape codes.  To view this file
12interpreted, print it with the following command:
13
14        enscript -G2re README.ESCAPES
15
16Special escape is a string which starts with the escape character
17`\0'.  Escape's name follows immediately after the escape character.
18After name there can be escape dependant options and arguments.
19
20Currently following escapes are supported:
21
22  - epsf        inline EPS files to document
23  - font        select current font
24  - comment     comment the rest of the line
25  - shade       highlight regions of text
26  - ps          include raw PostScript code to the output
27  - color       change text color
28  - bggray      change text background color
29  - escape      change the escape character
30
31
32shade{.8}* epsfshade{1.0}
33
34Inline an EPS (Encapsulated PostScript) file to the document.  EPSF
35escape's syntax is:
36
37        epsf[OPTIONS]{FILENAME}
38
39where OPTIONS is an optional sequence of option characters and values
40and FILENAME is the name of the EPS file.
41
42This is the simplest use of the epsf escape:
43
44epsf{mtr.eps}
45
46That image was printed with command `^@epsf{mtr.eps}' (two character
47sequence "^@" is used to represent the escape character `\0' (octal
48000) in this document).
49
50Next we would like to print a centered image.  Option `c' centers
51image horizontally to the current line:
52
53epsf[c]{mtr_small.eps}
54
55That image was printed with command `^@epsf[c]{mtr_small.eps}'.
56Options must be enclosed with `[' and `]' characters and they are
57placed between escape's name and the filename.
58
59Images can also be printed right justified:
60
61epsf[r]{mtr_small.eps}
62
63Right justification can be selected with option `r':
64`^@epsf[r]{mtr_small.eps}'.
65
66
67As a default, images are printed in the size which was specified in
68the image's "%%BoundingBox:" comment.  You can also specify image's
69size explicitly by giving option `hSIZE'.  This option specifies
70image's horizontal height in lines.
71
72Here is a 1 line mtr (^@epsf[h1]{mtr.eps}):
73epsf[h1]{mtr.eps}
74and the same image twice as big (^@epsf[h2]{mtr.eps}):
75epsf[h2]{mtr.eps}
76and finally a three liner (^@epsf[h3]{mtr.eps}):
77epsf[h3]{mtr.eps}
78
79Sometimes you just want to print an image and continue printing just
80like there were no image at all.  This can be done with option `n'
81which forbids current point update:
82
83  a epsf[n r]{mtr_small.eps}
84  b
85  c
86
87That was printed with code:
88
89  a ^@epsf[n r]{mtr_small.eps}
90  b
91  c
92
93For text printing, that special escape acts just like an ordinary
94newline character.
95
96Current point updates can be controlled individually for both x and y
97directions.  Option `nx' prevents current point x-coordinate update
98and option `ny' y-coordinate update.
99
100
101Images can also be moved to any position in page.  Option `xPOS'
102specifies image's starting x position in current line (in characters).
103Note that as a default, positions are relative to the current point.
104
105Print a tiny mtr to column 40 (^@epsf[x40 h1]{mtr_tiny.eps}):
106epsf[x40 h1]{mtr_tiny.eps}
107
108Option `yPOS' specifies image's starting y position (in lines).
109
110Now let's print an image between this and the previous paragraphs.
111That can be done with escape "^@epsf[n x0a y-2 h1]{mtr_tiny.eps}". comment
112epsf[n x0a y-2 h1]{mtr_tiny.eps}
113
114Previous x- and y-dimensions vere relative to the current point.  You
115can also specify absolute positions by adding character `a' after the
116dimension.  Absolute placement was used to print the previous image to
117the beginning of the line: (x0a).
118
119Note: All numeric values can also be given as a decimal number:
120
121        ^@epsf[h1.2 x4.5 y-2.1]{foo.eps}
122
123Option `s' scales images with a specified amount.  Option is followed
124by a number which specifies the scale factor.  For example, half sized
125`mtr.eps' can be printed with escape "^@epsf[s.5]{mtr.eps}:
126
127epsf[s.5]{mtr_small.eps}
128
129Scaling can also be specified independently for both x- and
130y-directions.  This is done by specifying direction (`x' or `y')
131immediately after the `s' option.
132
133epsf[sx2 sy.25]{mtr_small.eps}
134
135(^@epsf[sx2 sy.25]{mtr_small.eps})
136
137
138EPSF images can also be read from the specified command.  In this
139form, epsf escape's filename must end to the `|' character.  For
140example, this image:
141
142epsf{cat mtr.eps|}
143
144was inlined with command: ^@epsf{cat mtr.eps|}.
145
146
147shade{.8}* fontshade{1.0}
148
149Font escape can be used to change the current body-font for the end of
150the current page.  Font escape's syntax is:
151
152        font{FONTNAME}
153
154where FONTNAME is a standard font specification.
155
156font{Palatino-Roman12}This chapter was printed with 12pt
157Palatino-Roman font. font{default}
158
159Previous chapter was typeset with following commands:
160
161  ^@font{Palatino-Roman12}This chapter was printed with 12pt
162  Palatino-Roman font. ^@font{default}
163
164The special font name `default' can be used to switch back to the
165default font which was active before the first ^@font escape.
166
167
168shade{.8}* commentshade{1.0}
169
170Comment escape can be used to comment the rest of the line including
171the newline character.  Comment escape's syntax is:
172
173        comment ... any text ... NEWLINE
174
175For example, text:
176
177  You can't see this: ^@comment Hello, world!
178
179prints like this:
180
181  You can't see this: comment Hello, world!
182
183
184shade{.8}* shadeshade{1.0}
185
186Shade escape changes the text background color to the specified gray
187value.  Escape's syntax is:
188
189        shade{GRAY}
190
191shade{.95}For example, this chapter is highlighted with the
192following code:
193
194  ^@shade{.95}For example, this chapter is highlighted with the
195  ...
196  ^@shade{1.0}
197shade{1.0}
198
199
200shade{.8}* psshade{1.0}
201
202PS escape includes a piece of raw PostScript code to the generated
203PostScript output.  This is quite handy if you are creating scripts
204which want to do some special highlighting etc. for the input data but
205be carefull, with ps-escape you can broke the whole output!
206
207Here is a simple example:
208
209ps{gsave 100 0 rmoveto (Hello, world!) show grestore}
210
211and the source was:
212
213^@ps{gsave 100 0 rmoveto (Hello, world!) show grestore}
214
215
216shade{.8}* colorshade{1.0}
217
218The color escape can be used to change the text color.  Color escape's
219syntax is:
220
221        color{RED [GREEN BLUE]}
222
223where RED, GREEN and BLUE are intensities of the corresponding colors
224presented as floating point numbers between 0 and 1.  If only
225component RED is given, escape changes the text gray level.  The
226special ^@color{default} selects the default text color (black).
227
228Examples:
229
230^@color{1 0 0}red^@color{default} =>    color{1 0 0}redcolor{default}
231^@color{1 0 0}green^@color{default} =>  color{0 1 0}greencolor{default}
232^@color{1 0 0}blue^@color{default} =>   color{0 0 1}bluecolor{default}
233^@color{.5}.5 gray^@color{default} =>   color{.5}.5 graycolor{default}
234
235
236shade{.8}* bggrayshade{1.0}
237
238Bggray escape changes the text background color, where the shade
239escape changes the background color for whole lines, bggray escape
240changes only the color of printed strings, this can be used to
241implemented very fine granularity highlightings.  Escape's syntax is:
242
243        bggray{GRAYVALUE}
244
245And here is a bggray{.8}simplebggray{1.0} example.
246
247That example was typed as follows:
248
249  And here is a ^@bggray{.8}simple^@bggray{1.0} example.
250
251
252shade{.8}* escapeshade{1.0}
253
254Escape escape changes the current escape character.  Escape's syntax
255is:
256
257        escape{ESCAPE}
258
259where ESCAPE is the new ESCAPE character as a decimal number.
Note: See TracBrowser for help on using the repository browser.