# [Tex/LaTex] create table with only header bold and center

tables

How to create a table using latex – only it's 1st row bold and center and others are left side and normal.

\begin{table}

\renewcommand{\arraystretch}{1.5}

\caption[m1]{ m2}

\label{Hardware}\centering

\begin{tabular}{|c|c|c|c|}

\hline

a & b & c & d  \\ \hline

a  & b  & c & d\\ \hline

a & b & c & d \\ \hline

\end{tabular}

\end{table}


Tabular does not have a concept of a header. If you want to have one, you have to modify the first row yourself. As Mico pointed out

\begin{tabular}{|l|l|l|l|}
\hline
a & b & c & d \\ \hline
a & b & c & d \\ \hline
\end{tabular}


Of course, this is somewhat verbose and cumbersome. Two possible simplifications:

1. First possibility: Define a macro for this

\newcommand*{\thead}[1]{\multicolumn{1}{c}{\bfseries #1}}


and then use it:

\begin{tabular}{|l|l|l|l|}
\hline
a & b & c & d \\ \hline
a & b & c & d \\ \hline
\end{tabular}

2. Second possibiliy: Alternatively, use the tabu package, which allows to specify individual row formating via the \rowfont command

\begin{tabu}{|l|l|l|l|}
\hline