将 threeparttable 与交叉引用相结合 - LyX

将 threeparttable 与交叉引用相结合 - LyX

我想知道threeparttable在浮点数内结合交叉引用是否存在已知问题。我的标签位于表格标题内,除非threeparttable被调用,否则此方法可以正常工作,在这种情况下,引用??在编译后才会出现。任何建议都将不胜感激。

ETA:谢谢 scottkosty,当然我应该添加更多细节。这是 LyX 中一个表格的屏幕截图,使用了 threeparttable 命令: 在此处输入图片描述

以下是该表的导出文本,包括序言:

%% LyX 2.0.6 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,british,american,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{color}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{setspace}
\onehalfspacing
\usepackage[unicode=true,pdfusetitle,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 0},backref=false,colorlinks=true]
 {hyperref}
\usepackage{breakurl}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
%% A simple dot to overcome graphicx limitations
\newcommand{\lyxdot}{.}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.

\usepackage{amsfonts}
\usepackage{chicago}
\usepackage{pdflscape}
\usepackage{appendix}
\usepackage{hyperref}
\usepackage[letterpaper,top=1in,right=1in,left=1in,bottom=1in]{geometry}
\usepackage[bottom]{footmisc}
%\usepackage{fancyhdr}
\usepackage{bibentry}
\usepackage{threeparttable}
\usepackage{dcolumn}
\usepackage{booktabs}

\setcounter{MaxMatrixCols}{10}

\newtheorem{theorem}{Theorem}
\newtheorem{acknowledgement}[theorem]{Acknowledgement}
\newtheorem{algorithm}[theorem]{Algorithm}
\newtheorem{axiom}[theorem]{Axiom}
\newtheorem{case}[theorem]{Case}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{conclusion}[theorem]{Conclusion}
\newtheorem{condition}[theorem]{Condition}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{criterion}[theorem]{Criterion}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{exercise}[theorem]{Exercise}
\newtheorem{lemma}{Lemma}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{problem}[theorem]{Problem}
\newtheorem{proposition}{Proposition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{solution}[theorem]{Solution}
\newtheorem{summary}[theorem]{Summary}
\newenvironment{proof}[1][Proof]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}

% For centered entries: 
% Allow line breaks with \\ in specialcells
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}
}

