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

R markdown does not create a pdf file #1285

Closed
bdeepthi opened this issue Mar 11, 2018 · 59 comments
Closed

R markdown does not create a pdf file #1285

bdeepthi opened this issue Mar 11, 2018 · 59 comments
Milestone

Comments

@bdeepthi
Copy link

Hi,

When I try to knit the vanilla example Rmd file to "pdf" I get the below error. I tried re-installing the packages and restarting the R session several time but it dint help.

Output created: test.pdf
Error in tools::file_path_as_absolute(output_file) :
file 'test.pdf' does not exist
Calls: ->
In addition: Warning messages:
1: running command '"pdflatex" -halt-on-error -interaction=batchmode "test.tex"' had status 1
2: In readLines(logfile) : incomplete final line found on 'test.log'
Execution halted

@condwanaland
Copy link

I couldn't reproduce this; would you mind adding the minimal structure of Rmd file that fails to knit (i.e., can you include the yaml metadata and any chunks you have)?

Could you please also include the output of sessionInfo()

@bdeepthi
Copy link
Author

bdeepthi commented Mar 11, 2018

Thank you for getting back to me. The Rmd file I'm using the vanilla script you get when you choose a new R markdown.

Rmd file

---
title: "Untitled"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, error= TRUE)
```
## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r cars}
summary(cars)
```

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

Session Info details

R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

loaded via a namespace (and not attached):
 [1] compiler_3.4.3  backports_1.1.2 magrittr_1.5    rprojroot_1.3-2 htmltools_0.3.6
 [6] tools_3.4.3     yaml_2.1.17     Rcpp_0.12.15    stringi_1.1.6   rmarkdown_1.9  
[11] knitr_1.20      stringr_1.3.0   digest_0.6.15   evaluate_0.10.1

@condwanaland
Copy link

What does list.files(pattern = ".Rmd") return?

@bdeepthi
Copy link
Author

It returns the list of rmd files I have in my directory. For this particular file it's "test.Rmd"

@NMarkgraf
Copy link

Try current repository rmarkdown! devtools::install_github("rmarkdown")!

@Zanidean
Copy link

Zanidean commented Mar 12, 2018

Getting this same bug as well, happy to see it's not my system.

I tried the github repo and it hasn't helped.

If I press the 'Knit' button it works, but when i use rmarkdown::render() it fails with the same error message. Same default .Rmd file as well.

Error: Failed to compile Test.tex.
In addition: Warning message:
running command '"pdflatex" -halt-on-error -interaction=batchmode "Test.tex"' had status 1 

Here is my sessionInfo()

R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] rmarkdown_1.9.3 tinytex_0.4    

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.15     digest_0.6.15    withr_2.1.1.9000
 [4] rprojroot_1.3-2  R6_2.2.2         backports_1.1.2 
 [7] git2r_0.21.0     magrittr_1.5     evaluate_0.10.1 
[10] httr_1.3.1       stringi_1.1.6    curl_3.1        
[13] devtools_1.13.5  tools_3.4.3      stringr_1.3.0   
[16] yaml_2.1.18      compiler_3.4.3   memoise_1.1.0   
[19] htmltools_0.3.6  knitr_1.20   

@NMarkgraf
Copy link

NMarkgraf commented Mar 12, 2018

Can you please show us the complete rmarkdown::render() command, I'd like to see the parameters you use.

@Zanidean
Copy link

rmarkdown::render(input = "Test.Rmd",
                  output_format = "pdf_document",
                  output_file = "Test.pdf")

I've tried defaulting the file name and format options as well, same result.

@NMarkgraf
Copy link

NMarkgraf commented Mar 12, 2018

Rendered here with no problem. Did you update tinytex to current github release 0.3.7 as well?
devtools::install_github("tinytex") ?

@Zanidean
Copy link

Zanidean commented Mar 12, 2018

No I didn't, but I'll try.

I don't actually even use that tinytext, but installed it thinking it might be worth trying.

In the meantime, just reverting to an older rmarkdown worked for me.

devtools::install_version("rmarkdown", version = "1.8", repos = "http://cran.us.r-project.org")

@NMarkgraf
Copy link

Yes it does, but please give tinytex a try, it is very cool and a lot of speed up, when you use "keep_tex: yes" ;-) -- And if it work, @yihui should publish a new rmarkdown and tinytex release ASAP ;-)

@Zanidean
Copy link

Zanidean commented Mar 12, 2018

I'm still pretty confident that this particular problem is in RMarkdown rather than tinytex as OP doesn't seem to have it running on his end and it was resolved for me by reverting to an older version of the package.

Yes, it looks like tinytex becoming a dependency is probably the cause of this for me. This commit gets rid of a ton of latexmk and now tinytex is required for pdf.

Funny that it doesn't seem to translate to the button inside RStudio though, does anybody know why that might be?

@bdeepthi
Copy link
Author

I couldnt install the dev version of the rmarkdown because of folder permission issues. But I installed it using install.packages("rmarkdown") and tried to knit it but the same issue.

@Zanidean
Copy link

Try installing an older version of RMarkdown if you need to knit right away. I had luck with version 1.8 but I think anything prior to 1.9.3 should solve this as it's when tinytex became required.

@NMarkgraf
Copy link

If you can't get both current development releases (rmarkdown 1.9.3 and tinytex 0.3.7) on your system, please your rmarkdown 1.8. Or encourage @yihui to release the current devilment releases as 1.10 and 0.4 on CRAN asap! ;-)

Yes, the older rmarkdown will do the job, but tinytex will become a needed part of rmarkdown soon.

@yihui
Copy link
Member

yihui commented Mar 12, 2018

@NMarkgraf tinytex 0.4 is on CRAN. I have been sick for a few days, so haven't tagged the 0.4 release on Github yet.

