piet@cs.ruu.nl (Piet van Oostrum) (04/11/91)
Typesetting program texts with TeX and LaTeX. This is a preliminary survey of methods to typeset program texts with TeX and/or LaTeX, usually mixed with other text. The description consists mostly of (edited) parts of the documentation of the packages, or messages from their authors. I post this to get responses from people that know other packages, or updated versions of these. Also I would like to receive input about the availability (e.g. by FTP or mail server) of these packages, other than the ones mentioned here. Some are available on our own archive. PLEASE MAIL remarks to me, do not post them on the net. After two or three weeks I will post an updated version. I might also submit it for publication in TUGboat, but then I will have to TeXify it first. Contents: 1. Web and derivatives 1.1 Cweb 1.2 Fweb 1.3 Spiderweb 2. Tgrind 3. C2latex 4. C++2latex 5. Cprog macros 6. program environment 7. Scheme 8. Ada 9. sundry ------------------------------------------------------------------------ 1.1 Cweb ------------------------------------------------------------------------ ctangle, cweave - translate CWEB to C and/or TeX The ctangle program converts a CWEB source document into a C program that may be compiled in the usual way. The output file includes #line specifications so that debugging can be done in terms of the CWEB source file. The cweave program converts the same CWEB file into a TeX file that may be formatted and printed in the usual way. It takes appropriate care of typographic details like page layout and the use of indentation, italics, boldface, etc.,and it supplies extensive cross-index information that it gathers automatically. CWEB allows you to prepare a single document containing all the information that is needed both to produce a compilable C program and to produce a well-formatted document describing the program in as much detail as the writer may desire. The user of CWEB ought to be familiar with TeX as well as C. Don Knuth wrote WEB for TeX and Pascal. Silvio Levy designed and developed CWEB by adapting the WEB conventions to C and by recoding everything in CWEB. Subject: Levy's Cweb system ported to MS-DOS and VAX/VMS On the UK TeX Archive at Aston University, directory [tex-archive.web.cweb] contains the sources for building Silvio Levy's CWEB system (a WEB suite which uses C as the programming language, and TeX as the typesetting language) under Unix; this includes a bootstrapping version of Ctangle which permits one to get Cweave, etc., working. Originally this was accompanied by a file VMS.CH which purported to port Cweb onto VAX/VMS: however, Vax-C has been revised since Levy released this, and further changes were necessary to get the system working under VMS. The original VMS.CH has threfore been deleted, and a new subdirectory [tex-archive.web.cweb.vms] added to hold the files for bootstrapping CWEB onto VMS, and the change files to make this Ctangle and Cweave. In addition, I have ported CWEB to MS-DOS (under Borland's Turbo-C V1.5). This was a *major* undertaking, because of clashes between identifiers used in ANSI-standard function prototypes in Borland's libraries and constants defined in the .web files. Other very extensive changes were required to handle the large data structures, which exceed the 64kB segment limit of the PC architecture. However, it's all working eventually, and the files required for bootstrapping it, and the change files, will be found in [tex-archive.web.cweb.ms-dos]. For both of the above ports, the majority of the files of the Unix distribution will also be required. To get started, fetch the file [tex-archive.web.cweb]00readme.txt from Aston, either by NIFTP (username PUBLIC, password PUBLIC), or by sending mail to <TeXserver@Uk.Ac.Aston.TeX>, with the body of the message consisting of the two lines: FILES [tex-archive.web.cweb]00readme.txt This file will tell you which other files will be required to be fetched to have a working version of CWEB under Unix, VMS or MS-DOS. Brian {Hamilton Kelly} ------------------------------------------------------------------------ 1.2 Fweb ------------------------------------------------------------------------ Announcing FWEB: A Fortran/Ratfor/C version of WEB. Since the advent of Knuth's famous WEB system for documenting Pascal and, later, Levy's C version thereof, various Fortran users have inquired about the possibility of a WEB system for Fortran. I have developed a version of WEB that supports Fortran, Ratfor, and C (which can be mixed in the same WEB run). The new version is called FWEB. I am releasing v. 0.99 for beta-testing. This release is a bit premature (there are a few known bugs), but professional responsibilities force me to put FWEB on the back burner for a few months. This project was driven by necessity. I was developing a large scientific code that I planned to write mostly in C. I was eager to document it as well as I could (so my graduate students could understand it), so I was interested in Silvio Levy's CWEB. Levy graciously gave me v. 0.5 of CWEB, which I used successfully for a few years. However, part of my code could not be efficiently written in C; Fortran was necessary in some form. Straight Fortran is terrible, but RATional FORtran (Ratfor) removes many of the deficiencies and makes Fortran look something like C. Thus, part of the code was written in Ratfor, with a preliminary pass through the macro preprocessor m4 for good measure. Of course, I wanted to document that code as well. Now although CWEB was never intended for Ratfor, because of Ratfor's C-like syntax CWEB was able in many cases to format Ratfor code satisfactorily. Of course, sometimes the documentation fell apart completely because keywords like DIMENSION aren't known to C, and certain syntax is different. Thus, after living with usable but somewhat marginal woven Ratfor output from CWEAVE for a while, I decided to do things right and teach CWEAVE the appropriate rules for Fortran. I though that would take a couple of weeks... The first project was to endow FWEB with the concept of a current language. Since I routinely mix C and Ratfor code and I wanted all the documentation to be all in one place, it was important to be able to switch between syntaxes as necessary. After some MONTHS (FWEB was developed in my spare time), I had taught the WEAVE processor to produce reasonable quality typeset Fortran and Ratfor, and to switch back and forth between the various languages. Little had been done to TANGLE at that point. However, I then decided that it was pointless to make separate passes through m4 and Ratfor; why not make TANGLE do it all. Levy had eliminated the macro preprocessor from CTANGLE since C has its own. I reinstated one, patterned after ANSI C. I also added a statement translator, so Ratfor keywords could be expanded. Thus, the present version of FWEB has these significant enhancements over CWEB: (1) The concept of a current language (Fortran, Ratfor, and/or C); (2) A C-like macro preprocessor; (3) Ratfor to Fortran-77 translation. My students and I use FWEB every day; we find it to be a tool of great utility. For writing in Fortran, the macro processor is indispensible. As far as Ratfor is concerned, I find it to be a great step forward; I hope never again to have to write a straight Fortran program. The goal for FWEB v. 1.0 was to achieve functionality. It would be pointless to defend the elegance of all of the internal code at this point: some should be optimized for speed; some should be rewritten. Eventually, these projects will be undertaken. (Note that since I'm a major user I have a powerful motivation.) But now it's most important to get some Fortran users involved so I get some feedback and bug reports. The relevant files are available via anonymous FTP from Internet host CCC.NMFECC.GOV in directory (VMS syntax) TEX$ROOT:[DISTR.FWEB]. The files are described in READ.ME. As this explains, for VAX/VMS users only a subset of all files is necessary, since the executable binaries FTANGLE.EXE and FWEAVE.EXE are provided. If you have the courage to try to bring things up on another machine, you should also read INSTALL.FWEB, and transfer all files except *.EXE, *.HLB, and *.HLP to your machine. If you are bootstrapping onto another machine, please note that you may have to make a few operating system-dependent changes in the source code. Feel free to contact me for help. I will appreciate bug reports, suggestions, etc. My addresses are MFEnet: krommes@ppc.mfenet Internet: Krommes%ppc.mfenet@ccc.nmfecc.gov Bitnet: krommes%ppc.mfenet@lbl.bitnet John Krommes ------------------------------------------------------------------------ 1.3 Spiderweb ------------------------------------------------------------------------ % Copyright 1989 by Norman Ramsey, Odyssey Research Associates % To be used for research purposes only % For more information, see file COPYRIGHT in the parent directory \documentstyle[11pt]{article} \title{A note about a new implementation of {\tt WEB}} \author{Norman Ramsey\\Odyssey Research Associates} \date{July 4, 1988} \setcounter{secnumdepth}{0} \begin{document} \maketitle \begin{abstract} Literate programming has received recent attention in the {\sl Communications of the ACM}~\cite{bentley:lp,cvw:loom}. {\tt WEB} is a tool intended for literate programming, but until recently it was useful only for writing PASCAL programs. The author has developed a new tool, {\tt SPIDER}, which reads a description of a programming language and writes a {\tt WEB} system that can be used to write programs in that language. {\tt SPIDER} has been used in the author's organization to build {\tt WEB} systems for Ada, C, AWK, and other languages. The author hopes that {\tt SPIDER} will enable people to write literate programs in many more languages than they could before. \end{abstract} \section{Introduction} Donald Knuth developed the {\tt WEB} system of structured documentation as part of the {\TeX} project~\cite{knuth:literate-programming}. His implementation of {\tt WEB} combined PASCAL and {\TeX}. The {\tt WEB} idea suggests a way of combining {\em any} programming language with {\em any} document formatting language, but until recently there was no software support for writing in {\tt WEB} anything but PASCAL programs. In~1987, Silvio Levy rewrote the {\tt WEB} system in C for C, while retaining {\TeX} as the formatting language~\cite{levy:cweb}. I have has modified Levy's implementation by removing the parts that make C the target programming language, and I have added a third tool, {\tt SPIDER}, which complements {\tt WEAVE} and {\tt TANGLE}. {\tt SPIDER} reads a description of a programming language, and writes source code for a {\tt WEAVE} and {\tt TANGLE} which support that language. Using {\tt SPIDER}, a C~compiler, and an AWK~interpreter, an experienced systems programmer can generate in a few hours a {\tt WEB} system for an Algol-like language. \section{Features of Spidery {\tt WEB}} An exhaustive list of Spidery {\tt WEB}'s features would interest only {\tt WEB} experts, but I do want to mention some features that I hope will encourage people to use Spidery {\tt WEB}. \begin{itemize} \item {\tt TANGLE} and {\tt WEAVE} can read from multiple files (this feature is present in Levy's {\tt CWEB}), and {\tt TANGLE} can write to multiple files. Included files will be searched for on a path if not found in the current directory. These features make Spidery {\tt WEB} more usable on systems that have {\tt make}. \item {\tt TANGLE} can expand macros with multiple parameters. \item The starred sections in Spidery {\tt WEB} can be organized hierarchically (in three levels). We have a UNIX tool that can extract different pieces of the hierarchy from the output of {\tt WEAVE}, so that it is possible to take excerpts from {\tt WEB} documents. \item {\tt TANGLE} writes {\tt \#line} directives, so you can debug at the {\tt WEB} source level if your compiler respects the C~conventions for {\tt\#line}. \item Many features of {\tt WEB} seem to exist only to compensate for deficiencies in PASCAL, and most of those were dropped in {\tt CWEB}. I have changed much of {\tt CWEB} in order to avoid being bound too much by C conventions. As a result, there are dozens of minor differences between Spidery {\tt WEB} and original {\tt WEB}. To give just one example, Spidery {\tt WEB} supports octal and hexadecimal constants using {\tt WEB}-style notation, not the C~notation used in {\tt CWEB}. \end{itemize} \section{Scope of {\tt SPIDER}} {\tt SPIDER} can generate {\tt WEB} systems for a variety of languages. The author has written {\tt SPIDER} description files for C, AWK, Ada, SSL (a language that describes attribute grammars to the Cornell Synthesizer Generator), the Larch Shared Language (a language for describing equational theories), and Dijkstra's language of guarded commands. Debugging the grammar that {\tt WEAVE} uses to prettyprint the language is the most time-consuming part of creating a {\tt WEB} system for a new target language, and {\tt SPIDER} makes it trivial to change that grammar. To make a {\tt SPIDER} description file for an Algol-like language that uses infix expression notation, an experienced systems programmer should be able to adapt an existing {\tt SPIDER} description file very quickly. {\tt SPIDER}'s major limitations are lexical. All Spidery {\tt WEB}s assume that spaces and tabs in the input are not significant, except as separators; this makes it impossible to construct Spidery {\tt WEB}s for languages like Fortran and Miranda, where the position of text on a line is significant. The lexical structures of identifiers, string literals, and numeric literals are fixed. \section{Conclusions} {\tt SPIDER} is a modest piece of engineering; it does not introduce new ideas. {\tt SPIDER} does make it possible to create a new {\tt WEB} quickly, and to tinker with it easily. The author's group routinely uses Spidery {\tt WEB} to write programs in Ada, C, and~SSL, and has been pleased with the result. We have written in {\tt WEB} an application of eighteen thousand lines, and we are very pleased at how easy it has been to review and maintain this code. The author hopes that the availability of Spidery {\tt WEB} will encourage other groups to try literate programming, and that they, too, will be pleased with the results. \begin{thebibliography}{Van~Wyk~9999} \bibitem[Bentley~86]{bentley:lp} Jon L. Bentley, ``Programming Pearls,'' {\sl Communications of the ACM} {\bf 29:5} (May~1986), 364--368, and {\bf 29:6} (June~1986), 471--483. \bibitem[Knuth~84]{knuth:literate-programming} Donald E. Knuth, ``Literate Programming,'' {\sl The Computer Journal} {\bf 27:2} (1984), 97--111. \bibitem[Levy~87]{levy:cweb} Silvio Levy, ``{\tt WEB} Adapted to C, Another Approach,'' {\sl TUGBoat} {\bf 8:1} (1987), 12--13. \bibitem[Van~Wyk~87]{cvw:loom} Christopher J. Van~Wyk, ``Literate Programming,'' {\sl Communications of the ACM} {\bf 30:7} (July~1987), 593--599, and {\bf 30:12} (December~1987), 1000--1010. \end{thebibliography} ------------------------------------------------------------------------ 2. Tgrind ------------------------------------------------------------------------ From: Ken Yap <ken@rochester.arpa> Several people have asked about including program source in TeX documents. I believe the most general approach is to use a utility like tgrind (TeX analog of vgrind). One specifies the language to be processed (so that tgrind can detect keywords). Tgrind converts tabs into the appropriate spacing (generates things like \tab{24} for 3 tabs), boldens keywords, prints quoted strings in typewriter font, prints comments in italics, and other nice things. All these goodies are customizable. This requires an extra pass, but the preprocessing is quite fast. Tgrind is on the Unix TeX tape, in the directory TeXcontrib/van. It was written by Van Jacobson of LBL. Unfortunately it is Unix specific, but I think equivalents for other OS are no problem. Heck, just take your favourite pretty-printer and generate TeX instead of prettified output. Ken tgrind - grind nice program listings using TeX or LaTeX Tgrind formats program sources in a nice style using TeX. Comments are placed in italics, keywords in bold face and strings in typewriter font. Source file line numbers appear in the right margin (every 10 lines). The start of a function is indicated by the function name in large type in the right margin. In regular mode tgrind processes its input file(s) and passes them to TeX for formating and output. In format mode (i.e., when the flag is used), tgrind processes its input file(s) and writes the result to standard output. This output can be saved for later editting, inclusion in a larger document, etc. Currently known are PASCAL, RATFOR, Modula-2, MODEL, C, ISP, Yacc, Prolog, Icon, TeX, CSH, and Bourne Shell . Van Jacobson, Lawrence Berkeley Laboratory (based on "vgrind" by Dave Presotto & William Joy of UC Berkeley). ------------------------------------------------------------------------ 3. C2latex ------------------------------------------------------------------------ From: ramsdell@celebes.mitre.org (John D. Ramsdell) Subject: c2latex--Simple Support for Literate Programming in C C2latex provides simple support for literate programming in C. Given a C source file in which the comments have been written in LaTeX, c2latex converts the C source file into a LaTeX source file. It can be used to produce typeset listings of C programs and/or documentation associated with the program. The C source given to c2latex usually has the following form. It starts with a large comment containing LaTeX commands that start a document along with any initial text. Then there is a sequence of comment and code pairs, with the comment explaining the code to follow. The source file is ended by a comment containing LaTeX commands that finish the document. C2latex produces LaTeX source by implementing a small number of rules. A C comment that starts at the beginning of a line is copied unmodified into the LaTeX source file. Otherwise, non-blank lines are surrounded by a pair of formatting commands (\begin{flushleft} and \end{flushleft}), and the lines are separated by \\*. Each non-blank line is formatted using LaTeX's \verb command, except comments within the line are formatted in an \mbox. The c2latex program is written in ANSI C and can be processed by c2latex to produce LaTeX source containing a typeset listing of itself. It has a copyright similar to those distributed with GNU software. c2latex is available from me as a shar file via electronic mail. If there is enough interest, I will request that the sources be placed on a public server. John ------------------------------------------------------------------------ 4. C++2latex ------------------------------------------------------------------------ The program c++2latex converts ANSI-C/C++ programs into LaTeX source. It requires flex which can be found on various ftp sites, e.g. prep.ai.mit.edu. For those without flex and without the possibility to get one, I can email the flex'ed program. Please notice that this program is under GNU Copyleft. DESCRIPTION c++2latex is a tool for generating LateX source from ANSI-C or C++ programs. It recogizes all keywords, strings, and comments. These recognized parts can be set in different fonts. c++2latex can generate complete LaTeX files which can directly passed through latex or parts of LaTeX files which can be included in other files (either direct or by the \input or \include commands). The output filename is searched in various steps. First, if the {-o,+output} flag is given, the output is written to the file pointed to by the value of this flag. If the {-t,+pipe} option is given, the output is written to stdout. (It is an error to specify both options together.) If none of this options but an input pathname is given, the output is written to a file who's name is the last component of the input pathname with the substituted or else added suffix '.tex'. If the input is read from stdin and none of the above options is given, the output is written to '<program-name>.tex' with <program- name> being the name of this program. ------------------------------------------------------------------------ 5. Cprog macros ------------------------------------------------------------------------ % The cprog macros allow programs in C, C++, Pascal, and Modula-2 to be % included directly into TeX documents. Program text is set in a Roman % font, comments in slanted, and strings in typewriter. Operators such as % <= are optionally combined into single symbols like $\le$. Keywords are % *not* emphasised---I find this ugly and distracting. (By purest % coincidence it would also be very hard to do.) % % These macros can be \input in plain TeX or used as a style file in LaTeX. % They provide a convenient alternative to tgrind, particularly for program % fragments embedded in documents. Full instructions for use appear in the % macro package itself. % % % \'Eamonn McManus <emcmanus@cs.tcd.ie> <emcmanus%cs.tcd.ie@cunyvm.cuny.edu> % % This allows C programs to be formatted directly by TeX. It can be % invoked by \cprogfile{filename} or (in LaTeX) \begin{cprog} ... % \end{cprog} or (in plain TeX) \cprog ... \end{cprog}. In LaTeX, the % alternative form \begin{cprog*} is allowed, where spaces in C strings % are printed using the `square u' character (like LaTeX {verbatim*}). % In plain TeX, you have to use \csname cprog*\endcsname for this (sorry). % If you are using \cprogfile, say \cprogttspacetrue beforehand if you % want this effect. % The formatting is (necessarily) simple. C text is set in a normal Roman % font, comments in a slanted font, and strings in a typewriter font, with % spaces optionally made visible as the `square u' symbol. Tabs are % expanded to four spaces (this does not look good when comments are % aligned to the right of program text). Some pairs of input characters % appear as single output characters: << <= >> >= != -> are respectively % TeX's \ll \le \gg \ge \ne \rightarrow. Say \cprogpairsfalse to disable % this. % You can escape to TeX within cprog text by defining an escape character. % The character @ is suitable for C and Pascal. I have not tested other % characters so they may interact badly with their existing definitions here. % To define @ as the escape character, do \cprogescape@. Then within text % you can do @ followed by TeX commands. These commands will be in a TeX % group with the \catcodes of \{}% as normal. The commands are terminated % by a newline, which is not considered part of the program text. % The fonts below can be changed to alter the setting of the various parts % of the program. The \cprogbaselineskip parameter can be altered to % change the line spacing. LaTeX's \baselinestretch is taken into account % too. The indentation applied to the whole program is \cprogindent, % initially 0. Before and after the program there are skips of % \beforecprogskip and \aftercprogskip; the default values are \parskip % and 0 respectively (since there will often be a \parskip after the % program anyway). % If the source text is Pascal or Modula-2, say \pascaltrue or \modulatrue % (respectively) before formatting it. This makes (* *) be recognised for % comments instead of /* */. Braces {} are also recognised for Pascal. % \pascalfalse or \modulafalse as appropriate restores the default of C. % This package works by making a large number of characters active. Since % even spaces are active, it is possible to examine the next character in % a macro by making it a parameter, rather than using \futurelet as one % would normally do. This is more convenient, but the coding does mean % that if the next character itself wants to examine a character it may % look at a token from the macro rather than the input text. I think that % all cases that occur in practice have been looked after. % The macros could still do with some work. For example, the big macro % defined with [] taking the place of {} could be recoded to use {} and so % be more legible. The internal macros etc should have @ in their names, % and should be checked against LaTeX macros for clashes. ------------------------------------------------------------------------ 6. Program environment ------------------------------------------------------------------------ \documentstyle[program2]{article} \oddsidemargin 10mm \evensidemargin 10mm \marginparwidth 20mm \marginparsep 7pt \topmargin 0mm \headheight 12pt \headsep 1cm \footheight 12pt \footskip 30pt \textheight 220mm \textwidth 147mm \columnsep 10pt \columnseprule 0pt \def\lijn{\rule{\textwidth}{1pt}} \begin{document} \title{How to layout a (Pascal-)program in \LaTeX} \author{Rein Smedinga \\ {\small department of computing science, p.o.box 800, 9700 AV Groningen }\\ {\small tel. 050--633937 (633939), email: \verb!rein @cs.rug.nl!}} \maketitle \def\framed#1{\framebox[\textwidth][l]{\vbox{#1}}} \def\bep{\begin{program}\skipprog}% begin programtext \def\eep{\end{program}\noindent}% end programtext In \TeX\ or \LaTeX\ is it possible, but difficult, to create a nice layout for programs. The easiest way is to use the \verb!verbatim! environment. The layout is then copied from the input file. In most books a program (e.g., a PASCAL-program) is displayed using boldface reserved words, using math-italic for statements and using teletype fonts for string representations. Without extra equipment this can be done in \TeX\ as well as in \LaTeX\ using a \verb!tabbing!-environment. Of course, each font choice should be made explicitly, e.g., you must say \verb!{\bf begin}! to create a boldface begin-symbol and \verb!$x:=x+1$! to denote an assignment. Furthermore, the user is responsible for setting the tabs and jumping to the right ones. This is far from being user-friendly. The \verb!program!-environment tries to be of some help while displaying program-texts. It contains a number of macros of the form \verb!\BEGIN!, \verb!\PROCEDURE! and alike that not only put down a boldface begin- or procedure-symbol but also sets and jumps to the right tabs. Using the \verb!program! environment from the \verb!program2!-style file also automatically puts the statements in math-mode (you do not have to use \verb!$!-signs anymore). ------------------------------------------------------------------------ A similar style: program.sty: a LaTeX style file for typesetting algorithms. Copyright (C) 1991 Martin Ward This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This is the "program" style option which sets up the program and programbox environments, keywords for programs and a few goodies. NOTE: Within the program environment: (1) Newlines are significant. (2) Each line is in math mode, so for example spaces in the input file are not significant. (3) \\ within a line causes a linebreak in the output. We also define a "programbox" environment which typesets a program in a box. Useful for keeping a piece of code on one page or for typesetting small programs in running text. We also redefine \( and \) as \begin{programbox} and \end{programbox}. The \tab and \untab commands are defined to have no effect while outside a program environment, hence a single-line program can be typeset in maths mode without the overhead associated with programbox. ------------------------------------------------------------------------ 7. Scheme ------------------------------------------------------------------------ From: John D. Ramsdell <ramsdell%linus@mitre-bedford.ARPA> Subject: SchemeTeX---Simple support for literate programming in Lisp. SchemeTeX provides simple support for literate programming in any dialect of Lisp on Unix. Originally created for use with Scheme, it defines a new source file format which may be used to produce LaTeX code or Lisp code. Roughly speaking, LaTeX formats Lisp code in a verbatum-like environment, and it formats Lisp comments in an ordinary environment. SchemeTeX is available via anonymous FTP from linus (192.12.120.51) in the shar file named "pub/schemeTeX.sh". Included is an operating system independent version for the T dialect of Lisp. John ------ From: dorai@tone.rice.edu (Dorai Sitaram) Subject: typesetting Scheme code I wrote something called SLaTeX that allows listings of Scheme code in LaTeX without restricting it to the usual monospace typewriter font supported by other code typesetters. I've placed the current version in the titan.rice.edu's anonymous ftp area: get public/slatex.sh. SLaTeX decides which tokens should be, say, boldfaced, italicized, or sansserifed, pretty much along the style of the Little Lisper [1]. (The user can completely control this default decision process, so much so that he can flip the fonts around, add new fonts, or even do something silly like make everything come out in typewriter -- i.e., turn the program into a no-op.) I'd been leery of distributing SLaTeX before because of the frequent updating that it's undergone following the Rice Scheme-and-similar- language users' lively demands for bells and whistles, e.g., o allowing arbitrarily positionable displays, boxed code, in-text code, and directly inputing actual Scheme files; o getting little pockets of LaTeX text or mathmode into the Scheme code, for readable Schemelike pseudocode (useful for expository papers and class handouts); o making it learn automatically that a macro definition implies that keyword should henceforth be boldfaced, etc. At any time, the ftp site will contain the most recent code. The shar file contains the Scheme source (Ch*z, but should carry over to other Schemes with minor changes), a shellscript that piggybacks the codesetter on to LaTeX, the requisite LaTeX style file, installation instructions, a manual in LaTeX, a man page, and a copyleft. The first 2 sections in the manual suffice for most uses, with fine tuning being described later. (The code, as of now, contains more fine tuning than documented -- I'll update the docs when I next get time.) This is free(ly distributable) software, and hence no warranty, though I'll be glad to field bug and other reports. [1] D.P. Friedman and M. Felleisen, _The Little Lisper_, Science Research Associates (3e), 1989, and The MIT Press, 1987. ------------------------------------------------------------------------ 8. Ada. ------------------------------------------------------------------------ Zie TUGboat 10#1, April 1989 Sriram Sankar APE -- A set of TeX macros to format Ada programs I have developed a set of macros to do exactly this for Ada programs. To get more details on these macros, read the report in the April issue of TUGBoat, or the Nov/Dec issue of Ada Letters (both in 1989). The macros are available by anonymous ftp to anna.stanford.edu in the pub directory (I think). I can send them to you if you are willing to cover the costs. Sriram. Zie ook: GUTenberg'90 May 15-18, 1990 University Paul Sabatier, Toulouse, FRANCE Typesetting ADA programs (P. Naudin, C. Quitte) ------------------------------------------------------------------------ 9. Sundry. ------------------------------------------------------------------------ From: rosenber@ra.abo.fi (Robin Rosenberg INF) Subject: Re: Typesetting programming languages in LaTeX About two years ago I wrote a program that converts programs to TeX. The program sets keywords in boldface (or any font you select) using a data file to find out which strings are keywords and how to skip comments. I have data files for Modula-2, C, C++, Pascal, Occam, Beta, and some more. The program is written in C (under VMS) and could well be improved. However it does what I want it to do, it makes programs _look_ nice in listing. As said it translates to TeX and not LaTex but that is no big deal to change I'd guess. If you need this program send a mail to rosenber@ra.abo.fi. mail Robin Rosenberg ------------------------------------------------------------------------ I have an SED script and Pascal environment for LaTeX that follows the standard Algol 60 style for setting Pascal text. The SED script translates everything between \begin{pascal} and \end{pascal} in various ways that the pascal environment understands. The only problem with the thing is that indenting must be in multiples of 4 spaces, but I've used it for a number of publications without hearing any complaints about my awkward indenting style. In any case, I strongly recommend the notion of environments for language types, as opposed to the various grind programs. It would be nice to have a standard set of environment parameters to control things like keyword font so language environments from different sources could be at least somewhat interchangable. Doug Jones jones@herky.cs.uiowa.edu ------------------------------------------------------------------------ % manpage.sty % Rong Chen (rchen@cs.uiuc.edu) % Department of Computer Science % University of Illinois at Urbana-Champaign % Urbana, IL 61801 % Copyright (c) 1990 by Rong Chen % Permission to copy all or part of this work is granted, provided % that the copies are not made or distributed for resale, and that % the copyright notice and this notice are retained. % % THIS WORK IS PROVIDED ON AN "AS IS" BASIS. THE AUTHOR PROVIDES NO % WARRANTY WHATSOEVER, EITHER EXPRESS OR IMPLIED, REGARDING THE WORK, % INCLUDING WARRANTIES WITH RESPECT TO ITS MERCHANTABILITY OR FITNESS % FOR ANY PARTICULAR PURPOSE. % This style option is designed to work with the report document style % of LaTeX version 2.09. Use \documentstyle[11pt,manpage]{report} % % This LaTeX style file is similer to the UNIX troff man macros in format and % is specially tuned for documenting the C++ library that the author wrote. % % The commands that are created in the style file are: % % \begin{manpage}{Title}{Module}{Version} % see an example, all will be clear % \end{manpage} % end of manpage environment % \variable{#1} (e.g., \variable{int foo}) % with \medskip added % \variable*{#1} (e.g., \variable*{int bar})% no extra spacing % \function{#1} (e.g., \function{void demo(int dummy)}) % with \medskip added % \function*{#1} (e.g., \function*{void demo(int dummy)})% no extra spacing % \subtitle{#1} (e.g., \subtitle{AUTHOR}) % fit in the same line if possible % \subtitle*{#1} (e.g., \subtitle*{AUTHOR})% always break a newline % "#1" (e.g., "dummy_variable") % argument is in italic&unbreakable % \separator % draw a thin line to seperate suntitle from the text % \header{#1}{#2}{#3} % in case you want to have a header and % \footer{#1}{#2}{#3} % a footer outside of the manpage environment % \dq % print double quote character (") % % In the \function macro, data types and their dummy arguments are separated % by a space. So if you have a function like "int f(const int n)", you should % document it as \function{int f(const~int n)}. The argument n is optional. % In the \subtitle macro, two lines of text may be devided by "\\". -- Piet* van Oostrum, Dept of Computer Science, Utrecht University, Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands. Telephone: +31 30 531806 Uucp: uunet!mcsun!ruuinf!piet Telefax: +31 30 513791 Internet: piet@cs.ruu.nl (*`Pete')