El paquete de geometría hace que LaTeX genere un error extraño

El paquete de geometría hace que LaTeX genere un error extraño

Estoy intentando presentar mi tesis doctoral y todo está bien excepto el diseño de la página. Cuando intento utilizar geometryel paquete emitiendo

\usepackage[top=3cm, bottom=3cm, left=3.5cm, right=2.5cm]{geometry}

pero genera un error como:

! You can't use `the character 1' after \the.

varias veces.

% this is the main file, consisting of definitions.
\documentclass[12pt,titlepage,a4paper]{report}
% IMPORTANT: With the very beginnig of the document, we begin numbering with   'romans'.
% We end it in the beginning of chapter-1 beginning to 'arabic' numbering'
\pagenumbering{roman} % Roman,roman,arabic,alph,Alph .
\renewcommand{\baselinestretch}{1.5} % 1.5 line space
\setcounter{secnumdepth}{5} % Change default depth of report class for heading  numbering

\usepackage[top=3cm, bottom=3cm, left=3.5cm, right=2.5cm]{geometry} % page layout
\usepackage{fancyhdr}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathptmx} % For enabling Times New Roman
\usepackage[turkish]{babel}
\usepackage{amsmath, amsfonts, amssymb} % AMS stuff
\usepackage[dvips]{graphicx}
\usepackage[all]{xy} 
\usepackage{lscape}
\usepackage{longtable} % For long tables
\usepackage{tabularx} % and tabular environments
\usepackage{tabulary} % ... and same here.
\usepackage{apacite}
\usepackage{url}
\usepackage{verbatim}
\usepackage{textcomp}
\usepackage{titlesec} % For chapter, section ad subsection titles
%\usepackage{algorithm} % for enabling floating environment for algortihms
%\usepackage[noend]{algpseudocode} % For typesetting algortihms with 'algorithmicx' package 
\usepackage[turkish]{algorithm2e} % For typesetting algorithms with 'algorithm2e' package
\usepackage{listings} % For source code listings
\usepackage{tocloft,titletoc, lipsum, etoolbox} % AU SOSBE standartlarında TOC üretmek için.
\makeindex

\pagestyle{fancy}%
\renewcommand{\headheight}{14.5pt}
\renewcommand{\headrulewidth}{0pt} % No header rule
\renewcommand{\footrulewidth}{0pt} % No footer rule
\fancyhead{} % Clear all header fields
%\fancyhead[RO,R]{\thepage} % Page number on right in header
\fancyfoot{} % Clear all footer fields
\fancyfoot[RO,R]{\thepage} % Page number on right in footer



%%%%%%%% KUME FONTLARI %%%%%%%%%%%%
% Define mathematical set fonts.
\let\mathnumsetfont\mathbb
\newcommand\Nset{\mathnumsetfont N} % set of positive integer numbers
\newcommand\Zset{\mathnumsetfont Z} % set of integer numbers
\newcommand\Qset{\mathnumsetfont Q} % set of rational numbers
\newcommand\Rset{\mathnumsetfont R} % set of real numbers
\newcommand\Cset{\mathnumsetfont C} % set of complex numbers
\newcommand\Hset{\mathnumsetfont H} % set of quaternions


%%%%%%% ANADOLU SOSBE BASLIK AYARLARI %%%%%%
% \titleformat{\chapter}
% {\centering\normalfont\huge\bfseries}
% {\chaptertitlename\: \thechapter.}{20pt}{\Huge}

\titleformat{\chapter}[block]
{\centering\normalfont\sffamily}
{\thechapter.}{12pt}{\bfseries}

\titleformat{\section}[block]
{\raggedright\normalfont\sffamily}
{\thesection.}{12pt}{\bfseries}

\titleformat{\subsection}[block]
{\raggedright\normalfont\sffamily\normalfont}
{\hspace{1cm}\thesubsection.}{12pt}{\bfseries}

\titleformat{\subsubsection}[block]
{\raggedright\normalfont\sffamily\normalfont\it}
{\hspace{2cm}\thesubsubsection.}{12pt}{\bfseries}

% Builtin Title Page
% \title{}
% \author{}

