Debian Codegraph @

texmf-dist/doc/latex/cnltx/cnltx_en.tex

raw
1 % arara: pdflatex: { shell: on }
2 % arara: pdflatex
3 % arara: biber
4 % arara: pdflatex
5 % arara: pdflatex
6 % --------------------------------------------------------------------------
7 % the CNLTX bundle
8 %
9 % LaTeX source code and output
10 %
11 % --------------------------------------------------------------------------
12 % Clemens Niederberger
13 % Web: https://github.com/cgnieder/cnltx/
14 % E-Mail: [email protected]
15 % --------------------------------------------------------------------------
16 % Copyright 2013--2019 Clemens Niederberger
17 %
18 % This work may be distributed and/or modified under the
19 % conditions of the LaTeX Project Public License, either version 1.3
20 % of this license or (at your option) any later version.
21 % The latest version of this license is in
22 % http://www.latex-project.org/lppl.txt
23 % and version 1.3 or later is part of all distributions of LaTeX
24 % version 2005/12/01 or later.
25 %
26 % This work has the LPPL maintenance status `maintained'.
27 %
28 % The Current Maintainer of this work is Clemens Niederberger.
29 % --------------------------------------------------------------------------
30 % If you have any ideas, questions, suggestions or bugs to report, please
31 % feel free to contact me.
32 % --------------------------------------------------------------------------
33 \PassOptionsToPackage{ngerman,english}{babel}
34 \documentclass[load-preamble+]{cnltx-doc}
35 \usepackage[utf8]{inputenc}
36
37 \usepackage{varioref}
38 \usepackage{amsmath}
39 \usepackage{array,booktabs}
40 \usepackage{tikz}
41 \usetikzlibrary{chains}
42
43 \setcnltx{
44 name = cnltx ,
45 title = the cnltx bundle ,
46 version = \csname cnltx@@version\endcsname ,
47 date = \csname cnltx@@date\endcsname ,
48 subtitle = Documentation for \LaTeXe\ Packages or Classes ,
49 info = \LaTeX\ tools and documenting facilities the
50 \texorpdfstring{\textsc{cn}}{CN} way ,
51 authors = Clemens Niederberger ,
52 email = [email protected] ,
53 url = https://github.com/cgnieder/cnltx ,
54 abstract = {%
55 A versatile bundle of packages and classes for consistent formatting of
56 control sequences, package options, source code examples, and writing a
57 package manual (including an index containing the explained control
58 sequences, options, \ldots).\par
59 The bundle also provides several other small ideas of mine such as a
60 mechansim for providing abbreviations \etc. Not at least it provides a
61 number of programming tools.%
62 } ,
63 index-setup = { othercode=\footnotesize,level=\section},
64 add-cmds = {
65 % internal macros:
66 cnltx@babel@options,
67 cnltx@bibtex@listings@style,
68 cnltx@caption@font, cnltx@captionlabel@font,
69 cnltx@define@colorscheme,
70 cnltx@gobble,
71 cnltx@ifcounter,
72 cnltx@ifisnum,
73 cnltx@ifpunctuation,
74 cnltx@ifsym,
75 cnltx@listings@style, cnltx@load@module, cnltx@load@modules,
76 cnltx@make@active, cnltx@make@letter, cnltx@make@other,
77 cnltx@makeindex@listings@style,
78 cnltx@mdframed@options,
79 cnltx@restore@catcode, cnltx@restore@catcodes,
80 cnltx@save@catcode, cnltx@save@catcodes,
81 cnltx@set@catcode, cnltx@set@catcodes,
82 cnltx@scrartcl@options,
83 cnltx@trailpunct,
84 cnltx@treat@lst@index,
85 % official macros:
86 AD, AM, BC,
87 changedversion, cls, cnltxacronym, cnltxat, cnltxbang, cnltxequal, code,
88 codefont, command, cs, csidx, ctan, CTAN, CTANurl,
89 darg, DeclareCounterRepresentation, Default, default, definecolorscheme,
90 dsh,
91 eg, env, envidx, environment, expandable,
92 iftest, indexcs, inputexample, inputsidebyside, inputsourcecode,
93 key, keybool, keychoice, keyval,
94 lppl, LPPL,
95 marg, Marg, module, Module,
96 name, newabbr, newarg, newcounterrepresentation, newname, newnote,
97 newpackagename, newinputsourcefilecmd, newsourcecodeenv,
98 oarg, opt, option,
99 PM, pkg, providecounterrepresentation,
100 renewcounterrepresentation,
101 sarg, setcnltx, sinceversion, sourceformat,
102 unexpandable, usf, usw,
103 vgl, Vgl,
104 zB, ZB
105 },
106 add-silent-cmds = {
107 @foo,
108 ab,AB, at,
109 carlisle, cd, chead, circled,circlenumber, cnltx,
110 foo, foothree,
111 GetTranslation,
112 href,
113 KOMAoptions,
114 lipsum,
115 minusone,multoffourrm,
116 nohyperpage,
117 pdf@shellescape,
118 superiors@spaced,
119 textsu,
120 twodigits
121 } ,
122 add-envs = {
123 commands,
124 environments,
125 example,
126 options,
127 sidebyside,sourcecode
128 },
129 add-frame-options = {
130 innerleftmargin=2em
131 }
132 }
133
134 \usepackage{csquotes}
135 \defbibheading{bibliography}[\bibname]{\section{#1}}
136
137 \makeatletter
138 \newcommand*\cnltxhyphen{\texorpdfstring{\cnltx@hyphen}{-}}
139 \newrobustcmd*\cnltx@hyphen{\penalty\@M-\hskip\z@skip}
140 \makeatother
141
142 \newpackagename\cnltxbase{cnltx\cnltxhyphen base}
143 \newpackagename\cnltxcsnames{cnltx\cnltxhyphen csnames}
144 \newpackagename\cnltxdoc{cnltx\cnltxhyphen doc}
145 \newpackagename\cnltxexample{cnltx\cnltxhyphen example}
146 \newpackagename\cnltxlistings{cnltx\cnltxhyphen listings}
147 \newpackagename\cnltxtools{cnltx\cnltxhyphen tools}
148 \newpackagename\cnltxtranslations{cnltx\cnltxhyphen translations}
149
150 \newnote*\bypackage[1]{provided by \csname cnltx#1\endcsname}
151 \newnote*\byclass{provided by \cnltxdoc}
152
153 \newname\oberdiek{Heiko Oberdiek}
154 \newname\egreg{Enrico Gregorio}
155 \newname\heinz{Carsten Heinz}
156 \newname\moses{Brooks Moses}
157 \newname\hoffmann{Jobst Hoffmann}
158 \newname\daniel{Marco Daniel}
159
160 \usepackage{fixfoot}
161 \DeclareFixedFootnote\oberdiekfn{\CTANurl{oberdiek}}
162
163 \newcommand*\file[1]{\code{#1}}
164 \newidxcmd\prg{\code{#1}}[ (program)]
165 \newcommand*\latin[1]{\cnltxlatin{#1}}
166
167 \newcommand*\PDF{\cnltxacronym{PDF}{pdf}}
168
169 \newenvironment{colors}
170 {%
171 \def\colour##1{\item[]\code{\textcolor{##1}{##1}}\hfill\newline}%
172 \cnltxlist
173 }
174 {\endcnltxlist}
175
176 \def\at{\cnltxat}
177 \def\bang{\cnltxbang}
178 \def\equal{\cnltxequal}
179
180 \newcommand*\BibTeX{\texorpdfstring{\hologo{BibTeX}}{BibTeX}}
181
182 \begin{document}
183
184 \part{About The Bundle}
185
186 \section{Background}
187
188 The \cnltx\ bundle contains different packages and classes\footnote{Well,
189 \emph{one} class for the time being,}. I developed it as a successor of my
190 class \cls{cnpkgdoc}~\cite{cls:cnpkgdoc} that I used until now for writing the
191 documentation of my packages. The intention behind the new bundle is a
192 cleaner interface and less unnecessary ballast, hence the separation into
193 packages and classes. This is actually a bit of a contradiction: the document
194 class \cnltxdoc\ loads \emph{all} packages of the bundle which makes it more
195 feature-rich than \cls{cnpkgdoc} ever used to be. The bundle provides source
196 code environments that also print the output and defines quite a lot of macros
197 for formatting of control sequence names, package names, package options and
198 so on.
199
200 Part of the motivation is also that users have asked me how I created the
201 manuals for my packages. Now I can refer to this bundle.
202
203 Another reason for the splitting into separate packages is -- besides the
204 advantage of easier maintenance -- is that I wanted to add programming tools
205 that I often use into \cnltxbase\ which may allow me (and others) to use them
206 for other packages, too, without having to define them each time. So it is
207 quite likely that \cnltxbase\ will get extended in the future.
208
209 The bundle provides \pkg{listings} style for \LaTeX\ code, bibliography
210 database files and index style files. It provides a \pkg{biblatex} citation
211 and bibliography style closely linked to \cnltxdoc. It provides a
212 bibliography database file containing many \LaTeX\ packages. It
213 provides\ldots\ Let's stop here. You see that the bundle provides a lot of
214 different features which explains why this manual is more than 60~pages long.
215
216 The most detailed documentation for the bundle is as always the source code of
217 the \file{sty} and \file{cls} files but I'm trying to provide a documentation
218 as comprehensive as possible. Reading the source files may show how things
219 are implemented but the intended use only becomes clear when you read this
220 manual.
221
222 The bundle reflects the fact that I haven't started using literate
223 programming, yet. I don't use \code{docstrip} and don't write \file{dtx}
224 files but always write the \file{sty} or \code{cls} files directly. I write
225 the manual always at the same time but as a separate file. While I'm entirely
226 aware of the advantages of literate programming I never could bring myself to
227 start to use it myself. As a consequence I have no idea if this bundle can be
228 used for it or not.
229
230 Source code formatting is done with the help of the powerful
231 \pkg{listings} package~\cite{pkg:listings} by \heinz\ and later \moses, now
232 maintained by \hoffmann. The only real drawback I have found with it is
233 recognizing starred und un-starred versions of an environment as different
234 keywords. This does not seem to be possible which is why indexing of such
235 environments will lead to wrong page numbers.
236
237 The fancy frames of the source code examples are realized with the
238 \pkg{mdframed} package by \daniel~\cite{pkg:mdframed}, loaded with the option
239 \keyis*-{framemethod}{tikz}.
240
241 Besides all this I included some other ideas of mine in this bundle which are
242 all provided by \cnltxtools. This includes a mechansim for defining clever
243 abbreviations or macros that make it easy to index names the same way
244 \pkg{biblatex} does.
245
246
247 \section{Bundled Packages, Classes and Files}
248
249 The \cnltx\ bundle currently bundles the following packages, classes and
250 files:
251 \begin{itemize}
252 \item \sinceversion{0.9}\cnltx\ -- a wrapper package for usage in documents.
253 It loads one or more of the following packages. See
254 section~\ref{sec:usage-bundle} for details on the usage. \\
255 \verbcode+\usepackage{cnltx}+
256 \item \cnltxbase\ -- a package that defines base macros for error-messaging,
257 expansion control, tokenlist manipulation and defining of expandable
258 macros. It also provides color definitions and defines a few color
259 schemes for the \cnltxdoc\ class. All other packages and classes of the
260 \cnltx\ bundle load this package. This package can be used
261 stand-alone. \\
262 \verbcode+\usepackage{cnltx-base}+\\
263 The packages commands are not described in the main part of this
264 documentation but only in section~\ref{sec:defined-cnltxbase}, \ie, in the
265 appendix.
266 \item \cnltxdoc\ -- a class for writing package manuals. Loads
267 \cnltxexample\ and \cnltxtools\ and implicitly all other files of the
268 bundle. \\
269 \verbcode+\documentclass{cnltx-doc}+
270 \item \cnltxexample\ -- a package that defines macros and environments for
271 describing control sequences and options and for including source code.
272 Loads \cnltxlistings. This package can be used stand-alone. \\
273 \verbcode+\usepackage{cnltx-example}+
274 \item \sinceversion{0.4}\cnltxlistings\ -- a package that defines the
275 listings language `BibTeX'. Also defines a list of highlighted control
276 sequence names and environment names, loaded by \cnltxexample. The
277 additional control sequence and environment names used to be defined in
278 \cnltxcsnames. That package got removed and its contents are now provided
279 by \cnltxlistings. This package can be used stand-alone. \\
280 \verbcode+\usepackage{cnltx-listings}+
281 \item \sinceversion{0.2}\cnltxtools\ -- a package that defines tools used by
282 \cnltxdoc\ that are unrelated to \LaTeX\ documentation \latin{per se}.
283 This package can be used stand-alone. \\
284 \verbcode+\usepackage{cnltx-tools}+
285 \item \sinceversion{0.11}\cnltxtranslations\ -- a package that provides
286 translations needed by the other modules. It makes no sense to use this
287 package standalone although it's possible.
288 \item \file{cnltx.ist} -- an index style file that is used when the option
289 \option{add-index} for \cnltxdoc\ is activated and the option
290 \option{index-style} is not used.
291 \item \sinceversion{0.4}\file{cnltx.bib} -- a bibliography file that
292 contains a small but growing number of package entries, see
293 section~\ref{sec:list-entr-bib}. Used by \cnltxdoc\ when the
294 \option{add-bib} is used.
295 \item \sinceversion{0.4}\file{cnltx.bbx}, \file{cnltx.cbx} and
296 \file{cnltx.dbx} -- files related to the \pkg{biblatex} style
297 \code{cnltx}. The \pkg{biblatex} style defined in those files is used
298 when the \option{add-bib} for \cnltxdoc\ is used.
299 \end{itemize}
300
301 \section{License and Requirements}\label{sec:license}
302 \license
303
304 The \cnltxbase\ package loads the following packages:
305 \needpackage{pgfopts}~\cite{pkg:pgfopts},
306 \needpackage{etoolbox}~\cite{pkg:etoolbox},
307 \pkg{ltxcmds}\oberdiekfn~\cite{pkg:ltxcmds},
308 \pkg{pdftexcmds}\oberdiekfn~\cite{pkg:pdftexcmds},
309 \needpackage{trimspaces}~\cite{pkg:trimspaces} and
310 \needpackage{xcolor}~\cite{pkg:xcolor}.
311
312 The \cnltxdoc\ class loads the packages \cnltxbase, \cnltxexample,
313 \cnltxtranslations, \needpackage{ulem}~\cite{pkg:ulem},
314 \needpackage[macros/latex/required/tools]{multicol}~\cite{pkg:multicol},
315 \needpackage[macros/latex/contrib/ms]{ragged2e}~\cite{pkg:ragged2e},
316 \needpackage{marginnote}~\cite{pkg:marginnote} and
317 \needpackage{hyperref}~\cite{pkg:hyperref}. It is a wrapper class for the
318 \KOMAScript\ class
319 \cls{scrartcl}\footnote{\CTANurl{koma-script}}~\cite{bnd:koma-script}. The
320 class has the option \option{load-preamble} which when used will load
321 additional packages, see section~\vref{sec:preamble} for details.
322
323 The \cnltxexample\ package loads the packages: \cnltxbase, \cnltxlistings,
324 \cnltxtools, \cnltxtranslations, \needpackage{mdframed}~\cite{pkg:mdframed},
325 \needpackage{textcomp}~\cite{pkg:textcomp},
326 \needpackage{idxcmds}~\cite{pkg:idxcmds},
327 \needpackage{ifxetex}~\cite{pkg:ifxetex},
328 \needpackage{adjustbox}~\cite{pkg:adjustbox}.
329
330 The \cnltxlistings\ package loads the packages \cnltxbase,
331 \needpackage{listings}~\cite{pkg:listings} and
332 \needpackage{catchfile}~\cite{pkg:catchfile}.
333
334 The \cnltxtools\ package loads the packages \cnltxbase, \cnltxtranslations and
335 \pkg{accsupp}\oberdiekfn~\cite{pkg:accsupp}.
336
337 \cnltxtranslations\ loads the \pkg{translations}
338 package~\cite{pkg:translations}.
339
340 All other packages that are loaded are loaded by the mentioned packages and
341 not directly by any of the packages or classes of the \cnltx\ bundle. Like
342 all of my packages \cnltx\ implicitly relies on an up to date \TeX\
343 distribution.
344
345 \section{Usage of the Bundle}\label{sec:usage-bundle}
346 The intended use of this bundle is three-fold:
347 \begin{itemize}
348 \item The main use-case is documenting my own \LaTeX\ packages. This is
349 done with
350 \begin{sourcecode}[gobble=6]
351 \documentclass{cnltx-doc}
352 \end{sourcecode}
353 and actually loads most if not all of the bundle.
354 \item The module \cnltxbase\ is also intended as a programming tools package
355 that will be used in other packages eventually. For example it is used by
356 the \pkg{cntformats} package.
357 \item In case parts of this bundle prove useful to be used in a document the
358 recommended way is to add
359 \begin{sourcecode}[gobble=6]
360 \usepackage{cnltx}
361 \end{sourcecode}
362 to the preamble which will load the \cnltxbase\ module. Other needed
363 modules can be given as package option by using the name part after the
364 dash as option.
365 \begin{sourcecode}[gobble=6]
366 \usepackage[example]{cnltx}
367 \end{sourcecode}
368 would load \cnltxexample.
369 \item Parts of the bundle -- especially \cnltxbase\ -- may prove useful in
370 other packages. The loading the packages directly as indicated in
371 section~\ref{sec:license} seems the best way. After loading \cnltxbase\
372 the other modules can also be loaded with \verbcode+\cnltx@load@module+,
373 see section~\ref{sec:related-bundle} for details.
374 \end{itemize}
375
376 \part{Details of Available Commands, Environments and Options}
377
378 \section{Options and Setup}
379 The \cnltx\ bundle has a large number of options. The \cnltxdoc\ class only
380 knows a few options (described in section~\vref{sec:class:options}) as
381 \emph{class} options, though. All other options regardless if they're defined
382 by a package or a class can and should be set with the setup command:
383 \begin{commands}
384 \command{setcnltx}[\marg{options}]
385 Setup command for the \cnltx\ bundle. This command is provided by
386 \cnltxbase.
387 \end{commands}
388 The source code environments defined by the \cnltxexample\ package also have
389 optional arguments that can be used to set the options for the environment
390 locally.
391
392 \section{Available Commands}
393 \subsection{Description of Macros, Environments and Options}\label{sec:cmds:macros}
394
395 The commands described in this section all are provided by the \cnltxexample\
396 package\bypackage{example}. They all are related to the typesetting of
397 provided macros, options and the like.
398
399 \begin{commands}
400 \command{code}[\marg{arg}]
401 Formatting of source code. This is \emph{no} verbatim command. Used
402 internally in the following commands.
403 \command{verbcode}[\meta{char}\meta{code}\meta{char}]
404 \sinceversion{0.2}A verbatim command that uses the same formatting as the
405 source code example environments, \cf\ section~\ref{sec:usage:examples}.
406 This is a wrapper for \cs*{lstinline} which loads the corresponding
407 style.
408 \command{cs}[\sarg\marg{name}]
409 Format the control sequence \meta{name}, \cs{cs}\Marg{name}:
410 \cs*{name}. Adds a corresponding index entry. The starred form does not
411 add an index entry.
412 \command{csidx}[\marg{name}]
413 Adds an index entry but does not typeset the control sequence
414 \meta{name}.
415 \command{env}[\sarg\marg{name}]
416 Format the environment \meta{name}, \cs{env}\Marg{name}:
417 \env*{name}. Adds a corresponding index entry with a hint that the entry
418 refers to an environment. The starred form does not add an index entry.
419 \command{envidx}[\marg{name}]
420 Adds an index entry but does not typeset the environment \meta{name}.
421 \command{meta}[\marg{meta}]
422 Description of an argument, \cs{meta}\Marg{meta}: \meta{meta}.
423 \command{marg}[\marg{arg}]
424 A mandatory argument. \meta{arg} is formatted with \cs{meta} if it is not
425 blank, \cs{marg}\Marg{arg}: \marg{arg}.
426 \command{Marg}[\marg{arg}]
427 \sinceversion{0.2}A mandatory argument. \meta{arg} is formatted with
428 \cs{code} if it is not blank, \cs{Marg}\Marg{arg}: \Marg{arg}.
429 \command{oarg}[\marg{arg}]
430 An optional argument. \meta{arg} is formatted with \cs{meta} if it is not
431 blank, \cs{oarg}\Marg{arg}: \oarg{arg}.
432 \command{Oarg}[\marg{arg}]
433 \sinceversion{0.2}An optional argument. \meta{arg} is formatted with
434 \cs{code} if it is not blank, \cs{Oarg}\Marg{arg}: \Oarg{arg}.
435 \command{darg}[\marg{arg}]
436 An argument with parentheses as delimiters. \meta{arg} is formatted with
437 \cs{meta} if it is not blank, \cs{darg}\Marg{arg}: \darg{arg}.
438 \command{Darg}[\marg{arg}]
439 \sinceversion{0.2}An argument with parentheses as delimiters. \meta{arg}
440 is formatted with \cs{code} if it is not blank, \cs{Darg}\Marg{arg}:
441 \Darg{arg}.
442 \command{sarg}
443 An optional star argument, \cs{sarg}: \sarg.
444 \command{newarg}[\oarg{arg formatting}\marg{cs}\marg{left delim}\marg{right delim}]%
445 \Default{\cs{meta}}
446 \changedversion{0.2}Command used to define the argument commands:
447 \verbcode+\newarg\marg{\{}{\}}+. The optional argument determines how the
448 argument of the new command will be formatted. This is done with
449 \cs{meta} per default. \cs{Marg} is defined
450 \verbcode+\newarg[\code]\Marg{\{}{\}}+.
451 \command{option}[\sarg\marg{name}]
452 An option \meta{name}, \cs{option}\Marg{name}: \option{name}. Adds a
453 corresponding index entry. The starred form does not add an index entry.
454 \command{optionidx}[\marg{name}]
455 Adds an index entry but does not typeset the option \meta{name}.
456 \command{module}[\sarg\marg{name}]
457 A module \meta{name}, \cs{module}\Marg{name}: \module{name}. Adds a
458 corresponding index entry. The starred form does not add an index entry.
459 In some of my packages I like to organize options by grouping them in
460 different classes that I call ``modules''. This command refers to those
461 modules.
462 \command{moduleidx}[\sarg\marg{name}]
463 Adds an index entry but does not typeset the option \meta{name}.
464 \command{key}[\sarg\code{-}\marg{name}\marg{value}]
465 A key \meta{name} with value \meta{value}, the optional star prevents an
466 index entry, the optional \code{-} strips the braces around \meta{value};
467 \cs{key}\Marg{key}\Marg{value}: \key{key}{value};
468 \cs{key}\code{-}\Marg{key}\Marg{value}: \key-{key}{value}
469 \command{keyis}[\sarg\code{-}\marg{name}\marg{value}]
470 \sinceversion{0.2}A key \meta{name} set to value \meta{value}, the
471 optional star prevents an index entry, the optional \code{-} strips the
472 braces around \code{value}; \cs{key}\Marg{keyis}\Marg{value}:
473 \keyis{key}{value}.
474 \command{choices}[\marg{clist of choices}]
475 A list of choices, \cs{choices}\Marg{one,two,three}:
476 \choices{one,two,three}
477 \command{choicekey}[\marg{name}\marg{clist of choices}]
478 A key \meta{name} with a list of possible values,
479 \cs{choicekey}\Marg{key}\Marg{one,two,three}:
480 \choicekey{key}{one,two,three}
481 \command{boolkey}[\marg{name}]
482 A boolean key \meta{name} with choices \code{true} and \code{false},
483 \cs{boolkey}\Marg{key}: \boolkey{key}
484 \command{default}[\marg{value}]
485 Markup for a default choice,
486 \cs{choices}\Marg{one,\cs{default}\Marg{two},three}:
487 \choices{one,\default{two},three}
488 \end{commands}
489
490
491 \subsection{Versioning Commands, Licensing and Related Stuff}\label{sec:cmds:versioning}
492
493 The commands described in this section are provided by the \cnltx\
494 class\byclass\ except where indicated differently. These commands are related
495 to information about the legal stuff of a package and where to find it on th
496 world wide web.
497
498 \begin{commands}
499 \command{sinceversion}[\marg{version}]
500 \sinceversion{0.0}Gives a sidenote like the one on the left.
501 \command{changedversion}[\marg{version}]
502 \changedversion{0.0}Gives a sidenote like the one on the left.
503 \command{newnote}[\sarg\marg{cs}\oarg{num}\oarg{optional}\marg{definition}]
504 Defines a note like \cs{sinceversion}. The syntax of the command is the
505 same as the one of \cs*{newcommand}. \cs{sinceversion} was defined as
506 follows:\\
507 \verbcode+\newnote*\sinceversion[1]{Introduced in version~#1}+\\
508 or actually like this:\\
509 \verbcode+\newnote*\sinceversion[1]{\GetTranslation{cnltx-introduced}~#1}+
510 \command{newpackagename}[\marg{cs}\marg{name}]
511 Define a comand \meta{cs} that prints \meta{name} formatted like \cnltx,
512 \ie\ in small caps and colored with the color \code{cnltx} (see
513 section~\ref{sec:actual-used-color}).
514 \command{lppl}
515 Typesets ``\lppl'' and adds a corresponding index entry.
516 \command{LPPL}
517 Typesets ``\LPPL'' and adds the same index entry as \cs{lppl}.
518 \command{license}[\sarg\oarg{maintenance status}]\Default{maintained}
519 \changedversion{0.2}Typesets `\license*'. The un-starred variant adds a
520 \cs*{par}.
521 \command{ctan}
522 Typesets ``\ctan'' and adds a corresponding index entry.
523 \command{CTAN}
524 Typesets ``\CTAN'' and adds the same index entry as \cs{ctan}.
525 \command{pkg}[\sarg\marg{package}]
526 \bypackage{example}Format the package name \meta{package} and add an
527 index entry. The starred variant adds nothing to the index.
528 \command{pkgidx}[\marg{package}]
529 \bypackage{example}Add an index entry for the package \meta{package}.
530 \command{cls}[\sarg\marg{class}]
531 \bypackage{example}Format the class name \meta{class} and add an index
532 entry. The starred variant adds nothing to the index.
533 \command{clsidx}[\marg{class}]
534 \bypackage{example}Add an index entry for the class \meta{class}.
535 \command{CTANurl}[\oarg{directory}\marg{name}]
536 Writes a \ctan\ link like the ones in section~\vref{sec:license} in the
537 footnotes. The predefined directory is \code{macros/latex/contrib}. The
538 link address will be:\par
539 \code{http://mirrors.ctan.org/\meta{directory}/\meta{name}/}.
540 \command{email}[\marg{email address}]
541 \sinceversion{0.11}A wrapper for \verbcode+\href{mailto:#1}{#1}+.
542 \command{website}[\marg{web address}]
543 \sinceversion{0.11}A wrapper for \verbcode+\href{http://#1/}{#1}+.
544 \command{securewebsite}[\marg{web address}]
545 \sinceversion{0.11}A wrapper for \verbcode+\href{https://#1/}{#1}+.
546 \command{needpackage}[\oarg{directory}\marg{name}]
547 \sinceversion{0.2}A wrapper for
548 \verbcode+\pkg{#2}\footnote{\CTANurl[#1]{#2}}+
549 \command{needclass}[\oarg{directory}\marg{name}]
550 \sinceversion{0.2}A wrapper for
551 \verbcode+\cls{#2}\footnote{\CTANurl[#1]{#2}}+
552 \end{commands}
553
554 \begin{example}
555 \newpackagename{\foothree}{foo-3}%
556 now \foothree\ looks like \cnltx.
557 \end{example}
558
559 \subsection{Input Source Code Files}
560 Similar to the environments described in section~\vref{sec:envs:sourcecode}
561 \cnltxexample\ provides a few commands for inputting source code files,
562 formatting and printing the source code and inputting the file directly.
563 \begin{commands}
564 \command{inputexample}[\oarg{options}\marg{file name}]
565 The equivalent of the \env{example} environment, see
566 section~\vref{sec:envs:sourcecode}.
567 \command{inputsidebyside}[\oarg{options}\marg{file name}]
568 The equivalent of the \env{sidebyside} environment, see
569 section~\vref{sec:envs:sourcecode}.
570 \command{inputsourcecode}[\oarg{options}\marg{file name}]
571 The equivalent of the \env{sourcecode} environment, see
572 section~\vref{sec:envs:sourcecode}.
573 \command{implementation}[\oarg{options}\marg{file name}]
574 \sinceversion{0.5}A wrapper for
575 \verbcode+\lstinputlisting[style=cnltx,#1]{#2}+
576 \end{commands}
577
578 It is possible to define further commands like this:
579 \begin{commands}
580 \command{newinputsourcefilecmd}[\oarg{option}\marg{control sequence}]
581 Defines \meta{control sequence} as a new source code input command where
582 \meta{options} are preset.
583 \end{commands}
584
585 The existing commands have been defined like this:
586 \begin{sourcecode}
587 \newinputsourcefilecmd\inputexample
588 \newinputsourcefilecmd[side-by-side]\inputsidebyside
589 \newinputsourcefilecmd[code-only]\inputsourcecode
590 \end{sourcecode}
591
592 \section{Available Environments}\label{sec:envs}
593 \subsection{Description Environments}\label{sec:envs:description}
594 \cnltxdoc\ defines some description environments used to describe macros,
595 environments or options.
596
597 \begin{environments}
598 \environment{commands}
599 A description-like environment for describing commands. While this
600 environment is a list internally and thus recognizes \cs*{item} own
601 commands are used to describe macros. They are explained in
602 section~\vref{sec:usage:commands}.
603 \environment{options}
604 A description-like environment for describing options. While this
605 environment is a list internally and thus recognizes \cs*{item} own
606 commands are used to describe options. They are explained in
607 section~\vref{sec:usage:options}.
608 \environment{environments}
609 A description-like environment for describing environments. While this
610 environment is a list internally and thus recognizes \cs*{item} own
611 commands are used to describe environments. They are explained in
612 section~\vref{sec:usage:environments}.
613 \end{environments}
614
615 These environments are lists all using the same internal \cs*{list}. The
616 setup of this list can be changed via an option:
617
618 \begin{options}
619 \keyval{list-setup}{definitions}{}
620 \Default{\cs*{leftmargin}=0pt \cs*{labelwidth}=2em \cs*{labelsep}=0pt
621 \cs*{itemindent}=-1em }
622 The setup of the \cs*{list} used by the \env{commands}, \env{options} and
623 \env{environments} environments.
624 \end{options}
625
626 \subsection{Source Code Environments}\label{sec:envs:sourcecode}
627 \cnltxexample\ defines the following environments that are used to display
628 source code and possibly the output of the source code, too.
629
630 \begin{environments}
631 \environment{example}[\oarg{options}]
632 This environment is a formatted verbatim environment that also inputs the
633 output of the inputted code. This environment is described in
634 section~\vref{sec:usage:examples}.
635 \environment{sidebyside}[\oarg{options}]
636 This environment is a formatted verbatim environment that also inputs the
637 output of the inputted code. Source and output are printed side-by-side.
638 This environment is described in section~\vref{sec:usage:examples}.
639 \environment{sourcecode}[\oarg{options}]
640 This environment is a formatted verbatim environment. This environment is
641 described in section~\vref{sec:usage:examples}.
642 \end{environments}
643
644 \sinceversion{0.2}In each of these environments certain hooks are provided
645 that can be used to add definitions you like:
646 \begin{options}
647 \keyval{pre-code}{definitions}
648 \meta{definitions} are placed before the source code is inserted.
649 \keyval{after-code}{definitions}
650 \meta{definitions} are placed after the source code is inserted.
651 \keyval{pre-output}{definitions}
652 \meta{definitions} are placed before the output of the source code is
653 inserted.
654 \keyval{after-output}{definitions}
655 \meta{definitions} are placed after the output of the source code is
656 inserted.
657 \end{options}
658
659 It is possible to define further environments like this:
660 \begin{commands}
661 \command{newsourcecodeenv}[\oarg{option}\marg{name}]
662 Defines \meta{name} as a new source code environment where
663 \meta{options} are preset.
664 \end{commands}
665
666 The existing environments have been defined like this:
667 \begin{sourcecode}
668 \newsourcecodeenv{example}
669 \newsourcecodeenv[side-by-side]{sidebyside}
670 \newsourcecodeenv[code-only]{sourcecode}
671 \end{sourcecode}
672
673 \section{Usage of the Various Functions}
674 \subsection{Command Descriptions}\label{sec:usage:commands}
675 Inside of the environment \env{commands} that was introduced in
676 section~\vref{sec:envs:description} items are input via the following command:
677 \begin{commands}
678 \command{command}[\sarg\marg{name}\oarg{stuff after}]
679 This macro formats a control sequence with \cs{cs} and puts a line break
680 after it. The optional argument allows printing things directly after the
681 command name and can thus be used for adding arguments. The star prevents
682 the creation of an index entry.
683 \command{Default}[\sarg\code{!}\marg{code}]
684 \changedversion{0.3}This command can be placed after \cs{command} or
685 \cs{opt} in order to give a default definition of a macro or a default
686 value of an option. The definition will then be placed on the same line
687 flush right. The star prevents the insertion of \cs*{newline} after it.
688 The optional bang adds the information that an option is mandatory, \ie\
689 has to be set.
690 \command{expandable}
691 \sinceversion{0.5}Adds the symbol \expandablesymbol\ to the left of a
692 command in the margin to indicate that the command is expandable. This
693 command should be used \emph{immediately} before \cs{command}.
694 \command{unexpandable}
695 \sinceversion{0.5}Adds the symbol \unexpandablesymbol\ to the left of a
696 command in the margin to indicate that the command is not expandable.
697 This command should be used \emph{immediately} before \cs{command}.
698 \command{expandablesign}\Default{\cs*{textasteriskcentered}}
699 \sinceversion{0.5}The macro that holds the sign used by \cs{expandable}
700 and \cs{unexpandable}.
701 \command{expandablesymbol}
702 \sinceversion{0.11}The symbol \expandablesymbol, \ie, \cs{expandablesign}
703 formatted with the color \code{expandable}.
704 \command{unexpandablesymbol}
705 \sinceversion{0.11}The symbol \unexpandablesymbol, \ie,
706 \cs{expandablesign} formatted with the color \code{unexpandable}.
707 \end{commands}
708
709 \begin{example}
710 \begin{commands}
711 \command{cs}
712 This is about foo bar baz.
713 \command{cs}[\marg{arg}]
714 This one has an argument.
715 \command{cs}[\sarg\oarg{option}]
716 This has a star variant and an optional argument.
717 \command{cs}\Default{foo bar}
718 This one has the default replacement text \code{foo bar}
719 \expandable\command{cs}
720 This macro is expandable.
721 \end{commands}
722 \end{example}
723
724 The \cs{expandablesign} can of course be redefined to something else you like
725 better. For the sake of completeness there is an option that does exactly
726 this:
727 \begin{options}
728 \keyval{expandable-sign}{definition}\Default{\cs*{textasteriskcentered}}
729 \sinceversion{0.5}Redefines \cs{expandablesign} to \meta{definition}.
730 \end{options}
731
732 \subsection{Option Descriptions}\label{sec:usage:options}
733 The \env{options} environment knows a few more commands to meet all the
734 different kinds of options.
735 \begin{commands}
736 \command{opt}[\sarg]
737 An option. The star prevents an index entry.
738 \command{keyval}[\sarg\code{-}\marg{key}\marg{value}]
739 A key/value option. The optional star prevents an index entry. The
740 optional \code{-} strips the braces around \meta{value}, see the example
741 below.
742 \command{keychoice}[\sarg\marg{key}\marg{list of choices}]
743 A key/value option where the value is one of a list of choices. The star
744 prevents an index entry.
745 \command{keybool}[\sarg\marg{name}]
746 A boolean key, that ist a choice key with choices \code{true} and
747 \code{false}. The star prevents an index entry.
748 \command{Default}[\sarg\code{!}\marg{code}]
749 \changedversion{0.3}This command can be placed after \cs{command} or
750 \cs{opt} (or any of the other commands for adding an option to the
751 \env{options} list) in order to give a default definition of a macro or a
752 default value of an option. The definition will then be placed on the
753 same line flush right. The star prevents the insertion of \cs*{newline}
754 after it. The optional bang adds the information that an option is
755 mandatory, \ie, it has to be set.
756 \command{Module}[\sarg\code{!}\marg{name}]
757 \sinceversion{0.3}This command can be placed after \cs{option} but before
758 \cs{Default} in order to determine the module the option belongs to. It
759 will be written in the left margin next to the option name. The star
760 prevents the insertion of \cs*{newline} after it. The optional bang
761 \emph{adds} an index entry for the module. This is somehow inconsistent
762 with many of the other commands where an optional star \emph{prevents} an
763 index entry but it fits to the functionality of \cs{Default} which is why
764 this syntax was chosen.
765 \end{commands}
766
767 The following demonstrates how the commands would be used to create option
768 descriptions:
769 \begin{sourcecode}
770 \begin{options}
771 \opt{foo}
772 This makes stuff. Let's add a few more words so that the line gets
773 filled and we can see how the output actually looks.
774 \opt*{foo}\Default{bar}
775 This makes stuff. Let's add a few more words so that the line gets
776 filled and we can see how the output actually looks.
777 \opt{foo}\Module{bar}
778 This option belongs to \module*{bar}. Let's add a few more words so
779 that the line gets filled and we can see how the output actually
780 looks.
781 \opt{foo}\Module{bar}\Default{baz}
782 This option belongs to \module*{bar}. Let's add a few more words so
783 that the line gets filled and we can see how the output actually
784 looks.
785 \keyval{foo}{bar}\Default
786 This makes stuff. Let's add a few more words so that the line gets
787 filled and we can see how the output actually looks.
788 \keyval{foo}{bar}\Default!
789 This makes stuff. Let's add a few more words so that the line gets
790 filled and we can see how the output actually looks.
791 \keyval*{foo}{bar}
792 This makes stuff. Let's add a few more words so that the line gets
793 filled and we can see how the output actually looks.
794 \keyval-{foo}{bar}
795 This makes stuff. Let's add a few more words so that the line gets
796 filled and we can see how the output actually looks.
797 \keychoice{foo}{one,two,three}
798 This makes stuff. Let's add a few more words so that the line gets
799 filled and we can see how the output actually looks.
800 \keybool{foo}
801 This makes stuff. Let's add a few more words so that the line gets
802 filled and we can see how the output actually looks.
803 \end{options}
804 \end{sourcecode}
805
806 The code above gives the following output:
807 \begin{options}
808 \opt{foo}
809 This makes stuff. Let's add a few more words so that the line gets
810 filled and we can see how the output actually looks.
811 \opt*{foo}\Default{bar}
812 This makes stuff. Let's add a few more words so that the line gets
813 filled and we can see how the output actually looks.
814 \opt{foo}\Module{bar}
815 This option belongs to the module \module{bar}. Let's add a few more
816 words so that the line gets filled and we can see how the output actually
817 looks.
818 \opt{foo}\Module{bar}\Default{baz}
819 This option belongs to the module \module{bar}. Let's add a few more
820 words so that the line gets filled and we can see how the output actually
821 looks.
822 \keyval{foo}{bar}\Default
823 This makes stuff. Let's add a few more words so that the line gets
824 filled and we can see how the output actually looks.
825 \keyval{foo}{bar}\Default!
826 This makes stuff. Let's add a few more words so that the line gets
827 filled and we can see how the output actually looks.
828 \keyval*{foo}{bar}
829 This makes stuff. Let's add a few more words so that the line gets
830 filled and we can see how the output actually looks.
831 \keyval-{foo}{bar}
832 This makes stuff. Let's add a few more words so that the line gets
833 filled and we can see how the output actually looks.
834 \keychoice{foo}{one,two,three}
835 This makes stuff. Let's add a few more words so that the line gets
836 filled and we can see how the output actually looks.
837 \keybool{foo}
838 This makes stuff. Let's add a few more words so that the line gets
839 filled and we can see how the output actually looks.
840 \end{options}
841
842 \subsection{Environment Descriptions}\label{sec:usage:environments}
843 Environment descriptions are made -- unsurprisingly -- with the
844 \env{environments} environment. It knows the command \cs{environment}:
845
846 \begin{commands}
847 \command{environment}[\sarg\marg{name}\oarg{stuff after}]
848 This macro prints the environment name and puts a line break
849 after it. The optional argument allows printing things directly after the
850 environment name and can thus be used for adding arguments.
851 \end{commands}
852
853 \begin{example}
854 \begin{environments}
855 \environment*{foobar}[\oarg{options}]
856 This is environment \env*{foobar}. The star prevents it from being
857 added to the index.
858 \end{environments}
859 \end{example}
860
861 \subsection{Code Examples}\label{sec:usage:examples}
862 Code examples can be included through the \env{example} environment or the
863 \env{sourcecode} environment. The \env{sourcecode} only shows the piece of
864 \LaTeX code while the \env{example} environment also shows the output of the
865 \LaTeX\ code.
866 \begin{sourcecode}
867 \begin{example}
868 a \LaTeX\ code example
869 \end{example}
870 \end{sourcecode}
871 This example would give:
872
873 \begin{example}
874 a \LaTeX\ code example
875 \end{example}
876
877 Both environments can be influenced by options:
878 \begin{options}
879 \keybool{code-only}\Default{false}
880 Only typeset the code as code but don't include it afterwards. The
881 code box above is an example for the usage of this option. This option
882 has no effect on the \env{sourcecode} environment: is is already set for
883 this environment.
884 \keybool{side-by-side}\Default{false}
885 Typeset source and output side by side. The code is input on the left and
886 the output on the right. Side by side examples are typeset in
887 \env*{minipage} environments with all consequences that come with them
888 (think of \cs*{parindent}, page breaks \ldots). Since a \code{minipage}
889 cannot be broken across pages the surrounding \pkg{mdframed} frame gets
890 the option \keyis*-{nobreak}{true}. This option has no effect on the
891 \env{sourcecode} environment.
892 \keybool{code-left}\Default{true}
893 If \code{true} and the option \option{side-by-side} is chosen the source
894 code is printed on the right side else on the left. This option has no
895 effect on the \env{sourcecode} environment.
896 \keyval{code-sep}{definition}\Default{\cs*{hrulefill}}
897 Code that is inserted between a source code and the corresponding output
898 when printed below each other. This option has no effect on the
899 \env{sourcecode} environment.
900 \keybool{outside}\Default{false}
901 \sinceversion{0.10}If \code{true} the output of an example is put outside
902 of the frame in the input stream. This can be useful if the example code
903 contains a floating environment for example.
904 \end{options}
905
906 The same example again, this time using \option{side-by-side} (which is the
907 same as using the \env{sidebyside} environment):
908
909 \begin{example}[side-by-side]
910 a \LaTeX\ code example
911 \end{example}
912
913 \option{side-by-side} and \keyis-{code-left}{false}:
914
915 \begin{example}[side-by-side,code-left=false]
916 a \LaTeX\ code example
917 \end{example}
918
919 The frame around the examples is done by the
920 \pkg{mdframed} package~\cite{pkg:mdframed}. It is of course possible to
921 customize it:
922 \begin{options}
923 \keyval{add-frame-options}{\pkg{mdframed} options}\Default
924 Add options to the predefined settings.
925 \keyval{frame-options}{\pkg{mdframed} options}{}
926 \Default{backgroundcolor=cnltxbg,linecolor=cnltx,roundcorner=5pt}
927 Overwrite the settings with new ones.
928 \keyval{add-local-frame}{\pkg{mdframed} options}
929 \sinceversion{0.10}Add \pkg{mdframed} options to the environment where the
930 option is used only. This is
931 basically \beginenv*\Marg{\env{mdframed}}\Oarg{style=cnltx,\meta{options}}.
932 \keyval{local-frame}{\pkg{mdframed} options}
933 \sinceversion{0.10}replace the default \pkg{mdframed} options to the
934 environment where the option is used only. This is
935 basically \beginenv*\Marg{\env{mdframed}}\oarg{options}.
936 \end{options}
937
938 The source code is formatted using the great \pkg{listings}
939 package~\cite{pkg:listings} by \heinz, \moses, and \hoffmann. Similar options
940 exist to adapt \pkg{listings}' options that are used for formatting the source
941 code. The predefined style has many options that will not be mentioned here.
942 If you're interested you can find them in \file{cnltx-example.sty} or in
943 section~\vref{sec:listings-sourcecode}.
944 \begin{options}
945 \keyval-{gobble}{integer}\Default{2}
946 The number of initial characters that is gobbled from each line.
947 \keyval{add-cmds}{list of csnames}\Default
948 A list of control sequence names that should be recognized as a command
949 sequence in the source code examples and should be formatted accordingly.
950 The control sequence names in this list will also get an index entry when
951 they're used in the source example. This is done internally via
952 \cs{csidx}. The option should be used to add the new commands that are
953 defined by the package for which you are writing the manual for.
954 \keyval{add-silent-cmds}{list of csnames}
955 A list of control sequence names that should be recognized as a command
956 sequence in the source code examples and should be formatted accordingly.
957 The control sequence names in this list will \emph{not} get an index entry
958 when they're used in the source example. There already is quite a large
959 but far from comprehensive list of silent commands but many are still
960 missing. This option allows you to extend the list on a per document
961 basis.
962 \keyval{add-listings-options}{\pkg{listings} options}\Default
963 Additional options for the \pkg{listings}~\cite{pkg:listings}
964 environments. \emph{This redefines the \code{cnltx} \pkg{listings} style
965 which will affect all sourcecode environments!}
966 \keyval{listings-options}{\pkg{listings} options}
967 Overwrite existing options with new ones. This can be used to build an own
968 style from scratch. \emph{This redefines the \code{cnltx} \pkg{listings}
969 style which will affect all sourcecode environments!}
970 \keyval{add-sourcecode-options}{\pkg{listings} options}
971 \sinceversion{0.4}These options are added to the \pkg{listings} options of
972 the source code environments without redefing the main style. Hence it
973 can be used to locally add options to a source code environment. This is
974 basically \cs*{lstset}\Marg{style=cnltx,\meta{options}}.
975 \keyval{sourcecode-options}{\pkg{listings} options}
976 \sinceversion{0.10}These options are added to the \pkg{listings} options
977 of the source code environments without redefing or using the main style.
978 Hence it can be used to locally add options to a source code environment.
979 This is basically \cs*{lstset}\marg{options}.
980 \keyval{add-envs}{list of environment names}\Default
981 Like \option{add-cmds} but for environment names.
982 \keyval{add-silent-envs}{list of environment names}
983 Like \option{add-silent-cmds} but for environment names.
984 \end{options}
985
986 \subsection{Compile Source Examples}\label{sec:comp-source-exampl}
987 \subsubsection{The Compliation Process}\label{sec:compliation-process}
988 When you input an example like
989 \begin{sourcecode}
990 \begin{example}
991 \documentclass{article}
992 \begin{document}
993 foo
994 \end{document}
995 \end{example}
996 \end{sourcecode}
997 you'll get an error since the code is input as is and you'll end up with
998 \cs*{documentclass} after \verbcode=\begin{document}=. There's a way out,
999 though.
1000
1001 \cnltxexample\sinceversion{0.9} provides the possibility to compile the source
1002 code file externally and input the compiled \PDF.
1003
1004 \begin{sourcecode}
1005 \begin{example}[compile]
1006 \documentclass{article}
1007 \begin{document}
1008 foo
1009 \end{document}
1010 \end{example}
1011 \end{sourcecode}
1012
1013 This needs \code{shell-escape} enabled. The default compilation program is
1014 \prg{pdflatex} which will compile the file two times. The process can be
1015 customized with the following options:
1016
1017 \begin{options}
1018 \keybool{compile}\Default{false}
1019 Compile the source code file. Although this option can be set globally it
1020 really shouldn't be! It's best to give this option explicitly to the
1021 source code environment whose body should be compiled. If enabled
1022 globally \emph{all} examples would be compiled and most likely lead to
1023 various errors since most examples won't be complete \LaTeX\ documents.
1024 \keychoice{program}{pdflatex,lualatex,xelatex,arara}\Default{pdflatex}
1025 The program to compile the source file.
1026 \keyval{runs}{number}\Default{2}
1027 The number of compilations.
1028 \keyval{exe-with}{options}\Default
1029 Command line options that can be given to the compilation program chosen
1030 with \option{program}.
1031 \keyval{file-ext}{extension}\Default{pdf}
1032 The file extension of the included file of a compiled example.
1033 \keybool{add-frame}\Default{true}
1034 \sinceversion{0.10}If \code{true} every output page will get a frame.
1035 \end{options}
1036
1037 The compiled document will be input with \cs*{includegraphics}, each page
1038 separately. Since the pages of the document are most likely as large as the
1039 ones from the main document itself they are scaled down. This is best
1040 demonstrated with an example. The following input
1041 \begin{sourcecode}
1042 \begin{example}[compile]
1043 \documentclass[a5paper]{scrartcl}
1044 \usepackage{showframe,lipsum}
1045 \author{Clemens Niederberger}
1046 \title{A Test File}
1047 \begin{document}
1048 \maketitle
1049 \tableofcontents
1050 \section{A Section Title}
1051 \lipsum[1-10]
1052 \end{document}
1053 \end{example}
1054 \end{sourcecode}
1055 will lead to this output:
1056
1057 \begin{example}[compile]
1058 \documentclass[a5paper]{scrartcl}
1059 \usepackage{showframe,lipsum}
1060 \author{Clemens Niederberger}
1061 \title{A Test File}
1062 \begin{document}
1063 \maketitle
1064 \tableofcontents
1065 \section{A Section Title}
1066 \lipsum[1-10]
1067 \end{document}
1068 \end{example}
1069
1070 The pages get scaled according to two parameters:
1071 \begin{options}
1072 \keyval{max-pages}{number}\Default{4}
1073 The maximum number of pages in a row. The width of the pages is scaled to
1074 $\text{\cs*{linewidth}}/n$ where $n$ is either the number of pages $p$ of
1075 the compiled document or \meta{number} if $p>\text{\meta{number}}$.
1076 \keyval{max-height}{dimension}\Default{.5\cs*{textheight}}
1077 The maximum height of a page.
1078 \end{options}
1079
1080 There's another possibility to influence the appearance of the output:
1081 \begin{options}
1082 \keyval{graphics}{options}\Default
1083 \meta{options} are passed to \cs*{includegraphics} for every page that is
1084 input.
1085 \end{options}
1086
1087 \subsubsection{Floating Output}\label{sec:floating-output}
1088 Since the output can become a quite large figure it might be preferable to
1089 have it as a floating figure. This is also possible by using the option
1090 \option{float}.
1091 \begin{options}
1092 \keychoice{float}{\default{true},false,\meta{float
1093 parameters}}\Default{false}
1094 Choose if the output should be placed in a \env*{figure} of it's own. You
1095 can also use this option to specify the floating parameters for the float.
1096 \keyval{float-pos}{float parameters}\Default{tbp}
1097 Set the standard floating parameters that are used if
1098 \keyis-{float}{true}. The default is actually the expansion of
1099 \cs*{fps@figure} and not directly \code{tbp}.
1100 \keyval{float-env}{name}\Default{figure}
1101 \sinceversion{0.10}The floating environment used when the option
1102 \option{float} is used.
1103 \keyval{caption}{text}\Default
1104 \meta{text} will be used as caption. If left blank no caption will be
1105 typeset. If you want to add a \cs*{label} you can use it in this option.
1106 Implicitly sets \keyis-{float}{true}.
1107 \end{options}
1108 Please note that \option{float} only has an effect if \keyis-{compile}{true}
1109 has been set.
1110
1111 \subsubsection{Selective Output}\label{sec:selective-output}
1112 Sometimes it may be preferable not to include all pages of a compiled document
1113 but only specific pages. This is possible with the following option.
1114
1115 \begin{options}
1116 \keyval{pages}{specifications}
1117 Select the included pages. \meta{specification} is a comma-separated list
1118 of page numbers and page ranges, \eg, \code{1,3,4} or
1119 \code{1,3-5}. \code{1,3-5} is the same as \code{1,3,4,5}. If the list
1120 includes page numbers larger than the maximum number of pages the \PDF\
1121 has a warnung message will be issued and a replacement text will occur in
1122 the output where the page would have been.
1123 \end{options}
1124
1125 The input
1126 \begin{sourcecode}
1127 \begin{example}[compile,pages=1]
1128 \documentclass[a5paper]{scrartcl}
1129 \usepackage{showframe,lipsum}
1130 \author{Clemens Niederberger}
1131 \title{A Test File}
1132 \begin{document}
1133 \maketitle
1134 \tableofcontents
1135 \section{A Section Title}
1136 \lipsum[1-10]
1137 \end{document}
1138 \end{example}
1139 \end{sourcecode}
1140 will lead to this output:
1141
1142 \begin{example}[compile,pages=1]
1143 \documentclass[a5paper]{scrartcl}
1144 \usepackage{showframe,lipsum}
1145 \author{Clemens Niederberger}
1146 \title{A Test File}
1147 \begin{document}
1148 \maketitle
1149 \tableofcontents
1150 \section{A Section Title}
1151 \lipsum[1-10]
1152 \end{document}
1153 \end{example}
1154
1155 Together with the \option{graphics} option this can be used to output a part
1156 of a page. The following source
1157
1158 \begin{sourcecode}
1159 \begin{example}[compile,pages=1,graphics={trim={0pt 12cm 0pt 0pt},clip}]
1160 \documentclass[a5paper]{scrartcl}
1161 \usepackage{showframe,lipsum}
1162 \author{Clemens Niederberger}
1163 \title{A Test File}
1164 \begin{document}
1165 \maketitle
1166 \tableofcontents
1167 \section{A Section Title}
1168 \lipsum[1-10]
1169 \end{document}
1170 \end{example}
1171 \end{sourcecode}
1172 will give this output:
1173
1174 \begin{example}[compile,pages=1,graphics={trim={0pt 12cm 0pt 0pt},clip}]
1175 \documentclass[a5paper]{scrartcl}
1176 \usepackage{showframe,lipsum}
1177 \author{Clemens Niederberger}
1178 \title{A Test File}
1179 \begin{document}
1180 \maketitle
1181 \tableofcontents
1182 \section{A Section Title}
1183 \lipsum[1-10]
1184 \end{document}
1185 \end{example}
1186
1187 \subsection{Example File}
1188 Let's say you're documenting a package called \code{mypackage} that provides
1189 the command \cs*{mycommand} and the environment \env*{myenv}. The basic
1190 manual setup could then look something like this:
1191
1192 \begin{sourcecode}
1193 \documentclass[load-preamble]{cnltx-doc}
1194 \usepackage[T1]{fontenc}
1195 \usepackage[utf8]{inputenc}
1196 \usepackage{mypackage}
1197 \setcnltx{
1198 package = mypackage ,
1199 authors = John Doe ,
1200 email = [email protected] ,
1201 add-cmds = {mycommand} ,
1202 add-envs = {myenv}
1203 }
1204 \begin{document}
1205 ...
1206 \end{document}
1207 \end{sourcecode}
1208
1209 \subsection{Additional Functionality Provided by \cnltxbase}
1210 The \cnltxbase\ package's main purpose is to provide programming facilities.
1211 Most of its macros are listed in section~\ref{sec:defined-cnltxbase}.
1212 However, I like to explain some of its features in a bit more detail.
1213
1214 \subsubsection{Looking for Trailing Punctuation}
1215 The command \cs{cnltx\at ifpunctuation} is is a conditional that detects if a
1216 punctuaction mark follows and acts depending on it. What counts as a
1217 punctuation mark can be set by the user.
1218
1219 \begin{commands}
1220 \command{cnltx\at ifpunctuation}[\sarg\oarg{punctuation
1221 marks}\marg{true}\marg{false}\meta{trailing punctuation}]
1222 The starred version does not gobble the trailing punctuation while the
1223 unstarred does. That's why in the unstarred version you can also use
1224 \cs{cnltx\at trailpunct} to access the gobbled punctuation mark. The
1225 optional argument sets the punctuation marks that should be considered for
1226 this use only.
1227 \end{commands}
1228 \begin{options}
1229 \keyval{set-trail-punct}{punctuation marks}\Default{,.!?;:}
1230 Sets the default list of punctuation marks that should be checked if the
1231 optional argument of \cs{cnltx\at ifpunctuation} is not used.
1232 \end{options}
1233
1234 The usage is probably self-explaining:
1235 \begin{example}
1236 \makeatletter
1237 \cnltx@ifpunctuation{(test\cnltx@trailpunct)}{(test)}!\par
1238 \cnltx@ifpunctuation[.]{(test\cnltx@trailpunct)}{(test)}!\par
1239 a punctuation mark \cnltx@ifpunctuation*{follows}{doesn't follow}!\par
1240 a full stop \cnltx@ifpunctuation*[.]{follows}{doesn't follow}!
1241 \end{example}
1242
1243 If the non-starred variant has gobbled a \cs*{par} the \cs*{par} is placed
1244 back:
1245
1246 \begin{example}
1247 \makeatletter
1248 \def\test{\cnltx@ifpunctuation{(test\cnltx@trailpunct)}{(test)}}%
1249 \makeatother
1250 \test
1251
1252 \test.
1253
1254 \test{} .
1255 \end{example}
1256
1257 \subsubsection{Counter Representation Commands}\label{sec:count-repr-comm}
1258 \minisec{Background}
1259
1260 A counter representation command like \cs*{arabic}\Marg{section} always is a
1261 command that calls an associated internal command (\cs*{@arabic} in the case
1262 of our example) that acts on the count associated with the counter:
1263 \begin{sourcecode}
1264 \def\arabic#1{\expandafter\@arabic\csname c@#1\endcsname}
1265 \def\@arabic#1{\number #1}
1266 \end{sourcecode}
1267 The command \cs*{arabic}\marg{counter} builds a command sequence
1268 \cs*{c@\meta{counter}} from its argument \meta{counter}. It then calls the
1269 internal command \cs*{@arabic} that takes this command sequence as an
1270 argument. The command sequence \cs*{c@\meta{counter}} is the count (in the
1271 \TeX\ sense) that is associated with the counter \meta{counter}, \ie, it holds
1272 the actual number. The command \cs*{@arabic} now simply typesets the integer
1273 value of the count.
1274
1275 The same holds for every counter representation command. The principle always
1276 is as follows:
1277 \begin{sourcecode}
1278 \def\foo#1{\expandafter\@foo\csname c@#1\endcsname}
1279 \def\@foo#1{do something with #1 (where #1 is a count)}
1280 \end{sourcecode}
1281 This means in order to get a new counter representation command you actually
1282 need to define \emph{two} macros.
1283
1284 \cnltxbase\ defines an interface that allows to define both commands at once
1285 without having to think about \cs*{expandafter}, associated counts, internal
1286 command names and so on. The only thing left to do is choosing a name for the
1287 counter representation and providing a valid definition of what should happen
1288 with the (integer) value of the counter.
1289
1290 \minisec{New Commands}
1291
1292 \begin{commands}
1293 \command{DeclareCounterRepresentation}[\marg{command}\marg{definition}]
1294 Declares a new counter representation command and its internal equivalent.
1295 In the \meta{definition} \code{\#1} is used to refer to the counter
1296 \emph{number}, that is, the value of \cs*{c@\meta{counter}}. This command
1297 will silently overwrite any existing definition.
1298 \command{newcounterrepresentation}[\marg{command}\marg{definition}]
1299 Defines a new counter representation command and its internal equivalent.
1300 In the \meta{definition} \code{\#1} is used to refer to the counter
1301 \emph{number}, that is, the value of \cs*{c@\meta{counter}}. This command
1302 will issue an error if either the user command or the internal command
1303 (\cf\ \cs*{arabic} and \cs*{@arabic}) already exist.
1304 \command{providecounterrepresentation}[\marg{command}\marg{definition}]
1305 Provides a new counter representation command and its internal equivalent.
1306 In the \meta{definition} \code{\#1} is used to refer to the counter
1307 \emph{number}, that is, the value of \cs*{c@\meta{counter}}. This command
1308 will define the commands only if neither the user command nor the internal
1309 command (\cf\ \cs*{arabic} and \cs*{@arabic}) already exist and will do
1310 nothing if either of them exist.
1311 \command{renewcounterrepresentation}[\marg{command}\marg{definition}]
1312 Redefines an existing counter representation command and its internal
1313 equivalent. In the \meta{definition} \code{\#1} is used to refer to the
1314 counter \emph{number}, that is, the value of \cs*{c@\meta{counter}}. This
1315 command will issue an error if neither the user command nor the internal
1316 command (\cf\ \cs*{arabic} and \cs*{@arabic}) already exist.
1317 \end{commands}
1318
1319 Let's take a look at what is actually defined by these commands:
1320 \begin{example}
1321 \makeatletter\ttfamily
1322 before:\par
1323 \meaning\arabic\par
1324 \meaning\@arabic
1325
1326 \renewcounterrepresentation\arabic{\the\numexpr#1\relax}%
1327 after:\par
1328 \meaning\arabic\par
1329 \meaning\@arabic
1330 \end{example}
1331
1332 As you can see nothing bad happens. The commands are only a convenient
1333 interface. Let's take a look at some more realistic examples. The above
1334 redefinition was only a demonstration. For example you may want to have a
1335 representation which calculates the displayed value from the counter value?
1336
1337 \begin{example}
1338 \newcounterrepresentation\minusone{\the\numexpr#1-1\relax}%
1339 \newcounterrepresentation\multoffourrm{\romannumeral\numexpr(4*#1)-4\relax}%
1340 % \newrobustcmd is provided by the `etoolbox' package
1341 \newrobustcmd*\circlenumber[1]{%
1342 \tikz[baseline]\node[anchor=base,draw,shape=circle]{\number#1};}%
1343 \newcounterrepresentation\circled{\circlenumber{#1}}%
1344 \makeatletter
1345 \newcounterrepresentation\twodigits{\two@digits{#1}}%
1346 \makeatother
1347 \newcounter{test}%
1348 \setcounter{test}{9}
1349
1350 \minusone{test}\par
1351 \multoffourrm{test}\par
1352 \circled{test}\par
1353 \twodigits{test}
1354 \end{example}
1355
1356 \subsubsection{Expandable Document Commands}
1357 The commands presented in this section are highly experimental. \emph{Use them
1358 \emph{only} if you really have to!}
1359 \begin{commands}
1360 \command{newexpandablecmd}[\sarg\marg{cs}\oarg{num args}\oarg{default
1361 opt}\marg{definition}]
1362 \sinceversion{0.7}This command has the same syntax as \cs*{newcommand}.
1363 The difference is that if \meta{cs} is defined with an optional argument
1364 it is still fully expandable. This comes with a cost: in order to still
1365 being able to check for the optional argument it needs to see a following
1366 token as argument. If it is used without optional argument and has no
1367 mandatory arguments it may be necessary to add a trailing \cs*{empty} or
1368 something. There's another drawback: a command \cs*{test} thus defined
1369 cannot distinguish between \verbcode+\test[]+ and \verbcode+\test{[}]+ and
1370 will misinterpret the second as a present optional argument.
1371
1372 My recommendation is to never use this for defining a user
1373 command.\footnote{I can see the contradiction here: if a command is no
1374 user command there is no need for an optional argument.} Use it in code
1375 you can control and only if you have to.
1376
1377 If you define a command \emph{without} optional argument this command
1378 falls back to \cs*{newcommand}.
1379 \command{renewexpandablecmd}[\sarg\marg{cs}\oarg{num args}\oarg{default
1380 opt}\marg{definition}]
1381 \sinceversion{0.7}The equivalent of \cs*{renewcommand}. See description of
1382 \cs{newexpandablecmd} for further details.
1383 \command{provideexpandablecmd}[\sarg\marg{cs}\oarg{num args}\oarg{default
1384 opt}\marg{definition}]
1385 \sinceversion{0.7}The equivalent of \cs*{providecommand}. See description
1386 of \cs{newexpandablecmd} for further details.
1387 \end{commands}
1388
1389 \subsection{Additional Functionality Provided by \cnltxtools}
1390 \subsubsection{Commands for Defining Different Document Macros}
1391 \label{sec:prov-defin-comm}
1392
1393 The \cnltxtools\ package defines some additional macros which provide useful
1394 functionality also in contexts \emph{not} documenting a \LaTeX\ package.
1395
1396 \begin{commands}
1397 \command{newname}[\marg{cs}\Marg{\meta{first name} \meta{last name}}]
1398 Defines \meta{cs}\changedversion{0.12} to write out the full name and add
1399 an index entry sorted by the last name. Also defines a starred variant of
1400 \meta{cs} that only writes the last name but still adds the full index
1401 entry.
1402 \command{name}[\sarg\Marg{\meta{first name} \meta{last name}}]
1403 \changedversion{0.12}Typesets a name according to the same specs as the
1404 names defined with \cs{newname}. Also adds the name to the index. The
1405 starred version only writes the name but doesn't add the name to the
1406 index. Index entries either have the form \meta{last name} or
1407 \code{\meta{last name}, \meta{first name}} depending on the usage of the
1408 optional argument. It's safer to define a dedicated macro with
1409 \cs{newname} to get consistent index entries.
1410 \command{cnltxacronym}[\marg{pdf and sort string}\marg{acronym}]
1411 Typesets \meta{acronym} with small caps and uses \meta{pdf and sort
1412 string} as \PDF\ string and for sorting the index entry that is added.
1413 This command was used to define \cs{lppl} and \cs{ctan}. \emph{This is
1414 not intended as a replacement for packages like
1415 \pkg*{acro}~\cite{pkg:acro} or \pkg*{glossaries}~\cite{pkg:glossaries}!}
1416 In fact it is a ``poor man's'' solution that allows me not to require one
1417 of those packages.
1418 \command{newabbr}[\sarg\marg{control sequence}\marg{definition}]
1419 Defines the abbreviation \meta{control sequence} with the definition
1420 \meta{definition}. The star argument prevents that a dot is added at the
1421 end of the definition. An error is raised if \meta{control sequence}
1422 already exists.
1423 \command{renewabbr}[\sarg\marg{control sequence}\marg{definition}]
1424 Redefines the abbreviation \meta{control sequence} with the definition
1425 \meta{definition}. The star argument prevents that a dot is added at the
1426 end of the definition. An error is raised if \meta{control sequence} does
1427 not exist already.
1428 \command{defabbr}[\sarg\marg{control sequence}\marg{definition}]
1429 Defines or overwrites the abbreviation \meta{control sequence} with the
1430 definition \meta{definition}. The star argument prevents that a dot is
1431 added at the end of the definition.
1432 \command{cnltxtimeformat}[\marg{abbreviation}]\Default{\cs*{textsc}\Marg{\cs*{,}\#1}}
1433 Used in some predefined abbreviations.
1434 \command{cnltxlatin}[\marg{abbreviation}]\Default{\cs*{textit}\Marg{\#1}}
1435 Used in some localization strings.
1436 \end{commands}
1437
1438 \begin{options}
1439 \keyval{acronym-format}{definition}\Default{\cs*{scshape}}
1440 Formatting of the acronyms as typeset with \cs{cnltxacronym}.
1441 \keyval{name-format}{formatting commands}\Default{\#1}
1442 The formatting of names created with \cs{newname} or typeset with
1443 \cs{name}. Names typeset through the bibliography style \code{cnltx} are
1444 also formatted according to this option. \meta{formatting commands}
1445 should contain \code{\#1} for the actual name.
1446 \keyval{last-name-format}{formatting commands}\Default{\cs*{textsc}\Marg{\#1}}
1447 The formatting of the last names created with \cs{newname} or typeset with
1448 \cs{name}. Names typeset through the bibliography style \code{cnltx} are
1449 also formatted according to this option. \meta{formatting commands}
1450 should contain \code{\#1} for the actual name.
1451 \keyval{first-name-format}{formatting commands}\Default{\#1}
1452 The formatting of first names created with \cs{newname} or typeset with
1453 \cs{name}. Names typeset through the bibliography style \code{cnltx} are
1454 also formatted according to this option. \meta{formatting commands}
1455 should contain \code{\#1} for the actual name.
1456 \end{options}
1457
1458 A short example of the usage of \cs{newname} and \cs{cnltxacronym}:
1459 \begin{example}
1460 \newname\carlisle{David Carlisle}%
1461 \carlisle\ is a well-known member of the \LaTeX\ community. \carlisle* is
1462 the author of many packages such as \pkg*{longtable}. Take a look in the
1463 index where you'll find \carlisle* mentioned.
1464
1465 \lppl\ is defined as \cnltxacronym{LPPL}{lppl}.
1466 \end{example}
1467
1468 \subsubsection{Defining Abbreviations}\label{sec:defin-abbr}
1469 In section~\ref{sec:prov-defin-comm} when describing \cs{newabbr} and similar
1470 commands I said \enquote{The star argument prevents that a dot is added at the
1471 end of the definition}. We should clarify what that means. Many
1472 abbreviations end with a dot. Some don't which explains the starred form of
1473 the commands. But why add a dot automatically in the first place? The
1474 reasoning is two-fold:
1475 \begin{itemize}
1476 \item Suppose you add the dot explicitly in the definition but forget one or
1477 two times that you did -- you'll end up with abbreviations followed by
1478 \emph{two} dots! Macros defined with \cnltxtools\ recognize a
1479 following dot and will not print a second one in those cases.
1480 \item In a document where \cs*{nonfrenchspacing} is active the space after a
1481 dot in the middle of a sentence should be shorter than the one after the
1482 full stop ending a sentence. \TeX\ automatically interprets a dot
1483 following a small letter as the end of a sentence and a dot after a
1484 capital letter as a dot after an abbreviation inside of a sentence.
1485 Usually you solve this by adding \cs*{@} in the appropriate places:
1486 \verbcode+e.\,g.\@+ for a intra-sentence space and \verbcode+NSA\@.+ for
1487 a inter-sentence space. The dot added by \cnltxtools\ always will be
1488 followed by an intra-sentence space. If you add a dot explicitly it will
1489 be your responsibility. Per default it will then act like a dot after a
1490 small letter.
1491 \end{itemize}
1492
1493 Let's see some example:
1494 \begin{example}[side-by-side]
1495 \ttfamily% <= this will amplify the visual effect of \nonfrenchspacing
1496 \newabbr\ab{a.b}%
1497 \newabbr\AB{A.B}%
1498 \newabbr*\cd{cd}%
1499 \ab\ and some words\par
1500 \ab. and some words\par
1501 \AB\ and some words\par
1502 \AB. and some words\par
1503 \cd\ and some words
1504 \end{example}
1505
1506 Beware: \cnltxtools\ will only leave the dot out if one follows directly in
1507 the input! That means that spaces are not ignored. However, of course \TeX\
1508 ignores spaces after macro names so usually this won't be an issue. If you
1509 define an abbreviation with a macro name consisting of one non-letter where
1510 spaces are not ignored you have to keep this fact in mind, though.
1511
1512 \subsubsection{Predefined Abbreviations}
1513 \cnltxtools\ already provides a bunch of abbreviations defined with its
1514 \cs{newabbr} command.
1515
1516 \minisec{Abbreviations that allow Localization}\label{sec:abbr-that-allow}
1517
1518 \cnltxtools\ defines a few abbreviations that are sensitive to \pkg{babel}
1519 settings. Currently only translations for English and German are provided and
1520 the definition falls back to the English version if you're using a language
1521 other than those. It is possible to add further localization strings quite
1522 easily, see section~\ref{sec:language-support}.
1523
1524 \begin{commands}
1525 \command{ie}
1526 Prints \enquote{\ie} or \enquote{\foreignlanguage{ngerman}{\ie}}
1527 \command{eg}
1528 Prints \enquote{\eg} or \enquote{\foreignlanguage{ngerman}{\eg}}
1529 \command{etc}
1530 Prints \enquote{\etc} or \enquote{\foreignlanguage{ngerman}{\etc}}
1531 \command{cf}
1532 Prints \enquote{\cf} or \enquote{\foreignlanguage{ngerman}{\cf}}
1533 \end{commands}
1534
1535 All of these macros add a final dot followed by \cs*{@} \emph{except} if a dot
1536 \emph{directly} follows the macro.
1537
1538 \begin{example}[side-by-side]
1539 \eg\ and some following text\par
1540 \eg, and some following text\par
1541 \eg. and some following text\par
1542 \selectlanguage{ngerman}
1543 \eg\ and some following text\par
1544 \eg, and some following text\par
1545 \eg. and some following text
1546 \end{example}
1547
1548 \minisec{German Abbreviations}\label{sec:german-abbreviations}
1549
1550 The following abbreviations are not sensitive to localization and are only of
1551 use in a German text. Although they're defined: \emph{please} do not use
1552 abbreviations at the start of a sentence!
1553 \begin{commands}
1554 \command{dsh}
1555 Prints \enquote{\dsh}
1556 \command{Dsh}
1557 Prints \enquote{\Dsh}
1558 \command{usf}
1559 Prints \enquote{\usf}
1560 \command{usw}
1561 Prints \enquote{\usw}
1562 \command{uswusf}
1563 Prints \enquote{\uswusf}
1564 \command{zB}
1565 Prints \enquote{\zB}
1566 \command{ZB}
1567 Prints \enquote{\ZB}
1568 \command{vgl}
1569 Prints \enquote{\vgl}
1570 \command{Vgl}
1571 Prints \enquote{\Vgl}
1572 \end{commands}
1573
1574 These macros behave the same as the ones described in
1575 section~\vref{sec:abbr-that-allow}.
1576
1577 \begin{example}[side-by-side]
1578 \dsh\ und weiterer Text\par
1579 \dsh. und weiterer Text\par
1580 \usw\ und weiterer Text\par
1581 \usw. und weiterer Text\par
1582 \usf\ und weiterer Text\par
1583 \usf. und weiterer Text\par
1584 \zB\ und weiterer Text\par
1585 \zB. und weiterer Text
1586 \end{example}
1587
1588 \minisec{Time related Abbreviations}\label{sec:time-relat-abbr}
1589
1590 The abbreviations presented in this section differ from the others in that
1591 they're formatted by the command \cs{cnltxtimeformat}\marg{}, see
1592 section~\vref{sec:prov-defin-comm}.
1593 \begin{commands}
1594 \command{AM}
1595 Prints \enquote{\AM}
1596 \command{PM}
1597 Prints \enquote{\PM}
1598 \command{AD}
1599 Prints \enquote{\AD}
1600 \command{BC}
1601 Prints \enquote{\BC}
1602 \end{commands}
1603
1604 In their current definition these abbreviations are meant to be used
1605 \emph{directly} after the time of day or the date, respectively.
1606
1607 \begin{example}[side-by-side]
1608 She left for work before 6\AM, but
1609 did not arrive until 12\PM. The
1610 interval 5\BC--5\AD\ is one year
1611 shorter than the interval
1612 95\AD--105\AD.
1613 \end{example}
1614
1615 \section{Formatting Possibilities}\label{sec:cmds:formatting}
1616
1617 One of the goals I wanted to achieve with this package is a consistent look
1618 and an easy interface for customization. No font choice and no color choice
1619 is fixed. In this section ways to change the formatting are shown.
1620
1621 The formatting of the different commands provided by \cnltx\ and various other
1622 properties can be changed in two ways: either by redefining the internal
1623 commands that are used for the formatting or by setting a corresponding
1624 option. Both variants are described in the next subsections.
1625
1626 How the colors should be changed is described in section~\vref{sec:colors}.
1627
1628 \subsection{Formatting by Redefining Hooks}
1629
1630 You can change the formatting by redefining the following commands. They're
1631 all defined by the \cnltxexample\ package except where indicated differently.
1632
1633 \begin{commands}
1634 \command{codefont}\Default{\cs*{ttfamily}}
1635 This command is used for all formatting of source code.
1636 \command{sourceformat}\Default{\cs{codefont}\cs*{small}}
1637 Formatting of the listings.
1638 \command{exampleformat}\Default
1639 Special formatting of the output of a listing.
1640 \command{versionnoteformat}\Default{\cs*{footnotesize}\cs*{sffamily}\cs*{RaggedRight}}
1641 \byclass Formatting of the notes introduced in section~\vref{sec:cmds:versioning}.
1642 \command{packageformat}\Default{\cs*{sffamily}}
1643 The formatting of package names.
1644 \command{classformat}\Default{\cs*{sffamily}}
1645 The formatting of class names.
1646 \command{argumentformat}\Default{\cs*{normalfont}\cs*{itshape}}
1647 The formatting of \cs{meta}\marg{meta}.
1648 \end{commands}
1649
1650 \begin{example}
1651 \renewcommand*\codefont{\sffamily\bfseries}
1652 \code{foo} and \cs*{bar}, option \option{baz}
1653 \end{example}
1654
1655 \subsection{Formatting by Setting Options}
1656
1657 You can change the formatting of by setting the following options. They're all
1658 defined by the \cnltxexample\ package except where indicated differently.
1659
1660 \begin{options}
1661 \keyval{title-format}{definition}\Default{\cs*{bfseries}\cs*{scshape}}
1662 \sinceversion{0.2}Formatting of the document title.
1663 \keyval{abstract-width}{dimension}\Default{.75\cs*{linewidth}}
1664 \sinceversion{0.6}The width of the \cs*{parbox} the abstract as set with
1665 the \option{abstract} option is placed in.
1666 \keyval{abstract-format}{definition}%
1667 \Default{\cs*{setlength}\cs*{parskip}\Marg{.333\cs*{baselineskip}}}
1668 \sinceversion{0.6}Code that is placed in the parbox the abstract is placed
1669 in \emph{before} the abstract text.
1670 \keyval{caption-font}{definition}%
1671 \Default{\cs*{normalfont}\cs*{small}\cs*{sffamily}}
1672 This option only has any effect if you use the option
1673 \option{load-preamble}, see section~\vref{sec:preamble} for details on the
1674 option.
1675 \keyval{caption-label-font}{definition}%
1676 \Default{\cs*{normalfont}\cs*{small}\cs*{sffamily}\cs*{scshape}}
1677 This option only has any effect if you use the option
1678 \option{load-preamble}, see section~\vref{sec:preamble} for details on the
1679 option.
1680 \keyval{code-font}{definition}\Default{\cs*{ttfamily}}
1681 Used for all formatting of source code.
1682 \keyval{source-format}{definition}\Default{\cs{codefont}\cs*{small}}
1683 Formatting of the listings.
1684 \keyval{expl-format}{definition}\Default
1685 Special formatting of the output of a listing.
1686 \keyval{module-sep}{definition}\Default{\cs*{,}>{}>\cs*{,}}
1687 \byclass Change the separator between module name and corresponding option
1688 name.
1689 \keyval{version-note-format}{definition}%
1690 \Default{\cs*{footnotesize}\cs*{sffamily}\cs*{RaggedRight}}
1691 \byclass Formatting of the notes introduced in
1692 section~\vref{sec:cmds:versioning}.
1693 \keyval{pkg-format}{definition}\Default{\cs*{sffamily}}
1694 The formatting of package names.
1695 \keyval{cls-format}{definition}\Default{\cs*{sffamily}}
1696 The formatting of class names.
1697 \keyval{arg-format}{definition}\Default{\cs*{normalfont}\cs*{itshape}}
1698 The formatting of \cs{meta}\marg{meta}.
1699 \keyval{default-format}{code}\Default{\cs*{uline}}
1700 \sinceversion{0.2}The formatting of \cs{default}'s argument.
1701 \meta{code}'s last macro should take one argument.
1702 \end{options}
1703
1704 \begin{example}
1705 \setcnltx{code-font=\sffamily\itshape}
1706 \code{foo} and \cs*{bar}, option \option{baz}
1707 \end{example}
1708
1709 \section{Commands, Options and Further Settings Directly Related to the \cnltxdoc\ Class}
1710
1711 \subsection{Using Class Options}\label{sec:class:options}
1712 The \cnltxdoc\ class only knows a few options:
1713 \begin{options}
1714 \keybool{load-preamble}\Default{false}
1715 See section~\vref{sec:preamble} for details.
1716 \keybool{load-preamble+}\Default{false}
1717 See section~\vref{sec:predefined-indexing} for details.
1718 \keybool{add-index}\Default{false}
1719 See section~\vref{sec:predefined-indexing} for details.
1720 \keybool{adapt-layout}\Default{true}
1721 \sinceversion{0.13}If set to true \cnltxdoc\ will make some changes to the
1722 section and part formats, it will redefine the footnote format, set the
1723 header and footer and adapt the caption format.
1724 \keyval{babel-options}{options}\Default{english}
1725 Options given to the \needpackage[macros/latex/required]{babel} package.
1726 This option only has an effect if \keyis-{load-preamble}{true}.
1727 \keyval{scrartcl}{options}\Default
1728 \changedversion{0.13}Options that are passed to the underlying class
1729 \cls{scrartcl}. Can be used to pass options to \cls{scrartcl} when
1730 \option{load-preamble} is used. Not really necessary since unknown
1731 options are passed to \cls{scrartcl}, anyway.
1732 \end{options}
1733
1734
1735 \subsection{Information on the Described Package or Class}\label{sec:inform-descr-pack}
1736 A manual for a package or a class needs some information on the described
1737 package like the package name, the version number, the date and so on. This
1738 information is given with the following options. They are used to build the
1739 title page of the manual.
1740 \begin{options}
1741 \keyval{package}{package}
1742 The name of the package that is described. Either this option or
1743 \option{class} or \option{name} should always be given. This command also
1744 defines a command sequence from the package name that formats the package
1745 name with color and small caps like \cnltx.
1746 \keyval{class}{class}
1747 The name of the class that is described. Either this option or
1748 \option{package} or \option{name} should always be given. This command
1749 also defines a command sequence from the class name that formats the class
1750 name with color and small caps like \cnltx.
1751 \keyval{name}{name}
1752 The name of the class/package that is described. Either this option or
1753 \option{package} or \option{class} should always be given. This command
1754 also defines a command sequence from the class name that formats the class
1755 name with color and small caps like \cnltx.
1756 \keyval{authors}{author list}
1757 \changedversion{0.4}Comma separated list of package/class authors. After
1758 each author name you can add an email address by writing it in square
1759 brackets: \verbcode+Some Name[[email protected]]+. Email addresses specified
1760 this way get written as a footnote. At least one author should always be
1761 given.
1762 \keyval{version}{version number}
1763 Version number of the package/class. \cnltx\ tries to extract the
1764 information from the given \option{package} or \option{class}. This
1765 option can be used to set it explicitly.
1766 \keyval{date}{date}
1767 Date of the package/class. \cnltx\ tries to extract the
1768 information from the given \option{package} or \option{class}. This
1769 option can be used to set it explicitly.
1770 \keyval{info}{package/class info}
1771 Information about the package/class. \cnltx\ tries to extract the
1772 information from the given \option{package} or \option{class}. This
1773 option can be used to set it explicitly.
1774 \keyval{subtitle}{subtitle}
1775 A subtitle, printed below the package/class name.
1776 \keyval{url}{url}
1777 The homepage of the package.
1778 \keyval{email}{email}
1779 A contact email address.
1780 \keyval{abstract}{abstract}
1781 An abstract of the package/class/manual. This is text typeset in a box of
1782 \code{.75\cs*{linewidth}}. Actually it does not have to be text but could
1783 be an image or whatever you like.
1784 \end{options}
1785
1786 \subsection{Building of the Manuals Title Page}
1787 If either the \option{package} or \option{class} has been given an automatic
1788 title page is built using the gathered information. Figure~\vref{fig:titlepage}
1789 roughly sketches which informations is used and how the different elements are
1790 arranged on the title page. The page style of the title page is
1791 \code{plain}. Additionally a table of contents is automatically built that
1792 is set in two columns. The automatic building of the title page can be
1793 prevented by explicitly setting the following option:
1794
1795 \begin{options}
1796 \keybool{build-title}
1797 The default state depends on other options given like \option{package}.
1798 However, setting this option to \code{false} \emph{after} any of the
1799 options described in section~\vref{sec:inform-descr-pack} will prevent the
1800 building of a title page and allows you to design your own.
1801 \end{options}
1802
1803 \begin{figure}[htb]
1804 \centering
1805 \begin{tikzpicture}[
1806 start chain=going below,
1807 node distance=1em,
1808 every node/.style={draw,align=center}
1809 ]
1810 \node[on chain] {package name formatted with \cs{titleformat} and scaled
1811 to 1.5 of its size} ;
1812 \node[on chain] {subtitle} ;
1813 \node[on chain,draw=none]
1814 {\tikz\draw (0,0) node[draw] {version} ++(4,0) node[draw] {date} ;} ;
1815 \node[on chain] {package information} ;
1816 \node[on chain] {author names (formatted according to specifications for
1817 names as defined with \cs{newname})} ;
1818 \node[on chain] {url when specified via the \option{url} option} ;
1819 \node[on chain] {email address when specified via the \option{email} option} ;
1820 \node[on chain] {abstract when specified via the \option{abstract} option} ;
1821 \end{tikzpicture}
1822 \caption{Schematic sketch of the title page.}
1823 \label{fig:titlepage}
1824 \end{figure}
1825
1826 \subsection{A Quotation Environment}
1827
1828 \cnltxdoc\sinceversion{0.5} provides a quotation environment:
1829 \begin{environments}
1830 \environment{cnltxquote}[\oarg{author/reference}]
1831 A quotation environment.
1832 \end{environments}
1833
1834 The environment sets the body indented on both sides as it simply uses a
1835 \env*{quote} environment internally. The contents of the optional argument is
1836 set flush right after the environment's body. The formatting is controlled by
1837 two options:
1838
1839 \begin{options}
1840 \keyval{quote-format}{definition}\Default{\cs*{small}\cs*{sffamily}}
1841 The formatting of the environment's body.
1842 \keyval{quote-author-format}{definition}\Default{\cs*{itshape}}
1843 \end{options}
1844
1845 \begin{example}
1846 \begin{cnltxquote}[Douglas Adams, The Restaurant at the End of the Universe]
1847 ``The first ten million years were the worst,'' said Marvin, ``and the
1848 second ten million years, they were the worst too. The third ten million
1849 years I didn't enjoy at all. After that I went into a bit of a decline.''
1850 \end{cnltxquote}
1851 \end{example}
1852
1853 \subsection{Predefined Preamble}\label{sec:preamble}
1854 It is possible to load a part of my standard preamble automatically by
1855 passing an option as class option.
1856 \begin{options}
1857 \opt{load-preamble}
1858 Class option that preloads part of my custom preamble.
1859 \end{options}
1860
1861 Using the option will include the following code:\changedversion{0.13}
1862
1863 \begin{sourcecode}
1864 \RequirePackage{ifxetex,ifluatex}
1865 \ifbool{cnltx@load@fonts}
1866 {
1867 \ifboolexpr{not bool{xetex} and not bool{luatex}}
1868 {\RequirePackage[T1]{fontenc}}
1869 {\RequirePackage{fontspec}}
1870 \RequirePackage[oldstyle]{libertine}
1871 \RequirePackage{libertinehologopatch}
1872 \RequirePackage[supstfm=libertinesups]{superiors}
1873 % libertine does not have superior letters:
1874 \def\@makefnmark{%
1875 \hbox{%
1876 \cnltx@ifisnum{\@thefnmark}
1877 {\textsu{\hspace*{\superiors@spaced}\@thefnmark}}
1878 {\@textsuperscript{\normalfont\@thefnmark}}%
1879 }%
1880 }
1881 }
1882 {}
1883 \ifbool{cnltx@microtype}
1884 {\RequirePackage{microtype}}
1885 {}
1886 \ifboolexpr
1887 {
1888 bool {cnltx@microtype} and
1889 not test {\ifcsdef{MT@pr@set@@romansans}} and
1890 not test {\ifcsdef{MT@ex@set@@romansans}} and
1891 bool {cnltx@load@fonts}
1892 }
1893 {
1894 \DeclareMicrotypeSet{romansans}{
1895 encoding = {*},
1896 family = {rm*,sf*}
1897 }
1898 }
1899 {}
1900 \ifboolexpr
1901 {
1902 bool {cnltx@microtype} and
1903 not test {\ifcsdef{MT@tr@set@@scshape}} and
1904 bool {cnltx@load@fonts}
1905 }
1906 {
1907 \DeclareMicrotypeSet[tracking]{scshape}{
1908 encoding = {*} ,
1909 shape = {sc,scit,si}
1910 }
1911 }
1912 {}
1913 \ifboolexpr
1914 {
1915 not bool {xetex} and
1916 bool {cnltx@load@fonts} and
1917 bool {cnltx@microtype}
1918 }
1919 {
1920 \microtypesetup{
1921 tracking = scshape ,
1922 protrusion = romansans ,
1923 expansion = romansans
1924 }
1925 \DisableLigatures{ family = tt* }
1926 }
1927 {}
1928 \ifbool{cnltx@load@fonts}
1929 {
1930 \ifboolexpr{not bool{xetex} and not bool{luatex}}
1931 {\RequirePackage[scaled=.81]{beramono}}
1932 {
1933 \setmonofont[
1934 Scale = MatchLowercase ,
1935 Ligatures = {NoCommon,NoRequired,NoContextual}
1936 ]{DejaVu Sans Mono}
1937 }
1938 \KOMAoptions{DIV=last}
1939 \recalctypearea
1940 }
1941 {}
1942 \RequirePackage{fnpct}
1943 \expandafter\RequirePackage\expandafter[\cnltx@babel@options]{babel}
1944 \end{sourcecode}
1945
1946 The effect of this preamble is demonstrated by the document you're reading at
1947 this moment.
1948
1949 \begin{options}
1950 \keybool{load-preamble-}\Default{false}
1951 This option has the same effect as adding using \option{load-preamble} but
1952 without making any font decisions.
1953 \end{options}
1954
1955 Another option affects the layout of the document:
1956 \begin{options}
1957 \keybool{adapt-layout}\Default{true}
1958 \sinceversion{0.13}If set to true \cnltxdoc\ will make some changes to the
1959 section and part formats, it will redefine the footnote format, set the
1960 header and footer and adapt the caption format.
1961 \end{options}
1962
1963 Using the option will include the following code:
1964
1965 \begin{sourcecode}
1966 \renewcommand*\sectionformat{%
1967 \textcolor{cnltx}{\thesection\autodot}\enskip
1968 }
1969 \renewcommand*\subsectionformat{%
1970 \textcolor{cnltx}{\thesubsection\autodot}\enskip
1971 }
1972 \renewcommand*\subsubsectionformat{%
1973 \textcolor{cnltx}{\thesubsubsection\autodot}\enskip
1974 }
1975 \setkomafont{subsubsection}{\normalfont\normalsize\itshape}
1976 \renewcommand*\partformat{%
1977 \textcolor{cnltx}{\partname~\thepart\autodot}%
1978 }
1979 \renewcommand*\partformat{%
1980 \textcolor{cnltx}{\partname~\thepart\autodot}}
1981 \deffootnote{2em}{1em}{\llap{\thefootnotemark. }}%
1982 \RequirePackage{scrlayer-scrpage}
1983 \chead{\rightmark}
1984 \KOMAoptions{automark}
1985 \pagestyle{scrheadings}
1986 \setcapindent{1.5em}
1987 \setkomafont{caption}{\cnltx@caption@font}
1988 \setkomafont{captionlabel}{\cnltx@captionlabel@font}
1989 \end{sourcecode}
1990
1991 \subsection{Predefined Indexing}\label{sec:predefined-indexing}
1992 \cnltxdoc\ allows the automated creation of an index. This is done with the
1993 help of the \pkg{imakeidx} package by \egreg~\cite{pkg:imakeidx}. To use this
1994 feature you have two class options. They cannot be set with \cs{setcnltx} but
1995 must be given as class options.
1996
1997 \begin{options}
1998 \keybool{add-index}\Default{false}
1999 Enables the automatic creation of an index at the end of the document.
2000 \keybool{load-preamble+}\Default{false}
2001 This option has the same effect as adding the options
2002 \option{load-preamble}, \option{add-index} and \option{add-bib}.
2003 \end{options}
2004
2005 Enabling the feature
2006 \begin{itemize}
2007 \item loads the \needpackage{imakeidx} package,
2008 \item uses a given style file for the index that can be specified with the
2009 \option{index-style} option,
2010 \item sets a certain setup for the index that can be specified with the
2011 \option{index-setup} option and
2012 \item adds an index at the end of the document.
2013 \end{itemize}
2014
2015 The following options are available to customize the appearance of the index:
2016 \begin{options}
2017 \keyval{index-prologue}{text}
2018 Adds \meta{text} as index prologue between heading and the actual index.
2019 \keyval{index-space}{dimension}\Default{0pt}
2020 The vertical space between index prologue and index.
2021 \keyval{index-setup}{options}%
2022 \Default{othercode=\cs*{footnotesize},level=\cs*{addsec}}
2023 The options that are passed to \pkg{imakeidx}'s \cs*{indexsetup} command.
2024 \keyval{makeindex-setup}{options}\Default{columns=2,columnsep=1em}
2025 The options that are passed to the \cs*{makeindex} command.
2026 \keyval{index-style}{style file}\Default{cnltx.ist}
2027 The style file that is used for formatting the index.
2028 \end{options}
2029
2030 The index style file \file{cnltx.ist} contains the following lines:
2031 \inputsourcecode[sourcecode-options={style=cnltx-makeindex}]{cnltx.ist}
2032
2033 The feature is demonstrated by this document which does not contain a single
2034 control sequence containing the string \code{index}!
2035
2036 \subsection{Bibliography with \pkg*{biblatex}}
2037 \subsubsection{Bibliography Entry Types \code{package}, \code{class} and
2038 \code{bundle} for \pkg*{biblatex}}
2039 \label{sec:listings:bibtex-language}
2040
2041 \cnltxdoc\sinceversion{0.4} defines the bibliograpy entry types
2042 \code{package}, \code{class} and \code{bundle} when
2043 \pkg{biblatex}~\cite{pkg:biblatex} is used. This allows specifying \LaTeX\
2044 packages in \file{bib} files:
2045
2046 \begin{sourcecode}[sourcecode-options={style=cnltx-bibtex}]
2047 @package{pkg:chngcntr,
2048 title = {chngcntr} ,
2049 author = {Peter Wilson} ,
2050 maintainer = {Will Robertson} ,
2051 date = {2009-09-02} ,
2052 version = {1.0a} ,
2053 url = {http://mirror.ctan.org/macros/latex/contrib/chngcntr/}
2054 }
2055 @class{cls:exam,
2056 title = {exam},
2057 author = {Philip Hirschhorn},
2058 date = {2015-05-07},
2059 version = {2.5},
2060 url = {http://mirror.ctan.org/macros/latex/contrib/exam/}
2061 }
2062 @bundle{bnd:koma-script,
2063 title = {\KOMAScript} ,
2064 sorttitle = {KOMA-Script} ,
2065 indextitle = {\KOMAScript} ,
2066 indexsorttitle = {KOMA-Script} ,
2067 author = {Markus Kohm},
2068 date = {2015-07-02} ,
2069 version = {3.18} ,
2070 url = {http://mirror.ctan.org/macros/latex/contrib/koma-script/}
2071 }
2072 \end{sourcecode}
2073
2074 As you can see also an entry field \code{maintainer} is defined. For this to
2075 work you have to use the \pkg{biblatex} bibliography style \code{cnltx}. This
2076 style basically is a clone of the style \code{alphabetic} but defines the
2077 necessary additions for the \code{package}, \code{class} and \code{bundle}
2078 entry types and the \code{maintainer} entry field.
2079
2080 Along with the bibliography style a citation style \code{cnltx} is provided,
2081 again a clone of the \code{alphabetic} style. The only addition it makes is
2082 that indexing of maintainer names is enabled if \pkg{biblatex}'s
2083 \code{indexing} option is used. The styles load \cnltxexample\ as it relies
2084 on definitions made by it.
2085
2086 This document uses the following call of \pkg{biblatex}:
2087 \begin{sourcecode}
2088 \usepackage[
2089 backend=biber,
2090 style=cnltx,
2091 sortlocale=en_US,
2092 indexing=cite,
2093 useprefix]{biblatex}
2094 \addbibresource{cnltx.bib}
2095 \end{sourcecode}
2096 Actually it let's \cnltxdoc\ do it, see section~\ref{sec:autom-bibl} for
2097 details.
2098
2099 Just for the sake of the example I am going to cite the \pkg*{chngcntr}
2100 package now~\cite{pkg:chngcntr} so you can see both the bibliography entry and
2101 the indexed names of package, author and maintainer in the appendix.
2102
2103 \subsubsection{Automatic Bibliography}\label{sec:autom-bibl}
2104
2105 \cnltxdoc\ allows the automated creation of a bibliography.
2106
2107 \begin{options}
2108 \keybool{add-bib}\Default{false}
2109 Enables the automatic creation of a bibliography at the end of the
2110 document.
2111 \keybool{load-preamble+}\Default{false}
2112 This option has the same effect as adding the options
2113 \option{load-preamble}, \option{add-index} and \option{add-bib}.
2114 \end{options}
2115
2116 What this options does is including the following code:
2117 \begin{sourcecode}
2118 \RequirePackage[
2119 backend=biber,
2120 style=cnltx,
2121 sortlocale=en_US,
2122 indexing=cite,
2123 useprefix]{biblatex}
2124 \addbibresource{cnltx.bib}
2125 \AtEndDocument{\printbibliography}
2126 \end{sourcecode}
2127
2128 As you can see there's also a bibliography database file \file{cnltx.bib} that
2129 provides a yet small but growing number of package entries.
2130
2131 \section{Predefined \pkg*{listings} and \pkg*{mdframed} Styles}
2132 \subsection{\pkg*{mdframed}}
2133
2134 The source code environments (see section~\vref{sec:usage:examples}) all get a
2135 frame with the help of the \pkg{mdframed}~\cite{pkg:mdframed} package. For
2136 this a custom style is defined called \code{cnltx}. The options
2137 \option{frame-options} and \option{add-frame-options} mentioned in
2138 section~\vref{sec:usage:examples} manipulate this style. It is predefined
2139 with these values:
2140
2141 \begin{sourcecode}
2142 \def\cnltx@mdframed@options{
2143 backgroundcolor = cnltxbg ,
2144 linecolor = cnltx ,
2145 roundcorner = 5pt
2146 }
2147 \end{sourcecode}
2148
2149 \subsection{\pkg*{listings}}
2150 \subsubsection{\LaTeX\ Sourcecode}\label{sec:listings-sourcecode}
2151
2152 The code of the source code environments (see
2153 section~\vref{sec:usage:examples}) is formatted with the help of the
2154 \pkg{listings} package~\cite{pkg:listings}. A \pkg{listings} style is defined
2155 called \code{cnltx}. The options \option{add-cmds}, \option{add-silent-cmds},
2156 \option{add-envs}, \option{add-silent-envs}, \option{listings-options} and
2157 \option{add-listings-options} manipulate this style. It is predefined by
2158 \cnltxexample\ as follows:
2159
2160 \begin{sourcecode}
2161 \def\cnltx@listings@style{
2162 language = [AlLaTeX]TeX,
2163 alsolanguage = [plain]TeX,
2164 basicstyle = {\sourceformat},
2165 numbers = left,
2166 numberstyle = \tiny,
2167 xleftmargin = 1em,
2168 numbersep = .75em,
2169 gobble = \cnltx@gobble ,
2170 columns = fullflexible,
2171 literate =
2172 {ä}{{\"a}}1
2173 {ö}{{\"o}}1
2174 {ü}{{\"u}}1
2175 {Ä}{{\"A}}1
2176 {Ö}{{\"O}}1
2177 {Ü}{{\"U}}1
2178 {ß}{{\ss}}1 ,
2179 breaklines = true,
2180 keepspaces = true,
2181 breakindent = 1em,
2182 commentstyle = \color{comment},
2183 keywordstyle = \color{cs},
2184 deletetexcs =
2185 {
2186 a,o,u,A,O,U,
2187 begin,
2188 center,
2189 description,document,
2190 end,enumerate,
2191 figure,flushleft,flushright,
2192 itemize,list,
2193 otherlanguage,
2194 table,tabu,tabular
2195 },
2196 deletekeywords =
2197 {
2198 a,o,u,A,O,U,
2199 begin,
2200 center,
2201 description,document,
2202 end,enumerate,
2203 figure,flushleft,flushright,
2204 itemize,list,
2205 otherlanguage,
2206 table,tabu,tabular
2207 },
2208 % \begin, \end:
2209 texcsstyle = [2]\color{beginend},
2210 index = [2][texcs2],
2211 indexstyle = [2]\@gobble,
2212 moretexcs = [2]{begin,end},
2213 % added environments that'll be indexed:
2214 texcsstyle = [3]\color{env},
2215 index = [3][texcs3],
2216 indexstyle = [3]\envidx,
2217 % environments that won't be indexed:
2218 texcsstyle = [4]\color{env},
2219 index = [4][texcs4],
2220 indexstyle = [4]\@gobble,
2221 % control sequences that'll be indexed:
2222 texcsstyle = [5]\color{cs},
2223 index = [5][texcs5],
2224 indexstyle = [5]\indexcs,
2225 % control sequences that won't be indexed:
2226 texcsstyle = [6]\color{cs},
2227 index = [6][texcs6],
2228 indexstyle = [6]\@gobble
2229 }
2230 \end{sourcecode}
2231
2232 \subsubsection{\BibTeX\ Entries}
2233 The \cnltxlistings\ package defines\sinceversion{0.4} a \pkg{listings}
2234 language \code{BibTeX} that contains a huge number of bibentry types and
2235 bibentry field types, have a look at
2236 section~\vref{sec:listings:bibtex-language}. \cnltxexample\ defines a
2237 \pkg{listings} style for formatting them called \code{cnltx-bibtex}:
2238
2239 \begin{sourcecode}
2240 \def\cnltx@bibtex@listings@style{
2241 language = BiBTeX,
2242 basicstyle = {\sourceformat},
2243 numbers = left,
2244 numberstyle = \tiny,
2245 xleftmargin = 1em,
2246 numbersep = .5em,
2247 gobble = \cnltx@gobble ,
2248 columns = fullflexible,
2249 literate =
2250 {ä}{{\"a}}1
2251 {ö}{{\"o}}1
2252 {ü}{{\"u}}1
2253 {Ä}{{\"A}}1
2254 {Ö}{{\"O}}1
2255 {Ü}{{\"U}}1
2256 {ß}{{\ss}}1 ,
2257 breaklines = true,
2258 keepspaces = true,
2259 breakindent = 1em,
2260 commentstyle = \color{comment},
2261 keywordstyle = \color{bibentry} ,
2262 keywordstyle = [2]\color{bibentryfield}\itshape ,
2263 showstringspaces = false ,
2264 }
2265 \end{sourcecode}
2266
2267 \subsubsection{\code{makeindex} Style Files}
2268 \cnltxlistings\ defines\sinceversion{0.7} a \pkg{listings} language
2269 \code{makeindex} that contains the keywords used in \code{makeindex} style
2270 files. \cnltxexample\ defines a \pkg{listings} style for formatting them
2271 called \code{cnltx-makeindex}:
2272
2273 \begin{sourcecode}
2274 \def\cnltx@makeindex@listings@style{
2275 language = makeindex,
2276 basicstyle = {\sourceformat},
2277 numbers = left,
2278 numberstyle = \tiny,
2279 xleftmargin = 1em,
2280 numbersep = .75em,
2281 gobble = \cnltx@gobble ,
2282 columns = fullflexible,
2283 literate =
2284 {ä}{{\"a}}1
2285 {ö}{{\"o}}1
2286 {ü}{{\"u}}1
2287 {Ä}{{\"A}}1
2288 {Ö}{{\"O}}1
2289 {Ü}{{\"U}}1
2290 {ß}{{\ss}}1 ,
2291 breaklines = true,
2292 keepspaces = true,
2293 breakindent = 1em,
2294 commentstyle = \color{comment},
2295 keywordstyle = \color{makeidxkey}\bfseries ,
2296 stringstyle = \color{makeidxstring} ,
2297 showstringspaces = false
2298 }
2299 \end{sourcecode}
2300
2301 \section{\PDF\ Strings and \pkg*{hyperref}}
2302
2303 Since the formatting and indexing commands \cs{cs}, \cs{env}, \cs{option},
2304 \cs{pkg}, \cs{cls} and \cs{key} are robust they are ignored in \PDF\
2305 strings. For this reason you should \emph{only use the starred variants} in
2306 places where \PDF\ bookmarks are built from such as section titles when you
2307 use \pkg{hyperref}~\cite{pkg:hyperref}. Since \cnltxdoc\ loads \pkg{hyperref}
2308 this means you should do so, too, when you use \cnltxdoc. This is important
2309 for two reasons:
2310 \begin{enumerate}
2311 \item Indexing in strings that get written to the table of contents does
2312 noch make much sense, anyway, so the starred versions should be used in
2313 section titles even if you don't use \pkg{hyperref}.
2314 \item When \pkg{hyperref} is loaded the mentioned commands are disabled in
2315 \PDF\ strings in a way that \emph{expects} them to be followed by a star.
2316 This means leaving the star out will result in \code{doesn't match its
2317 definition} errors.
2318 \end{enumerate}
2319
2320 \section{Predefined Colors and Color-Schemes}\label{sec:colors}
2321 \subsection{Explicitly Defined Colors}\label{sec:expl-defin-colors}
2322
2323 The \cnltxbase\ package defines a number of colors:
2324 \begin{colors}
2325 \colour{cnltxbrown}
2326 Per default used for the control sequences.
2327 \colour{cnltxblue}
2328 Per default used for module names.
2329 \colour{cnltxred}
2330 Per default used as base color in various places.
2331 \colour{cnltxgreen}
2332 Unused per default.
2333 \colour{cnltxgray}
2334 Per default used for formatting comments.
2335 \colour{cnltxyellow}
2336 Per default used for option names.
2337 \colour{cnltxformalblue}
2338 Unused per default.
2339 \colour{cnltxformalred}
2340 Unused per default.
2341 \end{colors}
2342
2343 \subsection{Actual Used Color Names and Color Schemes}\label{sec:actual-used-color}
2344
2345 The colors defined in section~\vref{sec:expl-defin-colors} are not directly
2346 used with those names. Instead colors are used whose names describe their
2347 function rather than the color. For this the color names are mapped to actual
2348 colors and saved as a coloring scheme. There are currently three predefined
2349 color schemes whose definitions are given below. Those definitions also show
2350 the actually used color names. They are defined via the following command:
2351
2352 \begin{commands}
2353 \command{definecolorscheme}[\marg{name}\marg{color assignments}]
2354 \sinceversion{0.5}Defines the color scheme \meta{name}. When used all
2355 assignments will be actually carried out with \pkg{xcolor}'s
2356 \cs*{colorlet} command. How to input \meta{color assignments} will be
2357 immediately clear from the examples below.
2358 \end{commands}
2359
2360 To activate a color scheme for a document it is simply selected through an
2361 option:
2362 \begin{options}
2363 \keyval{color-scheme}{color scheme name}\Default{default}
2364 Activate a color scheme previously defined with \cs{definecolorscheme}.
2365 \end{options}
2366
2367 The `default' color scheme is defined as follows:
2368 \begin{sourcecode}
2369 \definecolorscheme{default}{
2370 cs => cnltxbrown , % command sequences
2371 option => cnltxyellow ,% options
2372 module => cnltxblue , % modules
2373 comment => cnltxgray , % comments
2374 beginend => red , % \begin and \end
2375 env => black , % environment names
2376 argument => black , % argument delimiters
2377 meta => black!80 , % arguments of \meta
2378 cnltx => cnltxred , % base color
2379 cnltxbg => white , % source code box background
2380 link => black!90 , % hyperlinks
2381 versionnote => black!75 % versioning notes text
2382 bibentry => cnltxgreen , % BibTeX entry types
2383 bibentryfield => black, % BibTeX entry fields
2384 expandable => red , % the color used in \expandable
2385 unexpandable => black , % the color used in \unexpandable
2386 makeidxkey => cnltxgreen , % used for keywords in the cnltx-makeindex
2387 % style
2388 makeidxstring => black % used for strings in the cnltx-makeindex
2389 % style
2390 }
2391 \end{sourcecode}
2392
2393 The `blue' color scheme is defined this way:
2394 \begin{sourcecode}
2395 \definecolorscheme{blue}{
2396 cs => cnltxbrown ,
2397 option => cnltxgreen ,
2398 module => cnltxred ,
2399 comment => cnltxgray ,
2400 beginend => red ,
2401 env => black ,
2402 argument => black ,
2403 meta => black!80 ,
2404 cnltx => cnltxblue ,
2405 cnltxbg => yellow!10 ,
2406 link => cnltx ,
2407 versionnote => black!75
2408 bibentry => cnltxyellow ,
2409 bibentryfield => black ,
2410 expandable => red ,
2411 unexpandable => black ,
2412 makeidxkey => cnltxyellow ,
2413 makeidxstring => black
2414 }
2415 \end{sourcecode}
2416
2417 Finally the `formal' color scheme is defined like this:
2418 \begin{sourcecode}
2419 \definecolorscheme{formal}{
2420 cs => black ,
2421 option => cnltxformalblue ,
2422 module => cnltxblue ,
2423 comment => cnltxgray ,
2424 beginend => red ,
2425 env => black ,
2426 argument => black ,
2427 meta => black!80 ,
2428 cnltx => cnltxformalblue ,
2429 cnltxbg => white ,
2430 link => black!90 ,
2431 versionnote => black!75 ,
2432 bibentry => black ,
2433 bibentryfield => black ,
2434 expandable => red ,
2435 unexpandable => black ,
2436 makeidxkey => black ,
2437 makeidxstring => black
2438 }
2439 \end{sourcecode}
2440
2441 \section{Language Support}\label{sec:language-support}
2442 \noindent\sinceversion{0.2}The \cnltxdoc, the \cnltxexample\ and the
2443 \cnltxtools\ package as well as the \code{cnltx.ist} index style and the
2444 \code{cnltx} \pkg{biblatex} style all rely on the \pkg{translations}
2445 package~\cite{pkg:translations} for providing some document language dependent
2446 strings\footnote{Actually they depend on \cnltxtranslations\ which in turn
2447 loads \pkg{translations}.}. Currently only translations for English and
2448 German are provided. Others can be added and the existing ones changed with
2449 the following commands provided by the \pkg{translations} package:
2450
2451 \begin{commands}
2452 \command{DeclareTranslation}[\marg{language}\marg{keyword}\marg{translation}]
2453 Define or redefine translations for the string identified by the
2454 \textsc{id} \meta{keyword}.
2455 \command{RenewTranslation}[\marg{language}\marg{keyword}\marg{translation}]
2456 Renew translations for the string identified by the \textsc{id}
2457 \meta{keyword}.
2458 \end{commands}
2459
2460 The strings defined by \cnltx\ are listed in
2461 table~\vref{tab:language:strings}. They are used in indexing strings and in
2462 different parts of the document.
2463
2464 \begin{table}
2465 \centering\renewcommand\arraystretch{1.3}
2466 \caption{Overview over available internationalization key words.}
2467 \label{tab:language:strings}
2468 \begin{tabular}{
2469 l
2470 >{\ttfamily}l
2471 >{\RaggedRight}p{.25\linewidth}
2472 >{\RaggedRight}p{.25\linewidth}
2473 }
2474 \toprule
2475 Package/Class & key word & English version & German version\\
2476 \midrule
2477 \cnltxexample & cnltx-package &
2478 \GetTranslation{cnltx-package} &
2479 \GetTranslationFor{German}{cnltx-package} \\
2480 \cnltxexample & cnltx-class &
2481 \GetTranslation{cnltx-class} &
2482 \GetTranslationFor{German}{cnltx-class} \\
2483 \cnltxexample & cnltx-bundle &
2484 \GetTranslation{cnltx-bundle} &
2485 \GetTranslationFor{German}{cnltx-bundle} \\
2486 \cnltxexample & cnltx-environment &
2487 \GetTranslation{cnltx-environment} &
2488 \GetTranslationFor{German}{cnltx-environment} \\
2489 \cnltxdoc & cnltx-default &
2490 \GetTranslation{cnltx-default} &
2491 \GetTranslationFor{German}{cnltx-default} \\
2492 \cnltxdoc & cnltx-empty &
2493 \GetTranslation{cnltx-empty} &
2494 \GetTranslationFor{German}{cnltx-empty} \\
2495 \cnltxdoc & cnltx-required &
2496 \GetTranslation{cnltx-required} &
2497 \GetTranslationFor{German}{cnltx-required} \\
2498 \cnltxdoc & cnltx-toc &
2499 \GetTranslation{cnltx-toc} &
2500 \GetTranslationFor{German}{cnltx-toc} \\
2501 \cnltxdoc & cnltx-license &
2502 \GetTranslation{cnltx-license} &
2503 \GetTranslationFor{German}{cnltx-license}\\
2504 \cnltxdoc & cnltx-introduced &
2505 \GetTranslation{cnltx-introduced} &
2506 \GetTranslationFor{German}{cnltx-introduced} \\
2507 \cnltxdoc & cnltx-changed &
2508 \GetTranslation{cnltx-changed} &
2509 \GetTranslationFor{German}{cnltx-changed} \\
2510 \cnltxdoc & cnltx-f. &
2511 \GetTranslation{cnltx-f.} &
2512 \GetTranslationFor{German}{cnltx-f.} \\
2513 \cnltxdoc & cnltx-ff. &
2514 \GetTranslation{cnltx-ff.} &
2515 \GetTranslationFor{German}{cnltx-ff.} \\
2516 \cnltxdoc & cnltx-maintainer &
2517 \GetTranslation{cnltx-maintainer} &
2518 \GetTranslationFor{German}{cnltx-maintainer} \\
2519 \cnltxdoc & cnltx-maintainers &
2520 \GetTranslation{cnltx-maintainers} &
2521 \GetTranslationFor{German}{cnltx-maintainers} \\
2522 \cnltxtools & cnltx-i.e. &
2523 \GetTranslation{cnltx-i.e.} &
2524 \GetTranslationFor{German}{cnltx-i.e.} \\
2525 \cnltxtools & cnltx-e.g. &
2526 \GetTranslation{cnltx-e.g.} &
2527 \GetTranslationFor{German}{cnltx-e.g.} \\
2528 \cnltxtools & cnltx-cf. &
2529 \GetTranslation{cnltx-cf.} &
2530 \GetTranslationFor{German}{cnltx-cf.} \\
2531 \cnltxtools & cnltx-etc. &
2532 \GetTranslation{cnltx-etc.} &
2533 \GetTranslationFor{German}{cnltx-etc.} \\
2534 \bottomrule
2535 \end{tabular}
2536 \end{table}
2537
2538 \part{Appendix}
2539 \appendix
2540
2541 \section{Internal Helper Commands}
2542
2543 The commands in this section are only described for the sake of completeness.
2544 They are not meant to be used in a document. Some of them might be useful in
2545 \LaTeX\ programming, though. Expandable commands are marked with
2546 \textcolor{expandable}{\expandablesign}.
2547
2548 \subsection{Defined by \cnltxbase}\label{sec:defined-cnltxbase}
2549
2550 Especially \cnltxbase\ defines some useful helper macros that are also used by
2551 the other packages and classes.
2552
2553 \subsubsection{Related to the Bundle}\label{sec:related-bundle}
2554
2555 \begin{commands}
2556 \expandable\command{cnltx\at\at date}
2557 The creation date of the current version of the bundle.
2558 \expandable\command{cnltx\at\at version}
2559 The version number of the bundle.
2560 \expandable\command{cnltx\at\at info}
2561 The short description of the bundle.
2562 \command{cnltx\at create\at bundle\at message}%
2563 [\sarg\marg{module}\Marg{\choices{Error,Warning,WarningNoLine,Info}}]
2564 \sinceversion{0.7}Create suiting error and warning messaging commands
2565 for the module \meta{module} of the \cnltx\ bundle. The starred version
2566 creates messages for a class the un-starred version messages for a
2567 package.
2568 \command{cnltx\at base\at error}[\marg{message}]
2569 Issue an error message using \cs*{PackageError}\Marg{cnltx-base}.
2570 \command{cnltx\at base\at warning}[\marg{message}]
2571 Issue a warning message using \cs*{PackageWarning}\Marg{cnltx-base}.
2572 \command{cnltx\at base\at warningnoline}[\marg{message}]
2573 Issue a warning message using \cs*{PackageWarningNoLine}\Marg{cnltx-base}.
2574 \command{cnltx\at base\at info}[\marg{message}]
2575 Issue a message using \cs*{PackageInfo}\Marg{cnltx-base}.
2576 \command{cnltx\at define\at colorscheme}[\marg{name}\marg{scheme definition}]
2577 Command that can be used to define a color scheme.
2578 \command{cnltx\at load\at module}[\marg{\cnltx\ module}]
2579 \sinceversion{0.11}Loads the package \code{cnltx-\meta{\cnltx\
2580 module}.sty}.
2581 \command{cnltx\at load\at modules}[\marg{\cnltx\ modules}]
2582 \sinceversion{0.11}Maps the comma separated list \meta{\cnltx\ modules} to
2583 \cs{cnltx\at load\at module}, leading and trailing spaces are trimmed.
2584 \end{commands}
2585
2586 \subsubsection{Programming Tools}
2587 \paragraph{Message Handling}
2588 \begin{commands}
2589 \command{cnltx\at create\at message}%
2590 [\sarg\marg{prefix}\marg{package/class
2591 name}\Marg{\choices{Error,Warning,WarningNoLine,Info}} \marg{detailed
2592 error message}]
2593 \changedversion{0.7}Create error and warning messaging commands
2594 \cs*{\meta{prefix}@\choices{error,warning,warningnoline,info}}\marg{message}.
2595 The starred version creates messages for a class the un-starred version
2596 messages for a package. All commands have one argument which takes the
2597 message. \meta{prefix} will be all lowercase in the generated command.
2598 \command{cnltx\at create\at generic\at message}%
2599 [\sarg\marg{prefix}\marg{package/class
2600 name}\Marg{\choices{Error,Warning,WarningNoLine,Info}}]
2601 \sinceversion{0.7}Create error and warning messaging commands
2602 \cs*{\meta{prefix}@\choices{error,warning,warningnoline,info}}\marg{message}.
2603 The starred version creates messages for a class the un-starred version
2604 messages for a package. All commands have one argument which takes the
2605 message \emph{except for the error command which gets two arguments}, the
2606 first for the short version and the second for the detailed message.
2607 \meta{prefix} will be all lowercase in the generated command.
2608 \end{commands}
2609
2610 \paragraph{Conditionals}
2611 \begin{commands}
2612 \expandable\command{iftest}[\marg{test directive}\marg{true}\marg{false}]
2613 \sinceversion{0.7}Checks if \meta{test directive} is true and either
2614 places \meta{true} or \meta{false} in the input stream. \meta{test
2615 directive} should be a \TeX\ test like
2616 \cs*{ifx}\meta{token1}\meta{token2}, \ie, demand an \cs*{else} and
2617 \cs*{fi}.\\
2618 This is a command in the spirit of \pkg{etoolbox}'s \cs*{ifbool} that does
2619 the same for a boolean \meta{bool} defined with
2620 \cs*{newif}\cs*{if\meta{bool}} or \cs*{newbool}\marg{bool}. It
2621 corresponds to \pkg{etoolbox}'s \code{test} directive for its
2622 \cs*{ifboolexpr}.
2623 \expandable\command{nottest}[\marg{test directive}\marg{not true}\marg{not false}]
2624 \sinceversion{0.7}Checks if \meta{test directive} is not true and either
2625 places \meta{not true} or \meta{not false} in the input stream. Test
2626 directive should be a \TeX\ test like
2627 \cs*{ifx}\meta{token1}\meta{token2}, \ie, demand an \cs*{else} and
2628 \cs*{fi}.\\
2629 This is a command in the spirit of \pkg{etoolbox}'s \cs*{notbool} that does
2630 the same for a boolean \meta{bool} defined with
2631 \cs*{newif}\cs*{if\meta{bool}} or \cs*{newbool}\marg{bool}.
2632 \expandable\command{cnltx\at ifcounter}[\marg{counter}\marg{true}%
2633 \marg{false}]
2634 \sinceversion{0.11}Checks if \meta{counter} is a counter, \ie, if the
2635 control sequence names \cs*{c@\meta{counter}}, \cs*{cl@\meta{counter}},
2636 \cs*{p@\meta{counter}} \emph{and} \cs*{the\meta{counter}} exist and either
2637 leaves \meta{true} or \meta{false} in the input stream.
2638 \command{cnltx\at ifnextchars}[\marg{list of
2639 tokens}\marg{true}\marg{false}\meta{trailing token}]
2640 \sinceversion{0.8}Tests if \meta{trailing token} is any of those in
2641 \meta{list of tokens} and either places \meta{true} or \meta{false} in the
2642 input stream without removing \meta{trailing token}.
2643 \command{cnltx\at ifsym}[\marg{token}\marg{true}\marg{false}]
2644 A generic version of \LaTeX's \cs*{@ifstar} that checks if \meta{token}
2645 follows in the input stream. If yes it is removed and \meta{true} is
2646 placed in the input stream else \meta{false}.
2647 \command{cnltx\at ifdash}[\marg{true}\marg{false}]
2648 A wrapper for \verbcode+\cnltx@ifsym{-}+.
2649 \command{cnltx\at ifbang}[\marg{true}\marg{false}]
2650 \sinceversion{0.3}A wrapper for \verbcode+\cnltx@ifsym{!}+.
2651 \expandable\command{cnltx\at ifisnum}[\marg{token list}\marg{true}\marg{false}]
2652 \sinceversion{0.6}Checks if \meta{token list} is an integer zero or
2653 greater and leaves \meta{true} in the input stream if it is and
2654 \meta{false} if it isn't. There is one hopefully extremely unlikely case
2655 where the test fails: when \meta{token list} starts with
2656 ``\code{\meta{integer}\%}'' where \code{\%} has a category code different
2657 than 9 (ignored) or 14 (comment).
2658 \expandable\command{cnltx\at ifshellescape}[\marg{true}\marg{false}]
2659 \sinceversion{0.9}Checks if shellescape is enabled. It returns true if
2660 \pkg{pdftexcmds}' \cs*{pdf@shellescape} has the value~\code{1}. This is a
2661 wrapper for \verbcode+\iftest{\ifnum\pdf@shellescape=1 }+.
2662 \command{cnltx\at if\at in}[\marg{tokenlist}\marg{search}\marg{true}\marg{false}]
2663 Places \meta{true} in the input stream if \meta{search} is found in
2664 \meta{tokenlist} and \meta{false} if it isn't.
2665 \expandable\command{cnltx\at ifstrequal}[\marg{string1}\marg{string2}%
2666 \marg{true}\marg{false}]
2667 \sinceversion{0.10}Tests if \meta{string1} is equal to \meta{string2} and
2668 either leaves \meta{true} or \meta{false} in the input stream. This test
2669 doesn't take category codes into account.
2670 \command{cnltx\at ifinlist}%
2671 [\marg{item}\marg{listmacro}\marg{true}\marg{false}]
2672 \sinceversion{0.10}A conditional for \pkg{etoolbox} lists similar to
2673 \cs*{ifinlist} where braces in items are allowed. This wraps around the
2674 proposal in \pkg{etoolbox}'s documentation to redefine \cs*{do} and loop
2675 through the list.
2676 \command{cnltx\at ifinlistcs}%
2677 [\marg{item}\marg{listcsname}\marg{true}\marg{false}]
2678 \sinceversion{0.10}A conditional for \pkg{etoolbox} lists similar to
2679 \cs*{ifinlistcs} where braces in items are allowed. This wraps around the
2680 proposal in \pkg{etoolbox}'s documentation to redefine \cs*{do} and loop
2681 through the list.
2682 \end{commands}
2683
2684 \paragraph{Expansion Tools}
2685 \begin{commands}
2686 \command{expandtwice}[\marg{code}]
2687 \sinceversion{0.10}Expands \meta{code} twice in an \cs*{edef}-like
2688 context. This is a wrapper for\newline
2689 \cs*{unexpanded}\cs*{expandafter}\cs*{expandafter}\cs*{expandafter}.
2690 \command{cnltx\at expandargs}[\darg{specs}\meta{control sequence}]
2691 \sinceversion{0.7}This is a \LaTeXe\ version of expl3's
2692 \cs*{exp\_args:N}\meta{specs}. The command expands the arguments of
2693 \meta{control sequence} according to \meta{specs}. In \meta{specs}
2694 \begin{itemize}
2695 \item \code{N} means unexpanded token,
2696 \item \code{n} means unexpanded braced group,
2697 \item \code{c} means braced group converted into a control sequence
2698 name,
2699 \item \code{o} means braced group expanded once,
2700 \item \code{f} means braced group expanded with \cs*{romannumeral}, and
2701 \item \code{x} means braced group expanded with \cs*{edef}.
2702 \end{itemize}
2703 \end{commands}
2704
2705 \paragraph{Category Code Stuff}
2706 \begin{commands}
2707 \command{cnltx\at save\at catcode}[\marg{token}]
2708 \sinceversion{0.11}Saves the current category code of \meta{token}.
2709 \command{cnltx\at restore\at catcode}[\marg{token}]
2710 \sinceversion{0.11}Restores the category code of \meta{token} as
2711 previously saved with \cs{cnltx\at save\at catcode}.
2712 \command{cnltx\at set\at catcode}[\marg{token}\marg{catcode}]
2713 \sinceversion{0.11}Sets the category code of \meta{token} to
2714 \meta{catcode}. This is a wrapper for \newline
2715 \code{\cs*{catcode}`\meta{token}=\meta{catcode}\cs*{relax}}.
2716 \command{cnltx\at save\at catcodes}[\marg{tokenlist}]
2717 \sinceversion{0.11}Maps \cs{cnltx\at save\at catcode} to all tokens in
2718 \meta{tokenlist}.
2719 \command{cnltx\at restore\at catcodes}[\marg{tokenlist}]
2720 \sinceversion{0.11}Maps \cs{cnltx\at restore\at catcode} to all tokens in
2721 \meta{tokenlist}.
2722 \command{cnltx\at set\at catcodes}[\marg{tokenlist}\marg{catcode}]
2723 \sinceversion{0.11}Maps \cs{cnltx\at set\at catcode} to all tokens in
2724 \meta{tokenlist}, \ie, all tokens get category code \meta{catcode}.
2725 \command{cnltx\at make\at letter}[\marg{token}]
2726 \sinceversion{0.11}A wrapper for \cs{cnltx\at set\at
2727 catcode}\marg{token}\Marg{11}.
2728 \command{cnltx\at make\at other}[\marg{token}]
2729 \sinceversion{0.11}A wrapper for \cs{cnltx\at set\at
2730 catcode}\marg{token}\Marg{12}.
2731 \command{cnltx\at make\at active}[\marg{token}]
2732 \sinceversion{0.11}A wrapper for \cs{cnltx\at set\at
2733 catcode}\marg{token}\Marg{13}.
2734 \end{commands}
2735
2736 \paragraph{Token List Manipulation}
2737 \begin{commands}
2738 \command{cnltx\at replace\at once}[\marg{cs}\marg{search}\marg{replace}]
2739 Replaces the first occurence of \meta{search} in the first expansion of
2740 \meta{cs} with \meta{replace}.
2741 \command{cnltx\at greplace\at once}[\marg{cs}\marg{search}\marg{replace}]
2742 \sinceversion{0.9}The same as \cs{cnltx\at replace\at once} but acts
2743 globally.
2744 \command{cnltx\at replace\at all}[\marg{cs}\marg{search}\marg{replace}]
2745 Replaces all occurences of \meta{search} in the first expansion of
2746 \meta{cs} with \meta{replace}.
2747 \command{cnltx\at greplace\at all}[\marg{cs}\marg{search}\marg{replace}]
2748 \sinceversion{0.9}The same as \cs{cnltx\at replace\at all} but acts
2749 globally.
2750 \command{cnltx\at remove\at once}[\marg{cs}\marg{search}]
2751 \sinceversion{0.3}Removes the first occurence of \meta{search} in the
2752 first expansion of \meta{cs}.
2753 \command{cnltx\at gremove\at once}[\marg{cs}\marg{search}]
2754 \sinceversion{0.9}The same as \cs{cnltx\at remove\at once} but acts
2755 globally.
2756 \command{cnltx\at remove\at all}[\marg{cs}\marg{search}]
2757 \sinceversion{0.3}Removes all occurences of \meta{search} in the first
2758 expansion of \meta{cs}.
2759 \command{cnltx\at gremove\at all}[\marg{cs}\marg{search}]
2760 \sinceversion{0.9}The same as \cs{cnltx\at remove\at all} but acts
2761 globally.
2762 \end{commands}
2763
2764 \paragraph{Miscellaneous}
2765 \begin{commands}
2766 \expandable\command{cnltx\at par}
2767 Expands to \cs*{par}. Sometimes you need to smuggle a \cs*{par} in a
2768 short macro \ldots
2769 \expandable\command{cnltx\at stripbs}
2770 A shortcut for \verbcode+\expandafter\@gobble\string+.
2771 \command{cnltxat}
2772 Robust command that typesets `\at' with category code 11. An @ in command
2773 names confuses the indexing of the command names. Either one uses another
2774 symbol for makeindex's ``actual'' recognition and also tells
2775 \pkg{idxcmds}~\cite{pkg:idxcmds} about it or one uses \cs{cnltxat} in
2776 \cs{cs} and friends. For the sake of convenience you can define a command
2777 like \cs*{at} that expands to it\footnote{This is important. If you
2778 \cs*{let} it to \cs{cnltxat} index entries may be sorted differently!
2779 Remember: \cs{cnltxat} is robust.}. In order not to overwrite any such
2780 existing macro it is not defined by \cnltxexample. This document for
2781 example defines \verbcode+\def\at{\cnltxat}+.
2782 \command{cnltxletterat}
2783 An alias of \cs{cnltxat}.
2784 \command{cnltxotherat}
2785 The same as \cs{cnltxat} but with a `\at' with category code 12.
2786 \command{cnltxbang}
2787 The same as \cs{cnltxotherat} except that it contains a `\bang'.
2788 \command{cnltxequal}
2789 The same as \cs{cnltxotherat} except that it contains a `\equal'.
2790 \end{commands}
2791
2792 \subsection{Defined by \cnltxdoc}
2793 \begin{commands}
2794 \command{cnltx\at doc\at error}[\marg{message}]
2795 Issue an error message using \cs*{ClassError}\Marg{cnltx-doc}.
2796 \command{cnltx\at doc\at warning}[\marg{message}]
2797 Issue a warning message using \cs*{ClassWarning}\Marg{cnltx-doc}.
2798 \command{cnltx\at doc\at warningnoline}[\marg{message}]
2799 Issue a warning message using \cs*{ClassWarningNoLine}\Marg{cnltx-doc}.
2800 \command{cnltx\at doc\at info}[\marg{message}]
2801 Issue a message using \cs*{ClassInfo}\Marg{cnltx-doc}.
2802 \command{cnltx\at getfileinfo}[\marg{file name}\marg{file extension}]
2803 Extract the date, version and background information for a package or a
2804 class and defines \cs{cnltx\at package\at date}, \cs{cnltx\at package\at
2805 version} and \cs{cnltx\at package\at info} to contain the extracted
2806 data.
2807 \command{cnltx\at version\at note}[\marg{note}]
2808 Command that is used for the versioning notes interally. Sets
2809 \cs*{reversemarginpar} and then writes the note \meta{note} to the margin
2810 with corresponding formatting.
2811 \end{commands}
2812 \begin{environments}
2813 \environment{cnltxlist}
2814 The list environment that is used by the environments \env{commands},
2815 \env{options} and \env{environments}.
2816 \end{environments}
2817
2818 \subsection{Defined by \cnltxexample}
2819 \begin{commands}
2820 \command{cnltx\at example\at error}[\marg{message}]
2821 Issue an error message using \cs*{PackageError}\Marg{cnltx-example}.
2822 \command{cnltx\at example\at warning}[\marg{message}]
2823 Issue a warning message using \cs*{PackageWarning}\Marg{cnltx-example}.
2824 \command{cnltx\at example\at warningnoline}[\marg{message}]
2825 Issue a warning message using \cs*{PackageWarningNoLine}\Marg{cnltx-example}.
2826 \command{cnltx\at example\at info}[\marg{message}]
2827 Issue a message using \cs*{PackageInfo}\Marg{cnltx-example}.
2828 \command{cnltx\at isvalue}
2829 Used in definitions of the key/value option typesetting commands. Inserts
2830 a \code{=} with some stretchable space around and a legal break-point
2831 after it.
2832 \command{indexcs}
2833 Version of \cs{csidx} that takes care of a \cs*{textcompwordmark} inserted
2834 by listings. Also replaces all occurences of @ with category code 11 or 12
2835 with \cs{cnltxat}. Used to index commands in the \env{sourcecode} and
2836 \env{example} environments that have been added with \option{add-cmds}.
2837 \command{indexenv}
2838 \sinceversion{0.7a}Version of \cs{envidx} that takes care of a
2839 \cs*{textcompwordmark} inserted by listings. Also replaces all occurences
2840 of @ with category code 11 or 12 with \cs{cnltxat}. Used to index
2841 environments in the \env{sourcecode} and \env{example} environments that
2842 have been added with \option{add-envs}.
2843 \command{cnltx\at treat\at lst\at index}[\marg{new index cs}\marg{internal
2844 index cs}]
2845 \sinceversion{0.7a}This command was used to define \cs{indexcs} and
2846 \cs{indexenv}:\\
2847 \verbcode+\cnltx@treat@lst@index{\indexcs}{\csidx}+
2848 \command{MakePercentComment}
2849 Sets the category code of \code{\%} to 14.
2850 \command{cnltx\at copyablespace}
2851 Prints a space that is also copyable. Uses the \pkg{accsupp} package by
2852 \oberdiek~\cite{pkg:accsupp}.
2853 \command{cnltx\at mdframed\at options}
2854 Predefined option list for the \pkg{mdframed}~\cite{pkg:mdframed} style
2855 \code{cnltx}.
2856 \command{cnltx\at listings\at style}
2857 Predefined option list for the \pkg{listings}~\cite{pkg:listings} style
2858 \code{cnltx}.
2859 \end{commands}
2860
2861 \subsection{Defined by \cnltxlistings}
2862 \begin{commands}
2863 \command{cnltx\at listings\at error}[\marg{message}]
2864 Issue an error message using \cs*{PackageError}\Marg{cnltx-listings}.
2865 \command{cnltx\at listings\at warning}[\marg{message}]
2866 Issue a warning message using \cs*{PackageWarning}\Marg{cnltx-listings}.
2867 \command{cnltx\at listings\at warningnoline}[\marg{message}]
2868 Issue a warning message using \cs*{PackageWarningNoLine}\Marg{cnltx-listings}.
2869 \command{cnltx\at listings\at info}[\marg{message}]
2870 Issue a message using \cs*{PackageInfo}\Marg{cnltx-listings}.
2871 \command{cnltx\at predefined\at control\at sequences}
2872 A comma-separated list of predefined `silent' control sequence names.
2873 \command{cnltx\at predefined\at environments}
2874 A comma-separated list of predefined `silent' environment names.
2875 \command{listsilentcmds}
2876 Prints all known control sequence names formatted and separated with the
2877 separator set with \option{list-sep}. Requires \cnltxexample.
2878 \command{listsilentenvs}
2879 Prints all known environment names formatted and separated with the
2880 separator set with \option{list-sep}. Requires \cnltxexample.
2881 \command{listbibfilekeys}[\marg{file name}]
2882 \sinceversion{0.7}Prints all cite keys contained in the bibliography file
2883 \meta{file name} formatted with \cs{code} and separated with the
2884 separator set with \option{list-sep}. Requires \cnltxexample.
2885 \command{listbibfiletypes}[\marg{file name}]
2886 \sinceversion{0.7}Prints all citation types contained in the bibliography
2887 file \meta{file name} formatted with \cs{code} and separated with the
2888 separator set with \option{list-sep}. Requires \cnltxexample.
2889 \command{listbibfileentries}[\marg{file name}]
2890 \sinceversion{0.7}Prints all cite keys contained in the bibliography file
2891 \meta{file name} formatted with \cs{code} and gives their respective
2892 entry types, separated with the separator set with \option{list-sep}.
2893 Requires \cnltxexample.
2894 \end{commands}
2895 \begin{options}
2896 \keyval{list-sep}{separator}\Default{,\cs*{space}}
2897 Sets the separator for \cnltxlistings' commands listing the different
2898 commands \etc.
2899 \end{options}
2900
2901 \subsection{Defined by \cnltxtools}
2902 \begin{commands}
2903 \command{cnltx\at tools\at error}[\marg{message}]
2904 Issue an error message using \cs*{PackageError}\Marg{cnltx-tools}.
2905 \command{cnltx\at tools\at warning}[\marg{message}]
2906 Issue a warning message using \cs*{PackageWarning}\Marg{cnltx-tools}.
2907 \command{cnltx\at tools\at warningnoline}[\marg{message}]
2908 Issue a warning message using \cs*{PackageWarningNoLine}\Marg{cnltx-tools}.
2909 \command{cnltx\at tools\at info}[\marg{message}]
2910 Issue a message using \cs*{PackageInfo}\Marg{cnltx-tools}.
2911 \command{cnltx\at accsupp}[\marg{actual text}\marg{additional
2912 options}\marg{\TeX\ text}]
2913 A wrapper for package \pkg{accsupp}'s\newline
2914 \cs*{BeginAccSupp}\Marg{ActualText = \meta{actual text}}\meta{\TeX\ text}%
2915 \cs*{EndAccSupp}\marg{}.
2916 \end{commands}
2917
2918 \section{List of Known \LaTeX\ Control Sequences}\label{sec:known:csnames}
2919
2920 Below all \emph{predefined} control sequence names are listed that are treated
2921 as ``silent'' names by \cnltx, that is, those defined by \cnltxlistings.
2922
2923 \begin{multicols}{3}\small
2924 \RaggedRight\listsilentcmds
2925 \end{multicols}
2926
2927 \section{List of Known \LaTeX\ Environments}\label{sec:known:environments}
2928
2929 Below all \emph{predefined} environment names are listed that are treated as
2930 ``silent'' names by \cnltx, that is, those defined by \cnltxlistings.
2931
2932 \begin{multicols}{3}\small
2933 \RaggedRight\listsilentenvs
2934 \end{multicols}
2935
2936 \section{List of Entries in \code{cnltx.bib}}\label{sec:list-entr-bib}
2937 Most entries in \code{cnltx.bib} are entries of the \code{@package} type.
2938 The cite keys that the file currently contains are listed below. This list is
2939 very likely to be extended significantly in the future.
2940
2941 \setcnltx{list-sep={,\par}}
2942 \begin{multicols}{3}\small
2943 \RaggedRight\listbibfileentries{cnltx.bib}
2944 \end{multicols}
2945
2946 \end{document}