4

As i mentioned in title, i can't manage fancyhdr to work. I can't remove page numbers. And page numbering is not stable. And this is the result. As you can see one iii is at the bottom but iv is at the heading and intersecting with text.undesired result

Sorry for bad english.

This is mwe(i think) Because of the document is too long i did not dump the all code. But i can if it is needed.

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[turkish]{babel}
\usepackage[left=3.50cm, right=2.50cm, top=3.00cm, bottom=3.00cm,nohead,nofoot]{geometry}
\usepackage[overload]{textcase} 
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{pslatex}
\usepackage{setspace}
\setlength{\parindent}{0pt}
\renewcommand{\thefigure}{\arabic{section}.\arabic{figure}}
\setlength{\parskip}{\baselineskip}

\addto\extrasturkish{\uccode`i=\string"9D \lccode`I=\string"19 }
\addto\noextrasturkish{\uccode`i=`I \lccode`I=`i }


\setlength{\footskip}{20pt}
\setlength{\marginparwidth}{0 pt}


\raggedbottom
\usepackage{chngcntr}
\setcounter{secnumdepth}{6}

\counterwithin{paragraph}{subsubsection}
\counterwithin{subparagraph}{paragraph}
\makeatother


%\usepackage{graphicx,epstopdf}
%\epstopdfsetup{update}
%\DeclareGraphicsExtensions{.ps}

\usepackage{url}

\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}

\usepackage{titlesec}

\titlespacing{\section}
    {0pt}
    {-12 pt plus 4pt minus 2pt}
    {-10 pt plus 2pt minus 2pt}

\titlespacing{\subsection}
    {0pt}   
    {-12pt plus 4pt minus 2pt}
    {-10pt plus 2pt minus 2pt}

\titlespacing{\subsubsection}
    {0pt}
    {-12pt plus 4pt minus 2pt}
    {-10pt plus 2pt minus 2pt}

\titlespacing\paragraph
    {0pt}
    {-12pt plus 4pt minus 2pt}
    {-10pt plus 2pt minus 2pt}

\titleformat{\section}
    {\normalfont\normalsize\bfseries\MakeTextUppercase}
    {\thesection.}
    {1em}
    {} 

\titleformat{\subsection}
    {\normalfont\normalsize\bfseries}
    {\thesubsection.}
    {1em}
    {}

\titleformat{\subsubsection}
    {\normalfont\normalsize\bfseries\itshape}
    {\thesubsubsection.}
    {1em }
    {}

\titleformat{\paragraph}
    {\itshape\normalsize}
    {\theparagraph.}
    {1em}
    {}

\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
\chead{{\thepage}}
\renewcommand{\footrulewidth}{0pt}
\pagestyle{fancy}
\setlength{\headheight}{ 0 cm} 

\usepackage{enumitem}
\setlist{nolistsep}
%\raggedbottom
\setitemize{topsep=-12pt}
\setenumerate{topsep=-12pt}
\setenumerate[2]{label=\alph*.}
\let\stdsection\section
\renewcommand{\section}{\newpage\stdsection}

\begin{document}

\shorthandoff{=}

(...)

(...)

\begin{spacing}{1.0}
\setlength{\parskip}{0.245\baselineskip}

\tableofcontents
\setlength{\parskip}{\baselineskip}
\end{spacing}

(...)

(...)

\end{document}
  • 2
    Your problem may lie with the combination of nohead,nofoot via geometry in conjunction with requiring a header/footer via fancyhdr. – Werner Jun 18 '12 at 10:32
  • wow thanks. But one page number is at the top one is the bottom this time – interlude Jun 18 '12 at 10:34
  • This is because of the page styles set by your document class (and possibly packages loaded in the preamble). – Werner Jun 18 '12 at 10:56
7

do not use any margin setting after loading fancyhdr. Delete your

\setlength{\headheight}{ 0 cm} 

and use geometry for any setting. To get the same behaviour on the first page for chapters redefine the pagestyle:

\fancypagestyle{plain}{%
  \renewcommand{\headrulewidth}{0pt}
  \fancyhf{}
  \chead{{\thepage}}
  \renewcommand{\footrulewidth}{0pt}}
  • good answer but it still keeps one number at bottom one number at top – interlude Jun 18 '12 at 10:49
  • sure, that is the default. If you do not want that, then redefine \fancypagestyle{plain}{ ...settings ...}. See documentation on page 7/8. – user2478 Jun 18 '12 at 10:50
  • see my edited answer – user2478 Jun 18 '12 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.