Cockburn 用例模板

Cockburn 用例模板

我正在尝试创建一个 Cockburn 用例表,这是我可以做的:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{multirow}
\usepackage{float} 
\usepackage{tabularx}

\begin{document}
\begin{table}[H]    

\def\arraystretch{1.5}


\begin{tabularx}{\linewidth}{|l|X|X|X|}

\hline
    Use Case \#N                   & \multicolumn{3}   {l|}{Name}   \\ \hline
    Goal in Context                & \multicolumn{3}{l|}{This is a very long line. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.  } \\ \hline
    Preconditions                  & \multicolumn{3}{l|}{}       \\ \hline
    Success End Conditions         & \multicolumn{3}{l|}{}       \\ \hline
    Failed End Conditions          & \multicolumn{3}{l|}{}       \\ \hline
    Primary Actor                  & \multicolumn{3}{l|}{}       \\ \hline
    Trigger                        & \multicolumn{3}{l|}{}       \\ \hline
    \multirow{2}{*}{Description}   & Step & User Action & System \\ \cline{2-4} 
    &      &             &        \\ \hline
    \multirow{2}{*}{Extensions}    & Step & User Action & System \\ \cline{2-4} 
    &      &             &        \\ \hline
    \multirow{2}{*}{Subvariations} & Step & User Action & System \\ \cline{2-4} 
    &      &             &        \\ \hline
    Notes                          & \multicolumn{3}{l|}{}       \\ \hline


\end{tabularx}

\end{table}
\end{document}

它似乎运行良好,但长行会破坏它,我找不到一种方法来换行长文本而不破坏其他内容(即多列),有人能帮助我吗?提前致谢。

我看到了另一篇关于 Cockburn 模板的帖子,但那并不是我所寻找的,因为我试图重现我在课堂上看到的表格。

答案1

您希望长条目为 X 列,其宽度大约是通常 X 宽度的三倍,因为它跨越 3 个 X 列,但也有 2 个列间空间和两个垂直规则

在此处输入图片描述

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{multirow}
\usepackage{float} 
\usepackage{tabularx}

\begin{document}
\begin{table}[H]    

\def\arraystretch{1.5}


\begin{tabularx}{\linewidth}{|l|X|X|X|}

  \hline Use Case \#N & \multicolumn{3} {l|}{Name} \\ \hline Goal in
  Context & \multicolumn{3}{>{\hsize=\dimexpr 3\hsize+4\tabcolsep+2\arrayrulewidth\relax}X|}{%
    This is a very long line. Lorem ipsum dolor sit amet, consectetur
    adipiscing elit, sed do eiusmod tempor incididunt ut labore et
    dolore magna aliqua.  } \\
 \hline Preconditions &
  \multicolumn{3}{l|}{} \\
 \hline Success End Conditions &
  \multicolumn{3}{l|}{} \\
 \hline Failed End Conditions &
  \multicolumn{3}{l|}{} \\
 \hline Primary Actor &
  \multicolumn{3}{l|}{} \\
 \hline Trigger & \multicolumn{3}{l|}{} \\

  \hline \multirow{2}{*}{Description} & Step & User Action & System \\

  \cline{2-4} & & & \\
 \hline \multirow{2}{*}{Extensions} & Step &
  User Action & System \\
 \cline{2-4} & & & \\
 \hline
  \multirow{2}{*}{Subvariations} & Step & User Action & System \\

  \cline{2-4} & & & \\
 \hline Notes & \multicolumn{3}{l|}{} \\
 \hline


\end{tabularx}

\end{table}
\end{document}

相关内容