2

I use package fancyhdr for make header and footer.

I want to auto quote text in the chapter for right header.

I use : \rhead{\thechapter} when latex show for me the number of chapter not text.

Can you tell me : How to show text of chapter on the right header(auto) ? Thanks for hint .

Now i have a new problems , if chapter name is very long , i want to have two line in header?

1 Answer 1

3

You have to handle with \leftmark and \righmark. The example shows you one way. For more information you should read the manual of fancyhdr: http://ctan.org/pkg/fancyhdr

\documentclass{book}
\usepackage{fancyhdr}
\rhead{\leftmark}
\lhead{}
\pagestyle{fancy}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}  
5
  • chapter name is too long , i want to break line on header? Can you help me?
    – user41499
    Commented Nov 24, 2013 at 17:48
  • 1
    @user41499: Rather than doing that, you should use the optional argument of \chapter to specify a shorter/compact version of the title: \chapter[<short title>]{<long title>}
    – Werner
    Commented Nov 24, 2013 at 17:54
  • @werner I see but i have to do it because that ruler.Thanks werner
    – user41499
    Commented Nov 24, 2013 at 17:58
  • @user41499: You can use a \parbox inside: \rhead{\parbox{\linewidth}{\leftmark}}`. However you have to recompute the margins. Commented Nov 24, 2013 at 18:00
  • I try , before i try to use package calc for auto computes but not win.
    – user41499
    Commented Nov 24, 2013 at 18:03

You must log in to answer this question.

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