The R Project SVN R

Rev

Rev 26349 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26349 Rev 26719
1
#! /bin/sh
1
#! /bin/sh
2
 
2
 
3
## Rd2dvi -- Convert man pages (*.Rd help files) via LaTeX to DVI/PDF.
3
## Rd2dvi -- Convert man pages (*.Rd help files) via LaTeX to DVI/PDF.
4
##
4
##
5
## Examples:
5
## Examples:
6
##  R CMD Rd2dvi /path/to/Rsrc/src/library/base/man/Normal.Rd
6
##  R CMD Rd2dvi /path/to/Rsrc/src/library/base/man/Normal.Rd
7
##  R CMD Rd2dvi `grep -l "\\keyword{distr" \
7
##  R CMD Rd2dvi `grep -l "\\keyword{distr" \
8
##                  /path/to/Rsrc/src/library/base/man/*.Rd | sort | uniq`
8
##                  /path/to/Rsrc/src/library/base/man/*.Rd | sort | uniq`
9
 
9
 
10
revision='$Revision: 1.39 $'
10
revision='$Revision: 1.40 $'
11
version=`set - ${revision}; echo ${2}`
11
version=`set - ${revision}; echo ${2}`
12
version="Rd2dvi ${version}
12
version="Rd2dvi ${version}
13
 
13
 
14
Copyright (C) 2000-2001 The R Core Development Team.
14
Copyright (C) 2000-2001 The R Core Development Team.
15
This is free software; see the GNU General Public Licence version 2
15
This is free software; see the GNU General Public Licence version 2
16
or later for copying conditions.  There is NO warranty." 
16
or later for copying conditions.  There is NO warranty." 
17
 
17
 
18
usage="Usage: R CMD Rd2dvi [options] files
18
usage="Usage: R CMD Rd2dvi [options] files
19
 
19
 
20
Generate DVI (or PDF) output from the Rd sources specified by files, by
20
Generate DVI (or PDF) output from the Rd sources specified by files, by
21
either giving the paths to the files, or the path to a directory with
21
either giving the paths to the files, or the path to a directory with
22
the sources of a package.
22
the sources of a package.
23
 
23
 
24
Unless specified via option '--output', the basename of the output file
24
Unless specified via option '--output', the basename of the output file
25
equals the basename of argument 'files' if this specifies a package
25
equals the basename of argument 'files' if this specifies a package
26
(bundle) or a single file, and 'Rd2' otherwise.
26
(bundle) or a single file, and 'Rd2' otherwise.
27
 
27
 
28
Options:
28
Options:
29
  -h, --help		print short help message and exit
29
  -h, --help		print short help message and exit
30
  -v, --version		print version info and exit
30
  -v, --version		print version info and exit
31
      --batch		no interaction
31
      --batch		no interaction
32
      --debug		turn on shell debugging (set -x)
32
      --debug		turn on shell debugging (set -x)
33
      --no-clean	do not remove created temporary files
33
      --no-clean	do not remove created temporary files
34
      --no-preview	do not preview generated output file
34
      --no-preview	do not preview generated output file
35
      --os=NAME		use OS subdir 'NAME' (unix, mac or windows)
35
      --os=NAME		use OS subdir 'NAME' (unix or windows)
36
      --OS=NAME		the same as '--os'
36
      --OS=NAME		the same as '--os'
37
  -o, --output=FILE	write output to FILE
37
  -o, --output=FILE	write output to FILE
38
      --pdf		generate PDF output
38
      --pdf		generate PDF output
39
      --title=NAME	use NAME as the title of the document
39
      --title=NAME	use NAME as the title of the document
40
  -V, --verbose		report on what is done
40
  -V, --verbose		report on what is done
41
 
41
 
42
Report bugs to <r-bugs@r-project.org>."
42
Report bugs to <r-bugs@r-project.org>."
43
 
43
 
44
start_dir=`pwd`
44
start_dir=`pwd`
45
 
45
 
46
batch=false
46
batch=false
47
clean=true
47
clean=true
48
debug=false
48
debug=false
49
out_ext="dvi"
49
out_ext="dvi"
50
output=""
50
output=""
51
preview=xdvi
51
preview=xdvi
52
verbose=false
52
verbose=false
53
OSdir=${R_OSTYPE-"unix"}
53
OSdir=${R_OSTYPE-"unix"}
54
 
54
 
