Skip to content

Commit

Permalink
Avoid adding \tcbcounter to global hash table (T-F-S#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
muzimuzhi committed Jan 11, 2023
1 parent 9bf2bc3 commit 58007d8
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions tex/latex/tcolorbox/tcolorbox.sty
Original file line number Diff line number Diff line change
Expand Up @@ -2077,36 +2077,35 @@
}

\def\tcb@proc@counter@autoanduse#1{%
\letcs\tcbcounter{tcb@cnt@#1}%
\ifx\kvtcb@new@numberwithin\@empty%
\csxdef{the\tcbcounter}{\expandafter\noexpand\kvtcb@new@format{\tcbcounter}}%
\csxdef{the#1}{\expandafter\noexpand\kvtcb@new@format{#1}}%
\else%
\@addtoreset{\tcbcounter}{\kvtcb@new@numberwithin}%
\csxdef{the\tcbcounter}{\expandafter\noexpand\csname the\kvtcb@new@numberwithin\endcsname .\expandafter\noexpand\kvtcb@new@format{\tcbcounter}}%
\@addtoreset{#1}{\kvtcb@new@numberwithin}%
\csxdef{the#1}{\expandafter\noexpand\csname the\kvtcb@new@numberwithin\endcsname .\expandafter\noexpand\kvtcb@new@format{#1}}%
\fi%
\ifx\kvtcb@new@freestyle\@empty%
\else%
\csxdef{the\tcbcounter}{\kvtcb@new@freestyle}%
\csxdef{the#1}{\kvtcb@new@freestyle}%
\fi%
\global\csletcs{thetcb@cnt@#1}{the\tcbcounter}%
\appto\tcb@new@colopt{,code={\letcs\tcbcounter{tcb@cnt@#1}\letcs\thetcbcounter{thetcb@cnt@#1}\stepcounter{\tcbcounter}\preto\kvtcb@phantom{\addtocounter{\tcbcounter}{-1}\refstepcounter{\tcbcounter}}}}%
\global\csletcs{the#1}{the#1}%
\appto\tcb@new@colopt{,code={\letcs\tcbcounter{#1}\letcs\thetcbcounter{the#1}\stepcounter{\tcbcounter}\preto\kvtcb@phantom{\addtocounter{\tcbcounter}{-1}\refstepcounter{\tcbcounter}}}}%
}

\def\tcb@proc@counter@auto#1{%
\newcounter{tcb@cnt@#1}%
\csxdef{tcb@cnt@#1}{tcb@cnt@#1}%
\newcounter{#1}%
\csxdef{#1}{#1}%
\tcb@proc@counter@autoanduse{#1}%
}

\def\tcb@proc@counter@use#1{%
\csxdef{tcb@cnt@#1}{\kvtcb@new@counter}%
\csxdef{#1}{\kvtcb@new@counter}%
\tcb@proc@counter@autoanduse{#1}%
}

\def\tcb@proc@counter@from#1{%
\csxdef{tcb@cnt@#1}{\kvtcb@new@counter}%
\global\csletcs{thetcb@cnt@#1}{the\kvtcb@new@counter}%
\appto\tcb@new@colopt{,code={\letcs\tcbcounter{tcb@cnt@#1}\letcs\thetcbcounter{thetcb@cnt@#1}\stepcounter{\tcbcounter}\preto\kvtcb@phantom{\addtocounter{\tcbcounter}{-1}\refstepcounter{\tcbcounter}}}}%
\csxdef{#1}{\kvtcb@new@counter}%
\global\csletcs{the#1}{the\kvtcb@new@counter}%
\appto\tcb@new@colopt{,code={\letcs\tcbcounter{#1}\letcs\thetcbcounter{the#1}\stepcounter{\tcbcounter}\preto\kvtcb@phantom{\addtocounter{\tcbcounter}{-1}\refstepcounter{\tcbcounter}}}}%
}

\def\tcb@proc@counter@no#1{%
Expand All @@ -2115,7 +2114,7 @@

\long\def\tcb@proc@options@init#1#2{%
\tcbset{new/.cd,reset@new,#1}%
\tcb@proc@counter{#2}%
\tcb@proc@counter{tcb@cnt@#2}%
\iftcb@resetcounteronoverlays%
\ifcsname resetcounteronoverlays\endcsname%
\ifcsname tcb@cnt@#2\endcsname%
Expand Down

0 comments on commit 58007d8

Please sign in to comment.