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 Error in vitae::awesomecv output: when used with tinytex package #80

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

Comments

@jooyoungseo
Copy link
Contributor

I cannot render an Rmd file using vitae::awesomecv() 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", 
  "awesomecv", 
  "vitae",
  create_dir = TRUE,
  edit = FALSE
)

rmarkdown::render(input = file, output_format = "vitae::awesomecv")
#> processing file: test.Rmd
#> Registered S3 method overwritten by 'R.oo':
#>   method        from       
#>   throw.default R.methodsS3
#> Warning in RefManageR::as.BibEntry(.): rownames of data.frame not
#> meaningful for creating keys
#> Writing 12 Bibtex entries ...
#> OK
#> Results written to file 'curie.bib'
#> 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 --table-of-contents --toc-depth 2 --template "C:\PROGRA~1\R\R-36~1.1\library\vitae\RMARKD~1\TEMPLA~1\AWESOM~1\RESOUR~1\AWESOM~1.TEX" --number-sections --highlight-style tango --pdf-engine xelatex --biblatex --lua-filter "C:/Program Files/R/R-3.6.1/library/rmarkdown/rmd/lua/pagebreak.lua" --wrap preserve --variable tables=yes --standalone --include-in-header "C:\Users\JooYoung\AppData\Local\Temp\RtmpcddSv7\cv-header28986d732d44.tex"
#> tlmgr search --file --global "/authoryear.dbx"
#> Warning in parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)): Failed
#> to find a package that contains authoryear.dbx
#> tlmgr search --file --global "/authoryear-comp.dbx"
#> Warning in parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)): Failed
#> to find a package that contains authoryear-comp.dbx
#> tlmgr search --file --global "/biblatex-dm.cfg"
#> Warning in parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)): Failed
#> to find a package that contains biblatex-dm.cfg
#> tlmgr search --file --global "/tikzlibrarytopaths.code.tex"
#> Trying to automatically install missing LaTeX packages...
#> tlmgr install pgf
#> tlmgr search --file --global "/authoryear.dbx"
#> Warning in parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)): Failed
#> to find a package that contains authoryear.dbx
#> tlmgr search --file --global "/authoryear-comp.dbx"
#> Warning in parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)): Failed
#> to find a package that contains authoryear-comp.dbx
#> tlmgr search --file --global "/biblatex-dm.cfg"
#> Warning in parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)): Failed
#> to find a package that contains biblatex-dm.cfg
#> tlmgr search --file --global "/tikzlibrarytopaths.code.tex"
#> ! Undefined control sequence.
#> <argument> blx@catg@bib-C:\Users 
#>                                  \JooYoung \AppData \Local \Temp \RtmpGsrLqX...
#> l.153 ...prex48f825735eea\test\curie.bib-865299.4}
#> 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]
#>  bibtex        0.4.2      2017-06-30 [1]
#>  bookdown      0.13.2     2019-09-01 [1]
#>  cli           1.1.0      2019-03-19 [1]
#>  crayon        1.3.4      2017-09-16 [1]
#>  curl          4.0        2019-07-22 [1]
#>  digest        0.6.20     2019-07-04 [1]
#>  dplyr         0.8.3.9000 2019-08-15 [1]
#>  evaluate      0.14       2019-05-28 [1]
#>  glue          1.3.1.9000 2019-08-08 [1]
#>  highr         0.8        2019-03-20 [1]
#>  htmltools     0.3.6      2017-04-28 [1]
#>  httr          1.4.1      2019-08-05 [1]
#>  jsonlite      1.6        2018-12-07 [1]
#>  knitr         1.24.4     2019-09-04 [1]
#>  lubridate     1.7.4.9000 2019-08-08 [1]
#>  magrittr      1.5        2014-11-22 [1]
#>  pillar        1.4.2      2019-06-29 [1]
#>  pkgconfig     2.0.2      2018-08-16 [1]
#>  plyr          1.8.4      2016-06-08 [1]
#>  purrr         0.3.2.9000 2019-08-09 [1]
#>  R.cache       0.13.0     2018-01-04 [1]
#>  R.methodsS3   1.7.1      2016-02-16 [1]
#>  R.oo          1.22.0     2018-04-22 [1]
#>  R.utils       2.9.0      2019-06-13 [1]
#>  R6            2.4.0      2019-02-14 [1]
#>  Rcpp          1.0.2.1    2019-08-08 [1]
#>  RefManageR    1.2.12     2019-04-03 [1]
#>  rlang         0.4.0.9002 2019-08-23 [1]
#>  rmarkdown     1.15.1     2019-09-03 [1]
#>  rvest         0.3.4      2019-08-08 [1]
#>  scholar       0.1.7      2019-08-08 [1]
#>  selectr       0.4-1      2018-04-06 [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]
#>  tibble      * 2.1.3      2019-06-06 [1]
#>  tidyselect    0.2.5.9000 2019-08-12 [1]
#>  tinytex       0.15.2     2019-09-03 [1]
#>  vitae       * 0.2.0      2019-09-03 [1]
#>  withr         2.1.2      2018-03-15 [1]
#>  xfun          0.9        2019-08-21 [1]
#>  xml2          1.2.2.9000 2019-08-15 [1]
#>  yaml          2.2.0      2018-07-25 [1]
#>  source                               
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  Github (rstudio/bookdown@56166fe)    
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  Github (tidyverse/dplyr@85faf79)     
#>  CRAN (R 3.6.1)                       
#>  Github (tidyverse/glue@7ac044a)      
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  Github (yihui/knitr@079dc84)         
#>  Github (tidyverse/lubridate@cd82679) 
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  Github (tidyverse/purrr@c755bb9)     
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  Github (RcppCore/Rcpp@1789f09)       
#>  CRAN (R 3.6.1)                       
#>  Github (r-lib/rlang@15e799c)         
#>  Github (rstudio/rmarkdown@ff285a0)   
#>  Github (hadley/rvest@c820e48)        
#>  Github (jkeirstead/scholar@9a9e92f)  
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.0)                       
#>  Github (hadley/stringr@0b90f91)      
#>  CRAN (R 3.6.1)                       
#>  Github (tidyverse/tidyselect@4de95ee)
#>  Github (yihui/tinytex@f8e025c)       
#>  Github (ropenscilabs/vitae@f21a70b)  
#>  CRAN (R 3.6.1)                       
#>  CRAN (R 3.6.1)                       
#>  Github (r-lib/xml2@5bf8de1)          
#>  CRAN (R 3.6.0)                       
#> 
#> [1] C:/Program Files/R/R-3.6.1/library
@jooyoungseo
Copy link
Contributor Author

