On 06/09/2015 06:13 PM, Scott Kostyshak wrote:
On Tue, Jun 09, 2015 at 10:00:25PM +0100, Ricardo Gaspar wrote:
Hi there,

I am a new user of Lyx, but a not a beginner in LaTEX.
Hi Ricardo, and welcome! It's nice to have a fresh perspective. Please
keep providing feedback and if you happen to have the time and
interests, patches or (if you do not enjoy programming) improvements to
the documentation would be welcome. It's especially useful to receive
feedback from new users, in my opinion.

I couldn’t find in the internet why Lyx doesn’t allow to edit the source LaTEX 
file. It would be an awesome feature and could make Lyx a great rival against 
the other LaTEX editors.
I like the simplicity of Lyx and the features it provides, but sometimes I 
would like to change or add code directly to the source file.

Can you please answer this question? Or at least redirect me to a site where I 
can find it?
This is an often requested feature. See for example:
http://wiki.lyx.org/LyX/FeaturePoll2#toc10
http://www.lyx.org/trac/ticket/5260

The basic answer, from what I understand, is simply that it is *very*
hard to parse LaTeX. LyX has its own format. It can export that format
to LaTeX very reliably, but it is extremely difficult to make that a
seamless two-way communication.

Yes, the basic problem is that this is highly non-trivial, though not impossible, and it isn't really compatible with the idea behind LyX. Contrary to how it is often advertised, LyX is NOT a LaTeX frontend. LaTeX is only one of the formats we natively export (though by far
the most important).

The ability to edit the LaTeX would basically involve offering the user the LaTeX source for some fragment of text, then running tex2lyx on whatever the user ended up with, then replacing the relevant fragment of text witih the result. This is still harder than it sounds, since tex2lyx outputs some text (a LyX file, basically), and what we really need is the data structure that LyX would create upon reading that file. This could be done, though, by reading the new text into a temporary Buffer and doing some kind of cut and paste behind the scenes. But there's not really any guarantee that what LyX would export at that point would actually be the same as what the user entered: That kind of 'roundtrip' is a goal, not a reality.

Alternatively, the LaTeX the user created could become ERT. But then maybe such a user
should just use LaTeX.

Richard

Reply via email to