[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: |
Tue, 03 May 2016 19:32:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (windows-nt) |
Answering to myself,
Le 03/05/2016 11:13, Vincent Belaïche a écrit :
>
>
> Hello,
>
> Answers below,
>
[...]
>
> I suggest we go to this kind of solution for robustifying texi2dvi
> w.r.t. to stange filenames. I want to refine it further in order to:
>
> - remove current handling of ~ and make option -~ obsolete (ie ignored)
>
> - do ^ -> \string^ only in the case of ^^XX
>
> I am quite sorry for Stephen but there seems to be no solution to
> support spaces in filenames --- at least with MikTeX etex engine.
>
> VBR,
> Vincent
>
Done the planned above. I also added the support of \ in filenames, but
could not test it (I am under MSW).
VBR,
Vincent.
Index: texi2dvi
===================================================================
--- texi2dvi (revision 7139)
+++ texi2dvi (working copy)
@@ -51,7 +51,6 @@
# Instead, assign them an empty value.
action=compile
batch=false # interact normally
-catcode_special=maybe
debug=false
escape="\\"
expand=false # true for expansion via makeinfo
@@ -810,14 +809,6 @@
*) error 1 "$out_lang not supported for $in_lang";;
esac
- # do the special catcode trick for ~ in filenames only for Texinfo,
- # not LaTeX.
- if test x"$in_lang" = xtexinfo && test $catcode_special != false; then
- catcode_special=true
- else
- catcode_special=false
- fi
-
# Beware of aux files in subdirectories that require the
# subdirectory to exist.
case $in_lang:$tidy in
@@ -874,23 +865,10 @@
tex_cmd="$tex_cmd </dev/null '${escape}nonstopmode'"
fi
- # we'd like to handle arbitrary input file names, especially
- # foo~bar/a~b.tex, since Debian likes ~ characters.
- if $catcode_special; then
- # The idea is to define \normaltilde as a catcode other ~ character,
- # then make the active ~ be equivalent to that, instead of the plain
- # TeX tie. Then when the active ~ appears in the filename, it will
- # be expanded to itself, as far as \input will see. (This is the
- # same thing that texinfo.tex does in general, BTW.)
- normaltilde="${escape}catcode126=12 ${escape}def${escape}normaltilde{~}"
- tex_cmd="$tex_cmd '$normaltilde${escape}catcode126=13
${escape}let~\normaltilde '"
+ # append the \input + input filename.
+ if test $# -gt 0; then
+ tex_cmd="$tex_cmd '${escape}input' '$1'"
fi
- # Other special (non-active) characters could be supported by
- # 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'"
}
# run_tex - Run TeX as "$tex $in_input", taking care of errors and logs.
@@ -918,14 +896,47 @@
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 sed regexp special characters for then quoting cur dir in sed
regexp
+ _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
+
+ case "$_run_tex_file_name" in
+ *%*)
+ tex_cmd="$tex_cmd
'${escape}begingroup${escape}catcode37=12${escape}def${escape}temp{${escape}def${escape}litpercent{%}}${escape}expandafter${escape}endgroup${escape}temp'"
+ ;;
+ esac
+ case "$_run_tex_file_name" in
+ *'\\'*)
+ tex_cmd="$tex_cmd
'address@hidden@address@hidden@address@hidden@address@hidden'"
+ ;;
+ esac
+
+
+
+ # Escape special TeX characters
+ _run_tex_file_name=`echo "$_run_tex_file_name" \
+| $SED -e 's!\\\\!\\\\litbs !g; s!\\([~]\\)!\\\\string\\1!g; \
+s!\\^\\^\\([0-9A-F]\\{2\\}\\)!\\\\string^\\\\string^\\1!g; \
+s! !\\\\space !g; \
+s!%!\\\\litpercent !g'`
+
+ tex_cmd="$tex_cmd '${escape}input' '$_run_tex_file_name' '${escape}relax'"
+
verbose "$0: Running $tex_cmd ..."
if eval "$tex_cmd" >&5; then
case $out_lang in
@@ -1475,14 +1486,10 @@
# \bye doesn't work for LaTeX, but it will cause latex
# to exit with an input error.
recorder_option_maybe="$1"
- save_catcode_special=$catcode_special
save_batch=$batch
- catcode_special=false
batch=true
- make_tex_cmd
- catcode_special=$save_catcode_special
+ make_tex_cmd ./openout.tex
batch=$save_batch
- tex_cmd="$tex_cmd ./openout.tex"
# ./ in case . isn't in path
verbose "$0: running $tex_cmd ..."
rm -fr "openout.$2"
@@ -1772,7 +1779,7 @@
case "$1" in
-@ ) escape=@;;
- -~ ) catcode_special=false;;
+ -~ ) verbose "Option -~ is obsolete, texi2dvi ignores it.";;
# Silently and without documentation accept -b and --b[atch] as synonyms.
-b | --batch) batch=true;;
--build) shift; build_mode=$1;;
Re: Fwd: REVIEW REQUEST - user manual generation, Gavin Smith, 2016/05/03
Re: Fwd: REVIEW REQUEST - user manual generation, Gavin Smith, 2016/05/04