summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/gmverb/gmverb.sty
blob: 66af1efd33e49059a94586b239262bf0bf0d09f8 (plain)
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
%
% \GetFileInfo{gmverb.sty}
% \title{The \pk{gmverb} Package\thfileinfo}
% \author{Natror (Grzegorz Murzynowski)}
% \date{\today}
% \maketitle
%%
%% This is (a~documentation of) file \pk{gmverb.sty},
%% intended to be used with \LaTeXe\ as a~package for
%% a~slight redefinition of the |\verb| macro and \env{verbatim}
%% environment and for short verb marking such as \verb+|\mymacro|+.
%% \medskip
%%
% \begin{copyrnote}
%
%%Written by Natror (Grzegorz Murzynowski),
%% natror at o2 dot pl
%%
%% \copyright\,2005, 2006, 2007 by Natror (Grzegorz Murzynowski).
%%
%% This program is subject to the \LaTeX\ Project Public License.
%% See \url{http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html} ^^A
%% for the details of that license.
%%
%% LPPL status: "author-maintained".\par
%%
%% Many thanks to my \TeX\ Guru Marcin Woli\nacute ski for his \TeX nical ^^A
%% support.\par
%\end{copyrnote}
%
% \ChangesStart{}{1000/00/00}
% 
% \chschange{v0.70}{06/8/15}{523}
% \chschange{v0.71}{06/9/04}{596}
% \chschange{v0.72}{06/9/05}{660}
% \chschange{v0.73}{06/9/06}{671}
% \chschange{v0.74}{06/9/7}{678}
% \chschange{v0.76}{06/9/24}{679}
% \chschange{v0.77}{06/9/28}{639}
% \chschange{v0.78}{06/12/1}{648}
% \chschange{v0.80}{07/3/2}{683}
% \chschange{v0.80}{07/3/30}{667}
% \chschange{v0.82}{2007/4/26}{663}
% \chschange{v0.83}{2007/11/9}{666}
% \chschange{v0.84}{2007/11/13}{658}
%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{gmverb}
    [2007/11/13 v0.84 After shortvrb (FM) but my way (GM)]

