cross reference in tufte handout format

Hello all rstats friends!

I am wondering if there is a way to adjust the output format of tufte::tufte_handout to enable cross reference figures and tables, and to use latex environments provided by bookdown such as theorem?

you can use the base_format argument of function as explained in the documentation

But this format is already included in bookdown I think. See https://bookdown.org/yihui/bookdown/html.html#tufte-style and end of page here https://bookdown.org/yihui/bookdown/latexpdf.html

You can change the base_format function to other output format functions, and bookdown has provided a simple wrapper function tufte_book2() , which is basically pdf_book(base_format = tufte::tufte_book) , to produce a PDF book using the Tufte PDF style (again, see the tufte package).

Are you looking from something different than the bookdown::tufte_* functions included in the :package: ?

Thanks, I got the misconception that only formats in the rticles package can be used in base_format. But when I got a error message

! LaTeX Error: Environment cslreferences undefined.

error: LaTeX failed to compile tufte.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See tufte.log for more info.

My yaml header is set as follows, with default content from the template

---
title: "Tufte Handout"
subtitle: "An implementation in R Markdown"
author: "JJ Allaire and Yihui Xie"
date: "`r Sys.Date()`"
output:
  bookdown::pdf_book:
    base_format: tufte::tufte_book
bibliography: skeleton.bib
link-citations: yes
xfun::session_info(c("rmarkdown", "bookdown", "tufte"))
#> R version 4.0.2 (2020-06-22)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 18362)
#> 
#> Locale:
#>   LC_COLLATE=Chinese (Simplified)_China.936 
#>   LC_CTYPE=Chinese (Simplified)_China.936   
#>   LC_MONETARY=Chinese (Simplified)_China.936
#>   LC_NUMERIC=C                              
#>   LC_TIME=Chinese (Simplified)_China.936    
#> 
#> Package version:
#>   base64enc_0.1.3 bookdown_0.20   digest_0.6.25   evaluate_0.14  
#>   glue_1.4.2      graphics_4.0.2  grDevices_4.0.2 highr_0.8      
#>   htmltools_0.5.0 jsonlite_1.7.1  knitr_1.30.1    magrittr_1.5   
#>   markdown_1.1    methods_4.0.2   mime_0.9        rlang_0.4.7    
#>   rmarkdown_2.3.9 stats_4.0.2     stringi_1.5.3   stringr_1.4.0  
#>   tinytex_0.26.1  tools_4.0.2     tufte_0.6       utils_4.0.2    
#>   xfun_0.17       yaml_2.2.1     
#> 
#> Pandoc version: 2.9.2.1

Created on 2020-09-25 by the reprex package (v0.3.0)

And at the bottom of the log file


! LaTeX Error: Environment cslreferences undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.599 \begin{cslreferences}
                            
Here is how much of TeX's memory you used:
 14008 strings out of 482799
 207148 string characters out of 5953272
 483578 words of memory out of 5000000
 28998 multiletter control sequences out of 15000+600000
 602774 words of font info for 136 fonts, out of 8000000 for 9000
 14 hyphenation exceptions out of 8191
 55i,11n,51p,1147b,503s stack positions out of 5000i,500n,10000p,200000b,80000s

!  ==> Fatal error occurred, no output PDF file produced!

Why don't you use bookdown::tufte_book2() ?
Is this working with bookdown::tufte_book2() ?

Can you try with the bookdown function and see if you got the same error ?
It could be a bug as in https://github.com/rstudio/rticles/issues/260

In fact this has already been fixed in dev version of tufte :package:.
See https://github.com/rstudio/tufte/pull/80

You need to install the dev version of tufte for now

1 Like

Thanks. bookdown::tufte_book2 does not work either, but the development version fixes both cases.

1 Like

Great ! There will be a CRAN release very soon !

And this is now on CRAN

The community keeps making amazing contributions!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.