Graphics, Figures & TablesInsert Matlab figure - Problems with epstopdf

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Bigbertho
Posts: 2
Joined: Mon Apr 04, 2011 11:36 am

Insert Matlab figure - Problems with epstopdf

Post by Bigbertho »

Hi there,
I'm writing my thesis and I have a problem on importing my matlab figures in latex.
I'm using TeXnicCenter on WinXp.
Googling, I found exportEpsPdf.m http://www.mathworks.com/matlabcentral/ ... ange/28275. This should allow me to easily export my matlab figures in eps format. It creates a *.tex file which works on the matlab figure substituting the text and other things.

On the other hand, in LaTex, I added the following packages:

Code: Select all

\usepackage{psfrag}
\usepackage{epstopdf}
in order to be able to manage eps files while using LaTex => PDF.

I already followed what is written here http://mactex-wiki.tug.org/wiki/index.p ... _inclusion, adding the option "--shell-escape" to LaTex => PDF. Now the options are: "--shell-escape -interaction=nonstopmode -max-print-line=120 "%pm" -synctex=-1 ".

The problem is that the compiler returnes this error:
"! Package pdftex.def Error: File 'Figure1.pdf' not found."

A suggestion I found in the Web is adding

Code: Select all

\epstopdfsetup{suffix=}
, but it just turned an old error into this one... :roll:


The problem is that I just need an easy way to copy my Matlab figures in LaTex. I used *.png files, but it's not so nice. I tried using eps, but enden up with this problem.

Thank you for helping me,
BigBertho

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Frits
Posts: 169
Joined: Wed Feb 02, 2011 6:02 pm

Insert Matlab figure - Problems with epstopdf

Post by Frits »

I export my MATLAB figures as .eps files and use just the epstopdf package in LaTeX:

Code: Select all

\documentclass{article}
\usepackage{graphicx}
\usepackage{epstopdf}

\begin{document}
\begin{figure}
	\centering
		\includegraphics[width=0.6\textwidth]{figurename.eps}
	\caption{Caption}
	\label{fig:figurename}
\end{figure}
\end{document}
This works fine, which make me wonder why you want to use something like exportEpsPdf.m and not just click Save As.. and save the figure in .eps format?
howtoTeX.com - Your LaTeX resource site (Tips, Tricks, Templates and more!)
Follow howtoTeX on twitter
zoparrat
Posts: 4
Joined: Fri Sep 24, 2010 3:43 pm

Insert Matlab figure - Problems with epstopdf

Post by zoparrat »

Another option is to use this wonderful Matlab function:
http://www.mathworks.com/matlabcentral/ ... -exportfig

With export_fig you can directly save your figures as pdf's and there are very neat options like cropping the borders, embedded fonts, bitmap or vector graphics options etc. This way you won't have to go the epstopdf route when using LaTeX => PDF
Post Reply