@NMarkgraf
Copy link

Thanks @yihui! - Get healthy first. - We need you and your work ;-)

@Zanidean
Copy link

I actually noticed that 0.4 was there - I think I'll just need to play around with getting it working and installed as I had some additional Status 4 errors.

Thank you for your help!

@bdeepthi
Copy link
Author

I tried different ways to downgrade the version but I was unsuccessful. I will wait till @yihui released the 1.10 version and try again.

@Zanidean
Copy link

Zanidean commented Mar 12, 2018

Do you have devtools installed?

If so, you could try this:

devtools::install_version("rmarkdown", version = "1.8", repos = "http://cran.us.r-project.org")

You might try going here and installing from source.

FWIW, I got tinytex going and rendering a pdf, but when I use xelatex it throws me the same status 1 error.

I think I'm going to wait until this can all be wrapped up into RStudio itself because I don't have time to bother with figuring out why tinytex isn't playing nicely.

@yihui
Copy link
Member

yihui commented Mar 12, 2018

@bdeepthi @Zanidean I tried for a while on Windows but I just could not reproduce the problem. I wonder if any of you are able to do a 10-min chat with me (anytime this afternoon or any day this week) and show me the problem on your computer (with screensharing). I don't think rmarkdown 1.10 will magically fix your issue if I don't figure out the reason of the failure. Thanks!

If you install.packages(c('rmarkdown', 'tinytex')) (i.e. both from CRAN), you may add a code chunk with options(tinytex.verbose = TRUE), and see if it gives you more information about the error.

@yihui
Copy link
Member

yihui commented Mar 12, 2018

BTW, if you have the log file (e.g., test.log), it might be helpful if I can take a look at it.

@Zanidean
Copy link

As much as I'd like to, I won't be able to screen share at work.

But I would like to help. As mentioned, pdflatex doesn't give me any issues but when I call xelatex I seem to get similar issues.

@bdeepthi
Copy link
Author

I have the same 'Permission Denied' error when I use devtools to install the package. I also downloaded the tar file from the archive and used that but its the same issue.

@bdeepthi
Copy link
Author

bdeepthi commented Mar 12, 2018

