2

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?

  • 5
    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 08 '17 at 13:48
  • 1
    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 08 '17 at 13:51
  • I am loading epstopdf before the graphicx package... Is that a problem? – kode master Jun 08 '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 08 '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 08 '17 at 14:01
  • @sk8forether .eps allows for rescaling (encapsulated postscript, I think it is a vector format). With pixel-based images you always have the problem of rasterisation and it is best to avoid rasterised images in documents to be printed (or scaled, for that matter). – Huang_d Jun 08 '17 at 14:04
  • @sk8forether --- png isn't a good format for plots or diagrams (it's a bitmap format; vector formats such as eps or pdf produce better results). – Ian Thompson Jun 08 '17 at 14:05
  • Yes, eps is a vector format according to this post, which is probably a good reference for this discussion. I was simply explaining another option as an aside, since there are many cases where an image will render "well enough" in png or some other format. It depends on what you are trying to display, and personal preferences. – sk8forether Jun 08 '17 at 14:12
  • @sk8forether Please see https://tex.meta.stackexchange.com/q/7307/2693 on your edit to the answer. (For future reference.) – Alan Munn Jun 08 '17 at 21:18
  • @AlanMunn Interesting... I was unaware of those spelling differences. – sk8forether Jun 09 '17 at 06:26

1 Answers1

2

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.

cfr
  • 198,882
Huang_d
  • 1,797