![重现一个表格(使用表格?)](https://linux22.com/image/437087/%E9%87%8D%E7%8E%B0%E4%B8%80%E4%B8%AA%E8%A1%A8%E6%A0%BC%EF%BC%88%E4%BD%BF%E7%94%A8%E8%A1%A8%E6%A0%BC%EF%BC%9F%EF%BC%89.png)
答案1
我将采用一个tabularx
环境并对第一列使用修改形式的X
列类型,其中修改会暂停完全对齐并启用悬挂缩进。
\documentclass[12pt]{article} % or some other suitable document class
\usepackage{tabularx,ragged2e,booktabs}
\usepackage{newtxtext,newtxmath}
\newcolumntype{L}{>{\RaggedRight\hangafter=1\hangindent=1em}X}
\newcommand\mc[1]{\multicolumn{2}{c}{#1}}
\begin{document}
\begin{table}
\caption{Participant Characteristics}
\begin{tabularx}{\textwidth}{@{} L r@{\space}l @{\qquad} r@{\space}l c @{}}
\toprule
& \mc{More} & \mc{Less} \\
& \mc{Experienced} & \mc{Experienced} \\
Variables & \mc{Investors} & \mc{Investors} & P-Value$^*$ \\
\midrule
Percentage who had previously invested in the stock market
& \multicolumn{2}{l}{78.50\%} & \multicolumn{2}{l}{36.78\%} & .001 \\
\addlinespace
Years of business work experience
& 6.35 & (6.00) & 1.28 & (2.14) & .001\\
\addlinespace
Age
& 30.46 & (1.70) & 20.11 & (2.67) & .001 \\
\addlinespace
Number of courses taken that discussed investing in mutual funds or the stock market
& 1.58 & (1.70) & .95 & (1.16) & .001 \\
\addlinespace
\dots \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
答案2
起点:
\documentclass[twocolumn]{article}
\usepackage{booktabs} % horizontal lines, such as \toprule, \midrule and \bottomrule
\usepackage{tabularx} % tabularx environment
\usepackage{siunitx} % S type columns to improve alignment of numbers
\usepackage{threeparttable} % tablenotes environment and \tnote commend
\usepackage{makecell} % \thead command for column headers with manual line breaks
\renewcommand{\theadfont}{\normalsize}
\usepackage{lipsum} % dummy text. Do not use in real document.
\begin{document}
\begin{table}
\begin{threeparttable}
\caption{the table's caption}
\label{tab:key}
\begin{tabularx}{\linewidth}{@{}>{\raggedright\arraybackslash\hangindent=6pt}X r@{\;}l r@{\;}l S[table-format=1.3]@{}}
\toprule
\thead[bl]{header}
& \multicolumn{2}{c}{\thead[b]{a 3 \\line long \\ header}}
&\multicolumn{2}{c}{\thead[b]{a 3 \\line long \\ header}}
& {\thead[b]{header\tnote{*}}}\\
\midrule
some text & \multicolumn{2}{c}{11.11\%} & \multicolumn{2}{c}{11.11\%} & 1.111 \\
a multiple line text & 1.11 & (1.11) & 11.11 & (1.11) & 1.111 \\
another entry with long text & 1.11 & (1.11) & 1.1 & (1.11) & 1.11 \\
\bottomrule
\end{tabularx}
\begin{tablenotes}[flushleft]\small
\item[*] some descriptive text below the table. This text is as wide as the table
\end{tablenotes}
\end{threeparttable}
\end{table}
\lipsum % dummy text. Do not use in real document.
\end{document}