3

Possible Duplicate:
Automating quoting across LaTeX documents

I'm working on 2 documents: 1.tex and 2.tex.

2.tex is a metadocument about 1.tex, so that 2.tex has a lot of quotations from 1.tex. Thus, if I modify 1.tex, I need to modify 2.tex to reflect the changes accordingly. Such a procedure, however, is tedious and error-prone.

My question is: how can I store content from 1.tex for later insertion in 2.tex? I was wondering if there is any package like this:

1.tex:

\documentclass{book}
\usepackage{foo}
\begin{document}
First sentence. \StoreAndPrint{<key>}{Second sentence}. Third sentence.
\end{document}

2.tex:

\documentclass{article}
\usepackage{foo}
\begin{document}
The author says:
 \begin{quote}
 \RetrieveAndPrint{<key>}
 \end{quote}
\end{document}

Running $ latex 1, and then $ latex 2, would output an automatically updated 2.dvi.

\input

I could create as many separate tex files as quotations, and then \input them into both documents, but that would make editing 1.tex too hard.

n.r.
  • 4,942
  • Just to be clear: 1.tex and 2.tex will be used to produce two distinct documents? – egreg Jan 11 '13 at 18:22
  • @egreg: Yes. I edited the question to clarify that. – n.r. Jan 11 '13 at 18:39
  • (1) is the quoted material in the same order in 2.tex as in 1.tex? (2) is there additional material in 2.tex that isn't in 1.tex? if the answer to (1) is yes, it might be possible to include everything in a single file, and by means of a switch, choose to output either 1.dvi or 2.dvi as appropriate. – barbara beeton Jan 11 '13 at 18:40
  • @nicolai.rostov On that basis, I've closed as a dupe. – Joseph Wright Jan 11 '13 at 19:13
  • @nicolai.rostov I've just added to the other question the answer I was preparing for this one. – egreg Jan 11 '13 at 20:21

0 Answers0