rstudio / rticles

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

Add Wellcome OR latex template #436

Closed arnold-c closed 2 years ago

arnold-c commented 2 years ago

To contribute a new article template to this package, please make sure you have done the following things (note that journalname_article below is only an example name):

Lastly, please try your best to do only one thing per pull request (e.g., if you want to add two output formats, do them in two separate pull requests), and refrain from making cosmetic changes in the code base: https://yihui.name/en/2018/02/bite-sized-pull-requests/

Thank you!


Hi,

I'm afraid I'm relatively inexperienced at both package development and LaTeX, so have adapted the template as much as I can, but am currently running into a problem when I try to knit skeleton.Rmd: Error: 'wellcomeor_article' is not an exported object from 'namespace:rticles'. If anyone can point me in the right direction, that'd be much appreciated, and I can see if the template works as expected.

Thanks,

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.

cderv commented 2 years ago

Thanks for the contribution of this new template.

but am currently running into a problem when I try to knit skeleton.Rmd: Error: 'wellcomeor_article' is not an exported object from 'namespace:rticles'

Did you install the development version of this package (from your branch) ?

Using the Knit button will use the install version. If you are using devtools::load_all() you would need to use command line rmarkdown::render I think

arnold-c commented 2 years ago

Sorry for the delay in response @cderv, and thanks for reminding me to build and install the development version! I'm now getting this issue

Error compiling template "/Users/user/Library/R/x86_64/4.1/library/rticles/rmarkdown/templates/wellcomeor/resources/template.tex" (line 77, column 1):
unexpected end of input
expecting " ", "\t", "$--", "\n", "\r\n", "\r", "$", "${" or "$$"
Error: pandoc document conversion failed with error 5
Execution halted

Looking in both skeleton.Rmd and template.tex I can't see any code that would be causing these issues, but I'm obviously missing something. I've tried removing the majority of the body text in an attempt to see if some of the LaTeX code was causing the error, but this didn't seem to help.

cderv commented 2 years ago

This type of error is thrown by Pandoc when something is not correct regarding syntax in the template. There must be a Pandoc template syntax not correct in the template. It could be an $endif$ missing or any other $ missing around variables.

arnold-c commented 2 years ago

Thanks @cderv. I've added the Pandoc requirements you linked, along with your other suggestions, and removed the arXiv files that accidentally were made when I was examining the template.

It is no longer throwing the Pandoc error, but I am now getting the following error

! Undefined control sequence.
<argument> ...sed on Wellcome Open Research \href 
                                                  {https://www.overleaf.com/...
l.62 Latex template}}

l.62 refers to

\emph{Text based on Wellcome Open Research
\href{https://www.overleaf.com/project/6131911644b635ad3aaa4cb2}{Overleaf
Latex template}}

When removing _Text based on Wellcome Open Research [Overleaf Latex template](https://www.overleaf.com/project/6131911644b635ad3aaa4cb2)_ from skeleton.Rmd, I instead get the following error:

! Undefined control sequence.
l.60 \hypertarget
                 {introduction}{% 

Which refers to:

\hypertarget{introduction}{%
\section{Introduction}\label{introduction}}

Thanks

arnold-c commented 2 years ago

I've updated the template and it now produces a pdf. The only remaining issues I couldn't figure out is how to disable link coloring (setting it using hypersetup{} didn't seem to work), and the author affiliation number isn't correct and doesn't allow for multiple authors. I tried to copy across code from the OUP template, which allows for it, but couldn't get it to work I'm afraid. I also get font warning, but it seems like that is also an warning on the Overleaf template, so I don't think it's too much of an issue that should be fixed on our end.

Warning message:
LaTeX Warning: Font shape declaration has incorrect series value `mc'.
               It should not contain an `m'! Please correct it.
               Found on input line 53.
cderv commented 2 years ago

I couldn't figure out is how to disable link coloring

It is possible this is something produced by Pandoc. Did you try opting out using the variables ? https://pandoc.org/MANUAL.html#links

Something like

colorlinks: false

in the YAML header ?

the author affiliation number isn't correct and doesn't allow for multiple authors.

This can be tricky and require to modify the template. Several formats have different trick for this kind of thing. I could try to have a look. That would be helpful if you know what syntax it should look like in the .tex output ? We could then adapt as template for Pandoc.

Thanks

arnold-c commented 2 years ago

Assuming the comments are all OK and it passes all the checks, I think this is ready to be merged. Thanks for your help and patience!

arnold-c commented 2 years ago

All look good to me so I just went ahead and committed the suggestions. Thanks

cderv commented 2 years ago

Thanks @arnold-c !

There were also the discussion box above my last comment 😅 sorry for that, Github have separated them from the other. Can you validate those too ?

Especially this one: https://github.com/rstudio/rticles/pull/436#discussion_r765659670

Thanks

arnold-c commented 2 years ago

Sorry about that. I've just gone through and confirmed it all works as expected after those suggestions (I think I got them all)

cderv commented 2 years ago

We must just redocument following new arguments in function. I'll do that tommorow and merge it.