# Remove the chapter numbers but display the titles in the table of contents in the book

I want to remove the title "Chapter 1" , "Chapter 2" , etc. in the book class and keep only the chapter name as the title and also update this in the table of contents.But when I give chapter* it does not display the chapter name in the table of contents. Here is my code:

\documentclass[oneside]{book}
%\title{Web Blog} %use titlesec
%\subtitle{Software Requirement Specification}
%\author{Subham Soni.S}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
%\maketitle
\begin{titlepage}
\begin{tikzpicture}[remember picture,overlay]
\draw[magenta,line width=5pt] ($(current page.north west) +(1in,-0.5in)$) -- ($(current page.south west) +(1in,0.5in)$);
\end{tikzpicture}
\begin{center}
\vspace*{1in}
\Huge WEB BLOG

\vspace{1in}
\LARGE Software Requirement Specification
\end{center}
\end{titlepage}
\tableofcontents
\include{./preface/preface}
\include{./purpose/purpose}
\include{./scope/scope}
\end{document}


The preface tex document:

\chapter{Preface}
\paragraph*{Blog}is an abbreviated version of \textbf{weblog} which is a term used to describe web sites that maintain an ongoing chronicle of information. A blog features diary-type commentary and links to articles on other Web sites, usually presented as a list of entries in reverse chronological order. Blogs range from the personal to the political, and can focus on one narrow subject or a whole range of subjects. \par
\textit{This document is intended for any individual user, developer, tester, project manager or documentation writer that needs to understand the basic system architecture and specifications of a web blog.}


The purpose tex document:

\chapter*{Purpose}
\paragraph*{}The purpose of the project is to provide users to create and manage their own blogs in various domains.There are three types of users, the \textit{Administrator}, the \textit{Blog Owner} and the \textit{Blog Viewer}.The Administrator has full control over the website, can delete the users or blogs if required. The Blog owner can create, edit, and delete blogs. The Blog viewer can view, comment the blogs and share them.


The scope tex document:

\chapter{Scope and Limitations}
\paragraph*{}
The scope and limitations of this system are:
\begin{itemize}
\item The web blog is designed for a limited number of domains so that it is feasible.
\item The web blog restricts the number of posts if the owners present average blog ratings are not above 3.
\item The members can view the blog and share them on social media networks.
\end{itemize}


In TeXMaker , How do I Make the Documentataion.tex (the first set of code) as the main file?

• You are already doing it (almost) right for the chapter "Purpose", but you have to use lowercase chapter in \addcontentsline{toc}{chapter}{Purpose} – karlkoeller Jan 11 '14 at 7:51
• I have got the chapter name in the ToC but it is not numbered.How to do that?And How to I make my Documentation.tex as the main file? – subham soni Jan 11 '14 at 8:25
• Well you can try the tufte-book class and forget of that issue. IMO is a very good way to create a book and forget the problem of the numbers even you don't need them. Reading your code, you can try to add the commands \frontmatter after the \begin{document} and \mainmatter before your chapter 1, and if you want add the \backmatter command before your references list or index. – Aradnix Jan 11 '14 at 8:42

With titlesec package:

\documentclass[oneside]{book}
\usepackage{titlesec}
\usepackage{lipsum} % only for the example

\titleformat{\chapter}
{\normalfont\Huge\bfseries}
{}
{0pt}
{}

\titlespacing*{\chapter}{0pt}{*11.5}{*8}

\renewcommand{\chaptermark}[1]{\markright{\MakeUppercase{#1}}}

\begin{document}

\tableofcontents

\chapter{First}
\lipsum[1]
\section{test}
\lipsum[1-5]

\chapter{Second}

\end{document}


• @subhamsoni Please revert back you acceptance. Karl's answer is more complete. Note his comments. :-) – user11232 Jan 11 '14 at 14:19
• Now it's OK.... – karlkoeller Jan 11 '14 at 16:12
• I deserve a beer, at least. – karlkoeller Jan 13 '14 at 22:42
• @karlkoeller Certainly. Come to Pondicherry :-) – user11232 Jan 13 '14 at 22:44

To set Documentation.tex as the main file in TeXMaker you have to go to the "Options" menu and click on "Define Current Document as 'Master Document'".

To answer your main question, if you want all your chapters numbered in the ToC but not in the document, you can create a new chapter command \chapterstar as follows (works fine with hyperref, too):

\newcommand{\chapterstar}[1]{%
\refstepcounter{chapter}%
\chapter*{#1}%
\markright{\MakeUppercase{#1}}%
}


\refstepcounter{chapter} increments the chapter counter each time you issue that command, while \markright{\MakeUppercase{#1}} is used to have the right contents in the header.

Finally, \addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#1} adds the right contents in the ToC.

This is an example of usage:

\documentclass[oneside]{book}
\usepackage{lipsum} % only for the example

\newcommand{\chapterstar}[1]{%
\refstepcounter{chapter}%
\chapter*{#1}%
\markright{\MakeUppercase{#1}}%
}

\begin{document}

\tableofcontents

\chapterstar{First}
\lipsum[1]
\section{test}
\lipsum[1-5]

\chapterstar{Second}

\end{document}


Output:

## EDIT

With the above solution, you can use \chapterstar when needed and continue using \chapter and \chapter* also, if you need them.

The following solution redefines the meaning of \chapter to behave like \chapterstar in the above solution, so you can use \chapter instead of \chapterstar, but beware that the original \chapter is not available anymore.

The redefinition of \chapter consists of (requires the etoolbox package):

\makeatletter
\patchcmd{\@chapter}{\chaptermark{#1}}{\markright{\MakeUppercase{#1}}}{}{}
\makeatother


Remember in this case to load hyperref after it.

The following MWE produces the same result as the above one:

\documentclass[oneside]{book}
\usepackage{etoolbox}
\usepackage{lipsum} % only for the example

\makeatletter
\patchcmd{\@chapter}{\chaptermark{#1}}{\markright{\MakeUppercase{#1}}}{}{}
\makeatother

\begin{document}

\tableofcontents

\chapter{First}
\lipsum[1]
\section{test}
\lipsum[1-5]

\chapter{Second}

\end{document}