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 am using the shaded environment in the framed package to wrap some text lines that may go across two different pages. If there is a crossing of pages, I'd like to automatically add a line "(continue on next page)" to the first shaded box. Is there an easy way to do so? Thank you.

share|improve this question
    
I recommend to use the newer mdframed package instead of the framed package. However, it also doesn't seem to have such a feature, but it might be done by patching \md@putbox@first and \md@putbox@middle. –  Martin Scharrer Jul 26 '11 at 9:49
2  
I have a new version of mdframed Maybe in two weeks the new version will be finished. A current pretest you can download here: mrunix.de/forums/… –  Marco Daniel Jul 26 '11 at 10:00
    
I think the usual wording is "continued on next page" as in "This article is continued on the next page", not "continue on next page" as in "Continue reading this article on the next page" (Google: 10m vs. 275k). –  doncherry Jul 26 '11 at 12:22

1 Answer 1

I recommend to use the newer mdframed package instead of the framed package. However, it also doesn't seem to have such a feature, but it might be done by patching \md@putbox@first and \md@putbox@middle.

Here something quick and dirty:

\documentclass{article}

\usepackage{mdframed}
\usepackage{lipsum}
\usepackage{xcolor}

\makeatletter
\let\orig@md@putbox@first\md@putbox@first
\def\md@putbox@first{%
    \orig@md@putbox@first
    \nopagebreak
    \vspace{-\baselineskip}%
    \vbox to 0pt{\hbox to \linewidth{\hss(continue on next page)}\vss}%
}
\let\orig@md@putbox@middle\md@putbox@middle
\def\md@putbox@middle{%
    \orig@md@putbox@middle
    \nopagebreak
    \vspace{-\baselineskip}%
    \vbox to 0pt{\hbox to \linewidth{\hss(continue on next page)}\vss}%
}
\makeatother

\begin{document}
\lipsum[1]

\bigskip

\begin{mdframed}[backgroundcolor=gray]
\lipsum[1-30]
\end{mdframed}
\end{document}

Result

share|improve this answer
    
not tested: addto\md@putboxfirst{\vbox to 0pt{\hbox to \linewidth{\hss(continue on next page)}\vss}} –  Marco Daniel Jul 26 '11 at 10:18
    
@Macro: That was my very first try as well :-) It didn't work. It places that line on a page of its own afterwards. –  Martin Scharrer Jul 26 '11 at 10:39
    
Thanks: Only at the weekend I can spend my time at home. Maybe for the next version it is an inspiration. –  Marco Daniel Jul 26 '11 at 14:05

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.