1

The following table (How to remove extra black line coming in table due to hhline) is working fine in document class article but, the horizontal lines of table are not visible in beamer class.

\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} 

How do I make the horizontal lines to be visible in beamer environment as well?

ShJ
  • 891
  • 1
    Add this : \makeatletter\let\zz\reset@color\def\reset@color{\kern\z@\zz}\makeatother in your preamble as described here: https://tex.stackexchange.com/a/405021/120578 – koleygr Mar 04 '19 at 12:24
  • 1
    if you would consider https://tex.stackexchange.com/questions/477205/how-to-remove-extra-black-line-coming-in-table-due-to-hhline/477220#477220 answer, than you wouldn't have these problems ;-) – Zarko Mar 04 '19 at 12:46

2 Answers2

1

Possible duplicate of this, So, do not upvote:

Full solution:

\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} 

enter image description here

koleygr
  • 20,105
0

It's easy to do that table with {NiceTabular} of 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}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

F. Pantigny
  • 40,250