Closed matteofg closed 4 months ago
The listings package does not use pgfkeys
and its powerful key handler mechanism. Therefore, \lstdefinestyle
is needed to create own keys in the sense of styles.
On the other hand, the tcolorbox package relies on pgf
and its pgfkeys
. The key handlers are quite sophisticated and allow much more than only to define a style. The .style
handler can have arguments, even argument patterns, etc. Often, you may want to use .code
or append thing, and so on.
So, for the task of shortening the most basic usage of .style
a new macro could be provided. But, IMHO, it would shadow the real mechanism which is very flexible and extensible.
Nevertheless, for personal usage one can add such a basic shortening quite easily, if needed:
\ProvideDocumentCommand{\tcbdefinestyle}{mm}{%
\tcbset{#1./style={#2}}%
}
Thank you for the explanation and the clarifications. Issue solved 👍
PS: Full list of pgfkeys
key handlers which can be used to define and modify key styles: https://tikz.dev/pgfkeys#sec-87.4.4.
@muzimuzhi Thank you
in
tcolorbox
the definition of a style is done through the command\tcbset
and the key.style
, according to the following syntax:Wouldn't it be better to simplify the syntax and provide a command similar to
\lstdefinestyle
(the name could be\tcbdefinestyle
), so as to set the various styles as follows?