Matlab – How to use non-ASCII characters in Matlab figures (for use in LaTeX doc)


I am using including Matlab-drawn figures into LaTeX. My usual workflow is as following:

  1. Script in matlab creates figure(s),
  2. I tweak what I find needs to be tweaked in visual figure editor,
  3. Figure is saved as .fig (for future modification) and .eps (for including in LaTeX),
  4. I convert .eps files to .pdf,
  5. PDF files are referenced in LaTeX source code.

To the point: when I try to use in axis labels, legend, titles, etc. non-ASCII chars, (to be exact: Polish national chars e.g. 'ą', 'ę', 'ś', 'ć') encoding in Matlab figure editor is fine and characters display properly. After exporting to .eps, they are all wrong (example: "Głębokość" turns into "G³êbokoœæ").

Does there exist a way to do this properly, either by tuning Matlab options or changing my workflow?

Note: I found that export to .png or other non-vector formats handles character encoding properly, but I would like to avoid having to do that — I'm asking for a way to "keep it vector". Export directly to .pdf produces the same effect as .eps, e.g. it is producing wrong results.

PS. Matlab is R2008a, .latex files are compiled with pdflatex, .eps files with epstopdf from MikTeX 2.9 (all under Win7).

Best Solution

You could have a look at psfrag, that's what I usually use when I try to use Matlab figures in LaTeX. You basically put just tags into the figure in Matlab and replace those tags with LaTeX text afterwards. The biggest benefit is that this allows you to have identical symbols in text and figures.

Edit: when looking for the psfrag-URL, I found a Matlab script to simplify this: LaPrint.

Related Question