关于绘制TikZ图的疑问
在这个示例代码中,作者做了以下
\draw ($(closedStart.south) + (-.5em,0)$)
edge[stateEdge] node[edgeLabel, xshift=-3em]{\emph{Passive open}}
($(listen.north) + (-.5em,0)$);
让我恼火的事情关于这些基于标记的绘图工具,最重要的是我必须测量一个值并指定。在这种情况下,作者指定了 .5em
我还不明白如何计算出来? .5em 多少钱?我什至不知道基础对象的大小,那么我如何确定如果我给出一个值它将是有效的?
有什么方法可以做到这一点吗?我应该如何确定值和单位? em 总是最好使用的单位吗?
In this sample code, the author does the following
\draw ($(closedStart.south) + (-.5em,0)$)
edge[stateEdge] node[edgeLabel, xshift=-3em]{\emph{Passive open}}
($(listen.north) + (-.5em,0)$);
What irritates me most about these markup based drawing tools is that I've to measure a value and specify. In this case, the author specifies .5em
I've yet not understood how to figure that out? How much is .5em? I don't even know the size of the base object, so how can I be sure that if I give a value it will be valid?
Is there any approach to do this? How should I decide the value and also the unit? Is em always the best unit to use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Google 是您的朋友:http://en.wikipedia.org/wiki/Em_%28typography %29
em 是排版领域的一种测量单位,等于当前字体的磅值。该单位不是根据任何特定字体定义的,因此对于给定磅值的所有字体都是相同的。因此,16 点字体中的 1 em 就是 16 点。
您可以将测量单位更改为乳胶支持的任何单位,我确信:英寸、毫米、厘米、磅、派卡等。
Google is your friend: http://en.wikipedia.org/wiki/Em_%28typography%29
An em is a unit of measurement in the field of typography, equal to the point size of the current font. This unit is not defined in terms of any specific typeface, and thus is the same for all fonts at a given point size. So, 1 em in a 16 point typeface is 16 points.
You can change the unit of measurement to anything supported by latex, i'm sure: in, mm, cm, pts, picas, etc etc.
不太确定 TikZ 如何处理它,但在 LaTeX 中,您可以将测量值指定为已知长度的分数(大于或小于 1),因此您可以将长度设置为 0.5\textwidth。我敢打赌 TikZ 具有这种功能,因此如果您要成为长期用户,您会想弄清楚它。
Not too sure how TikZ handles it but in LaTeX you can specify measurements as fractions (larger or smaller than 1) of known lengths, so you could set a length to be, say, 0.5\textwidth. My bet is that TikZ has this sort of facility so if you are going to be a long term user you'll want to figure it out.
扩展 Mica 的说法:
em
是测量字符间距的常用方法,历史上是给定字体中字符“M”的宽度(“M”通常是最宽的)拉丁字体中的字母):至关重要的是,它是一种相对度量,例如,下标字体的 em 比普通文本更小。现代字体通常具有比历史上更窄的“M”字符,并且有许多非拉丁字体,因此 em 度量现在源自字体设计者放置字符的正方形(或长方形)的尺寸,并进行交流作为参数,加上文本所在基线的高度等事实,可以告诉我们字体的比例。字体的磅值是
em
的点数(通常为 1/72 英寸),因此 12 磅字体的字符“M”宽度为 1/6 英寸(即 12/72 英寸)。 12 点字体的下标通常以 7 点字体显示,其 em 略低于 1/10 英寸。如果要在页面上进行定位,请使用点。如果您想控制文本中的间距,请使用 em,因为它们会缩放。
后记
修复了角色“M”的讨论,感谢 Mica。
To expand on what Mica says:
em
s are the usual way that intercharacter space is measured, and is historically was the width of a character "M" in a given font ("M" normally being the widest letter in Latin-based fonts): crucially, it is a relative measure, and subscript fonts, say, have a smaller em than normal text. Modern fonts generally have narrower "M" characters than historically, and there are many non-Latin fonts, so the em measure is now derived from the dimensions of the square (or oblong) that the font designer places the character in, and is communicated as a parameter, together with such facts as the height of the baseline that text sits on, that tells us the scale of the font.The point size of a font is the number of points (usually 1/72 inch) to an
em
, so a 12 point font is one whose character "M" is 1/6th of an inch wide (i.e., 12/72 in). The subscripts of a 12 point font are usually shown in a 7 point font, for which the em is just under 1/10th inch.If you want to do positioning on a page, use points. If you want to control spacing in text, use
em
s because they scale.Postscript
Fixed the discussion of the character `M', thanks to Mica.