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

beamer_presentation does not resolve latex_dependencies #2478

Closed
cderv opened this issue Apr 21, 2023 · 3 comments · Fixed by #2558
Closed

beamer_presentation does not resolve latex_dependencies #2478

cderv opened this issue Apr 21, 2023 · 3 comments · Fixed by #2558
Assignees
Labels
bug an unexpected problem or unintended behavior next to consider for next release

Comments

@cderv
Copy link
Collaborator

cderv commented Apr 21, 2023

---
output: 
  pdf_document:
    keep_tex: true
    keep_md: true
---

```{r}
knitr::asis_output("", meta = list(rmarkdown::latex_dependency("longtable")))
```

\begin{longtable}{r|r}
\hline
speed & dist\\
\hline
4 & 2\\
\end{longtable}

This will throw:

output file: test.knit.md

! LaTeX Error: Environment longtable undefined.

pdf_document does not. This is because we don't resolve depdencies in beamer_presentation format.

extra_dependencies is not even allowed argument

Initially from https://community.rstudio.com/t/apparent-bug-in-rmarkdown-to-beamer-using-gt/164778

@cderv cderv added bug an unexpected problem or unintended behavior next to consider for next release labels Apr 21, 2023
@setgree
Copy link

setgree commented Jun 7, 2024

Hi there, I am weighing in to say that I am encountering this issue as well. I am working on this presentation: https://github.com/setgree/vegan-meta/blob/main/vegan-meta-presentation.Rmd

and getting a million errors that all basically look like

This is LuaHBTeX, Version 1.18.0 (TeX Live 2024) 
 restricted system commands enabled.
tlmgr search --file --global '/bkm-pdftex.def'
Trying to automatically install missing LaTeX packages...
tlmgr install bookmark
tlmgr: package repository https://ctan.math.illinois.edu/systems/texlive/tlnet (verified)
tlmgr install: package already present: bookmark
This is LuaHBTeX, Version 1.18.0 (TeX Live 2024) 
 restricted system commands enabled.
tlmgr search --file --global '/bkm-pdftex.def'
! Undefined control sequence.
\@currentHref ->table.\theHtable 

Error: LaTeX failed to compile vegan-meta-presentation.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See vegan-meta-presentation.log for more info.
Execution halted

I commented something to this effect here as well before I found this issue

@cderv cderv assigned cderv and atusy and unassigned cderv Jun 7, 2024
@cderv
Copy link
Collaborator Author

cderv commented Jun 12, 2024

@atusy would you like to give it try ?

pdf_document does handle extra dependencies

rmarkdown/R/pdf_document.R

Lines 181 to 185 in e1c93a9

if (length(extra_dependencies) || has_latex_dependencies(knit_meta)) {
extra_dependencies <- latex_dependencies(extra_dependencies)
all_dependencies <- append(extra_dependencies, flatten_latex_dependencies(knit_meta))
args <- c(args, append_in_header(latex_dependencies_as_string(all_dependencies)))
}

but it seems beamer_presentation does not. I believe the same can be done so that latex_dependencies from any R package are correctly retrieved and inserted.

@atusy
Copy link
Collaborator

atusy commented Jun 12, 2024

@cderv Sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior next to consider for next release
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants