-
Notifications
You must be signed in to change notification settings - Fork 524
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
Proposal of a generic "article" template #430
Comments
That is an interesting idea! To better understand, what is exactly the main difference with using This package offers other format functions because they use specific class and usually needs to follow some templates provided by the journal. Adding a generic template to this package would mean to maintain another template and this is known to be a hard task. I would like to understand what would be the difference with the default template and what can't be used in this one directly ? Did you compare this already ? Thanks! |
The main contributions of this new format would be that it handles multiple authors, author affiliations and author footnotes as one would want for a scientific article, as well as keywords and multi-lingual abstracts, and it places some of the most useful options for scientific articles in the YAML header (endfloat, numbering lines, fancyhdr). I imagine in principle you could do this with
Yes, I started my template by copying the default latex template from the pandoc code repository and modifying it. My template has essentially everything that is in the default template (no beamer of course), but also a lot more. Most of it is related to the handling of the title page for which I had to write lots of horrifying latex, something I hope to never have to do again, which is why I want this to be a template. I think the best demonstration would be to just play with some of the options in the YAML header that are not in the standard template:
|
I should also say that I would modify the format somewhat if it is included in rticles so that some of the more obscure options, such as |
I see. Thanks for the clarification. I can understand the need of scientific addition to the default Pandoc template. I would love to find a way to
This is not just for this template but for all template. On pandoc side they do that for highlighting for example. They have Maybe we can think of something to add the scientific stuff needed. Just sharing thoughts here as I won't have time to look into more right now as I am taking times off, but I'll have a closer look in september if that is ok. Pinging @yihui as he may be interested and have thoughts on this. |
This may be possible, though on a technical level, I am not 100% sure how you are thinking of going about it. To create my format, I first took the pandoc default latex template, then I deleted all the beamer stuff as I wasn't interested in that and wanted to reduce noise in the template, then I added my parts in. Looking over the template.tex, the stuff that I added are, in order:
|
What I am thinking is that:
My idea is to modularize the content so that it could be easier to maintain and update based on default template change. The challenge on all this is how to keep the custom template up to date with default template in Pandoc , and with less friction as possible. Currently, we are not good at that and I need to improve this for all templates. Another idea: Leverage git features.
Example of such usage: bslib way of maintaining special tweakings on Boostrap updates using patches Solutions asides, my concerns regarding the challenge with a custom template for Pandoc are that
I hope it clarifies my current thinking. That is an interesting topic I need to think more about. (Regarding the format you suggest, maybe it should be in rmarkdown directly like a new formats Thanks for bringing all this up, I like the way it "shakes" my thinking. |
Think away, there is no rush. I more or less get what you are proposing, though I might need help with the mechanics of it when the time comes to implement it (if indeed you are proposing I do it - my time on this is not unlimited, but I am happy to lend a hand if I can get some direction). Once we have a strategy, I can move things around or cut things out of my template as needed, but I don't want to do much effort now until we have a clear strategy.
Regarding partials, I saw that in the pandoc documentation, but didn't really understand what they were about (the documentation is a bit terse...). It is another option. Placing this within the rmarkdown package also seems reasonable. As you say, there is no dependence on a specific CLS file, so rmarkdown makes more sense than rticles. Perhaps a new function |
The minimum work I need from you would be to have your files in a repo of yours so that we can retrieve them easily with git. A PR is also an option to share those files with us. Then the more you manage to do, the better it is for me. The hard part is the updating mechanism (at least one mechanism even if not perfect) so that we have a first solution. Then we (I) could try different logic. Once I get a good grasp what should be inserted and what is the best option we'll be able to work on the definitive solution. (from the same PR or using the repo with the files and tests). In a nutshell, a Minimal Viable product would be great as a base to work on. This does not require to change your template as it could be used already.
That is good to know.
It may not be the cleanest, but for this kind of "placement specific" content, a hot patch by searching for
Basically, they introduce this to have common elements between templates. Best example is all the CSS component that are shared across all the HTML templates in Pandoc. There is a style.html file, which is inserted in each template using the partials syntax. <style type="text/css">
$styles.html()$
</style> So this is mainly a mechanism to have less duplication. This would be useful for rticles but there would be minimal requirement on Pandoc greater than the current one. I don't want to do it yet on the whole package. (on a specific format, we could)
Great I like that you like the idea. This is exactly the no CLS part that makes me think that! I need to have a deeper look on this multi-lingual thing. This is new to me. Maybe there is a solution we can find leveraging the fact that we are rendering with Pandoc with pre processing in R before. We already to some hot patching of the template, and also pre processing on the md file or post processing on the tex file. Just so you know, I will take time off for the coming weeks, but I'll keep thinking about that. However, I could rework on rticles in maybe not sooner than a month. |
The key issue here is long-term maintenance. I'd suggest that we start with using |
Perhaps I am wrong, but I think we are on the wrong track with something here. Presuming I have correctly understood things, it seems like partials are the only option if we want to do things the "pandoc way", but then I think we would need hooks in the default pandoc latex template for this to work. As such, I don't see a way to directly implement the "patching" solution. What I propose to do instead is reorganize my template so that all my bits are in a few specific places and then we can see what is the best way to patch those into the pandoc default latex template. |
Also, I ran the idea of a |
Oh I see. That sounds tricky indeed... |
I created a repository with my template where I have taken the default latex template for pandoc, very slightly modified it to add hooks for partials and then placed all of my new code into those partial files. There were a few lines in the default template that I had to delete as these were replaced by the contents of the partial files, but other than that it is essentially the default pandoc template with partials hooks. This provides a clear path for us to implement what I am trying to do just using a few much more manageable files. The one thing that is clearly not working like I would like it to is multi-lingual abstracts. I tried using spans to push the abstract languages into The repository is https://github.com/dmkaplan2000/generic_rmarkdown_article |
In case it is pertinent, the pandoc template I started with is: https://github.com/jgm/pandoc/blob/master/data/templates/default.latex If you diff mine with theirs you should be able to see where I made modifications and deletions. |
I have now fixed essentially all the issues I had with multi-lingual abstracts and even improved on how it worked before by using divs with Setting a div to be Also, to get French to work, I had to force it to use the |
Hope everyone had a nice summer. I wanted to let you know that I now have a worked example that uses this template (with a few small unimportant modifications to fit the specific format demanded by the target audience): |
FYI, I have thrown my latest version of this template into a small R package: |
I recently created a generic "article" format that has a number of useful features for creating vendor neutral articles and is largely compatible with several other rticles formats, allowing one to start writing articles using this neutral format and quickly change to that of a specific journal once one makes a choice. I am using it to write working document for regional fisheries management organizations (which often eventually become peer-reviewed publications), but it is quite generic.
I am wondering if this sort of "vendor neutral" format could be integrated into rticles. I think it is valuable to include pertinent formats that are not linked to specific publishers, but want to make sure there is interest before trying to do so.
I am adding a link to the format below. If there is interest, I can easily adapt it to rticles and create a pull request for the format. Suggestions on what to call it would be appreciated ("generic_article"???).
Link to directory containing format files. Only rfmo_template.tex and rfmo_skeleton.Rmd are essential.
By filing an issue to this repo, I promise that
xfun::session_info('rticles')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/rticles')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: