Open muzimuzhi opened 6 days ago
Note that changing /tcb/minted style=<style>
to be an abbreviation for minted options={style=<style>}
would make minted options
and minted style
cancel each other's effect, thus introduce a breaking change.
Although that would be more consistent with the behaviors of listings options
and listings style
.
https://github.com/T-F-S/tcolorbox/blob/b59111a7429eccf196e716edec170f52fe560232/tex/latex/tcolorbox/tcblistings.code.tex#L66
Ah, the current doc of /tcb/minted style
added between v2.50 (2013/07/29) and v3.05 (2014/05/28) does say
Note that styles are always applied globally; all following examples will be set in the given \meta{style} until a new style is set.
But after minted
v2.0alpha (2013/07/30) introduced style
option, this restriction can be avoided.
Also, the current doc is vague about when minted style
is actually applied.
Note that changing
/tcb/minted style=<style>
to be an abbreviation forminted options={style=<style>}
would makeminted options
andminted style
cancel each other's effect, thus introduce a breaking change.Although that would be more consistent with the behaviors of
listings options
andlistings style
.
The difference is that a listings style
can be used as a shortcut for all kinds of listings options while minted style
only sets the Pygments stylesheet and not other minted options. Therefore, minted style
and minted options
are complementary (not really, since we have style
as an minted option).
So, I would not like to change /tcb/minted style=<style>
to be an abbreviation for minted options={style=<style>}
. By the way, the minted documentation describes tcblisting
with these options (currently, on page 19) and I would not want to break this.
Your proposal from the first post sounds reasonable to me. The global effect is documented and changing to your proposal would mean a possibly breaking change. But, honestly, I do not think that anybody has code which relies on the effect (?)...
Currently, I have no time to test the code, but I will do in the next days. If nothing special comes up, I will do these changes.
Thank you for your ideas!
The difference is that a
listings style
can be used as a shortcut for all kinds of listings options whileminted style
only sets the Pygments stylesheet and not other minted options.
Good point! I am too unfamiliar with listings
package.
So, I would not like to change
/tcb/minted style=<style>
to be an abbreviation forminted options={style=<style>}
.
Changing /tcb/minted style=<style>
to be an abbreviation is also not the way I would suggest. https://github.com/T-F-S/tcolorbox/issues/299#issuecomment-2458643527 was merely about what I just read from the source code. Sorry I didn't express myself clearly enough.
When
listing engine=minted
,\tcbusetemplisting
may call\usemintedstyle
(see code line 36 below) in the current group which then changes "global" minted style.https://github.com/T-F-S/tcolorbox/blob/b59111a7429eccf196e716edec170f52fe560232/tex/latex/tcolorbox/tcbminted.code.tex#L34-L56
Instead of
\usemintedstyle{<style>}
, the minted style can also be passed on to\inputminted
usingstyle=<style>
option. This ensures the setting of minted style is local.Example
Proposal