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