",," substitutes ''

Guide for writing and maintaining NEWSTAR documents

Contents

Summary of NEWSTAR LaTeX commands

For quick reference use the following list of special LaTeX commands available in the NEWSTAR documentation system:

ascref
Ascref
caption
chapter
eqref
Eqref
fig
figref
Figref
label
ps
psref
Psref
ref: Not to be used
tableofcontents
textref
Textref
whichref

The NEWSTAR documentation system

The NEWSTAR documentation system provides documentation in two forms: An on-line hypertext system based on the public-domain program "xmosaic" and standard LATeX documents. Both forms are derived from a single set of LaTeX source files; for the hypertext form, the public-domain translator latex2html is used. Broadly speaking, authors are free to use the standard LaTeX constructs. In particular, latex2html handles tabular material, mathematical formulas and the inclusion of diagrams very well. Writers should be aware, however, that every bit of math-mode text is translated into a little bitmap that must be loaded separately for display. This considerably slows down both the processing by ndoc Cook and the display by xmosaic. Simple macros defined through \newcommand can be used freely, but complicated nesting of macros should be avoided. To satisfy the specific needs of the NEWSTAR system and circumvent some deficiencies of latex2html , the guidelines given below should be followed.

General layout

Cross-references

In writing documents, the placeholder \whichref{text}{} can be used for references whose target is not yet known.

For most referencing commands, a companion with the leading character capitalised is available; these work the same way except that the text argument is printed in boldface. This feature is intended for use in the documentation home-page document, hb_contents.tex.

Cross-references to text in LaTeX documents

Cross-references must work in both the printed and hypertext versions of a document. For this reason, the standard LaTeX \ref command is unsuitable and the rules given below must be followed instead.

Cross-references to other types of documents

The documentation system also contains ASCII documents and PostScript documents imported from elswehere. Such documents may be referred to through the following commands:

<file name> is the name (without extension!) of a .txt file in directory \$n\_doc/txt or of a .ps file in directory \$n\_hlp; the name may contain neither dots nor uppercase characters, but underscores are allowed (and need not to be quotes with a backslash).

This command is used to refer to program code or WNTINC table definitions (.dsc files). directory must be specified relative to n_src and the file extension must be included.

Equations and equation references

The commands \Eqref{.<label>} and \eqref{.<label>} are entirely analogous to the figure references \Figref and \figref.

Figures and figure references

Figures with their captions reside in the directory \$n\_doc/fig. A figure consists of two components:

A figure with its caption is included in a document source file through the command

