Debian Codegraph @

texmf-dist/doc/latex/includernw/includeRnw-doc.tex

raw
1 %% includeRnw v0.1.0b11 - 2018/05/01
2 %% The LaTeX package includeRnw - version v0.1.0 (2018/05/01) build 11
3 %% Manual/Documentation for includeRnw.sty
4 %% -------------------------------------------------------------------------------------------
5 %% Copyright (c) 2018 by Andreas Storvik Strauman
6 %% -------------------------------------------------------------------------------------------
7 %% This work may be distributed and/or modified under the
8 %% conditions of the LaTeX Project Public License, either version 1.3c
9 %% of this license or (at your option) any later version.
10 %% The latest version of this license is in
11 %% http://www.latex-project.org/lppl.txt
12 %% and version 1.3c or later is part of all distributions of LaTeX
13 %% version 2008/05/04 or later.
14 %% This work has the LPPL maintenance status `author-maintained'.
15 %% This work consists of all files listed in README.txt
16 \documentclass[a4paper]{article}
17 \usepackage[all]{tcolorbox}
18 \usepackage{needspace}
19 \usepackage{tabularx}
20 \usepackage{geometry}
21 \makeatletter
22 \def\input@path{{../../docs/}}
23 \lstdefinestyle{mydocumentation}{style=tcbdocumentation,
24 classoffset=0,
25 texcsstyle=*\color{blue},
26 moretexcs={arrayrulecolor,draw,includegraphics,ifthenelse,isodd,lipsum,path,pgfkeysalso},
27 classoffset=1,
28 moretexcs={% core
29 includeRnw
30 },
31 texcsstyle=*\color{Definition}\bfseries,
32 classoffset=0,% restore default
33 }
34 \newtcolorbox{marker}[1][]{enhanced,
35 before skip=2mm,after skip=3mm,
36 boxrule=0.4pt,left=5mm,right=2mm,top=1mm,bottom=1mm,
37 colback=yellow!50,
38 colframe=yellow!20!black,
39 sharp corners,rounded corners=southeast,arc is angular,arc=3mm,
40 underlay={%
41 \path[fill=tcbcol@back!80!black] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2);
42 \path[draw=tcbcol@frame,shorten <=-0.05mm,shorten >=-0.05mm] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2);
43 \path[fill=yellow!50!black,draw=none] (interior.south west) rectangle node[white]{\Huge\bfseries !} ([xshift=4mm]interior.north west);
44 },
45 drop fuzzy shadow,#1}
46 \def\l@macro#1#2{#1\hfill\newline}
47 \newcommand\macrotable{\hypersetup{linkcolor=black}\@starttoc{mac}\hypersetup{linkcolor=Definition}}
48 \newcommand\gh[1]{\href{#1}{https://github.com/#1}}
49 % --- CHANGELOG TABLE --- %
50 \newcommand*\l@version[2]{%
51 \ifnum \c@tocdepth >\z@
52 \addpenalty\@secpenalty
53 \addvspace{1.0em \@plus\p@}%
54 \setlength\@tempdima{1.5em}%
55 \begingroup
56 \parindent \z@ \rightskip \@pnumwidth
57 \parfillskip -\@pnumwidth
58 \leavevmode \bfseries
59 \advance\leftskip\@tempdima
60 \hskip -\leftskip
61 #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{}\par
62 \endgroup
63 \fi}
64 \newcommand*\l@change[2]{%
65 \addvspace{0.5em \@plus\p@}%
66 \leftskip1em--\hspace{0.5em}\begin{minipage}{0.5\textwidth}#1\end{minipage}\hfill%
67 \begin{minipage}{0.3\textwidth}#2\end{minipage}\par%
68 }
69
70 \newcommand\chlogtable{\begin{NoHyper}\@starttoc{chlog}\hypersetup{final}\end{NoHyper}}
71 \def\newversion#1{\addcontentsline{chlog}{version}{#1}}
72 \newcommand\change[2][]{\addtocontents{chlog}{\protect\contentsline{change}{#2}{#1}{section.\thepage}}}
73 % --- /CHANGELOG TABLE --- %
74
75 \let\oldTOC\tableofcontents
76 \renewcommand\tableofcontents{\hypersetup{linkcolor=black}\oldTOC\hypersetup{linkcolor=Definition}}
77 \reversemarginpar
78 \def\updated#1{\tcbdocmarginnote{\bfseries{\color{blue}U}#1}}
79 \def\defnew#1{\tcbdocmarginnote{\bfseries{\color{green}N}#1}}
80
81 \let\dac\docAuxCommand
82 \def\mdac#1{\docAuxCommand{\expandafter\@gobble\string#1}}
83
84 \makeatother
85
86 \long\def\keyDef#1#2#3#4{\begin{docKey}{#1}{=\meta{#2}}{\meta{default}=#3}#4\end{docKey}}
87 \long\def\optDef#1#2{\begin{docKey*}{#1}{}{}#2\end{docKey*}}
88 \tcbset{documentation listing style=mydocumentation}
89 % Magenta HREF style
90 \let\oldhref\href
91 \gdef\href#1#2{{\color{magenta}\oldhref{#1}{#2}}}
92 \tcbset{documentation listing style=mydocumentation,/tcb/color hyperlink=Definition}
93 \hypersetup{colorlinks=true}
94 % Give section some space
95 \let\oldsection\section
96 \gdef\section{\needspace{0.3\paperheight}\oldsection}
97 \let\oldsubsection\subsection
98 \gdef\subsection{\needspace{0.2\paperheight}\oldsubsection}
99
100
101 \setlength{\parindent}{0pt}
102 \title{{includeRnw - manual\\ v0.1.0{\\[-0.5em]\footnotesize(build 11)}}}
103 \author{Andreas Strauman}
104 \begin{document}
105 \maketitle
106 This package is for including \texttt{.Rnw}-files in normal \texttt{.tex}-files.
107 It invokes the command \texttt{R} from your command line.\\
108
109 If you found any bugs or want new functionality, to contribute, view the commented source, get latest version of this package or get in touch with me, you can do all of that at\\\url{https://github.com/Strauman/includeRnw/}. If you have questions of functionality, kindly direct them to the community\\ \url{http://tex.stackexchange.com}. The author is active on this site regularly.
110
111 \tableofcontents
112 \clearpage
113 \section{Quick start}
114 \begin{dispListing}
115 \documentclass{article}
116 \usepackage{includeRnw}
117 \begin{document}
118 \includeRnw{path/to/my.Rnw}
119 \end{document}
120 \end{dispListing}
121
122 The Rnw-file:
123 \begin{dispListing}
124 <<pChunk, echo=F, cache=F >>=
125 read_chunk('r/.r')
126 @
127 \end{dispListing}
128 \begin{marker}
129 Path to \texttt{r}-files are relative to the path of the \texttt{.Rnw}-file
130 \end{marker}
131 \section{Reference}
132 \filbreak\subsection{Reference}
133 \begin{docCommand}{includeRnw}{\oarg{irw-options}\marg{path/to/file.Rnw}}
134 \updated{v0.1.0\\2018/05/01 }Compiles .Rnw-files using R. Assumes that \texttt{R} can be called
135 from the command line. It is optional to add the extension \texttt{.Rnw}
136 \end{docCommand}
137 \filbreak\subsection{Command Options}
138 Options to use with \refCom{includeRnw}
139 \optDef{h}{Use the \refKey{h} to prevent \dac{includeRnw} from
140 actually knitting the file, but only include the knitted \texttt{.tex} file}
141 \optDef{f}{\refKey{f} forces \dac{includeRnw} to actually knitting the file no matter,
142 what (as long as it exists).}
143 \filbreak\subsection{Package Options}
144 \dac{usepackage}[\oarg{options}] where the \meta{options} are:\\
145 \optDef{halt}{If you do \dac{usepackage}[halt]\brackets{includeRnw},
146 then \dac{includeRnw}\{my/file.Rnw\} will \emph{not} run knitr on it.
147 However, if the knitted file exists, it will include this. You can
148 override this with the f-option in the \refCom{includeRnw}:
149 \dac{includeRnw}[f]\brackets{my/file.Rnw}}
150 \optDef{new}{This option would make the \refCom{includeRnw} only
151 run knitr on the file if the knitted file does not exist.
152 }
153 \optDef{noknithead}{
154 This option will prevent \dac{includeRnw} from building and including the knitr-preamble.
155 }
156 \optDef{texenv}{
157 Using the \texttt{texenv} option disables the default Rnw syntax and allows for a new one. See example below
158 }
159 The two following examples do the exact same thing:\\
160 This example use standard Rnw:
161 \begin{dispListing}
162 \documentclass[a4paper]{article}
163 \usepackage{includeRnw}
164 \begin{document}
165 <<pChunk, echo=F, cache=F >>=
166 read_chunk('r/myRScript.r')
167 @
168 \end{document}
169 \end{dispListing}
170 The following chunk uses the \refKey{texenv} option:
171 \begin{dispListing}
172 \documentclass[a4paper]{article}
173 \usepackage[texenv]{includeRnw}
174 \begin{document}
175 \begin{Rnw}{myChunk, echo=F, cache=F}
176 read_chunk('r/myRScript.r')
177 \end{Rnw}
178 \end{document}
179 \end{dispListing}
180 \filbreak\subsection{User macros}
181 The default user macro settables are
182 \begin{dispListing}
183 \rnwInputDirectory{.}
184 \rnwKnittedSuffix{knitted}
185 \rnwKnitlogFile{\rnw@dir@output/knitlog.log}
186 \rnwKnitheadName{\rnw@dir@output/knithead}
187 \end{dispListing}
188 Where \dac{rnw@dir@output} is the value of the set \dac{rnwOutputDirectory}
189 \begin{docCommand}{rnwInputDirectory}{\marg{directory}}
190 \defnew{v0.0.2\\2018/04/28 } This command sets what directory \dac{includeRnw} will be using. If you e.g.
191 have all the Rnw-files inside a directory called \texttt{myRnws} then
192 \dac{rnwInputDirectory}\brackets{myRnws} would fix this.
193 \end{docCommand}
194 \begin{docCommand}{rnwKnittedSuffix}{\marg{text}}
195 \defnew{v0.0.2\\2018/04/28 } Set the default suffix of the filename of the knitted output
196 \end{docCommand}
197 \begin{docCommand}{rnwKnitlogFile}{\marg{filename}}
198 \defnew{v0.0.2\\2018/04/28 } Sets the filename of the log output by knitr.
199 \end{docCommand}
200 \begin{docCommand}{rnwKnitheadName}{\marg{filename}}
201 \defnew{v0.0.2\\2018/04/28 } Sets the filename of the preamble generated by knitr.
202 \end{docCommand}
203 \filbreak\subsection{List of all macros}
204
205 \addcontentsline{mac}{macro}{\refCom{includeRnw}}{}
206 \addcontentsline{mac}{macro}{\refCom{rnwInputDirectory}}{}
207 \addcontentsline{mac}{macro}{\refCom{rnwKnitheadName}}{}
208 \addcontentsline{mac}{macro}{\refCom{rnwKnitlogFile}}{}
209 \addcontentsline{mac}{macro}{\refCom{rnwKnittedSuffix}}{}
210
211 \macrotable
212
213
214 % \newgeometry{lmargin=0.7cm}
215 \section{Changelog}
216 \newversion{v0.0.1 2018/04/20}
217 \change{Created the package}
218 \newversion{v0.0.2 2018/04/28}
219 \change{Fixed wrong error message on no shell-escape}
220 \change{Added macros for setting custom values}
221 \change{Added \refKey{noknithead}}
222 \newversion{v0.1.0 2018/05/01}
223 \change{Added \refKey{texenv}}
224 \change{Fixed bug where \refKey{new} and \refKey{halt} package options didn't work}
225 \change{Fixed bug where \refKey{n}, \refKey{h} and \refKey{f} command options didn't work}
226 \chlogtable
227 \end{document}