3

Today I want to set a centered header.

My trial

\documentclass[utf8]{ctexart}
\usepackage{fancyhdr}
\begin{document}
 \pagestyle{fancy}
 \chead{ 常州大学本科论文外文翻译 }
 \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?

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

1 Answer 1

6

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
\fancyhead[C]{常州大学本科论文外文翻译}
\fancyfoot[C]{第\thepage 页,共 页}
\setlength{\headheight}{12.7pt}

\begin{document}

\section{introduction}

 my name is 汤书桃

\newpage

\section{conclusion }

I like \LaTeX{} very much 

\end{document}

Of course I removed \pages.

enter image description here

Here is the first page footer

enter image description here

2
  • ,+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, 2014 at 12:21
  • 1
    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, 2014 at 13:10

You must log in to answer this question.

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