On 06/10/2026 20:41, Ihor Radchenko wrote:
"Pedro A. Aranda" <[email protected]> writes:

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

Looks good in general.
Although I have a couple of larger-scope comments.

TINYCHANGE

Nit: The purpose of TINYCHANGE is copyright marking. It is only needed
for commits created by people without copyright assignment.

OK, note taken

+#+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.

A general thought not for this patch, but for future - if we keep adding
more and more special defaults sensible for ltx-talk, it could make
sense to split it into a separate ox-ltx-talk derived from ox-beamer.
> Then, we can have ltx-specific defaults for org-latex-listings-env and similar.

When we arrive at that bridge, we will see. I'm currently using this in beamer, ltx-talk and for my manuals. It's generic enough. I use the ltx-talk example, because it solved an issue I had with the listings package and ltx-talk. (Maybe it is because I'm working a lot with ltx-talk too, lately).


      (: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)

I think it would be nice (in the future), to allow some of these
ox-latex options to be settable via in-document keywords.

Noted.

For example, #+LATEX_LISTINGS_ENV: fancyrb would be very natural.

The environment would be "Verbatim", not the package. The default value is "lstlistings", see below, and not the listings package. And the docstring clearly talks about the environment and not the package ad how they relate.

+(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)

Please add :package-version.
OK> Also, I am wondering if we should make the type less generic and only
accept lstlisting and fancyrb.

I only use the listings and fancyvrb _packages_.
I was temoted to reduce to "lstlisting" and "Verbatim".But, what if there is another option which I'm not aware of?
--
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


Reply via email to