# Creating separated tex files using the versions package

I have a midterm exam written with the solutions included using the versions package. I use this to create an assignment/exam PDF and a solution PDF from the same basic tex file (this is great---change a question a bit and you don't have to change the question in a separate solutions file).

Is there a way to create separate assignment and solution tex (as opposed to PDF) files that exclude and include the appropriate version environments? The reason that I want to do this is because this is a take-home exam and some students want to submit their answers using LaTeX on the original file.

-
It's not necessary to begin your questions with a greeting. –  lockstep Mar 15 '11 at 19:19

sed '/\\begin{solution}/,/\\end{solution}/d' file.tex > file-without-solutions.tex

Both file.tex and file-without-solutions.tex could be compiled to PDF files with the additional benefit that you could hand out the source code for file-without-solutions.tex.