diff options
author | Karl Berry <karl@freefriends.org> | 2020-07-19 21:27:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-07-19 21:27:08 +0000 |
commit | 9be6d4cf0be6243c0865902d6c3773cc71cd2e84 (patch) | |
tree | c58b1cebb63873431e2feb70ef1d29615c07e2c8 /Master/texmf-dist/tex/latex/lwarp/lwarp-tcolorbox.sty | |
parent | d1db3fa487f34051ad216f6261b36f0086a729f2 (diff) |
lwarp (19jul20)
git-svn-id: svn://tug.org/texlive/trunk@55880 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/lwarp/lwarp-tcolorbox.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/lwarp/lwarp-tcolorbox.sty | 252 |
1 files changed, 252 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/lwarp/lwarp-tcolorbox.sty b/Master/texmf-dist/tex/latex/lwarp/lwarp-tcolorbox.sty new file mode 100644 index 00000000000..3cf73947475 --- /dev/null +++ b/Master/texmf-dist/tex/latex/lwarp/lwarp-tcolorbox.sty @@ -0,0 +1,252 @@ +%% +%% This is file `lwarp-tcolorbox.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% lwarp.dtx (with options: `tcolorbox') +%% This is a generated file. +%% Copyright 2016-2020 Brian Dunn +%% +%% 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. +\LWR@ProvidesPackagePass{tcolorbox}[2020/04/28] +\newbool{LWR@havetcblower} +\boolfalse{LWR@havetcblower} +\newcommand{\LWR@tcolorbox@findcolors}{% + \convertcolorspec{named}{tcbcolback}{HTML}\LWR@tcbcolback + \convertcolorspec{named}{tcbcolframe}{HTML}\LWR@tcbcolframe + \iftcb@titlefilled% + \convertcolorspec{named}{tcbcolbacktitle}{HTML}\LWR@tcbcolbacktitle + \else + \convertcolorspec{named}{tcbcolframe}{HTML}\LWR@tcbcolbacktitle + \fi + \convertcolorspec{named}{tcbcoltitle}{HTML}\LWR@tcbcoltitle + \convertcolorspec{named}{tcbcolupper}{HTML}\LWR@tcbcolupper + \convertcolorspec{named}{tcbcollower}{HTML}\LWR@tcbcollower +} + +\newcommand*{\LWR@tcolorbox@titlecolorstyles}{% + border-top: 1px solid \LWR@origpound\LWR@tcbcolframe ; + border-bottom: 1px solid \LWR@origpound\LWR@tcbcolframe ; + background: \LWR@origpound\LWR@tcbcolbacktitle ; + color: \LWR@origpound\LWR@tcbcoltitle ; +} +\newcommand*{\LWR@showtitle@}[1]{% + \begin{BlockClass}[ + \LWR@tcolorbox@titlecolorstyles + ]{tcolorboxtitle} + \kvtcb@before@title#1\kvtcb@after@title + \end{BlockClass} +} +\newcommand*{\LWR@showtitle}[1]{% + \iftcb@titlevisible + \LWR@showtitle@{#1} + \else + \LWR@showtitle@{~} + \fi +} + +\newcommand*{\LWR@tcolorbox@dophantom}{% + \kvtcb@phantom + \let\kvtcb@phantom\@empty% +} +\newcommand*{\LWR@tcolorboxstart}[1]{ + \LWR@tcolorbox@findcolors + \begin{BlockClass}[ + border: 1px solid \LWR@origpound\LWR@tcbcolframe ; + background: \LWR@origpound\LWR@tcbcolback ; + ]{#1} + \LWR@tcolorbox@dophantom% + \ifdefvoid{\kvtcb@title} + {} + { + \LWR@showtitle{\kvtcb@title} + } + \begin{BlockClass}[ + color: \LWR@origpound\LWR@tcbcolupper ; + ]{tcolorboxupper} +} +\newcommand*{\LWR@tcolorbox@dostartfloat}{% + \ifx\kvtcb@float\@empty% + \else% + \tcb@float@env@begin{tcbfloat}[\kvtcb@float] + \noexpand\kvtcb@everyfloat + \fi% +} + +\newcommand*{\LWR@tcolorbox@doendfloat}{% + \ifx\kvtcb@float\@empty% + \else% + \tcb@float@env@end% + \fi% +} +\renewenvironment{tcolorbox}[1][] + { + \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% + { + \PackageError{lwarp} + {% + Lwarp cannot process a tcolorbox inside a lateximage\MessageBreak + or SVG math.\MessageBreak + Enter 'H' for possible solutions% + } + {% + Use \protect\tcbox, \protect\tcboxmath, or + \protect\tcbhighmath\space instead.\MessageBreak% + (Inside math, you probably want to use these anyhow.)% + } + }{} + \LWR@printpendingfootnotes + \tcb@layer@inc + \tcb@apply@box@options{#1} + \LWR@tcolorbox@dostartfloat% + \boolfalse{LWR@havetcblower} + \LWR@tcolorboxstart{tcolorbox} + \tcb@insert@before@upper% + } + { + \ifbool{LWR@havetcblower}{% + \tcb@insert@after@lower% + }{% + \tcb@insert@after@upper% + }% + \end{BlockClass} + \LWR@printpendingfootnotes + \tcb@layer@dec + \end{BlockClass} + \LWR@tcolorbox@doendfloat% + } +\newcommand{\tcblower}{ + \tcb@insert@after@upper% + \end{BlockClass} + \begin{BlockClass}[% + border-top: 1px dashed \LWR@origpound\LWR@tcbcolframe ; + color: \LWR@origpound\LWR@tcbcollower ; + ]{tcolorboxlower} + \tcb@insert@before@lower% +} +\AtBeginDocument{ +\ifdef{\tcbline}{ + \newcommand*{\LWR@sub@tcbline}{% + \begin{BlockClass}{hrule} + \end{BlockClass} + } + \newcommand{\LWR@HTML@tcbline}{\@ifstar\LWR@sub@tcbline\LWR@sub@tcbline} + \LWR@formatted{tcbline} +}{} +} + +\newcommand{\LWR@HTML@tcbox}[2][]{ + \LWR@printpendingfootnotes + \LWR@tcolorbox@dostartfloat% + \begingroup + \tcb@layer@inc + \tcb@apply@box@options{#1} + \boolfalse{LWR@havetcblower} + \LWR@tcolorboxstart{tcolorbox inlineminipage} + \tcb@insert@before@upper% + #2 + \ifbool{LWR@havetcblower}{% + \tcb@insert@after@lower% + }{% + \tcb@insert@after@upper% + }% + \end{BlockClass} + \LWR@printpendingfootnotes + \end{BlockClass} + \tcb@layer@dec% + \endgroup% + \LWR@tcolorbox@dostartfloat% + \global\booltrue{LWR@minipagethispar}% +} +\LWR@formatted{tcbox} + +\appto\LWR@restoreMathJaxformatting{% + \renewcommand{\tcbox}[2][]{#2}% +} +\xpatchcmd{\tcbsubtitle} + {\begingroup} + {\begingroup\let\kvtcb@title\relax\begin{BlockClass}{tcolorboxsubtitle}} + {} + {\LWR@patcherror{tcolorbox}{tcbsubtitle}} + +\xpatchcmd{\tcbsubtitle} + {\endgroup} + {\end{BlockClass}\endgroup} + {} + {\LWR@patcherror{tcolorbox}{tcbsubtitleB}} +\AtBeginDocument{ + \ifdef{\tcboxfit}{% + \let\LWR@HTML@tcboxfit\tcbox% + \LWR@formatted{tcboxfit} + }{} +} +\LetLtxMacro\LWR@HTML@tcbtitle\tcbtitle +\xpatchcmd{\LWR@HTML@tcbtitle} + {\kvtcb@before@title\tcbtitletext} + {\kvtcb@before@title\LWR@textcurrentfont{\LWR@textcurrentcolor{\tcbtitletext}}} + {} + {\LWR@patcherror{tcolorbox}{LWR@HTML@tcbtitle}} +\LWR@formatted{tcbtitle} +\renewcommand*\l@tcolorbox[2]{\hypertocfloat{1}{tcolorbox}{lof}{#1}{#2}} +\AtBeginDocument{ +\pgfkeysifdefined{/tcb/libload/theorems}{ + + \def\LWR@HTML@tcb@hack@amsmath{% + \PackageError{lwarp} + {% + tcolorbox ``math'', ``ams equation'', and related\MessageBreak + are not supported.\MessageBreak + \protect\tcboxmath\space and + \protect\tcbhighmath\space are emulated.\MessageBreak + Enter 'H' for possible solutions% + } + {% + Remove tcolorbox math-related options, and instead\MessageBreak + use the usual math environments inside each tcolorbox.% + } + } + \LWR@formatted{tcb@hack@amsmath} + + % Cause an error if using math: + \tcbset{% + math upper/.style={before upper*=\tcb@hack@amsmath,after upper*=$},% + math lower/.style={before lower*=\tcb@hack@amsmath,after lower*=$},% + } + + \appto\LWR@restoreorigformatting{% + \tcbset{% + math upper/.style={before upper*=$\displaystyle,after upper*=$},% + math lower/.style={before lower*=$\displaystyle,after lower*=$},% + }% + } + + \newcommand{\LWR@HTML@tcboxmath}[2][]{#2} + \LWR@formatted{tcboxmath} + \newcommand{\LWR@HTML@tcbhighmath}[2][]{#2} + \LWR@formatted{tcbhighmath} + \appto\LWR@restoreMathJaxformatting{% + \renewcommand{\tcboxmath}[2][]{#2}% + \renewcommand{\tcbhighmath}[2][]{#2}% + } +}{}% theorems loaded +}% AtBeginDocument +\CustomizeMathJax{\newcommand{\tcbset}[1]{}} +\CustomizeMathJax{\newcommand{\tcbsetforeverylayer}[1]{}} +\CustomizeMathJax{\newcommand{\tcbox}[2][]{\boxed{\text{#2}}}} +\CustomizeMathJax{\newcommand{\tcboxfit}[2][]{\boxed{#2}}} +\CustomizeMathJax{\newcommand{\tcblower}{}} +\CustomizeMathJax{\newcommand{\tcbline}{}} +\CustomizeMathJax{\newcommand{\tcbtitle}{}} +\CustomizeMathJax{\newcommand{\tcbsubtitle[2][]{\mathrm{#2}}}} +\CustomizeMathJax{\newcommand{\tcboxmath}[2][]{\boxed{#2}}} +\CustomizeMathJax{\newcommand{\tcbhighmath}[2][]{\boxed{#2}}} +\endinput +%% +%% End of file `lwarp-tcolorbox.sty'. |