# how to apply style to complete row or table in tabulars

How can I define a style (font, size, color etc) for a whole row, without repiting the command before each cell?

Note that I do not want to use tabu package. I want to know to what extent this can be done without tabu. (nothing against tabu, I want to demonstrate the usage of standard tabular env. and in contrast tabu).

Also I do not want to add new columntypes. The principle shall be applicable to any table in a complex document, without inventing columntypes for each column in each table.

This example shows that only the first cell after the setting of styles is changed.

\documentclass[]{scrbook}

\usepackage[
dvipsnames, % Load a set of predefined colors
table,      % Load the colortbl package
]{xcolor}

\usepackage{float}

\begin{document}

\begin{table}[H]
%  --- table -->
\renewcommand{\arraystretch}{1.4}
\centering
\sffamily
\rowcolors{1}{gray!15}{white!100}%
% <------------
\begin{tabular}{lll}
\hline
\rowcolor{gray!25}
\small
\rmfamily
% <------------
\hline
%  --- tbody -->
\tiny\slshape
% <------------
content & content  & content \tabularnewline
content & content  & content \tabularnewline
content & content  & content \tabularnewline
\hline
\end{tabular}
\end{table}
\end{document}

-
If you're going to show good examples of LaTeX code, please refrain from using the [H] option for floating objects. In some occasions it can come handy, but in general it's not recommendable. –  egreg Oct 6 '11 at 12:58
I need a group, because otherwise the commands after \begin{table} would be applied to the whole document. I would prefer to write \begin{table}[float=none] but that is not implemented. Since there is no other solution which combines this functionality with self explaining code I always use [H] if I do not want floats. –  Matthias Pospiech Oct 6 '11 at 13:54
if you don't want floats, it's always possible to wrap the object to be isolated in \begingroup ... \endgroup which has nearly the same effect; the major difference of which i'm aware is that it doesn't include the extra vertical space associated with floats, but you can always add that yourself. –  barbara beeton Oct 6 '11 at 14:55
I know many ways to achieve the same. \begingroup ..  is one of them. But I prefer readable self-explanatory code. –  Matthias Pospiech Oct 6 '11 at 16:38

I put together I package which almost does what I want - configurable tables styles. Here is an example of the user API. Please provide feedback if you like it or what should be changed. The full code including a very detailed example is linked below.

Table Style

\begin{table}[H]
\tablestyle[sansboldbw]
\captionabove{table with darker alternating colors}
\begin{tabular}{*{2}{v{0.45\textwidth}}}
\tbody
content  & content \tabularnewline
content  & content \tabularnewline
content  & content \tabularnewline
content  & content \tabularnewline
content  & content \tabularnewline
content  & content \tabularnewline
%