Hi Ihor,

Find attached a couple of patches that I'd like you to take a look before applying on main.

best, /PA
--
Pedro A. Aranda
ox-latex & ox-beamer maintainer

Sagen's Paradeiser! (ORF: Als Radiohören gefährlich war) => write BE!
IA: onomatopeya del rebuzno
2nd year of the New Koprocracy
From ab6cdfb1ba20fd7184cd4bf943481e9d2443e9af Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <[email protected]>
Date: Sat, 3 Oct 2026 08:23:30 +0200
Subject: [PATCH 51/53] Add contributions to ox-latex and ox-beamer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* doc/org-manual.org (** List of Contributions): Added Roger Schürch and
  myself to the contributions list.

TINYCHANGE
---
 doc/org-manual.org | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 88f85b2e4..915ca8ae2 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -24590,6 +24590,13 @@ community and the code.
 
 - Marco Wahl wrote =ol-eww.el=.
 
+- Pedro A. Aranda Gutiérrez wrote the ~fontspec~ support for
+  =ox-latex.el=.
+
+- Roger Schürch requested and helped testing the support for the
+  ~ltx-talk~ package to generate accessible presentations with
+  =ox-beamer.el= written by Pedro A. Aranda Gutiérrez.
+
 * GNU Free Documentation License
 :PROPERTIES:
 :APPENDIX: t
-- 
2.43.0

From 975a754fabb30d3a2d01aa1a382a4f33d502a32f Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <[email protected]>
Date: Sat, 3 Oct 2026 08:27:19 +0200
Subject: [PATCH 52/53] ox-latex: Safe declarations for listings and minted
 custom var

* lisp/ox-latex.el (org-latex-listings-langs),
(org-latex-minted-langs),
(org-latex-minted-options): Declare them safe as lists.
---
 lisp/ox-latex.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index ddd7accfc..fd9fa8bd0 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1135,7 +1135,8 @@ (defcustom org-latex-listings-langs
   :type '(repeat
 	  (list
 	   (symbol :tag "Major mode       ")
-	   (string :tag "Listings language"))))
+	   (string :tag "Listings language")))
+  :safe #'listp)
 
 (defcustom org-latex-listings-src-omit-language nil
   "Discard src block language parameter in listings.
@@ -1210,7 +1211,8 @@ (defcustom org-latex-minted-langs
   :type '(repeat
 	  (list
 	   (symbol :tag "Major mode     ")
-	   (string :tag "Minted language"))))
+	   (string :tag "Minted language")))
+  :safe #'listp)
 
 (defcustom org-latex-minted-options nil
   "Association list of options for the latex minted package.
@@ -1242,7 +1244,8 @@ (defcustom org-latex-minted-options nil
   :type '(repeat
 	  (list
 	   (string :tag "Minted option name ")
-	   (string :tag "Minted option value"))))
+	   (string :tag "Minted option value")))
+  :safe #'listp)
 
 (defcustom org-latex-custom-lang-environments nil
   "Alist mapping languages to language-specific LaTeX environments.
-- 
2.43.0

From 9400e2b5508ed847e577235249a818b4826211c7 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <[email protected]>
Date: Sat, 3 Oct 2026 13:03:29 +0200
Subject: [PATCH 53/53] ox-latex: Further control for the listings src backend

* doc/org-manual.org (* An example of a presentation using =ltx-talk=):
Add a reference to source code listing options.
(* Source blocks in LaTeX export): Document `org-latex-listings-env'.
* lisp/ox-latex.el (org-latex-listings-env): New variable to define the
LaTeX block to use when exporting source code with the listings backend.
(org-latex-src-block--listings): break up the environment and use
`org-latex-listings-env' when generating the LaTeX begin/end commands.
* Testing/lisp/test-ox-latex.el (test-ox-latex/fancy-listings): New test
for `org-latex-listings-env'.

This is prompted after further studying the manuals and examples
provided by the ltx-talk authors.  Listings are scarcely discussed and
when they are, fancyvrb is used.
---
 doc/org-manual.org            | 29 +++++++++++++++++++++++++++++
 lisp/ox-latex.el              | 24 ++++++++++++++++++++++--
 testing/lisp/test-ox-latex.el | 26 ++++++++++++++++++++++++++
 3 files changed, 77 insertions(+), 2 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 915ca8ae2..1a6295593 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13541,6 +13541,12 @@ is the version of the Beamer example above adapted to ~ltx-talk:~
    | =exampleblock=     | No      |                 |
    | =note=             | No      |                 |
    |--------------------+---------+-----------------|
+4. The easiest way to get source code listings in your ~ltx-talk~
+   slides is to use the ~fancyvrb~ package as described in the
+   package's documentation.  To use ~fancyvrb~ in Org you will need to
+   customize some variables, cf.  [[* Source blocks in LaTeX export]].
+   Another possibility is to use the ~minted~ exporter if you need
+   source code decoration.
 
 ** HTML Export
 :PROPERTIES:
@@ -15167,6 +15173,29 @@ file, use the ~org-latex-listings-options~,
 ~org-latex-engraved-options~, and ~org-latex-minted-options~
 variables.
 
+#+vindex: org-latex-src-block-backend
+#+vindex: org-latex-listings-env
+#+vindex: org-latex-listings-src-omit-language
+The =listings= export backend generates LaTeX code for the ~listings~
+package by default, but is also compatible with the ~fancyvrb~
+package.  To generate code for the latter, you need to adjust the
+following variables:
+
+#+begin_src emacs-lisp
+(setq org-latex-listings-env "Verbatim"
+      org-latex-src-block-backend 'listings
+      org-latex-listings-src-omit-language t)
+#+end_src
+
+*Note:* if you use ~Verbatim~ to export your source code blocks, add
+~fancyvrb~ to ~org-latex-packages-alist~, or include:
+
+#+BEGIN_SRC org
+,#+LATEX_HEADER: \usepackage{fancyvrb}
+#+END_SRC
+
+in your document header.
+
 *** Example blocks in LaTeX export
 :PROPERTIES:
 :DESCRIPTION: Attributes specific to example blocks.
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index fd9fa8bd0..148ee9fd7 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -158,6 +158,7 @@ (org-export-define-backend 'latex
     (:latex-link-with-unknown-path-format nil nil org-latex-link-with-unknown-path-format)
     (:latex-src-block-backend nil nil org-latex-src-block-backend)
     (:latex-listings-langs nil nil org-latex-listings-langs)
+    (:latex-listings-env nil nil org-latex-listings-env)
     (:latex-listings-options nil nil org-latex-listings-options)
     (:latex-listings-src-omit-language nil nil org-latex-listings-src-omit-language)
     (:latex-minted-langs nil nil org-latex-minted-langs)
@@ -1189,6 +1190,22 @@ (defcustom org-latex-listings-options nil
 	   (string :tag "Listings option value")))
   :safe #'listp)
 
+(defcustom org-latex-listings-env "lstlisting"
+  "The LaTeX environment to use by the listings source code export backend.
+
+Set this variable to \"Verbatim\" and add the fancyvrb LaTeX package to your
+`org-latex-packages-alist' variable, via local variables, customization or in
+your Emacs init code, for example, with:
+
+  (require \\='ox-latex)
+  (add-to-list \\='org-latex-packages-alist \\='(\"\" \"fancyvrb\"))
+
+Note: this is the simplest solution to add code blocks in ltx-talk.
+"
+  :group 'org-export-latex
+  :type '(string :tag "Listings environment")
+  :safe #'stringp)
+
 (defcustom org-latex-minted-langs
   '((emacs-lisp "common-lisp")
     (cc "c++")
@@ -4606,6 +4623,7 @@ (cl-defun org-latex-src-block--listings
          (or (cadr (assq (intern lang)
                          (plist-get info :latex-listings-langs)))
              lang))
+        (env (or (plist-get info :latex-listings-env) "lstlisting"))
         (caption-str
          (when caption
            (let ((main (org-export-get-caption src-block))
@@ -4618,7 +4636,8 @@ (cl-defun org-latex-src-block--listings
         (lst-opt (plist-get info :latex-listings-options)))
     (concat
      (format
-      "\\begin{lstlisting}[%s]\n%s\\end{lstlisting}"
+      "\\begin{%s}[%s]\n%s"
+      env
       ;; Options.
       (concat
        (org-latex--make-option-string
@@ -4662,7 +4681,8 @@ (cl-defun org-latex-src-block--listings
                 ;; code
                 (concat (make-string (+ (- max-width (length loc)) 6) ?\s)
                         (format "(%s)" ref)))))
-         nil (and retain-labels (cdr code-info))))))))
+         nil (and retain-labels (cdr code-info)))))
+     (format "\n\\end{%s}" env))))
 
 ;;;; Statistics Cookie
 
diff --git a/testing/lisp/test-ox-latex.el b/testing/lisp/test-ox-latex.el
index e14c71aac..d104d1ae8 100644
--- a/testing/lisp/test-ox-latex.el
+++ b/testing/lisp/test-ox-latex.el
@@ -1221,5 +1221,31 @@ (ert-deftest test-ox-latex/alt-attribute ()
    (should (search-forward "It has a second line!}" nil t))
    (should (search-forward "]{./image.png}" nil t))))
 
+(ert-deftest test-ox-latex/fancy-listings ()
+  "Test that we can define Verbatim as environment for the listings backend."
+  (let ((org-latex-listings-env "Verbatim")
+        (org-latex-src-block-backend 'listings)
+        (org-latex-listings-src-omit-language t)
+        (org-latex-packages-alist '(("" "fancyvrb"))))
+   (org-test-with-exported-text
+    'latex
+    "#+LATEX_COMPILER: pdflatex
+
+* A stupid little listings
+
+#+BEGIN_SRC c
+for (int i=0; i<10; i++)
+    printf(\"i: %d\\n\",i);
+#+END_SRC
+"
+    ;; (message "fancy-listings:\n%s" (buffer-string))
+    (goto-char (point-min))
+    (should (search-forward "\\usepackage{fancyvrb}\n"))
+    (should (search-forward "\\begin{document}\n"))
+    (should (search-forward "\\begin{Verbatim}[numbers=none]\n"))
+    (should (search-forward "\\end{Verbatim}\n"))
+    (should (search-forward "\\end{document}"))
+    )))
+
 (provide 'test-ox-latex)
 ;;; test-ox-latex.el ends here
-- 
2.43.0

Reply via email to