LyX ⇒ Document exported from Lyx will not reimport
Document exported from Lyx will not reimport
Often, there are bugs in the Lyx output that I would like to try and correct in the source-code directly. For example, recently, there was a lot of bolded text (\textbf{}) throughout the document that I wanted to remove globally.
So I exported the entire book using File > Export > LaTeX (plain). I edited out all the permutations of bolding with Notepad++ and some regular expressions.
Then I opened the cleaned-up *.tex document in TeXworks. The PDF compiled perfectly.
But when I tried to return it to Lyx using File > Import > LaTeX (plain), I got an error and the file would not open.
Similarly, on other occasions, I have exported to TeXWorks a file that compiles perfectly to PDF within Lyx, only to find that it won't compile to PDF in TeXworks, and will no longer compile in Lyx either, once reimported, although no changes have been made to the source.
So there seem to be some irregularities that develop when exporting and reimporting between *.lyx and *.tex files. I've also had similar issues with export/import to and from plain text.
These problems arise because, on many occasions, I would like to be able to edit the source code from directly within Lyx, for example, to delete unwanted text formats, or to try out code snippets from forums like this one. But the source-code window in Lyx is read only.
Any suggestions? Thanks to all.
EFR
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
-
- Site Moderator
- Posts: 542
- Joined: Sat Sep 01, 2012 6:38 am
Document exported from Lyx will not reimport
If these are legitimate bugs and not just personal preferences, then you should post bug reports here to fix the problem at its source:efroselli wrote: Often, there are bugs in the Lyx output that I would like to try and correct in the source-code directly. For example, recently, there was a lot of bolded text (\textbf{}) throughout the document that I wanted to remove globally.
http://www.lyx.org/trac
Yes, it's very difficult to import .tex. This is because LyX has it's own representation so it has to parse LaTeX which is a very tricky process. If you would like, you can post individual enhancement requests here:efroselli wrote: But when I tried to return it to Lyx using File > Import > LaTeX (plain), I got an error and the file would not open.
Similarly, on other occasions, I have exported to TeXWorks a file that compiles perfectly to PDF within Lyx, only to find that it won't compile to PDF in TeXworks, and will no longer compile in Lyx either, once reimported, although no changes have been made to the source.
So there seem to be some irregularities that develop when exporting and reimporting between *.lyx and *.tex files. I've also had similar issues with export/import to and from plain text.
http://www.lyx.org/trac
Specify tex2lyx as the component.
I understand that it seems strange that LyX can't import a file that it exported, there are good technical reasons why this can be extremely difficult.
tex2lyx has had some improvements recently. If you are using Ubuntu you can easily try these improvements by using the LyX PPA:
http://wiki.lyx.org/LyX/LyXOnUbuntu#toc3
This is a common request but there are no plans to implement editing of the source directly. This is because really that's not the source; the source is in C++ objects and what you are seeing there is a preview of the *export*. Because LyX has difficulties reimporting .tex, as you've noticed, this would be very unstable.efroselli wrote: These problems arise because, on many occasions, I would like to be able to edit the source code from directly within Lyx, for example, to delete unwanted text formats, or to try out code snippets from forums like this one. But the source-code window in Lyx is read only.
Scott
Re: Document exported from Lyx will not reimport
-
- Site Moderator
- Posts: 542
- Joined: Sat Sep 01, 2012 6:38 am
Document exported from Lyx will not reimport
Many have had success by editing the .lyx file manually, which is just a text file. Of course you should be careful here and make backups.efroselli wrote:Thank you very much for your answer; now I know it's not just me. I'll find a different way around the problem.