help-texinfo
[Top][All Lists]
Advanced

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

Re: [help-texinfo] texi2dvi: AUC-TeX and depots


From: Akim Demaille
Subject: Re: [help-texinfo] texi2dvi: AUC-TeX and depots
Date: Mon, 26 Sep 2005 09:39:58 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

>>> "Karl" == Karl Berry <address@hidden> writes:

 > Could I ask you a favor and make a little patch for texinfo.txi to
 > add pdftexi2dvi to the dir entries and mention it in the relevant
 > node, and build the man page in doc/Makefile.am?  I know it's easy,
 > but I am buried right now.

Sure.

There are other features I would like to put in texi2dvi (you bet!),
and to ease their implementation, I think it is time to factor some
code as functions.  There are two issues I have to cover (later
please!):

- I'm pretty confident in the portability of `return', but anyway
  that's easy to workaround
- I have no idea about `local'

I will ask to knowledge people (Dr. Autoconf List & Pr. Libtool List)
what they think about it.

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * doc/texinfo.txi: Document pdftexi2dvi.
        * doc/Makefile.am (common_texi2dvi_deps): New.
        Handle texi2pdf and pdftexi2dvi.
        * util/texi2dvi (get_xref_files): Rename as...
        (xref_files_get): this.
        (xref_files_changed, xref_files_save): New.
        (run_tex_suite): New.
        (move_to_dest): Use `local'.
        ($textra_cmd): Compute it in...
        (insert_commands): here.


        <ulink>, but we need to explicitly escape expansion of addr.
        to use it.
        8 Dec 2004 17:15:17 +0100.


        (iso8859_15_map): new global.

        as this is the default when processing texinfo files.

        Report from: Prof Brian Ripley <address@hidden>,
        * info/filesys.c (extract_colon_unit): Clean up handling of the
        10 Jul 2004 15:36:40 +0200.
        file; don't just insert_string.
        * makeinfo/xref.c (cm_email, cm_uref, et al.):
        Report from: John Blevin <address@hidden>,



        strcasecmp.(gl_STRCASE): call this ...
        instead of checking document_encoding_code.

        skipping any non-digit characters.
        (main): make use of new functions for -I and -P options.
        * makeinfo/lang.c (cm_documentencoding): insert encoding attribute

        Report from: Jesper Harder <address@hidden>,
        float_type.  For HTML, used an <ul> block.
        * makeinfo/float.c (cm_listoffloats):
        line numbers in all of the indices,


        txi-tr.tex: The same.



















        argument; call \writetocentry and \donoderef.
        From: ezra peisach <address@hidden>,


Index: doc/Makefile.am
===================================================================
RCS file: /cvsroot/texinfo/texinfo/doc/Makefile.am,v
retrieving revision 1.29
diff -u -u -r1.29 Makefile.am
--- doc/Makefile.am 17 Aug 2005 12:43:06 -0000 1.29
+++ doc/Makefile.am 26 Sep 2005 07:35:40 -0000
@@ -27,7 +27,7 @@
 
 TXI_XLATE = txi-cs.tex txi-de.tex txi-en.tex txi-es.tex txi-fr.tex \
            txi-it.tex txi-nl.tex txi-no.tex txi-pl.tex txi-pt.tex \
-           txi-sr.tex txi-tr.tex 
+           txi-sr.tex txi-tr.tex
 
 # Include our texinfo.tex, not Automake's.
 EXTRA_DIST = epsf.tex pdfcolor.tex texinfo.tex \
@@ -97,12 +97,23 @@
        mv $@ address@hidden
        sed '/^\.IP$$/N;/\nAlso/s/I//;/\nThe/s/I//' address@hidden >$@
        rm address@hidden
-       
+
 $(srcdir)/texindex.1: $(top_srcdir)/util/texindex.c $(common_mandeps)
        @name="sort Texinfo index files" && $(man_rule_bin)
 
-$(srcdir)/texi2dvi.1: $(top_srcdir)/util/texi2dvi $(common_mandeps)
-       $(HELP2MAN) --name="print Texinfo documents" 
$(top_srcdir)/util/texi2dvi >$@
+
+common_texi2dvi_deps =                                 \
+$(common_mandeps)                                      \
+$(top_srcdir)/util/texi2dvi $(top_srcdir)/util/texi2pdf
+
+$(srcdir)/texi2dvi.1: $(common_texi2dvi_deps)
+       $(HELP2MAN) --name="convert Texinfo documents to DVI" 
$(top_srcdir)/util/texi2dvi >$@
+
+$(srcdir)/texi2pdf.1: $(common_texi2dvi_deps)
+       $(HELP2MAN) --name="convert Texinfo documents to PDF" 
$(top_srcdir)/util/texi2pdf >$@
+
+$(srcdir)/pdftexi2dvi.1:  $(common_texi2dvi_deps)
+       $(HELP2MAN) --name="convert Texinfo documents to PDF" 
$(top_srcdir)/util/pdftexi2dvi >$@
 
 # Do not create info files for distribution.
 dist-info:
