Debian Codegraph @

texmf-dist/doc/latex/codedescribe/codedescribe.tex

raw
1 %%%==============================================================================
2 % WinEdt pragmas
3 % !Mode:: "TeX:EN"
4 % Default Compile engines:
5 % !TEX program = pdflatex
6 % !PDFTeXify ext = --enable-etex --enable-write18
7 % !PDFLaTeX ext = --enable-etex --enable-write18
8 % !BIB program = biber
9 % !IND exe = xindex.exe
10 %%%==============================================================================
11 %% Copyright 2023-present by Alceu Frigeri
12 %%
13 %% This work may be distributed and/or modified under the conditions of
14 %%
15 %% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
16 %% version 1.3c (or later), and/or
17 %% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html),
18 %% version 3 (or later)
19 %%
20 %% This work has the LPPL maintenance status *maintained*.
21 %%
22 %% The Current Maintainer of this work is Alceu Frigeri
23 %%
24 %% This is version {1.24c} {2026/05/24}
25 %%
26 %% The list of files that compose this work can be found in the README.md file at
27 %% https://ctan.org/pkg/codedescribe
28 %%
29 %%%==============================================================================
30 \documentclass{article}
31 \RequirePackage[verbose,a4paper,marginparwidth=28mm,top=3cm,bottom=1.5cm,hmargin={45mm,25mm},marginparsep=2.5mm,columnsep=10mm,asymmetric]{geometry}
32 \usepackage[T1]{fontenc}
33 \usepackage[utf8]{inputenc}
34 \usepackage{lmodern}
35 %\usepackage[strict,infograb,codelisting={load xtra dialects,TeX dialects={doctools,l3kernelsign, l3expsign, l3amssign, l3pgfsign, l3bibtexsign,
36 % l3kernel, l3exp, l3ams, l3pgf, l3bibtex, kernel, xpacks, ams, pgf, pgfplots,
37 % bibtex, babel, hyperref},colors=brighter},index,silence,]{codedescribe}
38 %\usepackage[strict,infograb,silence,colors=darker,listing colors=darker]{codedescribe}
39 \usepackage[strict,infograb,silence]{codedescribe}
40 \RequirePackage[inline]{enumitem}
41 \SetEnumitemKey{midsep}
42 {parsep=0ex,itemsep=0.4ex}
43
44 \RequirePackage[backend=biber]{biblatex}
45 \addbibresource{codedescribe.bib}
46
47 %\ExplSyntaxOn
48 %\benchmark_tic:
49 %\ExplSyntaxOff
50
51 %\usepackage{xindex}
52 %\makeindex
53
54 %\defgroupfmt{code}{color=red,font=\sffamily}
55 %%
56 %\defgroupfmt{code}{color=brown,font=\ttfamily}
57
58 \RequirePackage[hidelinks,hypertexnames=false]{hyperref}
59 \begin{document}
60
61 %\tsOn
62
63 \newcodekey{codedesc}{
64 texcs={printindex},
65 texcs=[2]{defgroupfmt,defobjectfmt,tsmacro,tsobj,setcodelabels,newlabelset,selectlabelset},
66 emph={lbracket,rbracket,stmeta},
67 emph=[2]{tscode,tsdemo,new,update,note,env,and,or,months,remark},
68 keywd=[2]{oarg,arg,parg,xarg,meta,color},
69 keywd={codedescribe,codesyntax,codestore,tsremark},
70 }
71
72
73 %%% TO BE DETERMINED !! \parindent
74 %%%\setlength\parindent{0pt}
75
76 \tstitle{
77 author={Alceu Frigeri\footnote{\tsfmt{\url{https://github.com/alceu-frigeri/codedescribe}}}},
78 date={\tsdate},
79 title={The codedescribe and codelisting Packages\break Version \PkgInfo{codedescribe}{version}}
80 }
81
82 \begin{typesetabstract}
83
84 This package is designed to be as class independent as possible, depending only on \tsobj[pkg]{expl,scontents,listings,xpeekahead,pifont,xcolor}. A minimal set of macros/commands/environments is defined: most/all defined commands have an ``object type'' as a \tsobj[key,no index]{keyval} parameter, allowing for an easy expansion mechanism (instead of the usual ``one set of macros/environments'' for each object type).
85
86 No assumption is made about page layout (besides ``having a margin paragraph''), or underlying macros, so it should be possible to use this with any/most document classes.
87
88 \end{typesetabstract}
89
90 \tableofcontents
91
92 \section{Introduction}
93
94
95 This package aims at documenting both document level and package/class level commands. It's fully implemented using \tsobj[pkg]{expl}, requiring just an up to date kernel. \tsobj[pkg]{scontents,listings} packages (see \cite{SCONTENTS} and \cite{listings}) are used to typeset code snippets.
96 The package \tsobj[pkg]{pifont} (see \cite{pifont}) is needed just to typeset those (open)stars, in case one wants to mark a command as (restricted) expandable.
97 \tsobj[pkg]{xcolor} (see \cite{xcolor}) is needed to switch colors, and \tsobj[pkg]{xpeekahead} (see \cite{xpeekahead}) for spacing fine tuning. The package \tsobj[pkg]{infograb} (see \cite{pkginfograb}) is loaded for package's documentation only.
98
99
100 No other package/class is needed, and it should be possible to use these packages with most classes\footnote{If, by chance, a class with compatibility issues is found, just open an issue at {\url{https://github.com/alceu-frigeri/codedescribe/issues}} to see what can be done}, which allows to demonstrate document commands with any desired layout.
101
102 Generating an index is supported (since version 1.20, see \ref{indexing} and \ref{obj-types}) but no index package is pre-loaded, leaving it to the end user.
103
104 \tsobj[pkg]{codelisting} defines a few macros to display and demonstrate \LaTeX{} code (using \tsobj[pkg]{listings} and \tsobj[pkg]{scontents}), \tsobj[pkg]{codedescribe} defines a series of macros to display/enumerate macros and environments (somewhat resembling the \tsobj[pkg]{doc3} style), including some shortcuts (active characters, since version 1.23), and \tsobj[pkg]{codelstlang} defines a series of \tsobj[pkg]{listings} \TeX{} dialects.
105
106 These packages are fairly stable, and given the \tsobj[meta]{obj-type} mechanism (see \ref{obj-type-def}) they can be easily extended without changing their interface.
107
108 \subsection{Single versus Multi-column Classes}
109 This package ``can'' be used with multi-column classes, given that the \tsobj[code,no index]{\linewidth,\columnsep} are defined appropriately. \tsobj[code,no index]{\linewidth} shall defaults to text/column real width, whilst \tsobj[code,no index]{\columnsep}, if needed (2 or more columns), shall be greater than \tsobj[code,no index,sep = plus]{\marginparwidth,\marginparsep}.
110
111 \newpage
112 \section{codelisting Package}
113
114 It loads: \tsobj[pkg]{listings,scontents,xpeekahead}, defines an environment: \tsobj[env,no index]{codestore} and a few commands for listing and demonstration of \LaTeX{} code.
115
116 \subsection{Package Options}\label{codelist.pack-options}
117 The following options can also be set via \tsobj[pkg]{codedescribe} package options, see \ref{codedesc.pack-options}.
118 \begin{describelist}{option}
119 \describe{strict}{Package Warnings will be reported as Package Errors.}
120 \describe{suppress deprecated}{Suppress the messages associated with deprecated commands/keys.}
121 \describe{colors}{Possible values: \tsobj[option]{black,default,brighter, darker}. This will adjust the initial color configuration for the many listings' elements (used by \tsobj[code,no index]{\tscode,\tsdemo}). \tsobj[option]{black} will defaults all colors to black. \tsobj[option]{default, brighter, darker} are roughly the same color scheme. The \tsobj[option]{default} scheme is the one used in this document. With \tsobj[option]{brighter} the colors are brighter than the default, and with \tsobj[option]{darker} the colors will be darker, but not black.}
122 %\describe{colors}{This is just an alias for \tsobj[option]{listing colors}}
123 \describe{load xtra dialects}{(defaults to false) If set, it will load the auxiliary package \tsobj[pkg]{codelstlang} (see \ref{lstlang.pack}), which just defines a series of \tsobj[pkg]{listings} TeX dialects. }
124 \describe{TeX dialects}{This will set which \tsobj[pkg]{listings} TeX dialects will be used when defining the listing style \tsobj[option]{codestyle}. It defaults to \tsobj[option]{doctools}, which is derived from the [LaTeX]TeX dialect (this contains the same set of commands used by the package \tsobj[pkg]{doctools}). One can use any valid (\TeX{} derived) \tsobj[pkg]{listings} dialect, including user defined ones, see \cite{listings} for details.
125
126 Besides those, one can use (if the \tsobj[option]{load xtra dialects} is set):
127 \tsobj[values]{l3kernelsign, l3expsign, l3amssign, l3pgfsign, l3bibtexsign, l3kernel, l3exp, l3ams, l3pgf, l3bibtex, kernel, xpacks, ams, pgf, pgfplots, bibtex, babel, hyperref }. See \ref{lstlang.pack} for details on those dialects.
128 }
129 \begin{tsremark}
130 \tsobj[option]{TeX dialects} is a comma separated list of the dialect's name, without the base language (internally it will be converted to \tsverb[key]{[dialect]TeX}).
131 \end{tsremark}
132 % not sure about that...(not implemented)
133 %\begin{tsremark}
134 % If the package \tsobj[pkg]{fancyvrb} is detected at load time, the \tsobj[pkg]{listings} interface for it will be automatically activated.
135 %\end{tsremark}
136
137
138 \end{describelist}
139 For example:
140 \begin{codestore}[demo.dialect]
141 %% could be \usepackage[...]{codelisting}
142 \usepackage[load xtra dialects,
143 TeX dialects={doctools,l3kernel,l3ams}]{codedescribe}
144 %%
145 %% assuming the user has defined a dialect, named: [my-own-set]TeX
146 %%
147 \usepackage[TeX dialects={doctools,my-own-set}]{codedescribe}
148 %%
149 \end{codestore}
150 %
151 \tscode*[codeprefix=~,codedesc]{demo.dialect}
152
153
154 \subsection{In Memory Code Storage}
155 Thanks to \tsobj[pkg]{scontents}, it's possible to store \LaTeX{} code snippets in an \tsobj[pkg]{expl} sequence variable.
156
157
158 \begin{codestore}[store-colon]
159 %The code will be stored as 'store:A'
160 \begin{codestore}[store-env = store:A]
161 ...
162 \end{codestore}
163
164 %Same
165 \begin{codestore}[st = store:A]
166 ...
167 \end{codestore}
168
169 %The code will be stored as 'storeA'
170 \begin{codestore}[storeA]
171 ...
172 \end{codestore}
173
174 %This might raises an error.
175 %It will be stored as 'store' (not as 'store:A')
176 \begin{codestore}[store:A]
177 ...
178 \end{codestore}
179 \end{codestore}
180
181 \begin{codedescribe}[env]{codestore}
182 \begin{codesyntax}
183 \tsmacro{\begin{codestore}}[stcontents-keys]{}
184 \tsmacro{\end{codestore}}{}
185 \end{codesyntax}
186 This environment is an alias to \tsobj[env,no index]{scontents} environment (from \tsobj[pkg]{scontents}, see \cite{SCONTENTS}), all \tsobj[pkg]{scontents} keys are valid, with two additional ones: \tsobj[key]{st,store-at} which are aliases to the \tsobj[key]{store-env} key. If an ``isolated'' \tsobj[key,meta]{st-name} is given (unknown \tsobj[key]{key}), it is assumed that the environment body shall be stored in it (for use with \tsobj[code,no index]{\tscode,\tsmergedcode,\tsdemo,\tsresult,\tsexec}).
187 \end{codedescribe}
188 \begin{tsremark}
189 From \tsobj[pkg]{scontents}, \tsobj[marg]{st-name} is \tsobj[oarg]{index}ed (The code is stored in a sequence variable). It is possible to store as many code snippets as needed under the same name. The first one will be \tsobj[oarg]{index}$\rightarrow 1$, the second $2$, and so on.
190 \end{tsremark}
191 \begin{tsremark}[\color{red}Warning:]
192 If explicitly using one of the \tsobj[key,sep=or]{store-env,st,store-at} keys, the storage name can be anything. BUT, due to changes (August 2025) in the latex kernel keys processing, if an implicity key is used, then colons ( : ), besides a comma and equal signs, aren't allowed.
193 \end{tsremark}
194 \tscode*[codedesc]{store-colon}
195
196
197
198
199 \subsection{Code Display/Demo}\label{codelist}
200
201
202
203 \begin{codedescribe}[code,update=2024/01/06,update=2025/04/29]{\tscode*,\tsdemo*,\tsresult*}
204 \begin{codesyntax}%
205 \tsmacro{\tscode*}[code-keys]{st-name}\tsargs[oarg]{index}
206 \tsmacro{\tsdemo*}[code-keys]{st-name}\tsargs[oarg]{index}
207 \tsmacro{\tsresult*}[code-keys]{st-name}\tsargs[oarg]{index}
208 \end{codesyntax}
209 \tsmacro{\tscode*}{} just typesets \tsobj[meta]{st-name} (created with \tsobj[env]{codestore}) verbatim with syntax highlight (from \tsobj[pkg]{listings} package \cite{listings}). The non-star version centers it and use just half of the base line. The star version uses the full text width.
210
211 \tsmacro{\tsdemo*}{} first typesets \tsobj[meta]{st-name}, as above, then \emph{executes} it. The non-start version place them side-by-side, whilst the star version places one following the other.
212
213 (new 2024/01/06) \tsmacro{\tsresult*}{} only \emph{executes} it. The non-start version centers it and use just half of the base line, whilst the star version uses the full text width.
214 \end{codedescribe}
215
216 \begin{tsremark}
217 (from \tsobj[pkg]{stcontents} package) \tsobj[oarg]{index} can be from $1$ up to the number of stored codes under the same \tsobj[marg]{st-name}. Defaults to $1$.
218 \end{tsremark}
219
220 \begin{tsremark}
221 All are executed in a local group which is discarded at the end. This is to avoid unwanted side effects, but might disrupt code execution that, for instance, depends on local variables being set. That for, see \tsobj{\tsexec} below.
222 \end{tsremark}
223
224 For Example:
225 \begin{codestore}[st=democodestore]
226 \begin{codestore}[stmeta]
227 Some \LaTeX{} coding, for example: \ldots.
228 \end{codestore}
229
230 This will just typesets \tsobj[key,no index]{stmeta}:
231 \tscode*[codeprefix={Sample Code:}] {stmeta}
232
233 and this will demonstrate it, side by side with source code:
234 \tsdemo[numbers=left,firstnumber=5,ruleht=0.5,
235 codeprefix={inner sample code},
236 resultprefix={inner sample result}] {stmeta}
237 \end{codestore}
238
239 \tscode*[codedesc]{democodestore}[1]
240
241 \tsresult*[codedesc]{democodestore}[1]
242
243
244
245 \begin{codedescribe}[code,new=2025/04/29]{\tsmergedcode*}
246 \begin{codesyntax}%
247 \tsmacro{\tsmergedcode*}[code-keys]{st-name-index list}
248 \end{codesyntax}
249 This will typeset (as \tsobj{\tscode}) the merged contents from \tsobj[marg]{st-name-index list}. The list syntax comes from \tsobj[pkg]{scontents} (command \tsobj{\mergesc}), where it is possible to refer to a single index \tsargs[marg]{st-name A}\tsargs[oarg]{index}, a index range \tsargs[marg]{st-name B}\tsargs[oarg]{indexA-indexB}, or all indexes from a \tsobj[marg]{st-name}, \tsargs[marg]{st-name C}\tsargs[oarg]{1-end}. The special index \tsobj[oarg]{1-end} refers to all indexes stored under a given \tsobj[marg]{st-name}.
250 \end{codedescribe}
251 \begin{tsremark}
252 The brackets aren't optional. For instance \tsmacro{\tsmergedcode*}[code-keys]{} {\color{red}\{} \tsargs[marg]{st-name A}\tsargs[oarg]{index} , \tsargs[marg]{st-name B}\tsargs[oarg]{indexA-indexB} , \tsargs[marg]{st-name C}\tsargs[oarg]{1-end} {\color{red}\}}
253 \end{tsremark}
254 \begin{codedescribe}[code,new=2025/04/29]{\tsexec}
255 \begin{codesyntax}%
256 \tsmacro{\tsexec}{st-name}\tsargs[oarg]{index}
257 \end{codesyntax}
258 Unlike the previous commands which are all executed in a local group (discarded at the end) this will execute the code stored at \tsobj[marg]{st-name}\tsargs[oarg]{index} in the current \LaTeX{} group.
259
260 \end{codedescribe}
261
262 \subsubsection{Colors Customization}
263
264 \begin{codedescribe}[code,new=2025/12/14]{\setlistcolorscheme}
265 \begin{codesyntax} %
266 \tsmacro{\setlistcolorscheme}{color-key-list}
267 \end{codesyntax}
268 This allows to customize the default colors used by \tsobj[code,no index]{\tscode,\tsdemo} when typesetting (assuming the default listings's style is being used). Note that the given colors will be mixed with black. The key \tsobj[key]{brightness} set's the mixing proportion. The changes become effective at the point of use.
269 \end{codedescribe}
270 \tsobj[marg]{color-key-list} can be any combination of:
271 \begin{describelist*}{keys}
272 \describe{bckgnd}{(default: black) Sets the background base color. Note this is mixed with white, not black as the others. }
273 \describe{string}{(default: teal) Sets the string base color}
274 \describe{comment}{(default: green) Sets the comment base color}
275 \describe{texcs}{(default: blue) Sets the texcs (\TeX{} commands) base color}
276 \describe{keywd}{(default: cyan) Sets the keywd (keywords) base color}
277 \describe{emph}{(default: red) Sets the emph (emphasis) base color}
278 \describe{rule}{(default: gray) Sets the rule (unused by now) base color. Note this is mixed with white, not black as the others. }
279 \describe{number}{(default: gray) Sets the (small line) numbers base color. Note this is mixed with white, not black as the others. }
280 \describe{brightness}{(default: 1) Sets the mixing proportion between each base color and black.}
281 \describe{scheme}{(Defaults to \tsobj[key]{scheme}=\tsobj[value]{default}) Selects a pre-set color scheme, see below, the default scheme sets all of the above to their default value.}
282
283 \end{describelist*}
284
285 \begin{codedescribe}[code,new=2025/12/14]{\newlistcolorscheme}
286 \begin{codesyntax} %
287 \tsmacro{\newlistcolorscheme}{new-scheme,color-key-list}
288 \end{codesyntax}
289 This creates/defines a \tsobj[marg]{new-scheme} (\tsobj[marg]{color-key-list} as above) which can be later used as \tsobj[code,no index]{\setlistcolorscheme{scheme=new-scheme}}
290 \end{codedescribe}
291
292
293 \subsubsection{Code Keys}\label{code-keys}
294
295
296 \begin{codedescribe}{\setcodekeys}
297 \begin{codesyntax}%
298 \tsmacro{\setcodekeys}{code-keys}
299 \end{codesyntax}
300
301 One has the option to set \tsmeta{code-keys} per \tsobj{\tscode,\tsmergedcode,\tsdemo,\tsresult} call (see \ref{codelist}), or \emph{globally}, better said, \emph{in the called context group} .
302
303 \begin{tsremark}[N.B.:]
304 All \tsobj[code]{\tscode,\tsdemo} commands create a local group in which the \tsmeta{code-keys} are defined, and discarded once said local group is closed. \tsmacro{\setcodekeys}{} defines those keys in the \emph{current} context (which might be global or not, the declarations are always local).
305 \end{tsremark}
306 \end{codedescribe}
307
308 \begin{codedescribe}[code,new=2025/05/01,update=2025/12/23]{\newcodekey}
309 \begin{codesyntax}%
310 \tsmacro{\newcodekey}{new-key,code-keys}
311 \end{codesyntax}
312 This will define a new key \tsobj[marg]{new-key}, which can be used with \tsobj{\tscode,\tsmergedcode,\tsdemo,\tsresult}. \tsobj[marg]{code-keys} can be any of the following ones, including other \tsobj[marg]{new-key}s. Be careful not to create a definition loop.
313 \end{codedescribe}
314 \begin{tsremark}
315 The old \tsobj{\setnewcodekey} is (now) an alias to this, and will raise a warning if called (deprecation).
316 \end{tsremark}
317
318 \begin{codedescribe}[key,new={2025/11/12}]{lststyle}
319 \begin{codesyntax}% Also
320 \tsobj[key]{lststyle} = \tsargs[marg]{listings style}
321 \end{codesyntax}
322 This sets the base style to be used. It defaults to \tsobj[key]{codestyle}, and the user can use this (\tsobj[key]{codestyle}) as the base style for his own one (and avoid having to define every single aspect of it). For example:
323 \end{codedescribe}
324 \begin{codestore}[demo.lststyle]
325 \lstdefinestyle{my-own}{ % see the listings manual for a complete list of keywords
326 style=codestyle,
327 texcsstyle = * {\bfseries\color{red}}
328 }
329
330 \tscode*[lststyle=my-own]{demo-X}
331 \end{codestore}
332 %
333 \tscode*[codeprefix=~,codedesc]{demo.lststyle}
334
335 \begin{codedescribe}[key,update=2025/05/01,update=2025/12/29]{settexcs,texcs,texcsstyle}
336 \begin{codesyntax}% Also
337 \tsobj[key]{settexcs} = \tsargs[oarg]{num}\tsargs[marg]{csv-list}
338 \tsobj[key]{texcs} = \tsargs[oarg]{num}\tsargs[marg]{csv-list}
339 \tsobj[key]{texcsstyle} = \tsargs[oarg]{num}\tsargs[marg]{style}
340 \end{codesyntax}
341 These define sets of \LaTeX{} commands (csnames, sans the preceding slash bar), the \tsobj[key,no index]{settexcs} initialize/redefine those sets (an empty list, clears the set), while \tsobj[key,no index]{texcs} extend those sets. The \tsobj[key,no index]{texcsstyle} redefines the display style. \tsobj[oarg]{num} can be any number, though, currently, only 1 to 8 have a pre-defined style associated with them.
342 \end{codedescribe}
343 \begin{tsremark}
344 The old keys \tsobj[key]{settexcs2,settexcs3,settexcs4,texcs2,texcs3,texcs4,texcs2style,texcs3style,texcs4style} still work, but will raise a warning (deprecation), if used.
345 \end{tsremark}
346
347
348 \begin{codedescribe}[key,update=2025/05/01,update=2025/12/29]{setkeywd,keywd,keywdstyle}
349 \begin{codesyntax} %
350 \tsobj[key]{setkeywd} = \tsargs[oarg]{num}\tsargs[marg]{csv-list}
351 \tsobj[key]{keywd} = \tsargs[oarg]{num}\tsargs[marg]{csv-list}
352 \tsobj[key]{keywdstyle} = \tsargs[oarg]{num}\tsargs[marg]{style}
353 \end{codesyntax}
354 Same for other \emph{keywords} sets.
355 \end{codedescribe}
356 \begin{tsremark}
357 The old keys \tsobj[key]{setkeywd2,setkeywd3,setkeywd4,keywd2,keywd3,keywd4,keywd2style,keywd3style,keywd4style} still work, but will raise a warning (deprecation), if used.
358 \end{tsremark}
359
360
361 \begin{codedescribe}[key,update=2025/05/01,update=2025/12/29]{setemph,emph,emphstyle}
362 \begin{codesyntax} %
363 \tsobj[key]{setemph} = \tsargs[oarg]{num}\tsargs[marg]{csv-list}
364 \tsobj[key]{emph} = \tsargs[oarg]{num}\tsargs[marg]{csv-list}
365 \tsobj[key]{emphstyle} = \tsargs[oarg]{num}\tsargs[marg]{style}
366 \end{codesyntax}
367 for some extra emphasis sets.
368 \end{codedescribe}
369 \begin{tsremark}
370 The old keys \tsobj[key]{setemph2,setemph3,setemph4,emph2,emph3,emph4,emph2style,emph3style,emph4style} still work, but will raise a warning (deprecation), if used.
371 \end{tsremark}
372
373
374 \begin{codedescribe}[key,new=2025/05/13]{letter,other}
375 \begin{codesyntax} %
376 \tsobj[key]{letter} = \tsargs[marg]{csv-list}
377 \tsobj[key]{other} = \tsargs[marg]{csv-list}
378 \end{codesyntax}
379 These allow to redefine what a letter or other are (they correspond to the \tsobj[key,no index]{alsoletter,alsoother} keys from \tsobj[pkg]{listings}). The default value for the \tsobj[key]{letter} includes (sans the comma) \tsobj[verb]{ @ : _ } , whilst \tsobj[key]{other}'s default value is an empty list.
380 \begin{tsremark}
381 You might want to consider setting \tsobj[key]{letter} to just \tsverb[key]{letter={@,_}} so you don't have to list all \tsobj[pkg]{expl} variants of a command, but just the base name of them.
382 \end{tsremark}
383 \end{codedescribe}
384
385 \begin{codedescribe}[key,update=2025/12/16]{numbers,numberstyle,firstnumber}
386 \begin{codesyntax} %
387 \tsobj[key]{numbers} = \tsargs[marg]{none} | \tsargs[marg]{left}
388 \tsobj[key]{numberstyle} = \tsargs[marg]{style}
389 \tsobj[key]{firstnumber} = \tsargs[marg]{num}
390 \end{codesyntax}
391 \tsobj[key]{numbers} possible values are \tsobj[value]{none} (package's default) and \tsobj[value]{left} (key default value, to add tinny numbers to the left of the listing). With \tsobj[key]{numberstyle} one can redefine the numbering style. \tsobj[key]{firstnumber} sets the numbering start, it can be any number, \tsobj[value,or]{last,auto}. It's initialized with \tsobj[value]{last} (see \cite{listings} for details).
392 \end{codedescribe}
393
394 \begin{codedescribe}[key]{stringstyle,commentstyle}
395 \begin{codesyntax} %
396 \tsobj[key]{stringstyle} = \tsargs[marg]{style}
397 \tsobj[key]{commentstyle} = \tsargs[marg]{style}
398 \end{codesyntax}
399 to redefine \tsobj[key]{strings} and \tsobj[key]{comments} formatting style.
400 \end{codedescribe}
401
402 \begin{codedescribe}[key]{bckgndcolor}
403 \begin{codesyntax} %
404 \tsobj[key]{bckgndcolor} = \tsargs[marg]{color}
405 \end{codesyntax}
406 to change the listing background's color.
407 \end{codedescribe}
408
409 \begin{codedescribe}[key]{codeprefix,resultprefix}
410 \begin{codesyntax} %
411 \tsobj[key]{codeprefix} = \tsargs[marg]{string}
412 \tsobj[key]{resultprefix} = \tsargs[marg]{string}
413 \end{codesyntax}
414 those set the \tsobj[key]{codeprefix} (initial value: \LaTeX{} Code:) and \tsobj[key]{resultprefix} (initial value: \LaTeX{} Result:)
415 \end{codedescribe}
416
417 \begin{codedescribe}[key]{parindent}
418 \begin{codesyntax} %
419 \tsobj[key]{parindent} = \tsargs[marg]{indent}
420 \end{codesyntax}
421 Sets the indentation to be used when `demonstrating' \LaTeX{}code (\tsobj[code]{\tsdemo}). It's initialized with whatever value \tsobj[code,no index]{\parindent} was when the package was first loaded.
422 \end{codedescribe}
423
424 \begin{codedescribe}[key]{ruleht}
425 \begin{codesyntax} %
426 \tsobj[key]{ruleht} = \tsargs[marg]{scale}
427 \end{codesyntax}
428 When typesetting the `code demo' (\tsobj{\tsdemo}) a set of rules are drawn. It's initialized with 1 (scaling factor, equals to \tsobj[code,no index]{\arrayrulewidth}, usually 0.4pt).
429 \end{codedescribe}
430
431 \begin{codedescribe}[key,new=2023/11/18]{basicstyle}
432 \begin{codesyntax} %
433 \tsobj[key]{basicstyle} = \tsargs[marg]{style}
434 \end{codesyntax}
435 Sets the base font style used when typesetting the `code demo', default being \tsobj[code,no index]{\footnotesize} \tsobj[code,no index]{\ttfamily}
436 \end{codedescribe}
437
438 \newpage
439 \section{codedescribe Package}
440
441 This package aims at minimizing the number of commands, being the object kind (if a command, environment, key etc.) a parameter, allowing for a simple extension mechanism: other object types can be easily introduced without having to change, or add commands.
442
443 \subsection{Package Options}\label{codedesc.pack-options}
444
445 \begin{describelist}{key}
446 \describe{nolisting}{Will suppress the \tsobj[pkg]{codelisting} package load. In case it isn't needed or another listing package will be used.}
447 %\describe{fancyverb}{This will also load the package \tsobj[pkg]{fancyverb}.}
448 \describe{label set}{(new: 2025/11/22) This allows to pre-select a label set, see \ref{labelset}. Currently, the possible values are \tsobj[option]{english,german,french}, the ones present in the auxiliary package \tsobj[pkg]{codedescsets}.}
449 \describe{base skip}{Changes the base skip, all skips (used by the environments at \ref{desc-env}) are scaled up from this. It defaults to the font size at load time.}
450 \describe{strict}{Package Warnings will be reported as Package Errors. This will be passed over to \tsobj[pkg]{codelisting} as well.}
451 \describe{suppress deprecated}{(new: 2025/12/30) Suppress the messages associated with deprecated commands/keys. This will be passed over to \tsobj[pkg]{codelisting} as well.}
452 \describe{silence}{(new: 2025/11/22, defaults to 18.89999pt) This will suppress some annoying bad boxes warnings. Given the way environments at \ref{desc-env} are defined, with \tsobj[pkg]{expl} coffins, \TeX{} sometimes thinks they are too wide, when they are not. This just sets \tsobj[code,no index]{\hfuzz} to the given value.}
453
454 \describe{describe keys}{(defaults to \tsobj[value]{grouped}) This sets the way the keys \tsobj[key]{new,update,note} are listed in a \tsobj[env]{codedescribe} environment, see \ref{desc-env}. Possible values are \tsobj[value,or]{grouped,as is}. By default keys are grouped together, with \tsobj[value,or]{as is} keys will respect the used sequence. }
455
456 \describe{index}{(new: 2025/12/15) This will enable the many \tsobj[key]{index} keys and set the default of some object groups to \tsobj[key,no index]{index}. This \textbf{won't load} any index package, but just change some objects' default behaviour (see \ref{indexing} and \ref{obj-type-def}). If not set, all \tsobj[key]{index} keys will be silently ignored.}
457
458 \describe{colors}{Possible values: \tsobj[option]{black,default,brighter, darker}. This will adjust the initial color configuration for the many format groups/objects (see \ref{format-keys}). \tsobj[option]{black} will defaults all \tsobj{\tsobj} colors to black. \tsobj[option]{default, brighter, darker} are roughly the same color scheme. The \tsobj[option]{default} scheme is the one used in this document. With \tsobj[option]{brighter} the colors are brighter than the default, and with \tsobj[option]{darker} the colors will be darker, but not black.}
459 \describe{codelisting}{The argument of this (it's value) will be passed over to \tsobj[pkg]{codelisting} as package options (if loaded). For example: \tsobj[key,no index]{code listing} = \tsobj[value,comma]{\{colors=brighter,load xtra dialects\}}. See \ref{codelist.pack-options}. }
460 \describe{infograb}{This will enable the document level, \LaTeX2e, aliases from the package \tsobj[pkg]{pkginfograb} \cite{pkginfograb}.}
461 \begin{tsremark}
462 In case of an unknown \tsobj[option]{label set}, an error will be risen, and all known sets will be listed in the log file and terminal.
463 \end{tsremark}
464 %\begin{tsremark}
465 % The option \tsobj[option]{colors} doesn't affect \tsobj[pkg]{codelisting} / \tsobj[pkg]{listings} colors.
466 %\end{tsremark}
467 %\begin{tsremark}
468 % If the package \tsobj[pkg]{fancyvrb} is detected at load time, the \tsobj[pkg]{listings} interface (if loaded) for it will be automatically activated.
469 %\end{tsremark}
470
471 \end{describelist}
472
473 \subsection{Indexing}\label{indexing}
474 It's up to the user to choose a companion package to format and display index entries, though a very simple setup, using \tsobj[pkg]{xindex}'s defaults, could just be:
475 \begin{codestore}[index-demo]
476 % in the document's preamble
477 \usepackage{xindex}
478 \makeindex
479 ...
480
481 % at the document's end
482 \printindex
483 \end{codestore}
484 \tscode*[codedesc,codeprefix={}]{index-demo}
485
486 Similarly, given the many index package variants (specially how index entries shall be created), the user is expected to supply an index generating command (key \tsobj[key]{index fmt}, see \ref{format-keys}), which shall absorb 4 parameters. This \emph{user supplied} command will be used by
487 the command \tsobj[code,no index]{\tsobj} and environments \tsobj[env,no index]{codedescribe,describelist} to create index entries.
488
489
490 This package offers four such auxiliary commands, for some common cases.
491
492 \begin{tsremark}
493 The package option \tsobj[option]{index} won't load any index package, but just set the defaults of some format groups (see \ref{format-group}) to generate index entries.
494 \end{tsremark}
495 \begin{codedescribe}[code,new=2025/12/19,index group=Test]{\indexfmtraw,\indexfmtrawat,\indexfmtcsraw,\indexfmtcsrawat}
496 \begin{codesyntax} %
497 \tsmacro{\indexfmtraw}{name,prefix,group,item}
498 \tsmacro{\indexfmtrawat}{name,prefix,group,item}
499 \tsmacro{\indexfmtcsraw}{name,prefix,group,item}
500 \tsmacro{\indexfmtcsrawat}{name,prefix,group,item}
501 \end{codesyntax}
502 \tsobj[marg]{item} is the item (from \tsobj{\tsobj} or \tsobj[env,or]{codedescribe,describelist}) to be indexed. \tsobj[marg]{group} corresponds to the key \tsobj[key]{index group}. \tsobj[marg]{prefix} corresponds to the key \tsobj[key]{index prefix}. Finally, \tsobj[marg]{name} (which corresponds to the key \tsobj[key]{index name}) if not empty, will be enclosed in brackets, for instance, \tsverb[code]{\tsobj[index name={some},code]{\cmd}} will result in (with everything at its default value) \tsverb[code]{\indexfmtcsrawat{[some]}{}{}{\cmd}}. This allows to avoid testing the first parameter value, and use it `as is': If the \tsobj[key]{index name} isn't set, \tsobj[marg]{name} will be empty.
503
504 \end{codedescribe}
505 \tsobj[code,no index]{\indexfmtraw{name}{prefix}{group}{item}} will ignore the 2nd and 3rd parameters, being equivalent to \tsobj[code,no index]{\index{item}} (or \tsobj[code,no index]{\index[name]{item}}).
506
507 \tsobj[code,no index]{\indexfmtcsraw{name}{prefix}{group}{\cmd}} will also ignore the 2nd and 3rd parameters, being equivalent to \tsobj[code,no index]{\index{\string\cmd}} (or \tsobj[code,no index]{\index[name]{\string\cmd}}). The primitive \tsobj{\string} will precede the \tsobj[marg]{item} (if it is a command).
508
509 The other two commands, \tsobj[code,no index]{\indexfmtrawat,\indexfmtcsrawat}, will create index entries as \textbf{\tsmeta{prefix}\tsmeta{item}@\tsmeta{group}!\tsmeta{item}}. The backslash, if any, is removed from the first \tsmeta{item} (preceding the @) in \tsobj[code,no index]{\indexfmtcsrawat}.
510
511 \begin{tsremark}
512 The actual characters specifiers can be changed with the command \tsobj{\indexcodesetup}.
513 \end{tsremark}
514 \begin{tsremark}
515 Of course, \tsobj[marg]{name} is useful only in case of packages like \tsobj[pkg,or]{imakeidx,splitindex}, which allows multiple indexes. Don't use/set \tsobj[key]{index name}, if you aren't using a multi-index aware package.
516 \end{tsremark}
517
518
519 \begin{codedescribe}[code,new=2025/12/23]{\indexgenkey}
520 \begin{codesyntax}
521 \tsmacro{\indexgenkey}{tl-var,terms-list}
522 \end{codesyntax}
523 This auxiliary command will construct part of an index key from \tsobj[marg]{terms-list}. All terms from \tsobj[marg]{terms-list} will be concatenate using a \emph{level} separator (normally a \emph{\textbf{!}}) and the result assigned to \tsobj[marg]{tl-var}. The actual \emph{level} character being used can be changed with \tsobj{\indexcodesetup}. For example, \tsobj[code,no index]{\indexgenkey{\partkey}{a,b,c}} will result in \tsobj[code,no index]{\partkey} having \tsobj[value]{a!b!c}, and \tsobj[code,no index]{\indexgenkey{\partkey}{a,b,c,{}}} will result in \tsobj[code,no index]{\partkey} having \tsobj[value]{a!b!c!} (note the trailing \emph{!}).
524 \end{codedescribe}
525 \begin{tsremark}
526 \tsobj[marg]{terms-list} will be fully expanded before being processed.
527 \end{tsremark}
528
529
530 \begin{codedescribe}[code,new=2025/12/21]{\indexcodesetup}
531 \begin{codesyntax}
532 \tsmacro{\indexcodesetup}{index-specs}
533 \end{codesyntax}
534 This customize some aspects of the index code. \tsobj[marg]{index-specs} can be any combination of
535 \end{codedescribe}
536 \begin{describelist*}{keys}
537 \describe{index cmd}{In case the index package being used defines a distinct index command. This set's the actual index command, defaults to \tsobj[code,no index]{\index}, used by the provided auxiliary index commands (see above). The given command must adhere to the same syntax of the original \tsobj[code,no index]{\index} command (see \cite{makeindex}). }
538 \describe{index specs}{This allows to change \tsobj[pkg]{makeindex} \cite{makeindex} character specifiers. This expects a set of 4 parameters (from \tsobj[pkg]{makeindex}: \tsobj[key]{level, actual, encap, quote}). Its default is \tsobj[key]{index specs} = \tsverb[value]{{{!}{@}{|}{"}}}}
539 \describe{index specs oc}{This allows to change \tsobj[pkg]{makeindex} \cite{makeindex} open/close character specifiers. It expects a set of 4 parameters (from \tsobj[pkg]{makeindex}: \tsobj[key]{arg open, arg close, range open, range close}). Its default is \tsobj[key]{index specs oc} = \tsverb[value]{ {{\{}{\}}{(}{)}} }. This isn't used, and is just a place holder in case further customization (indexes) is needed. }
540 \describe{index specs others}{This allows to change \tsobj[pkg]{makeindex} \cite{makeindex} others specifiers. It expects a set of 3 parameters (from \tsobj[pkg]{makeindex}: \tsobj[key]{escape, page compositor, index command}). Its default is \tsobj[key]{index specs others} = \tsverb[value]{{{\\}{-}{\indexentry}}}. This isn't used, and is just a place holder in case further customization (indexes) is needed. }
541 \end{describelist*}
542 \begin{tsremark}
543 This can only be used in the document preamble. It will raise an error, if used after \tsobj[code,no index]{\begin{document}} .
544 \end{tsremark}
545 %\begin{tsremark}
546 % \tsobj[key,no index]{index cmd} assignment will be delayed until \tsobj[code,no index]{\begin{document}}. It will be ignored, and raise an error, if the given command doesn't exist.
547 %\end{tsremark}
548
549
550 \subsubsection{Index Keys}\label{index keys}
551 When defining object types (see \ref{obj-types}) or typesetting (see \ref{desc-env} and \ref{ts-commands}) the following keys can be used:
552 \begin{describelist*}{key}
553 \describe {no index} {To NOT include the items in the default index.}
554 \describe {index} {To include the items in the default index.}
555 \describe {index name} {Sets \tsobj[meta]{name} for those items.}
556 \describe {index group} {Sets \tsobj[meta]{group} for those items.}
557 \describe {index prefix} {Sets \tsobj[meta]{prefix} for those items.}
558 \describe {index gen group} {Sets \tsobj[meta]{group}, using \tsobj{\indexgenkey}, for those items.}
559 \describe {index gen prefix} {Sets \tsobj[meta]{prefix}, using \tsobj{\indexgenkey}, for those items.}
560 \end{describelist*}
561
562 \subsection{Object Type keys}\label{obj-type-def}
563
564 \tsobj[arg]{obj-types} defines the applied format: font shape, bracketing, etc. to be applied. When using an \tsobj[arg]{obj-type}, first the associated \tsobj[arg]{format-group} is applied, then the particular (if any) object format is applied.
565
566 \subsubsection{Format Keys}\label{format-keys}
567 Those are the primitive \tsobj[arg]{format-keys} used when (re)defining \tsobj[arg]{format-groups,obj-types} (see \ref{format-custom}):
568 \begin{describelist*}{keys}
569 \describe {meta} {Sets base format to typeset between angles.}
570 \describe {xmeta} {Sets base format to typeset *verbatim* between angles.}
571 \describe {verb} {Sets base format to typeset *verbatim*.}
572 \describe {xverb} {Sets base format to typeset *verbatim*, no spaces.}
573 \describe {code} {Sets base format to typeset *verbatim*, no spaces, replacing a TF by {\slshape\underline{TF}}.}
574 \describe {nofmt} {In case of a redefinition, removes the base formatting. Note that, it only makes sense if applied at the same level, meaning, if the format was originally defined at group formatting level, it only can be removed at this level.}
575 \describe {format} {Sets the base format. Possible values: \tsobj[values,or]{meta,xmeta,verb,xverb,code,nofmt,none}, as above.}
576 \begin{tsremark}
577 The \tsobj[key]{format} key is just an alternative way of setting the base formatting. \tsobj[value]{none} is just an alias to \tsobj[key]{nofmt}.
578 \end{tsremark}
579 \describe {slshape} {To use a slanted font shape.}
580 \describe {itshape} {To use an italic font shape.}
581 \describe {noshape} {In case of a redefinition, removes the base shape. Note that, it only makes sense if applied at the same level, meaning, if shape was originally defined at group formatting level, it only can be removed at this level.}
582 \describe {shape} {Sets the font shape. Possible values: \tsobj[value,or]{itshape,italic,slshape,slanted,noshape,none}, as above.}
583 \begin{tsremark}
584 The \tsobj[key]{shape} key is just an alternative way of setting the font shape. \tsobj[value]{none} is just an alias to \tsobj[value]{noshape}.
585 \end{tsremark}
586 \describe {shape preadj}{Adds a (thin) space before each term in \tsobj{\tsobj}, see \ref{ts-commands}. Possible values: \tsobj[values,or]{none,very thin, thin, mid}.}
587 \describe {shape posadj}{Adds a (thin) space after each term in \tsobj{\tsobj}, see \ref{ts-commands}. Possible values: \tsobj[values,or]{none,very thin, thin, mid}.}
588 \begin{tsremark}
589 These are meant for the case in which the italic or slanted shapes of the used font renders a character too close to an upright character.
590 \end{tsremark}
591
592 \describe {lbracket} {Sets the left bracket (when using \tsobj{\tsargs}), see \ref{ts-commands}.}
593 \describe {rbracket} {Sets the right bracket (when using \tsobj{\tsargs}), see \ref{ts-commands}.}
594 \describe {color} {Sets the text color. \textbf{NB:} color's name as understood by \tsobj[pkg]{xcolor} package.}
595 \describe {font} {Defaults to \tsobj[code,no index]{\ttfamily}. Sets font family.}
596 \describe {fsize} {Defaults to \tsobj[code,no index]{\small}. Sets font size.}
597 \begin{tsremark}
598 \tsobj[key]{font,fsize} shall receive a single command that absorbs no tokens.
599 \end{tsremark}
600 \describe {index fmt} {Sets the index generating command (see \ref{indexing}). }
601 \begin{tsremark}
602 Besides \tsobj[key]{index fmt} the other index keys (see \ref{index keys}) can also be used.
603 \end{tsremark}
604 \begin{tsremark}[\color{red}Important:]
605 Except for \tsobj[key]{font,fsize,index fmt} all other keys will be expanded at definition time, including the others \tsobj[key,no index]{index} keys.
606 \end{tsremark}
607 \begin{tsremark}
608 The \tsobj[key]{index fmt} command shall absorb 4 parameters, like \tsmacro{\usercmd{name}}{prefix,group,item}. \tsobj[marg]{prefix} will come from the key \tsobj[key]{index prefix}, \tsobj[marg]{group} from the key \tsobj[key]{index group} and \tsobj[marg]{item} will be the item to be indexed. \tsobj[marg]{name} will come from the key \tsobj[key]{index name} (if not empty, \tsobj[marg]{name} will be between brackets).
609
610 For instance, having \tsobj[key]{index fmt} = \tsverb**[code,no index]{\usercmd}, then
611 \tsobj[code,no index]{\tsobj}
612 \tsverb[oarg]{[index name = iname, index prefix = pre, index group = grp]}
613 \tsverb[marg]{{ \some }} will result in the execution of
614 \tsverb*[code]{\usercmd {[iname]}{pre}{grp}{\some }}.
615 \end{tsremark}
616 \end{describelist*}
617
618 \subsubsection{Format Groups}\label{format-group}
619 Using \tsobj{\defgroupfmt} (see \ref{format-custom}) one can (re-)define custom \tsobj[arg]{format-groups}. Predefined ones:
620 \begin{describelist*}{keys}
621 \describe {meta} {which sets \tsobj[keys]{meta,color}}
622 \describe {verb} {which sets \tsobj[keys]{color}}
623 \describe {code} {which sets \tsobj[keys]{code,color,index} (\tsobj[keys]{index fmt} = \tsobj{\indexfmtcsraw})}
624 \describe {oarg} {which sets \tsobj[keys]{meta,color}}
625 \describe {syntax} {which sets \tsobj[keys]{color}}
626 \describe {env} {which sets \tsobj[keys]{slshape,color,index} (\tsobj[keys]{index fmt} = \tsobj{\indexfmtraw})}
627 \describe {pkg} {which sets \tsobj[keys]{slshape,color}}
628 \describe {option} {which sets \tsobj[keys]{color,index} (\tsobj[keys]{index fmt} = \tsobj{\indexfmtraw})}
629 \describe {keys} {which sets \tsobj[keys]{slshape,color,index} (\tsobj[keys]{index fmt} = \tsobj{\indexfmtraw})}
630 \describe {values} {which sets \tsobj[keys]{slshape,color}}
631 \describe {defaultval} {which sets \tsobj[keys]{color}}
632 \end{describelist*}
633 \begin{tsremark}
634 \tsobj[keys]{color} was used in the list above just as a `reminder' that a color is defined/associated with the given group, it can be changed with \tsobj{\defgroupfmt}.
635 \end{tsremark}
636 \begin{tsremark}
637 \tsobj[keys]{index,index fmt} will only be set if the option \tsobj[option]{index} was used when loading this package, see \ref{codedesc.pack-options}.
638 \end{tsremark}
639
640 \subsubsection{Object Types}\label{obj-types}
641 Object types are the keys, \tsobj[meta]{obj-type}, used with \tsobj{\tsobj} (and friends, see \ref{ts-commands}) defining the specific format to be used.
642 With \tsobj{\defobjectfmt} (see \ref{format-custom}) one can (re-)define custom \tsobj[arg]{obj-types}.
643 Predefined ones:
644
645 \begin{describelist*}{keys,no index}
646 \describe {arg, meta} {based on (group) \tsobj[key]{meta}}
647 \describe {verb, xverb} {based on (group) \tsobj[key]{verb} plus \tsobj[key,sep=or]{verb,xverb}}
648 \describe {marg} {based on (group) \tsobj[key]{meta} plus brackets}
649 \describe {oarg, parg, xarg} {based on (group) \tsobj[key]{oarg} plus brackets}
650 \describe {code, macro, function} {based on (group) \tsobj[key]{code}}
651 \describe {syntax} {based on (group) \tsobj[key]{syntax}}
652 \describe {keyval, key, keys} {based on (group) \tsobj[key]{keys}}
653 \describe {value, values} {based on (group) \tsobj[key]{values}}
654 \describe {option} {based on (group) \tsobj[key]{option}}
655 \describe {defaultval} {based on (group) \tsobj[key]{defaultval}}
656 \describe {env} {based on (group) \tsobj[key]{env}}
657 \describe {pkg, pack} {based on (group) \tsobj[key]{pkg}}
658 \end{describelist*}
659
660
661 \subsubsection{Command List Keys}\label{code:keys}
662 The following keys are just some ``sugar syntax'' (to reduce a few keyboard strokes), and only make sense when typesetting (see \ref{ts-commands}) or describing (see \ref{desc-env}) \tsobj[pkg]{expl} commands. They are only applied in case the base format (format key, see \ref{format-keys}) is \tsobj[value]{code}, in which case a command (an item from \tsobj[marg]{csv-list}) can be any of the following:
663 \begin{enumerate}[midsep]
664 \item $\backslash$\tsobj[marg]{cmd}
665 \item $\backslash$\tsobj[marg]{cmd}:\tsobj[marg]{signature}
666 \item $\backslash$\tsobj[marg]{cmd}:\tsobj[marg]{base-signature} \{\tsobj[marg]{variants-list}\}
667 \end{enumerate}
668
669 In the first two cases, they will always be handle ``as is''. The third case depends on how the key \tsobj[key]{variants} is set (see below). Besides that, the keys \tsobj[key]{TF,noTF,pTF,nopTF} ``helps'' defining conditional variants of a base command.
670 \begin{tsremark}[\color{red}Attention:]
671 The keys bellow won't check for any \tsobj[pkg]{expl} convention, besides possible letters. It's up to the user to use them correctly.
672
673 \tsobj[marg]{base-signature} may contain \tsobj[value,or]{n,N,w,p,D}.
674
675 \tsobj[marg]{variants-list} may contain \tsobj[value,or]{n,o,e,x,v,V,N,c,w,p,D}.
676 \end{tsremark}
677
678 \begin{describelist*}{keys}
679 \describe{variants}
680 {%
681 (new 2026/02/12) Defaults to \tsobj[value]{none}. This will set how the 3rd case is processed. Possible values are:
682 \begin{describelist*}{value}
683 \describe{none}{The items (in a \tsobj[marg]{csv-list}) will be handled ``as is'' (no further special treatment). That's the default behaviour.}
684 \describe{list}{A first entry will be generate with $\backslash$\tsobj[marg]{cmd}:\tsobj[marg]{base-signature} then for each \tsobj[marg]{sig-item} in \tsobj[marg]{variants-list} an entry $\backslash$\tsobj[marg]{cmd}:\tsobj[marg]{sig-item} will be generated. For example,
685
686 \noindent\tsverb**{\tsobj[code,variants=list]{\exp_cmd:Nn {cn,cV}}} is equivalent to \tsobj[code,no index]{\tsobj{\exp_cmd:Nn,\exp_cmd:cn,\exp_cmd:cV}}
687 }
688 \describe{compact}{A first entry will be generate with $\backslash$\tsobj[marg]{cmd}:\tsobj[marg]{base-signature} then a second (or more, see remark below) entry will generated as $\backslash$\tsobj[marg]{cmd}:(\tsobj[marg]{bnf-or}). For example,
689
690 \noindent \tsverb**{\tsobj[code,variants=compact]{\exp_cmd:Nn {cn,cV}}} is equivalent to
691 \tsobj[code,no index]{\tsobj{\exp_cmd:Nn, \exp_cmd:(cn|cV)}}
692 }
693 \end{describelist*}
694 \begin{tsremark}
695 In the \tsobj[value]{compact} case, a dash ``-'' item will break down the ``bnf or'' in two entries at the dash entry. This helps avoiding extra-long entries. In the \tsobj[value]{list} case, a dash ``-'' item will be ignored.
696 \end{tsremark}
697 \begin{tsremark}
698 In case of \tsobj[value,or]{list,compact} the generated entries will use a slightly fainted color (the color defined by the object type mixed with white)
699 \end{tsremark}
700 }
701 \describe{TF}{This will add a trailing \textsl{\underline{TF}} to all items. The base name won't be listed as an item.}
702 \describe{noTF}{This will preserve the base(s) name and add the \textsl{\underline{TF}} variant to all items.}
703 \describe{pTF}{This will add a trailing \textsl{\underline{TF}} and a predicate \tsobj[code,no index]{_p:} variant, to all items, and mark them as \tsobj[key]{EXP}. The base name won't be listed as an item.}
704 \describe{nopTF}{This will preserve the base(s) name and add the \textsl{\underline{TF}} and predicate \tsobj[code,no index]{_p:} variants to all items. Marking them as \tsobj[key]{EXP}.}
705 \begin{tsremark}
706 The \tsobj[key]{pTF,nopTF} also implies \tsobj[key]{EXP} since the predicate variants must be expandable (see \ref{desc-env}).
707 \end{tsremark}
708 \end{describelist*}
709
710
711 \newpage
712 \subsubsection{Customization}\label{format-custom}
713
714 To create user defined groups/objects or change the predefined ones:
715
716
717 \begin{codedescribe}[code,new=2023/05/16]{\defgroupfmt}
718 \begin{codesyntax} %
719 \tsmacro{\defgroupfmt}{format-group,format-keys}
720 \end{codesyntax}
721 \tsobj[marg]{format-group} is the name of the new group (or the one being redefined, which can be one of the standard ones). \tsobj[marg]{format-keys} is any combination of the keys from \ref{format-keys}
722 \end{codedescribe}
723
724 For example, to change the color of all \tsobj[key]{obj-types} based on the \tsobj[key]{code} group (\tsobj[key,no index]{code, macro, function} objects) to red, it's enought to \tsobj[code,no index]{\defgroupfmt{code}{color=red}}.
725
726 \begin{codedescribe}[code,new=2025/12/11]{\dupgroupfmt}
727 \begin{codesyntax} %
728 \tsmacro{\dupgroupfmt}{new-group,org-group}
729 \end{codesyntax}
730 \tsobj[marg]{new-group} will be a copy of \tsobj[marg]{org-group} definition at time of use. Both can be later chaged/re-defined independently of each other.
731 \end{codedescribe}
732
733
734 \begin{codedescribe}[code,new=2023/05/16]{\defobjectfmt}
735 \begin{codesyntax} %
736 \tsmacro{\defobjectfmt}{obj-type,format-group,format-keys}
737 \end{codesyntax}
738 \tsobj[marg]{obj-type} is the name of the new \tsobj[arg]{object} being defined (or redefined),
739 \tsobj[marg]{format-group} is the base group to be used (see \ref{format-group}). \tsobj[marg]{format-keys} (see \ref{format-keys}) allows further differentiation.
740 \end{codedescribe}
741 For instance, the many optional \tsobj[arg]{*arg} are defined as follow:
742 \begin{codestore}[demo.fmtdef]
743 \colorlet {c__codedesc_oarg_color} { gray!90!black }
744
745 \defgroupfmt {oarg} { meta , color=c__codedesc_oarg_color }
746
747 \defobjectfmt {oarg} {oarg} { lbracket={[} , rbracket={]} }
748 \defobjectfmt {parg} {oarg} { lbracket={(} , rbracket={)} }
749 \defobjectfmt {xarg} {oarg} { lbracket={<} , rbracket={>} }
750 \end{codestore}
751
752 \tscode*[codeprefix=~,codedesc]{demo.fmtdef}
753
754 \begin{codedescribe}[code,new=2025/12/14]{\setcolorscheme}
755 \begin{codesyntax} %
756 \tsmacro{\setcolorscheme}{color-key-list}
757 \end{codesyntax}
758 This allows to customize the default colors used by the many object types and format groups. Note that the given colors will be mixed with black. The key \tsobj[key]{brightness} set's the mixing proportion. The changes become effective at the point of use.
759 \end{codedescribe}
760 \tsobj[marg]{color-key-list} can be any combination of:
761 \begin{describelist*}{keys}
762 \describe{error}{(default: red) Sets the error base color }
763 \describe{verb}{(default: black) Sets the verb base color}
764 \describe{args}{(default: white) Sets the args base color}
765 \describe{code}{(default: blue) Sets the code base color}
766 \describe{keys}{(default: teal) Sets the keys base color}
767 \describe{values}{(default: green) Sets the values base color}
768 \describe{env}{(default: green) Sets the env base color}
769 \describe{pack}{(default: green) Sets the pack base color}
770 \describe{brightness}{(default: 1) Sets the mixing proportion between each base color and black.}
771 \describe{scheme}{(Defaults to \tsobj[key]{scheme}=\tsobj[value]{default}) Selects a pre-set color scheme, see below, the default scheme sets all of the above to their default value.}
772 \end{describelist*}
773
774 \begin{codedescribe}[code,new=2025/12/14]{\newcolorscheme}
775 \begin{codesyntax} %
776 \tsmacro{\newcolorscheme}{new-scheme,color-key-list}
777 \end{codesyntax}
778 This creates/defines a \tsobj[marg]{new-scheme} (\tsobj[marg]{color-key-list} as above) which can be later used as \tsobj[code,no index]{\setcolorscheme{scheme=new-scheme}}
779 \end{codedescribe}
780
781
782
783 \newpage
784 \subsection{Locale}
785 The following commands allows to customize the many `labels' in use, in particular the auxiliary package \tsobj[pkg]{codedescsets} holds a few locale sets, the user is invited to submit translations for a specific case/language via a PR (Push Request) at \url{https://github.com/alceu-frigeri/codedescribe}
786
787
788 \begin{codedescribe}[code,new=2025/11/22]{\setcodelabels}\label{labelset}
789 \begin{codesyntax} %
790 \tsmacro{\setcodelabels}{labels-list}
791 \end{codesyntax}
792 \tsobj{\setcodelabels} allows to change the many `labels' used (like `updated' in the \tsobj[env]{codedescribe} environment), it can be used at any time, allowing to change those labels mid text. See below for a complete list of possible labels.
793 \end{codedescribe}
794
795 The \tsobj[marg]{labels-list} can be any combination of:
796 \begin{describelist*}{key}
797 \describe{new}{It set's the `new' label used in the \tsobj[env]{codedescribe} environment.}
798 \describe{update}{It set's the `update' label used in the \tsobj[env]{codedescribe} environment.}
799 \describe{note}{It set's the `note' label used in the \tsobj[env]{codedescribe} environment.}
800 \describe{and}{It set's the `and' label used by \tsobj{\tsobj} (hint: last item separator).}
801 \describe{or}{It set's the `or' label used by \tsobj{\tsobj} (hint: last item separator).}
802 \describe{months}{It set's the month list used by \tsobj{\tsdate}, see \ref{aux-commands}. NB.: it expects a list of names starting at `January' and ending at `December'.}
803 \describe{label set}{Selects a given set. No default. see below.}
804 \end{describelist*}
805
806 \begin{tsremark}
807 The given \tsobj[marg]{labels-list} doesn't need to be complete, though, only the given labels will be changed.
808 \end{tsremark}
809 \begin{tsremark}
810 The old \tsverb[xverb]{\selectlabelset{lang}} is (now) an alias to \tsverb[verb]{\setcodelabels {label set=lang}}, and will raise a warning if called (deprecation).
811 \end{tsremark}
812
813
814
815 \begin{codedescribe}[code,new=2025/11/22]{\newlabelset}
816 \begin{codesyntax} %
817 \tsmacro{\newlabelset}{lang,labels-list}
818 \end{codesyntax}
819 This creates/defines a new label's set (named as \tsobj[marg]{lang}), \tsobj[marg]{labels-list} as above, which can be later used as
820 \tsverb[code,no index]{\setcodelabels {label set=lang}}
821 \end{codedescribe}
822 \begin{tsremark}
823 \tsobj{\newlabelset} is used in the auxiliary package \tsobj[pkg]{codedescsets} to pre-define some sets, which can then be used as a package option, see \ref{codedesc.pack-options}.
824 \end{tsremark}
825 \begin{tsremark}
826 \tsobj{\newlabelset} can be used to redefine a given set, though, if doing so, one has to provide all labels. The old (if any) definitions will be erased. No warnings given.
827 \end{tsremark}
828
829
830
831
832 For example, this sets a new label set for German. In fact, since this is defined in the package \tsobj[pkg]{codedescsets} this label set can be used at load time, see \ref{codedesc.pack-options}.
833 \begin{codestore}[labelset]
834 \newlabelset {german}
835 {
836 new = neu ,
837 update = aktualisiert ,
838 note = NB ,
839 remark = Hinweis ,
840 and = und ,
841 or = oder ,
842 months =
843 {
844 Januar, Februar, März, April,
845 Mai, Juni, Juli, August,
846 September, Oktober, November, Dezember
847 }
848 }
849 \end{codestore}
850
851
852
853 \tscode*[codedesc,codeprefix={}]{labelset}
854
855 \subsection{Environments}\label{desc-env}
856
857 \begin{codedescribe}[env,new=2023/05/01,update=2023/05/01,note={a note example},update=2024/02/16,update=2025/09/25]{codedescribe}
858 \begin{codesyntax}
859 \tsmacro{\begin{codedescribe}}[obj-keys]{csv-list}
860 \ldots
861 \tsmacro{\end{codedescribe}}{}
862 \end{codesyntax}
863 This is the main environment to describe \tsobj[env,comma,no index]{Commands, Variables, Environments, etc.} \tsobj[marg]{csv-list} items will be listed in the left margin. The \tsobj[env]{codesyntax} will be attached to it's right, and the rest of the text will be below them, with the usual text width. The optional \tsobj[oarg]{obj-keys} defaults to just \tsobj[key]{code}, it can be any object type as defined at \ref{obj-types} (and \ref{format-custom}), index keys (see \ref{index keys}), command list keys (if object type is \tsobj[value]{code}, see \ref{code:keys}) or the following:
864 \end{codedescribe}
865 \begin{describelist*}{key}
866 \describe{new}{To add a \emph{new} line.}
867 \describe{update}{To add an \emph{updated} line.}
868 \describe{note}{To add a \emph{NB} line.}
869 \describe {keys seq} {Possible values are \tsobj[value,or]{grouped,as is}. By default the keys \tsobj[key]{new,update,note} are grouped together, first all \tsobj[key,no index]{new} keys, then all \tsobj[key,no index]{update} keys and lastly all \tsobj[key,no index]{note} keys. With \tsobj[value,or]{as is} keys will respect the used sequence. The default can be changed with the package option \tsobj[option,no index]{describe keys}, see \ref{codedesc.pack-options}.}
870 \describe{rulecolor}{For instance \tsmacro{\begin{codedescribe}[rulecolor=white]}{} will suppress the rules.}
871 \describe{EXP}{A star \ding{72} will be added to all items, signaling the commands are fully expandable.}
872 \describe{rEXP}{A hollow star \ding{73} will be added to all items, signaling the commands are restricted expandable.}
873 \describe {force margin} {If set, \tsobj[meta]{csv-list} items will be listed in the margin, regardless of their width.}
874 \end{describelist*}
875 \begin{tsremark}
876 The keys \tsobj[keys]{new,update,note} can be used multiple times. (2024/02/16)
877 \end{tsremark}
878 \begin{tsremark}
879 If using one of these keys the user must also provide an object type. \tsobj[key]{code} is the solely default IF nothing else is provided.
880 \end{tsremark}
881 \begin{tsremark}[\color{red} Attention:]
882 The \tsobj[env]{codedescribe} environment `acts' as a single block! That assures the margin block, the \tsobj[env]{codesyntax} environment (block) and the following text (inside the \tsobj[env]{codedescribe} environment) will always stay in the same page.
883 \end{tsremark}
884 \begin{tsremark}[\color{red} Attention:]
885 If the items don't fit in the margin, the \tsobj[marg]{csv-list} will advance towards the text window (up to approximately half of text width plus margin width), reducing the horizontal space of the \tsobj[env]{codesyntax} block. This can be changed with the \tsobj[key]{force margin}, in which case the \tsobj[marg]{csv-list} will always be at the margin, growing leftwards (might end outside the page).
886 \end{tsremark}
887 \begin{tsremark}
888 With the \tsobj[option]{strict} package option,
889 an error will be raised if used inside another \tsobj[env]{codedescribe} environment. Otherwise a warning will be raised. (it's safe to do so, but it doesn't make much sense).
890 \end{tsremark}
891
892 \begin{codedescribe}[env,update=2025/09/25,update=2025/11/25]{codesyntax}
893 \begin{codesyntax}
894 \tsmacro{\begin{codesyntax}}[obj-type]{}
895 \ldots
896 \tsmacro{\end{codesyntax}}{}
897 \end{codesyntax}
898 The \tsobj[env]{codesyntax} environment sets the fontsize and activates \tsmacro{\obeylines,\obeyspaces}{}, so one can list macros/cmds/keys use, one per line. The content will be formatted as defined by \tsobj[oarg]{obj-type} (defaults to \tsobj[syntax]{syntax}). \tsobj[oarg]{obj-type} can be any object from \ref{obj-types} (or \ref{format-custom}). For a \emph{verbatim} alternative, see \tsobj[env]{codesyntax*} below.
899 \end{codedescribe}
900
901 \begin{tsremark}
902 \tsobj[env,sep=and/or]{codesyntax,codesyntax*} environments shall appear only once, inside of a \tsobj[env]{codedescribe} environment.
903 Remember, this is not a verbatim environment!
904 \end{tsremark}
905 \begin{tsremark}
906 With the \tsobj[option]{strict} package option
907 an error will be raised if used outside a \tsobj[env]{codedescribe} environment, or more than once inside. Otherwise a warning will be raised.
908 \end{tsremark}
909
910 For example, the code for \tsobj[env]{codedescribe} (previous entry) is:
911
912 \begin{codestore}[demoD]
913 \begin{codedescribe}[ env , new=2023/05/01, update=2023/05/01, note={a note example}, update=2024/02/16, update=2025/09/25]{codedescribe}
914 \begin{codesyntax}
915 \tsmacro{\begin{codedescribe}}[obj-type]{csv-list}
916 \ldots
917 \tsmacro{\end{codedescribe}}{}
918 \end{codesyntax}
919 This is the main ...
920 \end{codedescribe}
921 \end{codestore}
922
923 \tscode*[codedesc,codeprefix={}]{demoD}
924
925
926
927
928 \begin{codedescribe}[env,new=2025/12/18]{codesyntax*}
929 \begin{codesyntax}
930 \tsmacro{\begin{codesyntax*}}[code-keys]{}
931 \ldots
932 \tsmacro{\end{codesyntax*}}{}
933 \end{codesyntax}
934 The \tsobj[env]{codesyntax*} is a true \emph{verbatim} environment (derived from \tsobj[pkg]{listings} package, see \cite{listings}). \tsobj[oarg]{code-keys} can be any valid code key from \ref{code-keys}, and syntax highlight will be applied (see \ref{codelist}). The background color will always be white, whilst line numbering will be suppressed. For a non \emph{verbatim} alternative, see \tsobj[env]{codesyntax} above.
935 \end{codedescribe}
936
937 \begin{tsremark}
938 If \tsobj[option]{nolisting} package option is set, this environment won't be defined.
939 \end{tsremark}
940 \begin{tsremark}
941 \tsobj[env,sep=and/or]{codesyntax,codesyntax*} environments shall appear only once, inside of a \tsobj[env]{codedescribe} environment.
942 \end{tsremark}
943 \begin{tsremark}
944 With the \tsobj[option]{strict} package option
945 an error will be raised if used outside a \tsobj[env]{codedescribe} environment, or more than once inside. Otherwise a warning will be raised.
946 \end{tsremark}
947
948
949
950
951 \begin{codedescribe}[env]{describelist,describelist*}
952 \begin{codesyntax}
953 \tsmacro{\begin{describelist}}[item-indent]{obj-type}
954 ~~\tsmacro{\describe}{item-name,item-description}
955 ~~\tsmacro{\describe}{item-name,item-description}
956 \tsmacro{\end{describelist}}{}
957 \end{codesyntax}
958 This sets a \tsobj[env]{description} like `list'. In the non-star version the \tsobj[marg]{items-name} will be typeset on the margin. In the star version, \tsobj[marg]{item-description} will be indented by \tsobj[oarg]{item-indent} (defaults to: 20mm).
959 \tsobj[marg]{obj-type} defines the object-type format used to typeset \tsobj[marg]{item-name}, it can be any object from \ref{obj-types} (or \ref{format-custom}) and index keys (see \ref{index keys}).
960 \end{codedescribe}
961
962
963 \begin{codedescribe}[code]{\describe}
964 \begin{codesyntax}
965 \tsmacro{\describe}{item-name,item-description}
966 \end{codesyntax}
967 This is the \tsobj[env]{describelist} companion macro. In case of the \tsobj[env]{describe*}, \tsobj[marg]{item-name} will be typeset in a box \tsobj[oarg]{item-indent} wide, so that \tsobj[marg]{item-description} will be fully indented, otherwise \tsobj[marg]{item-name} will be typed at the margin.
968 \end{codedescribe}
969
970 \begin{tsremark}
971 An error will be raised (undefined control sequence) if called outside of a \tsobj[env,sep=or]{describelist,describelist*} environment.
972 \end{tsremark}
973
974
975 \subsection{Typeset Commands}\label{ts-commands}
976
977 \begin{codedescribe}[code,update=2025/05/29]{\typesetobj,\tsobj}
978 \begin{codesyntax}
979 \tsmacro{\typesetobj}[obj-type]{csv-list}
980 \tsmacro{\tsobj}[obj-type]{csv-list}
981 \end{codesyntax}
982 This is the main typesetting command, each term of \tsobj[marg]{csv-list} will be separated by a comma and formatted as defined by \tsobj[oarg]{obj-type} (defaults to \tsobj[key]{code}). \tsobj[oarg]{obj-type} can be any object from \ref{obj-types} (or \ref{format-custom}), index keys (see \ref{index keys}), command list keys (if object type is \tsobj[value]{code}, see \ref{code:keys}) and the following keys:
983 \end{codedescribe}
984
985 \begin{describelist*}{key}
986 \describe{mid sep}{To change the item separator. Defaults to a comma, can be anything.}
987 \describe{sep}{To change the separator between the last two items. Defaults to ``and''.}
988 \describe{or}{To set the separator between the last two items to ``or''.}
989 \describe{comma}{To set the separator between the last two items to a comma.}
990 \describe{bnf or}{To produce a bnf style or list, like \tsobj[option,bnf or,no index]{abc,xdh,htf,hrf}.}
991 \describe{meta or}{To produce a bnf style or list between angles, like \tsobj[option,meta or,no index]{abc,xdh,htf,hrf}.}
992 \describe{par or}{To produce a bnf style or list between parentheses, like \tsobj[option,par or,no index]{abc,xdh,htf,hrf}.}
993 \end{describelist*}
994 \begin{tsremark}
995 If \tsobj[key,sep={and/or}]{shape preadj,shape posadj} are set (see \ref{format-keys}, a (thin) space will be added before and/or after each term of \tsobj[marg]{csv-list}.
996 \end{tsremark}
997
998 \begin{codedescribe}[code]{\typesetargs,\tsargs}
999 \begin{codesyntax}
1000 \tsmacro{\typesetargs}[obj-type]{csv-list}
1001 \tsmacro{\tsargs}[obj-type]{csv-list}
1002 \end{codesyntax}
1003 These will typeset \tsobj[marg]{csv-list} as a list of parameters, like \tsargs[oarg]{arg1,arg2,arg3}, or \tsargs[marg]{arg1,arg2,arg3}, etc. \tsobj[oarg]{obj-type} defines the formating AND kind of brackets used (see \ref{obj-type-def}): \tsverb{[]} for optional arguments (oarg), \tsverb{{}} for mandatory arguments (marg), and so on.
1004 \end{codedescribe}
1005
1006 \begin{codedescribe}[code]{\typesetmacro,\tsmacro}
1007 \begin{codesyntax}
1008 \tsmacro{\typesetmacro}{macro-list}\tsargs[oarg]{oargs-list}\tsargs[marg]{margs-list}
1009 \tsmacro{\tsmacro}{macro-list}\tsargs[oarg]{oargs-list}\tsargs[marg]{margs-list}
1010 \end{codesyntax}
1011
1012 These are just short-cuts for\par \tsverb*[code]{\tsobj [code]{macro-list} \tsargs [oarg]{oargs-list} \tsargs [marg]{margs-list}}.
1013
1014 \end{codedescribe}
1015
1016 \begin{codedescribe}[code]{\typesetmeta,\tsmeta}
1017 \begin{codesyntax}
1018 \tsmacro{\typesetmeta}{name}
1019 \tsmacro{\tsmeta}{name}
1020 \end{codesyntax}
1021 These will just typeset \tsobj[meta]{name} between left/right `angles' (no further formatting).
1022
1023 \end{codedescribe}
1024
1025
1026 \begin{codedescribe}[code,update=2026/02/13]{\typesetverb,\typesetverb*,\typesetverb**,\tsverb,\tsverb*,\tsverb**}
1027 \begin{codesyntax}
1028 \tsmacro{\typesetverb}[obj-type]{verbatim text}
1029 \tsmacro{\tsverb}[obj-type]{verbatim text}
1030 \end{codesyntax}
1031 Typesets \tsobj[marg]{verbatim text} as is. \tsobj[oarg]{obj-type} defines the used format. The difference with \tsverb*{\tsobj [verb]{something}} is that \tsmeta{verbatim text} can contain commas (which, otherwise, would be interpreted as a list separator by \tsobj{\tsobj}. The non-star version preserves all spaces (including an space after every command). The single star one suppresses the space after a command name if followed by an opening or closing, mandatory or optional, standard argument delimiter. The double star version suppresses all spaces.
1032 \begin{tsremark}
1033 This is meant for short expressions, and not multi-line, complex code (one is better off, then, using \ref{codelist}). \tsobj[meta]{verbatim text} must be balanced! Otherwise, some low level \TeX\ errors might pop out.
1034 \end{tsremark}
1035 \end{codedescribe}
1036
1037 \begin{codedescribe}[code,new=2026/02/13]{\typesetfmt,\tsfmt}
1038 \begin{codesyntax}
1039 \tsmacro{\typesetfmt}[obj-type]{gen-text}
1040 \tsmacro{\tsfmt}[obj-type]{gen-text}
1041 \end{codesyntax}
1042 These will typeset \tsobj[marg]{gen-text} in a local group formatted according to \tsobj[oarg]{obj-type} (font family, shape, size and color but nothing else). \tsobj[marg]{gen-text} will be fully expanded in the process.
1043 \end{codedescribe}
1044
1045
1046
1047 \subsection{Note/Remark Commands}\label{note-commands}
1048
1049
1050 \begin{codedescribe}[code]{\typesetmarginnote,\tsmarginnote}
1051 \begin{codesyntax}
1052 \tsmacro{\typesetmarginnote}{note}
1053 \tsmacro{\tsmarginnote}{note}
1054 \end{codesyntax}
1055 Typesets a small note at the margin.
1056 \end{codedescribe}
1057
1058 \begin{tsremark}
1059 Don't try to use these inside one of this packages environments, like \tsobj[env,or]{tsremark,codedescribe}, given the way they are constructed (\tsobj[pkg]{expl} coffins) it will result in a \emph{Float(s) lost} error.
1060 \end{tsremark}
1061
1062 \begin{codedescribe}[env]{tsremark}
1063 \begin{codesyntax}
1064 \tsmacro{\begin{tsremark}}[NB]{}
1065 \tsmacro{\end{tsremark}}{}
1066 \end{codesyntax}
1067 The environment body will be typeset as a text note. \tsobj[oarg]{NB} (defaults to Note:) is the note begin (in boldface). For instance:
1068 \begin{codestore}[demo.remark]
1069 Sample text. Sample test.
1070 \begin{tsremark}[N.B.]
1071 This is an example.
1072 \end{tsremark}
1073 \end{codestore}
1074 \tsdemo[codedesc,codeprefix={},resultprefix={}]{demo.remark}
1075 \end{codedescribe}
1076
1077
1078 \newpage
1079
1080 \subsection{Auxiliary Commands and Environment}\label{aux-commands}
1081 In case the Document Class being used redefines the \tsobj[code,no index]{\maketitle} command and/or \tsobj[env,no index]{abstract} environment, alternatives are provided (based on the article class).
1082
1083 \begin{codedescribe}[code]{\typesettitle,\tstitle}
1084 \begin{codesyntax}
1085 \tsmacro{\typesettitle}{title-keys}
1086 \tsmacro{\tstitle}{title-keys}
1087 \end{codesyntax}
1088 This is based on the \tsobj[code,no index]{\maketitle} from the \tsobj[pkg]{article} class. The \tsobj[marg]{title-keys} are:
1089 \end{codedescribe}
1090
1091 \begin{describelist*}{key}
1092 \describe{title}{The title.}
1093 \describe{author}{Author's name. It's possible to use the \tsobj[code,no index]{\footnote} command in it.}
1094 \describe{date}{Title's date.}
1095 \end{describelist*}
1096 \begin{tsremark}
1097 The \tsobj[code,no index]{\footnote} (inside this) will use an uniquely assigned counter, starting at one, each time this is used (to avoid \tsobj[pkg]{hyperref} warnings).
1098 \end{tsremark}
1099
1100
1101 \begin{codedescribe}[env]{tsabstract}
1102 \begin{codesyntax}
1103 \tsmacro{\begin{tsabstract}}{}
1104 \ldots
1105 \tsmacro{\end{tsabstract}}{}
1106 \end{codesyntax}
1107 This is the \tsobj[env,no index]{abstract} environment from the \tsobj[pkg]{article} class.
1108 \end{codedescribe}
1109
1110 \begin{codedescribe}[code,new=2023/05/16]{\typesetdate,\tsdate}
1111 \begin{codesyntax}
1112 \tsmacro{\typesetdate}{}
1113 \tsmacro{\tsdate}{}
1114 \end{codesyntax}
1115 This provides the current date (in Month Year format).
1116 \end{codedescribe}
1117
1118
1119
1120 \subsection{Shortcuts (experimental)}\label{activ-tokens}
1121 This is marked as experimental because the actual chosen short cuts might change, for instance, if it crashes badly with some other package. As of now, the current implementation tries to minimize any side effect, only kicking in if, and only if, one of the given patterns is found. Moreover, once deactivated, \tsobj{\tsOff}, any previous code is fully restored.
1122
1123 \begin{codedescribe}[code]{\tsOn,\tsOff}
1124 \begin{codesyntax}
1125 \tsobj{\tsOn}
1126 \tsobj{\tsOff}
1127 \end{codesyntax}
1128 This will switch the `shortcuts' on and off. Currently, only the character `!' is affected. \tsobj{\tsOn} preserves its status (if active or not, and related code, if any), so that \tsobj{\tsOff} can restore its full definition and status.
1129 \begin{tsremark}
1130 \tsobj{\tsOn} won't try to patch the current (if any) active definition of `!', but just save it (to be restored by \tsobj{\tsOff}), before setting its own code. Moreover, whilst active, if the use don't fit any of the given patterns (below), the previous active code (if any, and active) will be executed, or just `!' if it wasn't active.
1131 \end{tsremark}
1132 \begin{tsremark}
1133 If `!' already had an associated code, a warning will be raised, showing the previous code.
1134 \end{tsremark}
1135 \end{codedescribe}
1136
1137 \begin{codedescribe}[code,new=2025/12/29,note=active character,update=2026/02/12]{!:,!::,!!,!!:,!!::,!!?}
1138 \begin{codesyntax}
1139 \tsverb[code]{!:}\tsverb[marg]{[obj-type]{csv-list}} $\leftrightarrow$ \tsobj{\tsobj}
1140 \tsverb[code]{!::}\tsverb[marg]{[obj-type]{csv-list}} $\leftrightarrow$ \tsobj{\tsargs}
1141 \tsverb{!!}\tsverb[marg]{[obj-type]{verbatim text}} $\leftrightarrow$ \tsobj{\tsverb}
1142 \tsverb{!!:}\tsverb[marg]{{name}} $\leftrightarrow$ \tsobj{\tsmeta}
1143 \tsverb{!!::}\tsverb[marg]{{note}} $\leftrightarrow$ \tsobj{\tsmarginnote}
1144 \tsverb{!!?}\tsverb[marg]{{macro-list}[oargs-list]{margs-list}} $\leftrightarrow$ \tsobj{\tsmacro}
1145 \end{codesyntax}
1146 Once active (\tsobj{\tsOn}), \tsobj{!:} is a shortcut for \tsobj{\tsobj}, including it's optional parameter. Same for \tsobj{!::} (\tsobj{\tsargs}), and the others.
1147 \end{codedescribe}
1148 \begin{tsremark}
1149 To reduce undesirable side effects, no space (or any other character besides the ones shown) is allowed between the first `!' and either the `[' or `\{', for instance \tsobj{!!:{some}} will typeset \tsmeta{some}, but not \tsverb{!! :{some}} or \tsverb{!!: {some}} or \tsverb{!!:some}.
1150 \end{tsremark}
1151 \begin{tsremark}
1152 If none of these patterns are recognized it will either leave the `!' character or execute its previous code (if it was active). Same for the companions colon, `:', and question mark, `?', peeked in the process.
1153 \end{tsremark}
1154
1155
1156 \newpage
1157 \section{codelstlang Package}\label{lstlang.pack}
1158 This is an auxiliary package (which can be used on its own). It assumes the package \tsobj[pkg]{listings} was already loaded, and just defines the following \TeX{} dialects, all of them derived from \tsobj[pkg]{listings} \tsverb[key]{[LaTeX]TeX}:
1159 \begin{describelist}{key,no index}
1160 \describe{[l3kernelsign]TeX} {Most/all \tsobj[pkg]{expl} keys found in the \tsobj[pkg,comma]{l3kernel}\cite{l3kernel} packages, including signatures. }
1161 \describe{[l3expsign]TeX} {Most/all \tsobj[pkg]{expl} keys found in the \tsobj[pkg,comma]{l3kernel} experimental packages, including signatures. }
1162 \describe{[l3amssign]TeX} {Most/all \tsobj[pkg]{expl} keys found in the \tsobj[pkg,comma]{ams,siunitx} and related packages, including signatures. }
1163 \describe{[l3pgfsign]TeX} {Most/all \tsobj[pkg]{expl} keys found in the \tsobj[pkg,comma]{pgf} and related packages, including signatures. }
1164 \describe{[l3bibtexsign]TeX} {Most/all \tsobj[pkg]{expl} keys found in the \tsobj[pkg,comma]{bibtex,biblatex} and related packages, including signatures.}
1165 \begin{tsremark}
1166 The underscore `\_' and colon `:' have to be defined as letters (\tsverb[key]{letter = { _ , : }}, see \ref{code-keys}). Take note that these dialects are quite large, due the many signatures variants.
1167 \end{tsremark}
1168 \describe{[l3kernel]TeX} {Most/all \tsobj[pkg]{expl} keys found in the \tsobj[pkg,comma]{l3kernel} packages, without signatures. }
1169 \describe{[l3exp]TeX} {Most/all \tsobj[pkg]{expl} keys found in the \tsobj[pkg,comma]{l3kernel} experimental packages, without signatures. }
1170 \describe{[l3ams]TeX} {Most/all \tsobj[pkg]{expl} keys found in the \tsobj[pkg,comma]{ams,siunitx} and related packages, without signatures. }
1171 \describe{[l3pgf]TeX} {Most/all \tsobj[pkg]{expl} keys found in the \tsobj[pkg,comma]{pgf} and related packages, without signatures. }
1172 \describe{[l3bibtex]TeX} {Most/all \tsobj[pkg]{expl} keys found in the \tsobj[pkg,comma]{bibtex,biblatex} and related packages, without signatures.}
1173 \begin{tsremark}
1174 The underscore `\_' has to be defined as letter (\tsverb[key]{letter = { _ }}, but not the colon `:', see \ref{code-keys}). These are more compact versions of the previous ones.
1175 \end{tsremark}
1176 \describe{[kernel]TeX} {Most/all document level keys found in the \tsobj[pkg,comma]{kernel} packages. }
1177 \describe{[xpacks]TeX} {Most/all document level keys found in the \tsobj[pkg,comma]{x*} packages, like \tsobj[pkg,comma]{xkeyval,xpatch,xcolor} etc. }
1178 \describe{[ams]TeX} {Most/all document level keys found in the \tsobj[pkg,comma]{ams,siunitx} and related packages. }
1179 \describe{[pgf]TeX} {Most/all document level keys found in the \tsobj[pkg,comma]{pgf} and related packages.}
1180 \describe{[pgfplots]TeX} {Most/all document level keys found in the \tsobj[pkg,comma]{pgfplots} and related packages.}
1181 \describe{[bibtex]TeX} {Most/all document level keys found in the \tsobj[pkg,comma]{bibtex,biblatex} and related packages.}
1182 \describe{[babel]TeX} {Most/all document level keys found in the \tsobj[pkg,comma]{babel} and related packages.}
1183 \describe{[hyperref]TeX} {Most/all document level keys found in the \tsobj[pkg,comma]{hyperref} and related packages.}
1184 \begin{tsremark}
1185 These are usual document level, \LaTeXe, commands. In particular none of them includes any `@' symbol.
1186 \end{tsremark}
1187 \end{describelist}
1188
1189
1190 \printbibliography
1191
1192
1193 %\begin{codedescribe}[env]{tsabstract}
1194 %\begin{codesyntax*}[codedesc,codeprefix={},resultprefix={}]
1195 %\tsmacro{\begin{tsremark}}{}
1196 %\ldots \tsobj[code]{\some}
1197 %\tsmacro{\end{tsremark}}{}
1198 %\end{codesyntax*}
1199 %This is the \tsobj[env,no index]{abstract} environment from the \tsobj[pkg]{article} class.
1200 %\end{codedescribe}
1201
1202
1203
1204 %\printindex
1205
1206 %\ExplSyntaxOn
1207 %\benchmark_toc:
1208 %\ExplSyntaxOff
1209
1210 %\tsOff
1211
1212
1213
1214 \end{document}
1215