bug-texinfo
[Top][All Lists]
Advanced

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

Re: Fwd: REVIEW REQUEST - user manual generation


From: Vincent Belaïche
Subject: Re: Fwd: REVIEW REQUEST - user manual generation
Date: Thu, 28 Apr 2016 10:30:53 +0200

One more patch --- see comments below

Le 28/04/2016 00:32, Stephen H. Dawson a écrit :
> Nice. Glad to see people working together. It is a rarity in life I
> greatly enjoy experiencing.  :-)
>
> Thank You,
> Stephen H. Dawson
> (865) 804-3454
> http://www.linkedin.com/in/shdcs
>
>
> On 04/27/2016 05:33 PM, Vincent Belaïche wrote:
>> Answers below...

[...]

>>
>

OK,

I have tried several things for sorting out the space in filename
limitation of TeX, and I could not achieve this:

- use of double quotes (DQ) passed to etex : this does not work with
  MikTeX because then recorder file I/O fails, I tried to specify
  -jobname w/o the DQ, but it does not help, exactly the same happens as
  w/o -jobname option.

- catcoding to letters all the tex special characters that are valid in
  filename, that is to say: {}$#~ and space. I am using < > and | in
  place of { } and space respectively as <>| are not valid in filenames
  anyway. This does  not help either for the spaces in filename. However
  this works for allowing {}$#~ in filenames, and this method is
  superior to the current tricks for ~, as only the input filename is
  affected rather than the whole document --- I would suggest to use
  this, and make the -~ option obsolete and cleanup all the
  normal_tilde + catcode_special variable stuff.

To Karl: is there any reason why we need to affect the ~ catcode
globally ? don't we need this only for the top level input filename ? Do
you agree my suggestion to remove the current normale_tilde +
catcode_special stuff.

FYI, here is a trial with a file named toto$#{}~.texi (toto is the
French cousin of foo), and it works fine seemingly --- FYI, I will never
ever, even on Mars, name a file like that in my real life:

