\documentclass[11pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{array}
\usepackage{float}
\usepackage[export]{adjustbox}
\graphicspath{ {./images/} }
\usepackage{enumitem}
\usepackage{nameref}
\usepackage{amsfonts,amsmath,amssymb,amsthm,etoolbox}
\usepackage[version=4]{mhchem}
\usepackage{stmaryrd}
\usepackage{hyperref}
\hypersetup{colorlinks=true, linkcolor=blue, filecolor=magenta, urlcolor=cyan,}
\urlstyle{same}
\usepackage[vmargin=1.0in, left=1in, right=1.in,
footskip=2.0cm, % footskip margin
]{geometry}
\begin{document}
\begin{table}[]
\caption{}
\label{tab:my-table}
\begin{tabular}{llllllllll}
\multirow{3}{*}{Chrom Length} & \multicolumn{9}{l}{Success Rate (\%)} \\
& \multicolumn{3}{l}{SRP 1} & \multicolumn{3}{l}{SRP 2} & \multicolumn{3}{l}{SRP 3} \\
& Contr. Opr. & Slice Cross. & Comb. & Contr. Opr. & Slice Cross. & Comb. & Contr. Opr. & Slice Cross. & Comb. \\
11 & 40 & 88 & 85 & 0 & 0 & 0 & 5 & 3 & 8 \\
\multirow{3}{*}{15} & 56 & 94 & 97 & 0 & 0 & 0 & 4 & 10 & 5 \\
& 61 & 99 & 100 & 0 & 7 & 6 & 3 & 6 & 13 \\
& 62 & 100 & 98 & 0 & 23 & 21 & 5 & 8 & 12 \\
\multirow{3}{*}{27} & 58 & 97 & 100 & 0 & 38 & 37 & 3 & 13 & 14 \\
& 65 & 100 & 98 & 2 & 41 & 44 & 4 & 14 & 13 \\
& 69 & 99 & 99 & 6 & 52 & 42 & 7 & 7 & 10 \\
39 & 72 & 97 & 99 & 10 & 49 & 57 & 7 & 8 & 8 \\
43 & 74 & 94 & 96 & 7 & 57 & 59 & 3 & 12 & 8 \\
47 & 66 & 94 & 95 & 9 & 49 & 62 & 5 & 11 & 13 \\
51 & 79 & 97 & 94 & 10 & 62 & 61 & 5 & 8 & 9 \\
55 & 80 & 96 & 97 & 11 & 70 & 58 & 5 & 7 & 6 \\
59 & 73 & 96 & 98 & 12 & 59 & 51 & 0 & 7 & 10 \\
63 & 75 & 98 & 95 & 17 & 60 & 68 & 3 & 8 & 7 \\
67 & 74 & 99 & 96 & 21 & 66 & 63 & 4 & 8 & 4 \\
71 & 78 & 98 & 93 & 20 & 59 & 68 & 0 & 3 & 4 \\
75 & 75 & 96 & 96 & 16 & 61 & 72 & 3 & 3 & 9 \\
79 & 78 & 100 & 99 & 16 & 61 & 58 & 1 & 8 & 8 \\
83 & 69 & 96 & 98 & 18 & 74 & 71 & 1 & 5 & 11 \\
87 & 77 & 94 & 98 & 24 & 70 & 56 & 1 & 7 & 9 \\
91 & 72 & 97 & 92 & 20 & 67 & 68 & 4 & 5 & 4 \\
95 & 76 & 97 & 93 & 20 & 52 & 61 & 0 & 7 & 8 \\
99 & 82 & 91 & 95 & 24 & 68 & 63 & 4 & 4 & 2 \\
103 & 77 & 94 & 98 & 25 & 56 & 61 & 1 & 7 & 6 \\
Average & 70.33 & 96.29 & 96.21 & 12.00 & 50.04 & 50.29 & 3.25 & 7.46 & 8.38
\end{tabular}
\end{table}
\end{document}
- 6,690
- 5
- 26
- 47
- 161
3 Answers
Like this?
(red lines show page layout)
- Column headers are to wide, write thwo in two lines!
- By use of
tblroftabularraywith librariesbooktabsandsiunitx:
\documentclass[11pt,a4paper]{report}
\usepackage[margin=1.0in,
footskip=2.0cm, % footskip margin
]{geometry}
%--------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%
\usepackage{lipsum} % for dummy text
%---------------------------------------------------------------%
\usepackage[T1]{fontenc}
\usepackage[skip=1ex]{caption}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\begin{document}
\lipsum[66]
\begin{table}[ht]
\caption{}
\label{tab:my-table}
\begin{tblr}{colspec = {@{} {2}{X[c, si={table-format=2.0}]}
{2}{X[c, si={table-format=3.0}]}
*{6}{X[c, si={table-format=2.0}]}
@{} },
cell{2}{2,5,8} = {c=3}{c},
row{1-3,Z} = {guard,b},
rowsep = 1pt
}
\toprule
\SetCell[r=3]{l} Chrome Length
& \SetCell[c=9]{c} Source rate
& & & & & & & & \
\cmidrule{2-10}
& SRP 1
& & & SRP 2
& & & SRP 2
& & \
\cmidrule[lr]{2-4}
\cmidrule[lr]{5-7}
\cmidrule[lr]{8-10}
& Contr. Opr. & Slice Cross. & Comb.
& Contr. Opr. & Slice Cross. & Comb.
& Contr. Opr. & Slice Cross. & Comb. \
\midrule
11 & 40 & 88 & 85 & 0 & 0 & 0 & 5 & 3 & 8 \
\midrule[dashed, 0.15pt]
& 56 & 94 & 97 & 0 & 0 & 0 & 4 & 10 & 5 \
15 & 61 & 99 & 100 & 0 & 7 & 6 & 3 & 6 & 13 \
& 62 & 100 & 98 & 0 & 23 & 21 & 5 & 8 & 12 \
\midrule[dashed, 0.15pt]
& 58 & 97 & 100 & 0 & 38 & 37 & 3 & 13 & 14 \
27 & 65 & 100 & 98 & 2 & 41 & 44 & 4 & 14 & 13 \
& 69 & 99 & 99 & 6 & 52 & 42 & 7 & 7 & 10 \
\midrule[dashed, 0.15pt]
39 & 72 & 97 & 99 & 10 & 49 & 57 & 7 & 8 & 8 \
43 & 74 & 94 & 96 & 7 & 57 & 59 & 3 & 12 & 8 \
47 & 66 & 94 & 95 & 9 & 49 & 62 & 5 & 11 & 13 \
51 & 79 & 97 & 94 & 10 & 62 & 61 & 5 & 8 & 9 \
55 & 80 & 96 & 97 & 11 & 70 & 58 & 5 & 7 & 6 \
59 & 73 & 96 & 98 & 12 & 59 & 51 & 0 & 7 & 10 \
63 & 75 & 98 & 95 & 17 & 60 & 68 & 3 & 8 & 7 \
67 & 74 & 99 & 96 & 21 & 66 & 63 & 4 & 8 & 4 \
71 & 78 & 98 & 93 & 20 & 59 & 68 & 0 & 3 & 4 \
75 & 75 & 96 & 96 & 16 & 61 & 72 & 3 & 3 & 9 \
79 & 78 & 100 & 99 & 16 & 61 & 58 & 1 & 8 & 8 \
83 & 69 & 96 & 98 & 18 & 74 & 71 & 1 & 5 & 11 \
87 & 77 & 94 & 98 & 24 & 70 & 56 & 1 & 7 & 9 \
91 & 72 & 97 & 92 & 20 & 67 & 68 & 4 & 5 & 4 \
95 & 76 & 97 & 93 & 20 & 52 & 61 & 0 & 7 & 8 \
99 & 82 & 91 & 95 & 24 & 68 & 63 & 4 & 4 & 2 \
103 & 77 & 94 & 98 & 25 & 56 & 61 & 1 & 7 & 6 \
Average
& 70.33 & 96.29 & 96.21 & 12.00 & 50.04 & 50.29 & 3.25 & 7.46 & 8.38 \
\bottomrule
\end{tblr}
\end{table}
\lipsum[66]
\end{document}
- 296,517
Here's a solution that employs the machinery of the tabularx package to assure that the table fits within the width of the text block. By using the X column type in all ten columns, LaTeX can insert line breaks in cells if and when needed.
Separately, I would also employ the macros of the booktabs package to provide some additional visual structure, both in the table's header rows and in the body of the table. See, in particular, the use of \addlinespace directives in the following code to provide some (hopefully helpful) visual rhythm.
\documentclass[11pt,a4paper]{report}
%%\usepackage[utf8]{inputenc} % that's the default nowadays
\usepackage[T1]{fontenc}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{array}
\usepackage{float}
\usepackage[export]{adjustbox}
\graphicspath{ {./images/} }
\usepackage{enumitem}
\usepackage{nameref}
\usepackage{%amsfonts, % is loaded automatically by 'amssymb'
amsmath,amssymb,amsthm,etoolbox}
\usepackage[version=4]{mhchem}
\usepackage{stmaryrd}
\usepackage{hyperref}
\usepackage{xurl}
\urlstyle{same}
\hypersetup{colorlinks=true, linkcolor=blue,
filecolor=magenta, urlcolor=cyan}
\usepackage[margin=1in, footskip=2cm]{geometry}
%% New code
\usepackage{tabularx,ragged2e,booktabs}
\newcolumntype{L}{>{\RaggedRight}X}
\newcolumntype{C}{>{\Centering}X}
\newcommand\mytab[1]{\smash[b]{%
\begin{tabular}[t]{@{}p{\hsize}@{}} #1 \end{tabular}}}
\begin{document}
\begin{table}[ht]
\caption{A ten-column table\strut}
\label{tab:my-table}
\begin{tabularx}{\textwidth}{@{} L {9}{C} @{}}
\toprule
\mytab{Chrom Length} & \multicolumn{9}{c@{}}{Success Rate (%)}\
\cmidrule(l){2-10}
& \multicolumn{3}{c}{SRP 1}
& \multicolumn{3}{c}{SRP 2}
& \multicolumn{3}{c@{}}{SRP 3} \
\cmidrule(lr){2-4} \cmidrule(lr){5-7} \cmidrule(l){8-10}
& Contr.\ Opr. & Slice Cross. & Comb.
& Contr.\ Opr. & Slice Cross. & Comb.
& Contr.\ Opr. & Slice Cross. & Comb. \
\midrule
11 & 40 & 88 & 85 & 0 & 0 & 0 & 5 & 3 & 8 \
\addlinespace
\multirow{3}{}{15}
& 56 & 94 & 97 & 0 & 0 & 0 & 4 & 10 & 5 \
& 61 & 99 & 100 & 0 & 7 & 6 & 3 & 6 & 13 \
& 62 & 100 & 98 & 0 & 23 & 21 & 5 & 8 & 12 \
\addlinespace
\multirow{3}{*}{27}
& 58 & 97 & 100 & 0 & 38 & 37 & 3 & 13 & 14 \
& 65 & 100 & 98 & 2 & 41 & 44 & 4 & 14 & 13 \
& 69 & 99 & 99 & 6 & 52 & 42 & 7 & 7 & 10 \
\addlinespace
39 & 72 & 97 & 99 & 10 & 49 & 57 & 7 & 8 & 8 \
43 & 74 & 94 & 96 & 7 & 57 & 59 & 3 & 12 & 8 \
47 & 66 & 94 & 95 & 9 & 49 & 62 & 5 & 11 & 13 \
51 & 79 & 97 & 94 & 10 & 62 & 61 & 5 & 8 & 9 \
55 & 80 & 96 & 97 & 11 & 70 & 58 & 5 & 7 & 6 \
\addlinespace
59 & 73 & 96 & 98 & 12 & 59 & 51 & 0 & 7 & 10 \
63 & 75 & 98 & 95 & 17 & 60 & 68 & 3 & 8 & 7 \
67 & 74 & 99 & 96 & 21 & 66 & 63 & 4 & 8 & 4 \
71 & 78 & 98 & 93 & 20 & 59 & 68 & 0 & 3 & 4 \
75 & 75 & 96 & 96 & 16 & 61 & 72 & 3 & 3 & 9 \
\addlinespace
79 & 78 & 100 & 99 & 16 & 61 & 58 & 1 & 8 & 8 \
83 & 69 & 96 & 98 & 18 & 74 & 71 & 1 & 5 & 11 \
87 & 77 & 94 & 98 & 24 & 70 & 56 & 1 & 7 & 9 \
91 & 72 & 97 & 92 & 20 & 67 & 68 & 4 & 5 & 4 \
95 & 76 & 97 & 93 & 20 & 52 & 61 & 0 & 7 & 8 \
\addlinespace
99 & 82 & 91 & 95 & 24 & 68 & 63 & 4 & 4 & 2 \
103 & 77 & 94 & 98 & 25 & 56 & 61 & 1 & 7 & 6 \
\midrule
Average & 70.33 & 96.29 & 96.21 & 12.00 & 50.04 & 50.29 & 3.25 & 7.46 & 8.38 \
\bottomrule
\end{tabularx}
\end{table}
\end{document}
- 506,678
I'd not use \multirow for the 15 and 27 groups: the output would be very ambiguous. An empty cell after one in the first column will be interpreted as “repeat the previous value”.
I'd also use siunitx, besides booktabs, in order to improve the appearance. The \splitcell command helps in setting complex cells; the *-variant also applies \smash.
Provide a caption text: your readers will appreciate.
\documentclass[11pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[
vmargin=1.0in,
left=1in,
right=1.in,
footskip=2.0cm, % footskip margin
]{geometry}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{graphicx}
\usepackage{array}
\usepackage[export]{adjustbox}
\usepackage{enumitem}
\usepackage{nameref}
\usepackage{caption}
\usepackage{amsfonts,amsmath,amssymb,amsthm,etoolbox}
\usepackage[version=4]{mhchem}
\usepackage{stmaryrd}
\usepackage{hyperref}
\hypersetup{colorlinks=true, linkcolor=blue, filecolor=magenta, urlcolor=cyan,}
\urlstyle{same}
\graphicspath{ {./images/} }
\NewDocumentCommand{\splitcell}{sm}{%
\IfBooleanT{#1}{\smash}{\begin{tabular}[t]{@{}c@{}}#2\end{tabular}}%
}
\begin{document}
\begin{table}[htp]
\caption{A caption here, please}
\label{tab:my-table}
\begin{tabular}{
@{}
S[table-format=3.0]
S[table-format=2.0]
S[table-format=3.0]
S[table-format=3.0]
S[table-format=2.0]
S[table-format=2.0]
S[table-format=2.0]
S[table-format=2.0]
S[table-format=2.0]
S[table-format=2.0]
@{}
}
\toprule
\splitcell*{Chrom \ Length} & \multicolumn{9}{c}{Success Rate (%)} \
\cmidrule(l){2-10}
& \multicolumn{3}{c}{SRP 1} & \multicolumn{3}{c}{SRP 2} & \multicolumn{3}{c}{SRP 3} \
\cmidrule(lr){2-4} \cmidrule(lr){5-7} \cmidrule(l){8-10}
& \splitcell{Contr. \ Opr.} & \splitcell{Slice \ Cross.} & {Comb.}
& \splitcell{Contr. \ Opr.} & \splitcell{Slice \ Cross.} & {Comb.}
& \splitcell{Contr. \ Opr.} & \splitcell{Slice \ Cross.} & {Comb.} \
\midrule
11 & 40 & 88 & 85 & 0 & 0 & 0 & 5 & 3 & 8 \
15 & 56 & 94 & 97 & 0 & 0 & 0 & 4 & 10 & 5 \
& 61 & 99 & 100 & 0 & 7 & 6 & 3 & 6 & 13 \
& 62 & 100 & 98 & 0 & 23 & 21 & 5 & 8 & 12 \
27 & 58 & 97 & 100 & 0 & 38 & 37 & 3 & 13 & 14 \
& 65 & 100 & 98 & 2 & 41 & 44 & 4 & 14 & 13 \
& 69 & 99 & 99 & 6 & 52 & 42 & 7 & 7 & 10 \
39 & 72 & 97 & 99 & 10 & 49 & 57 & 7 & 8 & 8 \
43 & 74 & 94 & 96 & 7 & 57 & 59 & 3 & 12 & 8 \
47 & 66 & 94 & 95 & 9 & 49 & 62 & 5 & 11 & 13 \
51 & 79 & 97 & 94 & 10 & 62 & 61 & 5 & 8 & 9 \
55 & 80 & 96 & 97 & 11 & 70 & 58 & 5 & 7 & 6 \
59 & 73 & 96 & 98 & 12 & 59 & 51 & 0 & 7 & 10 \
63 & 75 & 98 & 95 & 17 & 60 & 68 & 3 & 8 & 7 \
67 & 74 & 99 & 96 & 21 & 66 & 63 & 4 & 8 & 4 \
71 & 78 & 98 & 93 & 20 & 59 & 68 & 0 & 3 & 4 \
75 & 75 & 96 & 96 & 16 & 61 & 72 & 3 & 3 & 9 \
79 & 78 & 100 & 99 & 16 & 61 & 58 & 1 & 8 & 8 \
83 & 69 & 96 & 98 & 18 & 74 & 71 & 1 & 5 & 11 \
87 & 77 & 94 & 98 & 24 & 70 & 56 & 1 & 7 & 9 \
91 & 72 & 97 & 92 & 20 & 67 & 68 & 4 & 5 & 4 \
95 & 76 & 97 & 93 & 20 & 52 & 61 & 0 & 7 & 8 \
99 & 82 & 91 & 95 & 24 & 68 & 63 & 4 & 4 & 2 \
103 & 77 & 94 & 98 & 25 & 56 & 61 & 1 & 7 & 6 \
\midrule
{Average} & {70.33} & {96.29} & {96.21} & {12.00} & {50.04} & {50.29} & {3.25} & {7.46} & {8.38} \
\bottomrule
\end{tabular}
\end{table}
\end{document}
- 1,121,712



geometry-package optionsvmargin=1.0in, left=1in, right=1.inmay be written more compactly asmargin=1in. – Mico May 01 '23 at 13:27