Hi, The attached patch to main and adds preliminary support for ltx-talk.
Tests and feedback appretiated ;-) Best, /PA ox-latex maintainer -- Fragen sind nicht da, um beantwortet zu werden, Fragen sind da um gestellt zu werden Georg Kreisler "Sagen's Paradeiser" (ORF: Als Radiohören gefährlich war) => write BE! Year 2 of the New Koprocracy
From 97acbdcdb9b92fec442051b861dc7d8012d30444 Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda" <[email protected]> Date: Tue, 23 Jun 2026 12:53:43 +0200 Subject: [PATCH] ox-beamer: add support preliminary for =ltx-talk= * doc/org-manual.org: Document the use of the =ltx-talk= class. * lisp/ox-beamer.el (org-beamer--format-frame): Don't include label= for ltx-talk; emit the frame title explicitly with \frametitle{xxx}. (org-beamer-template): Don't emit theme related code for ltx-talk. * testing/lisp/test-ox-beamer.el (test-ox-beamer/use-ltx-talk-class): New test for the preliminary ltx-talk support. --- doc/org-manual.org | 23 ++++++++++++++-- lisp/ox-beamer.el | 48 ++++++++++++++++++++-------------- testing/lisp/test-ox-beamer.el | 28 ++++++++++++++++++++ 3 files changed, 77 insertions(+), 22 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 9201a341a..562d2655b 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -13104,11 +13104,16 @@ It's just a jump to the left... Org uses Beamer export to convert an Org file tree structure into high-quality interactive slides for presentations. Beamer is a LaTeX document class for creating presentations in PDF, HTML, and other -popular display formats. +popular display formats. Additionally, the Beamer exporter provides +/preliminary/ support for =ltx-talk=, which produces accesible +presentation in PDF using the *LuaLaTeX* compiler. We strongly recommend familiarizing yourself with Beamer terminology before reading the rest of this chapter. See <https://en.wikipedia.org/wiki/Beamer_(LaTeX)> and references therein. +If you plan to use =ltx-talk=, consult the +[[https://github.com/josephwright/ltx-talk/tree/main][=ltx-talk= +repository]] for examples. *** Beamer export commands :PROPERTIES: @@ -13147,7 +13152,8 @@ before reading the rest of this chapter. See Beamer export backend has several additional keywords for customizing Beamer output. These keywords work similar to the general options -settings (see [[*Export Settings]]). +settings (see [[*Export Settings]]). *Note:* =BEAMER_...= keywords do not +apply to =ltx-talk= and will be ignored. - =BEAMER_THEME= :: @@ -13206,6 +13212,18 @@ settings (see [[*Export Settings]]). ~org-latex-title-command~ to configure typesetting of subtitle as part of front matter. +- =LATEX_CLASS= :: + + #+cindex: @samp{SUBTITLE}, keyword + The LaTeX class to use. Implicitly set to =beamer=. Set it + explicitly to =ltx-talk= to use this class, and remove any class + options: + + #+BEGIN_SRC org +,#+LATEX_CLASS: ltx-talk +,#+LATEX_CLASS_OPTIONS: + #+END_SRC + *** Frames and Blocks in Beamer :PROPERTIES: :DESCRIPTION: For composing Beamer slides. @@ -13280,6 +13298,7 @@ should in principle be exportable as a Beamer presentation. headlines. To manually adjust them for any unique configurations needs, use the =BEAMER_ENV= property. + *** Beamer specific syntax :PROPERTIES: :DESCRIPTION: For using in Org documents. diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el index 525eddcc5..d6a017170 100644 --- a/lisp/ox-beamer.el +++ b/lisp/ox-beamer.el @@ -42,7 +42,10 @@ (unless (assoc "beamer" org-latex-classes) "\\documentclass[presentation]{beamer}" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))) + ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))) + (add-to-list 'org-latex-classes + '("ltx-talk" + "\\DocumentMetadata{tagging = on}\n\\documentclass{ltx-talk}"))) @@ -484,7 +487,9 @@ (defun org-beamer--format-frame (headline contents info) ;; the user specified one. Also refrain from ;; labeling `allowframebreaks' frames; this is not ;; allowed by Beamer. + ;; no labels for ltx-talk (and (not (member "allowframebreaks" options)) + (not (equal "ltx-talk" (plist-get info :latex-class))) (not (cl-some (lambda (s) (string-match-p "^label=" s)) options)) (list @@ -501,7 +506,9 @@ (defun org-beamer--format-frame (headline contents info) 'option)) ;; Title. (let ((env (org-element-property :BEAMER_ENV headline))) - (format "{%s}" + ;; Separate frametitle doesn't hurt beamer + ;; but ltx-talk will not work w/o it. + (format "\n\\frametitle{%s}" (if (and env (equal (downcase env) "fullframe")) "" (org-export-data (org-element-property :title headline) info)))) @@ -882,24 +889,25 @@ (defun org-beamer-template (contents info) (format "\\newenvironment<>{%s}[1][]{\\begin{frame}#2[environment=%1$s,#1]}{\\end{frame}}\n" org-beamer-frame-environment)) ;; Insert themes. - (let ((format-theme - (lambda (prop command) - (let ((theme (plist-get info prop))) - (when theme - (concat command - (if (not (string-match "\\[.*\\]" theme)) - (format "{%s}\n" theme) - (format "%s{%s}\n" - (match-string 0 theme) - (org-trim - (replace-match "" nil nil theme)))))))))) - (mapconcat (lambda (args) (apply format-theme args)) - '((:beamer-theme "\\usetheme") - (:beamer-color-theme "\\usecolortheme") - (:beamer-font-theme "\\usefonttheme") - (:beamer-inner-theme "\\useinnertheme") - (:beamer-outer-theme "\\useoutertheme")) - "")) + (unless (equal (plist-get info :latex-class) "ltx-talk") + (let ((format-theme + (lambda (prop command) + (let ((theme (plist-get info prop))) + (when theme + (concat command + (if (not (string-match "\\[.*\\]" theme)) + (format "{%s}\n" theme) + (format "%s{%s}\n" + (match-string 0 theme) + (org-trim + (replace-match "" nil nil theme)))))))))) + (mapconcat (lambda (args) (apply format-theme args)) + '((:beamer-theme "\\usetheme") + (:beamer-color-theme "\\usecolortheme") + (:beamer-font-theme "\\usefonttheme") + (:beamer-inner-theme "\\useinnertheme") + (:beamer-outer-theme "\\useoutertheme")) + ""))) ;; Possibly limit depth for headline numbering. (let ((sec-num (plist-get info :section-numbers))) (when (integerp sec-num) diff --git a/testing/lisp/test-ox-beamer.el b/testing/lisp/test-ox-beamer.el index 482f22c8f..1f880b407 100644 --- a/testing/lisp/test-ox-beamer.el +++ b/testing/lisp/test-ox-beamer.el @@ -111,5 +111,33 @@ (ert-deftest test-ox-beamer/orgframe-in-one-example () (should (search-forward (concat "\\end{frame}") nil t)) (should (search-forward (concat "\\end{" org-beamer-frame-environment "}")))))) +(ert-deftest test-ox-beamer/use-ltx-talk-class () + "Test that `org-beamer-frame-environment' is defined and used." + (let ((org-latex-compiler "lualatex") + (org-latex-hyperref-template nil) + (org-latex-packages-alist nil) + (org-latex-default-packages-alist nil)) + (org-test-with-exported-text + 'beamer + "#+STARTUP: beamer +#+OPTIONS: toc:nil +#+LATEX_CLASS: ltx-talk +#+LATEX_CLASS_OPTIONS: +#+TITLE: Testing =ltx-talk= +#+BEAMER_THEME: +* A frame +- First +- Second +- Third + +# Local variables: +# End: +" + ;; (message "--> \n%s" (buffer-string)) + (goto-char (point-min)) + (save-excursion (should-not (search-forward "\\usetheme{" nil t))) + (save-excursion (should-not (search-forward "[label=]" nil t))) + (save-excursion (should (search-forward "\\frametitle{A frame}" nil t)))))) + (provide 'test-ox-beamer) ;;; test-ox-beamer.el ends here -- 2.43.0
