rstudio / rticles

LaTeX Journal Article Templates for R Markdown
https://pkgs.rstudio.com/rticles/
1.46k stars 516 forks source link

sim_article update #547

Closed henrikibster closed 8 months ago

henrikibster commented 8 months ago

I have used the sim_article to create an article for Statistics in Medicine. However I have gotten the following feedback "...please ensure that the references are in the correct Statistics in Medicine style. We are now using the American Medical Association reference style".

Would it be possible to update the package so this new style is supported?

Details of the new template can be found at https://authorservices.wiley.com/author-resources/Journal-Authors/Prepare/new-journal-design.html?_gl=1*rfvm07*_gcl_au*MTAyNjA3NDI3OS4xNjkyMDk4MTM5

Br, Henrik

cderv commented 8 months ago

The template already use the AMA option for the class https://github.com/rstudio/rticles/blob/8dd188afb0cbe69fd0cb862c8be83e40d7203064/inst/rmarkdown/templates/sim/resources/template.tex#L1-L1

which will correctly load the style with natbib https://github.com/rstudio/rticles/blob/8dd188afb0cbe69fd0cb862c8be83e40d7203064/inst/rmarkdown/templates/sim/skeleton/WileyNJD-v2.cls#L2694-L2696

And sim_article() defaults to natbib https://github.com/rstudio/rticles/blob/8dd188afb0cbe69fd0cb862c8be83e40d7203064/R/article.R#L571

However, it seems no one PR a new update of WJD template, so files are clearly out dated. So I can try updating the files included with the package.

To confirm before doing the work, did you try them after downloading on the website ?

Can you share how it should looks like ? I can't see the difference with the document we currently produce image image

and an online published article https://onlinelibrary.wiley.com/doi/epdf/10.1002/sim.9916 image image

Is this the reference part which has too much spacing ?

i'll see if I can make a PR to test the new version available on website

henrikibster commented 8 months ago

I did download the zip file with the template (WileyNJDv5_Template.zip), but as I am quite the amateur I do not know where to put these files in order for them to be used. The output you have generated above appears to be correct as far as I can judge. However when I knit my document it does not appear to be correct: image

An update that would fix this issue for me, would be much appreciated.

cderv commented 8 months ago

However when I knit my document it does not appear to be correct:

You should have the same output as me - I only used the default template for sim_article(). What is your Rmd document header? Did you tweak some options ?

I'll push a PR with V5 updates, but you will need to adapt your article to it probably.

henrikibster commented 8 months ago

My header is this (some stuff deleted): image

cderv commented 8 months ago

It should be ok. I don't know why you don't ket the correct format. You should check you version.

By the way, check the indentation of your field in YAML. the screenshot shows that some are not correct.

henrikibster commented 8 months ago
cderv commented 8 months ago

How will I get the new updated version?

You can install the PR directly

pak::pak("rstudio/rticles#548")
# or 
remotes::install_github("rstudio/rticles#548")

This will install the version from the PR.

henrikibster commented 8 months ago

After having downloaded this and knitting I get the error: ! LaTeX Error: File `WileyNJD-v5.cls' not found. And when I look in the "WileyNJDv5_Template.zip" file, there is no file called that - there is a "WileyNJDv5.cls" though. Am I missing something here?

cderv commented 8 months ago

rticles works by providing format functions, but also resources that goes with it. Those resources are bundled in articles but in the same way they are supposed to be used with the original template. This implies that when you update to the new articles versions, you need to update the resources. To do that, you need to create a new template for sim_article() and then put your article content in the new .Rmd.

There is no other way to update right now. But you experience makes me think of severals improvement we need to do probably

These improvement won't be made right away, but they can definitely be useful.

henrikibster commented 8 months ago

Great. I have it up and running now - thank you very much for the help.

cderv commented 8 months ago

Awesome. So this means the PR works right ?

henrikibster commented 8 months ago

Actually not, the latex appears to contain some errors, so I rolled back. It may be an issue with my system though. I tried to install again just now, but the remotes::install_github("rstudio/rticles#548") does not appear to work this morning.

cderv commented 8 months ago

The PR has been merged as shown in this issue.

You can now install directly from the repo

pak::pak("rstudio/rticles")
remotes::install_github("rstudio/rticles")

The test of compilation for the tempate Rmd are passing - if there is some other issue. Please open a new one and share what is not working for you. Thanks!

github-actions[bot] commented 1 month ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.