1

Can anyone send example for this code?

\fancyhead[LE]{\leftmark} 
\fancyhead[RO]{\rightmark} 
\fancyhead[CE,CO]{\thepage} 
\renewcommand{\headrulewidth}{0.4pt} 
\renewcommand{\footrulewidth}{0pt}
1
  • 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?
    – raphink
    Commented Aug 9, 2011 at 5:54

1 Answer 1

2

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .