垂直对齐拆分表

垂直对齐拆分表

我的表格太宽,不适合两列页面。因此,我将其分成两部分:

\documentclass{eusflat2021}

\begin{table}[ht]
\begin{center}
\vspace{1ex}
\begin{tabular}{|c|c|c|c|c|c|} \hline
    {\bf GTW} & {\bf 10} & {\bf 15} & {\bf 20} & {\bf 25} & {\bf 30}  \\\hline
    Entropy &  & &&& \\
    IDF & 0.4301& 0.4552&0.4627&\textbf{0.4648}&0.4610 \\
    Normal & \textbf{0.4856} & 0.4802 &0.4769&0.4266&0.4181\\
    ProbIDF &0.3333&0.3628&0.3717&\textbf{0.3831}&0.3697\\
    LDA &\textbf{0.4668}&0.4587&0.4582&0.4482&0.4378 \\
    Norm-alt & \textbf{0.5598}&0.5066&0.5077&0.4685&0.4876\\
    \hline
\end{tabular}

\begin{tabular}{|c|c|c|c|c|} \hline
    {\bf GTW} & {\bf 35} & {\bf 40} & {\bf 45} & {\bf 50}  \\\hline
    Entropy &  & && \\
    IDF & 0.4523&0.4270&0.4349&0.4337 \\
    Normal &0.4176&0.3877&0.3724&0.3555\\
    ProbIDF &0.3773&0.3712&0.3608&0.3705\\
    LDA &0.4634&0.4518&0.4489&0.4481 \\
    Normal-alt &0.4784&0.4493&0.4515&0.4420\\
    \hline
\end{tabular}

在此处输入图片描述

但是这样做的话,顶部还是太宽,表格无法对齐。有没有办法让顶部变窄,并使行对齐?

答案1

一个解决方案是转置表格并减少列之间的空间。我也用它booktabs来制作一个更漂亮的表格。

