Skip to content
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

CSL handing indent does not seem to be working #290

Closed
dmkaplan2000 opened this issue May 7, 2020 · 3 comments
Closed

CSL handing indent does not seem to be working #290

dmkaplan2000 opened this issue May 7, 2020 · 3 comments

Comments

@dmkaplan2000
Copy link
Contributor

A number of rticles formats seem to provide support for hanging indent of CSL/pandoc-citeproc formatted references, but either I do not understand how it is supposed to be used or it is not working as intended. For example, the plos_article format includes the following code in template.tex:

$if(csl-refs)$
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newenvironment{cslreferences}%
  {$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
  \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
  {\par}
$endif$

Given this code, I would expect that adding to the YAML header:

csl-refs: yes
cls-hanging-indent: yes

would cause the references to be formatted with a handing indent. However, this does not seem to work because the references are not sandwiched in the appropriate environment in the TeX output:

\begin{cslreferences}
<CSL REFERENCES HERE>
\end{cslreferences}

Am I not understanding how this is supposed to be used or is this not implemented appropriately?

Thanks and I apologize if I am misunderstanding something.


By filing an issue to this repo, I promise that

  • [ X] I have fully read the issue guide at https://yihui.name/issue/.
  • [ X] I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included 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').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • [ X] I have learned the Github Markdown syntax, and formatted my issue correctly.

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

@yihui
Copy link
Member

yihui commented Aug 3, 2020

The cslreferences environment is only generated since a certain version of Pandoc. You didn't follow the issue guide to provide your session info, so we don't know for sure if it's because your Pandoc version is too low. If you are using RStudio, try to upgrade it (as the issue guide asked you to). If not, try to upgrade Pandoc: https://bookdown.org/yihui/rmarkdown-cookbook/install-pandoc.html

@cderv
Copy link
Collaborator

cderv commented Aug 18, 2020

For example, the plos_article format includes the following code in template.tex:

I think this is from the pandoc default latex template
https://github.com/jgm/pandoc/blob/c22b12100d11a5ebb9ab58f1829a44288b640b6d/data/templates/default.latex#L368-L375

This is for pandoc-citeproc to work when a csl file is provided. That means

  • csl-refs will be true if a csl is provided in yaml (as the PLOS template)
  • csl-hanging-indent will be true if the csl file contains hanging-indent=true

See jgm/pandoc-citeproc#410

This has been in Pandoc only since 2.8 and later, so it won't work by default in RStudio IDE has it comes with pandoc 2.7.3. You need to install a more recent version.

We will assume this is the issue you encountered. If even after upgrading, you still have the issue, please reopen.

@cderv cderv closed this as completed Aug 18, 2020
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants