summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/context/manuals/reference/en/co-verbatim.tex
blob: 0ec79e5c8cac9cf826a72716d4746042995bf94f (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
\startcomponent co-verbatim

\environment contextref-env
\product contextref


\chapter[verbatim]{Verbatim text}
\index{verbatim text}
\index{typed text}
\index{typing}
\index{verbatim}
\macro{\tex{starttyping}}
\macro{\tex{setuptyping}}
\macro{\tex{setuptype}}
\macro{\tex{type}}
\macro{\tex{typ}}
\macro{\tex{tex}}
\macro{\tex{typefile}}

Text can be displayed in verbatim (typed) form. The text is
typed between the commands:

\showsetup{starttyping}

Like in:

\startbuffer
\starttyping
In this text there are enough examples of verbatim text. The command
definitions and examples are typeset with the mentioned commands. Like in
this example.
\stoptyping
\stopbuffer

\startreality
\typebuffer
\stopreality

For in||line typed text the command \type {\type} is
available.

\showsetup{type}

A complete file can be added to the text with the command:

\showsetup{typefile}

The style of typing is set with:

\showsetup{setuptyping}

This setup influences the display verbatim (\type
{\starttyping}) and the verbatim typesetting of files (\type
{\typefile}) and buffers (\type {\typebuffer}). The first
optional argument can be used to define a specific verbatim
environment.

\starttyping
\setuptyping[file][margin=default]
\stoptyping

When the key \type {space=on}, the spaces are shown:

\startreality
\setuptyping[space=on]
\starttyping
No alignment is to be preferred
over   aligning   by   means  of
spaces or the s t r e t c h i n g of words
\stoptyping
\stopreality

A very special case is:

\startbuffer
\definetyping
  [broadtyping]

\setuptyping
  [broadtyping]
  [oddmargin=-1.5cm,evenmargin=-.75cm]
\stopbuffer

\getbuffer

\typebuffer

This can be used in:

\startbuffer
\startbroadtyping
A verbatim line can be very long and when we don't want to hyphenate we
typeset it in the margin on the uneven pages.
\stopbroadtyping
\stopbuffer

\typebuffer

At a left hand side page the verbatim text is set in the
margin.

\getbuffer

An in||line verbatim is set up by:

\showsetup{setuptype}

When the parameter \type {option} is set at \type {slanted}
all text between \type{<}\type{<} and \type{>}\type{>} is
typeset in {\ttsl a slanted letter}. This feature can be
used with all parameters. In this way \type
+\type{aa<+\type+<bb>+\type+>cc}+ will result in: \type
{aa<<bb>>cc}.

% Het gekruk met de gesplitste << voorkomt ongewenste
% ligaturen in lucida fonts.

For reasons of readability you can also use other characters
than \type+{+ and \type+}+ as {\em outer} parenthesis. You
can choose your own non||active (a non||special) character,
for example: \type{\type+like this+} or \type{\type-like
that-}. Furthermore you can use the mentioned
\type{<}\type{<} and \type{>}\type{>}, as in
\type+\type<+\type+<like this>+\type+>+ or even
\type{\type<like that>}.

The parameter \type {option=commands} enables you to process
commands in a typed text. In this option \texescape\ is
replaced by \type {/}. This option is used for typesetting
manuals like this one. For example:

\startexample
\setuptyping[option=none]
\starttyping
\seethis <</rm : this command has no effect>>
 /vdots
\sihtees <</sl : neither has this one>>
\stoptyping
\stopexample

The double \type{<}\type{<} and \type{>}\type{>} overtake
the function of \type+{}+.

Within the type||commands we are using \type {\tttf}. When
we would have used \type {\tt}, the \type {\sl} would have
produced a slanted and \type {\bf} a bold typeletter. Now
this will not happen:

\startexample
\setuptyping[option=commands]
\starttyping
\seethis <</rm : this command has no effect>>
 /vdots
\sihtees <</sl : neither has this one>>
\stoptyping
\stopexample

One of the most interesting options of typesetting verbatim
is a program source code. We will limit the information on
this topic and refer readers to the documentation in the
files \type {verb-<<xxx>>.tex} and \type {cont-ver.tex}. In
that last file you can find the following lines:

\starttyping
\definetyping [MP]  [option=MP]
\definetyping [PL]  [option=PL]
\definetyping [JS]  [option=JS]
\definetyping [TEX] [option=TEX]
\stoptyping

Here we see that it is possible to define your own verbatim
environment. For that purpose we use the command:

\showsetup{definetyping}

The definitions above couple such an environment to an
option.

\startbuffer
\startMP
beginfig (12) ;
  MyScale = 1.23 ;
  draw unitsquare scaled MyScale shifted (10,20) ;
endfig ;
\stopMP
\stopbuffer

\typebuffer

In color (or reduced gray) this will come out as:

\startreality
\getbuffer
\stopreality

These environments take care of typesetting the text in such
a way that the typographics match the chosen language. It is
possible to write several filters. Languages like \METAPOST,
\METAFONT, \PERL, \JAVASCRIPT, \SQL, and off course \TEX\
are supported. By default color is used to display these
sources, where several palettes take care of the different
commands. That is why you see the parameter \type {palet} in
\type {\setuptyping}. One can use font changes or even own
commands instead, by assigning the appropriate values to the
\type {icommand} (for identifiers), \type {vcommand} (for
variables) and \type {ccommand} parameters (for the rest). By
default we have:

\starttyping
\setuptyping [icommand=\ttsl, vcommand=, ccommand=\tf]
\stoptyping

We have some alternatives for \type {\type}. When
typesetting text with this command the words are not
hyphenated. Hyphenation is performed however when one uses:

\showsetup{typ}

\startmode[mkii]
When you are thinking of producing a manual on \TEX\ you
have two commands that may serve you well:

\showsetup{tex}

\showsetup{arg}

The first command places a \tex{} in front of typed text and
the second command encloses the text with \arg{}.
\stopmode


\startmode[mkiv]
When you are thinking of producing a manual on \TEX\ you
have a command that may serve you well:

\showsetup{tex}

This command places a \tex{} in front of typed text.
\stopmode



\stopcomponent