Previous Next Contents

5.1 Formatting, Previewing and Printing

NAME format - translate SGML into LaTeX or nroff/troff

SYNOPSIS

format [-c] [-t int] [-T format] [-r mapping] file[.sgml]

DESCRIPTION

format translates an SGML file of the qwertz document type into LaTeX and various forms of nroff/troff. The ".sgml" file name extension is optional. It first checks that the file is a syntactically correct instance of the qwertz document type. The default action is to write LaTeX to the standard output. To print a qwertz file named foo.sgml, using LaTeX, just type

format foo | qtex | lpr

qtex is a front-end to LaTeX designed to be used as a filter in this way. See qtex(1) for more information.

If you need more control over printing than is available using lpr alone, you can first create a dvi file, and then print the file using a dvi to PostScript converter, such as dvips. For example, to print pages 3 to 10 of foo, you could type

format foo | qtex -d > foo.dvi
dvips -p 3 -n 8 foo | lpr

If there is a PostScript previewer available, such as ghostview, from the GNU distribution, you can preview the document by typing

format foo | qtex > foo.ps; ghostview foo.ps

Or, you may also preview the document using a dvi previewer such as xdvi by typing

format foo | qtex -d > foo.dvi;  xdvi foo

You can also use nroff to view the document on an ASCII terminal:

format -T nroff foo | nroff -ms | more

Finally, nroff may also be suitable for sending the document to someone by electronic mail:

format -T nroff foo | nroff -ms | mail thomas@gmdzi.gmd.de

OPTIONS

In the following, it is assumed that the file to be formatted is named foo.sgml, or simply foo.

-help

If this is the only option, a short message listing all the options available, and their purpose, is printed to the standard out.

-c

Just check the syntax of the document, to see that it is a correct instance of the qwertz document type.

-T [latex | nroff | grops | man]

Use -T to select the format in which to translate the qwertz document. By default, LaTeX is used. nroff is appropriate for ASCII devices. grops is a troff format for groff, a reconstruction of troff from the Free Software Foundation. grops uses groff's names for non-ASCII characters and symbols. To use groff to generate an ASCII version of the document, use the nroff format, as in:

format -T nroff foo | groff -ms -T ascii | more 

Both the grops and nroff formats use the ms macro package. Also, documents containing tables and formulas will need to be preprocesed by tbl(1) and eqn(1), respectively.

The man format generates nroff using the man macro package for Unix manual pages. Manual pages may also be formatted using any of the other formats.

By default, format looks in the $FORMAT/rep directory for the files controlling the translation of qwertz documents into various formats. If you wish to customize the appearance of your documents, or support additional formats, you may create your own mappings. Just set the REPDIR shell variable to the directory containing your formats. For each format, f, there should be a subdirectory named f in the REPDIR directory. Within this subdirectory, there must be three files, named: mapping, general and math. The mapping file is a simple table from SGML start and end tags into instructions or commands for the goal formatting system. (The table must be in the format first used by the Amsterdam SGML Parser.) See $FORMAT/rep/qwertz/latex/mapping and $FORMAT/rep/qwertz/grops/mapping for examples. The general and math files are SGML files containing the formatter specific definitions of general purpose characters and mathematical symbols, respectively. Again, see the examples in $FORMAT/rep/qwertz/latex. See also the -r option, below.

-r replacement file

The REPDIR shell variable is used to set the default directory for complete replacement files. The -r option is used to override the replacements for some of the start and end tags in a default replacement file. Only the start or end tags which are to be formatted differently than specified in the default file need to be included.

-t n

format always pipes the input document through expand to replace tabs by spaces. By default, each tab is replaced by eight spaces. You can change this by using this option.

SEE ALSO

 
qtex(1), nroff(1), tbl(1), eqn(1), groff(1), dvips(1),
expand(1), sed(1), lpr(1), ghostview(1), xdvi(1) 

DIAGNOSTICS

SGML syntax errors are reported to standard out. Each error message mentions the line number containing the error.


Previous Next Contents