我正在尝试创建一个符合以下格式的表格,但我无论如何也想不通。标有“(w/b)”的单元格应该是黑色背景上的白色文本。
----------------------------------------
| Title (w/b) |
|--------------------------------------|
| Description |
|--------------------------------------|
| Item 1 (w/b) | Item 1 description. |
|--------------------------------------|
| Item 2 (w/b) | Item 2 description. |
|--------------------------------------|
| Item 3 (w/b) | Item 3 description. |
----------------------------------------
基本上是五行两列,也许五列,其中一列用于物品名称,四列用于物品描述。每行之间有边框。我还需要它来拉伸页面的宽度(在边距内),以便为描述留出足够的空间。有什么提示吗?
答案1
\documentclass{article}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage[svgnames,table]{xcolor}
\usepackage{makecell, multirow, tabularx,booktabs,nicematrix}
\begin{document}
\renewcommand{\thead}{\color{white}\large\bfseries\sffamily}
\noindent\begin{NiceTabular*}{\columnwidth}{lc}[colortbl-like, code-before=\columncolor{gray}
{1}]
\rowcolor{black}\thead{Title} & \thead{Description} \\
Item & {\parbox{10cm} {\raggedright Island Museum analyzes historical artifacts using one or more techniques described below – all but one of which is performed by an outside laboratory – to obtain specific information about an object’s creation. For each type of material listed, the museum uses only the technique described:}} \\
\end{NiceTabular*}
\end{document}