Main lesson
Using captions (fig.cap
) treats plots, table or images differently and by default places one per page.
See ex_breaks.pdf
and ex_no_breaks.pdf
to see the difference.
Example of chronologically
Example of Captioned
In general the document with format each object chronologically. But some chuck options will modify the placement of an plot, table or image.
Bottom line: Markdown is not LaTeX. It was designed for HTML instead of LaTeX.
(Yihui Xie Explaining Markdown, Pandoc,formattting power on SO )[https://stackoverflow.com/a/17648350/9115822]
Using captions (fig.cap
) treats plots, table or images differently and by default places one per page.
See ex_breaks.pdf
and ex_no_breaks.pdf
to see the difference.
Example of chronologically
Example of Captioned
There are options to set behaviour but they don’t work very well, as they dont seem to be strict.
knitr::opts_chunk$set(fig.pos = "t")
Where:
h , here; t , top; b , bottom; p , page of float
---
title: "Example PDF Document"
author: "Ross"
date: "2018-07-02"
output:
pdf_document:
toc: true
toc_depth: 2
---
Latex/Pandoc commands can be used in the first layer of the yaml
. (First layer meaning the same indentation as title
, date
, etc.)
---
title: "Example PDF Document"
author: "Ross"
date: "2018-07-02"
geometry: margin=1.2in
---
This is a tricky one because there isn’t R
and RMarkdown
specific functions to modify the font…
All indications are that you have to use LaTeX.
\renewcommand{\familydefault}{\rmdefault}
(Some possibilities)[https://www.sharelatex.com/learn/Font_sizes,_families,_and_styles#Font_families]
Easy, using [^1]
and a connected [^1]: blah
:
Utinam accusata no sea, an nam solum omnium impedit, equidem propriae urbanitas per an. [^1]
[^1]: Lorem ipsum dolor sit amet, ius viris constituto mnesarchum ea, ius dicat inani iracundia ei, vim facer homero eirmod te. Nihil phaedrum qui eu.
There are a bunch of ways to do this. I have included in ex_main.Rmd
and example of a internal yaml
reference, with citation and Bibliography at the end. A bit of a LaTeX learning curve.
title: "Example PDF Document"
author: "Ross"
date: "2018-07-02"
references:
- id: fenner2012a
title: One-click science marketing
author:
- family: Fenner
given: Martin
container-title: Nature Materials
volume: 11
URL: 'http://dx.doi.org/10.1038/nmat3283'
DOI: 10.1038/nmat3283
issue: 4
publisher: Nature Publishing Group
page: 261-263
type: article-journal
issued:
year: 2012
month: 3
[@fenner2012a]
# References
By default a RMarkdown
using the pdf_document
output with have page numbers. Controlled in yaml
with LaTeX command:
title: "Example PDF Document"
author: "Ross"
date: "2018-07-02"
header-includes:
\pagenumbering{gobble}
If the data is in a data.frame
, df
or tibble
class object then we can just print()
the data to get a table.
Using the kable()
function neatens it up with cell borders etc.
kableExtra::kable(head(iris))
Captioning a table, changes the formatting (centres and puts at bottom of page). See ex_table.pdf
Example of Tables