Closed bcm0 closed 3 years ago
Hi, thanks for the report.
As this question concerns beamer_presentation
, I moved it in rmarkdown repo.
I don't think this is a rmarkdown issue. Under the hook, Pandoc is used to create the .tex
file for beamer slides. I tried this
❯ pandoc -t beamer -s -o default.tex
# header
```{.cpp .numberLines}
int main
^Z
and
````powershell
❯ pandoc -t beamer -Vtheme=AnnArbor -s -o AnnArbor.tex
# header
```{.cpp .numberLines}
int main
^Z
to compare the file created. The only difference is the theme as expected
````diff
❯ git diff .\default.tex .\AnnArbor.tex
diff --git "a/.\\default.tex" "b/.\\AnnArbor.tex"
index 81f2ed3..b81948b 100644
--- "a/.\\default.tex"
+++ "b/.\\AnnArbor.tex"
@@ -58,6 +58,7 @@
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
+\usetheme[]{AnnArbor}
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
So I asked myself if this was supposed to work by using only LaTeX. For code block, the fancyvrb CTAN package is used, with a Verbatim
environment, renamed Highlighting
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
So I tried to use simple tex file to compile with latexmk
\documentclass{beamer}
\usepackage{fancyvrb}
\begin{document}
\begin{Verbatim}[numbers=left]
First verbatim line.
Second verbatim line.
\end{Verbatim}
Normal text
\end{document}
and it ouptuts as expected
Then I added the theme
\documentclass{beamer}
\usepackage{fancyvrb}
\usetheme[]{AnnArbor}
\begin{document}
\begin{Verbatim}[numbers=left]
First verbatim line.
Second verbatim line.
\end{Verbatim}
Normal text
\end{document}
and this has no number before line
So it seems that line numbers is not supported in AnnArbor theme.
Do you happen to know of a .tex
example where it works ? This would help understand what missing.
Otherwise, I believed this is not supported by the theme, so it won't be possible from rmarkdown directly.
Hope it helps
I have no working .tex
example and the only difference is the \usetheme
line.
It works on some themes only. I tried the "Berkeley" theme and the line numbers are partially hidden by the theme. Probably beamer's theme definition files don't account enough space. Thank you for checking it.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
Checklist
xfun::session_info('bookdown')
in your issue?remotes::install_github("rstudio/bookdown")
?I use
bookdown::render_book('code.Rmd')
This works: