tags:

views:

248

answers:

2

I have a document where I want to place an unnumbered section in my header. I use the fancyhdr package, and for a numbered section, I would had done something like this:

\lhead{\leftmark}

But this don't work with unnumbered sections. I'm solving math-problems in my document, so I don't want part-sections and numbered sections

Anyone, who knows, how this is done?

+1  A: 

Is there anything wrong with

\section*{}
\subsection*{}
\subsubsection*{}
dmckee
No - I use these statements. But when a section is used with a *, then I can't refer to them in my header. This is my problem.
Soren M
+1  A: 

Use

      \chapter*{Preface\markboth{Preface}{}}

for your unnumbered section. (You should replace chapter with whatever you are actually using.)

You can even try

\newcommand{\mysection}[1]{\section*{{#1}\protect\markboth{#1}{}}}

but be careful -- it may create some problems with TOC or references.

AVB
Thanks that works! But I am not a expert in macro - is there a way of renewcommand the \section*, so it default put the section into the header, instead of I have to do this every time?
Soren M
@Soren: That would be difficult, since `\section*` is actually `\section` applied on `*`, so you will redefine `\section` as well.
KennyTM
That's also ok, because it is very limited, what the document should be used for.
Soren M