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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I insert figures into my tex,sometimes it goes out of the page. Can you please suggest a method to avoid this.

share|improve this question

adjustbox is your friend. Load adjustbox with export option:


And add max width=\linewidth in the options of \includegraphics. The images will be scaled only if they are broader than the \textwidth/\linewidth (as the case may be)

\usepackage{showframe}   %% just for demo
\includegraphics[width=2\textwidth,,max width=\linewidth]{example-image-a}

\includegraphics[width=0.5\textwidth,,max width=\linewidth]{example-image-a}

enter image description here

You can make a macro if you like:

  \oldincludegraphics[#1,max width=\linewidth]{#2}}

Now you can use


as usual.

share|improve this answer

Your Answer


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.