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 want to use LaTeX to do a school paper. I need the professor name the class name and class time all to be in the upper right corner of every page. The fancyhdr package, at least in it's default configuration, lines the right header with the right margins (also it puts a line at the top of the page which won't fly with my professor who is picky.) How do I make a header that would fit the standard school format? mla package does it, but that by default forces me into a whole host of other formatting decisions.

share|improve this question
2  
The fancyhdr package comes with documentation that explains how to change it from its default output. I'd suggest you look at it. Perhaps if there's a more specific question you'd like answered, we can help. –  Seamus Oct 30 '11 at 20:39
    
@Bre Is this on every page or only the first one. Can you post a small image of the front page of such a paper? –  Yiannis Lazarides Oct 30 '11 at 21:07
    
cmhughes and seamus, the headheight change is definitely needed. Your code works perfectly, as long as I leave out the frame (on my system the frame rendering is very bad, with lines going through the text, but that's ok because I don't need the frame). One more thing, I think I may need the header to be the above style on the first page, but just have the last name and page number on all the rest. Is there an easy way to modify this code to do that? –  Bre Nov 2 '11 at 20:09
    
@Bre: I connected your two accounts (there was an unregistered and a registered one). Now you can edit your question and post comments to the answers. I moved your post to a comment here. You might want to add it to both answers now. –  Martin Scharrer Nov 3 '11 at 7:02

2 Answers 2

up vote 6 down vote accepted

The solution below uses fancyhdr and puts the content you described in a minipage.

Following @Seamus' comment, I have increased the headheight using the geometry package.

\documentclass{article}
\usepackage[showframe=true,headheight=1cm]{geometry}
\usepackage{fancyhdr} % for headers and footers
\usepackage{lipsum}   % for dummy text

\begin{document}

% headers
\fancyhead[L]{}
\fancyhead[C]{}
\fancyhead[R]{%
\begin{minipage}{3cm}
 \raggedleft 
 Hughes\\
 Math 251: Calc\\
 MW 9am-11.30am
\end{minipage}}
\renewcommand{\headrulewidth}{0pt}

% footers
\fancyfoot[L]{left foot}
\fancyfoot[C]{center foot}
\fancyfoot[R]{right foot}

% need to specify the pagestyle as fancy
\pagestyle{fancy}
\lipsum

% if you want a non-fancy pages from this point use ... 
\pagestyle{plain}
\lipsum

\end{document}

If you only want the information to appear in the header on the first page it might be appropriate to use

\pagestyle{plain}
\thispagestyle{fancy}

at the beginning of your document.

share|improve this answer
3  
Might you want to increase the headheight if you have a multiline header? –  Seamus Oct 30 '11 at 20:51
    
@Seamus Thank you, yes I agree. See my edit. –  cmhughes Oct 30 '11 at 20:57

The titlesec package also offers a set of commands for one-step headline and footline settings (see Section 5. Page Styles of the package documentation). Here's a little example, placing the required information (on every page) flushed to the right margin, and the page number in the center of the footer:

\documentclass{article}
\usepackage[pagestyles]{titlesec} 
\usepackage{lipsum} % just to generate text for the example

\addtolength\headheight{6pt}

\newpagestyle{mystyle}{
  \sethead{}{}{\begin{minipage}{3.5cm}
                                 \raggedleft 
                                 The Professor\\
                                 The Class\\
                                 The Time
                               \end{minipage}}
  \setfoot{}{\thepage}{}
}

\pagestyle{mystyle}

\begin{document}

\lipsum[1-14]

\end{document}
share|improve this answer

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.