Latex decimal alignment issues- font changed, header affected, not aligning for bold maths

I’m a beginner of Latex and I’m working on a journal formatting.

I have a lot of statistical tables (ANOVA table, post-hoc test) to put into my paper, here are some problem I encountered:

  • Decimal alignment package meaning unclear to me:I used the dcolumn package for decimal alignment in each column. Although I’ve checked through the documentation of this package, it is still unclear to me what D{.}{.}{a,b} really do to the numerical values and text in the table.

For instance, below are one of my table code and its image:

begin{table}[htbp]
renewcommandarraystretch{1.3}
caption{COMPARISONS BETWEEN THE LFG AND THE ARG ON INTERCEPT}
label{tab:compare_intercept_LFG_ARG}
resizebox{columnwidth}{!}{%
begin{tabular}{|c|c|c|D{.}{.}{2,3}|c|c|c|}
hline
textbf{Mode} &
  textbf{begin{tabular}[c]{@{}c@{}}Config. 1\ (I)end{tabular}} &
  textbf{begin{tabular}[c]{@{}c@{}}Config. 2\ (J)end{tabular}} &
  textbf{begin{tabular}[c]{...}Mean Diff.\ (I)-(J)end{tabular}} &
  textbf{begin{tabular}[c]{@{}c@{}}SE\ Diff.\ (I)-(J)end{tabular}} &
  textit{textbf{begin{tabular}[c]{@{}c@{}}t\ (df=31)end{tabular}}} &
  textit{textbf{p}} \ hline
multirow{2}{*}{AR mode} & ARG-30 & LFG-30 & 70.952 & 30.067 & 2.360 & textbf{.025*} \ cline{2-7} 
                         & ARG-60 & LFG-60 & 38.37  & 30.441 & 1.260 & .219           \ hline
multirow{2}{*}{VR mode} & ARG-30 & LFG-30 & 50.915 & 37.319 & 1.364 & .215           \ cline{2-7} 
                         & ARG-60 & LFG-60 & 48.637 & 32.534 & 1.495 & .794           \ hline
end{tabular}%
}
end{table}

This is what the code shows in PDF.

I changed frombegin{tabular}{|c|c|c|c|c|c|c|} to begin{tabular}{|c|c|c|D{.}{.}{2,3}|c|c|c|} for aligning the decimal point, but it caused the first row header to run out of the cell.

  • Error happens when I add D{.}{.}{number} as an alignment choice

    The code below used D{.}{.}{3} and boldmath{}, and it jumped several errors (listed below). But it turns out that the table shows quite well to me.

    • Missing } inserted. → I couldn’t find the place

    • Extra }, or forgotten $. → I couldn’t find any

    • Command boldmath invalid in math mode on input line 62. → don’t know why

    • Command mathversion invalid in math mode on input line 62. → don’t know either

    • Overfull hbox (4.33331pt too wide) detected at line 62 → guess maybe I can ignore it?

begin{table}[htbp]
renewcommand{arraystretch}{1.3}
caption{POST HOC TEST RESULTS OF THE INTERACTION FOR SLOPE BETWEEN GLASSES AND DISTANCE}
label{tab:slope_2w_inter_glasses_dist}
resizebox{linewidth}{!}{%
begin{tabular}{|c|c|c|D{.}{.}{5}|D{.}{.}{3}|D{.}{.}{3}|D{.}{.}{3}|}
hline 
textbf{begin{tabular}[c]{@{}c@{}}Group\ #end{tabular}} &
  textbf{begin{tabular}[c]{@{}c@{}}Config. 1\ (I)end{tabular}} &
  textbf{begin{tabular}[c]{@{}c@{}}Config. 2\ (J)end{tabular}} &
  multicolumn{1}{c|}{textbf{begin{tabular}[c]{@{}c@{}}Mean Diff.\ (I)$-$(J)end{tabular}}} &
  multicolumn{1}{c|}{textbf{SE}} &
  multicolumn{1}{c|}{textit{textbf{begin{tabular}[c]{@{}c@{}}t\ (df=31)end{tabular}}}} &
  multicolumn{1}{c|}{textit{textbf{p}}} \ [3pt] hline
1 & multirow{3}{*}{ARG-30} & ARG-60 & 14.463   & 5.063 & 2.857   & boldmath{.035^{*}} \ cline{1-1} cline{3-7} 
2 &                         & LFG-30 & 4.621    & 5.211 & 0.887   & 1.000          \ cline{1-1} cline{3-7} 
3 &                         & LFG-60 & 2.177    & 5.771 & 0.377   & 1.000          \ hline
4 & multirow{2}{*}{LFG-30} & ARG-60 & 9.842    & 5.771 & 1.705   & .373           \ cline{1-1} cline{3-7} 
5 &                         & LFG-60 & -2.444  & 5.063 & -0.483 & 1.000          \ hline
6 & ARG-60                  & LFG-60 & -12.286 & 5.211 & -2.358 & .109           \ hline
multicolumn{7}{l}{$^{ast}$textit{p} textless .05.}
end{tabular}%
}
end{table}
  • If I use bm instead of boldmath, the code collapse and couldn’t compile. Furthurmore, if I add $$, such as $bm{.35^{*}}$, the whold cell will go blank (same for boldmath)

  • Font changes when I use D{.}{.}{} (happening to the 2nd code block above)
    I found this alignment choice automatically add $$ to all the numerical cells such that the cells with non-math font will be changed to math style, and the math font with $$ in the corresponding columns will be change back to normal text.

    Is there anyway to resolve this font-changing issue?

  • Bold math with asterisk * won’t align by decimal point.
    I have a lot of values need asterisk superscript (ex. .05* , .01**, .001***), but the same method for decimal alignment doesn’t work for the cells with superscript.

All of those problems are freaking me out QQ. Please help me out with the trivial problems so that I can focus back to my content writing.

I changed the value in D{.}{.}{#} like D{.}{.}{3} or D{.}{.}{5} to try aligning my decimal points.
Some table did succeeded without affecting the header position, but some just ruined the whole table. The header just cannot stay in center of the cell.

Other problems are as described.

New contributor

Annie Teng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật