Cyrille Artho wrote:

> I think it is possible to save some internal features of LyX (inset
> collapsed/expanded, notes, etc.) in LaTeX as well. They could be exported
> as special LaTeX comments. Of course, editing these comments would lose
> the extra data, but we'd have to trust people working on the low-level
> LaTeX code on that :-)
> 
> This probably works best of the comments are short (so people are not
> tempted to delete them), such as
> 
> \begin{table}%%LyX{inset:collapsed}
> ...
> \end{table}
> 
> (using two % to distinguish the comment for normal comments).

I strongly oppose to the idea of transporting meta data in comments. I have 
seen too many cases in many different application areas where this was done, 
and it failed (e.g. you are probably not the first with the idea to use %% 
as a special comment marker). tex2lyx does already parse special comments in 
the preamble, and there is a bug in trac about that which I currently don't 
find. I am short on time today, if you need more explanations please tell 
and you'll get them till the weekend.

Fortunately, LaTeX is a macro language, so it is easy to define new macros 
for stuff which is normally not exported to LaTeX. E.g., I believe it would 
not be too difficult to replicate branches in LaTeX with a set of macros, so 
that one can even enable/disable them in the .tex file.

You can improve roundtrip a lot without using comments for meta data. The 
current problems can be divided into three major categories:

1) Data that is available in LyX but not in LaTeX, e.g. a document language 
can not always be deduced from the .tex file

2) Limitations of the LyX file format, e.g. it is not possible to make LyX 
output a table that contains custom ERT between the end of a line and the 
beginning of the next one. If such things are read, tex2lyx has to conevrt 
the whole table to ERT. Another problem of this category are math macros 
(see my earlier mail).

3) Unfinished/missing features in tex2lyx, e.g. all needed information 
exists in .tex, but tex2lyx does not know how to use it (see 
src/tex2lyx/TODO.txt for pointers).

Category 1) might require additional meta data, but 2) and 3) do not, and 
I'd concentrate on these.


Georg

Reply via email to