使用tbl&amp ;;在UNIX中创建表的troff

时间:2016-04-19 01:33:10

标签: unix troff

我必须在troff中创建一个表,我有:

.TS
tab(:);
c s s
c | c | c
l | l | n.
My Custome PC Specs
=
Component:Selection:Price
_
CPU:Intel Core i5-4690K 3.5GHz Quad-Core Processor:$219.99  
_
Motherboard:MSI Z97-GAMING 5 ATX LGA1150:$129.88
_
Memory:Corsair Vengeance Pro 16GB (2 x 8GB) DDR3-1866 Memory:$74.88 
_
Storage:Sandisk X110 128GB 2.5" Solid State Drive:FREE  
\^:Western Digital 1TB 3.5" 7200RPM Internal Hard Drive:$38.77  
_
Video Card:MSI GeForce GTX 970 4GD5T OC 4GB GDDR5:$289.99   
_
Case:Corsair Graphite Series 230T Orange ATX Mid Tower Case:$73.46
_
Power Supply:CorsairCX 750W 80+ Bronze Certified Semi-Modular ATX:$59.99
_
Optical Drive:Asus DRW-24B1ST/BLK/B/AS DVD/CD Writer:$12.89 
_
Operating System: Microsoft Windows 10 Pro OEM (64-bit):FREE
_
WAN: TP-Link TL-WN881ND 802.11b/g/n PCI-Express Wi-Fi Adapter:$18.89
_
Case Fan: Cooler Master SickleFlow 69.7 CFM 120mm Fan:$9.99
_
Monitor:Monoprice 12178 144Hz 24.0" Monitor:$229.99
_
Keyboard: Corsair Vengeance K70 Wired Gaming Keyboard:$119.99
_
Mouse: Razer DeathAdder 2013 Wired Optical Mouse:$59.99
_
Total: :$1,388.70
_
.TE

我尝试通过输入tbl [filename] | troff来执行,但我没有得到 表,我尝试过使用其他选项,但我不确定我是否理解troff是如何工作的。

1 个答案:

答案 0 :(得分:1)

使用 GNU Troff ,我已使用以下调用成功处理了您的文件:

groff -t -Tascii tbl.tr > tbl.txt

-t告诉troff使用运行tbl预处理器和-Tascii设置ascii输出设备,它会生成纯文本输出。

以下是结果的前三行:

                                    My Custome PC Specs
-----------------+-----------------------------------------------------------+--------------
   Component     |                         Selection                         |    Price
-----------------+-----------------------------------------------------------+--------------
CPU              | Intel Core i5-4690K 3.5GHz Quad-Core Processor            |   $219.99
-----------------+-----------------------------------------------------------+--------------
Motherboard      | MSI Z97-GAMING 5 ATX LGA1150                              |   $129.88
-----------------+-----------------------------------------------------------+--------------

您的错误来自于忽略 troff 选项。请仔细阅读手册的相应章节GNU Troff或您可能正在使用的其他任何风格。

GNU Troff的最佳帮助来源是mailing list