|
| 1 | +#--- NOTE to contributors ------------------------------------------------------ |
| 2 | +# Please order these format functions alphabetically. |
| 3 | +#------------------------------------------------------------------------------- |
| 4 | + |
| 5 | +#' R Markdown output formats for (journal) articles |
| 6 | +#' |
| 7 | +#' Most article formats are based on \code{rmarkdown::pdf_document()}, with a |
| 8 | +#' custom Pandoc LaTeX template and different default values for other arguments |
| 9 | +#' (e.g., \code{keep_tex = TRUE}). |
| 10 | +#' |
| 11 | +#' @section Details: You can find more details about each output format below. |
| 12 | +#' @name acm_article |
| 13 | +#' @rdname article |
| 14 | +NULL |
| 15 | + |
| 16 | +#' @section \code{acm_article}: Format for creating an Association for Computing |
| 17 | +#' Machinery (ACM) articles. Adapted from |
| 18 | +#' \url{http://www.acm.org/publications/article-templates/proceedings-template.html}. |
| 19 | +#' @param |
| 20 | +#' ...,keep_tex,latex_engine,citation_package,highlight,fig_caption,md_extensions |
| 21 | +#' Arguments passed to \code{rmarkdown::\link{pdf_document}()}. |
| 22 | +#' @return An R Markdown output format. |
| 23 | +#' @examples \dontrun{ |
| 24 | +#' rmarkdown::draft("MyArticle.Rmd", template = "acm_article", package = "rticles") |
| 25 | +#' rmarkdown::draft("MyArticle.Rmd", template = "asa_article", package = "rticles")} |
| 26 | +#' @export |
| 27 | +#' @rdname article |
| 28 | +acm_article <- function(...) { |
| 29 | + pdf_document_format("acm_article", ...) |
| 30 | +} |
| 31 | + |
| 32 | +#' @section \code{acs_article}: Format for creating an American Chemical Society |
| 33 | +#' (ACS) Journal articles. Adapted from |
| 34 | +#' \url{http://pubs.acs.org/page/4authors/submission/tex.html}. |
| 35 | +#' @export |
| 36 | +#' @rdname article |
| 37 | +acs_article <- function( |
| 38 | + ..., keep_tex = TRUE, md_extensions = c("-autolink_bare_uris"), fig_caption = TRUE |
| 39 | +) { |
| 40 | + pdf_document_format( |
| 41 | + "acs_article", keep_tex = keep_tex, md_extensions = md_extensions, |
| 42 | + fig_caption = fig_caption, ... |
| 43 | + ) |
| 44 | +} |
| 45 | + |
| 46 | +#' @section \code{aea_article}: Format for creating submissions to the American |
| 47 | +#' Economic Association (AER, AEJ, JEL, PP). |
| 48 | +#' @export |
| 49 | +#' @rdname article |
| 50 | +aea_article <- function(..., keep_tex = TRUE, md_extensions = c("-autolink_bare_uris")) { |
| 51 | + pdf_document_format( |
| 52 | + "aea_article", keep_tex = keep_tex, md_extensions = md_extensions, ... |
| 53 | + ) |
| 54 | +} |
| 55 | + |
| 56 | +#' @section \code{agu_article}: Format for creating a American Geophysical Union |
| 57 | +#' (AGU) article. Adapted from |
| 58 | +#' \url{https://publications.agu.org/author-resource-center/checklists-and-templates/}. |
| 59 | +#' @export |
| 60 | +#' @rdname article |
| 61 | +agu_article <- function( |
| 62 | + ..., keep_tex = TRUE, citation_package = 'natbib', |
| 63 | + highlight = NULL, md_extensions = c("-autolink_bare_uris", "-auto_identifiers") |
| 64 | +) { |
| 65 | + pdf_document_format( |
| 66 | + "agu_article", keep_tex = keep_tex, highlight = highlight, |
| 67 | + citation_package = citation_package, md_extensions = md_extensions, ... |
| 68 | + ) |
| 69 | +} |
| 70 | + |
| 71 | +#' @section \code{amq_article}: Ce format a été adapté du format du bulletin de |
| 72 | +#' l'AMQ. |
| 73 | +#' @export |
| 74 | +#' @rdname article |
| 75 | +amq_article <- function( |
| 76 | + ..., latex_engine = 'xelatex', keep_tex = TRUE, fig_caption = TRUE, |
| 77 | + md_extensions = c("-autolink_bare_uris") |
| 78 | +) { |
| 79 | + pdf_document_format( |
| 80 | + "amq_article", latex_engine = latex_engine, highlight = NULL, keep_tex = keep_tex, |
| 81 | + md_extensions = md_extensions, fig_caption = fig_caption, ... |
| 82 | + ) |
| 83 | +} |
| 84 | + |
| 85 | +#' @section \code{ams_article}: Format for creating an American Meteorological |
| 86 | +#' Society (AMS) Journal articles. Adapted from |
| 87 | +#' \url{https://www.ametsoc.org/ams/index.cfm/publications/authors/journal-and-bams-authors/author-resources/latex-author-info/}. |
| 88 | +#' @export |
| 89 | +#' @rdname article |
| 90 | +ams_article <- function(..., keep_tex = TRUE, md_extensions = c("-autolink_bare_uris")) { |
| 91 | + pdf_document_format( |
| 92 | + "ams_article", keep_tex = keep_tex, md_extensions = md_extensions, ... |
| 93 | + ) |
| 94 | +} |
| 95 | + |
| 96 | +#' @section \code{asa_article}: This format was adapted from The American |
| 97 | +#' Statistican (TAS) format, but it should be fairly consistent across |
| 98 | +#' American Statistical Association (ASA) journals. |
| 99 | +#' @export |
| 100 | +#' @rdname article |
| 101 | +asa_article <- function(..., keep_tex = TRUE, citation_package = 'natbib') { |
| 102 | + pdf_document_format( |
| 103 | + "asa_article", keep_tex = keep_tex, citation_package = citation_package, ... |
| 104 | + ) |
| 105 | +} |
| 106 | + |
| 107 | +#' @section \code{biometrics_article}: This format was adapted from the |
| 108 | +#' Biometrics journal. |
| 109 | +#' @export |
| 110 | +#' @rdname article |
| 111 | +biometrics_article <- function(..., keep_tex = TRUE, citation_package = 'natbib') { |
| 112 | + pdf_document_format( |
| 113 | + 'biometrics_article', keep_tex = keep_tex, citation_package = citation_package, ... |
| 114 | + ) |
| 115 | +} |
| 116 | + |
| 117 | +#' @section \code{ctex}: A wrapper function for \code{rmarkdown::pdf_document()} |
| 118 | +#' and changed the default values of two arguments \code{template} and |
| 119 | +#' \code{latex_engine} so it works better for typesetting Chinese documents |
| 120 | +#' with the \pkg{ctex} LaTeX package. |
| 121 | +#' @export |
| 122 | +#' @rdname article |
| 123 | +ctex <- function(..., latex_engine = 'xelatex') { |
| 124 | + pdf_document_format('ctex', latex_engine = latex_engine, ...) |
| 125 | +} |
| 126 | + |
| 127 | +#' @section \code{elsevier_article}: Format for creating submissions to Elsevier |
| 128 | +#' journals. Adapted from |
| 129 | +#' \url{https://www.elsevier.com/authors/author-schemas/latex-instructions}. |
| 130 | +#' @export |
| 131 | +#' @rdname article |
| 132 | +elsevier_article <- function( |
| 133 | + ..., keep_tex = TRUE, md_extensions = c("-autolink_bare_uris") |
| 134 | +) { |
| 135 | + pdf_document_format( |
| 136 | + "elsevier_article", keep_tex = keep_tex, md_extensions = md_extensions, ... |
| 137 | + ) |
| 138 | +} |
| 139 | + |
| 140 | +#' @section \code{frontiers_article}: Format for creating Frontiers journal |
| 141 | +#' articles. Adapted from |
| 142 | +#' \url{http://home.frontiersin.org/about/author-guidelines}. |
| 143 | +#' @export |
| 144 | +#' @rdname article |
| 145 | +frontiers_article <- function(..., keep_tex = TRUE) { |
| 146 | + pdf_document_format("frontiers_article", keep_tex = keep_tex, ...) |
| 147 | +} |
| 148 | + |
| 149 | +#' @section \code{mdpi_article}: Format for creating submissions to |
| 150 | +#' Multidisciplinary Digital Publishing Institute (MDPI) journals. Adapted |
| 151 | +#' from \url{http://www.mdpi.com/authors/latex}. |
| 152 | +#' @export |
| 153 | +#' @rdname article |
| 154 | +mdpi_article <- function(..., keep_tex = TRUE) { |
| 155 | + pdf_document_format( |
| 156 | + "mdpi_article", keep_tex = keep_tex, citation_package = "natbib", ... |
| 157 | + ) |
| 158 | +} |
| 159 | + |
| 160 | +#' @section \code{mnras_article}: Format for creating an Monthly Notices of |
| 161 | +#' Royal Astronomical Society (MNRAS) Journal articles. Adapted from |
| 162 | +#' \url{https://www.ras.org.uk/news-and-press/2641-new-version-of-the-mnras-latex-package}. |
| 163 | +#' @export |
| 164 | +#' @rdname article |
| 165 | +mnras_article <- function(..., keep_tex = TRUE, fig_caption = TRUE) { |
| 166 | + pdf_document_format( |
| 167 | + "mnras_article", keep_tex = keep_tex, fig_caption = fig_caption, ... |
| 168 | + ) |
| 169 | +} |
| 170 | + |
| 171 | +#' @section \code{peerj_article}: Format for creating submissions to The PeerJ |
| 172 | +#' Journal. This was adapted from the |
| 173 | +#' \href{https://www.overleaf.com/latex/templates/latex-template-for-peerj-journal-and-pre-print-submissions/ptdwfrqxqzbn}{PeerJ |
| 174 | +#' Overleaf Template}. |
| 175 | +#' @export |
| 176 | +#' @rdname article |
| 177 | +peerj_article <- function(..., keep_tex = TRUE) { |
| 178 | + pdf_document_format("peerj_article", keep_tex = keep_tex, ...) |
| 179 | +} |
| 180 | + |
| 181 | +#' @section \code{plos_article}: Format for creating submissions to PLOS |
| 182 | +#' journals. Adapted from \url{http://journals.plos.org/ploscompbiol/s/latex}. |
| 183 | +#' @export |
| 184 | +#' @rdname article |
| 185 | +plos_article <- function( |
| 186 | + ..., keep_tex = TRUE, md_extensions = c("-autolink_bare_uris") |
| 187 | +) { |
| 188 | + pdf_document_format( |
| 189 | + "plos_article", keep_tex = keep_tex, md_extensions = md_extensions, ... |
| 190 | + ) |
| 191 | +} |
| 192 | + |
| 193 | +#' @section \code{pnas_article}: Format for creating submissions to PNAS |
| 194 | +#' journals. |
| 195 | +#' @export |
| 196 | +#' @rdname article |
| 197 | +pnas_article <- function(..., keep_tex = TRUE) { |
| 198 | + pdf_document_format("pnas_article", keep_tex = keep_tex, ...) |
| 199 | +} |
| 200 | + |
| 201 | +#' @section \code{sage_article}: Format for creating submissions to Sage |
| 202 | +#' Journals. Based on the official Sage Journals |
| 203 | +#' \href{https://uk.sagepub.com/sites/default/files/sage_latex_template_4.zip}{class}. |
| 204 | +#' |
| 205 | +#' Possible arguments for the YAML header are: |
| 206 | +#' \itemize{ |
| 207 | +#' \item \code{title} title of the manuscript |
| 208 | +#' \item \code{runninghead} short author list for header |
| 209 | +#' \item \code{author} list of authors, containing \code{name} and \code{num} |
| 210 | +#' \item \code{address} list containing \code{num} and \code{org} for defining \code{author} affiliations |
| 211 | +#' \item \code{corrauth} corresponding author name and address |
| 212 | +#' \item \code{email} correspondence email |
| 213 | +#' \item \code{abstract} abstract, limited to 200 words |
| 214 | +#' \item \code{keywords} keywords for the artucle |
| 215 | +#' \item \code{bibliography} BibTeX \code{.bib} file name |
| 216 | +#' \item \code{classoption} options of the \code{sagej} class |
| 217 | +#' \item \code{header-includes}: custom additions to the header, before the \code{\\begin\{document\}} statement |
| 218 | +#' \item \code{include-after}: for including additional LaTeX code before the \code{\\end\{document\}} statement} |
| 219 | +#' @export |
| 220 | +#' @rdname article |
| 221 | +sage_article <- function(..., highlight = NULL, citation_package = "natbib") { |
| 222 | + pdf_document_format( |
| 223 | + "sage_article", highlight = highlight, citation_package = citation_package, ... |
| 224 | + ) |
| 225 | +} |
| 226 | + |
| 227 | +#' @section \code{sim_article}: Format for creating submissions to Statistics in |
| 228 | +#' Medicine. Based on the official Statistics in Medicine |
| 229 | +#' \href{http://onlinelibrary.wiley.com/journal/10.1002/(ISSN)1097-0258/homepage/la_tex_class_file.htm}{class}. |
| 230 | +#' |
| 231 | +#' Possible arguments for the YAML header are: |
| 232 | +#' \itemize{ |
| 233 | +#' \item \code{title} title of the manuscript |
| 234 | +#' \item \code{author} list of authors, containing \code{name} and \code{num} |
| 235 | +#' \item \code{address} list containing \code{num} and \code{org} for defining \code{author} affiliations |
| 236 | +#' \item \code{presentaddress} not sure what they mean with this |
| 237 | +#' \item \code{corres} author and address for correspondence |
| 238 | +#' \item \code{authormark} short author list for header |
| 239 | +#' \item \code{received}, \code{revised}, \code{accepted} dates of submission, revision, and acceptance of the manuscript |
| 240 | +#' \item \code{abstract} abstract, limited to 250 words |
| 241 | +#' \item \code{keywords} up to 6 keywords |
| 242 | +#' \item \code{bibliography} BibTeX \code{.bib} file |
| 243 | +#' \item \code{classoption} options of the \code{WileyNJD-v2} class |
| 244 | +#' \item \code{longtable} set to \code{true} to include the \code{longtable} package, used by default from \code{pandoc} to convert markdown to LaTeX code |
| 245 | +#' \item \code{header-includes}: custom additions to the header, before the \code{\\begin\{document\}} statement |
| 246 | +#' \item \code{include-after}: for including additional LaTeX code before the \code{\\end\{document\}} statement} |
| 247 | +#' @export |
| 248 | +#' @rdname article |
| 249 | +sim_article <- function(..., highlight = NULL, citation_package = "natbib") { |
| 250 | + pdf_document_format( |
| 251 | + "sim_article", highlight = highlight, citation_package = citation_package, ... |
| 252 | + ) |
| 253 | +} |
| 254 | + |
| 255 | +#' @section \code{springer_article}: This format was adapted from the Springer |
| 256 | +#' Macro package for Springer Journals. |
| 257 | +#' @export |
| 258 | +#' @rdname article |
| 259 | +springer_article <- function(..., keep_tex = TRUE, citation_package = 'none'){ |
| 260 | + pdf_document_format( |
| 261 | + "springer_article", keep_tex = keep_tex, citation_package = citation_package, ... |
| 262 | + ) |
| 263 | +} |
0 commit comments