mathematica 8.0 和 psfrag
我最近从 mathematica 7.0 更新到 8.0,现在在使用 psfrag 包用 LaTeX 代码替换绘图标签时遇到了问题。一切都与早期版本完美配合,并且情节完全相同,但现在 psfrag 保留所有标签不变。我在 Ubuntu 11.04 上使用 Kile 进行 LaTeX 编辑。
例如,在 Mathematica 中:
plot = Plot[x, {x, -0.1, 0.1},
AxesLabel -> {eps, SUM}, BaseStyle -> {FontSize -> 10}]
Export["plot.eps", plot]
然后在 LaTeX 中:
\begin{figure}
\psfrag{eps}{$\epsilon$}
\psfrag{SUM}{$\Sigma$}
\includegraphics{plot.eps}
\end{figure}
现在应该用 LaTeX 排版替换标签,但没有任何反应。有什么建议如何解决这个问题吗?有谁知道 Mathematica 8 在 eps 文件中编码文本的方式与早期版本相比是否有区别?
I recently updated from mathematica 7.0 to 8.0, and have now encountered problem with replacing my plot labels with LaTeX code using the psfrag package. Everything worked perfectly with the earlier version and the exact same plots, but now psfrag leaves all the labels unchanged. I use Kile on Ubuntu 11.04 for LaTeX editing.
For example, in Mathematica:
plot = Plot[x, {x, -0.1, 0.1},
AxesLabel -> {eps, SUM}, BaseStyle -> {FontSize -> 10}]
Export["plot.eps", plot]
and then in LaTeX:
\begin{figure}
\psfrag{eps}{$\epsilon$}
\psfrag{SUM}{$\Sigma$}
\includegraphics{plot.eps}
\end{figure}
This should now replace labels with LaTeX typesetting, but nothing happens. Any suggestions how to solve this? Does anyone know if there is a difference in how Mathematica 8 encodes text in eps files compared to earlier versions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
EPS 的编码方式没有区别。问题是在 v7 输出中生成文本的 PS 代码(请注意,Mma 使用
bind def
为大量 PS 代码创建快捷方式,详细信息请参阅生成的 EPS 文件的顶部) :在 v8 中已被替换为
这意味着
psfrag
无法抓住标签。我在 Mma 导出选项中找不到如何解决此问题。
目前,我能想到的唯一解决方法(并且我已经测试过有效)是使用单字母标签作为轴标签,例如
注意:
可能想要使用 psfrag 的原因> 在 http://www.reimeika.ca/marco/prettyplots/ 中有很好的说明
附录:
psfrag
包仅适用于EPS
图形,因此仅适用于latex
。如果您想使用
psfrag
和pdflatex
,请参阅 tex.SE 问题将 psfrag 与 pdflatex 结合使用
There's no difference in how the EPS is encoded. The problem is that the PS code that makes the text in the v7 output (note that Mma uses
bind def
to create shortcuts for a lot of PS code, see the top of the generated EPS files for details):has been replaced in v8 with
This means that
psfrag
can not grab hold of the tags.I can't find how to fix this in the Mma export options.
At the moment, the only work-around I can think of (and I've tested that works) is to use single letter tags for the axes labels, e.g.
Note:
The reasons for maybe wanting to use
psfrag
are well stated in http://www.reimeika.ca/marco/prettyplots/Addendum:
The package
psfrag
only works withEPS
graphics and thus only withlatex
.If you want to use
psfrag
andpdflatex
, then see the tex.SE questionUsing psfrag with pdflatex
尝试了 7.0.1 和 8.0.1,对我来说效果很好。因此,我无法重现您的错误。 (也许只是拼写错误、区分大小写等)。无论如何,我同意 LateX 修改对于出版物来说几乎是必须的。首先,我也使用 PSFrag,但很多时候我也不喜欢标签的定位,特别是当您放置更复杂的表达式时。因此,我建议通过 PSTricks 进行中间步骤。看起来像这样:
因此,您必须手动完成一些工作,但通常值得花时间,因为结果看起来确实更好,特别是如果要发布的话。但是,请记住,在标准设置中,LaTeX 使用计算机现代字体作为公式。这与典型的文本选择(例如 Times New Roman)不同。您可以使用 mathptmx 包更改此设置。
Tried both 7.0.1 and 8.0.1 and worked well for me. Hence, I cannot reproduce your error. (Maybe just a typo, case sensitivity etc.). Anyway, I agree that LateX modification is almost obligatory for publications. First I also used PSFrag, but very often I also don't like the positioning of the labels, especially if you place more complex expressions. Therefore I suggest an intermediate step via PSTricks. This looks something like this:
So there is some work you have to do by hand, but usually it is worth the time as the result really looks better, especially if it is for publication. However, keep in mind that in standard settings LaTeX uses the Computer Modern Font for formulae. This is not identical with e.g. Times New Roman, the typical choice for text. You can change this with the mathptmx package.
您可以直接在 Mathematica 中编写“排版”表单,然后它将已经存在于 .eps 文件中,您可以按原样包含 .eps。
绘图 = 绘图[x, {x, -0.1, 0.1}, AxesLabel -> {"[\eps], [\Sigma]}, BaseStyle -> {FontSize -> 10}]
只要执行 [esc]+"eps"+[esc] 你就会得到一个 epsilon,或者从西格玛的工具箱也是如此。
You can write the "typeset" form in Mathematica directly, then it'll be already in the .eps file and you can just include the .eps as is.
plot = Plot[x, {x, -0.1, 0.1}, AxesLabel -> {"[\eps], [\Sigma]}, BaseStyle -> {FontSize -> 10}]
Just do [esc]+"eps"+[esc] and you'll get an epsilon, or insert it from the toolbox. Same for the sigma.