Index: doc/texinfo.txi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/doc/texinfo.txi,v
retrieving revision 1.148
diff -u -u -r1.148 texinfo.txi
--- doc/texinfo.txi 19 Sep 2005 12:50:54 -0000 1.148
+++ doc/texinfo.txi 26 Sep 2005 07:35:41 -0000
@@ -60,6 +60,7 @@
 * install-info: (texinfo)Invoking install-info. Update info/dir entries.
 * texi2dvi: (texinfo)Format with texi2dvi.      Print Texinfo documents.
 * texi2pdf: (texinfo)PDF Output.                PDF output for Texinfo.
+* pdftexi2dvi: (texinfo)PDF Output.             PDF output for Texinfo.
 * texindex: (texinfo)Format with tex/texindex.  Sort Texinfo index files.
 * makeinfo: (texinfo)Invoking makeinfo.         Translate Texinfo source.
 @end direntry
@@ -7433,7 +7434,7 @@
 Info output, the argument is printed as-is.  In either format, if the
 second argument is present, it is printed in parentheses after the
 acronym.  In HTML, Docbook, and XML, the @code{<acronym>} tag is
-used.  
+used.
 
 For instance (since GNU is a recursive acronym, we use
 @code{@@acronym} recursively):
@@ -9149,7 +9150,7 @@
 In Texinfo, all floats are numbered the same way: with the chapter
 number (or appendix letter), a period, and the float number, which
 simply counts 1, 2, 3, @dots{}, and is reset at each chapter.  Each
-float type is counted independently.  
+float type is counted independently.
 
 Floats within an @code{@@unnumbered} are numbered, or outside of any
 chapter, are simply numbered consecutively from 1.
@@ -9315,7 +9316,7 @@
 For @TeX{} output, if an image is the first thing in a paragraph, for
 example if you want two images side-by-side, you must precede it with
 @code{@@noindent} (@pxref{noindent,,@code{@@noindent}}).  Otherwise it
-will be displayed on a line by itself.  If you want it centered, 
+will be displayed on a line by itself.  If you want it centered,
 use @code{@@center} (@pxref{titlefont center sp,,@code{@@titlefont
 @@center @@sp}}).
 
@@ -9956,7 +9957,7 @@
 
 The @code{@@defcodeindex} is like the @code{@@defindex} command,
 except that, in the printed output, it prints entries in an
address@hidden@@code} font by default instead of a roman font.  
address@hidden@@code} font by default instead of a roman font.
 
 You should define new indices before the end-of-header line of a
 Texinfo file, and (of course) before any @code{@@synindex} or
@@ -14242,7 +14243,10 @@
 With the @option{--pdf} option, @command{texi2dvi} produces PDF output
 instead of DVI (@pxref{PDF Output}), by running @command{pdftex}
 instead of @command{tex}.  Alternatively, the command
address@hidden is an abbreviation for running @samp{texi2dvi --pdf}.
address@hidden is an abbreviation for running @samp{texi2dvi
+--pdf}.  The command @command{pdftexi2dvi} is also supported as a
+convenience to address@hidden users, since the latter merely prepends
address@hidden to DVI producing tools to have PDF producing tools.
 
 @cindex @LaTeX{}, processing with @command{texi2dvi}
 @command{texi2dvi} can also be used to process @LaTeX{} files; simply
@@ -14919,12 +14923,12 @@
 
 @pindex pdftex
 The simplest way to generate PDF output from Texinfo source is to run
