未編譯部分的引用

未編譯部分的引用

我用乳膠寫論文,我在各章中使用了不同的文件,並使用 \input 指令插入主文件。

有時,我只需要編譯一章(將其發送給讀者,或快速查看我所做的修改)。為此,我註釋/取消註釋相關的“輸入”命令。

但我想在已編譯的章節中保留對未編譯章節(章節、圖形、表格等)的交叉引用。如果我先對整個文件進行編譯,是否可以透過避免破壞舊的目錄檔案來保留交叉引用,是這樣的嗎?

我正在使用 smartref,但我不知道它對當前問題是否有用。

MWE 不是很有用,但它可能如下

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{cleveref}

\begin{document}

%\section{Uncompiled section}\label{thelabel}
%Hello world!

\section{Compiled section}
See \cref{thelabel} to get the Hello World.

\end{document}

答案1

使用\include命令集。例如:

\documentclass{report}
\includeonly{chap1,chap3} % only process chap1.tex and chap3.tex
\begin{document}
\include{chap1}    % input chap1.tex
\include{chap2}    % input chap2.tex
\include{chap3}    % input chap3.tex
\include{chap4}    % input chap4.tex
\end{document}

它只會處理 chap1.tex 和 chap3.tex,但會保留先前包含的文件的所有交叉引用。若要處理整批,請註解掉\includeonly巨集。

相關內容