2

currently, I want to color my tables. However, presumably since I'm using the listings package, I can't apply the abovementioned packages, as they totally mess up the default table looks (lines between columns/rows are suddenly bold). Are there any possibilities to color my tables while using listings and one of these packages?

Here's a short MWE:

\documentclass[a4paper,12pt,parskip,bibtotoc,liststotoc]{article}
\usepackage[utf8x]{inputenc}  
\usepackage{fontenc}
\usepackage[english]{babel}
\usepackage{listings}
\usepackage{colortbl}

\begin{document}

\begin{table}[ht]
 \begin{center}
 \vspace*{1mm}
 \begin{tabular}{|l|l|l|} %hier die Spaltenausrichtung, -breite, -begrenzung und -anzahl eintragen

        \hline
        XYZ & ABC \\ \hline
        XXX & YYY\\
        & Lorem\\
        & Ipsum\\
        & Dolores est\\
        \hline 
 \end{tabular} \\[2mm]
\setlength{\belowcaptionskip}{-15pt}
 \caption{Attributes station class} \label{Table6}
 \end{center}
\end{table}

\end{document}

You should see the issue I'm talking about when using it.

edit: I now updated my miktex version and everything is still screwed. However, here is a link to a picture depicting the issues:

enter image description here

you can see that the lines between the customer type and the setting is bold. I dont want it to be bold, since most other lines aren't.

edit 2: It comes even worse: when I use the \rowcolor command the table borders get completely messed up, as some borders between columns completely disappear. Here's a pic and the respective code:

enter image description here

\begin{table}[htb!]
\begin{center}
 \begin{tabular}{|l|l|l|l|l|l|} %hier die Spaltenausrichtung, -breite, -begrenzung und -anzahl eintragen
        \hline
        \rowcolor{Gray}
        Day & Customer type & Setting 1 & Setting 2\\ \hline
        &1 &\multicolumn{1}{|r|}{25} & \multicolumn{1}{|r|}{35}\\
        &2 & \multicolumn{1}{|r|}{3} & \multicolumn{1}{|r|}{6}\\
        &3 & \multicolumn{1}{|r|}{1} & \multicolumn{1}{|r|}{2}\\ \hline
        \rowcolor{Gray}
        Night&Customer type &Setting 1&Setting 2\\ \hline
        &1 &\multicolumn{1}{|r|}{25} & \multicolumn{1}{|r|}{35}\\
        &2 & \multicolumn{1}{|r|}{3} & \multicolumn{1}{|r|}{6}\\
        &3 & \multicolumn{1}{|r|}{1} & \multicolumn{1}{|r|}{2}\\        
\hline 
 \end{tabular} \\[2mm]
 \caption{Setting of possible system settings} \label{Table4}
 \end{center}
\end{table}
7
  • 1
    The correct name of the package is colortbl and not colorbtl!
    – Mensch
    Sep 18, 2014 at 11:00
  • 1
    i don't see the issue you're talking about. what engine are you using? what vintage of tex distro? (i tried "unadorned" tex, pdftex "explicitly", xelatex and lualatex, all from my tl'14 installation). Sep 18, 2014 at 11:25
  • I'm using pdflatex+Makeindex+Bibtex in Miktex. My miktex versions is, however, quite old (about 3 years I guess).
    – Atlan
    Sep 18, 2014 at 11:27
  • @Atlan Three... years...! Time to update.
    – jub0bs
    Sep 18, 2014 at 11:56
  • You can be pretty confident that if updating to MikTeX 2.9 is screwing up things, it's the document not the distro as the culprit unless it is about engine problems such as luaotfload or some naming convention.
    – percusse
    Sep 18, 2014 at 14:37

1 Answer 1

3

The issue is nothing to do with listings, the lines are bold as you have specified two adjacent rules.

  &1 &\multicolumn{1}{|r|}{25} & \multicolumn{1}{|r|}{35}\\

specifies a rule at the right edge of one column and the left edge of the next so you get two rules which look like one double thickness rule.

All latex inter-column material is on the right edge except for the first column, which has left and right so it should be

&1 &\multicolumn{1}{r|}{25} & \multicolumn{1}{r|}{35}\\
2
  • 1
    Ow - so that happens if you simply copy code. Those were solutions for aligning data in tables that were written by someone else. I didn't know that they implied some further options. I'll change the code asap and I will let you know of the outcome. In any case, I'll probably accept your answer :)
    – Atlan
    Sep 18, 2014 at 17:13
  • You were totally right, the multicoloumns were the problem :)
    – Atlan
    Sep 19, 2014 at 15:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .