[Tex/LaTex] Chapter/Section title in header without numbering

header-footersectioning

I want to have chapter and subsection in the headings of my document. but the numbering should not exist.

Best Answer

Maybe you can redefine your chapters and sections?

\documentclass{book}
\usepackage{lipsum}

\newcommand\mychapter[1]{\chapter*{#1}%
\addcontentsline{toc}{chapter}{\protect\numberline{}#1}%
\def\rightmark{#1}}
\newcommand\mysection[1]{\section*{#1}%
\addcontentsline{toc}{section}{\protect\numberline{}#1}%
\def\leftmark{#1}}

\begin{document}
\tableofcontents
\mychapter{First chapter}
\mysection{First section}
\lipsum[1-10]
\mysection{Second section}
\lipsum[1-10]
\mychapter{Second chapter}
\lipsum[1-10]
\end{document}

When you write \mychapter{Chapter title}, latex will:

  • create an unnumbered chapter with that title: \chapter*{#1}
  • add it to the table of contents:

    \addcontentsline{toc}{chapter}{\protect\numberline{}#1}

    (unnumbered things usually don't show up in the toc)

  • set the correct title in the page headings: \def\rightmark{#1}
Related Question