@mitchelloharawild, do you have any idea about how to address this issue?
Does it have something to do with this issue?
I can't wait to utilize this awesome package.

@robjhyndman
Copy link
Collaborator

robjhyndman commented Sep 15, 2019

It looks like your bib file contains windows paths and it is interpreting them as LaTeX commands. Remove the paths, or change the back slashes to forward slashes.

@jooyoungseo
Copy link
Contributor Author

Thank you very much for your kind advice @robjhyndman; however, I have just used the basic awesomecv template provided by vitae.
I have not changed any path at all.
FYI, if I do not use vitae::bibliography_entries() function in an Rmd file, it does not cause any issue; in other words, on Windows, an Rmd file containing vitae::bibliography_entries() throws that issues.
Would you mind testing that for me on Windows?

@achamess
Copy link

I'm having similar issues. If I open up a fresh template for moderncv and run it, I get the following:

usr/local/bin/pandoc +RTS -K512m -RTS Untitled.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output Untitled.tex --table-of-contents --toc-depth 2 --template /Library/Frameworks/R.framework/Versions/3.5/Resources/library/vitae/rmarkdown/templates/moderncv/resources/moderncv.tex --number-sections --highlight-style tango --pdf-engine pdflatex --biblatex --wrap preserve --variable theme=casual --variable tables=yes --standalone --include-in-header /var/folders/gx/mfdx8g856wvdtp0dw7k8h2s80000gn/T//RtmpWUkBz4/cv-header1bae50e1532e.tex 
output file: Untitled.knit.md

