[R] Package documentation and rd.sty

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Nov 13 19:45:39 CET 2002


"Daniel Hoppe" <daniel.hoppe at em.uni-karlsruhe.de> writes:

> Hi all,
> 
> I've got a basic question regarding package documentation and rd.sty. I
> wrote my first own package, and now I would like to place the documentation
> into the appendix of another LaTex document. Seemingly I cannot simply
> \usepackage{Rd}, as this will modify the page-settings of my document. Is
> there a minimum style file which will just define the environments and
> commands needed for Rd-files but leaves the page-setup alone?
> 
> Thanks for your hints!

I bumped into just that in connection with the appendix in ISwR. I
butchered the Rd.sty (patch below), but perhaps something more
organized is called for. In particular, I didn't take care to change
the name or add a comment that I hacked it since it was not intended
for redistribution. 

        -p

--- /home/pd/R-devel/r-devel/R/share/texmf/Rd.sty	Thu May 10 16:38:24 2001
+++ /home/pd/ISWR/Rd.sty	Sun Jan 13 02:37:11 2002
@@ -27,11 +27,6 @@
 \RequirePackage{verbatim}        % small example code
 \RequirePackage{url}             % set urls
 
-\addtolength{\textheight}{12mm}
-\addtolength{\topmargin}{-9mm}   % still fits on US paper
-\addtolength{\textwidth}{24mm}   % still fits on US paper
-\setlength{\oddsidemargin}{10mm}
-\setlength{\evensidemargin}{\oddsidemargin}
 
 \newlength{\middle}
 \setlength{\middle}{\textwidth}
@@ -42,7 +37,6 @@
   {\begin{list}{}{\setlength{\leftmargin}{30pt}}\item}%
   {\end{list}}
 \newcommand{\HTML}{{\normalfont\textsc{html}}}
-\newcommand{\R}{{\normalfont\textsf{R}}{}}
 \newcommand{\Rdash}{-}
 
 \def\href#1#2{\special{html:<a href="#1">}{#2}\special{html:</a>}}