log file: (Replace the actual path with "path"

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6630 64-bit) (preloaded format=pdflatex 2018.3.11) 12 MAR 2018 11:59 entering extended mode **./test.tex (test.tex LaTeX2e <2017-04-15> Babel <3.18> and hyphenation patterns for 75 language(s) loaded.

("path\MiKTeX 2.9\tex\latex\base\artic
le.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class

("path\MiKTeX 2.9\tex\latex\base\size1
0.clo"
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("path\MiKTeX 2.9\tex\latex\lm\lmodern
.sty"
Package: lmodern 2009/10/30 v1.6 Latin Modern Fonts
LaTeX Font Info: Overwriting symbol font operators' in version normal'
(Font) OT1/cmr/m/n --> OT1/lmr/m/n on input line 22.
LaTeX Font Info: Overwriting symbol font letters' in version normal'
(Font) OML/cmm/m/it --> OML/lmm/m/it on input line 23.
LaTeX Font Info: Overwriting symbol font symbols' in version normal'
(Font) OMS/cmsy/m/n --> OMS/lmsy/m/n on input line 24.
LaTeX Font Info: Overwriting symbol font largesymbols' in version normal'
(Font) OMX/cmex/m/n --> OMX/lmex/m/n on input line 25.
LaTeX Font Info: Overwriting symbol font operators' in version bold'
(Font) OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 26.
LaTeX Font Info: Overwriting symbol font letters' in version bold'
(Font) OML/cmm/b/it --> OML/lmm/b/it on input line 27.
LaTeX Font Info: Overwriting symbol font symbols' in version bold'
(Font) OMS/cmsy/b/n --> OMS/lmsy/b/n on input line 28.
LaTeX Font Info: Overwriting symbol font largesymbols' in version bold'
(Font) OMX/cmex/m/n --> OMX/lmex/m/n on input line 29.
LaTeX Font Info: Overwriting math alphabet \mathbf' in version normal'
(Font) OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 31.
LaTeX Font Info: Overwriting math alphabet \mathsf' in version normal'
(Font) OT1/cmss/m/n --> OT1/lmss/m/n on input line 32.
LaTeX Font Info: Overwriting math alphabet \mathit' in version normal'
(Font) OT1/cmr/m/it --> OT1/lmr/m/it on input line 33.
LaTeX Font Info: Overwriting math alphabet \mathtt' in version normal'
(Font) OT1/cmtt/m/n --> OT1/lmtt/m/n on input line 34.
LaTeX Font Info: Overwriting math alphabet \mathbf' in version bold'
(Font) OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 35.
LaTeX Font Info: Overwriting math alphabet \mathsf' in version bold'
(Font) OT1/cmss/bx/n --> OT1/lmss/bx/n on input line 36.
LaTeX Font Info: Overwriting math alphabet \mathit' in version bold'
(Font) OT1/cmr/bx/it --> OT1/lmr/bx/it on input line 37.
LaTeX Font Info: Overwriting math alphabet \mathtt' in version bold'
(Font) OT1/cmtt/m/n --> OT1/lmtt/m/n on input line 38.
)
("path\MiKTeX 2.9\tex\latex\amsfonts\a
mssymb.sty"
Package: amssymb 2013/01/14 v3.01 AMS font symbols

("path\MiKTeX 2.9\tex\latex\amsfonts\a
msfonts.sty"
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
@emptytoks=\toks14
\symAMSa=\mathgroup4
\symAMSb=\mathgroup5
LaTeX Font Info: Overwriting math alphabet \mathfrak' in version bold'
(Font) U/euf/m/n --> U/euf/b/n on input line 106.
))
("path\MiKTeX 2.9\tex\latex\amsmath\am
smath.sty"
Package: amsmath 2017/09/02 v2.17a AMS math features
@mathmargin=\skip43
For additional information on amsmath, use the `?' option.

("path\MiKTeX 2.9\tex\latex\amsmath\am
stext.sty"
Package: amstext 2000/06/29 v2.01 AMS text

("path\MiKTeX 2.9\tex\latex\amsmath\am
sgen.sty"
File: amsgen.sty 1999/11/30 v2.0 generic functions
@emptytoks=\toks15
\ex@=\dimen103
))
("path\MiKTeX 2.9\tex\latex\amsmath\am
sbsy.sty"
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
\pmbraise@=\dimen104
)
("path\MiKTeX 2.9\tex\latex\amsmath\am
sopn.sty"
Package: amsopn 2016/03/08 v2.02 operator names
)
\inf@bad=\count87
LaTeX Info: Redefining \frac on input line 213.
\uproot@=\count88
\leftroot@=\count89
LaTeX Info: Redefining \overline on input line 375.
\classnum@=\count90
\DOTSCASE@=\count91
LaTeX Info: Redefining \ldots on input line 472.
LaTeX Info: Redefining \dots on input line 475.
LaTeX Info: Redefining \cdots on input line 596.
\Mathstrutbox@=\box26
\strutbox@=\box27
\big@size=\dimen105
LaTeX Font Info: Redeclaring font encoding OML on input line 712.
LaTeX Font Info: Redeclaring font encoding OMS on input line 713.
\macc@depth=\count92
\c@MaxMatrixCols=\count93
\dotsspace@=\muskip10
\c@parentequation=\count94
\dspbrk@lvl=\count95
\tag@help=\toks16
\row@=\count96
\column@=\count97
\maxfields@=\count98
\andhelp@=\toks17
\eqnshift@=\dimen106
\alignsep@=\dimen107
\tagshift@=\dimen108
\tagwidth@=\dimen109
\totwidth@=\dimen110
\lineht@=\dimen111
@envbody=\toks18
\multlinegap=\skip44
\multlinetaggap=\skip45
\mathdisplay@stack=\toks19
LaTeX Info: Redefining [ on input line 2817.
LaTeX Info: Redefining ] on input line 2818.
)
("path\MiKTeX 2.9\tex\generic\ifxetex
ifxetex.sty"
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional
)
("path\MiKTeX 2.9\tex\generic\oberdiek
\ifluatex.sty"
Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
)
("path\MiKTeX 2.9\tex\latex\base\fixlt
x2e.sty"
Package: fixltx2e 2016/12/29 v2.1a fixes to LaTeX (obsolete)
Applying: [2015/01/01] Old fixltx2e package on input line 46.

Package fixltx2e Warning: fixltx2e is not required with releases after 2015
(fixltx2e) All fixes are now in the LaTeX kernel.
(fixltx2e) See the latexrelease package for details.

Already applied: [0000/00/00] Old fixltx2e package on input line 53.
)
("path\MiKTeX 2.9\tex\latex\base\fonte
nc.sty"
Package: fontenc 2017/04/05 v2.0i Standard LaTeX package

("path\MiKTeX 2.9\tex\latex\base\t1enc
.def"
File: t1enc.def 2017/04/05 v2.0i Standard LaTeX file
LaTeX Font Info: Redeclaring font encoding T1 on input line 48.
))
("path\MiKTeX 2.9\tex\latex\base\input
enc.sty"
Package: inputenc 2015/03/17 v1.2c Input encoding file
\inpenc@prehook=\toks20
\inpenc@posthook=\toks21

("path\MiKTeX 2.9\tex\latex\base\utf8.
def"
File: utf8.def 2017/01/28 v1.1t UTF-8 support for inputenc
Now handling font encoding OML ...
... no UTF-8 mapping file for font encoding OML
Now handling font encoding T1 ...
... processing UTF-8 mapping file for font encoding T1

("path\MiKTeX 2.9\tex\latex\base\t1enc
.dfu"
File: t1enc.dfu 2017/01/28 v1.1t UTF-8 support for inputenc
defining Unicode char U+00A0 (decimal 160)
defining Unicode char U+00A1 (decimal 161)
defining Unicode char U+00A3 (decimal 163)
defining Unicode char U+00AB (decimal 171)
defining Unicode char U+00AD (decimal 173)
defining Unicode char U+00BB (decimal 187)
defining Unicode char U+00BF (decimal 191)
defining Unicode char U+00C0 (decimal 192)
defining Unicode char U+00C1 (decimal 193)
defining Unicode char U+00C2 (decimal 194)
defining Unicode char U+00C3 (decimal 195)
defining Unicode char U+00C4 (decimal 196)
defining Unicode char U+00C5 (decimal 197)
defining Unicode char U+00C6 (decimal 198)
defining Unicode char U+00C7 (decimal 199)
defining Unicode char U+00C8 (decimal 200)
defining Unicode char U+00C9 (decimal 201)
defining Unicode char U+00CA (decimal 202)
defining Unicode char U+00CB (decimal 203)
defining Unicode char U+00CC (decimal 204)
defining Unicode char U+00CD (decimal 205)
defining Unicode char U+00CE (decimal 206)
defining Unicode char U+00CF (decimal 207)
defining Unicode char U+00D0 (decimal 208)
defining Unicode char U+00D1 (decimal 209)
defining Unicode char U+00D2 (decimal 210)
defining Unicode char U+00D3 (decimal 211)
defining Unicode char U+00D4 (decimal 212)
defining Unicode char U+00D5 (decimal 213)
defining Unicode char U+00D6 (decimal 214)
defining Unicode char U+00D8 (decimal 216)
defining Unicode char U+00D9 (decimal 217)
defining Unicode char U+00DA (decimal 218)
defining Unicode char U+00DB (decimal 219)
defining Unicode char U+00DC (decimal 220)
defining Unicode char U+00DD (decimal 221)
defining Unicode char U+00DE (decimal 222)
defining Unicode char U+00DF (decimal 223)
defining Unicode char U+00E0 (decimal 224)
defining Unicode char U+00E1 (decimal 225)
defining Unicode char U+00E2 (decimal 226)
defining Unicode char U+00E3 (decimal 227)
defining Unicode char U+00E4 (decimal 228)
defining Unicode char U+00E5 (decimal 229)
defining Unicode char U+00E6 (decimal 230)
defining Unicode char U+00E7 (decimal 231)
defining Unicode char U+00E8 (decimal 232)
defining Unicode char U+00E9 (decimal 233)
defining Unicode char U+00EA (decimal 234)
defining Unicode char U+00EB (decimal 235)
defining Unicode char U+00EC (decimal 236)
defining Unicode char U+00ED (decimal 237)
defining Unicode char U+00EE (decimal 238)
defining Unicode char U+00EF (decimal 239)
defining Unicode char U+00F0 (decimal 240)
defining Unicode char U+00F1 (decimal 241)
defining Unicode char U+00F2 (decimal 242)
defining Unicode char U+00F3 (decimal 243)
defining Unicode char U+00F4 (decimal 244)
defining Unicode char U+00F5 (decimal 245)
defining Unicode char U+00F6 (decimal 246)
defining Unicode char U+00F8 (decimal 248)
defining Unicode char U+00F9 (decimal 249)
defining Unicode char U+00FA (decimal 250)
defining Unicode char U+00FB (decimal 251)
defining Unicode char U+00FC (decimal 252)
defining Unicode char U+00FD (decimal 253)
defining Unicode char U+00FE (decimal 254)
defining Unicode char U+00FF (decimal 255)
defining Unicode char U+0100 (decimal 256)
defining Unicode char U+0101 (decimal 257)
defining Unicode char U+0102 (decimal 258)
defining Unicode char U+0103 (decimal 259)
defining Unicode char U+0104 (decimal 260)
defining Unicode char U+0105 (decimal 261)
defining Unicode char U+0106 (decimal 262)
defining Unicode char U+0107 (decimal 263)
defining Unicode char U+0108 (decimal 264)
defining Unicode char U+0109 (decimal 265)
defining Unicode char U+010A (decimal 266)
defining Unicode char U+010B (decimal 267)
defining Unicode char U+010C (decimal 268)
defining Unicode char U+010D (decimal 269)
defining Unicode char U+010E (decimal 270)
defining Unicode char U+010F (decimal 271)
defining Unicode char U+0110 (decimal 272)
defining Unicode char U+0111 (decimal 273)
defining Unicode char U+0112 (decimal 274)
defining Unicode char U+0113 (decimal 275)
defining Unicode char U+0114 (decimal 276)
defining Unicode char U+0115 (decimal 277)
defining Unicode char U+0116 (decimal 278)
defining Unicode char U+0117 (decimal 279)
defining Unicode char U+0118 (decimal 280)
defining Unicode char U+0119 (decimal 281)
defining Unicode char U+011A (decimal 282)
defining Unicode char U+011B (decimal 283)
defining Unicode char U+011C (decimal 284)
defining Unicode char U+011D (decimal 285)
defining Unicode char U+011E (decimal 286)
defining Unicode char U+011F (decimal 287)
defining Unicode char U+0120 (decimal 288)
defining Unicode char U+0121 (decimal 289)
defining Unicode char U+0122 (decimal 290)
defining Unicode char U+0123 (decimal 291)
defining Unicode char U+0124 (decimal 292)
defining Unicode char U+0125 (decimal 293)
defining Unicode char U+0128 (decimal 296)
defining Unicode char U+0129 (decimal 297)
defining Unicode char U+012A (decimal 298)
defining Unicode char U+012B (decimal 299)
defining Unicode char U+012C (decimal 300)
defining Unicode char U+012D (decimal 301)
defining Unicode char U+012E (decimal 302)
defining Unicode char U+012F (decimal 303)
defining Unicode char U+0130 (decimal 304)
defining Unicode char U+0131 (decimal 305)
defining Unicode char U+0132 (decimal 306)
defining Unicode char U+0133 (decimal 307)
defining Unicode char U+0134 (decimal 308)
defining Unicode char U+0135 (decimal 309)
defining Unicode char U+0136 (decimal 310)
defining Unicode char U+0137 (decimal 311)
defining Unicode char U+0139 (decimal 313)
defining Unicode char U+013A (decimal 314)
defining Unicode char U+013B (decimal 315)
defining Unicode char U+013C (decimal 316)
defining Unicode char U+013D (decimal 317)
defining Unicode char U+013E (decimal 318)
defining Unicode char U+0141 (decimal 321)
defining Unicode char U+0142 (decimal 322)
defining Unicode char U+0143 (decimal 323)
defining Unicode char U+0144 (decimal 324)
defining Unicode char U+0145 (decimal 325)
defining Unicode char U+0146 (decimal 326)
defining Unicode char U+0147 (decimal 327)
defining Unicode char U+0148 (decimal 328)
defining Unicode char U+014A (decimal 330)
defining Unicode char U+014B (decimal 331)
defining Unicode char U+014C (decimal 332)
defining Unicode char U+014D (decimal 333)
defining Unicode char U+014E (decimal 334)
defining Unicode char U+014F (decimal 335)
defining Unicode char U+0150 (decimal 336)
defining Unicode char U+0151 (decimal 337)
defining Unicode char U+0152 (decimal 338)
defining Unicode char U+0153 (decimal 339)
defining Unicode char U+0154 (decimal 340)
defining Unicode char U+0155 (decimal 341)
defining Unicode char U+0156 (decimal 342)
defining Unicode char U+0157 (decimal 343)
defining Unicode char U+0158 (decimal 344)
defining Unicode char U+0159 (decimal 345)
defining Unicode char U+015A (decimal 346)
defining Unicode char U+015B (decimal 347)
defining Unicode char U+015C (decimal 348)
defining Unicode char U+015D (decimal 349)
defining Unicode char U+015E (decimal 350)
defining Unicode char U+015F (decimal 351)
defining Unicode char U+0160 (decimal 352)
defining Unicode char U+0161 (decimal 353)
defining Unicode char U+0162 (decimal 354)
defining Unicode char U+0163 (decimal 355)
defining Unicode char U+0164 (decimal 356)
defining Unicode char U+0165 (decimal 357)
defining Unicode char U+0168 (decimal 360)
defining Unicode char U+0169 (decimal 361)
defining Unicode char U+016A (decimal 362)
defining Unicode char U+016B (decimal 363)
defining Unicode char U+016C (decimal 364)
defining Unicode char U+016D (decimal 365)
defining Unicode char U+016E (decimal 366)
defining Unicode char U+016F (decimal 367)
defining Unicode char U+0170 (decimal 368)
defining Unicode char U+0171 (decimal 369)
defining Unicode char U+0172 (decimal 370)
defining Unicode char U+0173 (decimal 371)
defining Unicode char U+0174 (decimal 372)
defining Unicode char U+0175 (decimal 373)
defining Unicode char U+0176 (decimal 374)
defining Unicode char U+0177 (decimal 375)
defining Unicode char U+0178 (decimal 376)
defining Unicode char U+0179 (decimal 377)
defining Unicode char U+017A (decimal 378)
defining Unicode char U+017B (decimal 379)
defining Unicode char U+017C (decimal 380)
defining Unicode char U+017D (decimal 381)
defining Unicode char U+017E (decimal 382)
defining Unicode char U+01CD (decimal 461)
defining Unicode char U+01CE (decimal 462)
defining Unicode char U+01CF (decimal 463)
defining Unicode char U+01D0 (decimal 464)
defining Unicode char U+01D1 (decimal 465)
defining Unicode char U+01D2 (decimal 466)
defining Unicode char U+01D3 (decimal 467)
defining Unicode char U+01D4 (decimal 468)
defining Unicode char U+01E2 (decimal 482)
defining Unicode char U+01E3 (decimal 483)
defining Unicode char U+01E6 (decimal 486)
defining Unicode char U+01E7 (decimal 487)
defining Unicode char U+01E8 (decimal 488)
defining Unicode char U+01E9 (decimal 489)
defining Unicode char U+01EA (decimal 490)
defining Unicode char U+01EB (decimal 491)
defining Unicode char U+01F0 (decimal 496)
defining Unicode char U+01F4 (decimal 500)
defining Unicode char U+01F5 (decimal 501)
defining Unicode char U+0218 (decimal 536)
defining Unicode char U+0219 (decimal 537)
defining Unicode char U+021A (decimal 538)
defining Unicode char U+021B (decimal 539)
defining Unicode char U+0232 (decimal 562)
defining Unicode char U+0233 (decimal 563)
defining Unicode char U+1E02 (decimal 7682)
defining Unicode char U+1E03 (decimal 7683)
defining Unicode char U+200C (decimal 8204)
defining Unicode char U+2010 (decimal 8208)
defining Unicode char U+2011 (decimal 8209)
defining Unicode char U+2012 (decimal 8210)
defining Unicode char U+2013 (decimal 8211)
defining Unicode char U+2014 (decimal 8212)
defining Unicode char U+2015 (decimal 8213)
defining Unicode char U+2018 (decimal 8216)
defining Unicode char U+2019 (decimal 8217)
defining Unicode char U+201A (decimal 8218)
defining Unicode char U+201C (decimal 8220)
defining Unicode char U+201D (decimal 8221)
defining Unicode char U+201E (decimal 8222)
defining Unicode char U+2030 (decimal 8240)
defining Unicode char U+2031 (decimal 8241)
defining Unicode char U+2039 (decimal 8249)
defining Unicode char U+203A (decimal 8250)
defining Unicode char U+2423 (decimal 9251)
defining Unicode char U+1E20 (decimal 7712)
defining Unicode char U+1E21 (decimal 7713)
)
Now handling font encoding OT1 ...
... processing UTF-8 mapping file for font encoding OT1

("path\MiKTeX 2.9\tex\latex\base\ot1en
c.dfu"
File: ot1enc.dfu 2017/01/28 v1.1t UTF-8 support for inputenc
defining Unicode char U+00A0 (decimal 160)
defining Unicode char U+00A1 (decimal 161)
defining Unicode char U+00A3 (decimal 163)
defining Unicode char U+00AD (decimal 173)
defining Unicode char U+00B8 (decimal 184)
defining Unicode char U+00BF (decimal 191)
defining Unicode char U+00C5 (decimal 197)
defining Unicode char U+00C6 (decimal 198)
defining Unicode char U+00D8 (decimal 216)
defining Unicode char U+00DF (decimal 223)
defining Unicode char U+00E6 (decimal 230)
defining Unicode char U+00EC (decimal 236)
defining Unicode char U+00ED (decimal 237)
defining Unicode char U+00EE (decimal 238)
defining Unicode char U+00EF (decimal 239)
defining Unicode char U+00F8 (decimal 248)
defining Unicode char U+0131 (decimal 305)
defining Unicode char U+0141 (decimal 321)
defining Unicode char U+0142 (decimal 322)
defining Unicode char U+0152 (decimal 338)
defining Unicode char U+0153 (decimal 339)
defining Unicode char U+0174 (decimal 372)
defining Unicode char U+0175 (decimal 373)
defining Unicode char U+0176 (decimal 374)
defining Unicode char U+0177 (decimal 375)
defining Unicode char U+0218 (decimal 536)
defining Unicode char U+0219 (decimal 537)
defining Unicode char U+021A (decimal 538)
defining Unicode char U+021B (decimal 539)
defining Unicode char U+2013 (decimal 8211)
defining Unicode char U+2014 (decimal 8212)
defining Unicode char U+2018 (decimal 8216)
defining Unicode char U+2019 (decimal 8217)
defining Unicode char U+201C (decimal 8220)
defining Unicode char U+201D (decimal 8221)
)
Now handling font encoding OMS ...
... processing UTF-8 mapping file for font encoding OMS

("path\MiKTeX 2.9\tex\latex\base\omsen
c.dfu"
File: omsenc.dfu 2017/01/28 v1.1t UTF-8 support for inputenc
defining Unicode char U+00A7 (decimal 167)
defining Unicode char U+00B6 (decimal 182)
defining Unicode char U+00B7 (decimal 183)
defining Unicode char U+2020 (decimal 8224)
defining Unicode char U+2021 (decimal 8225)
defining Unicode char U+2022 (decimal 8226)
)
Now handling font encoding OMX ...
... no UTF-8 mapping file for font encoding OMX
Now handling font encoding U ...
... no UTF-8 mapping file for font encoding U
defining Unicode char U+00A9 (decimal 169)
defining Unicode char U+00AA (decimal 170)
defining Unicode char U+00AE (decimal 174)
defining Unicode char U+00BA (decimal 186)
defining Unicode char U+02C6 (decimal 710)
defining Unicode char U+02DC (decimal 732)
defining Unicode char U+200C (decimal 8204)
defining Unicode char U+2026 (decimal 8230)
defining Unicode char U+2122 (decimal 8482)
defining Unicode char U+2423 (decimal 9251)
))

@yihui
Copy link
Member

yihui commented Mar 12, 2018

@Zanidean No worries. It will be faster to debug the issue if I can see it, but that is not required. From your reply above #1285 (comment), you actually seemed to have issues with pdflatex because the warning messaged indicated so:

running command '"pdflatex" -halt-on-error -interaction=batchmode "Test.tex"' had status 1 

but you just said "pdflatex doesn't give me any issues", and it was the first time you mentioned xelatex when you said "but when I call xelatex I seem to get similar issues" above, so I'm confused what exactly your issue was. Would you give me more consistent instructions on how to reproduce your issue?

@bdeepthi For the time being, please use all packages from CRAN, and don't install the Github versions yet. I'll let you know when you need to. The first step is as I said above:

If you install.packages(c('rmarkdown', 'tinytex')), you may add a code chunk with options(tinytex.verbose = TRUE), and see if it gives you more information about the error.

@Zanidean
Copy link

@yihui Sorry, I have two issues and didn't delineate between them.

The initial issue with pdflatex was also present for xelatex and lualatex. This was caused by updating rmarkdown to 1.9.3, where tinytex was required but I hadn't actually installed it. I had the package installed, but not tinytex itself. For now, I've solved this by downgrading rmarkdown to 1.8, before the dependency changed.

The second issue comes when I have both tinytex fully installed, and the latest rmarkdown. When I use pdflatex to render there is no issue, but when I use xelatex I get the same status 1 error.

@yihui
Copy link
Member

yihui commented Mar 12, 2018

@Zanidean Okay, let's focus on the second issue first. Again:

If you install.packages(c('rmarkdown', 'tinytex')), you may add a code chunk with options(tinytex.verbose = TRUE) in your R Markdown document, and see if it gives you more information about the error.

@Zanidean
Copy link

Zanidean commented Mar 12, 2018

Hm, okay.

So with the default markdown document I didn't run into that problem at all, so I think it's in how I'm using rmarkdown.

I still get it in my specific application though, where I'm using rmarkdown::render() to generate different .pdf's depending on certain input. The error doesn't occur on pdflatex.

Here is the error with xelatex. I changed the path to 'document'.

! Missing $ inserted.
<inserted text> 
                $
l.98 ..._files/figure-latex/unnamed-chunk-3-1.pdf}

Error: Failed to compile document.tex. See document.log for more info.

In addition: Warning messages:
...
1: running command '"xelatex" -halt-on-error -interaction=batchmode "document.tex"' had status 1 
2: running command '"xelatex" -halt-on-error -interaction=batchmode "document.tex"' had status 1 

When I change the output_file argument to something static like "test.pdf" it works, but when I use a variable assigned in the loop, it doesn't seem to work.

@Zanidean
Copy link

It looks like this has to do with spaces in the variable file name I was using.

These examples take place inside loops.

Here is the example of what I was doing that wasn't working:

  filename <- paste0("Reports/Documents/", program, ".pdf")
  rmarkdown::render(input = "Reports/Generator/Batch Template.Rmd",
         output_format = "pdf_document",
         output_file = filename)

And this is what made it work.

  filename <- paste0("Reports/Documents/", program, ".pdf") %>% 
    gsub(" ", "", .)
  print(filename)
  rmarkdown::render(input = "Reports/Generator/Batch Template.Rmd",
         output_format = "pdf_document",
         output_file = filename)

And again, only with xelatex and lualatex.

@Zanidean
Copy link

Did you also run tinytex::install_tinytex()?

@yihui
Copy link
Member

yihui commented Mar 16, 2018

@Zanidean Please note that rmarkdown 1.9 does not require the tinytex R package. Only the current dev version of rmarkdown requires it. Please also be aware of the fact that the tinytex R package does not require TinyTeX -- the custom LaTeX distribution I made: https://yihui.name/tinytex/r/ You can use any LaTeX distribution with tinytex (the R package). The only problem is that tinytex won't automatically install missing LaTeX packages for you if you don't use TinyTeX (TinyTeX refers to the custom LaTeX distribution; tinytex refers to the R package).

@ma1966 I have been desperately looking for someone who can reproduce this issue, since I cannot reproduce it by myself: https://community.rstudio.com/t/6155 So far I have heard both successes and failures, but haven't found a person who can screenshare with me, so I can debug it right on the problematic machine (@Zanidean cannot share due to work restrictions; @bdeepthi has not responded yet). You are the third person who has reported the issue, and I wonder if you are able to share your desktop screen with me.

@ma1966
Copy link

ma1966 commented Mar 16, 2018

I uninstalled MikTex. Then I installed tinytex::install_tinytex() and got an error:


> tinytex::install_tinytex()
trying URL 'http://mirror.ctan.org/systems/texlive/tlnet/install-tl.zip'
Content type 'application/zip' length 19439353 bytes (18.5 MB)
downloaded 7.9 MB

trying URL 'https://github.com/yihui/tinytex/raw/master/tools/pkgs-custom.txt'
Content type 'text/plain; charset=utf-8' length 267 bytes
downloaded 267 bytes

trying URL 'https://github.com/yihui/tinytex/raw/master/tools/texlive.profile'
Content type 'text/plain; charset=utf-8' length 295 bytes
downloaded 295 bytes

Error in setwd(dir) : character argument expected
In addition: Warning messages:
1: In download.file("http://mirror.ctan.org/systems/texlive/tlnet/install-tl.zip",  :
  downloaded length 8257536 != reported length 19439353
2: In unzip("install-tl.zip") : error 1 in extracting from zip file
Restart your R session and check if tinytex:::is_tinytex() is TRUE.

Then I restart rstudio and tinytex:::is_tinytex() was FALSE.

Yes I can share my screen. Are you available today?

@yihui
Copy link
Member

yihui commented Mar 16, 2018

@ma1966 Downloading the installer was not complete for some reason. You may try tinytex::install_tinytex() again, but please do me a favor not to do it before we chat, so that you can still reproduce the issue when I'm ready to investigate the issue on your computer. Thanks!

Edit: Oh I just saw you had uninstalled MiKTeX. Well, then please try tinytex::install_tinytex() again, and see if a different LaTeX distribution can fix your issue.

@ma1966
Copy link

ma1966 commented Mar 16, 2018

I uninstalled MikTex as recommended in your post and thought install_tinytex would install TeX live. I will wait for the chat. Thanks again.

@thiagocmattar
Copy link

thiagocmattar commented Mar 17, 2018

Hello everyone, I got this issue too.

I'm using MikTeX with rmarkdown. This issue is caused by the lack of some packages required to compile the pdf and rmarkdown apparently is not able to require the downloads.

So I opened a sweve file and wrote the same document and when I compiled, MikTeX asked to download some packages.

After that rmarkdown is working fine.

@jmschallock
Copy link

Hi everyone, just wanted to chime in to say I was struggling with this issue today too, and going back to rmarkdown 1.8 seems to have fixed it for me.

@yihui
Copy link
Member

yihui commented Mar 17, 2018

@thiagocmattar Interesting. I wonder if there is a chance that you still remember which missing packages MiKTeX installed?

@jmschallock Do you have a minimal reproducible example? Any spaces in your filenames?

@JasonCEC
Copy link

JasonCEC commented Mar 17, 2018

I am having this issue as well, MikTeX with rmarkdown (version 1.9) on Windows 8.1.
If I output a .tex file and compile it in MikTeX it works fine,
but fails with render(..)

My packages are:

  • \usepackage{multicol}
  • \usepackage{fancyhdr}

Edit: going back to rmarkdown version 1.8 did not fix the problem for me

@JasonCEC
Copy link

Edit 2:

I got the PDF rendering again by uninstalling MikTex 2.9.? and updating to the most recent version;
now with (rmarkdown 1.8 still installed) I can user render(...) and it all works.

@jmschallock
Copy link

@yihui I'm afraid I wasn't very diligent with documenting what I did, but I updated R and RStudio to the latest versions and reverted to rmarkdown 1.8. No spaces in any of my filenames.

(Also just want to say thank you for all your work building and supporting such awesome packages! You're kind of my hero :)

@yihui
Copy link
Member

yihui commented Mar 19, 2018

Hi everyone, I think I have finally figured out the root causes (one of which was rstudio/rstudio#2446) of the issues reported in this thread, and below are two possible solutions (with the latest version of rmarkdown on CRAN, i.e. v1.9):

If you have to use MiKTeX

You can install the devel version of the R package tinytex:

devtools::install_github('yihui/tinytex')

If you haven't installed MiKTeX, remember to check the option Yes in Install missing packages when installing it:

screen shot 2018-03-19 at 9 49 22 am

If you have already installed MiKTeX, go to the Start menu, find the menu "MiKTeX Console", and choose the option Always install missing packages on-the-fly:

screen shot 2018-03-19 at 10 05 06 am

If you don't have to use MiKTeX

Things will be a little easier. Uninstall MiKTeX if you have installed it (or temporarily rename its installation folder if you don't want to get rid of it completely), then in R:

install.packages('tinytex')
tinytex::install_tinytex()

This will install TinyTeX (a custom version of TeX Live), which can also build LaTeX documents to PDF on Windows. For more info, see https://yihui.name/tinytex/. Restart RStudio/R when the installation is done (it may take 3-5 minutes).

Please let me know if you still have trouble. Thanks!

@yihui
Copy link
Member

yihui commented Mar 26, 2018

Hi @bdeepthi @Zanidean @JasonCEC @jmschallock @thiagocmattar @ma1966, can any of you confirm if the CRAN version of rmarkdown work with the dev version of tinytex when rendering PDF?

install.packages('rmarkdown')
devtools::install_github('yihui/tinytex')

Since I haven't heard back from any of you, I feel nervous about making a new release of tinytex to CRAN. R package authors are allowed to make at most six releases of a package in six months, and I have already used four chances since last December, so I have to be very cautious now. Thanks!

@Zanidean
Copy link

@yihui

Working for me.

@boshek
Copy link

boshek commented Mar 28, 2018

@yihui

For what it's worth it works for me as well.

Session Info
Session info ----------------------------------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.4 (2018-03-15)
 system   x86_64, mingw32             
 ui       RStudio (1.1.442)           
 language (EN)                        
 collate  English_Canada.1252         
 tz       America/Los_Angeles         
 date     2018-03-28                  

Packages --------------------------------------------------------------------------------------------------------------------------------------------------------
 package   * version    date       source                        
 backports   1.1.2      2017-12-13 CRAN (R 3.4.3)                
 base      * 3.4.4      2018-03-15 local                         
 compiler    3.4.4      2018-03-15 local                         
 datasets  * 3.4.4      2018-03-15 local                         
 devtools  * 1.13.5     2018-02-18 CRAN (R 3.4.3)                
 digest      0.6.15     2018-01-28 CRAN (R 3.4.3)                
 evaluate    0.10.1     2017-06-24 CRAN (R 3.4.3)                
 graphics  * 3.4.4      2018-03-15 local                         
 grDevices * 3.4.4      2018-03-15 local                         
 htmltools   0.3.6      2017-04-28 CRAN (R 3.4.3)                
 knitr       1.20       2018-02-20 CRAN (R 3.4.3)                
 lobstr    * 0.0.0.9000 2018-03-14 Github (r-lib/lobstr@75254f1) 
 magrittr    1.5        2014-11-22 CRAN (R 3.4.3)                
 memoise     1.1.0      2017-04-21 CRAN (R 3.4.0)                
 methods   * 3.4.4      2018-03-15 local                         
 R6          2.2.2      2017-06-17 CRAN (R 3.4.3)                
 Rcpp        0.12.16    2018-03-13 CRAN (R 3.4.4)                
 rlang       0.2.0      2018-02-20 CRAN (R 3.4.3)                
 rmarkdown * 1.9        2018-03-01 CRAN (R 3.4.4)                
 rprojroot   1.3-2      2018-01-03 CRAN (R 3.4.3)                
 stats     * 3.4.4      2018-03-15 local                         
 stringi     1.1.7      2018-03-12 CRAN (R 3.4.4)                
 stringr     1.3.0      2018-02-19 CRAN (R 3.4.3)                
 testthat  * 2.0.0      2017-12-13 CRAN (R 3.4.3)                
 tinytex   * 0.4.2      2018-03-28 Github (yihui/tinytex@c7d62e1)
 tools       3.4.4      2018-03-15 local                         
 usethis   * 1.3.0      2018-02-24 CRAN (R 3.4.3)                
 utils     * 3.4.4      2018-03-15 local                         
 withr       2.1.2      2018-03-15 CRAN (R 3.4.4)                
 yaml        2.1.18     2018-03-08 CRAN (R 3.4.3) 03-08 CRAN (R 3.4.3)    

@yihui
Copy link
Member

yihui commented Mar 28, 2018

Excellent! Thanks @Zanidean and @boshek!

@yihui
Copy link
Member

yihui commented Apr 16, 2018

FYI I have submitted the new version of tinytex (0.5) to CRAN: https://cran.r-project.org/package=tinytex Hopefully in about two days, update.packages() will solve all problems.

@yihui yihui added this to the v1.10 milestone Apr 18, 2018
@mbedward
Copy link

Joining in late but just in case this is helpful to anyone. On my windows 10 system tinytex::install was failing some way into the process. It turned out to be caused by wget not being installed. After installing it everything worked. Perhaps the batch file could check for wget and issue a message if not found?

My thanks and respect for all the fabulous work.

@yihui
Copy link
Member

yihui commented May 25, 2018

@bdeepthi Please see rstudio/tinytex#49 (the short answer is you will have to wait for at least two days before you can tinytex::install_tinytex()).

@ga122493
Copy link

ga122493 commented Jun 13, 2018

@mbedward Sorry this is a silly question, how did you install wget -- was this for R/R Studio?

@yihui The fix works for regular pdf knitting. However, for pdf beamer, I uninstalled MikTex and installed tinytex on my window machine -- the problem is still there... The error is

Output created: Lecture3_slides_060418.pdf
Error in tools::file_path_as_absolute(output_file) :
file 'Lecture3_slides_060418.pdf' does not exist
Calls: < Anonymous > -> < Anonymous >
Execution halted

Looking through the log file and this has an error message, not sure if it helps...

(c:/Users/tyankama/AppData/Roaming/TinyTeX/texmf-dist/tex/generic/oberdiek/infw
arerr.sty
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO))

I also experience this on a Mac computer, which I already posted an issue here #1360

Any suggestions? Thank you!!

@mbedward
Copy link

@ga122493 I installed wget on my system (Windows 10), using the version from gnuwin32 on sourceforge. But I think rstudio/tinytex#49 suggests that the need for wget was due to a problem in the tinytex install script and it should no longer be required.

@yihui
Copy link
Member

yihui commented Jun 13, 2018

@mbedward You are right. Just forget about wget. It is irrelevant now.

@ga122493 The message you posted from the LaTeX log file was not an error message. Error messages in LaTeX typically start with !. I have seen your #1360. Please hold on, and give me a little more time to breathe :)

To all: I'm going to lock this issue, since the original problem has been solved. The solution was install.packages('tinytex'). If anyone runs into new issues, please file new issues separately. Thanks!

@rstudio rstudio locked as resolved and limited conversation to collaborators Jun 13, 2018
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