tabela multicolunas com diferentes configurações de \sisetup{}

tabela multicolunas com diferentes configurações de \sisetup{}

Gostaria de saber se existe uma maneira de usar parâmetros diferentes de \sisetup{} para cada coluna de uma tabela. Por exemplo, eu gostaria de usar:

\sisetup{round-mode=places,
round-precision=2,
fixed-exponent = 6,
scientific-notation = fixed,
}

para a primeira coluna da minha tabela e uma versão ligeiramente diferente dela:

\sisetup{round-mode=places,
round-precision=2,
fixed-exponent = 8,
scientific-notation = fixed,
}

para a segunda coluna deste último.

Ex:

\begin{table}[H]
\centering
\sisetup{round-mode=places,
round-precision=2,
fixed-exponent = 6,
scientific-notation = fixed,
}
\sisetup{round-mode=places,
round-precision=2,
fixed-exponent = 8,
scientific-notation = fixed,
}
\begin{tabular}{SSS}
\hline A & a & b \\ \hline
$B$ & -8940513.51965462 & -393467529.743240\\
$C$ & -8295841.85412406 & -365095852.079073 \\ \hline
\end{tabular}
\end{table}

Responder1

Bem-vindo ao TeX.SE!

Você pode dividir sisetupem duas partes:

  • comum (global), quais configurações são usadas em todas Sas colunas
  • local, onde você pode adicionar ou substituir configurações comuns quando necessário:
\documentclass{article}
\usepackage{booktabs}   % added
\usepackage{siunitx}

\begin{document}
    \begin{table}[ht]
\sisetup{round-mode=places,  % common settings
         round-precision=2,
         fixed-exponent = 6,
         scientific-notation = fixed,
         }
\begin{tabular}{l S[fixed-exponent = 8] % <--- local
                  S}
    \toprule
A   &  {a}              & {b}               \\ 
    \midrule
$B$ & -8940513.51965462 & -393467529.743240 \\
$C$ & -8295841.85412406 & -365095852.079073 \\ 
    \bottomrule
\end{tabular}
    \end{table}
\end{document}

insira a descrição da imagem aqui

Responder2

Você deseja usar algumas configurações comuns para toda a tabela e algumas locais para a coluna específica. Você também deseja especificar o número de dígitos, para que os cabeçalhos sejam posicionados corretamente e o espaçamento seja ideal. É claro que tal configuração será feitaa posteriori, depois de observar o que a tabela realmente produz.

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}

\begin{table}[htp]

% common settings for this table
\sisetup{
  round-mode=places,
  round-precision=2,
  scientific-notation = fixed,
}

\begin{tabular}{
  l
  S[fixed-exponent = 8,table-format=-1.2e1]
  S[fixed-exponent = 6,table-format=-3.2e1]
}
\toprule
A   &  {a}              & {b}               \\ 
\midrule
$B$ & -8940513.51965462 & -393467529.743240 \\
$C$ & -8295841.85412406 & -365095852.079073 \\ 
\bottomrule
\end{tabular}

\end{table}

\end{document}

insira a descrição da imagem aqui

informação relacionada