1

enter image description here

Hi! I want to make some changes like image given above.

  • removing page number for chapters' first page.
  • changing page number locations from chapters page to end.

How can i fix the problem? Thank you.

\documentclass[12pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[turkish,english,shorthands=:!]{babel}
\usepackage[a4paper,left=30mm,top=30mm,right=25mm,bottom=25mm]{geometry}
% Font and line spacing settings
\usepackage[scaled=1.00375]{newtxtext}
\usepackage[scaled=1.00375]{newtxmath}
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.432818}% <-- 1.00375*1.427465
% Customize headings
\usepackage{titlesec}
\newcommand*{\myonevspace}{13.850574pt}% <-- Define a macro \myonehalfvspace
\newcommand*{\myonehalfvspace}{20.775861pt}% <-- Define a macro \myonehalfvspace
\newcommand*{\mytwovspace}{27.701147pt}% <-- Define a macro \mytwovspace
% For dummy texts, you can remove it.
\usepackage{lipsum} 
\usepackage{tocloft}
\usepackage{titlesec}
\usepackage{apacite}
\usepackage{graphicx}
\usepackage{etoolbox}
%%----%%----%% Page number-----------
\usepackage{fancyhdr} %sayfa numarası
\fancypagestyle{plain}{%
  \fancyhf{}% clear all header and footer fields
  \chead{\thepage}%
  \renewcommand{\headrulewidth}{0pt}%
  \renewcommand{\footrulewidth}{0pt}%
}


% now we need to fix \@chapter
\makeatletter
\patchcmd{\@chapter}
  {\addtocontents{lof}{\protect\addvspace{10\p@}}}
  {}
  {}{}
\patchcmd{\@chapter}
  {\addtocontents{lot}{\protect\addvspace{10\p@}}}
  {}
  {}{}
\makeatother





%****************************************
% CHAPTERS
%%% Chapter titles

% Chapter heading \titlespacing*{command}{left}{before-sep}{after-sep}[right-sep]
\titleformat{\chapter}
  {\normalfont\normalsize\bfseries}{\thechapter.}{.5em}{}
\titlespacing{\chapter}{1cm}{0cm plus 4pt minus 2pt}{\myonehalfvspace plus 2pt minus 2pt}
% Section heading
\titleformat{\section}
  {\normalfont\normalsize\bfseries}{\thesection.}{.5em}{}
\titlespacing{\section}{1cm}{\myonehalfvspace plus 4pt minus 2pt}{\myonehalfvspace plus 2pt minus 2pt}
% Subsection heading
\titleformat{\subsection}
  {\normalfont\normalsize\bfseries}{\thesubsection.}{.5em}{}
\titlespacing{\subsection}{1cm}{\mytwovspace plus 4pt minus 2pt}{\myonehalfvspace plus 2pt minus 2pt}
% Subsubsection heading
\titleformat{\subsubsection}
  {\normalfont\normalsize\bfseries}{\thesubsubsection.}{.5em}{}
\titlespacing{\subsubsection}{1cm}{\mytwovspace plus 4pt minus 2pt}{\myonehalfvspace plus 2pt minus 2pt}



\usepackage[unicode]{hyperref} %son yükle

% BEGIN
\begin{document}
\pagenumbering{gobble}

\pagenumbering{Roman}
\addtocontents{toc}{\hfill \underline{\textbf{Sayfa No}}\par} 

% Page ÖNSÖZ--------------
\addcontentsline{toc}{chapter}{ÖNSÖZ} 
\begin{center}
    \vspace*{0cm} % Top: 40mm olmalı
    {\fontsize{12pt}{12pt}\selectfont \textbf{ÖNSÖZ}}\\
\end{center}
\par \lipsum[1-1]
\clearpage
%-------------------------

% Page Etik--------------
\addcontentsline{toc}{chapter}{ETİK} 
\begin{center}
    \vspace*{0cm} % Top: 40mm olmalı
    {\fontsize{12pt}{12pt}\selectfont \textbf{ETİK}}\\
\end{center}
\par \lipsum[1-1]
\clearpage
%-------------------------

% Page TOC İçindekiler ---
\renewcommand*\contentsname{İÇİNDEKİLER}
\addcontentsline{toc}{chapter}{İÇİNDEKİLER} %içindekiler tablosunu içindekilerde gösterir.
\setcounter{secnumdepth}{3} %Kaç alt başlığın numarasını verecek belirler
\setcounter{tocdepth}{3}

\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % dots for chapters
\renewcommand{\cfttoctitlefont}{\MakeUppercase\hfil\bfseries\fontsize{12pt}{12pt}\selectfont}
    \vspace*{-1.8cm} 
\renewcommand\cftchapfont{\mdseries}
\renewcommand\cftchappagefont{\mdseries}
%\renewcommand{\cftchappresnum}{CHAPTER\space}
\renewcommand{\cftchapaftersnum}{.} 
\renewcommand{\cftsecaftersnum}{.} 
\renewcommand{\cftsubsecaftersnum}{.} 
\renewcommand{\cftsubsubsecaftersnum}{.} 

%\setlength{\cftbeforetoctitleskip}{10mm} 
\setlength{\cftaftertoctitleskip}{1\baselineskip}
\setlength{\cftchapnumwidth}{4em}
\setlength{\cftsecnumwidth}{4em}
\setlength{\cftsubsecnumwidth}{4em}

