Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using \@author variable to put authorname in header of my document. Currently, header shows authorname and footnotemark which incerements every page:

\makeatletter
\let\runauthor\@author
\let\runtitle\@title
\makeatother

\fancyhead[OC]{\runauthor}
\fancyhead[EC]{\sc \runtitle}

For example, if author is John Doe, I get printed

John Doe^1 (1.page)
John Doe^2 (2.page)
...
etc.

Any ideas ?

share|improve this question
1  
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  hpesoj626 Mar 5 '13 at 23:40
    
Your code works here. Without a MWE, it is hard to tell what is going wrong. I have added an alternative solution as an answer, can you try that and let us know if it works? (I'll delete it if this is not what you are after) –  Corentin Mar 6 '13 at 0:05
add comment

3 Answers 3

up vote 1 down vote accepted

This works fluently.

\documentclass[twoside]{article}

\usepackage{fancyhdr}
\usepackage{authoraftertitle}

\makeatletter
\fancyhead[OC]{{\let\thanks\@gobble\MyAuthor}}
\fancyhead[EC]{\scshape \MyTitle}
\pagestyle{fancy}
\makeatother

\title{TTT}
\author{AAA\thanks{THXTHX}}

\usepackage{lipsum} % filler text

\begin{document}

\maketitle
\lipsum[1-40]

\end{document}
share|improve this answer
    
Not if the \author command contains also address information: \author{AAA\\bbb\\ccc} –  egreg Mar 8 '13 at 0:49
add comment

As egreg suggests, your problem may be related to the presence of other macros in the \author command, perhaps something like \author{John Doe\thanks{Mum and Dad}}. It is difficult to tell without a full MWE (in particular, what document class you are using and how you are calling \author). However, a solution which should work is to use the titling package:

\documentclass[twoside]{article}

\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{titling}

\author{John Doe}
\title{My Title}

\pagestyle{fancy}
\fancyhead[OC]{\theauthor}
\fancyhead[EC]{\scshape \thetitle}

\begin{document}

\lipsum

\end{document}
share|improve this answer
    
The OP's problem is quite probably in something like \author{A. Uthor\thanks{Ducks}}; the titling package should indeed take care of this: maybe you could try adding it to your code. Please, use \scshape and not \sc. –  egreg Mar 6 '13 at 0:35
    
Ok. the idea behind all this is that I am using pdfpages to produce binder for several articles. I use my own class definition and in it I use \author variable to specify author name in the header. In other words, I don't want to hard code author's name. And I think you made a point why this problem is occuring. –  user26930 Mar 6 '13 at 13:36
    
@egreg Yes, that is likely. Thanks for spotting the \sc, I just copy-pasted from the OP's post but I definitely agree about using \scshape. –  Corentin Mar 8 '13 at 0:22
    
Unfortunately this doesn't work if the \author command contains also address information. –  egreg Mar 8 '13 at 0:50
add comment

If you are not happy with any of the packaged solutions, you can always write your own, like I did. The example here uses standard article class margins, which my stamper was not designed for. But it still looks OK, and you have control over all the parameters.

\documentclass[12pt]{article}

\makeatletter
%% SET UP CODE TO USE PAGE STAMPS AT TOP AND BOTTOM OF PAGE.  DEFAULT
%% STAMP IS "DRAFT", BUT IT CAN BE RESET AND USED FOR OTHER PURPOSES,
%% TOO.
\def\PageStampFlag{F}
\def\thePageStamp{}
\def\EmptyStyle{empty}
\def\PlainStyle{plain}

\newcommand{\ps@pagestamp}{
  \renewcommand{\@oddhead}{\hfil\textbf{\Large\thePageStamp}\hfil}
  \renewcommand{\@evenhead}{\@oddhead}
  \renewcommand{\@evenfoot}{\hfil
                            \begin{tabular}{c}
                            \textrm{\thepage}\\
                            \textbf{\Large\thePageStamp}
                            \end{tabular}
                            \hfil}
  \renewcommand{\@oddfoot}{\@evenfoot}
}

\newcommand{\ps@emptypagestamp}{
  \renewcommand{\@oddhead}{\hfil\textbf{\Large\thePageStamp}\hfil}
  \renewcommand{\@evenhead}{\@oddhead}
  \renewcommand{\@evenfoot}{\hfil
                            \begin{tabular}{c}
                            ~\\
                            \textbf{\Large\thePageStamp}
                            \end{tabular}
                            \hfil}
  \renewcommand{\@oddfoot}{\@evenfoot}
}

\newcommand\PageStamp[1][DRAFT]{
  \def\PageStampFlag{T}
  \setlength\textheight{9in} %textheight+headheight+headsep=9in
  \def\thePageStamp{#1}
  \setlength\topmargin{-1.0in}
  \setlength\headheight{0.6in}
  \setlength\headsep{0.4in}
  \setlength\footskip{38pt}
  \def\PlainStyle{pagestamp}
  \def\EmptyStyle{emptypagestamp}
  \pagestyle{\PlainStyle}
}

\newcommand\StopPageStamp[0]{
  \def\PageStampFlag{F}
  \setlength\topmargin{0in}
  \setlength\headheight{0pt}
  \setlength\headsep{0pt}
  \setlength\textheight {9.0in}
  \setlength\footskip{30pt}
  \def\PlainStyle{plain}
  \def\EmptyStyle{empty}
  \pagestyle{\PlainStyle}
}

\makeatother

\begin{document}

\PageStamp[\today]

This is a test of Steven's pagestamping commands. Usage is
\verb|\PageStamp[stamp]|.  Default stamp is ``DRAFT''.  The command can
be reissued to change the pagestamp.  The alternate command
\verb|\StopPageStamp| will suspend the pagestamp, unless/until later
reinstituted with a \verb|\PageStamp[]|

\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.