diff options
Diffstat (limited to 'macros/latex/contrib/tcolorbox/tcolorbox.sty')
-rw-r--r-- | macros/latex/contrib/tcolorbox/tcolorbox.sty | 215 |
1 files changed, 138 insertions, 77 deletions
diff --git a/macros/latex/contrib/tcolorbox/tcolorbox.sty b/macros/latex/contrib/tcolorbox/tcolorbox.sty index 812b9dcc90..be2dc7e19b 100644 --- a/macros/latex/contrib/tcolorbox/tcolorbox.sty +++ b/macros/latex/contrib/tcolorbox/tcolorbox.sty @@ -1,8 +1,8 @@ -%% The LaTeX package tcolorbox - version 6.1.0 (2023/09/26) +%% The LaTeX package tcolorbox - version 6.2.0 (2024/01/10) %% tcolorbox.sty: Text color boxes %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2006-2023 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de> +%% Copyright (c) 2006-2024 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de> %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -17,9 +17,9 @@ %% %% This work consists of all files listed in README %% -\NeedsTeXFormat{LaTeX2e}[2020/10/01] -\ProvidesPackage{tcolorbox}[2023/09/26 version 6.1.0 text color boxes] -\def\tcb@version{6.1.0} +\NeedsTeXFormat{LaTeX2e}[2021-11-15] +\ProvidesPackage{tcolorbox}[2024/01/10 version 6.2.0 text color boxes] +\def\tcb@version{6.2.0} \RequirePackage{pgf}[2008/01/15] \RequirePackage{verbatim}[2003/08/22] @@ -55,6 +55,19 @@ \newcounter{tcblayer} \newcounter{tcolorbox@number} +\ExplSyntaxOn +\bool_new:N \l__tcobox_prevent_init_overwrite_bool +\box_new:N \l__tcobox_tmpa_box +\dim_new:N \l__tcobox_tmpa_dim +\fp_new:N \l__tcobox_tmpa_fp +\iow_new:N \g__tcobox_out_iow +\iow_new:N \g__tcobox_record_iow +\str_new:N \l__tcobox_record_file_str +\tl_new:N \l__tcobox_kv_labeltype_tl +\tl_new:N \l__tcobox_tmpa_tl +\tl_new:N \l__tcobox_tmpb_tl +\ExplSyntaxOff + \def\tcb@info#1{\PackageInfo{tcolorbox}{#1}} \def\tcb@warning#1{\PackageWarning{tcolorbox}{#1}} \def\tcb@error#1#2{\PackageError{tcolorbox}{#1}{#2}} @@ -287,7 +300,7 @@ fontlower/.store in=\kvtcb@fontlower, tempfile/.store in=\kvtcb@tempfile, savelowerto/.code={\tcb@redirectlowertofalse\def\kvtcb@savelowerto{#1}}, - redirectlowerto/.code={\tcb@lowerignoredtrue\tcb@lowervisiblefalse\tcb@redirectlowertotrue\def\kvtcb@savelowerto{#1}}, + redirectlowerto/.code={\pgfkeysalso{lowerbox=ignored}\tcb@redirectlowertotrue\def\kvtcb@savelowerto{#1}}, saveto/.store in=\kvtcb@saveupperto, savedelimiter/.estore in=\kvtcb@savedelimiter, floatplacement/.store in=\kvtcb@floatplacement, @@ -888,9 +901,33 @@ wrap@environment/.is if=tcb@wrap@environment, } + +\def\kvtcb@beforebox{} +\def\kvtcb@afterbox{} + + \ExplSyntaxOn -\tl_new:N \l__tcobox_kv_labeltype_tl +\tcbset +{ + __environment / .style~n~args = { 3 } + { + before~#1* = { \begin{#2} #3 }, + after~#1* = { \end{#2} } + }, + environment~upper / .value~required, + environment~lower / .value~required, + environment~title / .value~required, + environment~upper / .style = { __environment = {upper}{#1}{ } }, + environment~lower / .style = { __environment = {lower}{#1}{ } }, + environment~title / .style = { __environment = {title}{#1}{ } }, + environment~upper~args / .value~required, + environment~lower~args / .value~required, + environment~title~args / .value~required, + environment~upper~args / .style~n~args = { 2 }{ __environment = {upper}{#1}{#2} }, + environment~lower~args / .style~n~args = { 2 }{ __environment = {lower}{#1}{#2} }, + environment~title~args / .style~n~args = { 2 }{ __environment = {title}{#1}{#2} }, +} \cs_new:Npn \__tcobox_label_label:n #1 @@ -965,26 +1002,39 @@ IfBooleanT/.code~n~args={2}{\IfBooleanT{#1}{\pgfkeysalso{#2}}}, IfBooleanF/.code~n~args={2}{\IfBooleanF{#1}{\pgfkeysalso{#2}}}, } -\ExplSyntaxOff - -\def\kvtcb@beforebox{} -\def\kvtcb@afterbox{} \IfFormatAtLeastTF{2023-06-01} { - \def\tcb@set@parbox@indent@{% - \noindent% - \let\tcb@set@parbox@indent\@empty% + \def\tcb@set@parbox@indent@{ + \exp_args:Nne \hook_gput_next_code:nn {para/begin} + { \__tcobox_set_parbox_indent:n { \thetcolorboxnumber } } + \let\tcb@set@parbox@indent\@empty } } { % Note: To be removed in future - \def\tcb@set@parbox@indent@{% - \vspace{-\parskip}\noindent% - \let\tcb@set@parbox@indent\@empty% + \def\tcb@set@parbox@indent@{ + \vspace{-\parskip} + \noindent + \let\tcb@set@parbox@indent\@empty } } +\cs_new_protected:Npn \__tcobox_set_parbox_indent:n #1 + { + \bool_lazy_and:nnT + % if not inside a nested tcolorbox + { \int_compare_p:nNn { #1 } = { \thetcolorboxnumber } } + % and if inside a "tcb@savebox" env (upper or lower part is non-empty), + % hence not at the time of using saved \tcb@upperbox or \tcb@lowerbox + { \cs_if_exist_p:N \tcbbreak } + { + \OmitIndent + } + } + +\ExplSyntaxOff + \def\tcb@parbox@true@indent{}% \def\tcb@parbox@false@indent{% \preto\kvtcb@before@title{\tcb@set@parbox@indent}% @@ -1183,8 +1233,19 @@ \expandafter\let\csname end\kvtcb@savedelimiter\expandafter\endcsname\csname tcb@endupperverbatimanddraw\endcsname% \ifx\kvtcb@savelowerto\@empty% \else% - \tcb@warning{'saveto' and 'savelowerto' cannot be combined. I deactivate 'savelowerto'}% - \tcbset{savelowerto=}% + \iftcb@redirectlowerto% + \tcb@warning{% + 'saveto' and 'redirectlowerto' cannot be combined.\MessageBreak + I deactivate 'redirectlowerto' but retain its\MessageBreak + 'lowerbox' setting}% + \tcb@redirectlowertofalse% + \tcbset{savelowerto=}% + \else% + \tcb@warning{% + 'saveto' and 'savelowerto' cannot be combined.\MessageBreak + I deactivate 'savelowerto'}% + \tcbset{savelowerto=}% + \fi% \fi% \fi% \tcb@startbox% @@ -1462,19 +1523,19 @@ \ExplSyntaxOn \def\tcb@ch@fixed@spacesave { - \fp_set:Nn \l_tmpa_fp { \tcb@space+\tcbheightspace } - \fp_compare:nTF { \l_tmpa_fp < 0 } + \fp_set:Nn \l__tcobox_tmpa_fp { \tcb@space+\tcbheightspace } + \fp_compare:nTF { \l__tcobox_tmpa_fp < 0 } { - \fp_zero_new:N \l_tmpa_fp + \fp_zero:N \l__tcobox_tmpa_fp } { - \fp_compare:nT { \l_tmpa_fp > \tcb@height } + \fp_compare:nT { \l__tcobox_tmpa_fp > \tcb@height } { - \fp_set:Nn \l_tmpa_fp { \tcb@height } + \fp_set:Nn \l__tcobox_tmpa_fp { \tcb@height } } } - \tcbdimto\tcb@space { \fp_to_dim:n { trunc(\l_tmpa_fp,2) } } - \use:x { \exp_not:N\tcb@savespace{\thetcolorboxnumber}{\tcb@space} } + \tcbdimto\tcb@space { \fp_to_dim:n { trunc(\l__tcobox_tmpa_fp,2) } } + \use:e { \exp_not:N\tcb@savespace{\thetcolorboxnumber}{\tcb@space} } \tcbdimto\tcb@height@upper{\ht\tcb@upperbox+\dp\tcb@upperbox+\tcbheightspace} \let\tcbheightspace\tcb@zpt \iftcb@lowerspace @@ -2236,8 +2297,6 @@ \ExplSyntaxOn -\bool_new:N \l__tcobox_prevent_init_overwrite_bool - \cs_new:Npn \__tcobox_process_newtcolorbox:nn #1#2 { \bool_lazy_and:nnF @@ -2257,7 +2316,7 @@ { \tl_set:Nn #1 { #2 } \tl_trim_spaces:N #1 - \tl_set:Nx #1 { \exp_last_unbraced:NV \cs_to_str:N #1 } + \tl_set:Ne #1 { \exp_last_unbraced:NV \cs_to_str:N #1 } } @@ -2324,8 +2383,8 @@ } \NewDocumentCommand \__tcobox_new_TotalTColorBox:w { m +O{} m } { - \__tcobox_set_backslash_removed:Nn \l_tmpa_tl { #3 } - \exp_args:NNnV \__tcobox_new_TotalTColorBox:Nnnnnn #1 {#2} \l_tmpa_tl + \__tcobox_set_backslash_removed:Nn \l__tcobox_tmpa_tl { #3 } + \exp_args:NNnV \__tcobox_new_TotalTColorBox:Nnnnnn #1 {#2} \l__tcobox_tmpa_tl } \NewDocumentCommand \DeclareTotalTColorBox { } { @@ -2368,8 +2427,8 @@ } \NewDocumentCommand \__tcobox_new_tcbox_i:w { m +O{} m } { - \__tcobox_set_backslash_removed:Nn \l_tmpa_tl { #3 } - \exp_args:NNnV \__tcobox_new_tcbox_ii:w #1 {#2} \l_tmpa_tl + \__tcobox_set_backslash_removed:Nn \l__tcobox_tmpa_tl { #3 } + \exp_args:NNnV \__tcobox_new_tcbox_ii:w #1 {#2} \l__tcobox_tmpa_tl } \NewDocumentCommand \newtcbox { } { @@ -2390,8 +2449,8 @@ } \NewDocumentCommand \__tcobox_new_TCBox:w { m +O{} m } { - \__tcobox_set_backslash_removed:Nn \l_tmpa_tl { #3 } - \exp_args:NNnV \__tcobox_new_TCBox:Nnnnn #1 {#2} \l_tmpa_tl + \__tcobox_set_backslash_removed:Nn \l__tcobox_tmpa_tl { #3 } + \exp_args:NNnV \__tcobox_new_TCBox:Nnnnn #1 {#2} \l__tcobox_tmpa_tl } \NewDocumentCommand \DeclareTCBox { } { @@ -2422,8 +2481,8 @@ } \NewDocumentCommand \__tcobox_new_TotalTCBox:w { m +O{} m } { - \__tcobox_set_backslash_removed:Nn \l_tmpa_tl { #3 } - \exp_args:NNnV \__tcobox_new_TotalTCBox:Nnnnnn #1 {#2} \l_tmpa_tl + \__tcobox_set_backslash_removed:Nn \l__tcobox_tmpa_tl { #3 } + \exp_args:NNnV \__tcobox_new_TotalTCBox:Nnnnnn #1 {#2} \l__tcobox_tmpa_tl } \NewDocumentCommand \DeclareTotalTCBox { } { @@ -2494,9 +2553,8 @@ \ifnum\c@tocdepth<1\relax \tcb@warning{'tocdepth'~value~lower~than~1~for~'tcblistof'} \fi - \tl_set:Nx \l_tmpa_tl {\tl_trim_spaces:n{#1}} - \tl_set:Nx \l_tmpb_tl {\str_range:Nnn \l_tmpa_tl {2}{8}} - \str_if_eq:VnT \l_tmpb_tl { chapter } + \tl_set:Ne \l__tcobox_tmpa_tl {\tl_trim_spaces:n{#1}} + \str_if_eq:eeT { \str_range:Nnn \l__tcobox_tmpa_tl {2}{8} } { chapter } { \if@twocolumn \@restonecoltrue\onecolumn @@ -2504,8 +2562,7 @@ \@restonecolfalse \fi } - \tl_set:Nx \l_tmpa_tl {\str_item:Nn \l_tmpa_tl {-1}} - \str_if_eq:VnTF \l_tmpa_tl { * } + \str_if_eq:eeTF { \str_item:Nn \l__tcobox_tmpa_tl {-1} } { * } { #1{#4} \IfNoValueTF{#3} @@ -2535,10 +2592,11 @@ % verbatim output as in 'verbatim' -\def\tcb@allocate@tcb@out{% - \newwrite\tcb@out% - \xdef\tcb@allocate@tcb@out{}% -} +\ExplSyntaxOn +\cs_new_protected:Npn \tcb@iow@open { \iow_open:Nn \g__tcobox_out_iow } +\cs_new_protected:Npn \tcb@iow@write { \iow_now:Ne \g__tcobox_out_iow } +\cs_new_protected:Npn \tcb@iow@close { \iow_close:N \g__tcobox_out_iow } +\ExplSyntaxOff \let\tcb@verbatim@begin@hook\@empty \let\tcb@verbatim@end@hook\@empty @@ -2548,20 +2606,17 @@ \def\tcbverbatimwrite#1{% \@bsphack \tcb@set@verbatim@finish% - \tcb@allocate@tcb@out% - \immediate\openout\tcb@out #1 + \tcb@iow@open{#1}% \tcb@verbatim@begin@hook% \let\do\@makeother\dospecials \tcb@verbatim@change@percent\catcode`\^^M\active \catcode`\^^I=12 - \def\verbatim@processline{% - \immediate\write\tcb@out - {\the\verbatim@line}}% + \def\verbatim@processline{\tcb@iow@write{\the\verbatim@line}}% \verbatim@start}%' \def\endtcbverbatimwrite{% \tcb@verbatim@end@hook% - \immediate\closeout\tcb@out + \tcb@iow@close \@esphack% } @@ -2570,12 +2625,12 @@ \cs_new_nopar:Npn \__tcobox_verbatim_finish: { - \tl_set_rescan:Nnx \l_tmpa_tl + \tl_set_rescan:Nne \l__tcobox_tmpa_tl { \char_set_catcode_space:n { 9 } \char_set_catcode_space:n { 32 } } { \the\verbatim@line } - \tl_if_blank:VF \l_tmpa_tl + \tl_if_blank:VF \l__tcobox_tmpa_tl { \verbatim@processline } @@ -2646,36 +2701,42 @@ % recording -\def\tcb@allocate@tcb@record@out{% - \newwrite\tcb@record@out% - \xdef\tcb@allocate@tcb@record@out{}% -} - +\ExplSyntaxOn -\def\tcb@null#1{} -\newcommand{\tcb@record}[1]{\immediate\write\tcb@record@out{#1}} +\cs_new_protected:Npn \__tcobox_record:n #1 + { + \iow_now:Ne \g__tcobox_record_iow { #1 } + } -\newcommand{\tcbstartrecording}[1][\jobname.records]{% - \let\tcbrecord\tcb@record% - \edef\tcb@record@file{#1}% - \tcb@allocate@tcb@record@out% - \immediate\openout\tcb@record@out\tcb@record@file% -} +\NewDocumentCommand \tcbstartrecording { O{\jobname.records} } + { + \cs_set_eq:NN \tcbrecord \__tcobox_record:n + \str_set:Ne \l__tcobox_record_file_str { #1 } + \iow_open:Nn \g__tcobox_record_iow { \l__tcobox_record_file_str } + } -\newcommand{\tcbstoprecording}{% - \immediate\closeout\tcb@record@out% - \let\tcbrecord\tcb@null% -} +\NewDocumentCommand \tcbstoprecording { } + { + \iow_close:N \g__tcobox_record_iow + \cs_set_eq:NN \tcbrecord \use_none:n + } -\tcbset{% +\tcbset{ record/.style={phantom={\tcbrecord{#1}}}, - no recording/.code={\let\tcbrecord\tcb@null}, - no recording + no~recording/.code={ \cs_set_eq:NN \tcbrecord \use_none:n }, + no~recording } -\newcommand{\tcbinputrecords}[1][\tcb@record@file]{% - \IfFileExists{#1}{\input{#1}}{\tcb@error{record file `#1' not found}{The record file `#1' was not found}}% -} +\NewDocumentCommand \tcbinputrecords { O{\l__tcobox_record_file_str} } + { + \file_if_exist_input:nF {#1} + { + \tcb@error{record~file~`#1'~not~found} + {The~record~file~`#1'~was~not~found} + } + } + +\ExplSyntaxOff \tcb@new@skin{standard}{frame engine=standard,interior titled engine=standard, interior engine=standard,segmentation engine=standard,title engine=standard, |