Hi again,

time permitting, could you pls apply this patch on you current patch code
to check if the sectioning is fixed for you or we need to refine more?

Schönen Gruß, /PA

On Wed, 24 Jun 2026 at 07:56, Pedro Andres Aranda Gutierrez <
[email protected]> wrote:

> Hi
>
> One thing at a time...
>
> To fix the sectioning, try:
>
> ------
> (use-package ox-beamer
>   :ensure nil
>   :after org
>   :config
>   (add-to-list 'org-latex-classes '("ltx-talk" "\\DocumentMetadata{lang=en,
>                   pdfstandard = ua-2,
>                   pdfstandard = a-4f,
>                   pdfversion = 2.0,
>                   tagging=on}
>
> \\tagpdfsetup{table/header-rows={1},role / new-tag = frametitle / H2}
> \\documentclass{ltx-talk}\n"
> ("\\section{%s}" ."\\section*{%s}"))))
> -------
>
> A question: should we also support \part, mix \part and \section? Is there
> any use to this?
>
> For the LaTeX before the document class, I'm exploring the generalised
> #+LATEX_CLASS_PRE keyword instead of org-latex-classes, WDYT?
>
> Best, /PA
>
> PS: My personal config is
> #+LANGUAGE: es de en it
> So, feel free ;-)
>
> On Wed, 24 Jun 2026 at 07:08, Pedro Andres Aranda Gutierrez <
> [email protected]> wrote:
>
>> As said, this was preliminary, based on the examples provided in the Web
>> page.
>> Thanks for the examples and comments; they are helpful in bringing this
>> forward.
>> Will see what else we need.
>>
>> Best, /PA
>>
>> On Wed, 24 Jun 2026 at 04:56, Roger Schürch <[email protected]> wrote:
>>
>>> Pedro Andres Aranda Gutierrez <[email protected]> writes:
>>> > On my Mac, with MacTeX2025, because 2026 has problems with the
>>> Harfbuzz driver and fallback fonts...
>>>
>>> Dear Pedro,
>>>
>>> I have used your file as a basis and could get the ltx-talk patch to
>>> work on my system. I tried to make a file that uses most of what I need
>>> (sectioning, images, columns, R code and results of computations, formulae;
>>> see attachment). The resulting PDF was 95% compliant with Canvas LMS, the
>>> remaining compliance issue is a warning that frame titles are not level 1
>>> headings (ltx-talk makes a deliberate choice to have these be level 4
>>> headings).
>>>
>>> The two issues regarding my desired functionality that remain now are
>>> that:
>>>
>>> 1. the sectioning does not work (if I set org-beamer-frame-level to 2,
>>> the level 1 headings turn into enumerate environments), and
>>>
>>> 2. the minted (or generally verbatim) environments work differently now
>>> (beamer used fragile as an option to the frame environment, ltx-talk uses a
>>> frame* environment)
>>>
>>> I have manually tested that if I remove the fragile option and instead
>>> use the frame* environment directly in the LaTeX file the code blocks
>>> render fine in minted.
>>>
>>> For completeness, here is my relevant section from my init file
>>> (modified from your suggestion):
>>>
>>> (use-package ox-beamer
>>>   :ensure nil
>>>   :after org
>>>   :config
>>>   (add-to-list 'org-latex-classes '("ltx-talk"
>>> "\\DocumentMetadata{lang=en,
>>>                   pdfstandard = ua-2,
>>>                   pdfstandard = a-4f,
>>>                   pdfversion = 2.0,
>>>                   tagging=on}
>>>
>>> \\tagpdfsetup{table/header-rows={1},role / new-tag = frametitle / H2}
>>> \\documentclass{ltx-talk}\n")))
>>>
>>> Best wishes,
>>> Roger
>>>
>>>
>>>
>>
>> --
>> 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
>>
>>
>
> --
> 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
>
>

-- 
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 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/2] 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

Reply via email to