Forum: support


RE: Latex problem [ Reply ] By: Achim Zeileis on 2024-12-07 20:22 | [forum:50034] |
👍 |
RE: Latex problem [ Reply ] By: Francisco Goerlich on 2024-12-07 19:07 | [forum:50033] |
I solved the problem re-installing tinytex. Thanks for your time and for your advice Achim. |
RE: Latex problem [ Reply ] By: Achim Zeileis on 2024-12-07 16:36 | [forum:50032] |
OK, maybe tools::texi2dvi fails because of the space, that's possible. In any case, you switch between the two interfaces by using options(exams_tex = "...") setting it either to "tools" or to "tinytex". If the option is not set the default is to use "tinytex" in case it is installed (and "tools" otherwise). |
RE: Latex problem [ Reply ] By: Francisco Goerlich on 2024-12-07 10:58 | [forum:50031] |
Many Thanks for the advice Achim, This tools::texi2dvi("hello.tex", pdf = TRUE) fails Error en tools::texi2dvi("hello.tex", pdf = TRUE): unable to run pdflatex on 'hello.tex' LaTeX errors: !pdfTeX error: pdflatex.exe (file c:/Users/Francisco Goerlich/AppData/Roaming/TinyTeX/texmf-var/fonts/map/pdftex/updmap/pdftex.map): fflush() failed (Bad file descriptor) ==> Fatal error occurred, no output PDF file produced! Blank space in Users folder? The second one, tinytex::latexmk("hello.tex"), works and generates [1] "hello.pdf" Thanks a lot. The curious think is that this worked perfectly last week, and that only give me an error if I attach a datafile to the pdf. Thanks a lot! |
RE: Latex problem [ Reply ] By: Achim Zeileis on 2024-12-07 00:44 | [forum:50030] |
Francisco, first try to find out whether there is anything particular about the way exams2pdf() calls LaTeX or whether this problem occurs generally. As a minimal example, you could try to write a simple hello.tex file: tex <- c("\\documentclass[a4paper]{article}", "\\begin{document}", "Hello World!", "\\end{document}") writeLines(tex, "hello.tex") And then you could try to compile it using the tools package: tools::texi2dvi("hello.tex", pdf = TRUE) Or alternatively via tinytex: tinytex::latexmk("hello.tex") If these fail, then you need to investigate your LaTeX setup because then there would be a general problem. If they work, then maybe the problems come from using certain LaTeX packages. Or maybe from compiling it in a certain directory on your system? |
RE: Latex problem [ Reply ] By: Francisco Goerlich on 2024-12-06 23:11 | [forum:50029] |
With options(exams_tex = "tinytex"), I get the same error, with options(exams_tex = "tools") I get Error en texi2dvi(out_tex[j], pdf = TRUE, clean = TRUE, quiet = quiet): unable to run pdflatex on 'plain1.tex' LaTeX errors: !pdfTeX error: pdflatex.exe (file c:/Users/Francisco Goerlich/AppData/Roaming/TinyTeX/texmf-var/fonts/map/pdftex/updmap/pdftex.map): fflush() failed (Bad file descriptor) ==> Fatal error occurred, no output PDF file produced! I will investigate the Latex setup. Many thanks anyway |
RE: Latex problem [ Reply ] By: Achim Zeileis on 2024-12-05 17:55 | [forum:50028] |
For me exams2pdf() works without problem. Both when going via the system LaTeX installation after options(exams_tex = "tinytex") and also when going via tinytex after options(exams_tex = "tools") So maybe something changed in your LaTeX setup? For debugging you can try running exams2pdf(..., texdir = "path/to/folder") where path/to/folder should be an empty directory where the LaTeX files can be put. Then you can inspect the files there and also try to run pdflatex manually. |
Latex problem [ Reply ] By: Francisco Goerlich on 2024-12-05 17:17 | [forum:50027]![]() |
Hi, The attached file, 080321.Rmd, worked perfectly last week, you can see it in the pdf file, exercise 35, page 17, but now I get this error: ! LaTeX Error: Can be used only in preamble. Error: LaTeX failed to compile plain1.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See plain1.log for more info. All \usepackage{...} commands, as well as \documentclass[...]{...}, are written before \begin{document} in templates. Any idea? Thanks a lot. |