Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Book and chapter name in the header

110 views
Skip to first unread message

minimus

unread,
Jul 30, 2012, 5:46:03 AM7/30/12
to
Hello,

I am writing my PhD thesis using he book class. I would like that the
even numbered pages indicate the title of my thesis and the odd numbered
pages indicate the associated chapter name. I tried to do this with the
fancyhdr package using the \chead command but could not manage. Any help
would be appreciated.

Lars Madsen

unread,
Jul 30, 2012, 6:03:01 AM7/30/12
to
might be nice with a minimal example, such we can see what you are doing

--

/daleif (remove RTFSIGNATURE from email address)

Memoir and mh bundle maintainer
LaTeX FAQ: http://www.tex.ac.uk/faq
LaTeX book: http://math.au.dk/videnudveksling/latex/bog/ (in Danish)
Remember to post minimal examples, see URL below
http://www.minimalbeispiel.de/mini-en.html

minimus

unread,
Jul 30, 2012, 6:11:48 AM7/30/12
to
On 30-Jul-12 12:03, Lars Madsen wrote:
> minimus wrote, On 2012-07-30 11:46:
>> Hello,
>>
>> I am writing my PhD thesis using he book class. I would like that the
>> even numbered pages indicate the title of my thesis and the odd
>> numbered pages indicate the associated chapter name. I tried to do
>> this with the fancyhdr package using the \chead command but could not
>> manage. Any help would be appreciated.
>
> might be nice with a minimal example, such we can see what you are doing
>

Lars you are right. It is custom to include a minimal example and I
actually thought of including one. But I really do not have any syntax
written down for fancyhdr. So I myself cannot come up with a minimal
example really.

What I am asking is simply having the thesis title on the header of one
page, and the chapter title on the next page, and then again the thesis
title on the next page and so forth. That is all.

Lee Rudolph

unread,
Jul 30, 2012, 7:47:41 AM7/30/12
to
I am not aware of any built-in facility of the book class,
or any of the other standard classes, that automatically
assigns a "chapter title" (or book title) which can thereafter
be used in, e.g., a header. Certainly when one begins a
section with, e.g.,
\section{The Art and Science of Constructing MWEs},
nothing (that I know of) automatically stores
the string "The Art and Science of Constructing MWEs".
So (unless there is already a package out there to do
this and more) you will in any case have to have some
"syntax written down" for storing that string, then
recovering it for use in your header. (Actually,
it occurs to me that the required information *is* being
stored for use in the table of contents--but it is not
clear to me that extracting it from there would be worth
the trouble.)

My solution to a similar problem (similar but not identical
because (1) I was using memoir.cls rather than book.cls, and
memoir.cls incorporates features of fancyhdr--you might,
in fact, want to switch from book to memoir, for that and
many other reasons, and (2) I wanted the chapter name,
or rather a running head that might be a shortened version
of the chapter name, not a section name, on odd-numbered
pages [except of course the first page of the chapter,
which for my set-up was always odd-numbered; presumably
your sections can start on either even or odd pages, and
may even start in the middle of a page {meaning that you
must give some thought to the header on such a page}, and
the chapter author[s], not the book title, on even-numbered
pages) was as follows. In my preamble I defined

\def\subhead#1{\def\subheadcontents{#1}}
\def\subauthor#1{\def\subauthorname{#1}}

then initialized

\def\subheadcontents{\relax}
\def\subauthorname{\relax}

and proclaimed

\pagestyle{myheadings}
\makeevenhead{myheadings}{\thepage\qquad\subauthorname}{}{}
\makeoddhead{myheadings}{}{}{\subheadcontents\quad\thepage}

(in fact, it turned out to be somewhat different, because
when I was nearly done with the book, my publisher belatedly
informed me that the house style for chapters was to have
all major words [i.e., exclusing non-initial digraphs, "and",
etc.] capitalized *on the title page of the chapter and in
the table of contents*, but only the first word [and
proper nouns, and the first word following an internal
colon or em-dash...] capitalized *in the running head*,
grrrh). Then at the beginning of a chapter I could
write

\subhead{The Art and Science of Constructing MWEs}%
\subauthor{F. X. Spezial}%
\chapter{\subcontentsname\label{chap:\subcontentsname}}

and it all worked. (Maybe it shouldn't have; I don't
claim my way was "the right way", or even merely that
my way was right--I might have just been lucky. And
certainly, if I had been serious, I would have
automatically accomodated the few cases--in the
actual book in question--when I had to tweak the
chapter title in the table of contents [for esthetic
reasons] or abbreviate the chapter title in the
header [because it was too long altogether].)

Something along those lines might work for you. Or,
if you don't want to automate anything at all,
just start each chapter with the appropriate
handcrafted variation of the fancyhdr-like-syntax
given above (beginning with "\pagestyle{" and ending
with "\thepage}").

Lee Rudolph

Lars Madsen

unread,
Jul 30, 2012, 8:04:02 AM7/30/12
to
all of this is in the fancyhdr manual, a simple minimal example:

\documentclass[a4paper]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}

