如果需要在 response.tex 中引用 revision.tex 的某一段文本,可通过以下步骤实现:
-
在 revision.tex 中,将需要引用的文本放在
%<*tag>
和%</tag>
之间,即:%<*tag> Here is the text to be cited. %</tag>
-
在 response.tex 中,添加
catchfilebetweentags
这个包,即:\usepackage{catchfilebetweentags}
-
在 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 中正常编译并显示