In my tex project I use an ./images/xxx/ directory to save stuff generated by matlab2tikz. Sometimes matlab2tikz generates png's. When I try to "\include" the tikz file it fails to import those for an obvious reason - the tikz file contains the paths to png's relative to itself, not to the main tex file.

Is there a standard way to handle such situation (e.g. supply a path prefix to matlab2tikz as an option). Please do not advice postprocessing the tikz file, I'm looking either for built in functionality, or a tex idiom to handle this.

1 Answer 1


There are a few options:

  • You can use the option relativeDataPath for matlab2tikz to set the prefix that is put in the files. This is documented both on the Wiki and in the help of matlab2tikz.
  • You can set the \graphicspath in your LaTeX file to include all folders where the PNG files may reside. More info in the graphics package.
  • @HennadiiMadan Don't worry. It has given me the incentive to write a bit better documentation for those parameters.
    – Egon
    Feb 16, 2016 at 20:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .