diff options
author | Karl Berry <karl@freefriends.org> | 2010-05-01 23:09:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-05-01 23:09:39 +0000 |
commit | 905e4b59250e7a09de14faed63264e115ea93a8e (patch) | |
tree | b56c25c57799e6d2e58fe8902ef6b6f5dd790919 /Master/texmf-dist/tex/latex | |
parent | c46fedb6ca202978e4d55c800452c32528e40326 (diff) |
mdframed 0.3b (1may10)
git-svn-id: svn://tug.org/texlive/trunk@18071 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/mdframed/mdframed.sty | 286 |
1 files changed, 195 insertions, 91 deletions
diff --git a/Master/texmf-dist/tex/latex/mdframed/mdframed.sty b/Master/texmf-dist/tex/latex/mdframed/mdframed.sty index 84b1ed38ca2..d9d0bae8f0d 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/23 v0.3a: mdframed] +\ProvidesPackage{mdframed}[2010/04/30 v0.3b: mdframed] %%==================================================%% %%=============== Benoetigte Pakete ================%% @@ -130,6 +130,9 @@ } } + + + %%%Laengentests %%\mdf@linewidth \begingroup @@ -169,20 +172,73 @@ %%==================================================%% -%%==Deklaration diverser Eingabe und Hilfsparameter=%% -%%==================================================%% +%%========Sicherstellen der key-value-Syntax========%% +%%================ HIER DIE LOKALEN ================%% +%%==================================================%% +\define@key{mdfl}{linewidth}[\mdf@linewidth]{% +\def\@tempa{#1} +\md@iflength{\@tempa}% + {\global\edef\mdfl@linewidth{\the\md@templength}}% + {\global\edef\mdfl@linewidth{\the\md@templength}} +\let\mdf@linewidth\mdfl@linewidth +} -\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 +\define@key{mdfl}{rightmargin}[\mdf@rightmargin]{% +\def\@tempa{#1} +\md@iflength{\@tempa}% + {\global\edef\mdfl@rightmargin{\the\md@templength}}% + {\global\edef\mdfl@rightmargin{\the\md@templength}} +\let\mdf@rightmargin\mdfl@rightmargin +} -\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|<->| +\define@key{mdfl}{leftmargin}[\mdf@leftmargin]{% +\def\@tempa{#1} +\md@iflength{\@tempa}% + {\global\edef\mdfl@leftmargin{\the\md@templength}}% + {\global\edef\mdfl@leftmargin{\the\md@templength}} +\let\mdf@leftmargin\mdfl@leftmargin +} + +\define@key{mdfl}{margin}[\mdf@margin]{% +\def\@tempa{#1} +\md@iflength{\@tempa}% + {\global\edef\mdfl@margin{\the\md@templength}}% + {\global\edef\mdfl@margin{\the\md@templength}} +\let\mdf@margin\mdfl@margin +} +\define@key{mdfl}{backgroundcolor}[\mdf@backgroundcolor]{% +\def\@tempa{#1} +\let\mdf@backgroundcolor\@tempa\relax +} + +\define@key{mdfl}{linecolor}[\mdf@linecolor]{% +\def\@tempa{#1} +\let\mdf@linecolor\@tempa\relax +} + +\define@key{mdfl}{fontcolor}[\mdf@fontcolor]{% +\def\@tempa{#1} +\let\mdf@fontcolor\@tempa\relax +} + +\define@key{mdfl}{defaultunit}[\mdf@defaultunit]{% +\def\@tempa{#1} +\let\mdf@defaultunit\@tempa\relax +} + +\define@key{mdfl}{ntheorem}[false]{% + \def\@tempa{#1} + \def\md@true{true} + \ifx\@tempa\md@true\relax + \mdf@ntheoremtrue% + \fi +} -\newskip\md@outsidemargin \md@outsidemargin\mdf@leftmargin %% Hilfslaenge -- Speicherung des gesamt - %% vorgebenen left-right-margin - \advance\md@outsidemargin\mdf@rightmargin +%%==================================================%% +%%==Deklaration diverser Eingabe und Hilfsparameter=%% +%%==================================================%% \newcommand\mdframedabovespace[1]{\def\md@space@above@frame{#1}} \mdframedabovespace{\baselineskip} %% Abstand vor der Frame-Umgebung @@ -198,29 +254,29 @@ \newif\ifmd@box@empty \md@box@emptyfalse %% Ifabfrage, die prueft, ob der Inhalt einer Box leer ist %% default - ist nicht leer -\def\md@@linecolor{\color{\mdf@linecolor}} %% Abkuerzungskommando Linienfarbe - -\def\md@@fontcolor{\color{\mdf@fontcolor}} %% Abkuerzungskommando Schriftfarbe - -\def\md@@backgroundcolor{\color{\mdf@backgroundcolor}}%% Abkuerzungskommando Hintergrundfarbe - %%==================================================%% %%===Globale Umgebung -- noch keine Modifikation ===%% %%==================================================%% \newenvironment{mdframed}[1][]% default-Umgebung - {\setkeys{mdf}{#1}% - \addvspace{\mdf@skipabove}% - \ifmdf@ntheorem - \ifdefined\theorempreskipamount - \theorempreskipamount0pt - \theorempostskipamount0pt - \else + {\trivlist\item\relax\endtrivlist% + \vskip -2\topsep% + \vskip -2\parskip% + \vskip -2\partopsep% + \vskip -2\lineskip% + \vspace*{\mdf@skipabove}% + \setkeys{mdfl}{#1}% + \ifmdf@ntheorem% + \ifdefined\theorempreskipamount% + \theorempreskipamount0pt% + \theorempostskipamount0pt% + \else% {\md@PackageWarning{You haven not loaded ntheorem yet}}% \fi% \fi% - \mdframed@global@env}% + \mdframed@global@env% + }% {\endmdframed@global@env\addvspace{\mdf@skipbelow}} @@ -239,10 +295,10 @@ %%================= 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 - \mdf@leftmargin %% hsize minus gewuenschten linken Abstand - \advance\hsize by - \mdf@rightmargin %% hsize minus gewuenschten linken Abstand + \advance\hsize by - \mdf@margin% %% hsize minus Randvorgabe + \advance\hsize by - \mdf@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 %%==================================================%% @@ -253,7 +309,7 @@ \def\md@sizeofframe{\begingroup \setbox\z@\vbox{% \vskip-5in \hbox{\hskip-5in - \fboxsep2\baselineskip\fboxrule\md@framed@linewidth\fbox% + \fboxsep2\baselineskip\fboxrule\mdf@linewidth\fbox% {\hbox{\vrule \@height 4.7in \@depth.3in \@width 5in}}}% \vskip\z@skip}% \global\md@temp@frame@hsize\wd\z@ \global\md@temp@frame@vsize\ht\z@ @@ -263,9 +319,12 @@ %%==================================================%% %%============Start der globalen Umgebung===========%% %%==================================================%% -\def\mdframed@global@env{\par - %Bestimmung zusatzlichen Freiraumes gemaess Vorgabe des Rahmens - \let\width\md@temp@frame@hsize \let\height\md@temp@frame@vsize + +\let\md@hsize\hsize +\def\mdframed@global@env{\par% +% %Bestimmung zusatzlichen Freiraumes gemaess Vorgabe des Rahmens + \let\width\md@temp@frame@hsize + \let\height\md@temp@frame@vsize % Einfuegen von Strafpunkten und Abstaenden \begingroup \skip@\lastskip @@ -303,28 +362,40 @@ \vskip-\skip@ \penalty 1800 \vskip\skip@ \fi \addvspace{\topsep}% - \endgroup + \endgroup% % clear out pending page break \nobreak \vskip 2\baselineskip \vskip\height %%%\@M=10000 \penalty9999 \vskip -2\baselineskip \vskip-\height \penalty9999 % updates \pagetotal - \md@adjheight - \setbox\@tempboxa\vbox\bgroup - \begingroup %%% zweites begingroup noetig, dass fontcolor gesetzt werden kann - \md@@fontcolor %%% Setzen der Schriftfarbe - \md@margin@equation - \textwidth\hsize \columnwidth\hsize +%%%%SIEHE LATEX.ltx -- ersten Absatz ignorieren +\def\@doendpe{\@endpetrue + \def\par{\@restorepar\par\@endpefalse}\everypar + {{\setbox\z@\lastbox}\everypar{}\@endpefalse}} +%%%%%%%%%%%%%%%%%%%%%%%%%%% + \md@adjheight% + \advance\hsize by - \mdf@margin% %% hsize minus Randvorgabe links + \advance\hsize by - \mdf@margin% %% hsize minus Randvorgabe rechts + \advance\hsize by - \mdf@linewidth% %% hsize minus Linienbreite links + \advance\hsize by - \mdf@linewidth% %% hsize minus Linienbreite rechts + \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 + \setbox\@tempboxa\vbox\bgroup\@doendpe% + \begingroup% %%% zweites begingroup noetig, dass fontcolor gesetzt werden kann + \color{\mdf@fontcolor}% %%% Setzen der Schriftfarbe +% \md@margin@equation% + \textwidth\hsize \columnwidth\hsize% } -\def\endmdframed@global@env{\par +\def\endmdframed@global@env{\par% \kern\z@ %%%\z@=0 - \hrule\@width\hsize\@height\z@ + \hrule\@width\md@hsize\@height\z@% \penalty-100 % put depth into height - \endgroup - \egroup - \begingroup - \md@put@frame - \endgroup + \endgroup% + \egroup% + \begingroup% + \md@put@frame% + \endgroup% } @@ -368,10 +439,10 @@ \expandafter%%% ???? % \endgroup \ifdim\dimen@>\ht\@tempboxa %%% Pruefe, ob Box noch auf Seite passt - \ifmd@content@split %%% Pruefe ob \@tempboxa gesplittet wurde - \md@putbox@second %%% Wurde gesplittet- nehme zweiten Teil der Umrandung - \else %%% - \md@putbox@single %%% Box wurde nicht gesplitter - einfacher Rahmen + \ifmd@content@split% %%% Pruefe ob \@tempboxa gesplittet wurde + \md@putbox@second% %%% Wurde gesplittet- nehme zweiten Teil der Umrandung + \else% %%% + \md@putbox@single% %%% Box wurde nicht gesplitter - einfacher Rahmen \fi% \md@afterframe %%% siehe Anweisung \else %%%Box muss gesplittet werden @@ -440,12 +511,12 @@ \else % Bekommt Material fuer das Abspalten am Kopf (Got material split off at the head) \egroup %%%Moegliches egroup \md@resto@set - \ifvoid\@tempboxa %%% prueft, ob die \tempbox@ (abgesplitteter unterer Teil) leer ist. + \ifvoid\@tempboxa% %%% prueft, ob die \tempbox@ (abgesplitteter unterer Teil) leer ist. \setbox\@tempboxa\box\tw@ \ifmd@box@empty - \md@putbox@single % - \else - \md@putbox@second % + \md@putbox@single% + \else% + \md@putbox@second% \fi \md@afterframe \else % Es ist wirklich gesplittet mit oberen Teil in \tw@ und unteren Teil in \tempboxa@ @@ -481,36 +552,47 @@ \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-\md@outsidemargin}{\fp@putboxa@length@md}% + \addtolength{\fp@putboxa@length@md}{\mdf@linewidth}% + \rule[-0.5\baselineskip]% + {\md@textwidth-\mdf@leftmargin-\mdf@rightmargin-\mdf@linewidth-\mdf@linewidth}% + {\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}% + \rlap{\color{\mdf@linecolor}\vrule width \mdf@linewidth% + height \fp@putboxa@length@md% + depth 0.5\baselineskip}% + \rlap{\color{\mdf@linecolor}\rule[-0.5\baselineskip-\mdf@linewidth]% + {\md@textwidth-\mdf@leftmargin-\mdf@rightmargin}{\mdf@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}}% + \llap{\color{\mdf@linecolor}\vrule width \mdf@linewidth% + height \fp@putboxa@length@md% + depth 0.5\baselineskip}% + \llap{\color{\mdf@linecolor}\rule[\fp@putboxa@length@md]% + {\md@textwidth-\mdf@leftmargin-\mdf@rightmargin}{\mdf@linewidth}}% }% \def\md@putbox@single{%%%%% Ausgabe der ungesplitteten Gesamtbox \ifvoid\@tempboxa \else - \centerline{% - \null\hspace*{\md@framed@leftmargin}% - \md@frame@background@single% + \leftline{% + \null\hspace*{\mdf@leftmargin}% \md@frame@leftandbottomline@single% - \hfill{\box\@tempboxa}\hfill% - \md@frame@topandrightline@single% - \hspace*{\mdf@rightmargin}\null% - }% + \hspace*{\mdf@linewidth}% + \md@frame@background@single% + \hspace*{\mdf@margin}% + {\box\@tempboxa}% + \hspace*{\mdf@margin}% + \hspace*{\mdf@linewidth}% + \md@frame@topandrightline@single% + }% \fi } @@ -520,35 +602,46 @@ \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-\md@outsidemargin}{\fp@putboxa@length@md}% + \addtolength{\fp@putboxa@length@md}{1.4\baselineskip}% + \addtolength{\fp@putboxa@length@md}{-\mdf@linewidth}% + \rule[-0.4\baselineskip]{\md@textwidth-\mdf@leftmargin-\mdf@rightmargin-\mdf@linewidth-\mdf@linewidth}% + {\fp@putboxa@length@md}% }% }% \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}% + \addtolength{\fp@putboxa@length@md}{\baselineskip}% + \rlap{\color{\mdf@linecolor} \vrule width \mdf@linewidth% + height \fp@putboxa@length@md% + depth 0.4\baselineskip% + }% + \rlap{\color{\mdf@linecolor}\rule[\fp@putboxa@length@md-\mdf@linewidth]{\md@textwidth-\mdf@leftmargin-\mdf@rightmargin}% + {\mdf@linewidth}% }% }% \def\md@frame@rightline@first{% - \llap{\md@@linecolor \vrule width \md@framed@linewidth height \fp@putboxa@length@md}% + \llap{\color{\mdf@linecolor}\vrule width \mdf@linewidth% + height \fp@putboxa@length@md% + depth 0.4\baselineskip% + }% }% \def\md@putbox@first{%%%% Ausgabe der Teilbox 1 - \centerline{% - \null\hspace*{\mdf@leftmargin}% - \md@frame@background@first% + \leftline{% + \null\hspace*{\mdf@leftmargin}% \md@frame@topandleftline@first% - \hfill{\box\tw@}\hfill% + \hspace*{\mdf@linewidth}% + \md@frame@background@first% + \hspace*{\mdf@margin}% + {\box\tw@}% + \hspace*{\mdf@margin}% + \hspace*{\mdf@linewidth}% \md@frame@rightline@first% - \null\hspace*{\mdf@rightmargin}\null% - }% + }% } %%=second=%% @@ -557,34 +650,45 @@ \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}% + \rule[-0.5\baselineskip]{\md@textwidth-\mdf@leftmargin-\mdf@rightmargin-\mdf@linewidth-\mdf@linewidth}% + {\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}}% + \rlap{\color{\mdf@linecolor}\vrule width \mdf@linewidth% + height \fp@putboxa@length@md% + depth 0.5\baselineskip% + }% + \rlap{\color{\mdf@linecolor}\rule[-0.5\baselineskip-\mdf@linewidth]% + {\md@textwidth-\mdf@leftmargin-\mdf@rightmargin}% + {\mdf@linewidth}}% }% \def\md@frame@rightline@second{% - \llap{\md@@linecolor\vrule width \md@framed@linewidth height \fp@putboxa@length@md depth 0.5\baselineskip}% + \llap{\color{\mdf@linecolor}\vrule width \mdf@linewidth% + height \fp@putboxa@length@md% + depth 0.5\baselineskip}% }% \def\md@putbox@second{%%%%% Ausgabe der Teilbox 2 - \ifvoid\@tempboxa + \ifvoid\@tempboxa% \else - \centerline{% + \leftline{% \null\hspace*{\mdf@leftmargin}% - \md@frame@background@second% \md@frame@leftandbottomline@second% - \hfill{\box\@tempboxa}\hfill% + \hspace*{\mdf@linewidth}% + \md@frame@background@second% + \hspace*{\mdf@margin}% + {\box\@tempboxa}% + \hspace*{\mdf@margin}% + \hspace*{\mdf@linewidth}% \md@frame@rightline@second% - \hspace*{\mdf@rightmargin}\null% }% - \fi -} + \fi% +}% |