0

Can I make the columns of this table wider, also can the Caption at the bottom not contain Table 1?

  % Table generated by Excel2LaTeX from sheet 'Sheet3'
    \begin{table}[htbp]
      \centering
        \begin{tabular}{llllll}
        \multicolumn{6}{l}{Table 3.1: Summary Statistics} \bigstrut[b]\\
        \hline
               & Mean   & Std.   &        & Mean   & Std. \bigstrut\\
        \hline
        $r$    & 0.61   & 4.24   & ElcEq  & 0.79   & 6.02 \bigstrut[t]\\
        Agric  & 0.58   & 6.32   & Autos  & 0.60   & 6.37 \\
        Food   & 0.66   & 4.14   & Aero   & 0.88   & 6.52 \\
        Beer   & 0.69   & 4.98   & Ships  & 0.65   & 6.71 \\
        \hline
        \end{tabular}%
      \caption{Note: In this Caption I do not want to see the table}
      \label{tab:addlabel}%
    \end{table}%

enter image description here

7
  • Why do you add a manual table number instead of using the caption command? If you want the caption to be as wide as the table, take a look at threeparttable. This package might also be useful to add table notes.
    – leandriis
    Apr 21, 2020 at 15:51
  • 1
    What's the reason for \bigstrut[b]?
    – leandriis
    Apr 21, 2020 at 15:52
  • @leandriis I wish it wasnt there, it comes up when I use excel2latex
    – Sam
    Apr 21, 2020 at 15:54
  • Ok, well then remove it. What about the desired alignment of "Table 3.1: Summary Statistics"? Could you please comment on that? Please also make your code compilable by adding the documentclass as well as the relevant packages. Please also specify which column you want to make wider and why.
    – leandriis
    Apr 21, 2020 at 15:57
  • @leandriis I would like to make all of the columns wider in order to match the notes at the bottom as I think it looks better
    – Sam
    Apr 21, 2020 at 16:04

3 Answers 3

0

\tabcolsep defines the length between columns. In the example below, it is fixed to 2em. You can change this value to fit your needs.

\documentclass{article}

\usepackage{booktabs}

\begin{document}

\begin{table}[htbp]
  \setlength{\tabcolsep}{2em}

  \caption{Summary Statistics}\label{tab:addlabel}

  \begin{center}
    \begin{tabular}{llllll}
      \toprule
      & Mean   & Std.   &        & Mean   & Std.\\
      \midrule
      $r$    & 0.61   & 4.24   & ElcEq  & 0.79   & 6.02 \\
      Agric  & 0.58   & 6.32   & Autos  & 0.60   & 6.37 \\
      Food   & 0.66   & 4.14   & Aero   & 0.88   & 6.52 \\
      Beer   & 0.69   & 4.98   & Ships  & 0.65   & 6.71 \\
      \bottomrule
    \end{tabular}
  \end{center}
\end{table}

\end{document}
0

Here are two examples:

enter image description here

I would not recomment to artificially make the individual table columns wider than they naturally are.

\documentclass{article}
\usepackage{array}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{geometry}
\usepackage{threeparttable}
\counterwithin{table}{section}
\begin{document}
\section{A section title}

    \begin{table}[htbp]
      \centering
      \caption{Summary Statistics}
      \label{tab:addlabel}%
        \begin{tabular}{*{6}{Wc{2cm}}}
        \toprule
               & Mean   & Std.   &        & Mean   & Std. \\
        \midrule
        $r$    & 0.61   & 4.24   & ElcEq  & 0.79   & 6.02 \\
        Agric  & 0.58   & 6.32   & Autos  & 0.60   & 6.37 \\
        Food   & 0.66   & 4.14   & Aero   & 0.88   & 6.52 \\
        Beer   & 0.69   & 4.98   & Ships  & 0.65   & 6.71 \\
        \bottomrule
        \end{tabular}%
      \caption*{Note: In this Caption I do not want to see the table}
    \end{table}%


    \begin{table}[htbp]
      \centering
      \captionsetup{singlelinecheck=false}
      \begin{threeparttable}
      \caption{Summary Statistics}
      \label{tab:addlabel}%
        \begin{tabular}{*{2}{lcc}}
        \toprule
               & Mean   & Std.   &        & Mean   & Std. \\
        \midrule
        $r$    & 0.61   & 4.24   & ElcEq  & 0.79   & 6.02 \\
        Agric  & 0.58   & 6.32   & Autos  & 0.60   & 6.37 \\
        Food   & 0.66   & 4.14   & Aero   & 0.88   & 6.52 \\
        Beer   & 0.69   & 4.98   & Ships  & 0.65   & 6.71 \\
        \bottomrule
        \end{tabular}%
%        \end{threeparttable}
        \begin{tablenotes}[flushleft]
        \setlength\labelsep{0pt}
        \item[]Note: In this Caption I do not want to see the table
        \end{tablenotes}
        \end{threeparttable}
    \end{table}%
\end{document}
0

enter image description here

\documentclass{article}
\usepackage{booktabs, makecell}
\usepackage[referable]{threeparttablex}
\usepackage{siunitx}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\begin{document}
\lipsum[1]
    \begin{table}[htb]
\setlength\tabcolsep{0pt}
\setcellgapes{3pt}
\makegapedcells
\sisetup{table-format=1.2}
    \centering
   \begin{threeparttable}
\caption{Summary Statistics}
\label{tab:addlabel}    
    \begin{tabular*}{0.8\linewidth}{@{\extracolsep{\fill}}lSSlSS}
      \toprule
        & {Mean} & {Std.} &        & {Mean} & {Std.}    \\
      \midrule
$r$     & 0.61   & 4.24   & ElcEq  & 0.79   & 6.02      \\
Agric   & 0.58   & 6.32   & Autos  & 0.60   & 6.37      \\
Food    & 0.66   & 4.14   & Aero   & 0.88   & 6.52      \\
Beer    & 0.69   & 4.98   & Ships  & 0.65   & 6.71      \\
      \bottomrule
    \end{tabular*}
    \begin{tablenotes}\small
\note{some explanation about table}
    \end{tablenotes}
\end{threeparttable}
    \end{table}
\end{document}

You must log in to answer this question.

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