Table in LaTeX: Align the table in single column using the two column template

Fizzah picture Fizzah · Nov 13, 2018 · Viewed 7.5k times · Source

I am working on the LaTeX overleaf. I am using the IEEE access template which is two column. I have to fix my table in a single column. I have to fix the table where its place. I have used \FloatBarrier for this. \FloatBarrier has fixed the table on its place but the table is covering the text. I have applied all the techniques like using Table*,!htbp, \FloatBarrier and many more. I will very thankful to solve this issue.

\FloatBarrier
\begin{table}[!htbp]
\caption{Car Database}
\label{table:Car_DB}
\begin{tabular}{ccccc}
\toprule
\textbf{Car\_ID}    & \textbf{Car\_Name}    & \textbf{Car\_Number} &\textbf{Owner\_Name}  &\textbf{Owner\_ID} \\
\midrule
C1      &Suzuki Mehran  &RIZ 3725  &Bilal Khalid  &34512-4520645-5\\
C2      &mazda  &MN 3909  &Usman Bhatti  &32103-9963008-2\\
C2      &Toyotta Carolla    &LEL 06 4520  &Ali Haider  &12345-1529307-7\\
\bottomrule
\end{tabular}
\end{table}

The result of this code is like this

Answer

Werner picture Werner · Nov 13, 2018

I'd suggest reducing the column headers since your \caption already mentions items will be related/represent cars. That is, remove the Car prefix. Then you can also reduce the \tabcolsep inserted between each column using

\setlength{\tabcolsep}{0.7\tabcolsep}

The above command reduces \tabcolsep by 30%. Here's a display of the end result:

enter image description here

\documentclass{IEEEtran}

\usepackage{lipsum,booktabs}

\begin{document}

\begin{table}
  \caption{Car Database}
  \begin{tabular}{ccccc}
    \toprule
    \textbf{Car\_ID}    & \textbf{Car\_Name}    & \textbf{Car\_Number} &\textbf{Owner\_Name}  &\textbf{Owner\_ID} \\
    \midrule
    C1 & Suzuki Mehran   & RIZ 3725    & Bilal Khalid & 34512-4520645-5 \\
    C2 & Mazda           & MN 3909     & Usman Bhatti & 32103-9963008-2 \\
    C3 & Toyotta Carolla & LEL 06 4520 & Ali Haider   & 12345-1529307-7 \\
    \bottomrule
  \end{tabular}
\end{table}

\begin{table}
  \caption{Car Database}
  \setlength{\tabcolsep}{0.7\tabcolsep}% Shrink \tabcolsep by 30%
  \centering
  \begin{tabular}{ *{5}{c} }
    \toprule
    \textbf{ID} & \textbf{Name} & \textbf{Number} & \textbf{Owner name} & \textbf{Owner ID} \\
    \midrule
    C1 & Suzuki Mehran   & RIZ 3725    & Bilal Khalid & 34512-4520645-5 \\
    C2 & Mazda           & MN 3909     & Usman Bhatti & 32103-9963008-2 \\
    C3 & Toyotta Carolla & LEL 06 4520 & Ali Haider   & 12345-1529307-7 \\
    \bottomrule
  \end{tabular}
\end{table}

\sloppy % Just for this example
\lipsum[1]

\end{document}

More options available from My table doesn't fit; what are my options?