revert: remove beamer resizebox filter, keep tabularx skip for beamer
Adjustbox in presentation.org template handles beamer tables. Resizebox filter was conflicting with it.
This commit is contained in:
25
config.el
25
config.el
@@ -379,7 +379,7 @@ Bound to cmd+v in org-mode and markdown-mode."
|
|||||||
|
|
||||||
(defun my/org-latex-fix-tabularx (table backend _info)
|
(defun my/org-latex-fix-tabularx (table backend _info)
|
||||||
"Convert tabular/tabularx → tabularx{\\linewidth}{lYYY} in LaTeX output.
|
"Convert tabular/tabularx → tabularx{\\linewidth}{lYYY} in LaTeX output.
|
||||||
Skip for beamer exports — beamer uses adjustbox wrapper on plain tabular instead."
|
Skip for beamer exports — beamer uses adjustbox on plain tabular."
|
||||||
(when (and (stringp table)
|
(when (and (stringp table)
|
||||||
(not (org-export-derived-backend-p backend 'beamer)))
|
(not (org-export-derived-backend-p backend 'beamer)))
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
@@ -412,29 +412,6 @@ Skip for beamer exports — beamer uses adjustbox wrapper on plain tabular inste
|
|||||||
|
|
||||||
(add-hook 'org-export-before-processing-hook #'my/org-ensure-tabularx-filter)
|
(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)
|
;; Optional: enable booktabs style (horizontal rules in tables)
|
||||||
;; (setq org-latex-tables-booktabs t)
|
;; (setq org-latex-tables-booktabs t)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user