Today I want to set a centered header.

My trial

\documentclass[utf8]{ctexart}
\usepackage{fancyhdr}
\begin{document}
\pagestyle{fancy}
\cfoot{第\thepage 页，共\pages 页}
\section{introduction}
my name is 汤书桃
\newpage
\section{conclusion }
I like \latex very much
\end{document}


However, it doesn't work. Can someone help me?

• What errors do you get? Plus the LaTeX logo is written \LaTeX (case matters) – daleif Jan 16 '14 at 12:05
• @daleif,the header show the section 's captions , not the sentence that I define . – xyz Jan 16 '14 at 12:23

There are a few errors:

• utf8 should be UTF8

• \pages is not defined (I don't know what it's supposed to do)

• It's \LaTeX, not \latex

Here's a working version

\documentclass[UTF8]{ctexart}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % clear all fields
\fancyfoot[C]{第\thepage 页，共 页}

\begin{document}

\section{introduction}

my name is 汤书桃

\newpage

\section{conclusion }

I like \LaTeX{} very much

\end{document}


Of course I removed \pages.

Here is the first page footer

• ,+1,It goes well .Thanks ,I have learned LaTex for a month that by writing my graduating paper and reading the book "The latex Tutorial ".In fact,I would like to define the command \page as the pages of my document ,but I don't know how to define .Anyway , thanks for your detailed guide. – xyz Jan 16 '14 at 12:21
• If you are looking for something like 'Page 1 of 5'. So If you want total number of pages in the document, you can have a look at ctan.org/pkg/lastpage. Here is the package lastpage, which could be useful in that case. – Umz Jan 16 '14 at 13:10