[Tex/LaTex] How to set the width of a landscape figure to the textwidth

floatslandscape

I would like to have a figure in landscape format to fill the whole page, i.e. I would like the width to be the textheight of a portrait page or the textwidth of a landscape page, respectively.

Here is an example of my code:

\documentclass[a5paper, 11pt]{scrbook}

\usepackage{graphicx}
\usepackage{color}
\usepackage{pdflscape}    

\begin{document}    
\begin{landscape}
 \begin{figure}
 \centering
 \def\svgwidth{\textwidth}
 \input{figure.pdf_tex}
 \caption{Example Figure}
 \end{figure}
\end{landscape}    
\end{document}

When running this through pdfLaTeX I get a landscape figure that is as wide as the textwidth of a portrait page.

Using

\def\svgwidth{\textheight}

does not change the output.

How can I get the figure to fill the whole page?


I cannot include figure.pdf since this format is not allowed to upload, but you can find figure.png further down.

The following is the code content of figure.pdf_tex:

\begingroup% 
 \makeatletter%
 \providecommand\color[2][]{%
 \errmessage{(Inkscape) Color is used for the text in Inkscape, but the 
package 'color.sty' is not loaded}%
        \renewcommand\color[2][]{}%
 }%
 \providecommand\transparent[1]{%
 \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
   \renewcommand\transparent[1]{}% 
 }%
 \providecommand\rotatebox[2]{#2}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{782.075bp}%
 \ifx\svgscale\undefined%
  \relax%
 \else%
  \setlength{\unitlength}{\unitlength * \real{\svgscale}}%
 \fi%
 \else%
\setlength{\unitlength}{\svgwidth}%
 \fi%
 \global\let\svgwidth\undefined%
 \global\let\svgscale\undefined%
 \makeatother%
 \begin{picture}(1,0.48489595)%
  \put(0,0){\includegraphics[width=\unitlength]{figure.pdf}}%
  \put(0.21413974,0.24055332){\color[rgb]{0,0,0}\makebox(0,0)
[lb]{\smash{Text}}}%
\end{picture}%
\endgroup%

figure

Best Answer

Try \linewidth. It works for me with \resizebox.

Related Question