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.

I would like to change my figure's width to a precentage of my \textwidth:

\textwidth /2 would scale to 50% of the \textwidth.

What is the proper syntax (if any) to do this ?

share|improve this question

1 Answer 1

up vote 31 down vote accepted
 \documentclass{article}
 \usepackage{graphicx}
 \begin{document}
   \includegraphics[width=0.5\textwidth]{file}
 \end{document}

In some cases \linewidth instead of \textwidth may be the better option. For example will it be the same as \textwidth in a single column document, but the same as \columnwidth in a two column document. \linewidth may also change in list environments, becoming smaller in nested lists.

As commented by Christian Lindig, see Difference between \textwidth, \linewidth and \hsize for a discussion of this.

share|improve this answer
3  
See also the difference between \textwidth, \linewidth and \hsize. For these reasons you should use \linewidth because it works inside columns and minipages. –  Christian Lindig Dec 10 '11 at 12:00
1  
If used as-is, just remove the paragraph indentation to avoid a \parindent horizontal shift. I wouldn't change your MWE though, since the OP's usage may not require it (for example, within a figure environment). –  Werner Dec 10 '11 at 15:34

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.