1: # The LearningOnline Network with CAPA
2: # Perl script to render texxml files to a dvi
3: #
4: # Copyright Michigan State University Board of Trustees
5: #
6: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
7: #
8: # LON-CAPA is free software; you can redistribute it and/or modify
9: # it under the terms of the GNU General Public License as published by
10: # the Free Software Foundation; either version 2 of the License, or
11: # (at your option) any later version.
12: #
13: # LON-CAPA is distributed in the hope that it will be useful,
14: # but WITHOUT ANY WARRANTY; without even the implied warranty of
15: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: # GNU General Public License for more details.
17: #
18: # You should have received a copy of the GNU General Public License
19: # along with LON-CAPA; if not, write to the Free Software
20: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21: #
22: # /home/httpd/html/adm/gpl.txt
23: #
24: # http://www.lon-capa.org/
25: #
26: # 7-16-2002 Jeremy Bowers
27:
28: use strict;
29: use Fcntl;
30: use POSIX qw(tmpnam);
31:
32: if ( scalar(@ARGV) < 2 and 0 )
33: {
34: print (<<USAGE);
35: Usage: $0 texxml_file_name or
36: perl $0 -- texxml_file_name
37: where "texxml_file_name" does not include the .texxml suffix
38: Output: texxml_file_name.dvi
39:
40: $0 renders texxml files into dvi files by copying the tex file
41: resulting from from texxml2latex.pl and the referenced eps files
42: into a temporary directory and running LaTeX on the .tex file.
43:
44: Must be run as somebody with permissions to write temp files and
45: access /home/httpd/html/adm/help/eps.
46: USAGE
47:
48: exit();
49: }
50:
51: my $tmpdir = tmpnam();
52: my $fileroot = $ARGV[1];
53: print $fileroot . "\n";
54:
55: mkdir $tmpdir;
56:
57: print "Converting texxml to tex...\n";
58: system ( "perl texxml2latex.pl $fileroot.texxml > $tmpdir/$fileroot.tex" );
59:
60: print "Copying .eps files...\n";
61: system ( "cp /home/httpd/html/adm/help/eps/* $tmpdir/" );
62:
63: print "Running Latex...\n";
64: system ( "cd $tmpdir; latex $fileroot >& /dev/null; latex $fileroot >& /dev/null; latex $fileroot >& /dev/null; " );
65:
66: print "dvips...\n";
67: system ( "cd $tmpdir; dvips -f $fileroot.dvi > $fileroot.ps " );
68:
69: print "Copying dvi file...\n";
70: system ( "cp $tmpdir/$fileroot.ps .");
71:
72: print "Clearing temp directory...\n";
73: system ( "rm -rf $tmpdir" );
74:
75: print "$fileroot.ps is ready, if all went well.\n";
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>