Search code examples
headerlatextex

How can I get the \rhead superiorly to the top and \chead down?


MWE


\documentclass[12pt,a4paper]{article}


\usepackage{enumitem}
\usepackage{fancyhdr}
\usepackage[margin=3cm]{geometry}
\usepackage{pgfplots}



\newlength{\tabcont}
\setlength{\parindent}{0.0in}
\setlength{\parskip}{0.05in}


\title{Assignment 4}


\newcommand{\course}{lipsum}
\newcommand{\coursen}{lipsum}
\newcommand{\semester}{lipsum}
\newcommand{\TDAG}{lipsum}
\newcommand{\campus}{lipsum}
\newcommand{\dept}{lipsum}



\pagestyle{fancyplain}
\headheight 56.2pt

\chead{\campus \\ \dept \\ \course \\ \coursen }
\lhead{\TDAG}
\rfoot{\thepage}
\begin{document}
\maketitle
Submit the following problems which are given in the tutorial 4 as your Assignment 4.
\begin{enumerate}

\item In question 19 ,part (d).
\end{enumerate}

\end{document}

The solution I want

After compiling the above document, the \rhead and \chead are similar in position of height. I want the \rhead to be up and \chead to be down/after \rhead.

I have reviewed a post that included something like \header[C], but that did not work. I am using Miktex + texMaker. But do provide an example if you know how to do it with \header[C] :)

Screenshots

Current one

What I get when I compile the above code

The solution that I need

I need code to get this look


Solution

  • You could just wrap the central header in a minipage:

    \documentclass[12pt,a4paper]{article} 
    
    
    \usepackage{enumitem}
    \usepackage{fancyhdr}
    \usepackage[margin=3cm]{geometry}
    \usepackage{pgfplots}
    
    
    
    \newlength{\tabcont}
    \setlength{\parindent}{0.0in}
    \setlength{\parskip}{0.05in}
    
    
    \title{Assignment 4}
    
    
    \newcommand{\course}{lipsum}
    \newcommand{\coursen}{lipsum}
    \newcommand{\semester}{lipsum} 
    \newcommand{\TDAG}{lipsum}
    \newcommand{\campus}{lipsum}
    \newcommand{\dept}{lipsum}
    
    
    
    \pagestyle{fancyplain}
    \headheight 56.2pt
    
    \chead{\begin{minipage}[t]{.3\textwidth}
    \centering
    \campus \\ \dept \\ \course \\ \coursen 
    \end{minipage}}
    \lhead{\TDAG}
    \rfoot{\thepage}
    \begin{document}
    \maketitle
    Submit the following problems which are given in the tutorial 4 as your Assignment 4.
    \begin{enumerate}
    
    \item In question 19 ,part (d).
    \end{enumerate}
     
    \end{document}
    

    enter image description here