简体   繁体   中英

Latex hline does not work with rowcolor?

\begin{tabularx}{\textwidth}{ |X|X|X| }

    \hline

    \rowcolor{fapsgrau1}\global\setlength\arrayrulewidth{0.4pt}

    \textbf{Länge}          & \textbf{Breite}       & \textbf{Höhe} \\
    \hline
    & 115           & \\
    & 120           & \\
    240 (248)       & 150           & 52 \\
    300 (298) (308) & 175           & 200 \\
    & 200           & 113 (123) \\
    490 (498)       & 240           & 155 \\
    (623)           & 300           & 238 (248) \\
    & 365           & \\
    \hline
\end{tabularx}

How do i need to change the code that the hline on the top is seen and that the lines continue to the top? (cannot upload the picture)

What you're witnessing is an artifact of the PDF viewer, not the LaTeX code. Let's look at a comparison between three PDF viewers:

  1. SumatraPDF
  2. Adobe Acrobat Reader DC
  3. Foxit Reader

Here are different zoom levels for the same table:

  • SumatraPDF @ 150%

    在此处输入图片说明

  • Adobe Acrobat Reader DC @ 150%

    在此处输入图片说明

  • Foxit Reader @ 150%

    在此处输入图片说明

Sumatra shows all the lines around the coloured header, as does Foxit. Adobe Reader doesn't show the top/left rules.


  • SumatraPDF @ 200%

    在此处输入图片说明

  • Adobe Acrobat Reader DC @ 200%

    在此处输入图片说明

  • Foxit reader @ 200%

    在此处输入图片说明

SumatraPDF again shows all rules, while Adobe Reader and Foxit seems to miss the left rule in the header.

As you should be able to see, it's zoom, but also viewer-dependent. Viewers tend to render the output and make it snap to visible pixels. In some of these calculations, there may be rounding that causing visuals to differ from the actual.

Printing will be correct, regardless of the reader.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM