summaryrefslogtreecommitdiff
path: root/support/dbtex/verbatim.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/dbtex/verbatim.sty
Initial commit
Diffstat (limited to 'support/dbtex/verbatim.sty')
-rw-r--r--support/dbtex/verbatim.sty42
1 files changed, 42 insertions, 0 deletions
diff --git a/support/dbtex/verbatim.sty b/support/dbtex/verbatim.sty
new file mode 100644
index 0000000000..5882017b7d
--- /dev/null
+++ b/support/dbtex/verbatim.sty
@@ -0,0 +1,42 @@
+% 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.
+%
+% As a matter of interest, it is much nicer for TeX if you input large
+% quantities of "verbatim material" from an "external file" rather than by use
+% of the `verbatim' environment (i.e. putting the material in the main input
+% file. This is because this environment, in common with most (but not all)
+% other "verbatim macros", makes the whole of the "vebatim material" a macro
+% argument and therefore eats up TeTeX's internal memory.
+%
+% Chris Rowley
+%
+
+% --- 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
+}