0

For example, using \chapter{INTRODUCTION} will be printed as

1 INTRODUCTION...............x

I want to remove the number 1 behind the chapter, so the output on the ToC would be:

INTRODUCTION................x

Note: x is a page number.

My MWE is :

\documentclass{a4paper, 12pt, oneside, openany}{book}
\usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
\usepackage{blindtext}

\begin{document}

\tableofcontents

\chapter{Chapter 1. INTRODUCTION} \section{Section Name} \blindtext \section{Section Name} \blindtext \chapter{Chapter 2. BACKGROUND} \section{Section Name} \blindtext \section{Section Name} \blindtext

\end{document}

CarLaTeX
  • 62,716
  • 2
    Is the introduction still expected to have a number in the text? Or should it be gone in both cases? BTW: you're missing a } after book – daleif Jul 31 '20 at 09:40
  • @daleif Thanks for the correction. In the text, it should be shown as Chapter 1. INTRODUCTION as well. (No number behind the title). – user516076 Jul 31 '20 at 09:43
  • 2
    Your document confuses me a lot. Why are you writing Chapter 1, Chapter 2 by hand? That makes no sense. – daleif Jul 31 '20 at 10:08
  • @daleif yea. I won't use \chapter*{...} because it makes the first section start with 0.1, 0.2 .... instead of 1.1, 1.2, 1.3. And an easy way to get 1.1, 1.2, 1.3 is using \chapter{...} and writing chapter by hand. – user516076 Jul 31 '20 at 10:16
  • And actually i about to use \section*{...} to avoid the zero starts. But that's a bad idea cuz it's not automatic and another reason. I just want to remove that number behind the title of chapter, that's all. Please help me. – user516076 Jul 31 '20 at 10:22
  • You're requirement does not make any sense at all. And neither does writing where by hand. BTW remember that the chapter counter can be set by hand, fx stepped one bia \refstepcounter{chapter} or \stepcounter{chapter} – daleif Jul 31 '20 at 10:27
  • Oh ok. I've tried \stepcounter{chapter} and it doesn't work for chapter 2 – user516076 Jul 31 '20 at 10:40
  • If i use \refstepcounter{chapter} or \stepcounter{chapter}, the section only shows 1.1, 1.2.... and can't show 2.1, 2.2. That's why i'm using \chapter{...} – user516076 Jul 31 '20 at 10:49
  • @daleif Sorry if it confuses you. Maybe this can help you to understand what i mean. Link: https://ibb.co/n80BsFN . As you can see, the output on the ToC only shows the title without number, and the section. This is why i'm using \chapter{....} and section{...}. I managed to fix the text ouput on the mainmatter, so all i care about is only to remove the number behind the chapter. – user516076 Jul 31 '20 at 10:57
  • Related: the "Update" part of this answer: https://tex.stackexchange.com/a/556796/79060 – muzimuzhi Z Jul 31 '20 at 11:04
  • That only shows the toc, please show images of some of the relevant pages – daleif Jul 31 '20 at 11:16

1 Answers1

1

You can influence the appearance of the titles in the table of contents with the titletoc package. This allows you to remove the number.

The command for this is \titlecontents. See the comments in the code below for a description of the arguments of this command. See also the package documentation.

MWE (note that I removed the manual 'Chapter n.' parts of the \chapter commands):

\documentclass[a4paper, 12pt, oneside, openany]{book}
\usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
\usepackage{blindtext}
\usepackage{titletoc}
\titlecontents{chapter}% redefine chapter toc appearance
[1.5em]% left margin
{}% code before starting the title, here empty
{\hspace*{-2.3em}\bfseries}% format: shift a bit left and boldface, no number
{\hspace*{-2.3em}\bfseries}% format for \chapter*, not really needed for the MWE but added for completeness
{\titlerule*[1pc]{.}\contentspage}% dotted line and page number

\begin{document}

\tableofcontents

\chapter{INTRODUCTION} \section{Section Name} \blindtext \section{Section Name} \blindtext \chapter{BACKGROUND} \section{Section Name} \blindtext \section{Section Name} \blindtext

\end{document}

Result in TOC:

enter image description here

In the document:

enter image description here

If you also want to change the appearance in the document then you can use the titlesec package which is closely related to titletoc with very similar syntax. The command for changing the title in the document is \titleformat. See the comments in the code below for a description of the arguments of this command.

\documentclass[a4paper, 12pt, oneside, openany]{book}
\usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
\usepackage{blindtext}
\usepackage{titlesec}
\usepackage{titletoc}
\titlecontents{chapter}% redefine chapter toc appearance
[1.5em]% left margin
{}% code before starting the title, here empty
{\hspace*{-2.3em}\bfseries}% format: shift a bit left and boldface, no number
{\hspace*{-2.3em}\bfseries}% format for \chapter*, not really needed for the MWE but added for completeness
{\titlerule*[1pc]{.}\contentspage}% dotted line and page number

\titleformat{\chapter}% change format of chapter in the document {\huge\bfseries}% huge font and bold {Chapter \thechapter}% the word Chapter followed by the chapter number {1em}%horizontal space between 'Chapter n' and the chapter title {}% code after the title, here empty

\begin{document}

\tableofcontents

\chapter{INTRODUCTION} \section{Section Name} \blindtext \section{Section Name} \blindtext \chapter{BACKGROUND} \section{Section Name} \blindtext \section{Section Name} \blindtext

\end{document}

The TOC is the same, but in the document a chapter is now as follows:

enter image description here

Marijn
  • 37,699