I liked the approach shown here. beautiful tables in latex. But when I use it in beamer class, tabularx conflicts with xcolor. What is the solution?
Asked
Active
Viewed 2,091 times
1
-
2if you want help with an error, please supply a small document that reproduces the error, what does "conflict" mean here? – David Carlisle Dec 16 '15 at 11:21
1 Answers
1
Beamer loads xcolor by itself. So if you want to use specific xcolor options (and the approach does) you have to pass them to beamer and not load xcolor again with these settings.
\documentclass[xcolor=usenames,dvipsnames]{beamer} % <-- set xcolor options here
\usepackage{tcolorbox}
\usepackage{tabularx}
\usepackage{array}
\usepackage{colortbl}
\tcbuselibrary{skins}
\newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
\tcbset{tab1/.style={fonttitle=\bfseries\large,fontupper=\normalsize\sffamily,
colback=yellow!10!white,colframe=red!75!black,colbacktitle=Salmon!40!white,
coltitle=black,center title,freelance,frame code={
\foreach \n in {north east,north west,south east,south west}
{\path [fill=red!75!black] (interior.\n) circle (3mm); };},}}
\tcbset{tab2/.style={enhanced,fonttitle=\bfseries,fontupper=\normalsize\sffamily,
colback=yellow!10!white,colframe=red!50!black,colbacktitle=Salmon!40!white,
coltitle=black,center title}}
\begin{document}
\begin{frame}{Nice Tables}
\begin{tcolorbox}[tab2,tabularx={X||Y|Y|Y|Y||Y}]
Group & One & Two & Three & Four & Sum \\\hline\hline
Red & 1000.00 & 2000.00 & 3000.00 & 4000.00 & 10000.00 \\\hline
Green & 2000.00 & 3000.00 & 4000.00 & 5000.00 & 14000.00 \\\hline
Blue & 3000.00 & 4000.00 & 5000.00 & 6000.00 & 18000.00 \\\hline\hline
Sum & 6000.00 & 9000.00 & 12000.00 & 15000.00 & 42000.00
\end{tcolorbox}
\end{frame}
\end{document}
Benjamin
- 4,781