beamer: resizebox table filter + org-beamer-frame-default-options

- org-beamer-frame-default-options = allowframebreaks (proper way,
  not renewenvironment frame hack which caused empty slides)
- my/org-beamer-resizebox-tables: export filter wraps tabular in
  resizebox{textwidth}{!} for beamer backend only
- document.org export unchanged (still uses tabularx filter)
This commit is contained in:
2026-02-25 11:20:45 +01:00
parent 905341dd90
commit d75b9c1b87

View File

@@ -412,6 +412,29 @@ Skip for beamer exports — beamer uses adjustbox wrapper on plain tabular inste
(add-hook 'org-export-before-processing-hook #'my/org-ensure-tabularx-filter)
;; Beamer: tables → resizebox (scale to slide width), allowframebreaks globally
(with-eval-after-load 'ox-beamer
(setq org-beamer-frame-default-options "allowframebreaks"))
(defun my/org-beamer-resizebox-tables (table backend _info)
"Wrap tabular environments in \\resizebox for beamer exports."
(when (and (stringp table)
(org-export-derived-backend-p backend 'beamer))
(with-temp-buffer
(insert table)
(goto-char (point-min))
(when (re-search-forward "\\\\begin{tabular}" nil t)
(goto-char (match-beginning 0))
(insert "\\resizebox{\\textwidth}{!}{%\n")
(goto-char (point-max))
(when (search-backward "\\end{tabular}" nil t)
(goto-char (match-end 0))
(insert "\n}")))
(buffer-string))))
(with-eval-after-load 'ox-beamer
(add-to-list 'org-export-filter-table-functions #'my/org-beamer-resizebox-tables))
;; Optional: enable booktabs style (horizontal rules in tables)
;; (setq org-latex-tables-booktabs t)