From 7e8d5077cc44657bb237d8e86fc50a9d84d7336c Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 14 Nov 2011 23:44:42 +0000
Subject: mdframed 1.0 (14nov11)

git-svn-id: svn://tug.org/texlive/trunk@24594 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/mdframed/mdframed.sty | 290 ++++++++++++++--------
 1 file changed, 188 insertions(+), 102 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/mdframed/mdframed.sty')

diff --git a/Master/texmf-dist/tex/latex/mdframed/mdframed.sty b/Master/texmf-dist/tex/latex/mdframed/mdframed.sty
index 98da4a03325..9303173956d 100644
--- a/Master/texmf-dist/tex/latex/mdframed/mdframed.sty
+++ b/Master/texmf-dist/tex/latex/mdframed/mdframed.sty
@@ -32,17 +32,17 @@
 %%                                                 %%
 %%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>%%
 
-%%$Id: mdframed.sty 209 2011-10-09 11:53:45Z marco $
-%%$Rev: 209 $
+%%$Id: mdframed.sty 220 2011-11-13 17:39:13Z marco $
+%%$Rev: 220 $
 %%$Author: marco $
-%%$Date: 2011-10-09 13:53:45 +0200 (So, 09. Okt 2011) $
+%%$Date: 2011-11-13 18:39:13 +0100 (So, 13. Nov 2011) $
 
 %% Allgemeine Angaben
-\def\mdversion{v0.9h}
+\def\mdversion{v1.0}
 \def\mdframedpackagename{mdframed}
 \def\md@maindate@svn$#1: #2 #3 #4-#5-#6 #7 #8${#4/#5/#6\space }
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mdframed}[\md@maindate@svn$Id: mdframed.sty 209 2011-10-09 11:53:45Z marco $ \mdversion: \mdframedpackagename]
+\ProvidesPackage{mdframed}[\md@maindate@svn$Id: mdframed.sty 220 2011-11-13 17:39:13Z marco $ \mdversion: \mdframedpackagename]
 %%==================================================%%
 %%=============== Benoetigte Pakete ================%%
 %%==================================================%%
@@ -52,18 +52,24 @@
  \IfFileExists{#1.sty}{%
           \RequirePackage{#1}%
         }{%
-        \md@PackageWarning{The package #1 does not exist^^J
+        \md@PackageWarning{The file #1 does not exist^^J
                            but needed by \mdframedpackagename^^J
                            see documentation fo further information
                            }%
        }
 }
-\md@LoadFile@IfExist{kvoptions}
-\md@LoadFile@IfExist{etex}
-\md@LoadFile@IfExist{calc}
+
+\RequirePackage{kvoptions}
+\RequirePackage{etex}
+\RequirePackage{etoolbox}[2011/01/03]
+\RequirePackage{zref-abspage}
+
+%separate Handhabung color
 \md@LoadFile@IfExist{color}
-\md@LoadFile@IfExist{etoolbox}
-\md@LoadFile@IfExist{zref-abspage}
+
+ 
+
+
 \SetupKeyvalOptions{family=mdf,prefix=mdf@}
 
 %%==================================================%%
@@ -103,9 +109,10 @@
        \expandafter\setlength\csname mdf@#1@length\endcsname{\csname mdfl@#1\endcsname}%
    }%
 }
-%%Schleifenmakro zur Optioneneingabe Option==Laenge
-
+%%Schleifenmakro zur Optioneneingabe
 \DeclareListParser*{\mdf@dolist}{,}
+
+%Laengenoptionen
 \def\mdf@do@lengthoption#1{%
   \mdf@lengthoption@doubledo#1\@nil%
 }
