# setwd -> ctrl+shift+enter -> remove this chunk
dir.create(path = "data")
dir.create(path = "souorces")
dir.create(path = "figures")
file.create("abstract")
file.create("main.Rmd")
file.create("sup.Rmd")
file.create("fig.Rmd")

\pagestyle{empty}

rm(list = ls())

library(tidyverse)
library(fudukue)
extrafont::loadfonts()

opts_chunk$set(fig.width = 5, fig.height = 7, dpi = 2000,
               echo = FALSE, message = FALSE, warning = FALSE, cache = FALSE, eval = TRUE)

Session information

devtools::session_info()
eval_fig <- FALSE
update_data <- FALSE

initialize_refs()

eval_fig <-
  if_else(out_type != "docx", T, F)

eqn_prefix <- c("Eq. ", "Eqs. ")
fig_prefix <- c("Fig. ", "Figs. ")
table_prefix <- c("Table", "Tables")

double_width <-  (166 / 25.4) %>% round(., 1)
mid_width <- (125 / 25.4) %>% round(., 1)
single_width <-  (80 / 25.4) %>% round(., 1)
TITLE <-
  "TITLE"

RUNNING_TITLE <-
  "SHORT TITLE"

AUTHORS <-
  lst(
    lst(name = "Keach Murakami", affiliation = c(1, 2), role = "Crsp", email = "keach.murakami@gmail.com"),
    lst(name = "Aaa Bbb", affiliation = c(2), role = ""),
    lst(name = "XXX YYY", affiliation = c(3), role = ""),
    lst(name = "Abc Def", affiliation = c(3), role = "Crsp", email = "HIS/HER EMAIL")
  )

AFFILIATIONS <-
  list(
    `1` = "Division of Plant Sciences, Research School of Biology, The Australian National University",
    `2` = "Graduate School of Sciences and Technology for Innovation, Yamaguchi University",
    `3` = "Graduate School of Science, XXX University"
  )

ADDRESSES <-
  lst(
    `1` = "Acton, ACT 2601, Australia",
    `2` = "Yoshida 1677–1, Yamaguchi 753–8515, Japan",
    `3` = "Somewhere"
  )

generate_author_list <-
  function(list_authors = AUTHORS, superscripts = TRUE){

    per_author <-
      if(superscripts){
        function(lst){
          author_record <- str_glue("{lst[[1]]}^{str_c(lst[[2]], collapse = ',')}")
          if_else(lst[[3]] == "Crsp", str_c(author_record, ",\\*^"), str_c(author_record, "^"))
        }
      } else {
        function(lst){
          author_record <- lst[[1]]
        }
      }

    list_authors %>%
      map(per_author) %>%
      str_c(collapse = ", ")
  }

generate_affiliation_list <-
  function(list_affiliations = AFFILIATIONS){
    list_affiliations %>%
      imap(~ str_glue("^{.y}^{.x}")) %>%
      str_c(collapse = "; ")
  }

generate_corredponding_list <-
  function(list_authors = AUTHORS){
    list_authors %>%
      map_if(~ .[3] != "Crsp", ~ list("", "", "", "")) %>%
      map(~ str_glue("{.[1]}: {.[4]}")) %>%
      str_c(collapse = "; ") %>%
      str_replace_all(": ; ", "")
  }
dir("sources", full.names = TRUE) %>% walk(source)
ref_fig <- function(...) "FIGURE"
ref_table <- function(...) "TABLE"
ref_eqn <- function(...) "EQUATION"

\newpage \setstretch{2} \large

Title & Authors


dir("figures/", full.names = T) %>%
  map(embed_fonts, options = "-c \"<</NeverEmbed []>> setdistillerparams\" -f ")

\newpage \linenumbers

Abstract (< 200 words)


Keywords

Abbreviations

\newpage \pagestyle{plain} \setcounter{page}{1} \setlength\parindent{12 pt} \captionsetup[figure]{name={r fig_prefix[1]}, labelsep=space, font={normal,stretch=2.5}} \captionsetup[table]{name={r table_prefix[1]}, labelsep=space, font={normal,stretch=2.5}}


\newpage
\noindent
Author contributions

\noindent
Disclosures

\noindent
Acknowledgements

\newpage \noindent \setcounter{page}{1} \pagestyle{fancy} \fancyhf{} \rhead{r RUNNING_TITLE | r str_extract(AUTHORS[[1]][[1]], ' .*') et al.} \fancyfoot[C]{Sup.~\thepage~}


\newpage \setcounter{page}{1} \pagestyle{fancy} \fancyhf{} \rhead{Captions} \fancyfoot[C]{C~\thepage~}

\listoffigures

\newpage \setcounter{page}{1} \pagestyle{fancy} \fancyhf{} \rhead{References} \fancyfoot[C]{R~\thepage~}

\setlength\parindent{12pt}

References



KeachMurakami/fudukue documentation built on May 22, 2019, 12:40 p.m.