4

On some pages of my latex document I want to have a full-size image, margin-less, covering the whole page, as you can see it often in magazines. Additionally, I want this image to be referable, i.e. it should fit into the figure numbering order and should appear in the document's "list of figures". Furthermore, it should have a regular figure caption overlayed (i.e. "Fig 1.1.: foo") and a label to refer to.

how it should look like

I tried it with figure sizing and negative spaces:

\newpage
\begin{figure}[p]
\vspace*{-4.4cm}
\makebox[\linewidth]{
\includegraphics[width=\paperwidth,height=\paperheight]{universe.jpg}}
\vspace*{-5em}
\caption{\textcolor{white}{test}}
\label{fig:test1}
\end{figure}
\newpage

But the solution is not robust when using different page margins/geometry. Is there a way to set the vspaces exactly such that there will be no overfull box warnings?

I tried it with background:

\usepackage[pages=some,angle=0,opacity=1,scale=1]{background}
\newcommand\BackImage[1]{%
\BgThispage
\backgroundsetup{contents={\includegraphics[width=\paperwidth,height=\paperheight]{#1}}}}
\begin{document}
\BackImage{universe.jpg}
\vspace*{-3cm}
\begin{figure}
\caption{\textcolor{white}{test}}
\label{fig:test2}
\end{figure}
\clearpage

But using a figure without an actual image seems odd to me.

In both solutions I do not know how to position the caption properly, i.e. I need to have a multi-line caption box on the bottom left corner of the page with, say, 5cm width.

Is there an elegant solution or package for it?

  • I would not use a floating image in this case, so remove the figure environment. The caption should be positionable with the caption package, which you need then anyway for the non-figure - caption – user31729 Sep 10 '15 at 7:51
1

You could do something like the below. Here I have rotated the legend as an example but you could avoid that if you wish. The image itself will be distorted if it in not at the same aspect ratio as the page (that can be avoided using various methods if you wish). The legend itself you would style using the caption package. I have put the legend in a colored box, but again you could avoid that and alter the color of legend to suit the image.

\documentclass{article}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{eso-pic}
\usepackage{caption}

%for convenience I define a coordinate system for page runs -1 to +1
%so you can move the legend
\makeatletter
\def\parsecomma#1,#2\endparsecomma{\def\page@x{#1}\def\page@y{#2}}
\tikzdeclarecoordinatesystem{page}{
    \parsecomma#1\endparsecomma
    \pgfpointanchor{current page}{north east}
    \pgf@xc=\pgf@x%
    \pgf@yc=\pgf@y%
    \pgfpointanchor{current page}{south west}
    \pgf@xb=\pgf@x%
    \pgf@yb=\pgf@y%
    \pgfmathparse{(\pgf@xc-\pgf@xb)/2.*\page@x+(\pgf@xc+\pgf@xb)/2.}
    \expandafter\pgf@x\expandafter=\pgfmathresult pt
    \pgfmathparse{(\pgf@yc-\pgf@yb)/2.*\page@y+(\pgf@yc+\pgf@yb)/2.}
    \expandafter\pgf@y\expandafter=\pgfmathresult pt
}
\makeatother


\begin{document}
\lipsum[5]

\clearpage
\thispagestyle{empty}
\AddToShipoutPicture*{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}}
\begin{tikzpicture}[remember picture,overlay,every node/.style={anchor=center}]%
\node [fill = yellow!30, anchor = north west, minimum height = 6mm, minimum width = 0.20\paperheight, align = flush left,  inner xsep = 3mm, text width=0.30\paperheight-5mm, rotate = 90] at (page cs:-0.8,-0.5) {\captionof{figure}[Legend for table of figures]{This is my legend}\label{im:first}};
\end{tikzpicture}
\clearpage
\lipsum[5]
\clearpage
\thispagestyle{empty}
\AddToShipoutPicture*{\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}}
\begin{tikzpicture}[remember picture,overlay,every node/.style={anchor=center}]%
\node [fill = yellow!30, anchor = north west, minimum height = 6mm, minimum width = 0.20\paperheight, align = flush left,  inner xsep = 3mm, text width=0.30\paperheight-5mm, rotate = 90] at (page cs:-0.8,-0.5) {\captionof{figure}[Legend for table of figures]{This is my legend}\label{im:second}};
\end{tikzpicture}
\clearpage

This is a reference to Figure \ref{im:second} and this to This is a reference to Figure \ref{im:first}

\end{document}
  • Works perfectly well for me, thanks a lot! Just aside: I do not need a convenient coordinate system, could we get rid of the tikz declaration? – Martin Sep 10 '15 at 13:17

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.