16

I have a table where one column are p values. p values should be formatted without leading zero, and if they are smaller than .001, they should be reported as "< .001". Numbers should be aligned at the decimal point.

A similar question is here: siunitx: Decimal alignment with 'less than' sign

But, how can I remove the leading zero?

\documentclass{article}

%tables
\usepackage{booktabs}
\usepackage{siunitx} %align numbers by decimal point

\begin{document}

\begin{tabular}{
  S[table-format = 2]
  S[table-format = -1.2, table-space-text-post = $^{***}$]
  S[table-format = -1.2, table-space-text-post = $^{***}$]
  S[table-format = 2.2]
  S[table-format = <0.3]}
\toprule
{Item} & {$b$} & {$t$} & {$F$} & {$p$}\\
\midrule
1 & -1.45{$^{***}$} & -7.44{$^{***}$} & 55.34 & .18  \\
11 & -.86{$^{*}$} & -2.09{$^{*}$} & 4.36 & .01  \\
12 & -1.79{$^{***}$} & -3.80{$^{***}$} & 14.47 & .05  \\
13 & -.56 & -1.34 & 1.80 & .00  \\
61 & -1.79{$^{***}$} & -5.85{$^{***}$} & 34.20 & .12  \\
62 & -1.00{$^{**}$} & -3.17{$^{**}$} & 10.05 & .04  \\
63 & -.27 & -.65 & .43 & <0.001  \\
64 & -.37 & -.97 & .94 & .00  \\
65 & -.34 & -.85 & .73 & .00  \\
66 & 1.05{$^{**}$} & 2.70{$^{**}$} & 7.30 & .02  \\
67 & -1.12{$^{**}$} & -2.90{$^{**}$} & 8.40 & .03  \\
72 & -.41 & -1.20 & 1.43 & .00  \\
73 & -.27 & -.82 & .67 & .00  \\
74 & 2.05{$^{***}$} & 4.99{$^{***}$} & 24.88 & .09  \\
75 & 1.61{$^{***}$} & 4.41{$^{***}$} & 19.46 & .07  \\
76 & .29 & .91 & .83 & <0.001  \\
\bottomrule
\end{tabular}

\end{document}

enter image description here

How can I correctly format the "p" column?

15

This can be done by adding add-integer-zero=false, but you have to typeset your numbers without the leading zeroes, e.g. <.001 instead of <0.001.

MWE

\documentclass{article}

%tables
\usepackage{booktabs}
\usepackage{siunitx} %align numbers by decimal point

\begin{document}

\begin{tabular}{
  S[table-format = 2]
  S[table-format = -1.2, table-space-text-post = $^{***}$]
  S[table-format = -1.2, table-space-text-post = $^{***}$]
  S[table-format = 2.2]
  S[table-format = <0.3,add-integer-zero=false]}
\toprule
{Item} & {$b$} & {$t$} & {$F$} & {$p$}\\
\midrule
1 & -1.45{$^{***}$} & -7.44{$^{***}$} & 55.34 & .18  \\
11 & -.86{$^{*}$} & -2.09{$^{*}$} & 4.36 & .01  \\
12 & -1.79{$^{***}$} & -3.80{$^{***}$} & 14.47 & .05  \\
13 & -.56 & -1.34 & 1.80 & .00  \\
61 & -1.79{$^{***}$} & -5.85{$^{***}$} & 34.20 & .12  \\
62 & -1.00{$^{**}$} & -3.17{$^{**}$} & 10.05 & .04  \\
63 & -.27 & -.65 & .43 & <.001  \\
64 & -.37 & -.97 & .94 & .00  \\
65 & -.34 & -.85 & .73 & .00  \\
66 & 1.05{$^{**}$} & 2.70{$^{**}$} & 7.30 & .02  \\
67 & -1.12{$^{**}$} & -2.90{$^{**}$} & 8.40 & .03  \\
72 & -.41 & -1.20 & 1.43 & .00  \\
73 & -.27 & -.82 & .67 & .00  \\
74 & 2.05{$^{***}$} & 4.99{$^{***}$} & 24.88 & .09  \\
75 & 1.61{$^{***}$} & 4.41{$^{***}$} & 19.46 & .07  \\
76 & .29 & .91 & .83 & <.001  \\
\bottomrule
\end{tabular}

\end{document} 

Output

enter image description here

Note, however, that removing the leading zero is not recommended at all, siunitx adds them because it is considered good typography.

  • 2
    "removing the leading zero is not recommended at all". I agree - but it's a requirement of the APA style guide for psychological science ... – Felix S Feb 12 '15 at 11:53
  • @FelixS I see... – karlkoeller Feb 13 '15 at 5:53

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.