LaTeX :跨 tex 文件的引用

如果需要在 response.tex 中引用 revision.tex 的某一段文本,可通过以下步骤实现:

  1. 在 revision.tex 中,将需要引用的文本放在 %<*tag>%</tag> 之间,即:

    %<*tag>
    Here is the text to be cited.
    %</tag>
    
  2. 在 response.tex 中,添加 catchfilebetweentags 这个包,即:

    \usepackage{catchfilebetweentags}
    
  3. 在 response.tex 中,利用 \ExecuteMetaData 命令引用文本,即:

    \ExecuteMetaData[revision]{tag}
    

然而,如果需要引用的文本中包含了 \ref\eqref\cite 命令,response.tex 将无法正常编译以及显示编号

此时,还需要让 response.tex 获取 revision.tex 所生成的 labels 和 citations ,即,在 response.tex 中添加如下命令:

% copy labels
\usepackage{xr}
\externaldocument{revision}

% copy citations
\usepackage{xcite}
\externalcitedocument{revision}

这是因为,revision.tex 生成的 labels 和 citations 全都保存在 revision.aux 文件中,而 \externaldocument\externalcitedocument 可以分别读取 aux 文件中的 labels 和 citations

执行完以上操作,无论是 revision.tex 中的什么文本,都能在 response.tex 中正常编译并显示(测试使用的是 IEEE 的论文模板)

可能不适用于其余期刊的论文模板,因为其他期刊论文模板可能修改了 aux 文件中 labels 和 citations 的格式(应该是都可以通过编译的,只不过显示效果依赖于期刊模板)

例如,在 revision.tex 中写到:

%<*lemma>
\blue{The transmission energy consumption of an SN can be minimal when constraints \eqref{eqn:power_low_energy_node} - \eqref{eqn:power_CH} are met with equality.}
%</lemma>

在 response.tex 中引用 revision.tex 的内容:

We have rewritten Lemma 1 as: ``\ExecuteMetaData[revision]{lemma}''

编译得到的 response.pdf 显示:
在这里插入图片描述
可以看到,revision.tex 对公式的引用,即, \eqref{eqn:power_low_energy_node} - \eqref{eqn:power_CH} ,也能在 response.tex 中正常编译,并且,在 response.pdf 显示出的公式编号与 revision.pdf 相同

再例如,在 revision.tex 中写到:

%<*collection>
With CDG scheme \cite{CDG2009}, each SN sends the collected data along the data collection route to the CH, and the UAV flies to collect data along the trajectory obtained from the configuration phase.
%</collection>

在 response.tex 中引用:

To reveal the data collection mechanism, we have added the following sentence in Section IV: ``\blue{\ExecuteMetaData[revision]{collection}}''

编译得到的 response.pdf 显示:

在这里插入图片描述

可以看到,revision.tex 对参考文献的引用,\cite{CDG2009} ,也能在 response.tex 中奏效

类似的,revision.tex 中关于表格(table)、算法(algorithm)、图片(figure)等的引用(通过 \label 命令打标签、通过 \ref 命令引用),也能采用以上方式在 response.tex 中正常编译并显示

  • 5
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Jiankyeer

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值