4

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

1
  • 2
    +1 for although my supervisor does not use LaTeX, I've decided to do my master thesis in LaTeX
    – user11232
    Jun 15, 2014 at 12:44

2 Answers 2

3

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}

1
  • 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?
    – psoares
    Jun 15, 2014 at 10:57
2

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.

1
  • Thank you! It worked! I also added the package float like suggested in the other comment
    – psoares
    Jun 15, 2014 at 10:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .