rstudio / rticles

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

citecolor and \@ref() in rmarkdown not working accurately #401

Closed alexWhitworth closed 3 years ago

alexWhitworth commented 3 years ago

I'm trying to follow the Bookdown guidance

Problem 1

Use of \@ref(<label>) doesn't work. Instead am required to use (@<label>) or (\ref{<label>})

Problem 2

Same issue as in https://github.com/rstudio/rmarkdown/issues/362

Rmarkdown header

---
title: 'rCUPED: user guide'
author: "Alex Whitworth"
date: "May, 2021"
fontsize: 12pt
geometry: margin=0.75in
urlcolor: blue
citecolor: blue
abstract: 'my abstract is super cool'
bibliography: ['bibliography.bib']  
output: 
  pdf_document:
    citation_package: natbib      # exclude when not attempting `\@ref()` labeling
    toc: true
    number_sections: true
    df_print: kable
    fig_width: 6.5
---

my super cool minimally reproducible doc (@devtools)

bibliography

@article{devtools,
  title={Package ‘devtools’},
  author={Wickham, Hadley and Hester, Jim and Chang, Winston and Hester, Maintainer Jim},
  year={2020}
}

rticles

xfun::session_info('rticles')
R version 4.0.3 (2020-10-10)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Stream 8, RStudio 1.2.5033

Locale:
  LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
  LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

Package version:
  base64enc_0.1.3 digest_0.6.27   evaluate_0.14   glue_1.4.2      graphics_4.0.3  grDevices_4.0.3 highr_0.8      
  htmltools_0.5.0 jsonlite_1.7.2  knitr_1.31      magrittr_2.0.1  markdown_1.1    methods_4.0.3   mime_0.9       
  rlang_0.4.10    rmarkdown_2.6   rticles_0.19    stats_4.0.3     stringi_1.5.3   stringr_1.4.0   tinytex_0.31   
  tools_4.0.3     utils_4.0.3     xfun_0.19       yaml_2.2.1     
cderv commented 3 years ago

Hi, thanks for the report.

In your example your are using pdf_document() but you opened an issue in rticles repo. Are you using an rticles format ? If so which one ?

Also, you mentioned issue with cross reference, citing Cookbook chapter. In your example you pdf_document() but as mentioned in the doc, you need to use a bookdown format.

To use cross-references, you will need:

A bookdown output format: Cross-referencing is not provided directly within the base rmarkdown package, but is provided as an extension in bookdown (Xie 2020c). We must therefore use an output format from bookdown (e.g., html_document2, pdf_document2, and word_document2, etc.) in the YAML output field.

For pdf this would be pdf_document2() or pdf_book() with another base format. Cross reference won't work without a bookdown format. With which format are you trying to use cross reference ?

Regarding the citecolor, I don't understand what is the issue. The citation is correctly put in blue when I use your code.

Please provide a complete reproducible example with what you are doing with rticles R 📦

Thanks

alexWhitworth commented 3 years ago

Interesting. I do not see (intended) blue citations when I compile. But it may be something unrelated to the example above.

Thanks for pointing me to bookdown::pdf_document2 vs pdf_document

cderv commented 3 years ago

I am willing to help if you share an example I can reproduce.

Otherwise do not hesitate to ask for advice on https://community.rstudio.com

alexWhitworth commented 3 years ago

Sounds good. I'll reopen the issue when I revisit the vignette. At the moment, it's in a reasonable state. Thanks.

On Sat, May 22, 2021, 10:24 AM Christophe Dervieux @.***> wrote:

I am willing to help if you share an example I can reproduce.

Otherwise do not hesitate to ask for advice on https://community.rstudio.com

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/rstudio/rticles/issues/401#issuecomment-846439100, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHW65SJ2TS5QBKOHTN3QRDTO7SFFANCNFSM44ZKIJYA .

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