-----Original Message-----
From: Stefan [mailto:[email protected]]
Sent: Sun 3/14/2010 9:50 AM
To: [email protected]
Subject: Using document title and author in fancyhdr
 
>Hello,
>
>I am trying to use the title & author of the document as heading on 
>every page. I am using article style & fancyhdr package.
>
>I am using the command \lhead{\title} \rhead{\author} in the preamble, 
>but this leads to empty headings (probably because in the preamble 
>those are not filled yet). Is there any way to delay expansion of the 
>\title and \author macros until shipout time at which point they have 
>the right values?
>
>Alternatively, does anyone else know an elegant solution that allows 
>me to put the title and author of a document into heading? 
>Needs to be automatic - no good to explicitly having to put it there


If the problem is that you don't want to enter the author name two times,
put this in the preamble:

\newcommand{\myauthor}{Author name}
\newcommand{\mytitle}{Title text}

\lhead{\mytitle}
\rhead{\myauthor}

In the author field in the document, insert a tex-box and type
\myauthor
Similiar for the title, where you type \mytitle in a tex box.

Maybe not so elegant on screen, but yields perfectly good output.
If you make a document template, then you won't have to make those
tex boxes all the time. You just set author and title in the preamble,
that's it.

Helge Hafting

Reply via email to