Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ims_article() #372

Merged
merged 12 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 38 additions & 4 deletions R/article.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,48 @@ frontiers_article <- function(..., keep_tex = TRUE) {
pdf_document_format("frontiers", keep_tex = keep_tex, ...)
}

#' @section \code{ims_article}: Format for creating submissions to the Institute of Mathematical Statistics \href{https://imstat.org/}{IMS}
#' journals and publications. It includes the Annals of Applied Statistics. Adapted from
#' @section \code{ims_article}: Format for creating submissions to the Institute of Mathematical Statistics
#' \href{https://imstat.org/}{IMS} journals and publications. Adapted from
#' \url{https://github.com/vtex-soft/texsupport.ims-aoas}.
#'
#' The argument \code{journal} accepts the acronym of any of the
#' \href{https://www.e-publications.org/ims/support/ims-instructions.html}{journals} in IMS:
#' \itemize{
#' \item \code{aap}: The Annals of Applied Probability
#' \item \code{aoas}: The Annals of Applied Statistics
#' \item \code{aop}: The Annals of Probability
#' \item \code{aos}: The Annals of Statistics
#' \item \code{sts}: Statistical Science}
#' @export
#' @rdname article
ims_article <- function(..., keep_tex = TRUE, citation_package = "natbib") {
ims_article <- function(journal = c("aoas", "aap", "aop", "aos", "sts"),
keep_tex = TRUE, citation_package = "natbib",
md_extensions = c(
"-autolink_bare_uris" # disables automatic links
), ...) {

journal <- match.arg(journal)
if (length(journal) > 1) stop("Please choose just one ", dQuote("journal"))

with_kwsc <- journal %in% c("aap", "aop", "aos") # with keyword_subclass

args <- c(
"journal" = journal,
if (with_kwsc) c("with_kwsc" = with_kwsc)
)

# pandoc_variable_arg not exported from rmarkdown, adapted from ieee_article()
pandoc_arg_variable <- function(var_name, value) {
c("-V", paste0(var_name, "=", value))
}
cderv marked this conversation as resolved.
Show resolved Hide resolved

# Convert to pandoc arguments
pandoc_arg_list <- mapply(pandoc_arg_variable, names(args), args)

pdf_document_format(
"ims", keep_tex = keep_tex, citation_package = citation_package, ...
"ims", keep_tex = keep_tex, citation_package = citation_package,
md_extensions = md_extensions, pandoc_args = pandoc_arg_list,
...
)
}

Expand Down
11 changes: 4 additions & 7 deletions inst/rmarkdown/templates/ims/resources/template.tex
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@
}{\renewenvironment{Shaded}{\begin{kframe}}{\end{kframe}}}
\makeatother