tlmgr search --file --global '/authoryear.dbx'
tlmgr search --file --global '/authoryear-comp.dbx'
tlmgr search --file --global '/biblatex-dm.cfg'
tlmgr search --file --global '/Untitled.bbl'
! Undefined control sequence.
\onlynumberslink ...tl {#1}\regex_replace_all:nnN 
                                                  {[^0-9+]}{}\l_onlynumbersl...
l.191 \end{document}

Error: Failed to compile Untitled.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See Untitled.log for more info.
In addition: Warning messages:
1: package 'tibble' was built under R version 3.5.2 
2: In RefManageR::as.BibEntry(.) :
  rownames of data.frame not meaningful for creating keys
3: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains authoryear.dbx
4: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains authoryear-comp.dbx
5: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains biblatex-dm.cfg
6: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains Untitled.bbl
Execution halted
> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.14.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] forcats_0.4.0   stringr_1.4.0   dplyr_0.8.3     purrr_0.3.2     readr_1.3.1     tidyr_1.0.0     tibble_2.1.3    ggplot2_3.2.1  
 [9] tidyverse_1.2.1 vitae_0.2.0    

loaded via a namespace (and not attached):
 [1] tidyselect_0.2.5  xfun_0.9          haven_2.1.1       lattice_0.20-38   colorspace_1.4-1  generics_0.0.2    vctrs_0.2.0      
 [8] htmltools_0.3.6   yaml_2.2.0        rlang_0.4.0       R.oo_1.22.0       pillar_1.4.2      withr_2.1.2       glue_1.3.1       
[15] R.utils_2.9.0     selectr_0.4-1     readxl_1.3.1      modelr_0.1.5      plyr_1.8.4        R.cache_0.13.0    lifecycle_0.1.0  
[22] cellranger_1.1.0  munsell_0.5.0     gtable_0.3.0      rvest_0.3.4       R.methodsS3_1.7.1 evaluate_0.14     knitr_1.24       
[29] scholar_0.1.7     curl_3.3          broom_0.5.2       Rcpp_1.0.2        backports_1.1.4   scales_1.0.0      jsonlite_1.6     
[36] hms_0.5.1         digest_0.6.20     stringi_1.4.3     bibtex_0.4.2      grid_3.5.0        cli_1.1.0         tools_3.5.0      
[43] magrittr_1.5      lazyeval_0.2.2    RefManageR_1.2.12 crayon_1.3.4      pkgconfig_2.0.2   zeallot_0.1.0     xml2_1.2.2       
[50] lubridate_1.7.4   assertthat_0.2.1  rmarkdown_1.15    httr_1.4.1        rstudioapi_0.10   R6_2.4.0          nlme_3.1-141     
[57] compiler_3.5.0   

@mitchelloharawild
Copy link
Owner

Thank you very much for your kind advice @robjhyndman; however, I have just used the basic awesomecv template provided by vitae.
I have not changed any path at all.
FYI, if I do not use vitae::bibliography_entries() function in an Rmd file, it does not cause any issue; in other words, on Windows, an Rmd file containing vitae::bibliography_entries() throws that issues.
Would you mind testing that for me on Windows?

Is this now working with the latest development version? I've just pushed a change which resolves some related issues. (586a8dd)

@achamess
Copy link

Still not working. I think it's related to the tlmgr package. I'm using a Mac. I think the tlmgr needs me to be root to download the templates? Awesome CV works for me, but none of the others.

This is what I'm getting

output file: test.knit.md

