library(ggplot2)
The chiaro_pdf
format is meant for articles to be printed (or viewed as PDFs) in the ordinary black-text-on-white-paper style. The main thing it adds to an ordinary R Markdown-to-PDF setup is TikZ figure wrangling: by default the document's main font will be used in figures as well (change this with a plot_font
option under output
). It also sets a black-and-white ggplot theme as the default (disable this with chunk option theme_bw
). The default figure dimensions are 4 in by 2 in (adjustable via chunk options or as options to the output format called fig_width
and fig_height
). Figure settings almost always require some tweaking, with special attention to the interaction between the fig.width
and fig.height
parameters and the out.width
parameter: the former two set the size of the image file (and hence its aspect ratio) whereas the latter gives the width (as a TeX dimension) in the final document. If you do not change out.width
, it will be set to the actual width of the image file or the \textwidth
, whichever is smaller. The type size before any scaling will be \footnotesize
(set via chunk option size
). Figure placement, captioning, and labeling are by the usual knitr
and LaTeX mechanisms. See fig.\ \ref{fig:cars}.
The LaTeX is based on a custom template which uses the memoir
package, the template included in my memarticle setup. A copy of this is included in this package. The page format is one-sided (symmetric margins) by default, but can be overridden by specifying classoption: [twoside]
. The accompanying Makefile here lets you simply use make
to turn this file into a PDF.
You can use biblatex
or biblatex-chicago
for references. In order to get rmarkdown
to process this correctly, set citation_package: biblatex
as a format option (under scuro::chiaro_pdf
). For biblatex-chicago
, set metadata key biblatex-chicago: true
. Set the remaining pandoc bibliography keys as normal, including biblatexoptions
and bibliography
. Set citation_package: none
to disable this feature.\autocite[An example citation:][]{wilde:soul}
ggplot(mtcars) + geom_point(aes(wt, mpg, color=factor(gear))) + labs(color="Gear")
Code listings and output may be included too, with the usual chunk options, but note that the echo
chunk option is set to false by default.
exp(1i * pi) + 1
(It's okay, R, math is complex.)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.