-the convenience script @command{texi2pdf}; this simply executes the
address@hidden script with the @option{--pdf} option
-(@pxref{Format with texi2dvi}).  If for some reason you want to
-process by hand, simply run the @command{pdftex} program instead of
-plain @command{tex}.  That is, run @samp{pdftex foo.texi} instead of
address@hidden foo.texi}.
+the convenience script @command{texi2pdf} (or @command{pdftexi2dvi});
+this simply executes the @command{texi2dvi} script with the
address@hidden option (@pxref{Format with texi2dvi}).  If for some
+reason you want to process by hand, simply run the @command{pdftex}
+program instead of plain @command{tex}.  That is, run @samp{pdftex
+foo.texi} instead of @samp{tex foo.texi}.
 
 @dfn{PDF} stands for `Portable Document Format'. It was invented by
 Adobe Systems some years ago for document interchange, based on their
@@ -15217,7 +15221,7 @@
 For the specified format, process @samp{@@address@hidden and
 @samp{@@@var{format}} commands even if not generating the given output
 format.  For instance, if @option{--iftex} is specified, then
address@hidden@@iftex} and @samp{@@tex} blocks will be read.  
address@hidden@@iftex} and @samp{@@tex} blocks will be read.
 
 @item address@hidden
 @itemx -E @var{file}
@@ -16250,7 +16254,7 @@
 When splitting, the HTML output files are written into a subdirectory,
 with the name chosen as follows:
 @enumerate
address@hidden 
address@hidden
 @command{makeinfo} first tries the subdirectory with the base name
 from @code{@@setfilename} (that is, any extension is removed).  For
 example, HTML output for @code{@@setfilename gcc.info} would be
@@ -16287,7 +16291,7 @@
 @uref{http://www.w3.org/Style/CSS/}.
 
 By default, @command{makeinfo} includes a few simple CSS commands to
-better implement the appearance of some of the environments.  Here 
+better implement the appearance of some of the environments.  Here
 are two of them, as an example:
 
 @example
@@ -16562,7 +16566,7 @@
 @end itemize
 
 On case-folding computer systems, nodes differing only by case will be
-mapped to the same file.  
+mapped to the same file.
 
 In particular, as mentioned above, Top always maps to the file
 @file{index.html}.  Thus, on a case-folding system, Top and a node
@@ -16772,9 +16776,9 @@
 texinfo split http://www.gnu.org/software/texinfo/manual/texinfo/html_node/
 texinfo mono http://www.gnu.org/software/texinfo/manual/texinfo/texinfo.html
 
-If the keyword is 'split', that is the target is split, the urlprefix gives 
+If the keyword is 'split', that is the target is split, the urlprefix gives
 the directory and host name.
-If the keyword is 'mono', that is the target is mono, the urlprefix gives 
+If the keyword is 'mono', that is the target is mono, the urlprefix gives
 directory, host and file name.
 
 '#' followed by a space begins comments. '#' followed by another character
Index: util/texi2dvi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi,v
retrieving revision 1.62
diff -u -u -r1.62 texi2dvi
--- util/texi2dvi 23 Sep 2005 00:05:45 -0000 1.62
+++ util/texi2dvi 26 Sep 2005 07:35:41 -0000
@@ -147,7 +147,6 @@
 recode=false
 set_language=
 textra=         # Extra TeX commands to insert in the input file.
-textra_cmd=     # sed command to insert TEXTRA where appropriate
 txincludes=     # TEXINPUTS extensions, with trailing colon
 txiprereq=19990129 # minimum texinfo.tex version with macro expansion
 verb=false      # true for verbose mode
@@ -266,36 +265,6 @@
 done
 
 
-# get_xref_files FILENAME-NOEXT
-# -----------------------------
-# Compute the list of xref files (indexes, tables and lists).
-get_xref_files ()
-{
-  if $tidy; then
-    # In a tidy build, all the files around as actual outputs.
-    ls * 2>/dev/null
-  else
-    # Find all files having root filename with a two-letter extension,
-    # saves the ones that are really Texinfo-related files.
-    # - .?o?
-    #   .toc, .log, LaTeX tables and lists, FiXme's .lox, maybe more.
-    # - bu[0-9]*.aux
-    #   Sub bibliography when using the LaTeX bibunits package.
-    ls "$1".?o? "$1".aux bu[0-9]*.aux "$1".?? "$1".idx 2>/dev/null
-  fi |
-  while read file; do
-    # If the file is not suitable to be an index or xref file, don't
-    # process it.  It's suitable if the first character is a
-    # backslash or right quote or at, as long as the first line isn't
-    # \input texinfo.
-    case `sed '1q' $file` in
-      "\\input texinfo"*) ;;
-      [\\''@]*) echo "./$file";;
-    esac
-  done
-}
-
-
 # get_index_files FILE1 FILE2...
 # ------------------------------
 # Select the files that are indexes to run texindex/makeindex onto.
@@ -351,10 +320,11 @@
 # file with the same base name.
 move_to_dest ()
 {
-  _file_noext=`echo "$1" | sed 's/\.[^.]*$//'`
-  _file_ext=`echo "$1" | sed 's/^.*\.//'`
-  _out_noext=`echo "$oname" | sed 's/\.[^.]*$//'`
-  _out_ext=`echo "$oname" | sed 's/^.*\.//'`
+  local _file_noext=`echo "$1" | sed 's/\.[^.]*$//'`
+  local _file_ext=`echo "$1" | sed 's/^.*\.//'`
+  local _out_noext=`echo "$oname" | sed 's/\.[^.]*$//'`
+  local _out_ext=`echo "$oname" | sed 's/^.*\.//'`
+  local _dest
 
   case $tidy:$oname in
     true:)  _dest=$orig_pwd;;
@@ -371,6 +341,90 @@
 }
 
 
+## --------------------- ##
+## Managing xref files.  ##
+## --------------------- ##
+
+
+# xref_files_get FILENAME-NOEXT
+# -----------------------------
+# Compute the list of xref files (indexes, tables and lists).
+xref_files_get ()
+{
+  if $tidy; then
+    # In a tidy build, all the files around as actual outputs.
+    ls * 2>/dev/null
+  else
+    # Find all files having root filename with a two-letter extension,
+    # saves the ones that are really Texinfo-related files.
+    # - .?o?
+    #   .toc, .log, LaTeX tables and lists, FiXme's .lox, maybe more.
+    # - bu[0-9]*.aux
+    #   Sub bibliography when using the LaTeX bibunits package.
+    ls "$1".?o? "$1".aux bu[0-9]*.aux "$1".?? "$1".idx 2>/dev/null
+  fi |
+  while read file; do
+    # If the file is not suitable to be an index or xref file, don't
+    # process it.  It's suitable if the first character is a
+    # backslash or right quote or at, as long as the first line isn't
+    # \input texinfo.
+    case `sed '1q' $file` in
+      "\\input texinfo"*) ;;
+      [\\''@]*) echo "./$file";;
+    esac
+  done
+}
+
+# xref_files_save
+# ---------------
+# Save the xref files.
+xref_files_save ()
+{
+  # Save copies of auxiliary files for later comparison.
+  xref_files_orig=`xref_files_get  "$filename_noext"`
+  if test -n "$xref_files_orig"; then
+    verbose "Backing up xref files: $xref_files_orig"
+    cp $xref_files_orig "$work_bak"
+  fi
+}
+
+
+# xref_files_changed
+# ------------------
+# Whether the xref files were changed since the previous run.
+xref_files_changed ()
+{
+  # LaTeX (and the package changebar) report in the LOG file if it
+  # should be rerun.  This is needed for files included from
+  # subdirs, since texi2dvi does not try to compare xref files in
+  # subdirs.  Performing xref files test is still good since LaTeX
+  # does not report changes in xref files.
+  grep "Rerun to get" "$filename_noext.log" >&6 2>&1 &&
+    return 0
+
+  # If old and new lists don't at least have the same file list,
+  # then one file or another has definitely changed.
+  xref_files_new=`xref_files_get  "$filename_noext"`
+  verbose "Original xref files = $xref_files_orig"
+  verbose "New xref files      = $xref_files_new"
+  test "x$xref_files_orig" != "x$xref_files_new" &&
+    return 0
+
+  # Compare each file until we find a difference.
+  for this_file in $xref_files_new; do
+    verbose "Comparing xref file `echo $this_file | sed 's|\./||g'` ..."
+    # cmp -s returns nonzero exit status if files differ.
+    if cmp -s "$this_file" "$work_bak/$this_file"; then :; else
+      verbose "xref file `echo $this_file | sed 's|\./||g'` differed ..."
+      $debug && diff -u "$work_bak/$this_file" "$this_file"
+      return 0
+    fi
+  done
+
+  # No change.
+  return 1
+}
+
 ## ----------------------- ##
 ## Running the TeX suite.  ##
 ## ----------------------- ##
@@ -507,7 +561,7 @@
     latex)   texindex=${MAKEINDEX:-makeindex};;
     texinfo) texindex=${TEXINDEX:-texindex};;
   esac
-  index_files=`get_index_files $orig_xref_files`
+  index_files=`get_index_files $xref_files_orig`
   if test -n "$texindex" && test -n "$index_files"; then
     verbose "Running $texindex $index_files ..."
     $texindex $index_files 2>&5 1>&2 ||
@@ -536,6 +590,32 @@
 }
 
 
+# run_tex_suite
+# -------------
+# Run the TeX tools until a fix point is reached.
+run_tex_suite ()
+{
+  # Count the number of cycles.
+  cycle=0
+
+  while :; do
+    cycle=`expr $cycle + 1`
+    verbose "Cycle $cycle for $command_line_filename"
+
+    xref_files_save
+
+    run_bibtex
+    run_index
+    run_tex
+
+    xref_files_changed || break
+  done
+
+  # If we were using thumbpdf and producing PDF, then run thumbpdf
+  # and TeX one last time.
+  run_thumbpdf
+}
+
 ## -------------------------------- ##
 ## TeX processing auxiliary tools.  ##
 ## -------------------------------- ##
@@ -650,6 +730,12 @@
 # Used most commonly for @finalout, @smallbook, etc.
 insert_commands ()
 {
+  local textra_cmd
+  case language in
+    latex)   textra_cmd=1i;;
+    texinfo) textra_cmd='/address@hidden/a';;
+  esac
+
   if test -n "$textra"; then
     # _xtr.  The file with the user's extra commands.
     work_xtr=$workdir/xtr
@@ -691,6 +777,7 @@
   fi
 }
 
+
 ## ---------------------- ##
 ## Command line parsing.  ##
 ## ---------------------- ##
@@ -889,7 +976,6 @@
   # though the user may be able to reenter a valid filename at the tex
   # prompt (assuming they're attending the terminal), this script won't
   # be able to find the right xref files and so forth.
-  pwd
   if test ! -r "$command_line_filename"; then
     report "cannot read $command_line_filename, skipping."
     continue
@@ -982,16 +1068,10 @@
   # we just guessed, or from the file extension if not set yet.
   case ${language:-$filename_ext} in
     [lL]a[tT]e[xX] | *.ltx | *.tex | *.drv | *.dtx)
-      # Assume a LaTeX file.  LaTeX needs bibtex and uses latex for
-      # compilation.  No makeinfo.
       language=latex
-      textra_cmd=1i
       ;;
-
     *)
-      # Assume a Texinfo file.
       language=texinfo
-      textra_cmd='/address@hidden/a'
       ;;
   esac
 
@@ -1004,64 +1084,14 @@
   # --recode
   run_recode
 
-  # Count the number of cycles.
-  cycle=0
-
   # Move to the working directory.
   if $tidy; then
     verbose "cd $work_build"
     cd "$work_build" || exit 1
   fi
 
-  while :; do # will break out of loop below
-    cycle=`expr $cycle + 1`
-    verbose "Cycle $cycle for $command_line_filename"
-
-    # Save copies of auxiliary files for later comparison.
-    orig_xref_files=`get_xref_files  "$filename_noext"`
-    if test -n "$orig_xref_files"; then
-      verbose "Backing up xref files: $orig_xref_files"
-      cp $orig_xref_files "$work_bak"
-    fi
-
-    run_bibtex
-    run_index
-    run_tex
-
-    # LaTeX (and the package changebar) report in the LOG file if it
-    # should be rerun.  This is needed for files included from
-    # subdirs, since texi2dvi does not try to compare xref files in
-    # subdirs.  Performing xref files test is still good since LaTeX
-    # does not report changes in xref files.
-    grep "Rerun to get" "$filename_noext.log" >&6 2>&1 &&
-      continue
-
-    # If old and new lists don't at least have the same file list,
-    # then one file or another has definitely changed.
-    new_xref_files=`get_xref_files  "$filename_noext"`
-    verbose "Original xref files = $orig_xref_files"
-    verbose "New xref files      = $new_xref_files"
-    test "x$orig_xref_files" != "x$new_xref_files" &&
-      continue
-
-    # Compare each file until we find a difference.
-    for this_file in $new_xref_files; do
-      verbose "Comparing xref file `echo $this_file | sed 's|\./||g'` ..."
-      # cmp -s returns nonzero exit status if files differ.
-      if cmp -s "$this_file" "$work_bak/$this_file"; then :; else
-        verbose "xref file `echo $this_file | sed 's|\./||g'` differed ..."
-        $debug && diff -u "$work_bak/$this_file" "$this_file"
-        continue 2
-      fi
-    done
-
-    # We're done.
-    break
-  done # while :;
-
-  # If we were using thumbpdf and producing PDF, then run thumbpdf
-  # and TeX one last time.
-  run_thumbpdf
+  # Run until a fix point is reached.
+  run_tex_suite
 
   # Both to make sure we can remove $t2ddir (we might have cd'd into
   # it), and in case $orig_pwd is on a different drive (for DOS).

reply via email to

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