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

Mdpi update #515

Merged
merged 44 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4af424f
remove old mdpi files
Feb 4, 2023
b942fd1
add new mdpi files and preserve structure
Feb 4, 2023
b149971
update template to mdpi version 2022-12
Feb 4, 2023
521fb6e
new yaml options for mdpi template.tex
Feb 4, 2023
6544fa5
update figures and table examples
Feb 4, 2023
b867bff
update math environment examples
Feb 4, 2023
d234a8f
edits
Feb 4, 2023
1068c6d
edits
Feb 4, 2023
293a210
update to 2023-03-25 template files
Apr 17, 2023
4284601
remove old comment
Apr 17, 2023
301b1cf
check location of mdpi.cls directly from mdpi_article()
Apr 17, 2023
278166d
use comment chunk
Apr 17, 2023
45a2aa5
go back to class specific options in the yaml
Apr 17, 2023
0e2247b
define pdftex class option using latex_engine variable in template fu…
Apr 17, 2023
e360b59
fix template date
Apr 17, 2023
b541e4c
add markdown math
Apr 18, 2023
0345732
remove bibliography comment
Apr 18, 2023
64a90e7
clarify comment
Apr 18, 2023
2bf8a93
handle moreauthor arg in format function
Apr 18, 2023
3da379b
journal names as table
Apr 18, 2023
03671db
remove journals class option comment
Apr 18, 2023
e2a611a
typo: moreauthors
Apr 18, 2023
d2bf6cc
remove \externalbibliography
Apr 18, 2023
731f7d4
document mdpi_article
Apr 19, 2023
564405e
remove pipe
Apr 19, 2023
87b4783
update documentation in template
Apr 19, 2023
5f22c98
add journal specific variables
Apr 19, 2023
5267301
clean up journal specific template comments
Apr 19, 2023
42441ef
document yaml options
Apr 20, 2023
b1a4a9e
Expose argument but check them early for format's allowed values
cderv Apr 20, 2023
b480528
`pandoc_args` needs to be exposed as we modify it
cderv Apr 20, 2023
eebdb68
Rewrite pre_processor handling to not miss the pdf_document one
cderv Apr 20, 2023
9054859
Use :: for namespace instead
cderv Apr 20, 2023
f7eb8ea
Add a function to split text into table
cderv Apr 21, 2023
568589f
Use available field in format function
cderv Apr 21, 2023
8ef1b2a
Correct reference
cderv Apr 21, 2023
ea1c876
Bump VERSION
cderv Apr 21, 2023
0d96cb7
Add NEWS
cderv Apr 21, 2023
551bb08
Add new contributor to README
cderv Apr 21, 2023
e346471
Merge branch 'main' into mdpi-update
cderv Apr 21, 2023
49c988e
Function was renamed :facepalm:
cderv Apr 21, 2023
ebdc0d7
visual editor is messing with README
cderv Apr 21, 2023
b8b90a6
Fix examples
cderv Apr 21, 2023
8dd3fcd
Add new helper to NEWS
cderv Apr 21, 2023
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
45 changes: 42 additions & 3 deletions R/article.R
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,50 @@ jedm_article <- function(..., keep_tex = TRUE, citation_package = "natbib") {
#' from <https://www.mdpi.com/authors/latex>.
#' @export
#' @rdname article
mps9506 marked this conversation as resolved.
Show resolved Hide resolved
mdpi_article <- function(..., keep_tex = TRUE) {
pdf_document_format(
#' @importFrom rmarkdown pandoc_variable_arg
mdpi_article <- function(..., keep_tex = TRUE, latex_engine = "pdflatex") {


## pre_processor checks if author metadata > 1 and uses moreauthors mdpi class
## argument
pre_processor <- function(metadata,
input_file,
runtime,
knit_meta,
files_dir,
output_dir) {

if(length(metadata$author) > 1) {
return(pandoc_variable_arg("multipleauthors", "moreauthors"))
} else {
return(pandoc_variable_arg("multipleauthors", "oneauthor"))
}
}

## check location of mdpi.cls file (new versions are in subfolder)
## to ensure compatibility with old versions
cls_loc <- if(file.exists("mdpi.cls")) "mdpi" else "Definitions/mdpi"
pandoc_args <- pandoc_variable_arg("cls", cls_loc)

## check if latex engine is pdflatex or xelatex
if(!latex_engine %in% c("pdflatex", "xelatex")) {
stop("latex_engine must be one of 'pdflatex' or 'xelatex' when using the MDPI template.")
}
## if latex engine is pdflatex, mdpi class argument must be pdftex
if(latex_engine == "pdflatex") {
pandoc_args <- c(pandoc_args,
pandoc_variable_arg("pdftex", "pdftex"))
}

base <- pdf_document_format(
"mdpi",
keep_tex = keep_tex, citation_package = "natbib", ...
keep_tex = keep_tex, citation_package = "natbib",
latex_engine = latex_engine,
pandoc_args = pandoc_args,
...
)
base$pre_processor <- pre_processor
base
}

#' @section `mnras_article`: Format for creating an Monthly Notices of
Expand Down
232 changes: 154 additions & 78 deletions inst/rmarkdown/templates/mdpi/resources/template.tex

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ FUNCTION {output.check.colon}
FUNCTION {output.year.check}
{ year empty$
{ "empty year in " cite$ * warning$ }
{ write$
". " year * extra.label *
{ add.period$ write$
" " year * extra.label *
month empty$
{ }
{ ", " * month * }
Expand Down Expand Up @@ -775,7 +775,7 @@ FUNCTION {format.tr.number}

FUNCTION {format.article.crossref}
{ "See"
"\citeN{" * crossref * "}" *
"\citep{" * crossref * "}" *
}

FUNCTION {format.crossref.editor}
Expand Down Expand Up @@ -821,12 +821,12 @@ FUNCTION {format.book.crossref}
}
{ format.crossref.editor * }
if$
" \citeN{" * crossref * "}" *
" \citep{" * crossref * "}" *
}

FUNCTION {format.incoll.inproc.crossref}
{ "See"
" \citeN{" * crossref * "}" *
" \citep{" * crossref * "}" *
}

% format.lab.names:
Expand Down Expand Up @@ -1010,17 +1010,10 @@ FUNCTION {output.bibitem}
}

%% For printing DOI numbers (it is a hyperlink but printed in black)
FUNCTION {format.doi}
{ doi empty$
{ "" }
{"\href{https://doi.org/" doi * "}" * }
if$
}

FUNCTION {formatfull.doi}
{ doi empty$
{ "" }
{"doi:{\changeurlcolor{black}\href{https://doi.org/" doi * "}{\detokenize{" * doi * "}}}" * }
{"{\url{https://doi.org/" doi * "}}" * }
if$
}

Expand Down Expand Up @@ -1663,7 +1656,7 @@ FUNCTION {begin.bib}
'skip$
{ preamble$ write$ newline$ }
if$
"\begin{thebibliography}{}" write$ newline$
"\begin{thebibliography}{999}" write$ newline$
}


Expand Down
460 changes: 460 additions & 0 deletions inst/rmarkdown/templates/mdpi/skeleton/Definitions/journalnames.tex

Large diffs are not rendered by default.

6,929 changes: 6,929 additions & 0 deletions inst/rmarkdown/templates/mdpi/skeleton/Definitions/logo-ccby.eps

Large diffs are not rendered by default.

Loading