3

I'm new to LaTex. I'm trying to find some sample code that shows how to create a single column table with borders (and if possible a grey header row) in a two column paper.

1

2 Answers 2

7

Since you mentioned IEEE, in these documentclass(es) the starred versions of table and figure span the whole page.

To have a highlighted (colored) line, just add rowcolor{your_favorite_color} before the line in question. To make this available, you need to load the colortbl and the (xcolor or color) packages in the preamble.

In my example the lipsum package is just necessary to generate some random text.

Here's a MWE you can try (I kept the title and author info from the downloadable template):

\documentclass[conference]{IEEEtran}

\usepackage{xcolor}% you could also use the color package
\usepackage{colortbl}
\usepackage{lipsum}

\begin{document}

\title{Bare Demo of IEEEtran.cls for Conferences}

\author{\authorblockN{Michael Shell}
\authorblockA{School of Electrical and\\Computer Engineering\\
Georgia Institute of Technology\\
Atlanta, Georgia 30332--0250\\
Email: [email protected]}
\and
\authorblockN{Homer Simpson}
\authorblockA{Twentieth Century Fox\\
Springfield, USA\\
Email: [email protected]}
\and
\authorblockN{James Kirk\\ and Montgomery Scott}
\authorblockA{Starfleet Academy\\
San Francisco, California 96678-2391\\
Telephone: (800) 555--1212\\
Fax: (888) 555--1212}}

\maketitle

\begin{abstract}
The abstract goes here.
\end{abstract}

\section{Table Example}

\lipsum[1]

\begin{table*}
\centering
\begin{tabular}{|c|c|c|}
\hline
\rowcolor{gray}
A & B & C\\
\hline
1 & 2 & 3\\
\hline
\end{tabular}
\end{table*}

\lipsum[2-15]

\end{document}
1
  • MWE... done! :)
    – Count Zero
    Mar 4, 2013 at 14:28
0
\documentclass[conference]{IEEEtran}

\usepackage{xcolor}% enables use of color package
\usepackage{colortbl}
\usepackage{lipsum}

\begin{document}

\title{Bare Demo of IEEEtran.cls for Conferences}

\author{Aswani~Kumar~Eedara}

\maketitle

\begin{abstract}
The abstract goes here.
\lipsum[1]
\end{abstract}

\section{ Table spanning two columns of the paper in center}

\begin{table*}
\centering
\begin{tabular}{|c|c|c||c|c|c|}
\hline
\rowcolor{gray}
A & B & C & D & E & F\\    \hline
A & B & C & D & E & F\\    \hline
A & B & C & D & E & F\\    \hline
A & B & C & D & E & F\\    \hline
A & B & C & D & E & F\\    \hline
A & B & C & D & E & F\\    \hline
A & B & C & D & E & F\\    \hline
A & B & C & D & E & F\\    \hline
\end{tabular}
\end{table*}
\lipsum[2-10]%

\section{ Table spanning in single column of the paper in center}
\lipsum[11-30]
\begin{table}
\centering
\begin{tabular}{|c|c|c|}
\hline
\rowcolor{yellow}
A & B & C\\    \hline%hline draws horizontal line
1 & 2 & 3\\    
1 & 2 & 3\\    \hline
1 & 2 & 3\\    \hline
1 & 2 & 3\\    \hline
1 & 2 & 3\\    \hline
1 & 2 & 3\\    \hline
1 & 2 & 3\\    \hline
\end{tabular}
\end{table}
\lipsum[16-50]

\end{document}
1
  • How is this different to the existing answer?
    – Werner
    Jun 15, 2015 at 7:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .