阅读完以下答案后以 mm 表示的各种单位 (ex、em、in、pt、bp、dd、pc) 是什么?和一些相关问题,我意识到我对 Tex 的一个基本假设是错误的:我认为由于缩放点sp
是基本内部基本单位(约 5.36 nm),所以所有其他(绝对)单位都将以整数表示。这应该是下面顶级项目符号中的值,粗体值由源代码报告,如下所示1pt = \number\dimexpr 1pt\relax sp
:
1pt
=65536sp
(精确定义,2^16)1pc
=12pt
=786432sp
1bp
= 65781.76sp⇒65781sp
至65782sp
(72.27/72 = 803/800 pt/bp)- 来自 int
in
: 相同的 int 值 100bp = \number\dimexpr 100bp\relax sp
⇒6578176sp(不是 6578100sp!)
- 来自 int
1in
= 72.27pt = 4736286.72sp ⇒4736286sp
到4736287sp
- 从 int
bp
:72bp
=4736232sp
到4736304sp
100in = \number\dimexpr 100in\relax sp
⇒473628672sp(不是 473628600sp!)
- 从 int
好的,点和英寸的实现很准确,但是毫米和厘米呢?
1mm
= 186467.9811…sp⇒186467sp
到186468sp
- 来自
in
intpt
:相同的 int 值 - 从int
in
到bp
:186465sp
或186466sp
到186468sp
186469sp
1000mm = \number\dimexpr 1000mm\relax sp
⇒ 186467981sp2540mm = \number\dimexpr 2540mm\relax sp
⇒ 473628672sp(=100in
)
- 来自
1cm
= 1864679.811…sp⇒1864679sp
到1864680sp
- 来自
in
intpt
:相同的 int 值 - 从int
in
到bp
:186465sp
或186466sp
到186468sp
- 来自 int
mm
:10mm
=1864650sp
,1864660sp
,1864670sp
,1864680sp
或1864690sp
100cm = \number\dimexpr 100cm\relax sp
⇒ 186467981sp254cm = \number\dimexpr 254cm\relax sp
⇒ 473628672sp(=100in
)
- 来自
似乎有理由预期实际的内部定义实际上是1in
= 1cm
= 10mm
,但由于值在转换为 时会被截断sp
,因此当然会出现舍入误差,如上面链接的答案所示。
但是,Tex 中狄多点(和西塞罗点)的实际定义是什么?它试图近似哪个历史定义?我见过多次提到 1238/1157 pt/dd 或 1.07 pt/dd,但没有实际的权威参考。
1dd
=sp
或sp
(70124sp
)- ⅜ 月/日:
0.375mm
= - Tschichold 100/266 毫米/日:
0.37594mm
= - 迪多约:
0.37597mm
= - 伯特霍尔德:
0.376mm
= - 16/15 分/日:
69905sp
1.07pt
=
- ⅜ 月/日:
1cc
=12dd
= `` 或sp
(841489sp
, 不是841488sp
!)4.5mm
=- Tschichold 1200/266 mm/cc:约。
4.5112782mm
- 伯特霍尔德:
4.512mm
= - 192/15 点/件:
12.8pt
= 12.84pt
=
\noindent1pt = \number\dimexpr 1pt\relax sp
\noindent1pc = \number\dimexpr 1pc\relax sp
\noindent1bp = \number\dimexpr 1bp\relax sp
\noindent1in = \number\dimexpr 1in\relax sp
800bp = 803pt = \number\dimexpr 800bp\relax sp = \number\dimexpr 803pt\relax sp %= 52625408sp
\noindent1mm = \number\dimexpr 1mm\relax sp
\noindent1cm = \number\dimexpr 1cm\relax sp
2540mm = 254cm = 100in = 7200bp = 7227pt \hfill\break %= 473628672sp
= \number\dimexpr 2540mm\relax sp = \number\dimexpr 254cm\relax sp = \number\dimexpr 100in\relax sp = \number\dimexpr 7200bp\relax sp = \number\dimexpr 7227pt\relax sp
\noindent1dd = \number\dimexpr 1dd\relax sp %= 70124sp
1.07pt = \number\dimexpr 1.07pt\relax sp %= 70124sp
Berthold: \number\dimexpr 0.376mm\relax sp %= 70113sp
Didot approx.: \number\dimexpr 0.37597mm\relax sp %= 70107sp
Tschichold: \number\dimexpr 0.37593985mm\relax sp (100/266 mm/dd) %= 70101sp
3/8 mm/dd: \number\dimexpr 0.375mm\relax sp %= 69925sp
16/15 pt/dd: 69905sp
1238pt = 1157dd = \number\dimexpr 1238pt\relax sp = \number\dimexpr 1157dd\relax sp %= 81133568sp
\noindent1cc = 12dd = \number\dimexpr 1cc\relax sp = \number\dimexpr 12dd\relax sp %= 841489sp != 841488sp
12.84pt = \number\dimexpr 12.84pt\relax sp %= 841482sp != 841488sp
Berthold: \number\dimexpr 4.512mm\relax sp %= 841342sp != 841356sp
Tschichold: \number\dimexpr 4.5112782mm\relax sp (1200/266 mm/cc) %= 841208sp != 841212sp
4.5mm = \number\dimexpr 4.5mm\relax sp %= 839105sp != 839100sp
192/15 pt/pc: \number\dimexpr 12.8pt\relax sp %= 838861sp != 838860sp
1238pc = 1157cc = \number\dimexpr 1238pc\relax sp = \number\dimexpr 1157cc\relax sp %= 973602816sp
\vskip1em
10000pt = \number\dimexpr 10000pt\relax sp %= 655360000sp
10000bp = \number\dimexpr 10000bp\relax sp %= 657817600sp
10000dd = \number\dimexpr 10000dd\relax sp %= 701240864sp
\bye
答案1
哎哟,在我发布问题几分钟后,我想我自己找到了答案:
The next two parameters, |num| and |den|, are positive integers that define
the units of measurement; they are the numerator and denominator of a
fraction by which all dimensions in the \.{DVI} file could be
multiplied in order to get lengths in units of $10^{-7}$ meters. Since
$\rm 7227{pt} = 254{cm}$, and since \TeX\ works with scaled points
where there are $2^{16}$ sp in a point, \TeX\ sets
$|num|/|den|=(254\cdot10^5)/(7227\cdot2^{16})=25400000/473628672$.
@^sp@>
@ The necessary conversion factors can all be specified exactly as
fractions whose numerator and denominator sum to 32768 or less.
According to the definitions here, $\rm2660\,dd\approx1000.33297\,mm$;
this agrees well with the value $\rm1000.333\,mm$ cited by Bosshard
@^Bosshard, Hans Rudolf@> in {\sl Technische Grundlagen zur
Satzherstellung\/} (Bern, 1980). The Didot point has been newly
standardized in 1978; it's now exactly $\rm 1\,nd=0.375\,mm$.
Conversion uses the equation $0.375=21681/20320/72.27\cdot25.4$. The
new Cicero follows the new Didot point; $\rm 1\,nc=12\,nd$. These
would lead to the ratios $21681/20320$ and $65043/5080$, respectively.
The closest approximations supported by the algorithm would be
$11183/10481$ and $1370/107$. In order to maintain the relation $\rm
1\,nc=12\,nd$, we pick the ratio $685/642$ for $\rm nd$, however.
@d set_conversion_end(#)== denom:=#; end
@d set_conversion(#)==@+begin num:=#; set_conversion_end
@<Scan for \(a)all other units and adjust |cur_val| and |f|...@>=
if scan_keyword("in") then set_conversion(7227)(100)
@.in@>
else if scan_keyword("pc") then set_conversion(12)(1)
@.pc@>
else if scan_keyword("cm") then set_conversion(7227)(254)
@.cm@>
else if scan_keyword("mm") then set_conversion(7227)(2540)
@.mm@>
else if scan_keyword("bp") then set_conversion(7227)(7200)
@.bp@>
else if scan_keyword("dd") then set_conversion(1238)(1157)
@.dd@>
else if scan_keyword("cc") then set_conversion(14856)(1157)
@.cc@>
else if scan_keyword("nd") then set_conversion(685)(642)
@.nd@>
else if scan_keyword("nc") then set_conversion(1370)(107)
@.nc@>
else if scan_keyword("sp") then goto done
@.sp@>
因此 1238/1157 pt/dd 或 pc/cc 确实是精确的,并且 375 µm 的“公制狄多点”及其西塞罗实际上有两个单位:nd
和nc
:
1nd
= ⌊685/642 pt⌋ = 69925sp ≈ 0.375mm1nc
= ⌊1370/107 pt⌋ = 839105sp ≈ 4.5mm