-
Notifications
You must be signed in to change notification settings - Fork 522
Modify rjournal_article template to allow more than one affiliation per author #286
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
Conversation
+ Now the YAML header supports more than one affiliation per author + If the author has only one affiliation, nothing has changed
+ Now the YAML header supports more than one affiliation per author + If the author has only one affiliation, nothing has changed + Update corresponding skeleton.Rmd to have example for multiple affiliations + Update DESCRIPTION + Update NEWS
add support orcid and url
inst/rmarkdown/templates/rjournal_article/resources/template.tex
Outdated
Show resolved
Hide resolved
cderv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RLumSK I have left some comments. Please tell me if it is clear enough. I can take the lead to modify and finish the PR based on your work. You tell me if you have time or not.
inst/rmarkdown/templates/rjournal_article/resources/template.tex
Outdated
Show resolved
Hide resolved
…ipes not yet available in RStudio due to an older pandoc verison. The commit includes: + Updated template.tex as suggested by @cderv + Updated rjournal_article.R with more details in the documentation + Updated Rd-file
…ipes not yet available in RStudio due to an older pandoc verison. The commit includes: + Updated template.tex as suggested by @cderv + Updated rjournal_article.R with more details in the documentation + Updated Rd-file + skeleton.Rmd update
…ails: + Resolve author name separator problem (#287) + Function does not touch anymore the users files + Files are no collected in a seperate folder defined via output_dir in the YAML-header as part of the post processing + BIB-file renamed when in output_dir to match journal requirements + The user can now define an own bibliography file via the YAML-header + Measures implemented to avoid that users updating 'rticles' will run into trouble while rebuilding old files + Update skeleton.Rmd to meet new requirements + Update documentation
This comment has been minimized.
This comment has been minimized.
as for other rticles help files
Using purl on the output tex file will not return the expected result.
this also insure utf8 encoding assume in Rmarkdown.
… pdf also remove a space and refactor
and that is why it fails.
|
I now have revised the implemention to fix a few issues and refactor some code. Here, we only rename R file and tex file and we only document and warn for bibliography naming. Documentation of the format has also been improved. Figures are now kept in the I like the md documenting for roxygen so I kept that for this one even if it is the first function to be documented this way currently. Thanks for suggesting that ! @yihui You can now have a look at it and I think we have now a new good base to rethink this bib renaming thing. Let's note that currently (as in master branch) the |
|
@cderv Very nice work, indeed. Interesting to see how you solved the issues differently. I also played with the The only thing we may want to keep in mind: I am not sure (nothing is written in the author's guidelines) whether they allow subfolders for the submission or prefer a flat-file structure (i.e. no subfolder like, e.g., Elsevier usually requests). |
You are talking about the figures ? I asked myself the same question and found nothing in the author's guidelines either. |
|
Another question I had: can the |
Yes, I meant the figures. I suggest to leave it as it is for the moment. If no one raises that issue again, it was ok. |
I was inclined to write no because the template uses
However, I just tried to create a document with six authors and "voilà", there was a linebreak and the replacement did not work anymore the way it should. Means, you are right, we have to consider a linebreak. Update @cderv I suggest modifying your helper function post_process_authors <- function(text) {
# correct authors field to have pattern Author 1, Author 2 and Author 3
## (1) function to identify author lines
authors_line <- function(text,
range = rep(grep(pattern = "\\author{", x = text, fixed = TRUE),2)) {
if(any(is.na(range)) || length(grep(pattern = "}", x = text[range[2]], fixed = TRUE)))
return(range)
authors_line(text, c(range[1], range[2] + 1))
}
## (2) rewrite lines
if (!any(is.na(line_range <- authors_line(text)))) {
new_authors <- knitr::combine_words(
unlist(strsplit(text[seq(line_range[1],line_range[2])], split = ","))
)
##write new authors line
text[line_range[1]] <- new_authors
##remove no-needed lines
if(line_range[2] > line_range[1])
text <- text[-c(seq(line_range[1] + 1, line_range[2]))]
}
text
}I have tested this little piece of refactored code using various examples:
However, I did not add it as a commit tough. However, if you are happy with it, I could make a commit of it. |
|
@cderv One last comment for today. Now where the warning is shown for the bibliography, there is one problem, at least when I use RStudio: If the markdown process does not show an error the panel window (in RStudio) switches immediately back from the R Markdown Panel to the Console. This happens all so fast that it is impossible to notice a warning message. If I back and check, of course, the warning is there. But imagine the user never does something really wrong, never causes an error message, there would be no reason to look into the r markdown terminal feedback. So maybe the warning should become a |
|
@RLumSK Thank you for your input code. I prefered to handled it differently while testing more edge cases. Hope you don't mind! About the warning, it appears in the R Markdown pane indeed as any other warnings for the R code. So if there is a warning in the R code, and it is not captured in the Rmd output, it will also be printed inside this Rmarkdown pane.
This and the warning in addition should be enough - I think adding a stop() is too much.
If we wan't to improve that, we still have the solution of (copying+) renaming the bib file and modifying the file accordingly. As @yihui said, he will look into this and maybe reconsider the current choices. |
Sure, no problem, it was just a suggestion. Looks nice the way you did it. |
yihui
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall! I only have one question in the comment.
For the filename of bibliography, I also feel stop() is a little too aggressive.
Thank you!
|
Thanks a lot @RLumSK for this PR ! Great work and discussions ! |
|
@cderv Likewise! I also carefully locked into your changes and I hope next time I can meet your expectations from the start. Anyway, it was nice and sincerely exciting work. |
Motivation
I realized that the
rjournal_articletemplate does not support multiple affiliations per author, which are, however, sometimes needed (and requested by the affiliations you are attached to).On top of it, I realized that the fields
urlandorcidwere not yet supported.My contribution enables multi-affiliation support for this template and addresses #287 so that the
the output will be more consistent with the RJournal author's instructions (I am sorry, it accidentally ended up in the same pull request).
The commit includes the following modifications:
Changes
resources/template.texnow knows how to handle multiple affiliations, while the default behavior of the template did not change. In other words, if the author has only one affiliation and enters the information as before, the PDF output renders as before.urlanorcidskeleton.Rmdto have an example for multiple affiliationsDESCRIPTIONand added me as a contributor (more is not justified given the minor nature of my contribution)NEWS.mdrjournal_article()to R Journal Instructions. #287Forms
Unless you have done it in any other RStudio's projects before, please sign the individual or corporate contributor agreement for a significant pull request (it is fine not to sign it if a PR is only intended to fix a few typos). You can send the signed copy to jj@rstudio.com.
Add the
journalname_article()function toR/article.Rif the output format is simple enough, otherwise create a separateR/journalname_article.R.Not applicable.
inst/rmarkdown/templates/journalname_article/resources/template.tex.Not applicable, but the original template was updated.
inst/rmarkdown/templates/journalname_article/skeleton/skeleton.Rmd.Not applicable, but the original skeleton was updated.
inst/rmarkdown/templates/journalname_article/template.yaml.Not applicable.
*.cls) if needed, but please do not include standard LaTeX packages (*.sty) that can be downloaded from CTAN. Please keep the number of new files absolutely minimal, and also make examples minimal (e.g., if you need a.bibexample, try to only leave one or two bibliography entries in it, and don't include one hundred items in it without using all of them).Not applicable.
devtools::document()).Not applicable.
Not applicable.
Not applicable.
tests/testit/test-formats.R.Not applicable, the tests do not change, but I ran all tests to make sure that I did not break something.
Authors@Rin DESCRIPTION. You don't need to bump the package version in DESCRIPTION.