# How to get matlab plot in .eps format into the latex using epstopdf?

I want to enter my matlab plot into LaTeX. I am using the graphicx and epstopdf packages. But when I tried to make a pdf, the pdf was not created. It shows a blank page and the following warning:

Package epstopdf Warning: No graphics package graphic{s,x}' loaded.
)) ("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2016/07/10 v1.0t Standard LaTeX Graphics (DPC,SPQR)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)


How can I get rid of this problem?

• Please help us help you and add a minimal (non-)working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Dai Bowen Jun 8 '17 at 13:48
• Things to check: The order of loading the packages matter, do you load epstopdf before or after graphicx? Do you have these packages installed in your distribution? – Huang_d Jun 8 '17 at 13:51
• I am loading epstopdf before the graphicx package... Is that a problem? – kode master Jun 8 '17 at 13:53
• Thanks @Huang_d. I changed the loading order and have got rid of the warning. Could you please post it as an answer, so that I can accept it. – kode master Jun 8 '17 at 13:57
• As an aside, MATLAB will generate many different image types, so you could just create a .png or another extension that LaTeX will take naturally. – sk8forether Jun 8 '17 at 14:01

Some packages interact with each other and rely on a certain loading order. When you load them in the incorrect order, unexpected errors can occur. As a general rule, go from general package to specialised package; In your case, the epstopdf package should be loaded after the graphicx package. Another case where this matters is loading the tikz` library after initialising the package.