4

My header and footer do not appear on the first page. I hope they do. The solution of a duplicate question is not working for me. That is why I still decided to post my question. I will make the tile more informative once I have known the cause.

MWE

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage[hidelinks]{hyperref} % hide the links
% For custom spacing
\usepackage{setspace}
\setstretch{1.2} 
% For the symbols
\usepackage{wasysym}
\usepackage{marvosym}
\usepackage[alpine]{ifsym}

\usepackage{fancyhdr}

\pagestyle{fancy} \fancyhf{} \lhead{ \Mundus\enspace \href{http://sites.google.com/site/}{http://sites.google.com/site/} } \rhead{ \MVAt\enspace \href{mailto:e@gmail.com}{e@gmail.com} } \cfoot{\thepage/2}

\usepackage{lipsum}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} \newcommand{\Hrule}{\rule{\linewidth}{0.3mm}}

\makeatletter% since there's an at-sign (@) in the command name \renewcommand{@maketitle}{% \parindent=0pt% don't indent paragraphs in the title block \centering {\LARGE \bfseries\textsc{@title}} \HRule\par% \textit{@author \hfill @date} \par } \makeatother% resets the meaning of the at-sign (@)

\title{Statement of Purpose} \author{X} \date{\today}

\begin{document} \maketitle% prints the title block \thispagestyle{empty} \vspace{12pt}

\lipsum \end{document}

  • Please make sure to reduce your code to the very minimum, e.g. the only package necessary to show your problem is fancyhdr (see http://meta.tex.stackexchange.com/questions/228/ive-just-been-asked-to-write-a-minimal-example-what-is-that/3225#3225). – doncherry Oct 12 '14 at 14:28

2 Answers2

6

\maketitle defines the current page style as plain. Hence you have to define the plain page style.

\fancypagestyle{plain}{%
  \fancyhf{}
\lhead{
\Mundus\enspace \href{http://sites.google.com/site/}{http://sites.google.com/site/}
}
\rhead{
\MVAt\enspace \href{mailto:e@gmail.com}{e@gmail.com}
}
\cfoot{\thepage/2}
}

Full code:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage[hidelinks]{hyperref} % hide the links
% For custom spacing
\usepackage{setspace}
\setstretch{1.2}
% For the symbols
\usepackage{wasysym}
\usepackage{marvosym}
\usepackage[alpine]{ifsym}

\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\lhead{
\Mundus\enspace \href{http://sites.google.com/site/}{http://sites.google.com/site/}
}
\rhead{
\MVAt\enspace \href{mailto:e@gmail.com}{e@gmail.com}
}
\cfoot{\thepage/2}

\fancypagestyle{plain}{%
  \fancyhf{}
\lhead{
\Mundus\enspace \href{http://sites.google.com/site/}{http://sites.google.com/site/}
}
\rhead{
\MVAt\enspace \href{mailto:e@gmail.com}{e@gmail.com}
}
\cfoot{\thepage/2}
}

\usepackage{lipsum}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\newcommand{\Hrule}{\rule{\linewidth}{0.3mm}}

\makeatletter% since there's an at-sign (@) in the command name
\renewcommand{\@maketitle}{%
  \parindent=0pt% don't indent paragraphs in the title block
  \centering
  {\LARGE \bfseries\textsc{\@title}}
  \HRule\par%
  \textit{\@author \hfill \@date}
  \par
}
\makeatother% resets the meaning of the at-sign (@)

\title{Statement of Purpose}
\author{X}
\date{\today}

\begin{document}
  \maketitle% prints the title block
  %\thispagestyle{empty}
  \vspace{12pt}

\lipsum
\end{document}

enter image description here

1

If you want the same headers and footers on the title page as on the other pages, a simple solution is redefine the plain-pagestyle to have the same content as the pagestyle you use in the rest of the document (i.e. \pagestyle{fancy}).You may use the the \let-command to do that.

\let\ps@plain\ps@fancy

Since it contains the @you have to enclose it in a \makeatletter\makeatother pair. You already have such a pair where you redefine the @\maketitle-command, so add the \let either at the beginning or end of that code:

\makeatletter% since there's an at-sign (@) in the command name

\let\ps@plain\ps@fancy %% ---> change the headers and footer at the title-page

\renewcommand{\@maketitle}{%
  \parindent=0pt% don't indent paragraphs in the title block
  \centering
  {\LARGE \bfseries\textsc{\@title}}
  \HRule\par%
  \textit{\@author \hfill \@date}
  \par
}
\makeatother% resets the meaning of the at-sign (@)
Sveinung
  • 20,355