@@ -55,31 +49,24 @@
   \@starttoc{toc}}
 
 \newcommand{\Header}[2]{%
-  \vneed{1ex}
-  \markboth{#1}{#1}
+  \par\penalty-5000
   \noindent
-  \nopagebreak
+% \nopagebreak
   \begin{center}
-  \ifthenelse{\boolean{Rd at use@hyper}}%
-    {\def\@currentHref{page.\thepage}
-    \hypertarget{Rfn.#1}{\index{#1@\texttt{#1}}}%
-    \myaddcontentsline{toc}{subsection}{#1}%
-    \pdfbookmark[1]{#1}{Rfn.#1}}
-    {\addcontentsline{toc}{subsection}{#1}
-      \index{#1@\texttt{#1}|textbf}}
     \hrule
     \parbox{0.95\textwidth}{%
-      \begin{ldescription}[1.5in]
+      \begin{ldescription}[1.3in]
        \item[\texttt{#1}] \emph{#2}
       \end{ldescription}}
     \hrule
   \end{center}
-  \nopagebreak}
+  \nopagebreak
+}
 %
 %
 \ifthenelse{\boolean{Rd at use@hyper}}
-{\newcommand{\Link}[1]{\hyperlink{Rfn.#1}{#1}\index{#1@\texttt{#1}|textit}}}
-{\newcommand{\Link}[1]{#1\index{#1@\texttt{#1}|textit}}}
+{\newcommand{\Link}[1]{\hyperlink{Rfn.#1}{#1}}}
+{\newcommand{\Link}[1]{#1}}
 %
 % \alias{<alias>}{<header>}
 \ifthenelse{\boolean{Rd at use@hyper}}
@@ -89,7 +76,7 @@
 {\newcommand{\methalias}[2]{\hypertarget{Rfn.#1}{\relax}}}
 {\newcommand{\methalias}[2]{}}
 % \keyword{<topic>}{<header>}
-\newcommand{\keyword}[2]{\index{$*$Topic{\large\ \textbf{#1}}!#2@\texttt{#2}}}
+\newcommand{\keyword}[2]{}
 %
 \newcommand{\Itemize}[1]{\begin{itemize}{#1}\end{itemize}}
 \newcommand{\Enumerate}[1]{\begin{enumerate}{#1}\end{enumerate}}
@@ -150,7 +137,7 @@
 \newenvironment{Value}{%
   \begin{Rdsection}{Value}}{\end{Rdsection}}
 
-\newenvironment{ExampleCode}{\small\verbatim}{\endverbatim}
+\newenvironment{ExampleCode}{\footnotesize\verbatim}{\endverbatim}
 
 \ifx\textbackslash\undefined%-- e.g. for MM
   \newcommand{\bsl}{\ifmmode\backslash\else$\backslash$\fi}
@@ -167,9 +154,6 @@
 \newcommand{\bold}[1]{\ifmmode\bm{#1}\else\textbf{#1}\fi}
 \newcommand{\file}[1]{`\textsf{#1}'}
 
-\ifthenelse{\boolean{Rd at use@hyper}}
-{\newcommand{\link}[1]{\hyperlink{Rfn.#1}{#1}\index{#1@\texttt{#1}}}}
-{\newcommand{\link}[1]{#1\index{#1@\texttt{#1}}}}
 
 \newcommand{\email}[1]{$\langle${#1}$\rangle$}
 %% \code without `-' ligatures
@@ -192,65 +176,6 @@
   \DeclareFontShape{T1}{aett}{bx}{n}{<->ssub*aett/m/n}{}}
   {\message{NOT loading ae}}
 
-\ifthenelse{\boolean{Rd at use@hyper}}{%
-  \RequirePackage{color}
-  \definecolor{Blue}{rgb}{0,0,0.8}
-  \definecolor{Red}{rgb}{0.7,0,0}
-
-  \def\myaddcontentsline#1#2#3{%
-    \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}{page.\thepage}}}
-  \RequirePackage{hyperref}
-  \renewcommand\tableofcontents{%
-    \if at twocolumn
-      \@restonecoltrue\onecolumn
-    \else
-      \@restonecolfalse
-    \fi
-    \chapter*{\contentsname
-        \@mkboth{%
-           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
-    \pdfbookmark{Contents}{contents}
-    \@starttoc{toc}%
-    \if at restonecol\twocolumn\fi
-    }
-  \renewenvironment{theindex}
-  {\if at twocolumn
-    \@restonecolfalse
-    \else
-    \@restonecoltrue
-    \fi
-    \columnseprule \z@
-    \columnsep 35\p@
-    \twocolumn[\@makeschapterhead{\indexname}]%
-    \@mkboth{\MakeUppercase\indexname}%
-    {\MakeUppercase\indexname}%
-    \pdfbookmark{Index}{index}
-    \myaddcontentsline{toc}{chapter}{Index}
-    \thispagestyle{plain}\parindent\z@
-    \parskip\z@ \@plus .3\p@\relax
-    \raggedright
-    \let\item\@idxitem}
-  {\if at restonecol\onecolumn\else\clearpage\fi}
-  }{
-  \renewenvironment{theindex}
-  {\if at twocolumn
-    \@restonecolfalse
-    \else
-    \@restonecoltrue
-    \fi
-    \columnseprule \z@
-    \columnsep 35\p@
-    \twocolumn[\@makeschapterhead{\indexname}]%
-    \@mkboth{\MakeUppercase\indexname}%
-    {\MakeUppercase\indexname}%
-    \addcontentsline{toc}{chapter}{Index}
-    \thispagestyle{plain}\parindent\z@
-    \parskip\z@ \@plus .3\p@\relax
-    \raggedright
-    \let\item\@idxitem}
-  {\if at restonecol\onecolumn\else\clearpage\fi}
-  }
-
 
 \InputIfFileExists{Rd.cfg}{%
   \typeout{Reading personal defaults ...}}{}


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list