# mdframed+tikz to display overfullrule

This may or may not be a bug, so I'll first ask it here before reporting.

In the following test case:

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}

\overfullrule=5pt

\def\sentence{%
to be the morphism from $\delta^*$ to $(\delta')^*$ (resp.\ to
$(\delta'')^*$) such that $h'((p', p'')a(q', q''))$}

\begin{document}

\begin{mdframed}[hidealllines=true]
\sentence
\end{mdframed}

\begin{mdframed}[rightline=false,topline=false]
\sentence
\end{mdframed}

\end{document}


the overfullrule is drawn only in the first mdframed. How can I make it work in the second one too? This silent ignoring of overfullrule can be really dangerous...

Thanks!

• TeXlive 2012.26892-2 on Arch Linux
• latest mdframed from GitHub (1.6c, mdframed.dtx 436 2012-06-23 09:49:13Z marco)
-
Without any lines the with of the text area is longer and so you will get an other output. –  Marco Daniel Sep 18 '12 at 16:03
This is not the point; the two mdframed contain an overfull hbox, only the first one is signaled with an overfullrule. Thanks! –  Michaël Sep 18 '12 at 16:06
@Michaël The overfull rule is drawn: the message indeed ends with q[]\OT1/cmr/m/n/10 ))\$ | and the bar means precisely the rule. For some reason, with TikZ as frame method, this rule is not printed: everything that overflows the reserved area is blanked out (the two closing parentheses are missing too). –  egreg Sep 18 '12 at 16:28
@egreg Yeah, I guessed that the rule was just clipped (all the more since I saw examples with only half the rule). I prefered presenting the question without any guesswork :-) Though I didn't know about the "|" meaning of the message; thanks! –  Michaël Sep 18 '12 at 18:59

This question lead to the new option draft which is now implement in the development branch.

https://github.com/marcodaniel/mdframed

The contents of the environment mdframed is saved in a savebox. The output, if you use framemethod=tikz, will be done by the environment tikzpicture. To allow the options of three different lines I must work with the command \clip provided by tikz which also clips the overfull boxes.

If you use the option hidealllines=true there is nothing to clip which results in the output of overfull boxes.

To show the overfull markers you can do the following:

\makeatletter
\renewrobustcmd*\mdf@tikzbox@tfl[1]{%three or four borders
%\clip
\path(0,0)rectangle(\mdfboundingboxwidth,\mdfboundingboxheight);%
\begin{scope}[mdfcorners]%
\clip[preaction=mdfouterline]%
[postaction=mdfbackground]%
[postaction=mdfinnerline]#1;%
\end{scope}%
\path[mdfmiddleline,mdfcorners]#1;
}%

\renewrobustcmd*\mdf@tikzbox@otl[2]{%one or two borders
%\clip
\path(0,0)rectangle(\mdfboundingboxwidth,\mdfboundingboxheight);%
\begin{scope}
\path[mdfouterline,mdfcorners]#1;%
\clip[postaction=mdfbackground]#2;%
\path[mdfinnerline,mdfcorners]#1;%
\end{scope}%
\path[mdfmiddleline,mdfcorners]#1;}%
\makeatother


-
Probably an option for clipping or nonclipping should be used; maybe draft? –  egreg Sep 18 '12 at 16:33
@egreg: Great idea. –  Marco Daniel Sep 18 '12 at 16:36
Well, an answer from the man himself, great! Removing those "clips" is what I did to make it work; I was expecting a cleaner answer: adding a draft option is indeed a great idea! Thanks! –  Michaël Sep 18 '12 at 19:01
@Michaël: Added option –  Marco Daniel Sep 20 '12 at 12:27
@Michaël: Can you accept my answer please? –  Marco Daniel Sep 21 '12 at 16:09