[Env: Windows 10, R version 4.1.3, RStudio latest, MikTeX 2.9]
On all my computers I am unable to build PDF manuals for packages, typically using devtools::build_manual() which used to work when I last tried quite a while ago.
It is maddening, because there is no useful information in the error message:
> devtools::build_manual()
Error in `value[[3L]]()`:
! Failed to build manual
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_trace()
<error/rlang_error>
Error in `value[[3L]]()`:
! Failed to build manual
---
Backtrace:
x
1. \-devtools::build_manual()
2. \-base::tryCatch(...)
3. \-base (local) tryCatchList(expr, classes, parentenv, handlers)
4. \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. \-value[[3L]](cond)
6. \-cli::cli_abort("Failed to build manual")
7. \-rlang::abort(message, ..., call = call, use_cli_format = TRUE)
I happen to have a function, myutil::man() in a local package, which gives a bit more information, pointing to a missing \ifluatex command:
> myutil::man("heplots")
Hmm ... looks like a package
Converting parsed Rd's to LaTeX .....
Creating pdf output from LaTeX ...
Warning in system(paste(shQuote(texi2dvi), if (quiet) "--quiet" else "", :
running command '"C:\PROGRA~1\MiKTeX\miktex\bin\x64\texify.exe" --pdf "Rd2.tex" --max-iterations=20 -I "C:/R/R-41~1.3/share/texmf/tex/latex" -I "C:/R/R-41~1.3/share/texmf/bibtex/bst"' had status 1
Error : running 'texi2dvi' on 'Rd2.tex' failed
LaTeX errors:
! Undefined control sequence.
l.188 \ifluatex
?
! Emergency stop.
! Emergency stop.
l.188
End of file on the terminal!
! ==> Fatal error occurred, no output PDF file produced!
Yet, I do have ifluatex.sty installed in MikTeX:
$ kpsewhich ifluatex.sty
C:/Program Files/MiKTeX/tex/generic/iftex/ifluatex.sty
I get the same results if I try this in the R GUI console.
How can I debug or solve this?
Edit:
In response to a question, I ran R CMD Rd2pdf . in the package directory. After getting in the console,
Hmm ... looks like a package
Converting parsed Rd's to LaTeX .....
Creating pdf output from LaTeX ...
it never completed. When I examined the .log file, I was surprised to see LaTeX War at the end:
(C:\Program Files\MiKTeX\tex/generic/ltxcmds\ltxcmds.sty
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
)
(C:/Dropbox/localtexmf\tex/latex/iftex\iftex.sty
Package: iftex 2013/04/04 v0.2 Provides if(tex) conditional for PDFTeX, XeTeX,
and LuaTeX
)
LaTeX War
I am more and more stylied.