Uwe Stöhr <uwesto...@web.de> writes: > 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.
OK, I see what you mean now. It would be a good idea to chage all of our definitions to use \providecommand. > 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. The whole idea of the scheme was to mark the parts that come from LyX and the ones that come 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! Note that tex2lyx can never be guaranteed to be colleague-proof. For every clever trick you find there will be a stubborn colleague to defeat it. The idea of the previous scheme was to add comments indicating which parts of the code come from LyX, and which part come from the user. If the colleague does not read them and just hacks around, there is not much anyone can do. Remember that tex2lyx is a best-effort tool, not a solution to all problems. > 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. Yes, I wanted to add a closing comment there and I am not sure why it was not done. >> 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. So you mean that each and every comment is part of the file format? Hmmm, I am not sure I buy that. Ok, let's sum things up. Now that I thought about it, here is what I do not like about your approach * maintenance is difficult: nobody changes the file format when a comment changes in LaTeX output. The file format is only for .lyx files. * it is black magic: the user has _no_ way to know in advance which comment will be kept and which will be discarded. My approach was different: we have a mark indicating that a file is produced by LyX and, if this mark is present, only stuff said to be part of user preamble is kept. It solves the first problem but is still a bit black magic. Therefore we could have a different version of it, one that warns the "colleague". Something like: a comment at the beginning like % [lyxlatex] if this comment is kept, only text in [userpreamble]/[enduserpreamble] will be kept by tex2lyx and later in the preamble % [userpreamble] the lines below will be kept when re-importing in LyX ... % [enduserpreamble] lines below will not be kept when re-importing in LyX The precise comments are not important, but you get the idea: * a tag that tex2lyx reads (and that will be documented in its man page and its documentation. * human-readable text that tell the colleague what it is all about and where he should add his stuff. Thoughts? JMarc