# Different font sizes for different rows

I want to put different sizes of fonts (smaller) into different rows of my LaTeX table. I found that it is possible to have different font sizes for different columns of this post. Is there any simple way to put different fonts to LaTeX table rows ?

-

## migrated from stackoverflow.comNov 9 '11 at 13:24

This question came from our site for professional and enthusiast programmers.

You can use the package tabu which provides the command \rowfont:

\documentclass{article}
\usepackage{tabu}
\begin{document}
\begin{tabu}{ll}
\rowfont{\scriptsize}
Hello & World \\
Foo & Bar \\
\rowfont{\huge}
Hello & World
\end{tabu}
\end{document}

-

Creating your own \rowfont{<font>} switch is also possible.

Using the array package, you can insert elements in front of every column via the definition of a new column type. This insertion helps span the group associated with each tabular cell.

\documentclass{article}
\usepackage{array}% http://ctan.org/pkg/array
\makeatletter
\makeatother
\newcommand{\rowfonttype}{}% Current row font
\newcommand{\rowfont}[1]{% Set current row font
\gdef\rowfonttype{#1}#1%
}
\newcolumntype{L}{>{\rowfonttype}l}
\begin{document}
\begin{tabular}{LL}
\rowfont{\scriptsize}%
Hello & World \\
\rowfont{\normalsize}%
Foo & Bar \\
\rowfont{\huge}%
Hello & World
\end{tabular}
\end{document}


\rowfont{<font>} globally (re)defines \rowfonttype, and also inserts it into the current cell. Resetting the font is required in a subsequent row (via \rowfont{\normalsize} or otherwise).

End-of-tabular resetting is automated by appending \rowfont{} to \endtabular.

-