tlmgr search --file --global '/authoryear.dbx'
tlmgr search --file --global '/authoryear-comp.dbx'
tlmgr search --file --global '/biblatex-dm.cfg'
! Undefined control sequence.
l.87 \DeclareSortingTemplate
                            {ty}{ 

Error: Failed to compile test.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See test.log for more info.
In addition: Warning messages:
1: In RefManageR::as.BibEntry(.) :
  rownames of data.frame not meaningful for creating keys
2: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains authoryear.dbx
3: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains authoryear-comp.dbx
4: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains biblatex-dm.cfg
Execution halted

@achamess
Copy link

With classic CV template (no changes made, just a fresh Rmd template from the package), I get this:

output file: Untitled.knit.md

tlmgr search --file --global '/authoryear.dbx'
tlmgr search --file --global '/authoryear-comp.dbx'
tlmgr search --file --global '/biblatex-dm.cfg'
tlmgr search --file --global '/tikzlibrarytopaths.code.tex'
tlmgr search --file --global '/tikzlibraryshapes.code.tex'
tlmgr search --file --global '/tikzlibrarybackgrounds.code.tex'
tlmgr search --file --global '/tikzlibrarymindmap.code.tex'
tlmgr search --file --global '/tikzlibrarytrees.code.tex'
Trying to automatically install missing LaTeX packages...
tlmgr install pgf
You don't have permission to change the installation in any way,
specifically, the directory /usr/local/texlive/2017/tlpkg/ is not writable.
Please run this program as administrator, or contact your local admin.
tlmgr: An error has occurred. See above messages. Exiting.
tlmgr update --self
tlmgr: package repository http://mirror.utexas.edu/ctan/systems/texlive/tlnet (not verified: gnupg not available)
You don't have permission to change the installation in any way,
specifically, the directory /usr/local/texlive/2017/tlpkg/ is not writable.
Please run this program as administrator, or contact your local admin.
tlmgr: An error has occurred. See above messages. Exiting.
fmtutil [ERROR]: format directory not writable: /usr/local/texlive/2017/texmf-var/web2c
tlmgr install pgf
You don't have permission to change the installation in any way,
specifically, the directory /usr/local/texlive/2017/tlpkg/ is not writable.
Please run this program as administrator, or contact your local admin.
tlmgr: An error has occurred. See above messages. Exiting.
tlmgr path add
add_link_dir_dir: /usr/local/share/info/dir exists; not making symlink.
! Undefined control sequence.
l.276 \DeclareSortingTemplate
                             {ty}{ 

Error: Failed to compile Untitled.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See Untitled.log for more info.
In addition: Warning messages:
1: package 'tibble' was built under R version 3.5.2 
2: In RefManageR::as.BibEntry(.) :
  rownames of data.frame not meaningful for creating keys
3: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains authoryear.dbx
4: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains authoryear-comp.dbx
5: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains biblatex-dm.cfg
Execution halted

@mitchelloharawild
Copy link
Owner

You don't have permission to change the installation in any way,
specifically, the directory /usr/local/texlive/2017/tlpkg/ is not writable.
Please run this program as administrator, or contact your local admin.

Looks like this is a permissions issue. Can you grant the process additional privileges?

@achamess
Copy link

I could, but not sure where or how. Can I add a sudo somewhere?

@mitchelloharawild
Copy link
Owner

The package trying to be installed is pgf, so try installing that manually from the terminal with
sudo tlmgr install pgf.

@achamess
Copy link

Thanks. I did this. It was already present. I went even further and modified the directory where tlmgr puts packages so that it was writable. It changed the error message slightly now:

output file: Untitled.knit.md

tlmgr search --file --global '/authoryear.dbx'
tlmgr search --file --global '/authoryear-comp.dbx'
tlmgr search --file --global '/biblatex-dm.cfg'
tlmgr search --file --global '/tikzlibrarytopaths.code.tex'
Trying to automatically install missing LaTeX packages...
tlmgr install pgf
tlmgr: package repository http://mirrors.rit.edu/CTAN/systems/texlive/tlnet (not verified: gpg unavailable)
tlmgr install: package already present: pgf
tlmgr path add
add_link_dir_dir: /usr/local/share/info/dir exists; not making symlink.
tlmgr search --file --global '/authoryear.dbx'
tlmgr search --file --global '/authoryear-comp.dbx'
tlmgr search --file --global '/biblatex-dm.cfg'
tlmgr search --file --global '/tikzlibrarytopaths.code.tex'

Why is it searching for those files through tlmgr?

@achamess
Copy link

FYI: I used the Tinytex installation and that got around most of the issues. But now I have parallel installs of LaTex on my computer. Not ideal, but works for now.

@mitchelloharawild
Copy link
Owner

Great, glad that worked out for you.
Closing as we recommend using tinytex for those having trouble managing their own LaTeX installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants