Hi,

Attached is the patch adding support for ltx-talk in ox-beamer.
Splitting it in three files addressing the different aspects of ltx-talk is
intentional.

0001 Provides the basic differentiation between beamer and ltx-talk.
0002 Adds support for sectioning.
0003 Addresses frames with verbatim contents.

Thanks uncountable to Roger for his patience and support testing.

Review and possible push requested.
/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 1/3] 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

From 1d46ad5ed6da88e7648a7c07e2e43760b5dae6f0 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <[email protected]>
Date: Wed, 24 Jun 2026 08:45:53 +0200
Subject: [PATCH 2/3] ox-beamer: Sectioning for ltx-latex

* doc/org-manual.org: New section for ltx-talk under the beamer exporter
chapter.
* lisp/ox-beamer.el: Add sectioning to init code and remove
DocumentMetadata.
(org-beamer-frame-level): Add safe predicate.
(org-beamer-template):  Warn and remove latex-class-options.
* testing/lisp/test-ox-beamer.el (test-ox-beamer/ltx-talk-class):
Renamed from (test-ox-beamer/use-ltx-talk-class)  and add more options
to test document.
(test-ox-beamer/ltx-talk-multi-line-metadata):  New test with multi-line
* metadata.
---
 doc/org-manual.org             | 32 ++++++++++++++---
 lisp/ox-beamer.el              | 17 ++++++---
 testing/lisp/test-ox-beamer.el | 66 +++++++++++++++++++++++++++++-----
 3 files changed, 97 insertions(+), 18 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 562d2655b..dd7efe0b1 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13152,8 +13152,8 @@ repository]] for examples.
 
 Beamer export backend has several additional keywords for customizing
 Beamer output.  These keywords work similar to the general options
-settings (see [[*Export Settings]]). *Note:* =BEAMER_...= keywords do not
-apply to =ltx-talk= and will be ignored.
+settings (see [[*Export Settings]]). *Note:* =BEAMER_..._THEME=
+keywords do not apply to =ltx-talk= and will be ignored.
 
 - =BEAMER_THEME= ::
 
@@ -13216,12 +13216,10 @@ apply to =ltx-talk= and will be ignored.
 
   #+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:
+  explicitly to =ltx-talk= to use this class:
 
   #+BEGIN_SRC org
 ,#+LATEX_CLASS: ltx-talk
-,#+LATEX_CLASS_OPTIONS:
   #+END_SRC
 
 *** Frames and Blocks in Beamer
@@ -13422,6 +13420,30 @@ Here is an example of an Org document ready for Beamer export.
     Please test this stuff!
 #+end_example
 
+*** Presentations with =ltx-talk=
+
+=ltx-talk= is an alternative to the =beamer= class. It depends on
+LuaLaTeX and produces tagged PDF files with enhanced
+accessibility. The Beamer exporter can produce presentations for this
+class, too. To activate it, make sure that you have, at least, the
+following options in the Org header:
+
+#+begin_example
+#+STARTUP: beamer
+#+LATEX_COMPILER: lualatex
+#+LATEX_CLASS: ltx-talk
+#+LATEX_CLASS_PRE: \\DocumentMetadata{tagging = on}
+#+OPTIONS: H:2
+#+end_example
+
+Observations:
+- Setting the header levels to =H:2= in the options will create the
+  sectioning in your presentation. Setting =H:1= will suppress
+  sectioning.
+- If you use a longer prelude before ~\documentclass{ltx-talk}~, feel
+  free to add as many ~#+LATEX_CLASS_PRE:~ lines as needed.
+- ~#+LATEX_CLASS_OPTIONS:~ will be removed and you will be warned.
+
 ** HTML Export
 :PROPERTIES:
 :DESCRIPTION: Exporting to HTML.
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index d6a017170..09e60c29a 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -45,8 +45,8 @@ (unless (assoc "beamer" org-latex-classes)
 		 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
   (add-to-list 'org-latex-classes
 	       '("ltx-talk"
-		 "\\DocumentMetadata{tagging = on}\n\\documentclass{ltx-talk}")))
-
+		 "\\documentclass{ltx-talk}"
+		 ("\\section{%s}" . "\\section*{%s}"))))
 
 
 ;;; User-Configurable Variables
@@ -75,7 +75,8 @@ (defcustom org-beamer-frame-level 1
 This integer is relative to the minimal level of a headline
 within the parse tree, defined as 1."
   :group 'org-export-beamer
-  :type 'integer)
+  :type 'integer
+  :safe #'integerp)
 
 (defcustom org-beamer-frame-default-options ""
   "Default options string to use for frames.
@@ -266,6 +267,7 @@ (org-export-define-derived-backend 'beamer 'latex
   :options-alist
   '((:headline-levels nil "H" org-beamer-frame-level)
     (:latex-class "LATEX_CLASS" nil "beamer" t)
+    (:latex-class-pre "LATEX_CLASS_PRE" nil nil newline)
     (:beamer-subtitle-format nil nil org-beamer-subtitle-format)
     (:beamer-column-view-format "COLUMNS" nil org-beamer-column-view-format)
     (:beamer-theme "BEAMER_THEME" nil org-beamer-theme)
@@ -875,7 +877,12 @@ (defun org-beamer-template (contents info)
 CONTENTS is the transcoded contents string.  INFO is a plist
 holding export options."
   (let ((title (org-export-data (plist-get info :title) info))
-	(subtitle (org-export-data (plist-get info :subtitle) info)))
+	(subtitle (org-export-data (plist-get info :subtitle) info))
+        (beamer-class (plist-get info :latex-class)))
+    (when (and (equal beamer-class "ltx-talk")
+               (plist-get info :latex-class-options))
+      (warn "ox-beamer: ignoring LaTeX class options for `ltx-talk'")
+      (setq info (plist-put info :latex-class-options nil)))
     (concat
      ;; Timestamp.
      (and (plist-get info :time-stamp-file)
@@ -889,7 +896,7 @@ (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.
-     (unless (equal (plist-get info :latex-class) "ltx-talk")
+     (unless (equal beamer-class "ltx-talk")
        (let ((format-theme
 	      (lambda (prop command)
 	        (let ((theme (plist-get info prop)))
diff --git a/testing/lisp/test-ox-beamer.el b/testing/lisp/test-ox-beamer.el
index 1f880b407..690aef204 100644
--- a/testing/lisp/test-ox-beamer.el
+++ b/testing/lisp/test-ox-beamer.el
@@ -111,8 +111,12 @@ (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."
+(ert-deftest test-ox-beamer/ltx-talk-class ()
+  "Initial test for a simple ltx-talk example.
+1. Default Metadata is inserted
+2. Sectioning is supported
+3. Labels and Beamer theme stuff are ignored
+4. LaTeX class options are also ignored and a warning is issued."
   (let ((org-latex-compiler "lualatex")
         (org-latex-hyperref-template nil)
         (org-latex-packages-alist nil)
@@ -120,24 +124,70 @@ (ert-deftest test-ox-beamer/use-ltx-talk-class ()
     (org-test-with-exported-text
      'beamer
      "#+STARTUP: beamer
-#+OPTIONS: toc:nil
+#+OPTIONS: toc:nil H:2
+#+LATEX_CLASS: ltx-talk
+#+LATEX_CLASS_OPTIONS: warn
+#+LATEX_CLASS_PRE: \\DocumentMetadata{tagging = on}
+#+TITLE: Testing =ltx-talk=
+#+BEAMER_THEME: Boadilla
+
+* A section
+** A frame
+- First
+- Second
+- Third
+"
+     (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 "\\DocumentMetadata{tagging = on}\n" nil t))
+       (should (search-forward "\\documentclass{ltx-talk}\n" nil t))
+       (should (search-forward "\\section{A section}" nil t))
+       (should (search-forward "\\frametitle{A frame}" nil t))))))
+
+(ert-deftest test-ox-beamer/ltx-talk-multi-line-metadata ()
+  "Initial test for a simple ltx-talk example.
+1. Default Metadata is inserted
+2. Sectioning is supported
+3. Labels are supppressed."
+  (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 H:2
 #+LATEX_CLASS: ltx-talk
 #+LATEX_CLASS_OPTIONS:
+#+LATEX_CLASS_PRE: \\DocumentMetadata{lang=en,
+#+LATEX_CLASS_PRE:   pdfstandard = ua-2,
+#+LATEX_CLASS_PRE:   pdfstandard = a-4f,
+#+LATEX_CLASS_PRE:   pdfversion = 2.0,
+#+LATEX_CLASS_PRE:   tagging=on}
+#+LATEX_CLASS_PRE: \\tagpdfsetup{table/header-rows={1},role / new-tag = frametitle / H2}
 #+TITLE: Testing =ltx-talk=
 #+BEAMER_THEME:
-* A frame
+
+* A section
+** 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))))))
+     (save-excursion
+       (should (search-forward "\\DocumentMetadata{lang=en," nil t))
+       (should (search-forward "pdfversion = 2.0," nil t))
+       (should (search-forward "tagging=on}" nil t))
+       (should (search-forward "\\tagpdfsetup{table" nil t))
+       (should (search-forward "\\section{A section}" nil t))
+       (should (search-forward "\\frametitle{A frame}" nil t))))))
 
 (provide 'test-ox-beamer)
 ;;; test-ox-beamer.el ends here
-- 
2.43.0

From 64ab13862b064292d83e6a33531a80334379023e Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <[email protected]>
Date: Thu, 25 Jun 2026 07:55:56 +0200
Subject: [PATCH 3/3] ox-beamer: frame vs. frame* for ltx-talk

* doc/org-manual.org: Add a larger example with a listing for
ltx-talk and refine the section.  Point to the package documentation.
* lisp/ox-beamer.el (org-beamer--format-frame): Extract latex class from
INFO channel; make `fragilep' a boolean; generate `frame' separately for
beamer and ltx-talk.
* testing/lisp/test-ox-beamer.el (test-ox-beamer/ltx-talk-class):
Comment out debug message.
(test-ox-beamer/ltx-talk-multi-verb-frame): New test for frame vs
frame*.
(test-ox-beamer/beamer-verb-frame): Check that we didn't break verbatim
frames for beamer.
---
 doc/org-manual.org             | 45 +++++++++++------
 lisp/ox-beamer.el              | 54 +++++++++++---------
 testing/lisp/test-ox-beamer.el | 90 +++++++++++++++++++++++++++++++++-
 3 files changed, 152 insertions(+), 37 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index dd7efe0b1..c26dda3e3 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13112,8 +13112,8 @@ 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.
+[[https://mirrors.ctan.org//macros/latex/contrib/ltx-talk.tds.zip/ltx-talk.pdf][=ltx-talk=
+documentation]].
 
 *** Beamer export commands
 :PROPERTIES:
@@ -13420,29 +13420,46 @@ Here is an example of an Org document ready for Beamer export.
     Please test this stuff!
 #+end_example
 
-*** Presentations with =ltx-talk=
+*** An example of a presentation using =ltx-talk=
 
 =ltx-talk= is an alternative to the =beamer= class. It depends on
 LuaLaTeX and produces tagged PDF files with enhanced
 accessibility. The Beamer exporter can produce presentations for this
-class, too. To activate it, make sure that you have, at least, the
-following options in the Org header:
+class, too. The following is an example of a minimal presentation
+using ~ltx-talk:~
+
+#+BEGIN_SRC org
+,#+STARTUP: beamer
+,#+OPTIONS: toc:nil H:2 title:t
+,#+LATEX_CLASS: ltx-talk
+,#+LATEX_CLASS_PRE: \\DocumentMetadata{tagging=on}
+,#+TITLE: Testing =ltx-talk= verbatims
+
+,* A section
+,** A frame
+- First
+- Second
+- Third
+,** A frame with a listing
+- This is a listing:
+  ,#+BEGIN_SRC python
+import sys
+
+print(\"Hello, ltx-talk!\", file=sys.stderr)
+  ,#+END_SRC
+#+END_SRC
 
-#+begin_example
-#+STARTUP: beamer
-#+LATEX_COMPILER: lualatex
-#+LATEX_CLASS: ltx-talk
-#+LATEX_CLASS_PRE: \\DocumentMetadata{tagging = on}
-#+OPTIONS: H:2
-#+end_example
 
 Observations:
 - Setting the header levels to =H:2= in the options will create the
   sectioning in your presentation. Setting =H:1= will suppress
-  sectioning.
+  sectioning[fn::Frames should be placed at the first level in this
+  case.].
 - If you use a longer prelude before ~\documentclass{ltx-talk}~, feel
   free to add as many ~#+LATEX_CLASS_PRE:~ lines as needed.
-- ~#+LATEX_CLASS_OPTIONS:~ will be removed and you will be warned.
+- ~#+LATEX_CLASS_OPTIONS:~ will be removed and you will be
+  warned. ~#+BEAMER_..._THEME~ keywords will be silently ignored.
+- Frame options will also be ignored.
 
 ** HTML Export
 :PROPERTIES:
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index 09e60c29a..0a5af39e4 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -433,26 +433,34 @@ (defun org-beamer--format-frame (headline contents info)
   "Format HEADLINE as a frame.
 CONTENTS holds the contents of the headline.  INFO is a plist
 used as a communication channel."
-  (let* ((fragilep
+  (let* ((latex-class (plist-get info :latex-class))
+         (fragilep
 	  ;; FRAGILEP is non-nil when HEADLINE contains an element
-	  ;; among `org-beamer-verbatim-elements'.
-	  (org-element-map headline org-beamer-verbatim-elements 'identity
-			   info 'first-match))
+	  ;; among `org-beamer-verbatim-elements'. Make it a boolean
+          ;; for easier debugging.
+	  (not (null (org-element-map headline org-beamer-verbatim-elements 'identity
+			              info 'first-match))))
          ;; If FRAGILEP is non-nil and CONTENTS contains an occurrence
          ;; of \begin{frame} or \end{frame}, then set the FRAME
-         ;; environment to be `org-beamer-frame-environment';
-         ;; otherwise, use "frame". If the selected environment is not
-         ;; "frame", then add the property :beamer-define-frame to
-         ;; INFO and set it to t.
-         (frame (let ((selection
-                       (or (and fragilep
-                                (or (string-match-p "\\\\begin{frame}" contents)
-                                    (string-match-p "\\\\end{frame}" contents))
-                                org-beamer-frame-environment)
-                           "frame")))
-                  (unless (string= selection "frame")
-                    (setq info (plist-put info :beamer-define-frame t)))
-                  selection)))
+         ;; environment to be `org-beamer-frame-environment' for beamer
+         ;; and "frame*" for ltx-talk;  otherwise, use "frame".
+         ;; For beamer, if the selected environment is not "frame",
+         ;; then add the property :beamer-define-frame to INFO and
+         ;; set it to t.
+         (frame (if (equal latex-class "beamer")
+                    (let ((selection
+                           (or (and fragilep
+                                    (or (string-match-p "\\\\begin{frame}" contents)
+                                        (string-match-p "\\\\end{frame}" contents))
+                                    org-beamer-frame-environment)
+                               "frame")))
+                      (unless (string= selection "frame")
+                        (setq info (plist-put info :beamer-define-frame t)))
+                      selection)
+                  ;; for ltx-talk: fragilep means frame*
+                  (if fragilep
+                      "frame*"
+                    "frame"))))
     (concat "\\begin{" frame "}"
 	    ;; Overlay specification, if any. When surrounded by
 	    ;; square brackets, consider it as a default
@@ -480,8 +488,9 @@ (defun org-beamer--format-frame (headline contents info)
 				                  (match-string 1 beamer-opt))
 			                     ",")))))
 		   (fragile
-		    ;; Add "fragile" option if necessary.
-		    (and fragilep
+		    ;; Add "fragile" option if necessary for beamer.
+		    (and (equal latex-class "beamer")
+                         fragilep
 			 (not (member "fragile" options))
 			 (list "fragile")))
 		   (label
@@ -489,9 +498,10 @@ (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)))
+                    ;; FIXME: no labels for ltx-talk in \begin{frame}
+                    ;;        find an alternative!
+		    (and (equal "beamer" latex-class)
+                         (not (member "allowframebreaks" options))
 			 (not (cl-some (lambda (s) (string-match-p "^label=" s))
 				       options))
 			 (list
diff --git a/testing/lisp/test-ox-beamer.el b/testing/lisp/test-ox-beamer.el
index 690aef204..a6566bb5d 100644
--- a/testing/lisp/test-ox-beamer.el
+++ b/testing/lisp/test-ox-beamer.el
@@ -137,9 +137,11 @@ (ert-deftest test-ox-beamer/ltx-talk-class ()
 - Second
 - Third
 "
-     (message "--> \n%s" (buffer-string))
+     ;; (message "--> \n%s" (buffer-string))
      (goto-char (point-min))
+     ;; ltx-talk ignores theme info
      (save-excursion (should-not (search-forward "\\usetheme{" nil t)))
+     ;; ltx-talk doesn't generate labels
      (save-excursion (should-not (search-forward "[label=]" nil t)))
      (save-excursion
        (should (search-forward "\\DocumentMetadata{tagging = on}\n" nil t))
@@ -189,5 +191,91 @@ (ert-deftest test-ox-beamer/ltx-talk-multi-line-metadata ()
        (should (search-forward "\\section{A section}" nil t))
        (should (search-forward "\\frametitle{A frame}" nil t))))))
 
+(ert-deftest test-ox-beamer/ltx-talk-multi-verb-frame ()
+  "Test that a frame with verbatim elements uses \"frame*\"."
+  (let ((org-latex-compiler "lualatex")
+        (org-latex-hyperref-template nil)
+        (org-latex-packages-alist nil)
+        (org-latex-default-packages-alist nil)
+        (org-latex-title-command "\\begin{frame}\n\\maketitle\n\\end{frame}\n"))
+    (org-test-with-exported-text
+     'beamer
+     "#+STARTUP: beamer
+#+OPTIONS: toc:nil H:2 title:t
+#+LATEX_CLASS: ltx-talk
+#+LATEX_CLASS_PRE: \\DocumentMetadata{tagging=on}
+#+TITLE: Testing =ltx-talk= verbatims
+#+BEAMER_THEME:
+
+* A section
+** A frame
+- First
+- Second
+- Third
+** A frame with a listing
+- This is a listing:
+  #+BEGIN_SRC python
+import sys
+
+print(\"Hello, ltx-talk!\", file=sys.stderr)
+  #+END_SRC
+"
+     ;; (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 "\\DocumentMetadata{tagging=on}" nil t))
+       (should (search-forward "\\section{A section}\n" nil t))
+       (should (search-forward "\\begin{frame}\n" nil t))
+       (should (search-forward "\\frametitle{A frame}\n" nil t))
+       (should (search-forward "\\end{frame}\n" nil t))
+       (should (search-forward "\\begin{frame*}\n" nil t))
+       (should (search-forward "\\frametitle{A frame with a listing}\n" nil t))
+       (should (search-forward "\\end{frame*}\n" nil t))))))
+
+(ert-deftest test-ox-beamer/beamer-verb-frame ()
+  "Test that a frame with verbatim elements sets fragile in beamer.
+Added to check that the ltx-talk adaptation doesn't break anything in Beamaer."
+  (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 H:2 title:t
+#+LATEX_CLASS_OPTIONS: [presentation,11pt,t]
+#+TITLE: Testing =beamer= verbatims
+#+BEAMER_THEME: Boadilla
+
+* A section
+** A frame
+- First
+- Second
+- Third
+** A frame with a listing
+- This is a listing:
+  #+BEGIN_SRC python
+import sys
+
+print(\"Hello, beamer!\", file=sys.stderr)
+  #+END_SRC
+"
+     ;; (message "--> \n%s" (buffer-string))
+     (goto-char (point-min))
+     (save-excursion
+       (should-not (search-forward "\\DocumentMetadata{tagging=on}" nil t)))
+     (save-excursion
+       (should (search-forward "\\documentclass[presentation,11pt,t]{beamer}" nil t))
+       (should (search-forward "\\usetheme{" nil t)))
+       (should (search-forward "\\section{A section}\n" nil t))
+       (should (search-forward-regexp "^\\\\begin{frame}\\[.+?]$" nil t))
+       (should (search-forward "\\frametitle{A frame}\n" nil t))
+       (should (search-forward "\\end{frame}\n" nil t))
+       (should (search-forward-regexp "^\\\\begin{frame}\\[.+?\\,fragile]$" nil t))
+       (should (search-forward "\\frametitle{A frame with a listing}\n" nil t))
+       (should (search-forward "\\end{frame}\n" nil t)))))
+
 (provide 'test-ox-beamer)
 ;;; test-ox-beamer.el ends here
-- 
2.43.0

Reply via email to