I am working on a project where a version control identifier is extracted through the \write18 mechanism and added to the output.

This particular problem may of course be solved in other ways, for instance extracting the identifier and adding it to the input stream before the main document or setting the LATEX environment variable.

However, a really easy solution, is to allow texi2dvi to pass the
shell-escape option to the TeX processor, in the same way src-specials currently is. Thus, it is available more or less as a drop-in replacement for the "latex" command.

Attached is a patch for such functionality against CVS revision 1.159 of file texinfo/util/texi2dvi. Consider copyleft to be assigned to the FSF.

Yours sincerely,

   Roland Kaufmann
--- texi2dvi.orig	2010-09-06 21:40:58.479818378 +0200
+++ texi2dvi	2010-09-06 22:16:24.169821285 +0200
@@ -58,6 +58,7 @@
 recode=false
 set_language=
 src_specials=
+shell_escape=
 latex2html=hevea  # or set to tex4ht
 textra=         # Extra TeX commands to insert in the input file.
 txiprereq=19990129 # minimum texinfo.tex version with macro expansion
@@ -331,6 +332,7 @@
       --no-line-error        do not pass --file-line-error to TeX
   -r, --recode               call recode before TeX to translate input
       --recode-from=ENC      recode from ENC to the @documentencoding
+      --shell-escape         pass --shell-escape to TeX
       --src-specials         pass --src-specials to TeX
   -t, --command=CMD          insert CMD in copy of input file
    or --texinfo=CMD          multiple values accumulate
@@ -987,6 +989,9 @@
   # source, given a sufficiently smart editor), if specified.
   test -n "$src_specials" && cmd="$cmd $src_specials"
 
+  # Tell TeX to allow running external executables
+  test -n "$shell_escape" && cmd="$cmd $shell_escape"
+
   # Tell TeX to be batch if requested.
   if $batch; then
     # \batchmode does not show terminal output at all, so we don't
@@ -1699,6 +1704,7 @@
     -r | --recode) recode=true;;
     --recode-from) shift; recode=true; recode_from="$1";;
     --src-specials) src_specials=--src-specials;;
+    --shell-escape) shell_escape=--shell-escape;;  
     --tex4ht) latex2html=tex4ht;;
     -t | --texinfo | --command ) shift; textra="$textra\\
 "`echo "$1" | sed 's/\\\\/\\\\\\\\/g'`;;

Reply via email to