bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

texi2dvi: thumbpdf support


From: Akim Demaille
Subject: texi2dvi: thumbpdf support
Date: Mon, 30 Jun 2003 13:00:24 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

The following patch adds thumbpdf support to texi2dvi.  I have not
made it optional (--thumb), since anyway if the author of the document
has added thumbpdf.sty to the document, she is certainly willing to
have them.  Sure, it is adding a significant delay to the whole
process (running thumbpdf means running gs, plus an additional tex
pass), but PDF is not, I think, the right format for draft: DVI is.

There is something strongly unpleasant in this patch: code
duplication.  That's because I observed the texi2dvi convention that
shell functions are not portable.  I believe it is absolutely safe for
Texinfo to drop this obsolete requirement.  I'll refactor with a great
please if there's a go for shell functions.

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * util/texi2dvi: Add thumbpdf support.

Index: util/texi2dvi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi,v
retrieving revision 1.23
diff -u -u -r1.23 texi2dvi
--- util/texi2dvi 10 Jun 2003 20:50:03 -0000 1.23
+++ util/texi2dvi 30 Jun 2003 10:51:35 -0000
@@ -68,10 +68,10 @@
   -t, --command=CMD    insert CMD in copy of input file;
    or --texinfo=CMD    multiple values accumulate
 
-The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO, TEX
-(or PDFTEX), and TEXINDEX environment variables are used to run those
-commands, if they are set.  Any CMD strings are added after @setfilename
-for Texinfo input, in the first line for LaTeX input.
+The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO,
+TEX (or PDFTEX), TEXINDEX, and THUMBPDF environment variables are used
+to run those commands, if they are set.  Any CMD strings are added
+after @setfilename for Texinfo input, in the first line for LaTeX input.
 
 Email bug reports to <address@hidden>,
 general questions and discussion to <address@hidden>.
@@ -444,6 +444,7 @@
       else
         tex=${PDFLATEX:-pdflatex}
       fi
+      thumbpdf=${THUMBPDF:-thumbpdf}
       ;;
 
     *)
@@ -481,6 +482,7 @@
         # As long as we had to run TeX, offer the user this convenience:
         test "$txiformat" = Texinfo && escape=@
       fi
+      thumbpdf=${THUMBPDF:-thumbpdf}
       ;;
   esac
 
@@ -646,7 +648,29 @@
 
     # If finished, exit the loop, else rerun the loop.
     test -n "$finished" && break
-  done
+  done # while :;
+
+  # If we were using thumbpdf and producing PDF, then run thumbpdf
+  # and TeX one last time.
+  if test $oformat = pdf \
+     && test -r "$filename_noext.log" \
+     && grep 'thumbpdf\.sty'  "$filename_noext.log" >&6 2>&1; \
+  then
+    $verbose "Running $thumbpdf $filename_noext ..."
+    if $thumbpdf "$filename_noext" >&5; then :; else
+      echo "$0: $thumbpdf exited with bad status, quitting." >&2
+      exit 1
+    fi
+    $verbose "Running $cmd ..."
+    if $cmd >&5; then :; else
+      echo "$0: $tex exited with bad status, quitting." >&2
+      echo "$0: see $filename_noext.log for errors." >&2
+      test "$clean" = t \
+       && cp "$filename_noext.log" "$orig_pwd"
+      exit 1
+    fi
+  fi
+
 
   # If we were in clean mode, compilation was in a tmp directory.
   # Copy the DVI (or PDF) file into the directory where the compilation




reply via email to

[Prev in Thread] Current Thread [Next in Thread]