copy and reuse the content of an environment
The package to use in this case is:
http://www.ctan.org/tex-archive/macros/latex/contrib/catchfilebetweentags/ gives the clearest code for this type of system of documents, each one citing perhaps parts of other.
Basically, a system of organization based on placing tags with some kind indexing convention (in between which a particular environment with a often reused piece of code or text goes) in documents allows using pieces of each as necessary where these may be littered and reused across many documents.
If the indexing convention is clever (use different prime numbers multiplied together to uniquely mark across documents as often done in software, as suggested by the only scientist recognized by posterity for his efforts with a brand of biscuits named after him?) or straightforward, say [Lichtenberg]{B-25},for the 25th aphorism of Lichtenberg's journal B, found in a larger document (a quotes file Lichtenberg, itself broken into sections A, B, C, according to the journals that sources of the quote in this case.
With a slightly different input, the following works just as well:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{myquotes.tex}
\begin{myquote}{quote1}
This is a quote
\end{myquote}
\begin{myquote}{quote2}
lorem ipsum dolor sit amet
\end{myquote}
\begin{myquote}{quote3}
foo bar baz foobar foobaz
\end{myquote}
\end{filecontents*}
\usepackage{environ}
\newcommand{\myquotearg}{}
\NewEnviron{myquote}[1]{%
\renewcommand{\myquotearg}{#1}% Store myquote environment argument
\ifx\myquotearg\contentName% Match argument with content name
\BODY% Print myquote environment body
\fi
\ignorespaces
}
\newcommand{\contentName}{}
\newcommand{\placeContent}[1]{%
\renewcommand{\contentName}{#1}% Store content name
\input{myquotes}}% Read input file
\begin{document}
\placeContent{quote2}
\placeContent{quote3}
\end{document}
The change is to supply an argument to your myquote
environment which is then used to check against the argument of \placeContent
. environ
is the key here, which allows to swallow the entire contents of the environment into \BODY
. We just condition on printing it based on whether the argument matches \contentName
.