-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updates to paper production to allow for separate paper information y…
…aml and auotomated manuscript PDF generation using R script
- Loading branch information
1 parent
6d56826
commit 095378a
Showing
9 changed files
with
1,423 additions
and
49 deletions.
There are no files selected for viewing
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#a script to knit and produce the full document | ||
|
||
#You can specify below what additional Rmd files you want to be added to | ||
#main.pdf for the full manuscript (currently tables and figures and appendix). | ||
#The program will change page numbering for the supplementary pdfs so there | ||
#is no need to change page numbers in the YAML. The script will also | ||
#create a title page since many journals require this. | ||
|
||
separate_tabfigs <- TRUE | ||
separate_appendix <- TRUE | ||
|
||
library(pdftools) | ||
library(rmarkdown) | ||
|
||
# Knit PDFs --------------------------------------------------------------- | ||
|
||
#first remove all existing PDF files | ||
system("rm *.pdf") | ||
|
||
#assume main.Rmd exists or no point to this | ||
render("main.Rmd") | ||
|
||
#now render additional pdfs | ||
list_of_pdfs <- "main.pdf" | ||
start_page <- pdf_length("main.pdf")+1 | ||
if(separate_tabfigs & file.exists("tablesfigs.Rmd")) { | ||
render("tablesfigs.Rmd", | ||
output_options = list(pandoc_args = c(paste("--metadata=pagenumber:", | ||
start_page, sep=" ")))) | ||
start_page <- start_page + pdf_length("tablesfigs.pdf") | ||
list_of_pdfs <- c(list_of_pdfs, "tablesfigs.pdf") | ||
} | ||
if(separate_appendix & file.exists("appendix.Rmd")) { | ||
render("appendix.Rmd", | ||
output_options = list(pandoc_args = c(paste("--metadata=pagenumber:", | ||
start_page, sep=" ")))) | ||
list_of_pdfs <- c(list_of_pdfs, "appendix.pdf") | ||
} | ||
|
||
#now do the title page | ||
if(file.exists("title_page.Rmd")) { | ||
render("title_page.Rmd") | ||
} | ||
|
||
pdf_combine(list_of_pdfs, output = "full_manuscript.pdf") |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
title: "The Title" | ||
author: | ||
- affiliation: University of Oregon, Sociology | ||
name: Aaron Gullickson | ||
- affiliation: Some Research University | ||
name: My co-author | ||
keywords: keywords | ||
#FYI: the thanks and abstract are easier to view and edit in Atom which does proper linewrapping | ||
thanks: Thanks to people and stuff | ||
abstract: This is a test abstract | ||
--- |
Oops, something went wrong.