\hline 在表格内不起作用

\hline 在表格内不起作用

我想要表格中每行之间的水平线。我为表格使用了此代码。但是,它只显示垂直线。

这是我的代码(请忽略表内的值)

\begin{table}[h]
\caption{Comparison of Accuracy, Precision and Recall}
\label{table_example}
\begin{tabular}{|c||c|c|c|c|c|c|}
\hline
Method & Accuracy & Precision & Recall \\
\hline
Author 1 (2019) & 97.93 & 76.72 & 76.72\\
\hline
Author 2 (2017) & 93.36 & 0.78 & 76.72\\
\hline
Author 3 (2019) & 0.91 & 0.90 & 76.72\\
\hline
Author 4 (2019) & 0.91 & 0.90 & 76.72\\
\hline
Author 5 (2018) & 0.91 & 0.90 & 76.72\\
\hline
Author 6 & 0.91 & 0.90 & 76.72\\
\hline
\end{tabular}
\end{table}

显示效果如下,我尝试用其他浏览器查看,没有出现横线。 在此处输入图片描述


附录:以下是序言内容:

\documentclass[conference]{IEEEtran}
\usepackage[pdftex]{graphicx} 
\graphicspath{{../pdf/}{../jpeg/}} 
\DeclareGraphicsExtensions{.pdf,.jpeg,.png} 
\usepackage[cmex10]{amsmath} 
\usepackage{tabularx} 
\usepackage{colortbl} 
\usepackage{mathabx} 
\usepackage{algorithmic} 
\usepackage{array} 
\usepackage{mdwmath} 
\usepackage{mdwtab} 
\usepackage{eqparbox} 
\usepackage{url}

编辑-[已解决]通过删除mdwtab

答案1

您报告说序言同时加载了mdwtab包和colortbl包。这两个包之间似乎存在一个不幸的 [!] 交互,导致绘制的线条\hline呈现为白色,因此变得不可见。一旦您停止加载包mdwtabcolortbl包,水平线就会重新出现。

您需要决定是否可以不使用mdwtaband/orcolortbl包(或两者!)。如果可以,问题将得到解决。

在下面的 MWE(最小工作示例)中,通过不加载mdwtabmdwmath包解决了该问题。

在此处输入图片描述

\documentclass[conference]{IEEEtran}
\usepackage[pdftex]{graphicx} 
\graphicspath{{../pdf/}{../jpeg/}} 
\DeclareGraphicsExtensions{.pdf,.jpeg,.png} 
\usepackage[cmex10]{amsmath} 
\usepackage{tabularx} 
\usepackage{colortbl} 
\usepackage{mathabx} 
\usepackage{algorithmic} 
%\usepackage{array} % is loaded automatically by 'tabularx'
% The next two packages haven't been updated in decades
%%%\usepackage{mdwmath} 
%%%\usepackage{mdwtab} 
\usepackage{eqparbox} 
\usepackage{url}

\begin{document}
\begin{table}
\centering
\setlength\extrarowheight{1pt}
\caption{Comparison of Accuracy, Precision and Recall}
\label{table_example}
\begin{tabular}{|l||c|c|c|c|c|c|}
\hline
Method & Accuracy & Precision & Recall \\
\hline
Author 1 (2019) & 97.93 & 76.72 & 76.72\\
\hline
Author 2 (2017) & 93.36 & 0.78 & 76.72\\
\hline
Author 3 (2019) & 0.91 & 0.90 & 76.72\\
\hline
Author 4 (2019) & 0.91 & 0.90 & 76.72\\
\hline
Author 5 (2018) & 0.91 & 0.90 & 76.72\\
\hline
Author 6 & 0.91 & 0.90 & 76.72\\
\hline
\end{tabular}
\end{table}
\end{document}

答案2

为了看到,如果是颜色或者厚度问题(白线或太细看不清)请执行以下操作:(如上所述)在这条线颜色问题) 和线宽粗细问题 加载颜色包加载厚度\usepackage{colortbl}\usepackage{makecell}

并写\arrayrulecolor{black}\hline 为 and/Or\Xhline{5pt}而不是\hline

例如:

\usepackage{colortbl}
\usepackage{makecell}

...

\begin{table}[h]
\caption{Comparison of Accuracy, Precision and Recall}
\label{table_example}
\begin{tabular}{|c||c|c|c|c|c|c|}
\arrayrulecolor{black}\hline %Forcing black colour in the \hline
Method & Accuracy & Precision & Recall \\
\arrayrulecolor{black}\Xhline{5pt} %Forcing black colour and 5pt thickness
Author 1 (2019) & 97.93 & 76.72 & 76.72\\
\arrayrulecolor{blue}\hline %Forcing blue colour in the \hline
Author 2 (2017) & 93.36 & 0.78 & 76.72\\
\hline
Author 3 (2019) & 0.91 & 0.90 & 76.72\\
\hline
Author 4 (2019) & 0.91 & 0.90 & 76.72\\
\hline
Author 5 (2018) & 0.91 & 0.90 & 76.72\\
\hline
Author 6 & 0.91 & 0.90 & 76.72\\
\hline
\end{tabular}
\end{table}

那么现在,如果它是两个问题之一,你就会

相关内容