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

Undefined control sequence in rticles::tf_article output: when used with tinytex package #246

Closed
jooyoungseo opened this issue Sep 5, 2019 · 8 comments

Comments

@jooyoungseo
Copy link

I cannot render an Rmd file using rticles::tf_article output format along with tinytex package.

Please help me with the issue using the following reproducible scripts:

tinytex:::is_tinytex()
#> [1] TRUE
options(tinytex.verbose = TRUE)

file <- rmarkdown::draft(
  "test", 
  "tf_article", 
  "rticles", 
  create_dir = TRUE, 
  edit = FALSE
)

rmarkdown::render(input = file, output_format = "rticles::tf_article")
#> processing file: test.Rmd
#> output file: test.knit.md
#> "C:/ANACON~1/Scripts/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.tex --template "C:\PROGRA~1\R\R-36~1.1\library\rticles\RMARKD~1\TEMPLA~1\TF_ART~1\RESOUR~1\template.tex" --highlight-style tango --pdf-engine pdflatex --natbib --lua-filter "C:/Program Files/R/R-3.6.1/library/rmarkdown/rmd/lua/pagebreak.lua"
#> ! Undefined control sequence.
#> <argument> C:\Users 
#>                     \JooYoung \AppData \Local \Temp \RtmpQ 1rEam\file 31143d...
#> l.381 ...l\Temp\RtmpQ1rEam\file31143d461174.pdf}}}
#>                                                   \hspace{5pt}
#> Error: Failed to compile test.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See test.log for more info.

Created on 2019-09-05 by the reprex package (v0.3.0.9000)

Session info
sessioninfo::session_info()
#> - Session info ----------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.6.1 (2019-07-05)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_United States.1252  
#>  ctype    English_United States.1252  
#>  tz       America/New_York            
#>  date     2019-09-05                  
#> 
#> - Packages --------------------------------------------------------------
#>  package     * version    date       lib
#>  assertthat    0.2.1      2019-03-21 [1]
#>  cli           1.1.0      2019-03-19 [1]
#>  crayon        1.3.4      2017-09-16 [1]
#>  digest        0.6.20     2019-07-04 [1]
#>  evaluate      0.14       2019-05-28 [1]
#>  highr         0.8        2019-03-20 [1]
#>  htmltools     0.3.6      2017-04-28 [1]
#>  knitr         1.24.4     2019-09-04 [1]
#>  magrittr      1.5        2014-11-22 [1]
#>  Rcpp          1.0.2.1    2019-08-08 [1]
#>  rmarkdown     1.15.1     2019-09-03 [1]
#>  rticles       0.10.1     2019-08-28 [1]
#>  sessioninfo   1.1.1      2018-11-05 [1]
#>  stringi       1.4.3      2019-03-12 [1]
#>  stringr       1.4.0.9000 2019-08-08 [1]
#>  tinytex       0.15.2     2019-09-03 [1]
#>  withr         2.1.2      2018-03-15 [1]
#>  xfun          0.9        2019-08-21 [1]
#>  yaml          2.2.0      2018-07-25 [1]
#>  source                            
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.1)                    
#>  Github (yihui/knitr@079dc84)      
#>  CRAN (R 3.6.1)                    
#>  Github (RcppCore/Rcpp@1789f09)    
#>  Github (rstudio/rmarkdown@ff285a0)
#>  Github (rstudio/rticles@989e18a)  
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.0)                    
#>  Github (hadley/stringr@0b90f91)   
#>  Github (yihui/tinytex@f8e025c)    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.1)                    
#>  CRAN (R 3.6.0)                    
#> 
#> [1] C:/Program Files/R/R-3.6.1/library
@tcgriffith
Copy link

Looks like you have spaces in your path.

@jooyoungseo
Copy link
Author

Thanks for your comment @tcgriffith; however, I do not think it has something to do with spaces in path. Because the path is automatically quoted with the quotation (") mark when generated by reprex::reprex() function.
If someone could try with the reproducible code with tinytex package on Windows system, please share me with your results.

@tcgriffith
Copy link

I tested your code and it's totally fine on Win10.

I'm still suspecting it's a path issue since you are using the template Rmd document. Please try the following script and see if it works for you, the only change I made is to change your working directory to c:

options(tinytex.verbose = TRUE)

setwd("C:")
file <- rmarkdown::draft(
  "test", 
  "tf_article", 
  "rticles", 
  create_dir = TRUE, 
  edit = FALSE
)

rmarkdown::render(input = file, output_format = "rticles::tf_article")

@jooyoungseo
Copy link
Author

@tcgriffith, still doesn't work.
What version of Pandoc do you use? I use the latest one: V2.7.3.

@tcgriffith
Copy link

2.3.1. I never installed pandoc myself so I'm sure it was shipped with Rstudio.

@jooyoungseo
Copy link
Author

It doesn't work even I tried with Pandoc 2.3.1.
Excuse me, @yihui, do you have any suggestion on this issue?

@yihui yihui closed this as completed in 243e1b8 Sep 13, 2019
@yihui
Copy link
Member

yihui commented Sep 13, 2019

Yes. The problem came from the Rmd template, which I just fixed via 243e1b8. Somehow I didn't notice this when I was reviewing @dleutnant's PR #218 (FYI, knitr::fig_chunk() would be a much better way than pdf(tempfile()): https://yihui.name/en/2017/09/knitr-fig-chunk/).

@github-actions
Copy link

github-actions bot commented Nov 2, 2020

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 Nov 2, 2020
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