有人可以向我解释为什么在.po
(“页面偏移量”)请求中嵌入文字值(例如“ 1c”)有效,但是引用数字寄存器却无效吗?
.\" Set the dimensions of an A4 page.
.nr a4_width 21c
.nr a4_height 29.7c
.nr a4_margin_horizontal 1c
.nr a4_margin_vertical 1c
.nr a4_content (\n[a4_width] - (\n[a4_margin_horizontal] * 2))
.
.\" Page-offset and line-length
.po \n[a4_margin_horizontal]
.ll \n[a4_content]
.\" Uncomment the below two lines and everything works.
.\" .po 1c
.\" .ll 19c
.
.\" Start the document.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
.sp
答案 0 :(得分:2)
当您编写以下行时:
.nr a4_margin_horizontal 1c
字母c
是一个刻度指示器;因此实际存储在寄存器中的数值约为28346。
稍后再写:
.po \n[a4_margin_horizontal]
没有刻度指示器;因此,解释器将退回到默认比例尺指示器,该指示器根据line layout(手册页)为m
。
如果要使其正常运行,请在u
请求之后添加\n
指示器:
.po \n[a4_margin_horizontal]u
答案 1 :(得分:1)
有趣的是,我如何将我的头撞在墙上整整一个小时,然后当我最终在StackOverflow上问我一个问题时,我就知道了。
在线手册中:
gtroff(与许多其他程序一样)需要数字参数来指定 各种测量。大多数数字参数9可能具有一个测量单位 附上。这些单位被指定为单个字符, 跟随数字或表达式。这些单元中的每一个都可以通过 gtroff,为其基本单位的倍数。所以,每当不同 指定的度量单位gtroff将其转换为基本单位。这个 基本单位(以“ u”表示)是与设备相关的度量,即 非常小,范围为1/75英寸至1/72000英寸。值可以是 以分数形式给出;但是,分数基本单位总是四舍五入 到整数。
我对1c
(1厘米)的度量被转换为28346个“基本单位”(每英寸72,000),并且.po
请求被认为是默认的度量单位。