\renewcommand\cfttoctitlefont{\hfill\normalsize\bfseries}
\renewcommand\cftaftertoctitle{\hfill\null\\\null\hfill       \textbf{\underline{Sayfa}}}

\renewcommand\cftlottitlefont{\hfill\normalsize\bfseries}
\renewcommand\cftafterlottitle{\hfill\null\\\null\hfill    \textbf{\underline{Sayfa}}}

\renewcommand\cftloftitlefont{\hfill\normalsize\bfseries}
\renewcommand\cftafterloftitle{\hfill\null\\\null\hfill\textbf{\underline{Sayfa}}}

\begin{document}

\makeatletter
\patchcmd{\@dottedtocline}{\leavevmode}{\leavevmode\bfseries\boldmath}{}{}
\patchcmd{\@dottedtocline}{\normalfont}{\normalfont\bfseries\boldmath}{}{}
\patchcmd{\l@part}{\bfseries}{\bfseries\boldmath}{}{}
\patchcmd{\l@chapter}{\bfseries}{\bfseries\boldmath}{}{}% report/book
%\patchcmd{\l@section}{\bfseries}{\bfseries\boldmath}{}{}% article
\patchcmd{\@part}{\bfseries}{\bfseries\boldmath}{}{}
\patchcmd{\@spart}{\bfseries}{\bfseries\boldmath}{}{}
\patchcmd{\@makechapterhead}{\bfseries}{\bfseries\boldmath}{}{}% report/book
\patchcmd{\@makeschapterhead}{\bfseries}{\bfseries\boldmath}{}{}% % report/book
\patchcmd{\section}{\bfseries}{\bfseries\boldmath}{}{}
\patchcmd{\subsection}{\bfseries}{\bfseries\boldmath}{}{}
\patchcmd{\subsubsection}{\bfseries}{\bfseries\boldmath}{}{}
\patchcmd{\paragraph}{\bfseries}{\bfseries\boldmath}{}{}
\patchcmd{\subparagraph}{\bfseries}{\bfseries\boldmath}{}{}
\makeatother

\addtocontents{toc}{\protect\thispagestyle{fancy}} % Protect fancy style in TOC
\addtocontents{lot}{\protect\thispagestyle{fancy}} % Protect fancy style in LOT
\addtocontents{lof}{\protect\thispagestyle{fancy}} % Protect fancy style in LOF

\tableofcontents\thispagestyle{fancy} % Create TOC
\newpage\listoftables\addcontentsline{toc}{chapter}{Tablolar Listesi}\thispagestyle{fancy} % Create LOT
\newpage\listoffigures\addcontentsline{toc}{chapter}{Şekiller Listesi}\thispagestyle{fancy} % Create LOF


% include chapters into document
\chapter{INTRODUCTION}\thispagestyle{fancy}
\pagenumbering{arabic} % This should be put just once, to the point
% where you desire the document to be numbered with Arabic numbers.

\par The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.


\section{Writing a PhD Thesis Should Not A Big Deal Indeed}
\par The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.

\subsection{It is at least harder than writing a MSc thesis}
\par \par The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.

\section{One More Section}

\par \par The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.

\chapter{THE EXPECTED SECOND CHAPTER}\thispagestyle{fancy}
\pagenumbering{arabic} % This should be put just once, to the point
% where you desire the document to be numbered with Arabic numbers.

\par The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.


\section{Writing a PhD Thesis Should Not A Big Deal Indeed}
\par The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.

\subsection{It is at least harder than writing a MSc thesis}
\par \par The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.

\section{One More Section}

\par \par The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.
The problem is not with \LaTeX but with dinosaurs and Word jerks.
 The problem is not with \LaTeX but with dinosaurs and Word jerks.

\end{document}

Respuesta1

Tienes

\renewcommand*{\headheight]{14.5pt}

\headheightes un registro dimen y otros paquetes como geometryse espera que sea un registro. Se puede cambiar por:

\setlength{\headheight}{14.5pt}

O con paquete geometry:

\usepackage[
  top=3cm,
  bottom=3cm, 
  left=3.5cm,
  right=2.5cm,
  headheight=14.5pt,
 ]{geometry}

información relacionada