\def\fileversion{v0.5} \def\filename{RJournal} \def\filedate{2008/09/04} \def\docdate {2008/09/04} % % \iffalse % %% %% ***************************************** %% This file is defunct: for R Journal files please visit: %% https://journal.r-project.org/ %% ***************************************** %% % % \fi % % \iffalse % %% %% Package `RJournal' to use with LaTeX2e %% Copyright (C) 2008 by the R Foundation %% Please report errors to KH or FL %% %% -*- LaTeX -*- % % \fi % % \iffalse % \changes{v0.5}{2008/09/04}{Copy and edit Rnews.dtx.} % \fi % % \MakeShortVerb{\|} % % \newcommand{\AmS}{$${\protect\the\textfont2 A}\kern-.1667em\lower % .5ex\hbox{\protect\the\textfont2 M}\kern % -.125em{\protect\the\textfont2 S}} % \newcommand{\AmSLaTeX}{\mbox{\AmS-\LaTeX}} % % \title{The package \pkg{\filename}} % \author{Kurt Hornik \and Friedrich Leisch} % % \maketitle % % \section{Introduction} % % The \LaTeXe{} package \pkg{\filename} provides commands for formatting % The R Journal. % % \section{Documentation} % % \subsection{Marking Words and Phrases} % % The \pkg{Rnews} package provides roughly the same commands for marking % words and phrases as does Texinfo (but note that the \LaTeX special % characters still need special treatment). These commands are % \begin{description} % \item[\code{\cmd{\code}\{\var{sample-code}\}}] % Indicate text that is a literal example of a piece of a program. % \item[\code{\cmd{\kbd}\{\var{keyboard-characters}\}}] % Indicate keyboard input. % \item[\code{\cmd{\key}\{\var{key-name}\}}] % Indicate the conventional name for a key on a keyboard. % \item[\code{\cmd{\samp}\{\var{text}\}}] % Indicate text that is a literal example of a sequence of % characters. % \item[\code{\cmd{\var}\{\var{metasyntactic-variable}\}}] % Indicate a metasyntactic variable. % \item[\code{\cmd{\env}\{\var{environment-variable}\}}] % Indicate an environment variable. % \item[\code{\cmd{\file}\{\var{file-name}\}}] % Indicate the name of a file. % \item[\code{\cmd{\command}\{\var{command-name}\}}] % Indicate a command name (such as \samp{ls}). % \item[\code{\cmd{\option}\{\var{option-name}\}}] % Indicate a command line option. % \item[\code{\cmd{\dfn}\{\var{term}\}}] % Indicate the introductory or defining use of a term. % \item[\code{\cmd{\acronym}\{\var{acronym}\}}] % Use for abbreviattions written in all capital letters, such as % \samp{NASA}. % \end{description} % If this sounds rather confusing, please see the Texinfo documentation % for more details. % % \DescribeMacro{\strong} % There is also a |\strong| command for emphasizing text more strongly % than with |\emph|. For example, |\strong{Note:}| gives \strong{Note:}. % % \DescribeMacro{\pkg} % Finally, use |\pkg| for indicating R packages. % % \subsection{Quotations and Examples} % % In addition to the standard \LaTeX{} for quotations and examples (such % as |quote|, |quotation|, |flushleft|, |center| and |flushright|), the % \pkg{\filename} package provides the following environments. % \begin{description} % \item[\code{example}] % Illustrate code, commands, and the like. The text is printed in a % fixed-width font, and indented but not filled. % \item[\code{smallexample}] % Similar to \code{example}, except that text is typeset in a smaller % font. % \end{description} % These are patterned after the Texinfo environments with the same % names. In particular, |{|, |}|, |\| retain their ``usual'' meanings % and are not treated verbatim, which is not optimal for displaying R % code or output. Hence, we also provide a |smallverbatim| environment % which works like |verbatim| but uses a smaller font for typesetting. % % \subsection{Mathematics} % % \DescribeMacro{\P} % \DescribeMacro{\E} % \DescribeMacro{\VAR} % \DescribeMacro{\COV} % \DescribeMacro{\COR} % The commands |\P|, |\E|, |\VAR|, |\COV|, and |\COR| produce symbols % for probability, expectation, variance, covariance and correlation. % For example, Chebyshev's inequality % \DeleteShortVerb{\|} % \begin{displaymath} % \P(|\xi-\E\xi|>\lambda) \le \frac{\VAR(\xi)}{\lambda^2}. % \end{displaymath} % can be coded as % \MakeShortVerb{\|} % \begin{quote} % \verb+\P(|\xi-\E\xi|>\lambda) \le \frac{\VAR(\xi)}{\lambda^2}+. % \end{quote} % % \DescribeMacro{\mathbb} % The symbols % \begin{displaymath} % \mathbb{N}\quad\mathbb{Z}\quad\mathbb{Q}\quad\mathbb{R}\quad\mathbb{C} % \end{displaymath} % for the positive integers, the integers, and the rational, real and % complex numbers, respectively, can be obtained using |\mathbb| from % package \pkg{amsfonts} as % \begin{quote} % |\mathbb{N}| |\mathbb{Z}| |\mathbb{Q}| |\mathbb{R}| |\mathbb{C}| % \end{quote} % % \section{The Code} % % \subsection{The Batch File} % % First comes the code for creating the batch file \file{\filename.ins} % which in turn can be used for producing the package and driver files. % % \begin{macrocode} %<*install> \begin{filecontents}{\filename.ins} % Simply TeX or LaTeX this file to extract various files from the source % file `Rnews.dtx'. \def\filedate{2001/01/05} \def\batchfile{Rnews.ins} \input docstrip.tex \preamble \endpreamble \generateFile{Rnews.drv}{t}{\from{Rnews.dtx}{driver}} \generateFile{Rnews.sty}{t}{\from{Rnews.dtx}{package}} \Msg{***********************************************************} \Msg{* For documentation, run LaTeX on Rnews.dtx or Rnews.drv. *} \Msg{***********************************************************} \end{filecontents} % % \end{macrocode} % % \subsection{The Driver} % % Next comes the documentation driver file for \TeX{}, i.e., the file % that will produce the documentation you are currently reading. It % will be extracted from this file by the \texttt{docstrip} program. % Since it is the first code in the file one can alternatively process % this file directly with \LaTeXe{} to obtain the documentation. % % \begin{macrocode} %<*driver> \documentclass[fleqn]{ltxdoc} \usepackage[driver]{\filename} \renewcommand{\pkg}[1]{\textsf{#1}} \begin{document} \DocInput{\filename.dtx} \end{document} % % \end{macrocode} % % \subsection{The Code} % % Now comes the code for the package. % % It the current format is not \LaTeXe{}, we abort immediately. % Otherwise, we provide ourselves and show the current version of the % package on the screen and in the transscript file. % \begin{macrocode} %<*package> \NeedsTeXFormat{LaTeX2e}[1995/12/01] \ProvidesPackage{\filename}[\filedate\space\fileversion\space Rnews package] \typeout{Package: `\filename\space\fileversion \@spaces <\filedate>'} \typeout{English documentation as of <\docdate>} % \end{macrocode} % % Next, we set up a more or less trivial option handler. We use option % `driver' for conditionalizing package code we do not want executed % when typesetting the driver file. % \begin{macrocode} \RequirePackage{ifthen} \newboolean{Rnews@driver} \DeclareOption{driver}{\setboolean{Rnews@driver}{true}} \DeclareOption*{\PackageWarning{\filename}{Unknown option `\CurrentOption'}} \ProcessOptions\relax % \end{macrocode} % % Now comes the real code. % % \begin{macrocode} \ifthenelse{\boolean{Rnews@driver}}{}{ % \end{macrocode} % % First we load some utility packages. % \begin{macrocode} \RequirePackage{multicol,graphicx,color,fancyhdr,hyperref} \IfFileExists{upquote.sty}{\RequirePackage{upquote}}{} % \end{macrocode} % % \subsubsection{Basic Structure} % % Issues of of \emph{The R Journal} are created from the standard \LaTeX{} % document class \pkg{report}. Individual articles correspond to % chapters, and are contained in |article| environments. This makes it % easy to have figures counted within articles and hence hyperlinked % correctly. % % Basic front matter information about the issue: volume, number, and % date. % \begin{macrocode} \newcommand{\volume}[1]{\def\Rnews@volume{#1}} \newcommand{\volnumber}[1]{\def\Rnews@number{#1}} \renewcommand{\date}[1]{\def\Rnews@date{#1}} % \end{macrocode} % % We do not want numbered sections. % \begin{macrocode} \setcounter{secnumdepth}{-1} % \end{macrocode} % % \begin{macro}{\author} % \begin{macro}{\title} % \begin{macro}{\subtitle} % An article has an author, a title, and optionally a subtitle. We use % the obvious commands for specifying these. % \begin{macrocode} \renewcommand{\author}[1]{\def\Rnews@author{#1}} \renewcommand{\title}[1]{\def\Rnews@title{#1}} \newcommand{\subtitle}[1]{\def\Rnews@subtitle{#1}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % Note that we put the title info in the TOC and the bookmarks when % creating PDF. Thus titles should really only contain text. % % \begin{environment}{article} % Environment |article| clears the article header information its begin % and restores single column mode at its end. % \begin{macrocode} \newenvironment{article}{% \author{}\title{}\subtitle{}}{\end{multicols}} % \end{macrocode} % \end{environment} % % \begin{macro}{\maketitle} % The real work is done by a redefined version of |\maketitle|, which % also switches to double column mode. Note that even though we do not % want chapters (articles) numbered, we need to increment the chapter % counter, so that figures get correct labelling. % \begin{macrocode} \renewcommand{\maketitle}{ \begin{multicols}{2}[\chapter{\Rnews@title}\refstepcounter{chapter}][3cm] \ifx\empty\Rnews@subtitle\else\noindent\textbf{\Rnews@subtitle} \par\nobreak\addvspace{\baselineskip}\fi \ifx\empty\Rnews@author\else\noindent\textit{\Rnews@author} \par\nobreak\addvspace{\baselineskip}\fi \@afterindentfalse\@nobreaktrue\@afterheading} % \end{macrocode} % \end{macro} % % Now for some ugly redefinitions. We do not want articles to start a % new page. % \begin{macrocode} \renewcommand\chapter{\secdef\Rnews@chapter\@schapter} \providecommand{\nohyphens}{% \hyphenpenalty=10000\exhyphenpenalty=10000\relax} \newcommand{\Rnews@chapter}{% \renewcommand{\@seccntformat}[1]{}% \@startsection{chapter}{0}{0mm}{% -2\baselineskip \@plus -\baselineskip \@minus -.2ex}{\p@}{% \normalfont\Huge\bfseries\raggedright}} % \end{macrocode} % TOC entries for articles (chapters) should really look like sections. % \begin{macrocode} \renewcommand*\l@chapter{\@dottedtocline{0}{0pt}{1em}} % \end{macrocode} % We want bibliographies as starred sections within articles. As the % standard |thebibliography| environment uses |\chapter*|, we simply % redefine the latter according to our needs. % \begin{macrocode} \def\@schapter#1{\section*#1} % \end{macrocode} % % Package \pkg{multicol}, which is used for producing two-column output, % only allows for starred (single-column) floats (figures and tables). % Therefore, we provide a simple non-floating |figure| environment % ourselves. % \begin{macrocode} \renewenvironment{figure}[1][]{% \def\@captype{figure} \noindent \begin{minipage}{\columnwidth}}{% \end{minipage}\par\addvspace{\baselineskip}} % \end{macrocode} % Equations, figures and tables are counted within articles, but we do % not show the article number. Unfortunately, for equations this means % that we need to redefine |equation| as otherwise hyperref computes the % equation hyperlinks (via |\make@stripped@name{\theequation}|) as % |equation.\theequation|. % \begin{macrocode} \renewcommand{\theequation}{\@arabic\c@equation} \def\equation{% \let\refstepcounter\H@refstepcounter \H@equation \def\newname{\arabic{chapter}.\theequation}% \let\theHequation\newname% \hyper@makecurrent{equation}% \Hy@raisedlink{\hyper@anchorstart{\@currentHref}}% \let\refstepcounter\new@refstepcounter}% \def\endequation{\Hy@raisedlink{\hyper@anchorend}\H@endequation} \renewcommand{\thefigure}{\@arabic\c@figure} \renewcommand{\thetable}{\@arabic\c@table} % \end{macrocode} % % \begin{macro}{\tableofcontents} % Need to provide our own version of |\tableofcontents| (no fiddling % with the number of columns). Note that |\section*| is really the same % as |\chapter*|). % \begin{macrocode} \renewcommand{\contentsname}{Contents of this issue:} \renewcommand\tableofcontents{% \section*{\contentsname \@mkboth{% \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}% \@starttoc{toc}} % \end{macrocode} % \end{macro} % \begin{macro}{\titlepage} % The title page of each issue features logo et al at the top and the % TOC. We start with the top. % \begin{macrocode} \renewcommand{\titlepage}{% \noindent \rule{\textwidth}{1pt}\\[-.8\baselineskip] \rule{\textwidth}{.5pt} \begin{center} \fontsize{2cm}{2cm}\selectfont The \includegraphics[height=2cm]{Rlogo}\hspace{7mm} Journal \end{center} Volume \Rnews@volume/\Rnews@number, \Rnews@date\\[-.5\baselineskip] \rule{\textwidth}{.5pt}\\[-.8\baselineskip] \rule{\textwidth}{1pt} \vspace{1cm} % \end{macrocode} % Now set up the header and footer information for the rest of the % document. % \begin{macrocode} \fancyhf{} \fancyhead[L]{Vol.~\Rnews@volume/\Rnews@number, \Rnews@date} \fancyhead[R]{\thepage} \fancyfoot[L]{The R Journal} \fancyfoot[R]{ISSN ????-????} \thispagestyle{empty} % \end{macrocode} % And finally, put the TOC at the bottom in a framed box. Note the way % |tocdepth| is adjusted before and after producing the TOC: thus, we % can ensure that only articles show up in the printed TOC, but that in % the PDF version, bookmarks are created for sections and subsections as % well (provided that the non-starred forms are used). % \begin{macrocode} \begin{bottombox} \begin{multicols}{2} \setcounter{tocdepth}{0} \tableofcontents \setcounter{tocdepth}{2} \end{multicols} \end{bottombox}} % \end{macrocode} % \end{macro} % % The R News section at the end of the journal can be started with the % following command: % \begin{macrocode} \newcommand{\startRnews}{% \newpage\noindent \begin{center} \fontsize{15mm}{1mm}\selectfont \includegraphics[height=15mm]{Rlogo}\hspace{7mm} News \end{center} \rule{\textwidth}{.5pt} \vspace{1cm} \addcontentsline{toc}{chapter}{R News} } % \end{macrocode} % \subsubsection{Layout, Fonts and Color} % % \paragraph{Layout.} % We set the basic layout parameters in a way that printouts should be % fine for both A4 and Letter paper. % \begin{macrocode} \setlength{\textheight}{250mm} \setlength{\topmargin}{-10mm} \setlength{\textwidth}{17cm} \setlength{\oddsidemargin}{-6mm} \setlength{\columnseprule}{.1pt} \setlength{\columnsep}{20pt} % \end{macrocode} % % \paragraph{Fonts.} % We use the following fonts (all with T1 encoding): % \begin{center} % \begin{tabular}{lp{0.8\textwidth}} % rm & palatino \\ % tt & almost european (computer modern working with T1) \\ % & Reason for aett: uses less horizontal space than courier, % which is better for example code \\ % sf & almost european \\ % math & palatino % \end{tabular} % \end{center} % % \begin{macrocode} \RequirePackage{ae,mathpple} \RequirePackage[T1]{fontenc} \renewcommand{\rmdefault}{ppl} \renewcommand{\sfdefault}{aess} \renewcommand{\ttdefault}{aett} % \end{macrocode} % % \paragraph{Colors.} These are actually used for |\hypersetup| but we % do not call this here, although we should. % \marginpar{FIXME} % \begin{macrocode} \definecolor{Red}{rgb}{0.7,0,0} \definecolor{Blue}{rgb}{0,0,0.8} \definecolor{hellgrau}{rgb}{0.55,0.55,0.55} % \end{macrocode} % % \subsubsection{Miscellania} % % \begin{macrocode} \newcommand{\R}{R} \newcommand{\address}[1]{\addvspace{\baselineskip}\noindent\emph{#1}} \newcommand{\email}[1]{\href{mailto:#1}{\normalfont\texttt{#1}}} % \end{macrocode} % % \begin{environment}{bottombox} % Used for creating the TOC and the back matter editorial information. % \begin{macrocode} \newsavebox{\Rnews@box} \newlength{\Rnews@len} \newenvironment{bottombox}{% \begin{figure*}[b] \begin{center} \noindent \begin{lrbox}{\Rnews@box} \begin{minipage}{0.99\textwidth}}{% \end{minipage} \end{lrbox} \addtolength{\Rnews@len}{\fboxsep} \addtolength{\Rnews@len}{\fboxrule} \hspace*{-\Rnews@len}\fbox{\usebox{\Rnews@box}} \end{center} \end{figure*}} % \end{macrocode} % \end{environment} % % \begin{environment}{boxedverbatim} % Used for creating a boxed (small) verbatim environment, e.g., when % showing output that is too wide for displaying in two-column mode. % The code is taken from package \pkg{moreverb}. Note that we need to % use |verbatim| rather than |alltt|. % \begin{macrocode} \RequirePackage{verbatim} \def\boxedverbatim{% \def\verbatim@processline{% {\setbox0=\hbox{\the\verbatim@line}% \hsize=\wd0 \the\verbatim@line\par}}% \@minipagetrue \@tempswatrue \setbox0=\vbox \bgroup\small\verbatim } \def\endboxedverbatim{% \endverbatim \unskip\setbox0=\lastbox \egroup \fbox{\box0} } % \end{macrocode} % \end{environment} % % Finally, we turn on fancy page style. % \begin{macrocode} \pagestyle{fancy} } % \ifthenelse{\boolean{Rnews@driver}} % \end{macrocode} % % \subsubsection{Marking Words and Phrases} % % Simple font selection is not good enough. For example, |\texttt{--}| % gives `\texttt{--}', i.e., an endash in typewriter font. Hence, we % need to turn off ligatures, which currently only happens for commands % |\code| and |\samp| and the ones derived from them. Hyphenation is % another issue; it should really be turned off inside |\samp|. And % most importantly, \LaTeX{} special characters are a nightmare. E.g., % one needs |\~{}| to produce a tilde in a file name marked by |\file|. % Perhaps a few years ago, most users would have agreed that this may be % unfortunate but should not be changed to ensure consistency. But with % the advent of the WWW and the need for getting `|~|' and `|#|' into % URLs, commands which only treat the escape and grouping characters % specially have gained acceptance (in fact, this is also what % \pkg{alltt} does, and hence environments based on it such as our % |smallexample|). Hence, in the long run we should implement the same % for |\code|, |\kbd|, |\samp|, |\var|, and |\file|. (The other % Texinfo-style commands do not need this.) % % \begin{macrocode} %\newcommand\code{\bgroup\@noligs\@codex} \newcommand\code{\bgroup\@codex} \def\@codex#1{{\normalfont\ttfamily\hyphenchar\font=-1 #1}\egroup} \newcommand{\kbd}[1]{{\normalfont\texttt{#1}}} \newcommand{\key}[1]{{\normalfont\texttt{\uppercase{#1}}}} \newcommand\samp{`\bgroup\@noligs\@sampx} \def\@sampx#1{{\normalfont\texttt{#1}}\egroup'} \newcommand{\var}[1]{{\normalfont\textsl{#1}}} \let\env=\code \newcommand{\file}[1]{{`\normalfont\textsf{#1}'}} \let\command=\code \let\option=\samp \newcommand{\dfn}[1]{{\normalfont\textsl{#1}}} \newcommand{\acronym}[1]{{\normalfont\textsc{\lowercase{#1}}}} \newcommand{\strong}[1]{{\normalfont\fontseries{b}\selectfont #1}} \let\pkg=\strong % \end{macrocode} % % \subsubsection{Quotations and Examples} % % \begin{macrocode} \RequirePackage{alltt} \newenvironment{example}{\begin{alltt}}{\end{alltt}} \newenvironment{smallexample}{\begin{alltt}\small}{\end{alltt}} \newenvironment{display}{\list{}{}\item\relax}{\endlist} \newenvironment{smallverbatim}{\small\verbatim}{\endverbatim} % \end{macrocode} % Support for output from Sweave. % \begin{macrocode} \RequirePackage{fancyvrb} \DefineVerbatimEnvironment{Sinput}{Verbatim}{fontsize=\small,fontshape=sl} \DefineVerbatimEnvironment{Soutput}{Verbatim}{fontsize=\small} \DefineVerbatimEnvironment{Scode}{Verbatim}{fontsize=\small,fontshape=sl} % \end{macrocode} % % \subsubsection{Mathematics} % % \begin{macro}{\operatorname} % The implementation of |\operatorname| is similar to the mechanism % \LaTeXe{} uses for functions like sin and cos, and simpler than the % one of \AmSLaTeX{}. We use |\providecommand| for the definition in % order to keep the one of the \pkg{amstex} if this package has % already been loaded. % \begin{macrocode} \providecommand{\operatorname}[1]{% \mathop{\operator@font#1}\nolimits} % \end{macrocode} % \end{macro} % % \begin{macro}{\P} % \begin{macro}{\E} % \begin{macro}{\VAR} % \begin{macro}{\COV} % \begin{macro}{\COR} % Next, we provide commands for probability, expectation, variance, % covariance and correlation which are obviously useful in probability % theory and statistics. % (Of course, originally |\P| gives \mathhexbox27B.) % \begin{macrocode} \renewcommand{\P}{% \mathop{\operator@font I\hspace{-1.5pt}P\hspace{.13pt}}} \newcommand{\E}{% \mathop{\operator@font I\hspace{-1.5pt}E\hspace{.13pt}}} \newcommand{\VAR}{\operatorname{var}} \newcommand{\COV}{\operatorname{cov}} \newcommand{\COR}{\operatorname{cor}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % Finally, we load package \pkg{amsfonts} so that |\mathbb| is available % for producing the symbols for positive integers etc. % \begin{macrocode} \RequirePackage{amsfonts} % \end{macrocode} % % This ends the implementation of the \pkg{\filename} package. % \begin{macrocode} % % \end{macrocode}