>>    Take the tex2lyx test file "test-insets.tex" that you find in branch,
>>    import it and compile the result as PDF -> this fails.
>
> Hmm, I just tried it and it worked... What error do you get?

This doesn't work with LyX 1.6.3's tex2lyx. After importing the file, you have 
the LyX-specific commands
\LyX
\lyxline
\lyxarrow
in the preamble (this is what I meant with more than one). But LyX adds them additionally automatically to the preamble. The LaTeX error you get when you want compile the document is that \lyxline and \lyxarrow are already define.

>>    The reason was
>>    that tex2lyx tries to recognize LyX-specific settings by the comment
>>
>>    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
>
> Normally, it recognizes LyX-specific settings by this comment and the additional 
"do not edit
> unless you know what you are doing" at the top.
>
> It may be that there is a bug with that, but it would be trivial to fix.

This not buggy - this is simply not working. It is this way impossible to know what preamble parts are from LyX and what from the user. Take for example the case that I send a TeX file created by LyX to a colleague. He's editing the file and I want to reimport it. With the current implementation, I loose his preamble code depending at which position he inserted his additions. This is not acceptable! But as said, it currently also fails, when you have more than one LyX-specific command in the preamble and fails for the closing \makeatother and the final call of babel.

>>    My solution fixes this because the things are now
>>    taken as they are without any assumptions. I've stress test this a lot
>>    and are very confident with the result. Please test it out and report
>>    when you find bugs.
>
> I can understand that this kind of "remember all the possible comments and 
add them to a big
> array" may work, but what happens when somebody changes a comment from
>
>   "%% Change tracking with ulem\n",
> to
>   "%% Change tracking with ulem package\n",

Then the user has a good reason to change the comment. Maybe he added some other things or so, therefore the comment need to be output. And this is what my patch does. (A comment more doesn't harm btw.)

> 1/ one has to remember to update tex2lyx

But that's what I'm currently doing. tex2lyx needs to be updated with most of the fileformat changes. This cannot be changed.

> 2/ now tex2lyx recognizes files generated by the new LyX, but not by the old 
one, so

This is not true. I checked that the comments haven't been changed since they 
were introduced.

> 3/ one has to add a new comment, so that we have
>  "%% Change tracking with ulem\n",
>  "%% Change tracking with ulem package\n",

No, see my statement above.

> Am I right that in your scheme, every inset only applies to the next line 
(expression)?

Yes, because no assumptions are made (that will always fail under certain circumstances). Only expressions added by LyX are handled, no matter where they are and no matter about comments.

regards Uwe

p.s. please CC me when replying

Reply via email to