TransWikia.com

How to force adding dotted line on chapter without ruin the chapter fontsize

TeX - LaTeX Asked on October 2, 2021

i found related problems to this, See duplicate.
but, when i tried to use this codes, this ruined my chapter fontsize like this:
see picture

i have setting the fontsize of the chapter using titleformat. So, i’ve changed the chapter fontsize to 12pt. And after using code from duplicate link, my fontsize was ruin and getting bigger.

This is my codes:

documentclass[a4paper,12pt,oneside,openany]{book}
usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
usepackage[onehalfspacing]{setspace}
usepackage{fancyhdr}
usepackage{titlesec}
usepackage{setspace}
usepackage{tocloft}
fancyhf{}
cfoot{thepage}
linespread{1.5}
pagestyle{plain}
renewcommandcftchapdotsep{cftdotsep}  %MY ATTEMPT HERE
titleformat{chapter}[display]
    {bfseriescentering}
    {chaptertitlename thechapter}{12pt}{}
titlespacing*{chapter}{0pt}{10pt}{10pt}

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


begin{document}
clearpage
thispagestyle{empty}

frontmatter %

pagestyle{fancy}   
renewcommand{headrulewidth}{0pt}
include{cover1}
include{cover2}
linespread{1}
tableofcontents %TABLE OF CONTENTS
listoffigures
listoftables
mainmatter %

end{document}

Btw, i’m using cmd: chapter*{...} and addcontentsline{toc}{chapter}. To create chapter title. Not shown on my code cz it includes on another file. I split my main file into some parts.

One Answer

I'm not entirely sure what your problem is but perhaps using the titles option to tocloft solves it.

% chapterdotsprob.tex SE 555536

documentclass[a4paper,12pt,oneside,openany]{book}
usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
usepackage[onehalfspacing]{setspace}
usepackage{fancyhdr}
usepackage{titlesec}
usepackage{setspace}
usepackage[titles]{tocloft}
fancyhf{}
cfoot{thepage}
linespread{1.5}
pagestyle{plain}
renewcommandcftchapdotsep{cftdotsep}  %MY ATTEMPT HERE
titleformat{chapter}[display]
    {bfseriescentering}
    {chaptertitlename thechapter}{12pt}{}
titlespacing*{chapter}{0pt}{10pt}{10pt}
%renewcommandcftchapdotsep{cftdotsep}  %MY ATTEMPT HERE

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


begin{document}
clearpage
thispagestyle{empty}

frontmatter %

pagestyle{fancy}   
renewcommand{headrulewidth}{0pt}
include{cover1}
include{cover2}
linespread{1}
tableofcontents %TABLE OF CONTENTS
listoffigures
listoftables
mainmatter %

chapter{One}
Some text
chapter{Two}
More text.

end{document}

The titles option makes the titles of the ToC, etc., look like those of the chapters in the document.

Correct answer by Peter Wilson on October 2, 2021

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