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'm new to LaTeX and although my supervisor does not use LaTeX, I've decided to do my master thesis in LaTeX.

However, I'm having a problem with the images. I have big images generated through R. They have some white space around but I manually removed the white space. Nevertheless, I've tried a lot of different examples found in the Internet and none resolve the issue. To better understand the problem, I attach a print screen of the image in the middle of the page. enter image description here

The image is quite large itself but I think that if I was able to put max width of the page, one will be able to see the picture. Here is the picture alone enter image description here

The code used is the following:

\begin{figure}
    \centering
\includegraphics[max size={\textwidth}{\textheigth}]{../Files/PMM/densityplotVac.png}
%\includegraphics[width=1.2 \textwidth ,keepaspectratio]{../Files/PMM/densityplotVac.png}       
\end{figure}        

If any one was any pointer, I would be very grateful. Thank you very much

share|improve this question
2  
+1 for although my supervisor does not use LaTeX, I've decided to do my master thesis in LaTeX –  Harish Kumar Jun 15 at 12:44

2 Answers 2

up vote 3 down vote accepted

You can use the float-package for positioning the image.

\documentclass{article}

\usepackage{graphicx}
\usepackage{float}
\usepackage{blindtext}

\begin{document}

\blindtext

\begin{figure}[H]
 \includegraphics[width=\textwidth]{image.png}
 \caption{Kernel density estimates ...}
\end{figure}

\blindtext

\end{document}

share|improve this answer
    
Thank you! It worked! It seems so simple and I wasn't able to figure it out. Before the [H] I had [h!]. So the main issue was the lack of the package float? –  pavid Jun 15 at 10:57

Try setting the width of the image to the \textwidth, which is the width of the area with text in it:

\begin{figure}
  \centering
  \includegraphics[width=\textwidth]{../Files/PMM/densityplotVac.png}       
\end{figure}

The trick is in setting the actual width of the image rather than the maximum size.

share|improve this answer
    
Thank you! It worked! I also added the package float like suggested in the other comment –  pavid Jun 15 at 10:58

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.