1

I made a table with this code:

   \documentclass[12pt,twoside,a4paper,openright]{report}
    \usepackage[portuguese]{babel}
    \usepackage[utf8]{inputenc}
    \usepackage[inner=3cm,outer=2cm,tmargin=2.0cm,bmargin=2.0cm, includefoot, includehead]{geometry}
    \usepackage{booktabs, multicol, multirow}
    \usepackage{tabularx}
    \usepackage{siunitx}
    \sisetup{locale = FR}

    \newcolumntype{R}{>{\raggedleft\arraybackslash}X}
    \newcolumntype{L}{>{\raggedright\arraybackslash}X}
    \newcolumntype{C}{>{\centering\arraybackslash}X}


    \begin{document}

    \begin{table}[htbp]
      \centering
      \caption{Equipamentos e normas utilizados nos testes papeleiros com o objectivo de caracterizar as folhas de papel.}
       \begin{tabularx}{\textwidth}{@{}Lcccccc@{}}
        \cmidrule[0.8pt]{1-7}
     Tamanho de Partícula & H60 & H60 M & H90 & H90 M & H90E & H90E M\\
        \cmidrule{1-7}
    \si{d_{50}} (\si{$\mu$m}) & 2,1 & 5,1 & 1,3 & 3,4 & 1,3 & 3,4\\
        \cmidrule[0.8pt]{1-7}
        \end{tabularx}
      \label{d50}
    \end{table}

    \end{document}

But I want more space between columns. There are too space between first and others columns. I have some difficuties to explain what I want.

2 Answers 2

2

(I've thoroughly revised this answer.)

I think you have three main options:

  • Keep using the tabularx environment but increase the value of \tabcolsep, the length parameter that sets a (hard) amount of inter-column white-space. In the example below I've chosen 12pt for this parameter, double the default value of 6pt.

  • Switch to a tabular* environment. Unlike the tabularx environment, which operates by expanding the widths of the columns until the overall assigned width (here: textwidth) is achieved, tabular* works -- if the admittedly arcane-looking directive @{\extracolsep{\fill}} is provided -- by expanding the inter-column white-space.

Neither of these two choices is, I believe, perfect, because neither addresses the separate need to align the numerical data on their decimal markers in order to make the information (more) easily parsable. You may therefore want to

  • Use a tabularx environment with a twist: Use the plain l column type for the first column, use the S column type (from the siunitx package) for the data columns, and use a (centered version of the) X column type for the headers of each of the six data columns. This will give you good amounts of intercolumn whitespace and alignment of the data on the decimal markers.

enter image description here

\documentclass[12pt,twoside,a4paper,openright]{report}
\usepackage[portuguese]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[inner=3cm,outer=2cm,tmargin=2.0cm,bmargin=2.0cm, includefoot, includehead]{geometry}
\usepackage{booktabs}
\usepackage{tabularx,ragged2e}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newcolumntype{C}{>{\Centering\arraybackslash}X}

\usepackage{siunitx}
\sisetup{locale = FR}

\newcommand\mc[1]{\multicolumn{1}{C}{#1}} % handy shortcut macro

\begin{document}
\begin{table}[htbp]
\caption{Equipamentos e normas utilizados nos testes papeleiros com o objectivo de caracterizar as folhas de papel.} \label{d50}

\bigskip
\verb|1. original form |

\verb|   (tabularx, "L" column type for first col., "c" for data columns)|

\begin{tabularx}{\textwidth}{@{}Lcccccc@{}}
\cmidrule[0.8pt]{1-7}
Tamanho de Partícula & H60 & H60 M & H90 & H90 M & H90E & H90E M\\
\cmidrule{1-7}
\si{d_{50}} (\si{$\mu$m}) & 2,1 & 5,1 & 1,3 & 3,4 & 1,3 & 3,4\\
\cmidrule[0.8pt]{1-7}
\end{tabularx}

\bigskip
\setlength\tabcolsep{12pt}  % default value: 6pt
\verb|2. tabularx with increased value of \tabcolsep|

\begin{tabularx}{\textwidth}{@{} L *{6}{c} @{}}
\midrule[0.8pt]
Tamanho de Partícula & H60 & H60 M & H90 & H90 M & H90E & H90E M\\
\cmidrule{1-7}
\si{d_{50}} (\si{\micro\meter}) & 2,1 & 5,1 & 1,3 & 3,4 & 1,3 & 3,4\\
\bottomrule[0.8pt]
\end{tabularx}

\bigskip
\setlength\tabcolsep{1pt} %% choose a deliberately small value
\verb|3. tabular* with @{\extracolsep{\fill}}|

\begin{tabular*}{\textwidth}{@{} l @{\extracolsep{\fill}} *{6}{c} @{}}
\midrule[0.8pt]
Tamanho de Partícula\quad\null & H60 & H60 M & H90 & H90 M & H90E & H90E M\\
\cmidrule{1-7}
\si{d_{50}} (\si{\micro\meter}) & 2,1 & 5,1 & 1,3 & 3,4 & 1,3 & 3,4\\
\bottomrule[0.8pt]
\end{tabular*}

\bigskip
\setlength\tabcolsep{6pt} % reset to default value
\verb|4. modified tabularx|

\verb|  "l" for first col., "S" for data columns, "C" for data headers row|

\begin{tabularx}{\textwidth}{@{} l *{6}{S} @{}}
\midrule[0.8pt]
Tamanho de Partícula\quad\null & 
\mc{H60} & \mc{H60 M} & \mc{H90} & 
\mc{H90 M} & \mc{H90E} & \multicolumn{1}{C@{}}{H90E~M}\\
\cmidrule{1-7}
\si{d_{50}} (\si{\micro\meter}) & 2,1 & 5,1 & 1,3 & 3,4 & 1,3 & 3,4\\
\si{d_{500}} (\si{\micro\meter}) & 12,1 & 25,1 & 31,3 & 3,41 & 1,33 & 23,54\\
\bottomrule[0.8pt]
\end{tabularx}
\end{table}
\end{document}
1

To increase space between columns you can set the value of the parameter tabcolsep by using the following statement inside the table environment : \setlength{\tabcolsep}{7pt}

 \begin{table}[htbp]
 \setlength{\tabcolsep}{7pt} %set appropriate space, default is 5pt (most probably).
 \renewcommand{\arraystretch}{1.2} %change vertical spacing of tables
 \centering
 \begin{tabular}{|c|c|c|}
 %Table Content
 \end{tabular}
 \caption{This is a caption}
 \label{tab:showingUseOfSpacing}
 \end{table}
1
  • 1
    In the "standard" document classes, the default value of \tabcolsep is 6pt. Maybe you're thinking of \arraycolsep -- its default value is indeed 5pt.
    – Mico
    Jun 28, 2014 at 15:49

You must log in to answer this question.

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