Hi Max,
You are right in all your considerations. My concerns/motivation when
proposing this:
1) not all users may have enough ELisp knowledge to add a hack to their
configuration, specifically when it comes to modifying an alist.
2) not all documents you produce may need the hack, so adding config
options may be appealing to people who, like me, need them only sometimes
and don't want to be retouching their Emacs configuration depending on the
doc.
3) export filters... I have also tried a post-export filter, but since ~~
and == both produce \texttt{}, it was difficult to control. Will continue
exploring that.
Re \verb@@ in captions, you are absolutely right. LaTeX will complain, but
this can be fixed by educating users, i.e. by adding a CAVEAT in the manual
in the lines of
CAVEAT: If ~org-latex-verb-is-verb~ to t, you may not use ~verb~ in
captions to add monospaced text. You will need to use =verb= instead.
BTW, instead of posting filtering code to the mailing list, this may be
something for worg... WDYT?
And finally, thanks for pointing me to Prot's resources, Will try out!
Thanks a ton, /PA
On Sat, 30 May 2026 at 05:04, Max Nikulin <[email protected]> wrote:
> 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.
>
--
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