问题描述
我使用包括Matlab绘制的图形到LaTeX。我的常用工作流程如下:
I am using including Matlab-drawn figures into LaTeX. My usual workflow is as following:
- matlab中的脚本创建图形,
- 调整我发现需要在视觉效果图编辑器中调整,
- 图保存为.fig(供以后修改)和.eps(包括在LaTeX中),
- 我将.eps文件转换为.pdf,
- 在LaTeX源代码中引用了PDF文件。
- Script in matlab creates figure(s),
- I tweak what I find needs to be tweaked in visual figure editor,
- Figure is saved as .fig (for future modification) and .eps (for including in LaTeX),
- I convert .eps files to .pdf,
- PDF files are referenced in LaTeX source code.
说明:当我尝试在轴标签,图例,标题等中使用非ASCII字符时, chars如'ą','ę','ś','ć')编码是很好的,字符显示正确。导出到.eps后,他们都错了(例如:Głębokość变成了G³êbokoœæ)。
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œæ").
有没有一种方法做到这一点正确,调整Matlab选项或更改我的工作流?
Does there exist a way to do this properly, either by tuning Matlab options or changing my workflow?
注意:我发现导出到.png或其他非向量格式会正确处理字符编码,但我想避免做 - 我要求一种方法来保持它的向量。直接导出到.pdf产生的效果与.eps相同。它会产生错误的结果。
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是R2008a,.latex文件是用pdflatex,.eps文件和从MikTeX 2.9(全部在Win7下)的epstopdf编译。
PS. Matlab is R2008a, .latex files are compiled with pdflatex, .eps files with epstopdf from MikTeX 2.9 (all under Win7).
推荐答案
您可以查看,这是我通常使用的时候尝试在LaTeX中使用Matlab数字。你基本上只是把标签放在Matlab的图中,然后用LaTeX文本替换这些标签。最大的好处是,这允许你在文本和图形中有相同的符号。
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.
编辑:在寻找psfrag-URL时,我发现了一个Matlab脚本, :
。
when looking for the psfrag-URL, I found a Matlab script to simplify this:LaPrint.
这篇关于如何在Matlab图中使用非ASCII字符(用于LaTeX doc)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!