tabularx 中标题在浮动之外

tabularx 中标题在浮动之外

处理此 latex 文件时出现错误。请帮助我。谢谢。

\documentclass{article}
\usepackage{tabularx}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage{booktabs}
\usepackage{setspace}
\usepackage[tablename=TABLE,labelsep=newline,aboveskip=0pt,bf,justification = centering]{caption}
\usepackage[dvipsnames]{xcolor}
\usepackage[capposition=top]{floatrow}
\newcommand*{\tabnospace}{\item \noindent \hspace{-0.05in}}
\newcommand{\gmc}[2]{\multicolumn{#1}{@{}#2@{}}}

\begin{document}

\begin{ThreePartTable}    
\footnotesize  

\begin{TableNotes}[flushleft]       
\small      
\tabnospace 
Notes: The table reports results from regression models of future forecast errors of real estate price changes on the corresponding-region accounting profitability change. Forecast errors are actual realizations of real estate price changes minus the corresponding-period forecasts from Econoday and Zillow. Table 1 provides more details on the variables and the sample. \hrule
\end{TableNotes}        

\singlespacing  

\begin{tabularx}{\textwidth}{XXXX}
    \caption{\textbf{How is Regional Accounting Information Processed by Real Estate Forecasters?}}\\
    \gmc{4}{l}{Panel A. Econoday forecasts} \\\hline
    & \gmc{3}{c}{Future Forecast error of regional real estate price change} \\\hline
    & Estimate & Standard Error & t-statistic \\\hline
    $\Delta Prof_{region}$ &    0.100&  0.046&  2.165\\
    Intercept & 0.000&  0.001&  0.147 \\
    Adjusted $R^2$ &    0.154        \\\\\hline

    \gmc{4}{l}{Panel A. Zillow forecasts} \\\hline  
    &Estimate&  Standard Error& t-statistic\\
    $\Delta Prof_{region}$ &    0.068&  0.029&  2.389 \\
    Intercept&  0.000&  0.000&  0.347\\\\
    Adjusted $R^2$ &    0.145        \\
    \end{tabularx}   
\end{ThreePartTable}

\end{document}

答案1

位于环境\captiontabularx,这是一个错误。但即使在环境外它也不会起作用,因为Threeparttable没有浮动环境。请根据需要使用caption包和\captionof{table}{\textbf{How is ...}}位于环境外的包tabularx,位于环境下方或上方。tabularx

\documentclass{article}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage{booktabs}
\usepackage{setspace}
\usepackage[tablename=TABLE,labelsep=newline,aboveskip=0pt,bf,justification = centering]{caption}
\usepackage[dvipsnames]{xcolor}
\usepackage[capposition=top]{floatrow}
\newcommand*{\tabnospace}{\item \noindent \hspace{-0.05in}}
\newcommand{\gmc}[2]{\multicolumn{#1}{@{}#2@{}}}

\begin{document}

\begin{ThreePartTable}    
\footnotesize  

\begin{TableNotes}[flushleft]       
\small      
\tabnospace 
Notes: The table reports results from regression models of future forecast errors of real estate price changes on the corresponding-region accounting profitability change. Forecast errors are actual realizations of real estate price changes minus the corresponding-period forecasts from Econoday and Zillow. Table 1 provides more details on the variables and the sample. \hrule
\end{TableNotes}        

\singlespacing  
\captionof{table}{\textbf{How is Regional Accounting Information Processed by Real Estate Forecasters?}}

\begin{tabularx}{\textwidth}{XXXX}
    \gmc{4}{l}{Panel A. Econoday forecasts} \\\hline
    & \gmc{3}{c}{Future Forecast error of regional real estate price change} \\\hline
    & Estimate & Standard Error & t-statistic \\\hline
    $\Delta Prof_{region}$ &    0.100&  0.046&  2.165\\
    Intercept & 0.000&  0.001&  0.147 \\
    Adjusted $R^2$ &    0.154        \\\\\hline

    \gmc{4}{l}{Panel A. Zillow forecasts} \\\hline  
    &Estimate&  Standard Error& t-statistic\\
    $\Delta Prof_{region}$ &    0.068&  0.029&  2.389 \\
    Intercept&  0.000&  0.000&  0.347\\\\
    Adjusted $R^2$ &    0.145        \\
  \end{tabularx}   
\end{ThreePartTable}
\end{document}

相关内容