TransWikia.com

Margin setting for chapter title and chapter number

TeX - LaTeX Asked by user3089201 on May 5, 2021

I’m using the code below. The margin for my report is 2cm for top, right and bottom, 4cm for left. The margin setting works for my second page. However, it does not work for my page in which the chapter title is located. May I know how can I solve it? Besides, I need to put my chapter title and chapter number at the same row. Thanks for your help.

documentclass[12pt,a4paper]{report}

%%%%%%%%Package
usepackage{anysize}
usepackage{faktor} 
usepackage{placeins}
usepackage{float}
usepackage{fancyhdr}%for page number font
usepackage{lmodern}%also for page number font

usepackage{booktabs, calc, cleveref}

usepackage{mathptmx}%Font: Times New Roman

usepackage{setspace} %Set spacing between lines
doublespacing

usepackage[font={small},labelfont=bf]{caption}%For figure's caption
usepackage[titles]{tocloft} %Table of contents 


usepackage{sectsty}%used to format chapter title to be centre etc.
    chapternumberfont{nohangcenteringsmallMakeUppercase} %to format the font for the 'Chapter' number
    chaptertitlefont{nohangcenteringsmallMakeUppercase}
     sectionfont{fontsize{12}{15}selectfont}



%Set Margin
usepackage[left=4cm, right=2cm, top=2cm, bottom=2cm, footskip=1cm]{geometry}

%%%%%%%

renewcommand{cftchapleader}{cftdotfill{cftdotsep}} % for chapters dots
renewcommandcftchappresnum{CHAPTER } % prefix "Chapter " to chapter number in ToC
  cftsetindents{chapter}{0em}{6em}      % set amount of indenting

pagestyle{fancy}
  lhead{}
  chead{}
  rhead{}
  lfoot{}
  cfoot{}
  rfoot{thepage}

 fancypagestyle{plain}{
    fancyfoot{}
    fancyfoot[R]{fontsize{10pt}{10pt}selectfontthepage}
    renewcommand{headrulewidth}{0pt}
    renewcommand{footrulewidth}{0pt}}
 pagestyle{plain}

begin{document}

chapter{Introduction}
 This is my file.

newpage
This is my file2.


end{document}

One Answer

documentclass[12pt,a4paper]{report}


%%%%%%%%Package
usepackage{array}

usepackage{anysize}
usepackage{faktor} 
usepackage{placeins}
usepackage{float}

usepackage{enumerate}
usepackage{fancyhdr}%for page number font
usepackage{lmodern}%also for page number font
usepackage[pdftex]{graphicx}
usepackage{caption}


%Set Margin
usepackage[left=4cm, right=2cm, top=2cm, bottom=2cm, footskip=1cm, showframe]{geometry}

usepackage{mathptmx}%Font: Times New Roman


usepackage{setspace}%double spacing
  setstretch{2}%or use doublespacing

usepackage[font={small},labelfont=bf]{caption}
usepackage[titles]{tocloft}

usepackage[notquote]{hanging}%for hanging indentation, used in the List of Publications section, [notquote] required so file doesn't crash

usepackage{titlesec}%used to format chapter title to be centre and within margin.
   titleformat{chapter}[hang]{bf}{centeringnormalsizeMakeUppercasechaptername~thechapter}{1ex}{centeringMakeUppercasenormalsize}
   titlespacing{chapter}{0cm}{*-6}{*6}
   titleformat{section}{normalfontfontsize{12}{15}bfseries}{thesection}{1em}{}


usepackage{tikz}

%%%%%%%

renewcommand{cftchapleader}{cftdotfill{cftdotsep}} % for chapters dots
renewcommandcftchappresnum{CHAPTER } % prefix "Chapter " to chapter number in ToC
  cftsetindents{chapter}{0em}{6em}      % set amount of indenting

pagestyle{fancy}
 lhead{}
 chead{}
 rhead{}
 lfoot{}
 cfoot{}
 rfoot{thepage}
renewcommand{headrulewidth}{0pt}
renewcommand{footrulewidth}{0pt}

%%%%
fancypagestyle{plain}{
fancyfoot{}
fancyfoot[R]{fontsize{10pt}{10pt}selectfontthepage}
renewcommand{headrulewidth}{0pt}
renewcommand{footrulewidth}{0pt}}
pagestyle{plain}


%%%%

renewcommand{contentsname}{Table of Contents}%Change 'Contents' to 'Table of Contents'




begin{document}

addcontentsline{toc}{chapter}{TABLE OF CONTENTS}

tableofcontents

pagenumbering{arabic} 
setcounter{page}{1}


 %Chapter 1
 chapter{MakeUppercase{INTRODUCTION}}

 %Background of study
 section{Background of study}

 xxx


 %%%%%%%%%%%%%%

 chapter{MakeUppercase{Literature Review and Some Preliminaries}}


 section{A brief overview}

 xxx




 end{document}

Answered by user3089201 on May 5, 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