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 have a series of mdframed frames in the document. Some frames are few pages long, and some pages have two frames within.

How can I display the frametitle of the corresponding page in the header as we display sections in the header.

\begin{mdframed}[style=example,frametitle=Some Title]
....
\end{mdframed}
\begin{mdframed}[style=example,frametitle=Some Title]
.....
\end{mdframed}
share|improve this question
    
are you using fancyhdr? –  cmhughes Apr 19 '12 at 17:07
    
@cmhughes yes, I have it too. –  All Apr 19 '12 at 17:12

1 Answer 1

up vote 8 down vote accepted

The package mdframed stores the frame title in the command \mdf@frametitle. To bring this title to the header I used the internal command \@mkboth. This command is used inside the definitions of headings. Based on the token @ you have to use makeatletter/makeatother.

\documentclass{scrartcl}

\usepackage{mdframed}
\usepackage{lipsum}
\makeatletter
\mdfdefinestyle{example}{settings={\@mkboth{\mdf@frametitle}{\mdf@frametitle}}}
\makeatother
\pagestyle{headings}
\begin{document}

\begin{mdframed}[style=example,frametitle=Some Title 1]
\lipsum
\end{mdframed}
\begin{mdframed}[style=example,frametitle=Some Title 2]
\lipsum[1]
\end{mdframed}

\begin{mdframed}[style=example,frametitle=Some Title 3]
\lipsum[1]
\end{mdframed}
\begin{mdframed}[style=example,frametitle=Some Title 4]
\lipsum[1]
\end{mdframed}
\end{document}

enter image description here

share|improve this answer

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.