\renewcommand{\headrulewidth}{0pt}
\fancyhead{}
\fancufoot{}
\fancyhead[ER]{Thesis Title}
\fancyhead[EL,OR]{\thepage}
\fancyhead[OL]{\leftmark}


\usepackage{lipsum}

\begin{document}

\chapter{Test}
\lipsum[1-15]

\end{document}

As Lee mentioned, memoir provides better control than what is possible
in book plus fancyhdr, e.g. it is quite easy to remove the automatic
upper casing in memoir.

minimus

unread,
Jul 30, 2012, 8:09:22 AM7/30/12
to
Lee, I very much appreciate this detailed explanation but this is way
too complicated for me to comprehend. I am not proficient in latex but I
still suspect that there is a simple way to carry on the thesis title in
the header.

Alain Ketterlin

unread,
Jul 30, 2012, 9:34:58 AM7/30/12
to
minimus <min...@live.co.uk> writes:

> What I am asking is simply having the thesis title on the header of
> one page, and the chapter title on the next page, and then again the
> thesis title on the next page and so forth. That is all.

I may have missed something, but... doesn't section 8 of fancyhdr's
documentation describe almost exactly what you are looking for?

-- Alain.

Ulrike Fischer

unread,
Jul 30, 2012, 10:38:45 AM7/30/12
to
Am Mon, 30 Jul 2012 11:47:41 +0000 (UTC) schrieb Lee Rudolph:

> I am not aware of any built-in facility of the book class,
> or any of the other standard classes, that automatically
> assigns a "chapter title" (or book title) which can thereafter
> be used in, e.g., a header.

Sorry but this is nonsense.

In every class that I know \chapter issue internally a \chaptermark
command which stores the title normally in the left part a mark with
\markboth. You can retrieve the content in the header with
\leftmark.

You should *not* use \def\whatever to store the title and get it in
the header. They can due to the asynchronous page building get out
of sync. If it worked for you you were only lucky, and you should
certainly not tell other people to use the same way.



--
Ulrike Fischer

Lee Rudolph

unread,
Jul 30, 2012, 11:10:18 AM7/30/12
to
Well, I *did* tell them (him) that it was probably wrong.
This is an example of how all Usenet was in its Golden Era--
the best way to get good expert advice on something was to
give bad and inexpert advice, then wait a few hours. Thank
you!

However, what I wrote was *not* literally "nonsense": at
the time I wrote it--though not now--I was, just as I
wrote, "not aware" of \chaptermark (though I agree both
that I should have been, and that at some point I must have
been, since I *had* read the relevant parts of the memoir
manual, among other things; alas, my memory is less good
than it used to be).

And I was (as it turned out) lucky (though probably not
all *that* lucky; given that I was using the openright
option for chapters, and \cleardoublepage for the first
chapter of a part, my [still inexpert] guess is that
the asynchronous page building would be less likely,
though perhaps not entirely unlikely, to cause that
particular problem--yes? no?).

Lee Rudolph

minimus

unread,
Jul 30, 2012, 1:00:28 PM7/30/12
to
Almost but not exactly. I would like the book title to appear on odd
numbered pages (centered) and the chapter title on even numbered pages
(centered). Still do not know how to do it.

Alain Ketterlin

unread,
Jul 30, 2012, 2:18:06 PM7/30/12
to
minimus <min...@live.co.uk> writes:

> On 30-Jul-12 15:34, Alain Ketterlin wrote:
>> minimus<min...@live.co.uk> writes:
>>
>>> What I am asking is simply having the thesis title on the header of
>>> one page, and the chapter title on the next page, and then again the
>>> thesis title on the next page and so forth. That is all.
>>
>> I may have missed something, but... doesn't section 8 of fancyhdr's
>> documentation describe almost exactly what you are looking for?
>
> Almost but not exactly. I would like the book title to appear on odd
> numbered pages (centered) and the chapter title on even numbered pages
> (centered). Still do not know how to do it.

This is getting ridiculous. I suspect you're a troll.

So. What have you tried to adapt this example? What was the result?

-- Alain.

minimus

unread,
Jul 30, 2012, 3:48:21 PM7/30/12
to
Excuse me? If it was simple then people would have already said it
above. I do not know how to use the code for the task I am trying to
accomplish. That is why I ask it. And yes I did give several tries but I
could not manage anything. Now what is getting ridiculous?

Peter Flynn

unread,
Jul 30, 2012, 5:17:51 PM7/30/12
to
On 30/07/12 10:46, minimus wrote:
> Hello,
>
> I am writing my PhD thesis using he book class.

Don't. Use the report class, which is virtually identical except that it
allows an Abstract, which the book class does not (assuming your thesis
has to include an abstract -- most seem to need this).

> I would like that the even numbered pages indicate the title of my
> thesis and the odd numbered pages indicate the associated chapter
> name.

This implies two-sided printing. Check with your institution that this
is permitted: some of them require single-sided printing, for which this
setup would be meaningless.

Remember that the title page, abstract, ToC, and chapter starts will by
convention not have any running head.

> I tried to do this with the fancyhdr package using the \chead
> command but could not manage.

Wrong command: see the documentation, section 6, page 6.

\documentclass[twoside]{report}
\usepackage{fancyhdr,lipsum}
\makeatletter
% set up special headers
\pagestyle{fancy}
\fancyhead{}
\fancyhead[CE]{\@title}
\fancyhead[CO]{\leftmark}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
% redefine \maketitle so that it doesn't zap \@title
% this is copied verbatim from report.cls and three
% lines commented out.
\renewcommand\maketitle{\par
\begingroup
\renewcommand\thefootnote{\@fnsymbol\c@footnote}%
\def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
\long\def\@makefntext##1{\parindent 1em\noindent
\hb@xt@1.8em{%
\hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
\if@twocolumn
\ifnum \col@number=\@ne
\@maketitle
\else
\twocolumn[\@maketitle]%
\fi
\else
\newpage
\global\@topnum\z@
\@maketitle
\fi
\thispagestyle{plain}\@thanks
\endgroup
\setcounter{footnote}{0}%
\global\let\thanks\relax
\global\let\maketitle\relax
\global\let\@maketitle\relax
\global\let\@thanks\@empty
% \global\let\@author\@empty
% \global\let\@date\@empty
% \global\let\@title\@empty
\global\let\title\relax
\global\let\author\relax
\global\let\date\relax
\global\let\and\relax
}
\def\@maketitle{%
\newpage
\null
\vskip 2em%
\begin{center}%
\let \footnote \thanks
{\LARGE \@title \par}%
\vskip 1.5em%
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
\@author
\end{tabular}\par}%
\vskip 1em%
{\large \@date}%
\end{center}%
\par
\vskip 1.5em}
\makeatother
\begin{document}
\title{My Thesis}
\author{minimus}
\maketitle
\begin{abstract}
\lipsum[1]
\end{abstract}
\tableofcontents
\chapter{Intro}
\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]
\lipsum[5]
\lipsum[6]
\lipsum[7]
\lipsum[8]
\lipsum[9]
\lipsum[10]
\lipsum[11]
\lipsum[12]
\lipsum[13]
\lipsum[14]
\lipsum[15]
\end{document}

///Peter

Phillip Helbig---undress to reply

unread,
Jul 31, 2012, 1:15:56 AM7/31/12
to
In article <a7oc00...@mid.individual.net>, Peter Flynn
<pe...@silmaril.ie> writes:

