放大/缩小时表格内的线条会消失

放大/缩小时表格内的线条会消失

当我放大/缩小表格时,分隔线会根据缩放级别出现和消失。我尝试使用多个 pdf 查看器,但都无法解决问题。如果我从表格中删除颜色,则不再存在问题。为什么会发生这种情况?有人能帮我解决这个问题吗?

我正在使用这些颜色包,代码可以在下面看到。

\usepackage[dvipsnames]{xcolor}
\usepackage{colortbl}


\begin{table}[H]
\caption{Eksempler på søkeord og resultater}
\label{tabell_sokeord}
\resizebox{\textwidth}{!}{%
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{l|l|r|l}
\rowcolor[HTML]{C0C0C0}\textbf{Søkeord} & \textbf{Søkemotor} & \textbf{Antall resultater} & \textbf{Benyttet kilde} \\[6pt]  \hline 
\rowcolor[HTML]{F0F0F0} 4D & Google Scholar & 2 490 000 &  \\
\rowcolor[HTML]{E2E2E2}4D BIM & Google Scholar & 29 200 &  \\
\rowcolor[HTML]{F0F0F0} "4D BIM" & Google Scholar & 2 780 &  \\
\rowcolor[HTML]{E2E2E2}"4D BIM"\hspace{2pt}Modeling & Google Scholar & 2 710 &  \\
\rowcolor[HTML]{F0F0F0}"4D BIM"\hspace{2pt}Modeling & Google Scholar & 1 060 & \\
\rowcolor[HTML]{F0F0F0}(senere enn år 2016) & &&  \\
 \rowcolor[HTML]{E2E2E2}"4D BIM Modeling" & Google Scholar & 17 & Automated Mining of Construction Schedules \\
\rowcolor[HTML]{E2E2E2}(senere enn år 2016) & && for Easy and Quick Assembly of 4D BIM \\
\rowcolor[HTML]{E2E2E2} & & & Simulations\citep{torres-calderon_automated_2019}\\
\rowcolor[HTML]{F0F0F0}\textquotedbl4D BIM\textquotedbl\hspace{1pt}\&\hspace{1pt}\textquotedbl Safety planning\textquotedbl& Google Scholar & 335 & 4D-BIM for Construction Safety Planning \\
\rowcolor[HTML]{F0F0F0} &&& \citep{sulankivi_4d-bim_2010}
\end{tabular}% 
}
\renewcommand{\arraystretch}{1}
\end{table}

并非所有线条都显示出来

代码

答案1

(≥4.0){NiceTabular}的环境解决了您的问题。nicematrix

此包创建与表格中单元格位置相对应的 PGF/Tikz 节点,并将此信息写入文件中.aux。在第二次编译中,绘制了所有彩色面板所有规则。因此,PDF 查看器不会受到干扰(在 创建的 PDF 中colortbl,在对应于某一行的以下彩色矩形之前绘制了一条水平规则,而在光栅化过程中,许多查看器会优先考虑之后绘制的彩色矩形,从而擦除水平规则(取决于缩放级别))。

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage[T1]{fontenc}
\usepackage{nicematrix}
\usepackage{float}

\begin{document}

\begin{table}[H]
\caption{Eksempler på søkeord og resultater}
\label{tabell_sokeord}
\resizebox{\textwidth}{!}{%
\renewcommand{\arraystretch}{1.2}
\begin{NiceTabular}{L|L|R|L}[
code-before = \rowcolor[HTML]{C0C0C0}{1}
              \rowcolor[HTML]{F0F0F0}{2,4,6,7,11,12}
              \rowcolor[HTML]{E2E2E2}{3,5,8-10}
]
\textbf{Søkeord} & \textbf{Søkemotor} & \textbf{Antall resultater} & \textbf{Benyttet kilde} \\[6pt]  \hline 
 4D & Google Scholar & 2 490 000 &  \\
4D BIM & Google Scholar & 29 200 &  \\
 "4D BIM" & Google Scholar & 2 780 &  \\
"4D BIM"\hspace{2pt}Modeling & Google Scholar & 2 710 &  \\
"4D BIM"\hspace{2pt}Modeling & Google Scholar & 1 060 & \\
(senere enn år 2016) & &&  \\
"4D BIM Modeling" & Google Scholar & 17 & Automated Mining of Construction Schedules \\
(senere enn år 2016) & && for Easy and Quick Assembly of 4D BIM \\
 & & & Simulations\\
\textquotedbl4D BIM\textquotedbl\hspace{1pt}\&\hspace{1pt}\textquotedbl Safety planning\textquotedbl& Google Scholar & 335 & 4D-BIM for Construction Safety Planning \\
 &&& 
\end{NiceTabular}% 
}
\renewcommand{\arraystretch}{1}
\end{table}


\end{document}

您需要编译两次。

上述代码的结果

相关内容