>>>>> "Allan" == Allan Rae <[EMAIL PROTECTED]> writes:
Allan> * Relying upon '\n's to denote a paragraph is awkward and
Allan> error prone as demonstrated by our existing code. The
Allan> alternative: * {A LaTeX paragraph.\par} * <p>A typical
Allan> [SG|X|HT]ML paragraph.</p>
In the LaTeX case, the solution is straightforward now that the
output is on a LString and not a file. Insead of adding \n blindly,
just use the following methods, a stream-like version of it.
void breakLine(LString &str) {
if (!str.suffixIs('\n'))
str +='\n';
}
void breakParagraph(LString &str) {
// we could be a bit cleverer here to avoid an excessive number of \n,
// but this is not important
str +="\n\n";
}
The code in breakLine ensures that we will *never* have extra
paragraph breaks. And this code is needed whether or not you use \par
for paragraph break. In fact, I cannot think of an example where \par
makes a difference.
Allan> The last point might also have its difficulties in itemized
Allan> lists for example where two paragraphs are used for a single
Allan> itemized point as in:
Allan> * This is a long winded example.
Allan> That has a second paragraph.
Allan> * This is the next item.
Allan> where we'd need to generate (I think):
Allan> {\item This is a long winded example.
Allan> That has a second paragraph.\par}
We certainly do not need to generate such ugly code. LaTeX has enough
built-in support for lists so that everything works out of the
box. What you are trying it do is use LaTeX as a low-level tool and
not a high-level one.
Allan> My LaTeX knowledge doesn't stretch quite this far so the above
Allan> example could easily be wrong so I welcome any correction. I
Allan> have a feeling it'd actually need to generate something more
Allan> like:
Allan> \item {This is a long winded example.
Allan> That has a second paragraph.\par}
What's the use for the {} you put around paragraphs? Have you seen
many human-written LaTeX documents that use this kind of bizarre
construct? If it was really useful, then I would say LaTeX is a
badly-designed system.
JMarc