I'm putting a template together and I have created a custom command which I'm going to use to set specific margins on the text passed to its argument and a few more formatting things, like this:
\newcommand{\mytextbox}[1] {#1} I want it so text passed to this command splits across new pages nicely but before the new page begins, I want to print a new separate line saying "Continued on next page" and on the next page, print a line above the remaining text saying "Continued from previous page".
So for example if I do this near the bottom of a page:
\mytextbox{\lipsum} It will print a few lines before flowing to the next page, but have my custom titles at the bottom and top of the next page, like this:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. **Continued on next page** -----new-page------------------------------- **Continued from previous page** Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. I've been banging my head against the wall trying to figure out a way to do this. Nothing seems to work for me. My best guess is finding something in TeX that controls when it wraps the lines, checking if its the last line of the page and inserting a \newpage command in to the text but I haven't found a way to do this and it seems a bit convoluted. I don't care whether mytextbox is a command or environment as long as it behaves as above.

`to mark your inline code as I did in my edit.fancyhdr? If not, I could attempt to write up a solution using that package.fancyhdrbut I'll consider anything as long as the titles are directly below and above the text as in the example, and only occur formytextboxitems.