% avoid conflict of pandoc parser and imsart package
\newcommand{\email}[1]{#1}


$if(predefined-theoremstyle)$
\startlocaldefs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -204,10 +200,11 @@
$abstract$
\end{abstract}


$for(keyword-subClass)$
$keyword-subClass$
$if(with_kwsc)$
$for(keyword-subclass)$
$keyword-subclass$
$endfor$
$endif$

\begin{keyword}
$for(keywords)$
Expand Down
58 changes: 25 additions & 33 deletions inst/rmarkdown/templates/ims/skeleton/skeleton.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
journal: aoas # aap, aop, aos, sts
title: A sample article with some additional note
thanks: # delete thanks field if not require, here notes for title
- ref: T1
Expand All @@ -8,19 +7,19 @@ runtitle: A sample running head title
author:
- name: First
surname: Author
email: \email{first@somewhere.com}
email: first@somewhere.com
label: e1
addressLabel: A
sepNext: "," # use "," or \and; the last author not need this field
- name: Second
surname: Author
email: \email{second@somewhere.com}
email: second@somewhere.com
label: e2,mark
addressLabel: B
sepNext: \and
- name: Third
surname: Author
email: \email{third@somewhere.com}
email: third@somewhere.com
label: e3,mark
addressLabel: B
affiliation:
Expand All @@ -42,22 +41,22 @@ abstract: |
This is a sample input file. Comparing it with the output it
generates can show you how to produce a simple document of
your own.
# Uncomment below for aap, aop, aos journals
# keyword-subClass: |
# \begin{keyword}[class=MSC2020]
# \kwd[Primary ]{00X00}
# \kwd{00X00}
# \kwd[; secondary ]{00X00}
# \end{keyword}
keyword-subclass: |
\begin{keyword}[class=MSC2020] % It must be define for aap, aop, aos journals. For aoas, sts is not used
\kwd[Primary ]{00X00}
\kwd{00X00}
\kwd[; secondary ]{00X00}
\end{keyword}
cderv marked this conversation as resolved.
Show resolved Hide resolved
keywords:
- First keyword
- Second keyword

predefined-theoremstyle: true # use in section Environments for Axiom, Theorem, etc
bibliography: ims.bib
biblio-style: imsart-nameyear # imsart-number
biblio-style: imsart-nameyear # alternative: imsart-number
output:
rticles::ims_article:
journal: aoas # aap, aoas, aop, aos, sts. See documentation
toc: false # Please use for articles with 50 pages and more
---

Expand Down Expand Up @@ -191,16 +190,9 @@ Text is displayed by indenting it from the left margin. There are short quotatio

and longer ones.

<!-- The following syntax works with Rmarkdown >= 2.7 -->
<!-- ::: {.environment latex=true} -->
<!-- code -->
<!-- ::: -->
<!-- It's equivalent to -->
<!-- \begin{environment} -->
<!-- % code -->
<!-- \end{environment} -->
<!-- custom blocks syntax https://bookdown.org/yihui/rmarkdown-cookbook/custom-blocks.html -->

::: {.quotation latex=true}
::: {.quotation data-latex=""}
This is a longer quotation. It consists of two paragraphs
of text. The beginning of each paragraph is indicated
by an extra indentation.
Expand All @@ -213,55 +205,55 @@ as dull as the first paragraph.

## Examples for *`plain`-style environments*

::: {.axiom latex=true}
::: {.axiom data-latex=""}
\label{ax1}
This is the body of Axiom \ref{ax1}.
:::

::: {.proof latex=true}
::: {.proof data-latex=""}
This is the body of the proof of the axiom above.
:::

::: {.claim latex=true}
::: {.claim data-latex=""}
\label{cl1}
This is the body of Claim \ref{cl1}. Claim \ref{cl1} is numbered after
Axiom \ref{ax1} because we used \verb|[axiom]| in \verb|\newtheorem|.
:::

::: {.theorem latex=true}
::: {.theorem data-latex=""}
\label{th1}
This is the body of Theorem \ref{th1}. Theorem \ref{th1} numbering is
dependent on section because we used \verb|[section]| after \verb|\newtheorem|.
:::

::: {.theorem latex="[Title of the theorem]"}
::: {.theorem data-latex="[Title of the theorem]"}
\label{th2}
This is the body of Theorem \ref{th2}. Theorem \ref{th2} has additional title.
:::

::: {.lemma latex=true}
::: {.lemma data-latex=""}
\label{le1}
This is the body of Lemma \ref{le1}. Lemma \ref{le1} is numbered after
Theorem \ref{th2} because we used \verb|[theorem]| in \verb|\newtheorem|.
:::

::: {.proof latex="[Proof of Lemma \ref{le1}]"}
::: {.proof data-latex="[Proof of Lemma \ref{le1}]"}
This is the body of the proof of Lemma \ref{le1}.
:::

## Examples for *`remark`*-style environments
::: {.definition latex=true}
::: {.definition data-latex=""}
\label{de1}
This is the body of Definition \ref{de1}. Definition \ref{de1} is numbered after
Lemma \ref{le1} because we used \verb|[theorem]| in \verb|\newtheorem|.
:::

::: {.example latex=true}
::: {.example data-latex=""}
This is the body of the example. Example is unnumbered because we used \verb|\newtheorem*|
instead of \verb|\newtheorem|.
:::

::: {.fact latex=true}
::: {.fact data-latex=""}
This is the body of the fact. Fact is unnumbered because we used \verb|\newtheorem*|
instead of \verb|\newtheorem|.
:::
Expand Down Expand Up @@ -341,7 +333,7 @@ One long equation:
<!-- %% Example with single Appendix: %% -->
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->

::: {.appendix latex=true}
::: {.appendix data-latex=""}
# Title {.unnumbered #appn}

Appendices should be provided in \verb|{appendix}| environment,
Expand All @@ -355,7 +347,7 @@ then please refer to it in text as \ldots\ in the \hyperref[appn]{Appendix}.
<!-- %% Example with multiple Appendixes: %% -->
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->

::: {.appendix latex=true}
::: {.appendix data-latex=""}
# Title of the first appendix {#appA}
If there are more than one appendix, then please refer to it
as \ldots\ in Appendix \ref{appA}, Appendix \ref{appB}, etc.
Expand Down
21 changes: 18 additions & 3 deletions man/article.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.