2

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!

2
  • 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. Feb 27, 2014 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..! Feb 27, 2014 at 14:08

1 Answer 1

3

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

1
  • 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 Feb 27, 2014 at 16:15

You must log in to answer this question.

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