rstudio / rticles

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

Update springer article #491

Closed eliocamp closed 1 year ago

eliocamp commented 2 years ago

Springer seems to have updated its template. The one provided by rticles uses de svjour3 class, but the one you can download form the website uses the sn-jnl class and is pretty different.

I'm preparing a submission (that's why I noticed) so I could update it and send a PR.


By filing an issue to this repo, I promise that

I understand that my issue may be closed if I don't fulfill my promises.

cderv commented 2 years ago

I'm preparing a submission (that's why I noticed) so I could update it and send a PR.

Awesome thanks !

We don't have an effective way currently to know when a journal updates and when we need to update. We are trying to rely on contributor for that. Thank you very much !

eliocamp commented 2 years ago

I'm trying to adapt this affiliation format:

\affil[3]{\orgdiv{Department}, \orgname{Organization}, \orgaddress{\street{Street}, \city{City}, \postcode{610101}, \state{State}, \country{Country}}}

Right now I have this in the yaml header

affiliations:
  - number: 1
    corresponding: TRUE
    division: Department
    name: Organization
    address:
        street: Street
        city: City
        postcode: 100190
        state: State
        country: Country

And this in the template

$for(affiliations)$
  \affil$if(affiliations.corresponding)$*$endif$[$affiliations.number$]{
    $if(affiliations.division)$
      \orgdiv{$affiliations.division$},
    $endif$
    $if(affiliations.name)$
      \orgname{$affiliations.name$},
    $endif$
  $if(affiliations.address)$
  \orgaddress{
    $if(affiliations.address.street)$
      \street{$affiliations.address.street$},
    $endif$
    $if(affiliations.address.city)$
      \city{$affiliations.address.city$},
    $endif$
    $if(affiliations.address.postcode)$
      \postcode{$affiliations.address.postcode$},
    $endif$
    $if(affiliations.address.state)$
      \state{$affiliations.address.state$},
    $endif$
    $if(affiliations.address.country)$
      \country{$affiliations.address.country$}
    $endif$
    }
  $endif$}
$endfor$

The problem is that for an organisation without some of the fields you get dangling commas:

\affil*[2]{\orgname{Other Organisation},}

Is there a way to emulate the $sep$ behaviour inside an if?

cderv commented 2 years ago

What about using a for instead of an if ? I wonder if the $sep$ will add if there is only one value 🤔 https://pandoc.org/MANUAL.html#for-loops

Some pipes function are required sometimes for complex layout (https://pandoc.org/MANUAL.html#pipes) This will upgrade Pandoc's requirement for the format but it is really to do otherwise without it sometimes.

But it is possible that Template feature from Pandoc is too limited for this new organization 🤔

eliocamp commented 2 years ago

Ah, thanks for pointing me to the pipe thing. Using the pairs pipe and clever use of names I solved it with:


affiliations:
  - number: 1
    corresponding: TRUE
    info:
      orgdiv: Department
      orgname: Organization
    address:
        street: Street
        city: City
        postcode: 100190
        state: State
        country: Country

and

$for(affiliations)$
  \affil[$affiliations.number$]{$for(affiliations.info/pairs)$\$it.key${$it.value$}$sep$, $endfor$$if(affiliations.address)$, \orgaddress{$for(affiliations.address/pairs)$\$it.key${$it.value$}$sep$, $endfor$}$endif$}
$endfor$
cderv commented 2 years ago

Using the pairs pipe and clever use of names I solved it

Good! This just means that a minimum Pandoc version requirement will be required for this template.

github-actions[bot] commented 7 months 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.