![在表格中使用颜色时跨度规则消失](https://linux22.com/image/380686/%E5%9C%A8%E8%A1%A8%E6%A0%BC%E4%B8%AD%E4%BD%BF%E7%94%A8%E9%A2%9C%E8%89%B2%E6%97%B6%E8%B7%A8%E5%BA%A6%E8%A7%84%E5%88%99%E6%B6%88%E5%A4%B1.png)
大家好!这里我的需求是表格列具有不同的颜色和相应的跨度规则。当我们使用 \cline{} 时,它消失了,并被下一行颜色覆盖。请告诉我如何解决这个问题。
梅威瑟:
\documentclass{book}
%\usepackage{pdfx}
\usepackage{colortbl,multirow}
\begin{document}
\chapter{Sample title}
\section{Head one First}
Between 200BC and 100BC, during $\mathcal{A}$ the Han Dynasty, the Chinese used matrix-type methods with the text \textit{Nine chapters on the mathematical art}. There was further development, but it was not until 1683 when the idea of a determinant appeared in Japan when Seki wrote \textit{Method of solving the dissimulated problems}. This used matrix methods in tables in the same way as the earlier work of the Chinese. Ten years later the determinant first appeared in Europe in the work of Leibniz. The word determinant was first introduced by Gauss in 1801 while
discussing quadratic forms, but Cauchy in 1812 used determinant in the modern sense.
\begin{tabular}{|l|l|l|}
\hline
\textbf{Discussing quadratic} & \textbf{Modern sense} &\\
\hline
\cellcolor{green}Han Dynasty & \cellcolor{green}Chinese markup & \cellcolor{yellow} \\
\cline{1-2}
\cellcolor{green}Han Dynasty & \cellcolor{green}Chinese markup &\cellcolor{yellow}Poor ratio\\
\cline{1-2}
\cellcolor{green}Han Dynasty & \cellcolor{green}Chinese markup &\cellcolor{yellow}\\
\hline
\end{tabular}
\section{Head one Second}
Between 200BC and 100BC, during the Han Dynasty, the Chinese used matrix-type methods with the text \textit{Nine chapters on the mathematical art}. There was further development, but it was not until 1683 when the idea of a determinant appeared in Japan when Seki wrote \textit{Method of solving the dissimulated problems}. This used matrix methods in tables in the same way as the earlier work of the Chinese. Ten years later the determinant first appeared in Europe in the work of Leibniz. The word determinant was first introduced by Gauss in 1801 while discussing quadratic forms, but Cauchy in 1812 used determinant in the modern sense.
\end{document}
答案1
和彩色单元格的问题\cline
已为人所知。解决方法是使用与\hhline
颜色配合良好的:将 hhline 的最后一部分的颜色设置为黄色,然后将其恢复为黑色。
\documentclass{book}
\usepackage{colortbl,multirow, hhline}
\begin{document}
\chapter{Sample title}
\section{Head one First}
Between 200BC and 100BC, during $\mathcal{A}$ the Han Dynasty, the Chinese used matrix-type methods with the text \textit{Nine chapters on the mathematical art}. There was further development, but it was not until 1683 when the idea of a determinant appeared in Japan when Seki wrote \textit{Method of solving the dissimulated problems}. This used matrix methods in tables in the same way as the earlier work of the Chinese. Ten years later the determinant first appeared in Europe in the work of Leibniz. The word determinant was first introduced by Gauss in 1801 while
discussing quadratic forms, but Cauchy in 1812 used determinant in the modern sense.
\begin{center}
\aboverulesep = 0pt
\belowrulesep = 0pt
\begin{tabular}{|l|l|l|}
\hline
\textbf{Discussing quadratic} & \textbf{Modern sense} &\\
\hline
\cellcolor{green}Han Dynasty & \cellcolor{green}Chinese markup & \cellcolor{yellow} \\
\hhline{-->{\arrayrulecolor{yellow}}->{\arrayrulecolor{black}}|}
\cellcolor{green}Han Dynasty & \cellcolor{green}Chinese markup &\cellcolor{yellow}Poor ratio\\
\hhline{-->{\arrayrulecolor{yellow}}->{\arrayrulecolor{black}}|}
\cellcolor{green}Han Dynasty & \cellcolor{green}Chinese markup &\cellcolor{yellow}\\
\hline
\end{tabular}
\end{center}
\section{Head one Second}
Between 200BC and 100BC, during the Han Dynasty, the Chinese used matrix-type methods with the text \textit{Nine chapters on the mathematical art}. There was further development, but it was not until 1683 when the idea of a determinant appeared in Japan when Seki wrote \textit{Method of solving the dissimulated problems}. This used matrix methods in tables in the same way as the earlier work of the Chinese. Ten years later the determinant first appeared in Europe in the work of Leibniz. The word determinant was first introduced by Gauss in 1801 while discussing quadratic forms, but Cauchy in 1812 used determinant in the modern sense.
\end{document}