Exporting from MATLAB to PDF (via inkscape & pdflatex)

matthias on 2012/10/31

[Update: 2013-12-04: I was made aware that I forgot to add the source code for this, so I did. Sorry for that]

In the past, getting MATLAB plots into a pdf LaTeX Document was usually a pain for me without access to expensive software.

This morning I took another look at getting this to work with Inkscape and it seems that things have improved a lot from when I tried this the last time.

I was initially considering using psfrag. That would however require me to switch my toolchain from pdflatex to latex->dvips -> pstodpf. I’d like to avoid that because it would require me to then provide all my figures in .eps.

Therefore I took a look at the various options that Inkscape offers for exporting to pdf first.

I was already quite happy with these results from the simple drawing, but I experimented further with plots from MATLAB.

Here’s an old plot that I had saved and cropped with another tool and various export options in Inkscape.

The adjustments in Fig. 7 did not take very long and are fairly obvious (essentially there is a list of coordinates that I altered) as well as the content of boxes.

I was curious if anything changed with a file that I got directly out of MATLAB, and in fact things became even better.

So yeah, from what I see here, I have to applaud the inkscape developers and will definitely use this tool more.

A collection of methods that describe how to use psfrag with pdfdlatex exporting to eps and then place text with latex using placeholders.