Format Estelle/Java/Lotos/MSC/Pascal/SDL for LaTeX

See the download page to obtain this program

Description

These programs read Estelle, Java, LOTOS, MSC Pascal or SDL source (which is assumed to be syntactically valid) from the standard input. They write formatted LaTeX to the standard output.

The programs translate initial tab and space characters on a line into LaTeX horizontal space (\hspace). This assumes that indentation will be by small (e.g. 2) units of space. Because LaTeX limits the number of tab stops in a tabbing environment to around a dozen, it is not possible to have tab stops every space or two. Tabs and multiple spaces embedded in a line are translated into LaTeX tab commands (\>). This assumes that embedded tabs and multiple spaces are likely to be used to format comments and the like, for which a coarser degree of control over spacing is acceptable. Since the output is assumed to be embedded in a LaTeX tabbing environment, a LaTeX newline command (\\) is appended to each line.

Keywords are converted to bold (\bf), and LaTeX special characters are escaped. The programs recognise comments and strings as appropriate to the language. Comments may not be nested. Comment delimiters are treated literally inside strings, and string delimiters are treated literally inside comments. Keywords are not emboldened inside comments or strings. To preserve the appearance of strings, embedded tabs and multiple spaces are converted into tabs. This is only a rough approximation because of the proportional spacing.

Options

The flag -n causes output lines to be numbered at the right. The environment variable FMT may be set to this value for the same effect.

Usage

Run these programs on an appropriate source file. For example, to format Java do:

javtex [-n] file.java

The resulting formatted LaTeX is sent to the standard output. However if this is done, note that there may be a limit on how much text may be filtered at one time. It may therefore be necessary to filter a large amount of text in several blocks.

History

Version 1.0: First public version, Ken Turner, 28th July 1992 (esttex), 16th September 1993 (lottex), 31st January 1997 (pastex), 4th August 1992 (sdltex)

Version 1.1: Ken Turner, 6th November 2001 (esttex), 6th November 2001 (javtex), 6th November 2001 (lottex), 6th November 2001 (pastex), 6th November 2001 (sdltex)

Version 1.2: Ken Turner, 12th May 2002 (esttex), 12th May 2002 (javtex), 12th May 2002 (lottex), 12th May 2002 (msctex), 12th May 2002 (pastex), 12th May 2002 (sdltex)


Up one level to LaTeX Utilities

Web Ken Turner Home   Email    Search Search Web Pages

Last Update: 25th February 2010
URL: http://www.cs.stir.ac.uk/~kjt/software/latex/xyztex.html