Rev 4736 | Blame | Last modification | View Log | Download | RSS feed
#!/bin/sh# Rd2dvi -- check man pages (*.Rd help files) by LaTeX..## Example (in $R_HOME):# bin/Rd2dvi src/library/base/man/Normal# bin/Rd2dvi `grep -l 'KEYWORD(distr' src/library/base/man/* |sort|uniq`#Pwd=`dirname $0`R_HOME=${Pwd}/..MANTEXDIR=${R_HOME}/doc/manualD2L="${Pwd}/Rdconv -t latex"file_sed='s/[_$]/\\\\&/g'# Quote the ^^^^ "\" twice (-> 4 \ ) since it used in ".."## If perl-sh: sub subject() {## "$1"'{\\Large \\file{'`echo $2 | sed $file_sed`"}$3" }#call_dir=`pwd`if [ -f Rd2.tex ]thenecho "'Rd2.tex' already exists -- renaming it to Rd2.tex.Older"echo " -------- "mv Rd2.tex Rd2.tex.Olderfitouch Rd2.texif [ $# -eq 1 -a -d $1 ]thendir=$1test -d $dir/man && dir=$dir/manecho "Rd2dvi : \`Rdconv -t latex' $dir/ files..."files="${dir}/*.Rd"subj='of all in {\\Large \\file{'`echo $dir | sed $file_sed`'}}'# DBG: echo "files = $files"toc_sed='; s/\\input{Rd/\\Rdcontents{\\R\\ objects documented:} &/'elsefiles="$@"if [ $# -gt 1 ]; then subj=' ...etc '; else subj=''; fisubj='of {\\Large \\file{'`echo $1 | sed $file_sed`"}$subj}"echo "Rd2dvi : Collecting files and \`Rdconv -t latex'ing them ..."toc_sed=''fi## DBG: echo ''; echo 'subj:'; echo "$subj"; echo ''for f in $filesdoecho $f$D2L $f >> Rd2.texdoneecho "MANTEXDIR='$MANTEXDIR'"R_P=`echo 'getenv("R_PAPERSIZE")'| R --vanilla --quiet|grep -v getenv|grep '"'|sed 's/ *//g;s/"//g'`sed "s/a4paper/${R_P}paper/; s| documentation |& ${subj} |; ${toc_sed}" \${MANTEXDIR}/Rd2dvi.tex > Rd2dvi.texif [ ! -f Rd.sty ]; thensed 's/markright{#1}/markboth{#1}{#1}/' ${MANTEXDIR}/Rd.sty > Rd2.styfi#exit#---------------------latex Rd2dviif [ -x `/usr/bin/which makeindex` ]then makeindex Rd2dvilatex Rd2dvifiif [ -x `/usr/bin/which xdvi` ]then xdvi Rd2dvi &fiecho ''echo 'Rd2dvi: You may want to clean up by'echo ' rm -f Rd2dvi.* Rd2.sty Rd2.tex*'echo ''