Quando si utilizza knitr con una classe come apa6e
, i blocchi di codice vengono impostati in modo da raddoppiare lo spazio come il resto del documento. Questo non è desiderabile.knitr codice di spazio singolo quando la classe imposta un doppio spazio (Rnw)
Questo potrebbe essere alterato avvolgendo con:
\begin{singlespace}
<<*>>=
CODE
@
\end{singlespace}
Come può questo essere fatto a livello globale, piuttosto che avvolgendo con le tex singoli tag spaziali?
MWE .Rnw il file
\documentclass[leavefloats]{apa6e}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa,backend=biber,bibencoding=latin1]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\begin{document}
<<setup, include=FALSE, cache=FALSE>>=
# set global chunk options
opts_chunk$set(fig.path='figure/minimal-', fig.align='center', fig.show='hold')
options(replace.assign=TRUE,width=90)
library(ggplot2); library(xtable)
@
\title{MWE}
\shorttitle{MWE}
\author{Tyler Rinker}
\date{\today}
\authornote{\dots}
\abstract{This is an example of an abstract in APA.}
\maketitle
<<foo>>=
x <- "Got me some code"
y <- "look another line"
paste(x, y)
@
\begin{singlespace}
<<bar>>=
x <- "Got me some code"
y <- "look another line"
paste(x, y)
@
\end{singlespace}
\end{document}
funziona perfettamente. Grazie. –