2

I have a longtable with some thick horizontal lines (I know and agree, lines are ugly, but I have to do it). Works good with package boldline and \clineB. But it interferes with colored Columns.

Am I able to fix this?

The example is completely stripped, in realiter it is much more complex, with some codechange in \LT@output for footer and header value-overflows

\documentclass[12pt]{article}
\usepackage{longtable}
\usepackage[table]{xcolor}
\usepackage{boldline}
\definecolor{Gray}{gray}{0.85}
\newcolumntype{g}{>{\columncolor{Gray}}r}
\newcolumntype{G}[1]{>{\columncolor{Gray}}p{#1}}
\begin{document}
\begin{longtable}{@{}|p{2cm}|G{3cm}|c|}\hline
Ueb1 & Ueb2 & Ueb3\\\hline
Zeile1 & Inhalt & Inhalt\\\hline
Zeile2 & Inhalt & Inhalt\\\clineB{1-1}{4}\clineB{2-2}{6}\clineB{3-3}{4}
Zeile3 & Inhalt & Inhalt\\\hline
\end{longtable}
\end{document}

i have seen this (https://golatex.de/problem-mit-cline-und-hintergrundfarbe-von-spalten-t12684.html), but I could get the soulutions to work with my setup.

  • Do you want a thick rule in the coloured column, or no rule at all? – Bernard Jun 29 '18 at 13:05
  • I want a thicker line in the coloured column than in the other two the left and right. – Peter Miehle Jun 29 '18 at 13:33
4

Boldline, and the bold lines from makecell have problems with colour in tables. For lines of variable widths, you can load booktabs and neutralise locally the padding added around the rules, or use the \specialrule command, which lets you set the width, padding above and padding below:

\documentclass[12pt]{article}
\usepackage{longtable}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\usepackage{boldline}
\definecolor{Gray}{gray}{0.85}
\newcolumntype{g}{>{\columncolor{Gray}}r}

\begin{document}

\begin{longtable}{@{}|c|g|c|}\hline
Ueb1 & Ueb2 & Ueb3\\\hline
Zeile1 & Inhalt & Inhalt\\\hline
Zeile2 & Inhalt & Inhalt\\
\specialrule{1.6pt}{0pt}{0pt}%
Zeile3 & Inhalt & Inhalt\\\hline
\end{longtable}

\end{document} 

enter image description here

In case you want a horizontal rule to have a varying width (depending on the column), it's easy to obtain with booktabs \cmidrules, but this will result in gaps in the vertical rules. So I suggest a plain \hline with a series of convenient \hhlines above and below, like this code

\begin{longtable}{@{}|p{2cm}|G{3cm}|c|}
\hline
Ueb1 & Ueb2 & Ueb3\\\hline
Zeile1 & Inhalt & Inhalt\\\hline
Zeile2 & Inhalt & Inhalt\\
\hhline{|~|-|~|}
\hhline{|~|-|~|}
\hline
\hhline{|~|-|~|}
\hhline{|~|-|~|}
Zeile3& Inhalt & Inhalt \\
\hline
\end{longtable}

enter image description here

  • can I use \specialrule in combination with \cline? – Peter Miehle Jun 29 '18 at 13:29
  • I want a thicker line in the coloured column than in the other two the left and right. – Peter Miehle Jun 29 '18 at 13:33
  • Oh! I see. I'll try to post something in a moment. – Bernard Jun 29 '18 at 13:34
  • ah, and btw, I have changed the example to a p{}-column, so I do not know the height? – Peter Miehle Jun 29 '18 at 13:36
  • @PeterMiehle: I've added a code based on hhline (looks like a hack, but I found no other way to obtain this result). Is it what you try to achieve? – Bernard Jun 29 '18 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.