我试图使用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发布于 2021-01-21 06:26:38
根据所需的输出,下面将是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发布于 2021-01-21 14:38:28
主要的问题是T{ <#>必须在行的末尾,就像}T必须位于行的开头一样。只要更改换行符,您就可以得到:

您可以通过使用w(troff_width)为列提供宽度来帮助排版(默认刻度是ens,字体中"n“字符的大致宽度)。例如,对第一个格式行使用l lw(50)提供:

请注意,在文档中的示例中,要使其工作,必须将字符串[[circle]]替换为选项卡字符,正如前面提到的那样。
发布于 2021-01-21 17:08:08
我还自己找到了一个解决方案(尽管这与我的示例屏幕截图不像其他解决方案那么匹配):
.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 | l部分告诉tbl在两列之间放置一条垂直线。
_告诉tbl在两行之间放置一条水平线。
tab(@)告诉tbl将@字符视为行中单元格之间的分隔符。
\^告诉tbl,紧接在上面的表条目向下跨越该行。
https://unix.stackexchange.com/questions/630147
复制相似问题