AllenDowney / plastex-oreilly

Branch of plastex that generates DocBook 4.5 that meets O'Reilly style guidelines.
7 stars 7 forks source link

some exercises generate invalid DocBook #9

Open AllenDowney opened 12 years ago

AllenDowney commented 12 years ago

If you have a one-paragraph exercise like this

\begin{exercise}
Although the NSFG has been conducted seven times, it is not a
longitudinal study.  Read the Wikipedia pages
\url{http://wikipedia.org/wiki/Cross-sectional_study}
and
\url{http://wikipedia.org/wiki/Longitudinal_study}
to make sure you understand why not.
\end{exercise}

It generates DocBook that doesn't have a par around the contents of the exercise, so you get lots of errors.

If you put a newline in the LaTeX document before and after the paragraph, that works around the problem. But it would be preferable to handle correct LaTeX correctly.

AllenDowney commented 12 years ago

I extended TreeCleaner to handle this case. Seems to be working.

AllenDowney commented 12 years ago

This is still a problem if there are \index{} entries in the exercise that are not attached to a paragraph of text.

But this creates other problems elsewhere, so it may be that we want to require the LaTeX to attach index entries to text.