![对齐列表中的文本](https://linux22.com/image/254748/%E5%AF%B9%E9%BD%90%E5%88%97%E8%A1%A8%E4%B8%AD%E7%9A%84%E6%96%87%E6%9C%AC.png)
我希望“Yes”在下面完美对齐。就像现在的表格一样,如果“Yes”前面有星号,它会将文本推到左边。但是,我希望每列“Yes”都对齐,这样 yes 中的每个“Y”都直接位于该列中其他 yes 中的另一个“Y”之上,而不管前面有多少个星号。
我尝试过\phantom
添加一些星星,但是没有用。
最小示例:
\documentclass{article}
\usepackage{longtable}
\usepackage{dcolumn}
\usepackage{booktabs}
\usepackage{lscape}
\newcommand{\C}[1]{\multicolumn{1}{c}{#1}}
\newcommand*{\SuperScriptSameStyle}[1]{%
\ensuremath{%
\mathchoice
{{}^{\displaystyle #1}}%
{{}^{\textstyle #1}}%
{{}^{\scriptstyle #1}}%
{{}^{\scriptscriptstyle #1}}%
}%
}
\newcommand*{\oneS}{\SuperScriptSameStyle{*}}
\newcommand*{\twoS}{\SuperScriptSameStyle{**}}
\newcommand*{\threeS}{\SuperScriptSameStyle{*{*}*}}
\newcommand\Ya{\C{Yes}}
\newcommand\Yb{\C{Yes\oneS}}
\newcommand\Yc{\C{Yes\twoS}}
\newcommand\Yd{\C{Yes\threeS}}
\newcolumntype{d}[1]{D{.}{.}{#1}} % "decimal" column type
\begin{document}
\begin{landscape}
\begin{longtable}{@{} l @{\extracolsep{\fill}} *{7}{d{6}} @{}}
\cmidrule[\heavyrulewidth]{1-8}
& \multicolumn{1}{c}{Column 1aa}
& \multicolumn{1}{c}{Column 1aa}
& \multicolumn{1}{c}{Column 1aa}
& \multicolumn{1}{c}{Column 1aa}
& \multicolumn{1}{c}{Column 1aa}
& \multicolumn{1}{c}{Column 1aa}
& \multicolumn{1}{c}{Column 1aa} \\
\cmidrule{1-8}
\endfirsthead
\multicolumn{2}{@{}l}{\emph{(continued)}} \\
\cmidrule[\heavyrulewidth]{1-8}
& \multicolumn{1}{c}{Column 1aa}
& \multicolumn{1}{c}{Column 1aa}
& \multicolumn{1}{c}{Column 1aa}
& \multicolumn{1}{c}{Column 1aa}
& \multicolumn{1}{c}{Column 1aa}
& \multicolumn{1}{c}{Column 1aa}
& \multicolumn{1}{c}{Column 1aa} \\
\cmidrule{1-8}
\endhead
\cmidrule[\heavyrulewidth]{1-8}
\multicolumn{8}{r@{}}{\emph{(continued)}}
\endfoot
\cmidrule[\heavyrulewidth]{1-8}
\endlastfoot
\multicolumn{5}{@{}l}{\emph{Estimates}} \\
$\tau = 0.05$ & -0.078 & -0.959 & -0.695 & -1.754\oneS & 0.339 & -2.925 & 2.553 \\
$\tau = 0.10$ & -0.046 & -0.868 & -0.649 & -1.066 & -0.272 & -4.288\twoS & -0.245 \\
$\tau = 0.50$ & -0.424 & -0.910 & -0.786 & -1.625\oneS & 1.569\twoS & -3.569\twoS & 0.086 \\
$\tau = 0.90$ & -1.008\twoS & 0.001 & -1.924\threeS & 0.906 & 0.284 & -2.444 & 1.552 \\
$\tau = 0.95$ & -0.911\twoS & 0.930 & -2.230\threeS & -0.321 & 1.363 & -2.903 & 0.479 \\
& & & & & & & \\
$F:\tau \in \{0.05,0.50\}$ & 0.467 & 0.002 & 0.018 & 0.013 & 1.325 & 0.078 & 1.855 \\
$F:\tau \in \{0.50,0.95\}$ & 0.842 & 2.808\oneS & 5.230\twoS & 1.447 & 0.031 & 0.022 & 0.028 \\
$F:\tau \in \{0.05,0.95\}$ & 2.484 & 2.952\oneS & 3.918\twoS & 1.378 & 0.483 & 0.000 & 0.572 \\
& & & & & & & \\
\multicolumn{5}{@{}l}{\emph{\underline{Sigs}}} \\
$\tau = 0.05$ & \Yb & \Yd & \Ya & \Yd & \Ya & \Yd & \Yd \\
$\tau = 0.10$ & \Ya & \Yd & \Ya & \Yd & \Ya & \Yd & \Ya \\
$\tau = 0.50$ & \Yd & \Ya & \Ya & \Ya & \Ya & \Ya & \Ya \\
$\tau = 0.90$ & \Yd & \Yb & \Yb & \Ya & \Ya & \Yc & \Ya \\
$\tau = 0.95$ & \Yd & \Yc & \Yd & \Yc & \Yd & \Yd & \Yd \\
\end{longtable}
\end{landscape}
\end{document}
答案1
一种方法是将星星放在(或)r
上方,这样它们就不会占用任何水平空间。简而言之,相当于:lap
\rlap
\rlap
\makebox[0pt][l]
\newcommand*{\oneS}{\rlap{\SuperScriptSameStyle{*}}}
\newcommand*{\twoS}{\rlap{\SuperScriptSameStyle{**}}}
\newcommand*{\threeS}{\rlap{\SuperScriptSameStyle{*{*}*}}}