55
## Need a `safe' echo which does not interpret backslash-escaped
55
## Need a `safe' echo which does not interpret backslash-escaped
56
## characters in SysV style.
56
## characters in SysV style.
57
echo="sh ${R_HOME}/share/sh/echo.sh"
57
echo="sh ${R_HOME}/share/sh/echo.sh"
58
 
58
 
59
while test -n "${1}"; do
59
while test -n "${1}"; do
60
  case ${1} in
60
  case ${1} in
61
    -h|--help)
61
    -h|--help)
62
      ${echo} "${usage}"; exit 0 ;;
62
      ${echo} "${usage}"; exit 0 ;;
63
    -v|--version)
63
    -v|--version)
64
      ${echo} "${version}"; exit 0 ;;
64
      ${echo} "${version}"; exit 0 ;;
65
    --batch)
65
    --batch)
66
      batch=true ;;
66
      batch=true ;;
67
    --debug)
67
    --debug)
68
      debug=true ;;
68
      debug=true ;;
69
    --no-clean)
69
    --no-clean)
70
      clean=false ;;
70
      clean=false ;;
71
    --no-preview)
71
    --no-preview)
72
      preview=false ;;
72
      preview=false ;;
73
    --pdf)
73
    --pdf)
74
      out_ext="pdf";
74
      out_ext="pdf";
75
      preview=false;
75
      preview=false;
76
      R_RD4DVI=${R_RD4PDF-"ae,hyper"};
76
      R_RD4DVI=${R_RD4PDF-"ae,hyper"};
77
      R_LATEXCMD=${PDFLATEX-pdflatex} ;;
77
      R_LATEXCMD=${PDFLATEX-pdflatex} ;;
78
    --title=*)
78
    --title=*)
79
      title=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
79
      title=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
80
    -o)
80
    -o)
81
      if test -n "`echo ${2} | sed 's/^-.*//'`"; then      
81
      if test -n "`echo ${2} | sed 's/^-.*//'`"; then      
82
	output="${2}"; shift
82
	output="${2}"; shift
83
      else
83
      else
84
	${echo} "ERROR: option '${1}' requires an argument"
84
	${echo} "ERROR: option '${1}' requires an argument"
85
	exit 1
85
	exit 1
86
      fi
86
      fi
87
      ;;
87
      ;;
88
    --output=*)
88
    --output=*)
89
      output=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
89
      output=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
90
    --OS=*|--os=*)
90
    --OS=*|--os=*)
91
      OSdir=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
91
      OSdir=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
92
    -V|--verbose)
92
    -V|--verbose)
93
      verbose=${echo} ;;
93
      verbose=${echo} ;;
94
    --|*)
94
    --|*)
95
      break ;;
95
      break ;;
96
  esac
96
  esac
97
  shift
97
  shift
98
done
98
done
99
 
99
 
100
if ${debug}; then set -x; fi
100
if ${debug}; then set -x; fi
101
 
101
 
102
. ${R_HOME}/share/sh/dcf.sh	# get_dcf_field()
102
. ${R_HOME}/share/sh/dcf.sh	# get_dcf_field()
103
 
103
 
104
Rdconv_dir_or_files_to_LaTeX () {
104
Rdconv_dir_or_files_to_LaTeX () {
105
  ## Convert Rd files in a dir or a list of Rd files to LaTeX, appending
105
  ## Convert Rd files in a dir or a list of Rd files to LaTeX, appending
106
  ## the result to OUTFILE.
106
  ## the result to OUTFILE.
107
  ## Usage:
107
  ## Usage:
108
  ##   Rdconv_dir_or_files_to_LaTeX OUTFILE DIR
108
  ##   Rdconv_dir_or_files_to_LaTeX OUTFILE DIR
109
  ##   Rdconv_dir_or_files_to_LaTeX OUTFILE FILES
109
  ##   Rdconv_dir_or_files_to_LaTeX OUTFILE FILES
110
 
110
 
111
  ${verbose} $@
111
  ${verbose} $@
112
 
112
 
113
  out="${1}"
113
  out="${1}"
114
  shift
114
  shift
115
 
115
 
116
  if test -d ${1}; then
116
  if test -d ${1}; then
117
    files=`ls ${1}/*.[Rr]d`
117
    files=`ls ${1}/*.[Rr]d`
118
    if test -d ${1}/${OSdir}; then
118
    if test -d ${1}/${OSdir}; then
119
      files="${files} `ls ${1}/${OSdir}/*.[Rr]d`"
119
      files="${files} `ls ${1}/${OSdir}/*.[Rr]d`"
120
    fi
120
    fi
121
    files=`LC_ALL=C ${echo} ${files} | sort`
121
    files=`LC_ALL=C ${echo} ${files} | sort`
122
  else
122
  else
123
    files="${@}"
123
    files="${@}"
124
  fi
124
  fi
125
 
125
 
126
  echo "Converting Rd files to LaTeX ..."
126
  echo "Converting Rd files to LaTeX ..."
127
 
127
 
128
  for f in ${files}; do
128
  for f in ${files}; do
129
    ${echo} ${f}
129
    ${echo} ${f}
130
    ${R_CMD} Rdconv -t latex ${f} >> ${out}
130
    ${R_CMD} Rdconv -t latex ${f} >> ${out}
131
  done
131
  done
132
 
132
 
133
}
133
}
134
 
