Deyan Ginev edited subsection_Advanced_Table_Colors_In__.tex  almost 9 years ago

Commit id: 34b090371dcc75bc0a87dbf227f1677ea1f815d1

deletions | additions      

       

\subsection{Advanced Table Colors}  \subsubsection{Row Colors}  In Section \ref{sec:textcolor} we showed the extended set of colors available through the \verb|xcolor.sty| package. For tables, however, it is also useful to have control over the background color of individual rows. For instance:  \begin{lstlisting}   {\rowcolors{4}{green!80!yellow!50}{green!70!yellow!40}  \begin{tabular}{ |c|c|c|c|c| }  \hline  \multicolumn{5}{|c|}{An Example of Row Colors} \\  \hline  \multicolumn{5}{|c|}{Heading can be White} \\  \hline  \multicolumn{5}{|c|}{Light Green} \\  \multicolumn{5}{|c|}{Dark Green} \\  \multicolumn{5}{|c|}{Light Green} \\  \multicolumn{5}{|c|}{Dark Green} \\  \hline  \end{tabular} }  \end{lstlisting}  %%%  {\rowcolors{4}{green!80!yellow!50}{green!70!yellow!40}  \begin{tabular}{ |c|c|c|c|c| }  \hline  \multicolumn{5}{|c|}{An Example of Row Colors} \\  \hline  \multicolumn{5}{|c|}{Heading can be White} \\  \hline  \multicolumn{5}{|c|}{Light Green} \\  \multicolumn{5}{|c|}{Dark Green} \\  \multicolumn{5}{|c|}{Light Green} \\  \multicolumn{5}{|c|}{Dark Green} \\  \hline  \end{tabular} }  %%%%%%%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%  \subsubsection{Backgrounds for Individual Cells}  \begin{lstlisting}  \setlength{\arrayrulewidth}{1mm}  \setlength{\tabcolsep}{18pt}  \renewcommand{\arraystretch}{2.5}    {\rowcolors{4}{green!80!yellow!50}{green!70!yellow!40}  \begin{tabular}{ |c|c|c|c|c| }  \hline 

\end{tabular} }  \end{lstlisting}  %%%  \setlength{\arrayrulewidth}{1mm}  \setlength{\tabcolsep}{18pt}  \renewcommand{\arraystretch}{2.5}    {\rowcolors{4}{green!80!yellow!50}{green!70!yellow!40}  \begin{tabular}{ |c|c|c|c|c| } 

Name & \multicolumn{3}{|c|}{Performance} & Memory \\ \cline{2-4}  & Best & Average & Worst & \\   \hline  \multicolumn{5}{c}{Light \multicolumn{5}{|c|}{Light  Green} \\ \multicolumn{5}{c}{Dark \multicolumn{5}{|c|}{Dark  Green} \\ \multicolumn{5}{c}{Light \multicolumn{5}{|c|}{Light  Green} \\ \multicolumn{5}{c}{Dark \multicolumn{5}{|c|}{Dark  Green} \\ Quicksort & $n \log(n)$ & $n \log(n)$ & $n^2$ & $\log n$ \\  Merge Sort & $n \log(n)$ & $n \log(n)$ & $n \log(n)$ & $n$ worst case\\  \hline