-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
88 lines (67 loc) · 4.21 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
title: "Repository for my poster at the Mendelian randomization conference 2019"
output: github_document
bibliography: MyBib.bib
---
```{r include=FALSE}
# switch this to eval = TRUE to evaluate the chunks that knit the poster and save the pdf
knitr::opts_chunk$set(eval = TRUE)
```
* The full information about the Mendelian randomization conference is at https://www.mendelianrandomization.org.uk/ .
* This poster was prepared using the `posterdown` package [@posterdown].
* The design is based on the Better Scientific Poster design by @betterposter.
* I picked up some tips how to edit the html template for the poster from https://github.com/lcolladotor/recount-brain-bog19 .
Here are the steps to recreate the poster.
1. Install the posterdown package and, due to the edits I made to my HTML template file, install the version of the bookdown package at this commit.
```{r, eval=FALSE}
# remotes::install_github("brentthorne/posterdown") # uncomment on first run
# remotes::install_github("rstudio/bookdown@364092a") # uncomment on first run
```
1. Launch the posterdown Rmd template for the portrait version of the Better Scientific Poster.
```{r, eval=FALSE}
rmarkdown::draft("mr2019-tom-palmer-poster.Rmd",
template = "posterdown_betterport",
package = "posterdown",
edit = FALSE)
```
1. Edit the Rmd file with your content.
* I edited the html template provided by posterdown:
- to make the icons opaque
- to make a level 4 header force a column break before the header. This is so that I could position the "Extra Figures & Tables" header at the top of the column. Note since I wanted the text of that header to be at level 1 I had to introduce the column break with a header level that I didn't use anywhere else on the poster. I used a level 4 header, so in my edited template I included the following code.
```css
.section h4 {
break-before: column;
}
```
Then to trigger the column break in the poster Rmd file I included an empty level 4 header `#### `.
1. Render the Rmd file to html. This can be achieved either by clicking the Knit button in RStudio or by running (change the file name for your poster's Rmd file).
```{r results='hide', warning=FALSE, message=FALSE, error=FALSE}
rmarkdown::render('mr2019-tom-palmer-poster.Rmd', encoding = 'UTF-8')
```
1. To render on github pages:
* I copied the html poster and its associated `_files` folder and folder of figures, `Figures`, to the `docs` folder because I prefer enabling github pages for a repo from the docs folder rather than from a separate branch. The html file is renamed to index.html (its _files folder doesn't need renaming, and in fact is empty, so doesn't show on the GitHub repo) so the github pages page will render.
```{r}
# install.packages("fs") # uncomment on first run
fs::file_copy("mr2019-tom-palmer-poster.html",
"./docs/index.html",
overwrite = TRUE)
fs::dir_copy("./Figures", "./docs/Figures", overwrite = TRUE)
fs::dir_copy("./mr2019-tom-palmer-poster_files",
"./docs/mr2019-tom-palmer-poster_files", overwrite = TRUE)
```
* I then enabled github pages for this repository in the repository settings on GitHub.
1. The pdf version of the poster can be generated either by opening the html version in Google Chrome and selecting `Print` then `Save as PDF` through the menus or by using the `chrome_print()` function in the [`pagedown`](https://github.com/rstudio/pagedown) package as follows.
```{r}
pagedown::chrome_print("mr2019-tom-palmer-poster.html")
```
* Note, I find that occasionally page and column breaks can be in slightly different positions in the pdf compared to the html, so it's always worth opening the pdf and checking this.
1. Note that this `README.md` file is generated by knitting `README.Rmd` as follows.
```{r, eval=FALSE}
rmarkdown::render('README.Rmd', encoding = 'UTF-8')
```
1. For reproducibility, I report my R session information.
```{r, eval=TRUE}
# install.packages("sessioninfo") # uncomment on first run
sessioninfo::session_info()
```
## References