1

I have seen similar questions here. However, all of the code in the other started with \begin{tabular}{|c|c|c|c|} which I want to avoid. How do I get rid of the space between the vertical line?enter image description here

 \documentclass[letter,11pt,twoside]{article}
    \usepackage{array,siunitx,booktabs}
    \usepackage{multirow}
    \usepackage{subfig,rotating,longtable,lscape,geometry,layouts}
    \usepackage{makecell}

    %%%%%%%%%%%%%%%%
    \begin{document}

    \begin{table}[h!] 
    \small
    \hspace*{-0.3cm}
    \begin{tabular*}{\textwidth}{p{1.7cm}
      @{\extracolsep{\fill}}
      l
      *{3}{
        S[table-format=4.0]
        S[table-format=4.0]
        S[table-format=4.0]
      }
      @{}
    }
    \par\noindent\rule[-2mm]{16.5cm}{0.3mm} \\

    \multicolumn{2}{c|} {} & {\makecell{text}} & {\makecell{text}} & {text} & {text} \\
    \par\noindent\rule[0mm]{16.5cm}{0.2mm}\\
    \multicolumn{2}{c|} {text}  &   {text}  &   {text}  &   {text}  & {text}  \\ 
        \vspace{-0.5cm}
    \par\noindent\rule[1mm]{16.5cm}{0.3mm}
    \end{tabular*} 
    \vspace{-0.2cm}
    \caption{text} 
    \label{idealized}  
    \end{table}
    \end{document}

Thank you very much

  • 2
    Please use \hline instead of \par\noindent\rule[0mm]{16.5cm}{0.2mm}\\ – MadyYuvi Sep 4 at 11:17
  • 1
    Why do you load booktabs and not use it? – Bernard Sep 4 at 11:17
  • 3
    Nowadays you really should not be using vertical lines in data tables anyway. Studies show that the vertical lines makes it harder to read each row. The rules from booktabs are explicitly designed with this in mind. – daleif Sep 4 at 11:26
  • Why you use S column types and than you have text in columns? – Zarko Sep 4 at 13:04
  • Your question is not clear. Do you like to have something like this: \documentclass{article} \usepackage{booktabs, tabularx} \newcolumntype{C}{>{\centering\arraybackslash}X} \begin{document} \begin{table}[ht] \begin{tabularx}{\linewidth}{ l *{4}{C} } \toprule & text & text & text & text \\ \midrule text & text & text & text & text \\ text & text & text & text & text \\ \bottomrule \end{tabularx} \caption{text} \label{idealized} \end{table} \end{document} ? – Zarko Sep 4 at 13:15
1

Try the following instead of all the manual spaces and lines:

\documentclass[letter,11pt,twoside]{article}
\usepackage{array,siunitx,booktabs}
\usepackage{multirow}
\usepackage{subfig,rotating,longtable,lscape,geometry,layouts}
\usepackage{makecell}

%%%%%%%%%%%%%%%%
\begin{document}

\begin{table}[h!] 
\small
%\hspace*{-0.3cm}
\begin{tabular*}{\textwidth}{
    p{1.7cm}|
  @{\extracolsep{\fill}}
  *{4}{
    S[table-format=4.0]
  }
  @{}
}
\hline
 & {\makecell{text}} & {\makecell{text}} & {text} & {text} \\
 \hline
  {text}  &   {text}  &   {text}  &   {text}  & {text}  \\ 
  \hline 
\end{tabular*} 
%\vspace{-0.2cm}
\caption{text} 
\label{idealized}  
\end{table}
\end{document}

Why you have 11 columns, if your table only have 5?

enter image description here

0

As I mentioned in my comment, your question is not clear ... For example, what you like to achieve with

  *{3}{
        S[table-format=4.0]
        S[table-format=4.0]
        S[table-format=4.0]
      }

it is the same as

*{0}{S[table-format=4.0]}

Than why you use S columns if your table body don't contain numbers.

For horizontal rules in table are defined my special lines, from standard \hline and cline to \toprule, \midrule and bottomrule defined in booktabs package and many others. Why you use \rule which is not intended for such an use?

See, if the following guessing what you after is correct:

\documentclass[letter,11pt,twoside]{article}
\usepackage{geometry}
\usepackage{siunitx}
\usepackage{rotating}
\usepackage{array,booktabs,longtable,makecell,multirow}
\setcellgapes{3pt}  % for more vrtical space around cells contents
                    % defined in the 'makecell' package
\usepackage{subfig}
\usepackage{lscape}

\begin{document}
    \begin{table}[ht]
    \makegapedcells % for more vrtical space around cells contents
                    % defined in the 'makecell' package
    \setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{ p{1.7cm}| @{\extracolsep{\fill}}
                              l 
                         *{9}{S[table-format=4.0]}
                            }
    \Xhline{1pt}    % defined in the 'makecell' package
        & some text
        &   {text}  &   {text}  &   {text}  
        &   {text}  &   {text}  &   {text}
        &   {text}  &   {text}  &   {text}  \\
    \hline
text    & some text
        &   1234    &   1234    &   1234    
        &   1234    &   1234    &   1234
        &   1234    &   1234    &   1234    \\
    \Xhline{1pt}
\end{tabular*}
\caption{Caption text}
\label{idealized}
    \end{table}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.