How to avoid large margins around Matlab plot in PDF
This is partially off-topic, since LaTeX doesn't have anything to do with how the PDF is generated. Nonetheless, it's relevant enough for my tastes.
In Matlab, you can create a cropped PDF by setting the papersize to the same size as the graphic; see this small figuresize.m
function to do this automatically.
Usually if you're generating graphics from Matlab, though, I'd recommend using matlabfrag so that your figure labels are typeset by LaTeX. You can use psfrag-based graphics in pdfLaTeX by using the pstool
package.
Finally, if you just want to crop a graphic, TeX Live and MiKTeX both come with a command line tool pdfcrop
to perform this on an arbitrary PDF.
pdfcrop should help remove the margins. I use it like so:
pdfcrop -margins 10 fig.pdf fig.pdf
how about trimming the image by using the options of the \includegraphics
command?
here is an example \includegraphics[trim = 35mm 95mm 40mm 100mm, clip,
width=0.475\textwidth]