Graphics, Figures & TablesTable borderlines not appearing on pdf

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
piantap
Posts: 2
Joined: Wed Apr 29, 2020 9:53 pm

Table borderlines not appearing on pdf

Post by piantap »

Hello all,
I'ven trying to find an answer to my problem but I have failed.
I'll try to explain it as clearly as possible.

I'm using overleaf to write some text that includes a table, which compiles without errors and even shows as it should on the built in pdf viewer. The thing es when I extract the pdf some of the table border lines disappear. Evenmore the lines appear and disappear depending on the current zoom on the pdf file.

This is how the table should look, and looks on overleaf
tablabien.png
tablabien.png (10.92 KiB) Viewed 4529 times
And this is how it looks once extracted to a pdf
tablamal.png
tablamal.png (20.64 KiB) Viewed 4529 times
Below is the code I'm using:

\usepackage{multirow}
\usepackage{booktabs}
\usepackage{hhline}
\usepackage[table]{xcolor}
\begin{document}

\begin{table}[h]
\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
\hline
\rowcolor[HTML]{A4CAF6}
\multicolumn{1}{|c|}{\cellcolor[HTML]{A4CAF6}} & \multicolumn{8}{c|}{\cellcolor[HTML]{A4CAF6}Temperatura $[^{\circ}C]$} & \cellcolor[HTML]{A4CAF6} \\ \cline{2-9}
\rowcolor[HTML]{A4CAF6}
\multicolumn{1}{|c|}{\multirow{-2}{*}{\cellcolor[HTML]{A4CAF6}Propiedad}} & 25 & 50 & 100 & 150 & 200 & 250 & 300 & 350 & \multirow{-2}{*}{\cellcolor[HTML]{A4CAF6}Referencia} \\ \hline
\rowcolor[HTML]{FFFFC7}
$Rp_{0,2} [MPa]$ & & & & & & & & & \\ \hline
\rowcolor[HTML]{CFCFCF}
$UTS [MPa]$ & & & & & & & & & \\ \hline
\end{tabular}
\end{table}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Table borderlines not appearing on pdf

Post by Bartman »

Please pay attention to a complete example.

\cline does not create the desired horizontal line in a colored table, regardless of the pdf viewer. According to colortbl's documentation, you should replace the command with another whose package you are already loading.

You can avoid these problems with the coloring and the lines, if you are allowed to design the table with the help of the package booktabs already loaded in your preamble.

A suggestion:

Code: Select all

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
\begin{table}[htbp]
    \centering
    \begin{tabular}{l*8cl}
    \toprule
    Propiedad & \multicolumn{8}{c}{Temperatura [\si{\celsius}]} & Referencia\\ 
    \cmidrule(lr){2-9}
    & 25 & 50 & 100 & 150 & 200 & 250 & 300 & 350 & \\ 
    \midrule
    $Rp_{0,2}$ [\si{\MPa}] & & & & & & & & & \\ 
    \addlinespace
    UTS [\si{\MPa}] & & & & & & & & & \\
    \bottomrule
    \end{tabular}
\end{table}
\end{document}
For further use, the siunitx package would have to be adapted for the language area using its options.
piantap
Posts: 2
Joined: Wed Apr 29, 2020 9:53 pm

Table borderlines not appearing on pdf

Post by piantap »

Thank your for your response.

I used the design of your table but I want to keep colours.

Do you know how to remove the white spaces surroundung the top/middle/bottom rules and the one on the Propiedades and Referencias cells?
tabla.png
tabla.png (7.56 KiB) Viewed 4476 times

\documentclass{article}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{hhline}
\usepackage[table]{xcolor}

\begin{document}

\begin{table}[h]
\centering
\begin{tabular}{l*8cl}
\toprule
\rowcolor[HTML]{A4CAF6}
\multicolumn{1}{c}{\cellcolor[HTML]{A4CAF6}} & \multicolumn{8}{c}{\cellcolor[HTML]{A4CAF6}Temperatura $[^{\circ}C]$} & \cellcolor[HTML]{A4CAF6} \\ \cmidrule(lr){2-9}
\rowcolor[HTML]{A4CAF6}
\multicolumn{1}{c}{\multirow{-2}{*}{\cellcolor[HTML]{A4CAF6}Propiedad}} & 25 & 50 & 100 & 150 & 200 & 250 & 300 & 350 & \multirow{-2}{*}{\cellcolor[HTML]{A4CAF6}Referencia} \\
\rowcolor[HTML]{FFFFC7}
$Rp_{0,2} [MPa]$ & & & & & & & & & \\
\rowcolor[HTML]{CFCFCF}
$UTS [MPa]$ & & & & & & & & & \\ \bottomrule
\end{tabular}
\end{table}

\end{document}
Post Reply