3

I am trying to create a template for my short reports (3-5 pages). I would like to have a header and a footer on each page.

I have managed the most of it but I am running into an issue and would greatly appreciate a solution to this problem.

I reviewed the previous questions and there was answer to a question ( Text running into footer area when using amsart and fancyhdr) but when I implement that suggestion, my header disappears.

Here is the code I am using and a screenshot to illustrate the issue.

Thank you, Jay

enter image description here

\documentclass[11pt]{article}
\usepackage[top=1in, bottom=1in, left=0.5in, right=0.5in]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{graphicx}
\usepackage{datetime}

\lhead{ \includegraphics[width=3cm, height=1cm]{logo-img-3}}
\rhead{\begin{Large} faucibus maximus\end{Large}\\    \begin{small}LQuisque ex dui, tincidunt eu metus ut \end{small}}
\fancyfoot[L]{Lorem ipsum dolor sit amet, consectetur }
\fancyfoot[R]{\today}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\setlength{\headheight}{33pt}

\graphicspath{ {images/} }
\vspace*{5ex}

\begin{document}
\begin{center}
\begin{Huge} Aliquam malesuada ex libero \end{Huge}\\
\end{center}

\vspace{0.5in}
\begin{center}
\begin{Huge} consectetur adipiscing \end{Huge}\\
\end{center}


\clearpage
\begin{tabular}{| c | c | c | c | c | c | r |}
\hline
col1  & col2 & col3 & col4 & col5 & col6 & col7 \\ [1ex]
\hline \hline
col1  & col2 & col3 & col4 & col5 & col6 & col7 \\ [1ex]
\hline
col1  & col2 & col3 & col4 & col5 & col6 & col7 \\ [1ex]
\hline
col1  & col2 & col3 & col4 & col5 & col6 & col7 \\ [1ex]
\hline
\end{tabular}

\end{document}
3
  • 1
    Welcome! If you use geometry, do not set page layout dimensions manually as it will throw off the calculations. In this case geometry doesn't know you've changed \headheight so it doesn't take any account of it.
    – cfr
    May 2, 2016 at 16:09
  • The code you've posted doesn't generate the image posted. It doesn't demonstrate the issue. At least, it doesn't when I substitute your image with example-image-a. Obviously, I don't have your image itself. What is the vertical space before \begin{document} supposed to do?
    – cfr
    May 2, 2016 at 16:11
  • 1
    warning -- amsart isn't set up to coexist happily with either fancyhdr or geometry; the page layout is defined to produce the output required by the in-house platemaker in our printing department. so using instructions meant for amsart isn't likely to produce the results you are looking for when you are using article. May 2, 2016 at 16:17

1 Answer 1

3

Do you want something like this?

sample output

If you use geometry, do not set page layout dimensions manually as it will throw off the calculations. In this case geometry doesn't know you've changed \headheight so it doesn't take any account of it. The problem can be corrected by changing the dimension using geometry's facilities.

Code for above sample:

\documentclass[11pt]{article}
\usepackage[top=1in, bottom=1in, left=0.5in, right=0.5in]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{graphicx}
\usepackage{datetime}
\lhead{ \includegraphics[width=3cm, height=1cm]{example-image-a}}
\rhead{\Large faucibus maximus\\\small LQuisque ex dui, tincidunt eu metus ut}
\fancyfoot[L]{Lorem ipsum dolor sit amet, consectetur }
\fancyfoot[R]{\today}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\geometry{headheight=33pt}
\usepackage{kantlipsum}
\begin{document}
\vspace*{5ex}
\begin{center}
  \Huge Aliquam malesuada ex libero
  \vspace{0.5in}

  \Huge consectetur adipiscing
\end{center}
\kant[1-10]
\clearpage
\begin{tabular}{| c | c | c | c | c | c | r |}
  \hline
  col1  & col2 & col3 & col4 & col5 & col6 & col7 \\ [1ex]
  \hline \hline
  col1  & col2 & col3 & col4 & col5 & col6 & col7 \\ [1ex]
  \hline
  col1  & col2 & col3 & col4 & col5 & col6 & col7 \\ [1ex]
  \hline
  col1  & col2 & col3 & col4 & col5 & col6 & col7 \\ [1ex]
  \hline
\end{tabular}
\end{document}
3
  • Hi, Thank you so much for your quick response. your proposed code works nicely. I have another question: how do I remove the weekday from the day in the footer? I just need the day of the month and year (no week day). Many Thanks, Jay May 2, 2016 at 17:04
  • Never mind! I replaced \usepackage{datetime} with \usepackage{advdate} and I now have the date format I wanted. Thanks! May 2, 2016 at 18:25
  • You could also do it with datetime but if advdate does what you need, you already have a solution ;).
    – cfr
    May 2, 2016 at 18:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .