0

I wanted to have all document with geometry parameters as follow:

\usepackage[top=1.5cm, bottom=2cm, left=2.5cm, right=1.25cm, includehead,includefoot, footskip=5mm,headsep=5mm]{geometry}

But the first page with the smaller left margin (1.25cm) so I defined new geometry for the first page. Everything works but the header and footer are moved to the right even when the right margin is set (but the text of section is ok).

enter image description here enter image description here

but the first page (with new geometry is ok): enter image description here

The code:

\documentclass[a4paper,11pt]{article}
\usepackage[top=1.5cm, bottom=2cm, left=2.5cm, right=1.25cm, includehead,includefoot,     footskip=5mm,headsep=5mm]{geometry}

%\usepackage[showframe]{geometry}
\usepackage{graphicx}
\usepackage{fancyhdr}           % fancy headers/footers
\usepackage[T1]{fontenc}
\usepackage{newtxtext,newtxmath}

% Use fancyheadings stuff
\fancypagestyle{mytitlestyle}{

%Set up new layouts values for title page
\renewcommand{\headheight}{30mm}

% Definition of the header
\renewcommand{\headrulewidth}{0.6pt}
\fancyhead[L]{\bf Number}
\fancyhead[R]{\includegraphics[width=57mm]{Logo}}
%defn of footer
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[L]{\textbf{Title}}
\cfoot{\vspace*{5mm} \bf Page \thepage\ of \pageref{END}}
\fancyfoot[R]{\textbf{Version number}}
}

\fancypagestyle{mypagestyle}{

% Definition of the header
\renewcommand{\headrulewidth}{0.6pt}
\fancyhead[LO,RE]{\bf Number}
\fancyhead[RO,LE]{\bf Commercial in Confidence}
%
\renewcommand{\footrulewidth}{0.6pt}
\fancyfoot[LO,RE]{\textbf{Title}}
\cfoot{\vspace*{5mm} \bf Page \thepage\ of \pageref{END}}
\fancyfoot[RO,LE]{\textbf{Version number}}
}



\begin{document}
\thispagestyle{mytitlestyle}
\newgeometry{top=1.5cm, bottom=5cm, left=1.25cm, right=1.25cm, includehead,includefoot,     footskip=5mm,headsep=5mm}

 \setcounter{page}{1}
\begin{center}
\vspace*{20mm}
{\Large \textbf{TITLE}}\\
\vspace*{30mm}
{\large \textbf{ABSTRACT}}
\end{center}

\newpage
\pagestyle{mypagestyle}
\restoregeometry

\section{The First Section}
Text text text text text text text text text text text text text text text text text text text text     text text text text text.Text text text text text text text text text text text text text text text text text text text text text text text text text.Text text text text text text text text text text text text text 

\label{END}
\end{document} 
1
  • fancyhdr cannot change its header size once created. I would do the entire title page using \tikz[overlay]. Apr 13, 2020 at 17:47

1 Answer 1

0

This shows how to create a title page using tikz. It takes two runs due to [remember picture].

It turns out that footskip=5mm is too small and the rule winds up inside the text area, so I increased it to footskip=10mm and reduced bottom accordingly. I still can't quite match \textheight or the footer spacing.

\documentclass[a4paper,11pt]{article}
\usepackage[top=1.5cm, bottom=1.5cm, left=2.5cm, right=1.25cm, includehead,includefoot, footskip=10mm,headsep=5mm]{geometry}

%\usepackage[showframe]{geometry}
\usepackage{tikz}
\usepackage{fancyhdr}           % fancy headers/footers
\usepackage[T1]{fontenc}
\usepackage{newtxtext,newtxmath}

% Use fancyheadings stuff
\fancypagestyle{mypagestyle}{

% Definition of the header
\renewcommand{\headrulewidth}{0.6pt}
\fancyhead[LO,RE]{\bf Number}
\fancyhead[RO,LE]{\bf Commercial in Confidence}
%
\renewcommand{\footrulewidth}{0.6pt}
\fancyfoot[LO,RE]{\textbf{Title}}
\cfoot{\vspace*{5mm} \bf Page \thepage\ of \pageref{END}}
\fancyfoot[RO,LE]{\textbf{Version number}}
}

\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[remember picture, overlay]
\path(current page.north) ++(0pt,-1.5cm)% header (top)
  node[below,inner sep=0pt,text width={\paperwidth-2.5cm}]{\rule{0pt}{30mm}% strut
    \textbf{Title}\hfill\smash{\includegraphics[width=57mm]{example-image}}};% \smash in case logo doesn't fit

\draw[line width=0.6pt] (current page.north west) ++(1.25cm,-4.75cm) -- ++(\paperwidth-2.5cm,0pt);

\path(current page.north) ++(0pt,-5cm)% text area
  node[below, inner sep=0pt]{\parbox[c][\dimexpr \paperheight-7.5cm][t]{\dimexpr\paperwidth-2.5cm}{%
\begin{center}
\vspace*{20mm}
{\Large \textbf{TITLE}}\\
\vspace*{30mm}
{\large \textbf{ABSTRACT}}
\end{center}}};

\draw[line width=0.6pt] (current page.south west) ++(1.25cm,1.75cm+0.5\baselineskip) -- ++(\paperwidth-2.5cm,0pt);

\path(current page.south) ++(0pt,1.5cm)% footer (baseline)
  node[above, inner sep=0pt, text width={\paperwidth-2.5cm}]{%
    \rlap{\textbf{Title}}\hfill
    \raisebox{-8mm}[0pt][0pt]{\bf Page \thepage\ of \pageref{END}}\hfill
    \llap{\textbf{Version number}}};
\end{tikzpicture}
\newpage
\pagestyle{mypagestyle}

\section{The First Section}
Text text text text text text text text text text text text text text text text text text text text     text text text text text.Text text text text text text text text text text text text text text text text text text text text text text text text text.Text text text text text text text text text text text text text 

\the\textheight\par
\the\dimexpr \paperheight-5cm\relax
\label{END}
\end{document} 
3
  • Thanks for your answer, it seems to work. Is it any way to put also a table exactly at the bottom of the title page? I tried to use \vfill but it doesn't work in tikzpicture environment.
    – begginer
    Apr 14, 2020 at 7:06
  • Using [text width=...] is equivalent to using a \parbox, which is why \hfill doesn't work. There are two solutions: use \parbox[c][\dimexpr \paperheight-7cm][t]{\dimexpr \paperwidth-2.5cm}{...} inside the node, or add another node 2cm up from (current page.south). Apr 14, 2020 at 14:45
  • My first solution assumed that top and bottom applied to the text area, but with includehead and includefoot they apply to the header (top) and footer (baseline). Apr 14, 2020 at 16:05

You must log in to answer this question.

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