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 have the following table which I want to put in the center of the two-column manuscript. But it failed although I already put the asterisk in the \begin{table*} command.

\begin{table*}
\noindent\begin{tabular*}{\columnwidth}{@{\extracolsep{\stretch{1}}}*{7}{r}@{}}
  \toprule
  & $z_{6}$ & $z_{8}$ & $z_{9}$ & $z_{11}$ & $z_{13}$ & $z_{14}$ \\
  \midrule
  fileA & 0.00 & 0.00 & 0.00 & 0.08 & 0.79 & 0.08  \\
  fileB & 0.01 & 0.00 & 0.13 & 0.00 & 0.84 & 0.00  \\
  fileC & 0.00 & 0.39 & 0.02 & 0.49 & 0.00 & 0.00  \\
  fileD & 0.75 & 0.08 & 0.00 & 0.00 & 0.00 & 0.00  \\
  \bottomrule                             
\end{tabular*}
\end{table*}

What's the right way to do it?

share|improve this question
2  
Can you please edit your question to add a complete minimal working example (MWE) tex document and describe what you would like to achieve? –  Andreas Dec 12 '12 at 6:47
1  
Note that \columnwidth is only half of the two-column size of tabular*. Adding \centering before \begin{tabular*} will center the table. –  Stephan Lehmke Dec 12 '12 at 6:56
1  
I think what Stephan is saying is that you would probably like to try replacing \columnwidth by \textwidth. –  Andreas Dec 12 '12 at 7:04

1 Answer 1

up vote 4 down vote accepted

The full width of the text area is \textwidth not \columnwidth so as shown in the first example below you could specify that to tabular* personally I think that makes the table look rather spaced out and it is better to set it to its natural width using tabular and then centre the result, as shown in the second table.

enter image description here

\documentclass[twocolumn]{article}

\usepackage{booktabs}

\def\a{One two three four. }
\def\b{Red Yellow Green Blue. }
\def\c{\a\a\b\b\par\b\a\b\a\b\b\a\par}

\begin{document}
\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c
\begin{table*}
\centering
\begin{tabular*}{\textwidth}{@{\extracolsep{\stretch{1}}}*{7}{r}@{}}
  \toprule
  & $z_{6}$ & $z_{8}$ & $z_{9}$ & $z_{11}$ & $z_{13}$ & $z_{14}$ \\
  \midrule
  fileA & 0.00 & 0.00 & 0.00 & 0.08 & 0.79 & 0.08  \\
  fileB & 0.01 & 0.00 & 0.13 & 0.00 & 0.84 & 0.00  \\
  fileC & 0.00 & 0.39 & 0.02 & 0.49 & 0.00 & 0.00  \\
  fileD & 0.75 & 0.08 & 0.00 & 0.00 & 0.00 & 0.00  \\
  \bottomrule                             
\end{tabular*}
\caption{tabular*}
\end{table*}
\begin{table*}
\centering
\begin{tabular}{*{7}{r}}
  \toprule
  & $z_{6}$ & $z_{8}$ & $z_{9}$ & $z_{11}$ & $z_{13}$ & $z_{14}$ \\
  \midrule
  fileA & 0.00 & 0.00 & 0.00 & 0.08 & 0.79 & 0.08  \\
  fileB & 0.01 & 0.00 & 0.13 & 0.00 & 0.84 & 0.00  \\
  fileC & 0.00 & 0.39 & 0.02 & 0.49 & 0.00 & 0.00  \\
  fileD & 0.75 & 0.08 & 0.00 & 0.00 & 0.00 & 0.00  \\
  \bottomrule                             
\end{tabular}
\caption{tabular}
\end{table*}

\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c\c


\end{document}
share|improve this answer

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.