0

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

1
  • 3
    "Just to mention"... it would be great if you could provide us with a minimal working example (MWE), since sectional units and headings are very dependent on the document class and packages you are using (or limited to use).
    – Werner
    Commented Jul 5, 2014 at 6:05

1 Answer 1

2

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}
5
  • 1
    thanks. could you please a little talk about those new commands? I am very new to LaTeX and I am so sorry that my questions seem so simple to the community.
    – enthu
    Commented Jul 5, 2014 at 12:43
  • @Parsa Updated my answer. Is it clear enough?
    – izabera
    Commented Jul 5, 2014 at 12:54
  • does it appear unnumbered in the page headings? + what is the difference between \mychapter and \include{filename} + what is left and right mark?
    – enthu
    Commented Jul 5, 2014 at 13:01
  • Section and chapters will appear unnumbered in the page headings and the table of contents. \rightmark controls the right page header, \leftmark the left page header. The fancyhdr package may help to customize your header and footer. About \include{filename} check this answer for a good explanation.
    – izabera
    Commented Jul 5, 2014 at 13:27
  • thanks, I do not know how to thank you. Let me check it and I will check mark your answer.
    – enthu
    Commented Jul 5, 2014 at 13:47

You must log in to answer this question.

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