9

I'm French so it's not easy to explain my problem but I'll try.

I use fancyhdr to make my own headings (book class).

I want the section's title at the right of the heading in small caps, and only in odds pages. But when I print it I can read e.g., "2. DERIVATION" which is what I was expecting.

My question is: how can I remove the number of the section, so that I can obtain just "DERIVATION" and not "2.DERIVATION"?

I wrote :

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyhead[LE]{\footnotesize{\scshape\nouppercase{\leftmark}}}
\fancyhead[RO]{\footnotesize{\scshape\nouppercase{\rightmark}}}
\fancyfoot{} % clear all footer fields
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{0 pt}
\renewcommand{\footrulewidth}{0 pt}

\leftmark is for chapter and is OK.

The problem is with the \rightmark, how can I redefine it?

lockstep
  • 250,273
benekire
  • 131

1 Answers1

8

Add the following line to the settings for fancyhdr

\renewcommand{\sectionmark}[1]{\markright{#1}}
egreg
  • 1,121,712
  • @egreg I cannot seem to make your solution work with my setup. I have \rhead{\rightmark} + your code. – Jonathan Komar Jan 09 '15 at 09:49
  • @macmadness86 Difficult to say without an example; open a new question and don't forget a MWE. – egreg Jan 09 '15 at 09:51
  • @egreg Another question would be a duplicate of this question. I am not sure that this is a good idea. This is an example of how the "one question per issue" policy does not always work. – Jonathan Komar Jan 09 '15 at 10:07
  • @macmadness86 Why should it be a duplicate? I retested the solution with a minimal preamble and it works. So your problem depends on what you're loading. Also the documentclass can be important: for instance, if you're using article with the twoside option. – egreg Jan 09 '15 at 10:16
  • @egreg My question would be "How can remove the section number from the marks in fancyhdr" or something to that effect. I have a one-sided document with article class. The geometry package is also in there. – Jonathan Komar Jan 09 '15 at 10:18
  • @macmadness86 The presented solution works for me. Please, open a new question with a minimal example showing the issue. – egreg Jan 09 '15 at 10:22
  • 1
    For completeness, here is the link to the new question: http://tex.stackexchange.com/q/222370/13552 – Jonathan Komar Jan 09 '15 at 10:42