6

I'm trying to use fancy header and \maketitle concurrently. This causes a problem because apparently \maketitle calls \plainstyle, which overrides the fancyhdr settings. Is there a simple patch for this? In the following MWE, commenting and un-commenting line 34 totally changes the layout of the document. I want to preserve all the document characteristics with \maketitle commented out, with just the addition of the title section about the text columns. Any help?

\documentclass[a4paper,11pt]{article}

%..define packages to be used in controlling document features and layout  
\usepackage{multicol}
\usepackage[left=1.5cm,right=1.5cm,bottom=2cm,top=1cm]{geometry}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage{fancyhdr, lipsum}
\usepackage{textcomp}
\usepackage{titling}

\usepackage{etoolbox} %..http://tex.stackexchange.com/questions/199317/custom-footer-on-title-page-using-maketitle-and-book-document-class
\patchcmd{\maketitle}
  {\end{titlepage}}
  {\thispagestyle{titlepagestyle}\end{titlepage}}
  {}{}

%..This section controls the header-footer layout of the document
\setlength\headheight{25mm}
\pagestyle{fancy}

\fancyhead[L]{\parbox[b][10mm][t]{0.5\textwidth}{\large{COMPANY NAME HERE}}}
\fancyhead[R]{LOGO HERE}

\fancyfoot[C]{\textit{\textcopyright \,DRAFT: SOME COMPANY, \today}}

%..This section controls the title layout
\title{TITLE}
\author{NAME and ID}
\date{\today}

\begin{document}

%\maketitle

\begin{multicols*}{2}

\section{First Section}

Hello, here is some text without a meaning.  This text should show what  a printed text will look like at this place. If you read this text, you will get no information.  Really?  Is there no information?  Is there...

\section{Second Section}

Hello, here is some text without a meaning.  This text should show what  a printed text will look like at this place. If you read this text, you will get no information.  Really?  Is there no information?  Is there...

\end{multicols*}

\end{document}
10

As it stands, the bottom of your pages will disappear to Never, Never Land as soon as you get to the bottom of a column. This is because you change the value of headheight after geometry has done its magic.

If you include headheight=25mm in the options for geometry, the header is cut off because you have not allowed sufficient space. top cannot be smaller than the size you want for the header.

article does not use a titlepage by default so the patching has no effect. Since it uses an undefined page style, that may be just as well.

Here's a fixed version which maintains as much of your layout as possible subject to the constraint of everything fitting on the page. I use showframe to make the layout clearer.

\thispagestyle{fancy} is used after \maketitle to ensure the header and footer.

fixed layout fits on page

\documentclass[a4paper,11pt]{article}

%..define packages to be used in controlling document features and layout
\usepackage{multicol}
\usepackage[left=1.5cm, right=1.5cm, bottom=2cm, top=25mm, marginparwidth=0pt, headheight=25mm, verbose, showframe]{geometry}% top must be at least headheight!
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage{fancyhdr, lipsum}
\usepackage{textcomp}
\usepackage{titling}

%..This section controls the header-footer layout of the document
\pagestyle{fancy}

\fancyhead[L]{\parbox[b][10mm][t]{0.5\textwidth}{\large{COMPANY NAME HERE}}}
\fancyhead[R]{LOGO HERE}

\fancyfoot[C]{\textit{\textcopyright \,DRAFT: SOME COMPANY, \today}}

%..This section controls the title layout
\title{TITLE}
\author{NAME and ID}
\date{\today}

\begin{document}

  \maketitle\thispagestyle{fancy}

  \begin{multicols*}{2}

    \section{First Section}

    \lipsum[1-10]

    \section{Second Section}

    \lipsum[11-20]

  \end{multicols*}

\end{document}
  • Thanks! That's helpful. As a bonus, do you have any tips on how to shrink the amount of whitespace between the header and the title? – Aaron Mar 18 '15 at 5:43
  • @Aaron See the manual for titling. That lets you configure the layout of the title fairly easily. – cfr Mar 18 '15 at 13:56
1

This is discussed on page 7 of fancyhdr documentation. Just redefine the plain page style:

 \fancypagestyle{plain}{INSERT YOUR DEFINITIONS}
  • This is the easiest solution! I've searched for hours. If you stumble upon this and are also using org-export then you can simply add the line #+LATEX_HEADER: \fancypagestyle{plain}{} to the tree being exported and the title page will also have the header/footer defined with fancyhdr. – Guilherme Salomé May 1 at 19:18

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.