表格中的代码

表格中的代码

我被要求用 LaTeX 创建一个表格,其中使用 IEEE 标准进行一些引用。此外,我还被要求将该表格的标题放在上面。然而,出于某种原因,这是我唯一遇到麻烦的表格。只要我将标题和标签放在表格其余代码上方,pdf 就不会编译。

表格中的代码

%-TABLE 8 -%
\begin{table}[]
\centering
\caption{Most used algorithms in ML for eartquakes}
\label{tab:tabla_8}
\resizebox{\textwidth}{!}{%
\begin{tabular}{|c|c|c|l|c|}
\hline
\textbf{N} &
  \textbf{Algorithms} &
  \textbf{ML Methods} &
  \multicolumn{1}{c|}{\textbf{References}} &
  \textbf{Total number of articles} \\ \hline
 &
   &
  Linear SCV &
   &
  0 \\ \cline{3-5} 
 &
   &
  SGD Classifier &
   &
  0 \\ \cline{3-5} 
1 &
  Classification &
  Naïve Bayes &
  \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}\cite{source_2} \cite{source_12} \cite{source_13} \cite{source_14} \\ \cite{source_16} \cite{source_36} \\[5pt] \cite{source_45} \cite{source_49} \cite{source_54} \cite{source_71} \cite{source_73} \cite{source_77} \cite{source_83} \cite{source_89} \cite{source_105}\end{tabular}} &
  15 (12\%) \\ \cline{3-5} 
 &
   &
  KNeighborsClassifier &
   &
  0 \\ \hline
 &
   &
  MeanShift &
   &
  0 \\ \cline{3-5} 
2 &
  Clustering &
  VBGMM &
   &
  0 \\ \cline{3-5} 
 &
   &
  MiniBatch KMeans &
   &
  0 \\ \cline{3-5} 
 &
   &
  KMeans &
  \multicolumn{1}{c|}{\cite{source_55}} &
  1 (1\%) \\ \hline
 &
   &
  SGD Regressor &
   &
  0 \\ \cline{3-5} 
 &
   &
  Lasso &
  \multicolumn{1}{c|}{\cite{source_1} \cite{source_54} \cite{source_56} \cite{source_77} \cite{source_106} \\[5pt] \cite{source_4}} &
  5 (4\%) \\ \cline{3-5} 
3 &
  Regression &
  ElasticNET &
   &
  0 \\ \cline{3-5} 
 &
   &
  RidgeRegressions &
  \multicolumn{1}{c|}{\cite{source_4}} &
  1 (1\%) \\ \cline{3-5} 
 &
   &
  EnsembleRegressors &
   &
  0 \\ \hline
 &
   &
  Randomized PCA &
   &
  0 \\ \cline{3-5} 
 &
   &
  Isomap &
   &
  0 \\ \cline{3-5} 
4 &
  Dimensionality reduction &
  Spectral Embedding &
   &
  0 \\ \cline{3-5} 
 &
   &
  SEE ALSO &
  \multicolumn{1}{c|}{\cite{source_24}} &
  1 (1%) \\ \cline{3-5} 
 &
   &
  Kernel Approximation &
   &
  0 \\ \hline
\end{tabular}%
}
\end{table}

我还想提供一个链接,您可以在其中找到带有相应 .bib 文件的完整文章 https://drive.google.com/file/d/1XUQuquNBvoxrQucr0ja-Q​​c522tychlmf/view?usp=sharing

这是一个相当奇怪的问题,但我希望有一个解决方案。谢谢

答案1

试试这个。这个更简单,更精简。

\documentclass[conference,a4paper]{IEEEtran}
\usepackage{balance}
\usepackage[pdftex]{graphicx}

\usepackage{tabularray}

%****************************************



\begin{document}
      
\begin{table*}
\centering
\caption{Most used algorithms in ML for eartquakes}
\label{tab:tabla_8}
\begin{tblr}{width=\textwidth,
colspec={c X[c,m,0.75] *{3}{X[c,m]}},
hlines={solid},
vlines={solid},
row{1}={font = \bfseries}
}
    N & Algorithms & ML Methods & References & Total Number of Articles\\
    \SetCell[c=1,r=4]{m}{1} & \SetCell[c=1,r=4]{m}{Classification} & Linear SCV & & 0\\
    & & SGD Classifier & & 0 \\
    & & Naïve Bayes & \cite{source_2, source_12, source_13, source_14, source_16, source_36,source_45,source_49,source_54,source_71,source_73, source_77, source_83, source_89, source_105} & 15 (12\%)\\
    & & KNeighborsClassifier & & 0\\
    \SetCell[c=1,r=4]{m}{2} & \SetCell[c=1,r=4]{m}{Clustering} & MeanShift & & 0 \\
    & & VBGMM & & 0 \\
    & & MiniBatch KMeans & & 0\\
    & & KMeans & \cite{source_55} & 1 (\%)\\
    \SetCell[c=1,r=5]{m}{3} & \SetCell[c=1,r=5]{m}{Regression} & SGD Regressor & & 0 \\
    & & Lasso & \cite{source_1,source_54, source_56, source_77, source_106, source_4} & 5 (4\%)\\
    & & ElasticNET & & 0 \\
    & & RidgeRegressions & \cite{source_4} & 1 (1\%)\\
    & & EnsembleRegressors & & 0\\
    \SetCell[c=1,r=5]{m}{4} & \SetCell[c=1,r=5]{m}{Dimensionality reduction} & Randomized PCA & & 0\\
    & & Isomap & & 0\\
    & & Spectral Embedding & & 0\\
    & & SEE ALSO & \cite{source_24} & 1 (1\%)\\
    & & Kernel Approximation & & 0\\
