Page Layoutautomatic footline

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
michael_b
Posts: 15
Joined: Fri Nov 06, 2009 11:20 am

automatic footline

Post by michael_b »

Hey all,

i have written a report in latex. Therefore i have created a special configuration site where all special terms are selected. Among other things there are selected the automatic headline (with section and site number) and the automatic footline (with subsection). For some sites i haven't got a subsection. In this case the footline shows the latest subsection. So how can i tell latex that there is no subsection in this section so that the footline stays empty or how can i tell latex that e.g. the site 4 has no footline?

thanks
Michael

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

automatic footline

Post by gmedina »

Hi,

you forgot to mention some important information: the document class that you are using and how you are defining the headers and footers for your document.

Anyway, the following example code will show you one possible solution (if I understood your problem correctly). The idea is to use the titlesec package to define two page styles, one with footer (that I called wfooter in the example) and the other one without footer (wofooter, in my example). Then you can switch between styles (using the \pagestyle or \thispagestyle command) according to your needs.

Here's the example code:

Code: Select all

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

\setmarks{section}{subsection}

\newpagestyle{wfooter}
  {\sethead{\thesection\ \sectiontitle}{}{\thepage}
    \setfoot{\thesubsection\ \subsectiontitle}{}{}}

\newpagestyle{wofooter}
  {\sethead{\thesection\ \sectiontitle}{}{\thepage}
    \setfoot{}{}{}}

\begin{document}

\pagestyle{wfooter}% style with header and footer
\section{Test section one}
\lipsum[1]
\subsection{Test subsection one one}
\lipsum[1-4]
\subsection{Test subsection one two}
\lipsum[1-5]

\section{Test section two}
\pagestyle{wofooter}% style with header and no footer
\lipsum[1-10]

\section{Test section three}% style with header and footer
\pagestyle{wfooter}
\lipsum[1]
\subsection{Test subsection three one}
\lipsum[1-4]
\subsection{Test subsection three two}
\lipsum[1-5]

\end{document}
Of course, feel free to adapt my example according to your needs.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply