LyXCannot display EPS files inside Lyx

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
kazis
Posts: 1
Joined: Wed Apr 01, 2015 11:38 pm

Cannot display EPS files inside Lyx

Post by kazis »

Hello everyone,

I trying to include matlab figures (.eps files) into my lyx document. However, I get the errors such as file cannot be converted to loadable format, or error loading file into memory. I know there is a lot of posts out there about this problem, but they haven't helped resolve the issue.

Things I have already tried:
1) added EPS>PNG in file handling (this allows me to see the figures in the generated PDF but not in Lyx)

2) downloaded ghostscript package for MacOS from the follwing site:
http://pages.uoregon.edu/koch/

then I reconfigured lyx, but no luck.

Please let me know your suggestions. Also, please assume layman's knowledge when replying.

Thank you in advance!!

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

xiaoquanzz
Posts: 2
Joined: Mon Apr 18, 2016 4:20 pm

Cannot display EPS files inside Lyx

Post by xiaoquanzz »

Hallo Kazis,

Have you fixed this problem? I have the same problem today and I have figured out the solution which works for me now.

Here are the steps that I have done(for Mac OS X).

1. In Lyx preview, graphs are converted to PNG for display. Conversion from eps to png can be done by convert command provided by ImageMagick. First type covert /path/fig.eps /path/fig.png in terminal to check if convert command is working properly. If not, install ImageMagick first(http://cactuslab.com/imagemagick/).

2. Then add EPS to PNG converter in Lyx follow Lyx>Preferences>File Handling>Converters. Choose EPS->PDF and change the 'to format' from PDF to PNG. In the converter line, type "convert $$i $$o" and then press add and save.

3. Now you have to add the path where convert is located to Lyx. Mine is located at /opt/ImageMagick/bin. Go to Lyx>Preferences>Paths>Path prefix add :/opt/ImageMagick/bin to the end of the paths. Save the paths and exit Lyx.

4. Reload the file with eps graphs should display graphs in preview now.

That is what I have done. Hope works for you too if you have not fixed the problem yet.
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Cannot display EPS files inside Lyx

Post by scottkosty »

I've had one report from a Mac user who had this problem that it is fixed in LyX 2.2.0rc1, which can be downloaded here: ftp://ftp.lyx.org/pub/lyx/devel/lyx-2.2/2.2.0-latest
Post Reply