TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to include in a Lyx document an Xfig figure with some LaTeX formulas. Following this guide I can do this in ordinary .tex documents: I export my Xfig figure as a "Combined PDF/LaTeX (both parts)" file and I simply include it in the .tex document with the \input{file_name.pdf_t} command. So far so good! Anyway, when I try to do this same thing in my Lyx document (both writing explicitly the \input{ } command and through the Insert->File->Child_Document menu) I get the following error:

\includegraphics {file_name.pdf}% The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

So, does someone now how to fix this? How can I include my figures with latex equations into Lyx?

Thank you all in advance!

share|improve this question
i'm not a lyx user, but it's not "permitted" to \input a pdf file directly into a latex document. the \includegraphics command as cited in the error message is the proper method. – barbara beeton Feb 27 '14 at 13:55
Hi! Well, in fact, the argument of \input, file_name.pdf_t, is not a .pdf but an ordinary text file. To be more precise, file_name.pdf_t is a .tex file of the form \begin{figures} ... \includegraphics{file_name.pdf} ... \end{figures}, which tells latex to take the (real) .pdf file, file_name.pdf (without equations), and display on it some latex equations..! – AstoundingJB Feb 27 '14 at 14:08
up vote 3 down vote accepted

A better idea is to use LyX's native integration with Xfig. This is better because if you modify your Xfig you do not have to remember to export again. I've seen many problems (e.g. "I forgot to reexport") occur from such copy/paste issues. This has the further advantage that LyX will show your figure.

Go to Insert > File > External Material:

enter image description here

And then select Xfig:

enter image description here

See the help documents for more information. Even if LyX didn't have built-in support for Xfig, I would have recommended that you add it manually (you can define your own external templates).

share|improve this answer
Great idea!! I appreciate very much your suggestion, @scottkosty! This actually solved all of my troubles! I'm a newbie to Lyx and I didn't know this features! Thank you very much! +1 and accepted! :D – AstoundingJB Feb 27 '14 at 16:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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