| 1 |
% \iffalse meta-comment |
| 2 |
% newfile.dtx |
| 3 |
% Author: Peter Wilson, Herries Press |
| 4 |
% Maintainer: Will Robertson (will dot robertson at latex-project dot org) |
| 5 |
% Copyright 2002--2004 Peter R. Wilson |
| 6 |
% |
| 7 |
% This work may be distributed and/or modified under the |
| 8 |
% conditions of the LaTeX Project Public License, either |
| 9 |
% version 1.3c of this license or (at your option) any |
| 10 |
% later version: <http://www.latex-project.org/lppl.txt> |
| 11 |
% |
| 12 |
% This work has the LPPL maintenance status "maintained". |
| 13 |
% The Current Maintainer of this work is Will Robertson. |
| 14 |
% |
| 15 |
% This work consists of the files listed in the README file. |
| 16 |
% |
| 17 |
% |
| 18 |
%<*driver> |
| 19 |
\documentclass{ltxdoc} |
| 20 |
\EnableCrossrefs |
| 21 |
\CodelineIndex |
| 22 |
\setcounter{StandardModuleDepth}{1} |
| 23 |
\begin{document} |
| 24 |
\DocInput{newfile.dtx} |
| 25 |
\end{document} |
| 26 |
%</driver> |
| 27 |
% |
| 28 |
% \fi |
| 29 |
% |
| 30 |
% \CheckSum{329} |
| 31 |
% |
| 32 |
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath} |
| 33 |
% \DoNotIndex{\@centercr,\@cite} |
| 34 |
% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue} |
| 35 |
% \DoNotIndex{\@input,\@ixpt,\@m} |
| 36 |
% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint} |
| 37 |
% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb} |
| 38 |
% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt} |
| 39 |
% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt} |
| 40 |
% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace} |
| 41 |
% \DoNotIndex{\advance,\Alph,\alph} |
| 42 |
% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box} |
| 43 |
% \DoNotIndex{\bullet} |
| 44 |
% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption} |
| 45 |
% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass} |
| 46 |
% \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist} |
| 47 |
% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup} |
| 48 |
% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter} |
| 49 |
% \DoNotIndex{\fbox} |
| 50 |
% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef} |
| 51 |
% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule} |
| 52 |
% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi} |
| 53 |
% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi} |
| 54 |
% \DoNotIndex{\input} |
| 55 |
% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark} |
| 56 |
% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright} |
| 57 |
% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment} |
| 58 |
% \DoNotIndex{\NeedsTeXFormat,\newdimen} |
| 59 |
% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number} |
| 60 |
% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@} |
| 61 |
% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip} |
| 62 |
% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions} |
| 63 |
% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright} |
| 64 |
% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font} |
| 65 |
% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman} |
| 66 |
% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength} |
| 67 |
% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space} |
| 68 |
% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase} |
| 69 |
% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt} |
| 70 |
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace} |
| 71 |
% \DoNotIndex{\wd,\xiipt,\year,\z@} |
| 72 |
% |
| 73 |
% \changes{v1.0}{2002/06/22}{First public release} |
| 74 |
% \changes{v1.0a}{2002/07/07}{Corrected documentation} |
| 75 |
% \changes{v1.0b}{2004/05/10}{Changed license from LPPL v1.0 to v1.3} |
| 76 |
% \changes{v1.0c}{2009/09/03}{New maintainer (Will Robertson)} |
| 77 |
% |
| 78 |
% \def\dtxfile{newfile.dtx} |
| 79 |
% \def\fileversion{v1.0} |
| 80 |
% \def\filedate{2002/06/22} |
| 81 |
% \def\fileversion{v1.0a} |
| 82 |
% \def\filedate{2002/07/07} |
| 83 |
% \def\fileversion{v1.0b} |
| 84 |
% \def\filedate{2004/05/10} |
| 85 |
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package |
| 86 |
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option |
| 87 |
% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file |
| 88 |
% \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter |
| 89 |
% \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle |
| 90 |
% \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment |
| 91 |
% |
| 92 |
% \title{The \Lpack{newfile} package\thanks{This |
| 93 |
% file (\texttt{\dtxfile}) has version number \fileversion, last revised |
| 94 |
% \filedate.}} |
| 95 |
% |
| 96 |
% \author{ |
| 97 |
% Author: Peter Wilson, Herries Press \\ |
| 98 |
% Maintainer: Will Robertson \\ |
| 99 |
% \texttt{will dot robertson at latex-project dot org} |
| 100 |
% } |
| 101 |
% \date{\filedate} |
| 102 |
% \maketitle |
| 103 |
% \begin{abstract} |
| 104 |
% The \Lpack{newfile} package provides convenient user level commands |
| 105 |
% for reading and writing new files during a LaTeX run. |
| 106 |
% \end{abstract} |
| 107 |
% \tableofcontents |
| 108 |
% |
| 109 |
% |
| 110 |
% \section{Introduction} |
| 111 |
% |
| 112 |
% TeX has a maximum of 16 input and 16 output \emph{streams} |
| 113 |
% for reading and writing |
| 114 |
% files. The \Lpack{newfile} package provides means of associating |
| 115 |
% several different files with a particular stream. |
| 116 |
% |
| 117 |
% The \Lpack{newfile} package requires the \Lpack{verbatim} |
| 118 |
% package~\cite{VERBATIM}, which is one of the required packages in |
| 119 |
% a LaTeX distribution. |
| 120 |
% |
| 121 |
% This manual is typeset according to the conventions of the |
| 122 |
% \LaTeX{} \textsc{docstrip} utility which enables the automatic |
| 123 |
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}. |
| 124 |
% |
| 125 |
% Section~\ref{sec:usc} describes the usage of the package. |
| 126 |
% Commented source code for the package is in Section~\ref{sec:code}. |
| 127 |
% |
| 128 |
% \section{The \Lpack{newfile} package} \label{sec:usc} |
| 129 |
% |
| 130 |
% |
| 131 |
% \DescribeMacro{\newoutputstream} |
| 132 |
% \DescribeMacro{\newinputstream} |
| 133 |
% The command |\newoutputstream|\marg{stream} creates a new stream |
| 134 |
% called \meta{stream} for writing out text and commands. The \meta{stream} |
| 135 |
% should be just alphabetic characters with no spaces; for example |myout|. |
| 136 |
% The command |\newinputstream|\marg{stream} creates a new stream for |
| 137 |
% reading from a file. The \meta{stream} names must be unique --- you cannot |
| 138 |
% use the same name for both an input and an output stream. |
| 139 |
% |
| 140 |
% If you try and create too many streams, TeX will tell you via an error |
| 141 |
% message. |
| 142 |
% |
| 143 |
% These two commands also attempt to create two other new commands, |
| 144 |
% called respectively |
| 145 |
% |\atstreamopen<stream>| and |\atstreamclose<stream>|. If these commands |
| 146 |
% already exist then they are left untouched, otherwise they are |
| 147 |
% created (like using |\providecommand{\atstreamopen<stream}{}|). |
| 148 |
% For example if |
| 149 |
% if you have used |mystr| as the name of a stream (either input or output), |
| 150 |
% then the macros |\atstreamopenmystr| and |\atstreamclosemystr| are |
| 151 |
% defined; by default they do nothing, but you can |\renewcommand| them |
| 152 |
% to do something. |
| 153 |
% |
| 154 |
% \DescribeMacro{\openoutputfile} |
| 155 |
% The macro |\openoutputfile|\marg{filename}\marg{stream} opens the |
| 156 |
% file called \meta{filename} and the output stream \meta{stream}. It |
| 157 |
% then attaches the file to the stream for writing and calls the macro |
| 158 |
% |\atstreamopen<stream>|. Any pre-existing contents of \meta{filname} |
| 159 |
% are deleted. |
| 160 |
% |
| 161 |
% \DescribeMacro{\closeoutputstream} |
| 162 |
% The macro |\closeoutputstream|\marg{stream} calls the macro |
| 163 |
% |\atstreamclose<stream>|, closes the output stream |
| 164 |
% \meta{stream} and closes whatever file |
| 165 |
% is currently attached to \meta{stream}. It then detaches the file from |
| 166 |
% the stream. |
| 167 |
% |
| 168 |
% \DescribeEnv{writeverbatim} |
| 169 |
% The |writeverbatim| environment takes one argument, the name of an output |
| 170 |
% stream, which must be open. The contents of the environment are written |
| 171 |
% out verbatim to the file currently attached to the stream. |
| 172 |
% |
| 173 |
% \DescribeMacro{\addtostream} |
| 174 |
% The command |\addtostream|\marg{stream}\marg{text} writes \meta{text} |
| 175 |
% to the file currently attached to the output stream \meta{stream}, which |
| 176 |
% must be open. Any commands within \meta{text} will be processed before |
| 177 |
% being written. To prevent this, put |\protect| before any command that |
| 178 |
% you do not want expanding. |
| 179 |
% |
| 180 |
% \DescribeMacro{\openinputfile} |
| 181 |
% The macro |\openinputfile|\marg{filename}\marg{stream} opens the |
| 182 |
% file called \meta{filename} and the input stream \meta{stream}. It |
| 183 |
% then attaches the file to the stream for reading and calls the macro |
| 184 |
% |\atstreamopen<stream>|. It is an error if \meta{filename} can not be found. |
| 185 |
% |
| 186 |
% \DescribeMacro{\closeinputstream} |
| 187 |
% The macro |\closeinputstream|\marg{stream} calls the macro |
| 188 |
% |\atstreamclose<stream>|, closes the input stream |
| 189 |
% \meta{stream} and closes whatever file |
| 190 |
% is currently attached to \meta{stream}. It then detaches the file from |
| 191 |
% the stream. |
| 192 |
% |
| 193 |
% \DescribeMacro{\readstream} |
| 194 |
% The macro |\readstream|\marg{stream} reads the contents of the file that |
| 195 |
% is currently associated with the input stream \meta{stream}. This provides |
| 196 |
% the same functionality as |\input|\marg{filename} does. |
| 197 |
% |
| 198 |
% \DescribeMacro{\readaline} |
| 199 |
% The macro |\readaline|\marg{stream} reads what TeX considers to be |
| 200 |
% one line from the file that |
| 201 |
% is currently associated with the input stream \meta{stream}. Multiple lines |
| 202 |
% can be read by calling |\readaline| multiple times. A warning is issued |
| 203 |
% if there are no more lines to be read (i.e., the end of the file has |
| 204 |
% been reached). |
| 205 |
% |
| 206 |
% |
| 207 |
% \DescribeMacro{\readverbatim} |
| 208 |
% The macro |\readverbatim|\marg{stream} reads the contents of the file that |
| 209 |
% is currently associated with the input stream \meta{stream} as |verbatim| |
| 210 |
% text. This provides |
| 211 |
% the same functionality as the \Lpack{verbatim} package's |
| 212 |
% |\verbatiminput|\marg{filename} command does. |
| 213 |
% |
| 214 |
% \DescribeMacro{\streamvfont} |
| 215 |
% Text read in verbatim is typeset using the font specified by |
| 216 |
% |\streamvfont|\marg{font}. The default is |
| 217 |
% |\streamvfont{\normalfont\ttfamily}|. To typeset in a smaller font, try |
| 218 |
% for example, |
| 219 |
% |\streamvfont{\small\ttfamily}|. |
| 220 |
% |
| 221 |
% |
| 222 |
% \DescribeMacro{\numbervstream} |
| 223 |
% \DescribeMacro{\marginnumbervstream} |
| 224 |
% \DescribeMacro{\streamvnumfont} |
| 225 |
% The declaration |\numbervstream| causes |\readverbatim| to number each |
| 226 |
% line it reads. |
| 227 |
% The declaration |\marginnumbervstream| is similar to |\numbervstream| |
| 228 |
% except it puts the numbers in the margin. |
| 229 |
% The |streamvline| counter is used for the line numbering. Both |
| 230 |
% the numbering declarations (re)set it to zero. The numbers are |
| 231 |
% typeset in the font specified by |\streamvnumfont|\marg{font}. |
| 232 |
% The default is |\streamvnumfont{\footnotesize}|. |
| 233 |
% |
| 234 |
% \DescribeMacro{\plainvstream} |
| 235 |
% The declaration |\plainvstream| stops any numbering. The default |
| 236 |
% is |\plainvstream|. |
| 237 |
% |
| 238 |
% \DescribeEnv{comment} |
| 239 |
% The |comment| environment, which is part of the \Lpack{verbatim} |
| 240 |
% package, throws away everything inside the environment. |
| 241 |
% |
| 242 |
% The \Lpack{verbatim} package~\cite{VERBATIM} provides some other |
| 243 |
% facilities, apart from |
| 244 |
% the |comment| environment, and its documentation explains them. |
| 245 |
% |
| 246 |
% \section{Examples} |
| 247 |
% |
| 248 |
% \subsection{Output stream} |
| 249 |
% |
| 250 |
% This example is inspired by the \Lpack{endfloat} package~\cite{ENDFLOAT} |
| 251 |
% which provides a more sophisticated approach than shown below. The |
| 252 |
% example demonstrates the use of an output stream. |
| 253 |
% |
| 254 |
% Suppose that in an \Lpack{article} class document you want all the |
| 255 |
% figures to be collected at the end, but to specify them at the appropriate |
| 256 |
% places in the body of the text. |
| 257 |
% |
| 258 |
% \begin{macrocode} |
| 259 |
%<*ex> |
| 260 |
% \end{macrocode} |
| 261 |
% \begin{macrocode} |
| 262 |
\documentclass{article} |
| 263 |
\usepackage{newfile} |
| 264 |
... |
| 265 |
% \end{macrocode} |
| 266 |
% Create a new output stream called |figs| and open it to write to file |
| 267 |
% |figures.tex|. |
| 268 |
% \begin{macrocode} |
| 269 |
\newoutputstream{figs} |
| 270 |
\openoutputfile{figures.out}{figs} |
| 271 |
... |
| 272 |
% \end{macrocode} |
| 273 |
% Write out verbatim the first |figure| environment to the |figs| stream. |
| 274 |
% \begin{macrocode} |
| 275 |
\begin{writeverbatim}{figs} |
| 276 |
\begin{figure} |
| 277 |
... |
| 278 |
\end{figure} |
| 279 |
\end{writeverbatim} |
| 280 |
... |
| 281 |
% \end{macrocode} |
| 282 |
% After the last |figure| is written to |figs|, close the |figs| output |
| 283 |
% stream, which also closes the |figures.out| file. |
| 284 |
% \begin{macrocode} |
| 285 |
\begin{writeverbatim}{figs} |
| 286 |
\begin{figure} |
| 287 |
... |
| 288 |
\end{figure} |
| 289 |
\end{writeverbatim} |
| 290 |
\closeoutputstream{figs} |
| 291 |
... |
| 292 |
% \end{macrocode} |
| 293 |
% At the end |\input| |figures.out| to typeset the figures. |
| 294 |
% \begin{macrocode} |
| 295 |
\input{figures.out} |
| 296 |
\end{document} |
| 297 |
% \end{macrocode} |
| 298 |
% |
| 299 |
% \subsection{An output and input stream} |
| 300 |
% |
| 301 |
% This example is the kind of thing that the \Lpack{answers} |
| 302 |
% package~\cite{ANSWERS} does rather better. The example illustrates |
| 303 |
% the use of an output and an input stream. |
| 304 |
% |
| 305 |
% Suppose you are writing a document that includes questions and answers |
| 306 |
% and you want all the answers at the end. It is most convenient if you |
| 307 |
% can write the answer to each question as it is posed, and then only |
| 308 |
% print them at the end. |
| 309 |
% |
| 310 |
% \setcounter{CodelineNo}{0} |
| 311 |
% \begin{macrocode} |
| 312 |
\documentclass{article} |
| 313 |
\usepackage{newfile} |
| 314 |
... |
| 315 |
% \end{macrocode} |
| 316 |
% Create new output and input streams called |ans| and |ansin|. Just to |
| 317 |
% demonstrate the use of the |\atstreamopen...| command, redefine |
| 318 |
% |\atstreamopenansin| so that it will start a section called |
| 319 |
% `Answers to all the questions'. Then open the |ans| stream to write to |
| 320 |
% a file called |answers.all|. |
| 321 |
% \begin{macrocode} |
| 322 |
\newoutputstream{ans} |
| 323 |
\newinputstream{ansin} |
| 324 |
\renewcommand{\atstreamopenansin}{\section{Answers to all the questions}} |
| 325 |
\openoutputfile{answers.all}{ans} |
| 326 |
... |
| 327 |
% \end{macrocode} |
| 328 |
% For each question, write out the answer verbatim to the |ans| stream. |
| 329 |
% \begin{macrocode} |
| 330 |
This is a question. |
| 331 |
\begin{writeverbatim}{ans} |
| 332 |
This is the answer to a question. |
| 333 |
\end{writeverbatim} |
| 334 |
... |
| 335 |
% \end{macrocode} |
| 336 |
% At the end, close the |ans| stream and open the |ansin| stream to read from |
| 337 |
% the file |answers.all|. Opening the stream will also start the new |
| 338 |
% `Answers to all the questions' section (from |\atstreamopenansin|). Then |
| 339 |
% read from the |ansin| stream. |
| 340 |
% \begin{macrocode} |
| 341 |
\closeoutputstream{ans} |
| 342 |
\openinputfile{answers.all}{ansin} |
| 343 |
\readstream{ansin} |
| 344 |
% \end{macrocode} |
| 345 |
% Finally, close the |ansin| stream, and we are done. |
| 346 |
% \begin{macrocode} |
| 347 |
\closeinputstream{ansin} |
| 348 |
\end{document} |
| 349 |
% \end{macrocode} |
| 350 |
% |
| 351 |
% If desired, instead of inserting the answers at the end of the question |
| 352 |
% document, |answers.all| could have been |\input| into a seperate |
| 353 |
% answer document. |
| 354 |
% |
| 355 |
% Along the same lines as above, perhaps the original document is |
| 356 |
% a \Lpack{book} class, with questions (and answers) at the end of each |
| 357 |
% chapter. A seperate answer file could be produced for each chapter, like: |
| 358 |
% \setcounter{CodelineNo}{0} |
| 359 |
% \begin{macrocode} |
| 360 |
... |
| 361 |
\newoutputstream{ansout} |
| 362 |
\newinputstream{ansin} |
| 363 |
... |
| 364 |
\chapter{First chapter} % chapter 1 |
| 365 |
\openoutputfile{\jobname\thechapter.ans}{ansout} |
| 366 |
% \end{macrocode} |
| 367 |
% The |\jobname| is the name of the main LaTeX document file, without |
| 368 |
% the |.tex| extension, so if the name of the LaTeX source file is |
| 369 |
% |mybook.tex| the above line creates a file called |mybook1.ans|. |
| 370 |
% \begin{macrocode} |
| 371 |
... |
| 372 |
\begin{writeverbatim}{ansout} |
| 373 |
An answer |
| 374 |
\end{writeverbatim} |
| 375 |
... |
| 376 |
\closeoutputstream{ansout} |
| 377 |
\chapter{Another chapter} % chapter N |
| 378 |
\openoutputfile{\jobname\thechapter.ans}{ansout} |
| 379 |
... |
| 380 |
\closeoutputstream{ansout} |
| 381 |
|
| 382 |
\chapter{Answers} |
| 383 |
|
| 384 |
\section{Chapter 1} |
| 385 |
\openinputstream{\jobname1.ans}{ansin} |
| 386 |
\readstream{ansin} |
| 387 |
\closestream{ansin} |
| 388 |
... |
| 389 |
\section{Chapter N} |
| 390 |
\openinputstream{\jobnameN.ans}{ansin} |
| 391 |
\readstream{ansin} |
| 392 |
\closestream{ansin} |
| 393 |
... |
| 394 |
% \end{macrocode} |
| 395 |
% |
| 396 |
% The above example shows how you can associate different files with a single |
| 397 |
% stream. |
| 398 |
% |
| 399 |
% \subsection{Multiple streams} |
| 400 |
% |
| 401 |
% This is a more complex example, again inspired by the \Lpack{endfloat} |
| 402 |
% package. In a \Lpack{book} class document you want |
| 403 |
% all the |
| 404 |
% figures and tables to be collected at the end, |
| 405 |
% but to specify them at the appropriate |
| 406 |
% places in the body of the text. |
| 407 |
% |
| 408 |
% \setcounter{CodelineNo}{0} |
| 409 |
% \begin{macrocode} |
| 410 |
\documentclass{book} |
| 411 |
\usepackage{newfile} |
| 412 |
... |
| 413 |
% \end{macrocode} |
| 414 |
% Create and open two new output streams, one for figures (|figs|) and the |
| 415 |
% other (|tabs|) for tables. |
| 416 |
% For demonstration purposes, also create a new input stream called figtab. |
| 417 |
% \begin{macrocode} |
| 418 |
\newoutputstream{figs} |
| 419 |
\openoutputfile{figures.out}{figs} |
| 420 |
\newoutputstream{tabs} |
| 421 |
\openoutputfile{tables.out}{tabs} |
| 422 |
\newinputstream{figtab} |
| 423 |
... |
| 424 |
% \end{macrocode} |
| 425 |
% There is a slight difficulty with this example, as in the \Lpack{book} |
| 426 |
% class, figures and table numbers start anew with each chapter and the |
| 427 |
% chapter number is preprended to the sequence number. We can make a |
| 428 |
% start on solving this by creating a new pseudo chapter number and changing |
| 429 |
% the default definitions of the figure and table numbers (which are |
| 430 |
% |\renewcommand{\thefigure}{\thechapter.\arabic{figure}}| and similarly |
| 431 |
% for tables). |
| 432 |
% \begin{macrocode} |
| 433 |
\newcounter{pseudochapter} |
| 434 |
\renewcommand{\thepseudochapter}{\arabic{pseudochapter}} |
| 435 |
\renewcommand{\thefigure}{\thepseudochapter.\arabic{figure}} |
| 436 |
\renewcommand{\thetable}{\thepseudochapter.\arabic{table}} |
| 437 |
... |
| 438 |
% \end{macrocode} |
| 439 |
% Do the usual things at the start of the document. |
| 440 |
% \begin{macrocode} |
| 441 |
\begin{document} |
| 442 |
\maketitle |
| 443 |
\tableofcontents |
| 444 |
\listoffigures |
| 445 |
.. |
| 446 |
% \end{macrocode} |
| 447 |
% At the start of each chapter we need to set the |pseudochapter| counter |
| 448 |
% to the chapter number, and write this to the output streams so |
| 449 |
% that there is a record of which chapters the figures and tables came from |
| 450 |
% Normally, each chapter resets the figure and table numbers, but as |
| 451 |
% these will now be at the end, we have to fake the start of chapters |
| 452 |
% in the output files. We can do all of this by the |\addtostream| macro. |
| 453 |
% \begin{macrocode} |
| 454 |
\chapter{First} |
| 455 |
% \end{macrocode} |
| 456 |
% The next bit of code will result in \\ |
| 457 |
% |\setcounter{pseudochapter}{N}| \\ |
| 458 |
% where |N| is the number of this chapter, appearing in the output files. |
| 459 |
% \begin{macrocode} |
| 460 |
\addtostream{figs}{\protect\setcounter{pseudochapter}{\thechapter}} |
| 461 |
\addtostream{tabs}{\protect\setcounter{pseudochapter}{\thechapter}} |
| 462 |
% \end{macrocode} |
| 463 |
% The next bit of code results in the following two lines in the output files:\\ |
| 464 |
% |\refstepcounter{chapter}| \\ |
| 465 |
% |\addtocounter{chapter}{-1}| \\ |
| 466 |
% The first of these has the effect of resetting the figure and table |
| 467 |
% counters by increasing the chapter counter by one. The second line resets |
| 468 |
% the chapter counter back to its original value. |
| 469 |
% \begin{macrocode} |
| 470 |
\addtostream{figs}{\protect\refstepcounter{chapter}} |
| 471 |
\addtostream{figs}{\protect\addtocounter{chapter}{-1}} |
| 472 |
\addtostream{tabs}{\protect\refstepcounter{chapter}} |
| 473 |
\addtostream{tabs}{\protect\addtocounter{chapter}{-1}} |
| 474 |
% \end{macrocode} |
| 475 |
% Write out verbatim each figure to the |figs| stream. |
| 476 |
% \begin{macrocode} |
| 477 |
\begin{writeverbatim}{figs} |
| 478 |
\begin{figure} |
| 479 |
... |
| 480 |
\end{figure} |
| 481 |
\end{writeverbatim} |
| 482 |
... |
| 483 |
% \end{macrocode} |
| 484 |
% and write each table verbatim to the |tabs| stream. |
| 485 |
% \begin{macrocode} |
| 486 |
\begin{writeverbatim}{tabs} |
| 487 |
\begin{table} |
| 488 |
... |
| 489 |
\end{table} |
| 490 |
\end{writeverbatim} |
| 491 |
... |
| 492 |
% \end{macrocode} |
| 493 |
% When we have done all the chapters, figures and tables, |
| 494 |
% close the two output streams. |
| 495 |
% \begin{macrocode} |
| 496 |
\closeoutputstream{figs} |
| 497 |
\closeoutputstream{tabs} |
| 498 |
% \end{macrocode} |
| 499 |
% Then if we want the figures to be typeset before the tables, open |
| 500 |
% the |figtab| stream to read from |figures.out|, read the stream and |
| 501 |
% close it. |
| 502 |
% \begin{macrocode} |
| 503 |
\openinputfile{figures.out}{figtab} |
| 504 |
\readstream{figtab} |
| 505 |
\closestream{figtab} |
| 506 |
% \end{macrocode} |
| 507 |
% We can use the same |figtab| stream for reading the tables. |
| 508 |
% \begin{macrocode} |
| 509 |
\openinputfile{tables.out}{figtab} |
| 510 |
\readstream{figtab} |
| 511 |
\closestream{figtab} |
| 512 |
\end{document} |
| 513 |
% \end{macrocode} |
| 514 |
% \begin{macrocode} |
| 515 |
%</ex> |
| 516 |
% \end{macrocode} |
| 517 |
% |
| 518 |
% Note that the \Lpack{endfloat} package~\cite{ENDFLOAT} will produce the |
| 519 |
% same effect as the previous example, but much simply. |
| 520 |
% |
| 521 |
% |
| 522 |
% \StopEventually{} |
| 523 |
% |
| 524 |
% |
| 525 |
% \section{The package code} \label{sec:code} |
| 526 |
% |
| 527 |
% This package can only be used with LaTeX2e, and requires the |
| 528 |
% \Lpack{verbatim} package~\cite{VERBATIM}, which is one of the required |
| 529 |
% packages for a LaTeX distribution. |
| 530 |
% \setcounter{CodelineNo}{0} |
| 531 |
% \begin{macrocode} |
| 532 |
%<*outin> |
| 533 |
\NeedsTeXFormat{LaTeX2e}[1996/06/01] |
| 534 |
\ProvidesPackage{newfile}[2009/09/03 v1.0c Output and input files] |
| 535 |
\RequirePackage{verbatim} |
| 536 |
% \end{macrocode} |
| 537 |
% |
| 538 |
% To try and avoid name clashes with other packages, each internal macro |
| 539 |
% in this package includes the character string `|stre@m|'. |
| 540 |
% |
| 541 |
% \begin{macro}{\newoutputstream} |
| 542 |
% |\newoutputstream|\marg{stream} creates a new output stream called \meta{stream}. |
| 543 |
% Different files may be associated with the \meta{stream}. Note that |
| 544 |
% TeX permits no more than 16 output streams. |
| 545 |
% \begin{macrocode} |
| 546 |
\newcommand{\newoutputstream}[1]{% |
| 547 |
\@ifundefined{#1outstre@m}% |
| 548 |
{\expandafter\newwrite\csname #1outstre@m\endcsname |
| 549 |
\csname newif\expandafter\endcsname |
| 550 |
\csname ifstre@m#1open\endcsname |
| 551 |
\global\csname stre@m#1openfalse\endcsname |
| 552 |
\expandafter\ifx\csname atstreamopen#1\endcsname\relax |
| 553 |
\global\@namedef{atstreamopen#1}{}% |
| 554 |
\fi |
| 555 |
\expandafter\ifx\csname atstreamclose#1\endcsname\relax |
| 556 |
\global\@namedef{atstreamclose#1}{}% |
| 557 |
\fi |
| 558 |
}% |
| 559 |
{\PackageError{newfile}{Output stream #1 is already defined}{\@ehc}}} |
| 560 |
|
| 561 |
% \end{macrocode} |
| 562 |
% \end{macro} |
| 563 |
% |
| 564 |
% \begin{macro}{\newinputstream} |
| 565 |
% |\newinputstream|\marg{stream} creates a new input stream called \meta{stream}. |
| 566 |
% Different files may be associated with the \meta{stream}. Note that |
| 567 |
% TeX permits no more than 16 input streams. |
| 568 |
% \begin{macrocode} |
| 569 |
\newcommand{\newinputstream}[1]{% |
| 570 |
\@ifundefined{#1instre@m}% |
| 571 |
{\expandafter\newread\csname #1instre@m\endcsname |
| 572 |
\csname newif\expandafter\endcsname |
| 573 |
\csname ifstre@m#1open\endcsname |
| 574 |
\global\csname stre@m#1openfalse\endcsname |
| 575 |
\expandafter\ifx\csname atstreamopen#1\endcsname\relax |
| 576 |
\global\@namedef{atstreamopen#1}{}% |
| 577 |
\fi |
| 578 |
\expandafter\ifx\csname atstreamclose#1\endcsname\relax |
| 579 |
\global\@namedef{atstreamclose#1}{}% |
| 580 |
\fi |
| 581 |
}% |
| 582 |
{\PackageError{newfile}{Input stream #1 is already defined}{\@ehc}}} |
| 583 |
|
| 584 |
% \end{macrocode} |
| 585 |
% \end{macro} |
| 586 |
% |
| 587 |
% Some checking macros will be useful as some of the checks occur in |
| 588 |
% multiple places. |
| 589 |
% |
| 590 |
% \begin{macro}{\@ifstre@mopen} |
| 591 |
% |\@ifstre@mopen|\marg{stream}\marg{TRUE code}\marg{FALSE code} |
| 592 |
% checks if stream \meta{stream} is currently open. |
| 593 |
% \begin{macrocode} |
| 594 |
\newcommand{\@ifstre@mopen}[3]{% |
| 595 |
\csname ifstre@m#1open\endcsname#2\else#3\fi} |
| 596 |
% \end{macrocode} |
| 597 |
% \end{macro} |
| 598 |
% |
| 599 |
% \begin{macro}{\instre@mandopen} |
| 600 |
% |\instre@mandopen|\marg{stream}\marg{TRUE code} checks if \meta{stream} |
| 601 |
% is an input stream and is open. If so, it executes \meta{TRUE code}. |
| 602 |
% \begin{macrocode} |
| 603 |
\newcommand{\instre@mandopen}[2]{% |
| 604 |
\@ifundefined{#1instre@m}{% |
| 605 |
\PackageError{newfile}{#1\space is not an input stream}{\@ehc}}% |
| 606 |
{\@ifstre@mopen{#1}{#2}{% |
| 607 |
\PackageError{newfile}{Input stream #1\space is not open}{\@ehc}}}} |
| 608 |
|
| 609 |
% \end{macrocode} |
| 610 |
% \end{macro} |
| 611 |
% |
| 612 |
% \begin{macro}{\instre@mandclosed} |
| 613 |
% |\instre@mandclosed|\marg{stream}\marg{TRUE code} checks if \meta{stream} |
| 614 |
% is an input stream and is closed (not open). |
| 615 |
% If so, it executes \meta{TRUE code}. |
| 616 |
% \begin{macrocode} |
| 617 |
\newcommand{\instre@mandclosed}[2]{% |
| 618 |
\@ifundefined{#1instre@m}{% |
| 619 |
\PackageError{newfile}{#1\space is not an input stream}{\@ehc}}% |
| 620 |
{\@ifstre@mopen{#1}{% |
| 621 |
\PackageError{newfile}{Input stream #1\space is open}{\@ehc}}{#2}}} |
| 622 |
|
| 623 |
% \end{macrocode} |
| 624 |
% \end{macro} |
| 625 |
% |
| 626 |
% \begin{macro}{\outstre@mandopen} |
| 627 |
% |\outstre@mandopen|\marg{stream}\marg{TRUE code} checks if \meta{stream} |
| 628 |
% is an output stream and is open. If so, it executes \meta{TRUE code}. |
| 629 |
% \begin{macrocode} |
| 630 |
\newcommand{\outstre@mandopen}[2]{% |
| 631 |
\@ifundefined{#1outstre@m}{% |
| 632 |
\PackageError{newfile}{#1\space is not an output stream}{\@ehc}}% |
| 633 |
{\@ifstre@mopen{#1}{#2}{% |
| 634 |
\PackageError{newfile}{Output stream #1\space is not open}{\@ehc}}}} |
| 635 |
|
| 636 |
% \end{macrocode} |
| 637 |
% \end{macro} |
| 638 |
% |
| 639 |
% \begin{macro}{\outstre@mandclosed} |
| 640 |
% |\outtre@mandclosed|\marg{stream}\marg{TRUE code} checks if \meta{stream} |
| 641 |
% is an output stream and is closed (not open). |
| 642 |
% If so, it executes \meta{TRUE code}. |
| 643 |
% \begin{macrocode} |
| 644 |
\newcommand{\outstre@mandclosed}[2]{% |
| 645 |
\@ifundefined{#1outstre@m}{% |
| 646 |
\PackageError{newfile}{#1\space is not an output stream}{\@ehc}}% |
| 647 |
{\@ifstre@mopen{#1}{% |
| 648 |
\PackageError{newfile}{Output stream #1\space is open}{\@ehc}}{#2}}} |
| 649 |
|
| 650 |
% \end{macrocode} |
| 651 |
% \end{macro} |
| 652 |
% |
| 653 |
% \begin{macro}{\openoutputfile} |
| 654 |
% |\openoutputfile|\marg{filename}\marg{stream} opens the file called |
| 655 |
% \meta{filename} and attaches it to the stream \meta{stream} for |
| 656 |
% writing. However, if the |\nofiles| command has been given the |
| 657 |
% file is \emph{not} attached to the stream. No more than one file can be |
| 658 |
% attached to a stream at any given time. |
| 659 |
% \begin{macrocode} |
| 660 |
\newcommand{\openoutputfile}[2]{% |
| 661 |
\outstre@mandclosed{#2}{% |
| 662 |
\global\@namedef{#1@filename}{#1}% |
| 663 |
\if@filesw |
| 664 |
\immediate\openout\@nameuse{#2outstre@m}=\@nameuse{#1@filename}% |
| 665 |
\fi |
| 666 |
\global\csname stre@m#2opentrue\endcsname% |
| 667 |
\@nameuse{atstreamopen#2}% |
| 668 |
}% |
| 669 |
} |
| 670 |
|
| 671 |
% \end{macrocode} |
| 672 |
% \end{macro} |
| 673 |
% |
| 674 |
% \begin{macro}{\closeoutputstream} |
| 675 |
% |\closeoutputstream|\marg{stream} closes the stream \meta{stream}. |
| 676 |
% \begin{macrocode} |
| 677 |
\newcommand{\closeoutputstream}[1]{% |
| 678 |
\outstre@mandopen{#1}{% |
| 679 |
\@nameuse{atstreamclose#1}% |
| 680 |
\immediate\closeout\@nameuse{#1outstre@m}% |
| 681 |
\global\csname stre@m#1openfalse\endcsname}% |
| 682 |
} |
| 683 |
|
| 684 |
% \end{macrocode} |
| 685 |
% \end{macro} |
| 686 |
% |
| 687 |
% \begin{macro}{\openinputfile} |
| 688 |
% |\openinputfile|\marg{filename}\marg{stream} opens the file called |
| 689 |
% \meta{filename} and attaches it to the stream \meta{stream} for |
| 690 |
% reading. The file is added to the list of files. |
| 691 |
% No more than one file can be attached to a stream at |
| 692 |
% any given time. |
| 693 |
% \begin{macrocode} |
| 694 |
\newcommand{\openinputfile}[2]{% |
| 695 |
\IfFileExists{#1}{% file exists |
| 696 |
\instre@mandclosed{#2}{% |
| 697 |
\@addtofilelist{#1}% |
| 698 |
\global\@namedef{#1@filename}{#1}% |
| 699 |
\immediate\openin\@nameuse{#2instre@m}=\@nameuse{#1@filename}% |
| 700 |
\global\csname stre@m#2opentrue\endcsname% |
| 701 |
\@nameuse{atstreamopen#2}}}% |
| 702 |
{% file not found |
| 703 |
\PackageError{newfile}{Can't find file #1}{\@ehc}% |
| 704 |
}% |
| 705 |
} |
| 706 |
|
| 707 |
% \end{macrocode} |
| 708 |
% \end{macro} |
| 709 |
% |
| 710 |
% \begin{macro}{\closeinputstream} |
| 711 |
% |\closeinputstream|\marg{stream} closes the stream \meta{stream}. |
| 712 |
% \begin{macrocode} |
| 713 |
\newcommand{\closeinputstream}[1]{% |
| 714 |
\instre@mandopen{#1}{% |
| 715 |
\@nameuse{atstreamclose#1}% |
| 716 |
\immediate\closein\@nameuse{#1instre@m}% |
| 717 |
\global\csname stre@m#1openfalse\endcsname}% |
| 718 |
} |
| 719 |
|
| 720 |
% \end{macrocode} |
| 721 |
% \end{macro} |
| 722 |
% |
| 723 |
% \begin{environment}{writeverbatim} |
| 724 |
% |\begin{writeverbatim}|\marg{stream} writes the contents of |
| 725 |
% the environment as verbatim text to the given \meta{stream}. |
| 726 |
% \begin{macrocode} |
| 727 |
\def\writeverbatim#1{% |
| 728 |
\@bsphack |
| 729 |
\let\do\@makeother\dospecials |
| 730 |
\catcode`\^^M\active |
| 731 |
\verbatim@startline |
| 732 |
\verbatim@addtoline |
| 733 |
\verbatim@finish |
| 734 |
\def\verbatim@processline{% |
| 735 |
\immediate\write\@nameuse{#1outstre@m}{\the\verbatim@line}}% |
| 736 |
\verbatim@start} |
| 737 |
\def\endwriteverbatim{\@esphack} |
| 738 |
|
| 739 |
% \end{macrocode} |
| 740 |
% \end{environment} |
| 741 |
% |
| 742 |
% \begin{macro}{\addtostream} |
| 743 |
% |\addtostream|\marg{stream}\marg{text} writes \meta{text} to the |
| 744 |
% given \meta{stream}. |
| 745 |
% \begin{macrocode} |
| 746 |
\newcommand{\addtostream}[2]{% |
| 747 |
\@bsphack |
| 748 |
\outstre@mandopen{#1}{% |
| 749 |
{\let\protect\string |
| 750 |
\immediate\write\@nameuse{#1outstre@m}{#2}% |
| 751 |
}}% |
| 752 |
\@esphack |
| 753 |
} |
| 754 |
|
| 755 |
% \end{macrocode} |
| 756 |
% \end{macro} |
| 757 |
% |
| 758 |
% \begin{macro}{\ifstre@mnoteof} |
| 759 |
% \begin{macro}{\checkstre@mnoteof} |
| 760 |
% |\checkstre@mnoteof|\marg{stream} sets |\ifstre@mnoteof| to TRUE if |
| 761 |
% \meta{stream} is not at the end of the file (i.e., it is the opposite |
| 762 |
% of |\ifeof|). |
| 763 |
% \begin{macrocode} |
| 764 |
\newif\ifstre@mnoteof |
| 765 |
\newcommand{\checkstre@meof}[1]{% |
| 766 |
\stre@mnoteoftrue\ifeof\@nameuse{#1instre@m}\stre@mnoteoffalse\fi} |
| 767 |
|
| 768 |
% \end{macrocode} |
| 769 |
% \end{macro} |
| 770 |
% \end{macro} |
| 771 |
% |
| 772 |
% \begin{macro}{\readstream} |
| 773 |
% |\readstream|\marg{stream} reads the contents of |
| 774 |
% the given \meta{stream} as |\input| text. |
| 775 |
% \begin{macrocode} |
| 776 |
\def\readstream#1{ |
| 777 |
\instre@mandopen{#1}{% |
| 778 |
\loop \checkstre@meof{#1} \ifstre@mnoteof |
| 779 |
\read\@nameuse{#1instre@m} to\temptokstre@m |
| 780 |
\temptokstre@m |
| 781 |
\repeat |
| 782 |
}% |
| 783 |
} |
| 784 |
|
| 785 |
% \end{macrocode} |
| 786 |
% \end{macro} |
| 787 |
% |
| 788 |
% \begin{macro}{\readaline} |
| 789 |
% |\readaline|\marg{stream} reads what TeX considers to be one line |
| 790 |
% from the given \meta{stream} as |\input| text. |
| 791 |
% \begin{macrocode} |
| 792 |
\def\readaline#1{ |
| 793 |
\instre@mandopen{#1}{% |
| 794 |
\ifeof\@nameuse{#1instre@m} |
| 795 |
\PackageWarning{newfile}{No more to read from stream #1} |
| 796 |
\else |
| 797 |
\read\@nameuse{#1instre@m} to\temptokstre@m |
| 798 |
\temptokstre@m |
| 799 |
\fi |
| 800 |
}% |
| 801 |
} |
| 802 |
|
| 803 |
% \end{macrocode} |
| 804 |
% \end{macro} |
| 805 |
% |
| 806 |
% |
| 807 |
% \begin{macro}{\readverbatim} |
| 808 |
% \begin{macro}{\stre@mverbatim@input} |
| 809 |
% \begin{macro}{\verbatim@readstre@m} |
| 810 |
% |\readverbatim|\marg{stream} reads the contents of |
| 811 |
% the given \meta{stream} as verbatim text. |
| 812 |
% |
| 813 |
% The read verbatim code is a slight variation on code from the |
| 814 |
% \Lpack{verbatim} package. Most of the setup is done by the macros |
| 815 |
% |\stre@mverbatim@input|\marg{setup}\marg{stream} and |
| 816 |
% |\verbatim@readstre@m|\marg{stream}. Finally, |\verbatim@read@file| |
| 817 |
% is a \Lpack{verbatim} package macro. |
| 818 |
% \begin{macrocode} |
| 819 |
\def\readverbatim{\begingroup |
| 820 |
\@ifstar{\stre@mverbatim@input\relax}% |
| 821 |
{\stre@mverbatim@input{\frenchspacing\@vobeyspaces}}} |
| 822 |
|
| 823 |
\def\stre@mverbatim@input#1#2{% |
| 824 |
\@ifstre@mopen{#2}% |
| 825 |
{\@verbatim #1\relax |
| 826 |
\def\verbatim@in@stream{\@nameuse{#2instre@m}} |
| 827 |
\verbatim@readstre@m{#2}\endtrivlist\endgroup\@doendpe}% |
| 828 |
{\PackageError{newfile}{Stream #2 is not open}{\@ehc}\endgroup}% |
| 829 |
} |
| 830 |
|
| 831 |
\def\verbatim@readstre@m#1{% |
| 832 |
\verbatim@startline |
| 833 |
\expandafter\endlinechar\expandafter\m@ne |
| 834 |
\expandafter\verbatim@read@file |
| 835 |
\expandafter\endlinechar\the\endlinechar\relax |
| 836 |
\verbatim@finish |
| 837 |
} |
| 838 |
|
| 839 |
% \end{macrocode} |
| 840 |
% \end{macro} |
| 841 |
% \end{macro} |
| 842 |
% \end{macro} |
| 843 |
% |
| 844 |
% \begin{macro}{\plainvstream} |
| 845 |
% A macro that sets |\verbatim@processline| to its default definition. |
| 846 |
% \begin{macrocode} |
| 847 |
\newcommand{\plainvstream}{% |
| 848 |
\def\verbatim@processline{\the\verbatim@line\par}% |
| 849 |
} |
| 850 |
|
| 851 |
% \end{macrocode} |
| 852 |
% \end{macro} |
| 853 |
% |
| 854 |
% \begin{macro}{\streamvnumfont} |
| 855 |
% \begin{macro}{\stre@mvnfont} |
| 856 |
% We need a counter for numbering lines read in verbatim. |
| 857 |
% |
| 858 |
% |\streamvnumfont|\marg{font} defines |\stre@mvnfont| to be \meta{font}. |
| 859 |
% \begin{macrocode} |
| 860 |
\newcounter{streamvline} |
| 861 |
\newcommand{\streamvnumfont}[1]{\def\stre@mvnfont{#1}} |
| 862 |
\streamvnumfont{\footnotesize} |
| 863 |
|
| 864 |
% \end{macrocode} |
| 865 |
% \end{macro} |
| 866 |
% \end{macro} |
| 867 |
% |
| 868 |
% \begin{macro}{\streamvfont} |
| 869 |
% \begin{macro}{\verbatim@font} |
| 870 |
% |\streamvfont|\marg{font} defines |\verbatim@font| to use \meta{font}. |
| 871 |
% \begin{macrocode} |
| 872 |
\newcommand{\verbatimfont}[1]{% |
| 873 |
\def\verbatim@font{#1% |
| 874 |
\hyphenchar\font\m@ne |
| 875 |
\let\do\do@noligs |
| 876 |
\verbatim@nolig@list}} |
| 877 |
\verbatimfont{\normalfont\ttfamily} |
| 878 |
|
| 879 |
% \end{macrocode} |
| 880 |
% \end{macro} |
| 881 |
% \end{macro} |
| 882 |
% |
| 883 |
% \begin{macro}{\numbervstream} |
| 884 |
% |\numbervstream| puts numbers at the start of each line read verbatim. |
| 885 |
% \begin{macrocode} |
| 886 |
\newcommand{\numbervstream}{% |
| 887 |
\setcounter{streamvline}{0}% |
| 888 |
\def\verbatim@processline{% |
| 889 |
\addtocounter{streamvline}{1}% |
| 890 |
\leavevmode |
| 891 |
{\stre@mvnfont \thestreamvline}\space |
| 892 |
\the\verbatim@line\par}% |
| 893 |
} |
| 894 |
|
| 895 |
% \end{macrocode} |
| 896 |
% \end{macro} |
| 897 |
% |
| 898 |
% \begin{macro}{\marginnumbervstream} |
| 899 |
% |\marginnumbervstream| puts numbers in the margin at the start of |
| 900 |
% each line read verbatim. |
| 901 |
% \begin{macrocode} |
| 902 |
\newcommand{\marginnumbervstream}{% |
| 903 |
\setcounter{streamvline}{0}% |
| 904 |
\def\verbatim@processline{% |
| 905 |
\addtocounter{streamvline}{1}% |
| 906 |
\leavevmode |
| 907 |
\llap{{\stre@mvnfont \thestreamvline} \hskip\@totalleftmargin} |
| 908 |
\the\verbatim@line\par}% |
| 909 |
} |
| 910 |
|
| 911 |
% \end{macrocode} |
| 912 |
% \end{macro} |
| 913 |
% |
| 914 |
% The end of the \Lpack{newfile} package. |
| 915 |
% \begin{macrocode} |
| 916 |
%</outin> |
| 917 |
% \end{macrocode} |
| 918 |
% |
| 919 |
% |
| 920 |
% |
| 921 |
% \bibliographystyle{alpha} |
| 922 |
% |
| 923 |
% \begin{thebibliography}{GMS94} |
| 924 |
% |
| 925 |
% \bibitem[GMS94]{GOOSSENS94} |
| 926 |
% Michel Goossens, Frank Mittelbach, and Alexander Samarin. |
| 927 |
% \newblock \emph{The LaTeX Companion}. |
| 928 |
% \newblock Addison-Wesley Publishing Company, 1994. |
| 929 |
% |
| 930 |
% \bibitem[MG95]{ENDFLOAT} |
| 931 |
% James Darrell McCauley and Jeff Goldberg. |
| 932 |
% \newblock `The \texttt{endfloat} package'. |
| 933 |
% \newblock October, 1995. |
| 934 |
% |
| 935 |
% \bibitem[Pif96]{ANSWERS} |
| 936 |
% Mike Piff. |
| 937 |
% \newblock `Production of solution sheets in LaTeX2e'. |
| 938 |
% \newblock July, 1996. |
| 939 |
% |
| 940 |
% \bibitem[SRR99]{VERBATIM} |
| 941 |
% Rainer Sch\"{o}pf, Bernd Raichle, and Chris Rowley. |
| 942 |
% \newblock `A New Implementation of LaTeX's \texttt{verbatim} and |
| 943 |
% \texttt{verbatim*} Environments'. |
| 944 |
% \newblock December, 1999. |
| 945 |
% |
| 946 |
% \end{thebibliography} |
| 947 |
% |
| 948 |
% |
| 949 |
% \Finale |
| 950 |
% \PrintIndex |
| 951 |
% |
| 952 |
\endinput |
| 953 |
|
| 954 |
%% \CharacterTable |
| 955 |
%% {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 |
| 956 |
%% 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 |
| 957 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 958 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 959 |
%% Dollar \$ Percent \% Ampersand \& |
| 960 |
%% Acute accent \' Left paren \( Right paren \) |
| 961 |
%% Asterisk \* Plus \+ Comma \, |
| 962 |
%% Minus \- Point \. Solidus \/ |
| 963 |
%% Colon \: Semicolon \; Less than \< |
| 964 |
%% Equals \= Greater than \> Question mark \? |
| 965 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 966 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 967 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 968 |
%% Right brace \} Tilde \~} |
| 969 |
|