我想创建一个包含大量文本的表格,遵循图 1(下图)中所示的样式。我曾尝试使用tabularx
但收效甚微。我尝试描述以下一些问题 - 如果描述不准确,它们也会在图片中突出显示(红色框)。
- 创建“空行”——按照“标题 1,2,3 等”。
- 在表格的左上角创建一个空框。
- 将第 4 列和第 5 列放置在第 3 列和第 4 列旁边。
- 为所有标题 (第 1、2、3 列等等...) 换行。
梅威瑟:
\documentclass[a4paper,11pt]{article}
\usepackage{tabularx}
\usepackage{booktabs,caption, makecell}
\usepackage{pdflscape,afterpage}
\begin{document}
\begin{landscape}% Landscape page
\begin{table}[ht]
\caption{Cognitive walkthrough goals, tasks and actions}
\small
\begin{tabularx}{\linewidth}{@{}*{3}{>{\arraybackslash}X}}
\toprule\midrule[0.5pt]
\thead{\textbf{Column 1}}& \thead{\textbf{Column 2}} & \thead{\textbf{Column 3}} & \thead{\textbf{Column 4}} & \thead{\textbf{Column 5}}\\
\midrule
To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries. & To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries. & To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.
\\
\addlinespace
Text & Text & Text \\
\addlinespace
Text & Text & Text \\
\addlinespace
Text & Text & Text \\
\addlinespace
Text & Text & Text \\
\addlinespace
Text & Text & Text \\
\addlinespace
Text & Text & Text \\
\addlinespace
Text & Text & Text \\
\addlinespace
Text & Text & Text \\
\addlinespace
Text & Text & Text \\
\bottomrule
\end{tabularx}%
\hspace*{-12mm}%
\label{table:comparison of techniques}
\end{table}
\end{landscape}
\end{document}
感谢您的任何建议。我很乐意使用另一个tabularx
我熟悉的包。
提前致谢!
答案1
- 抱歉,你的问题不清楚。例如,如果文本的行数不同,如何对齐第 2 - 5 列单元格中的内容。所以我的回答是基于猜测
- 在表格设计中看到,如果表格应该是什么样子对你有帮助
\documentclass[a4paper,11pt]{article}
\usepackage{booktabs, makecell, tabularx}
\usepackage{caption}
\renewcommand\theadfont{\small\bfseries}
\renewcommand\tabularxcolumn[1]{m{#1}}
\usepackage[table]{xcolor}
\usepackage{pdflscape,afterpage}
\begin{document}
\begin{landscape}% Landscape page
\begin{table}[ht]
\caption{Cognitive walkthrough goals, tasks and actions}
\label{table:comparison of techniques}
\small
\setlength\extrarowheight{2pt}
\begin{tabularx}{\linewidth}{
>{\columncolor{red!30}} l
*{4}{X}
}
\Xhline{1pt}
\rowcolor{red!30}
\multicolumn{1}{c}{}
& \thead{Column 2} & \thead{Column 3}
& \thead{Column 4} & \thead{Column 5} \\
\rowcolor{black}
\multicolumn{5}{l}{\textcolor{white}{Title 1}} \\
Part 1
& To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.
& To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.
& To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.
& To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries. \\
\Xhline{0.25pt}
Part 2
& Text & Text & Text & Text \\
\rowcolor{black}
\multicolumn{5}{l}{\textcolor{white}{Title 2}} \\
Part 1
& Text & Text & Text & Text \\
\Xhline{1pt}
\end{tabularx}%
\end{table}
\end{landscape}