我想将一个单元格分成几行,如何在 latex 中做到这一点?我需要这个结果,我该怎么做
%这将改变文档中所有表格的字体。
\documentclass{report}
\usepackage{color}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{multirow}
%This will change the font for all the tables in the document.
\makeatletter
\begin{document}
\begin{table}[ht]
\newcolumntype{Y}{>{\centering\arraybackslash\columncolor{Gainsboro}}c}
\renewcommand*{\arraystretch}{1.2}
\centering
\caption{Methodologies Summary}
\begin{tabular}{|Y|c|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|}
\hline
\multicolumn{1}{|c}\emph{\textbf{Approach}} & \multicolumn{2}{|c|}{\emph{\textbf{Feature}}} & Grüninger-Fox & KACTUS & METHONTOLOGY & SENSUS & On-To-Knowledge & cyc & Usdhold - King \\
\hline
{Development Process} & {Project management processes } & \multirow{3}{*}{} & & & && \\
\cline{1-8}
& Ontology development-oriented processes &
& & & & & \\
\cline{1-8}
& Integral processes &
& & & & & \\
\hline
\end{tabular}
\end{table}
\end{document}
答案1
编辑: 似乎你期望有人为你从头开始制作这张表......我在下面给出仅是一个起点如何自己制作表格。因此,从您讨论的新图像中,我只考虑了几个表格行。列标题仍然基于猜测。
\documentclass{report}
\usepackage{geometry}
\usepackage{makecell,multirow,tabularx}
\renewcommand\theadfont{\bfseries}
\usepackage[table]{xcolor}
%\makeatletter %doesn't work
%\g@addto@macro{\table[ht]}{\fontsize{9pt}{10.8pt}\selectfont}
%\makeatother
\newcolumntype{L}{>{\raggedright\arraybackslash}X}% <-- new
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\begin{table}[ht]
\footnotesize
\renewcommand*{\arraystretch}{1.2}
\centering
\caption{Methodologies S}
\begin{tabularx}{\textwidth}{|L|L|L|*{7}{C{0.6cm}|}}
\hline
\multicolumn{10}{|l|}{Approach: Development Process} \\
\hline
\multicolumn{3}{|c|}{}
& \multicolumn{7}{c|}{\thead{Methodology}} \\
\cline{4-10}
\multicolumn{3}{|c|}{\thead{Feature}}
& aaa & bbb & ccc & ddd & eee & f f f & ggg \\
\hline
\multirowcell{3}{Project\\ management\\ processes}
& \multicolumn{2}{l|}{initiation}
& & & & & & & \\
\cline{2-10}
& \multicolumn{2}{l|}{monitoring and control}
& & & & & & & \\
\cline{2-10}
& \multicolumn{2}{l|}{Management}
& & & & & & & \\
\hline
\multirowcell{4}{Ontology\\ development-\\oriented\\ processes}
& \multirowcell{2}{Development\\ proces}
& requirements process
& & & & & & & \\
\cline{3-10}
& & design process
& & & & & & & \\
\cline{3-10}
& & implementations process
& & & & & & & \\
\hline
\end{tabularx}
\label{ch7:tab:experiencesinpracticalphysics}
\end{table}
\end{document}
如您所见,我使用了一些新的包:makecell
用于列标题(宏\thead
)和多行单元格(宏multirowcell
),multirow
用于支持带有居中单元格内容的˙multirowcell tabularx X p{6mm} C`makecell
包。and
, from which is used column type
for multi line cells with self-calculate width. Last seven columns are based on
type column (redefined into
由于表格似乎比文本宽度宽,因此将其设置为横向可能是合理的(我不知道最后七列是什么,选择 6 毫米纯粹是猜测)。