\setlength{\cftchapindent}{0em}
\setlength{\cftsecindent}{0em}
\setlength{\cftsubsecindent}{0em}
\setlength{\cftsubsubsecindent}{0em}

% Spacing between items
\setlength{\cftbeforechapskip}{7pt}
\setlength{\cftbeforesecskip}{\cftbeforechapskip}
\setlength{\cftbeforesubsecskip}{\cftbeforechapskip}
\setlength{\cftbeforesubsubsecskip}{\cftbeforechapskip}

\begin{singlespace}
\tableofcontents
\end{singlespace}
\clearpage
%-------------------------

% Page Figures Şekiller ---
\renewcommand*\listfigurename{ŞEKİLLER DİZİNİ}
\addtocontents{lof}{\par\nobreak\textbf{{\scshape } \hfill} \underline{\textbf{Sayfa No}}\par\nobreak} %{\scshape Şekil} kısmı eklenebilir.
\renewcommand{\cftloftitlefont}{\MakeUppercase\hfil\bfseries\fontsize{12pt}{12pt}\selectfont}
\renewcommand{\cftfigaftersnum}{.}
\renewcommand*\cftfigpresnum{Şekil~}
\settowidth{\cftfignumwidth}{\cftfigpresnum}
\renewcommand{\cftfigaftersnumb}{\quad~~}
\setlength{\cftbeforeloftitleskip}{10mm}
\setlength{\cftafterloftitleskip}{1\baselineskip}
\setlength{\cftbeforefigskip}{\cftbeforechapskip}

\begin{singlespace}
\listoffigures
\end{singlespace}
\clearpage
%-------------------------

% Page Tables Tablolar ---
\renewcommand*\listtablename{TABLOLAR DİZİNİ}
\addtocontents{lot}{\par\nobreak\textbf{{\scshape } \hfill} \underline{Sayfa No}\par\nobreak}
\renewcommand{\cftlottitlefont}{\MakeUppercase\hfil\bfseries\fontsize{12pt}{12pt}\selectfont}
\renewcommand{\cfttabaftersnum}{.}
\renewcommand*\cfttabpresnum{Tablo~}
\settowidth{\cfttabnumwidth}{\cfttabpresnum}
\renewcommand{\cfttabaftersnumb}{\quad~~}
\setlength{\cftbeforelottitleskip}{10mm}
\setlength{\cftafterlottitleskip}{1\baselineskip}
\setlength{\cftbeforetabskip}{\cftbeforechapskip}

\begin{singlespace}
\listoftables
\end{singlespace}
\clearpage
%-------------------------

\pagenumbering{arabic}


\chapter{CHAPTER}
\section{Section}
\lipsum[1]
\subsubsection{Subsubsection}
\lipsum[3-5]
\chapter{CHAPTER}
\section{Section}
\lipsum[1]
\subsection{Subsection}
\lipsum[2-3]
\subsubsection{Subsubsection}
\lipsum[3-5]
%.........................

\end{document}
volkan
  • 349
  • And the headers contain only the page number, is that correct? – Bernard Jul 20 '18 at 12:13
  • @Bernard Yes, there will be only page numbers in the headers. – volkan Jul 20 '18 at 12:15
  • The usual approach is to use \thispagestyle and create different page styles for each option. \chpater automatically uses \thispagestyle{plain} so you will need to change the plain page style as well. – John Kormylo Jul 20 '18 at 13:09
  • Hi @John, i searched about your suggestion but i did not find useful source or example. Can you give details or show some code? Thank you. – volkan Jul 21 '18 at 09:25
  • Try https://tex.stackexchange.com/questions/437937/images-in-footer-on-specific-pages, or https://tex.stackexchange.com/questions/352070/different-footer-heights-for-odd-and-even-pages, or https://tex.stackexchange.com/questions/220800/how-i-can-typeset-a-footer-on-only-one-page – John Kormylo Jul 21 '18 at 18:26
  • @JohnKormylo I added fancyhdr codes but something is going wrong. Page number is on the top only chapters' page and it is on the footer in the other pages. Whereas the page number must be in the header (top center) in the all pages except of the chapters' first page. Have you any suggestions? Thanks. – volkan Jul 23 '18 at 06:05
  • Hi @Bernard, i added fancyhdr package and some codes but still i needs help. Have you any suggestion? Thank you. – volkan Jul 23 '18 at 06:08

1 Answers1

1

With using fancyhdr package, it is created a pagestyle and edited the plain. Solution is below:

\usepackage{fancyhdr} %sayfa numarası

\fancypagestyle{chapterpage}{%
  \fancyhf{}% Clear header and footer
  \chead{\thepage}%
  \renewcommand{\headrulewidth}{0pt}% Line at the header visible
  \renewcommand{\footrulewidth}{0pt}% Line at the footer visible
}

% Redefine the plain page style
\fancypagestyle{plain}{%
  %\fancyhf{}% clear all header and footer fields
  \chead{}%
  \renewcommand{\headrulewidth}{0pt}%
  \renewcommand{\footrulewidth}{0pt}%
}

and before the \chapter:

\pagestyle{chapterpage}
volkan
  • 349