Graphics, Figures & Tablestable not working with \usepackage[table]{xcolor}

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
marek_step
Posts: 27
Joined: Sun Aug 19, 2012 8:48 am

table not working with \usepackage[table]{xcolor}

Post by marek_step »

Hello all!

A funny issue. No idea what's going on here: in the following MWE comment (or out) the \usepackage[table]{xcolor} and the corresponding } marked with a comment. With the colours the numbers are eaten in the resulting pdf ...

Thank you in advance for every hint!

marek

Code: Select all

\documentclass[a4paper,landscape]{article}
\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{bm} % to get bold math symbols
\usepackage[table]{xcolor} 
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\usepackage{booktabs}
\usepackage{makecell}
\renewcommand\theadalign{bc}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}
\usepackage[official]{eurosym}

\setlength{\parindent}{0em}

\begin{document}

\begin{table*}\centering
\ra{1.3}
{\rowcolors{2}{green!80!yellow!50}{green!60!yellow!30}
\begin{tabular}{l  c r@{ - }l r@{ - }l r@{.}l r@{.}l r@{.}l}
  \thead{Flughafen} & \thead{City\\($\bm{\approx{}km$})} & \multicolumn{2}{c}{\thead{Wartezeit\\($\bm{\approx{}Std$})}} & \multicolumn{2}{c}{\thead{Fahrzeit\\($\bm{\approx{}min}$)}} & \multicolumn{2}{c}{\thead{Fahrpreis City\\($\bm{\approx{}}$ \euro{})}} & \multicolumn{2}{c}{\thead{Jahresplakette\\($\bm{\approx{}}$ \euro{})}} & \multicolumn{2}{c}{\thead{Gebühren\\($\bm{\approx{}}$ \euro{})}}\\
\toprule
München & 38 &  3 & 4 & 30 & 60 & 70 & 00 & 360 & 00 & 1 & 50\\ \hline
Frankfurt & 20  &  3 & 5 & 30 & 60 & 2 & 00 & \multicolumn{2}{c}{\o} & 30 & 00\\
\hline
Berlin & 20   &  3 & 5 & 30 & 60 & 2 & 00 & 97 & 00 & 30 & 00\\
\hline
Athen & 20   &  3 & 5 & 30 & 60 & 2 & 00 & 97 & 00 & 30 & 00\\
\hline
Paris 1 (Charles de Gaulle) & 20  &  3 & 5 & 30 & 60 & 50/55 & 00 & 97 & 00 & 30 & 00\\
\hline
Paris 2 (Orly) & 20   &  3 & 5 & 30 & 60 & 30/35 & 00 & 97 & 00 & 30 & 00\\
\hline
London Heathrow & 20   &  3 & 5 & 30 & 60 & 2 & 00 & 97 & 00 & 30 & 00\\
\hline
London Stansted & 20  &   3 & 5 & 30 & 60 & 2 & 00 & 97 & 00 & 30 & 00\\
\hline
London City & 20   &  3 & 5 & 30 & 60 & 2 & 00 & 97 & 00 & 30 & 00\\
\hline
Madrid-Barajas Airport & 20  &  3 & 5 & 30 & 60 & 30 & 00 & 97 & 00 & 30 & 00\\
\hline
Lissabon & 20  &  3 & 5 & 30 & 60 & 2 & 00 & 97 & 00 & 30 & 00\\
\bottomrule
\end{tabular}
} % This is the end } of the table color line above
\caption{Gebühren für Taxiunternehmen und -fahrer an Europäischen Flughäfen}
\end{table*}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

table not working with \usepackage[table]{xcolor}

Post by Stefan Kottwitz »

Hi Marek!

\rowcolors colors the whole row, including the separation space. @{...} is for changing that space, such as by \hspace within, and that should be colored too. Howewer, you use the @{...} syntax for inserting actual text. That's not uncommon, but probably not foreseen with that feature.

In that case I would not use @{...} for inserting dashes or dots. It's probably not the correct spacing around such symbols or relations signs anyway, since it's a tabular intercolumn space and no standard spacing.

I would write the . and - just as usual in the table cell. The alignment may be ok still since the stuff is of the same width. Or one could use dcolumn or siunitx for alignment.

Stefan
LaTeX.org admin
marek_step
Posts: 27
Joined: Sun Aug 19, 2012 8:48 am

table not working with \usepackage[table]{xcolor}

Post by marek_step »

Thank you Stefan for your reply. I will look into the manuals of siunits and dcolumn

Best greetings to all!


marek
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

table not working with \usepackage[table]{xcolor}

Post by Stefan Kottwitz »

By the way, it's siunitx with an x at the end, to distinguish it from the older siunits package. siunitx is the best and modern choice for formatting units. Note, in that example the units are italic, with math font and not proper kerning. Units are commonly written upright. siunitx provides a syntax and does the formatting right. In addition, it provides a table feature with alignment.

Link: http://mirrors.ctan.org/macros/latex/co ... iunitx.pdf

Stefan
LaTeX.org admin
Post Reply