[comp.text.tex] using redefined \verbatim in verbatimfiles

jmn@power.berkeley.edu (J. Mark Noworolski) (06/06/91)

I need some help getting \verbatimfiles to use a redefined verbatim
environment.

More specifically, someone recently sent me some LaTeX code to make
the verbatim environment automatically add a continuation character to long
lines and indent their continuation on the next line.

This works fine on its own via:
\begin{verbatim}
--------------very long line here gets automatically wrapped-----------------
\end{verbatim

But the line wrapping doesn't happen when called via:
\verbatimfiles{filename}

I have tried modifying verbatimfiles.sty in quasi-random ways, to no avail.

Can anyone offer advice?
Here's the file which modifies the verbatim environment:
%newverbatim.sty
{\catcode`\^^M=13
% Redefine verbatim environment:
\gdef\verbatim{\@verbatim \frenchspacing\@vobeyspaces
   \let\par=^^M\let^^M=\DoLongLines\count@=0  % New stuff
   \@xverbatim}
}
\def\CharsPerLine{60}
\def\ContinuationChar{{\rm ---}}
\def\DoLongLines{\afterassignment\DoOneChar\let\next= }
\def\DoOneChar{%
  \ifx\next\end
  \else\ifx\next\DoLongLines\count@=0 \par
  \else
    \advance\count@ by 1
    \ifnum\count@=\CharsPerLine
      \ContinuationChar
      \par\noindent{\ \ \ \ \ \ \ \ }\count@=9 \fi
    \next
    \let\next\DoLongLines
  \fi\fi
  \next}

--
"There's a really fine line between clever and stupid"
				Nigel- Lead Guitar (Spinal Tap)
jmn@united.berkeley.edu, or jmn@power.berkeley.edu

raichle@informatik.uni-stuttgart.de (Bernd Raichle) (06/07/91)

> [... Problem with changed verbatim-environment & \verbatimfiles ...]

First: it's better you use the new Style-Option, called `verbatim'
written by Rainer Schoepf.

(Available via anon-ftp from rusmv1.rus.uni-stuttgart.de [129.69.1.12]
in soft/tex/latex-style/supported/verbatim/* and from other
TeX-Server)

You can define a new environment/command with changed macros
\verbatim@startline, \verbatim@addtoline, \verbatim@processline to
implement line wrapping and other things...  (Look in the
documentation of `verbatim')


> I have tried modifying verbatimfiles.sty in quasi-random ways, to no avail.
> Can anyone offer advice?

Try this one, but note that it's a hack and doesn't work with a newer
LaTeX version!

{\catcode`\^^M=13
% Redefine verbatimfile environment:
\gdef\verbatimfile#1{\begingroup
    % redefine \end (\DoOneChar scans for an \end token, not for \endgroup!)
  \let\end=\endgroup
  \@verbatim \frenchspacing \@vobeyspaces
    % New stuff from `newverbatim'
  \let\par=^^M\let^^M=\DoLongLines\count@=0 %
    % don't forget to start \DoLongLines at the first line (Hack!)
  \expandafter\DoLongLines\@@input#1 \end % = \endgroup
}%
}


-bernd
__________________________________________________________________________
Bernd Raichle, Student der Universit"at Stuttgart | "Le langage est source
privat: Stettener Str. 73, D-7300 Esslingen       |  de malentendus"
email:  raichle@azu.informatik.uni-stuttgart.de   |  (A. de Saint-Exupery)