I wish to put book title on the left header, and chapter title on the
right header.
Cute ideas? thanks.
-Marsup
\pagestyle{fancy}
\fancyhead{RO,LE}{}
\fancyhead{LE,RO}{}
\fancyhead{CE}{\small\@title}
\fancyhead{CO}{\small\rightmark}
(untested, I'm away from base right now)
///Peter
What is the meanting of @title here? I am not good at these,
however, if I wish to put the book title, how can I change this?
{\small\@title}
Any one while Peter is away? Thanks.
-Marsup
After the command
\title{My Actual Title Here}
the title text is stored in the macro \@title. However, after the
command
\maketitle
the contents of \@title are discarded. Thus, Peter's code cannot
work unless
1. You use \title
2. You don't use \maketitle
Also, since the macro uses an @ sign, you must surround
it with \makeatletter and \makeatother.
\makeatletter
\fancyhead{CE}{\small \@title}
\makeatother
A better solution would be to type in the actual title:
\pagestyle{fancy}
\fancyhead{RO,LE}{}
\fancyhead{LE,RO}{}
\fancyhead{CE}{\small My Actual Title Here}
\fancyhead{CO}{\small\rightmark}
Caveat: I do not use fancyhdr, so I can't say for sure if Peter's
incantations are otherwise correct. But clearly the fancyhdr
documentation would be able to say.
Dan
No, they are not correct! The positioning arguments
should go inside square brackets.
\newcommand{\booktitle}{How to write a book}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[CE]{\small\booktitle}
\fancyhead[CO]{\small\rightmark}
\fancyfoot{\small\thepage}
The command \fancyhf{} resets all header and footer fields,
so we need only to fill in the ones we want.
If \title is needed, it's easy:
\title{\booktitle}
\maketitle
Ciao
Enrico
\@title is where LaTeX stores the title you give in \title.
> I am not good at these,
> however, if I wish to put the book title, how can I change this?
> {\small\@title}
Sorry, I don't understand the question.
///Peter
Quite right, I had forgotten this, sorry. I almost always rewrite
\maketitle.
> Also, since the macro uses an @ sign, you must surround
> it with \makeatletter and \makeatother.
> \makeatletter
> \fancyhead{CE}{\small \@title}
> \makeatother
That too.
///Peter