GeneralHeader and footer

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am

Header and footer

Post by Jchen066 »

Tried to use pictures for header and footer. please see below code used and the output:

The header picture doesn't covere the entire header area. Can I change the header height to match the picture or other way around.

Code: Select all

\documentclass[12pt,english]{article}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PACKAGES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% GEOMETRY - Provide the geometry settings of document
\usepackage{geometry}
\geometry{
	left = 28mm,
	right = 28mm,
	top = 50mm,
	bottom = 28mm,
	bindingoffset = 0mm,
	headheight = 103pt,
	headsep = 15mm,
	footskip = 0mm
}

\usepackage{lmodern}

% AMSFONTS - Allows for \mathbb fonts
\usepackage{amsfonts}

% MARGINNOTE - Allows for additive calculations
\usepackage{marginnote,calc,kantlipsum}

% TIKS & PGFPLOTS - Allows the creation of graphics
\usepackage{tikz}
\usepackage{pgfplots}

% PARSKIP - Provides instant formatting to indents on paragraphs. Having this package will remove indentation.
\usepackage{parskip}

% LIPSUM - For debugging purposes; provides text in Latin
\usepackage{lipsum}

% ESO-PIC - Allows floating text (and perhaps pictures) to be placed in either the foreground or backgrounds
\usepackage[pscoord]{eso-pic}

% COLOR - Allows user to user colours on text
\usepackage{color}
\usepackage{xcolor}

% TCOLORBOX - Allows for coloured boxes
\usepackage{tcolorbox}

% VLecture Colours

\definecolor{vlecture}{RGB}{63,163,175}
\definecolor{vlecture2}{RGB}{184,189,38}

% TITLESEC - Stylign on default section headings

\usepackage{titlesec}

% RELSIVE - Increase the size of equations in the math environment

\usepackage{relsize}

% CONTOUR - Contours on titles

\usepackage{contour}

\titleformat{\section}
{\color{vlecture}\normalfont\Large\bfseries}
{\color{vlecture}\thesection}{1em}{}

\titleformat{\subsection}
{\color{vlecture2}\normalfont\large\bfseries}
{\color{vlecture2}\thesubsection}{1em}{}

% MULTICOL - For multiple columns

\usepackage{multicol}

% DASHRULE

\usepackage{arydshln}

\setlength{\dashlinedash}{0.2pt}
\setlength{\dashlinegap}{4.5pt}
\setlength{\arrayrulewidth}{0.2pt}

% FANCYHDR - For additional options on headers and footers
\usepackage{fancyhdr}
\usepackage{array}

\newlength{\myoddoffset}
\setlength{\myoddoffset}{\marginparwidth + \marginparsep}

\pagestyle{fancy}
\fancyheadoffset[leh,roh]{\myoddoffset} 
\fancyheadoffset[loh,reh]{\myoddoffset}

\fancyheadoffset[lf,rf]{\myoddoffset + 25pt} 
%\fancyheadoffset[lof,ref]{\myoddoffset + 25pt}

%\lhead{\Large \bfseries\begin{tabular}{c}Year 11 \\ Mathematics \\ Extension 1\end{tabular}}

\fancyhead[L]{
	\large \bfseries \sffamily 
	\begin{tabular}{c}
		Year 11 \\ Mathematics \\ Extension 1
	\end{tabular}
}

\fancyhead[C]{
	\begin{tabular}{c}
		\includegraphics[height=2.9cm, width=22cm]{C:/Users/jiech/Documents/Tuition/pictures/pictures/header.png}
	\end{tabular}
}

\fancyhead[R]{
	\large \bfseries
	Volume (i)
}

\fancyfoot[L]{
	\includegraphics[height=2.8cm, width=22cm]{C:/Users/jiech/Documents/Tuition/pictures/pictures/footer.png}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% COMMANDS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%






\begin{document} 
	
	% Create title page
	

	
	\section{Introduction}
	


\end{document}
Attachments
head 2.PNG
head 2.PNG (32.24 KiB) Viewed 13519 times
Last edited by Stefan Kottwitz on Sun Sep 16, 2018 4:37 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Header and footer

Post by rais »

Hi there,
you've put the header logo into an additional tabular environment.
There's nothing wrong with that as such, but according to the column declaration---the {c}---you want \tabcolsep space left (and right) of this column.
Try {@{}c@{}} instead (the @{} cuts off the additional space, here on both sides of the c column).

KR
Rainer
Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am

Header and footer

Post by Jchen066 »

rais wrote:Hi there,
you've put the header logo into an additional tabular environment.
There's nothing wrong with that as such, but according to the column declaration---the {c}---you want \tabcolsep space left (and right) of this column.
Try {@{}c@{}} instead (the @{} cuts off the additional space, here on both sides of the c column).

KR
Rainer
Thanks Rainer. Indeed, it removed the space from both left and right side.

Is there a way to align the logo (the blue golden line) to the header line (dark line)
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Header and footer

Post by rais »

Well, you could put the image in a \raisebox and let it tell LaTeX, its contents has neither height nor depth.
However, your header image will then most likely overwrite the stuff from the left side; looks like you've already considered that and used a transparent background (otherwise, `year 11' wouldn't have been visible). So for those using a header file without transparency, I'd put the header image into a \makebox in the left header part already, where I can tell LaTeX to overwrite this box:

Code: Select all

\fancyhead[L]{%
  \makebox[0pt][l]{%
    \raisebox{-8mm}[0pt][0pt]{%
      \includegraphics[height=3.5cm, width=22cm]{header}%
    }%
  }%
  \large \bfseries \sffamily 
  \begin{tabular}{c}
    Year 11 \\ Mathematics \\ Extension 1
  \end{tabular}%
}
Or, you could use the eso-pic package for putting the header image in the background at top of the page (you're already loading it).

KR
Rainer
Post Reply