\documentclass[twocolumn]{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{multirow}
\usepackage{lipsum}

\begin{document}
    \begin{table}[ht]
        \centering
        \vspace{1ex}
        \begin{tabular}{|c|c|c|c|c|c|} \hline
            {\bf GTW} & {\bf 10} & {\bf 15} & {\bf 20} & {\bf 25} & {\bf 30}  \\\hline
            Entropy &  & &&& \\
            IDF & 0.4301& 0.4552&0.4627&\textbf{0.4648}&0.4610 \\
            Normal & \textbf{0.4856} & 0.4802 &0.4769&0.4266&0.4181\\
            ProbIDF &0.3333&0.3628&0.3717&\textbf{0.3831}&0.3697\\
            LDA &\textbf{0.4668}&0.4587&0.4582&0.4482&0.4378 \\
            Norm-alt & \textbf{0.5598}&0.5066&0.5077&0.4685&0.4876\\
            \hline
        \end{tabular}
        
        \begin{tabular}{|c|c|c|c|c|} \hline
            {\bf GTW} & {\bf 35} & {\bf 40} & {\bf 45} & {\bf 50}  \\\hline
            Entropy &  & && \\
            IDF & 0.4523&0.4270&0.4349&0.4337 \\
            Normal &0.4176&0.3877&0.3724&0.3555\\
            ProbIDF &0.3773&0.3712&0.3608&0.3705\\
            LDA &0.4634&0.4518&0.4489&0.4481 \\
            Normal-alt &0.4784&0.4493&0.4515&0.4420\\
            \hline
        \end{tabular}
    \end{table}
    
    \begin{table}[ht]
        \centering
        \begin{tabular}{@{}>{\bfseries}c*{5}{@{\hspace{3pt}}c}@{}}
            \toprule
            \multirow{2}{*}{GTW} &                          \multicolumn{5}{c}{\bfseries Entropy}                           \\
                                 &       IDF       &     Normal      &     ProbIDF     &       LDA       &    Norm-alt      \\ \midrule
            10                   &     0.4301      & \textbf{0.4856} &     0.3333      & \textbf{0.4668} & \textbf{0.5598}  \\
            15                   &     0.4552      &     0.4802      &     0.3628      &     0.4587      &     0.5066       \\
            20                   &     0.4627      &     0.4769      &     0.3717      &     0.4582      &     0.5077       \\
            25                   & \textbf{0.4648} &     0.4266      & \textbf{0.3831} &     0.4482      &     0.4685       \\
            30                   &     0.4610      &     0.4181      &     0.3697      &     0.4378      &     0.4876       \\
            35                   &     0.4523      &     0.4176      &     0.3773      &     0.4634      &     0.4784       \\
            40                   &     0.4270      &     0.3877      &     0.3712      &     0.4518      &     0.4493       \\
            45                   &     0.4349      &     0.3724      &     0.3608      &     0.4489      &     0.4515       \\
            50                   &     0.4337      &     0.3555      &     0.3705      &     0.4481      &     0.4420       \\ \bottomrule
        \end{tabular}
    \end{table}
    
    \lipsum[1-10]
\end{document}

在此处输入图片描述

答案2

使用三个表而不是仅仅两个。

我将它们插入到他们随作者说明提供的模板中。

http://www.ifsa-eusflat2021.eu/materials/ifsa-eusflat-2021-template-latexNEW.zip

X

\section{Tables}

All tables must be centered and clear (See Table \ref{table}).
\begin{table}[ht]
\begin{center}
\vspace{1ex}
\begin{tabular}{|c|c|c|c|} \hline
{\bf GTW}   & {\bf 10}          & {\bf 15}  & {\bf 20}  \\ \hline
Entropy     &                   &           &           \\
IDF         & 0.4301            & 0.4552    &0.4627     \\
Normal      & \textbf{0.4856}   & 0.4802    &0.4769     \\
ProbIDF     &0.3333             &0.3628     &0.3717     \\
LDA         &\textbf{0.4668}    &0.4587     &0.4582     \\
Normal-alt  & \textbf{0.5598}   &0.5066     &0.5077     \\
\hline
\end{tabular}

\vspace{1ex}
\begin{tabular}{|c|c|c|c|} \hline
{\bf GTW}    & {\bf 25}         & {\bf 30}  & {\bf 35} \\ \hline
Entropy     &                   &           &           \\
IDF         &\textbf{0.4648}    &0.4610     &0.4523     \\
Normal      &0.4266             &0.4181     &0.4176     \\
ProbIDF     &\textbf{0.3831}    &0.3697     &0.3773     \\
LDA         &0.4482             &0.4378     &0.4634     \\
Normal-alt  &0.4685             &0.4876     &0.4784     \\
\hline
\end{tabular}

\vspace{1ex}
\begin{tabular}{|c|c|c|c|} \hline
{\bf GTW}   & {\bf 40}  & {\bf 45}  & {\bf 50}  \\\hline
Entropy     &           &           &           \\
IDF         &0.4270     &0.4349     &0.4337     \\
Normal      &0.3877     &0.3724     &0.3555     \\
ProbIDF     &0.3712     &0.3608     &0.3705     \\
LDA         &0.4518     &0.4489     &0.4481     \\
Normal-alt  &0.4493     &0.4515     &0.4420     \\
\hline
\end{tabular}

\caption{\label{table}The number and caption of the table always appear below the table.}
\end{center}
\end{table}

\section{Figures}

All figures must be centered like Figure~\ref{figure1}.

如果所有表格都位于同一列或同一页面,那么您会非常幸运!

对于可能发生的意外情况,第二个代码更好。

All tables must be centered and clear (See Table \ref{table}).
    
\begin{table}[ht]
\begin{center}
    \begin{tabular}{|c|c|c|c|} \hline
        {\bfseries GTW}     & {\bfseries 10}            & {\bfseries 15}    & {\bfseries 20}  \\ \hline
        Entropy     &                   &           &           \\
        IDF         & 0.4301            & 0.4552    &0.4627     \\
        Normal      & \textbf{0.4856}   & 0.4802    &0.4769     \\
        ProbIDF     &0.3333             &0.3628     &0.3717     \\
        LDA         &\textbf{0.4668}    &0.4587     &0.4582     \\
        Normal-alt  & \textbf{0.5598}   &0.5066     &0.5077     \\
        \hline
    \end{tabular}
\end{center}
\end{table}

\begin{table}[ht]
\begin{center}
    \begin{tabular}{|c|c|c|c|} \hline
        {\bfseries GTW}     & {\bfseries 25}        & {\bfseries 30}    & {\bfseries 35} \\ \hline
        Entropy     &                   &           &           \\
        IDF         &\textbf{0.4648}    &0.4610     &0.4523     \\
        Normal      &0.4266             &0.4181     &0.4176     \\
        ProbIDF     &\textbf{0.3831}    &0.3697     &0.3773     \\
        LDA         &0.4482             &0.4378     &0.4634     \\
        Normal-alt  &0.4685             &0.4876     &0.4784     \\
        \hline
    \end{tabular}
\end{center}
\end{table}

\begin{table}[ht]
\begin{center}
    \begin{tabular}{|c|c|c|c|} \hline
        {\bfseries GTW}     & {\bfseries 40}    & {\bfseries 45}    & {\bfseries 50}  \\\hline
        Entropy     &           &           &           \\
        IDF         &0.4270     &0.4349     &0.4337     \\
        Normal      &0.3877     &0.3724     &0.3555     \\
        ProbIDF     &0.3712     &0.3608     &0.3705     \\
        LDA         &0.4518     &0.4489     &0.4481     \\
        Normal-alt  &0.4493     &0.4515     &0.4420     \\
        \hline
    \end{tabular}
\caption{\label{table}The number and caption of the table always appear below the table.}
\end{center}
\end{table}

万维网

答案3

没有办法让这些桌子适应正常尺寸。

您可以减小尺寸,我发现 7.5pt 适合,或者使用三个表格。

\documentclass{eusflat2021}

\usepackage{lipsum} % for mock text

\title{\bfseries Ifsa-Eusflat 2021 Bratislava: Instructions for Authors}
\author{Author$^a$ \and $^*$Corresponding Author$^b$ \and Author$^{b,c}$\\
$^a$Department, Faculty, University, Address, \email{[email protected]} \\
$^b$Department, Faculty, University, Address, \email{[email protected]} \\
$^c$Department, Faculty, University, Address, \email{[email protected]}}

\begin{document}

\maketitle

\begin{abstract}
The abstract must be indented 0.7 cm both on left as well as right-hand margins.

Please, do not place or cite tables and figures in the abstract.

{\bfseries Keywords:} Start with capital, Use comma, At least three keywords.
\end{abstract}

\lipsum[1][1-4]

\begin{table}[ht]
\centering

\fontsize{7.5}{8.6}\selectfont

\sbox{0}{%
  \begin{tabular}{|c|c|c|c|c|c|} \hline
    {\bfseries GTW} & {\bfseries 10} & {\bfseries 15} & {\bfseries 20} & {\bfseries 25} & {\bfseries 30}  \\\hline
    Entropy IDF & 0.4301& 0.4552&0.4627&\textbf{0.4648}&0.4610 \\
    Normal & \textbf{0.4856} & 0.4802 &0.4769&0.4266&0.4181\\
    ProbIDF &0.3333&0.3628&0.3717&\textbf{0.3831}&0.3697\\
    LDA &\textbf{0.4668}&0.4587&0.4582&0.4482&0.4378 \\
    Norm-alt & \textbf{0.5598}&0.5066&0.5077&0.4685&0.4876\\
    \hline
  \end{tabular}%
}

\usebox{0}

\makebox[\wd0][l]{%
  \begin{tabular}{|c|c|c|c|c|c} \hline
    {\bfseries GTW} & {\bfseries 35} & {\bfseries 40} & {\bfseries 45} & {\bfseries 50} \\ \hline
    Entropy IDF & 0.4523&0.4270&0.4349&0.4337 \\
    Normal &0.4176&0.3877&0.3724&0.3555\\
    ProbIDF &0.3773&0.3712&0.3608&0.3705\\
    LDA &0.4634&0.4518&0.4489&0.4481 \\
    Normal-alt &0.4784&0.4493&0.4515&0.4420\\
    \hline
  \end{tabular}%
}

\end{table}

\lipsum[1]

\begin{table}[ht]
\centering
\newcommand{\?}{\textbf}

\begin{tabular}{|c|c|c|c|}
  \hline
  {\bfseries GTW} & {\bfseries 10} & {\bfseries 15} & {\bfseries 20} \\
  \hline
  Entropy IDF &    0.4301  & 0.4552 & 0.4627 \\
  Normal      & \?{0.4856} & 0.4802 & 0.4769 \\
  ProbIDF     &    0.3333  & 0.3628 & 0.3717 \\
  LDA         & \?{0.4668} & 0.4587 & 0.4582 \\
  Norm-alt    & \?{0.5598} & 0.5066 & 0.5077 \\
  \hline
\end{tabular}

\begin{tabular}{|c|c|c|c|}
  \hline
  {\bfseries GTW} & {\bfseries 25} & {\bfseries 30} & {\bfseries 35} \\
  \hline
  Entropy IDF & \?{0.4648} & 0.4610 & 0.4523 \\
  Normal      &    0.4266  & 0.4181 & 0.4176 \\
  ProbIDF     & \?{0.3831} & 0.3697 & 0.3773 \\
  LDA         &    0.4482  & 0.4378 & 0.4634 \\
  Norm-alt    &    0.4685  & 0.4876 & 0.4784 \\
  \hline
\end{tabular}

\begin{tabular}{|c|c|c|c|c|c}
  \hline
  {\bfseries GTW} & {\bfseries 40} & {\bfseries 45} & {\bfseries 50} \\
  \hline
  Entropy IDF & 0.4270 & 0.4349 & 0.4337 \\
  Normal      & 0.3877 & 0.3724 & 0.3555 \\
  ProbIDF     & 0.3712 & 0.3608 & 0.3705 \\
  LDA         & 0.4518 & 0.4489 & 0.4481 \\
  Normal-alt  & 0.4493 & 0.4515 & 0.4420 \\
  \hline
\end{tabular}

\end{table}

\lipsum

\end{document}

在此处输入图片描述

请注意,不管 EUSFLAT 的人怎么想,该命令\bf已经被弃用了 25 年。

我使用\?(环境中的本地命令table来简化输入,但最重要的是它的可读性。

相关内容