home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!news.service.uci.edu!unogate!mvb.saic.com!info-tex
- From: "George D. Greenwade" <bed_gdg@SHSU.edu>
- Newsgroups: comp.text.tex
- Subject: RE: TeX in batch mode
- Message-ID: <009640BE.414986E0.14469@SHSU.edu>
- Date: Mon, 23 Nov 1992 13:47:16 CST
- Organization: Info-Tex<==>Comp.Text.Tex Gateway
- X-Gateway-Source-Info: Mailing List
- Lines: 118
-
- In <By036B.E6H@news.cso.uiuc.edu> (comp.text.tex, Fri, 20 Nov 1992 05:56:34
- GMT), cameron@symcom.math.uiuc.edu (Cameron Smith) asked:
- > Another request for help.
- >
- > One of the goals of a project I'm helping out with is to allow a computer
- > program to generate nicely formatted reports in response to remote
- > requests. For this we are planning to have the program generate TeX code
- > as its output, then spawn a subprocess to run TeX to do the formatting,
- > then convert the resultant DVI file to an appropriate other form and send
- > that to the remote user for printing. This means that we need to run TeX
- > in batch mode, under the supervision of another program, which needs at a
- > minimum to be able to detect whether a TeX run completed successfully so
- > that it will know whether it can go on to the next step and try to deliver
- > a document to the user. This itself is apparently a non-trivial
- > proposition, since even a warning telling me that a page is 2pt overfull
- > causes TeX to deliver an "error" return code, even though an "error" like
- > that is acceptable for our purposes. I envision (with distaste) building a
- > parser that reads through a log file after a TeX run to decide whether
- > errors so serious that they preclude printing have occurred.
- >
- > This is very different from the way I've used TeX in the past, and because
- > my experience with this mode is so limited my question is quite general (I
- > don't know enough yet to ask anything specific!). I would simply like to
- > hear any pointers, tips, suggestions, warnings, and the like from anybody
- > who has tried this kind of thing. I'd like to hear from you regardless of
- > whether you did or did not succeed in getting the results you wanted
- > (perhaps *especially* if you didn't, since if this is impractical to the
- > point of unfeasibility I'd prefer to find out now rather than after I've
- > spent six months on it).
- >
- > Email would be OK, but I'd rather read postings since that way everyone can
- > join in and either learn from or teach one another. Thanks in advance for
- > any info.
-
- Given some of the terminology here ("spawn a subprocess", in particular), I
- assume that this for VMS. There are two dimensions here. First,
- processing the file as a spawned subprocess. When writing the file, do NOT
- include the \batchmode statement so *you* can play with the file, if
- necessary, without further editing (which helps with version limits to see
- just what did happen).
-
- Simply spawn the process out, such as I have done in a brief (but handy)
- VMS command file I have named BATEX.COM (and define BATEX as a foreign
- symbol BATEX :== @device:[directory]BATEX.COM, then you can use BATEX
- filename to LaTeX the file in the subprocess; obviously for TeX, change the
- "LATEX" strings to "TEX" and name the new file BTEX.COM or whatever). This
- file follows my signature (and I have used it for years under three
- versions of TeX and more than a few versions of LaTeX, so if there are bugs
- I am blissfully unaware of them). This dimension is easy and obvious (but
- I thought all weekend about posting this DCL command file, so now I have a
- good reason 8-)).
-
- The second dimension --- catching errors --- is not quite as
- straightforward (although it is probably much more system independent).
- After looking at this problem in designing my menu-based TeX publishing
- system similar to All-in-1 (yet to be posted; if anyone is interested I
- might can make it available, but it's pretty site dependent), I noticed one
- very nice fact. Just about the only time you see the characters "l." in
- columns 1 and 2 of the listing file, they are related to a failure (telling
- you the line number). If you use the listing file from your job and search
- for occurrences of "l." in columns 1 and 2 and don't find them, there
- probably aren't any problems. Indeed, from my PUBLISH.COM ('pub_document'
- is assigned to the DCL symbol associated with the filename sans extension):
- $!.....
- $ LATEX 'pub_document'
- $ set mess/nofac/nosev/notex/noid
- $ search 'pub_document'.lis "l." /out=sys$login:runtime.err
- $ if $status .ne. 1
- $ then delete/noconfirm/nolog sys$login:runtime.err.
- $ set mess/fac/sev/tex/id
- $ return
- $ endif
- $ set mess/nofac/nosev/notex/noid
- $ open/read start_file sys$login:runtime.err
- $ read start_file start_line
- $!.....
- $ close start_file
- $!.....
- and make some evaluations on the start_line symbol to isolate the exact
- line with the problem.
-
- While this doesn't give the exact way to achieve what you might be wanting
- to do, these are a few of the tricks under VMS I have learned to live with.
-
- Regards and good luck, George
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- George D. Greenwade, Ph.D. Bitnet: BED_GDG@SHSU
- Department of Economics and Business Analysis THEnet: SHSU::BED_GDG
- College of Business Administration Voice: (409) 294-1266
- P. O. Box 2118 FAX: (409) 294-3612
- Sam Houston State University Internet: bed_gdg@SHSU.edu
- Huntsville, TX 77341 bed_gdg%SHSU.decnet@relay.the.net
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- $!! Program Name : BATEX.COM
- $!! Original Author : BED_GDG
- $!! Date : 23-NOV-1988
- $!! Program Description : Spawn out a subprocess to run LaTeX
- $!! :
- $START:
- $ SUB_NAME = "BATEX_''F$EXTRACT(21,2,F$TIME())'"
- $ WO := WRITE SYS$OUTPUT
- $ WO " "
- $ WO "BaTeX -- LaTeX processing in an interactive batch environment."
- $ WO " This program creates an attached sub-process to process LaTeX files."
- $ WO " The attached sub-process environment is transparent to the user,"
- $ WO " allowing full use of the terminal while LaTeX processing occurs."
- $ WO " "
- $ WO " When processing is complete, you will be notified with the message:"
- $ WO " Subprocess ''SUB_NAME' has completed."
- $ID_FILE:
- $ WO " "
- $ IF P1 .EQS. "" THEN READ SYS$COMMAND/PROMPT= -
- "What is the name of the file for LaTeX processing? " TEXNAME
- $ IF P1 .NES. "" THEN TEXNAME := 'P1'
- $ IF TEXNAME .EQS. "" THEN GOTO ID_FILE
- $ SPAWN/NOWAIT/NOLOG/NOTIFY/INPUT=NL:/PROCESS="''SUB_NAME'" -
- /OUTPUT='sub_name'_JUNK.OUT LATEX 'TEXNAME'
- $ EXIT
-