--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
$ texi2dvi -~ --verbose -t @finalout 'toto$#{}~.texi'
/bin/texi2dvi: Processing toto$#{}~.texi ...
/bin/texi2dvi: Checking TeX \openout in log support...
/bin/texi2dvi: /bin/texi2dvi: running etex </dev/null '\nonstopmode' '\input' 
'./openout.tex' ...
/bin/texi2dvi: Checking TeX \openout in log support... no
/bin/texi2dvi: Checking TeX recorder support...
/bin/texi2dvi: /bin/texi2dvi: running etex -recorder </dev/null '\nonstopmode' 
'\input' './openout.tex' ...
/bin/texi2dvi: Checking TeX recorder support... yes
/bin/texi2dvi: BIBINPUTS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: BSTINPUTS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: DVIPSHEADERS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: INDEXSTYLE='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: MFINPUTS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: MPINPUTS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: TEXINPUTS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: TFMFONTS='/tmp/efrench/with space:/tmp/efrench/with space/.:'
/bin/texi2dvi: texinfo.tex preloaded as `', version is `20160323' ...
/bin/texi2dvi: Inserting extra commands: \
@finalout
/bin/texi2dvi: Backing up xref files: toto$#{}~.toc
toto$#{}~.aux
toto$#{}~.cp
/bin/texi2dvi: Cycle 1 for ./toto$#{}~.texi
/bin/texi2dvi: /bin/texi2dvi: Running etex -recorder '\relax{\catcode60=1 
\catcode62=2 \catcode124=10 \catcode123=11 \catcode125=11 \catcode36=11 
\catcode35=11 \catcode126=11 
\catcode32=11|\toks0<\input|./toto$#{}~.t2d/dvi/xtr/toto$#{}~.texi\relax>\expandafter>\the\toks0|'
 ...
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9 64-bit)
entering extended mode
(toto$#{}~.t2d/dvi/xtr/toto$#{}~.texi
(C:\Nos_Programmes\MinGW\msys\share\texmf\tex\texinfo\texinfo.tex
Loading texinfo [version 2016-03-23.14]: pdf, fonts, markup, glyphs,
page headings, tables, conditionals, indexing, sectioning, toc, environments,
defuns, macros, cross references, insertions,
(C:\Nos_Programmes\MinGW\msys\share\texmf\tex\generic\epsf\epsf.tex
This is `epsf.tex' v2.7.4 <14 February 2011>
) localization, formatting, and turning on texinfo input format.) [1] [2]
(toto$#{}~.toc) [-1] Chapter 1 (toto$#{}~.aux) (Index) [1] [2] )
Output written on toto$#{}~.dvi (5 pages, 2688 bytes).
Transcript written on toto$#{}~.log.
/bin/texi2dvi: Original xref files = toto$#{}~.toc
toto$#{}~.aux
toto$#{}~.cp
/bin/texi2dvi: New xref files      = toto$#{}~.toc
toto$#{}~.aux
toto$#{}~.cp
/bin/texi2dvi: Comparing xref file toto$#{}~.toc ...
/bin/texi2dvi: Comparing xref file toto$#{}~.aux ...
/bin/texi2dvi: Comparing xref file toto$#{}~.cp ...
/bin/texi2dvi: Removing /tmp/efrench/with space/toto$#{}~.t2d
/bin/texi2dvi: done.
/bin/texi2dvi: Removing /tmp/efrench/with space/toto$#{}~.t2d
--8<----8<----8<----8<----8<--  end  -->8---->8---->8---->8---->8----

VBR,
        Vincent
  

Index: texi2dvi

===================================================================

--- texi2dvi    (revision 7139)

+++ texi2dvi    (working copy)

@@ -889,8 +889,10 @@

   # resetting their catcodes to other on the command line and changing
   # texinfo.tex to initialize everything to plain catcodes.  Maybe someday.
 
-  # append the \input command.
-  tex_cmd="$tex_cmd '${escape}input'"
+  # append the \input + input filename.
+  if test $# -gt 0; then
+    tex_cmd="$tex_cmd '${escape}input' '$1'"
+  fi
 }
 
 # run_tex - Run TeX as "$tex $in_input", taking care of errors and logs.
@@ -910,6 +912,7 @@

   # all the plain TeX special characters cause trouble, but there's no
   # harm in making the link.
   #
+
   case $tidy:`func_dirname "$in_input"` in
     true:*["$space$tab$newline\"#\$%\\^_{}~"]*)
       _run_tex_file_name=`basename "$in_input"`
@@ -918,14 +921,51 @@

         run rm -f "$_run_tex_file_name"
         run ln -s "$in_input"
       fi
-      tex_cmd="$tex_cmd '$_run_tex_file_name'"
       ;;
 
     *)
-      tex_cmd="$tex_cmd '$in_input'"
+      _run_tex_file_name="$in_input"
       ;;
   esac
 
+
+  # Make input filename relative, in order to alleviate risk of spaces
+  # in name
+  _run_tex_cur_dir=`pwd`
+  case "$_run_tex_file_name" in
+    *"$_run_tex_cur_dir"*)
+      # escape special characters
+      _run_tex_cur_dir=`echo "$_run_tex_cur_dir" | $SED -e 
's/\([.$^\]\)/\\\1/g'`
+      _run_tex_file_name=`echo "$_run_tex_file_name" | $SED -e 
"s<^$_run_tex_cur_dir/<./<1"`
+    ;;
+  esac
+
+  # If there are still spaces remaining the the input file name, we
+  # try double quoting, this is tex implementation and OS dependent,
+  # so that trick may not work always.
+  case "$_run_tex_file_name" in
+    *" "*)
+      _run_tex_dq='"'
+
+      # Well, this does not work with MikTeX for -recorder file I/O,
+      # so I try also to specify the -jobname w/o the double quotes,
+      # but this does not help.
+      _run_tex_jobname=`basename "$_run_tex_file_name" | $SED -e 
's/\.[^.]\+$//1'`
+      tex_cmd="$tex_cmd '-jobname=$_run_tex_jobname'"
+      ;;
+    *)
+      _run_tex_dq=
+      ;;
+  esac
+  #                                          <={                  >=}          
        |=space
+  tex_cmd="$tex_cmd '${escape}relax{${escape}catcode60=1 ${escape}catcode62=2 
${escape}catcode124=10"
+  # make letter {   }   $  #  ~   space(must be last in this list)
+  for w in      123 125 36 35 126 32; do
+    tex_cmd="$tex_cmd ${escape}catcode$w=11";
+  done
+  
tex_cmd="$tex_cmd|${escape}toks0<${escape}input|$_run_tex_dq$_run_tex_file_name$_run_tex_dq${escape}relax>${escape}expandafter>${escape}the${escape}toks0|'"
+  
+
   verbose "$0: Running $tex_cmd ..."
   if eval "$tex_cmd" >&5; then
     case $out_lang in
@@ -1479,10 +1519,9 @@

     save_batch=$batch
     catcode_special=false
     batch=true
-    make_tex_cmd
+    make_tex_cmd ./openout.tex
     catcode_special=$save_catcode_special
     batch=$save_batch
-    tex_cmd="$tex_cmd ./openout.tex"
     # ./ in case . isn't in path
     verbose "$0: running $tex_cmd ..."
     rm -fr "openout.$2"

reply via email to

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