% For left-aligned entries:
%% Allow line breaks with \\ in specialcells
%\newcommand{\specialcell}[2][c]{%
%\begin{tabular}[#1]{@{}l@{}}#2\end{tabular}% missing % in original
%                       %%%
%}

% *****************************************************************
% siunitx
% *****************************************************************
\newcommand{\sym}[1]{\rlap{#1}} % Thanks to Joseph Wright & David Carlisle

\usepackage{siunitx}
    \sisetup{
        detect-mode,
        group-digits            = false,
        input-symbols           = ( ) [ ] - +,
        tight-spacing       = true,
        table-align-text-post   = false,
        input-signs             = ,
        }   

% Packages for tables
\usepackage{booktabs}% Pretty tables
\usepackage{threeparttablex}% For Notes below table

% Character substitution that prints brackets and the minus symbol in text mode. Thanks to David Carlisle
\def\yyy{%
  \bgroup\uccode`\~\expandafter`\string-%
  \uppercase{\egroup\edef~{\noexpand\text{\llap{\textendash}\relax}}}%
  \mathcode\expandafter`\string-"8000 }

\def\xxxl#1{%
\bgroup\uccode`\~\expandafter`\string#1%
\uppercase{\egroup\edef~{\noexpand\text{\noexpand\llap{\string#1}}}}%
\mathcode\expandafter`\string#1"8000 }

\def\xxxr#1{%
\bgroup\uccode`\~\expandafter`\string#1%
\uppercase{\egroup\edef~{\noexpand\text{\noexpand\rlap{\string#1}}}}%
\mathcode\expandafter`\string#1"8000 }

\def\textsymbols{\xxxl[\xxxr]\xxxl(\xxxr)\yyy}


% *****************************************************************
% Estout related things
% *****************************************************************
\let\estinput=\input % define a new input command so that we can still flatten the document

\newcommand{\estwide}[3]{
        \vspace{.75ex}{
            \textsymbols% Note the added command here
            \begin{tabular*}
            {\textwidth}{@{\hskip\tabcolsep\extracolsep\fill}l*{#2}{#3}}
            \toprule
            \estinput{#1}
            \bottomrule
            \addlinespace[.75ex]
            \end{tabular*}
            }
        }   

\newcommand{\estauto}[3]{
        \vspace{.75ex}{
            \textsymbols% Note the added command here
            \begin{tabular}{l*{#2}{#3}}
            \toprule
            \estinput{#1}
            \bottomrule
            \addlinespace[.75ex]
            \end{tabular}
            }
        }

% *****************************************************************
% Custom subcaptions
% *****************************************************************
% Note/Source/Text after Tables
% The new approach using threeparttables to generate notes that are the exact width of the table.
\newcommand{\Figtext}[1]{%
    \begin{tablenotes}[para,flushleft]
    \hspace{6pt}
    \hangindent=1.75em
    #1
    \end{tablenotes}
    }
\newcommand{\Fignote}[1]{\Figtext{\emph{Note:~}~#1}}
\newcommand{\Figsource}[1]{\Figtext{\emph{Source:~}~#1}}
\newcommand{\Starnote}{\Figtext{* p < 0.1, ** p < 0.05, *** p < 0.01. Standard errors in parentheses.}}% Add significance note with \starnote

% To adjust margins: 
\usepackage{changepage}

\usepackage{bbm}
\usepackage{bm}

\makeatother

\begin{document}
\begin{onehalfspace}


\begin{table}[!t]
\centering
\begin{threeparttable}

\caption{\label{tab:indices_plain}Treatment effects on index variables}


{\scriptsize\include{../Output/indices_plain}}

\selectlanguage{british}%
\begin{tablenotes}[flushleft] \scriptsize \item \emph{Notes:} 
OLS estimates of treatment and spillover effects. Outcome variables are listed on the left. Column (1) reports the mean of the control group for a given outcome variable. Column (2) reports the treatment effect across villages, i.e. comparing treatment households to pure control households. Column (3) reports the treatment effect within villages, i.e. comparing treatment housholds to control households in treatment villages (spillover households). Column (4) reports the spillover effect, i.e. the treatment effect on spillover households compared to pure control households. The unit of observation is the household for all outcome variables, except the psychological variables index, where it is the individual. The sample includes all households and individuals, except for the intrahousehold index, where it is restricted to co-habitating couples, and for the education index, where it is restricted to households with school-age children. For each outcome variable, we report the coefficient of interest, its standard error in parentheses, and the bootstrapped FWER $p$-value in brackets. Standard errors are clustered at the village level in columns (2) and (4), and at the household level in column (3). * denotes significance at 10 pct., ** at 5 pct., and *** at 1 pct. level.
\end{tablenotes}
\end{threeparttable}\selectlanguage{english}%
\end{table}

\end{document}

希望这有助于描述情况。我使用的是 LyX 版本 2.0.6,带有 MacTeX 包 2013。谢谢大家!

答案1

您已习惯使用\include表添加外部文件,但这并不推荐 -\input应改用。请参阅何时应使用 \input 和 \include?了解详情。基本上,\include应该在外部文件包含文档的较长部分(例如整个章节)时使用,这些部分应该从新页面开始,whereas \input可以用于较短的代码片段。\input与直接在 LaTeX 文件中写入内容基本相同。

不完全确定\include这样使用时会发生什么,但是当我\input在您的示例 LaTeX 文件中将其替换时,交叉引用可以正常工作。

在 LyX 中:

点击框说Include:indices_plain.tex,然后更改包含类型输入

在此处输入图片描述

相关内容