GeneralFront page figure covering entire top page, incl. margins

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
NiklasF
Posts: 4
Joined: Fri Feb 22, 2008 5:31 pm

Front page figure covering entire top page, incl. margins

Post by NiklasF »

Hello!

I'm not very skilled at Latex but I know the basics. Right now I'm writing my master thesis and as the layout was provided to me from a friend I'm almost set. One thing bothers me though and that is the cover page. I would like to have a figure covering about 1/4 of the page and being positioned at the top of the page. The figure should cover all the margins as well, that is left-, right- and top margin (no white space whatsoever).

Is this possible? I've been playing around with an environment called "narrow" and I think this solves the left and right margins but the top margin persists (perhaps topmargin can't be redefined temporarily in-text?!)

This is how it looks right now:

Code: Select all

%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{narrow}[2]{%
  \begin{list}{}{%
  \setlength{\topsep}{0pt}%
  \setlength{\leftmargin}{#1}%
  \setlength{\rightmargin}{#2}%
  \setlength{\listparindent}{\parindent}%
  \setlength{\itemindent}{\parindent}%
  \setlength{\parsep}{\parskip}}%
\item[]}{\end{list}}

\begin{figure}
	\begin{narrow}{-XXin}{XXin}
		\includegraphics[width = XXcm]{XX.png}
	\end{narrow}
\end{figure}

%%%%%%%%%%%%%%%%%%%%%%%%%
Can someone recommend a nice package or strategy to solve this problem?

Thanks!

Recommended reading 2024:

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

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

User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Front page figure covering entire top page, incl. margins

Post by Juanjo »

There are several possible approaches. For example, the textpos package allows to place boxes, pictures or text at any arbitrary position of the page.

Next, I provide a direct approach: it suffices to move the picture upwards and to the left some suitable spaces. The following code asumes that you want to cover exactly 1/4 of the paper height.

Code: Select all

\documentclass[a4paper]{book}

\usepackage{graphicx}
\usepackage{color}

\newlength{\PictHOffset}
\newlength{\PictVOffset}
\setlength{\PictHOffset}{1in}
\addtolength{\PictHOffset}{\hoffset}
\addtolength{\PictHOffset}{\oddsidemargin}

\setlength{\PictVOffset}{1in}
\addtolength{\PictVOffset}{\voffset}
\addtolength{\PictVOffset}{\topmargin}
\addtolength{\PictVOffset}{\headheight}
\addtolength{\PictVOffset}{\headsep}
\addtolength{\PictVOffset}{\topskip}
\addtolength{\PictVOffset}{-0.25\paperheight}

\begin{document}

\begin{titlepage}
   \noindent\hspace*{-\PictHOffset}%
   % Uncomment next line and replace XXX by your graphics file
   %\raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
      %\includegraphics[width=\paperwidth,height=0.25\paperheight]{XXX}}}
   % Comment next line.
    \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{\color{blue}\rule{\paperwidth}{0.25\paperheight}}}

   \begin{center}
      \vfill
      \bfseries \Huge My Master Thesis \\[3cm]
      by Myself 
      \vfill
     University of \LaTeX land
   \end{center}
\end{titlepage}

\frontmatter
\chapter{Preface}

\mainmatter
\chapter{And so on}

\end{document}
(Edited to add the \makebox command)
NiklasF
Posts: 4
Joined: Fri Feb 22, 2008 5:31 pm

Front page figure covering entire top page, incl. margins

Post by NiklasF »

Thanks a bunch! The textpos package did the trick. For those of you who are interested in my approach:

Code: Select all

\usepackage[absolute]{textpos}

\begin{textblock*}{297mm}(0mm,0mm)
	\includegraphics[width=\paperwidth]{xxx.png}
\end{textblock*}
/Niklas
kamrul
Posts: 3
Joined: Wed Sep 01, 2010 9:12 am

Re: Front page figure covering entire top page, incl. margin

Post by kamrul »

Thanks. It's really a nice trick.
Post Reply