rstudio / rticles

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

Pinning tex template version ? (Self-contained mode ?) #359

Open eliocamp opened 3 years ago

eliocamp commented 3 years ago

Right now, when rticles updates a template, it risks either breaking older markdown documents (for example, if the name of a header variable changes; see https://github.com/rstudio/rticles/pull/358) or changing the resulting pdf. This poses a challenge to reproducibility and stability.

Some of that could be ameliorated if instead of using the template.tex file that lives with the package, each article format copied the template.tex file to the root of the project at creation time and then used that file as template. That document is then shielded from updates to rticles. Of course, that also means that it also doesn't receive new updates (but if the user wants to update, they could create a new rmakdown file and then copy the the new template.tex, or perhaps there could be a command that does the update).

@cderv suggested that this could be an optional "self-contained" mode for advanced users. I don't know if this is possible or worth it.

yihui commented 3 years ago

It's always hard to decide whether we should let users opt-in or opt-out a feature, when either option has its own pros and cons.

In this case, if users really wants to stabilize template.tex, they could copy it from rticles and place it under the same directory as the Rmd. The use the template argument of the output format, e.g.,

output:
  rticles::acm_article:
    template: template-old.tex

where template-old.tex is copied from a certain version of rticles. When they do this, they have to acknowledge that they won't receive future updates or bug fixes in the template, and future updates of rticles could potentially break the old template, too.

cderv commented 3 years ago

@cderv suggested that this could be an optional "self-contained" mode for advanced users. I don't know if this is possible or worth it.

What I had in mind was maybe a simple helper to copy locally in the directory the template from within a package to allow those users to effectively use this self-contained mode the way you describe.

yihui commented 3 years ago

a simple helper

Yes, that's it.