bug-texinfo
[Top][All Lists]
Advanced

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

texi2dvi: -t and LaTeX


From: Akim Demaille
Subject: texi2dvi: -t and LaTeX
Date: Wed, 07 May 2003 10:44:43 +0200
User-agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3 (gnu/linux)

In the generation of documents with different aspects, I found it most
useful to have something comparable to -t for LaTeX input.  I'm using
the following patch with success.

Thanks!

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * util/texi2dvi (textra_cmd): New.
        (textra): Escape escapes from sed's evaluation.
        Use them to support additional TeX/LaTeX commands.
        Support --command as a synonym for --texinfo.

Index: util/texi2dvi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi,v
retrieving revision 1.16
diff -u -u -r1.16 texi2dvi
--- util/texi2dvi 5 Apr 2003 01:06:09 -0000 1.16
+++ util/texi2dvi 7 May 2003 08:40:59 -0000
@@ -65,12 +65,13 @@
   -I DIR               search DIR for Texinfo files
   -l, --language=LANG  specify the LANG of FILE (LaTeX or Texinfo)
   -p, --pdf            use pdftex or pdflatex for processing
-  -t, --texinfo=CMD    insert CMD after @setfilename in copy of input file
+  -t, --command=CMD    insert CMD in copy of input file
                        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.
+those commands, if they are set.  CMD are added after @setfilename
+for Texinfo input, otherwise in the first line.

 Email bug reports to <address@hidden>,
 general questions and discussion to <address@hidden>.
@@ -89,7 +90,8 @@
 oname=          # --output
 quiet=          # by default let the tools' message be displayed
 set_language=
-textra=
+textra=         # Extra TeX commands to insert in the input file.
+textra_cmd=     # sed command to insert TEXTRA where appropriate
 tmpdir=${TMPDIR:-/tmp}/t2d$$  # avoid collisions on 8.3 filesystems.
 txincludes=     # TEXINPUTS extensions, with trailing colon
 txiprereq=19990129 # minimum texinfo.tex version to have macro expansion
@@ -165,8 +167,8 @@
                 *) oname="$orig_pwd/$1";;
       esac;;
     -p | --p*) oformat=pdf;;
-    -t | --t*) shift; textra="$textra\\
-$1";;
+    -t | --tex* | --com* ) shift; textra="$textra\\
+"`echo "$1" | sed 's/\\\\/\\\\\\\\/g'`;;
     -v | --vers*) echo "$version"; exit 0;;
     -V | --verb*) verbose=echo;;
     --) # What remains are not options.
@@ -432,6 +434,7 @@
       bibtex=${BIBTEX:-bibtex}
       makeinfo= # no point in running makeinfo on latex source.
       texindex=${MAKEINDEX:-makeindex}
+      textra_cmd=1i
       if test $oformat = dvi; then
         tex=${LATEX:-latex}
       else
@@ -443,6 +446,7 @@
       # Assume a Texinfo file.  Texinfo files need makeinfo, texindex and tex.
       bibtex=
       texindex=${TEXINDEX:-texindex}
+      textra_cmd='/address@hidden/a'
       if test $oformat = dvi; then
         tex=${TEX:-tex}
       else
@@ -501,8 +505,8 @@
   # Used most commonly for @finalout, @smallbook, etc.
   if test -n "$textra"; then
     $verbose "Inserting extra commands: $textra"
-    sed '/address@hidden/a\
-'"$textra" "$filename_input" >$filename_xtr
+    sed "$textra_cmd\\
+$textra" "$filename_input" >$filename_xtr
     filename_input=$filename_xtr
   fi




reply via email to

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