%% \VignetteIndexEntry{Bioconductor LaTeX Style} \documentclass{article} <>= BiocStyle::latex() @ \newcommand{\exitem}[3]{\item \texttt{\textbackslash#1\{#2\}} #3 \csname#1\endcsname{#2}.} \title{\Bioconductor{} \LaTeX{} Style} \author{Martin Morgan, Andrzej Ole\'s, Wolfgang Huber} \begin{document} \SweaveOpts{concordance=TRUE} \maketitle \tableofcontents \section{Use} To use with Sweave, add the following to your package \file{DESCRIPTION} file: \begin{verbatim} Suggests: BiocStyle \end{verbatim} and add this code chunk to your \texttt{.Rnw} file: \begin{verbatim} <>= BiocStyle::latex() @ \end{verbatim} To use with \CRANpkg{knitr}, add the following to the \file{DESCRIPTION} file: \begin{verbatim} VignetteBuilder: knitr Suggests: BiocStyle \end{verbatim} and this to your \texttt{.Rnw} file: \begin{verbatim} <>= BiocStyle::latex() @ \end{verbatim} See \Rcode{?latex} for additional options. Page headers contain the title of the vignette as defined by \verb+\title+, override it by adding the following line to the preamble of your vignette: \begin{verbatim} \renewcommand{\thetitle}{Short header title} \end{verbatim} \Biocpkg{BiocStyle} automatically attaches the following \LaTeX{} packages: \texttt{color}, \texttt{fancyhdr}, \texttt{geometry}, \texttt{helvet}, \texttt{hyperref}, \texttt{sectsty}, \texttt{Sweave} and \texttt{titling}. \section{Markup commands} \Biocpkg{BiocStyle} introduces the following additional markup styling commands useful in typical \Bioconductor{} vignettes.\\\\ %% Software: \begin{itemize} \item \verb+\R{}+ and \verb+\Bioconductor{}+ to reference \R{} software and the \Bioconductor{} project. \exitem{software}{GATK}{to reference third-party software, e.g.,} \end{itemize} \vspace{1em} %% Packages: \begin{itemize} \exitem{Biocpkg}{IRanges}{for \Bioconductor{} software packages, including a link to the release version landing page,} \exitem{Biocannopkg}{org.Hs.eg.db}{for \Bioconductor{} annotation packages, including a link to the release version landing page,} \exitem{Biocexptpkg}{parathyroidSE}{for \Bioconductor{} experiment data packages, including a link to the release version landing page,} \exitem{CRANpkg}{data.table}{for \R{} packages available on CRAN, including a link to the FHCRC CRAN mirror landing page,} \exitem{Rpackage}{MyPkg}{for \R{} packages that are \emph{not} available on \Bioconductor{} or CRAN,} \end{itemize} \vspace{1em} %% Code: \begin{itemize} \exitem{Rfunction}{findOverlaps}{for functions} \exitem{Robject}{olaps}{for variables} \exitem{Rclass}{GRanges}{when referring to a formal class} \exitem{Rcode}{log(x)}{for \R{} code,} \end{itemize} \vspace{1em} %% Communication: \begin{itemize} \exitem{comment}{comment to the user}{communicates a} \exitem{warning}{common pitfalls}{signals} \exitem{fixme}{incomplete functionality}{provides an indication of} \end{itemize} \vspace{1em} %% General: \begin{itemize} \exitem{email}{user@domain.com}{to provide a linked email address,} \exitem{file}{script.R}{for file names and file paths} \end{itemize} %--------------------------------------------------------- \section{Sectioning: this is a section} %--------------------------------------------------------- Use \verb+\tableofcontents+ for a hyperlinked table of contents, \verb+\section+, \verb+\subsection+, \verb+\subsubsection+ for structuring your vignette. \subsection{This is a subsection} Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. \subsubsection{This is a subsubsection} Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. %--------------------------------------------------------- \section{Including figures}\label{incfig} %--------------------------------------------------------- Besides the usual \LaTeX{} capabilities (\verb+figure+ environment and \verb+\includegraphics+ command), \file{Bioconductor.sty} defines a macro \verb+\incfig[placement]{filename}{width}{shorttitle}{extendedcaption}+, which expects four arguments: \begin{description}%[font=\texttt] \item[filename] The name of the figure file, also used as the label by which the float can be referred to by \verb+\ref{}+. Some \software{Sweave} and \CRANpkg{knitr} options place figures in a subdirectory; unless \Rcode{short.fignames=TRUE} is set the full file name, including the subdirectory and any prefixes, should be provided. By default, these are \file{-} for \Rpackage{Sweave} and \file{figure/} for \CRANpkg{knitr}. \item[width] Figure width. \item[shorttitle] A short description, used in the list of figures and printed in bold as the first part of the caption. \item[extendedcaption] Continuation of the figure caption. \end{description} The optional \textbf{placement} specifier controls where the figure is placed on page and takes the usual values allowed by \LaTeX{} floats, i.e., a list containing \verb+t+, \verb+b+, \verb+p+, or \verb+h+, where letters enumerate permitted placements. If no placement specifier is given, the default \verb+tbp+ is assumed. For \verb+incfig+ with Sweave, use \begin{verbatim} <>= v = seq(0, 60i, length=1000) plot(abs(v)*exp(v), type="l", col="Royalblue") @ \incfig{LatexStyle-figureexample}{0.25\textwidth}{A curve.} {The code that creates this figure is shown in the code chunk.} as shown in Figure~\ref{LatexStyle-figureexample}. \end{verbatim} This results in <>= v = seq(0, 60i, length=1000) plot(abs(v)*exp(v), type="l", col="Royalblue") @ \incfig{LatexStyle-figureexample}{0.25\textwidth}{A curve.} {The code that creates this figure is shown in the code chunk.} as shown in Figure~\ref{LatexStyle-figureexample}. When the option \Rcode{short.fignames} is set to \Rcode{TRUE}, figure names used by \verb+\incfig+ and \verb+\ref+ do not contain any prefix and are identical to the corresponding code chunk labels. For example, the respective code for the above example would be \verb+\incfig{figureexample}{...}{...}{...}+ and \verb+\ref{figureexample}+. For \verb+\incfig+ with \Rpackage{knitr}, use the option \Rcode{fig.show='hide'} rather than \Rcode{include=FALSE}. The \Rpackage{knitr}-equivalent code for Figure~\ref{LatexStyle-figureexample} is: \begin{verbatim} <>= v = seq(0, 60i, length=1000) plot(abs(v)*exp(v), type="l", col="Royalblue") @ \end{verbatim} Note the difference in option names setting the figure width and height compared to \Rpackage{Sweave}. Unless \Rcode{short.fignames=TRUE} is set, use the default \file{figure/} prefix when inserting and referring to figures, e.g.: \begin{verbatim} \incfig{figure/figureexample}{0.25\textwidth}{A curve.} {The code that creates this figure is shown in the code chunk.} \end{verbatim} A custom prefix for figure file names can be passed to \Rfunction{latex} using the \Rcode{fig.path} option. When \Rcode{short.fignames=TRUE}, figures can be referred to directly by code chunk labels, as described in Section~\ref{incfig}. %--------------------------------------------------------- \section{Session info} %--------------------------------------------------------- Here is the output of \Rfunction{sessionInfo} on the system on which this document was compiled: <>= toLatex(sessionInfo()) @ \end{document}