TeX - LaTeX Asked on June 5, 2021
I use subsection{example}
and on the toc shows 1.4.1 Example
. But on the text only shows 1.4 Example
. The numbered after chapter number 1
and section number 4
is missing. How to add the number for subsection?
Btw i have tried to see some duplicates. Tried their codes but didn’t work.
My duplicate: enter link description here
MWE :
documentclass[a4paper,12pt,oneside,openany]{book}
usepackage{pgf, tikz}
usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
usepackage{geometry}
usepackage[onehalfspacing]{setspace}
usepackage{fancyhdr}
usepackage{titlesec}
usepackage{setspace}
usepackage[titles]{tocloft}
usepackage{tocbibind}
usepackage{indentfirst}
usepackage{blindtext}
usepackage{tocloft}
usepackage{etoolbox}
usepackage{enumitem}
usepackage{amssymb}
usepackage{amsmath}
usepackage{amsfonts}
patchcmd{section}{bfseries}{bfseriesboldmath}{}{}
setlength{cftbeforesecskip}{10pt}
setlength{cftbeforesubsecskip}{10pt}
fancyhf{}
cfoot{thepage}
linespread{1.5}
pagestyle{plain}
renewcommandcftchapdotsep{cftdotsep}
titleformat{chapter}[block]
{normalfontbfseriescentering}
{}{0pt}{}
titleformat{section}
{normalfontbfseries}
{thesection}{1em}{}
titleformat{subsection}
{normalfontbfseries}
{thesection}{1em}{}
titlespacing*{chapter}{0pt}{10pt}{20pt}
titlespacing*{section}{0pt}{0pt}{0pt}
titlespacing*{subsection}{0pt}{0pt}{0pt}
addtocontents{toc}{protectnullprotecthfill{Halaman}protectpar}
setlengthparindent{1.25cm}
setcounter{secnumdepth}{2} %I TRIED THIS BUT DID'NT WORK
begin{document}
frontmatter %
pagestyle{fancy}
renewcommand{headrulewidth}{0pt}
begin{spacing}{0.1}
tableofcontents
% listoffigures
% listoftables
end{spacing}
mainmatter
pagestyle{fancyplain}
fancyhf{}
fancyhead[R]{thepage}
renewcommand{headrulewidth}{0pt}
refstepcounter{chapter}
chapter*{textbf{BAB 1. PENDAHULUAN}}
addtocontents{toc}{setlength{cftbeforechapskip}{20pt}}
addcontentsline{toc}{chapter}{textbf{BAB 1. PENDAHULUAN}}
thispagestyle{empty}
vspace{15pt}
section{textbf{Batasan Masalah}}
blindtext
vspace{15pt}
section{textbf{Tujuan Penelitian}}
blindtext
vspace{15pt}
section{textbf{Manfaat Penelitian}}
blindtext
vspace{15pt}
section{textbf{Kebaruan Penelitian}}
blindtext
subsection{Subsection 1}
blindtext
subsection{Subsection 2}
blindtext
end{document}
After getting the MWE to actually compile, the problem boils down to this:
titleformat{subsection}
{normalfontbfseries}
{thesection}{1em}{}
which is wrong, note the thesection
, it should be
titleformat{subsection}
{normalfontbfseries}
{thesubsection}{1em}{}
to match the fact that it is for subsection
Correct answer by daleif on June 5, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP