Centering a table that spans in two column document

The switch \centering is only enforced when it finds the end of a paragraph (an explicit \par or a blank line). Since you're wrapping \centering inside a group and there is no such "end of paragraph" signal before the group closes, the effect of \centering is never enforced.

The solution is to remove the scoping braces {...} since they're not needed here (despite using \small as well). Alternatively, use \begin{center} ... \end{center}, which will insert additional spacing above/below the tabular.

enter image description here

\documentclass[twocolumn]{article}

\usepackage{lipsum}
\usepackage{multirow, booktabs}

\begin{document}

\lipsum

\begin{table*}[t]
  \caption{hello core APIs}
  \small\centering
  \begin{tabular}{llll}

    \toprule

    {\bfseries API group} & {\bfseries Name} & {\bfseries Parameters} & {\bfseries output} \\
    \midrule\midrule[.1em]

    \multirow{2}{3.5cm}{Creation} 
      & {\ttfamily createFBFSummary}
      & {\ttfamily summary}, {\ttfamily tableWidth}%, {\ttfamily schema} (optional)  
      & FBF summary \\
    \cmidrule(lr){2-4}
      & {\ttfamily createLabeledSummary}
      & {\ttfamily summary}
      & Labeled summary \\

    \midrule[.1em] 

    \multirow{2}{3.5cm}{Query} 
      & {\ttfamily query}
      & {\ttfamily summary}, {\ttfamily label}
      & value \\
    \cmidrule(lr){2-4}
      & {\ttfamily search}
      & {\ttfamily directory}, {\ttfamily label}
      & (summary, value) pairs \\   
    \bottomrule
  \end{tabular}
\end{table*}

\lipsum

\end{document}

In the above example, the end of the table* environment constitutes an "end of paragraph" signal.


Some additional suggestions (beyond removing the scope-limiting curly braces), in no particular order:

  • Use a p column type (of width 3.5cm); get rid of the \multicolumn statements

  • Set up a new column type (called t in the code below) for the fixed-width font material in columns 2 and 3; get rid of the individual \tt directives

  • It's not necessary to invoke \small; just typeset the table at the normal document font size

  • Since you're using the macros of the booktabs package, do embrace the package's overall approach to designing tables as well. E.g., use horizontal rules sparingly, and use whitespace instead. The result will be a more "open" looking table.

  • Don't use the deprecated font switching macros \tt and \bf; instead, use \ttfamily and \bfseries.

  • The elements h and b in the placement directive [!hbt] have absolutely no effect on a table* environment. The omissing of the p element is potentially problematic as it prevents the creation of a full-page float and thereby increases the chances that the float will end up at the very end of the document. My advice would be to omit the [!hbt] directive entirely.

enter image description here

\documentclass[twocolumn]{article}
\usepackage{lipsum}
\usepackage{booktabs, array}
\newcolumntype{t}{>{\ttfamily}l}  % automatic-ttfamily "l" column

\begin{document}
\lipsum[1-3]

\begin{table*}
\caption[hello core APIs]{hello core APIs\strut}\label{tab:apis}
\centering
\renewcommand\arraystretch{1.2}
\begin{tabular}{@{} p{3.5cm} t t l @{}}
\toprule
\bfseries API group & \bfseries\rmfamily Name & \bfseries\rmfamily Parameters & \bfseries output \\
\midrule
Creation
& createFBFSummary  & summary, tableWidth & FBF summary \\
& createLabeledSummary & summary & Labeled summary \\
\addlinespace
Query               & query & summary, label & value \\
& search & directory, label & (summary, value) pairs \\   
\bottomrule
\end{tabular}
\end{table*}

\lipsum[4-13]
\end{document}

The answers given up to now fix the problem, but go wrong in suggesting “improvements”.

About the main problem, just for completeness:

  1. \centering outside the table environment doesn't affect the environment at all

  2. {\centering...} has no effect, because the paragraph ends after } is scanned, so \centering has already ended its action.

So the format should be

\lipsum

\begin{table*}[t]
\centering\small

\caption{hello core APIs}\label{tab:apis}

\begin{tabular}{llll}
[...]
\end{tabular}

\end{table*}

\lipsum

I prefer to have the formatting instructions at the top; they don't affect the caption anyway.

Now, let's consider the tabular and how it can be improved.

\documentclass[10pt, twocolumn]{article}

\usepackage{lipsum}
\usepackage{booktabs}

\newcommand{\keyw}[1]{\texttt{#1}}

\begin{document}

\lipsum

\begin{table*}
\small\centering

\caption{hello core APIs}\label{tab:apis}

\medskip % not necessary if you load caption

\begin{tabular}{llll}
\toprule
% header
\bfseries API group & \bfseries Name & \bfseries Parameters & \bfseries output \\
% table data
\midrule
Creation
  & \keyw{createFBFSummary}
  & \keyw{summary}, \keyw{tableWidth}%, \keyw{schema} (optional)  
  & FBF summary \\
\cmidrule(lr){2-4}
  & \keyw{createLabeledSummary}
  & \keyw{summary}
  & Labeled summary \\
\midrule
Query
  & \keyw{query}
  & \keyw{summary}, \keyw{label}
  & value \\
\cmidrule(lr){2-4}
  & \keyw{search}
  & \keyw{directory}, \keyw{label}
  & (summary, value) pairs \\   
\bottomrule
\end{tabular}

\end{table*}

\lipsum

\end{document}

Note the personal command for typesetting special words in typewriter type; also \bf and \tt should never be used. Nor double horizontal rules. There's also no need for \multirow: the word "Creation" automatically refers to the blank cell below it.

enter image description here