我想用粗体字母突出显示表格中的某些值。我使用了命令 textbf,但值不再居中...我已经尝试了在线找到的几种方法,但它们对我的表格不起作用:
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{titlesec}
\titleformat{\chapter}
{\normalfont\huge\bfseries}{\thechapter}{1em}{}
\titlespacing*{\chapter}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\usepackage{appendix}
\usepackage[a4paper, left=30mm, right=30mm, top=25mm, bottom=25mm]{geometry}
\usepackage{setspace}
\onehalfspacing
\usepackage{graphicx}
\graphicspath{{images/}}
\usepackage[backend=biber,style=apa,autocite=inline]{biblatex}
\addbibresource{references.bib}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\usepackage{caption}
\floatsetup[figure]{capposition=top}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage[group-separator={.}]{siunitx}
\usepackage{multicol}
\usepackage{multirow}
\counterwithout{table}{chapter}
\begin{table}[ht]
\setlength\tabcolsep{1pt}
\footnotesize
\centering
\small
\renewcommand{\arraystretch}{1.4}
\caption{Pearson correlation} \label{tab:title}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}l
S[table-format=-1.2]
S[table-format=-1.2]
S[table-format=-1.2]
*{9}{S[table-format=-1.2]}@{}
}
\toprule
& {USDT} & {PAX} & {DGX} & {PAXG} & {DAI} & {WBTC} & {AMPL} & {BTC} & {LTC} & {EUR} & {JPY}\\
\hline
\hline
USDT & 1\\
PAX & -0.26 & 1\\
DGX & 0.04 & -0.01 & 1 \\
PAXG & 0.11 & -0.18 & 0.14 & 1\\
DAI & -0.09 & 0.13 & 0.10 & 0.10 & 1\\
WBTC & -0.07 & -0.20 & -0.01 & 0.10 & 0.00 & 1\\
AMPL & 0.09 & 0.04 & 0.03 & -0.04 & -0.02 & 0.33 & 1\\
BTC & 0.08 & -0.13 & 0.01 & 0.10 & -0.18 & 0.50 & 0.50 & 1\\
LTC & 0.00 & -0.17 & 0.06 & 0.15 & -0.10 & \textbf{0.44} & \textbf{0.55} & \textbf{0.80} & 1 \\
EUR & 0.07 & -0.12 & 0.07 & \textbf{0.48} & -0.07 & 0.11 & 0.10 & 0.17 & 0.29 & 1\\
JPY & 0.09 & -0.06 & 0.02 & \textbf{0.51} & 0.08 & -0.03 & 0.00 & 0.17 & 0.25 & 0.56 & 1\\
\hline
\end{tabular*}
\end{table}
有人能帮我吗?谢谢!
答案1
对于siunitx
版本 3:
\documentclass[12pt]{report}
\usepackage[a4paper, left=30mm, right=30mm, top=25mm, bottom=25mm]{geometry}
\usepackage{booktabs}
\usepackage[group-separator={.}]{siunitx}
\usepackage{caption}
\NewDocumentCommand{\bb}{}{\fontseries{b}\selectfont}
\begin{document}
\begin{table}[ht]
\centering
%\small
\setlength{\tabcolsep}{0pt}
\sisetup{mode=text,reset-text-series=false}
\caption{Pearson correlation} \label{tab:title}
\begin{tabular*}{\linewidth}{
@{\extracolsep{\fill}}l
*{10}{S[table-format=-1.2]}
S[table-format=1]
@{}
}
\toprule
& {USDT} & {PAX} & {DGX} & {PAXG} & {DAI} & {WBTC} & {AMPL} & {BTC} & {LTC} & {EUR} & {JPY}\\
\midrule
USDT & 1\\
PAX & -0.26 & 1\\
DGX & 0.04 & -0.01 & 1 \\
PAXG & 0.11 & -0.18 & 0.14 & 1\\
DAI & -0.09 & 0.13 & 0.10 & 0.10 & 1\\
WBTC & -0.07 & -0.20 & -0.01 & 0.10 & 0.00 & 1\\
AMPL & 0.09 & 0.04 & 0.03 & -0.04 & -0.02 & 0.33 & 1\\
BTC & 0.08 & -0.13 & 0.01 & 0.10 & -0.18 & 0.50 & 0.50 & 1\\
LTC & 0.00 & -0.17 & 0.06 & 0.15 & -0.10 & \bb 0.44 & \bb 0.55 & \bb 0.80 & 1 \\
EUR & 0.07 & -0.12 & 0.07 & \bb 0.48 & -0.07 & 0.11 & 0.10 & 0.17 & 0.29 & 1\\
JPY & 0.09 & -0.06 & 0.02 & \bb 0.51 & 0.08 & -0.03 & 0.00 & 0.17 & 0.25 & 0.56 & 1\\
\bottomrule
\end{tabular*}
\end{table}
\end{document}