# add “tag” to every page containing mdframed

Suppose I have an mdframed that spans several pages.

Each mdframed will have a title but because one frame may span many pages what actually is under discussion in the frame may be lost by the reader when quickly searching for information.

So, what I would like to do is add a sort of "header" to each page(just like many books put the chapter title and/or section somewhere on the page.

The "header" though, is really the frame title or some other similar text that is placed on every page the mdframed is on except possibly the first(since it may already exists as the frametitle).

The text probably will be vertical if on the left and right margins and horizontal if at the top and bottom.

Is there any way to add this to an mdframed? Basically it just needs some intelligence to not add itself the first time and to do something different at the end of the frame else it will just put itself in the same place every time along the border of the frame.

Update:

The code demonstrates the issue/"bug" with mdframed. A frame title appears at the end of a frame but the first thing on a new page(in my case it is opposite in that it I get a frametitle without any content(on the same page) at the start instead of at the end due to the type of content I'm using.

Basically the frame should end on the previous if it's content, on that page, is empty. (or in my case the frame should start on the next page (in my case I can use \newpage to fix the problem if I can put it in the right spots, which is difficult))

Also notice how rounded corners in subsequent frametitles on the same frame look bad. Roundcornershould be 0 on subsequent intra-frametitles.

\documentclass{book}

\usepackage{tikz, pgffor}
\usepackage[framemethod=TikZ]{mdframed}

\newcommand{\myframe}[2]{
\begin{mdframed}[rightline=true,
frametitlerule=true,frametitlerulecolor=blue,
frametitlebackgroundcolor=gray,repeatframetitle=true,
align=center,linecolor=gray, middlelinewidth=2pt,roundcorner=10pt, innerbottommargin=0.5cm, innertopmargin=0.05cm, frametitleaboveskip=8.5pt, skipbelow=10pt,frametitlealignment={\hspace*{0.25cm}},frametitle={#1}]#2\end{mdframed}
}%

\begin{document}

\foreach \l in {1,2,3,4,5,6,7,8,9} {\myframe{Title}{Frame \l{} content \hrule \vspace{8cm}
\hrule}}

\end{document}


• Would you be so kind as to add some visual aid by means of a picture? Even if you created a document in MS Word and post the output in picture form for others to see. Also, include a minimal working example (MWE) that interested community members can work with. – Werner Jul 12 '12 at 5:28
• Use the option repeattitle=true – Marco Daniel Jul 12 '12 at 17:25
• @MarcoDaniel: The code  \ifbool{mdf@repeatframetitle}% {% \setlength{\mdf@roundcorner@length}{\z@}% \toggletrue{mdf@notfirstframetitle}% Makes subsequent titles square. – AbstractDissonance Aug 12 '12 at 6:01

The package mdframed provides the option repeatframetitle.

Here an example:

\documentclass{article}
\usepackage[framemethod=tikz,repeatframetitle=true,frametitlebackgroundcolor=green]{mdframed}
\usepackage{kantlipsum}
\begin{document}

\begin{mdframed}[frametitle={My Frametitle}]
\kant
\end{mdframed}
\end{document}


Any modifications of the repeated frame title are currently not implemented.

• This doesn't work very well. When a new frame is created and it is right at the bottom of the first page the frametitle is repeated twice: One at the very bottom of the page and the other at the top of the new page with the rest of the frame. Also, I'm using rounded corners on the frame which do not continue over on subsequent repeats. It would be nice to use rounded corners on the first frame and then square corners on subsequent repeats. I'll update my question with an example showing the problem. – AbstractDissonance Aug 8 '12 at 20:25