%
% \tableofcontents
% 
% \division{Intro, Usage}
%
% This package redefines the |\verb| command and the \env{verbatim}
% environment so that the verbatim text can break into lines, with |%|
% (or another character chosen to be the comment char) as
% a~`hyphen'. Moreover, it allows the user to define \hisher\ own
% \env{verbatim}-like environments provided their contents would be not
% \emph{horribly} long (as long as a macro's argument may be at most).
%
% This package also allows the user to declare a chosen char(s) as 
% a `short verb' e.g., to write \verb+|\a\verbatim\example|+ instead of
% \verb+\verb|\a\verbatim\example|+.
% \dekmedskip 
%
% The \pk{gmverb} package redefines the |\verb| command and the
% \env{verbatim} environment in such a~way that | |, |{| and |\| are
% breakable, the first with no `hyphen' and the other two with the
% comment char as a~hyphen. I.e. |{|\<subsequent text>|}| breaks into
% |{%|\par \<subsequent text>|}| ^^A]  bal. braces for Emacs
% and \<text>|\mymacro| breaks into \<text>|%|\par
% |\mymacro|.
%
% (If you don't like linebreaking at backslash, there's the
% \TextUsage\fixbslash\ declaration (observing the common scoping
% rules, hence OCSR) and an analogous
% declaration for the left brace: \TextUsage\fixlbrace.)
% \dekmedskip
%
% The default `hyphen' is |%| since it's the default comment char. If
% you wish another char to appear at the linebreak, use the
% \TextUsage\VerbHyphen\ declaration that takes |\|\<char> as the only
% argument. This declaration is always global.
%
% \stanza
% Another difference is the \TextUsage\verbeolOK\ declaration
% (OCSR). Within its scope, |\verb| allows an
% end of a~line in its argument and typesets it just as a~space. 
%
% As in the standard version(s), the plain |\verb| typesets the spaces
% blank and |\verb*| makes them visible. 
% 
% Moreover, \pk{gmverb} provides the \TextUsage\MakeShortVerb\ macro
% that takes a~one-char control sequence as the only argument and
% turns the char used into a~short verbatim delimiter, e.g., after
% \verb+\MakeShortVerb*\|+ (as you guess, the declaration has its
% starred version, which is for visible spaces, and the non-starred for
% the spaces blank) you may type \verb+|\mymacro|+ to get |\mymacro|
% instead of typing |\verb+\mymacro+|. Because the char used in this
% example is my favourite and used just this way by DEK in the
% \TeXbook's format, \pk{gmverb} provides a~macro \TextUsage\dekclubs\
% as a~shorthand for \verb+\MakeShortVerb*\|+.
%
% Be careful because such active chars may interfere with other
% things, e.g., the \verb+|+ with the vertical marker in tables and
% with the \pk{tikz} package. If this happens, you can declare e.g.,
% \TextUsage\DeleteShortVerb\verb+\|+ and the previous meaning of the
% char used shall be restored.
%
% One more difference between \pk{gmverb} and \pk{shortvrb} is that
% the chars |\active|ated  by |\MakeShortVerb| in the math mode behave
% as if they were `other', so you may type e.g., \verb+$|$+ to get
% $|$ and |+| |\active|ated this way is in the math mode typeset properly
% etc.
%
% However, if you don't like such a~conditional behaviour, you may use
% \TextUsage\OldMakeShortVerb\ instead, what I~do when I~like to
% display short verbatims in displaymath.
%
%
% There's one more declaration provided by \pk{gmverb}:
% \TextUsage\dekclubs, which is a~shorthand for
% \verb+\MakeShortVerb*\|+ and \TextUsage\dekclubs*\ for
% \verb+\OldMakeShortVerb*\|+.  
%
% So that, after the latter declaration, you can write 
%\[\verb+\[|+\<verbatim stuff>\verb+|\]+\]
% instead of 
%\[\verb+\[\hbox{|+\<the stuff>\verb+|}\]+\]
% to get a~displayed shortverb. 
%
% Both versions of |\dekclubs| OCSR.
%
%
%
% \stanza
% As many good packages, this also does not support any options.
%
% \begin{gmlonely}
%   \subdivision{Installation}
%
%   Unpack the \file{gmverb-tds.zip} archive (this is an archive
%   conforming the \acro{TDS} standard, see \file{CTAN/tds/tds.pdf})
%   in a~\file {texmf} directory or put the \pk{gmverb.sty} somewhere
%   in the \file{texmf/\:tex/\:latex} branch on your own. Creating
%   a~\file{texmf/\:tex/\:latex/\:gm} directory may be advisable if
%   you consider using other packages written by me.
%
%   Then you should refresh your \TeX\ distribution's files' database
%   most probably.
% \end{gmlonely}
%
% \subdivision{Contents of the \pk{gmverb.zip} Archive}
%
% The distribution of the \pk{gmverb} package consists of the
% following four files and a~\acro{TDS}-compliant archive.
% \begin{verse}
%   \pk{gmverb.sty}\\
%   \pk{README}\\
%   \pk{gmverbDoc.tex}\\
%   \pk{gmverbDoc.pdf}\\
%   \pk{gmverb.tds.zip}
% \end{verse}
% 
% \begin{gmlonely}
%   \subdivision{Compiling the Documentation}
%
%   The last of the above files (the \pk{.pdf}, i.e., \emph{this
%     file}) is a~documentation compiled from the \pk{.sty} file by
%   running \LaTeX\ on the \pk{gmverbDoc.tex} file twice,
%   then MakeIndex on the gmverb.idx file, and then \LaTeX\
%   on gmverbDoc.tex once more.
%
%   MakeIndex shell command:
%\begin{verbatim}
%makeindex -r gmverbDoc
%\end{verbatim}
%   The |-r| switch is to forbid MakeIndex to make implicit ranges since
%   the (code line) numbers will be hyperlinks.
%
%   Compiling the documentation requires the packages:
%   \pk{gmdoc} (\pk{gmdoc.sty} and \pk{gmdocc.cls}), \pk{gmverb.sty},
%   \pk{gmutils.sty} and also some standard packages:
%   \pk{hyperref.sty}, \pk{color.sty}, \pk{geometry.sty},
%   \pk{multicol.sty}, \pk{lmodern.sty} and \pk{fontenc.sty} that should
%   be installed on your computer by default.
%
%   If you had not installed the \pk{mwcls} classes (available on
%   CTAN and present in \TeX\ Live e.g.), the result of your
%   compilation might differ a~bit from the \pk{.pdf} provided in this
%   \pk{.zip} archive in formatting: If you had not installed
%   \pk{mwcls}, the standard \pk{article.cls} class would be used.
% \end{gmlonely}
%
%
% \StopEventually{\NoEOF}
%
%
% \division{The Code}
%
% \DoIndex{\verb \verb*}
% \subdivision{Preliminaries}
%
\RequirePackage{gmutils}[2007/04/24]
% For |\firstofone|, |\afterfi|, |\gmobeyspaces|, |\@ifnextcat|, |\foone| and
% |\noexpand|'s and |\expandafter|'s shorthands |\@nx| and |\@xa| resp.

%    \begin{oldmc}
\foone{\@makeother\%}
{\def\xiipercent{%}}
%    \end{oldmc}

% Someone may want to use another char for comment, but we assume here
% `orthodoxy'. Other assumptions in \pk{gmdoc} are made. The `knowledge'
% what char is the comment char is used to put proper `hyphen' when
% a~\env{verbatim} line is broken.
% \Define\verbhyphen
% \changes{v0.75}{06/9/8}{renamed from a~rather confusing
% \cs{commentchar}} 
\let\verbhyphen\xiipercent

% Provide a~declaration for easy changing it. Its argument should be
% of |\|\<char> form (of course, a~\<char>\catother is also allowed).
% \Define\VerbHyphen
% \changes{v0.78}{06/12/1}{added}
\def\VerbHyphen#1{%
  {\escapechar\m@ne
    \@xa\gdef\@xa\verbhyphen\@xa{\string#1}}}
% As you see, it's always global.


% \subdivision{The Breakables}
%
% Let's define a~|\discretionary| left brace such that if it breaks,
% it turns |{%| at the end of line. We'll use it in almost Knuthian
% |\ttverbatim|---it's part of this `almost'.
\foone{\catcode`\[=1 \@makeother\{ \catcode`\]=2 }%
[%
   \def\breaklbrace[\discretionary[{%^^A}
     \verbhyphen][][{%^^A}
       ]]%
   \def\xiilbrace[{%^^A}
     ]%
]% of |\firstofone|


