>>>>> "Joao" == Joao Luis Meloni Assirati <[EMAIL PROTECTED]> writes:

Joao> Hey guys,

Joao> I am back again to bug you.

Joao> Bug 1: the following latex fragment

Joao> [...] \usepackage{epsfig} [...] \begin{figure}
Joao> \epsfig{file=fig_1.eps} \end{figure}

Joao> when translated with tex2lyx, gives a 'catcode [_,8] illegal in
Joao> text mode' and the relevant translated code is 'file=fig1.eps',
Joao> i.e. the '_' is simply missing. The problem here is evidently
Joao> that 'file=fig_1.eps' is treated as text, not as ERT as it
Joao> should.

There is no way for tex2lyx to guess that \epsfig takes one argument
so what it does is reasonable. The right solution would be to add
support for \epsfig, but considering how obsolete this package is, the
is not a top priority.

Joao> Bug 2: in the latex fragment

Joao> \parbox{3in}{ \begin{center} one line\\ another line
Joao> \end{center}
Joao> }

Joao> the center environment is ignored. The problem here is that LyX
Joao> cannot consider the argument of the parbox as a paragraph.

This case is more difficult indeed. There are two problems:

1/ the center environment is currently ignored. This is a bug that
should be fixed asap.

2/ we do not support \parbox natively in LyX, so it is indeed very
difficult to fix this case. The fix would be to ``support'' parbox by
reading its parameters as ERT, but as before, I think there more
pressing things to do.

Joao> Discussion: I think it is nice how tex2lyx tries its best to
Joao> present things not in ERT, so lyx can display them in WYSIWYM
Joao> mode, which would be useful in the case of Bug 2. But it seems
Joao> to be impossible to do this reliably in general, as the examples
Joao> show.

Yes.

Joao> Furthermore, it is unpleasant to have a simple thing as
Joao> '\vspace{1cm}' broken as '\vspace', '{', '}' in ERT and '1cm' in
Joao> text mode. If then I delete the ERT '}' I end up with a broken
Joao> latex export, whereas if I delete a whole '\vspace{1cm}' in ERT
Joao> the latex export is OK.

The right solution here is to support \vspace, which is not too
difficult and should IMO be done before 1.4.0.

Joao> Therefore, I suggest that when '\command{blah blah}' is unknown
Joao> to tex2lyx, it be translated as a single ERT. Maybe to add a
Joao> command line switch like "--try-hard-on-ert", with the warning
Joao> that the resulting lyx file will be unreliable.

And how many parameters do you consider? Do you do the same for
\command*{blah blah}? And what about \command[bar]{foo}?

It is very difficult to do sensible things when one does not know
syntax. In this respect, reLyX uses a syntax table which allows it to
read more correctly commands even when they will eventually become
ERT. Implementing this in tex2lyx is not trivial.

JMarc

Reply via email to