Article View: comp.text.tex
Article #1688Re: /input or /include or ... ?
From: Hartmut Frommert
Date: Tue, 25 Aug 1992 16:52
Date: Tue, 25 Aug 1992 16:52
57 lines
2694 bytes
2694 bytes
osalazar@dcc.uchile.cl (SALAZAR CERNA OSCAR MAPOCHO) writes:
> I want to include a C program file using \input{file.c} in
> this way:
> \begin{vertabim}
> \input{file.c}
> \end{verbatim}
[..]
Try the following .sty (Verbfile.sty):
--------------------------------------
% Here is a version of Adrian's VERBATIM.STY, for inputting whole files
% verbatim, which is "more LaTeX-like" in that it uses the actual LaTeX
% macros which set up the `verbatim' environment.
% --- V E R B A T I M F I L E S . S T Y
%
% --- This LaTeX style-file defines two user-callable macros:
% --- \verbatimfile{<filename>} for verbatim inclusion of a file
% --- \verbatimlisting{<filename>} for verbatim inclusion with line numbers
%
% --- The macros are based on those distributed with Sunil Podar's
% --- `EPIC.STY' macro package, attributed to Tim Morgan,
% --- modified to keep internal macros internal by Adrian F. Clark,
% --- alien@uk.ac.essex.ese
% --- ---and further latexification by Chris Rowley,
% --- ca_rowley@uk.ac.open.acs.vax.
%
% --- Note that the precise layout of line breaks in this file is important!
%
\def\verbatimfile#1{\begingroup
\@verbatim \frenchspacing \@vobeyspaces
\input#1 \endgroup
}
\newcounter{lineno}
\def\verbatimlisting#1{\setcounter{lineno}{0}%
\begingroup \@verbatim \frenchspacing \@vobeyspaces \parindent=20pt
\everypar{\stepcounter{lineno}\llap{\thelineno\ \ }}\input#1
\endgroup
}
------------------------------------
Then, as stated, type
\documentstyle[..,verbfile,..]{..}
..
\begin{document}
..
\verbatimfile{file.c}
..
\end{document}
in your document. Hope this helps.
--
Hartmut Frommert, Physics, Univ of Constance, | + Whale killing is murder. +
P.O.Box 55 60, D-W-7750 Konstanz, Germany | + Eat whale killers, not whales.
E-Mail: <phfrom@dknkurz1.bitnet> or <phfrom@nyx.uni-konstanz.de>
+ "Windows NoT" expands in German to "Windows Noch Teurer"
+ ^even ^more expensive
Technical Details
Message-ID:
<phfrom.253@nyx.uni-konstanz.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!gumby!yale!yale.edu!ira.uka.de!sun1.ruf.uni-freiburg.de!news.belwue.de!eratu.rz.uni-konstanz.de!nyx.uni-konstanz.de!phfromReferences:
<1992Aug24.201734.21275@dcc.uchile.cl>Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!gumby!yale!yale.edu!ira.uka.de!sun1.ruf.uni-freiburg.de!news.belwue.de!eratu.rz.uni-konstanz.de!nyx.uni-konstanz.de!phfrom From: phfrom@nyx.uni-konstanz.de (Hartmut Frommert) Subject: Re: /input or /include or ... ? Message-ID: <phfrom.253@nyx.uni-konstanz.de> Sender: usenet@eratu.rz.uni-konstanz.de Organization: Dept. of Physics, University of Constance References: <1992Aug24.201734.21275@dcc.uchile.cl> Date: Tue, 25 Aug 1992 16:52:57 GMT Lines: 57