Andre Poenitz wrote:
> Maybe we must settle at a 'round trip' definition. There are several
> possibilities:
>
> 1. round trip in the weak sense:
> .lyx -> .tex -> .dvi == .lyx -> .tex -> .lyx -> .tex -> .dvi
>
> 2. round trip in the realistic sense:
>
> .lyx == .lyx -> .tex -> .lyx (mod irrelevant whitespace)
>
> 3. round trip in the strong sense:
>
> .lyx == .lyx -> .tex -> .lyx
> .tex == .tex -> .lyx -> .tex
>
> [...]
>
> I'd be more than happy to have 2. and I'd rather not add too much code
> to make the whitespace behave nicely as long as 1. is satisfied.
Ok. If the goal is 2., the test in the check_space function becomes:
if (next.cat() == catSpace ||
(next.cat() == catNewline && next.cs().size() == 1) ||
(next.cs() == "end" && context.layout->free_spacing && curr.cat() ==
catNewline))
The check for catSpace and catNewline is necessary, because a space followed
by a newline may only produce one space in the output (and vice versa).
Multiple spaces are handled by the tokenizer.
Georg