我想获得像我附件中的表格。然后我尝试使用它\hhline
来绘制水平线。但我仍然遇到自动断线的问题。
我想要的
坏的
\documentclass[12pt, a4paper,twoside]{article}
\usepackage{multirow,booktabs}
\usepackage{colortbl,multirow,hhline,mathtools}
\usepackage{makecell}
\begin{document}
\definecolor{c1}{rgb}{0.30980, 0.50588, 0.73725}
\definecolor{c2}{rgb}{0.82353, 0.87843, 0.92941}
\setlength{\arrayrulewidth}{1pt}
\setlength{\extrarowheight}{1.0pt}
\begin{table}[H] % added on 12172013 for caption and label
\centering
\caption{Table}
\label{tb32b}
\arrayrulecolor{white}
\begin{tabular}{|p{4.5em}|p{7cm}|p{3.8cm}|l|}
\rowcolor{c1}
\multirow{4}*{\textcolor{white}{Measure}}
& \multicolumn{2}{l|}{\multirow{4}*{\textcolor{white}{Description}}} &
\multirow{4}*{\textcolor{white}{NO.}} \\
\hline
\arrayrulecolor{white}
\rowcolor{c2}
\multirow{4}*{\parbox[t]{4.5em}{Orientation-based}} & \multicolumn{2}{p{11.25cm}|}{The first orientater of empty bins in the rose plot.} & \multirow{2}*{$M_8$} \\
\hhline{|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{white}}-|>{\arrayrulecolor{white}}-|>{\arrayrulecolor{white}}-|}% \hhline hack
\rowcolor{c2}
& \multicolumn{2}{p{11.25cm}|}{The second one is defined in the orientations of the delta points.} & \multirow{2}*{$M_9$} \\
\hline
\rowcolor{c2}
\multirow{4}{4.5em}{Pair-based} & Equ1 & \multirow{4}*{\parbox[t]{3.8cm}{The first orid measure is the number of empty bins in the rose plot, The first orased measure is the number of empty bins in the rose plot.}} & \multirow{4}*{$M_{10\_13}$} \\
\hhline{|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{white}}-|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{c2}}-|}% \hhline hack
\rowcolor{c2}
& Equ2 & & \\
\hhline{|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{white}}-|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{c2}}-|}% \hhline hack
\rowcolor{c2}
& Equ3 & & \\
\hhline{|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{white}}-|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{c2}}-|}% \hhline hack
\rowcolor{c2}
& Equ4 & & \\
\hline
\end{tabular}
\end{table}
\end{document}
答案1
您显然从未运行过您发布的示例,在表格开始之前的序言中就有很多错误。然而,修复这个问题的主要问题是表单*
不进行换行,您需要指定 p 列的宽度。此外,由于您希望文本位于颜色上方而不是下方,因此您需要将其添加到最后一行,而不是第一行:
\documentclass[12pt, a4paper,twoside]{memoir}
\usepackage{colortbl,multirow,hhline,mathtools}
\definecolor{c1}{rgb}{0.30980, 0.50588, 0.73725}
\definecolor{c2}{rgb}{0.82353, 0.87843, 0.92941}
\begin{document}
\setlength{\arrayrulewidth}{1pt}
\setlength{\extrarowheight}{1.0pt}
\begin{table}[H] % added on 12172013 for caption and label
\centering
\caption{Table}
\label{tb32b}
%\arrayrulecolor{white}
\begin{tabular}{|p{4.5em}|p{7cm}|p{3.8cm}|l|}
\rowcolor{c1}
\multirow{4}{4.5em}{\textcolor{white}{Measure}}
& \multicolumn{2}{l|}{\multirow{4}{*}{\textcolor{white}{Description}}} &
\multirow{4}{*}{\textcolor{white}{NO.}} \\
\hline
\arrayrulecolor{white}
\rowcolor{c2}
& \multicolumn{2}{p{11.25cm}|}{The first orientation-based medfadadfd empty bins in the rose plot.} & \multirow{2}{*}{$M_8$} \\
\hhline{|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{white}}-|>{\arrayrulecolor{white}}-|>{\arrayrulecolor{white}}-|}% \hhline hack
\rowcolor{c2}
\multirow{-3}{4.5em}{Orientation-based} & \multicolumn{2}{p{11.25cm}|}{The second one is definesfa e in the orientatisdafasdf points.} & \multirow{2}{*}{$M_9$} \\
\hline
\rowcolor{c2}
& Equ1 & & \multirow{4}{*}{$M_{10\_13}$} \\
\hhline{|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{white}}-|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{c2}}-|}% \hhline hack
\rowcolor{c2}
& Equ2 & & \\
\hhline{|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{white}}-|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{c2}}-|}% \hhline hack
\rowcolor{c2}
& Equ3 & & \\
\hhline{|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{white}}-|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{c2}}-|}% \hhline hack
\rowcolor{c2}
\multirow{-4}{4.5em}{Pair-based} & Equ4 & & \\
\rowcolor{c2}&&&\\
\rowcolor{c2}&&&\\
\rowcolor{c2}&&&\\
\rowcolor{c2}&&
\multirow{-8}{3.8cm}{sd afd safasd fd safasd fd sfasd fd safd safd safasd fd safasd fasd fsad fasd fsad fsad fasd fd safd safd safd asfd safd safasd fasd fsad afdas}
&\\
\hline
\end{tabular}
\end{table}
\end{document}
答案2
您可以使用该makecell
包。它有一个\multirowcell
允许换行的命令。它的语法与 相同\multirow
。
或者,如果您想输入带有自动换行符的整个段落,可以这样做:
\multirow{nb lines}{*}{\parbox{parwidth}{My text}}
答案3
我建议你避免在表格中使用垂直线:它们在排版上并不美观。你的代码很乱:我写了一个代码,你可以用它作为基础来让表格更有序。你可以通过添加颜色来改进它。
\documentclass[12pt, a4paper,twoside]{article}
\usepackage{multirow,booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{cccc}
\toprule
Measure & \multicolumn{2}{c}{Description} & NO. \\
\midrule
\multirow{2}*{Orientation-based} & \multicolumn{2}{c}{The first orientation} & $M_8$ \\
& \multicolumn{2}{c}{The second one is } & $M_9$ \\
\midrule
\multirow{4}*{Pair-based} & Equ1 & \multirow{4}*{Example of text} & \multirow{4}*{$M_{10\_13}$} \\
& Equ2 & & \\
& Equ3 & & \\
& Equ4 & & \\
\bottomrule
\end{tabular}
\end{table}
\end{document}