\input{../fig/<name>.cap

In the printed document, figure and caption are included in the standard way. In the hypertext display the word FIGURE is included, followed by the caption text, with a hypertext link from FIGURE to a postscript file. ndoc generates that file automatically from the .fig file.

Caption files

The purpose of the caption file (as opposed to spelling out the caption text in the document source) is to enable the figure with its caption to exist as an independent unit that can be included in more than one document and also exist outside the context of any document.

The caption file must not only provide the caption, but also the title under which the figure may be listed in the Handbook Overview. It is therefore important to adhere strictly to the following format:

 
        \begin{figure}[htbp] 
          \fig{<name>} 
          \caption[]{<optional LaTeX commands, e.g. \it> 
        <title> 
        <optional LaTeX commands, e.g. \> <optional remainder of caption> 
        } 
          \label{.<label>} 
        \end{figure} 

Examples can be found in the /\$n\_doc/fig directory.

You are free to choose the label; the recommended choice, however, is the file name with underscores replaced by dots. (Remember that underscores are illegal in labels and that labels must start with a dot.)

Comment lines (but no empty lines!) may be arbitrarily added, except that the <title> line must immediately follow the \caption command.

Xfig figures

.fig files may be created without any restrictions with the public-domain program xfig. It is not necessary to produce a postscript file with this program. ndoc/ will take the .fig file and convert it automatically.

Often, figures drawn on a convenient scale on a workstation screen will not fit on a standard A4 page. ndoc/ may be instructed to automatically reduce its scale by including in the figure a text line

<file name>.fig <nn> It is best to put this text in an inconspicuous corner and a small font (e.g. 10pt as opposed to a standard 20pt).

Postscript figures

It is also possible to include Postscript figures produced in other ways than through xfig: Use the command \ps{<filename>} instead of \fig and place the postscript file <filename>.ps in the directory /\$n\_doc/bin with a soft link to it in \$n\_hlp. If it can not be easily recovered, it is advisable to protect it against accidental deletion!

Figure references

For references to figures, use

\figref{.<label>} and \Figref{.<label>}

These commands translate to hypertext links figure or Figure in the hypertext document, and to a standard reference figure <n> or Figure <n> in the printed document.

Session transcripts

Verbatim transcripts of pieces of terminal dialogue controlling program execution are an important ingredient to documentation. Such transcripts are easily produced through the command ndoc S[cript] <file name> This starts a cshell script session in which you execute the program of which you want a transcript. After exit from the script session, the collected script is automatically formatted into a LaTeX file <file name>.trs; what remains for you to do is to cut out the irrelevant parts and perhaps add some comments. A sample section of such a file is shown below

 %
\spbegin %
\skeyword{USE\_SCN\_NODE} \sprompt{(input node name)} \sdefault{= *:}
\suser{?} %
\svbegin \begin{verbatim} 
 Specify the node name from which the corrections should be calculated. 
 * indicates the same as the output node name. 
\end{verbatim}\svend
 \spend
%
%
\spbegin %
\skeyword{USE\_SCN\_NODE} \sprompt{(input node name)} \sdefault{= *:}
\suser{*} \sinline{Use the same SCN file} \spend
%
%
\spbegin %
\skeyword{USE\_SCN\_SETS} \sprompt{(Set(s) of input uv-data Sectors:
g.o.f.c.s)} \sdefault{= "":} \suser{2.0.0.0.0} \sinline{Sets in job 2}
\spend %
%
\spbegin %
\skeyword{HA\_RANGE} \sprompt{(DEG) (HA range)} \sdefault{= *:}
\suser{\scr} \sinline{Use all scans in these sets} %
\svbegin \begin{verbatim} 
   0123456789ABCD 
 0 -+++++++++++++ 
 1  -++++++++++++ 
 2   -+++++++++++ 
 3    -++++++++++ 
 4     -+++++++++ 
 5      -++++++++ 
 6       -+++++++ 
 7        -++++++ 
 8         -+++++ 
 9          -++++ 
 A           -+++ 
 B            -++ 
 C             -+ 
 D              - 
\end{verbatim}\svend
\spend%

The file consists of sections delimited by \spbegin and \spend, each consisting of a prompt with its reply and the ensuing output from the computer. LaTeX will treat these sections as blocks in which a page break can not occur. The following LaTeX commands are used:

It is necessary to check these scripts with some care. The system does occasionally get confused by the way the parameter interface splits long input and output lines. The errors are usually easily corrected.

On-line Help files in the NEWSTAR FIGURE .] documentation system and their origins.
Files shown in boldface are the documentation and program sources, those shown in regular print are the derived Help files.
The full-drawn arrows indicate hypertext links for diagrams. The links to the other files types are not shown. The dotted arrow indicate links to in-line picture files that contain formulas and tables.
The dashed arrows indicate the relations between the files: Straight arrows represent a direct derivation, merging arrows a source-file inclusion. The capital letters on the arrows show in which procedure the derivation is implemented:
C= ndoc Cook; F= ndoc Fig; T= ndoc Test; P= ndoc Print.

Printable documents in the NEWSTAR FIGURE .] documentation system and their origins.
Files shown in boldface are the documentation and program sources, those shown in regular print are the derived printable files in the Help system.
The dashed arrows indicate the relations between the files: Straight arrows represent a direct derivation, merging arrows a source-file inclusion. The capital letters on the arrows show in which procedure the derivation is implemented: F= ndoc Fig; T= ndoc Test; P= ndoc Print.

The documentation system encompasses three classes of files. The document source files reside in subdirectories of $n_doc; the code source files which may also be referenced reside in subdirectories of $n_src. All hypertext files reside in a tree of subdirectories rooted in \$n\_hlp. The interrelations of all these files are shown in figure.

The following types of source texts are used:

In processing, temporary files are created in the current directory; their names either contain the string \_tmp. or end in .tmp. ndoc normally deletes them when exiting.

latex2html, invoked by ndoc Cook, translates each file <name>.tex into a file \$n\_hlp/<name>/<name>.html. A large number of .html files are therefore in subdirectories of \$n\_hlp.