134
 
135
Rd_DESCRIPTION_to_LaTeX () {
135
Rd_DESCRIPTION_to_LaTeX () {
136
  ## Typeset the contents of a DESCRIPTION file in a LaTeX description
136
  ## Typeset the contents of a DESCRIPTION file in a LaTeX description
137
  ## list.
137
  ## list.
138
  ## Usage:
138
  ## Usage:
139
  ##   Rd_DESCRIPTION_to_LaTeX FILE
139
  ##   Rd_DESCRIPTION_to_LaTeX FILE
140
  
140
  
141
  fields=`sed '/^[ 	]/d; s/^\([^:]*\):.*$/\1/' $1`
141
  fields=`sed '/^[ 	]/d; s/^\([^:]*\):.*$/\1/' $1`
142
  ${echo} "\\begin{description}"
142
  ${echo} "\\begin{description}"
143
  ${echo} "\\raggedright{}"
143
  ${echo} "\\raggedright{}"
144
  for f in `${echo} "${fields}" | sed '/Package/d; /Bundle/d;'`; do
144
  for f in `${echo} "${fields}" | sed '/Package/d; /Bundle/d;'`; do
145
    text=`get_dcf_field ${f} ${1}`
145
    text=`get_dcf_field ${f} ${1}`
146
    ${echo} "\\item[${f}] \\AsIs{${text}}"
146
    ${echo} "\\item[${f}] \\AsIs{${text}}"
147
  done
147
  done
148
  ${echo} "\\end{description}"
148
  ${echo} "\\end{description}"
149
}
149
}
150
 
150
 
151
is_bundle=no
151
is_bundle=no
152
is_base_package=no
152
is_base_package=no
153
file_sed='s/[_$]/\\&/g'
153
file_sed='s/[_$]/\\&/g'
154
 
154
 
155
toc="\\Rdcontents{\\R{} topics documented:}"
155
toc="\\Rdcontents{\\R{} topics documented:}"
156
if test -d "${1}"; then
156
if test -d "${1}"; then
157
  if test -f ${1}/DESCRIPTION; then
157
  if test -f ${1}/DESCRIPTION; then
158
    if test -n "`grep '^Bundle:' ${1}/DESCRIPTION`"; then
158
    if test -n "`grep '^Bundle:' ${1}/DESCRIPTION`"; then
159
      echo "Hmm ... looks like a package bundle"
159
      echo "Hmm ... looks like a package bundle"
160
      is_bundle=yes
160
      is_bundle=yes
161
      bundle_name=`get_dcf_field Bundle "${1}/DESCRIPTION"`
161
      bundle_name=`get_dcf_field Bundle "${1}/DESCRIPTION"`
162
      bundle_pkgs=`get_dcf_field Contains "${1}/DESCRIPTION"`
162
      bundle_pkgs=`get_dcf_field Contains "${1}/DESCRIPTION"`
163
      title=${title-"Bundle \`${bundle_name}'"}
163
      title=${title-"Bundle \`${bundle_name}'"}
164
    else
164
    else
165
      echo "Hmm ... looks like a package"
165
      echo "Hmm ... looks like a package"
166
      package_name=`get_dcf_field Package "${1}/DESCRIPTION"`
166
      package_name=`get_dcf_field Package "${1}/DESCRIPTION"`
167
      title=${title-"Package \`${package_name}'"}
167
      title=${title-"Package \`${package_name}'"}
168
      dir=${1}/man
168
      dir=${1}/man
169
    fi
169
    fi
170
    test -z "${output}" && output="`basename ${1}`.${out_ext}"
170
    test -z "${output}" && output="`basename ${1}`.${out_ext}"
171
  elif test -f ${1}/DESCRIPTION.in && \
