1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
%%
%% \iffalse ^^A we skip the debug setting
\IfFileExists{\string~/bin/gen_and_xela}{\errorcontextlines=1000 }{}
%% \fi
%% ^^A $Id: TheUltimateMaster.gmd,v 0.352 2011/10/12 15:19:42 natror Exp natror $
%% This is file “gmmeta.sty” generated with the DocStrip utility.
%%
%%
%% The original source files were:
%%
%% gmutils/gmutils.gmd (with options: `meta')
%%
%%
%% Copyright ©
%% by Grzegorz ‘Natror’ Murzynowski
%% natror (at) gmail (dot) com
%%
%% This program is subject to the LaTeX Project Public License.
%% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
%% for the details of that license.
%%
%% LPPL status: "author-maintained".
%%
%%
%%
%% For documentation please refer to the file(s)
%% gmutils.{gmd,pdf}.
%%
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{gmmeta}
[2011/10/12 v0.996 meta-symbols for typesetting macros and arguments (GM)]
%%
%%
%% ^^A\typeout{\unexpanded{#4}}%%
\RequirePackage{gmcommand}
\pdef\meta#1{%
% \begin{quotation}
% Since the old implementation of |\meta| could be used in math we better ensure
% that this is possible with the new one as well. So we use |\ensuremath| around
% |\langle| and |\rangle|. However this is not enough: if |\meta@font@select| below
% expands to |\itshape| it will fail if used in math mode. For this reason we hide
% the whole thing inside an |\nfss@text| box in that case.
% \end{quotation}
{\meta@fontsetting\ensuremath\langle}%
\ifmmode\@xa\nfss@text\fi
{% this has to be a~begin-group because \incmd{\nfss@text} becomes
% \incmd\hbox\ in math mode.
\gmu@activespaceblank
\meta@font@select
% Need to keep track of what we changed just in case the user changes font inside
% the argument so we store the font explicitly.
#1\/%
}%
{\meta@fontsetting\ensuremath\rangle}%
}% of |\meta|.
\pdef\gmu@activespaceblank{%
\@xa\def\gmu@activespace{\space\ignorespaces}% note the
% subtle perversity of this definition: if we meet more than one
% subsequent active spaces, then the first of them will
% typeset \incmd\space and its \incmd\ignorespaces\ will
% gobble \incmd\space\ of the second and will stop at
% \incs{ignorespaces} and this \incs{ignorespaces} will gobble
% the next \incs{space} and so on.
}
\def\meta@fontsetting{\color{red!85!black}}
\def\meta@font@select{\meta@fontsetting\it}
\def\<#1>{\meta{#1}}
\pdef\metachar#1{\begingroup\metacharfont #1\endgroup}
\def\metacharfont{\meta@fontsetting\rm}
\pdef\vs{\discre{\visiblespace}{}{\visiblespace}}
\def\printspaces#1{{\let~=\vs \let\ =\vs \gmu@pswords#1 \@nil}}
\def\gmu@pswords#1 #2\@nil{%
\ifx\relax#1\relax\else#1\fi
\ifx\relax#2\relax\else\vs\penalty\hyphenpenalty\gmu@pswords#2\@nil\fi}% note
\pdef\sfname#1{\textsf{\printspaces{#1}}}
\def\gmu@discretionaryslash{\discre{/}{\hbox{}}{/}}% the second
\pdef\file#1{\gmu@printslashes#1/\gmu@printslashes}
\def\gmu@printslashes#1/#2\gmu@printslashes{%
\sfname{#1}%
\ifx\gmu@printslashes#2\gmu@printslashes
\else
\textsf{\gmu@discretionaryslash}%
\afterfi{\gmu@printslashes#2\gmu@printslashes}\fi}
\pdef\pk#1{\textsf{#1}}
\DeclareCommand\cs{O{\type@bslash\penalty\@M\hskip\z@skip}}{%\
% \begin{enumargs}
% \dc O{\bslash} the control sequence's prefix, by default it's
% \inverb|\| allowing hyphenation of subsequent word,
% \dc m the control sequence or anything to be typeset in
% typewriter font.
% \end{enumargs}
% \chgs{2008/12/12 v0.98 added \cs{verbatim@specials}}
% \chgs{2008/12/12 v0.98 made \cmd\- switch to \cmd\normalfont\
% because \IMHO\ this underlines the fact that a~\CS\ belongs to the
% narrative. \cmd\hyphenchar\ set to 45 as in usual texts}
\begingroup
\ifdefined\verbatim@specials\verbatim@specials\fi
\edef\-{\discretionary{%
\ifdefined\gmv@hyphen\gmv@hyphen
\else\unexpanded{{\normalfont-}}%
\fi}{}{}}%
\def\{{\type@lbrace\yeshy}\def\}{\char`\}}%
\narrativett
\edef\narrativett@storedhyphenchar{\the\hyphenchar\font}%
\hyphenchar\font=%
\ifdefined\gmv@hyphenchar\gmv@hyphenchar
\else "A6
\fi
\cs@inner{#1}%
}% of |\cs|
\let\type@bslash\bslash
\pdef\cs@inner#1#2{%
#1#2%
\endgroup}
\def\narrativett{\ttfamily}% such name because I~introduce it to
\long\pdef\env{\cs[]}
\foone{\@makeother\^}
{\pdef\hathat{\cs[^^]}}
\AtBeginDocument{%
\@ifpackageloaded{gmdoc}{\def\hash{\cs[\#]}}{}}
\def\possfil{\hfil\penalty1000\hfilneg}
\def\possvfil{\vfil
\penalty\numexpr
\gmu@minnum{\clubpenalty+\widowpenalty}{9999}%
\relax % eaten by |\gmu@maxnum|
\relax % eaten by |\numexpr|
\vfilneg}
\long\def\cmd#1{\@xa\cs\@xa{\@xa\cmd@to@cs\string#1}\spifletter}% it has to be
\def\cmd@to@cs#1#2{\char\number`#2\relax}
\pdef\marg#1{{\narrativett\type@lbrace}\arg@wrap{#1}{\narrativett\char`\}}}
\pdef\oarg{\@ifnextchar[\@oargsq\@oarg}
\pdef\@oarg#1{{\narrativett[}\arg@wrap{#1}{\narrativett]}}
\pdef\@oargsq[#1]{\@oarg{#1}}
\pdef\parg{\@ifnextchar(\@pargp\@parg}
\def\@parg#1{{\narrativett(}\arg@wrap{#1}{\narrativett)}}
\def\@pargp(#1){\@parg{#1}}
\pdef\aarg{\@ifnextchar<\@aarga\@aarg}
\def\@aarg#1{{\narrativett<}\arg@wrap{#1}{\narrativett>}}
\def\@aarga<#1>{\@aarg{#1}}
\def\@verbaarga#1#2>{\@aarg{#2}\arg@dc}
\foone{\catcode`>\active}{%
\def\@verbaargact#1#2>{\@aarg{#2}\arg@dc}%
}
\foone{\@makeother\{\@makeother\}%
\catcode`[=\@ne\catcode`]=\tw@}
[% ^^A{
\def\@verbmargm#1#2}[% for an argument in curly braces in a verbatim, where
% the braces are not groupers and not necessary ‘other’. We'll know
% by \incmd{\@ifnextif} that the future token is an opening
% brace. Note this macro has 2nd parameter delimited with ‘other’
% closing brace (so may not act correctly when braces are nested
% (then hide them with special verbatim groupers)).
\marg[#2]%
\arg@dc
]%
]% of |\foone|
\def\arg@wrap{\meta}
\DeclareCommand\arg@dc!{%
% \chgs{200/03/04 v0.991 added rcognising of verbatim braces and
% angles}
s % (1)
o % (2)
c % (3)
b % (4)
a % (5)
T{\arg} % (6) just gobbled (for backwards compatibility)
}{% This command iterates while it
% has arguments and typesets them in brackets, parentheses or curly
% braces. Note it gobbles subsequent |\arg|s and just iterates.
\def\next{0}%
\gmuIfValueT{#1}%
{\metachar[\scanverb{*}\metachar]\def\next{1}}%
\gmuIfValueT{#2}{\@oarg{#2}\def\next{1}}%
\gmuIfValueT{#3}{\@parg{#3}\def\next{1}}%
\gmuIfValueT{#4}{\marg{#4}\def\next{1}}%
\gmuIfValueT{#5}{\aarg{#5}\def\next{1}}%
\@ifnextchar\egroup{\endgroup}{%
\if1\next\@xa\arg@dc
\else % it's crucial that we look for verbatim braces \emph{after}
% we checked there were no \inhash4, otherwise there would
% be an error.
\def\next{%
\@ifnextif\xiilbrace{\@verbmargm}%
{% not active or other lbrace
\@ifnextif<{% then we look for angles
\ifnum\catcode`>=\active
\@xa\@verbaargact
\else\@xa\@verbaarga
\fi}%
{% and if not angles neither verbatim braces, then
\endgroup % if we have no more arguments to typeset, we
% close the group opened in lines \ref{queer.group} and \ref{queer.group2}.
\spifletter
}%
}%
}%
\@xa \next
\fi
}% of not egroup
}% of |\arg@dc|
\foone{\obeylines\@makeother\^^C}{%
\AtBeginDocument{%
\let\math@arg\arg %
\pdef\arg{% This is |\arg| for meta-arguments.
\ifmmode\math@arg %
% \chgs{200/03/04 v0.991 added rcognising of verbatim braces and angles}
\else\afterfi{%
\begingroup %
% \label{queer.group}
\ifdefined\@ifQueerEOL\@ifQueerEOL{%
\def^^M{\unskip\space}% in the ‘queer’ \ac{EOL}s scope we
% keep line end active in case we have
% \incmd\arg\nlpercent\arg{arg.} ending a~line: the next
% char peeper touches line end or, if the line end was $_5$,
% gobbles the space it turns into so the comment layer would
% ‘leak’ to the code layer.
}{}\fi %
\arg@dc}%
\fi}% of |\arg|,
}% of |\AtBeginDocument|,
%
% \stanza
% And this is arg-typesetting command for verbatim arguments.
\pdef\argv{%
\begingroup %
% \label{queer.group2}
\@makeother\^^C%
\pdef\arg@wrap##1{%
\narrativett{##1}%
}%
\ifdefined\@ifQueerEOL\@ifQueerEOL{%
\def^^M{\unskip\space}% in the ‘queer’ \ac{EOL}s scope we
% keep line end active… as above
}{}%
\fi % of |\ifdefined|
\arg@dc}%
}% of |\foone|.
\DeclareCommand\cat{Q{'"0123456789ABCDEF}{0}}{%
${}_{\the\numexpr#1}\m@th$\spifletter
}
\pdef\CS{% \changes{v0.99n}{2008/08/30}{added}
\acro{CS}%
\@ifnextcat a{ }{}}% we put a~space if the next token is
\pdef\CSs{\CS{}es\@ifnextcat a{ }{}}% for pluralis.
\pdef\CSes{\CS{}es\@ifnextcat a{ }{}}% for pluralis.
\endinput
%%
%% End of file `gmmeta.sty'.
|