TeX - LaTeX Asked by Banerjee on September 14, 2020
Here is my code:
documentclass[letterpaper]{article} % DO NOT CHANGE THIS
usepackage{times} % DO NOT CHANGE THIS
usepackage{helvet} % DO NOT CHANGE THIS
usepackage{courier} % DO NOT CHANGE THIS
usepackage[hyphens]{url} % DO NOT CHANGE THIS
usepackage{graphicx} % DO NOT CHANGE THIS
urlstyle{rm} % DO NOT CHANGE THIS
defUrlFont{rm} % DO NOT CHANGE THIS
usepackage{graphicx} % DO NOT CHANGE THIS
usepackage{natbib} % DO NOT CHANGE THIS AND DO NOT ADD ANY OPTIONS TO IT
usepackage{caption} % DO NOT CHANGE THIS AND DO NOT ADD ANY OPTIONS TO IT
usepackage{multirow}
usepackage{makecell}
usepackage{adjustbox}
usepackage{amsmath}
usepackage{bm}
usepackage{amssymb}
usepackage{mathtools}
usepackage{textcomp}
usepackage{array}
usepackage{pbox}
frenchspacing % DO NOT CHANGE THIS
setlength{pdfpagewidth}{8.5in} % DO NOT CHANGE THIS
setlength{pdfpageheight}{11in} % DO NOT CHANGE THIS
begin{document}
begin{table*}[ht]
centering
begin{adjustbox}{width=0.9textwidth}
begin{tabular}{c|c|cc|cc|cc|c}
hline
multirow{4}{*}{Network} & multirow{4}{*}{makecell{Score Type}} & multicolumn{2}{c}{multirow{3}{*}{High SNR}} &
multicolumn{2}{c}{multirow{3}{*}{Medium SNR}} &
multicolumn{2}{c}{multirow{3}{*}{Low SNR}} &
multirow{4}{*}{makecell{Timeper epoch(secs)}}
& & MAE & PE (%) & MAE & PE(%) & MAE & PE(%) & hline hline
multirow{2}{*}{SVR}
& R & 8.89$pm$2.07 & 100$pm$0.00 & 9.23$pm$1.85 & 100$pm$0.00 & 9.70$pm$1.38 & 100$pm$0.00 & multirow{2}{*}{---}
& E & 9.97$pm$2.45 & 96.29$pm$8.30 & 10.08$pm$2.46 & 96.28$pm$8.32 & 10.31$pm$1.56 & 96.40$pm$8.05 & hline
multirow{2}{*}{Lasso}
& R & 18.57$pm$5.28 & 44.89$pm$21.06 & 18.56$pm$5.28 & 44.84$pm$21.12 & 18.55$pm$5.24 & 44.85$pm$21.02 & multirow{2}{*}{---}
& E & 18.60$pm$3.58 & 43.19$pm$8.66 & 18.60$pm$3.57 & 42.95$pm$8.50 & 18.61$pm$3.56 & 43.01$pm$8.61 & hline
end{tabular}
end{adjustbox}
caption{....}
label{table:tab2}
end{table*}
end{document}
Here are three different examples showing how to...
adjustbox
In the first two examples, I have removed adjustbox
and instead used a landscape page for the wide table, while I entirely changed the table layout in the third example. In the second and third example, I have removed all vertical lines and replaced the horizontal ones by rules from the booktabs
package. Additionally, I used the siunitx
package in order to improve the alignment of the numbers:
documentclass[letterpaper]{article} % DO NOT CHANGE THIS
usepackage{times} % DO NOT CHANGE THIS
usepackage{helvet} % DO NOT CHANGE THIS
usepackage{courier} % DO NOT CHANGE THIS
usepackage[hyphens]{url} % DO NOT CHANGE THIS
usepackage{graphicx} % DO NOT CHANGE THIS
urlstyle{rm} % DO NOT CHANGE THIS
defUrlFont{rm} % DO NOT CHANGE THIS
usepackage{graphicx} % DO NOT CHANGE THIS
usepackage{natbib} % DO NOT CHANGE THIS AND DO NOT ADD ANY OPTIONS TO IT
usepackage{caption} % DO NOT CHANGE THIS AND DO NOT ADD ANY OPTIONS TO IT
usepackage{multirow}
usepackage{makecell}
usepackage{adjustbox}
usepackage{amsmath}
usepackage{bm}
usepackage{amssymb}
usepackage{mathtools}
usepackage{textcomp}
usepackage{array}
usepackage{pbox}
frenchspacing % DO NOT CHANGE THIS
setlength{pdfpagewidth}{8.5in} % DO NOT CHANGE THIS
setlength{pdfpageheight}{11in} % DO NOT CHANGE THIS
usepackage{pdflscape}
usepackage{booktabs}
usepackage{siunitx}
begin{document}
begin{landscape}
begin{table}
centering
begin{tabular}{c|c|cc|cc|cc|c}
hline
multirow{3}{*}{Network} & multirow{3}{*}{makecell{Score Type}} & multicolumn{2}{c|}{multirow{3}{*}{High SNR}} &
multicolumn{2}{c|}{multirow{2}{*}{Medium SNR}} &
multicolumn{2}{c|}{multirow{2}{*}{Low SNR}} &
multirow{3}{*}{makecell{Timeper epoch(secs)}}
& & & & & & & &
& & MAE & PE (%) & MAE & PE(%) & MAE & PE(%) & hline hline
multirow{2}{*}{SVR}
& R & 8.89$pm$2.07 & 100$pm$0.00 & 9.23$pm$1.85 & 100$pm$0.00 & 9.70$pm$1.38 & 100$pm$0.00 & multirow{2}{*}{---}
& E & 9.97$pm$2.45 & 96.29$pm$8.30 & 10.08$pm$2.46 & 96.28$pm$8.32 & 10.31$pm$1.56 & 96.40$pm$8.05 & hline
multirow{2}{*}{Lasso}
& R & 18.57$pm$5.28 & 44.89$pm$21.06 & 18.56$pm$5.28 & 44.84$pm$21.12 & 18.55$pm$5.24 & 44.85$pm$21.02 & multirow{2}{*}{---}
& E & 18.60$pm$3.58 & 43.19$pm$8.66 & 18.60$pm$3.57 & 42.95$pm$8.50 & 18.61$pm$3.56 & 43.01$pm$8.61 & hline
end{tabular}
caption{....}
label{table:tab2}
end{table}
end{landscape}
begin{landscape}
begin{table}
centering
sisetup{separate-uncertainty=true}
setlength{tabcolsep}{5.5pt}
begin{tabular}{l l *{3}{S[table-format=2.2(3)]S[table-format=3.2(4)]} c}
toprule
Network
& makecell{Score Type}
& multicolumn{2}{c}{High SNR}
& multicolumn{2}{c}{Medium SNR}
& multicolumn{2}{c}{Low SNR}
& makecell{Timeper epoch(secs)}
cmidrule(r){3-4} cmidrule(lr){5-6} cmidrule(l){7-8}
& & {MAE} & {PE (%)} & {MAE} & {PE(%)} & {MAE} & {PE(%)} &
midrule
SVR
& R & 8.89(207) & 100(0) & 9.23(185) & 100(0) & 9.70(138) & 100(0) & ---
& E & 9.97(245) & 96.29(830) & 10.08(246) & 96.28(832) & 10.31(156) & 96.40(805) & ---
midrule
Lasso
& R & 18.57(528) & 44.89(2106) & 18.56(528) & 44.84(2112) & 18.55(524) & 44.85(2102) & ---
& E & 18.60(358) & 43.19(866) & 18.60(357) & 42.95(850) & 18.61(356) & 43.01(861) & ---
bottomrule
end{tabular}
caption{....}
label{table:tab2}
end{table}
end{landscape}
begin{table}
centering
sisetup{separate-uncertainty=true}
setlength{tabcolsep}{5.5pt}
begin{tabular}{l l S[table-format=2.2(3)]S[table-format=3.2(4)] c}
toprule
Network
& multirow{2}{*}{makecell{Score Type}}
& multicolumn{2}{c}{High SNR}
& multirow{2}{*}{makecell{Time per epoch (secs)}}
cmidrule(r){3-4}
& & {MAE} & {PE (%)}
midrule
SVR
& R & 8.89(207) & 100(0) & ---
& E & 9.97(245) & 96.29(830) & ---
addlinespace
Lasso
& R & 18.57(528) & 44.89(2106) & ---
& E & 18.60(358) & 43.19(866) & ---
midrule
Network
& multirow{2}{*}{makecell{Score Type}}
& multicolumn{2}{c}{Medium SNR}
& multirow{2}{*}{makecell{Time per epoch (secs)}}
cmidrule(r){3-4}
& & {MAE} & {PE (%)}
midrule
SVR
& R & 9.23(185) & 100(0) & ---
& E & 10.08(246) & 96.28(832) & ---
addlinespace
Lass
& R & 18.56(528) & 44.84(2112) & ---
& E & 18.60(357) & 42.95(850) & ---
midrule
Network
& multirow{2}{*}{makecell{Score Type}}
& multicolumn{2}{c}{Low SNR}
& multirow{2}{*}{makecell{Time per epoch (secs)}}
cmidrule(r){3-4}
& & {MAE} & {PE (%)}
midrule
SVR
& R & 9.70(138) & 100(0) & ---
& E & 10.31(156) & 96.40(805) & ---
addlinespace
Lass
& R & 18.55(524) & 44.85(2102) & ---
& E & 18.61(356) & 43.01(861) & ---
midrule
end{tabular}
caption{....}
label{table:tab2}
end{table}
end{document}
Answered by leandriis on September 14, 2020
You haven't indicated how wide your document's margins are. Assuming they're about 1" wide each, it's actually possible to typeset the table in portrait mode without having to resort to the adjustbox
cudgel.
Since your document employs the times
text font package, I would like to strongly encourage you to use a Times Roman math font package; one such package is newtxmath
.
I would also like to encourage you to give a table a much more open "look", mainly by getting rid of all vertical rules and by using fewer, but well-spaced, horizontal rules by using the line-drawing macros of the booktabs
package.
Just to demonstrate the most unfortunate effects that using adjustbox
can have on tables, here's a screenshot of the table that's produced by your original code. Note, in particular, the wild disparity in font sizes of the body of the table on the one hand and of the caption on the other.
Finally, here's the code that produced the first screenshot.
documentclass[letterpaper]{article}
usepackage{amsmath,booktabs,multirow,makecell}
usepackage[margin=1in]{geometry} % set margins as needed
usepackage{times,newtxmath} % use a Times Roman math font
usepackage{array}
newcolumntype{C}{>{$}c<{$}}
newcommandx[1][1]{phantom{#1}} % for spacing adjustments
newcommandpx{mathord{pm}} % "pm" but without the spacing
begin{document}
begin{table}[ht]
setlengthtabcolsep{0pt}## Heading ##
begin{tabular*}{textwidth}{@{extracolsep{fill}}
l c *{6}{C} c }
toprule
Network
& makecell{ScoreType}
& multicolumn{2}{c}{High SNR}
& multicolumn{2}{c}{Medium SNR}
& multicolumn{2}{c}{Low SNR}
& makecell{Timeper epoch}
cmidrule{3-4} cmidrule{5-6} cmidrule{7-8}
& & text{MAE} & text{PE (%)}
& text{MAE} & text{PE (%)}
& text{MAE} & text{PE (%)}
& (secs)
midrule
multirow{2}{*}{SVR}
& R & x8.89px2.07 & x[1.]100pxx0.00 & x9.23px1.85
& x[1.]100pxx0.00 & x9.70px1.38 & x[1.]100pxx0.00
& multirow{2}{*}{--}
& E & x9.97px2.45 & 96.29pxx8.30 & 10.08px2.46
& 96.28pxx8.32 & 10.31px1.56 & 96.40pxx8.05 &
addlinespace
multirow{2}{*}{Lasso}
& R & 18.57px5.28 & 44.89px21.06 & 18.56px5.28
& 44.84px21.12 & 18.55px5.24 & 44.85px21.02
& multirow{2}{*}{--}
& E & 18.60px3.58 & 43.19pxx8.66 & 18.60px3.57
& 42.95pxx8.50 & 18.61px3.56 & 43.01pxx8.61 &
bottomrule
end{tabular*}
caption{dots}
label{table:tab2}
end{table}
end{document}
Answered by Mico on September 14, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP