Chapter 11
Verbatim Enviroments

   11.1 Verbatim Text
      Between Paragraphs
   11.2 JavaScript
   11.3 Cascade Style Sheets

<..local env..>
 <.blocs for local env.>
 \ifHtml  <.html local env.>
 \fi
 <.verbatim.>
 -_-_-

11.1 Verbatim Text

NOTE: VERBATIM WAS THERE for javascript and the like????

Between Paragraphs

For the option \Verbatim-, it should be noted the requested special character should not come from the word EndVerbatim. Letters within the environment carry categoty code 11, space, tab and end-of-line characters carry category code 13, and the other characters have category code 12. CHECK TABS

<..verbatim..>
 \def\V:rbatim{\begingroup \begin:Verb \Verb:env }
 \def\:EndVerbatim{\end:Verb \endgroup }
 -_-_-

<..the /EndVerbatim delimiter..>
 {
 \xdef\Verb:atim#1\EndVerbatim{\noexpand\vrb:tt
    \leavevmode#1\noexpand\:EndVerbatim}
 \catcode‘\/=0   /catcode‘/\=12
 /xdef/Ver:batim#1\EndVerbatim{/noexpand/vrb:tt
    /leavevmode#1/noexpand/:EndVerbatim}
 }
 -_-_-

Without the /leavevmode the header is lost when \Verbatim is followed by empty line. [test]

 
>  > 5.  Also, why did you go in the first place to ‘alltt’ and 
>  >     not ‘verbatim’? 
> 
>   Verbatim is an ugly beast. It can’t be placed in the argument of 
> another environment - e.g., I can’t create a new environment like this: 
> 
> \newenvironment{\test} 
>   {\fontsize{11}{12}\selectfont\begin{verbatim}} 
>   {\end{verbatim}} 
 

<..html config util..>+
 \NewConfigure{tt}[1]{\let\vrb:tt=#1}
 \let\vrb:tt=\tt
 -_-_-

<..verbatim..>+
 \def\Verb:env{\no:catcodes0{64}{12}\no:catcodes{65}{90}{11}%
    \no:catcodes{91}{96}{12}\no:catcodes{97}{122}{11}%
    \no:catcodes{123}{255}{12}%
    \catcode‘\^^M=13    \catcode‘\ =13    \catcode‘\^^I=13
    \:Verbatim      \::Verbatim }%
 \def\::Verbatim{\futurelet\:temp\V:erbatim}
 \def\V:erbatim{%
    \ifx -\:temp  \expandafter\Ve:rbatim
    \else  \let\start:verb=\Ver:batim  \expandafter\Ver:sp \fi }
 \def\Ver:sp{%
    \ifx \ver:sp\:temp  \expandafter\Ver:assg
    \else         \expandafter\Ver:ln \fi }
 \def\Ver:ln{%
    \ifx \ver:ln\:temp  \expandafter\Ver:assg
    \else         \expandafter\start:verb \fi }
 \def\Ver:assg{\afterassignment\start:verb\let\:temp=}
 <.optional control char in /Verbatim.>
 <.space and eoln chars in /Verbatim.>
 <.the /EndVerbatim delimiter.>
 -_-_-

<..optional control char in /Verbatim..>
 {
 \catcode‘\/=0
 /catcode‘/\=12
 /gdef/Ve:rbatim#1#2{/catcode‘#2=0
    /ifx  #2\/let/start:verb=/Verb:atim
    /else    /let/start:verb=/Ver:batim /fi
    /futurelet/:temp/Ver:sp}
 }
 -_-_-

<..space and eoln chars in /Verbatim..>
 {
 \catcode‘\^^I=13  \catcode‘\/=0   \catcode‘\\=12
 /catcode‘/.=10  /catcode‘/^^M=13      /catcode‘/ =13%
 /gdef/:Verbatim{%
 .../def^^M{/ht:everypar{/Verb:eoln}/Verb:boln/par/leavevmode}%
 .../def {/Verb:sp}%
 .../let/ver:sp= %
 .../let/ver:ln=^^M%
 .../def^^I{/leavevmode  }}}
 -_-_-

The following establishes a configurartion according to what should appear at the start, end, and each end-of-ln.

<..verbatim..>+
 \NewConfigure{VerbatimEnv}[2]{\def\begin:Verb{#1}\def\end:Verb{#2}}
 \Configure{VerbatimEnv}
    {\par  \edef\leftsk:p{\hskip\Verb:Left}%
     \leftskip=\z@ \parindent=\z@ \ht:everypar{\verb:config}}
    {\aft:Verb\par}
 \def\verb:config{\bef:Verb\csname leftsk:p\endcsname
    \def\verb:config{\Verb:boln \def\Verb:eoln{\leavevmode\par}\leftsk:p}}
 -_-_-

The following uses the above vehicle to establish a configuration in accordance to what should appear at the start, end, and before each of the non-leading lines.

<..html config util..>+
 \NewConfigure{HVerbatim}[4]{\c:def\bef:Verb{#1\Verb:eoln}%
    \c:def\aft:Verb{\ht:everypar{}#2}%
    \c:def\Verb:eoln{#3}\c:def\Verb:boln{#4}}
 \NewConfigure{HVerbatim+}[2]{\d:def\Verb:Left{#1}%
    \def\Verb:sp{#2}}
 -_-_-

The above has left margin of \Verb:Left and typically has inappropriate space above and below the code. The following takes the left margin of the html code.

    \Configure{HVerbatim} 
    {\HtmlPar\HCode{<NOBR><CODE>}} 
    {\HChar{160}\HCode{</CODE></NOBR>}} 
    {\HChar{160}\HCode{</CODE></NOBR><BR><NOBR><CODE>}} 

The \leavevmode is needed for the case that the commands start paragrphs, to ensure that \everypar operations would be performed outside the groups of the commands.

11.2 JavaScript

Note that the first parameter of \ScriptCommand must be in braces, without surrounding spaces.

<..scripting commands..>
 \def\ScriptCommand{\begingroup \catcode‘\\=12
    \:DefScript}
 \def\:DefScript#1{\endgroup \Def:Script#1<.par del.>}
 \def\Def:Script#1#2<.par del.>{%
    \expandafter\let\csname :#2:\endcsname=\empty
    \edef\:temp{\long\def\expandafter\noexpand\csname a:#2\endcsname
                  ####1\expandafter\noexpand\csname End#2\endcsname
                  {####1\noexpand\:EndVerbatim}}\:temp
    \long\expandafter\def\csname
        b:#2\endcsname##1#1End#2{##1\:EndVerbatim}%
    \edef\:temp{\noexpand\DefScript:
       \expandafter\noexpand\csname #2\endcsname
       {\expandafter\noexpand\csname a:#2\endcsname}%
       {\expandafter\noexpand\csname b:#2\endcsname}}\:temp
 }
 -_-_-

The \long above is for cases that the new command is embeded in other commands as is the case, for instance, in \CssFile.

\begin{keep}-\ AAAAAAAAAAAAAAAAA BBBBB \end{keep} or \begin{keep} AAAAAAAAAAAAAAAAA BBBBB \end{keep}

<..scripting commands..>+
 \def\DefScript:#1#2#3#4#5{\def#1{\call:script{#2}{#3}{#4}{#5}}}
 \def\call:script#1#2#3#4{\begingroup \vrb:tt
    \leftskip=\z@  \parindent=\z@
    \Configure{HVerbatim}{\empty}{\empty}%
                         {\special{t4ht=}\empty}{\empty}%
    \Configure{HVerbatim+}{\z@}{\hbox{ }}%
    #3\ht:special{t4ht@@}%
    \let\Verb:atim=#1\let\Ver:batim=#2%
    \def\:EndVerbatim{\ht:special{t4ht@@}%
    #4\endgroup\ignorespaces}\Verb:env}
 -_-_-

A \Configure{HVerbatim}{}{}{}{} above will be problematic for the hooks option. The \special{t4ht=}is to ensure pseudo code at empty lines.

11.3 Cascade Style Sheets

<..scripting commands..>+
 \def\a:rootfont:{-}
 \:CheckOption{fonts+} \if:Option \def\a:rootfont:{+}
 \else
    \Log:Note{for marking of the base font,
        use the command line option ‘fonts+’}%
 \fi
 -_-_-

The above option requests css font information for the root font of the file.

\xml:empty is for inserting the / at end of tags by demand.

The \edef\Preamble{\Preamble} is needed for context where the command line arguments come indirectly through an \env macro.

<..utilities..>+
 \ifx \xml:empty\:UnDef
    \edef\Preamble{\Preamble}
    \:CheckOption{xhtml}
    \if:Option \else \:CheckOption{xml}\fi
    \if:Option
       \def\xml:empty{ /}
       \long\def\:xhtml#1{#1}
    \else
       \Log:Note{for XML code, use the command line option
                 ‘xml’ or ‘xhtml’}%
 
       \let\:xhtml=\:gobble
       \let\xml:empty=\empty
 \fi \fi
 -_-_-

Default font (the extra code is neded in order to activate it within the dvi file before a change in font, e.g., for a title):

<..start html file..>+
 \ht:special{t4ht>\jobname.tmp}{\everyhbox{}\hbox
    {x\ht:special{t4ht;\a:rootfont:}x}}%
 \ht:special{t4ht<\jobname.tmp}%
 -_-_-

<..early Configure..>+
 \NewConfigure{Css}[1]{\def\aa:Css{#1}}
 -_-_-

<..html utilitiesNO..>
 \tmp:cnt=\time  \divide\tmp:cnt by 60
 \edef\:temp{\the\tmp:cnt}
 \multiply\tmp:cnt by -60 \advance\tmp:cnt by \time
 \edef\:today{\the\year-\ifnum \month<10 0\fi
   \the\month-\ifnum \day<10 0\fi\the\day
    \space\ifnum \:temp<10 0\fi \:temp
    :\ifnum \tmp:cnt<10 0\fi\the\tmp:cnt :00}
 -_-_-