TransWikia.com

How to Get rid of "Chapter N" without ruin the fontsize, and Remove the numbering "N title chapter" on the TOC

TeX - LaTeX Asked on December 11, 2020

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]
    {normalfontbfseriescentering}
    {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]
    {normalfontbfseriescentering}{}{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 {normalfontbfseriescentering}. 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 ive 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}
renewcommandcftchapdotsep{cftdotsep}
titleformat{chapter}[display]
    {normalfontbfseriescentering}
    {chaptertitlename thechapter}{12pt}{}
titlespacing*{chapter}{0pt}{10pt}{10pt}

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

addtocontents{toc}{protectnullprotecthfill{Halaman}protectpar}
setlengthparindent{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

One Answer

Change

titleformat{chapter}[display]
    {normalfontbfseriescentering}
    {chaptertitlename thechapter}{12pt}{}

to

titleformat{chapter}[block]
    {normalfontbfseriescentering}
    {}{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}
renewcommandcftchapdotsep{cftdotsep}
titleformat{chapter}[block]
    {normalfontbfseriescentering}
    {}{0pt}{}

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

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

addtocontents{toc}{protectnullprotecthfill{Halaman}protectpar}
setlengthparindent{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
xpatchcmdl@chapter
  {cftchapfont}
  {letnumberline@gobblecftchapfont}
  {}{fail}
makeatother

Correct answer by muzimuzhi Z on December 11, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP