The R Project SVN R

Rev

Rev 20002 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20002 Rev 21964
Line 5... Line 5...
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.37 $'
10
revision='$Revision: 1.38 $'
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
Line 25... Line 25...
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
      --debug		turn on shell debugging (set -x)
32
      --debug		turn on shell debugging (set -x)
32
      --no-clean	do not remove created temporary files
33
      --no-clean	do not remove created temporary files
33
      --no-preview	do not preview generated output file
34
      --no-preview	do not preview generated output file
34
      --os=NAME		use OS subdir 'NAME' (unix, mac or windows)
35
      --os=NAME		use OS subdir 'NAME' (unix, mac or windows)
35
      --OS=NAME		the same as '--os'
36
      --OS=NAME		the same as '--os'
Line 43... Line 44...
43
TEXINPUTS=.:${R_HOME}/share/texmf:${TEXINPUTS}
44
TEXINPUTS=.:${R_HOME}/share/texmf:${TEXINPUTS}
44
export TEXINPUTS
45
export TEXINPUTS
45
 
46
 
46
start_dir=`pwd`
47
start_dir=`pwd`
47
 
48
 
-
 
49
batch=false
48
clean=true
50
clean=true
49
debug=false
51
debug=false
50
out_ext="dvi"
52
out_ext="dvi"
51
output=""
53
output=""
52
preview=xdvi
54
preview=xdvi
Line 61... Line 63...
61
  case ${1} in
63
  case ${1} in
62
    -h|--help)
64
    -h|--help)
63
      ${echo} "${usage}"; exit 0 ;;
65
      ${echo} "${usage}"; exit 0 ;;
64
    -v|--version)
66
    -v|--version)
65
      ${echo} "${version}"; exit 0 ;;
67
      ${echo} "${version}"; exit 0 ;;
-
 
68
    --batch)
-
 
69
      batch=true ;;
66
    --debug)
70
    --debug)
67
      debug=true ;;
71
      debug=true ;;
68
    --no-clean)
72
    --no-clean)
69
      clean=false ;;
73
      clean=false ;;
70
    --no-preview)
74
    --no-preview)
Line 213... Line 217...
213
  rm -rf ${build_dir} || echo "cannot write to build dir" && exit 2
217
  rm -rf ${build_dir} || echo "cannot write to build dir" && exit 2
214
fi
218
fi
215
mkdir ${build_dir}
219
mkdir ${build_dir}
216
 
220
 
217
## Rd2.tex part 1: header
221
## Rd2.tex part 1: header
-
 
222
if test ${batch}; then
-
 
223
  cat > ${build_dir}/Rd2.tex <<EOF
-
 
224
\\nonstopmode{}
-
 
225
EOF
-
 
226
else
-
 
227
  cat > ${build_dir}/Rd2.tex <<EOF
-
 
228
EOF
-
 
229
fi
218
cat > ${build_dir}/Rd2.tex <<EOF
230
cat >> ${build_dir}/Rd2.tex <<EOF
219
\\documentclass[${R_PAPERSIZE}paper]{book}
231
\\documentclass[${R_PAPERSIZE}paper]{book}
220
\\usepackage[${R_RD4DVI-ae}]{Rd}
232
\\usepackage[${R_RD4DVI-ae}]{Rd}
221
\\usepackage{makeidx}
233
\\usepackage{makeidx}
222
\\makeindex{}
234
\\makeindex{}
223
\\begin{document}
235
\\begin{document}
Line 288... Line 300...
288
cat >> ${build_dir}/Rd2.tex <<EOF
300
cat >> ${build_dir}/Rd2.tex <<EOF
289
\\printindex{}
301
\\printindex{}
290
\\end{document}
302
\\end{document}
291
EOF
303
EOF
292
 
304
 
-
 
305
## <FIXME>
-
 
306
## Need to do something smarter about the exit status in batch mode.
-
 
307
status=0
-
 
308
## <FIXME>
-
 
309
 
293
echo "Creating ${out_ext} output from LaTeX ..."
310
echo "Creating ${out_ext} output from LaTeX ..."
294
cd ${build_dir}
311
cd ${build_dir}
295
${R_LATEXCMD-latex} Rd2
312
${R_LATEXCMD-latex} Rd2 || status=1
296
${R_MAKEINDEXCMD-makeindex} Rd2
313
${R_MAKEINDEXCMD-makeindex} Rd2
297
${R_LATEXCMD-latex} Rd2
314
${R_LATEXCMD-latex} Rd2
298
if test "${out_ext}" = pdf; then
315
if test "${out_ext}" = pdf; then
299
  ${R_LATEXCMD-latex} Rd2
316
  ${R_LATEXCMD-latex} Rd2
300
fi
317
fi
Line 307... Line 324...
307
  rm -rf ${build_dir}
324
  rm -rf ${build_dir}
308
else
325
else
309
  ${echo} "You may want to clean up by 'rm -rf ${build_dir}'"
326
  ${echo} "You may want to clean up by 'rm -rf ${build_dir}'"
310
fi
327
fi
311
${preview} ${output}
328
${preview} ${output}
312
exit 0
329
exit ${status}
313
 
330
 
314
### Local Variables: ***
331
### Local Variables: ***
315
### mode: sh ***
332
### mode: sh ***
316
### sh-indentation: 2 ***
333
### sh-indentation: 2 ***
317
### End: ***
334
### End: ***