¿Cómo uno las líneas verticales aquí en la tabla?

¿Cómo uno las líneas verticales aquí en la tabla?

Aquí está mi código:

\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
\def\UrlFont{\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.9\textwidth}
\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{Time\\per 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}

Respuesta1

Aquí hay tres ejemplos diferentes que muestran cómo...

  1. haz que tu código sea compilable,
  2. deshacerse de los espacios en las líneas verticales
  3. encaja tu mesa en el espacio disponible sin usaradjustbox
  4. mejorar la alineación de los números dentro de la tabla.

En los dos primeros ejemplos, eliminé adjustboxy en su lugar usé una página horizontal para la tabla ancha, mientras que en el tercer ejemplo cambié por completo el diseño de la tabla. En el segundo y tercer ejemplo, eliminé todas las líneas verticales y reemplacé las horizontales por reglas del booktabspaquete. Además, utilicé el siunitxpaquete para mejorar la alineación de los números:

ingrese la descripción de la imagen aquí

ingrese la descripción de la imagen aquí

ingrese la descripción de la imagen aquí

\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
\def\UrlFont{\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{Time\\per 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{Time\\per 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}

Respuesta2

No ha indicado qué tan anchos son los márgenes de su documento. Suponiendo que miden aproximadamente 1" de ancho cada uno, en realidad es posible componer la mesa en modo vertical.sintener que recurrir al \adjustboxgarrote.

Dado que su documento emplea el timespaquete de fuentes de texto, me gustaría recomendarle encarecidamente que utilice un paquete de fuentes matemáticas Times Roman; uno de esos paquetes es newtxmath.

También me gustaría animarle a que le dé a la tabla un "aspecto" mucho más abierto, principalmente eliminando todas las reglas verticales y utilizando menos reglas horizontales, pero bien espaciadas, mediante el uso de las macros de dibujo lineal del booktabspaquete.

ingrese la descripción de la imagen aquí


Solo para demostrar los efectos más desafortunados que el uso \adjustboxpuede tener en las tablas, aquí hay una captura de pantalla de la tabla producida por su código original. Nótese, en particular, la gran disparidad en los tamaños de fuente del cuerpo de la tabla, por un lado, y del título, por el otro.

ingrese la descripción de la imagen aquí


Finalmente, aquí está el código que produjo la primera captura de pantalla.

\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<{$}}
\newcommand\x[1][1]{\phantom{#1}} % for spacing adjustments
\newcommand\px{\mathord{\pm}} % "\pm" but without the spacing
\begin{document}
\begin{table}[ht]
\setlength\tabcolsep{0pt}## Heading ##
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} 
           l c *{6}{C} c }
\toprule
Network 
  & \makecell{Score\\Type} 
  & \multicolumn{2}{c}{High SNR} 
  & \multicolumn{2}{c}{Medium SNR} 
  & \multicolumn{2}{c}{Low SNR} 
  & \makecell{Time\\per 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.89\px2.07      & \x[1.]100\px\x0.00 & \x9.23\px1.85 
    & \x[1.]100\px\x0.00 & \x9.70\px1.38      & \x[1.]100\px\x0.00 
    & \multirow{2}{*}{--} \\ 
& E & \x9.97\px2.45      & 96.29\px\x8.30     & 10.08\px2.46 
    & 96.28\px\x8.32     & 10.31\px1.56       & 96.40\px\x8.05 & \\ 
\addlinespace
\multirow{2}{*}{Lasso}                                                         
& R & 18.57\px5.28       & 44.89\px21.06      & 18.56\px5.28 
    & 44.84\px21.12      & 18.55\px5.24       & 44.85\px21.02 
    & \multirow{2}{*}{--} \\
& E & 18.60\px3.58       & 43.19\px\x8.66     &  18.60\px3.57 
    & 42.95\px\x8.50     &  18.61\px3.56      & 43.01\px\x8.61 & \\ 
\bottomrule
\end{tabular*} 
\caption{\dots}
\label{table:tab2}
\end{table}
\end{document}

información relacionada