0

In LyX 2.1 I added some graphics (jpeg) to my paper by using a floating figure.

In the LaTeX source code, this is:

\begin{figure}[H]
\includegraphics[scale=0.6]{\string"blank billard 7\string".eps}\caption{A Billiard table $B_{\alpha}$ with a barrier of length $\alpha$.}
\end{figure}  

but it gives this error:

! LaTeX Error: Unknown graphics extension: .eps.



l.191 ...0.6]{\string"blank billard 7\string".eps}
                                                  \caption{A Billiard table ...

I am not sure where the .eps is coming from since I added the graphic in the form of a jpeg. 

How can I fix this?

Update:

%% LyX 2.1.4 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,reqno]{amsart}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{float}
\usepackage{amsthm}
\usepackage{graphicx}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{figure}{section}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.

\makeatletter
\renewcommand{\section}{%
\@startsection{section}
{1}
\z@
{1\baselineskip plus \baselineskip}
{-1em}
{\normalfont\bfseries}% \scshape
}
\makeatother

\makeatletter
\usepackage{etoolbox}
\patchcmd{\@maketitle}% <cmd>
  {\ifx\@empty\@dedicatory}% <search>
  {\smallskip
    \begin{center}
    \footnotesize% Size of the address content
    \begin{tabular}{c}
      University of   \\
      Department of  \\
      440  \\
     USA
    \end{tabular}
  \end{center}
  \ifx\@empty\@dedicatory}% <replace>
  {}{}% <success><failure>
\makeatother

\raggedbottom

\allowdisplaybreaks

\makeatother

\usepackage{babel}
\begin{document}
.
\begin{figure}[H]
\includegraphics[scale=0.6]{\string"blank billard 7\string".eps}\caption{A Billiard table $B_{\alpha}$ with a barrier of length $\alpha$.}
\end{figure}



\end{document}
0

1 Answer 1

5

Not really an answer why it does not work for you, but much to long for a comment …

Try the following:

  • Use a file manager to create a new folder on you file system, e.g., with the new name lyxtest.
  • Copy file example-image.jpg to that new folder or directory.
  • Start LyX.
  • Select FileNew (or press Ctrl-N)
  • Select FileSave as to save the new file as lyxtest.lyx in the folder generated in the first step.
  • Use InsertGraphics, select the file example-image.jpg and press OK.
  • Select FileSave
  • In LyX you should see something like:

LyX Windows

If you now open lyxtest.lyx in a standard text editor it should look similar to (note, this has been made using LyX 2.2.1 not LyX 2.1.1):

#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
\begin_inset Graphics
        filename example-image.jpg

\end_inset


\end_layout

\end_body
\end_document
  • Select DocumentView [PDF (pdflatex)]

You should get something like:

enter image description here

If this was successful, inserting of JPEG does work. Let's start again with insertion of an EPS:

  • Create a new folder on you file system, e.g., with the new name lyxtesteps.
  • Copy file example-image.eps to the new folder.
  • Start LyX.
  • Select FileNew (or press Ctrl-N)
  • Select FileSave as to save the new file as lyxtesteps.lyx in the folder lyxtesteps generated in the first step.
  • Use InsertGraphics, select the file example-image.eps and press OK.
  • Select FileSave

If you now compare lyxtest.lyx and lyxtesteps.lyx you will find, that it differs only in line:

   filename example-image.jpg

vs.

   filename example-image.eps
  • Select DocumentView [PDF (pdflatex)].

You will see the same result as above. But if you have a look at the temporary directory used by LyX (you can find the location of the directory in ToolsPreferences…Paths, open it with a file manager and look for a folder with lyx in its name) you will find there not only *example-image.eps but also *example-image.pdf. And the lyxtesteps.tex in the temporary directory will look like:

\batchmode
\makeatletter
\def\input@path{{/home/schweinebacke/lyxtesteps/}}
\makeatother
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{graphicx}
\usepackage{babel}
\begin{document}
\includegraphics{1_home_schweinebacke_lyxtesteps_example-image.pdf}
\end{document}

So indeed LyX has converted the eps file into a pdf file.

Do one last step:

  • Select FileExportLaTeX (pdflatex)

This would create the file lyxtesteps.tex in the directory lyxtesteps of the first step in this session. It should look like:

%% LyX 2.2.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{graphicx}
\usepackage{babel}
\begin{document}
\includegraphics{example-image}
\end{document}

And you will find also the new file example-image.pdf in the same directory. Now you can run pdflatex for lyxtesteps.tex and would also get the result:

enter image description here

Note: If you use a new LyX you can even copy the LyX file shown above into a text editor (e.g. vi, kate, texmaker), save it as lyxtest.lyx and open this file with LyX. But I do not know whether or not LyX 2.1.1 can open a file from LyX 2.2.1. Nevertheless, you can do the steps with your LyX and add the result into your question if it is not successful. You even can export a TeX file, see if this also creates a PDF from an imported EPS and show use the TeX file in your question.

3
  • I want to try this. How do I do the first 2 steps? "Make a new directory on you file system, e.g., lyxtest. Copy file example-image.jpg to that new directory." May 18, 2017 at 16:33
  • @TheSubstitute "Make a new directory" means "create a new folder". How to do it depends on the operating system you have. For example, for Windows 10 see here: dummies.com/computers/operating-systems/windows-10/….
    – CarLaTeX
    May 19, 2017 at 4:03
  • 4
    @TheSubstitute If you don't know how to make a directory/folder and if you don't know how to copy files from the internet to a specific location on your computer or how to rename a file, please ask someone to show you such basics on your computer or read an introduction in the operation system you try to use. May 19, 2017 at 5:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .