Debian Codegraph @

texmf-dist/doc/latex/skeycommand/skeycommand-guide.tex

raw
1 \documentclass[
2 use-a4-paper,
3 use-10pt-font,
4 final-version,
5 use-UK-English,
6 fancy-section-headings,
7 frame-section-numbers,
8 input-config-file,
9 no-hyperref-messages,
10 fancy-footers
11 ]{amltxdoc}
12
13 \usepackage{makeidx}
14 \makeatletter
15 \makeindex
16
17 \begin{document}
18
19 \begin{frontmatter}
20 \suptitle{}
21 \title{The \texttt{\color{blue}skeycommand} Package\titleref{t1}}
22 \subtitlefont{\normalsize\normalfont}
23 \subtitle{\fbox{\parbox[c]{\textwidth}{This package has been superseded by the
24 key command and key environment commands of the
25 \pkg'{ltxkeys}. It is maintained only for the sake of those already using it.
26 Prospective users should instead employ the facilities of the \pkg'{ltxkeys}.
27 }}}
28 \titlenote[t1]{The package is available at \url{\titleurltext}.}
29 \version{0.4}
30 \titleurl{http://mirror.ctan.org/macros/latex/contrib/skeycommand/}
31 \author{Ahmed Musa\Email{[email protected]}\\Preston, Lancashire, UK}
32
33 \renewdef*\abstractname{\vspace{-\baselineskip}}
34 \begin{abstract}
35 \begin{frameshade}[width=\hsize,fillcolor=yellow!20,framesep=2pt,framerule=2pt,
36 framecolor=brown]
37 \frameshade[fillcolor=white,width=2.5cm,framecolor=red!60,framerule=2pt]
38 \centering SUMMARY
39 \endframeshade
40 \small
41 The \pkgm'{skeycommand} provides tools for defining \latex-style commands and environments using parameters and keys together. The advantages of keys over parameters include the facts that the former aren't limited to nine but can rise as desired by the user, and keys are much easier to match to their values than parameters to arguments, especially if the parameters are many. Moreover, keys can have natural functions. The design approach and user interfaces in the \pkgg'{skeycommand} differ from those found in the \pkgm'{keycommand}. This package also provides the \ffx'{\newtwooptcmd,\newtwooptenviron} macros for defining new commands and environments with two options/optional arguments. At both key command definition and invocation times there is no reference by the user to the semantics of key parsing and management. All the complex semantics and calculations involved in defining and setting keys are transparent to the user. The user of the \pkgg'{skeycommand} has access to some of the machinery of \pkg'{ltxkeys} (including the pointer mechanism) at the much lesser cost of worrying only about the key names and their values. Native boolean keys are automatically recognized and handled appropriately. However, because of the need to keep the user interface simple, choice and style keys aren't available in this package.
42 \end{frameshade}
43 \end{abstract}
44
45 \newletcs\licname\licensename
46 \renewdef*\licensename{\vspace{-\baselineskip}}
47 \begin{license}
48 \begin{frameshade}[width=\hsize,fillcolor=white,framesep=2pt,framerule=2pt,
49 framecolor=brown]%
50 \small
51 \vspace{1ex}\centerline{\licname}\endgraff
52 This work (\ie, all the files in the \pkgg'{skeycommand} bundle) may be distributed and/or modified under the conditions of the \lppl, either version~1.3 of this license or any later version.
53 \endgraff
54 The \lppl maintenance status of this software is \quoted{author-maintained}. This software is provided \quoted{as it is}, without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose.
55 \endgraff
56 \centerline{\makered{\CopyrightYear}}%
57 \end{frameshade}
58 \end{license}
59
60 \end{frontmatter}
61
62 \frameshade[fillcolor=yellow!20,framecolor=brown,framerule=2pt,framesep=2pt,
63 width=\hsize]\tableofcontents
64 \endframeshade
65
66
67 \docsection(sec:pack-options){Package options}
68
69 The package has only one option (namely, \fxim{verbose}) and can be invoked at the time of loading the package or via the \fx{\skeycommand} macro. The option \fx{verbose} is a boolean, initially set to false (\ie, its complement, \fxim{silent}, is true by default). Setting \fx{silent} to \fx{false} is tantamount to setting \fx{verbose} to \fx{true}.
70
71 \start{example}[Package options]
72 |com(In style or class files:)
73 \RequirePackage[verbose=true |orr false]{skeycommand}
74 |com(In document files:)
75 \usepackage[verbose=true |orr false]{skeycommand}
76 |com(In all cases:)
77 \skeycommand{verbose=true |orr false}
78 \finish{example}
79
80 If you enter the boolean \fx{verbose} (or \fx{silent}) without value, the value is assumed to be \fx{true}. The \fx{verbose} option is simply passed on to the \pkg'{ltxkeys} to log informational messages in the transcript file. The major task of key parsing for the \pkg'{skeycommand} is undertaken by the \pkg'{ltxkeys}.
81
82
83 \docsection(sec:user-interface){User interfaces}
84
85 \docsubsection{Defining new key commands and environments}
86
87 The user interfaces for defining new key commands and environments are as follows:
88
89 \start+{newmacro}[\newkeycmd, \renewkeycmd, \newkeyenviron, \renewkeyenviron]
90 \newkeycmd|nang(cmd)<|nang(mp)>|(|nang(keyval)|)[|nang(narg)][|nang(dft1)]{|nang(defn)}
91 \newkeycmd|*|nang(cmd)<|nang(mp)>|(|nang(keyval)|)[|nang(narg)][|nang(dft1)]{|nang(defn)}
92
93 \renewkeycmd|nang(cmd)<|nang(mp)>|(|nang(keyval)|)[|nang(narg)][|nang(dft1)]{|nang(defn)}
94 \renewkeycmd|*|nang(cmd)<|nang(mp)>|(|nang(keyval)|)[|nang(narg)][|nang(dft1)]{|nang(defn)}
95
96 \newkeyenviron|nang(env)<|nang(mp)>|(|nang(keyval)|)[|nang(narg)][|nang(dft1)]{|nang(defn)}
97 \newkeyenviron|*|nang(env)<|nang(mp)>|(|nang(keyval)|)[|nang(narg)][|nang(dft1)]{|nang(defn)}
98
99 \renewkeyenviron|nang(env)<|nang(mp)>|(|nang(keyval)|)[|nang(narg)][|nang(dft1)]{|nang(defn)}
100 \renewkeyenviron|*|nang(env)<|nang(mp)>|(|nang(keyval)|)[|nang(narg)][|nang(dft1)]{|nang(defn)}
101 \finish{newmacro}
102 \fxim*{\newkeycmd, \renewkeycmd, \newkeyenviron, \renewkeyenviron}
103
104 Here,
105
106 \begin{enum}
107 \item \ang{cmd} is the new control sequence; \ang{env} is the new environment name.
108 \item \ang{mp} is the prefix for macros deriving from the defined keys whose values will be used in the new command or environment (this is called the \emph{macro prefix} in the parlance of keys). If you don't supply the optional \ang{mp}, the package will use the first three letters of the key command or environment name, excluding the escape character but including an added \quoted{at sign} (\fx{@}). The aim of the default \quoted{at sign} is to aid the visual separation of key names from macro prefixes.
109 \item \ang{keyval} is the key-value list [\eg, (\ffx{keya=valuea,keyb=valueb})].
110 \item \ang{narg} is the number of parameters/arguments for the new command or environment (excluding the keys), as you would normally enter it in \fx{\newcommand} and \fx{\newenvironment}.
111 \item \ang{dft1} is the default value for your optional argument (normally the first argument in \hhx'{\newcommand,\newenvironment}).
112 \item \ang{defn} is the replacement text (as in \hhx'{\newcommand,\newenvironment}).
113 \end{enum}
114
115 \ltsnote The number of parameters (\ang{narg}) for the new command or environment is limited to eight (8), and not the nine (9) that \tex allows. The ninth one is taken up by the keys. Indeed, we could have designed \ffx{\newkeycmd, \renewkeycmd, \newkeyenviron, \renewkeyenviron} to take nine parameters (apart from the keys) but the need for parameters is greatly diminished by the theoretically limitless number of keys that each command can have.
116
117 Please note the angle brackets surrounding \ang{mp}, and the parentheses surrounding \ang{keyval} in the above syntaxes. The \ang{mp} can't be empty (\ie, don't enter \texttt{<>}) because it will be used by the package to build unique names for the macros that will hold the key values. You can choose not to enter anything for \ang{mp}, \ie, no angled brackets at all. In this case the package will happily use the default prefix \fx{<xxx@>}, where \quoted{\fx{xxx}} represents the first three letters of the new command or environment name, excluding the escape character. Also, \ang{keyval} can't be empty: if it was empty, then we should wonder why you're using key commands instead of \latex's \fx{\newcommand} and \fx{\newenvironment}.
118
119 In \ang{defn}, you refer to your arguments in the normal way. You refer to the values of the keys using macros whose first three characters (after the escape character) are the \ang{mp} or, if \ang{mp} is not supplied, the first three letters of the declared key command (excluding the escape character). The family name of the keys defined via a key command is the key command name itself (without the escape character)---but the user is not required to know anything about such jargons as \quoted{key families}. The package uses this internally in developing the keys. The key prefix is always \quoted{KV}. If any of your key values contains parentheses, simply enclose them in braces, to avoid confusing them with \ang{keyval} list.
120
121 The \stform+ give \quoted{short} macros, while the plain (unstarred) variants yield \quoted{long} macros, in the sense usually understood in \latex.
122
123 The optional \ang{mp} will be useful if you fear clashes with previously defined key commands. Although, to be defined, key commands must be definable, two key commands may have their first three or four characters identical, thereby leading to clashes of their key-value prefixes.
124
125
126 \docsubsection(sec:env-final-tokens){Final tokens of every environment}
127
128 The user can add some tokens to the very end of every subsequent environment by declaring those tokens in \fxim{\skceveryeoe}, which by default contains only \latex's \fxi{\ignorespacesafterend}, that is, the \pkg'{skeycommand} automatically issues
129
130 \start{example}[\skceveryeoe]
131 |makered(\skceveryeoe){\ignorespacesafterend}
132 \finish{example}
133
134 It is important to note that new tokens are prepended (not appended) to the hook that underlies \fx{\skceveryeoe}, such that by default \fx{\ignorespacesafterend} always comes last in the list. You can empty the token list \fx{\skceveryeoe} by issuing \fx*{\skceveryeoe{}} and rebuild the list afresh, still by prepending elements to it. \fx{\skceveryeoe} isn't actually a token list register, but has been designed to behave like one. It is safe to issue \fx{\skceveryeoe}\fnu{token} and/or \fx*{\skceveryeoe{}} in the pre-code part of the environment. The following example illustrates this point.
135
136 \start{example}[\newkeyenviron]
137 \newkeyenviron*{testenv}<mp@>|(xwidth=2cm,ywidth=1.5cm,
138 bool=false,body=\null,author=\null|){%
139 \centering\fbox{\parbox{\mp@xwidth}{\mp@body}}
140 \ifmp@bool\color{red}\fi
141 \fbox{\parbox{\mp@ywidth}{\mp@body}}%
142 \normalcolor
143 |makered(\skceveryeoe){}%
144 |makered(\skceveryeoe){\ignorespacesafterend}%
145 |makered(\skceveryeoe){\endgraf\vskip\baselineskip
146 \centerline{\itshape\mp@author}}
147 \def\testmacroa##1{aaa##1bbb}|com(just to test parameter use)
148 }{%
149 \def\testmacrob##1{xxx##1yyy}%
150 }
151
152 \begin{document}
153 \begin{testenv}|(xwidth=5cm,ywidth=4cm,bool=true,
154 author={Cornelius Tacitus \textup{|(55--120~AD|)}},body={%
155 Love of fame is the last thing even learned men can bear
156 to be parted from.
157 }|)%
158 \end{testenv}
159 \end{document}
160 \finish{example}
161
162 %%+
163 \newkeyenviron*{testenv}<mp@>(xwidth=2cm,ywidth=1.5cm,
164 boola=false,body=\null,author=\null){%
165 \centering\fbox{\parbox{\mp@xwidth}{\raggedright\mp@body}}%
166 {\ifmp@boola\color{red}\fi
167 \hspace*{2mm}\fbox{\parbox{\mp@ywidth}{\raggedright\mp@body}}}%
168 \skceveryeoe{}%
169 \skceveryeoe{\ignorespacesafterend}%
170 \skceveryeoe{\endgraf\vskip\baselineskip
171 \centerline{\itshape\mp@author}}%
172 \def\testmacroa##1{aaa##1bbb}%
173 }{\def\testmacrob##1{xxx##1yyy}}%
174
175 \printexample
176 \begin{testenv}(xwidth=5cm,ywidth=6cm,boola=true,
177 author={Cornelius Tacitus \textup{(c.55--c.120~AD)}},
178 body={Love of fame is the last thing even learned men can bear
179 to be parted from.})%
180 \end{testenv}%
181 \endprintexample
182
183 \skceveryeoe{}
184 \skceveryeoe{\ignorespacesafterend}
185 %%-
186
187
188 \docsubsection(sec:invoking-new-cmd){Invoking new key commands and environments}
189
190 The syntaxes for calling new key commands and environments are as follows:
191
192 \start'{macro}[Invoking commands and environments]
193 \cmd[|nang(arg1)]{|nang(arg2)}...{|nang(argn)}|(|nang(keyval)|)
194
195 \begin{env}[|nang(arg1)]{|nang(arg2)}...{|nang(argn)}|(|nang(keyval)|)
196 environment body
197 \end{env}
198 \finish{macro}
199
200 where \fx{\cmd} and \fx{env} have been previously defined using key command and key environment. You refer to your arguments using parameter number one \fx{#1} onwards, up to a maximum of \fx{#8} (yes, \fx{#8}, not \fx{#9}). Here, \ang{keyval} (including the parenthesis) are optional arguments: you can omit them if you want to use the values of the keys set at key command definition time. Using keys is preferable to using parameters: you don't have to match parameters to arguments and, in principle, there is no limit to the number of keys that are permissible.
201
202
203 \docsubsection[Commands with two optional arguments]
204 {Commands and environments with two optional arguments}
205
206 The \pkg'{skeycommand} uses the following macros internally. They can be used to define new commands and environments with two optional arguments. Their philosophy, intent, and use syntaxes differ from those of the \pkgm'{twoopt}. They may be useful to some users in a few circumstances, but I recommend the use of the above key commands in all instances.
207
208 \start+{newmacro}[\newtwooptcmd,\newtwooptenviron, etc]
209 \newtwooptcmd|nang(cmd)[|nang(narg)][|nang(dft1)]{|nang(defn)}
210 \newtwooptcmd|*|nang(cmd)[|nang(narg)][|nang(dft1)]{|nang(defn)}
211
212 \renewtwooptcmd|nang(cmd)[|nang(narg)][|nang(dft1)]{|nang(defn)}
213 \renewtwooptcmd|*|nang(cmd)[|nang(narg)][|nang(dft1)]{|nang(defn)}
214
215 \newtwooptenviron|nang(cmd)[|nang(narg)][|nang(dft1)]{|nang(defn)}
216 \newtwooptenviron|*|nang(cmd)[|nang(narg)][|nang(dft1)]{|nang(defn)}
217
218 \renewtwooptenviron|nang(cmd)[|nang(narg)][|nang(dft1)]{|nang(defn)}
219 \renewtwooptenviron|*|nang(cmd)[|nang(narg)][|nang(dft1)]{|nang(defn)}
220 \finish{newmacro}
221 \fxim*{\newtwooptcmd,\renewtwooptcmd,\newtwooptenviron,\renewtwooptenviron}
222
223 \ang{narg} is the total number of arguments, including the first and second optional arguments.
224 Where are the second optional arguments here, you might be wondering? The second optional argument is usually empty and doesn't appear at command definition time. The second optional argument isn't the second argument of your command (as in \pkgg'{twoopt}), but the last. At command invocation, if you don't supply a value for the second optional argument, the command will assume it to be empty. But how do you supply a value for the second optional argument? The next section shows how.
225
226
227 \docsubsubsection[Invoking commands and environments]
228 {Invoking commands and environments with two optional arguments}
229
230 The syntaxes for calling commands and environments with two optional arguments are as follows:
231
232 \start{macro}[Commands and environments with two optional arguments]
233 \cmd[|nang(1st optarg)]{|nang(arg2)}...{|nang(argn)}|(|nang(2nd optarg)|)
234
235 \begin{env}[|nang(1st optarg)]{|nang(arg2)}...{|nang(argn)}|(|nang(2nd optarg)|)
236 environment body
237 \end{env}
238 \finish{macro}
239
240 If \ang{2nd optarg} is empty at command or environment invocation, the command or environment will assume it to be empty. Now you can see the conceptual link between \fx{\newtwooptcmd} (and friends) and \fx{\newkeycmd} (and friends).
241
242
243 \docsection(sec:examples){Examples}
244
245 The source codes for the following examples are available in the accompanying user guide (file
246 \file[tex]{skeycommand-guide}).
247
248 \hbadness\@M
249
250 \start{example}[\newkeycmd]
251 |com(The following is a macro of 3 parameters and 4 keys:)
252 |makered(\newkeycmd*)\demomacro|(name=Steve,height=1.60m,weight=75kg,
253 tested=true|)[3][Registered]{%
254 \def\x{#1}\def\y{#2}\def\z{#3}%
255 \noindent\rule{4cm}{1pt}\endgraf\smallskip
256 \noindent\textcolor{blue}{\texttt{\string\demomacro}} macro:
257 \endgraf\medskip
258 \ifdem@tested
259 \edef\cleared{\dem@name}%
260 \noindent\fbox{Name given: \dem@name}%
261 \else
262 \let\cleared\relax
263 Name not given
264 \fi
265 \endgraf\medskip
266 \noindent \x, \y, \z
267 \endgraf\smallskip
268 \noindent\rule{4cm}{1pt}%
269 \def\testmacro##1{xxx##1yyy}%
270 }
271 |com(|makered(\dem@name) will hold the value supplied for |makered(`name') by the user of)
272 |com(\demomacro. |makered(`dem') is from |makered(`demomacro'). Notice the LaTeX-like)
273 |com(syntax of this command. The user doesn't have to bother about)
274 |com(the nitty-gritty of key infrastructure.)
275
276 |com(You can use the following statement to instruct the user)
277 |com(to always supply value for `name' in \demomacro macro:)
278 \finish{example}
279
280 %%+
281 \newkeycmd*\demomacro(\needvalue{name}=Steve,height=1.60m,weight=75kg,
282 tested=true)[3][Registered]{%
283 \def\x{#1}\def\y{#2}\def\z{#3}%
284 \noindent\rule{4cm}{1pt}\endgraf\smallskip
285 \noindent\textcolor{blue}{\texttt{\string\demomacro}} macro:
286 \endgraf\medskip
287 \ifdem@tested
288 \edef\cleared{\dem@name}%
289 \noindent\fbox{Name given: \dem@name}%
290 \else
291 \let\cleared\relax
292 Name not given
293 \fi
294 \endgraf\medskip
295 \noindent \x, \y, \z
296 \endgraf\smallskip
297 \noindent\rule{4cm}{1pt}%
298 \def\testmacro##1{xxx##1yyy}%
299 }
300
301 \printexample
302 \demomacro[data1]{data2}{data3}(name=John Stone,
303 height=1.45m,weight=55kg,tested=true)%
304 \endprintexample
305 %%-
306
307 The following requires the user to always supply a value for \quoted{name}:
308
309 \start{example}[\newkeycmd]
310 |makered(\newkeycmd)*\demomacro|(\needvalue{name}=Steve,height=1.60m,wieght=75kg,tested=true|)
311 [3][Registered]{%
312 \def\x{#1}\def\y{#2}\def\z{#3}%
313 \noindent\rule{4cm}{1pt}\endgraf\smallskip
314 \noindent\textcolor{blue}{\texttt{\string\demomacro}} macro:
315 \endgraf\medskip
316 \ifdem@tested
317 \edef\cleared{\dem@name}%
318 \noindent\fbox{Name given: \dem@name}%
319 \else
320 \let\cleared\relax
321 Name not given
322 \fi
323 \endgraf\medskip
324 \noindent \x, \y, \z
325 \endgraf\smallskip
326 \noindent\rule{4cm}{1pt}%
327 }
328
329 |com(User now calls the \demomacro macro:)
330 \demomacro[data1]{data2}{data3}|(name,height=1.55m,wieght=55kg,
331 tested=true|)
332 |makered(|tto Error: no value supplied for `name')
333 \finish{example}
334
335 If for any key in \fx{\demomacro} you don't supply a key-value pair, the macro will use the above default value of that key. For example, in the following, the key \fx{height} is missing, so the macro will use its default value specified at key definition time:
336
337 \start{example}
338 \demomacro[data1]{data2}{data3}|(name=John,weight=55kg,tested=true|)
339 \finish{example}
340
341 \start{example}[\newkeycmd]
342 |makered(\newkeycmd*)\firstmacro<skc@>|(name=Steve,height=1.6m|)[8][xxx]{%
343 \noindent\textcolor{purple}{\texttt{\string\firstmacro}} macro:
344 \endgraf\vskip.25\baselineskip
345 \noindent Name: \skc@name\\Height: \skc@height\\
346 Details: #1#2#3#4#5#6#7#8\endgraf
347 }
348
349 \begin{document}
350 \firstmacro[1]{-2}{-3}{-4}{-5}{-6}{-7}{-8}%
351 |(name=John {|(Winner|)},height=1.54m|)
352 \end{document}
353 \finish{example}
354
355 %%+
356 \newkeycmd*\firstmacro<skc@>(name=Steve,height=1.6m)[8][xxx]{%
357 \noindent\textcolor{purple}{\texttt{\string\firstmacro}} macro:
358 \endgraf\vskip.25\baselineskip
359 \noindent Name: \skc@name\\Height: \skc@height\\
360 Details: #1#2#3#4#5#6#7#8\endgraf
361 }
362 \printexample
363 \firstmacro[1]{-2}{-3}{-4}{-5}{-6}{-7}{-8}%
364 (name=John {(Winner)},height=1.54m)%
365 \endprintexample
366 %%-
367
368 \start{example}[\newkeyenviron]
369 \NewBoxes{MiniBox}
370 |makered(\newkeyenviron*){xboxedminipage}<boxm@>|(width=\hsize,parindent=0em,
371 boxposition=center,innerposition=c,textposition=right,fboxrule=.4pt,
372 fboxsep=2pt|){%
373 \begingroup
374 \fboxsep\boxm@fboxsep\fboxrule\boxm@fboxrule
375 \dimensionexpr!\BoxWidth{\boxm@width-2\fboxsep-2\fboxrule}%
376 \simpleexpandarg\CheckInput\boxm@boxposition{center,right,left,justified}{%
377 \edef\boxm@boxposition{%
378 \ifcase\nr center\or flushright\or flushleft\or\fi
379 }%
380 }{%
381 \SKC@err{Invalid value `\boxm@boxposition' for `boxposition'}\@ehc
382 }%
383 \def\PrintBox{%
384 \simpleexpandarg\begin\boxm@boxposition
385 \fbox{\usebox{\MiniBox}}%
386 \simpleexpandarg\end\boxm@boxposition
387 \endgroup
388 }%
389 \begin{lrbox}{\MiniBox}%
390 \begin{minipage}[\boxm@innerposition]{\BoxWidth}%
391 \csname flush\boxm@textposition\endcsname
392 }{%
393 \end{minipage}\end{lrbox}\PrintBox
394 }
395 |com(Valid values for `position' are `right', `left', `center', and)
396 |com(`justified'.)
397 \finish{example}
398
399 %%+
400 \newbox\MiniBox
401 \newkeyenviron*{xboxedminipage}<boxm@>(width=\hsize,parindent=0em,
402 boxposition=left,innerposition=c,textposition=right,
403 fboxrule=.4pt,fboxsep=2pt){%
404 \begingroup
405 \fboxsep\boxm@fboxsep\fboxrule\boxm@fboxrule
406 \dimensionexpr!\BoxWidth{\boxm@width-2\fboxsep-2\fboxrule}%
407 \oifinlistbTF\boxm@boxposition{center,right,left,justified}{%
408 \edef\boxm@boxposition{%
409 \ifcase\nr center\or flushright\or flushleft\or\fi
410 }%
411 }{%
412 \SKC@err{Invalid value '\boxm@boxposition' for 'boxposition'}\@ehc
413 }%
414 \def\PrintBox{%
415 \simpleexpandarg\begin\boxm@boxposition
416 \fbox{\usebox{\MiniBox}}%
417 \simpleexpandarg\end\boxm@boxposition
418 \endgroup
419 }%
420 \begin{lrbox}{\MiniBox}%
421 \begin{minipage}[\boxm@innerposition]{\BoxWidth}%
422 \csname flush\boxm@textposition\endcsname
423 }{%
424 \end{minipage}\end{lrbox}\PrintBox
425 }
426
427 \printexample
428 \begin{xboxedminipage}(width=.5\hsize,parindent=0em,fboxrule=2pt,
429 innerposition=c,boxposition=center,textposition=right)%
430 A boxed minipage environment that accepts verbatim text like this:
431 \ttcl{macrocolor}{\fx{xxx_yyy_zzz}} \fx{\verb+xxx+}.
432 \end{xboxedminipage}%
433 \endprintexample
434 %%-
435
436 \start{example}[\newkeyenviron]
437 |makered(\newkeyenviron*){vdescription}<skv@>|(labelwidth=5pt,
438 labelsep=5pt|)[2][\qquad]
439 {\begin{list}{}{\renewdef*\makelabel##1{\sffamily ##1:\hfil}%
440 \settowidth\labelwidth{\makelabel{#1}}%
441 \dimensionexpr!\leftmargin{\labelwidth+\skv@labelwidth
442 +\labelsep+\skv@labelsep}}%
443 \item[Description Preamble] #2%
444 }{\end{list}}
445
446 \begin{document}
447 \begin{vdescription}[Description Postamble]%
448 {$\star\star\star$}|(labelwidth=10pt,labelsep=10pt|)
449 \item[Item 1] xxx
450 \item[Item 2] yyy
451 \item[Description Postamble] $\langle$End of my
452 environment$\rangle$
453 \end{vdescription}
454 \end{document}
455 \finish{example}
456
457 %%+
458 \newkeyenviron*{vdescription}<skv@>(labelwidth=5pt,labelsep=5pt)[2][\qquad]
459 {\begin{list}{}{\renewdef*\makelabel##1{\sffamily ##1:\hfil}%
460 \settowidth\labelwidth{\makelabel{#1}}%
461 \dimensionexpr!\leftmargin{\labelwidth+\skv@labelwidth
462 +\labelsep+\skv@labelsep}}%
463 \item[Description Preamble] #2%
464 }{\end{list}}
465 \printexample
466 \begin{vdescription}[Alexandre P\'ere Dumas (1802--1870)]%
467 {$\langle\star\star\star\rangle$}(labelwidth=5pt,labelsep=5pt)
468 \item[Alexandre P\'ere Dumas (1802--1870)] All for one, and one for all.
469 \item[Alexandre Fils Dumas (1824--1895)] All generalizations are dangerous, even this one.
470 \item[Description Postamble] $\langle\bullet\bullet\bullet\rangle$
471 \end{vdescription}%
472 \endprintexample
473 %%-
474
475 \EnableMathInExampleCode
476 \start{example}[\newkeyenviron]
477 |makered(\newkeyenviron*){dialog}<dia@>|(labelwidth=5pt,labelsep=5pt,
478 title=\null,source=\null,sourcecolor=blue|)[1][\qquad]
479 {\begin{list}{}{\renewdef*\makelabel##1{\sffamily ##1:\hfil}%
480 \centering\textbf{\dia@title}%
481 \settowidth\labelwidth{\makelabel{#1}}%
482 \dimensionexpr!\leftmargin{\labelwidth+\dia@labelwidth
483 +\labelsep+\dia@labelsep}}%
484 }{%
485 \\\flushright\textcolor{\dia@sourcecolor}{\dia@source}%
486 \end{list}%
487 }
488
489 \begin{dialog}[Ramanujan]|(labelwidth=0pt,labelsep=0pt,
490 title={G. H. Hardy vs.\ Srinivasa Ramanujan |(1920|)},
491 source={S. Ramanujan |(1887--1920|), Collected Works}|)%
492 \item[Hardy] Srinivasa, can you see that number from here, the
493 one on that taxi cab?
494 \item[Ramanujan] I can see it, it is 1729.
495 \item[Hardy] What a dull registration number to have on your vehicle?
496 \item[Ramanujan] No, it is a very interesting number.
497 \item[Hardy] What is interesting about it?
498 \item[Ramanujan] It is the smallest number expressible as a sum of two
499 cubes in two different ways.
500 \item[Hardy] What are the different ways?
501 \item[Ramanujan] They are $1^3+12^3$ and $9^3+10^3$.
502 \item[Hardy] I am impressed! When did you work that out?
503 \end{dialog}
504 \finish{example}
505 \DisableMathInExampleCode
506
507 %%+
508 \newkeyenviron*{dialog}<dia@>(labelwidth=5pt,labelsep=5pt,
509 title=\null,source=\null,sourcecolor=blue)[1][\qquad]
510 {\begin{list}{}{\renewdef*\makelabel##1{\sffamily ##1:\hfil}%
511 \centering\textbf{\dia@title}%
512 \settowidth\labelwidth{\makelabel{#1}}%
513 \dimensionexpr!\leftmargin{\labelwidth+\dia@labelwidth
514 +\labelsep+\dia@labelsep}}%
515 }{%
516 \\\flushright\textcolor{\dia@sourcecolor}{\dia@source}%
517 \end{list}%
518 }
519
520 \printexample
521 \begin{dialog}[Ramanujan](labelwidth=0pt,labelsep=0pt,
522 title={G. H. Hardy vs.\ Srinivasa Ramanujan (1920)},
523 source={S. Ramanujan (1887--1920), Collected Works})%
524 \item[Hardy] Srinivasa, can you see that number from here, the one on that taxi cab?
525 \item[Ramanujan] I can see it, it is 1729.
526 \item[Hardy] What a dull registration number to have on your vehicle?
527 \item[Ramanujan] No, it is a very interesting number.
528 \item[Hardy] What is interesting about it?
529 \item[Ramanujan] It is the smallest number expressible as a sum of two cubes in two different ways.
530 \item[Hardy] What are the different ways?
531 \item[Ramanujan] They are $1^3+12^3$ and $9^3+10^3$.
532 \item[Hardy] I am impressed! When did you work that out?
533 \end{dialog}%
534 \endprintexample
535 %%-
536
537 \start{example}[\newkeyenviron]
538 \def\@beeton{An author writing an article for publication
539 in TUGboat is encouraged to create it on a computer file
540 and submit it on magnetic tape.}
541 \def\beeton{Barbara BEETON,\\ \emph{How to Prepare a File For
542 Publication in TUGboat} |(1981|)}
543 \def\@hieronymus{The printer should refuse to employ wandering
544 men, foreigners who, after having committed some grievous
545 error, can easily disappear and return to their own country.}
546 \def\hieronymus{HIERONYMUS HORNSCHUCH |(1608|)}
547
548 |com(The macros \@beeton, \beeton, etc. are just shorthands:)
549 |com(you can enter their contents directly in key commands,)
550 |com(as we shall see later.)
551
552 |makered(\newkeyenviron){Quote}<mp@>|(left=\leftmargin,
553 right=\rightmargin,mode=false,whoby=\null,
554 source=\null|){%
555 \begin{list}{}{%
556 \setlength\leftmargin{\mp@left}%
557 \setlength\rightmargin{\mp@right}%
558 }%
559 \item[]\makebox[0pt][r]{``}%
560 }{%
561 \unskip\makebox[0pt][l]{''}%
562 \item[] \flushright\mp@whoby
563 \item[] \flushleft\small Source: \mp@source
564 \end{list}
565 \vskip\baselineskip
566 }
567 \usepackage{lipsum}
568 \lipsum[1]
569 \begin{Quote}|(left=30pt,right=30pt,mode=false,
570 whoby=\beeton,source={The \TeX Book}|)%
571 {\ifmp@mode\color{red}\else\color{blue}\fi\@beeton}
572 \end{Quote}
573
574 \lipsum[1]
575 \begin{Quote}|(left=20pt,right=20pt,mode=true,
576 whoby=\hieronymus,source={The \TeX Book}|)%
577 {\ifmp@mode\color{red}\else\color{blue}\fi\@hieronymus}
578 \end{Quote}
579
580 \lipsum[1]
581 \begin{Quote}|(left=40pt,right=40pt,mode=false,
582 whoby={EDWARD ELGAR},source={Letter to A.\ J.\ Jaeger |(1898|)}|)%
583 {\ifmp@mode\color{red}\else\color{blue}\fi
584 If I write a tune you all say it's commonplace---if I
585 don't, you all say it's rot.%
586 }%
587 \end{Quote}
588
589 \begin{Quote}|(left=40pt,right=40pt,mode=false,
590 whoby={ALBERT EINSTEIN},source={The World As I See It}|)%
591 {\ifmp@mode\color{red}\else\color{blue}\fi
592 If you want to find out anything from the theoretical physicists
593 about the methods they use, I advise you to stick closely to
594 one principle: don't listen to their words, fix your attention
595 on their deeds.%
596 }%
597 \end{Quote}
598 \finish{example}
599
600 %%+
601 \newkeyenviron{Quote}<mpi@>(left=\leftmargin,
602 right=\rightmargin,mode=false,whoby=\null,source=\null){%
603 \begin{list}{}{%
604 \setlength\leftmargin{\mpi@left}%
605 \setlength\rightmargin{\mpi@right}%
606 }%
607 \item[]\makebox[0pt][r]{``}%
608 }{%
609 \unskip\makebox[0pt][l]{''}%
610 \item[]\flushright\mpi@whoby
611 \item[]\flushleft\small Source:~\mpi@source
612 \end{list}%
613 \vskip\baselineskip
614 }
615 \def\@beeton{An author writing an article for publication
616 in TUGboat is encouraged to create it on a computer file
617 and submit it on magnetic tape.}
618 \def\beeton{B. BEETON,\\ \emph{How to Prepare a File For
619 Publication in TUGboat} (1981)}
620 \def\@hieronymus{The printer should refuse to employ wandering
621 men, foreigners who, after having committed some grievous
622 error, can easily disappear and return to their own country.}
623 \def\hieronymus{HIERONYMUS HORNSCHUCH (1608)}
624
625 \printexample
626 \begin{Quote}(left=30pt,right=30pt,mode=false,
627 whoby=\beeton,source={The \TeX Book})%
628 {\ifmpi@mode\color{red}\else\color{blue}\fi\@beeton}%
629 \end{Quote}%
630 \endprintexample
631 \printexample*
632 \begin{Quote}(left=40pt,right=40pt,mode=true,
633 whoby=\hieronymus,source={The \TeX Book})%
634 {\ifmpi@mode\color{red}\else\color{blue}\fi\@hieronymus}%
635 \end{Quote}%
636 \endprintexample
637 \printexample*
638 \begin{Quote}(left=80pt,right=80pt,mode=false,
639 whoby={EDWARD ELGAR (1898)},source={Letter to A.\ J.\ Jaeger})%
640 {\ifmpi@mode\color{red}\else\color{blue}\fi
641 If I write a tune you all say it's commonplace---if I
642 don't, you all say it's rot.%
643 }%
644 \end{Quote}%
645 \endprintexample
646 \printexample*
647 \begin{Quote}(left=40pt,right=40pt,mode=false,
648 whoby={ALBERT EINSTEIN},source={The World As I See It})%
649 {\ifmpi@mode\color{red}\else\color{blue}\fi
650 If you want to find out anything from the theoretical physicists
651 about the methods they use, I advise you to stick closely to
652 one principle: don't listen to their words, fix your attention
653 on their deeds.%
654 }%
655 \end{Quote}%
656 \endprintexample
657 %%-
658
659 \start{example}[\newkeyenviron]
660 \usepackage{lipsum}
661 \newcounter{notecnt}
662 \def\noteparameters{\labelsep=\notelabelsep
663 \itemindent=\noteitemindent \leftmargin=\noteleft
664 \rightmargin=\noteright \labelwidth=\notelabelwidth}
665
666 |makered(\newkeyenviron*){notex}<note>|(labelsep=8pt,itemindent=8pt,
667 left=\parindent,right=\parindent,labelwidth=0pt,
668 preskip=0ex,aftskip=0ex|)[1][\baselineskip]%
669 {\begin{list}{\textsc{Note}~\arabic{notecnt}:}%
670 {\noteparameters\usecounter{notecnt}}%
671 \vskip#1}%
672 {\end{list}\vskip\noteaftskip}
673
674 \begin{document}
675 \noindent\lipsum[1]
676 \begin{notex}[\notepreskip]|(labelsep=8pt,itemindent=8pt,
677 left=30pt,right=30pt,labelwidth=0pt,preskip=2ex,aftskip=2ex|)
678 \item \lipsum[1]
679 \item \lipsum[1]
680 \end{notex}
681 \end{document}
682 \finish{example}
683
684 %%+
685 \newcounter{notecnt}
686 \def\noteparameters{\labelsep=\notelabelsep
687 \itemindent=\noteitemindent \leftmargin=\noteleft
688 \rightmargin=\noteright \labelwidth=\notelabelwidth}
689 \newkeyenviron*{notex}<note>(labelsep=8pt,itemindent=8pt,
690 left=\parindent,right=\parindent,labelwidth=0pt,
691 preskip=0ex,aftskip=0ex)[1][\baselineskip]%
692 {\begin{list}{\textbf{Note~\arabic{notecnt}}}%
693 {\centering\textbf{How to make a recurring list}\\[1ex]%
694 \noteparameters\usecounter{notecnt}}%
695 \vskip#1%
696 }%
697 {\end{list}\vskip\noteaftskip}
698
699 \startrecurrentlist{2}
700 \printexample*
701 \begin{notex}[\notepreskip](labelsep=8pt,itemindent=8pt,
702 left=20pt,right=20pt,labelwidth=0pt,preskip=2ex,aftskip=2ex)%
703 \item The play was a great success, but the audience was a disaster. (Oscar Wilde, 1854--1900)
704 \item If people behaved in the way nations do they would all be put in straitjackets. (Tennessee Williams, 1911--1983)
705 \item If you hate a person, you hate something in him that is part of yourself. What isn't part of ourselves doesn't disturb us. (Hermann Hesse, 1877-1962)
706 \item If a man makes a better mouse-trap than his neighbor, though he builds his house in the woods, the world will make a beaten path to his door. (Ralph Waldo Emerson, 1803--1882)
707 \end{notex}
708 \endprintexample
709 \endrecurrentlist
710 %%-
711
712 \start{example}[\renewkeyenviron]
713 \def\sitation{}
714 \def\sitparameters{\leftmargin=\sit@left\rightmargin=\sit@right}
715 \newbox\sitname
716 |makered(\renewkeyenviron*){sitation}|(left=\parindent,
717 right=\parindent,nolinebreak=1|)[2][\relax]%
718 {\def\quoteend{#1}\sitparameters
719 \sbox\sitname{\textit{#2}}%
720 \begin{quote}\quoteend
721 }%
722 {\hspace*{\fill}\nolinebreak[\sit@nolinebreak]%
723 \quad\hspace*{\fill}\finalhyphendemerits\z@
724 \box\sitname
725 \end{quote}}
726
727 \begin{document}
728 \begin{sitation}[\sit@nolinebreak]%
729 {Theodore Roosevelt~|(1858--1919|)}%
730 |(left=30pt,right=30pt,nolinebreak=2|)
731 No man is justified in doing evil on the ground of expediency.
732 \end{sitation}
733
734 \begin{sitation}{George Bernard Shaw |(1856-1950|)}%
735 A man of great common sense and good taste; meaning thereby
736 a man without originality and/or moral courage.
737 \end{sitation}
738 \end{document}
739 \finish{example}
740
741 %%+
742 \def\sitation{}
743 \def\sitparameters{\leftmargin=\sit@left\rightmargin=\sit@right}
744 \csnnewbox{sitname}
745 \renewkeyenviron*{sitation}(left=\parindent,
746 right=\parindent,nolinebreak=1)[2][\relax]%
747 {\def\quoteend{#1}\sitparameters
748 \sbox\sitname{\textit{#2}}%
749 \begin{quote}%
750 }{%
751 \hspace*{\fill}\nolinebreak[\sit@nolinebreak]%
752 \quad\hspace*{\fill}\finalhyphendemerits\z@
753 \box\sitname
754 \end{quote}\quoteend
755 }
756 \printexample
757 \begin{sitation}[\vskip2ex\relax]{Theodore Roosevelt~\textup{(1858--1919)}}%
758 (left=30pt,right=30pt,nolinebreak=2)%
759 No man is justified in doing evil on the ground of expediency.
760 \end{sitation}%
761 \endprintexample
762 \printexample*
763 \begin{sitation}{George Bernard Shaw~\textup{(1856-1950)}}%
764 (left=0pt,right=0pt,nolinebreak=2)%
765 A man of great common sense and good taste;
766 meaning thereby a man without originality and/or moral courage.
767 \end{sitation}%
768 \endprintexample
769 %%-
770
771 \start{example}[\newkeyenviron]
772 |makered(\newkeyenviron*){vdescription}|(labelwidth=5pt,
773 labelsep=5pt|)[2][\qquad]%
774 {\begin{list}{}{\renewdef*\makelabel##1{\sffamily ##1:\hfil}%
775 \settowidth\labelwidth{\makelabel{#1}}%
776 \dimensionexpr!\leftmargin{\labelwidth+\vde@labelwidth
777 +\labelsep+\vde@labelsep}}%
778 \item[Description Preamble] #2%
779 }{\end{list}}
780
781 \begin{document}
782 \begin{vdescription}[Description Postamble]{+++xxx+++}%
783 |(labelwidth=10pt,labelsep=5pt|)
784 \item[Item 1] xxx
785 \item[Item 2] yyy
786 \item[Description Postamble] $\langle$End of my
787 environment$\rangle$
788 \end{vdescription}
789 \end{document}
790 \finish{example}
791
792 \start{example}[\renewtwooptenviron]
793 |makered(\renewtwooptenviron*){vdescription}[3][\qquad]
794 {\begin{list}{}{\renewdef*\makelabel##1{\sffamily ##1:\hfil}%
795 \settowidth\labelwidth{\makelabel{#1}}%
796 \dimensionexpr!\leftmargin{\labelwidth+\labelsep+#2}}%
797 \item[Description Preamble] #3%
798 }{\end{list}}
799
800 \begin{document}
801 \begin{vdescription}[Description Postamble]{4cm}|({|(Begin
802 environment no.\ 1|)}|)
803 \item[Item 1] xxx
804 \item[Item 2] yyy
805 \item[Description Postamble] |(End of environment no.\ 1|)
806 \end{vdescription}
807 \end{document}
808 \finish{example}
809
810 \start{example}[\newtwooptenviron]
811 |makered(\newtwooptenviron*){udescription}[3][\hspace{1cm}]
812 {\begin{list}{}{\renewdef*\makelabel##1{\sffamily ##1:\hfil}%
813 \settowidth\labelwidth{\makelabel{#1}}%
814 \dimensionexpr!\leftmargin{\labelwidth+\labelsep+#3}}%
815 \item[Description Preamble] #2%
816 }{\end{list}}
817
818 \begin{document}
819 \begin{udescription}[Description Postamble]{uuu}|(4cm|)
820 \item[Item 1] xxx
821 \item[Item 2] yyy
822 \item[Description Postamble] The End
823 \end{udescription}
824 \end{document}
825 \finish{example}
826
827 %%+
828 \newtwooptenviron*{udescription}[3][\hspace{1cm}]
829 {\begin{list}{}{\renewdef*\makelabel##1{\sffamily ##1:\hfil}%
830 \settowidth\labelwidth{\makelabel{#1}}%
831 \dimensionexpr!\leftmargin{\labelwidth+\labelsep+#3}}%
832 \item[Preamble] #2%
833 }{\end{list}%
834 }
835 \printexample
836 \begin{udescription}[Bertrand Russell (1872--1970)]{\ttcl{red}{Beginning of quotations}}(1mm)
837 \item[John Ruskin (1819--1900)]Whereas it has long being known and declared that the poor have no right to the property of the rich, I wish it also to be known and declared that the rich have no right to the property of the poor.
838 \item[Bertrand Russell (1872--1970)]The megalomaniac differs from the narcissist by the fact that he wishes to be powerful rather than charming, and seeks to be feared rather than loved. To this type belong many lunatics and most of the great men of history.
839 \item[Postamble] \ttcl{magenta}{End of quotations}
840 \end{udescription}%
841 \endprintexample
842 %%-
843
844 \start{example}[\renewkeycmd]
845 \def\firstmacro{}
846 |makered(\renewkeycmd*)\firstmacro<skv@>|(name=Steve,
847 module=Martian logic,pass=true|)[2][\@ptsize]{%
848 \edef\x{\skv@name}%
849 \wlog{\if0#1 10pt\else\if1#1 11pt\else
850 \if2#1 12pt\fi\fi\fi\space font used}%
851 \def\y{#2}%
852 }
853
854 \firstmacro[0]{aaa}|(name=John,module=Philosophy,pass=false|)
855 \finish{example}
856
857 \start{example}[\newtwooptcmd]
858 |makered(\newtwooptcmd*)\macro[3][xxx]{\def\x{#1}\def\y{#2}\def\z{#3}}
859 \macro[uuu]{vvv}|(www|)
860 \macro{vvv}|(www|)
861 \macro{vvv}
862 \finish{example}
863
864 \start{example}[\newtwooptcmd]
865 \undefcs\macro
866 |makered(\newtwooptcmd*)\macro[2][xxx]{\def\x{#1}\def\y{#2}}
867 \macro[uuu]|(vvv|)
868 \macro|(vvv|)
869 \finish{example}
870
871 \start{example}[\renewtwooptcmd]
872 |makered(\renewtwooptcmd)\macro[2][xxx]{\def\x{#1}\long\def\y{#2}}
873 \macro[uuu]|(\par|)
874 \macro|(\par|)
875 \finish{example}
876
877 \start{example}[\newkeycmd]
878 \let\ttcl\textcolor
879 |makered(\newkeycmd*)\firstrule|(raise=.5ex,width=1em,thick=2pt,
880 proclaim=false|)[1]{%
881 \ttcl{blue}{\rule[\fir@raise]{\fir@width}{\fir@thick}}%
882 #1%
883 \ttcl{cyan}{\rule[\fir@raise]{\fir@width}{\fir@thick}}%
884 \iffir@proclaim \color{red}\fi\textdaggerdbl
885 }
886
887 \usepackage[left=2cm,right=2cm]{geometry}
888 \begin{document}
889 \parindent\z@
890 \begin{tabular*}\textwidth{lr}
891 \verb+\firstrule{Hello World}|(width=2em,thick=4pt,
892 proclaim|)+:|ampersand
893 \firstrule{Hello World}|(width=2em,thick=4pt|)\cr
894 \verb+\firstrule{Hello}|(width=2em,thick=.5pt,
895 proclaim=true|)+:|ampersand
896 \firstrule{Hello}|(width=2em,thick=.5pt,proclaim=true|)\cr
897 \verb+\firstrule{Hello World}|(thick=2pt,
898 proclaim=true|)+:|ampersand
899 \firstrule{Hello World}|(thick=2pt,proclaim=true|)\cr
900 \verb+\firstrule{Hello World}|(raise=1ex,width=2em,
901 thick=1pt|)+:|ampersand
902 \firstrule{Hello}|(raise=1ex,width=2em,thick=1pt|)
903 \end{tabular*}
904 \end{document}
905 \finish{example}
906
907 %%+
908 \let\ttcl\textcolor
909 \newkeycmd*\firstrule(raise=.5ex,width=1em,thick=2pt,
910 proclaim=false)[1]{%
911 \ttcl{blue}{\rule[\fir@raise]{\fir@width}{\fir@thick}}%
912 #1%
913 \ttcl{cyan}{\rule[\fir@raise]{\fir@width}{\fir@thick}}%
914 \iffir@proclaim \color{red}\fi\textdaggerdbl
915 }
916 \printexample
917 \parindent7pt
918 \begin{tabular*}\hsize{lr}%
919 \fx*{\firstrule{Hello World}(width=2em,thick=4pt,proclaim)}:&
920 \firstrule{Hello World}(width=2em,thick=4pt)\cr
921 \fx*{\firstrule{Hello}(width=2em,thick=.5pt,proclaim=true)}:&
922 \firstrule{Hello}(width=2em,thick=.5pt,proclaim=true)\cr
923 \fx*{\firstrule{Hello World}(thick=2pt,proclaim=true)}:&
924 \firstrule{Hello World}(thick=2pt,proclaim=true)\cr
925 \fx*{\firstrule{Hello World}(raise=1ex,width=2em,thick=1pt)}:&
926 \firstrule{Hello}(raise=1ex,width=2em,thick=1pt)%
927 \end{tabular*}%
928 \endprintexample
929 %%-
930
931 \start{example}[\newkeycmd]
932 \let\ttcl\textcolor
933 |R(\newkeycmd)\secondrule<mp@>|(raise=.5ex,width=1em,thick=2pt,
934 proclaim=false|)[2][\ttcl{magenta}{$\star$}]{%
935 \ttcl{cyan}{\rule[\mp@raise]{\mp@width}{\mp@thick}}%
936 #1#2#1%
937 \ttcl{blue}{\rule[\mp@raise]{\mp@width}{\mp@thick}}%
938 \ifmp@proclaim \color{red}\fi\textdaggerdbl
939 }
940 \usepackage[left=2cm,right=2cm]{geometry}
941 \begin{document}
942 \parindent\z@
943 \begin{tabular*}\textwidth{lr}
944 \verb+\secondrule[\textbullet]{Hello World}|(width=2em,
945 thick=4pt,proclaim|)+:|ampersand
946 \secondrule[\textbullet]{Hello World}|(width=2em,
947 thick=4pt|)\cr
948 \verb+\secondrule{Hello}|(width=2em,thick=.5pt,
949 proclaim=true|)+:|ampersand
950 \secondrule{Hello}|(width=2em,thick=.5pt,proclaim=true|)\cr
951 \verb+\secondrule{Hello World}|(thick=2pt,
952 proclaim=true|)+:|ampersand
953 \secondrule{Hello World}|(thick=2pt,proclaim=true|)\cr
954 \verb+\secondrule{Hello World}|(raise=1ex,width=2em,
955 thick=1pt|)+:|ampersand
956 \secondrule{Hello}|(raise=1ex,width=2em,thick=1pt|)
957 \end{tabular*}
958 \end{document}
959 \finish{example}
960
961 %%+
962 \newkeycmd\secondrule<mpii@>(raise=.5ex,width=1em,thick=2pt,
963 proclaim=false)[2][\ttcl{magenta}{$\star$}]{%
964 \ttcl{cyan}{\rule[\mpii@raise]{\mpii@width}{\mpii@thick}}%
965 \textcolor{red}{#1}#2\textcolor{red}{#1}%
966 \ttcl{blue}{\rule[\mpii@raise]{\mpii@width}{\mpii@thick}}%
967 \ifmpii@proclaim \color{red}\fi\textdaggerdbl
968 }
969 \printexample
970 \parindent8pt
971 \footnotesize
972 \begin{tabular*}\hsize{lr}%
973 \fx*{\secondrule[\textbullet]{Hello World}(width=2em,thick=4pt,proclaim)}:&
974 \secondrule[\textbullet]{Hello World}(width=2em,thick=4pt)\cr
975 \fx*{\secondrule{Hello}(width=2em,thick=.5pt,proclaim=true)}:&
976 \secondrule{Hello}(width=2em,thick=.5pt,proclaim=true)\cr
977 \fx*{\secondrule{Hello World}(thick=2pt,proclaim=true)}:&
978 \secondrule{Hello World}(thick=2pt,proclaim=true)\cr
979 \fx*{\secondrule{Hello World}(raise=1ex,width=2em,thick=1pt)}:&
980 \secondrule[\textbullet]{Hello}(raise=1ex,width=2em,thick=1pt)%
981 \end{tabular*}%
982 \endprintexample
983 %%-
984
985 \docsection(sec:version-hist){Version history}
986
987 The numbers on the right-hand side of the following lists are section numbers; the \stsign means the subject features in the package but is not reflected anywhere in this user guide.
988
989 \begin{versionhist}
990 \begin{version}{0.4}{2011/10/22}
991 \item Changed the key processing module from the \pkg'{skeyval} to the \pkg'{ltxkeys}. \vsecref*
992 \item Improved the definition of \fx{\skceveryeoe} \vsecref{sec:env-final-tokens}
993 \end{version}
994
995 \begin{version}{0.3}{2010/05/21}
996 \item Introduced \fx{\skceveryeoe} \vsecref{sec:env-final-tokens}
997 \end{version}
998
999 \begin{version}{0.2}{2010/05/20}
1000 \item Addressed the case of \fx{\newkeycmd} without parameters \vsecref*
1001 \end{version}
1002
1003 \begin{version}{0.1}{2010/05/05}
1004 \item First public release \vsecref*
1005 \end{version}
1006
1007 \end{versionhist}
1008
1009 \newpage
1010 \printindex
1011
1012 \end{document}
1013