如果我想编写可在不同类Unix系统之间移植的手册页,我应该使用哪种源语言标准?或者我可以简单地假设GNU troff(groff)随处可用?
如果你看一下https://www.troff.org/macros.html,在man
下,它列出了两个编写手册页的指南。
一般来说,他们都建议避免使用额外的预处理器,如tbl
,pic
或eqn
,尤其是如果你想要最大化可移植性。
手册页使用an
宏包。这是这样做的,当你用-m
宏选项调用它时,它显示为troff -man
。要查找an
宏包定义的宏,您应该查找与tmac.an*
(对于UNIX / BSD系统)或an*.tmac
(对于Linux系统)匹配的文件。例如,在RHEL / CentOS上它将是:
/usr/share/groff/1.18.1.4/tmac/an.tmac which refers to
/usr/share/groff/1.18.1.4/tmac/andoc.tmac which refers to
/usr/share/groff/1.18.1.4/tmac/an-old.tmac which defines most of the macros
这些文件是groff包的一部分。