ndoc Print creates .ps PostScript text files in \$n\_hlp. ndoc Fig creates .fps PostScript diagram files in \$n\_hlp.

Programmer's commands: Processing individual files

The commands are of the form ndoc <operation> [-<option>] <file> <file> is the full file name including the extension, and it must be in the current directory. Wildcards may be used. The <operation> and -<option> arguments may be abbreviated and are case-insensitive. The following operations and options are available:

P[rint] creates [a] PostScript file[s] from [a] .tex source file[s], with the following options:

Print uses the LaTeX program. It attempts to suppress the verbose output of this program by filtering out everything except essential error messages. If you encounter a problem that you can not solve, submit your source file to the NEWSTAR group for diagnosis.

C[ook] creates a Hypertext file from [a] .tex document[s]. This operation makes use of latex2html . This program may crash over LaTeX syntax errors without properly analysing them. It is therefore recommended to first do a Print -Syntax check.

K[ey] creates Hypertext files from [a] .pin, .psc or .pef file[s]

L[ink] creates the softlinks from the n_hlp directory to the $n_doc/txt and $n_src directories.

ndoc checks the dates of its input and output files. If the output is newer than the date, ndoc emits a message and proceeds with the next input file. This check is incomplete in that it does not check the status of \input files such as figure captions.

There are two ways of bypassing this check:

When working in a shadow system, ndoc makes no difference between hard copies and soft links to the master system: Both are unconditionally compiled.

NEWSTAR manager's commands: Maintaining the documentation system

To recompile the entire documentation collection from its sources, one uses the command ndoc All ndoc will ask which parts of the system to recompile, the default being 'yes' for all subsystems. In this mode of operation ndoc bypasses the check for an up-to-date output file.

One of the actions available in ndoc All is a systematic check of the correspondence between source and output files. This is a very useful action because it clears up leftovers of obsolete documents and pinpoints areas of trouble.

Debugging .tex files

ndoc goes a long way in filtering from the verbiage that LaTeX spews out the essential diagnostics. It shows the essential section of LaTeX output where the error is reported (including a line number) plus five lines of text in the middle of which the error was found. Very often this information suffices to pinpoint the error. If it does not, you may have to take a better look either at your source or at the <file name>_tmp.tex file that is the file LaTeX was actually processing. Note that the line number reported refers to this latter file!

Specific errors that have been encountered and are not covered by this diagnosis mechanism are described below.

LaTeX bugs

Both ndoc Print and ndoc Cook make use of LaTeX and may therefore be affected by LaTeX bugs. For cases not covered here, refer to "The LaTex Book", which is probably the best informed source about that program.

Processing errors in ndoc

When LaTeX reports an error to ndoc, ndoc displays a five-line text section in the middle of which the error occurred. This is not from the original input text, but from the preprocessed text as it was eventually presented tp LaTeX. Most errors are easily recognised and traced back to the input .tex file.

Processing errors in ndoc Cook

The program latex2html on which ndoc Cook is based is rather lax on checking LaTeX syntax but may stumble over the consequences of an error missed. It is therefore strongly recommended to first check the syntactical correctness of the .tex file through ndoc P.

latex2html

latex2html is a public-domain perl script created by Nikos Drakos at Leeds University, England (Email: nikos@cbl.leeds.ac.uk) and available through anonymous ftp. It has been found to be a reliable and highly capable program. Apart from configuring it to the local environment, two changes were found necessary:

Formulas and the like in latex2html

LaTeX allows many constructs, such as formulas, tables etc., for which there is no HTML counterpart (yet). latex2html converts each single occurrence of these into a little picture file that is linked in-line into the .html document. The pictures are stored in .png files in the same directory as the .html file.

Since building these pictures is a very time-consuming process, latex2html seeks to reuse them as much as possible whenever it recompiles a .tex file. To this end, it maintains an administration in the file images.pl in the .html file's directory. Therefore, to insure the integrity of the .html document, both the .png files and images.pl must be left in place. As of May 1996, doc_cook.csh contains a section of code that finds all in-line picture references in the renewed .html file, reports any referred-to files that are missing and deletes unreferenced .png files.

In cases a .png file is reported missing, the way to get it rebuilt is to delete images.pl in order to force latex2html to rebuild all the picture files from scratch.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.


newstar@nfra.nl