0

How can I insert an image to cover the entire text space of a page, maintaining borders and everything? I don't want a background for the page, but just an image with its caption to cover the entire space available as texts would do.

I tried in this way. I want a landscape page and I use \usepackage{pdflscape}

\begin{landscape}
    \begin{figure}[H] \centering
        \includegraphics[width=1.5\textwidth, keepaspectratio]{"figure/estrack map_blue"}
        \caption[ESTRACK Antenna Position]{ESTRACK Antenna Position}
    \end{figure}
\end{landscape}
  • you want width=\linewidth I assume (but you do not say) that landscape is defined by the lscape package in which case \textwidth is the width pf the portrait page, – David Carlisle Jun 28 '18 at 10:22
  • What do you men by 'maintaining borders' ? Dou you want to fill the entire textarea or the whole page including margins ? And do you have some other text on the page. The solution, likely based on pgf/tikz could depend on the aspectratio of the image. You could have a look to my answer to tex.stackexchange.com/questions/423371, width handle the aspect ratio to maximize the image size when keeping the margins unchanged. – Jhor Jun 28 '18 at 10:24
  • Texts never cover "the entire space". Your task is difficult, b/c you have a float with a caption. So at least the size/height of the caption determines how high your image must be. In general you can use the lenghts\textheight \pageheight and \paperheight and put them as parameter height=\myLength with your \includegraphics. Each of these lengths means something different and none solves your problem of possible float margins and caption height. Also I think \paperheight is provided by some package and is not available by default. – Bananguin Jun 28 '18 at 10:36
  • Related: Vertically fit a figure with caption to page – leandriis Jun 28 '18 at 11:11
  • I tried using width=\textwidth but does not give me the correct result. I use pdflscape instead of lscape to have the same result when I print the document and at the same time also having a landscape visual of the pdf, avoiding to rotate the entire pdf when you want to read the paper. @Jhor: Yes I want to fill the entire text area in order to maintain the rest of the page as the other ones, with margins, page numbers and so on. Basically maintaining header and footer unchanged. I did the same thing with a table and I have the correct result, but with an image I don't like what I see – Shika93 Jun 28 '18 at 11:16
1

I have a solution which produces the following page:

enter image description here using a \savebox, a minipage and a simple (e-tex) length calculation. It works with both lscape and pdflscape because these are essentially the same. But the comment are not clear enough to ensure that this matches the desired output.

Here is a MWE, assuming that the image has itself a landscape aspect-ratio (which make sense for preferring the landscape mode):

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{duckuments}
\usepackage{pdflscape}
\pagestyle{headings}
\begin{document}
\newsavebox{\capt}
\savebox{\capt}{\parbox{0.9\textheight}{\bigskip\lipsum[4-5]}}
\newlength{\hcapt}\newlength{\himg}%
\settoheight{\hcapt}{\usebox{\capt}}%

\section{A section}
\lipsum[1-3]
\begin{landscape}
\centering%
\setlength{\himg}{\dimexpr 0.9\textheight-\hcapt\relax}%
\noindent\begin{minipage}{0.9\columnwidth}\centering%
\includegraphics[height=0.9\himg]{example-image-duck}
\usebox{\capt}
\end{minipage}%
\end{landscape}

\lipsum[6-7]
\end{document}

The caption is here a pure text block in savebox, but could be inserted as a \captionof{figure} of non floating image if we can access somehow the format options of the captions.

The hard-job could easily be recast in a simple macro or environment, but as I'm not sure to provide the expected result...

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.