~ubuntu-branches/ubuntu/intrepid/dblatex/intrepid

« back to all changes in this revision

Viewing changes to latex/scripts/runlatex

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Hoenen
  • Date: 2006-05-15 19:59:06 UTC
  • Revision ID: james.westby@ubuntu.com-20060515195906-rkfacgap1tbemkr4
Tags: 0.1.9-2
* Enable file names containing white space to be handled.  Closes: #366721
* Standards-Version: 3.7.2 (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
  for suffix in log lof lot glo idx ind ilg toc out aux cb
7
7
  do
8
8
    temp=$basefile.$suffix
9
 
    if [ -f $temp ]; then
10
 
      rm $temp*
11
 
    fi
 
9
    rm -f $temp*
12
10
  done
13
11
}
14
12
 
25
23
  }'
26
24
}
27
25
 
28
 
add_inputpath()
29
 
{
30
 
  path=""
31
 
  for i in $2; do
32
 
    path="$path{$i//}"
 
26
# Inputpath setting
 
27
inputpath=""
 
28
 
 
29
# Beware, blank spaces in the path are forbidden
 
30
add_inputpath_one()
 
31
{
 
32
  if [ $# -gt 1 ]; then
 
33
    echo "Warning: '$*': invalid input path (contains blank); skipped"
 
34
  else
 
35
    inputpath="$inputpath{$1//}"
 
36
  fi
 
37
}
 
38
 
 
39
add_inputpath_range()
 
40
{
 
41
  for i in $1; do
 
42
    add_inputpath_one "$i"
33
43
  done
34
 
  cat <<eof > $3
 
44
}
 
45
 
 
46
add_inputpath_tex()
 
47
{
 
48
  cat <<eof > $2
35
49
\makeatletter
36
 
\def\input@path{$path}
 
50
\def\input@path{$inputpath}
37
51
\makeatother
38
52
eof
39
 
cat $1 >> $3
 
53
cat $1 >> $2
40
54
}
41
55
 
42
56
scriptpath=`dirname $0`;
43
57
 
 
58
# (la)tex engine to use, and the expected output extension.
 
59
xtex=latex
 
60
oxt=dvi
 
61
 
44
62
while true
45
63
do
46
64
  case "$1" in
47
65
  --texpost) execpost="$2"; shift;;
48
 
  -*) echo "$1: Unknown option"; exit 1;;
49
 
  *) break;;
 
66
  --tex) xtex="$2"; shift;;
 
67
  --oxt) oxt="$2"; shift;;
 
68
  --src) add_inputpath_one $2; shift;;
 
69
  --xpath) add_inputpath_range "$2"; shift;;
 
70
  -*) shift;; # ignore silently the unknown option
 
71
  *)  break;;
50
72
  esac
51
73
  shift
52
74
done
53
75
 
54
 
if [ $# -lt 2 ]; then
55
 
  echo "`basename $0` file.tex inputpath [texengine extension]"
 
76
if [ $# -lt 1 ]; then
 
77
  echo "`basename $0` [options] file.tex"
56
78
  exit 1
57
79
fi
58
80
 
59
 
# (la)tex engine to use, and the expected output extension.
60
 
xtex=latex
61
 
oxt=dvi
62
 
if [ $# -ge 4 ]; then
63
 
  xtex=$3
64
 
  oxt=$4
65
 
fi
66
 
 
67
 
srcfile=$1
68
 
srcpath=$2
69
 
file=`basename $srcfile .tex`
 
81
srcfile="$1"
 
82
file=`basename "$srcfile" .tex`
70
83
srcout=$file.$oxt
71
84
file=${file}_tmp
72
85
basefile=$file
79
92
 
80
93
 
81
94
# Build the tex file with input@path set
82
 
add_inputpath $srcfile "$srcpath" $file
 
95
add_inputpath_tex "$srcfile" $file
83
96
 
84
97
run=1
85
98
while [ $run -ne 0 ]
86
99
do 
87
 
  echo "latex $file"
 
100
  echo "$xtex $file"
88
101
  $xtex -interaction=batchmode $file
89
102
  if [ $? -ne 0 ]; then
90
103
    echo "*** latex error"