表格标题不显示

表格标题不显示

我使用 pdfLaTeX 在 overleaf 中运行以下代码

\begin{table}[htbp]
\centering
\caption{$C_2$ matrix}
\[
\begin{array}{|c|c|c|c|c|}
\hline
C_2 & \texttt{L1} & \texttt{L2} & \texttt{L3} & \texttt{L4} \\ \hline
\texttt{L1} & \textbf{0.6} & 0.133 & 0.133 & 0.133 \\ \hline
\texttt{L2} & 0.133 & \textbf{0.6} & 0.133 & 0.133 \\ \hline
\texttt{L3} & 0.133 & 0.133 & \textbf{0.6} & 0.133 \\ \hline
\texttt{L4} & 0.133 & 0.133 & 0.133 & \textbf{0.6} \\ \hline
\end{array}
\]
\end{table}

产生以下输出,但没有所需的标题。

在此处输入图片描述

我该如何解决这个问题?谢谢。

答案1

我无法复制您的图片。以下是我在 overleaf 上使用 pdflatex 尝试的结果

\documentclass{article}
\begin{document}
\begin{table}[htbp]
\centering
\caption{$C_2$ matrix}
\[
\begin{array}{|c|c|c|c|c|}
\hline
C_2 & \texttt{L1} & \texttt{L2} & \texttt{L3} & \texttt{L4} \\ \hline
\texttt{L1} & \textbf{0.6} & 0.133 & 0.133 & 0.133 \\ \hline
\texttt{L2} & 0.133 & \textbf{0.6} & 0.133 & 0.133 \\ \hline
\texttt{L3} & 0.133 & 0.133 & \textbf{0.6} & 0.133 \\ \hline
\texttt{L4} & 0.133 & 0.133 & 0.133 & \textbf{0.6} \\ \hline
\end{array}
\]
\end{table}
\end{document}

在此处输入图片描述

相关内容