1

I want to highlight some values inside a table using bold letters. I used the command textbf but the values are not centered anymore... I already tried a few things I found online but it doesn't work for my table:

 \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}

Can someone help me with that? Thank you!

1 Answer 1

2

With siunitx version 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}

enter image description here

1
  • I'm writing my paper using overleaf so that's not working... Is there any other Option?
    – Nina
    Aug 2, 2021 at 18:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .