Alineación de tabla de muchas columnas con columna de papel

Alineación de tabla de muchas columnas con columna de papel

Estoy intentando crear la siguiente tabla (redactada en Excel) en mi manuscrito. ingrese la descripción de la imagen aquí

Estoy trabajando con dos plantillas de conferencias (IEEE y SPLNCS), así que organizo mi trabajo así:

├── IEEEtran.cls
├── llncs.cls
├── mainIEEE.tex
├── mainLNCS.tex
├── Introdoction.tex
└── # ... other sections' tex

Para poder navegar entre mainEEE.texy mainLNCS.texcompilar el formato de la conferencia.

Sin embargo, tengo dificultades para alinear esta tabla para que encaje con la columna de estas plantillas (otras tablas en mi documento funcionan bien).

MWE: IEEEtran.clsy llncs.cls

%%%  Introduction.tex
\section{Introduction}

\lipsum[1]

\begin{table}[ht]
    \caption{Some results}
    \label{tab:my_label}
    \centering
    \begin{tabularx}{\linewidth}{l|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|} 
    \toprule
     Mode  & \multicolumn{5}{l|}{Precision} & \multicolumn{5}{l|}{Recall} & \multicolumn{5}{l}{F1\-score} \\
     \cline{2-15}
     & RF & RF-SMOTEd & AdaBoost & SMOTEBoost & DECOC & RF & RF-SMOTEd & AdaBoost & SMOTEBoost & DECOC & RF & RF-SMOTEd & AdaBoost & SMOTEBoost & DECOC \\
     \midrule
     cat &1&2&3&4&5 &1&2&3&4&5 &1&2&3&4&5\\
    \bottomrule
    \end{tabularx}
\end{table}
  1. mainLNCS.texproducción:
\documentclass[runningheads]{llncs}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{tabularx,ragged2e}
\usepackage{lipsum}
    

\begin{document}

\title{Manuscript Title (SPLNCS) }


\maketitle

\begin{abstract}
The abstract in 150--250 words.


\keywords{keyword1  \and keyword2} 
\end{abstract}

\input{Introduction}



%\bibliographystyle{splncs04}
%\bibliography{Bib/references}

\end{document}

ingrese la descripción de la imagen aquí

  1. mainIEEE.texproducción:
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts

\usepackage{booktabs}
\usepackage{lipsum}  
\usepackage{tabularx,ragged2e}

\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}

\title{Conference Paper Title (IEEEtran)}


\begin{abstract}
This document is a model and instructions for \LaTeX.
This and the IEEEtran.cls ...
\end{abstract}

\begin{IEEEkeywords}
keyword1, keyword2
\end{IEEEkeywords}

\input{Introduction}


\end{document}

ingrese la descripción de la imagen aquí

Respuesta1

Esto muestra cómo utilizar encabezados rotados. Tenga en cuenta el uso de tabular*y \extracolseppara ajustar con precisión la columna.

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts

\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{lipsum}

\begin{document}

\lipsum[1]

\begin{table}[ht]
    \caption{Some results}
    \label{tab:my_label}
    %\centering
    \tabcolsep=0pt
    \begin{tabular*}{\linewidth}{@{\extracolsep{0pt plus 1fil}}lccccccccccccccc}
    \toprule
     Mode  & \multicolumn{5}{l}{Precision} & \multicolumn{5}{l}{Recall} & \multicolumn{5}{l}{F1\-score} \\
     \midrule
     & \rotatebox{90}{RF} & \rotatebox{90}{RF-SMOTEd} & \rotatebox{90}{AdaBoost} & 
      \rotatebox{90}{SMOTEBoost} & \rotatebox{90}{DECOC} & \rotatebox{90}{RF} &
      \rotatebox{90}{RF-SMOTEd} & \rotatebox{90}{AdaBoost} & \rotatebox{90}{SMOTEBoost} & 
      \rotatebox{90}{DECOC} & \rotatebox{90}{RF} & \rotatebox{90}{RF-SMOTEd} & 
      \rotatebox{90}{AdaBoost} & \rotatebox{90}{SMOTEBoost} & \rotatebox{90}{DECOC} \\
     \midrule
     cat &1&2&3&4&5 &1&2&3&4&5 &1&2&3&4&5\\
    \bottomrule
    \end{tabular*}
\end{table}

\lipsum[2-6]

\end{document}

Respuesta2

  • No está del todo claro cuál es el contenido de su tabla. Números de solo un dígito = ¿O un símbolo de una letra?

  • Si el caso anterior es el caso, puede rotar los encabezados de las columnas como se muestra en la respuesta de @John Kormylo.

  • Como complemento a su respuesta, aquí se sugiere qué uso es tabularrayel paquete compatible con rotatingy makecellpaquetes.

  • Con - Withclase de documento ieeetran`:

\documentclass[runningheads]{llncs}
\usepackage[T1]{fontenc}
\usepackage{lipsum}

\usepackage{rotating}
\usepackage{makecell}
\usepackage{ragged2e}
\usepackage{tabularray}

\begin{document}

\title{Manuscript Title (SPLNCS) }
\maketitle
\begin{abstract}
The abstract in 150--250 words.
%\keywords{keyword1  \and keyword2}
\end{abstract}

\section{Introduction}
\lipsum[11]
    \begin{table}[ht]
    \caption{Some results}
    \label{tab:my_label}
    \centering
\settowidth\rotheadsize{SMOTEBoost}
\renewcommand\theadfont{}
\begin{tblr}{hlines, vlines,
             colspec = { l *{15}{X[c]} },
             cell{2}{2-Z} = {cmd=\rothead}
             }
\SetCell[r=2]{c}    Mode  
    &   \SetCell[c=5]{c} Precision
        &   &   &   &   &   \SetCell[c=5]{c}    Recall 
                            &   &   &   &   &   \SetCell[c=5]{c}    F1\-score
                                                &   &   &   &       \\
    & RF    
        & RF-SMOTEd 
            & AdaBoost 
                & SMOTEBoost 
                    & DECOC 
    & RF
        & RF-SMOTEd
            & AdaBoost
                & SMOTEBoost
                    & DECOC
    & RF
        & RF-SMOTEd
            & AdaBoost
                & SMOTEBoost
                    & DECOC                         \\
cat & 1 & 2 & 3 & 4 & 5     
        & 1 & 2 & 3 & 4 & 5     
            & 1 & 2 & 3 & 4 & 5                     \\
\end{tblr}
    \end{table}
\end{document}

ingrese la descripción de la imagen aquí

  • Con ieeetranclase de documento:
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
%\usepackage[T1]{fontenc}
% ...
\begin{tblr}{hlines, vlines,
             colspec = { l *{15}{X[c]} },
             colsep=3pt,    % <---
             cell{2}{2-Z} = {cmd=\rothead}
             }
% rest is the same as before

ingrese la descripción de la imagen aquí

información relacionada