\foone{\catcode`\[=1 \catcode`\{=\active \catcode`\]=2 }%
[%
   \def\dobreaklbrace[\catcode`\{=\active 
   \def{%^^A}
     [\breaklbrace\gm@lbracehook]]%\label{gm@lbracehook}
]

% Now we only initialize the hook. Real use of it will be made in
% \pk{gmdoc}. 
\relaxen\gm@lbracehook

% The |\bslash| macro defined below I~use also in more `normal' \TeX ing, e.g.,
% to |\typeout| some |\outer| macro's name.
%\Define\bslash \Define\breakbslash
\foone{\catcode`\!=0 \@makeother\\}%\CodeEscapeChar\!
{%
  !def!bslash{\}%^^A}
  !def!breakbslash{!discretionary{!verbhyphen}{\}{\}}%^^A}}
}
%\CodeEscapeChar\\
%
% Sometimes linebreaking at a~backslash may be unwelcome. The basic
% case, when the first CS in a~verbatim breaks at the lineend leaving
% there |%|, is covered by line \ref{special opening bslash}. For the
% others let's give the user a~countercrank:
\newcommand*\fixbslash{\let\breakbslash=\bslash}% to use due to the
% common scoping rules. But for the special case of a~backslash
% opening a~verbatim scope, we deal specially in the line
% \ref{special opening bslash}.
%
% Analogously, let's provide a~possibility of `fixing' the left brace:
\newcommand*\fixlbrace{\let\breaklbrace=\xiilbrace}


