%From pat@slc8.INS.CWRU.Edu Thu Jun 30 15:53:56 1994 %Date: Thu, 30 Jun 1994 15:53:17 -0400 %From: pat@po.CWRU.Edu (Paul A. Thompson) %Subject: Re: Q: Some thing like \verbatiminput? %Enclosed find a copy of my .sty file verbasef (verbatim auto split external %files). I enclose both the main .sty file, and a secondary .sty file %needed for the main one. % %---------------- verbasef.sty % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % verbasef.sty % % This stands for VERBatim Automatic Splitting of External Files. % % Copyright (c) 1994 by Paul A. Thompson, All Rights Reserved. % Copy freely as per the GNU Copyleft. % % Requires: % The New Font Selection Scheme (NFSS) as implemented in LaTeX2e % VERBATIM.STY ::: Rainer Schoepf % VRBEXIN.STY ::: You % However, it is based on vrbinput.sty, a style by % Bernd Raichle which must be revised as discussed below % in the section labeled IMPORTANT % HERE.STY ::: David Carlisle % % There is a ifsubstr macro used below which is based on code from Donald % Arseneau. % % verbasef allows you to input (subsections of a) file, print them in % verbatim mode, while automatically breaking up the inputted lines into % pieces of a given length, which are output as figures. These figures are % posted using the [H] specification, which forces LaTeX to place the figure % at the spot of invocation, rather than floating the figures to the top of % the next page. % % Options for the verbasef specification include: % o numbering of input lines % o differential number of lines for the first page % o specification of the font for the verbatim output % o specification of the font for the optional line numbering % o specification of line numbers as labels % To use the labelling feature, non-standard approaches must be used. % A line number will be inserted into the main .aux file with label foo, % if the specification % % Vzzlabel|foo| % % is inserted AFTER the line which is to be indicated. Thus, if we have % a file with the following % % a line % b line % Vzzlabel|fooa| % c line % Vzzlabel|foob| % d line % Vzzlabel|fooc| % e line % f line % Vzzlabel|food| % % these lines will be found in the .aux file. % \newlabel{fooa}{{2}{1}} % \newlabel{foob}{{3}{1}} % \newlabel{fooc}{{4}{1}} % \newlabel{food}{{6}{1}} % % They can be used as any other label, for instance % % Using the labeling feature, pay attention to Line \ref{food} (found on % Page \pageref{food}) to understand this radically new method. % % Any lines with the Vzzlabel specification will be ignored in the % line counts. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % USING THE styLE % % verbasef is an adaptation of VRBSUBFILE, from Norman Walsh. % I fully acknowledge Mr./Dr. Walsh as the imprimature of the code ensconced % herein, but have included other features as indicated above. % % Comments and suggestions always welcome. % Paul A. Thompson % Department of Psychiatry, Data Analysis and Statistics Section % Case Western Reserve University % Cleveland, OH 44106 % % AudioNet: (216) 844-8946 % InterNet: pat@po.cwru.edu % % User interface: % VautoSubF[#1]#2#3#4#5#6 % Input lines #2 to #3 of file #4. If present, #1 indicates which lines % should be numbered. For example, if #1 is 5, lines 5, 10, 15, etc. % will be numbered. By default, lines are not numbered at all. % #5 is figure caption, and #6 is figure label. % % VautoSfFont[#1]#2 % Use font #2 for verbatim input lines and, if present, use font #1 for % line numbers. By default, #2 is \tt and #1 is \rm\tiny. % % VautoPl#1 % Placement of the figure (either H or some other placement character) % By default, placement is H (immediate here, here.sty) % (This currently does not function. All placement is done using the % H specification.) % % VautoLines[#1]{#2} % #2 is number of lines per page. If #1 is included, it is the number of % lines for the first page. If not, #1=#2 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT % IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT % IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % In order to use the verbasef.sty file, VRBINPUT.STY must be MODIFIED % and given a NEW NAME. Here are instructions for modification: % % 1. Obtain vrbinput.sty from the standard distribution channels. The file % should have the following characteristics: % % \fileversion{v1.0b} % \filedate{91/06/30} % \docdate{91/08/05} % % 2. Copy vrbinput.sty to a file vrbexin.sty. THIS MUST BE DONE PRIOR TO % EDITING ANY FILE. % % 3. Edit the file vrbexin.sty. Please don't edit the file vrbinput.sty. % Change Line 90 from % \verbatim@startline % to % \verbatim@start % as shown in the fragment of code from Lines 89-92 below. % % \def\verbatim@readfile#1{% % \verbatim@start % \openin\verbatim@in@stream #1\relax % \ifeof\verbatim@in@stream % % % 4. VERY IMPORTANT. CHANGE ALL OCCURRANCES of vrbinput, in titles, typeout % sections and credits to vrbexin. Remove all references to the original % author, Bernd Raichle, as he is not the author of the style file vrbexin. % You may substitute my name for Mr. Raichle if you wish. % % 5. Place this .sty file in a place searched by TeX, on the TEXINPUT path. % % After I can figure out the docstrip utility, I will do this stuff myself. % % Note: As is standard practice in the TeX community, any modifications in % .sty files must be given new names. Thus, it is certainly vitally important % that the modifications in vrbinput.sty be done in the file named % vrbexin.sty, not in the original which I did not write. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT % IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT % IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\fileversion{v1.1} \def\filedate{94/04/31} \typeout{Style-Option: `verbasef' \fileversion \space <\filedate> (ndw)} \@ifundefined{verbatim@@@}{\input{vrbexin.sty}\input{verbatim.sty}}{}% \@ifundefined{@HHfloat}{\input{here.sty}}{}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \newcounter{Vauto@LinePage}%3 % lines/page counter \newcounter{Vauto@NP}% % Number of pages \newcounter{Vauto@Fignum}% % Figure number - retain over figures \newcounter{Vauto@Pagea}% % # lines page 1 \newcounter{Vauto@LineNo}% % current line number \newcounter{Vauto@LineMod}% % modulo to print on \newcounter{Vauto@LineLoop}% % loop count in line number (1..Mod) \newcounter{Vauto@LineStart}% % first line to print \newcounter{Vauto@LineCount}% % number of lines to print \newcounter{Vauto@NotLabel}% % Printable - not a label \newcounter{Vauto@PrintFlag}% % print this line? % %%%% Default table placement, and macros to change table placement \def\Vauto@Plx{H}\def\Vauto@Pl#1{\def\Vauto@Plx{#1}}\def\VautoPl{\Vauto@Pl} %%%% Default verbatim font and verbatim line number font \def\Vauto@sfFont{\tt}\def\Vauto@sfLNF{\rm\tiny}% % %%%% Macros to change fonts \def\Vauto@sbf[#1]#2{\def\Vauto@sfFont{#2}\def\Vauto@sfLNF{#1}} \def\Vauto@svf#1{\def\Vauto@sfFont{#1}}% \def\VautoSfFont{ \@ifnextchar[{\Vauto@sbf}{\Vauto@svf}%] } %%%% Macros to set number of lines per figure \def\Vauto@LPP{46}\def\Vauto@LPPa{46} \def\Vauto@TwoLPP[#1]#2{\def\Vauto@LPP{#2}\def\Vauto@LPPa{#1}} \def\Vauto@OneLPP#1{\def\Vauto@LPP{#1}\def\Vauto@LPPa{#1}} \def\VautoLines{ \@ifnextchar[{\Vauto@TwoLPP}{\Vauto@OneLPP}%] } \def\VautoSubFF{\@ifnextchar[{\Vauto@sbf}{\Vauto@svf}%] } \def\xxparse Vzzlabel|#1|{ %\typeout{Here is that label: #1} \immediate\write\@mainaux{\string\newlabel{#1}{{\theVauto@LineNo}{\thepage}}} } \def\ifsubstr#1#2#3#4%% #1=string #2=substring, #3=yes, #4=no { \def\tempa##1#2##2\over_##3\end{% \ifx##3% can't parse \setcounter{Vauto@NotLabel}{1}% \else% can parse \setcounter{Vauto@NotLabel}{0}% \xxparse #1% \fi% }% \tempa#1\over_\over#2\over___\end } % %%Macro which sets beginfigure and endfigure constructions % \def\Vauto@etab#1#2#3{% {caption}{label}{prtype}% \ifnum#3<3% 1 or 2 qualifies here \begingroup \normalsize\rm\selectfont% \ifnum\theVauto@NP=1 \caption{#1}\label{#2}% \setcounter{Vauto@Fignum}{\value{figure}}% \else \vspace{2em}% \centerline{Figure \theVauto@Fignum: #1 (cont.)}% \fi% \endgroup% \end{figure}% \def\Vauto@PrCnt{\Vauto@LPP}% \ifnum#3=2 \setcounter{figure}{\value{Vauto@Fignum}}\fi% \fi% \ifnum#3>1% 2 or 3 qualifies here \begin{figure}[H]% \addtocounter{Vauto@NP}{1}% \setcounter{Vauto@LinePage}{0}% \setcounter{Vauto@PrintFlag}{1}% \fi% \catcode`\^^M9% }% % %%%% Internal macro that does the work... \def\Vauto@sf#1#2#3{\begingroup% \def\verbatim@start{\Vauto@etab{#2}{#3}{3}} \def\verbatim@finish{\Vauto@etab{#2}{#3}{1}} \def\verbatim@font{\Vauto@sfFont\selectfont} \setcounter{Vauto@LineNo}{0}% \setcounter{Vauto@LineLoop}{0}% \parskip=0pt% \def\verbatim@processline{% \edef\subz{\noexpand\ifsubstr{\the\verbatim@line}{Vzzlabel}{1}{0}}\subz \ifnum\theVauto@NotLabel=1% \addtocounter{Vauto@LineNo}{1}% \addtocounter{Vauto@LineLoop}{1}% \setcounter{Vauto@PrintFlag}{1}% \ifnum\theVauto@LineStart>0% we haven't reached the first line yet... \setcounter{Vauto@PrintFlag}{0}% \addtocounter{Vauto@LineStart}{-1}% \else% \ifnum\theVauto@LineCount=0% we're out of the "printable" region \setcounter{Vauto@PrintFlag}{0}% \else% \addtocounter{Vauto@LineCount}{-1}% decrease the line count \fi% \fi% % debugging... %\typeout{Start: \theVauto@LineStart, Count: \theVauto@LineCount, % Print: \theVauto@PrintFlag, Loop: \theVauto@LineLoop, % Mod: \theVauto@LineMod}% \ifnum\theVauto@PrintFlag=1% \leavevmode% \ifnum\theVauto@LineLoop=\theVauto@LineMod% \llap{{\Vauto@sfLNF\selectfont \theVauto@LineNo}% \ \hskip\@totalleftmargin}% \setcounter{Vauto@LineLoop}{0}% \else% \llap{\phantom{\Vauto@sfLNF\selectfont 0}\ % \hskip\@totalleftmargin}% \fi% \the\verbatim@line\par% \addtocounter{Vauto@LinePage}{1}% \else% \ifnum\theVauto@LineLoop=\theVauto@LineMod% \setcounter{Vauto@LineLoop}{0}% \fi% \fi% \ifnum\theVauto@LinePage=\Vauto@PrCnt \Vauto@etab{#2}{#3}{2}\fi% \fi% End of the loop printing non-labels } \verbatiminput{#1} \endgroup}% % \def\Vauto@sfP#1#2#3#4#5{% \begingroup \def\Vauto@PrCnt{\Vauto@LPPa} \setcounter{Vauto@LineMod}{-1}% \setcounter{Vauto@LineStart}{#1}% \setcounter{Vauto@LineCount}{#2}% \addtocounter{Vauto@LineCount}{-\theVauto@LineStart}% \addtocounter{Vauto@LineCount}{1}% \addtocounter{Vauto@LineStart}{-1}% \Vauto@sf{#3}{#4}{#5}% \catcode`\^^M`\^^M \endgroup }% \def\Vauto@sfN[#1]#2#3#4#5#6{% \begingroup \def\Vauto@PrCnt{\Vauto@LPPa} \setcounter{Vauto@LineMod}{#1}% \setcounter{Vauto@LineStart}{#2}% \setcounter{Vauto@LineCount}{#3}% \addtocounter{Vauto@LineCount}{-\theVauto@LineStart}% \addtocounter{Vauto@LineCount}{1}% \addtocounter{Vauto@LineStart}{-1}% \Vauto@sf{#4}{#5}{#6}% \catcode`\^^M`\^^M \endgroup }% \def\VautoSubF{ \@ifnextchar[{\Vauto@sfN}{\Vauto@sfP}%] }% % %%%% EOF %------------------vrbexin.sty %% %% This is file `vrbexin.sty', modified from vrbinput.sty %% %% The original source files were: %% %% vrbinput.doc %% %% Copyright (C) 1994 by Paul Thompson %% %% IMPORTANT NOTICE: %% %% You are not allowed to change this file. You may however copy this file %% to a different name and then change this copy. %% %% You are NOT ALLOWED to take money for the distribution or use of this %% file (or a changed version) except for some nominal charge for copying etc. %% %% \def\fileversion{v1.0b} \def\filedate{94/06/30} \def\docdate{94/06/30} %% \CheckSum{82} %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} %% %% Style-option `vrbexin' to use with LaTeX-2e %% and style-option `verbatim' (by Rainer Sch\"opf) %% Copyright (C) 1994 by Paul Thompson, all rights reserved. \@ifundefined{verbatim@readfile}{}{\endinput} \typeout{Style-Option: `vrbexin' \fileversion \space <\filedate> (br)} \typeout{English Documentation \@spaces\@spaces\space\space <\docdate> (br)} \@ifundefined{verbatim@@@}{\input{verbatim.sty}}{} \newread\verbatim@in@stream \ifnum\verbatim@in@stream=\@ne \csname newread\endcsname\verbatim@in@stream \fi \def\verbatim@readfile#1{% \verbatim@start \openin\verbatim@in@stream #1\relax \ifeof\verbatim@in@stream \typeout{No file #1.}% \else \expandafter\endlinechar\expandafter\m@ne \expandafter\verbatim@read@file \expandafter\endlinechar\the\endlinechar\relax \closein\verbatim@in@stream \fi \verbatim@finish } \def\verbatim@read@file{% \read\verbatim@in@stream to\next \ifeof\verbatim@in@stream \else \expandafter\verbatim@addtoline\expandafter{\next}% \verbatim@processline \verbatim@startline \expandafter\verbatim@read@file \fi } \def\verbatiminput{\begingroup \@ifstar{\verbatim@input\relax}% {\verbatim@input{\frenchspacing\@vobeyspaces}}} \def\verbatim@input#1#2{\@verbatim #1\relax \verbatim@readfile{#2}\item[]\endtrivlist\endgroup\@doendpe} \endinput %% %% End of file `vrbexin.sty'. -- Paul Thompson, Ph.D. | Rush Limbaugh appeals to those not mature enough Department of Psychiatry | to appreciate Barney. Case Western Reserve Univ| Cleveland, OH 44106 | Ole-ole-ole-ole, to 2nd round goes USA -- Paul Thompson, Ph.D. | Rush Limbaugh appeals to those not mature enough Department of Psychiatry | to appreciate Barney. Case Western Reserve Univ| Cleveland, OH 44106 | Ole-ole-ole-ole, to 2nd round goes USA