1

A friend sent me a lyx file to edit it. I had no idea how lyx works so I assumed it was similar to the usual latex. Since I hadn't lyx installed, I opened with texmaker as a .tex file and edited. I didn't know it but what I was editing was the source code, so it wasn't what my friend saw when she wrote it. There were code lines like

\begin_layout Standard
Existe un tipo de tensores que tiene especial interés en geometría, conocidos
 como tensores métricos.
 Se llama 
\emph on
tensor métrico o métrica 
\emph default
a cualquier tensor 2-covariante simétrico bilineal:
\end_layout

When I sent the edited .tex file back to her, I thought she just had to open it on lyx or copy the text and paste it in lyx, but it turns out that lyx isn't able to read its source code. I tried to install lyx to see what happens, but I've got an error when I tried to open it so I uninstalled it.

Does anyone know how to open that file on lyx?

  • What file did you try to open with LyX, the original she sent you, or the one you edited? If the edited, I would guess you used the wrong syntax, thereby making the code invalid, so LyX can't read it. Open the original in LyX, and make the changes in LyX, not by editing the source. – Torbjørn T. May 5 '18 at 20:42
  • 2
    LyX is actually not a LaTeX editor. It can import .tex files and export .tex files, but it would not be a good idea to continually export, edit, import. A .lyx file has a completely different format. So to edit a .lyx file, you would need to use LyX. I suggest that you both either use LyX or both just use LaTeX directly. Otherwise collaboration will be complicated unless you only need one round of edits. – scottkosty May 5 '18 at 20:46
  • @TorbjørnT. I changed the file extension from .lyx to .tex and then edited it on TexMaker. I'll try that, thanks. – Javi May 5 '18 at 21:07
  • You didn't really answer my question, but anyway: doing what you say there is actually somewhat pointless. Changing the file extension doesn't make into a LaTeX file, both a .tex file and a .lyx file is a plain text file, the difference is in the content. You could have opened the .lyx file in Texmaker without changing the extension. – Torbjørn T. May 5 '18 at 21:18
  • @TorbjørnT. I didn't know that, next time I won't change the extension and my friend will probably be able to work with it. – Javi May 5 '18 at 22:25
1

(Summarizing the comments a bit.)

LyX is not a LaTeX editor. The format used by LyX is not LaTeX code, it is completely different and native to LyX. Changing the file extension to .tex does not make it into a LaTeX file, any more than changing the extension of a Lua script to .py would make it a Python script. Both are just plain text files, it's the content that matters.

So if you want to edit a .lyx file, open it with LyX. Do not open it in a text editor, like Texmaker, and edit the source (unless you really know what you're doing).

As scottkosty mentions, LyX can import and export LaTeX files (thereby converting from/to its own format), but it's likely better for collaboration to stick to one of the formats.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.