如何使用 Unix tbl 实用程序获得多行单元格?

如何使用 Unix tbl 实用程序获得多行单元格?

我正在尝试与 groff 合作生成一个表格,其中一个单元格跨越多行。

我试过

.TS BOXED LABEL "Table 1: Use Case 1"
allbox, tab(@);
l l
l ld
l ^ .
Use Case Identifier@UC1
Flow of events@T{1. System prompts for username and password
.br
2. User submits their username and password
T}
.TE

但我收到下面的警告,并且表格渲染不正确。

warning: file `report.mom', around line 55:
  table wider than line width

我试图生成如下所示的表格,其中左下角的单元格跨越多行。

预期示例

我还尝试了其中的一个例子文档,特别是以下一个,我得到了相同的结果table wider than line width warning,并且表格无法正确渲染。 (下面的示例是我链接的页面上的最后一个示例。)

.TS
box;
cb s s s
c | c | c s
ltiw(1i) | ltw(2i) | lp8 | lw(1.5i)p8.
Some Interesting Places
_
Name[[circle]]Description[[circle]]Practical Information
_
T{
American Museum of Natural History
T}[[circle]]T{
The collections fill 11.5 acres (Michelin) or 25 acres (MTA)
of exhibition halls on four floors. There is a full-sized replica
of a blue whale and the world's largest star sapphire (stolen in 1964).
T}[[circle]]Hours[[circle]]10-5, ex. Sun 11-5, Wed. to 9
\^[[circle]]\^[[circle]]Location[[circle]]T{
Central Park West & 79th St.
T}
\^[[circle]]\^[[circle]]Admission[[circle]]Donation: $1.00 asked
\^[[circle]]\^[[circle]]Subway[[circle]]AA to 81st St.
\^[[circle]]\^[[circle]]Telephone[[circle]]212-873-4225
_
Bronx Zoo[[circle]]T{
About a mile long and .6 mile wide, this is the largest zoo in America.
A lion eats 18 pounds
of meat a day while a sea lion eats 15 pounds of fish.
T}[[circle]]Hours[[circle]]T{
10-4:30 winter, to 5:00 summer
T}
\^[[circle]]\^[[circle]]Location[[circle]]T{
185th St. & Southern Blvd, the Bronx.
T}
\^[[circle]]\^[[circle]]Admission[[circle]]$1.00, but Tu,We,Th free
\^[[circle]]\^[[circle]]Subway[[circle]]2, 5 to East Tremont Ave.
\^[[circle]]\^[[circle]]Telephone[[circle]]212-933-1759
_
Brooklyn Museum[[circle]]T{
Five floors of galleries contain American and ancient art.
There are American period rooms and architectural ornaments saved
from wreckers, such as a classical figure from Pennsylvania Station.
T}[[circle]]Hours[[circle]]Wed-Sat, 10-5, Sun 12-5
\^[[circle]]\^[[circle]]Location[[circle]]T{
Eastern Parkway & Washington Ave., Brooklyn.
T}
\^[[circle]]\^[[circle]]Admission[[circle]]Free
\^[[circle]]\^[[circle]]Subway[[circle]]2,3 to Eastern Parkway.
\^[[circle]]\^[[circle]]Telephone[[circle]]718-638-5000
_
T{
New-York Historical Society
T}[[circle]]T{
All the original paintings for Audubon's
.I
Birds of America
.R
are here, as are exhibits of American decorative arts, New York history,
Hudson River school paintings, carriages, and glass paperweights.
T}[[circle]]Hours[[circle]]T{
Tues-Fri & Sun, 1-5; Sat 10-5
T}
\^[[circle]]\^[[circle]]Location[[circle]]T{
Central Park West & 77th St.
T}
\^[[circle]]\^[[circle]]Admission[[circle]]Free
\^[[circle]]\^[[circle]]Subway[[circle]]AA to 81st St.
\^[[circle]]\^[[circle]]Telephone[[circle]]212-873-3400
.TE

答案1

根据您所需的输出,以下是tbl代码。请注意,您不需要框选项。

我以为你需要一个大胆的UC1在第一行第二列中,因此在列后缀中使用了 B。

.TS BOXED LABEL "Table 1: Use Case 1"
tab(@);
l lB, l l, l l, l l, l l
lT l, ^, ^, ^, ^.
_
Use Case Identifier@UC1
_
Title@Login
_
Participating actor(s)@Dental staff member or client
_
Precondition(s)@System is ready to receive requests
_
Parameters@Username, password
_
T{
Flow of events
T}@1. System prompts for username and password
^@2. User submits their username and password
^@3. System logs user in
^@4. User is redirected to homepage
_
.TE

答案2

主要问题是T{ 必须位于行尾,就像}T必须位于行首一样。只需更改换行符,您就可以得到:

表格1

您可以通过使用w(troff_width)(默认比例为恩斯,字体中“n”字符的近似宽度)。例如,用于l lw(50)第一个格式行给出:

在此输入图像描述

请注意,在文档的示例中,为了使其正常工作,您必须将字符串替换[[circle]]为制表符,正如前面提到的那样。

答案3

我还自己找到了一个解决方案(尽管这与我的示例屏幕截图不像其他解决方案那么匹配):

.TS BOXED
box, tab(@);
l | l .
Use Case Identifier@UC1
_
Title@Login
_
Participating actor(s)@Dental staff member or client
_
Precondition(s)@System is ready to receive requests
_
Parameters@Username, password
_
Flow of events@1. System prompts for username and password
\^@2. User submits their username and password
\^@3. System logs user in
\^@4. User is redirected to homepage
.TE

这会产生

样本渲染

该部分|中的指示在两列之间放置一条垂直线。l | ltbl

指示在两行之间放置一条水平线_tbl

指示tab(@)tbl字符@视为行中单元格之间的分隔符。

表明上面\^tbl表条目向下跨越该行。

相关内容