> > I am writing my PhD thesis using he book class.
>
> Don't. Use the report class, which is virtually identical except that it
> allows an Abstract, which the book class does not (assuming your thesis
> has to include an abstract -- most seem to need this).

One can also have \chapter*{Abstract} with book.

Phillip Helbig---undress to reply

unread,
Jul 31, 2012, 1:22:16 AM7/31/12
to
> > > I am writing my PhD thesis using he book class.
> >
> > Don't. Use the report class, which is virtually identical except that it
> > allows an Abstract, which the book class does not (assuming your thesis
> > has to include an abstract -- most seem to need this).
>
> One can also have \chapter*{Abstract} with book.

Many institutes have rather strict requirements for the format of a
thesis. Some of these have their own class. Check this out before you
put too much effort into tweaking the output of some other class.

Peter Flynn

unread,
Jul 31, 2012, 4:37:12 PM7/31/12
to
You certainly can, but it's not an abstract, it's an unnumbered chapter
with "Abstract" as the title :-)

///Peter


Markus Kohm

unread,
Aug 1, 2012, 6:33:35 AM8/1/12
to
minimus (Montag, 30. Juli 2012 11:46):
If fancyhdr isn't a must, here's another suggestion:

\documentclass{book}
\usepackage[english]{babel}
\usepackage{blindtext}% only for demonstration of a document

\usepackage[standardstyle]{scrpage2}% see chapter 5 of scrguien.pdf

\pagestyle{scrheadings}
\automark{chapter}
% If you want marks on plain pages, i.e., first page of a chapter, too:
%\rehead[\MakeMarkcase{Thesis title}]{\MakeMarkcase{Thesis title}}
%\lohead[\leftmark]{\leftmark}

% If you don't want marks on plain pages:
\rehead{\MakeMarkcase{Thesis title}}
\lohead{\leftmark}

% If you want to remove the "CHAPTER n:" at the chapter mark:
%\renewcommand*{\chaptermarkformat}{}% Use this to remove the "CHAPTER n:"

\begin{document}
\blinddocument
\end{document}

minimus

unread,
Aug 3, 2012, 8:35:02 AM8/3/12
to
I would like to thank you all for your help. I finally solved the
problem with the following code:

\pagestyle{fancy}
\renewcommand{\chaptername}{}
\renewcommand{\headrulewidth}{0pt}
\fancyhead{}
\fancyhead[CE]{ESSAYS ON PARTIAL RETIREMENT}
\fancyhead[CO]{\leftmark}

minimus

unread,
Aug 3, 2012, 8:37:34 AM8/3/12
to
Thanks a lot for this. You have spent a lot time to answer. Thank you.

Robin Fairbairns

unread,
Aug 13, 2012, 7:54:19 AM8/13/12
to
minimus <min...@live.co.uk> writes:

> On 30-Jul-12 12:03, Lars Madsen wrote:
>> minimus wrote, On 2012-07-30 11:46:
>>> Hello,
>>>
>>> I am writing my PhD thesis using he book class. I would like that the
>>> even numbered pages indicate the title of my thesis and the odd
>>> numbered pages indicate the associated chapter name. I tried to do
>>> this with the fancyhdr package using the \chead command but could not
>>> manage. Any help would be appreciated.
>>
>> might be nice with a minimal example, such we can see what you are doing
>
> Lars you are right. It is custom to include a minimal example and I
> actually thought of including one. But I really do not have any syntax
> written down for fancyhdr.

really? not even texdoc helps?

in which case, have you not looked at
mirror.ctan.org/macros/latex/contrib/fancyhdr/fancyhdr.pdf
which is what texdoc should show you?

> So I myself cannot come up with a minimal
> example really.
>
> What I am asking is simply having the thesis title on the header of
> one page, and the chapter title on the next page, and then again the
> thesis title on the next page and so forth. That is all.

so thesis title on odd-numbered pages, chapter title on even-numbered?
not actually conventional, but perfectly doable with fancyhdr.
--
Robin Fairbairns, Cambridge
sorry about all this posting. i'll go back to sleep in a bit.
0 new messages