Hfill 不工作

Hfill 不工作

在此处输入图片描述

嘿伙计们,看看上面的图片。我希望 (continue) 完全左对齐,但是 leftalign 在 tabularx (ltablex) 环境中对我不起作用,因此我使用 \hfill。虽然 hfill 在某种程度上有效,但不能产生完全左对齐。有没有修改 hill 的解决方案或任何其他解决方案来解决这个问题?谢谢。

\documentclass{article}
\usepackage{ltablex}
\usepackage{threeparttable}
\usepackage{booktabs}

\title{Document}
\begin{document}
\maketitle

\begin{tabularx}{\textwidth}{Xc}
\toprule\toprule
Some random text & 1,75,650\\\midrule
\multicolumn{2}{l}{\textbf{Panel A1: AAA}} \\\midrule
Number of observations ... & 1,75,650\\
Delete: ... & (78,420)\\
Delete: ... & (7,104)\\
Final sample & 90,126\\
Delete: & (2,143)\\
Delete: & (8,345)\\
Final sample & 79,638\\\midrule
\multicolumn{2}{l}{\textbf{Panel A2: AAA}} \\\midrule
Number of observations & 79,638\\
Delete: & (39,540)\\
Delete: & (7,979) \\
Final sample & 32,119 \\\midrule
\multicolumn{2}{l}{\textbf{Panel B1: BBB }} \\\midrule
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule
\multicolumn{2}{l}{\textbf{Panel B2: BBB}} \\\midrule
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule\bottomrule
\end{tabularx}

\end{document}

答案1

由于您说的是tabularx:在表格环境中,列前后都有空格。您可以通过@{}在列定义的相应位置插入来删除它,例如:

\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{4cm}{@{}Xr@{}}
\hline
Number & 42\\
\hline
\end{tabularx}
\end{document}

表输出

类似地,如果您使用\multicolumn

\multicolumn{2}{@{}l}{...}

您的 MWE 将成为:

表输出

对于“继续”行,请\multicolumn使用\hfill

\bottomrule\multicolumn{2}{@{}r@{}}{\small\textit{(Continued)}}\endfoot

续行

相关内容