4

I want to stretch my table using tabular*. I'm using following piece of code. I 'm not getting a proper table. The table lines/border look strange.

\documentclass{article}
\usepackage{multirow}
\begin{document}

    \begin{table}
    \centering
    \caption{Standard deviation.}
        %\begin{tabular}{|c|c|c|c|}
   \begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill} } | c | c | c | c | }
    \hline          

    \multirow{3}{*}{Reflectivity(\%)} & \multicolumn{3}{c|}{Distance(m)}\\ \cline{2-4}
                                 & 10 & 25 & 50\\ \cline{2-4}
                                 & \multicolumn{3}{c|}{Noise(mm)}\\ \hline
    10  & 1.2 & 3.0 & 7.5 \\ \hline
    20  & 0.8 & 2.5 & 5.0 \\ \hline
    100 & 0.4 & 1.0 & 2.5 \\ \hline   

        \end{tabular*}
    \label{tab:TLS_I}
\end{table}

\end{document}

MWE

3
  • 1
    Instead of posting a fragment of code, it's much more helpful to embed the fragment in a complete, compilable document so that people can play with the code easily.
    – Alan Munn
    Oct 27, 2013 at 16:34
  • Same problem as in tex.stackexchange.com/q/6836/27635 Oct 27, 2013 at 16:45
  • A suggestion: If you get rid of all vertical lines in the table, no one would notice the fact that the \clines don't connect all the way across and, moreover, the table would look less cluttered and thus be easier to take in.
    – Mico
    Oct 27, 2013 at 18:22

1 Answer 1

5

You can use tabulary instead of tabular* in this simpler way:

\begin{tabulary}{0.75\textwidth}{CCCC}

Only as a matter of style, I made also some other changes ( removing vertical lines and unnecessary horizontal lines, using booktabs commands for horizontal lines and raising a little the caption.

MWE

\documentclass{article}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{tabulary}
\usepackage{caption} 
\captionsetup[table]{skip=5pt}

\begin{document}

   \begin{table}
    \centering
    \caption{Standard deviation.}
   \begin{tabulary}{0.75\textwidth}{ C  C  C  C  }
    \toprule

    \multirow{3}{*}{Reflectivity(\%)} & \multicolumn{3}{c}{Distance (m)}\\ \cmidrule{2-4}
                                 & 10 & 25 & 50\\ \cmidrule{2-4}
                                 & \multicolumn{3}{c}{Noise (mm)}\\ \midrule
    10  & 1.2 & 3.0 & 7.5 \\ 
    20  & 0.8 & 2.5 & 5.0 \\ 
    100 & 0.4 & 1.0 & 2.5 \\ \bottomrule   

        \end{tabulary}
    \label{tab:TLS_I}
\end{table}

\end{document}
2
  • When using the rules of the booktabs package, proper vertical positioning via \multirow becomes difficult, to say the least. In the present case, I'd ditch \multirow entirely and just place "Reflectivity" on the same row as the three distances.
    – Mico
    Oct 27, 2013 at 19:11
  • @Mico You're rigth. A \multirow have nosense in this case. I ignored this issue.
    – Fran
    Oct 27, 2013 at 19:25

You must log in to answer this question.

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