Markdown tables in beamer_presentation

I have been making beamer_presentation slides from RMarkdown for my classes. They work really well for my purposes, except for the fact that I can't figure out how to generate a table that works. An RMarkdown document with the following content:

---
title: "Table test"
output: beamer_presentation
---

## Table

First Header  | Second Header
------------- | -------------
Content Cell  | Content Cell
Content Cell  | Content Cell

Returns the following error,

! Undefined control sequence.
<argument> \@@magyar@captionfix 

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

It does work to make LaTeX tables,

\begin{table}[htbp]
\begin{tabular}{l|l}
First header & second header \\
\hline
Content cell & content cell \\
Content cell & content cell 
\end{tabular}
\end{table}

but I don't understand why the Markdown approach doesn't work. Thoughts?

@yihui, can you comment? I'd guess this is something I don't understand about the RMarkdown -> Pandoc -> PDF process, and probably whatever is going on here with tables is a symptom of a more general problem. Is it the |s?

I don't get an error when I compile your example document. Are you using older installations of Latex or any Latex packages? What you're experiencing might be related to this issue.

The option "Use tinytex when compiling .tex files" should be irrelevant here (tinytex is always used for R Markdown documents).

You are probably using MacTeX right now. You may try TinyTeX instead:

tinytex::install_tinytex()

This has solved too many mysterious LaTeX issues in the past. See if you also have some luck with it.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

I cannot reproduce the error, either. Could you provide xfun::session_info('rmarkdown')?

It might have something to do with Pandoc 2.3.1. Could you try the RStudio Preview version? It has a higher version of Pandoc.

> xfun::session_info('rmarkdown')
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6, RStudio 1.2.5042

Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8

Package version:
  base64enc_0.1.3 digest_0.6.25   evaluate_0.14   glue_1.4.0     
  graphics_4.0.0  grDevices_4.0.0 highr_0.8       htmltools_0.4.0
  jsonlite_1.6.1  knitr_1.28      magrittr_1.5    markdown_1.1   
  methods_4.0.0   mime_0.9        Rcpp_1.0.4.6    rlang_0.4.6    
  rmarkdown_2.1   stats_4.0.0     stringi_1.4.6   stringr_1.4.0  
  tinytex_0.22    tools_4.0.0     utils_4.0.0     xfun_0.13      
  yaml_2.2.1     

Pandoc version: 2.3.1

I updated R and RStudio while trying to debug this myself, so I think I have up-to-date packages. And I'm pretty sure I ran through all the suggestions on https://yihui.org/tinytex/r/#debugging

Still getting the error,

> xfun::session_info('rmarkdown')
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6, RStudio 1.3.957

Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8

Package version:
  base64enc_0.1.3 digest_0.6.25   evaluate_0.14   glue_1.4.0     
  graphics_4.0.0  grDevices_4.0.0 highr_0.8       htmltools_0.4.0
  jsonlite_1.6.1  knitr_1.28      magrittr_1.5    markdown_1.1   
  methods_4.0.0   mime_0.9        Rcpp_1.0.4.6    rlang_0.4.6    
  rmarkdown_2.1   stats_4.0.0     stringi_1.4.6   stringr_1.4.0  
  tinytex_0.22    tools_4.0.0     utils_4.0.0     xfun_0.13      
  yaml_2.2.1     

Pandoc version: 2.7.3

My best guess is that I'm actually using a different TeX distribution (I do have whatever comes with TeXShop on my Mac, as well). I just went into my RStudio preferences and "Use tinytex when compiling .tex files" wasn't checked, but I fixed that, restarted RStudio, and am still having the error.