summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tcolorbox/tcbtheorems.code.tex
blob: 358fa624bf3acf9e435fe1dd356ac4a4d853643f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
%% The LaTeX package tcolorbox - version 2.40 (2013/07/15)
%% tcbtheorems.code.tex: Code for theorems in colorboxes
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2012 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
%\makeatletter
\tcb@set@library@version{2.40}

\RequirePackage{amsmath}

\def\tcb@hack@amsmath{\tcb@hack@currenvir\vskip-\abovedisplayskip}

\def\tcb@theo@title#1#2#3{%
  \ifdefempty{#2}{\setbox\z@=\hbox{#1}}{\setbox\z@=\hbox{#1~#2}}%
  \def\temp@a{#3}%
  \ifx\temp@a\@empty\relax%
    \unhbox\z@%
  \else%
    \setbox\z@=\hbox{\unhbox\z@:\ }%
    \hangindent\wd\z@%
    \hangafter=1%
    \mbox{\unhbox\z@}#3%
  \fi%
}

\def\tcb@theo@listentry#1#2#3{%
  \def\kvtcb@listentry{\numberline{#2}#3}%
}

\def\tcb@theo@label#1#2{%
  \def\temp@a{#2}%
  \ifx\temp@a\@empty%
  \else%
    \tcbset{label={#1:#2}}%
  \fi%
}

\tcbset{
  theorem/.style args={#1#2#3#4}{%
    step and label={#2}{#4},%
    title={\letcs\tcb@temp{the#2}\tcb@theo@title{#1}{\tcb@temp}{#3}}},%
  math upper/.style={before upper=$\displaystyle,after upper=$},%
  math lower/.style={before lower=$\displaystyle,after lower=$},%
  math/.style={math upper,math lower},%
  ams equation upper/.style={before upper=\tcb@hack@currenvir\equation,after upper=\endequation},%
  ams equation lower/.style={before lower=\tcb@hack@currenvir\equation,after lower=\endequation},%
  ams equation/.style={ams equation upper,ams equation lower},%
  ams equation* upper/.style={before upper=\tcb@hack@currenvir\csname equation*\endcsname,after upper=\endequation},%
  ams equation* lower/.style={before lower=\tcb@hack@currenvir\csname equation*\endcsname,after lower=\endequation},%
  ams equation*/.style={ams equation* upper,ams equation* lower},%
  ams align upper/.style={before upper=\tcb@hack@amsmath\align,after upper=\endalign},%
  ams align lower/.style={before lower=\tcb@hack@amsmath\align,after lower=\endalign},%
  ams align/.style={ams align upper,ams align lower},%
  ams align* upper/.style={before upper=\tcb@hack@amsmath\csname align*\endcsname,after upper=\endalign},%
  ams align* lower/.style={before lower=\tcb@hack@amsmath\csname align*\endcsname,after lower=\endalign},%
  ams align*/.style={ams align* upper,ams align* lower},%
  ams gather upper/.style={before upper=\tcb@hack@amsmath\gather,after upper=\endgather},%
  ams gather lower/.style={before lower=\tcb@hack@amsmath\gather,after lower=\endgather},%
  ams gather/.style={ams gather upper,ams gather lower},%
  ams gather* upper/.style={before upper=\tcb@hack@amsmath\csname gather*\endcsname,after upper=\endgather},%
  ams gather* lower/.style={before lower=\tcb@hack@amsmath\csname gather*\endcsname,after lower=\endgather},%
  ams gather*/.style={ams gather* upper,ams gather* lower},%
  ams nodisplayskip upper/.style={before upper=\vskip-\abovedisplayskip},%
  ams nodisplayskip lower/.style={before lower=\vskip-\abovedisplayskip},%
  ams nodisplayskip/.style={ams nodisplayskip upper,ams nodisplayskip lower},%
  highlight math style/.style={highlight math/.style={notitle,nophantom,#1}},%
}

\newcommand{\newtcbtheorem}[5][]{%
  \newtcolorbox[auto counter,#1]{#2}[3][]{#4,%
    title={\tcb@theo@title{#3}{\thetcbcounter}{##2}},
    list entry={\numberline{\thetcbcounter}##2},%
    code={\tcb@theo@label{#5}{##3}},%
    ##1}%
}


\newcommand{\tcbmaketheorem}[6][]{%
  \def\temp@a{#5}\ifx\temp@a\@empty%
    \newtcbtheorem[#1]{#2}{#3}{#4}{#6}%
  \else%
    \newtcbtheorem[use counter=#5,#1]{#2}{#3}{#4}{#6}%
  \fi%
}

\newtcbox{\tcboxmath}[1][]{nobeforeafter,math upper,tcbox raise base,#1}
\newtcbox{\tcbhighmath}[1][]{highlight math,nobeforeafter,math upper,tcbox raise base,#1}

\tcbset{%
  reset@theorems/.style={%
    highlight math style={colframe=red,colback=yellow!25!white},%
  },
  initialize@reset=reset@theorems,
}