2

Following is my MWE:

\documentclass[conference]{IEEEtran}
\usepackage{booktabs}
\begin{document}

\begin{table*}
\centering
\begin{tabular*}{\textwidth}{@{\extracolsep{\stretch{1}}}*{2}{r}}
  \toprule
   Scheme & Sequence \\
  \midrule
  \centering{\textit{A}} & 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1   \\
  \centering{\textit{B}} & 8 2 3 2 9 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 8 2 3 2 1 2 5 2 3 2 1 2 3 2 3 2 1   \\
  \bottomrule                             
\end{tabular*}
\caption{Table}\label{T1}
\end{table*}
\end{document}

My Question:

  1. How to center "Scheme" and "Sequence" in top row
  2. How to reduce white spacing between column
  3. If I try to add line between two rows using \hline it looks very congested. How can I add line and improve spacing

2 Answers 2

2
  1. Use c columns.

  2. Just use tabular, not tabular* set to \textwidth.

  3. \midrule instead of \hline? Do you want that line though?

You should also place the caption above the table, not below. And \centering is not a command that takes an argument, that is it should be used as {\centering ...}, not \centering{...}. But you don't need it at all when using a c column.

enter image description here

\documentclass[conference]{IEEEtran}
\usepackage{booktabs}
\begin{document}

\begin{table*}
\centering
\caption{Table}\label{T1}
\begin{tabular}{*{2}{c}}
  \toprule
   Scheme & Sequence \\
  \midrule
  \textit{A} & 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1   \\ \midrule
  \textit{B} & 8 2 3 2 9 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 8 2 3 2 1 2 5 2 3 2 1 2 3 2 3 2 1   \\
  \bottomrule                             
\end{tabular}
\end{table*}
\end{document}
0
  1. If you only want to change the alignment of a single cell, you can use \multicolumn{1}{c}{Scheme} here. This will also ignore any exstra column-specifiers from the array-package >{} and <{}.
  2. If you don't want exstra column-space, why are you using a tabular*-environment, with the \textwidth-specification? It is used to have a table stretch to a given length, here it will stretch to the width of your textarea. Instead, use just a regular tabular, as Torbjørn T also wrote in his answer. If you want to reduce the space further, you could set the space directly, with \setlength{\tabcolsep}{0pt}
  3. Instead of a line here, I would use \addlinespace, which just inserts some exstra vertical space.

Further suggestions

To reduce redundant code, instead of using \textit{A,\textit{B} etc. for every row, you can assign \itshape to the whole column, using array-package >{\itshape}c for the column-specifier. This will insert \itshape in front of every cell in this column, which is set to c for center alignment.

Add the caption on top of the table, as the caption is normally needed before one reads the table itself. Also, to improve the spacing and have better control over the captions, load the caption-package.

For labels, you should use a more informative label than T1. What would happen if you decided to insert a table before this one? Label it T0? Also, you would need to remember what each of them is. Instead, use something that tells you what the table really is about, like tab:SchemeSequence

Output

enter image description here

Code

\documentclass[conference]{IEEEtran}
\usepackage{booktabs}
\usepackage{array}
\usepackage{caption}
\begin{document}

\begin{table}
\caption{Table}\label{tab:SchemeSequence}
\begin{tabular}{>{\itshape}cr}
  \toprule
   \multicolumn{1}{c}{Scheme} & \multicolumn{1}{c}{Sequence} \\
  \midrule
  A & 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1   \\
  \addlinespace
  B & 8 2 3 2 9 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 3 2 3 2 1 2 8 2 3 2 1 2 5 2 3 2 1 2 3 2 3 2 1   \\
  \bottomrule
\end{tabular}
\end{table}

\begin{table}[hbt]
\caption{Table with grouping of numbers}\label{tab:SchemeSequenceGrouped}
\begin{tabular}{>{\itshape}cr}
  \toprule
   \multicolumn{1}{c}{Scheme} & \multicolumn{1}{c}{Sequence} \\
  \midrule
  A & 3232 1232 3212 3232 1232 3212 3232 1232 3212 3232 1232 3212 3232 1232 321   \\
  \addlinespace
  B & 8232 9232 3212 3232 1232 3212 3232 1232 3212 3232 1282 3212 5232 1232 321   \\
  \bottomrule
\end{tabular}
\end{table}
\end{document}

You must log in to answer this question.

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