6

is there a way I could align the comma signal on the numbers even with the % sign?

\documentclass[12pt]{article}
\usepackage{booktabs}
\usepackage[utf8]{inputenc}
\usepackage[skip=0.333\baselineskip]{caption} 
\usepackage{newtxtext,newtxmath} 
\usepackage[vmargin=3cm, hmargin=2.5cm]{geometry}
\usepackage[group-separator={.},
            group-four-digits,
            output-decimal-marker={,}]{siunitx}
\begin{document}
\begin{table}[ht]
\setlength\extrarowheight{2pt}
\caption{Estat\'{i}sticas - Escolaridade e Cor -2016} 
\centering
\begin{tabular}{llll}
  \toprule
  & Controle & Tratado & Total \\ 
  \midrule
Cor & - & - & - \\
\hspace{4mm} Brancos & 56.1\% & 57.2\% & 56.3\% \\ 
\hspace{4mm}  Amarelos e Ind\'{i}genas & 0.7\% & 0.8\% & 0.7\% \\ 
 \hspace{4mm} Pretos e Pardos & 43.2\% & 42.0\% & 43.0\% \\ 
  \midrule
  Escolaridade & - & - & - \\
 \hspace{4mm} At\'{e} Ensino Fundamental incompleto & 18.5\% & 10.3\% & 17.0\% \\ 
 \hspace{4mm} At\'{e} Ensino M\'{e}dio incompleto & 18.1\% & 15.1\% & 17.5\% \\ 
 \hspace{4mm} At\'{e} Ensino Superior incompleto & 40.2\% & 39.8\% & 40.1\% \\ 
 \hspace{4mm} Ensino Superior completo & 23.2\% & 34.8\% & 25.4\% \\ 
   \bottomrule
\end{tabular}
\end{table}
\end{document}
13

It's generally a bad idea to put the % sign on each number; better to put it in the column heading.

You've loaded siunitx but you're not using its S column type for the numbers. So here's a modified version of your table. I've made a small shorthand \mc to save some typing for the column headings.

I've also changed your accented characters into proper accented characters in the source. Since you are loading inputenc with [utf8] there's no need to use macros for accents.

\documentclass[12pt]{article}
\usepackage{booktabs}
\usepackage[utf8]{inputenc}
\usepackage[skip=0.333\baselineskip]{caption} 
\usepackage{newtxtext,newtxmath} 
\usepackage[vmargin=3cm, hmargin=2.5cm]{geometry}
\usepackage[group-separator={.},
            group-four-digits,
            output-decimal-marker={,}]{siunitx}
\newcommand\mc{\multicolumn{1}{c}}
\begin{document}
\begin{table}[ht]
\setlength\extrarowheight{2pt}
\caption{Estatísticas - Escolaridade e Cor -- 2016} 
\centering
\begin{tabular}{lSSS}
  \toprule
  & \mc{Controle} & \mc{Tratado} & \mc{Total} \\ 
  & \mc{\%} & \mc{\%} & \mc{\%}\\
  \midrule
Cor &  \\
\hspace{4mm} Brancos & 56.1 & 57.2 & 56.3 \\ 
\hspace{4mm}  Amarelos e Indígenas & 0.7 & 0.8 & 0.7 \\ 
 \hspace{4mm} Pretos e Pardos & 43.2 & 42.0 & 43.0 \\ 
  \midrule
  Escolaridade &  \\
 \hspace{4mm} Até Ensino Fundamental incompleto & 18.5 & 10.3 & 17.0 \\ 
 \hspace{4mm} Até Ensino Médio incompleto & 18.1 & 15.1 & 17.5 \\ 
 \hspace{4mm} Até Ensino Superior incompleto & 40.2 & 39.8 & 40.1 \\ 
 \hspace{4mm} Ensino Superior completo & 23.2 & 34.8 & 25.4 \\ 
   \bottomrule
\end{tabular}
\end{table}
\end{document}

output of code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.