All source files in ALLPROSE have the extension .nw. The standard extension is defined through the command ∖nwextension below and should be used in source text via the command ∖srcextension.
The command ∖extension is generally used for writing extensions in source text.
The file myalps.lsf (list of source files) will be generated by ∖sourcefile and ∖includesourcefiles during the compilation of the documentation via the programs LATEX and PDFLATEX. The command ∖sourcefile writes out
\SourceFile {DIR/FILENAME}
|
to the file myalps.lsf. It will, however do this only once per file, since the first time it is executed it defines a new TEX-command with the filename prefixed by an exclamation mark and in later executions checks the existence of that command. Thus the file myalps.lsf will contain no identical lines.
Note that we use ∖gdef below, because ∖sourcefile might appear inside an environment.
Braces {, }, backslashes, \, percent signs, %, number signs, #, underscores, _, and spaces can not be part of filenames.
Because hyperref is used, parentheses, (, and in particular ) are also not allowed in the argument. The hyperref package simply cuts off the target identifier after a ) character.
The command ∖SourceFile should not appear in any .tex file but only in the generated file myalps.lsf. When executed, it will include the corresponding file (with extension .nw.tex).
So there is no harm if, for example, the files allprose.tex.nw or myalps.bib.nw appears in the argument of the ∖sourcefile command.
Note the ∖makeatother in the following code chunk. The LATEX command \@starttoc{lsf} from above gives @ the TEX category code 11 (letter) before including the files. Here is a copy of that code from latex.ltx.
\def\@starttoc#1{%
\begingroup \makeatletter \@input{\jobname.#1}% \if@filesw \expandafter\newwrite\csname tf@#1\endcsname \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax \fi \@nobreakfalse \endgroup} |
If a source file is mentioned in the text, it should be tagged by ∖srcfile; if it is a generated file, it should be tagged by ∖genfile. Since every source file in a project supported by ALLPROSE has the extension .nw, that extension must not be put into the ∖srcfile or ∖sourcefile commands. The argument of ∖srcfile must follow Convention 12.
The commands ∖srcfile and ∖genfile are built on an auxiliary command ∖rhxhyperfile which expands its first argument completely.
NOWEAVE produces the complete path of the file into the argument of ∖nwfilename at the beginning of the generated .nw.tex file. See also target texfiles in Section 28.9). The command ∖nwfilename is modified to produce a new section and index entries.
For the definition of ∖currentfile (used in Section 24.4), we build on the fact that each generated .nw.tex file starts with
\nwfilename{FILENAME.nw}\nwbegindocs{0}
|
where FILENAME is the full path of the current file starting at PROJECTROOT and without its .nw extension.
Let us first initialize it.
Then we save the current definition of ∖nwfilename and redefine it.
The following commands basically set ∖ifAldorSource to true or false according to the extension of the filename given in the argument of ∖nwfilename.
Unfortunately,
\hypertarget{}{#1}
|
introduces an unwanted vertical space before the beginning of a section although it prints nothing. Thus, we had to use some internal commands of the hyperref package directly. Its RCS ID string reads:
Id: hyperref.dtx 6.71 2000/10/04 rahtz Exp rahtz
|