如何在 Matlab 图形中使用非 ASCII 字符(用于 LaTeX 文档)? [英] How to use non-ASCII characters in Matlab figures (for use in LaTeX doc)?

查看:22
本文介绍了如何在 Matlab 图形中使用非 ASCII 字符(用于 LaTeX 文档)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用将 Matlab 绘制的图形包含到 LaTeX 中.我通常的工作流程如下:

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

  1. matlab 中的脚本创建图形,
  2. 我调整了我认为需要在可视化图形编辑器中调整的内容,
  3. 图保存为 .fig(用于将来修改)和 .eps(用于包含在 LaTeX 中),
  4. 我将 .eps 文件转换为 .pdf,
  5. 在 LaTeX 源代码中引用了 PDF 文件.

<小时>

重点:当我尝试在轴标签、图例、标题等中使用非 ASCII 字符时,(准确地说:波兰国家字符,例如 'ą'、'ę'、'ś'、'ć') 在 Matlab 图形编辑器中编码很好并且字符显示正确.导出到 .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.

附注.Matlab 是R2008a,.latex 文件用pdflatex 编译,.eps 文件用MikTeX 2.9 的epstopdf 编译(均在Win7 下).

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

推荐答案

你可以看看 psfrag,这是我在 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 脚本来简化这个:LaPrint.

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

这篇关于如何在 Matlab 图形中使用非 ASCII 字符(用于 LaTeX 文档)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