From d46c5440d26b860244cb7a012e500a368e944d66 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Fri, 31 May 2024 11:39:00 +0200 Subject: [PATCH] added colored tables --- TODO.md | 1 - ppexample.tex | 16 ++++++++++++++++ psipresentation.cls | 18 +++++++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) delete mode 100644 TODO.md diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 48ab372..0000000 --- a/TODO.md +++ /dev/null @@ -1 +0,0 @@ - Add colored tables diff --git a/ppexample.tex b/ppexample.tex index 4768405..3460e98 100644 --- a/ppexample.tex +++ b/ppexample.tex @@ -181,6 +181,22 @@ Aenean commodo ligula eget dolor.\\ Aenean massa. \end{divider} + +\begin{frame}{Tables} + +% ctabular expects three arguments: +% column specifiers (LCR), row background color (purple), header text color (white). +% the new specifiers (LCR) replace the default specifiers (lcr) in order to apply the header text color. + +\begin{ctabular}{LCR}{purple}{white} +Title L & Title C & Title R\\ +Text & Text & Text\\ +Text & Text & Text\\ +Text & Text & Text\\ +Text & Text & Text\\ +\end{ctabular} +\end{frame} + \end{document} diff --git a/psipresentation.cls b/psipresentation.cls index 52a2547..27c6dc3 100644 --- a/psipresentation.cls +++ b/psipresentation.cls @@ -5,7 +5,7 @@ \DeclareOption*{\PassOptionsToClass{\CurrentOption}{beamer}} \ProcessOptions\relax -\LoadClass[final, 10pt, aspectratio=169]{beamer} % t: align columns to top +\LoadClass[final, 10pt, aspectratio=169, xcolor=table]{beamer} % t: align columns to top \beamertemplatenavigationsymbolsempty @@ -266,3 +266,19 @@ BoldItalicFont = *-Bold-Italic +% colored tables + +\newenvironment{ctabular}[3]{ + \newcolumntype{L}{>{\ifnumequal{\rownum}{1}{\bfseries\color{#3}}}l} + \newcolumntype{C}{>{\ifnumequal{\rownum}{1}{\bfseries\color{#3}}}c} + \newcolumntype{R}{>{\ifnumequal{\rownum}{1}{\bfseries\color{#3}}}r} + + \rowcolors{2}{#2!20}{#2!10} + \begin{tabular}{#1} + \rowcolor{#2} +}{ + \end{tabular} +} + + +