1

I am using a template from someone else to write my statement of purpose. The header looks cool, but how can I make it appear for every page?

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{times}
\usepackage{setspace}
\usepackage[hidelinks]{hyperref}
\usepackage{xcolor}

\renewcommand\thefootnote{\textcolor{blue}{\arabic{footnote}}}

\geometry{left=2.5cm,right=2.5cm,top=1.5cm,bottom=2cm}
\setlength{\parskip}{0.5em}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\newcommand{\Hrule}{\rule{\linewidth}{0.3mm}}
\makeatletter
\renewcommand{\@maketitle}{   \textit{ \vspace{-0.2 cm}\@author \hfill \@date}
\HRule
\parindent=0pt  \centering
\vspace{0.5cm}
{\Large \bfseries\textsc {\@title}}

\par
}
\makeatother



\begin{document}

\title{Statement of Purpose}
\author{ \textbf{My Name}}
\date{{\normalsize {Applicant for PhD program in XXX at XXX School}}%}
\maketitle
This is my statement of purpose.
\newpage{empty}
\end{document}
  • 1
    It amazes me the lengths people go to in order to make \maketitle format things differently, when the easy solution is to NOT USE \maketitle. Anyway, if you want it on every page you can put it into a header (possibly as a \parbox{\textwidth}). – John Kormylo Dec 2 '15 at 16:49
2

There is an easier way to achieve the same result, I think. You can use the package fancyhdr and work on it. I'll give you here a replica of what you were trying to achieve in your question, but there are more options you can use.

For example:

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{}
\fancyhead[RE,LO]{}
\fancyfoot[CE,CO]{}
\fancyfoot[LE,RO]{}

E for even pages, O for odd pages, R for right, L for left, C for center.

New version

If you want to change the properties of the rule, you can add a couple of commands. I also fixed the top margin a bit. If you want to push text down, add this command before the text you want to push (including the title): \vspace*{<length>}. Here's the full code:

\documentclass[12pt]{article}
\usepackage[a4paper,left=2.5cm,right=2.5cm,top=\dimexpr15mm+1.5\baselineskip,bottom=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{fancyhdr}

\renewcommand{\headrulewidth}{.4mm} % header line width

\pagestyle{fancy}
\fancyhf{}
\fancyhfoffset[L]{1cm} % left extra length
\fancyhfoffset[R]{1cm} % right extra length
\rhead{\today}
\lhead{\bfseries My name}
\rfoot{}

\begin{document}
\begin{center}
    \fontsize{24pt}{10pt}\selectfont
    \textsc{\textbf{Statement of purpose}}
\end{center}

This is my statement of purpose...

\newpage

...still going.
\end{document}

And the result...

enter image description here


Old version

First page

enter image description here

Second page

enter image description here

Code

\documentclass[a4paper, 12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\rhead{\today}
\lhead{\bfseries My name}
\rfoot{}

\begin{document}

\begin{center}
    \fontsize{24pt}{10pt}\selectfont
    \textsc{\textbf{Statement of purpose}}
\end{center}

This is my statement of purpose...

\newpage

...still going.
\end{document}
  • Thanks! This code serves the purpose of having a header for each page. But the header looks not as good as the /maketitle, especially when I impose \geometry{left=2.5cm,right=2.5cm,top=1.5cm,bottom=2cm}. Can we change the position, thickness and length of the horizontal line? – David Xiaoyu Xu Dec 3 '15 at 2:31
  • @DavidXiaoyuXu Sure we can, but how do you want it? Note that if you want to shift it down, you might have to fix the top margin to push the text down too. – Alenanno Dec 3 '15 at 9:47
  • Yes I wish to shift it down, preferably to the level as my original result. And I need the line to be thicker (4mm) and longer – David Xiaoyu Xu Dec 3 '15 at 14:16
  • @DavidXiaoyuXu 4mm? That's pretty thick! :D – Alenanno Dec 3 '15 at 14:21
  • Yeah but it looks good in current version. Is that feasible? – David Xiaoyu Xu Dec 3 '15 at 14:31

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.