\foone{\catcode`\!=0 \catcode`\\=\active}%%\CodeEscapeChar\!^^A
  % ^^A~One rbrace is turned off for Emacs  by |\{|.
{%^^A{
  !def!dobreakbslash{!catcode`!\=!active !def\{!breakbslash}}%
}
%\CodeEscapeChar\\

% The macros defined below, |\visiblebreakspaces| and |\xiiclub|
% we'll use in the almost Knuthian macro making verbatim. This `almost'
% makes a~difference.
\foone{\catcode`\ =12 }% note this space is ${}_{10}$ and is gobbled
% by parsing the number.
{\def\xiispace{ }%
\def\breakablexiispace{\discretionary{ }{}{ }}}

\foone\obeyspaces% it's just re|\catcode|'ing.
{%
\newcommand*\activespace{ }%
\newcommand*\dobreakvisiblespace{\def {\breakablexiispace}\obeyspaces}%^^A
% |%| |\def|ing it caused a~stack overflow disaster with \pk{gmdoc}.
\newcommand*\dobreakblankspace{\let =\space\obeyspaces}% 
}

% \Define\xiiclub
\bgroup\@makeother\|
\firstofone{\egroup\def\xiiclub{|}}

% \subdivision{Almost-Knuthian \cs{ttverbatim}}
%
% |\ttverbatim| comes from \TeXbook\ too, but I~add into it a~\LaTeX\
% macro changing the |\catcode|s and make spaces visible and breakable
% and left braces too.
% \Define\ttverbatim
% \changes{v0.80}{2007/2/27}{\cs{ttverbatim@hook} added}
\newcommand*\ttverbatim{%
  \let\do=\do@noligs \verbatim@nolig@list
  \let\do=\@makeother \dospecials
  \dobreaklbrace\dobreakbslash
  \dobreakspace
  \tt
  \ttverbatim@hook}

% While typesetting stuff in the QX fontencoding I~noticed there were
% no spaces in verbatims. That was because the QX encoding doesn't
% have any reasonable char at position 32. So we provide a~hook in
% the very core of the verbatim making macros to set proper
% fontencoding for instance.
\@emptify\ttverbatim@hook

% \Define*{\VerbT1}
\def\VerbT1{\def\ttverbatim@hook{\fontencoding{T1}\selectfont}}

% We wish the visible spaces to be the default.
% \DefIndex\dobreakspace
\let\dobreakspace=\dobreakvisiblespace
%
%^^A~|\meta| and pals moved to \pk{gmutils}

% \subdivision{The Core: From \pk{shortvrb}}
%
% The below is copied verbatim ;-) from
% \file{doc.pdf} and then is added my slight changes.
% \Define\MakeShortVerb \Define*\MakeShortVerb*

\def\MakeShortVerb{%
  \@ifstar
  {\def\@shortvrbdef{\verb*}\@MakeShortVerb}%
  {\def\@shortvrbdef{\verb}\@MakeShortVerb}}

% \Define\@MakeShortVerb
\def\@MakeShortVerb#1{%
  \@xa\ifx\csname cc\string#1\endcsname\relax
  \@shortvrbinfo{Made }{#1}\@shortvrbdef
  \add@special{#1}%
  \AddtoPrivateOthers#1% a~macro to be \emph{really} defined in
  % \pk{gmdoc}.
  \@xa
  \xdef\csname cc\string#1\endcsname{\the\catcode`#1}%
  \begingroup
  \catcode`\~\active \lccode`\~`#1%
  \lowercase{%
    \global\@xa\let
    \csname ac\string#1\endcsname~%
    \@xa\gdef\@xa~\@xa{%
      \@xa\ifmmode\@xa\string\@xa~%
      \@xa\else\@xa\afterfi{\@shortvrbdef~}\fi}}% This
  % terrible number of |\expandafter|s is to make the shortverb char
  % just other in the math mode (my addition).
  \endgroup
  \global\catcode`#1\active
 \else
 \@shortvrbinfo\@empty{#1 already}{\@empty\verb(*)}%
 \fi}

% \Define\DeleteShortVerb
\def\DeleteShortVerb#1{%
  \@xa\ifx\csname cc\string#1\endcsname\relax
  \@shortvrbinfo\@empty{#1 not}{\@empty\verb(*)}%
  \else
  \@shortvrbinfo{Deleted }{#1 as}{\@empty\verb(*)}%
  \rem@special{#1}%
  \global\catcode`#1\csname cc\string#1\endcsname
  \global \@xa\let \csname cc\string#1\endcsname \relax
  \ifnum\catcode`#1=\active
  \begingroup
  \catcode`\~\active \lccode`\~`#1%
  \lowercase{%
    \global\@xa\let\@xa~%
    \csname ac\string#1\endcsname}%
  \endgroup \fi \fi}

% My little addition
% \DefIndex\gmv@packname
\@ifpackageloaded{gmdoc}{%
  \def\gmv@packname{gmdoc}}{%
  \def\gmv@packname{gmverb}}

% \Define\@shortvrbinfo
\def\@shortvrbinfo#1#2#3{%
  \PackageInfo{\gmv@packname}{%
   ^^J\@empty #1\@xa\@gobble\string#2 a short reference
    for \@xa\string#3}}

% \Define\add@special
\def\add@special#1{%
  \rem@special{#1}%
  \@xa\gdef\@xa\dospecials\@xa
  {\dospecials \do #1}%
  \@xa\gdef\@xa\@sanitize\@xa
  {\@sanitize \@makeother #1}}

% For the commentary on the below macro see the \pk{doc} package's
% documentation. Here let's only say it's just amazing: so tricky and
% wicked use of |\do|. The internal macro |\rem@special| defines |\do|
% to expand to nothing if the |\do|'s argument is the one to be
% removed and to unexpandable CSs |\do| and \<\cs{do}'s argument>
% otherwise. With |\do| defined this way the entire list is just
% globally expanded itself. Analogous hack is done to the |\@sanitize|
% list. 
% \Define\rem@special
\def\rem@special#1{%
  \def\do##1{%
    \ifnum`#1=`##1 \else \@nx\do\@nx##1\fi}%
  \xdef\dospecials{\dospecials}%
  \begingroup
  \def\@makeother##1{%
    \ifnum`#1=`##1 \else \@nx\@makeother\@nx##1\fi}%
  \xdef\@sanitize{\@sanitize}%
  \endgroup}

% And now the definition of \env{verbatim} itself. As you'll see (I~hope),
% the internal macros of it look for the name of the current
% environment (i.e., |\@currenvir|'s meaning) to set
% their expectation of the environment's |\end| properly. This is done
% to allow the user to define his/her own environments with
% |\verbatim| inside them. I.e., as with the \pk{verbatim} package,
% you may write |\verbatim| in the begdef of your environment and then
% necessarily |\endverbatim| in its enddef. Of course (or maybe
% surprisingly), the commands written in the begdef after |\verbatim|
% will also be executed at \cs{begin\marg{environment}}.
% \Define\verbatim
% \Define*{verbatim}
\def\verbatim{\@beginparpenalty \predisplaypenalty \@verbatim
  \frenchspacing \gmobeyspaces \@xverbatim}% in the \LaTeX\ version
% there's |%\@vobeyspaces| instead of |\gmobeyspaces|.
% \changes{v0.73}{06/09/06}{\cs{@vobeyspaces} changed to 
%   \cs{obeyspaces} to make the blank \cs{verb/atim} spaces breakable}
% \Define*{verbatim*}
\@namedef{verbatim*}{\@beginparpenalty \predisplaypenalty \@verbatim
  \@sxverbatim}

% \Define\endverbatim
\def\endverbatim{\@@par
  \ifdim\lastskip >\z@
    \@tempskipa\lastskip \vskip -\lastskip
    \advance\@tempskipa\parskip \advance\@tempskipa -\@outerparskip
    \vskip\@tempskipa
  \fi
  \addvspace\@topsepadd
  \@endparenv}

% \Define\endverbatim*
\n@melet{endverbatim*}{endverbatim}

% \Define\@xverbatim
\begingroup \catcode `!=0 %
\catcode `[= 1 \catcode`]=2 %
\catcode`\{=\active
\@makeother\}%
\catcode`\\=\active%\CodeEscapeChar\!
!gdef!@xverbatim[%
  !edef!verbatim@edef[%
    !def!noexpand!verbatim@end%
      ####1!noexpand\end!noexpand{!@currenvir}[%
      ####1!noexpand!end[!@currenvir]]]%
  !verbatim@edef
  !verbatim@end]%
!endgroup
% \CodeEscapeChar\\

% \Define\@sxverbatim
\let\@sxverbatim=\@xverbatim

% \Define\@verbatim
% F.\,Mittelbach says the below is copied almost verbatim from \LaTeX\
% source, modulo |\check@percent|.\Define\@verbatim
\def\@verbatim{%
  % \changes{v0.71}{06/09/04}{trivlist substituted with
  % chosen explicit macros. Analog. in endverbatim.}
  % 
  % Originally here was just |\trivlist \item[]|, but it worked
  % badly in my document(s), so let's take just highlights of if.
  \parsep\parskip
  % From |\@trivlist|:
  \if@noskipsec \leavevmode \fi
  \@topsepadd \topsep
  \ifvmode
    \advance\@topsepadd \partopsep
  \else
    \unskip \par
  \fi
  \@topsep \@topsepadd
  \advance\@topsep \parskip
  \@outerparskip \parskip
  % (End of |\trivlistlist| and |\@trivlist| highlights.)
  \@@par\addvspace\@topsep
  \if@minipage\else\vskip\parskip\fi
  \leftmargin\parindent% please notify me if it's a~bad idea.
  \advance\@totalleftmargin\leftmargin
  \raggedright
  \leftskip\@totalleftmargin% so many assignments to preserve the
  % \env{list} thinking for possible future changes. However, we may
  % be sure no internal \env{list} shall use |\@totalleftmargin| as
  % far as no inner environments are possible in \env{verbatim(*)}.
%^^A  \rightskip\z@
%^^A  \parindent\z@\parfillskip\@flushglue\parskip\z@
  \@@par% most probably redundant.
  \@tempswafalse
  \def\par{% but I~don't want the terribly ugly empty lines when
    % a~blank line is met. Let's make them \pk{gmdoc}-like
    % i.e., let a~vertical space be added as in between stanzas
    % of poetry. Originally |\if@tempswa\hbox{}\fi|, in my version will
    % be
    \ifvmode\if@tempswa\addvspace\stanzaskip\@tempswafalse\fi\fi
    \@@par
    \penalty\interlinepenalty \check@percent}%
  \everypar{\@tempswatrue\hangindent\verbatimhangindent\hangafter\@ne}%^^A
  % since several chars are breakable, there's a~possibility of
  % breaking some lines. We wish them to be hanging indented.
  \obeylines
  \ttverbatim}

\@ifundefined{stanzaskip}{\newlength\stanzaskip}{}
\stanzaskip=\medskipamount

% \Define\verbatimhangindent
% \changes{v0.71}{06/09/04}{added to verbatim parameters.}
\newlength\verbatimhangindent
\verbatimhangindent=3em

\providecommand*\check@percent{}
% In the \pk{gmdoc} package shall it be defined to check if the next
% line begins with a~comment char.
%
% Similarly, the next macro shall in \pk{gmdoc} be defined to update
% a~list useful to that package. For now let it just gobble its
% argument.
\providecommand*\AddtoPrivateOthers[1]{}
% Both of the above are |\provide|d to allow the user to load
% \pk{gmverb} after \pk{gmdoc} (which would be redundant since
% \pk{gmdoc} loads this package on its own, but anyway should be
% harmless).

% Let's define the `short' verbatim command.
%
% \Define*\verb*
\def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
  \bgroup
  \ttverbatim
  \gm@verb@eol
  \@ifstar{\@sverb@chbsl}{\gmobeyspaces\frenchspacing\@sverb@chbsl}}%^^A
% in the \LaTeX\ version there's |\@vobeyspaces| instead of
% |\gmobeyspaces|.
% \DefIndex\@sverb@chbsl
\def\@sverb@chbsl#1{\@sverb#1\check@bslash}

% \DefIndex\@def@breakbslash
\def\@def@breakbslash{\breakbslash}% because |\| is |\def|ined
% as \cs{break\-b\-slash} not \inverb|\let|.

% For the special case of a~backslash opening a~(short) verbatim, in
% which it shouldn't be breakable, we define the checking macro.
% \Define\check@bslash
\def\check@bslash{\@ifnextchar{\@def@breakbslash}{\bslash\@gobble}{}}
% \label{special opening bslash}
% \changes{v0.70}{06/09/02}{Opening backslash made unbreakable.}

\let\verb@balance@group\@empty

% \Define\verb@egroup
\def\verb@egroup{\global\let\verb@balance@group\@empty\egroup}

% \Define\gm@verb@eol
%\changes[\verb]{v0.74}{06/09/07}{line end forbidden inside \*}
\let\gm@verb@eol\verb@eol@error
% The latter is a~\LaTeXe\ kernel macro that |\active|ates line end
% and defines it to close the verb group and to issue an error
% message. We use a~separate CS 'cause we are not quite positive to
% the forbidden line ends idea. (Although the allowed line ends with
% a~forgotten closing shortverb char caused funny disasters at my
% work a~few times.) Another reason is that \pk{gmdoc} wishes to
% redefine it for its own queer purpose.
%
% However, let's leave my former `permissive' definition under the
% |\verb@eol| name.
%
\begingroup
\obeylines\obeyspaces%
\gdef\verb@eolOK{\obeylines%
\def^^M{ \check@percent}%
}%
\endgroup
% The |\check@percent| macro here is |\provide|d to be |\@empty| but in
% \pk{gmdoc} employed shall it be.
%
% Let us leave (give?) a~user freedom of choice:
\def\verbeolOK{\let\gm@verb@eol\verb@eolOK}
% \changes{v0.74}{06/09/07}{added}
% And back to the main matter,
\def\@sverb#1{%
  \catcode`#1\active \lccode`\~`#1%
  \gdef\verb@balance@group{\verb@egroup
    \@latex@error{Illegal use of \bslash verb command}\@ehc}%
  \aftergroup\verb@balance@group
  \lowercase{\let~\verb@egroup}}

\def\verbatim@nolig@list{\do\`\do\<\do\>\do\,\do\'\do\-}

\def\do@noligs#1{%
  \catcode`#1\active
  \begingroup
  \lccode`\~=`#1\relax
  \lowercase{\endgroup\def~{\leavevmode\kern\z@\char`#1}}}

% And finally, what I~thought to be so smart and clever, now is just
% one of many possible uses of a~general almost Rainer Sch\"opf's
% macro:
% \Define\dekclubs
\def\dekclubs{\@ifstar{\OldMakeShortVerb*\|}{\MakeShortVerb*\|}}

% But even if a~shortverb is unconditional, the spaces in the math
% mode are not printed. So, 
%\Define\edverbs
% \changes{v0.79}{2007/01/01}{added}
% \changes{v0.80}{2007/02/27}{debugged, i.e. \cs{hbox} added back and
% redefinition of \cs{[}}%^^A]
\newcommand*\edverbs{%
  \let\gmv@dismath\[%
  \let\gmv@edismath\]%
  \def\[{%^^A\]
    \@ifnextac\gmv@disverb\gmv@dismath}%
  \let\edverbs\relax}%

\def\gmv@disverb{%
  \gmv@dismath
  % ^^A  \@xa\ verb\string
  \hbox\bgroup\def\]{\egroup\gmv@edismath}}

%\subdivision{\pk{doc}- And \pk{shortvrb}-Compatibility}
%
% One of minor errors while \TeX ing \pk{doc.dtx} was caused by my
% understanding of a~`shortverb' char:  at my settings, in the math
% mode an active `shortverb' char expands to itself's `other' version
% thanks to |\string|. \pk{doc/shortvrb}'s concept is different, there
% a~`shortverb' char should work as usual in the math mode. So let it
% may be as they wish:
% \Define\old@MakeShortVerb
 
\def\old@MakeShortVerb#1{%
  \@xa\ifx\csname cc\string#1\endcsname\relax
  \@shortvrbinfo{Made }{#1}\@shortvrbdef
  \add@special{#1}%
  \AddtoPrivateOthers#1% a~macro to be \emph{really} defined in
  % \pk{gmdoc}. 
  \@xa
  \xdef\csname cc\string#1\endcsname{\the\catcode`#1}%
  \begingroup
  \catcode`\~\active \lccode`\~`#1%
  \lowercase{%
    \global\@xa\let\csname ac\string#1\endcsname~%
    \@xa\gdef\@xa~\@xa{%
      \@shortvrbdef~}}%
  \endgroup
  \global\catcode`#1\active
 \else
 \@shortvrbinfo\@empty{#1 already}{\@empty\verb(*)}%
 \fi}

% \Define\OldMakeShortVerb
\def\OldMakeShortVerb{\begingroup
  \let\@MakeShortVerb=\old@MakeShortVerb
  \@ifstar{\eg@MakeShortVerbStar}{\eg@MakeShortVerb}}

% \Define\eg@MakeShortVerbStar \Define\eg@MakeShortVerb
\def\eg@MakeShortVerbStar#1{\MakeShortVerb*#1\endgroup}
\def\eg@MakeShortVerb#1{\MakeShortVerb#1\endgroup}


\endinput% for the Tradition.


% \ChangesGeneral
%
% \changes{v0.81}{2007/04/13}{\cs{afterfi} made two-argument (first
% undelimited, the stuff to be put after \cs{fi}, and the other,
% delimited with \cs{fi}, to be discarded}

% \changes{v0.83}{2007/11/09}{added a~hook in the active left brace
% definition intended for \pk{gmdoc} automatic detection of
% definitions (in line \protect\ref{gm@lbracehook})}

% \PrintChanges \PrintIndex
% \Finale

% (For my GNU Emacs:)
%%% Local Variables: 
%%% mode: doctex
%%% TeX-master: "../../../../LaTeX/TeXGuru/gmverb/gmverbDoc.tex"
%%% End: