5
\documentclass[11pt]{article}
\usepackage{multirow}
\begin{document}
\begin{table}[b] 
    \centering
\caption{It's a table I simulated concerned with my question.
 } 
\medskip
\label{table:coverage_simulation}
\begin{tabular*}{\columnwidth}{@{ }
l@{\extracolsep{\fill}}@{ }l@{\extracolsep{\fill}}@{ }c@{\extracolsep{\fill}}@{ }c@{\extracolsep{\fill}} @{ }c@{\extracolsep{\fill}}@{\extracolsep{4pt}}c@{\extracolsep{\fill}}@{ }c@{\extracolsep{\fill}}@{ }c@{\extracolsep{\fill}} @{\extracolsep{4pt} }c@{\extracolsep{\fill}}@{ }c@{\extracolsep{\fill}}@{ }c@{\extracolsep{\fill}}@{ \extracolsep{4pt}}c@{\extracolsep{\fill}}@{ }c@{\extracolsep{\fill}}@{ }c@{\extracolsep{\fill}}@{ }} \hline
    \centering
    \centering
      & &  \multicolumn {6}{c}{$n1$} &  \multicolumn {6}{c}{$n2$}\\ \cline{3-8} \cline{9-14}
      & &  \multicolumn {3}{c}{$s1 $} &\multicolumn {3}{c}{$s2$} &  \multicolumn {3}{c}{$s1$} &\multicolumn {3}{c}{$s2$} \\ \cline{3-5} \cline{6-8} \cline{9-11} \cline{12-14}
    RR & A & B & C & D  & E & F & G & H & I & J  & K & L & M
    \\ \hline
    \multirow{2}{*}{C1}  &   $\alpha$  &1.123&1.123&1.123&1.123&1.123&1.123&1.1234&1.1234&1.123&1.1243&1.1243&1.123\\
                                               &   $\alpha$  &1.123&1.123&1.123&1.123&1.123&1.123&1.1234&1.1234&1.123&1.1243&1.1243&1.123\\ \hline
             \multirow{2}{*}{C2}  &   $\alpha$  &1.123&1.123&1.123&1.123&1.123&1.123&1.1234&1.1234&1.123&1.1243&1.1243&1.123     \\
                                               &   $\alpha$  &1.123&1.123&1.123&1.123&1.123&1.123&1.1234&1.1234&1.123&1.1243&1.1243&1.123 \\ \hline
            C3 &   $\alpha$  &1.123&1.123&1.123&1.123&1.123&1.123&1.1234&1.1234&1.123&1.1243&1.1243&1.123    \\
       C4 &   $\alpha$  &1.123&1.123&1.123&1.123&1.123&1.123&1.1234&1.1234&1.123&1.1243&1.1243&1.123        \\ \hline
\end{tabular*} 
\end{table} 
\end{document}

It is strange that \hline can not be as long as tablular*.

  • 2
    welcome to tex.se! it is not strange when your table is wider than text width.. make your table narrower :-) – Zarko Jun 17 '18 at 7:43
  • how can i make my table narrower? – Lann Jun 17 '18 at 7:47
  • 2
    your table has more issues. (i) column headers are very unusual defined, consequently it doesn't work as you expected, (ii) use smaller font (iii) or make text width wider. – Zarko Jun 17 '18 at 7:55
  • Well if you data is too wide there is little you can do to make your table narrower: You have to redesign the table. You could make the font smaller (not great idea, I think). You could rotate it. You could split it in two (one for $n_1$ and one for $n_2$). Which of these options makes sense and is possible for you depends on your actual use case. – moewe Jun 17 '18 at 8:04
8

it is not strange when your table is wider than text width. make your table narrower or text width wider.

in the both cases you should redefined columns headers. as are in your mwe (minimal working example) are at are very unusual defined, consequently it doesn't work as you expected. i suggest the following changes (in code indicated with comments) in your table:

\documentclass[11pt]{article}
\usepackage{booktabs, multirow}

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

\begin{document}
    \begin{table}[bt]
\caption{It's a table I simulated concerned with my question.}
\label{table:coverage_simulation}
\setlength\tabcolsep{0pt}   % added
\small                      % added
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} % completely rewritten
                            l l *{12}{c}}
    \toprule % used instead \hline
    &   & \multicolumn{6}{c}{$n1$}  & \multicolumn{6}{c}{$n2$}  \\
    \cmidrule(r){3-8}\cmidrule(l){9-14} % used instead \cline
    &   & \multicolumn{3}{c}{$s1$}  & \multicolumn{3}{c}{$s2$}
        & \multicolumn{3}{c}{$s1$}  & \multicolumn{3}{c}{$s2$}  \\
    \cmidrule(lr){3-5}\cmidrule(lr){6-8}\cmidrule(lr){9-11}\cmidrule(l){12-14}
RR & A & B & C & D  & E & F & G & H & I & J  & K & L & M        \\
    \midrule
\multirow{2}{*}{C1}
    & $\alpha$  &1.123&1.123&1.123&1.123&1.123&1.123&1.1234&1.1234&1.123&1.1243&1.1243&1.123    \\
    & $\alpha$  &1.123&1.123&1.123&1.123&1.123&1.123&1.1234&1.1234&1.123&1.1243&1.1243&1.123    \\
    \addlinespace % used instead \hline, you can replace it with \midrule
\multirow{2}{*}{C2}
    & $\alpha$  &1.123&1.123&1.123&1.123&1.123&1.123&1.1234&1.1234&1.123&1.1243&1.1243&1.123    \\
    & $\alpha$  &1.123&1.123&1.123&1.123&1.123&1.123&1.1234&1.1234&1.123&1.1243&1.1243&1.123    \\
    \addlinespace
C3  & $\alpha$  &1.123&1.123&1.123&1.123&1.123&1.123&1.1234&1.1234&1.123&1.1243&1.1243&1.123    \\
C4  & $\alpha$  &1.123&1.123&1.123&1.123&1.123&1.123&1.1234&1.1234&1.123&1.1243&1.1243&1.123    \\
    \bottomrule
\end{tabular*}
    \end{table}
\end{document}

which gives

enter image description here

(red lines indicate text border)

as you can see, table is now fitted into text width, and lines are not longer as before, but the readability of table is low. between columns is to small spaces. this can be improved with define wider text width (is this is alowed), for example by adding

\usepackage[margin=25mm]{geometry}

in your document preamble. in this case you will obtain:

enter image description here

or reorganize table as suggest moewe in his comment or consider to rotate it (also suggest by moewe).

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.