@@ -113,6 +120,42 @@
    \mdf@option@length{#1}{#2}%
    \mdf@define@key@length{#1}%
 }
+%Stringoptionen
+\def\mdf@do@stringoption#1{%
+   \mdf@stringoption@doubledo#1\@nil%
+}
+\def\mdf@stringoption@doubledo#1==#2\@nil{%
+   \expandafter\gdef\csname mdf@#1\endcsname{#2}%
+   \define@key{mdf}{#1}{%
+      \csdef{mdf@#1}{##1}%
+   }%
+}
+
+
+%Booloptionen
+\def\mdf@do@booloption#1{%
+   \mdf@booloption@doubledo#1\@nil%
+}
+\def\mdf@booloption@doubledo#1==#2\@nil{%
+   \newbool{mdf@#1}\setbool{mdf@#1}{#2}%
+   \define@key{mdf}{#1}[#2]{%
+      \setbool{mdf@#1}{##1}%
+   }%
+}
+
+%Alignoptionen
+\def\mdf@do@alignoption#1{%
+   \mdf@alignoption@tripledo#1\@nil%
+}
+\def\mdf@alignoption@tripledo#1==#2==#3\@nil{%
+   \csdef{mdf@align@#1@left}{\null\hspace*{#2}}%
+   \csdef{mdf@align@#1@right}{\hspace*{#3}\null}%
+}
+
+%%==================================================%%
+%%=====================Optionen=====================%%
+%%==================================================%%
+
 
 %Festlegung welcher Stildatei
 %% 0 := tex-Kommandos -- rule
@@ -131,8 +174,8 @@
          \ifcase\value{mdf@globalstyle@cnt}\relax
              %0 <- kein Grafikpaket
           \or\md@LoadFile@IfExist{tikz}%1 <- tikz wird benoetigt
-          \or\md@LoadFile@IfExist{tikz}%2 <- tikz wird benoetigt
-          \or\md@LoadFile@IfExist{pstricks-add}%3 <- pstricks wird benoetigt
+          \or\md@LoadFile@IfExist{pstricks-add}%2 <- tikz wird benoetigt
+          \or\defcounter{mdf@globalstyle@cnt}{2}\md@LoadFile@IfExist{pstricks-add}%3 <- pstricks wird benoetigt
           \or\md@LoadFile@IfExist{pstricks-add}%4 <- pstricks wird benoetigt
           \else\md@PackageWarning{Unknown global style \value{mdf@globalstyle@cnt}}%
         \fi%
@@ -145,7 +188,7 @@
 \define@key{mdf}{framemethod}[default]{%
   \lowercase{\def\md@tempa{#1}}
   \forcsvlist{\listadd\md@framemethod@i}{default,tex,latex,none,0}
-  \forcsvlist{\listadd\md@framemethod@ii}{tikz,1}
+  \forcsvlist{\listadd\md@framemethod@ii}{pgf,tikz,1}
   \forcsvlist{\listadd\md@framemethod@iii}{pstricks,ps,2,postscript}
   \xifinlist{\md@tempa}{\md@framemethod@i}%
      {\def\mdf@@framemethod{default}\defcounter{mdf@globalstyle@cnt}{0}}%
@@ -154,7 +197,8 @@
          {\xifinlist{\md@tempa}{\md@framemethod@iii}%
              {\def\mdf@@framemethod{pstricks}\defcounter{mdf@globalstyle@cnt}{2}}%
              {%
-              \md@PackageWarning{Unknown framemethod \md@tempa\MessageBreak}}%
+              \md@LoadFile@IfExist{#1}%
+             }%
          }%
      }%
   \ifcase\value{mdf@globalstyle@cnt}\relax%
@@ -165,10 +209,7 @@
   \fi%
 }
 
-
-
 %%%%Optionen mit Laengen
-
 \mdf@dolist{\mdf@do@lengthoption}{%
    {skipabove==\z@},%
    {skipbelow==\z@},%
@@ -188,13 +229,67 @@
    {middlelinewidth==\expandafter\mdf@linewidth@length},%
    {outerlinewidth==\z@},%
    {roundcorner==\z@},%
-   {footenotedistance==\medskipamount}
+   {footenotedistance==\medskipamount},
+   {userdefinedwidth==\linewidth}
 } 
+%%%%Optionen mit String
+\mdf@dolist{\mdf@do@stringoption}{%
+    {defaultunit==pt},%
+    {settings=={}},%
+    {linecolor==black},%
+    {backgroundcolor==white},%
+    {fontcolor==black},%
+    {innerlinecolor==\mdf@linecolor},%
+    {outerlinecolor==\mdf@linecolor},%
+    {middlelinecolor==\mdf@linecolor},%
+    {psroundlinecolor==\mdf@backgroundcolor},%
+    {frametitle=={}},%
+    {frametitlefont==\bfseries\large},%
+    {printheight==none},%
+}
+%%%%Optionen mit Boolflag
+\mdf@dolist{\mdf@do@booloption}{%
+    {ntheorem==false},%
+    {topline==true},%
+    {leftline==true},%
+    {bottomline==true},%
+    {rightline==true},%
+    {hidealllines==false},%
+    {nobreak==false},%
+    {footnoteinside==true},%
+}
+
+
+%Alignoptionen:
+\mdf@dolist{\mdf@do@alignoption}{%
+    {left==\mdf@leftmargin@length==\z@},%
+    {center==\fill==\fill},%
+    {right==\fill==\mdf@rightmargin@length},%
+    {outer==\fill==\mdf@rightmargin@length},%not supported yet
+    {outer==\mdf@leftmargin@length==\fill},%not supported yet
+}
+
+\newcommand*\mdf@align{}%
+\newcommand*\mdf@makeboxalign@left{\null\hspace*{\mdf@leftmargin@length}}%
+\newcommand*\mdf@makeboxalign@right{}%
+\define@key{mdf}{align}[left]{%
+   \ifcsundef{mdf@align@#1@left}{%
+       \md@PackageWarning{Unknown alignment #1\MessageBreak}%
+       \letcs\mdf@makeboxalign@left{mdf@align@left@left}%
+       \letcs\mdf@makeboxalign@right{mdf@align@left@right}%
+   }{%
+       \def\mdf@makeboxalign@left{\csuse{mdf@align@#1@left}}%
+       \def\mdf@makeboxalign@right{\csuse{mdf@align@#1@right}}%
+   }%
+}
 
 %Unterstuetzung der Optionen fuer tikz
 \def\mdf@tikzset@local{\tikzset{tikzsetting/.style={}}}
 \define@key{mdf}{tikzsetting}{%
-  \def\mdf@tikzset@local{\tikzset{tikzsetting/.style={#1}}}
+  \def\mdf@tikzset@local{\tikzset{tikzsetting/.style={#1}}}%
+}
+\define@key{mdf}{apptotikzsetting}{%
+  \appto\mdf@tikzset@local{#1}%
 }
 
 %Unterstuetzung der Optionen fuer pstricks
@@ -203,36 +298,23 @@
   \def\mdf@psset@local{#1}
 }
 
-%Unterstuetzung von eigenen Definitionen
-\def\mdf@settings{}
-\define@key{mdf}{settings}{%
-  \def\mdf@settings{#1}
-}
-
-
-\DeclareStringOption[pt]{defaultunit}
+%Unterstuetzung der xcolor fuer pstricks
+\def\mdf@xcolor{}
+\define@key{mdf}{xcolor}[none]{%
+  \@ifpackageloaded{xcolor}{%
+     \let\mdf@xcolor\@empty %ignoriere die Eingabe der Optionen
+     }{%
+     \def\@tempa{none}%
+      \ifx\mdf@xcolor\@tempa
+         \else
+         \PassOptionsToPackage{\mdf@xcolor}{xcolor}%
+         \RequirePackage{xcolor}%     
+      \fi%
+   }%
+ }
 
-%%mdframed umfasst ntheorem-Umgebung ja/nein
-\DeclareBoolOption{ntheorem}
-%Linienausgabe
-\DeclareBoolOption[true]{topline}
-\DeclareBoolOption[true]{leftline}
-\DeclareBoolOption[true]{bottomline}
-\DeclareBoolOption[true]{rightline}
-\DeclareBoolOption[false]{hidealllines}
-%%FARBEN
-\DeclareStringOption[none]{xcolor}
-\DeclareStringOption[black]{linecolor}
-\DeclareStringOption[white]{backgroundcolor}
-\DeclareStringOption[black]{fontcolor}
-\DeclareStringOption[\mdf@linecolor]{innerlinecolor}
-\DeclareStringOption[\mdf@linecolor]{outerlinecolor}
-\DeclareStringOption[\mdf@linecolor]{middlelinecolor}
-\DeclareStringOption[\mdf@backgroundcolor]{psroundlinecolor}
 
 %Nutzung des Paketes needspace
-\DeclareStringOption[\z@]{needspace}
-\newcommand\mdf@sneedspace{}
 \define@key{mdf}{needspace}[\z@]{%
      \begingroup%
         \setlength{\dimen@}{#1}%
@@ -248,21 +330,6 @@
 \DeclareDefaultOption{%
    \md@PackageWarning{Unknown Option '\CurrentOption' for mdframed}}
 
-%%Uberschriften
-\DeclareStringOption{frametitle}
-\DeclareStringOption[\bfseries\large]{frametitlefont}
-
-%mdframed soll nicht splitte
-\DeclareBoolOption[false]{nobreak}
-
-%Ausgabe des Platzes auf Seite -- nicht float
-%Werte none,info,warning
-\DeclareStringOption[none]{printheight}
-
-%Fussnotenposition:
-\DeclareBoolOption[true]{footnoteinside}
-
-
 
 \ProcessKeyvalOptions*\relax
 \newcommand*{\mdfsetup}{\setkeys{mdf}}
@@ -275,28 +342,9 @@
                            You have to define a style via \string\mdfdefinedstyle\MessageBreak
                            }%
         }%
-        {\csuse{mdf@definestyle@#1}}%
-}
-
-
-%%==================================================%%
-%%========Sicherstellen der key-value-Syntax========%%
-%%==================================================%%
-\AtBeginDocument{
- \@ifpackageloaded{xcolor}{%
-    \let\mdf@xcolor\@empty %ignoriere die Eingabe der Optionen
-    }{%
-     \def\@tempa{none}
-    \ifx\mdf@xcolor\@tempa
-    \else
-     \PassOptionsToPackage{\mdf@xcolor}{xcolor}
-     \RequirePackage{xcolor}
-   \fi
- }
-}
-
-
-
+        {\expandafter\expandafter\expandafter\mdfsetup%
+         \expandafter\expandafter\expandafter{\csname mdf@definestyle@#1\endcsname}}%
+}%
 
 %%==================================================%%
 %%==========Ausgabe des Platzes auf Seite===========%%
@@ -326,7 +374,6 @@
 %%==================================================%%
 %Anpassung lrbox
 \let\md@lrbox\lrbox
-\let\endmd@lrbox\endlrbox
 \patchcmd\md@lrbox\hbox\vbox{}{}
 \patchcmd\md@lrbox\color@setgroup{%
 \color@setgroup\color{\mdf@fontcolor}%
@@ -336,6 +383,7 @@
 \linewidth=\hsize%
 \bgroup\md@@frametitle\egroup\noindent%
 }{}{}
+\def\endmd@lrbox{\unskip\color@endgroup}
 
 %Anpassung trivlist
 \let\md@trivlist\trivlist
@@ -344,15 +392,28 @@
 \def\md@endparenv{%
   \addpenalty\@endparpenalty\addvspace\mdf@skipbelow@length\@endpetrue}
 
+
+%%==================================================%%
+%%==============leftline anpassen===================%%
+%%==================================================%%
+\newrobustcmd*\mdf@makebox[2][\mdf@userdefinedwidth@length]{%
+ \noindent\makebox[#1][l]{#2}%
+}
+
+
 %%==================================================%%
 %%==================framestyle======================%%
 %%==================================================%%
 %inspired by Lars Madsen
 \newrobustcmd*\mdfdefinestyle[2]{%
-  \csdef{mdf@definestyle@#1}{\mdfsetup{#2}}%
+  \csdef{mdf@definestyle@#1}{#2}%
 }
 
-
+\newrobustcmd*\mdfapptodefinestyle[2]{%
+ \ifcsundef{mdf@definestyle@#1}%
+   {\md@PackageWarning{Unknown style #1}}%
+   {\csappto{mdf@definestyle@#1}{,#2}}%
+}
 
 %%==================================================%%
 %%=============Umgebungdefinition===================%%
@@ -627,8 +688,15 @@
 %%==================================================%%
 %%==Deklaration diverser Eingabe und Hilfsparameter=%%
 %%==================================================%%
-\newlength\mdfboundingboxheight
+%X-Laengen
 \newlength\mdfboundingboxwidth
+\newlength\mdfboundingboxtotalwidth
+%Y-Laengen
+\newlength\mdfboundingboxheight
+\newlength\mdfboundingboxdepth
+\newlength\mdfboundingboxtotalheight
+
+
 
 \newlength\md@freevspace@length
 \newlength\md@horizontalwidthofbox@length
@@ -636,6 +704,10 @@
 
 \providecommand*\ptTps{}
 
+%Kommando in tikz mit relax belegt:
+\newrobustcmd\mdfcreateextratikz{}
+
+
 %%==================================================%%
 %%==================Umgebung========================%%
 %%==================================================%%
@@ -644,7 +716,7 @@
 \def\mdframed@i[#1]{% default-Umgebung
 \begingroup
 %check is needed?
-   \mdfsetup{#1}%%
+   \mdfsetup{userdefinedwidth=\linewidth,#1}%%
    \md@hidealllines@check%
    \mdf@settings%
    \md@twoside@checklength%
@@ -667,10 +739,12 @@
       \def\md@reserveda{%
         \md@footnoteoutput%
         \end{md@lrbox}%
+        \let\hsize\linewidth
         \detected@md@put@frame}%
     \else%
       \def\md@reserveda{%
         \end{md@lrbox}
+        \let\hsize\linewidth
         \detected@md@put@frame%
         \md@footnoteoutput%
         }%
@@ -698,10 +772,14 @@
               }%
               {\settoggle{md:checktwoside}{true}}%
    \iftoggle{md:checktwoside}{%
-     \let\mdf@rightmargin@length\mdf@outermargin@length\relax%
-     \let\mdf@leftmargin@length\mdf@innermargin@length\relax%
+      \ifdimequal{\mdf@outermargin@length}{-999pt}%
+         {\setlength\mdf@rightmargin@length{\z@}}%
+         {\setlength\mdf@rightmargin@length{\mdf@outermargin@length}}%
+     \ifdimequal{\mdf@innermargin@length}{-999pt}%
+         {\setlength\mdf@leftmargin@length{\z@}}%
+         {\setlength\mdf@leftmargin@length{\mdf@innermargin@length}}%
    }{}%
- \fi
+ \fi%
 }
 
 \newcounter{md@zref@counter}%keine doppelten laebes
@@ -724,12 +802,20 @@
 }
 
 \newrobustcmd*\md@pageisodd{%
-\let\mdf@rightmargin@length\mdf@outermargin@length\relax%
-\let\mdf@leftmargin@length\mdf@innermargin@length\relax%
+      \ifdimequal{\mdf@outermargin@length}{-999pt}%
+         {\setlength\mdf@rightmargin@length{\z@}}%
+         {\setlength\mdf@rightmargin@length{\mdf@outermargin@length}}%
+     \ifdimequal{\mdf@innermargin@length}{-999pt}%
+         {\setlength\mdf@leftmargin@length{\z@}}%
+         {\setlength\mdf@leftmargin@length{\mdf@innermargin@length}}%
 }
 \newrobustcmd*\md@pageiseven{%
-\let\mdf@rightmargin@length\mdf@innermargin@length\relax%
-\let\mdf@leftmargin@length\mdf@outermargin@length\relax%
+      \ifdimequal{\mdf@outermargin@length}{-999pt}%
+         {\setlength\mdf@leftmargin@length{\z@}}%
+         {\setlength\mdf@leftmargin@length{\mdf@outermargin@length}}%
+     \ifdimequal{\mdf@innermargin@length}{-999pt}%
+         {\setlength\mdf@rightmargin@length{\z@}}%
+         {\setlength\mdf@rightmargin@length{\mdf@innermargin@length}}%
 }
 
 \newrobustcmd*\md@@setzref{\md@zref@label\if@md@pageodd}
@@ -757,7 +843,7 @@
 
 \newlength\md@horizontalspaceofbox
 \newrobustcmd*\md@horizontalmargin@equation{%
-    \setlength{\md@horizontalspaceofbox}{\hsize}%
+    \setlength{\md@horizontalspaceofbox}{\mdf@userdefinedwidth@length}%
     \mdf@dolist{\md@advancelength@orizontalmargin@add}{%
              leftmargin,outerlinewidth,middlelinewidth,%
              innerlinewidth,innerleftmargin,innerrightmargin,%
@@ -822,7 +908,7 @@
       \let\md@reserved@a\relax%
    \else
       %Hier berechnung Box-Inhalt+Rahmen oben und unten
-      \setlength{\md@verticalmarginwhole@length}{\ht\@tempboxa+\dp\@tempboxa}%
+      \setlength{\md@verticalmarginwhole@length}{\dimexpr\ht\@tempboxa+\dp\@tempboxa\relax}%
       \mdf@dolist{\md@advancelength@verticalmarginwhole}{%
                   outerlinewidth,middlelinewidth,innerlinewidth,innertopmargin,
                   innerbottommargin,innerlinewidth,middlelinewidth,outerlinewidth}%
@@ -848,7 +934,7 @@
               \def\md@reserved@a{\md@put@frame}%
              }{%
                %Hier berechnung Box-Inhalt+Rahmen oben und unten
-              \setlength{\md@verticalmarginwhole@length}{\ht\@tempboxa+\dp\@tempboxa}%
+              \setlength{\md@verticalmarginwhole@length}{\dimexpr\ht\@tempboxa+\dp\@tempboxa\relax}%
               \mdf@dolist{\md@advancelength@verticalmarginwhole}{%
                      outerlinewidth,middlelinewidth,innerlinewidth,innertopmargin,
                      innerbottommargin,innerlinewidth,middlelinewidth,outerlinewidth}%
@@ -943,7 +1029,7 @@
 
 \def\md@put@frame@ii{%Ausgabe der mittleren Box(en) wenn vorhanden
   \setlength{\md@freevspace@length}{\vsize}%
-  \setlength{\dimen@}{\ht\@tempboxa+\dp\@tempboxa}%
+  \setlength{\dimen@}{\dimexpr\ht\@tempboxa+\dp\@tempboxa\relax}%
   \mdf@dolist{\md@advancelength@freevspace@add}{%
                 outerlinewidth,middlelinewidth,innerlinewidth,%
                 innerbottommargin}%%%Addition der Linien unten
-- 
cgit v1.2.3

