bug-auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48078: Verbatim environments with key-value arguments


From: Dario Gjorgjevski
Subject: bug#48078: Verbatim environments with key-value arguments
Date: Wed, 28 Apr 2021 11:11:07 +0200

Hi,

I am writing styles for the minted and listings libraries of tcolorbox,
which introduce the tcblisting verbatim environment.  Here is a small
example showing things:

\documentclass[preview,svgnames,x11names]{standalone}

\RequirePackage[newfloat]{minted}
\RequirePackage{tcolorbox}
\tcbuselibrary{most,minted}

\begin{document}
\begin{tcblisting}{%
listing only,%
title={Example shell session},
minted language=shell-session,%
minted options={},%
}
$ echo 'Hello, World!'
Hello, World!
\end{tcblisting}
\end{document}

% Local Variables:
% mode: latex
% TeX-command-extra-options: "-shell-escape"
% TeX-master: t
% End:
As you can see, tcblisting takes key-value arguments.  This breaks the
"mandatory arguments to verbatim environments" part of
`font-latex-syntactic-keywords', which is defined as:

    ;; After the optional argument, there may also be
    ;; another mandatory argument(s) (e.g. with VerbatimOut or
    ;; the minted envs or defined with `lstnewenvironment').
    "\\(?:{[^}]*}\\)*"

Since the key-value arguments _can_ contain braces (e.g., title={Example
shell session}), the regex does not match properly and messes up the
fontification.

Feel free to add "tcblisting" to `LaTeX-verbtaim-environments' and check
out the example above: You will see that everything after title={Example
shell session} is fontified as verbatim.

I would be happy to try and improve the regex so that it handles
key-value arguments, but I first wanted to ask if this is indeed and the
best approach.

Best regards,

-- 
Dario Gjorgjevski <dario.gjorgjevski@gmail.com>
Key fingerprint = F7C3 734D 2381 DAEB 4C6D  9CF7 744A 4F0B 4F1C 9371
$ gpg --keyserver   hkps://hkps.pool.sks-keyservers.net \
      --search-keys 744A4F0B4F1C9371

reply via email to

[Prev in Thread] Current Thread [Next in Thread]