Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using TikZ to draw a box around text with a heading, and it works great if the content of the box can fit on one page, but if it doesn't, it goes past the bottom margin, into the page number, and then is simply cut off without continuing on the next page. How would I get it to tell when it reaches the end of the page and to continue on the next?

I found this example, which implements something similar, but I can't make enough sense of it to be able to implement it in my code.

\newcommand{\fancybox}[4]
{
    \tikzstyle{thmbox} = [rectangle, rounded corners, draw=black, fill=#4, inner sep=15pt, drop shadow={fill=black, opacity=.5}]%
    \tikzstyle{fancytitle} =[fill=white, text=black, rectangle, rounded corners, draw= black]%
    \noindent%
    \begin{tikzpicture}%
    \node [thmbox] (box){%
        \begin{minipage}{.91\textwidth}%
        \textit{#3}%
        \end{minipage}%
    };%
    \node[fancytitle, right=10pt] at (box.north west) {\textbf{#1:} #2};%
    \end{tikzpicture}
    \\\\
}
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

I'd suggest you try instead the mdframed package. In the latest documentation on CTAN the first box is cut right in half by a pagebreak and everything's fine (although I believe it was not intentional... :)).

share|improve this answer
    
I'm aware of the existence of packages which have this feature like mdframed, but I specifically chose TikZ for this task because it's the best documented, meaning that I can customize it to look however I want with more ease. –  howardh Feb 5 '12 at 8:06
    
mdframed loads TikZ if you ask it to. As for the documentation of TikZ... hmm, I beg to differ: I truly think there are packages out there that are more comprehensively documented. Not that TikZ weren't a great tool. –  Count Zero Feb 5 '12 at 8:56
    
Better documented than anything else I've seen so far in any case. I just realized that I've been given the exact same answer for another one of my questions, but I didn't use mdframed because I couldn't get it to install properly. I'll try this out once I can get TeX Live 2011 installed and working. –  howardh Feb 5 '12 at 18:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.