I'm trying the below script to make a header but its not working and this is very urgent if anyone could help me.

\documentclass[conference,letterpaper]{IEEEtran}
\usepackage{fancyhdr}
\setlength{\paperwidth}{215.9mm}
\setlength{\hoffset}{-9.7mm}
\setlength{\oddsidemargin}{0mm}
\setlength{\textwidth}{184.3mm}
\setlength{\columnsep}{6.3mm}
\setlength{\marginparsep}{0mm}
\setlength{\marginparwidth}{0mm}

\setlength{\paperheight}{279.4mm}
\setlength{\voffset}{-7.4mm}
\setlength{\topmargin}{0mm}
\setlength{\topskip}{0mm}
\setlength{\textheight}{235.2mm}
\setlength{\footskip}{12.4mm}

\setlength{\parindent}{1pc}

\hyphenation{op-tical net-works semi-conduc-tor}
\usepackage{cite}
\usepackage{tabularx,booktabs}
\usepackage{graphicx}
\usepackage{float}
\floatstyle{plaintop}
\restylefloat{table}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{caption}
%\usepackage{subcaption}
\usepackage{longtable}
\usepackage{comment}
\usepackage{tabularx}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{caption}
%\usepackage{subcaption}
\usepackage{longtable}
\usepackage{comment}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{gensymb}
\usepackage{subfig}
\usepackage{tikz}
\usepackage{afterpage}
\usetikzlibrary{calc}
\tikzset{
mynode/.style={anchor=south west,inner sep=0,outer sep=0pt}}
\usepackage{fancyhdr}
\pagestyle{fancy}


I removed the code that was not essential to the question:

\documentclass[conference,letterpaper]{IEEEtran}

\usepackage{fancyhdr}
\usepackage{lipsum}% just to generate text for the example

\pagestyle{fancy}
\fancyhf{}

\begin{document}

\lipsum[1-20]

\end{document}


If one wants the page containing the title information to also have the header, one has to redefine the page style IEEEtitlepagestyle issued by \maketitle:

\makeatletter
\let\ps@IEEEtitlepagestyle\ps@fancy
\makeatother


A complete example:

\documentclass[conference,letterpaper]{IEEEtran}

\usepackage{fancyhdr}
\usepackage{lipsum}% just to generate text for the example

\pagestyle{fancy}
\fancyhf{}
\makeatletter
\let\ps@IEEEtitlepagestyle\ps@fancy
\makeatother

\begin{document}
\title{The Title}
\author{Michael Shell \and Homer Simpson}

\maketitle

\lipsum[1-20]

\end{document}


Notice that with these settings, no page number will be shown; perhaps you could also add something like

\fancyfoot[C]{\thepage}


or something similar to display the page numbers.

Not related to the question, but notice that you are loading the same package more than once (e.g., amsmath, graphicx); this is not necessary and is a probable cause of clash if some option is passed in the wrong place; load each package just once. Also notice that the caption package and the IEEtran class might not cooperate well.

• Thanks Gonzalo, I've used this four lines but not working \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} \fancyhead[C]{NOT FOR DISTRIBUTION} – Tak Jun 13 '13 at 3:48
• @user1460166 Notice that you also have to change some lengths (the lines beginning with \setlength in my code). As the image in my answer shows, my code works. Saying simply "not working" is useless. Please edit your question with a simple document like the one in my answer and illustrating that the proposed solution is not working. – Gonzalo Medina Jun 13 '13 at 3:51
• @user1460166 I've updated my answer adding code to add the header also to the page containing the title declaration. – Gonzalo Medina Jun 13 '13 at 4:26
• could you please check my other question here tex.stackexchange.com/questions/118939/… – Tak Jun 13 '13 at 5:31
• @user1460166 I was in bed so I couldn't answer before, but now that I'm awake, I've provided an answer to your other question. – Gonzalo Medina Jun 13 '13 at 13:09