diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/mdframed/mdframed.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/mdframed/mdframed.sty | 716 |
1 files changed, 427 insertions, 289 deletions
diff --git a/Master/texmf-dist/tex/latex/mdframed/mdframed.sty b/Master/texmf-dist/tex/latex/mdframed/mdframed.sty index 36295b6ca84..112c389e61c 100644 --- a/Master/texmf-dist/tex/latex/mdframed/mdframed.sty +++ b/Master/texmf-dist/tex/latex/mdframed/mdframed.sty @@ -23,7 +23,7 @@ %% HEIKO OBERDIEK %% HERBERT VOSS %% -%% Copyright (c) 2010 Marco Daniel +%% Copyright (c) 2010-2013 Marco Daniel %% %% This package may be distributed under the terms of the LaTeX Project %% Public License, as described in lppl.txt in the base LaTeX distribution. @@ -48,14 +48,14 @@ %% >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> %% ================================================== %% -\def\mdversion{1.8} + +\def\mdversion{1.9a} \def\mdframedpackagename{mdframed} -\def\mdfmaindate{2013/03/09} -\def\mdfrevision{ 172}% Done by github: git rev-list HEAD | wc -l +\def\mdfmaindate{2013/06/21} +\def\mdfrevision{ 208}% Done by github: git rev-list HEAD | wc -l \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{mdframed}% - [\mdfmaindate\ % - \mdversion: \mdframedpackagename] + [\mdfmaindate\space \mdversion: \mdframedpackagename] \newcommand*\mdf@PackageError[1]{\PackageError{\mdframedpackagename}{#1}} \newcommand*\mdf@PackageWarning[1]{\PackageWarning{\mdframedpackagename}{#1}} \newcommand*\mdf@PackageInfo[1]{\PackageInfo{\mdframedpackagename}{#1}} @@ -67,7 +67,7 @@ but needed by \mdframedpackagename\MessageBreak see documentation fo further information }% - } + }% } \RequirePackage{kvoptions} \RequirePackage{xparse} @@ -75,7 +75,7 @@ \RequirePackage{zref-abspage} \RequirePackage{color} \SetupKeyvalOptions{family=mdf,prefix=mdf@} - +\def\mdf@definestyle@defaultoptions{}% \newlength{\mdf@templength} \def\mdf@iflength#1{% \afterassignment\mdf@iflength@check% @@ -93,10 +93,20 @@ } \def\mdf@iflength@cleanup#1\relax{} \DeclareListParser*{\mdf@dolist}{,} +\def\mdf@do@lengthoption#1{% + \mdf@lengthoption@doubledo#1\@nil% +} +\def\mdf@lengthoption@doubledo#1==#2\@nil{% + \mdf@option@length{#1}{#2}% + \mdf@define@key@length{#1}% + \gappto\mdf@definestyle@defaultoptions{#1=#2,}% +} + \newrobustcmd*{\mdf@option@length}[2]{% \expandafter\newlength\csname mdf@#1@length\endcsname% \expandafter\setlength\csname mdf@#1@length\endcsname{#2}% } + \newrobustcmd*{\mdf@define@key@length}[1]{% \define@key{mdf}{#1}{% \def\@tempa{##1} @@ -106,13 +116,7 @@ \setlength{\csname mdf@#1@length\endcsname}{\csname mdfl@#1\endcsname}% }% } -\def\mdf@do@lengthoption#1{% - \mdf@lengthoption@doubledo#1\@nil% -} -\def\mdf@lengthoption@doubledo#1==#2\@nil{% - \mdf@option@length{#1}{#2}% - \mdf@define@key@length{#1}% -} + \def\mdf@do@stringoption#1{% \mdf@stringoption@doubledo#1\@nil% } @@ -121,6 +125,7 @@ \define@key{mdf}{#1}{% \csdef{mdf@#1}{##1}% }% + \gappto\mdf@definestyle@defaultoptions{#1=#2,}% } \def\mdf@do@booloption#1{% \mdf@booloption@doubledo#1\@nil% @@ -130,32 +135,17 @@ \define@key{mdf}{#1}[#2]{% \setbool{mdf@#1}{##1}% }% -} -\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}% + \gappto\mdf@definestyle@defaultoptions{#1=#2,}% } \newcounter{mdf@globalstyle@cnt} -\defcounter{mdf@globalstyle@cnt}{0} -\newcommand*\mdfglobal@style{0} +\defcounter{mdf@globalstyle@cnt}{-99} + \define@key{mdf}{style}{% \mdf@PackageWarning{package option style is depreciated^^J + at this point and will be ignored^^J use framemethod instead\MessageBreak}% - \renewcommand*\mdfglobal@style{#1}% - \defcounter{mdf@globalstyle@cnt}{#1}% - \ifcase\value{mdf@globalstyle@cnt}\relax - \or\mdf@LoadFile@IfExist{tikz}%=1 - \or\mdf@LoadFile@IfExist{pstricks-add}%=2 - \or\defcounter{mdf@globalstyle@cnt}{2}%=3 - \mdf@LoadFile@IfExist{pst-node}% - \or\mdf@LoadFile@IfExist{pst-node}%=4 - \else%%>4 - \mdf@PackageWarning{Unknown global style \value{mdf@globalstyle@cnt}}% - \fi% } + \providecommand*\mdf@framemethod{} \def\mdf@framemethod@i{}% \def\mdf@framemethod@ii{}% @@ -168,29 +158,47 @@ \xifinlist{\mdf@tempa}{\mdf@framemethod@i}% {\def\mdf@@framemethod{default}\defcounter{mdf@globalstyle@cnt}{0}}% {\xifinlist{\mdf@tempa}{\mdf@framemethod@ii}% - {\def\mdf@@framemethod{tikz}\defcounter{mdf@globalstyle@cnt}{1}}% + {\def\mdf@@framemethod{tikz}% + \defcounter{mdf@globalstyle@cnt}{1}\mdf@LoadFile@IfExist{tikz}}% {\xifinlist{\mdf@tempa}{\mdf@framemethod@iii}% - {\def\mdf@@framemethod{pstricks}\defcounter{mdf@globalstyle@cnt}{2}}% + {\def\mdf@@framemethod{pstricks}% + \defcounter{mdf@globalstyle@cnt}{2}\mdf@LoadFile@IfExist{pst-node}}% {\mdf@LoadFile@IfExist{#1}}% }% }% \ifcase\value{mdf@globalstyle@cnt}\relax% - \or\mdf@LoadFile@IfExist{tikz}%=1 - \or\mdf@LoadFile@IfExist{pst-node}%=2 - \or\mdf@LoadFile@IfExist{pst-node}%=3 + \input{md-frame-0.mdf}% + \or\input{md-frame-1.mdf}% + \or\input{md-frame-2.mdf}% + \or\input{md-frame-3.mdf}% + \else% + \IfFileExists{md-frame-\value{mdf@globalstyle@cnt}.mdf}% + {\input{md-frame-\value{mdf@globalstyle@cnt}.mdf}}% + {% + \input{md-frame-0.mdf}% + \mdf@PackageWarning{The style number \value{mdf@globalstyle@cnt} + does not exist^^J + mdframed ues instead style=0 \mdframedpackagename}% + }% \fi% } +\DeclareVoidOption{tikz}{\setkeys{mdf}{framemethod=tikz}} +\DeclareVoidOption{TikZ}{\setkeys{mdf}{framemethod=tikz}} +\DeclareVoidOption{ps}{\setkeys{mdf}{framemethod=pstricks}} +\DeclareVoidOption{pstricks}{\setkeys{mdf}{framemethod=pstricks}} +\DeclareVoidOption{PSTricks}{\setkeys{mdf}{framemethod=pstricks}} + \mdf@dolist{\mdf@do@lengthoption}{% - {skipabove==\z@},% - {skipbelow==\z@},% + {skipabove==\topsep},% + {skipbelow==\topsep},% {leftmargin==\z@},% {rightmargin==\z@},% {innerleftmargin==10pt},% {innerrightmargin==10pt},% {innertopmargin==0.4\baselineskip},% {innerbottommargin==0.4\baselineskip},% - {splittopskip==\z@},% - {splitbottomskip==\z@},% + {splittopskip==10pt},% + {splitbottomskip==10pt},% {outermargin==\z@},% {innermargin==\z@},% {linewidth==0.4pt},% @@ -222,6 +230,9 @@ } \mdf@dolist{\mdf@do@stringoption}{% {frametitle=={}},% + {firstframetitle=={}},% + {framefoot=={}},% + {lastframefoot=={}},% {defaultunit==pt},% {linecolor==black},% {backgroundcolor==white},% @@ -245,10 +256,21 @@ {theoremcountersep=={.}},% {theoremtitlefont=={}},% {theoremspace=={\space}},% - {singleextra=={}}, - {firstextra=={}}, - {middleextra=={}}, - {secondextra=={}}, + {extra=={}},% + {singleextra=={}},% + {firstextra=={}},% + {middleextra=={}},% + {secondextra=={}},% + {beforesingleframe=={}},% + {aftersingleframe=={}},% + {beforebreak=={}},% + {afterbreak=={}},% + {beforelastframe=={}},% + {afterlastframe=={}},% + {startcode=={}},% + {startinnercode=={}},% + {endinnercode=={}},% + {endcode=={}},% {subtitlefont==\normalfont\bfseries},% {subsubtitlefont==\normalfont},% {subtitlebackgroundcolor==white},% @@ -290,7 +312,18 @@ \ifbool{mdf@hidealllines}{% \kvsetkeys{mdf}{leftline=false,topline=false,% rightline=false,bottomline=false}% - }{}% + }{% + \kvsetkeys{mdf}{leftline=true,topline=true,% + rightline=true,bottomline=true}% + }% +} +\appto\mdf@definestyle@defaultoptions{hidealllines=false,}% +\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}% } \mdf@dolist{\mdf@do@alignoption}{% {left==\mdf@leftmargin@length==\z@},% @@ -353,6 +386,9 @@ \DeclareDefaultOption{% \mdf@PackageError{Unknown Option '\CurrentOption' for mdframed}} \ProcessKeyvalOptions*\relax +\ifnum\c@mdf@globalstyle@cnt<0 + \kvsetkeys{mdf}{framemethod=default,} +\fi \newrobustcmd*{\mdfsetup}{\kvsetkeys{mdf}} \define@key{mdf}{style}{% \ifcsundef{mdf@definestyle@#1}{% @@ -364,6 +400,22 @@ {\expandafter\expandafter\expandafter\mdfsetup\expandafter% \expandafter\expandafter{\csname mdf@definestyle@#1\endcsname}}% }% +\DeclareVoidOption{default}{% + \expandafter\expandafter\expandafter\mdfsetup\expandafter% + \expandafter\expandafter{\csname mdf@definestyle@defaultoptions\endcsname}% +}% + +\ifnum\c@mdf@globalstyle@cnt>0 + \define@key{mdf}{linewidth}{% + \def\@tempa{#1} + \mdf@iflength{\@tempa}% + {\csxdef{mdfl@linewidth}{\the\mdf@templength}}% + {\csxdef{mdfl@linewidth}{\the\mdf@templength}}% + \setlength{\csname mdf@middlelinewidth@length\endcsname}% + {\csname mdfl@linewidth\endcsname}% + }% +\fi + \let\mdf@PackageNoInfo\@gobble \newrobustcmd*\mdf@ifstrequal@expand{% \expandafter\ifstrequal\expandafter{\mdf@printheight}% @@ -389,6 +441,7 @@ \newsavebox\mdf@splitbox@one \newsavebox\mdf@splitbox@two \newsavebox\mdf@splitbox@save + \newlength\mdfsplitboxwidth \newlength\mdfsplitboxtotalwidth \newlength\mdfsplitboxheight @@ -404,31 +457,32 @@ \newlength\mdffootnoteboxheight \newlength\mdffootnoteboxdepth \newlength\mdffootnoteboxtotalheight - \newlength\mdftotallinewidth - \newlength\mdfboundingboxwidth \newlength\mdfboundingboxtotalwidth - \newlength\mdfboundingboxheight \newlength\mdfboundingboxdepth \newlength\mdfboundingboxtotalheight - \newlength\mdf@freevspace@length \newlength\mdf@horizontalwidthofbox@length \newlength\mdf@verticalmarginwhole@length +\newlength\mdf@horizontalspaceofbox +\newlength\mdfsubtitleheight +\newlength\mdfsubsubtitleheight -\newtoggle{mdf@notfirstframetitle}% -\togglefalse{mdf@notfirstframetitle}% +\newbool{mdfsingleframe}\boolfalse{mdfsingleframe} +\newbool{mdffirstframe}\boolfalse{mdffirstframe} +\newbool{mdfmiddleframe}\boolfalse{mdfmiddleframe} +\newbool{mdflastframe}\boolfalse{mdflastframe} +\newtoggle{mdf@notfirstframetitle}\togglefalse{mdf@notfirstframetitle}% +\newtoggle{mdflastframe}\togglefalse{mdflastframe} + +\newcounter{mdfcountframes}\setcounter{mdfcountframes}{0} \newrobustcmd\mdfcreateextratikz{} \def\mdf@lrbox#1{% -%%patch to work with amsthm - \mdf@patchamsthm -%%%end patch - \edef\mdf@restoreparams{% - \parindent=\the\parindent\relax \parskip=\the\parskip\relax}% + \mdf@patchamsthm%patch amsthm \setbox#1\vbox\bgroup% \color@begingroup% \mdf@horizontalmargin@equation% @@ -447,22 +501,24 @@ \baselineskip\normalbaselineskip% %% \sloppy% \let\\\@normalcr% - \mdf@restoreparams\relax% + \mdf@par@local%New feature to restore parskip/parindent local in save box + \ifbool{mdf@suppressfirstparskip}{\vspace*{-\parskip}}{}% \@afterindentfalse% - \@afterheading% + %\@afterheading% } - \def\endmdf@lrbox{\color@endgroup\egroup} - \newrobustcmd*\mdf@ignorevbadness{% \edef\mdf@currentvbadness{\the\vbadness}% \vbadness=\@M% \afterassignment\mdf@restorevbadness} + \newrobustcmd*\mdf@restorevbadness{\vbadness=\mdf@currentvbadness\relax} +\let\mdf@patchamsthm\relax +\AtBeginDocument{% \@ifpackageloaded{amsthm}% -{% - \newrobustcmd\mdf@patchamsthm{% - \let\mdf@deferred@thm@head\deferred@thm@head + {% + \newrobustcmd\mdf@patchamsthm{% + \let\mdf@deferred@thm@head\deferred@thm@head% \pretocmd{\deferred@thm@head}{\@inlabelfalse}% {\mdf@PackageInfo{mdframed detected package amsthm ^^J changed the theorem header of amsthm\MessageBreak}% @@ -472,10 +528,16 @@ failed\MessageBreak}% }% }% -}{\let\mdf@patchamsthm\relax}% + }{}% +} \def\mdf@trivlist#1{% - \edef\x{\topsep=\the\topsep\relax\partopsep=\the\partopsep\relax\parsep=\the\parsep\relax} + \edef\mdf@temp{% + \topsep=\the\topsep\relax% + \partopsep=\the\partopsep\relax% + \parsep=\the\parsep\relax% + }% \setlength{\topsep}{#1}% + \topskip\z@% \partopsep\z@% \parsep\z@% \@nmbrlistfalse% @@ -485,9 +547,7 @@ \itemindent\z@% \let\@itemlabel\@empty% \def\makelabel##1{##1}% - \item\relax\x\relax\leavevmode\hrule \@height\z@ \@width\linewidth\relax% -%% \item\mbox{}\relax% second version -%% \item\relax\x% first Version + \item\relax\mdf@temp\relax% } \let\endmdf@trivlist\endtrivlist \patchcmd\endmdf@trivlist\@endparenv\mdf@endparenv{% @@ -499,7 +559,6 @@ } \def\mdf@endparenv{% \addpenalty\@endparpenalty\addvspace\mdf@skipbelow@length\@endpetrue} - \newrobustcmd*\mdf@makebox@out[2][\linewidth]{% \noindent\hb@xt@\z@{% \noindent\makebox[\dimexpr #1\relax][l]{#2}% @@ -534,7 +593,7 @@ \expandafter\let\csname #2\endcsname\relax% \expandafter\let\csname end#2\endcsname\relax% \newmdenv[#1]{#2}% - }% +}% \DeclareDocumentCommand\newmdtheoremenv{O{} m o m o }{% \ifboolexpr{ test {\IfNoValueTF {#3}} and test {\IfNoValueTF {#5}} }% {\newtheorem{#2}{#4}}{% @@ -551,6 +610,15 @@ \@ifpackageloaded{ntheorem}% {\renewrobustcmd*\mdf@thm@caption{\thm@thmcaption}}{}% } +\newrobustcmd*\mdf@checkntheorem{% + \ifbool{mdf@ntheorem}% + {\ifundef{\theorempreskipamount}% + {\mdf@PackageWarning{You have not loaded ntheorem yet}}% + {\setlength{\theorempreskipamount}{\z@}% + \setlength{\theorempostskipamount}{\z@}% + }% + }{}% +} \DeclareDocumentCommand{\mdtheorem}{ O{} m o m o }% {\ifcsdef{#2}% {\mdf@PackageWarning{Environment #2 already exits\MessageBreak}}% @@ -639,40 +707,38 @@ } \newrobustcmd\mdfframedtitleenv[1]{% - \mdf@lrbox{\mdf@frametitlebox}% + \mdf@lrbox{\mdf@frametitlebox}% + \begingroup + %%\parindent\z@\parskip\z@% + \@afterheading \mdf@frametitlealignment% - \leavevmode\color{\mdf@frametitlefontcolor}% - \normalfont\mdf@frametitlefont{#1} - \ifbool{mdf@ignorelastdescenders}% - {% - \par\strut\par - \unskip\unskip\setbox0=\lastbox - \vspace*{\dimexpr\ht\strutbox-\baselineskip\relax}% - }{}% - \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%% - \endmdf@lrbox\relax% - \mdf@ignorevbadness% - \setbox\mdf@frametitlebox=\vbox{\unvbox\mdf@frametitlebox}% - \mdfframetitleboxwidth=\wd\mdf@frametitlebox\relax% - \mdfframetitleboxheight=\ht\mdf@frametitlebox\relax% - \mdfframetitleboxdepth=\dp\mdf@frametitlebox\relax% - \mdfframetitleboxtotalheight=\dimexpr + \leavevmode\color{\mdf@frametitlefontcolor}% + \normalfont\mdf@frametitlefont{#1}% + \mdf@@ignorelastdescenders% + \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%% + \endgroup + \endmdf@lrbox\relax% + \mdf@ignorevbadness% + \setbox\mdf@frametitlebox=\vbox{\unvbox\mdf@frametitlebox}% + \mdfframetitleboxwidth=\wd\mdf@frametitlebox\relax% + \mdfframetitleboxheight=\ht\mdf@frametitlebox\relax% + \mdfframetitleboxdepth=\dp\mdf@frametitlebox\relax% + \mdfframetitleboxtotalheight=\dimexpr \ht\mdf@frametitlebox +\dp\mdf@frametitlebox% +\mdf@frametitleaboveskip@length +\mdf@frametitlebelowskip@length \relax% + \setbox\mdf@frametitlebox=%prevent frametitle to expand glue + \vbox to \dimexpr\mdfframetitleboxheight+\mdfframetitleboxdepth\relax% + {\unvbox\mdf@frametitlebox}% } -\newrobustcmd*\mdf@@frametitle{% - \mdfframedtitleenv{\mdf@frametitle}% -} - -\newrobustcmd*\mdf@@frametitle@use{% - \parskip\z@\relax% - \parindent\z@\relax% +\newrobustcmd\mdf@@frametitle@use{% \mdf@ignorevbadness% \setbox\mdf@splitbox@one=\vbox{% + \parskip\z@\relax% + \parindent\z@\relax% \offinterlineskip\relax% \unvcopy\mdf@frametitlebox\relax% \mdf@@frametitlerule\relax% @@ -682,18 +748,10 @@ \setbox\mdf@splitbox@one=\vbox{\unvbox\mdf@splitbox@one}% \mdfsetup{innertopmargin=\mdf@frametitleaboveskip@length}% } -\newrobustcmd*\mdf@checkntheorem{% - \ifbool{mdf@ntheorem}% - {\ifundef{\theorempreskipamount}% - {\mdf@PackageWarning{You have not loaded ntheorem yet}}% - {\setlength{\theorempreskipamount}{\z@}% - \setlength{\theorempostskipamount}{\z@}% - }% - }{}% -} \newrobustcmd*\mdf@footnoterule{% \kern0\p@% \hrule \@width 1in \kern 2.6\p@} + \newrobustcmd*\mdf@footnoteoutput{% \ifvoid\@mpfootins\else% \nobreak% @@ -703,30 +761,13 @@ \unvbox\@mpfootins% \fi% } + \newrobustcmd*\mdf@footnoteinput{% \def\@mpfn{mpfootnote}% \def\thempfn{\thempfootnote}% \c@mpfootnote\z@% \let\@footnotetext\@mpfootnotetext% } -\newrobustcmd*\mdf@load@style{% -\ifcase\value{mdf@globalstyle@cnt}\relax% - \input{md-frame-0.mdf}% - \or\input{md-frame-1.mdf}% - \or\input{md-frame-2.mdf}% - \or\input{md-frame-3.mdf}% - \else% - \IfFileExists{md-frame-\value{mdf@globalstyle@cnt}.mdf}% - {\input{md-frame-\value{mdf@globalstyle@cnt}.mdf}}% - {% - \input{md-frame-0.mdf}% - \mdf@PackageWarning{The style number \value{mdf@globalstyle@cnt} - does not exist^^J - mdframed ues instead style=0 \mdframedpackagename}% - }% -\fi% -}% -\mdf@load@style \newrobustcmd*\mdf@styledefinition{%AVOID!!!Needed for framemethod=default \ifnumequal{\value{mdf@globalstyle@cnt}}{0}% {\deflength{\mdf@innerlinewidth@length}{\z@}% @@ -741,15 +782,15 @@ \newrobustcmd*\detected@mdf@put@frame{% \ifmdf@nobreak%Option nobreak=true? \def\mdf@reserved@a{\mdf@put@frame@standalone}% - \else + \else% \def\mdf@reserved@a{\mdf@put@frame}% - \ifx\@captype\@undefined + \ifx\@captype\@undefined% \def\mdf@reserved@a{\mdf@put@frame}% - \else + \else% \mdf@PackageInfo{mdframed inside float ^^J mdframed uses option nobreak \mdframedpackagename}% \def\mdf@reserved@a{\mdf@put@frame@standalone}% - \fi + \fi% \if@minipage% \mdf@PackageInfo{mdframed inside minipage ^^J mdframed uses option nobreak \mdframedpackagename}% @@ -766,18 +807,20 @@ \newcount\mdf@envdepth \mdf@envdepth=0 \@definecounter{mdf@env@i} \@definecounter{mdf@env@ii} -\newenvironment{mdframed}[1][]{% -\color@begingroup% - \mdfsetup{userdefinedwidth=\linewidth,#1}% +\newrobustcmd*\mdf@preenvsetting{% \mdf@twoside@checklength% + \edef\mdf@par@local{% + \parskip=\the\parskip\relax% + \parindent=\the\parindent\relax}% + \parskip\z@% + \parindent\z@% \let\width\z@% \let\height\z@% \mdf@checkntheorem% - \ifbool{mdf@draft}% - {% - \ifdimgreater{\overfullrule}{0pt}{}{\setlength\overfullrule{5pt}}% - }{}% - \ifnum\mdf@envdepth >\tw@\@toodeep\else + \ifbool{mdf@draft}{% + \ifdimgreater{\overfullrule}{0pt}{}{\setlength\overfullrule{5pt}}}{}% + %% Nested environments and provide an extra counter. + \ifnum\mdf@envdepth >\tw@\@toodeep\else% \advance\mdf@envdepth\@ne \edef\mdf@depthctr{mdf@env@\romannumeral\the\mdf@envdepth}% \fi @@ -785,44 +828,61 @@ \mdf@footnoteinput% \color{\mdf@fontcolor}% \mdf@font% +} +\newrobustcmd*\mdf@@ignorelastdescenders{% + \ifbool{mdf@ignorelastdescenders}% + {% + \par\strut\par% + \unskip\unskip\setbox0=\lastbox + \vspace*{\dimexpr\ht\strutbox-\baselineskip\relax}% + }{}% +} +\newenvironment{mdframed}[1][]{% + \color@begingroup% + \mdfsetup{userdefinedwidth=\linewidth,#1}% + \mdf@startcode% + \mdf@preenvsetting% + \ifdefempty{\mdf@firstframetitle}{}% + {\let\mdf@frametitlesave\mdf@frametitle% + \let\mdf@frametitle\mdf@firstframetitle% + }% \ifvmode\nointerlineskip\fi% \mdf@trivlist{\mdf@skipabove@length}%% - \ifdefempty{\mdf@frametitle}{}{\mdf@@frametitle}% \mdf@settings% - \ifbool{mdf@suppressfirstparskip}{\addtolength{\mdf@innertopmargin@length}{-\parskip}}{}% \mdf@lrbox{\mdf@splitbox@one}% + \mdf@startinnercode% }% {% - \ifbool{mdf@ignorelastdescenders}% - {% - \par\strut\par - \unskip\unskip\setbox0=\lastbox - \vspace*{\dimexpr\ht\strutbox-\baselineskip\relax}% - }{}% - \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%% - \ifmdf@footnoteinside% + \mdf@@ignorelastdescenders% + \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%% + \ifmdf@footnoteinside% \def\mdf@reserveda{% \mdf@footnoteoutput% + \mdf@endinnercode% \endmdf@lrbox% - \ifdefempty{\mdf@frametitle}{}{\mdf@@frametitle@use}% + \ifdefempty{\mdf@frametitle}{}% + {\mdfframedtitleenv{\mdf@frametitle}\mdf@@frametitle@use}% \detected@mdf@put@frame}% - \else% + \else% \def\mdf@reserveda{% + \mdf@endinnercode% \endmdf@lrbox% - \ifdefempty{\mdf@frametitle}{}{\mdf@@frametitle@use}% + \ifdefempty{\mdf@frametitle}{}% + {\mdfframedtitleenv{\mdf@frametitle}\mdf@@frametitle@use}% \detected@mdf@put@frame% \mdf@footnoteoutput% }% - \fi% - \mdf@reserveda% - \endmdf@trivlist% -\color@endgroup\@doendpe% + \fi% + \mdf@reserveda% + \aftergroup\endmdf@trivlist% + \color@endgroup% + \mdf@endcode% } \newtoggle{md:checktwoside} \settoggle{md:checktwoside}{false} \newrobustcmd*\mdf@twoside@checklength{% - \if@twoside + \if@twoside% \ifbool{mdf@usetwoside}% {\mdf@PackageInfo{mdframed works in twoside mode}% \settoggle{md:checktwoside}{true}% @@ -840,7 +900,7 @@ \zref@newprop*{mdf@pagevalue}[0]{\number\value{page}} \zref@addprop{\ZREF@mainlist}{mdf@pagevalue} \newrobustcmd*\mdf@zref@label{% - \stepcounter{mdf@zref@counter} + \stepcounter{mdf@zref@counter}% \zref@label{mdf@pagelabel-\number\value{mdf@zref@counter}}% } \newrobustcmd*\if@mdf@pageodd{% @@ -869,81 +929,65 @@ \addtolength\mdf@freevspace@length{\dimexpr-\parskip\relax}\relax% }% } -\newrobustcmd*\mdf@advancelength@horizontalmargin@sub[1]{% - \advance\mdf@horizontalspaceofbox by -\csname mdf@#1@length\endcsname\relax% +\newrobustcmd*\mdf@advancelength@sub[2]{% + \advance #1 by -\csname mdf@#2@length\endcsname\relax% +} +\newrobustcmd*\mdf@advancelength@add[2]{% + \advance #1 by \csname mdf@#2@length\endcsname\relax% } -\newlength\mdf@horizontalspaceofbox \newrobustcmd*\mdf@horizontalmargin@equation{% \setlength{\mdf@horizontalspaceofbox}{\mdf@userdefinedwidth@length}% - \mdf@dolist{\mdf@advancelength@horizontalmargin@sub}{% + \mdf@dolist{\mdf@advancelength@sub{\mdf@horizontalspaceofbox}}{% leftmargin,outerlinewidth,middlelinewidth,% innerlinewidth,innerleftmargin,innerrightmargin,% innerlinewidth,middlelinewidth,outerlinewidth,% rightmargin}% \notbool{mdf@leftline}% - {% - \advance\mdf@horizontalspaceofbox by \mdf@innerlinewidth@length\relax% - \advance\mdf@horizontalspaceofbox by \mdf@middlelinewidth@length\relax% - \advance\mdf@horizontalspaceofbox by \mdf@outerlinewidth@length\relax% - }{}% + {% + \mdf@dolist{\mdf@advancelength@add{\mdf@horizontalspaceofbox}}% + {innerlinewidth,middlelinewidth,outerlinewidth}% + }{}% \notbool{mdf@rightline}% - {% - \advance\mdf@horizontalspaceofbox by \mdf@innerlinewidth@length\relax% - \advance\mdf@horizontalspaceofbox by \mdf@middlelinewidth@length\relax% - \advance\mdf@horizontalspaceofbox by \mdf@outerlinewidth@length\relax% - }{}% - \ifdimless{\mdf@horizontalspaceofbox}{3cm}% - {\mdf@PackageWarning{You have only a width of 3cm}}{}% + {% + \mdf@dolist{\mdf@advancelength@add{\mdf@horizontalspaceofbox}}% + {innerlinewidth,middlelinewidth,outerlinewidth}% + }{}% \hsize=\mdf@horizontalspaceofbox% } \newrobustcmd*\mdf@keeplines@single{% \notbool{mdf@topline}% {% - \advance\mdf@verticalmarginwhole@length % - by -\mdf@innerlinewidth@length\relax% - \advance\mdf@verticalmarginwhole@length % - by -\mdf@middlelinewidth@length\relax% - \advance\mdf@verticalmarginwhole@length % - by -\mdf@outerlinewidth@length\relax% + \mdf@dolist{\mdf@advancelength@sub{\mdf@verticalmarginwhole@length}}% + {innerlinewidth,middlelinewidth,outerlinewidth}% }{}% \notbool{mdf@bottomline}% {% - \advance\mdf@verticalmarginwhole@length % - by -\mdf@innerlinewidth@length\relax% - \advance\mdf@verticalmarginwhole@length % - by -\mdf@middlelinewidth@length\relax% - \advance\mdf@verticalmarginwhole@length % - by -\mdf@outerlinewidth@length\relax% + \mdf@dolist{\mdf@advancelength@sub{\mdf@verticalmarginwhole@length}}% + {innerlinewidth,middlelinewidth,outerlinewidth}% }{}% } -\newrobustcmd*\mdf@advancelength@verticalmarginwhole[1]{% - \advance\mdf@verticalmarginwhole@length % - by \csname mdf@#1@length\endcsname\relax% -} -\newrobustcmd*\mdf@advancelength@freevspace@sub[1]{% - \advance\dimen@ by -\csname mdf@#1@length\endcsname\relax% -} -\newrobustcmd*\mdf@advancelength@freevspace@add[1]{% - \advance\dimen@ by \csname mdf@#1@length\endcsname\relax% -} -\protected@edef\mdf@reset{\boxmaxdepth\the\boxmaxdepth +\protected@edef\mdf@reset{\boxmaxdepth\the\boxmaxdepth% \splittopskip\the\splittopskip}% \newrobustcmd*\mdf@put@frame@standalone{\relax% - \ifvoid\mdf@splitbox@one\relax + \ifvoid\mdf@splitbox@one\relax% \mdf@PackageWarning{The environment is empty\MessageBreak}% - \let\mdf@reserved@a\relax% - \else + \else% %Hier berechnung Box-Inhalt+Rahmen oben und unten \setlength{\mdf@verticalmarginwhole@length}% {\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}% - \mdf@dolist{\mdf@advancelength@verticalmarginwhole}{% + \mdf@dolist{\mdf@advancelength@add{\mdf@verticalmarginwhole@length}}{% outerlinewidth,middlelinewidth,innerlinewidth,% innertopmargin,innerbottommargin,innerlinewidth,% - middlelinewidth,outerlinewidth}% + middlelinewidth,outerlinewidth,extratopheight}% \mdf@keeplines@single% - \def\mdf@reserved@a{\mdf@putbox@single}% - \fi - \mdf@reserved@a% + \begingroup% + \mdf@@setzref% + \booltrue{mdfsingleframe}% + \mdf@beforesingleframe% + \mdf@putbox@single% + \mdf@aftersingleframe% + \endgroup%Output no break + \fi% } \def\mdf@put@frame{\relax% \ifvoid\mdf@splitbox@one\relax @@ -956,78 +1000,78 @@ \mdf@PackageInfoSpace{\the\mdf@freevspace@length before the beginning of \MessageBreak the environment ending on input line \MessageBreak}% - \ifdimless{\mdf@freevspace@length}{2\baselineskip} + \ifdimless{\mdf@freevspace@length}{2\baselineskip}% {% - \mdf@PackageInfo{Not enough space on this page} + \mdf@PackageInfo{Not enough space on this page}% \vfill\eject% \def\mdf@reserved@a{\mdf@put@frame}% }{% %Hier berechnung Box-Inhalt+Rahmen oben und unten \setlength{\mdf@verticalmarginwhole@length}% {\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}% - \mdf@dolist{\mdf@advancelength@verticalmarginwhole}% + \mdf@dolist{\mdf@advancelength@add{\mdf@verticalmarginwhole@length}}% {% outerlinewidth,middlelinewidth,innerlinewidth,% innertopmargin,innerbottommargin,% - innerlinewidth,middlelinewidth,outerlinewidth}% + innerlinewidth,middlelinewidth,outerlinewidth,extratopheight}% \mdf@keeplines@single% \ifdimless{\mdf@verticalmarginwhole@length}{\mdf@freevspace@length}% - {%passt auf Seite% - \begingroup\mdf@@setzref\mdf@putbox@single\endgroup%Output no break + {%enough space / no break + \begingroup% + \mdf@@setzref% + \booltrue{mdfsingleframe}% + \mdf@beforesingleframe% + \mdf@putbox@single% + \mdf@aftersingleframe% + \endgroup%Output no break \let\mdf@reserved@a\relax% }% {% - \def\mdf@reserved@a{\mdf@put@frame@i}%passt nicht auf Seite - } + \def\mdf@reserved@a{\mdf@put@frame@i}%need to split + }% }% -\fi +\fi% \mdf@reserved@a% } \def\mdf@put@frame@i{%Box must be splitted \mdf@freepagevspace%gives \mdf@freevspace@length \dimen@=\the\mdf@freevspace@length\relax% \dimen@i=\mdf@innertopmargin@length\relax% - \advance\dimen@i by \mdf@innerlinewidth@length\relax% - \advance\dimen@i by \mdf@middlelinewidth@length\relax% - \advance\dimen@i by \mdf@outerlinewidth@length\relax% + \mdf@dolist{\mdf@advancelength@add{\dimen@i}}% + {innerlinewidth,middlelinewidth,outerlinewidth}% \advance\dimen@i by 2\baselineskip\relax% \ifdimless{\dimen@}{\dimen@i}% {\hrule \@height\z@ \@width\hsize% - \vfill\eject% + \vfill\eject%no room for two lines \def\mdf@reserved@a{\mdf@put@frame}% }% - {% - \mdf@dolist{\mdf@advancelength@freevspace@sub}{%calculate with \dimen@ - outerlinewidth,middlelinewidth,innerlinewidth,% - innertopmargin,splitbottomskip}% - \ifbool{mdf@everyline}% - {% - \ifbool{mdf@bottomline}% - {% - \advance\dimen@ by -\mdf@innerlinewidth@length% - \advance\dimen@ by -\mdf@middlelinewidth@length% - \advance\dimen@ by -\mdf@outerlinewidth@length% - }{}% + {%enough space for first part + \mdf@dolist{\mdf@advancelength@sub{\dimen@}}{%calculate with \dimen@ + outerlinewidth,middlelinewidth,innerlinewidth,%width of top rule + innertopmargin,splitbottomskip}%width of length + \ifboolexpr{ bool {mdf@everyline} and bool {mdf@bottomline} }% + {%need space for bottomline + \mdf@dolist{\mdf@advancelength@sub{\dimen@}}% + {innerlinewidth,middlelinewidth,outerlinewidth}% }{}% - \notbool{mdf@topline}% + \notbool{mdf@topline}%no top line {% - \advance\dimen@ by \mdf@innerlinewidth@length% - \advance\dimen@ by \mdf@middlelinewidth@length% - \advance\dimen@ by \mdf@outerlinewidth@length% + \mdf@dolist{\mdf@advancelength@add{\dimen@}}% + {innerlinewidth,middlelinewidth,outerlinewidth}% }{}% - \advance\dimen@.8\pageshrink + \advance\dimen@.8\pageshrink% \ifdimless{\ht\mdf@splitbox@one+\dp\mdf@splitbox@one}{\dimen@}% {\mdf@PackageWarning{You got a bad break\MessageBreak because the last box will be empty\MessageBreak - you have to change it manually\MessageBreak - by changing the text, the space\MessageBreak - or something else}% + you have to change it manually\MessageBreak + by changing the text, the space\MessageBreak + or something else}% \advance\dimen@ by -1.8\baselineskip\relax%needed???????????????????? }{}% - \setbox\mdf@splitbox@save=\vbox{\unvcopy\mdf@splitbox@one}% + \setbox\mdf@splitbox@save=\vbox{\unvcopy\mdf@splitbox@one}%save original \splitmaxdepth\z@ \splittopskip\mdf@splittopskip@length% \mdf@ignorevbadness% - \setbox\mdf@splitbox@two\vsplit\mdf@splitbox@one to \dimen@ + \setbox\mdf@splitbox@two\vsplit\mdf@splitbox@one to \dimen@\relax% \setbox\mdf@splitbox@two\vbox{\unvbox\mdf@splitbox@two}% \setbox\mdf@splitbox@one\vbox{\unvbox\mdf@splitbox@one}% \ifdimgreater{\ht\mdf@splitbox@two+\dp\mdf@splitbox@two}{\dimen@}% @@ -1036,12 +1080,12 @@ starting loop to iterate the splitting point\MessageBreak}% \setbox\mdf@splitbox@one=\vbox{\unvcopy\mdf@splitbox@save}% - \dimen@i=\dimen@%\relax - \@tempcnta=\z@\relax + \dimen@i=\dimen@\relax% + \@tempcnta=\z@\relax% \loop \ifdim\dimexpr\ht\mdf@splitbox@two+\dp\mdf@splitbox@two\relax>\dimen@ - \advance\dimen@i by -\p@\relax - \advance\@tempcnta by \@ne\relax + \advance\dimen@i by -\p@\relax% + \advance\@tempcnta by \@ne\relax% %% \wlog{***mdframed \string\@tempcnta=\the\@tempcnta***} %% \wlog{***mdframed \string\dimen@i=\the\dimen@i***} \mdf@ignorevbadness% @@ -1052,10 +1096,10 @@ \setbox\mdf@splitbox@two\vbox{\unvbox\mdf@splitbox@two}% \setbox\mdf@splitbox@one\vbox{\unvbox\mdf@splitbox@one}% \ifnum\@tempcnta>100 - \let\iterate\relax + \let\iterate\relax% \mdf@PackageWarning{correct box splittet fails^^J It seems you are using a non splittable - contents\MessageBreak} + contents\MessageBreak}% \setbox\mdf@splitbox@one=\vbox{\unvcopy\mdf@splitbox@save}% \setbox\mdf@splitbox@two=\vbox{}% \def\mdf@reserved@a{\mdf@put@frame}% @@ -1073,33 +1117,44 @@ \enlargethispage{\baselineskip}% \def\mdf@reserved@a{\mdf@put@frame}% \fi% + % Test if first splitted frame doesn't have the original with. + % occurs with math \ifdim\wd\mdf@splitbox@two=\wd\mdf@splitbox@one\relax \else% \mdf@PackageInfo{You first box width is to small^^J mdframed fixed it\MessageBreak}% \setbox\mdf@splitbox@two=\vbox% {% - \hrule \@height\z@ \@width\mdfboundingboxwidth\relax + \hrule \@height\z@ \@width\mdfboundingboxwidth\relax% \unvcopy\mdf@splitbox@two% }% \fi% \ifvoid\mdf@splitbox@two\relax% - {\hrule \@height\f@size pt \@width\z@% + {% + \hrule \@height\f@size pt \@width\z@% \hrule \@height\z@ \@width\hsize}% \setbox\mdf@splitbox@one=\vbox{\unvcopy\mdf@splitbox@save}% - \def\mdf@reserved@a{\mdf@put@frame}% + \def\mdf@reserved@a{\mdf@put@frame% + }% \else% \ifdimequal{\ht\mdf@splitbox@two}{0pt}% - {\hrule \@height\z@ \@width\hsize% + {% + \hrule \@height\z@ \@width\hsize% \vfill\eject% \setbox\mdf@splitbox@one=\vbox{\unvcopy\mdf@splitbox@save}% \def\mdf@reserved@a{\mdf@put@frame}% }% {% - \begingroup\mdf@@setzref\mdf@putbox@first\endgroup% - \hrule \@height\z@ \@width\hsize% - \vfill\eject% - \def\mdf@reserved@a{\mdf@put@frame@ii}% + \begingroup% + \mdf@@setzref% + \mdf@beforebreak% + \booltrue{mdffirstframe}% + \mdf@putbox@first% + \mdf@afterbreak% + \endgroup% + \hrule \@height\z@ \@width\hsize% + \vfill\eject% + \def\mdf@reserved@a{\mdf@put@frame@ii}% }% \fi% }% @@ -1108,16 +1163,18 @@ \def\mdf@put@frame@ii{% \setlength{\mdf@freevspace@length}{\vsize}% \ifbool{mdf@repeatframetitle}% - {% + {%repeating title -- more robust using hooks. \toggletrue{mdf@notfirstframetitle}% \splitmaxdepth\z@ \splittopskip\z@% \setbox\mdf@splitbox@one=\vbox{\break\unvbox\mdf@splitbox@one}% \mdf@ignorevbadness% \setbox0=\vsplit\mdf@splitbox@one to \z@\relax% - \setbox\mdf@splitbox@one=\vbox{\unvbox\mdf@splitbox@one} + \setbox\mdf@splitbox@one=\vbox{\unvbox\mdf@splitbox@one}% \setbox\mdf@splitbox@one\vbox% {% - \vbox to \mdf@frametitleaboveskip@length{} + \parskip\z@\relax% + \parindent\z@\relax% + \vskip\mdf@frametitleaboveskip@length% \unvcopy\mdf@frametitlebox\relax% \mdf@@frametitlerule\relax% \unvbox\mdf@splitbox@one\relax% @@ -1125,51 +1182,40 @@ \setbox\mdf@splitbox@one=\vbox{\unvbox\mdf@splitbox@one}% }{}% \setlength{\dimen@}{\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}% - \mdf@dolist{\mdf@advancelength@freevspace@add}% - {%used \dimen@ - innerbottommargin,innerlinewidth,middlelinewidth,outerlinewidth,% - }% - \ifbool{mdf@everyline}% + \mdf@dolist{\mdf@advancelength@add{\dimen@}}% + {innerbottommargin,innerlinewidth,middlelinewidth,outerlinewidth}% + \ifboolexpr { bool {mdf@everyline} and bool {mdf@topline} }% {% - \ifbool{mdf@topline}% - {% - \advance\dimen@ by \mdf@innerlinewidth@length\relax% - \advance\dimen@ by \mdf@middlelinewidth@length\relax% - \advance\dimen@ by \mdf@outerlinewidth@length\relax% - }{}% + \mdf@dolist{\mdf@advancelength@add{\dimen@}}% + {innerlinewidth,middlelinewidth,outerlinewidth}% }{}% - \notbool{mdf@bottomline}% + \notbool{mdf@bottomline}%remove bottom if neccessary {% - \advance\dimen@ by -\mdf@innerlinewidth@length\relax% - \advance\dimen@ by -\mdf@middlelinewidth@length\relax% - \advance\dimen@ by -\mdf@outerlinewidth@length\relax% - \relax% + \mdf@dolist{\mdf@advancelength@sub{\dimen@}}% + {innerlinewidth,middlelinewidth,outerlinewidth}% }{}% \ifdimgreater{\dimen@}{\mdf@freevspace@length}% {%have a middle box \advance\mdf@freevspace@length by -\mdf@splitbottomskip@length\relax% - \ifbool{mdf@everyline}% + \ifbool{mdf@everyline}%regard top and bottom if everyline is used {% \ifbool{mdf@topline}% {% - \advance\mdf@freevspace@length by -\mdf@innerlinewidth@length\relax% - \advance\mdf@freevspace@length by -\mdf@middlelinewidth@length\relax% - \advance\mdf@freevspace@length by -\mdf@outerlinewidth@length\relax% + \mdf@dolist{\mdf@advancelength@sub{\mdf@freevspace@length}}% + {innerlinewidth,middlelinewidth,outerlinewidth}% }{}% \ifbool{mdf@bottomline}% {% - \advance\mdf@freevspace@length by -\mdf@innerlinewidth@length\relax% - \advance\mdf@freevspace@length by -\mdf@middlelinewidth@length\relax% - \advance\mdf@freevspace@length by -\mdf@outerlinewidth@length\relax% - \relax + \mdf@dolist{\mdf@advancelength@sub{\mdf@freevspace@length}}% + {innerlinewidth,middlelinewidth,outerlinewidth}% }{}% }{}% \setbox\mdf@splitbox@save=\vbox{\unvcopy\mdf@splitbox@one}% \splitmaxdepth\z@ \splittopskip\mdf@splittopskip@length% \mdf@ignorevbadness% - \setbox\mdf@splitbox@two\vsplit\mdf@splitbox@one to \mdf@freevspace@length - \setbox\mdf@splitbox@two\vbox{\unvbox\mdf@splitbox@two} - \setbox\mdf@splitbox@one\vbox{\unvbox\mdf@splitbox@one} + \setbox\mdf@splitbox@two\vsplit\mdf@splitbox@one to \mdf@freevspace@length% + \setbox\mdf@splitbox@two\vbox{\unvbox\mdf@splitbox@two}% + \setbox\mdf@splitbox@one\vbox{\unvbox\mdf@splitbox@one}% \ifdimgreater{\ht\mdf@splitbox@two+\dp\mdf@splitbox@two}% {\mdf@freevspace@length}% {%splitted wrong @@ -1183,8 +1229,6 @@ \mdf@freevspace@length\relax \advance\dimen@i by -\p@\relax% \advance\@tempcnta by \@ne\relax% -%% \wlog{***mdframed \string\@tempcnta=\the\@tempcnta***} -%% \wlog{***mdframed \string\dimen@i=\the\dimen@i***} \ifnum\@tempcnta>100 \let\iterate\relax% \mdf@PackageWarning{correct box splittet fails^^J @@ -1213,10 +1257,16 @@ \else \setbox\mdf@splitbox@two=\vbox% {% - \hrule \@height\z@ \@width\mdfboundingboxwidth\relax + \hrule \@height\z@ \@width\mdfboundingboxwidth\relax% \unvcopy\mdf@splitbox@two% }% - \begingroup\mdf@@setzref\mdf@putbox@middle\endgroup% + \begingroup% + \mdf@@setzref% + \booltrue{mdfmiddleframe}% + \mdf@beforebreak% + \mdf@putbox@middle% + \mdf@afterbreak% + \endgroup% \hrule \@height\z@ \@width\hsize% \vfill\eject% \def\mdf@reserved@a{\mdf@put@frame@ii}% @@ -1246,13 +1296,103 @@ \hrule \@height\z@ \@width\mdfboundingboxwidth }% }{}% - \begingroup\mdf@@setzref\mdf@putbox@second\endgroup% + \begingroup% + \toggletrue{mdflastframe}% + \mdf@beforebreak% + \begingroup% + \mdf@@setzref% + \booltrue{mdflastframe}% + \mdf@beforelastframe% + \mdf@putbox@second% + \mdf@afterlastframe% + \endgroup% \hrule \@height\z@ \@width\hsize% + \mdf@afterbreak% + \endgroup% \let\mdf@reserved@a\relax% }% \mdf@reserved@a% } +\newrobustcmd\mdfsubtitle[2][]% +{% + \begingroup + \penalty-9995%set a breakpoint before the subtitle + \parindent\z@\relax% + \parskip\z@\relax% + \mdfsetup{#1}%only for subtitle options + \par\addvspace{\mdf@subtitleaboveskip@length}% + \setbox\z@=\vbox{% + \mdf@frametitlealignment% + \mdf@subtitlefont{#2}% + \mdf@@ignorelastdescenders% + \relax}% + \setbox\z@=\vbox{\unvbox\z@}% + \setbox\z@=\vbox{% + \parskip\z@\relax% + \parindent\z@\relax% + \offinterlineskip\relax% + \vbox to \mdf@subtitleinneraboveskip@length{}% + \unvbox\z@\relax% + \vbox to \mdf@subtitleinnerbelowskip@length{}% + }%\z@ contains the subtitle+required length + \setlength{\mdfsubtitleheight}{\dimexpr\ht\z@+\dp\z@\relax} + \setbox\z@=\vbox to \mdfsubtitleheight {\unvbox\z@}% + % \dimen@ is now the complete width + \mdf@templength=\linewidth\relax% + \mdf@dolist{\mdf@advancelength@add{\mdf@templength}}% + {innerleftmargin,innerrightmargin}% + \offinterlineskip\relax% + \ifbool{mdf@subtitleaboveline}{\mdf@drawsubtitleaboveline\par}{}% + \mdf@drawsubtitlebackground% + \box\z@% + \ifbool{mdf@subtitlebelowline}{\mdf@drawsubtitlebelowline}{}% + \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi% + \penalty 9995% + \addvspace{\mdf@subtitlebelowskip@length}% + \endgroup% + \@afterheading% +} + +\newrobustcmd\mdfsubsubtitle[2][]% +{% + \begingroup + \penalty-9995%set a breakpoint before the subtitle + \parindent\z@\relax% + \parskip\z@\relax% + \mdfsetup{#1}%only for subtitle options + \par\addvspace{\mdf@subsubtitleaboveskip@length}% + \setbox\z@=\vbox{% + \mdf@frametitlealignment% + \mdf@subsubtitlefont{#2}% + \mdf@@ignorelastdescenders% + \relax}% + \setbox\z@=\vbox{\unvbox\z@}% + \setbox\z@=\vbox{% + \parskip\z@\relax% + \parindent\z@\relax% + \offinterlineskip\relax% + \vbox to \mdf@subsubtitleinneraboveskip@length{}% + \unvbox\z@\relax% + \vbox to \mdf@subsubtitleinnerbelowskip@length{}% + }%\z@ contains the subtitle+required length + \setlength{\mdfsubsubtitleheight}{\dimexpr\ht\z@+\dp\z@\relax} + \setbox\z@=\vbox to \mdfsubsubtitleheight {\unvbox\z@}% + % \dimen@ is now the complete width + \mdf@templength=\linewidth\relax% + \mdf@dolist{\mdf@advancelength@add{\mdf@templength}}% + {innerleftmargin,innerrightmargin}% + \offinterlineskip\relax% + \ifbool{mdf@subsubtitleaboveline}{\mdf@drawsubtitleaboveline\par}{}% + \mdf@drawsubtitlebackground% + \box\z@% + \ifbool{mdf@subsubtitlebelowline}{\mdf@drawsubtitlebelowline}{}% + \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi% + \penalty 9995% + \addvspace{\mdf@subsubtitlebelowskip@length}% + \endgroup% + \@afterheading% +} %%%% _____t_____ %%%% | | %%%% | | @@ -1262,7 +1402,6 @@ %%%% | | %%%% |___________| %%%% b -%%Zusammenhaenge abfragen: \newrobustcmd*\mdf@test@ltrb{% \ifboolexpr{ (bool {mdf@topline}) and (bool {mdf@bottomline}) and (bool {mdf@leftline}) and (bool {mdf@rightline})}} @@ -1317,7 +1456,6 @@ test {\mdf@test@lrb} or test {\mdf@test@lb} or test {\mdf@test@rb} or test {\mdf@test@tr} or test {\mdf@test@lt} ) }} -\DisableKeyvalOption[action=warning,package=mdframed]{mdf}{framemethod}% \DisableKeyvalOption[action=warning,package=mdframed]{mdf}{xcolor}% \endinput |