文章文档类中的表格中有水平线,但在投影仪中不可见

文章文档类中的表格中有水平线,但在投影仪中不可见

下表(如何删除由于 hhline 而出现在表格中的多余黑线) 在文档类中运行良好,article但是表格的水平线在beamer类中不可见。

\documentclass{article}
 \usepackage{hhline}
  \usepackage[table, svgnames]{xcolor}

  \usepackage{multirow}
 \usepackage{booktabs}

 \definecolor{Aliceblue}{rgb}{0.94, 0.97, 1.0}
\definecolor{aliceblue}{rgb}{0.94, 0.97, 1.0}

\definecolor{babyblue}{rgb}{0.54, 0.81, 0.94}

 \begin{document}

  \begin{table}[ht]
\centering
\setlength\arrayrulewidth{1.3pt}
\footnotesize\setlength{\tabcolsep}{2.7 pt}
\renewcommand{\arraystretch}{1.4}
\begin{tabular}{|c|c|c|c|c|c|c|}
    \hline
    \cellcolor{aliceblue}  & \multicolumn{2}{c|}{\cellcolor{babyblue}ISE} & \multicolumn{2}{c|}{\cellcolor{babyblue}IAE} & \multicolumn{2}{c|}{\cellcolor{babyblue}ITAE} \\ 
    \hhline{|>{\arrayrulecolor{aliceblue}}->{\arrayrulecolor{black}}|-|-|-|-|-|-|} % <==========================================
    \multirow{-2}{*}{\cellcolor{aliceblue}Methods}
    & \cellcolor{aliceblue}-20\%       & \cellcolor{aliceblue}+20\%     & \cellcolor{aliceblue}-20\%        & \cellcolor{aliceblue}+20\%      & \cellcolor{aliceblue}-20\%       & \cellcolor{aliceblue}+20\%        \\ \hhline{-|*6-}
    \rowcolor{babyblue}ABC                                                           & 0.5645      & 0.63     & 1.8       & 1.8      & 6.1       & 6.6       \\ \hhline{-|*6-}
    \rowcolor{aliceblue}XYZ                                                            & 2.1       & 2.3      & 0.881       & 9.82      & 9.2       & 28.9       \\ \hhline{-|*6-}
    \rowcolor{babyblue}MNO                                                                & 0.68      & 0.97     & 1.62       & 1.61      & 8.9       & 8.2       \\ \hhline{-|*6-}
    \rowcolor{aliceblue} PQR                                                                 & 0.65       & 0.753     & 2.064       & 2.231      & 28.04       & 28.56       \\ \hhline{-|*6-}
\end{tabular}
\end{table}
\end{document} 

我如何才能使水平线在beamer环境中也可见?

答案1

可能重复,所以,不要点赞:

完整解决方案:

\documentclass[xcolor=table]{beamer}
 \usepackage{hhline}
\makeatletter
\let\zz\reset@color
\def\reset@color{\kern\z@\zz}
\makeatother

  \usepackage{multirow}
 \usepackage{booktabs}

 \definecolor{Aliceblue}{rgb}{0.94, 0.97, 1.0}
\definecolor{aliceblue}{rgb}{0.94, 0.97, 1.0}

\definecolor{babyblue}{rgb}{0.54, 0.81, 0.94}

 \begin{document}
\begin{frame}
  \begin{table}[ht]
\centering
\setlength\arrayrulewidth{1.3pt}
\footnotesize\setlength{\tabcolsep}{2.7 pt}
\renewcommand{\arraystretch}{1.4}
\begin{tabular}{|c|c|c|c|c|c|c|}
    \hline
    \cellcolor{aliceblue}  & \multicolumn{2}{c|}{\cellcolor{babyblue}ISE} & \multicolumn{2}{c|}{\cellcolor{babyblue}IAE} & \multicolumn{2}{c|}{\cellcolor{babyblue}ITAE} \\ 
    \hhline{|>{\arrayrulecolor{aliceblue}}->{\arrayrulecolor{black}}|-|-|-|-|-|-|} % <==========================================
    \multirow{-2}{*}{\cellcolor{aliceblue}Methods}
    & \cellcolor{aliceblue}-20\%       & \cellcolor{aliceblue}+20\%     & \cellcolor{aliceblue}-20\%        & \cellcolor{aliceblue}+20\%      & \cellcolor{aliceblue}-20\%       & \cellcolor{aliceblue}+20\%        \\ \hhline{-|*6-}
    \rowcolor{babyblue}ABC                                                           & 0.5645      & 0.63     & 1.8       & 1.8      & 6.1       & 6.6       \\ \hhline{-|*6-}
    \rowcolor{aliceblue}XYZ                                                            & 2.1       & 2.3      & 0.881       & 9.82      & 9.2       & 28.9       \\ \hhline{-|*6-}
    \rowcolor{babyblue}MNO                                                                & 0.68      & 0.97     & 1.62       & 1.61      & 8.9       & 8.2       \\ \hhline{-|*6-}
    \rowcolor{aliceblue} PQR                                                                 & 0.65       & 0.753     & 2.064       & 2.231      & 28.04       & 28.56       \\ \hhline{-|*6-}
\end{tabular}
\end{table}
\end{frame}
\end{document} 

在此处输入图片描述

答案2

{NiceTabular}使用来制作该表很容易nicematrix

\documentclass[xcolor]{beamer}
\usepackage{nicematrix}


\definecolor{aliceblue}{rgb}{0.94, 0.97, 1.0}
\definecolor{babyblue}{rgb}{0.54, 0.81, 0.94}

\begin{document}
\begin{frame}
\begin{table}[ht]
\centering
\setlength{\arrayrulewidth}{1.3pt}
\footnotesize
\setlength{\tabcolsep}{2.7 pt}
\renewcommand{\arraystretch}{1.4}
\begin{NiceTabular}{ccccccc}[hvlines]
\CodeBefore
  \rowcolors{1}{babyblue}{aliceblue}
\Body
  \Block[fill=aliceblue]{2-1}{Methods} & \Block{1-2}{ISE} && \Block{1-2}{IAE} && \Block{1-2}{ITAE} \\ 
      &$-$20\%   & +20\%  & $-$20\%  & +20\% & $-$20\% & +20\%  \\
  ABC & 0.5645 & 0.63   & 1.8    & 1.8   & 6.1   & 6.6    \\ 
  XYZ & 2.1    & 2.3    & 0.881  & 9.82  & 9.2   & 28.9   \\ 
  MNO & 0.68   & 0.97   & 1.62   & 1.61  & 8.9   & 8.2    \\ 
  PQR & 0.65   & 0.753  & 2.064  & 2.231 & 28.04 & 28.56  \\ 
\end{NiceTabular}
\end{table}
\end{frame}
\end{document} 

您需要多次编译(因为nicematrix在后台使用 PGF/Tikz 节点)。

上述代码的输出

相关内容