Last active
May 3, 2019 13:18
-
-
Save uebayasi/198f8b82796bb750cc910712eefa7d78 to your computer and use it in GitHub Desktop.
rmd2pdf - Convert RMD to PDF reproducibly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# rmd2pdf.sh - Convert RMD to PDF reproducibly | |
# | |
# Requirements: lualatex (TeXlive) | |
# | |
set -e | |
rmd=$1 | |
tmp=$(mktemp XXXXXX) | |
cat <<END >$tmp | |
library('rmarkdown') | |
rmarkdown::render("$rmd") | |
END | |
cat <<END >_output.yaml | |
pdf_document: | |
toc: true | |
toc_depth: 2 | |
number_sections: true | |
latex_engine: lualatex | |
pandoc_args: | |
- --variable | |
- documentclass=ltjsarticle | |
END | |
env \ | |
SOURCE_DATE_EPOCH=0 \ | |
FORCE_SOURCE_DATE=1 \ | |
Rscript $tmp | |
rm -f $tmp _output.yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment