14

Is there any way to reduce the font size in a table/tabular but only in one of its columns without repeating the size command in each cell of that column?

Thanks.

  • 3
    This is not a good idea, but if you have to do it you can use the array package. \begin{tabular}{>{\small}lll} will make the first column \small. – Alan Munn Jul 23 '13 at 18:29
  • Related to tabular rows: Different font sizes for different rows – Werner Jul 23 '13 at 18:35
21

It's generally not a good idea to reduce the font size to make things fit in your document. Font sizes should be uniform for equivalent parts of a document. However, it's certainly easy enough to do if that's what you need.

The array package adds some very useful functionality to the regular tabular mechanism. In particular it allows you to specify code that applies at the beginning and end of each cell in a column. It also allows you to create new column types so that if you use the same formatting over again, you can just give it its own letter name.

The syntax of a column specification using array is the following:

 >{before code}columntype<{after code}

where before code will be executed before each cell in the column and after code will be executed at the end of each cell in a column. The column type is l, r, c , p{<width>} or any other type as defined by you (or by some other tabular package that uses array.)

For example, if we want a centre-aligned column where each element is \large, we can do the following:

\begin{tabular}{>{\large}c}

If we're going to use this column type a lot, then we can make it its own symbol:

\newcolumntype{C}{>{\large}c}

and then use

\begin{tabular}{C}

Here's a simple example:

\documentclass[12pt]{article}
\usepackage{array}
\newcolumntype{T}{>{\tiny}l} % define a new column type for \tiny
\newcolumntype{H}{>{\Huge}l} % define a new column type for \Huge

\begin{document}

\begin{tabular}{>{\footnotesize}l>{\Huge}llTH}
footnote size & huge & normal & tiny & huge
\end{tabular}

\end{document}

output of code

Of course the code you specify can be pretty much anything, although formatting commands like font size and family commands are most likely. But the code can be quite complex if you need it to be. For example, you can increment and display a counter to achieve automatic row numbers in a table, as in this question:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.