0

I have a figure created by Xfig that is contained in the files figure.pstex and figure.pstex_t. It is my understanding that to include this figure in a latex document, one needs to run the chain DVI-PS-PDF, instead of pdflatex. However, using this chain makes the inclusion of .jpg files hard. (Parameters natwidth and natheight are needed, which involves a lot of guessing, and is time consuming.) Is there a way to avoid this conundrum?

  • Welcome to TeX SX! What are those files? How are the figures produced? – Bernard Oct 13 '17 at 22:40
1

If the original fig files are no longer available, the following should work:

ps2pdf -dEPSCrop fig1.pstex fig1.pdf
sed -i '/\.pstex/.pdf/' fig1.pstex_t

The first command above converts the PostScript file fig1.pstex to a pdf file, here fig1.pdf. The second command changes the relevant line in the LaTeX-file fig1.pstex_t to include the graphics file fig1.pdf instead of fig1.pstex.

  • Now one can run pdflatex, instead of latex + dvips, as for the original question. – tkl Jan 9 '18 at 13:57
  • The suggested method did not quite work. The file fig1.pdf contained only a part of the figure. More precisely, the figure should represent a number line, but the pdf file did not contain any numbers, just the line. – J.Petrovic Jan 14 '18 at 18:44
  • @J.Petrovic: The numbers should be contained in fig1.pstex_t. That is the point of these combined file forrmats (fig.pstex + fig.pstex_t, fig.pdf_t + fig.pdf, fig_pspdftex.eps + fig_pspdftex.pdf + fig.pspdftex), that the text is set by LaTeX and the remaining graphics is contained in the pdf or eps file. – tkl Jan 17 '18 at 14:45
  • @tkl I suppose that my ignorance shows here. I have used the following code: \begin{figure} \centering \scalebox{0.75}{ \input{fig1.pstex_t}} \end{figure} When I do that I obtain only numbers. If I replace fig1.pstex_t by fig1.pdf I get only the line. How can I input both files? – J.Petrovic Jan 18 '18 at 19:21
  • @J.Petrovic Hm, please open the file fig1.pstex_t with a text editor and have a look inside. It contains all the text from the graphics (hence, full TeX-power for the text, and the same font in the main document and the graphics) and usually an \includegraphics command to include the pure graphics contained in the companion graphics file, here originally fig1.pstex. The answer is edited, so the issue should be clearer now. – tkl Jan 18 '18 at 22:12
0

Instead of XFig, you can use Inkscape or The Ipe extensible drawing editor. Have a look at this question (and the anwers)

Is there any way to type LaTeX code directly into the text boxes Inkscape?

And then you can use pdfLaTeX afterward.

  • Someone else has made the figure by Xfig. (And there are dozens of such that I want to include.) Is there perhaps a way to convert the pair figure.pstex and figure.pstex_t into something that pdflatex could process? – J.Petrovic Oct 14 '17 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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