我正在尝试实现快照中给出的表格。首先,我只想绘制多行,如图所示。
\documentclass[12pt, a4paper,twoside]{memoir}
\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{3.8cm}|p{7cm}|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}{*}{Orientation-based} & \multicolumn{2}{p{11.25cm}|}{The first orientatiofdsafsafsadfsdafdsfasdfdasfdsafasdfsdafdsaffsdafasdt.} & \multirow{2}{*}{$M_8$} \\
\rowcolor{c2}
& \multicolumn{2}{p{11.25cm}|}{The second osafdsafsdafasdfsda the sadfdsas of the misdafdsa points.} & \multirow{2}{*}{$M_9$} \\
\hline
\rowcolor{c2}
\multirow{4}{*}{Pair-based} & Equ1 & \multirow{4}{*}{sdafdsafasdfdsafasdfdsfasdfdsafdsafdsafasdfdsafasdfasdfsadfasdfsadfsadfasdfdsafdsafdsafdasfdsafdsafasdfasdfsadafdas} & \multirow{4}{*}{$M_{10\_13}$} \\
\cline{2-3}
& Equ2 & & \\
& Equ3 & & \\
& Equ4 & & \\
\hline
\end{tabular}
\end{table}
\end{document}
我找到了一个主题,但无法成功修改它。URL 是 Latex 中的表格格式化,同时使用多行和多列
然后我有了一个新的代码快照。这个更接近预期的表格。但是 M8 和 M9 之间的行线无法显示,并且最后三行的行颜色没有显示。
答案1
您可以使用嵌套表格。查找“大”表格行并使用m
列说明符:
\documentclass[12pt,a4paper,twoside]{memoir}
\pagestyle{empty}% for cropping
\usepackage[table]{xcolor}
\usepackage{tabularx,caption}
\usepackage[raggedrightboxes]{ragged2e}
\definecolor{c1}{rgb}{0.30980, 0.50588, 0.73725}
\definecolor{c2}{rgb}{0.82353, 0.87843, 0.92941}
\renewcommand\tabularxcolumn[1]{m{#1}}
\newcommand\TABstack[1]{\tabular{@{}p{\linewidth}@{}}#1\endtabular}
\begin{document}
\noindent
\begin{minipage}{\linewidth}
\captionof{table}{Table}\label{tb32b}
\arrayrulecolor{white}\def\arraystretch{1.4}
\begin{tabularx}{\linewidth}{|m{5em}|X|m{7em}|}
\rowcolor{c1}
\textcolor{white}{Measure}
& \textcolor{white}{Description}
& \textcolor{white}{NO.} \\\hline
\rowcolor{c2}
\shortstack[l]{Orientation-\\based}
& \TABstack{The first orientation-based measure is the number of empty bins in the t.\\\hline
The second one is defined as the variance in the orientations of points.}
& \TABstack{$N_i$ is the number of detected\\ $N_i$\newline~} \\\cline{2-2}
\end{tabularx}
\end{minipage}
\end{document}
答案2
评论
您必须使用\hhline
hack 来获取部分\hline
。
下次,请将所有需要排版的包都包含在您的 MWE 中。
执行
\documentclass[12pt,a4paper,twoside]{memoir}
\pagestyle{empty}% for cropping
\usepackage{colortbl,multirow,hhline,mathtools}
\usepackage[raggedrightboxes]{ragged2e}
\DeclareMathOperator{\mean}{mean}
\DeclareMathOperator{\std}{std}
\newcommand*{\MFT}{\mathrm{MFT}}
\newcommand*{\NR}{\mathrm{NR}}
\newcommand*{\NC}{\mathrm{NC}}
\definecolor{c1}{rgb}{0.30980, 0.50588, 0.73725}
\definecolor{c2}{rgb}{0.82353, 0.87843, 0.92941}
\begin{document}
\begin{table}
\centering
\caption{Table}
\label{tb32b}
\arrayrulecolor{white}
\begin{tabular}{|p{0.2\textwidth}|p{0.3\textwidth}|p{0.3\textwidth}|l|}
\rowcolor{c1}
\textcolor{white}{Measure} & \multicolumn{2}{c|}{\textcolor{white}{Description}} & \textcolor{white}{NO.} \\
\hline
\rowcolor{c2}
& \multicolumn{2}{c|}{$N_i$} & \\
\hhline{|>{\arrayrulecolor{c2}}-|>{\arrayrulecolor{white}}-|>{\arrayrulecolor{white}}-|>{\arrayrulecolor{white}}-|}% \hhline hack
\rowcolor{c2} \multirow{-2}{0.2\textwidth}{Orientation-based} & $N_i$ is the number of detected & & \\
\hline
\rowcolor{c2}
Mean value of FT & $\mean(\MFT_i)$ & $\MFT_i$ is a linear & $M_2$ \\
\hline
\rowcolor{c2}
Standard Deviation of $\MFT_i$ & $\std(\MFT_i)$ & The save to above. & $M_3$ \\
\hline
\rowcolor{c2}
in a Rectangle Region & $\NR_i$ & $\NR_i$ is the number of detec & $M_4$ \\
\hline
\rowcolor{c2}
a circle Region & $\NC_i$ & $\NC_i$ is the number o & $M_4$ \\
\hline
\end{tabular}
\end{table}
\end{document}