Need suggestions

From: David Arnold (darnold_at_northcoast.com)
Date: 06/30/04


Date: Tue, 29 Jun 2004 18:12:49 -0700
To: beginners@perl.org

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.



Relevant Pages

  • Re: Heart Attack
    ... >> Attack: I recently had a heart attack while exercising. ... >> showed 100% blockage of the right coronary artery. ... >> cleared and a stent inserted within about two hours. ... >> strenuous daily exercise. ...
    (sci.med.cardiology)
  • Re: Heart Attack
    ... > Attack: I recently had a heart attack while exercising. ... > showed 100% blockage of the right coronary artery. ... > cleared and a stent inserted within about two hours. ... > strenuous daily exercise. ...
    (sci.med.cardiology)
  • Re: "What if.... Pearl Harbor attack Cira 2007? How would it go?
    ... While Hawaii still has a lot of military, ... it has little to repel a multi carrier/ mini sub attack today. ... should coordinate the exercises with some sort of Fleet Week or other ... The premise and exercise do not address ...
    (sci.military.naval)
  • Re: 324. Tsunami (6/27/05)
    ... when a real terror attack happened. ... exercise at rush hour in busy public transportation line. ... In Picadilly station, a man with empty hand; ... Said these were suicide bombers. ...
    (talk.politics.misc)
  • Re: Need suggestions
    ... >> Being only moderately comfortable with Perl, I find myself in need of ... >> direction on a more complex task. ... >> This is the text of the exercise as it appears in the book. ... >> I am looking for suggestions on how to attack this assignment. ...
    (perl.beginners)