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 choiceThe code below used
D{.}{.}{3}
andboldmath{}
, 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 ofboldmath
, the code collapse and couldn’t compile. Furthurmore, if I add$$
, such as$bm{.35^{*}}$
, the whold cell will go blank (same forboldmath
) -
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.
Annie Teng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.