我如何“假装” LaTeX 中的倾斜文本?
我使用的字体在 LaTeX 中没有倾斜/倾斜变体(注意:不是斜体),并且我希望在某些地方有倾斜的文本。
有没有一种简单的方法可以倾斜文本而无需生成全新的字体文件等?
一个建议的解决方案是:
\renewcommand{\textsl}[1]{\tikz[baseline=(X.base)] \node[xslant=0.2231153] (X) {#1};}
这对于一两个单词来说效果很好,但是 tikz 节点不会跨行,因此对于定理环境来说,它是不够的。
显然,快速而肮脏的方法不会提供特殊的字偶距或间距,但我并不担心这一点。然而,13 度的剪切/倾斜是理想的。
A font I am using does not have the slanted/oblique variant to it in LaTeX (NB: not italics), and I would like to have slanted text in places.
Is there an easy way to slant text without having to generate entirely new font files and such?
One suggested solution was to do:
\renewcommand{\textsl}[1]{\tikz[baseline=(X.base)] \node[xslant=0.2231153] (X) {#1};}
This works well for one or two words, but tikz nodes don't break across lines, so it's not adequate, for, say, a theorem environment.
Obviously, a quick-and-dirty method will not give exceptional kerning or spacing, but I am not concerned about that. However, a 13 degree shear/slant would be desirable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以在 XeLaTeX 中轻松完成此操作:
但是,如果有任何机会您可以获得
更新:为什么不受欢迎?因为字体轮廓不是设计来扭曲的!除了双向线性缩放之外的任何类型的变换都会改变字母的内/外曲线之间的关系,这实际上违背了字体设计者的意愿。
如果您想用与罗马字体不同的字体突出显示某些内容并且不使用斜体,请尝试完全不同的字体,例如协调无衬线字体。
You can do this easily in XeLaTeX:
Highly undesirable, however, if there's any chance you can get a real italic.
Update: why undesirable? Because font outlines are not designed to be distorted! Any sort of transformation besides linear scaling in both directions will change the relationship between the inner/outer curves of the letters, effectively going against the wishes of the font designer.
If you want to highlight something in a different font than the roman and not use italic, try something completely different like a harmonising sans serif, for example.
使用有斜体的字体。除非您从事营销工作,否则标准字体是最好的。
Use a font that does have italics. Standard fonts are best unless you're in marketing.
我使用 LuaLaTeX,但以下内容也应该适用于 XeLaTeX。根据我的经验,LuaLaTeX 与旧的 LaTeX 完全向后兼容,而且只是稍微慢了一点。制作新的、聪明的宏是轻而易举的事。无论如何,劝说已经足够了。
这几乎是直接从我的一份文档中提取的。是的,其中有些是黑客式的,但它很好地满足了我的需求——而且结果也相当可观。
I use LuaLaTeX, but the following should also work with XeLaTeX. LuaLaTeX, from my experience, is fully backward compatible with good old LaTeX, and it's only marginally slower. And making new, clever macros is a breeze. Anyhow, enough proselytizing.
This is pulled almost directly from one of my documents. Some of it is hackish, yes, but it suits my needs well - and the results are quite respectable.
这里有一些用于剪切的宏,但我想这也不是您想要的。
Here are some macros for shearing, but that will not be what you want either, I guess.
上面提到的 XeLaTeX/fontspec 答案不知何故对我不起作用,所以我想出了这个:
The XeLaTeX/fontspec answer mentioned above somehow wouldn't work for me, so I came up with this: