Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
komal
Posts: 14 Joined: Thu Jun 02, 2011 1:57 pm
Post
by komal » Thu Jun 02, 2011 2:18 pm
I'm trying to add headers to my document but it gives an error right where I include the command \pagestyle{fancy}
The error is :
Missing = inserted for \ifdim
<to be read again>
&
\pagestyle{fancy}
Here's the code:
Code: Select all
\documentclass[pdftex,12pt,a4paper]{report}
\usepackage{url}
\usepackage{subfigure}
\usepackage[top=1.5in, bottom=1in, left=1.5in, right=1in]{geometry}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\usepackage[pdftex]{graphicx}
\usepackage{fancyhdr}
\pagestyle{fancy}
Last edited by
komal on Wed Jun 08, 2011 8:46 pm, edited 1 time in total.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide : 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook : 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ : the first book about TikZ for perfect drawings in your LaTeX thesis
Stefan Kottwitz
Site Admin
Posts: 10348 Joined: Mon Mar 10, 2008 9:44 pm
Post
by Stefan Kottwitz » Thu Jun 02, 2011 2:26 pm
Hi komal,
welcome to the board!
This code example doesn't produce that error, the problem is somewhere else. Please provide a complete example.
Stefan
LaTeX.org admin
komal
Posts: 14 Joined: Thu Jun 02, 2011 1:57 pm
Post
by komal » Thu Jun 02, 2011 2:46 pm
What could be the possible reason. The code itself is quite long and I'm not sure how to mention it here. Can there be an issue with keeping the fanchdr package in a wrong folder though the error is only related to \pagestyle{fancy}
In my document I've used titlpage, chapters and sections. Could there be an issue with that?
Stefan Kottwitz
Site Admin
Posts: 10348 Joined: Mon Mar 10, 2008 9:44 pm
Post
by Stefan Kottwitz » Thu Jun 02, 2011 3:09 pm
You don't need to post your complete document. Create a copy of the document, and reduce it - remove text which is not part of the problem.
Often the preamble together with some dummy chapter resp. text could be sufficient, and even the preamble can be reduced, removing not relevant packages.
This text is helpful:
What is a minimal working example . It may seem to be laborious, but a working example is usually a guarantee for getting a solution.
Stefan
LaTeX.org admin
komal
Posts: 14 Joined: Thu Jun 02, 2011 1:57 pm
Post
by komal » Thu Jun 02, 2011 3:19 pm
Code: Select all
\documentclass[pdftex,12pt,a4paper]{report}
\usepackage{url}
\usepackage{subfigure} \usepackage[top=1.5in, bottom=1in, left=1.5in, right=1in]{geometry}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\usepackage[pdftex]{graphicx}
\usepackage{fancyhdr}
\pagestyle{fancy}
\begin{document}
\newpage
\thispagestyle{empty}
\mbox{}
\begin{titlepage}
\begin{center}
\LARGE text \\[0.8cm]
\Large tex\\[1.5cm]
\HRule \\[0.4cm]
{\LARGE\bf text}\\
\HRule \\[1.4cm]
\begin{minipage}{0.4\textwidth}
\begin{flushleft} \large
\end{flushleft}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\begin{flushright} \large
\emph{text} \\
\end{flushright}
\end{minipage}
\end{center}
\end{titlepage}
\newpage
\begin{flushleft}
\textbf{\large Abstract}
\end{flushleft}
\tableofcontents
\chapter{Introduction}
\section{text}
\bibliographystyle{plain}
\bibliography{ref}
\end{document}
Stefan Kottwitz
Site Admin
Posts: 10348 Joined: Mon Mar 10, 2008 9:44 pm
Post
by Stefan Kottwitz » Thu Jun 02, 2011 3:42 pm
Does exactly this example gives the error?
Because when I compile it there's no error.
Stefan
LaTeX.org admin
komal
Posts: 14 Joined: Thu Jun 02, 2011 1:57 pm
Post
by komal » Thu Jun 02, 2011 4:46 pm
yes it's the exact example.
Could there be something wrong with the installation of .sty file ?
Stefan Kottwitz
Site Admin
Posts: 10348 Joined: Mon Mar 10, 2008 9:44 pm
Post
by Stefan Kottwitz » Thu Jun 02, 2011 4:58 pm
Possibly! Please include the command \listfiles in your preamble, compile again and post the produced .log file here as attachment to a post.
Stefan
LaTeX.org admin
komal
Posts: 14 Joined: Thu Jun 02, 2011 1:57 pm
Post
by komal » Thu Jun 02, 2011 5:08 pm
I have also used \subsection and \subsubsection commands in the file ( if that helps)
Attachments
report.log
(2.78 KiB) Downloaded 488 times
Stefan Kottwitz
Site Admin
Posts: 10348 Joined: Mon Mar 10, 2008 9:44 pm
Post
by Stefan Kottwitz » Thu Jun 02, 2011 5:18 pm
Your packages are located in C:\Program Files\MiKTeX 2.5\tex\latex , perhaps not fancyhdr? Is it in your document directory? If yes, move it away or rename it and test again, I would use fancyhdr of MiKTeX.
By the way, your MiKTeX installation 2.5 is very old (2006) and no longer supported, the current version is MiKTeX 2.9.
Stefan
LaTeX.org admin