Could anyone help me with how to create a table shown in the picture in latex? Thank you
3 Answers
With {NiceTabular} of nicematrix, it's very easy.
\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}
You need several compilations (because nicematrix uses PGF/Tikz nodes).
- 40,250
-
-
doesn'work on TL2000. The '\' are ignored: |tex / log / aux| files http://ix.io/2EdV – gigiair Nov 15 '20 at 09:23
-
@gigiair: It will work with the latest version of
nicematrix: version 5.6 of 2020/11/08 – F. Pantigny Nov 15 '20 at 11:01
In a very simple way:
\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}
Note that vertical lines in table are not recommended: they are ugly. For horizontal lines you can use \toprule, midrule, or \bottomrule from booktabs.
- 1,812
-
Text is not centered vertically within the respective cell, most noticeably in the top row and left column. Is there a fix for that? – Artmancc Nov 14 '20 at 14:25
-
from https://tex.stackexchange.com/questions/7208/how-to-vertically-center-the-text-of-the-cells you can type \renewcommand{\arraystretch}{1.4} before the tabular declaration. – gigiair Nov 14 '20 at 20:35
Here is a version using \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}
- 62,593
-
-
@gigiair: Sorry. I unintentionally uploaded the wrong document. Thanks for pointing this out. – leandriis Nov 15 '20 at 14:00



\cline(For example as in\cline{1-1} \cline{3-3} \cline{5-6}). For the text "So That", you could use the\multirowcommand from themultirowpackage (For example as in\multirow[b]{4}{1.7cm}{AS a \textbf{Manager} I want to}. – leandriis Nov 14 '20 at 12:32multirow. Have you looked for examples of that usage? – Teepeemm Nov 14 '20 at 14:59