summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty')
-rw-r--r--Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty103
1 files changed, 92 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty b/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty
index 31138ec11b4..7be342757ea 100644
--- a/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty
+++ b/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty
@@ -17,6 +17,7 @@
%% version 2005/12/01 or later.
+\RequirePackage{xcolor}% for \convertcolorspec
\LWR@ProvidesPackageDrop{mdframed}
\LWR@origRequirePackage{amsthm}
@@ -55,15 +56,15 @@ box-shadow:
{box-shadow: none ;}
\LWR@orignewline
"}
-\let\hspace\LWR@orighspace%
-\let\rule\LWR@origrule%
+\LetLtxMacro{\hspace}{\LWR@orighspace}%
+\LetLtxMacro\rule\LWR@origrule%
}
\newcommand*{\LWR@mdframedend}{
\LWR@htmldivclassend{\LWR@mdthisenv}
\gdef\LWR@mdthisenv{mdframed}
\LWR@startpars%
}
-\let\LWR@origmdfframedtitleenv\mdfframedtitleenv
+\LetLtxMacro\LWR@origmdfframedtitleenv\mdfframedtitleenv
\newlength{\LWR@titleroundcorner}
@@ -157,14 +158,94 @@ solid
\begin{mdframed}[#1]}%
\AfterEndEnvironment{#2}{\end{mdframed}}%
}
-\let\LWR@origmdtheorem\mdtheorem
-
-\DeclareDocumentCommand{\LWR@mdtheorem}{O{} m o m o}{%
-\LWR@origmdtheorem[#1]{#2}[#3]{#4}[#5]%
-\BeforeBeginEnvironment{#2}{\renewcommand*{\LWR@mdthisenv}{md#2}}%
-}
-
-\let\mdtheorem\LWR@mdtheorem
+\DeclareDocumentCommand{\mdtheorem}{ O{} m o m o }%
+ {\ifcsdef{#2}%
+ {\mdf@PackageWarning{Environment #2 already exits\MessageBreak}}%
+ {%
+ \IfNoValueTF {#3}%
+ {%#3 not given -- number relationship
+ \IfNoValueTF {#5}%
+ {%#3+#5 not given
+ \@definecounter{#2}%
+ \expandafter\xdef\csname the#2\endcsname{\@thmcounter{#2}}%
+ \newenvironment{#2}[1][]{%
+ \refstepcounter{#2}%
+ \ifstrempty{##1}%
+ {\let\@temptitle\relax}%
+ {%
+ \def\@temptitle{\mdf@theoremseparator%
+ \mdf@theoremspace%
+ \mdf@theoremtitlefont%
+ ##1}%
+ \mdf@thm@caption{#2}{{#4}{\csname the#2\endcsname}{##1}}%
+ }%
+ \begin{mdframed}[#1,frametitle={\strut#4\ \csname the#2\endcsname%
+ \@temptitle}]}%
+ {\end{mdframed}}%
+ \newenvironment{#2*}[1][]{%
+ \ifstrempty{##1}{\let\@temptitle\relax}{\def\@temptitle{:\ ##1}}%
+ \begin{mdframed}[#1,frametitle={\strut#4\@temptitle}]}%
+ {\end{mdframed}}%
+ }%
+ {%#5 given -- reset counter
+ \@definecounter{#2}\@newctr{#2}[#5]%
+ \expandafter\xdef\csname the#2\endcsname{\@thmcounter{#2}}%
+ \expandafter\xdef\csname the#2\endcsname{%
+ \expandafter\noexpand\csname the#5\endcsname \@thmcountersep%
+ \@thmcounter{#2}}%
+ \newenvironment{#2}[1][]{%
+ \refstepcounter{#2}%
+ \ifstrempty{##1}%
+ {\let\@temptitle\relax}%
+ {%
+ \def\@temptitle{\mdf@theoremseparator%
+ \mdf@theoremspace%
+ \mdf@theoremtitlefont%
+ ##1}%
+ \mdf@thm@caption{#2}{{#4}{\csname the#2\endcsname}{##1}}%
+ }
+ \begin{mdframed}[#1,frametitle={\strut#4\ \csname the#2\endcsname%
+ \@temptitle}]}%
+ {\end{mdframed}}%
+ \newenvironment{#2*}[1][]{%
+ \ifstrempty{##1}%
+ {\let\@temptitle\relax}%
+ {%
+ \def\@temptitle{\mdf@theoremseparator%
+ \mdf@theoremspace%
+ \mdf@theoremtitlefont%
+ ##1}%
+ \mdf@thm@caption{#2}{{#4}{\csname the#2\endcsname}{##1}}%
+ }%
+ \begin{mdframed}[#1,frametitle={\strut#4\@temptitle}]}%
+ {\end{mdframed}}%
+ }%
+ }%
+ {%#3 given -- number relationship
+ \global\@namedef{the#2}{\@nameuse{the#3}}%
+ \newenvironment{#2}[1][]{%
+ \refstepcounter{#3}%
+ \ifstrempty{##1}%
+ {\let\@temptitle\relax}%
+ {%
+ \def\@temptitle{\mdf@theoremseparator%
+ \mdf@theoremspace%
+ \mdf@theoremtitlefont%
+ ##1}%
+ \mdf@thm@caption{#2}{{#4}{\csname the#2\endcsname}{##1}}%
+ }
+ \begin{mdframed}[#1,frametitle={\strut#4\ \csname the#2\endcsname%
+ \@temptitle}]}%
+ {\end{mdframed}}%
+ \newenvironment{#2*}[1][]{%
+ \ifstrempty{##1}{\let\@temptitle\relax}{\def\@temptitle{:\ ##1}}%
+ \begin{mdframed}[#1,frametitle={\strut#4\@temptitle}]}%
+ {\end{mdframed}}%
+ }%
+\BeforeBeginEnvironment{#2}{\renewcommand*{\LWR@mdthisenv}{md#2}}% new
+\BeforeBeginEnvironment{#2*}{\renewcommand*{\LWR@mdthisenv}{md#2}}% new
+ }%
+ }
\DeclareDocumentCommand\newmdtheoremenv{O{} m o m o }{%
\ifboolexpr{ test {\IfNoValueTF {#3}} and test {\IfNoValueTF {#5}} }%
{\newtheorem{#2}{#4}}{%