[Tex/LaTex] Different header and footer on the title page (first page)

fancyhdrheader-footertitles

I have been racking my brains over how in bloody hell can you have a different header for the title (or first) page of a document.

I am not asking here how I can not have a header by clearing the page style for this page using \thispagestyle{plain} or something of the sort but how can I have a different header just for the very first page.

Please help as I have a deadline to meet.

So far, I have not been able to find anything useful on TeX.SE.

Here is some of my code to give you some idea of what I want to achieve:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage[margin=2.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{csc}
\pagestyle{fancy}
\fancyhead[L]{**Left Header for all pages**}\fancyhead[R]{**Right Header for all pages**}
\lhead{**Left Header for just the first page**}
\rhead{**Right Header for just the first page**}
\title{Problem Set 1}
        \author{MyBloodyName}
\date{January 31, 2017}
\begin{document}
    \maketitle
    \newpage
    Easier?
\end{document}

Best Answer

You can use \fancypagestyle to define a new page style and \thispagestyle to use it for only the current page:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage[margin=2.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{graphicx}
%\usepackage{csc}% unknown package
\pagestyle{fancy}
\fancyhead[L]{**Left Header for all pages**}
\fancyhead[R]{**Right Header for all pages**}
\fancypagestyle{firstpage}{%
  \lhead{**Left Header for just the first page**}
  \rhead{**Right Header for just the first page**}
}
\title{Problem Set 1}
\author{MyBloodyName}
\date{January 31, 2017}
\begin{document}
    \maketitle
    \thispagestyle{firstpage}
    \newpage
    Easier?
\end{document}

Nevertheless, this can only be done, if you do not really use a titlepage but a title head on the first page. If you want a title page, you have to patch the page style into, e.g., the titlepage environment:

\documentclass[12pt,titlepage]{article}
\usepackage{amsmath}
\usepackage[margin=2.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{graphicx}
%\usepackage{csc}% unknown package
\pagestyle{fancy}
\fancyhead[L]{**Left Header for all pages**}
\fancyhead[R]{**Right Header for all pages**}
\fancypagestyle{firstpage}{%
  \fancyhf{}% clear default for head and foot
  \lhead{**Left Header for just the first page**}
  \rhead{**Right Header for just the first page**}
}
\usepackage{xpatch}
\xapptocmd{\titlepage}{\thispagestyle{firstpage}}{}{}

\title{Problem Set 1}
\author{MyBloodyName}
\date{January 31, 2017}
\begin{document}
    \maketitle
    Easier?
\end{document}