171
  elif test -f ${1}/DESCRIPTION.in && \
172
       test -n "`grep '^Priority: *base' ${1}/DESCRIPTION.in`"; then
172
       test -n "`grep '^Priority: *base' ${1}/DESCRIPTION.in`"; then
173
    is_base_package=yes
173
    is_base_package=yes
174
    echo "Hmm ... looks like a package from the R distribution"
174
    echo "Hmm ... looks like a package from the R distribution"
175
    package_name=`get_dcf_field Package "${1}/DESCRIPTION.in"`
175
    package_name=`get_dcf_field Package "${1}/DESCRIPTION.in"`
176
    title=${title-"Package \`${package_name}'"}
176
    title=${title-"Package \`${package_name}'"}
177
    dir=${1}/man
177
    dir=${1}/man
178
    test -z "${output}" && output="`basename ${1}`.${out_ext}"    
178
    test -z "${output}" && output="`basename ${1}`.${out_ext}"    
179
  else
179
  else
180
    if test -d ${1}/man; then
180
    if test -d ${1}/man; then
181
      dir=${1}/man
181
      dir=${1}/man
182
    else
182
    else
183
      dir=${1}
183
      dir=${1}
184
    fi
184
    fi
185
    subj0=`${echo} ${dir} | sed -e ${file_sed}`
185
    subj0=`${echo} ${dir} | sed -e ${file_sed}`
186
    subj="all in \\file{${subj0}}"
186
    subj="all in \\file{${subj0}}"
187
  fi
187
  fi
