LaTeX forum ⇒ GeneralFront page figure covering entire top page, incl. margins

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

Front page figure covering entire top page, incl. margins

Postby NiklasF » Fri Feb 22, 2008 5:49 pm

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:

  1. %%%%%%%%%%%%%%%%%%%%%%%%%
  2.  
  3. \newenvironment{narrow}[2]{%
  4. \begin{list}{}{%
  5. \setlength{\topsep}{0pt}%
  6. \setlength{\leftmargin}{#1}%
  7. \setlength{\rightmargin}{#2}%
  8. \setlength{\listparindent}{\parindent}%
  9. \setlength{\itemindent}{\parindent}%
  10. \setlength{\parsep}{\parskip}}%
  11. \item[]}{\end{list}}
  12. \begin{figure}
  13. \begin{narrow}{-XXin}{XXin}
  14. \includegraphics[width = XXcm]{XX.png}
  15. \end{narrow}
  16. \end{figure}
  17.  
  18. %%%%%%%%%%%%%%%%%%%%%%%%%

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

Thanks!

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

Postby Juanjo » Sat Feb 23, 2008 12:20 am

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.
  1. \documentclass[a4paper]{book}
  2.  
  3. \usepackage{graphicx}
  4. \usepackage{color}
  5.  
  6. \newlength{\PictHOffset}
  7. \newlength{\PictVOffset}
  8. \setlength{\PictHOffset}{1in}
  9. \addtolength{\PictHOffset}{\hoffset}
  10. \addtolength{\PictHOffset}{\oddsidemargin}
  11.  
  12. \setlength{\PictVOffset}{1in}
  13. \addtolength{\PictVOffset}{\voffset}
  14. \addtolength{\PictVOffset}{\topmargin}
  15. \addtolength{\PictVOffset}{\headheight}
  16. \addtolength{\PictVOffset}{\headsep}
  17. \addtolength{\PictVOffset}{\topskip}
  18. \addtolength{\PictVOffset}{-0.25\paperheight}
  19.  
  20. \begin{document}
  21.  
  22. \begin{titlepage}
  23. \noindent\hspace*{-\PictHOffset}%
  24. % Uncomment next line and replace XXX by your graphics file
  25. %\raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
  26. %\includegraphics[width=\paperwidth,height=0.25\paperheight]{XXX}}}
  27. % Comment next line.
  28. \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{\color{blue}\rule{\paperwidth}{0.25\paperheight}}}
  29.  
  30. \begin{center}
  31. \vfill
  32. \bfseries \Huge My Master Thesis \\[3cm]
  33. by Myself
  34. \vfill
  35. University of \LaTeX land
  36. \end{center}
  37. \end{titlepage}
  38.  
  39. \frontmatter
  40. \chapter{Preface}
  41.  
  42. \mainmatter
  43. \chapter{And so on}
  44.  
  45. \end{document}


(Edited to add the \makebox command)

NiklasF
Posts: 4
Joined: Fri Feb 22, 2008 5:31 pm

Postby NiklasF » Mon Feb 25, 2008 1:59 pm

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

  1. \usepackage[absolute]{textpos}
  2.  
  3. \begin{textblock*}{297mm}(0mm,0mm)
  4. \includegraphics[width=\paperwidth]{xxx.png}
  5. \end{textblock*}


/Niklas

kamrul
Posts: 3
Joined: Wed Sep 01, 2010 9:12 am

Postby kamrul » Wed Sep 01, 2010 9:12 am

Thanks. It's really a nice trick.


Return to “General”

Who is online

Users browsing this forum: No registered users and 4 guests