unison

Fork of Unison, a bi-directional file synchronization tool
git clone git://git.laack.co/unison.git
Log | Files | Refs | README | LICENSE

moreverb.sty (5585B)


      1 %%
      2 %% This is file `moreverb.sty',
      3 %% generated with the docstrip utility.
      4 %%
      5 %% The original source files were:
      6 %%
      7 %% moreverb.dtx  (with options: `moreverb')
      8 %%
      9 \NeedsTeXFormat{LaTeX2e}
     10 \ProvidesPackage{moreverb}
     11         [1997/12/07 v2.2d.2
     12     `more' verbatim facilities%
     13                    ]
     14 \@ifundefined{verbatim@processline}{\RequirePackage{verbatim}}{}
     15 \newwrite \verbatim@out
     16 \def\verbatimwrite#1{%
     17   \@bsphack
     18   \immediate\openout \verbatim@out #1
     19   \let\do\@makeother\dospecials
     20   \catcode`\^^M\active \catcode`\^^I=12
     21   \def\verbatim@processline{%
     22     \immediate\write\verbatim@out
     23       {\the\verbatim@line}}%
     24   \verbatim@start}
     25 \def\endverbatimwrite{%
     26   \immediate\closeout\verbatim@out
     27   \@esphack}
     28 \newcount\tab@position \newcount\tab@size
     29 \def\verbatimtabsize{8\relax}
     30 \def\@xobeytab{%
     31   \loop
     32     \toks@\expandafter{\the\toks@\@xobeysp}%
     33     \advance\tab@position-1
     34   \ifnum\tab@position>0 \repeat
     35 }
     36 \begingroup
     37   \catcode`\^^I=\active
     38   \gdef\@vobeytabs{\catcode`\^^I\active\let^^I\@xobeytab}%
     39 \endgroup
     40 \def\verbatim@tabexpand#1{%
     41   \ifx#1\@nil
     42     \the\toks@
     43     \expandafter\par
     44   \else
     45     \ifx#1\@xobeytab
     46       \@xobeytab
     47     \else
     48       \toks@\expandafter{\the\toks@#1}%
     49       \advance\tab@position\m@ne
     50     \fi
     51     \ifnum\tab@position=0 \tab@position\tab@size \fi
     52     \expandafter\verbatim@tabexpand
     53   \fi
     54 }
     55 \newcount\listing@line \listing@line=1
     56 \def\listing@step{1\relax}
     57 \def\listinglabel#1{\llap{\small\rmfamily\the#1}\hskip\listingoffset\relax}
     58 \def\thelisting@line{%
     59   \setbox0\hbox{\listinglabel\listing@line}%
     60   \@tempcnta=\listing@line
     61   \divide\@tempcnta\listing@step \multiply\@tempcnta\listing@step
     62   \ifnum\listing@line=\@ne
     63     \unhbox0
     64   \else
     65     \ifnum\@tempcnta=\listing@line
     66       \unhbox0
     67     \else
     68       \hskip\wd0
     69     \fi
     70   \fi}
     71 \providecommand\listingoffset{1.5em}
     72 \newcommand\listing[2][1]{%
     73   \global\listing@line=#2\relax
     74   \gdef\listing@step{#1\relax}
     75   \listingcont}
     76 \def\listingcont{%
     77   \tab@size=\verbatimtabsize
     78   \def\verbatim@processline{\tab@position\tab@size
     79     \thelisting@line \global\advance\listing@line1
     80     \toks@{}%
     81     \expandafter\verbatim@tabexpand\the\verbatim@line\@nil}%
     82   \@verbatim\frenchspacing\@vobeyspaces\@vobeytabs\verbatim@start}
     83 \let\endlisting=\endtrivlist
     84 \let\endlistingcont=\endtrivlist
     85 \expandafter\newcommand\csname listing*\endcsname[2][1]{%
     86   \global\listing@line=#2\relax
     87   \gdef\listing@step{#1\relax}
     88   \csname listingcont*\endcsname}
     89 \@namedef{listingcont*}{%
     90   \def\verbatim@processline{%
     91     \thelisting@line \global\advance\listing@line1
     92     \the\verbatim@line\par}%
     93   \@verbatim\verbatim@start}
     94 \expandafter\let\csname endlisting*\endcsname\endtrivlist
     95 \expandafter\let\csname endlistingcont*\endcsname\endtrivlist
     96 \def\listinginput{%
     97    \@ifnextchar[%]
     98      {\@listinginput}%
     99      {\@listinginput[1]}}
    100 \begingroup
    101   \catcode`\~=\active \lccode`\~=`\^^M \lccode`\N=`\N
    102   \lowercase{\endgroup
    103     \def\@listinginput[#1]#2#3{\begingroup
    104       \global\listing@line=#2
    105       \gdef\listing@step{#1\relax}
    106       \tab@size=\verbatimtabsize
    107       \def\verbatim@processline{\tab@position\tab@size
    108         \thelisting@line \global\advance\listing@line1
    109         \toks@{}%
    110         \expandafter\verbatim@tabexpand\the\verbatim@line\@nil}%
    111       \@verbatim\frenchspacing\@vobeyspaces\@vobeytabs
    112       \def\verbatim@addtoline##1~{%
    113         \verbatim@line\expandafter{\the\verbatim@line##1}}%
    114       \openin\verbatim@in@stream=#3
    115       \ifeof\verbatim@in@stream
    116         \PackageWarning{moreverb}{No file #3.}%
    117       \else
    118         \do@verbatimtabinput
    119         \closein\verbatim@in@stream
    120       \fi
    121       \endtrivlist\endgroup
    122     \@doendpe
    123   }%
    124 }
    125 \def\verbatimcmd{%
    126   \PackageError{moreverb}{The verbatimcmd environment is obsolete}%
    127                          {Use alltt (from the LaTeX base package
    128                            alltt) in place of verbatimcmd}%
    129 }
    130 \let\endverbatimcmd\relax
    131 \def\boxedverbatim{%
    132   \def\verbatim@processline{%
    133     {\setbox0=\hbox{\the\verbatim@line}%
    134     \hsize=\wd0 \the\verbatim@line\par}}%
    135   \@minipagetrue%%%DPC%%%
    136   \@tempswatrue%%%DPC%%%
    137   \setbox0=\vbox\bgroup \verbatim
    138 }
    139 \def\endboxedverbatim{%
    140   \endverbatim
    141   \unskip\setbox0=\lastbox %%%DPC%%%
    142   \egroup
    143   \fbox{\box0}% <<<=== change here for centering,...
    144 }
    145 \newenvironment{verbatimtab}{\obeylines\@verbatimtab}{\endtrivlist}
    146 \newcommand\@verbatimtab[1][\verbatimtabsize]{%
    147   \do@verbatimtab{#1}{%
    148      \@verbatim\frenchspacing\@vobeyspaces\@vobeytabs\verbatim@start}%
    149 }
    150 \def\do@verbatimtab#1#2{%
    151   \tab@size=#1
    152   \def\verbatim@processline{\tab@position\tab@size
    153     \toks@{}%
    154     \expandafter\verbatim@tabexpand\the\verbatim@line\@nil}%
    155   #2%
    156 }
    157 \def\verbatimtabinput{%
    158    \@ifnextchar[%]
    159      {\@verbatimtabinput}%
    160      {\@verbatimtabinput[\verbatimtabsize]}}
    161 \begingroup
    162 \catcode`\~=\active \lccode`\~=`\^^M \lccode`\N=`\N
    163 \lowercase{\endgroup
    164   \def\@verbatimtabinput[#1]#2{\begingroup
    165     \do@verbatimtab{#1}{%
    166       \@verbatim\frenchspacing\@vobeyspaces\@vobeytabs}%
    167     \def\verbatim@addtoline##1~{%
    168       \verbatim@line\expandafter{\the\verbatim@line##1}}%
    169     \openin\verbatim@in@stream=#2
    170     \ifeof\verbatim@in@stream
    171       \PackageWarning{moreverb}{No file #2.}
    172     \else
    173       \@addtofilelist{#2}%
    174       \do@verbatimtabinput
    175       \closein\verbatim@in@stream
    176     \fi
    177   \endtrivlist\endgroup\@doendpe}%
    178 }
    179 \def\do@verbatimtabinput{%
    180   \read\verbatim@in@stream to \verbtab@line
    181   \ifeof\verbatim@in@stream
    182   \else
    183     \expandafter\verbatim@addtoline\verbtab@line
    184     \verbatim@processline
    185     \verbatim@startline
    186     \expandafter\do@verbatimtabinput
    187   \fi
    188 }
    189 \endinput
    190 %%
    191 %% End of file `moreverb.sty'.