Page LayoutQuestion about the Extramarks package

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
jmriff
Posts: 1
Joined: Sun Aug 30, 2009 1:23 am

Question about the Extramarks package

Post by jmriff »

I am using the Extramarks package supplied with Fancyhdr becuase I want the header to say "Section <XYZ> Continued" when content for a \section{} spills onto a follow on page. I acheive this as follows:

\Section{XYZ}
\extramarks{}{}
text text text text
text text text text...
\extramarks{Section XYZ Continued}{}
\extramarks{}{}

This works very well if content for a \section{} only spills onto 1 more page. If the content for a \section{} spills onto multiple pages, then the "Section <XYZ> Continued" remark only appears in the header for the last page for which there is content for \section{}. The header for the preceeding pages with \section{} content is blank. Why is this? How can I get "Section <XYZ> Continued" remarks to appear on all headers wich contain \section{XYZ} content minus the first page where \section{XYZ} content appears?

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Question about the Extramarks package

Post by gmedina »

Hi,

instead of using fancyhdr and extramarks, I would suggest you to use the titlesec package. In the following example I defined two new page styles: mysec, to be used in the first page of a section and myseccon to be used in the second, third, etc. pages of a section. I also redefined the format for the section headings to include the mysec page style.

Code: Select all

\documentclass{article}
\usepackage[pagestyles]{titlesec}
\usepackage{lipsum}

% style for the first page of a section
\newpagestyle{mysec}{\sethead{}{}{\thesection\enspace\sectiontitle}}

% style for the second, third, etc. pages of a section
\newpagestyle{myseccon}{\sethead{}{}{\thesection\enspace\sectiontitle\space (Continued)}}

% redefining the format for section headings; the new format basically imitates the
% standard format, but uses the page style "mysec"
\titleformat{\section}
  {\normalfont\Large\bfseries}{\thesection}{1em}{\thispagestyle{mysec}}
\titlespacing*{\section}
  {0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}

\begin{document}

\pagestyle{myseccon}

\section{First test section}
\lipsum[1-20]

\section{Second test section}
\lipsum[1-20]

\end{document}
Of course, feel free to adapt my example according to your needs; please refer to the package documentation for further information.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply