0

Actually i have seen all possibilities similar questions one by one. They have similar problem, but my problem is more complicated. So, here is my problem:

I want to remove "Chapter N" when i'm using:

\chapter{\textbf{Test Chapter}}

I'm not going to use \chapter*{...} because this makes my section start with 0.1 Section instead of 1.1 Section. I have seen this link, and tried to use it using \titlesec to remove my Chapter N.

This is my code before i changed anything, (Btw, i wrote the important part of my code only so you can focus on it):

\documentclass[a4paper,12pt,oneside,openany]{book}
\usepackage{titlesec}
\titleformat{\chapter}[display]
    {\normalfont\bfseries\centering}
    {\chaptertitlename \thechapter}{12pt}{}
\titlespacing*{\chapter}{0pt}{10pt}{10pt}

This is my code after i tried to remove Chapter N:

\documentclass[a4paper,12pt,oneside,openany]{book}
\usepackage{titlesec}
\titleformat{\chapter}[display]
    {\normalfont\bfseries\centering}{}{0pt}{\Large}
    {\chaptertitlename \thechapter}{12pt}{}
\titlespacing*{\chapter}{0pt}{10pt}{10pt}

and actually it removes the Chapter N like i wanted before. The point is, i only adding {}{0pt}{\Large} after {\normalfont\bfseries\centering}. And because of this, i got 2 problems here:

First Problem:

My fontsize was changed and getting bigger, and i got error message refers to {\chaptertitlename \thechapter}{12pt}{}

You can see before and after removing Chapter N in the following link below:

BEFORE REMOVING CHAPTER and AFTER REMOVING CHAPTER

This is my error message: link image Even though i\ve tried to place after \begin{document}

My Goal is i can remove Chapter N using simple code, without any error messages, and not changes the fontsize that i've changed before that is 12pt.

Second Problem:

This is not actually a problem that i got after using my code as i said before, i mean it's another problem and i want to remove numbering N title chapter on the TOC. Here is my current output. As you can see, there is a number in the front 1 BAB. 1 PENDAHULUAN and i want to remove 1 on the front becomes BAB 1. PENDAHULUAN like this output.

I really appreciate your answer. Please help me and Thanks in advance.

EDIT: This is my MWE

(Main tex file)

\documentclass[a4paper,12pt,oneside,openany]{book}
\usepackage{pgf, tikz}
\usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage[titles]{tocloft}
\usepackage{tocbibind}
\usepackage{indentfirst}
\fancyhf{}
\cfoot{\thepage}
\linespread{1.5}
\pagestyle{plain}
\renewcommand\cftchapdotsep{\cftdotsep}
\titleformat{\chapter}[display]
    {\normalfont\bfseries\centering}
    {\chaptertitlename \thechapter}{12pt}{}
\titlespacing*{\chapter}{0pt}{10pt}{10pt}

\renewcommand{\contentsname}{DAFTAR ISI}
\renewcommand{\listtablename}{DAFTAR TABEL}
\renewcommand{\listfigurename}{DAFTAR GAMBAR}

\addtocontents{toc}{\protect\null\protect\hfill{Halaman}\protect\par}
\setlength\parindent{1.25cm} 
\begin{document}

\clearpage
\thispagestyle{empty}

\frontmatter %

\pagestyle{fancy}   
\renewcommand{\headrulewidth}{0pt}
\include{cover1}
\include{cover2}


\mainmatter %
\include{bab1}

\end{document}

(File: bab1)

\chapter{\textbf{BAB 1. PENDAHULUAN}} 
%TEXT HERE
\section{Latar Belakang} 
%TEXT HERE
5
  • Question: Do you want the chapter number to not appear at all? If so, why do you want sections numbered Chap.Sec (e.g. 1.1)? – Donald Arseneau Jul 31 '20 at 0:27
  • Welcome to TeX.SX! Please provide a complete example which starts at \documentclass and ends with \end{document} and can reproduce your problem. By convention an example like that is called an MWE. – muzimuzhi Z Jul 31 '20 at 0:29
  • @DonaldArseneau Thanks for answering. Actually this is TOC template from my college, so after Chapter begins, the sections must have numbered like 1.1; 1.2; 2.1; 2.2 and so on. – user516076 Jul 31 '20 at 1:01
  • @muzimuzhiZ Hi, thank you 4 ur suggestion. Please see my edit. – user516076 Jul 31 '20 at 1:07
  • @DonaldArseneau btw, yes, i don't want the chapter. So i want to remove the "Chapter 1" above the title chapter. It works with my code as i mentioned in my question, but it ruined the fontsize of All ToC, LoF, LoT, and Chapter – user516076 Jul 31 '20 at 1:11
3

Change

\titleformat{\chapter}[display]
    {\normalfont\bfseries\centering}
    {\chaptertitlename \thechapter}{12pt}{}

to

\titleformat{\chapter}[block]
    {\normalfont\bfseries\centering}
    {}{0pt}{}
  • In display format, there is a linebreak between \chaptertitlename \thechapter and the chapter title. Since you don't need Chapter N, I replace display by block.
  • The separation between Chapter N and chapter title is set to zero 0pt as well.
  • You don't need to use \textbf in \chapter, the chapter title is already in bold (set by \bfseries in \titleformat{\chapter}...).

For detailed syntax and documentation of \titleformat, see titlesec manual, sec. 3.1.

\documentclass[a4paper,12pt,oneside,openany]{book}
\usepackage{tikz}
\usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage[titles]{tocloft}
\usepackage{tocbibind}
\usepackage{indentfirst}
\fancyhf{}
\cfoot{\thepage}
\linespread{1.5}
\pagestyle{plain}
\renewcommand\cftchapdotsep{\cftdotsep}
\titleformat{\chapter}[block]
    {\normalfont\bfseries\centering}
    {}{0pt}{}

\titlespacing*{\chapter}{0pt}{10pt}{10pt}

\renewcommand{\contentsname}{DAFTAR ISI}
\renewcommand{\listtablename}{DAFTAR TABEL}
\renewcommand{\listfigurename}{DAFTAR GAMBAR}

\addtocontents{toc}{\protect\null\protect\hfill{Halaman}\protect\par}
\setlength\parindent{1.25cm} 
\begin{document}

\frontmatter
\tableofcontents

\pagestyle{fancy}

\mainmatter
\chapter{BAB 1. PENDAHULUAN} 
%TEXT HERE
\section{Latar Belakang}
%TEXT HERE

\end{document}

enter image description here enter image description here

Update

As requested in comment, to hide the chapter number in \tableofcontents, add following code to preamble, after tocloft is loaded.

\usepackage{xpatch}
% patch the \l@chapter redefined by tocloft package, hide chapter number
\makeatletter
\xpatchcmd\l@chapter
  {\cftchapfont}
  {\let\numberline\@gobble\cftchapfont}
  {}{\fail}
\makeatother
6
  • Thank you so much. It works. Maybe one last question please. So, since i'm using \chapter{...}, in the ToC would printed as 1 BAB 1. PENDAHULUAN, 2 BAB 2. TITLE CHAPTER, 3 BAB 3. TITLE CHAPTER and so on. And i want to remove the numbering on the front (the number 1, 2, 3,... ), so it becomes BAB 1. PENDAHULUAN, BAB 2. TITLE CHAPTER, BAB 3. TITLE CHAPTER printed on the ToC. Can you help me? Again, many thanks for you. – user516076 Jul 31 '20 at 8:58
  • @user516076 Only hide for chapter and reserve for section and lower level sectioning titles in toc? – muzimuzhi Z Jul 31 '20 at 9:19
  • only the chapter. I want to remove the number behind the chapter. Thanks – user516076 Jul 31 '20 at 9:22
  • @user516076 See the "Update" part in my answer. – muzimuzhi Z Jul 31 '20 at 9:34
  • Unfortunately i got error message File 'l3backend-pdfmode.def' not found. {\sys^load_backend { } } – user516076 Jul 31 '20 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.