added colored tables

This commit is contained in:
2024-05-31 11:39:00 +02:00
parent b4a0f55297
commit d46c5440d2
3 changed files with 33 additions and 2 deletions

View File

@@ -1 +0,0 @@
Add colored tables

View File

@@ -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}

View File

@@ -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}
}