Show More
This diff has been collapsed as it changes many lines, (1049 lines changed) Show them Hide them | |||
@@ -0,0 +1,1049 b'' | |||
|
1 | #!/usr/bin/env perl | |
|
2 | # | |
|
3 | #***************************************************************************** | |
|
4 | # | |
|
5 | # lyxport - script for exporting lyx docs to HTML, PostScript and PDF | |
|
6 | # | |
|
7 | # Inspired on the lyx2html script by Steffen Evers (tron@cs.tu-berlin.de) | |
|
8 | # (many thanks to him). | |
|
9 | # | |
|
10 | # Copyright (C) 2001 Fernando Pérez (Fernando.Perez@colorado.edu) | |
|
11 | # | |
|
12 | #***************************************************************************** | |
|
13 | # | |
|
14 | # This program is free software; you can redistribute it and/or modify | |
|
15 | # it under the terms of the GNU General Public License as published by | |
|
16 | # the Free Software Foundation; either version 2 of the License, or | |
|
17 | # (at your option) any later version. | |
|
18 | # | |
|
19 | # This program is distributed in the hope that it will be useful, | |
|
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
22 | # GNU General Public License for more details. | |
|
23 | # | |
|
24 | # If you do not have a copy of the GNU General Public License, write | |
|
25 | # to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, | |
|
26 | # MA 02139, USA. | |
|
27 | # | |
|
28 | # If the author of this software was too lazy to include the full GPL | |
|
29 | # text along with the code, you can find it at: | |
|
30 | # | |
|
31 | # http://www.gnu.org/copyleft/gpl.html | |
|
32 | # | |
|
33 | #***************************************************************************** | |
|
34 | ||
|
35 | =pod | |
|
36 | ||
|
37 | =head1 NAME | |
|
38 | ||
|
39 | B<lyxport> - Export a LyX or LaTeX file to HTML, PostScript and PDF. | |
|
40 | ||
|
41 | =head1 SYNOPSIS | |
|
42 | ||
|
43 | B<lyxport> [options] F<file> | |
|
44 | ||
|
45 | Perl script which takes a LyX or LaTeX file as its only argument and produces | |
|
46 | HTML, PostScript and PDF versions of the document. The name is short for "lyx | |
|
47 | export". | |
|
48 | ||
|
49 | You can call B<lyxport> with a filename with or without extension: F<file>, | |
|
50 | F<file.lyx> and F<file.tex> will all work. B<lyxport> will update the LaTeX | |
|
51 | file if there is a corresponding LyX file with a newer timestamp. | |
|
52 | ||
|
53 | Use B<lyxport --help> for more information, and B<lyxport --man> for a full | |
|
54 | man page. | |
|
55 | ||
|
56 | =cut | |
|
57 | ||
|
58 | #***************************************************************************** | |
|
59 | # modify here the command names to suit your local conditions | |
|
60 | my %cmd= ( | |
|
61 | lyx => "/usr/bin/lyx", | |
|
62 | latex => "latex", | |
|
63 | latex2html => "latex2html", | |
|
64 | dvips => "dvips", | |
|
65 | pdflatex => "pdflatex", | |
|
66 | epstopdf => "epstopdf" | |
|
67 | ); | |
|
68 | ||
|
69 | #************ DO NOT CHANGE ANYTHING BELOW THIS ULESS YOU *REALLY* KNOW | |
|
70 | #************ WHAT YOU ARE DOING. | |
|
71 | ||
|
72 | #***************************************************************************** | |
|
73 | # modules and globals | |
|
74 | use strict; | |
|
75 | use File::Copy; | |
|
76 | use File::Basename; | |
|
77 | my (%opt); # command line options | |
|
78 | my $version = "0.3.2"; # keep this up to date with the docs (at end)! | |
|
79 | ||
|
80 | #***************************************************************************** | |
|
81 | # "main" (simple minded way to keep variable scoping under control) | |
|
82 | main(); | |
|
83 | ||
|
84 | sub main { | |
|
85 | my ($runs, # number of latex runs | |
|
86 | $file_in, # input filename as given at cmd line | |
|
87 | $file_base, # base (no extension) name of file to work on | |
|
88 | $lyx_time, # timestamps of lyx/tex files | |
|
89 | $tex_time, | |
|
90 | $l2h_file, # tex file cleaned up for latex2html | |
|
91 | $targets_built, | |
|
92 | $targets_failed, | |
|
93 | $status, # status string for diagnostics printing | |
|
94 | @latex_from_lyx # LaTeX files was created from LyX file | |
|
95 | ); | |
|
96 | ||
|
97 | #------------------------------------------------------------------------ | |
|
98 | # code begins | |
|
99 | ||
|
100 | cmdline_process(\%opt,\$file_in); | |
|
101 | ||
|
102 | # set defaults and filenames needed throughout | |
|
103 | $runs=$opt{runs}; | |
|
104 | set_cmd_defaults(\%cmd); | |
|
105 | $file_base=check_file_exists($file_in); | |
|
106 | # various filenames (with extensions) | |
|
107 | my @exts=qw(lyx tex aux dvi log ps pdf out toc); | |
|
108 | my ($lyx,$tex,$aux,$dvi,$log,$ps,$pdf,$out,$toc) = map { "$file_base.$_" } @exts; | |
|
109 | ||
|
110 | # first, if tex file is older than lyx file, update | |
|
111 | @latex_from_lyx=update_tex($lyx,$tex); | |
|
112 | ||
|
113 | if ($opt{clean}) { | |
|
114 | lyxport_info("Cleanup of old auxiliary files requested"); | |
|
115 | safe_system("rm -rf $file_base"); | |
|
116 | unlink ($aux,$log,$out,$toc); | |
|
117 | } | |
|
118 | ||
|
119 | # run latex for both html (needs .aux file) and ps (needs .dvi) | |
|
120 | if ($opt{html} or $opt{ps}) { | |
|
121 | run_latex("$cmd{latex} -interaction=nonstopmode",$tex,\$runs); | |
|
122 | } | |
|
123 | # now make targets | |
|
124 | if ($opt{html}) { | |
|
125 | make_html($tex,$file_base,$opt{opts_l2h},\$status, | |
|
126 | \$targets_built,\$targets_failed); | |
|
127 | } | |
|
128 | if ($opt{ps}) { | |
|
129 | make_ps($dvi,$ps,$file_base,\$status,\$targets_built,\$targets_failed); | |
|
130 | } | |
|
131 | if ($opt{pdf}) { | |
|
132 | make_pdf($tex,$pdf,\$runs,$file_base, | |
|
133 | \$status,\$targets_built,\$targets_failed); | |
|
134 | } | |
|
135 | ||
|
136 | #cleanup before exiting and print some diagnostics info | |
|
137 | unless ($opt{debug}) { | |
|
138 | unlink ($dvi,$log,$out); | |
|
139 | } | |
|
140 | # extra cleanup | |
|
141 | if ($opt{tidy}) { | |
|
142 | print "tidy up $opt{tidy},$aux,$log,$out,$toc,@latex_from_lyx\n"; | |
|
143 | tidy_up($opt{tidy},$aux,$log,$out,$toc,@latex_from_lyx); | |
|
144 | } | |
|
145 | final_diagnostics($file_in,$status,$targets_built,$targets_failed); | |
|
146 | exit(0); | |
|
147 | } # end of main() | |
|
148 | ||
|
149 | #***************************************************************************** | |
|
150 | # subroutines | |
|
151 | ||
|
152 | #----------------------------------------------------------------------------- | |
|
153 | sub make_html { | |
|
154 | my($tex,$html_dir,$opts_l2h,$stat_ref,$built_ref,$failed_ref)=@_; | |
|
155 | my($success); | |
|
156 | ||
|
157 | lyxport_info("Making HTML"); | |
|
158 | run_latex2html($tex,$opts_l2h); | |
|
159 | $success=check_targets("${html_dir}/${html_dir}.html",'HTML', | |
|
160 | $built_ref,$failed_ref); | |
|
161 | if ($success) {$$stat_ref .= "Target HTML built in directory $html_dir\n" } | |
|
162 | } # end of make_html() | |
|
163 | ||
|
164 | #----------------------------------------------------------------------------- | |
|
165 | sub make_ps { | |
|
166 | my($dvi,$ps,$html_dir,$stat_ref,$built_ref,$failed_ref)=@_; | |
|
167 | my($success); | |
|
168 | ||
|
169 | lyxport_info("Making PostScript"); | |
|
170 | safe_system("$cmd{dvips} $dvi -o $ps"); | |
|
171 | $success=check_targets($ps,'PostScript',$built_ref,$failed_ref); | |
|
172 | if ($success and not $opt{leave}) { | |
|
173 | move2html_dir('PostScript',$ps,$html_dir,$stat_ref,$built_ref); | |
|
174 | } | |
|
175 | } # end of make_ps() | |
|
176 | ||
|
177 | #----------------------------------------------------------------------------- | |
|
178 | sub make_pdf { | |
|
179 | my($tex,$pdf,$runs_ref,$html_dir,$stat_ref,$built_ref,$failed_ref)=@_; | |
|
180 | my($success); | |
|
181 | ||
|
182 | lyxport_info("Making PDF"); | |
|
183 | run_pdflatex($tex,$pdf,$runs_ref); | |
|
184 | $success=check_targets($pdf,'PDF',$built_ref,$failed_ref); | |
|
185 | if ($success and not $opt{leave}) { | |
|
186 | move2html_dir('PDF',$pdf,$html_dir,$stat_ref,$built_ref); | |
|
187 | } | |
|
188 | } # end of make_pdf() | |
|
189 | ||
|
190 | #----------------------------------------------------------------------------- | |
|
191 | # move a given target to the html dir, only if it exists. leaves diagnostics | |
|
192 | # info in a status string | |
|
193 | sub move2html_dir { | |
|
194 | my($name,$file,$dir,$stat_ref,$html_status_ref)=@_; | |
|
195 | ||
|
196 | if ($$html_status_ref =~ /HTML/) { | |
|
197 | safe_system("mv $file $dir"); | |
|
198 | $$stat_ref .= "Target $name moved to directory $dir\n"; | |
|
199 | } else { | |
|
200 | $$stat_ref .= "Target $name left in current directory\n"; | |
|
201 | } | |
|
202 | } # end of move2html_dir() | |
|
203 | ||
|
204 | #----------------------------------------------------------------------------- | |
|
205 | # make sure that the tex file is up to date vs the lyx original before starting | |
|
206 | # returns a list of the included .tex files which were generated (besides the main one) | |
|
207 | sub update_tex { | |
|
208 | my($lyx,$tex)=@_; | |
|
209 | my($lyx_time,$tex_time); | |
|
210 | my(@lyx_out,@made_tex,$lc); | |
|
211 | ||
|
212 | @made_tex=(); | |
|
213 | unless (-e $lyx) { | |
|
214 | print "LyX file not found. Working off the LaTeX file alone.\n\n"; | |
|
215 | return; | |
|
216 | } | |
|
217 | $lyx_time=(stat($lyx))[9]; | |
|
218 | $tex_time=(stat($tex))[9]; | |
|
219 | if ($lyx_time>$tex_time or not(-e $tex)) { | |
|
220 | lyxport_info("LaTeX file outdated or not existent, regenerating it..."); | |
|
221 | unlink $tex; | |
|
222 | @lyx_out=`$cmd{lyx} -dbg latex --export latex $lyx 2>&1 `; | |
|
223 | # try again without -dbg option: LyX has a bug here! Note that this will | |
|
224 | # disable the ability to remove extra .tex files generated from \include | |
|
225 | # statements. But at least it will work, until they fix the bug in LyX. | |
|
226 | unless (-e $tex) { | |
|
227 | @lyx_out=`$cmd{lyx} --export latex $lyx 2>&1 `; | |
|
228 | } | |
|
229 | # end of ugly workaround | |
|
230 | unless (-e $tex) {die "Aborting: couldn't create LaTeX file with LyX.\n\n"}; | |
|
231 | push (@made_tex,$tex); | |
|
232 | # find whether lyx made auxiliary (included) .tex files and report | |
|
233 | foreach $lc (0..$#lyx_out-1) { | |
|
234 | $_=$lyx_out[$lc]; | |
|
235 | if (/^incfile:.*\.lyx/) { | |
|
236 | $lyx_out[$lc+1] =~ /^writefile:(.*)$/; | |
|
237 | push (@made_tex,basename($1)); | |
|
238 | } | |
|
239 | } | |
|
240 | if (@made_tex) { | |
|
241 | lyxport_info("Made LaTeX included files: @made_tex"); | |
|
242 | } | |
|
243 | lyxport_info("Done with LaTeX generation. Moving on."); | |
|
244 | } | |
|
245 | return @made_tex; | |
|
246 | } # end of update_tex() | |
|
247 | ||
|
248 | #----------------------------------------------------------------------------- | |
|
249 | # run latex on a file as many times as needed | |
|
250 | # if the given # of runs is > 0, that many are done; otherwise latex is run | |
|
251 | # as many times as needed until cross-references work. | |
|
252 | # can be used to run either normal latex or pdflatex | |
|
253 | sub run_latex { | |
|
254 | my($latex_cmd,$file,$runs_ref)=@_; | |
|
255 | ||
|
256 | # pre-determined # of runs | |
|
257 | if ($$runs_ref > 0) { | |
|
258 | foreach (1..$$runs_ref) { | |
|
259 | lyxport_info("$latex_cmd run # $$runs_ref"); | |
|
260 | safe_system("$latex_cmd $file"); | |
|
261 | } | |
|
262 | } | |
|
263 | # or make as many runs as needed to get things right (not very robust...) | |
|
264 | else { | |
|
265 | $$runs_ref=0; | |
|
266 | while (1) { | |
|
267 | $$runs_ref++; | |
|
268 | lyxport_info("$latex_cmd run # $$runs_ref"); | |
|
269 | $_ = `$latex_cmd $file`; | |
|
270 | print; | |
|
271 | last unless (/Rerun to get cross-references right/m or | |
|
272 | /^No file .*\.toc.$/m); | |
|
273 | } | |
|
274 | } | |
|
275 | } # end of run_latex() | |
|
276 | ||
|
277 | #----------------------------------------------------------------------------- | |
|
278 | # cleanup the tex code so that latex2html doesn't get too confused | |
|
279 | # this is essentially a Perl version (made with s2p) of Steffan Effer's | |
|
280 | # original improvetex sed script, part of his lyx2html script collection | |
|
281 | sub improve_tex4html { | |
|
282 | my ($texfile,$newfile)=@_; | |
|
283 | my ($len1,$pflag); | |
|
284 | my $printit=1; | |
|
285 | local *OLD,*NEW; | |
|
286 | ||
|
287 | open(OLD,"< $texfile") || die "Can't read from file $texfile: $!\n"; | |
|
288 | open(NEW,"> $newfile") || die "Can't write to file $newfile: $!\n"; | |
|
289 | select(NEW) || die "Can't make $newfile default filehandle: $!\n"; | |
|
290 | ||
|
291 | # code generated by s2p follows. Emacs can't reindent it properly! | |
|
292 | # this code is ugly (once in Perl, original sed was ok). Clean it up... | |
|
293 | $pflag=$\; # save print flag | |
|
294 | $\="\n"; | |
|
295 | LINE: | |
|
296 | while (<OLD>) { | |
|
297 | chomp; | |
|
298 | # remove pagerefs over two lines (senseless in HTML) | |
|
299 | if (/on *$\|on *page *$/) { | |
|
300 | $_ .= "\n"; | |
|
301 | $len1 = length; | |
|
302 | $_ .= <OLD>; | |
|
303 | chop if $len1 < length; | |
|
304 | s/on *\n*page *\n*\\pageref{[^}]*}/\n/g; | |
|
305 | } | |
|
306 | # remove regular pagerefs (senseless in HTML) | |
|
307 | s/on *page *\\pageref{[^}]*}//g; | |
|
308 | # comment out redefintion of url tag (confuses latex2html) | |
|
309 | if (/^\\IfFileExists{url.sty}/) { | |
|
310 | s/^/%/; | |
|
311 | print; | |
|
312 | $_ = <OLD>; | |
|
313 | s/^/%/; | |
|
314 | } | |
|
315 | # remove empty pages | |
|
316 | if (/^\\thispagestyle{empty}~\\newpage$/) { | |
|
317 | $printit = 0; | |
|
318 | next LINE; | |
|
319 | } | |
|
320 | if (/^\\thispagestyle{empty}~$/) { | |
|
321 | $printit = 0; | |
|
322 | next LINE; | |
|
323 | } | |
|
324 | # remove custom latex commands for fancyheaders | |
|
325 | s/\\fancyhead[^{]*{[^{}]*([^{}]*{[^{}]*})*[^{}]*}*//g; | |
|
326 | s/\\thispagestyle{[^{}]*}//g; | |
|
327 | # change documentclass from scrbook to book | |
|
328 | s/^(\\documentclass[^{}]*{)scrbook}/$1book}/; | |
|
329 | # comment out unsupported packages | |
|
330 | s/^(\\usepackage\[T1\]{fontenc})/%$1/; | |
|
331 | s/^(\\usepackage{a4wide})/%$1/; | |
|
332 | s/^(\\usepackage{fancyhdr})/%$1/; | |
|
333 | s/^(\\usepackage{ae)/%$1/; | |
|
334 | s/^(\\pagestyle{fancy})/%$1/; | |
|
335 | # the geometry package doesn't make sense in html | |
|
336 | s/^(\\usepackage{geometry})/%$1/; | |
|
337 | s/^(\\geometry)/%$1/; | |
|
338 | # comment out ident/skip block command (produces error message; why?) | |
|
339 | s/^(\\setlength\\parskip{.*})/%$1/; | |
|
340 | s/^(\\setlength\\parindent{.*})/%$1/; | |
|
341 | } continue { | |
|
342 | if ($printit) { print } | |
|
343 | else { $printit++ } | |
|
344 | } | |
|
345 | close(OLD); | |
|
346 | close(NEW); | |
|
347 | select(STDOUT); | |
|
348 | $\=$pflag; # restore defaults | |
|
349 | } # end of improve_tex4html() | |
|
350 | ||
|
351 | #----------------------------------------------------------------------------- | |
|
352 | sub run_latex2html { | |
|
353 | my ($tex,$latex2html_opts)=@_; | |
|
354 | my ($l2h_file,$symlink_exists,$htmldir); | |
|
355 | ||
|
356 | ($htmldir=$tex) =~ s/\.tex$//; | |
|
357 | $l2h_file="${tex}_#tmp_2html#"; | |
|
358 | improve_tex4html($tex,$l2h_file); | |
|
359 | # add index support | |
|
360 | my $xtraargs = ""; | |
|
361 | my $idx = "$htmldir.idx"; | |
|
362 | if(-e $idx ) { | |
|
363 | $xtraargs .= "-index $idx"; | |
|
364 | } | |
|
365 | safe_system("$cmd{latex2html} $xtraargs $latex2html_opts $l2h_file"); | |
|
366 | unless ($opt{debug}) { | |
|
367 | unlink($l2h_file,"$htmldir/labels.pl"); | |
|
368 | } | |
|
369 | ||
|
370 | # latex2html always leaves 2 copies of the file (one as file.html, one as | |
|
371 | # index.html). In systems that support symlinks, remove one and replace it | |
|
372 | # with a link: | |
|
373 | $symlink_exists = eval { symlink("",""); 1 }; | |
|
374 | if ($symlink_exists) { | |
|
375 | unlink("$htmldir/index.html"); | |
|
376 | symlink("$htmldir.html","$htmldir/index.html"); | |
|
377 | } | |
|
378 | } # end of run_latex2html() | |
|
379 | ||
|
380 | #----------------------------------------------------------------------------- | |
|
381 | # remove calls to eps figures if they have an accompanying tiff, jpg or png | |
|
382 | sub improve_tex_figs { | |
|
383 | my ($tex,$textmp)=@_; | |
|
384 | local (*TEX,*TMP); | |
|
385 | ||
|
386 | # begin changes to tex file | |
|
387 | my ($printit,$figname,$fignoneps,$figbase,$figext,$fignew,@figlist,@tmpfiles); | |
|
388 | open(TEX,"< $tex") || die "Can't read from LaTeX file $tex: $!\n"; | |
|
389 | open(TMP,"> $textmp") || die "Can't write to temp file $textmp: $!\n"; | |
|
390 | $printit=1; | |
|
391 | while (<TEX>) { | |
|
392 | if (/includegraphics{([^\}]*)/) { | |
|
393 | $figname=$1; | |
|
394 | # remove .eps from fig name and make a .pdf version if necessary | |
|
395 | if ($figname =~ /\.eps$/i) { | |
|
396 | ($figbase = $figname) =~ s/\.eps$//i; | |
|
397 | # now we need to find if there's any non-eps figure for this file: | |
|
398 | # pdflatex can handle jpegs, tiffs, etc. So we only need to build | |
|
399 | # an associated pdf if there is no other figure file for pdflatex | |
|
400 | # to work with | |
|
401 | @figlist=grep {/\.jpe?g$|\.tiff?$|\.png$|\.pdf$/i} <$figbase.*>; | |
|
402 | if (@figlist > 1) { | |
|
403 | lyxport_info("Problem! More than one figure file found: @figlist"); | |
|
404 | die "I don't know what to do here. Sorry, aborting...\n\n"; | |
|
405 | } elsif (@figlist==1) { | |
|
406 | # problem: pdftex only recognizes jpg (not jpeg, not JPG, etc) | |
|
407 | # and tif (not tiff, not TIF, etc). It also gets confused by files | |
|
408 | # called a.b.c.jpg (it thinks .b.c.jpg is the extension). argh!!! | |
|
409 | ($fignoneps)=(@figlist); | |
|
410 | # so first, extract the 3 or 4 letter extension and lowercase it | |
|
411 | $fignoneps =~ /.*\.(....??)$/; | |
|
412 | ($figext = $1) =~ tr/[A-Z]/[a-z]/; | |
|
413 | # and remove any periods from the base of the name (replace by _) | |
|
414 | $figbase =~ s/\./_/g; | |
|
415 | $fignew="$figbase.$figext"; | |
|
416 | if ($fignoneps =~ /\.JPE?G$|\.TIFF?$|\.PNG$|\.PDF$/) { | |
|
417 | lyxport_info("pdflatex only recognizes the following extensions:\n". | |
|
418 | "pdf, png, jpg, tif. (all lowercase, no variations like jpeg or tiff).\n". | |
|
419 | "lyxport will make a copy of $fignoneps to $fignew so that pdflatex is happy"); | |
|
420 | copy($fignoneps,$fignew); | |
|
421 | push(@tmpfiles,$fignew); | |
|
422 | } | |
|
423 | s/$figname/$fignew/; # in $_, for printing to temp file | |
|
424 | } else { | |
|
425 | s/$figname/$figbase.pdf/; | |
|
426 | lyxport_info("Making PDF figure <$figbase.pdf> from <$figname>"); | |
|
427 | safe_system("$cmd{epstopdf} $figname"); | |
|
428 | } | |
|
429 | ||
|
430 | } | |
|
431 | } | |
|
432 | } continue { | |
|
433 | if ($printit) { print TMP $_} | |
|
434 | else { $printit++ } | |
|
435 | } | |
|
436 | close(TEX); | |
|
437 | close(TMP); | |
|
438 | return @tmpfiles; | |
|
439 | } # end of improve_tex_figs() | |
|
440 | ||
|
441 | #----------------------------------------------------------------------------- | |
|
442 | # Make the pdf directly from the latex file | |
|
443 | # Notes: for this to work ok, the following must have been done: | |
|
444 | # 1. ~/.dvipsrc file must contain the lines | |
|
445 | # p+ psfonts.cmz | |
|
446 | # p+ psfonts.amz | |
|
447 | # 2. The latex preamble of the lyx file must have | |
|
448 | # \usepackage{ae,aecompl} | |
|
449 | # This is so that T1 encoded fonts come out looking good in the final pdf. | |
|
450 | sub run_pdflatex { | |
|
451 | my ($tex,$pdf,$runs_ref)=@_; | |
|
452 | my ($texbase,$tmpbase,$textmp,@tmpfiles,@extensions,$printit); | |
|
453 | local *TEX,*TMP; | |
|
454 | ||
|
455 | # first fix references to eps figures (make sure that pdf versions exist!!!) | |
|
456 | # make all changes in a temp tex file | |
|
457 | ($texbase=$tex) =~ s/\.tex$//; | |
|
458 | $tmpbase = "${texbase}_#tmp_pdf#"; | |
|
459 | @extensions=qw(tex aux out toc log); | |
|
460 | ($textmp,@tmpfiles)= map { "${tmpbase}.$_" } @extensions; | |
|
461 | ||
|
462 | push(@tmpfiles,improve_tex_figs($tex,$textmp)); | |
|
463 | # now run the actual pdflatex converter | |
|
464 | run_latex("$cmd{pdflatex} -interaction=nonstopmode",$textmp,$runs_ref); | |
|
465 | rename( "${tmpbase}.pdf",$pdf); | |
|
466 | unless ($opt{debug}) { unlink ($textmp,@tmpfiles,"texput.log"); } | |
|
467 | } # end of run_pdflatex() | |
|
468 | ||
|
469 | #----------------------------------------------------------------------------- | |
|
470 | # general utility routines (not related to latex/html/pdf) follow | |
|
471 | ||
|
472 | #------------------------------------------------------------------------- | |
|
473 | sub cmdline_process{ | |
|
474 | my($opt_ref,$file_ref)=@_; | |
|
475 | ||
|
476 | # modules | |
|
477 | no strict "vars"; # avoid some unpleasant warnings while checking options | |
|
478 | ||
|
479 | use Getopt::Long; | |
|
480 | # allow bundling of single letter options (-a -b == -ab) | |
|
481 | Getopt::Long::Configure ("bundling"); | |
|
482 | use Pod::Usage; | |
|
483 | ||
|
484 | # note: the second name for each option (after |) is an alias for user | |
|
485 | # convenience only. Internally, the only created hash entries use the *first* | |
|
486 | # name as a key (i.e. $opt{h} doesn't exist, $opt{html} is set with -h or --html) | |
|
487 | my(@option_list) = qw(html|h ps|p pdf|f leave | |
|
488 | runs|r=i opts_l2h|o=s clean|c tidy|t+ | |
|
489 | cld|l debug|d help man|m version|v); | |
|
490 | ||
|
491 | # debug mode overrides all post-run cleanup options | |
|
492 | if ($opt{debug}) { $opt{t}=0 } | |
|
493 | ||
|
494 | # default: a negative # of runs means auto-detect | |
|
495 | $$opt_ref{runs}= -99; | |
|
496 | # dash options first | |
|
497 | GetOptions($opt_ref,@option_list) || pod2usage(-verbose => 0); | |
|
498 | ||
|
499 | # execute all possible "die" modes first | |
|
500 | cmdline_debug(%$opt_ref) if ($$opt_ref{cld}); | |
|
501 | pod2usage(-verbose => 1) if ($$opt_ref{help}); | |
|
502 | pod2usage(-verbose => 2) if ($$opt_ref{man}); | |
|
503 | die "\nlyxport: version $version\n\n" if ($$opt_ref{version}); | |
|
504 | ||
|
505 | ## Now get filename (only ONE) | |
|
506 | pod2usage(-verbose => 0, -message => | |
|
507 | "\nERROR: lyxport works with exactly ONE file at a time.\n") | |
|
508 | if (@ARGV != 1); | |
|
509 | ($$file_ref)=@ARGV; | |
|
510 | ||
|
511 | # choose whether to make all targets or just the explicitly specified ones | |
|
512 | unless ($$opt_ref{html} or $$opt_ref{ps} or $$opt_ref{pdf}) { | |
|
513 | $$opt_ref{html}=$$opt_ref{ps}=$$opt_ref{pdf}=1; | |
|
514 | } | |
|
515 | } # end of cmdline_process() | |
|
516 | ||
|
517 | #----------------------------------------------------------------------------- | |
|
518 | # quick and dirty hash printing by key/value pairs | |
|
519 | sub print_hash { | |
|
520 | my($key_msg,$val_msg,%hash)=@_; | |
|
521 | my($op,$val); | |
|
522 | ||
|
523 | while ( ($op,$val)=each(%hash) ) {print "$key_msg $op $val_msg $val\n" } | |
|
524 | } # end of print_hash() | |
|
525 | ||
|
526 | #----------------------------------------------------------------------------- | |
|
527 | sub cmdline_debug{ | |
|
528 | my(%opt)=@_; | |
|
529 | ||
|
530 | print "\nlyxport command line debug mode\n"; | |
|
531 | print "-------------------------------\n\n"; | |
|
532 | print "This is a dump of your command line options, as key-value pairs:\n\n"; | |
|
533 | print_hash("","->",%opt); | |
|
534 | print "\nExiting...\n\n"; | |
|
535 | exit; | |
|
536 | } # end of cmdline_debug() | |
|
537 | ||
|
538 | #----------------------------------------------------------------------------- | |
|
539 | # execute a system call but die with some info if return value is non-zero | |
|
540 | sub safe_system { | |
|
541 | my $error; | |
|
542 | ||
|
543 | $error=system(@_)/256; | |
|
544 | if ($error) { | |
|
545 | print "\nERROR: Command\n @_\nfailed.\n"; | |
|
546 | } | |
|
547 | return $error; | |
|
548 | } # end of safe_system() | |
|
549 | ||
|
550 | #----------------------------------------------------------------------------- | |
|
551 | # check that the command names specified at the top exist in the system, | |
|
552 | # otherwise choose bare defaults and hope for the best. | |
|
553 | sub set_cmd_defaults { | |
|
554 | my ($cmd)=@_; | |
|
555 | my ($prog,$cmd_name); | |
|
556 | ||
|
557 | print "\n"; | |
|
558 | while (($prog,$cmd_name)=each(%cmd)) { | |
|
559 | print "Checking for program <$prog>, as <$cmd_name>... \n"; | |
|
560 | if (system("which $cmd_name")/256) { | |
|
561 | $$cmd{$prog}=$prog; | |
|
562 | print "Not found. Reverting to default name $prog.\n"; | |
|
563 | } else { print "OK, found it.\n" } | |
|
564 | } | |
|
565 | print "\nDone configuring command names\n\n"; | |
|
566 | } # end of set_cmd_defaults() | |
|
567 | ||
|
568 | #----------------------------------------------------------------------------- | |
|
569 | # make sure there's either a .lyx or a .tex file to work with | |
|
570 | # returns a stripped name (without .lyx or .tex extension) of the file | |
|
571 | sub check_file_exists { | |
|
572 | my($file_in)=@_; | |
|
573 | my($base_file); | |
|
574 | ||
|
575 | $_=$file_in; | |
|
576 | if (/\.lyx$/) { s/\.lyx$// } | |
|
577 | elsif (/\.tex$/) { s/\.tex$// } | |
|
578 | $base_file=$_; | |
|
579 | unless (-e "${base_file}.lyx" or -e "${base_file}.tex") { | |
|
580 | die "I can't find a LyX or LaTeX file to work with!\nAborting...\n\n"; | |
|
581 | } | |
|
582 | return $base_file; | |
|
583 | } # end of check_file_exists() | |
|
584 | ||
|
585 | #----------------------------------------------------------------------------- | |
|
586 | sub check_targets{ | |
|
587 | my($file,$tag,$built,$failed)=@_; | |
|
588 | my($success)=0; | |
|
589 | ||
|
590 | $tag .= ' '; | |
|
591 | if (-s $file) { $$built .= $tag; $success=1; } | |
|
592 | else { $$failed .= $tag } | |
|
593 | return $success; | |
|
594 | } # end of check_targets() | |
|
595 | ||
|
596 | #----------------------------------------------------------------------------- | |
|
597 | # do extra cleaning of aux, toc, log files generated during running | |
|
598 | sub tidy_up { | |
|
599 | my($tidy,$aux,$log,$out,$toc,@latex_from_lyx)=@_; | |
|
600 | ||
|
601 | lyxport_info("Cleanup of leftover auxiliary files"); | |
|
602 | print "Removing files: $aux, $log, $out, $toc\n"; | |
|
603 | unlink ($aux,$log,$out,$toc); | |
|
604 | if ($tidy>1 and @latex_from_lyx) { | |
|
605 | lyxport_info("Extra cleanup: removing LaTeX file(s) @latex_from_lyx"); | |
|
606 | unlink(@latex_from_lyx); | |
|
607 | foreach (@latex_from_lyx) { | |
|
608 | s/\.tex$/\.aux/; | |
|
609 | if (-e) { | |
|
610 | print "Removing aux file $_\n"; | |
|
611 | unlink($_); | |
|
612 | } | |
|
613 | } | |
|
614 | } | |
|
615 | } # end of tidy_up() | |
|
616 | ||
|
617 | #----------------------------------------------------------------------------- | |
|
618 | sub lyxport_info { | |
|
619 | my ($target)=@_; | |
|
620 | ||
|
621 | print "\n",'*'x75,"\n"; | |
|
622 | print "<lyxport> $target\n\n"; | |
|
623 | } # end of lyxport_info() | |
|
624 | ||
|
625 | #----------------------------------------------------------------------------- | |
|
626 | sub final_diagnostics{ | |
|
627 | my($file_in,$status,$targets_built,$targets_failed)=@_; | |
|
628 | ||
|
629 | lyxport_info("All done!"); | |
|
630 | print "Input file: $file_in\n\n"; | |
|
631 | print "Targets built : $targets_built\n\n"; | |
|
632 | if ($targets_failed) { | |
|
633 | print "PROBLEM!\nTargets failed: $targets_failed\n\n"; | |
|
634 | } | |
|
635 | print "Diagnostics of build process:\n\n$status\nBye!\n\n"; | |
|
636 | } # end of final_diagnostics() | |
|
637 | ||
|
638 | ||
|
639 | #************************ end of code for <lyxport> ******************* | |
|
640 | ||
|
641 | __END__ | |
|
642 | ||
|
643 | =pod | |
|
644 | ||
|
645 | =head1 DESCRIPTION | |
|
646 | ||
|
647 | =head2 Purpose | |
|
648 | ||
|
649 | LyX ( http://www.lyx.org ) is a wonderful document processor, which can produce | |
|
650 | from a single source multiple versions for different purposes: a PostScript | |
|
651 | file for printing on a Unix-type system, a PDF file for distribution across | |
|
652 | multiple operating systems, or an HTML file for Internet display. It | |
|
653 | accomplishes this by exporting its own file format to a LaTeX file and then | |
|
654 | running various converters on this resulting file. | |
|
655 | ||
|
656 | However, it turns out that this process isn't exactly foolproof, as these | |
|
657 | converters have all sorts of little quirks which can produce anything from | |
|
658 | surprises in the way the final result looks like to outright failure of the | |
|
659 | export process. The purpose of B<lyxport> is to serve as a "smart wrapper" | |
|
660 | around those export facilities which LyX normally uses, trying to massage the | |
|
661 | LaTeX file that everything starts from in the hopes of having better success | |
|
662 | in producing HTML and PDF (PostScript usually poses no problems). | |
|
663 | ||
|
664 | B<lyxport> also allows you to keep around only the LyX file, and possibly any | |
|
665 | ancillary figure files. B<lyxport> takes care of generating (and removing | |
|
666 | afterwards if instructed to do so) any intermediate files necessary for the | |
|
667 | export process. | |
|
668 | ||
|
669 | For example, in order to make PDF from a LaTeX file, any included eps figures | |
|
670 | need to be converted to pdf format. But LyX likes to have the figures in eps | |
|
671 | format for on-screen display, which is a great feature to have. B<lyxport> | |
|
672 | allows you to keep your LyX file as usual (with references to .eps figures) | |
|
673 | and will make .pdf versions of any included figure on the fly as needed. You | |
|
674 | can even ask it to remove those pdf files after it finishes, if you really | |
|
675 | want to maintain a minimum of files around (though it will have to remake them | |
|
676 | again if you ever need to update your pdf exported document). | |
|
677 | ||
|
678 | =head2 Command line use | |
|
679 | ||
|
680 | If you simply type B<lyxport> F<file>, it will try to make PostScript, HTML, | |
|
681 | and PDF versions of your file, putting them all in a single directory named | |
|
682 | F<file> (without a .lyx or .tex extension if your file had one). But it has | |
|
683 | L<command line options|OPTIONS AND ARGUMENTS> for making only the | |
|
684 | formats you want, and fairly detailed control over its behavior. | |
|
685 | ||
|
686 | =head2 If you don't have LyX | |
|
687 | ||
|
688 | Despite its name, if you are a regular LaTeX user and don't even have LyX | |
|
689 | installed in your system, B<lyxport> can still be useful to you. In fact, | |
|
690 | B<lyxport> only uses LyX once in each run: if there is no F<file.tex> or if | |
|
691 | F<file.lyx> file is newer than F<file.tex>, B<lyxport> updates F<file.tex> | |
|
692 | from F<file.lyx>. But if there is no F<file.lyx> at all it will simply use | |
|
693 | F<file.tex> and proceed with all its functionality intact. | |
|
694 | ||
|
695 | =cut | |
|
696 | ########################################################################### | |
|
697 | =pod | |
|
698 | ||
|
699 | =head1 OPTIONS AND ARGUMENTS | |
|
700 | ||
|
701 | Single letter options (preceded by a single dash B<->) can be bundled: B<-pf> | |
|
702 | is equivalent to B<-p -f>. Long options (preceded by two dashes B<-->) can be | |
|
703 | abbreviated to as few letters as needed to clear ambiguity. | |
|
704 | ||
|
705 | =over | |
|
706 | ||
|
707 | =item B<-r --runs> I<NUM> | |
|
708 | ||
|
709 | Set number of latex runs by hand (otherwise auto-determined). | |
|
710 | ||
|
711 | =item B<-o --opts_l2h> I<'string'> | |
|
712 | ||
|
713 | String with options to be passed to B<latex2html>. This string should be | |
|
714 | protected by single quotes to allow double quotes inside of it. | |
|
715 | ||
|
716 | For example, if you want to pass to B<latex2html> the option B<-info "my | |
|
717 | info"> you can do so with B<lyxport -o ' -info "my info" '> (the extra spaces | |
|
718 | around the quote marks are not needed, they are here only for the sake of | |
|
719 | clarity). | |
|
720 | ||
|
721 | B<latex2html> has I<many> command-line options. For a project you are working | |
|
722 | constantly on, it may be more convenient to permanently set some of those | |
|
723 | options via a file called F<.latex2html-init> which B<latex2html> always | |
|
724 | reads at startup. See the B<latex2html> man page or the excellent online | |
|
725 | documentation kept at http://www-texdev.mpce.mq.edu.au/l2h/docs/manual for | |
|
726 | full details. | |
|
727 | ||
|
728 | =item B<-h --html> | |
|
729 | ||
|
730 | Export to HTML. | |
|
731 | ||
|
732 | =item B<-p --ps> | |
|
733 | ||
|
734 | Export to PostScript. | |
|
735 | ||
|
736 | =item B<-f --pdf> | |
|
737 | ||
|
738 | Export to PDF. See below the section L<PDF GENERATION> for details on how to | |
|
739 | obtain nice-looking PDF from your LaTeX sources. | |
|
740 | ||
|
741 | If none of the three above options is specified, the default behavior is to | |
|
742 | export I<all> three formats. If any is given, then only those formats | |
|
743 | explicitly specified will be produced (e.g. B<-h -f> makes HTML and PDF only, | |
|
744 | but not PostScript). | |
|
745 | ||
|
746 | =item B<--leave> | |
|
747 | ||
|
748 | By default lyxport moves the resulting PostScript and PDF files into the | |
|
749 | directory containing the HTML results (if it was created). This option tells | |
|
750 | it to leave them in the current directory. | |
|
751 | ||
|
752 | =item B<-c --clean> | |
|
753 | ||
|
754 | Do a clean start export, removing first any html directory, .aux, .log | |
|
755 | and .toc files which may have been left from previous runs. | |
|
756 | ||
|
757 | =item B<-t --tidy> | |
|
758 | ||
|
759 | B<lyxport> will tidy up I<after> itself, removing .aux, .log and .toc files left | |
|
760 | in the current directory. Use this only for "final" publication of documents, as | |
|
761 | those files are otherwise useful to shorten the time of runs. | |
|
762 | ||
|
763 | This option is incremental: you can call it twice (you can bundle it as | |
|
764 | B<-tt>). If called twice, B<lyxport> will remove also the LaTeX file | |
|
765 | associated with your LyX file, but I<only if> B<lyxport> I<itself created it | |
|
766 | in the same run>. This behavior is meant to be a safety net, so that | |
|
767 | B<lyxport> doesn't accidentally remove LaTeX files which you may have manually | |
|
768 | modified in some way. | |
|
769 | ||
|
770 | So if this option is called twice, you can start with a LyX file named F<file.lyx> | |
|
771 | and end up only with your original file plus a single directory named F<file> which | |
|
772 | will contain F<file.html>, F<file.ps> and F<file.pdf> (plus some ancillary stuff for | |
|
773 | the html version). This mode of operation is obviously provided for the neatness | |
|
774 | freaks amongst us. | |
|
775 | ||
|
776 | =item B<-d --debug> | |
|
777 | ||
|
778 | Debugging mode: B<lyxport> will leave I<all> temporary files it creates lying | |
|
779 | around. If a particular target refuses to build, you can then try to run the | |
|
780 | respective commands on the temporary files manually, and possibly diagnose the | |
|
781 | source of the problem. | |
|
782 | ||
|
783 | This option will override any calls made to option B<--tidy>. | |
|
784 | ||
|
785 | =item B<-l --cld> | |
|
786 | ||
|
787 | Special command-line debugging mode: only prints (in a rather primitive form) | |
|
788 | the names and values of all command-line options which were set. Useful for | |
|
789 | finding problems with complicated option strings being passed to | |
|
790 | B<latex2html>. | |
|
791 | ||
|
792 | =item B<--help> | |
|
793 | ||
|
794 | Print this help and quit. | |
|
795 | ||
|
796 | =item B<-m --man> | |
|
797 | ||
|
798 | Print a complete man page. B<lyxport> is documented using embedded pod | |
|
799 | strings, so you can see its full documentation using the command B<perldoc | |
|
800 | lyxport>. | |
|
801 | ||
|
802 | You can also convert this documentation to other formats using the | |
|
803 | I<pod2_anything> family of converters (L<pod2html>, L<pod2latex>, L<pod2man> | |
|
804 | and L<pod2text>). See their respective man pages for details. | |
|
805 | ||
|
806 | Note that if you installed B<lyxport> properly, you should already have a man | |
|
807 | page available, plus html and plain text versions of the documents. These are | |
|
808 | by default installed to a directory named F</usr/local/doc/lyxport-XXX>, where | |
|
809 | F<XXX> is the version number. At installation time, you may manually change | |
|
810 | the F</usr/local> prefix. Consult your local documents or ask your system | |
|
811 | administrator for details on the specifics of your configuration. | |
|
812 | ||
|
813 | =item B<-v --version> | |
|
814 | ||
|
815 | Print version information and quit. | |
|
816 | ||
|
817 | =item B<filename> | |
|
818 | ||
|
819 | The given filename may have a .lyx or .tex extension (or none at | |
|
820 | all). I<lyxport> will update the tex file from the lyx file if necessary. | |
|
821 | ||
|
822 | B<lyxport> accepts only I<one> filename at a time. | |
|
823 | ||
|
824 | =back | |
|
825 | ||
|
826 | =cut | |
|
827 | ########################################################################### | |
|
828 | =pod | |
|
829 | ||
|
830 | =head1 INTEGRATION WITH LyX | |
|
831 | ||
|
832 | If you find that B<lyxport> is more succesful in exporting your files than | |
|
833 | LyX's default calls to B<latex2html> and B<pdflatex>, you can modify LyX to | |
|
834 | use B<lyxport> as its conversion routine. For LyX versions 1.1.6 and above, go | |
|
835 | to C<< Edit->Preferences->Converters->Converters >> and specify B<lyxport> as your | |
|
836 | converter for C<< LaTeX->HTML >> and C<< LaTeX->PDF >>. LyX's convention | |
|
837 | is to call B<$$i> the current file. | |
|
838 | ||
|
839 | For example, if you want to setup B<lyxport> to be your PDF export filter | |
|
840 | under LyX, in the C<Converters> dialog, in the C<< LaTeX->PDF(pdflatex) >> | |
|
841 | option, set: | |
|
842 | ||
|
843 | lyxport --pdf $$i | |
|
844 | ||
|
845 | This way you'll be able to export to pdf directly from within LyX, even if | |
|
846 | your figures are in eps format. | |
|
847 | ||
|
848 | LyX's C<Converters> dialog is a bit confusing: after making changes, you must | |
|
849 | first press the C<Modify> button for your changes to actually be recorded, and | |
|
850 | then C<Save>. | |
|
851 | ||
|
852 | You can similarly set up B<lyxport> to be your LaTeX to HTML converter. | |
|
853 | ||
|
854 | For LyX versions earlier than 1.1.6 (which didn't have the new Preferences | |
|
855 | dialog) these same options can be configured via your LyX defaults file. See | |
|
856 | the LyX documentation for details. | |
|
857 | ||
|
858 | =cut | |
|
859 | ########################################################################### | |
|
860 | =pod | |
|
861 | ||
|
862 | =head1 PDF GENERATION | |
|
863 | ||
|
864 | =head2 Fonts | |
|
865 | ||
|
866 | Normally PDF documents made on Unix-type systems from LaTeX sources produce | |
|
867 | horrible looking fonts when viewed with Adobe's own Acrobat Reader. I don't | |
|
868 | know the many intricacies of the problem (you can search for the details on | |
|
869 | your own). I'll simply list here the trick that has helped I<me> solve the | |
|
870 | font problem. Try it, your mileage may vary. | |
|
871 | ||
|
872 | =over | |
|
873 | ||
|
874 | =item 1 | |
|
875 | ||
|
876 | In your home directory, make (or modify it if it already exists) a file | |
|
877 | named F<.dvipsrc> which must contain the lines: | |
|
878 | ||
|
879 | p+ psfonts.cmz | |
|
880 | p+ psfonts.amz | |
|
881 | ||
|
882 | =item 2 | |
|
883 | ||
|
884 | Make sure that the LaTeX preamble of your LyX file (or the part before | |
|
885 | C<\begin{document}> if you are using straight LaTeX files) contains: | |
|
886 | ||
|
887 | \usepackage[T1]{fontenc} | |
|
888 | \usepackage{ae,aecompl} | |
|
889 | ||
|
890 | This will guarantee that T1 encoded fonts come out looking good in the final PDF. | |
|
891 | ||
|
892 | =back | |
|
893 | ||
|
894 | =head2 Figures | |
|
895 | ||
|
896 | B<pdflatex> (if I understand correctly) only accepts filenames with a single | |
|
897 | B<.> in them, and only uses graphic files with extensions pdf, png, jpg and | |
|
898 | tif (all lowercase). B<lyxport> will do its best to analyze your latex file | |
|
899 | and try to change references to figures to accommodate B<pdflatex>, by | |
|
900 | creating temporary copies of your image files if necessary. | |
|
901 | ||
|
902 | Ideally, you should be able to have for example a figure called F<fig.1.JPG> | |
|
903 | along with a F<fig.1.eps> (for B<lyx> to preview it), and B<lyxport> would | |
|
904 | export a pdf document without leaving any more files after itself, even though | |
|
905 | it temporarily had to create F<fig_1.jpg> to make B<pdflatex> happy. As I | |
|
906 | said, ideally... If things don't quite work, try the B<--debug> option. If you | |
|
907 | find a fix for the problem, mail it to me: fperez@pizero.colorado.edu | |
|
908 | ||
|
909 | =head2 Links | |
|
910 | ||
|
911 | In order for URLs and similar elements to produce proper active links in the | |
|
912 | PDF document, you need to include in your LaTeX preamble the line | |
|
913 | ||
|
914 | \usepackage{hyperref} | |
|
915 | ||
|
916 | =cut | |
|
917 | ########################################################################### | |
|
918 | =pod | |
|
919 | ||
|
920 | =head1 REQUIRES | |
|
921 | ||
|
922 | B<lyxport> relies on some programs listed below, for the reasons indicated: | |
|
923 | ||
|
924 | =over | |
|
925 | ||
|
926 | =item B<lyx> | |
|
927 | ||
|
928 | To make LaTeX files from LyX files. Tested with lyx version 1.1.6fix1, should | |
|
929 | work with earlier versions (perhaps with minor changes to the way LyX is called). | |
|
930 | ||
|
931 | =item B<latex> | |
|
932 | ||
|
933 | To produce PostScript and for latex2html to work properly (cross-references). | |
|
934 | ||
|
935 | =item B<dvips> | |
|
936 | ||
|
937 | For making PostScript output. | |
|
938 | ||
|
939 | =item B<latex2html> | |
|
940 | ||
|
941 | For generating HTML from latex sources. | |
|
942 | ||
|
943 | =item B<pdflatex> | |
|
944 | ||
|
945 | For making PDF output from a latex file with proper cross-referencing and | |
|
946 | internal document links. | |
|
947 | ||
|
948 | =item B<epstopdf> | |
|
949 | ||
|
950 | A Perl script to automatically generate pdf versions of eps figures included | |
|
951 | in lyx files. It is more robust in its handling of various eps quirks than a | |
|
952 | straight call to B<ps2pdf>. | |
|
953 | ||
|
954 | =item B<perl> | |
|
955 | ||
|
956 | Well, it's a Perl script after all, isn't it? | |
|
957 | ||
|
958 | =back | |
|
959 | ||
|
960 | However, partial use of B<lyxport> is still possible without some of these | |
|
961 | components. If for example you don't have B<latex2html> in your system, you | |
|
962 | can still use B<lyxport> to produce PostScript and PDF. Various combinations | |
|
963 | are possible. | |
|
964 | ||
|
965 | =head2 Portability | |
|
966 | ||
|
967 | There are calls in B<lyxport> to some Unix commands like B<rm -rf>. For this | |
|
968 | reason it is not totally portable. These calls are however reasonably few and | |
|
969 | could be eliminated if there is enough demand by replacing them with | |
|
970 | equivalent Perl code. It's just more work... | |
|
971 | ||
|
972 | =cut | |
|
973 | ########################################################################### | |
|
974 | =pod | |
|
975 | ||
|
976 | =head1 TO DO | |
|
977 | ||
|
978 | =over | |
|
979 | ||
|
980 | =item * | |
|
981 | ||
|
982 | Build rpm for more convenient installation. | |
|
983 | ||
|
984 | =item * | |
|
985 | ||
|
986 | Clean up the C<improve_tex4html()> code for readability. | |
|
987 | ||
|
988 | =back | |
|
989 | ||
|
990 | =cut | |
|
991 | ########################################################################### | |
|
992 | =pod | |
|
993 | ||
|
994 | =head1 VERSION | |
|
995 | ||
|
996 | This is B<lyxport> version 0.3.1 | |
|
997 | ||
|
998 | =cut | |
|
999 | ########################################################################### | |
|
1000 | =pod | |
|
1001 | ||
|
1002 | =head1 AUTHOR | |
|
1003 | ||
|
1004 | Fernando Pérez E<lt>fperez@pizero.colorado.eduE<gt>. | |
|
1005 | ||
|
1006 | Please email me with comments, suggestions, bugfixes, etc. | |
|
1007 | ||
|
1008 | The most current version of B<lyxport> should always be available at | |
|
1009 | http://www-hep.colorado.edu/~fperez/lyxport | |
|
1010 | ||
|
1011 | =cut | |
|
1012 | ########################################################################### | |
|
1013 | =pod | |
|
1014 | ||
|
1015 | =head1 ACKNOWLEDGEMENTS | |
|
1016 | ||
|
1017 | Inspired on the B<lyx2html> script by Steffen Evers | |
|
1018 | E<lt>tron@cs.tu-berlin.deE<gt>. Some of the code is a blatant ripoff of | |
|
1019 | Steffen's code, using B<s2p> to get Perl versions of his original B<sed> | |
|
1020 | scripts. | |
|
1021 | ||
|
1022 | =cut | |
|
1023 | ########################################################################### | |
|
1024 | =pod | |
|
1025 | ||
|
1026 | ||
|
1027 | =head1 COPYRIGHT AND DISCLAIMER | |
|
1028 | ||
|
1029 | This program is Copyright 2001 by Fernando Pérez. | |
|
1030 | ||
|
1031 | This program is free software; you can redistribute it and/or modify it under | |
|
1032 | the terms of the GNU General Public License as published by the Free Software | |
|
1033 | Foundation; either version 2 of the License, or (at your option) any later | |
|
1034 | version. | |
|
1035 | ||
|
1036 | This program is distributed in the hope that it will be useful, | |
|
1037 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
1038 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
1039 | GNU General Public License for more details. | |
|
1040 | ||
|
1041 | If you do not have a copy of the GNU General Public License write to | |
|
1042 | the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, | |
|
1043 | MA 02139, USA. | |
|
1044 | ||
|
1045 | If the author of this software was too lazy to include the full GPL text along | |
|
1046 | with the code, you can find it at: http://www.gnu.org/copyleft/gpl.html | |
|
1047 | ||
|
1048 | =cut | |
|
1049 | #************************** end of file <lyxport> ********************** |
@@ -10,10 +10,9 b' graft IPython/UserConfig' | |||
|
10 | 10 | |
|
11 | 11 | graft doc |
|
12 | 12 | exclude doc/*.1 |
|
13 |
exclude doc/* |
|
|
13 | exclude doc/manual_base* | |
|
14 | 14 | exclude doc/ChangeLog.* |
|
15 | 15 | exclude doc/\#* |
|
16 | exclude doc/magic.tex | |
|
17 | 16 | exclude doc/update_magic.sh |
|
18 | 17 | exclude doc/update_version.sh |
|
19 | 18 | exclude doc/manual_base* |
General Comments 0
You need to be logged in to leave comments.
Login now