| Line 1... |
Line 1... |
| 1 |
#! /bin/sh
|
1 |
#! /bin/sh
|
| 2 |
# texi2dvi --- produce DVI (or PDF) files from Texinfo (or LaTeX) sources.
|
2 |
# texi2dvi --- produce DVI (or PDF) files from Texinfo (or LaTeX) sources.
|
| 3 |
# $Id: texi2dvi,v 1.4 2003/09/25 06:15:28 hornik Exp $
|
3 |
# $Id: texi2dvi,v 1.3 2004/02/17 16:59:46 karl Exp $
|
| 4 |
#
|
4 |
#
|
| 5 |
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
|
5 |
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
|
| 6 |
# 2002, 2003 Free Software Foundation, Inc.
|
6 |
# 2002, 2003, 2004 Free Software Foundation, Inc.
|
| 7 |
#
|
7 |
#
|
| 8 |
# This program is free software; you can redistribute it and/or modify
|
8 |
# This program is free software; you can redistribute it and/or modify
|
| 9 |
# it under the terms of the GNU General Public License as published by
|
9 |
# it under the terms of the GNU General Public License as published by
|
| 10 |
# the Free Software Foundation; either version 2, or (at your option)
|
10 |
# the Free Software Foundation; either version 2, or (at your option)
|
| 11 |
# any later version.
|
11 |
# any later version.
|
| Line 18... |
Line 18... |
| 18 |
# You should have received a copy of the GNU General Public License
|
18 |
# You should have received a copy of the GNU General Public License
|
| 19 |
# along with this program; if not, you can either send email to this
|
19 |
# along with this program; if not, you can either send email to this
|
| 20 |
# program's maintainer or write to: The Free Software Foundation,
|
20 |
# program's maintainer or write to: The Free Software Foundation,
|
| 21 |
# Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
|
21 |
# Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
|
| 22 |
#
|
22 |
#
|
| 23 |
# Original author: Noah Friedman <friedman@gnu.org>.
|
23 |
# Original author: Noah Friedman.
|
| 24 |
#
|
24 |
#
|
| 25 |
# Please send bug reports, etc. to bug-texinfo@gnu.org.
|
25 |
# Please send bug reports, etc. to bug-texinfo@gnu.org.
|
| 26 |
# If possible, please send a copy of the output of the script called with
|
26 |
# If possible, please send a copy of the output of the script called with
|
| 27 |
# the `--debug' option when making a bug report.
|
27 |
# the `--debug' option when making a bug report.
|
| 28 |
|
28 |
|
| 29 |
# This string is expanded by rcs automatically when this file is checked out.
|
29 |
# This string is expanded by rcs automatically when this file is checked out.
|
| 30 |
rcs_revision='$Revision: 1.4 $'
|
30 |
rcs_revision='$Revision: 1.3 $'
|
| 31 |
rcs_version=`set - $rcs_revision; echo $2`
|
31 |
rcs_version=`set - $rcs_revision; echo $2`
|
| 32 |
program=`echo $0 | sed -e 's!.*/!!'`
|
32 |
program=`echo $0 | sed -e 's!.*/!!'`
|
| 33 |
version="texi2dvi (GNU Texinfo 4.6) $rcs_version
|
33 |
version="texi2dvi (GNU Texinfo 4.7) $rcs_version
|
| 34 |
|
34 |
|
| 35 |
Copyright (C) 2003 Free Software Foundation, Inc.
|
35 |
Copyright (C) 2004 Free Software Foundation, Inc.
|
| 36 |
There is NO warranty. You may redistribute this software
|
36 |
There is NO warranty. You may redistribute this software
|
| 37 |
under the terms of the GNU General Public License.
|
37 |
under the terms of the GNU General Public License.
|
| 38 |
For more information about these matters, see the files named COPYING."
|
38 |
For more information about these matters, see the files named COPYING."
|
| 39 |
|
39 |
|
| 40 |
usage="Usage: $program [OPTION]... FILE...
|
40 |
usage="Usage: $program [OPTION]... FILE...
|
| Line 66... |
Line 66... |
| 66 |
-l, --language=LANG specify the LANG of FILE (LaTeX or Texinfo)
|
66 |
-l, --language=LANG specify the LANG of FILE (LaTeX or Texinfo)
|
| 67 |
-p, --pdf use pdftex or pdflatex for processing
|
67 |
-p, --pdf use pdftex or pdflatex for processing
|
| 68 |
-t, --command=CMD insert CMD in copy of input file;
|
68 |
-t, --command=CMD insert CMD in copy of input file;
|
| 69 |
or --texinfo=CMD multiple values accumulate
|
69 |
or --texinfo=CMD multiple values accumulate
|
| 70 |
|
70 |
|
| 71 |
The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO, TEX
|
71 |
The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO,
|
| 72 |
(or PDFTEX), and TEXINDEX environment variables are used to run those
|
72 |
TEX (or PDFTEX), TEXINDEX, and THUMBPDF environment variables are used
|
| 73 |
commands, if they are set. Any CMD strings are added after @setfilename
|
73 |
to run those commands, if they are set. Any CMD strings are added
|
| 74 |
for Texinfo input, in the first line for LaTeX input.
|
74 |
after @setfilename for Texinfo input, in the first line for LaTeX input.
|
| 75 |
|
75 |
|
| 76 |
Email bug reports to <bug-texinfo@gnu.org>,
|
76 |
Email bug reports to <bug-texinfo@gnu.org>,
|
| 77 |
general questions and discussion to <help-texinfo@gnu.org>.
|
77 |
general questions and discussion to <help-texinfo@gnu.org>.
|
| 78 |
Texinfo home page: http://www.gnu.org/software/texinfo/"
|
78 |
Texinfo home page: http://www.gnu.org/software/texinfo/"
|
| 79 |
|
79 |
|
| Line 92... |
Line 92... |
| 92 |
set_language=
|
92 |
set_language=
|
| 93 |
textra= # Extra TeX commands to insert in the input file.
|
93 |
textra= # Extra TeX commands to insert in the input file.
|
| 94 |
textra_cmd= # sed command to insert TEXTRA where appropriate
|
94 |
textra_cmd= # sed command to insert TEXTRA where appropriate
|
| 95 |
tmpdir=${TMPDIR:-/tmp}/t2d$$ # avoid collisions on 8.3 filesystems.
|
95 |
tmpdir=${TMPDIR:-/tmp}/t2d$$ # avoid collisions on 8.3 filesystems.
|
| 96 |
txincludes= # TEXINPUTS extensions, with trailing colon
|
96 |
txincludes= # TEXINPUTS extensions, with trailing colon
|
| 97 |
txiprereq=19990129 # minimum texinfo.tex version to have macro expansion
|
97 |
txiprereq=19990129 # minimum texinfo.tex version with macro expansion
|
| 98 |
verbose=false # echo for verbose mode
|
98 |
verbose=false # echo for verbose mode
|
| 99 |
|
99 |
|
| 100 |
orig_pwd=`pwd`
|
100 |
orig_pwd=`pwd`
|
| 101 |
|
101 |
|
| 102 |
# Systems which define $COMSPEC or $ComSpec use semicolons to separate
|
102 |
# Systems which define $COMSPEC or $ComSpec use semicolons to separate
|
| Line 111... |
Line 111... |
| 111 |
CDPATH=${ZSH_VERSION+.}$path_sep
|
111 |
CDPATH=${ZSH_VERSION+.}$path_sep
|
| 112 |
|
112 |
|
| 113 |
# In case someone crazy insists on using grep -E.
|
113 |
# In case someone crazy insists on using grep -E.
|
| 114 |
: ${EGREP=egrep}
|
114 |
: ${EGREP=egrep}
|
| 115 |
|
115 |
|
| - |
|
116 |
# return true if program $1 is somewhere in PATH, else false.
|
| - |
|
117 |
#
|
| - |
|
118 |
findprog () {
|
| - |
|
119 |
foundprog=false
|
| - |
|
120 |
for dir in `echo $PATH | tr "$path_sep" " "`; do
|
| - |
|
121 |
if test -x "$dir/$1"; then # does anyone still need test -f?
|
| - |
|
122 |
foundprog=true
|
| - |
|
123 |
break
|
| - |
|
124 |
fi
|
| - |
|
125 |
done
|
| - |
|
126 |
$foundprog
|
| - |
|
127 |
}
|
| - |
|
128 |
|
| - |
|
129 |
# Report an error and exit with failure.
|
| - |
|
130 |
fatal () {
|
| - |
|
131 |
echo "$0: $*" >&2
|
| - |
|
132 |
exit 1
|
| - |
|
133 |
}
|
| - |
|
134 |
|
| 116 |
# Save TEXINPUTS so we can construct a new TEXINPUTS path for each file.
|
135 |
# Save TEXINPUTS so we can construct a new TEXINPUTS path for each file.
|
| 117 |
# Unfortunately bibtex and makeindex do not read TEXINPUTS.
|
136 |
# Likewise for bibtex and makeindex.
|
| 118 |
tex_envvars="BIBINPUTS BSTINPUTS INDEXSTYLE TEXINPUTS"
|
137 |
tex_envvars="BIBINPUTS BSTINPUTS INDEXSTYLE TEXINPUTS"
|
| 119 |
for var in $tex_envvars; do
|
138 |
for var in $tex_envvars; do
|
| 120 |
eval ${var}_orig=\$$var
|
139 |
eval ${var}_orig=\$$var
|
| 121 |
export $var
|
140 |
export $var
|
| 122 |
done
|
141 |
done
|
| 123 |
|
142 |
|
| - |
|
143 |
|
| 124 |
# Push a token among the arguments that will be used to notice when we
|
144 |
# Push a token among the arguments that will be used to notice when we
|
| 125 |
# ended options/arguments parsing.
|
145 |
# ended options/arguments parsing.
|
| 126 |
# Use "set dummy ...; shift" rather than 'set - ..." because on
|
146 |
# Use "set dummy ...; shift" rather than 'set - ..." because on
|
| 127 |
# Solaris set - turns off set -x (but keeps set -e).
|
147 |
# Solaris set - turns off set -x (but keeps set -e).
|
| 128 |
# Use ${1+"$@"} rather than "$@" because Digital Unix and Ultrix 4.3
|
148 |
# Use ${1+"$@"} rather than "$@" because Digital Unix and Ultrix 4.3
|
| Line 205... |
Line 225... |
| 205 |
exit 2
|
225 |
exit 2
|
| 206 |
fi
|
226 |
fi
|
| 207 |
;;
|
227 |
;;
|
| 208 |
esac
|
228 |
esac
|
| 209 |
|
229 |
|
| - |
|
230 |
|
| - |
|
231 |
# We can't do much without tex.
|
| - |
|
232 |
#
|
| - |
|
233 |
if findprog ${TEX:-tex}; then :; else cat <<EOM
|
| - |
|
234 |
You don't have a working TeX binary (${TEX:-tex}) installed anywhere in
|
| - |
|
235 |
your PATH, and texi2dvi cannot proceed without one. If you want to use
|
| - |
|
236 |
this script, you'll need to install TeX (if you don't have it) or change
|
| - |
|
237 |
your PATH or TEX environment variable (if you do). See the --help
|
| - |
|
238 |
output for more details.
|
| - |
|
239 |
|
| - |
|
240 |
For information about obtaining TeX, please see http://www.tug.org. If
|
| - |
|
241 |
you happen to be using Debian, you can get it with this command:
|
| - |
|
242 |
apt-get install tetex-bin
|
| - |
|
243 |
EOM
|
| - |
|
244 |
exit 1
|
| - |
|
245 |
fi
|
| - |
|
246 |
|
| - |
|
247 |
|
| - |
|
248 |
# We want to use etex (or pdftex) if they are available, and the user
|
| - |
|
249 |
# didn't explicitly specify. We don't check for elatex and pdfelatex
|
| - |
|
250 |
# because (as of 2003), the LaTeX team has asked that new distributions
|
| - |
|
251 |
# use etex by default anyway.
|
| - |
|
252 |
#
|
| - |
|
253 |
# End up with the TEX and PDFTEX variables set to what we are going to use.
|
| - |
|
254 |
if test -z "$TEX"; then
|
| - |
|
255 |
if findprog etex; then TEX=etex; else TEX=tex; fi
|
| - |
|
256 |
fi
|
| - |
|
257 |
#
|
| - |
|
258 |
if test -z "$PDFTEX"; then
|
| - |
|
259 |
if findprog pdfetex; then PDFTEX=pdfetex; else PDFTEX=pdftex; fi
|
| - |
|
260 |
fi
|
| - |
|
261 |
|
| - |
|
262 |
|
| 210 |
# Prepare the temporary directory. Remove it at exit, unless debugging.
|
263 |
# Prepare the temporary directory. Remove it at exit, unless debugging.
|
| 211 |
if test -z "$debug"; then
|
264 |
if test -z "$debug"; then
|
| 212 |
trap "cd / && rm -rf $tmpdir" 0 1 2 15
|
265 |
trap "cd / && rm -rf $tmpdir" 0 1 2 15
|
| 213 |
fi
|
266 |
fi
|
| 214 |
|
267 |
|
| 215 |
# Create the temporary directory with strict rights
|
268 |
# Create the temporary directory with strict rights
|
| 216 |
(umask 077 && mkdir $tmpdir) || exit 1
|
269 |
(umask 077 && mkdir $tmpdir) || exit 1
|
| 217 |
|
270 |
|
| 218 |
# Prepare the tools we might need. This may be extra work in some
|
271 |
# Prepare the tools we might need. This may be extra work in some
|
| 219 |
# cases, but improves the readibility of the script.
|
272 |
# cases, but improves the readability of the script.
|
| 220 |
utildir=$tmpdir/utils
|
273 |
utildir=$tmpdir/utils
|
| 221 |
mkdir $utildir || exit 1
|
274 |
mkdir $utildir || exit 1
|
| 222 |
|
275 |
|
| 223 |
# A sed script that preprocesses Texinfo sources in order to keep the
|
276 |
# A sed script that preprocesses Texinfo sources in order to keep the
|
| 224 |
# iftex sections only. We want to remove non TeX sections, and
|
277 |
# iftex sections only. We want to remove non TeX sections, and comment
|
| 225 |
# comment (with `@c texi2dvi') TeX sections so that makeinfo does not
|
278 |
# (with `@c texi2dvi') TeX sections so that makeinfo does not try to
|
| 226 |
# try to parse them. Nevertheless, while commenting TeX sections,
|
279 |
# parse them. Nevertheless, while commenting TeX sections, don't
|
| 227 |
# don't comment @macro/@end macro so that makeinfo does propagate
|
280 |
# comment @macro/@end macro so that makeinfo does propagate them.
|
| 228 |
# them. Unfortunately makeinfo --iftex --no-ifhtml --no-ifinfo
|
281 |
# Unfortunately makeinfo --iftex --no-ifinfo doesn't work well enough
|
| 229 |
# doesn't work well enough (yet) to use that, so work around with sed.
|
282 |
# (yet), makeinfo can't parse the TeX commands, so work around with sed.
|
| - |
|
283 |
#
|
| 230 |
comment_iftex_sed=$utildir/comment.sed
|
284 |
comment_iftex_sed=$utildir/comment.sed
|
| 231 |
cat <<EOF >$comment_iftex_sed
|
285 |
cat <<EOF >$comment_iftex_sed
|
| 232 |
/^@tex/,/^@end tex/{
|
286 |
/^@tex/,/^@end tex/{
|
| 233 |
s/^/@c texi2dvi/
|
287 |
s/^/@c texi2dvi/
|
| 234 |
}
|
288 |
}
|
| Line 236... |
Line 290... |
| 236 |
s/^/@c texi2dvi/
|
290 |
s/^/@c texi2dvi/
|
| 237 |
/^@c texi2dvi@macro/,/^@c texi2dvi@end macro/{
|
291 |
/^@c texi2dvi@macro/,/^@c texi2dvi@end macro/{
|
| 238 |
s/^@c texi2dvi//
|
292 |
s/^@c texi2dvi//
|
| 239 |
}
|
293 |
}
|
| 240 |
}
|
294 |
}
|
| 241 |
/^@html/,/^@end html/{
|
- |
|
| 242 |
s/^/@c (texi2dvi)/
|
- |
|
| 243 |
}
|
- |
|
| 244 |
/^@ifhtml/,/^@end ifhtml/{
|
- |
|
| 245 |
s/^/@c (texi2dvi)/
|
- |
|
| 246 |
}
|
- |
|
| 247 |
/^@ifnottex/,/^@end ifnottex/{
|
295 |
/^@ifnottex/,/^@end ifnottex/{
|
| 248 |
s/^/@c (texi2dvi)/
|
296 |
s/^/@c (texi2dvi)/
|
| 249 |
}
|
297 |
}
|
| 250 |
/^@ifinfo/,/^@end ifinfo/{
|
298 |
/^@ifinfo/,/^@end ifinfo/{
|
| 251 |
/^@node/p
|
299 |
/^@node/p
|
| Line 305... |
Line 353... |
| 305 |
else
|
353 |
else
|
| 306 |
exec 5>&1
|
354 |
exec 5>&1
|
| 307 |
fi
|
355 |
fi
|
| 308 |
|
356 |
|
| 309 |
# Enable tracing
|
357 |
# Enable tracing
|
| 310 |
test "$debug" = t && set -x
|
358 |
if test "$debug" = t; then
|
| - |
|
359 |
exec 6>&1
|
| - |
|
360 |
set -x
|
| - |
|
361 |
else
|
| - |
|
362 |
exec 6>/dev/null
|
| - |
|
363 |
fi
|
| 311 |
|
364 |
|
| 312 |
#
|
365 |
#
|
| 313 |
# TeXify files.
|
366 |
# TeXify files.
|
| 314 |
|
367 |
|
| 315 |
for command_line_filename in ${1+"$@"}; do
|
368 |
for command_line_filename in ${1+"$@"}; do
|
| 316 |
$verbose "Processing $command_line_filename ..."
|
369 |
$verbose "Processing $command_line_filename ..."
|
| 317 |
|
370 |
|
| 318 |
# If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex),
|
371 |
# If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex),
|
| 319 |
# prepend `./' in order to avoid that the tools take it as an option.
|
372 |
# prepend `./' in order to avoid that the tools take it as an option.
|
| 320 |
echo "$command_line_filename" | $EGREP '^(/|[A-z]:/)' >/dev/null \
|
373 |
echo "$command_line_filename" | $EGREP '^(/|[A-z]:/)' >&6 \
|
| 321 |
|| command_line_filename="./$command_line_filename"
|
374 |
|| command_line_filename="./$command_line_filename"
|
| 322 |
|
375 |
|
| 323 |
# See if the file exists. If it doesn't we're in trouble since, even
|
376 |
# See if the file exists. If it doesn't we're in trouble since, even
|
| 324 |
# though the user may be able to reenter a valid filename at the tex
|
377 |
# though the user may be able to reenter a valid filename at the tex
|
| 325 |
# prompt (assuming they're attending the terminal), this script won't
|
378 |
# prompt (assuming they're attending the terminal), this script won't
|
| Line 421... |
Line 474... |
| 421 |
# If the user explicitly specified the language, use that.
|
474 |
# If the user explicitly specified the language, use that.
|
| 422 |
# Otherwise, if the first line is \input texinfo, assume it's texinfo.
|
475 |
# Otherwise, if the first line is \input texinfo, assume it's texinfo.
|
| 423 |
# Otherwise, guess from the file extension.
|
476 |
# Otherwise, guess from the file extension.
|
| 424 |
if test -n "$set_language"; then
|
477 |
if test -n "$set_language"; then
|
| 425 |
language=$set_language
|
478 |
language=$set_language
|
| 426 |
elif sed 1q "$command_line_filename" | grep 'input texinfo' >/dev/null; then
|
479 |
elif sed 1q "$command_line_filename" | grep 'input texinfo' >&6; then
|
| 427 |
language=texinfo
|
480 |
language=texinfo
|
| 428 |
else
|
481 |
else
|
| 429 |
language=
|
482 |
language=
|
| 430 |
fi
|
483 |
fi
|
| 431 |
|
484 |
|
| Line 442... |
Line 495... |
| 442 |
if test $oformat = dvi; then
|
495 |
if test $oformat = dvi; then
|
| 443 |
tex=${LATEX:-latex}
|
496 |
tex=${LATEX:-latex}
|
| 444 |
else
|
497 |
else
|
| 445 |
tex=${PDFLATEX:-pdflatex}
|
498 |
tex=${PDFLATEX:-pdflatex}
|
| 446 |
fi
|
499 |
fi
|
| - |
|
500 |
thumbpdf=${THUMBPDF:-thumbpdf}
|
| 447 |
;;
|
501 |
;;
|
| 448 |
|
502 |
|
| 449 |
*)
|
503 |
*)
|
| 450 |
# Assume a Texinfo file. Texinfo files need makeinfo, texindex and tex.
|
504 |
# Assume a Texinfo file. Texinfo files need makeinfo, texindex and tex.
|
| 451 |
bibtex=
|
505 |
bibtex=
|
| 452 |
texindex=${TEXINDEX:-texindex}
|
506 |
texindex=${TEXINDEX:-texindex}
|
| 453 |
textra_cmd='/^@setfilename/a'
|
507 |
textra_cmd='/^@setfilename/a'
|
| 454 |
if test $oformat = dvi; then
|
508 |
if test $oformat = dvi; then
|
| 455 |
tex=${TEX:-tex}
|
509 |
tex=$TEX
|
| 456 |
else
|
510 |
else
|
| 457 |
tex=${PDFTEX:-pdftex}
|
511 |
tex=$PDFTEX
|
| 458 |
fi
|
512 |
fi
|
| 459 |
# Unless required by the user, makeinfo expansion is wanted only
|
513 |
# Unless required by the user, makeinfo expansion is wanted only
|
| 460 |
# if texinfo.tex is too old.
|
514 |
# if texinfo.tex is too old.
|
| 461 |
if test "$expand" = t; then
|
515 |
if test "$expand" = t; then
|
| 462 |
makeinfo=${MAKEINFO:-makeinfo}
|
516 |
makeinfo=${MAKEINFO:-makeinfo}
|
| Line 464... |
Line 518... |
| 464 |
# Check if texinfo.tex performs macro expansion by looking for
|
518 |
# Check if texinfo.tex performs macro expansion by looking for
|
| 465 |
# its version. The version is a date of the form YEAR-MO-DA.
|
519 |
# its version. The version is a date of the form YEAR-MO-DA.
|
| 466 |
# We don't need to use [0-9] to match the digits since anyway
|
520 |
# We don't need to use [0-9] to match the digits since anyway
|
| 467 |
# the comparison with $txiprereq, a number, will fail with non
|
521 |
# the comparison with $txiprereq, a number, will fail with non
|
| 468 |
# digits.
|
522 |
# digits.
|
| 469 |
txiversion_tex=txiversion.tex
|
- |
|
| 470 |
echo '\input texinfo.tex @bye' >$tmpdir/$txiversion_tex
|
- |
|
| 471 |
# Run in the tmpdir to avoid leaving files.
|
523 |
# Run in the tmpdir to avoid leaving files.
|
| - |
|
524 |
(
|
| 472 |
eval `cd $tmpdir >/dev/null &&
|
525 |
cd $tmpdir
|
| - |
|
526 |
echo '\input texinfo.tex @bye' >txiversion.tex
|
| - |
|
527 |
# Be sure that if tex wants to fail, it is not interactive:
|
| - |
|
528 |
# close stdin.
|
| 473 |
$tex $txiversion_tex 2>/dev/null |
|
529 |
$tex txiversion.tex </dev/null
|
| - |
|
530 |
) >$tmpdir/txiversion.out 2>$tmpdir/txiversion.err
|
| - |
|
531 |
if test $? != 0; then
|
| - |
|
532 |
cat $tmpdir/txiversion.out
|
| - |
|
533 |
cat $tmpdir/txiversion.err >&2
|
| - |
|
534 |
fatal "texinfo.tex appears to be broken, quitting."
|
| - |
|
535 |
fi
|
| 474 |
sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p'`
|
536 |
eval `sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p' $tmpdir/txiversion.out`
|
| 475 |
$verbose "texinfo.tex preloaded as \`$txiformat', version is \`$txiversion' ..."
|
537 |
$verbose "texinfo.tex preloaded as \`$txiformat', version is \`$txiversion' ..."
|
| 476 |
if test "$txiprereq" -le "$txiversion" >/dev/null 2>&1; then
|
538 |
if test "$txiprereq" -le "$txiversion" >/dev/null 2>&1; then
|
| 477 |
makeinfo=
|
539 |
makeinfo=
|
| 478 |
else
|
540 |
else
|
| 479 |
makeinfo=${MAKEINFO:-makeinfo}
|
541 |
makeinfo=${MAKEINFO:-makeinfo}
|
| 480 |
fi
|
542 |
fi
|
| 481 |
# As long as we had to run TeX, offer the user this convenience:
|
543 |
# As long as we had to run TeX, offer the user this convenience:
|
| 482 |
test "$txiformat" = Texinfo && escape=@
|
544 |
test "$txiformat" = Texinfo && escape=@
|
| 483 |
fi
|
545 |
fi
|
| - |
|
546 |
thumbpdf=${THUMBPDF:-thumbpdf}
|
| 484 |
;;
|
547 |
;;
|
| 485 |
esac
|
548 |
esac
|
| 486 |
|
549 |
|
| - |
|
550 |
# Go to $tmpdir to try --help, since old versions that don't accept
|
| - |
|
551 |
# --help will generate a texput.log.
|
| - |
|
552 |
tex_help=`cd $tmpdir >/dev/null && $tex --help </dev/null 2>&1`
|
| - |
|
553 |
|
| 487 |
# If possible, make TeX report error locations in GNU format.
|
554 |
# If possible, make TeX report error locations in GNU format.
|
| 488 |
tex_args=
|
555 |
tex_args=
|
| 489 |
case `$tex --help </dev/null 2>&1` in
|
556 |
case $tex_help in
|
| 490 |
*file-line-error-style*) tex_args='--file-line-error-style';;
|
557 |
*file-line-error-style*) tex_args="$tex_args --file-line-error-style";;
|
| 491 |
esac
|
558 |
esac
|
| 492 |
|
559 |
|
| 493 |
# Tell TeX to be batch if requested. (\batchmode does not show
|
560 |
# Tell TeX to be batch if requested. (\batchmode does not show
|
| 494 |
# terminal output at all, so we don't want that.)
|
561 |
# terminal output at all, so we don't want that.)
|
| 495 |
$batch && tex_args="$tex_args ${escape}nonstopmode ${escape}input"
|
562 |
$batch && tex_args="$tex_args ${escape}nonstopmode ${escape}input"
|
| Line 558... |
Line 625... |
| 558 |
&& test -r "$filename_noext.log" \
|
625 |
&& test -r "$filename_noext.log" \
|
| 559 |
&& (grep '^\\bibdata[{]' "$filename_noext.aux" \
|
626 |
&& (grep '^\\bibdata[{]' "$filename_noext.aux" \
|
| 560 |
&& grep '^\\bibstyle[{]' "$filename_noext.aux" \
|
627 |
&& grep '^\\bibstyle[{]' "$filename_noext.aux" \
|
| 561 |
&& (grep 'Warning:.*Citation.*undefined' "$filename_noext.log" \
|
628 |
&& (grep 'Warning:.*Citation.*undefined' "$filename_noext.log" \
|
| 562 |
|| grep 'No file .*\.bbl\.' "$filename_noext.log")) \
|
629 |
|| grep 'No file .*\.bbl\.' "$filename_noext.log")) \
|
| 563 |
>/dev/null 2>&1; \
|
630 |
>&6 2>&1; \
|
| 564 |
then
|
631 |
then
|
| 565 |
$verbose "Running $bibtex $filename_noext ..."
|
632 |
$verbose "Running $bibtex $filename_noext ..."
|
| 566 |
if $bibtex "$filename_noext" >&5; then :; else
|
633 |
$bibtex "$filename_noext" >&5 ||
|
| 567 |
echo "$0: $bibtex exited with bad status, quitting." >&2
|
634 |
fatal "$bibtex exited with bad status, quitting."
|
| 568 |
exit 1
|
- |
|
| 569 |
fi
|
- |
|
| 570 |
fi
|
635 |
fi
|
| 571 |
|
636 |
|
| 572 |
# What we'll run texindex on -- exclude non-index files.
|
637 |
# What we'll run texindex on -- exclude non-index files.
|
| 573 |
# Since we know index files are last, it is correct to remove everything
|
638 |
# Since we know index files are last, it is correct to remove everything
|
| 574 |
# before .aux and .?o?. But don't really do <anything>o<anything>
|
639 |
# before .aux and .?o?. But don't really do <anything>o<anything>
|
| Line 585... |
Line 650... |
| 585 |
# files don't change, then there's no reason to run TeX again.
|
650 |
# files don't change, then there's no reason to run TeX again.
|
| 586 |
# But we won't know that if the index files are out of date or
|
651 |
# But we won't know that if the index files are out of date or
|
| 587 |
# nonexistent.
|
652 |
# nonexistent.
|
| 588 |
if test -n "$texindex" && test -n "$index_files"; then
|
653 |
if test -n "$texindex" && test -n "$index_files"; then
|
| 589 |
$verbose "Running $texindex $index_files ..."
|
654 |
$verbose "Running $texindex $index_files ..."
|
| 590 |
if $texindex $index_files 2>&5 1>&2; then :; else
|
655 |
$texindex $index_files 2>&5 1>&2 ||
|
| 591 |
echo "$0: $texindex exited with bad status, quitting." >&2
|
656 |
fatal "$texindex exited with bad status, quitting."
|
| 592 |
exit 1
|
- |
|
| 593 |
fi
|
- |
|
| 594 |
fi
|
657 |
fi
|
| 595 |
|
658 |
|
| 596 |
# Finally, run TeX.
|
659 |
# Finally, run TeX.
|
| 597 |
cmd="$tex $tex_args $filename_input"
|
660 |
cmd="$tex $tex_args $filename_input"
|
| 598 |
$verbose "Running $cmd ..."
|
661 |
$verbose "Running $cmd ..."
|
| Line 611... |
Line 674... |
| 611 |
# LaTeX (and the package changebar) report in the LOG file if it
|
674 |
# LaTeX (and the package changebar) report in the LOG file if it
|
| 612 |
# should be rerun. This is needed for files included from
|
675 |
# should be rerun. This is needed for files included from
|
| 613 |
# subdirs, since texi2dvi does not try to compare xref files in
|
676 |
# subdirs, since texi2dvi does not try to compare xref files in
|
| 614 |
# subdirs. Performing xref files test is still good since LaTeX
|
677 |
# subdirs. Performing xref files test is still good since LaTeX
|
| 615 |
# does not report changes in xref files.
|
678 |
# does not report changes in xref files.
|
| 616 |
if grep "Rerun to get" "$filename_noext.log" >/dev/null 2>&1; then
|
679 |
if grep "Rerun to get" "$filename_noext.log" >&6 2>&1; then
|
| 617 |
finished=
|
680 |
finished=
|
| 618 |
fi
|
681 |
fi
|
| 619 |
|
682 |
|
| 620 |
# Check if xref files changed.
|
683 |
# Check if xref files changed.
|
| 621 |
new_xref_files=`$get_xref_files "$filename_noext"`
|
684 |
new_xref_files=`$get_xref_files "$filename_noext"`
|
| Line 644... |
Line 707... |
| 644 |
done
|
707 |
done
|
| 645 |
fi
|
708 |
fi
|
| 646 |
|
709 |
|
| 647 |
# If finished, exit the loop, else rerun the loop.
|
710 |
# If finished, exit the loop, else rerun the loop.
|
| 648 |
test -n "$finished" && break
|
711 |
test -n "$finished" && break
|
| - |
|
712 |
done # while :;
|
| - |
|
713 |
|
| - |
|
714 |
# If we were using thumbpdf and producing PDF, then run thumbpdf
|
| - |
|
715 |
# and TeX one last time.
|
| - |
|
716 |
if test $oformat = pdf \
|
| - |
|
717 |
&& test -r "$filename_noext.log" \
|
| - |
|
718 |
&& grep 'thumbpdf\.sty' "$filename_noext.log" >&6 2>&1; \
|
| 649 |
done
|
719 |
then
|
| - |
|
720 |
$verbose "Running $thumbpdf $filename_noext ..."
|
| - |
|
721 |
$thumbpdf "$filename_noext" >&5 ||
|
| - |
|
722 |
fatal "$thumbpdf exited with bad status, quitting."
|
| - |
|
723 |
|
| - |
|
724 |
$verbose "Running $cmd ..."
|
| - |
|
725 |
if $cmd >&5; then :; else
|
| - |
|
726 |
echo "$0: $tex exited with bad status, quitting." >&2
|
| - |
|
727 |
echo "$0: see $filename_noext.log for errors." >&2
|
| - |
|
728 |
test "$clean" = t \
|
| - |
|
729 |
&& cp "$filename_noext.log" "$orig_pwd"
|
| - |
|
730 |
exit 1
|
| - |
|
731 |
fi
|
| - |
|
732 |
fi
|
| - |
|
733 |
|
| 650 |
|
734 |
|
| 651 |
# If we were in clean mode, compilation was in a tmp directory.
|
735 |
# If we were in clean mode, compilation was in a tmp directory.
|
| 652 |
# Copy the DVI (or PDF) file into the directory where the compilation
|
736 |
# Copy the DVI (or PDF) file into the directory where the compilation
|
| 653 |
# has been done. (The temp dir is about to get removed anyway.)
|
737 |
# has been done. (The temp dir is about to get removed anyway.)
|
| 654 |
# We also return to the original directory so that
|
738 |
# We also return to the original directory so that
|
| Line 672... |
Line 756... |
| 672 |
cd /
|
756 |
cd /
|
| 673 |
rm -rf $tmpdir_src $tmpdir_xtr $tmpdir_bak
|
757 |
rm -rf $tmpdir_src $tmpdir_xtr $tmpdir_bak
|
| 674 |
fi
|
758 |
fi
|
| 675 |
done
|
759 |
done
|
| 676 |
|
760 |
|
| 677 |
$verbose "$0 done."
|
761 |
$verbose "$0: done."
|
| 678 |
exit 0 # exit successfully, not however we ended the loop.
|
762 |
exit 0 # exit successfully, not however we ended the loop.
|