188
else
188
else
189
  if test ${#} -gt 1 ; then
189
  if test ${#} -gt 1 ; then
190
    subj=" etc.";
190
    subj=" etc.";
191
  else
191
  else
192
    subj=
192
    subj=
193
    toc=
193
    toc=
194
    if test -z "${output}"; then
194
    if test -z "${output}"; then
195
      output=`basename "${1}"`
195
      output=`basename "${1}"`
196
      output="`echo ${output} | sed 's/[Rr]d$//'`${out_ext}"
196
      output="`echo ${output} | sed 's/[Rr]d$//'`${out_ext}"
197
    fi
197
    fi
198
  fi
198
  fi
199
  subj0=`${echo} ${1} | sed -e ${file_sed}`
199
  subj0=`${echo} ${1} | sed -e ${file_sed}`
200
  subj="\\file{${subj0}}${subj}"
200
  subj="\\file{${subj0}}${subj}"
201
fi
201
fi
202
title=${title-"\\R{} documentation}} \\par\\bigskip{{\\Large of ${subj}"}
202
title=${title-"\\R{} documentation}} \\par\\bigskip{{\\Large of ${subj}"}
203
 
203
 
204
## Prepare for building the documentation.
204
## Prepare for building the documentation.
205
if test -z "${output}"; then
205
if test -z "${output}"; then
206
  output="Rd2.${out_ext}"
206
  output="Rd2.${out_ext}"
207
fi
207
fi
208
if test -f ${output}; then
208
if test -f ${output}; then
209
  ${echo} "file '${output}' exists; please remove first"
209
  ${echo} "file '${output}' exists; please remove first"
210
  exit 1
210
  exit 1
211
fi
211
fi
212
build_dir=.Rd2dvi${$}
212
build_dir=.Rd2dvi${$}
213
if test -d ${build_dir}; then
213
if test -d ${build_dir}; then
214
  rm -rf ${build_dir} || echo "cannot write to build dir" && exit 2
214
  rm -rf ${build_dir} || echo "cannot write to build dir" && exit 2
215
fi
215
fi
216
mkdir ${build_dir}
216
mkdir ${build_dir}
217
 
217
 
218
## Rd2.tex part 1: header
218
## Rd2.tex part 1: header
219
if test ${batch}; then
219
if test ${batch}; then
220
  cat > ${build_dir}/Rd2.tex <<EOF
220
  cat > ${build_dir}/Rd2.tex <<EOF
221
\\nonstopmode{}
221
\\nonstopmode{}
222
EOF
222
EOF
223
else
223
else
224
  cat > ${build_dir}/Rd2.tex <<EOF
224
  cat > ${build_dir}/Rd2.tex <<EOF
225
EOF
225
EOF
226
fi
226
fi
227
cat >> ${build_dir}/Rd2.tex <<EOF
227
cat >> ${build_dir}/Rd2.tex <<EOF
228
\\documentclass[${R_PAPERSIZE}paper]{book}
228
\\documentclass[${R_PAPERSIZE}paper]{book}
229
\\usepackage[${R_RD4DVI-ae}]{Rd}
229
\\usepackage[${R_RD4DVI-ae}]{Rd}
230
\\usepackage{makeidx}
230
\\usepackage{makeidx}
231
\\makeindex{}
231
\\makeindex{}
232
\\begin{document}
232
\\begin{document}
233
EOF
233
EOF
234
if test "${is_bundle}" = no; then
234
if test "${is_bundle}" = no; then
235
  cat >> ${build_dir}/Rd2.tex <<EOF
235
  cat >> ${build_dir}/Rd2.tex <<EOF
236
\\chapter*{}
236
\\chapter*{}
237
\\begin{center}
237
\\begin{center}
238
{\\textbf{\\huge ${title}}}
238
{\\textbf{\\huge ${title}}}
239
\\par\\bigskip{\\large \\today}
239
\\par\\bigskip{\\large \\today}
240
\\end{center}
240
\\end{center}
241
EOF
241
EOF
242
  if test -f ${1}/DESCRIPTION; then
242
  if test -f ${1}/DESCRIPTION; then
243
    Rd_DESCRIPTION_to_LaTeX ${1}/DESCRIPTION >> ${build_dir}/Rd2.tex
243
    Rd_DESCRIPTION_to_LaTeX ${1}/DESCRIPTION >> ${build_dir}/Rd2.tex
244
  fi
244
  fi
245
  if test "${is_base_package}" = yes; then
245
  if test "${is_base_package}" = yes; then
246
    R_version=unknown
246
    R_version=unknown
247
    if test -f ${1}/../../../VERSION; then
247
    if test -f ${1}/../../../VERSION; then
248
      R_version=`cat ${1}/../../../VERSION`
248
      R_version=`cat ${1}/../../../VERSION`
249
    fi
249
    fi
250
    Rd_DESCRIPTION_to_LaTeX ${1}/DESCRIPTION.in | \
250
    Rd_DESCRIPTION_to_LaTeX ${1}/DESCRIPTION.in | \
251
      sed "s/@VERSION@/${R_version}/" >> ${build_dir}/Rd2.tex
251
      sed "s/@VERSION@/${R_version}/" >> ${build_dir}/Rd2.tex
252
  fi
252
  fi
253
else
253
else
254
  cat >> ${build_dir}/Rd2.tex <<EOF
254
  cat >> ${build_dir}/Rd2.tex <<EOF
255
\\pagenumbering{Roman}
255
\\pagenumbering{Roman}
256
\\begin{titlepage}
256
\\begin{titlepage}
257
\\strut\\vfill
257
\\strut\\vfill
258
\\begin{center}
258
\\begin{center}
259
{\\textbf{\\Huge ${title}}}
259
{\\textbf{\\Huge ${title}}}
260
\\par\\bigskip{\\large \\today}
260
\\par\\bigskip{\\large \\today}
261
\\end{center}
261
\\end{center}
262
\\par\\bigskip
262
\\par\\bigskip
263
EOF
263
EOF
264
  Rd_DESCRIPTION_to_LaTeX ${1}/DESCRIPTION >> ${build_dir}/Rd2.tex
264
  Rd_DESCRIPTION_to_LaTeX ${1}/DESCRIPTION >> ${build_dir}/Rd2.tex
265
  cat >> ${build_dir}/Rd2.tex <<EOF
265
  cat >> ${build_dir}/Rd2.tex <<EOF
266
\\vfill\\vfill
266
\\vfill\\vfill
267
\\end{titlepage}
267
\\end{titlepage}
268
EOF
268
EOF
269
fi
269
fi
270
  
270
  
271
## Rd2.tex part 2: body
271
## Rd2.tex part 2: body
272
if test "${is_bundle}" = no; then
272
if test "${is_bundle}" = no; then
273
  ${echo} ${toc} >> ${build_dir}/Rd2.tex
273
  ${echo} ${toc} >> ${build_dir}/Rd2.tex
274
  Rdconv_dir_or_files_to_LaTeX ${build_dir}/Rd2.tex ${dir-${@}}
274
  Rdconv_dir_or_files_to_LaTeX ${build_dir}/Rd2.tex ${dir-${@}}
275
else
275
else
276
  cat >> ${build_dir}/Rd2.tex <<EOF
276
  cat >> ${build_dir}/Rd2.tex <<EOF
277
\\setcounter{secnumdepth}{-1}
277
\\setcounter{secnumdepth}{-1}
278
\\pagenumbering{roman}
278
\\pagenumbering{roman}
279
\\tableofcontents{}
279
\\tableofcontents{}
280
\\cleardoublepage{}
280
\\cleardoublepage{}
281
\\pagenumbering{arabic}
281
\\pagenumbering{arabic}
282
EOF
282
EOF
283
  for p in ${bundle_pkgs}; do
283
  for p in ${bundle_pkgs}; do
284
    ${echo} "Bundle package: '${p}'"
284
    ${echo} "Bundle package: '${p}'"
285
    ${echo} "\\chapter{Package \`${p}'}" >> ${build_dir}/Rd2.tex
285
    ${echo} "\\chapter{Package \`${p}'}" >> ${build_dir}/Rd2.tex
286
    if test -f ${1}/${p}/DESCRIPTION.in; then
286
    if test -f ${1}/${p}/DESCRIPTION.in; then
287
      Rd_DESCRIPTION_to_LaTeX ${1}/${p}/DESCRIPTION.in \
287
      Rd_DESCRIPTION_to_LaTeX ${1}/${p}/DESCRIPTION.in \
288
        >> ${build_dir}/Rd2.tex
288
        >> ${build_dir}/Rd2.tex
289
    fi
289
    fi
290
    Rdconv_dir_or_files_to_LaTeX ${build_dir}/Rd2.tex ${1}/${p}/man
290
    Rdconv_dir_or_files_to_LaTeX ${build_dir}/Rd2.tex ${1}/${p}/man
291
    ${echo} "\\clearpage{}" >> ${build_dir}/Rd2.tex
291
    ${echo} "\\clearpage{}" >> ${build_dir}/Rd2.tex
292
  done
292
  done
293
  ${echo} "\\cleardoublepage{}" >> ${build_dir}/Rd2.tex
293
  ${echo} "\\cleardoublepage{}" >> ${build_dir}/Rd2.tex
294
fi
294
fi
295
 
295
 
296
## Rd2.tex part 3: footer
296
## Rd2.tex part 3: footer
297
cat >> ${build_dir}/Rd2.tex <<EOF
297
cat >> ${build_dir}/Rd2.tex <<EOF
298
\\printindex{}
298
\\printindex{}
299
\\end{document}
299
\\end{document}
300
EOF
300
EOF
301
 
301
 
302
## <FIXME>
302
## <FIXME>
303
## Need to do something smarter about the exit status in batch mode.
303
## Need to do something smarter about the exit status in batch mode.
304
status=0
304
status=0
305
## <FIXME>
305
## <FIXME>
306
 
306
 
307
echo "Creating ${out_ext} output from LaTeX ..."
307
echo "Creating ${out_ext} output from LaTeX ..."
308
cd ${build_dir}
308
cd ${build_dir}
309
${R_LATEXCMD-latex} Rd2 || status=1
309
${R_LATEXCMD-latex} Rd2 || status=1
310
${R_MAKEINDEXCMD-makeindex} Rd2
310
${R_MAKEINDEXCMD-makeindex} Rd2
311
${R_LATEXCMD-latex} Rd2
311
${R_LATEXCMD-latex} Rd2
312
if test "${out_ext}" = pdf; then
312
if test "${out_ext}" = pdf; then
313
  ${R_LATEXCMD-latex} Rd2
313
  ${R_LATEXCMD-latex} Rd2
314
fi
314
fi
315
cd ${start_dir}
315
cd ${start_dir}
316
${echo} "Saving output to '${output}' ..."
316
${echo} "Saving output to '${output}' ..."
317
cp ${build_dir}/Rd2.${out_ext} ${output}
317
cp ${build_dir}/Rd2.${out_ext} ${output}
318
echo "Done"
318
echo "Done"
319
 
319
 
320
if ${clean}; then
320
if ${clean}; then
321
  rm -rf ${build_dir}
321
  rm -rf ${build_dir}
322
else
322
else
323
  ${echo} "You may want to clean up by 'rm -rf ${build_dir}'"
323
  ${echo} "You may want to clean up by 'rm -rf ${build_dir}'"
324
fi
324
fi
325
${preview} ${output}
325
${preview} ${output}
326
exit ${status}
326
exit ${status}
327
 
327
 
328
### Local Variables: ***
328
### Local Variables: ***
329
### mode: sh ***
329
### mode: sh ***
330
### sh-indentation: 2 ***
330
### sh-indentation: 2 ***
331
### End: ***
331
### End: ***