>>  > http://www.lyx.org/trac/ticket/6047
>>
>> This bug was a regression to LyX 1.5.x because of the new \ensuremath
>> handling. The bug reporter said that it worked with LyX 1.5.6.
>
> So, it was not a bug?

This bug was a regression introduced by the \ensuremath handling. That we load now mhchem automatically is a new feature.

>> The new feature is that we write
>>     \usepackage{mhchem}
>> to the preamble as soon as the user uses the command \ce in a formula.
>> So in LyX 1.6.3 you have to add this preamble line manually to the
>> preamble line when you open LyX files from 1.6.4 that use \ce.
>
> Ouch! Now I understand that it was a format change. I am really sorry
> for having missed that.

So we need a solution.

>> It is now as it is, but we should handle mhchem at least the same way
>> as we handle esint and amsmath: The user can turn them explicitly off
>> in the document settings under math. Do you agree?
>
> No, I think that it is a different case. It is more probable that a
> clash with a user defined macro occurs, rather than a clash among
> packages. The clash with a user macro is cured by the patch I posted.

We shouldn't guess anything. There might be package clashes, it is not possible to exclude this possibility. While think about this issue I still think that we need, additionally to your patch, to handle mhchem the same was as esint and amsmath.
Take for example the attached LyX file and open it in LyX 2.0svn where you have 
applied your patch.
When you compile it, you get errors, that \cf is already defined. The user has no choice to deactivate mhchem but he should have.

> However, it is now clear that a format change should be introduced.
> Now the damage is done in 1.6, but at least the problem should be
> fixed in 2.0 when exporting to a previous format.

This can only be done when we write something about mhchem to the file - like we do for esint and amsmath. Currently it is impossible to know by parsing the LyX file if mhchem is loaded by LyX or not. We cannot simply check if there is a "\ce{" in the file or not. Note that mhchem is also automatically loaded in the preamble when the command "\cf" is used.

regards Uwe

Attachment: newfile5.lyx
Description: application/lyx

Reply via email to