我正在尝试使用 LaTeX 创建下表:
我曾尝试使用制造细胞,表格型, 和大批包。但是,我无法创建它。我无法使表格的最大宽度等于\行宽,同时将长文本正确地分成多行并在表格单元格中创建项目符号列表。到目前为止,我尝试过的是:
\begin{table}[ht]
\caption{Example Table}
\label{example-table}
\begin{center}
\begin{tabularx}{\textwidth}{|p{0.2\linewidth}|p{0.2\linewidth}|p{0.2\linewidth}|p{0.2}\linewidth|X|}
\hline
\multicolumn{5}{|c|}{Example Table} \\
\hline
\multicolumn{2}{|c|}{very long text} & \multicolumn{3}{c|}{very long text} \\
\hline
\multirow{2}{*}{long text} & %
\multirow{2}{*}{long text} & %
\multirow{2}{*}{\makecell{very very \\ long text}} & %
\multicolumn{2}{c|}{\makecell{very very \\ long text}} \\
\cline{4-5}
& & & \makecell{very very \\ long text} & \makecell{very very \\ long text} \\
\hline
\makecell{\begin{itemize \item very very long text \item second very very long text \end{itemize}} \\
\hline
\end{tabularx}
\end{center}
\end{table}
有人有想法或知道如何用 LaTeX 实现表格吗?任何帮助都将不胜感激。
答案1
这是一个解决方案。我把最后四个单元格留空,因为它们与前一个单元格基本相同。
注 1:您可能需要调整\multirow
“nrows”参数以反映实际数量线覆盖范围而不是数量行。
笔记2:最好将表格放在横向页面中,因为它相当宽。
注 3:我曾经paralist
得到过更加紧凑的物品清单。
\documentclass{article}
\usepackage{tabularx}
\usepackage{makecell}
\usepackage{multirow}
\usepackage{paralist}
\newcommand{\itemlist}[1]{%
\setdefaultleftmargin{1em}{}{}{}{}{}
\begin{compactitem}#1\end{compactitem}%
}
% Inspired by https://tex.stackexchange.com/a/510318/113546
\newcommand{\Xwdth}[1]{\dimexpr#1\hsize+#1\tabcolsep+#1\tabcolsep+#1\arrayrulewidth-2\tabcolsep-\arrayrulewidth\relax}
\newcommand{\multiX}[3]{\multicolumn{#1}{>{\hsize=\Xwdth{#1}}#2}{#3}}
\begin{document}
\begin{table}[ht]
\caption{Example Table}
\label{example-table}
\begin{center}
\begin{tabularx}{\textwidth}{|*{6}{X|}}
\hline
\multicolumn{6}{|c|}{Example Table} \\
\hline
Very very long text & \multirow[t]{2}{=}{Very very long text} & \multirow[t]{2}{=}{Very very long text} & \multirow[t]{2}{=}{Very very very long text} & \multiX{2}{X|}{Very very long text} \\
\cline{1-1}\cline{5-6}
\multirow[t]{5}{=}{Very very long text} & & & & Very very long text & Very very long text \\
\cline{2-6}
& Very very long text & Very very long text & Very very long text & Very very long text & Very very long text \\
\cline{2-6}
& {Very very Very very Very very long text
\itemlist{%
\item Item number one
\item Item number two
}} & & & & \\
\hline
\end{tabularx}
\end{center}
\end{table}
\end{document}