\end{tblr}
\end{table*}
    
\end{document}

输出为: 在此处输入图片描述

答案2

我认为问题不是标题,而是你的表格代码有错误。你忘了在表格末尾添加一个。另外,不要\使用换行符%\\里面一个multicol环境,它也会在那里引发错误。

这是经过修改的表格,即对有问题的部分进行了注释。由于您要将其调整为整个textwidth,我将其更改tabletable*,以“摆脱”由 强加的双列格式ÌEEEtran

输出: 在此处输入图片描述

代码:

\documentclass[conference,a4paper]{IEEEtran}
\usepackage{balance}
\usepackage[pdftex]{graphicx}
\usepackage{multicol, multirow}

\begin{document}
    
%-TABLE 8 -%
\begin{table*}[]
    \centering
    \caption{Most used algorithms in ML for eartquakes}
    \label{tab:tabla_8}
    \resizebox{\textwidth}{!}{%
        \begin{tabular}{|c|c|c|l|c|}
            \hline
            \textbf{N} &
            \textbf{Algorithms} &
            \textbf{ML Methods} &
            \multicolumn{1}{c|}{\textbf{References}} &
            \textbf{Total number of articles} \\ \hline
            &
            &
            Linear SCV &
            &
            0 \\ \cline{3-5} 
            &
            &
            SGD Classifier &
            &
            0 \\ \cline{3-5} 
            1 &
            Classification &
            Naïve Bayes &
            \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}\cite{source_2} \cite{source_12} \cite{source_13} \cite{source_14} %\\   % HERE!!!!
            \cite{source_16} \cite{source_36} %\\[5pt]   % HERE!!!!
            \cite{source_45} \cite{source_49} \cite{source_54} \cite{source_71} \cite{source_73} \cite{source_77} \cite{source_83} \cite{source_89} \cite{source_105}\end{tabular}} &
            15 (12\%) \\ \cline{3-5} 
            &
            &
            KNeighborsClassifier &
            &
            0 \\ \hline
            &
            &
            MeanShift &
            &
            0 \\ \cline{3-5} 
            2 &
            Clustering &
            VBGMM &
            &
            0 \\ \cline{3-5} 
            &
            &
            MiniBatch KMeans &
            &
            0 \\ \cline{3-5} 
            &
            &
            KMeans &
            \multicolumn{1}{c|}{\cite{source_55}} &
            1 (1\%) \\ \hline
            &
            &
            SGD Regressor &
            &
            0 \\ \cline{3-5} 
            &
            &
            Lasso &
            \multicolumn{1}{c|}{\cite{source_1} \cite{source_54} \cite{source_56} \cite{source_77} \cite{source_106} %\\[5pt]   % HERE!!!!
            \cite{source_4}} &
            5 (4\%) \\ \cline{3-5} 
            3 &
            Regression &
            ElasticNET &
            &
            0 \\ \cline{3-5} 
            &
            &
            RidgeRegressions &
            \multicolumn{1}{c|}{\cite{source_4}} &
            1 (1\%) \\ \cline{3-5} 
            &
            &
            EnsembleRegressors &
            &
            0 \\ \hline
            &
            &
            Randomized PCA &
            &
            0 \\ \cline{3-5} 
            &
            &
            Isomap &
            &
            0 \\ \cline{3-5} 
            4 &
            Dimensionality reduction &
            Spectral Embedding &
            &
            0 \\ \cline{3-5} 
            &
            &
            SEE ALSO &
            \multicolumn{1}{c|}{\cite{source_24}} &
            1 (1\%<) \\ \cline{3-5}  % HERE!!!! missing 
            &
            &
            Kernel Approximation &
            &
            0 \\ \hline
        \end{tabular}%
    }
\end{table*}
    
\end{document}

相关内容