是否可以控制 Mathematica 中的数字样式?
我在书中使用 Constantia 字体(Windows 7 附带),并希望在 Mathematica 中使用相同的字体为本书准备图形。问题是 Constantia 默认输出旧式数字。我知道,例如在 XeTeX 中,可以控制是否使用旧式数字或普通数字进行输出。
是否可以控制 Mathematica 中的数字样式?
I use the Constantia font (that came with Windows 7) for my book and would like to prepare graphics for this book using the same font in Mathematica. Problem is that that Constantia by default outputs oldstyle digits. I know that, e.g. in XeTeX, it is possible to control whether oldstyle or normal digits are used for output.
Is it possible to control style of digits in Mathematica?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我觉得这个还是比较难的。 Constantia 可直接在 Mathematica 中使用:
但是,该字体是专门设计用于以这种方式平衡的。如果您使用
FontSize
和AdjustmentBox
调整字母的大小和位置,您会得到:您会看到移动和缩放的字母具有不同的字重。字体粗细可以调整,但只能非常粗略地调整。通常只有普通和粗体样式。所以你可以像这样接近:
稍微好一些,但仍然丑陋。我认为要实现这一点,必须对字母进行全新设计。也许可以在字体表中更远的地方找到普通字母?
更新
找到替代号码集。它们位于字体表中的位置 8320 - 8329。您应该能够使用字体实用程序来切换它们。
I think this is rather difficult. Constantia is directly usable in Mathematica:
However, the font is specifically designed to be balanced this way. If you tweak sizes and positions of the letters using
FontSize
andAdjustmentBox
you get this:You see the shifted and scaled letters have a different body weight. Font weight can be adjusted, but only very roughly. Usually you only have Plain and Bold styles. So you can get as close as this:
Somewhat better, but still ugly. I assume a complete new design of the letters is necessary for this to work. Perhaps the normal letters can be found somewhere further on in the font table?
UPDATE
Found the alternative number set. They are at positions 8320 - 8329 in the font table. You should be able to switch them using a font utility.
对于蜱虫,有一个解决方法,但需要一些编程。
首先,有一个辅助功能。
然后,像这样的函数:
产生以下结果:

然后可以在
FrameTicks
或Ticks选项。当然,这确实意味着指定您的刻度,而不是让 Mathematica 自动计算出它们的值。它还意味着采用默认的刻度长度,除非您希望使用另一个参数来指定
ConstantiaTicks
。For ticks, there is a workaround, but it requires a bit of programming.
First, there is an auxiliary function.
Then, a function like this:
Yields the following result:

This can then be used in a
FrameTicks
orTicks
option. Of course it does mean specifying your ticks rather than letting Mathematica work out their values automatically. It also means taking the default tick length unless you want to have another argument toConstantiaTicks
that specifies that.我会抓住 FontForge。较新的版本(我似乎记得)有一个隐藏得很深的菜单选项来应用映射并将其展平到字体中,因此您可以选择
lnum
(大写数字)并轻松输出 Constantia 的版本用衬里替换 Mathematica 之外已经制作的旧式数字。或者,在 Font-forge 中,技术含量稍低一些,您可以将衬里或表格数字复制并粘贴到小写数字的顶部。Font-forge 看起来不太漂亮,但不要太在意,因为它实际上非常好,并且对于调整字体非常方便。
作为替代解决方案,您是否考虑过将 Mathematica 中的数据导出到平面文件并使用 TikZ 在 XeTeX 中本地渲染?这是我经常使用的方法,而且输出确实非常好。
I'd grab FontForge. Newer versions (I seem to remember) have a deeply hidden menu option to apply a mapping and flatten it into the font, so you can select
lnum
(upper case numerals) and easily output a version of Constantia with the substitution of lining for old-style numerals already made, outside Mathematica. Alternatively, a bit less high-tech, in Font-forge you can just copy and paste in the lining or tabular numerals on top of the lower-case ones.Font-forge doesn't look pretty, but cut it some slack, because it's actually very good and is highly handy for tweaking fonts around.
As an alternative solution, have you thought of exporting the data in Mathematica to a flat file and rendering it natively in your XeTeX with TikZ? That's the approach I usually use, and the output is indeed excellent.