TransWikia.com

Align decimal point with REVTeX4.1 class without decreasing vertical spacing in tables

TeX - LaTeX Asked on November 23, 2021

I am working with the REVTeX4.1 class and I want to have some numbers aligned to their decimal point on tables. Following the REVTeX 4 Author’s Guide p13, I am using the dcolumn package. However, when I include it, the vertical spacing in the tables decreases, too much in my opinion. I would like to know if there is a procedure to both align to decimal places, and to keep the vertical spacing on tables.

Here is the code before adding the dcolumn package, with nice vertical spacing but no decimal point alignment.

documentclass[aps,pra,reprint]{revtex4-1}
begin{document}

begin{table}
begin{ruledtabular}
begin{tabular}{ccc}
Property & Value & Unit\
colrule
$epsilon_{text{w}}$ & $7.2times 10^{-5}$ & g cm/V$^2$s$^2$ \ 
$eta$  & $1.33times10^{-2}$ & g/cm s\
end{tabular}
end{ruledtabular}
end{table}

end{document}

enter image description here

Here is after adding the dcolumn spacing, where the table seems to loose the vertical spaces between its rows, but the numbers are aligned to the decimal point.

documentclass[aps,pra,reprint]{revtex4-1}

usepackage{dcolumn}

begin{document}

begin{table}
begin{ruledtabular}
 begin{tabular}{cdc}
  Property & text{Value} & Unit\
  colrule
  $epsilon_{text{w}}$ & 7.2times 10^{-5} & g cm/V$^2$s$^2$ \ 
  $eta$ & 1.33times10^{-2} & g/cm s\
 end{tabular}
 end{ruledtabular}
end{table}

end{document}

enter image description here

2 Answers

The ruledtabular environment, in addition to inserting double horizontal rules, modifies quite a few table-related parameters, see @Mico answer and @DavidCarlisle answer. You can use solutions from these answers, or design own solution, for example based on use of the Xhline which are defined in the makecell package and use of S column defined in the siunitx package, which also enable consistent writing of units:

% considered
%   https://tex.stackexchange.com/questions/267868/
%       does-ruledtabular-environment-from-revtex4-1-break-the-s-column-in-siunitx
documentclass[aps,pra,reprint]{revtex4-1}
usepackage{siunitx}
usepackage{makecell}

usepackage{lipsum}

begin{document}
lipsum[1]
begin{table}[ht]
sisetup{per-mode=symbol,
         bracket-unit-denominator=false,
         table-align-exponent=false,
         table-format=1.2e+1,
         table-align-text-post=false}
renewcommandarraystretch{1.3}
begin{tabular*}{0.9linewidth}{@{extracolsep{fill}} c S l}
    Xhline{0.8pt}
Property                & {Value}   & Unit \
    Xhline{0.4pt}
$epsilon_mathrm{w}$   & 7.2e-5    & si{gramcentimeterpersquaredvoltpersquaredsecond}    \
$eta$                  & 1.33e-2   & si{grampercentimeterpersecond}                         \
    Xhline{0.8pt}
 end{tabular*}
end{table}
lipsum[2-4]
end{document}

which gives:

enter image description here

Answered by Zarko on November 23, 2021

I found an answer here that works properly. The bad thing is that an extra rule needs to be added by hand on each line of every table. It seems to me that the package array (which is both included by dcloumn and siunitx) manages to change the spacing parameters of the tables on a revtex document in a poor way.

Answered by giant_bonsais on November 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP