summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mdframed
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-04-26 00:11:23 +0000
committerKarl Berry <karl@freefriends.org>2010-04-26 00:11:23 +0000
commit29987447c7006b1437decf63c0d8bd59ebe41f90 (patch)
tree51e0899c567ccc1b0a219dc36776cc675c9d0fa4 /Master/texmf-dist/tex/latex/mdframed
parent4c52c05c509c887e64f691a2ce5859f514a740c3 (diff)
mdframed 0.3a (24apr10)
git-svn-id: svn://tug.org/texlive/trunk@17993 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/mdframed')
-rw-r--r--Master/texmf-dist/tex/latex/mdframed/mdframed.sty379
1 files changed, 200 insertions, 179 deletions
diff --git a/Master/texmf-dist/tex/latex/mdframed/mdframed.sty b/Master/texmf-dist/tex/latex/mdframed/mdframed.sty
index 3d3da715f4b..84b1ed38ca2 100644
--- a/Master/texmf-dist/tex/latex/mdframed/mdframed.sty
+++ b/Master/texmf-dist/tex/latex/mdframed/mdframed.sty
@@ -36,7 +36,7 @@
\def\mdframedpackagename{mdframed}
\def\md@PackageWarning#1{\PackageWarning{\mdframedpackagename}{#1}}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mdframed}[2010/04/16 v0.3: mdframed]
+\ProvidesPackage{mdframed}[2010/04/23 v0.3a: mdframed]
%%==================================================%%
%%=============== Benoetigte Pakete ================%%
@@ -48,10 +48,10 @@
\md@PackageWarning{The package kvoptions.sty does not exist\MessageBreak
but it is requiered by \mdframedpackagename}%
}
-\IfFileExists{picture.sty}{%
- \RequirePackage[etex]{picture}
+\IfFileExists{etex.sty}{%
+ \RequirePackage{etex}
}{%
- \md@PackageWarning{The package picture does not exist\MessageBreak
+ \md@PackageWarning{The package etex does not exist\MessageBreak
but it is requiered by \mdframedpackagename}%
}
@@ -77,15 +77,45 @@
\DeclareStringOption[white]{backgroundcolor}
\DeclareStringOption[black]{fontcolor}
\DeclareStringOption[20pt]{margin}
-\DeclareStringOption[\z@]{skipabove}
-\DeclareStringOption[\z@]{skipbelow}
+\DeclareStringOption[\baselineskip]{skipabove}
+\DeclareStringOption[\baselineskip]{skipbelow}
\DeclareStringOption[none]{xcolor}
+\DeclareStringOption[pt]{defaultunit}
+
+\DeclareStringOption[0pt]{leftmargin}
+\DeclareStringOption[0pt]{rightmargin}
+
+\DeclareBoolOption{ntheorem}
+
\ProcessKeyvalOptions*
+%%==================================================%%
+%%========Hilfsmakro zur Bestimmung ob Laenge=======%%
+%%============= IDEE: Martin Scharrer ==============%%
+%%==================================================%%
+
+
+%%%\md@iflength{<EINGABE>}{<IST LAENGE>}{<IST KEINE LAENGE>}
+\newlength{\md@templength}
+\def\md@iflength#1{%
+ \afterassignment\md@iflength@check%
+ \md@templength=#1\mdf@defaultunit\relax\relax
+ \expandafter\endgroup\next
+}
+\def\md@iflength@check#1{%
+ \begingroup
+ \ifx\relax#1\@empty
+ \def\next{\@secondoftwo}
+ \else
+ \def\next{\@firstoftwo}
+ \expandafter\md@iflength@cleanup
+ \fi
+}
+\def\md@iflength@cleanup#1\relax{}
+
%%==================================================%%
%%========Sicherstellen der key-value-Syntax========%%
-%%================ HIER DER GLOABEL ================%%
%%==================================================%%
\AtBeginDocument{
\@ifpackageloaded{xcolor}{%
@@ -100,123 +130,58 @@
}
}
-
-\newcommand*\mdf@get@linewidth[1]{%
- \begingroup
- \unitlength=1pt\relax
- \@tempdima#1\unitlength
- \edef\mdf@GET@linewidth{\endgroup\@tempdima=\the\@tempdima}%
- \mdf@GET@linewidth
-}
-\picture@redefine\mdf@get@linewidth{&1}
+%%%Laengentests
+%%\mdf@linewidth
\begingroup
- \mdf@get@linewidth{\mdf@linewidth}
- \global\edef\mdf@linewidth{\the\@tempdima}
+\let\@tempa\mdf@linewidth
+\md@iflength{\@tempa}{}{\global\edef\mdf@linewidth{\the\md@templength}}
\endgroup
-
-
-\newcommand*\mdf@get@margin[1]{%
- \begingroup
- \unitlength=1pt\relax
- \@tempdima#1\unitlength
- \edef\mdf@GET@margin{\endgroup\@tempdima=\the\@tempdima}%
- \mdf@GET@margin
-}
-\picture@redefine\mdf@get@margin{&1}
+%%\mdf@margin
\begingroup
- \mdf@get@margin{\mdf@margin}
- \global\edef\mdf@margin{\the\@tempdima}
+\let\@tempa\mdf@margin
+\md@iflength{\@tempa}{}{\global\edef\mdf@margin{\the\md@templength}}
\endgroup
+%%\mdf@skipabove
+\begingroup
+\let\@tempa\mdf@skipabove
+\md@iflength{\@tempa}{}{\global\edef\mdf@skipabove{\the\md@templength}}
+\endgroup
-\newcommand*\mdf@get@skipabove[1]{%
- \begingroup
- \unitlength=1pt\relax
- \@tempdima#1\unitlength
- \edef\mdf@GET@skipabove{\endgroup\@tempdima=\the\@tempdima}%
- \mdf@GET@skipabove
-}
-\picture@redefine\mdf@get@skipabove{&1}
+%%\mdf@skipbelow
\begingroup
- \mdf@get@skipabove{\mdf@skipabove}
- \global\edef\mdf@skipabove{\the\@tempdima}
+\let\@tempa\mdf@skipbelow
+\md@iflength{\@tempa}{}{\global\edef\mdf@skipbelow{\the\md@templength}}
\endgroup
+%%\mdf@leftmargin
+\begingroup
+\let\@tempa\mdf@leftmargin
+\md@iflength{\@tempa}{}{\global\edef\mdf@leftmargin{\the\md@templength}}
+\endgroup
-\newcommand*\mdf@get@skipbelow[1]{%
- \begingroup
- \unitlength=1pt\relax
- \@tempdima#1\unitlength
- \edef\mdf@GET@skipbelow{\endgroup\@tempdima=\the\@tempdima}%
- \mdf@GET@skipbelow
-}
-\picture@redefine\mdf@get@skipbelow{&1}
+%%\mdf@rightmargin
\begingroup
- \mdf@get@skipbelow{\mdf@skipbelow}
- \global\edef\mdf@skipbelow{\the\@tempdima}
+\let\@tempa\mdf@rightmargin
+\md@iflength{\@tempa}{}{\global\edef\mdf@rightmargin{\the\md@templength}}
\endgroup
+
%%==================================================%%
-%%========Sicherstellen der key-value-Syntax========%%
-%%================ HIER DIE LOKALEN ================%%
+%%==Deklaration diverser Eingabe und Hilfsparameter=%%
%%==================================================%%
-\define@key{mdframed}{linecolor}[\mdf@linecolor]{%
- \def\md@@linecolor{\color{#1}}
-}
-
-
-\define@key{mdframed}{backgroundcolor}[\mdf@backgroundcolor]{%
- \mdbackgroundcolor{#1}
-}
-
-\define@key{mdframed}{fontcolor}[\mdf@fontcolor]{%
- \mdfontcolor{#1}
- \def\md@@fontcolor{\color{#1}}
-}
-
-\newcommand*\md@linewidth{}
-\define@key{mdframed}{linewidth}[2pt]{%
- \md@get@linewidth{#1}
- \edef\md@linewidth{\the\@tempdima}
- \md@framed@linewidth\md@linewidth
-}
-\newcommand*\md@get@linewidth[1]{%
- \begingroup
- \unitlength=1pt\relax
- \@tempdima#1\unitlength
- \edef\md@GET@linewidth{\endgroup\@tempdima=\the\@tempdima}%
- \md@GET@linewidth
-}
-\picture@redefine\md@get@linewidth{&1}
-
-
-
-\newcommand*\md@margin{}
-\define@key{mdframed}{margin}[10pt]{%
- \md@get@margin{#1}
- \edef\md@margin{\the\@tempdima}
- \md@framed@margin\md@margin
-}
-\newcommand*\md@get@margin[1]{%
- \begingroup
- \unitlength=1pt\relax
- \@tempdima#1\unitlength
- \edef\md@GET@margin{\endgroup\@tempdima=\the\@tempdima}%
- \md@GET@margin
-}
-\picture@redefine\md@get@margin{&1}
-
+\newskip\md@framed@margin \md@framed@margin\mdf@margin %% Abstand |Links<INHALTE>Rechts|
+\newskip\md@framed@linewidth \md@framed@linewidth\mdf@linewidth %% Dicke der Linie
+\newskip\md@framed@leftmargin \md@framed@leftmargin\mdf@leftmargin %% Laenge des Linken Abstandes |<->|TEXT...
+\newskip\md@framed@rightmargin \md@framed@rightmargin\mdf@rightmargin %% Laenge des Linken Abstandes ...TEXT|<->|
-%%==================================================%%
-%%==Deklaration diverser Eingabe und Hilfsparameter=%%
-%%==================================================%%
-
-\newskip\md@framed@margin \md@framed@margin\mdf@margin %% Abstand |Links<INHALTE>Rechts|
-\newskip\md@framed@linewidth \md@framed@linewidth\mdf@linewidth %% Dicke der Linie
+\newskip\md@outsidemargin \md@outsidemargin\mdf@leftmargin %% Hilfslaenge -- Speicherung des gesamt
+ %% vorgebenen left-right-margin
+ \advance\md@outsidemargin\mdf@rightmargin
\newcommand\mdframedabovespace[1]{\def\md@space@above@frame{#1}}
@@ -233,25 +198,30 @@
\newif\ifmd@box@empty \md@box@emptyfalse %% Ifabfrage, die prueft, ob der Inhalt einer Box leer ist
%% default - ist nicht leer
-\newcommand\mdbackgroundcolor[1]{\def\md@backgroundcolor{#1}} %% User-Command - Hintergrundfarbe
+\def\md@@linecolor{\color{\mdf@linecolor}} %% Abkuerzungskommando Linienfarbe
+
+\def\md@@fontcolor{\color{\mdf@fontcolor}} %% Abkuerzungskommando Schriftfarbe
-\newcommand\mdlinecolor[1]{\def\md@linecolor{#1}} %% User-Command - Linienfarbe
-\def\md@@linecolor{\color{\mdf@linecolor}} %% Abkuerzungskommando
+\def\md@@backgroundcolor{\color{\mdf@backgroundcolor}}%% Abkuerzungskommando Hintergrundfarbe
-\newcommand\mdfontcolor[1]{\def\md@fontcolor{#1}}
-\def\md@@fontcolor{\color{\mdf@fontcolor}}
-\mdbackgroundcolor{\mdf@backgroundcolor}
-\mdlinecolor{\mdf@linecolor}
%%==================================================%%
%%===Globale Umgebung -- noch keine Modifikation ===%%
%%==================================================%%
\newenvironment{mdframed}[1][]% default-Umgebung
- {\setkeys{mdframed}{#1}%
- \vskip\mdf@skipabove
+ {\setkeys{mdf}{#1}%
+ \addvspace{\mdf@skipabove}%
+ \ifmdf@ntheorem
+ \ifdefined\theorempreskipamount
+ \theorempreskipamount0pt
+ \theorempostskipamount0pt
+ \else
+ {\md@PackageWarning{You haven not loaded ntheorem yet}}%
+ \fi%
+ \fi%
\mdframed@global@env}%
- {\endmdframed@global@env\vskip\mdf@skipbelow}
+ {\endmdframed@global@env\addvspace{\mdf@skipbelow}}
@@ -268,10 +238,12 @@
%%==================================================%%
%%================= Breite der BOX =================%%
%%==================================================%%
-\def\md@margin@equation{% %% Berechnung der moeglichen Breite fuer den Rahmeninhalt
- \advance\hsize by -\md@framed@margin %% hsize minus Randvorgabe
- \advance\hsize by -2\md@framed@linewidth %% hsize minus Linienbreite
- \advance\hsize by -\width\md@arrayparboxrestore}%% Beruecksichtigung das Auszaehlung bzw. list-Umgebung enthalten
+\def\md@margin@equation{% %% Berechnung der moeglichen Breite fuer den Rahmeninhalt
+ \advance\hsize by - \md@framed@margin %% hsize minus Randvorgabe
+ \advance\hsize by -2\md@framed@linewidth %% hsize minus Linienbreite
+ \advance\hsize by - \mdf@leftmargin %% hsize minus gewuenschten linken Abstand
+ \advance\hsize by - \mdf@rightmargin %% hsize minus gewuenschten linken Abstand
+ \advance\hsize by - \width\md@arrayparboxrestore}%% Beruecksichtigung das Auszaehlung bzw. list-Umgebung enthalten
%%==================================================%%
%%===Bestimmung des Platzbedarfes fuer den Rahmen===%%
@@ -500,86 +472,117 @@
%%==================================================%%
%%=Ausgabe der Box nach Vorgabe der Ausagaberoutine=%%
%%==================================================%%
+
\let\md@textwidth\textwidth
-\def\md@putbox@single{%%%%% Ausgabe der ungesplitteten Gesamtbox
- \ifvoid\@tempboxa
- \else
- \centerline{%
- \rlap{\color{\md@backgroundcolor}%
+
+
+%%=single=%%
+\def\md@frame@background@single{%
+ \rlap{\color{\mdf@backgroundcolor}%
\setlength{\fp@putboxa@length@md}{\ht\@tempboxa}%
\addtolength{\fp@putboxa@length@md}{\baselineskip}%
\addtolength{\fp@putboxa@length@md}{\md@framed@linewidth}%
- \rule[-0.5\baselineskip]{\md@textwidth}{\fp@putboxa@length@md}%
- }%
- \setlength{\fp@putboxa@length@md}{\ht\@tempboxa}%
- \addtolength{\fp@putboxa@length@md}{0.5\baselineskip}%
- \rlap{\md@@linecolor%
- \vrule width \md@framed@linewidth height \fp@putboxa@length@md%
- \rule[-0.5\baselineskip-\md@framed@linewidth]{\hsize-2\md@framed@linewidth}{\md@framed@linewidth}%
- }%
- \hfill%
- {\box\@tempboxa}%
- \hfill%
- \llap{\md@@linecolor%
- \llap{%
- \rule[-0.5\baselineskip-\md@framed@linewidth]{0pt}{\md@framed@linewidth}%
- \vrule width \md@framed@linewidth height \fp@putboxa@length@md}%
- }%
- \llap{\md@@linecolor\rule[\fp@putboxa@length@md]{\hsize}{\md@framed@linewidth}}%
+ \rule[-0.5\baselineskip]{\md@textwidth-\md@outsidemargin}{\fp@putboxa@length@md}%
}%
+}%
+
+\def\md@frame@leftandbottomline@single{%
+ \setlength{\fp@putboxa@length@md}{\ht\@tempboxa}%
+ \addtolength{\fp@putboxa@length@md}{0.5\baselineskip}%
+ \rlap{\md@@linecolor\vrule width \md@framed@linewidth height \fp@putboxa@length@md depth 0.5\baselineskip}%
+ \rlap{\md@@linecolor\rule[-0.5\baselineskip-\md@framed@linewidth]{\md@textwidth-\md@outsidemargin}{\md@framed@linewidth}%
+ }%
+}%
+
+\def\md@frame@topandrightline@single{%
+ \llap{\md@@linecolor\vrule width \md@framed@linewidth height \fp@putboxa@length@md depth 0.5\baselineskip}%
+ \llap{\md@@linecolor\rule[\fp@putboxa@length@md]{\md@textwidth-\md@outsidemargin}{\md@framed@linewidth}}%
+}%
+
+
+\def\md@putbox@single{%%%%% Ausgabe der ungesplitteten Gesamtbox
+ \ifvoid\@tempboxa
+ \else
+ \centerline{%
+ \null\hspace*{\md@framed@leftmargin}%
+ \md@frame@background@single%
+ \md@frame@leftandbottomline@single%
+ \hfill{\box\@tempboxa}\hfill%
+ \md@frame@topandrightline@single%
+ \hspace*{\mdf@rightmargin}\null%
+ }%
\fi
}
-\def\md@putbox@first{%%%% Ausgabe der Teilbox 1
- \centerline{%
- \rlap{\color{\md@backgroundcolor}%
+%%=first=%%
+
+\def\md@frame@background@first{%
+ \rlap{\color{\mdf@backgroundcolor}%
\setlength{\fp@putboxa@length@md}{\ht\tw@}%
\addtolength{\fp@putboxa@length@md}{0.5\baselineskip}%
\addtolength{\fp@putboxa@length@md}{-\md@framed@linewidth}%
- \rule{\md@textwidth}{\fp@putboxa@length@md}%
+ \rule{\md@textwidth-\md@outsidemargin}{\fp@putboxa@length@md}%
}%
- \setlength{\fp@putboxa@length@md}{\ht\tw@}%
- \addtolength{\fp@putboxa@length@md}{0.5\baselineskip}%
- \rlap{\md@@linecolor%
- \vrule width \md@framed@linewidth height \fp@putboxa@length@md%
- \rule[\fp@putboxa@length@md-\md@framed@linewidth]{\hsize-\md@framed@linewidth}{\md@framed@linewidth}%
- }%
- \hfill%
- {\box\tw@}%
- \hfill%
- \llap{\md@@linecolor%
- \vrule width \md@framed@linewidth height \fp@putboxa@length@md%
- }%
- }%% ??? \centerline bad idea
+}%
+
+\def\md@frame@topandleftline@first{%
+ \setlength{\fp@putboxa@length@md}{\ht\tw@}%
+ \addtolength{\fp@putboxa@length@md}{0.5\baselineskip}%
+ \rlap{\md@@linecolor \vrule width \md@framed@linewidth height \fp@putboxa@length@md%
+ \rule[\fp@putboxa@length@md-\md@framed@linewidth]{\hsize-\md@framed@linewidth-\md@outsidemargin}{\md@framed@linewidth}%
+ }%
+}%
+
+\def\md@frame@rightline@first{%
+ \llap{\md@@linecolor \vrule width \md@framed@linewidth height \fp@putboxa@length@md}%
+}%
+
+
+
+\def\md@putbox@first{%%%% Ausgabe der Teilbox 1
+ \centerline{%
+ \null\hspace*{\mdf@leftmargin}%
+ \md@frame@background@first%
+ \md@frame@topandleftline@first%
+ \hfill{\box\tw@}\hfill%
+ \md@frame@rightline@first%
+ \null\hspace*{\mdf@rightmargin}\null%
+ }%
}
+%%=second=%%
+
+\def\md@frame@background@second{%
+ \rlap{\color{\mdf@backgroundcolor}%
+ \setlength{\fp@putboxa@length@md}{\ht\@tempboxa}%
+ \addtolength{\fp@putboxa@length@md}{0.7\baselineskip}%
+ \rule[-0.5\baselineskip]{\md@textwidth-\md@outsidemargin}{\fp@putboxa@length@md}%
+ }%
+}%
+
+\def\md@frame@leftandbottomline@second{%
+ \setlength{\fp@putboxa@length@md}{\ht\@tempboxa}%
+ \addtolength{\fp@putboxa@length@md}{0.2\baselineskip}% %Linienueberschuss auf zweiter Seite -- derzeit 0pt
+ \rlap{\md@@linecolor \vrule width \md@framed@linewidth height \fp@putboxa@length@md depth 0.5\baselineskip}%
+ \rlap{\md@@linecolor \rule[-0.5\baselineskip-\md@framed@linewidth]{\md@textwidth-\md@outsidemargin}{\md@framed@linewidth}}%
+}%
+
+\def\md@frame@rightline@second{%
+ \llap{\md@@linecolor\vrule width \md@framed@linewidth height \fp@putboxa@length@md depth 0.5\baselineskip}%
+}%
\def\md@putbox@second{%%%%% Ausgabe der Teilbox 2
\ifvoid\@tempboxa
\else
\centerline{%
- \rlap{\color{\md@backgroundcolor}%
- \setlength{\fp@putboxa@length@md}{\ht\@tempboxa}%
- \addtolength{\fp@putboxa@length@md}{.7\baselineskip}%
- \addtolength{\fp@putboxa@length@md}{\md@framed@linewidth}%
- \rule[-0.5\baselineskip-\md@framed@linewidth]{\md@textwidth}{\fp@putboxa@length@md}%
- }%
- \setlength{\fp@putboxa@length@md}{\ht\@tempboxa}%
- \addtolength{\fp@putboxa@length@md}{0.2\baselineskip}% %Linienueberschuss auf zweiter Seite
- \rlap{\md@@linecolor%
- \vrule width \md@framed@linewidth height \fp@putboxa@length@md%
- \rule[-0.5\baselineskip-\md@framed@linewidth]{\hsize-2\md@framed@linewidth}{\md@framed@linewidth}%
- }%
- \hfill%
- {\box\@tempboxa}%
- \hfill%
- \llap{\md@@linecolor%
- \llap{%
- \rule[-0.5\baselineskip-\md@framed@linewidth]{0pt}{\md@framed@linewidth}%
- \vrule width \md@framed@linewidth height \fp@putboxa@length@md}%
- }%
- }%
+ \null\hspace*{\mdf@leftmargin}%
+ \md@frame@background@second%
+ \md@frame@leftandbottomline@second%
+ \hfill{\box\@tempboxa}\hfill%
+ \md@frame@rightline@second%
+ \hspace*{\mdf@rightmargin}\null%
+ }%
\fi
}
@@ -614,7 +617,7 @@
-%%%%%KEINE AHNUNG
+
\catcode`\|=\md@arrayparboxrestore %%%????
@@ -657,5 +660,23 @@
\sloppy
}
+%%==================================================%%
+%%== Sicherstellen das Optionen nur global setzbar==%%
+%%==================================================%%
+
+\DisableKeyvalOption[%
+ action=warning,
+ package=mdframed,
+]{mdf}{skipabove}%
+
+\DisableKeyvalOption[%
+ action=warning,
+ package=mdframed,
+]{mdf}{skipbelow}%
+
+\DisableKeyvalOption[%
+ action=warning,
+ package=mdframed,
+]{mdf}{xcolor}%
\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%