![无法正确向表格添加垂直线](https://linux22.com/image/408786/%E6%97%A0%E6%B3%95%E6%AD%A3%E7%A1%AE%E5%90%91%E8%A1%A8%E6%A0%BC%E6%B7%BB%E5%8A%A0%E5%9E%82%E7%9B%B4%E7%BA%BF.png)
我正在尝试使用下面的代码在表格最左边的列添加一条垂直线。
\begin{table}
\centering
\setlength{\extrarowheight}{8pt}
\begin{tabular}{cc|c|c|}
& \multicolumn{1}{c}{GRU} & \multicolumn{1}{c}{GRU + ELMo} \\\cline{2-3}
acurácia & $0.767700$ & $0.776100$ \\\cline{2-3}
precisão & $0.770971$ & $0.787500$ \\\cline{2-3}
f-\textit{measure} & $0.769034$ & $0.780582$ \\\cline{2-3}
& \multicolumn{2}{c}{} \\
\end{tabular}
\end{table}
此代码生成此表:
我希望它看起来像这样:
我怎样才能让它工作?
答案1
希望以下内容能够满足您的要求:
\documentclass{book}
\begin{document}
\begin{table}
\centering
\begin{tabular}{c|c|c|c|}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{GRU} &
\multicolumn{1}{c}{$\mathrm{GRU} + \mathrm{ELMo}$} \\
\cline{2-3}
acurácia & $0.767700$ & $0.776100$ \\
\cline{2-3}
precisão & $0.770971$ & $0.787500$ \\
\cline{2-3}
f-\textit{measure} & $0.769034$ & $0.780582$ \\
\cline{2-3}
\end{tabular}
\caption{\label{tab:results-measures}Comparativo das métricas obtidas nos experimentos realizados.}
\end{table}
\end{document}
答案2
嗨@heniotierra,欢迎来到 TeX-SE。提问时,请告知重现您问题的 MWE。
而且您应该使用\usepackage[latin1]{inputenc}
或\usepackage[utf8]{inputenc}
来纠正句柄重音符号和其他特殊字符(我们巴西人必须注意这一点),并且由于您是用葡萄牙语书写的,所以请使用\usepackage[brazil]{babel}
来纠正句柄表格和图形标题。还要注意规范,有时标题必须位于对象(表格或图形)上方,有时位于下方。我让评论“下方标题”的位置。
\documentclass{article}
\usepackage{tabularx}
\usepackage[latin1]{inputenc}
\usepackage[brazil]{babel}
\begin{document}
\begin{table}
\centering
\caption{Comparativo}
\label{tab:results-measures}
\setlength{\extrarowheight}{8pt}
\begin{tabular}{c|c|c|}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{GRU} & \multicolumn{1}{c}{GRU + ELMo} \\
\cline{2-3}
acurácia & $0.767700$ & $0.776100$ \\
\cline{2-3}
precisão & $0.770971$ & $0.787500$ \\
\cline{2-3}
f-\textit{measure} & $0.769034$ & $0.780582$ \\
\cline{2-3}
\end{tabular}
%\caption{Comparativo Below}
%\label{tab:results-measures}
\end{table}
\end{document}