首页 > 解决方案 > 可以在 groff 请求中使用数字寄存器吗?

问题描述

有人可以向我解释为什么在.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 

标签: units-of-measurementgroff

解决方案


当您编写以下行时:

.nr a4_margin_horizontal 1c

该字母c为刻度指示符;因此存储在寄存器中的实际数值约为 28346。

以后写的时候:

.po \n[a4_margin_horizontal]

没有刻度指示器;因此解释器依赖于根据行布局(手册页)的默认比例指示器。m

如果要使其工作,请在请求u后添加指示符:\n

.po \n[a4_margin_horizontal]u

推荐阅读