[Tex/LaTex] Including Xfig figures with LaTeX formulas into Lyx documents

floatslyxxfig

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!

Best Answer

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).

Related Question