LyXWhy does LyX use a special file format (.lyx)?

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
traveller
Posts: 3
Joined: Wed Feb 08, 2012 1:38 am

Why does LyX use a special file format (.lyx)?

Post by traveller »

Hi,

LyX claims to be an almost WYSIWYG-frontend for LaTeX. You can write LaTeX commands everywhere in the text and view the LaTeX source in real time (but not edit it). However, the project files are not .tex but .lyx files. They are not just renamed .tex files, i.e. you cannot change the file extension to .tex and use a common compiler.
However, LyX is capable to import from/export to .tex files.

So I'm wondering why LyX uses a special file format if it claims to be so close to LaTeX?

My question is motivated by the fact that I'm trying to avoid file conversion (images, movies, different office suites,...) whenever possible because it almost inevitably lead to losses or formatting problems. What are the differences between a .tex and a .lyx file (in semantics, not syntax), and what could possibly go wrong in the conversion from one to the other?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Why does LyX use a special file format (.lyx)?

Post by scottkosty »

Hi traveller,

Good questions. See my answers (which are opinions of course) below.
traveller wrote:Hi,

LyX claims to be an almost WYSIWYG-frontend for LaTeX. You can write LaTeX commands everywhere in the text and view the LaTeX source in real time (but not edit it). However, the project files are not .tex but .lyx files. They are not just renamed .tex files, i.e. you cannot change the file extension to .tex and use a common compiler.
However, LyX is capable to import from/export to .tex files.

So I'm wondering why LyX uses a special file format if it claims to be so close to LaTeX?
Where does it claim this? Maybe some people have confusingly argued this, but I don't know of any LyX developer who claims this (well, this depends on what you mean by "so close"). LyX can export LaTeX. That's it, as far as its relation with LaTeX. It can also export XHTML. It can also export plain text.
traveller wrote: My question is motivated by the fact that I'm trying to avoid file conversion (images, movies, different office suites,...) whenever possible because it almost inevitably lead to losses or formatting problems. What are the differences between a .tex and a .lyx file (in semantics, not syntax), and what could possibly go wrong in the conversion from one to the other?
You are right to be concerned. LyX is not programmed with roundtrip (converting to .tex and then back to .lyx) in mind. tex2lyx does its best and is improved, but it will never be perfect.

My guess is that LyX is not for you. You sound like you're looking for a LaTeX editor. LyX is not a LaTeX editor. You should think of it more as a LaTeX exporter.
Post Reply