3

The LaTeX code below produces two pages. The second one is as I intended it to be: the picture filling the whole page. But when using overpic (for overlying some text), I have not been able of getting the same result.

\documentclass[12pt]{article}
\usepackage[percent]{overpic}
\usepackage{graphicx}
\usepackage[paperwidth=38.205cm, paperheight=19.367cm,
        margin=0cm]{geometry}

\setlength{\parindent}{0cm}

\begin{document}
\pagestyle{empty}

\begin{overpic}[width=\textwidth,height=\textheight]{picture}
  \put (55,10) {This is some text}
\end{overpic}

\newpage
\includegraphics[width=\textwidth, height=\textheight]{picture}

\end{document}

When I compile this with pdflatex, I get a second page with the image filling the page, but for the first one, I get an empty (while) line of about 0.5cm at the bottom, which is not filled by the picture (which is otherwise filling the rest of the page).

I've tried mangling with margings, indents, parskips and many other tricks, but I seem to be blocked... :-( Any idea

Just in case that matters, the image I'm using is JPEG, 2811x1374 (in pixels), and the output I get from pdflatex is as follows:

jgb@parato:/tmp$ pdflatex \\nonstopmode\\input test.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 7 languages loaded.

(./test.tex (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))
(/usr/share/texlive/texmf-dist/tex/latex/overpic/overpic.sty
Package: overpic v0.53 <2010/09/13> (RN)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(/usr/share/texlive/texmf-dist/tex/latex/eepic/epic.sty
Enhancements to Picture Environment. Version 1.2 - Released June 1, 1986
)
overpic: relative positioning in percent
) (/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)) (./test.aux)
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty)))
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
<picture.jpg, id=1, 2821.54124pt x 1379.1525pt> <use picture.jpg> [1{/var/lib/t
exmf/fonts/map/pdftex/updmap/pdftex.map} <./picture.jpg>] <use picture.jpg>
[2] (./test.aux) )</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm
/cmr12.pfb>
Output written on test.pdf (2 pages, 1181833 bytes).
Transcript written on test.log.
  • Welcome to TeX.SX! – Adam Liter Dec 15 '14 at 18:50
  • Is there a specific need for using overpic? Are you open to other suggestions? – Werner Dec 15 '14 at 18:53
  • I need to write some text and images over an image... I'm using this as the cover for a photo book. There is a photo covering the whole document (the cover), and then some text / pictures on specific places on top of it. So yes, I'm open to suggestions. But overpic seemed like a simple and nice solution, except for this small glitch... – jgbarah Dec 15 '14 at 19:20
4

This is easily achieved using eso-pic as an alternative:

enter image description here

\documentclass{article}
\usepackage{eso-pic,graphicx}
\usepackage[
  paperwidth=38.205cm,
  paperheight=19.367cm,
  margin=0cm]{geometry}

\setlength{\parindent}{0cm}
\pagestyle{empty}
\begin{document}

\AddToShipoutPictureBG*{%
  \AtPageLowerLeft{%
    \includegraphics[width=\textwidth,height=\textheight]{example-image-a}%
  }%
  \AtPageLowerLeft{%
    \hspace*{.55\textwidth}% 55% in from the left
    \raisebox{.1\textheight}{This is some text}% baseline will be 10% up from the bottom edge
  }
}

\mbox{}% Just to place something on the page.
\clearpage

\AddToShipoutPictureBG*{%
  \AtPageLowerLeft{%
    \includegraphics[width=\textwidth,height=\textheight]{example-image-b}%
  }
}

\mbox{}% Just to place something on the page.

\end{document}
  • Thanks a lot. It works like a charm. Just for completeness, I'm going to include the original code with your solution. – jgbarah Dec 15 '14 at 22:19
0

The answer by @Werner works great. Just to show some code that corresponds more exactly with the question:

\documentclass{article}
\usepackage{eso-pic,graphicx}
\usepackage[paperwidth=38.205cm, paperheight=19.367cm,
  margin=0cm]{geometry}

\setlength{\parindent}{0cm}
\pagestyle{empty}
\begin{document}

\AddToShipoutPictureBG*{%
  \AtPageLowerLeft{%
    \includegraphics[width=\textwidth,height=\textheight]{picture}%
  }%
  \AtPageLowerLeft{%
    \hspace*{.55\textwidth}% 55% in from the left
    \raisebox{.1\textheight}{This is some text}% baseline will be 10% up from the bottom edge
  }
}

\mbox{}% Just to place something on the page.
\newpage

\includegraphics[width=\textwidth, height=\textheight]{picture}

\end{document}

Now I get, as intended, two pages filled with the picture.

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.