2

I know there are many threads related to this topic, but I still could not find a satisfying solution.

Summary Matlab 2014b figures -> export as .eps or .svg -> load into Inkscape (problem is in here: text is not recognized) -> use Inkscpe to save as .pdf_tex -> use in scrreprt document (pdfTeX)


The goal: I want to use different Matlab 2014b plots in a scientific paper. Within those plot I want to use the same LaTeX font as it is used in my scrreprt document.

The problem: When I export or print the Matlab figures as .eps or .svg (possible in 2014b) it is not possible to use the document font (type and size) or access the text (labels, axisticks) Inkscape.

What I've done so far: I used matlab2tikz. This lets me access the plot with the "correct" font. But it does not create the results I want to have. This thread mentions a related problem.

I greated some figures in Inkscape (.svg) and used the export method which provides .pdf_tex files. Then I used \input to include them into the to the document. This works very well ("correct font and nice quality"), so I want to use this method, but in the first place I need to print/export the figures in a way that lets Inkscape read the text as text and notas pixels in a picture.

What is definitely not desired Setting the Matlab figure 'Interpreter' to 'Latex' looks nice in the figure, but is useless when including it into a latex document

I appreciate any help. Thanks in advance.

Edit: Due to a comment, I also posted the question here.

  • 2
    Have you considered exporting only the data (.csv or something), read this data with tikz and create a nice plot from within latex (tikz)? – Steffen Feb 27 '15 at 8:33
  • I've done some pretty complicated pictures with matlab2tikz. What's the problem in your case? – Habi Feb 27 '15 at 8:36
  • Thanks for your quick replies. The problem is, that I always have to tweak the beginning of the x-axis, because the plotted line is different in tikz. Another problem is, that tikz always draws the box around the legend, what has to be removed manually. @Steffen I did not consider yet. But since I need many figures, I am scared of doing it manually, plus I am really new to tikz – Das Muratorium Feb 27 '15 at 9:03
  • 2
    pgfplots can have global settings that can be set once and you would have them applied to all plots in your document. See Section 4.3.7 Importing graphics in the pgfplots document. – percusse Feb 27 '15 at 9:13
  • The problem of Inkscape not recognizing the text in a Matlab-generated file is, I fear, completely off-topic for this site. – Torbjørn T. Feb 27 '15 at 9:15
2

If anybody in the future encounters the same problem, please read this:

After a lot of trial, I came to the conclusion, that it is probably the best to use matlab2tikz or pgfplots.

The link that @Dolphin posted in his comment leads to a handy extension of Inkscape, which fulfills its purpose. All the text in the Matlab figures got recognized. The problem is the export from Inkscape later on. You could use .eps or even the .pdf export, which works as in this video. The problem is, that you have to adjust all the axess ticks, labels and legend entries manually. This is OK for figures with less text, but inappropriate for scientific figures with lots of data (numbers and legends).

P.S.: I don't know how to close the thread, since I created it with a guest account (Now I am writing form my own Stack Exchange account, which has the same Name.). If any Admin reads this, you may want to mark this answer as accepted.

  • 1
    You can ask an administrator to merge your two accounts ... – Kurt Feb 27 '15 at 15:31
  • You'll need to contact the Staff Exchange staff to merge your accounts: see the Contact page. – Joseph Wright Feb 27 '15 at 16:41
0

Another much easier solution is: don't use LaTeX in Matlab 2014b to label your axis. For example, you cannot have any thing like x_1^*. If you use only plain text in Matlab, then when you save the file to SVG, the text will be kept. You can then edit the .pdf_tex file generated by Inkscape to show the correct label. This is of course due to the bug of the figure-to-svg engine in Matlab 2014b. It simply cannot recognize LaTeX as text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.