Create a bold or italic column in a latex table or tabular environment

To create a table in latex one can use the tabular environment and surround it with a table block to add a caption and make it floating.

The table below starts with a column that is left-aligned, then there is a a column that will be in bold and is centered and finally there is an italic column that is right-aligned.


\begin{table}
\begin{tabular}{l>{\bfseries}c>{\italic}r}
apple & red & round\\
melon & green & round\\
cookie & brown & square\\
\end{tabular}
\caption{Some objects, their color and their shape.}
\end{table}

The key command to change the formatting of a whole column is:

>{\bfseries}

in front of the alignment in the column definition.

Comments

The style modifier must be before the alignment statement...

... or it will not work!

Just to be clear, if you add vertical lines between cells, it becomes easier to read :
it must be \begin{tabular}{l|>{\bfseries}c|r},
and not \begin{tabular}{l>{\bfseries}|c|r}.

Thanks for this tip, very helpful!

Yohann

What about single rows

Hi, thanks for the tip, but what if you just want a single row blod / italic.
If I try the following within the tabular environment I get loads of errors
\textit{ 5 & 01234 & blabladescription & price & quantity } \\
I want to avoid having to do \textit{} for each column.

Cheers,
Pau

Array package required

To use the technique described above you need to include the array package.

\usepackage{array}

http://start.it.uts.edu.au/w/doc/LaTeX/array.html

Bold words in a tabular envoronment?

how to just make some words appear in bold within a tabular environment? \textbf doesn't seem to work!

Bold words in a tabular envoronment

To make a single word in a tabular environment bold you can use \textbf. However, you may need to enclose the word with curly brackets.

Example:

\begin{tabular}{ll}
    \textbf{bold}&regular\\
\end{tabular}