Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I wanted to change the header of table to discriminate it from other records. It can be changing bounding box or font or what ever it is usual.

\begin{table}
    \centering
        \begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill}} | c | c | c | }
               \hline
                Measurement Type & Range & Accuracy \\
\hline
                Air Temperature &   -20\,^{\circ}\mathrm{C} - 60\,^{\circ}\mathrm{C} & ± 0.3\,^{\circ}\mathrm{C} \\
\hline
            Humidity & 0 - 100 & \pm2"\%" \\
\hline
Surface Temperature & -20\,^{\circ}\mathrm{C} - 70\,^{\circ}\mathrm{C} & \pm0.6\,^{\circ}\mathrm{C} \\
\hline
        \end{tabular*}
    \caption{Sensors specifications}
    \label{tab:SensorsSpecifications}
\end{table}

This is the table and I wanted to change the style of the first row.

enter image description here

share|improve this question
2  
Would writing the names in bold face suffice? –  Mafra Dec 6 '12 at 16:00
    
@Mafra Is it possible to change the borders like what we have in WORD? –  ali amidi Dec 6 '12 at 16:05
add comment

3 Answers

up vote 3 down vote accepted

Here is a suggestion. I have taken the liberty of changing a few other parts as well but basically you can treat the header items as regular text and use bold, italics etc.

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}
    \caption{Sensors specifications}
    \label{tab:SensorsSpecifications}
    \begin{center}
        \begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill}}  l  c  c  }
           \toprule
             \textbf{Measurement Type} &\textbf{Range} &\textbf{Accuracy} \\
           \midrule
             Air Temperature &--20$^\circ$C--60$^\circ$C &$\pm 0.3^\circ$C \\
             Humidity &0--100 &$\pm2$\% \\
             Surface Temperature &--20$^\circ$C--70$^\circ$C &$\pm0.6^\circ$C \\
           \bottomrule
        \end{tabular*}
    \end{center}
\end{table}
\end{document}

Note that I have used the booktabs package which allows better line control. Please refer to the package documentation for details.

share|improve this answer
add comment

I would recommend this, after loading the packages \usepackage{booktabs,tabularx}

enter image description here

\documentclass{article}

\pagestyle{empty}
\usepackage[margin=1in]{geometry} % not needed

\usepackage{booktabs,tabularx}

\usepackage{textcomp}% provides \textdegree
\newcommand \tC {\mbox{\textdegree C}}

\begin{document}

    \begin{table}
        \centering
            \begin{tabularx}{0.75\textwidth}{*{3}{>{\centering\arraybackslash}X}}
                   \toprule
                    \bfseries Measurement Type & \bfseries Range & \bfseries Accuracy \\
    \midrule[\heavyrulewidth]
                    Air Temperature &   $-20$ to $60\tC$ & $\pm 0.3\tC$ \\
    \midrule
                Humidity & $0$ to $100\,\%$ & $\pm2\,\%$ \\
    \midrule
    Surface Temperature & $-20$ to $70\tC$ & $\pm0.6\tC$ \\
    \bottomrule
            \end{tabularx}
        \caption{Sensors specifications.}
        \label{tab:SensorsSpecifications}
    \end{table}

\end{document}

Several remarks:

  • I did not change this, but I would not make the table fixed width unless the space is too narrow, i.e., I would not use tabularx at all and I would write:

    \begin{tabular}{*{3}{c}}
    ...
    \end{tabular}
    
  • Using dash for interval with negative values will always be confusing, so I changed to to

  • Some people won't agree with me, but I think that tables with vertical bars look awfully. Especially since you don't have many columns, I would omit them.

  • I believe that after a caption text, there should be a full stop ..

share|improve this answer
add comment

Just to add some flavor to the soup, one can use the table option of the xcolor package and include row colors as follows:

\documentclass{article}
\usepackage[table]{xcolor}
\begin{document}
\begin{table}
    \caption{Sensors specifications}
    \label{tab:SensorsSpecifications}
    \begin{center}
        \renewcommand{\arraystretch}{1.3} % Allows a better display of the table.
        \begin{tabular}{l c c}
             \rowcolor{blue!10} %changes the row color
             \textbf{Measurement Type} &\textbf{Range} &\textbf{Accuracy} \\
             Air Temperature &--20$^\circ$C--60$^\circ$C &$\pm 0.3^\circ$C \\
             Humidity &0--100 &$\pm2$\% \\
             Surface Temperature &--20$^\circ$C--70$^\circ$C &$\pm0.6^\circ$C \\
        \end{tabular}
    \end{center}
\end{table}
\end{document}

This results in:

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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