1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
% flm.latex.def.flmx.verbatim -- verbatim text.
%
% Verbatim text is written as ordinary LaTeX text in which every character
% stands for itself: the special characters escaped (\{, \}, \%, \&, \#, \_,
% \$, \textbackslash{}, \textasciitilde{}, \textasciicircum{}), every space a
% control space (\ ), a tab four of them. No verbatim catcodes are used, so
% verbatim text may stand anywhere: in a list item, a footnote, a table
% cell, a template's argument. The elements:
% \flmxVerbatim[kind, lang]{<text>}
% inline verbatim text; default: the text in the font of its kind.
% \begin{flmxVerbatimBlock}[kind, lang]
% \flmxVerbLine{<line>}
% ...
% \end{flmxVerbatimBlock}
% a block, one \flmxVerbLine per line (an empty line is
% \flmxVerbLine{}); default: a paragraph group in the font of its kind
% with \parindent and \parskip zero, ragged right, each line
% \par\noindent\strut<line>, between the hooks \flmxVerbatimBlockBegin
% and \flmxVerbatimBlockEnd (empty by default; redefine them for a
% frame or a background).
% Their keys:
% kind text (characters), code (computer code) or a (an identifier,
% such as a keyword or a name);
% lang the language the text is written in, where one was given.
%
% Fonts. Each kind of verbatim text has its own font switch, registered with
% \flmxDefineVerbatimFont{<kind>}{<font switch>}
% (a later registration wins). This chunk registers \ttfamily for the kind
% code and \itshape for the kind a. A kind with no registered font, text
% included, keeps the font of the surrounding text. Both defaults apply the
% font registered for the element's kind.
%
% A template distinguishes the kinds, or a language, by registering a look
% per kind, which then sets its own font:
% \flmxDefineVerbatim{<kind>}{<code over #1, the text>}
% \flmxDefineVerbatimBlock{<kind>}{<begin code>}{<end code>}
% It replaces the defaults with \flmxDefineVerbatimDefault{<code over #1>}
% and \flmxDefineVerbatimBlockDefault{<begin>}{<end>}, and the line with
% \renewcommand\flmxVerbLine[1]{...}.
\ExplSyntaxOn
% The font switch of each kind, run by both defaults; a kind with none
% registered keeps the font of the surrounding text.
\NewDocumentCommand \flmxDefineVerbatimFont
\cs_new_protected:Npn \__flmx_verbatim_font:
\flmxDefineVerbatimFont
\flmxDefineVerbatimFont
\NewDocumentCommand \flmxVerbatimBlockBegin
\NewDocumentCommand \flmxVerbatimBlockEnd
\NewDocumentCommand \flmxVerbatim
\flmxDefineVerbatimDefault
\NewDocumentEnvironment
\flmxDefineVerbatimBlockDefault
\NewDocumentCommand \flmxVerbLine
\ExplSyntaxOff