On 29/05/2026 12:27 am, Pedro A. Aranda wrote:

attached is a patch to enhance Org markup support in the LaTeX exporter.
I needed it for a publication.

Am I wrong expecting that it may be achieved without modification of ox-latex?

Subject: [PATCH] ox-latex: Use verb and texttt depending on markup

lisp/ox-latex.el: (org-latex-verb-is-verb,org-latex-quoted-verb)
  (org-latex-verb-is-verb): New custom variable controlling when to use
  "\verb" or "\texttt".
  (org-latex-quoted-verb): New custom variable to add quotes around
  generated "\verb".

Nitpick: to avoid repetition, I would expect

* lisp/ox-latex.el (org-latex-verb-is-verb): New custom variable
controlling when to use "\verb" or "\texttt".
(org-latex-quoted-verb): New custom variable to add quotes around
generated "\verb".

but it doesn't matter, see below.

+++ b/doc/org-manual.org

+If you set custom variable ~org-latex-verb-is-verb~ to ~t~, the words
+marked as verbatim will be exported usinf the ~\verb~ command[fn::Org will
+select the apropriate delimiter character. In the example it was '~']:

Doesn't `org-latex-text-markup-alist' allow to achieve the same?
(Side note: s/usinf/using/ s/apropriate/appropriate/ should be detected by a spell checker.)

+Additionally, you can set custom variable ~org-latex-quoted-verb~ to
+~single~ or ~double~ in order to surround verbatim text with single or
+double quotes. ~single~ mimics the =texinfo= conventions used in this
+manual and the resulting LaTeX code would be:

Have you considered adding quotes using export filters? I am in doubts if a niche use case deserves a dedicated defcustom and a snipped on the manual. Posting filter code to the mailing list may be enough since it should be discoverable through search engines.

+++ b/lisp/ox-latex.el
@@ -910,7 +910,7 @@ upsets the typesetting of a list."
                                         (italic . "\\emph{%s}")
                                         (strike-through . "\\sout{%s}")
                                         (underline . "\\uline{%s}")
-                                        (verbatim . protectedtexttt))
+                                        (verbatim . verb))

Have you verified that LaTeX files can be successfully compiled if =verb= is used in captions and headings? I admit, protectedtexttt has its own downside. It may cause confusing hyphenations.

A couple of weeks ago an old thread on issues with \verb|...| was revived. It seems, there is a number of not so obvious issues with \verb, \uline, \sout raised on the mailing list years earlier.

Side note: To get meaningful chunk headers, please, consider setting

    *.el        diff=elisp

in ~/.config/git/attributes

and

    [diff "elisp"]
xfuncname = "^((;;;+ |\\(|\\s*\\((cl-|el-|patch-)?def(un|var|macro|custom|method|struct|gb/)|\\s*\\(ert-deftest).*)$"
in ~/.config/git/config

See <https://protesilaos.com/codelog/2021-01-26-git-diff-hunk-elisp-org/>

P.S. Do not hurry up trying to react immediately. I may be wrong with my expectations.

Reply via email to