有人能帮我在 latex 中创建如图所示的表格吗?谢谢
答案1
有了{NiceTabular}
,nicematrix
就非常容易了。
\documentclass{article}
\usepackage{nicematrix}
\NiceMatrixOptions{cell-space-top-limit=2pt}
\begin{document}
\begin{NiceTabular}{llp{1in}lp{1in}l|}[hvlines]
0 & Role & Feature & & Goal/Objective & Priority \\
US1 & \Block{4-1}{As a \\ \textbf{manager},\\ I want do} & & \Block{4-1}{so\\ that} \\
US2 \\
US3 \\
US4 \\
\end{NiceTabular}
\end{document}
您需要多次编译(因为nicematrix
使用 PGF/Tikz 节点)。
答案2
以下是使用版本\multirow
:
\documentclass{article}
\usepackage{geometry}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|l|p{1.75cm}|p{3cm}|p{0.75cm}|p{4cm}|l|}%
\hline%
N0 & Role & Feature & & Goal/Objective & Priority \\
\hline%
US1 & \multirow[b]{4}{=}{AS a \textbf{Manager} I want to} & & \multirow{4}{=}{So that} & & \\
\cline{1-1}\cline{3-3}\cline{5-6}%
US2 & & & & & \\
\cline{1-1}\cline{3-3}\cline{5-6}%
US3 & & & & & \\
\cline{1-1}\cline{3-3}\cline{5-6}%
US4 & & & & & \\
\hline%
\end{tabular}
\end{document}
答案3
非常简单的方法:
\renewcommand{\arraystretch}{1.2}% from https://tex.stackexchange.com/questions/7208/how-to-vertically-center-the-text-of-the-cells
\begin{tabular}{|l|l|p{1in}|l|p{1in}|l|}
\hline%
N0 & Role & Feature & & Goal/Objective & Priority \\%
\hline%
US1 & & & & & \\%
\cline{1-1}\cline{3-3}\cline{5-6}%
US2 & AS a & & So & & \\%
\cline{1-1}\cline{3-3}\cline{5-6}%
US3 & \textbf{Manager} & & that & & \\%
\cline{1-1}\cline{3-3}\cline{5-6}%
US4 & I want to & & & & \\%
\hline%
\end{tabular}
请注意,不建议在表格中使用垂直线:它们很丑陋。对于水平线,您可以使用 booktabs 中的 \toprule、midrule 或 \bottomrule。