Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to use the width of the paper as a variable in order to set the width of an imported graphics? For instance when I want the picture size to be the width of the paper, minus 3 centimeters, or half of the paper's width etc.

share|improve this question
2  
Yes, there is, and you're probably referring to the width of the text block, not the paper width. Using the calc package, you can do all kinds of length calculations. I think the following is a duplicate: Scale image to page width? Does it help? Using the graphicx package (and calc), you can use \includegraphics[width=\textwidth-3cm]{image} or \includegraphics[width=.5\textwidth]{image}. –  Werner Feb 2 '12 at 19:54
    
That works. Thanks! –  Rob Feb 2 '12 at 20:13
add comment

1 Answer

The answer is simply to use \textwidth and do whatever you want with it. Of course by width of paper you mean the text block width, not the paper itself, in that case you use \paperwidth.

\includegraphics[width=\textwidth-5cm]{./Images/MyImage}
\includegraphics[width=\paperwidth]{./Images/MyImage}
\includegraphics[width=2\textheight]{./Images/MyImage}
\includegraphics[height=\marginparwidth]{./Images/MyImage}

you could use pt or inch or em ...etc, instead of cm.

Refer to http://en.wikibooks.org/wiki/LaTeX/Page_Layout#Page_dimensions for useful page dimensions commands.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.