machine-learning - 当在 latex 中使用 \textbf 时,它会改变里面的值的位置
问题描述
我正在尝试使用乳胶显示我的结果表,但我在显示时遇到了一些问题:应用粗体时数字不居中,你能帮我找出原因,在代码下方以及它的样子:
\documentclass[a4paper, 11pt, french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}% Include the listings-package
\usepackage{listings}
\lstset{language=python}
\usepackage[table]{xcolor}
\usepackage{collcell}
\usepackage{hhline}
\usepackage{pgf}
\usepackage{comment} % habilita el uso de comentarios en varias lineas (\ifx \fi)
\usepackage{lipsum} %Este paquete genera texto del tipo Lorem Ipsum.
\usepackage{fullpage} % cambia el margen
\usepackage{booktabs} % Required for better horizontal rules in tables
\usepackage{fouriernc} % Use the New Century Schoolbook font
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{siunitx}
\usepackage{graphicx}
\begin{document}
\begin{table}[ht]
\begin{tabular}{lSSS}
\toprule
\multirow{2}{*}{Models} &
\multicolumn{1}{c}{POS} \\
& {N+POS - P} \\ % & {V+N+L-P, S} & {V+N+L-P, S, Ne}
\midrule
LinearSVC & 0.44 \\ %& \textbf{0.58} & \textbf{0.58} \\
MultinomialNb & 0.51 \\ %& 0.51 & 0.51 \\
LogisticRegression & 0.53 \\ %& 0.51 & 0.51 \\
RandomForestClassifier & \textbf{0.55} \\ %& 0.56 & 0.57 \\
KNeighborsClassifier & 0.48 \\ %& 0.50 & 0.49 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
结果是这样的:
如您所见,0.55 与其他值并不完全一致
解决方案
我相信这与您给列的对齐方式有关。
在您的\begin{tabular}{lSSS}
行中,您声明了 4 列,即使您评论了其中的 2 列。它对我来说仍然是这样,但要考虑到l
左对齐,并且由于粗体效果会增加字母的宽度,如果你左对齐,它仍然会看起来更大。如果您希望值居中,我建议您使用c
而不是 S。
我就是这样做的,希望对你有用:
- 使用左对齐的解决方案:
\begin{table}[ht]
\begin{tabular}{ll}
\toprule
\multirow{2}{*}{Models} &
\multicolumn{1}{c}{POS} \\
& {N+POS - P} \\ % & {V+N+L-P, S} & {V+N+L-P, S, Ne}
\midrule
LinearSVC & 0.44 \\ %& \textbf{0.58} & \textbf{0.58} \\
MultinomialNb & 0.51 \\ %& 0.51 & 0.51 \\
LogisticRegression & 0.53 \\ %& 0.51 & 0.51 \\
RandomForestClassifier & \textbf{0.55} \\ %& 0.56 & 0.57 \\
KNeighborsClassifier & 0.48 \\ %& 0.50 & 0.49 \\
\bottomrule
\end{tabular}
\end{table}
- 使用中心对齐的解决方案
\begin{table}[ht]
\begin{tabular}{lc}
\toprule
\multirow{2}{*}{Models} &
\multicolumn{1}{c}{POS} \\
& {N+POS - P} \\ % & {V+N+L-P, S} & {V+N+L-P, S, Ne}
\midrule
LinearSVC & 0.44 \\ %& \textbf{0.58} & \textbf{0.58} \\
MultinomialNb & 0.51 \\ %& 0.51 & 0.51 \\
LogisticRegression & 0.53 \\ %& 0.51 & 0.51 \\
RandomForestClassifier & \textbf{0.55} \\ %& 0.56 & 0.57 \\
KNeighborsClassifier & 0.48 \\ %& 0.50 & 0.49 \\
\bottomrule
\end{tabular}
\end{table}
现在你需要决定哪一个更适合你。
推荐阅读
- javascript - Reactjs历史推送在抽屉组件中不起作用
- c# - 使用 ASP.NET 核心添加新的持久性 cookie
- jquery - 带有 Twitter API 的 jquery $.post 有效,但回调函数不返回数据
- python - 单击像素后如何打破循环并重新截取屏幕截图?
- byte-buddy - ByteBuddy 在方法参数上“传播”对象数组的能力有哪些限制?
- python - 人脸识别无法安装
- xamarin - Xamarin.Android (BiometricPrompt):缺少 setAllowedAuthenticators() 方法
- sql - Oracle分析SQL中的KEEP和OVER有什么区别
- javascript - TypeScript 中的承诺
- arrays - 为什么我使用 firstIndex(其中: