將一個文件的摘錄包含在另一個文件中

將一個文件的摘錄包含在另一個文件中

我有一份手稿及其修訂報告。我需要把這篇手稿的一些句子當作摘錄放入修訂報告中。不是將摘錄定義為巨集或將摘錄放入另一個文件中然後包含它們,是否有更好的解決方案在修訂報告中使用手稿的文本?

我期望一個像這樣的解決方案:

內容manuscript.tex

...
Pragraph is starting.
\begin{externalize}[excerpt1]
Part that must be both in the manuscript and the revision report.
\end{externalize}
Paragraph ends.
...

內容revisionReport.tex

...
Here we include the following excerpt from the revised manuscript:

\externalizedtext{excerpt1}
...

答案1

您可以使用filecontents動態建立摘錄檔案:

內容manuscript.tex

\documentclass{article}
\usepackage{filecontents}

\begin{document}
... 

Pragraph is starting.

\begin{filecontents}{excerpt1.tex}
Part that must be both in the manuscript and the revision report.
\end{filecontents}
\input{excerpt1.tex}

Paragraph ends.

...
\end{document}

內容revisionReport.tex

\documentclass{article}

\begin{document}
...

Here we include the following excerpt from the revised manuscript:

\input{excerpt1.tex}

...

\end{document}

儘管我不完全確定我正確理解了你的問題,但這應該可以解決問題。

相關內容