All,

Being only moderately comfortable with Perl, I find myself in need of some
direction on a more complex task. I have a tex file containing a large
number of exercises shaped as follows:

\ex This is the text of the exercise as it appears in the book.  The
exercise may have several parts.
\pt This is the first part.
\ans This is the solution to the first part.  
\endans
\backans{This is the answer to the first part that goes in the back of
the book. These are present only for the odd-numbered exercises.}
\pt This is the second part.
\ans This is the solution to the second  part.  
\endans
\backans{This is the answer to the second part that goes in the back
of the book.} 

I need to change each of these into the following form:

\begin{exer}
  \begin{exertext}
    This is the text of the exercise as it appears in the book.  The
    exercise may have several parts.
    \begin{subenumerate}
    \item This is the first part.
    \item This is the second part.
    \end{subenumerate}
  \end{exertext}
  \begin{soln}
    \begin{subsoln}
    \item  This is the solution to the first part.  
    \item This is the solution to the second  part. 
    \end{subsoln}
  \end{soln}
  \begin{answer}
    \begin{subanswer}
    \item This is the answer to the first part that goes in the back of
      the book. These are present only for the odd-numbered exercises.
    \item This is the answer to the second part that goes in the back
      of the book.
    \end{subanswer}
  \end{answer}
\end{exer}

I am looking for suggestions on how to attack this assignment. Perhaps
there are modules on CPAN that would help me of which I am not aware. Or,
perhaps a kind soul will suggest an attack.

Thanks. Any help appreciated.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to