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.

Can anyone send example for this code?

\fancyhead[LE]{\leftmark} 
\fancyhead[RO]{\rightmark} 
\fancyhead[CE,CO]{\thepage} 
\renewcommand{\headrulewidth}{0.4pt} 
\renewcommand{\footrulewidth}{0pt}
share|improve this question
2  
Hello. You can make your code highlighted by indenting it by 4 spaces (which I have done). I do not think the tex-core tag is appropriate for a question which is purely LaTeX. Can you precise your question a bit? –  ℝaphink Aug 9 '11 at 5:54

1 Answer 1

Here the code provided is used as an example:

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{lipsum}

\begin{document}
    % clear fancy header and footer
    \fancyhf{}

    % code start
    \fancyhead[LE]{\leftmark} 
    \fancyhead[RO]{\rightmark} 
    \fancyhead[CE,CO]{\thepage}
    \renewcommand{\headrulewidth}{0.4pt} 
    \renewcommand{\footrulewidth}{0pt}
    % code end

    % set pagestyle to use fancy header and footer
    \pagestyle{fancy}

    % insert some text into the document
    \markboth{lipsum 1}{demo 1}
    \lipsum[1-3]

    \markboth{lipsum 2}{demo 2}
    \lipsum[4-5]

    \markboth{lipsum 3}{demo 3}
    \lipsum[6-8]

    \markboth{lipsum 4}{demo 4}
    \lipsum[9-10]

\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.