some obstacles to incorporating xfig into LaTeX and TeX into xfig

1,211

Most users will find default Xfig fonts rather limited. The problem can be easily alleviated using psfrag package. From your description I get a sense that you are not very familiar with Xfig as you have problem rescaling existing fonts. Egreg comment about TikZ was rather misplaced. Xfig is a vector graphics editor while TikZ is languages for producing vector graphics. Over 20 years of using TeX I have found that there are situations in which use of language for producing graphics is preferable to use of vector graphics editors and vise versa. I have been using both myself. I use PSTricks language but also Xfig (also matplotlib and even MATLAB languages). Xfig is an old Unix program but it runs fine on Windows and MAC (Unix with a lots of make up). If you are familiar with Xfig my recommendation would be to stick with it as a vector graphics editor. If you are novice user you might benefit from little research and newer often more capable vector graphics editors.

I am at work right now so I will post MWE latter today.

Share:
1,211

Related videos on Youtube

Michael Hardy
Author by

Michael Hardy

Updated on July 26, 2020

Comments

  • Michael Hardy
    Michael Hardy over 3 years

    On a Linux machine, I wanted to incorporate a drawing created in xfig into a LaTeX document. But xfig wasn't allowing me to use any fonts except one microscopic one. Then I found this page (from which I quote below) saying TeX could be incorporated into and xfig document. I thought that might suffice, since I didn't want to use any text except mathematical notation, which isn't done well in xfig's usual fonts anyway. But then I found I could not adjust the size: it's still in that one beensy font. Other than that it looked very good.

    I can also run TeXworks on a Windows machine. I found a web page saying it's possible to get xfig for Windows. Is that easy enough that I should consider that alternative? (I heard the manner of incorporating graphics into a LaTeX document is different in that situation, e.g. one must use pdf instead of eps or something like that.)

    Appendix: quote from the cited web pave:

    This document is shamelessly copy-pasted from http://web.math.auc.dk/~dethlef/Links/latex_figures.html......

    Inside xfig, add the LaTeX expressions to the figure, using $...$ to switch to math-mode where necessary. Use the normal method in xfig for adding text, but set the "special text" mode using the "Text flags" menu at the bottom of the screen.

    Export the figure from xfig twice: firstly using the format "Combined PS/LaTeX (PS part)" to a file such as fig1.pstex, secondly using "Combined PS/LaTeX (LaTeX part)" to a file such as fig1.pstex_t.

    Create a driver file (e.g., fig1.tex) containing something like:

    \documentclass{article}
    \usepackage{epsfig}
    \usepackage{color} (note: you might not might not need to do this)
    \setlength{\textwidth}{100cm}
    \setlength{\textheight}{100cm}
    \begin{document}
    \pagestyle{empty}
    \input{fig1.pstex_t}
    \end{document}
    

    Run the commands:

    latex fig1.tex
    dvips -E fig1.dvi -o fig1.eps
    

    You should now have a file named "fig1.eps" which can be included (with scaling and rotation if desired) in other LaTeX documents.

    • Werner
      Werner over 10 years
      So your main question here is whether you can run Xfig on a Windows system? If so, then yes, this is possible, via CygWin/X. Another option, if you don't go the PDF route, is to use psfrag which should be able to replace your "beensy font size" with something that matches the document style.
    • egreg
      egreg over 10 years
      Nowadays, much more powerful tools that Xfig are available; with TikZ you can do much, possibly better than with Xfig and no problem with fonts arises.
    • Predrag Punosevac
      Predrag Punosevac over 10 years
      @egreg With all due respect that is not a constructive comment. Xfig is a vector graphics editor while TikZ is languages for producing vector graphics (comparing apple to oranges). Xfig has no fonts problem. The Warner gave a right pointer (psfrag). Comparing Xfig to Inkscape or similar would have been fair. Whether learning the new tool to accomplish a task is justified is subject to debate and I tend to argue that most productive thing in most cases is sticking to familiar tools. For the record I have been using Xfig circa 1990 as well as PSTricks.
    • egreg
      egreg over 10 years
      @PredragPunosevac psfrag requires using DVI format and EPS; this means, for instance, that microtype won't fully work. One could use psfrag for creating an EPS to be converted to PDF, but the workflow would be clumsy. If I had to choose, probably I'd go with Inkscape, rather than Xfig (a good program, by the way, but not as powerful as its modern successors).
    • Predrag Punosevac
      Predrag Punosevac over 10 years
      @egreg Of course:) Both of us know that psfrag and Xfig predate microtype and if one is just starting to learn she/he would be ill advised to pick up Xfig. However for those of us who has been using Xfig for a while learning new tool might not be the most productive thing to do.
  • Michael Hardy
    Michael Hardy over 10 years
    I've used xfig to created pictures involving lines and arcs and dots, etc., but I haven't used most of its features. On the system of unix machines on which I now have access to it, I used to be able to choose among many fonts and font sizes, but now that doesn't work. Something changed.
  • Predrag Punosevac
    Predrag Punosevac over 10 years
    @Michael Hardy Are you talking about Windows machines or in general? I just used Xfig on OpenBSD today (Unix arguably) and I can easily chose among dozen of fonts and rescale them. However for anything more serious psfrag is the right approach. I have a very basic familiarity with windows so I have not done much basic use of Xfig on Windows.
  • Michael Hardy
    Michael Hardy over 10 years
    I've used xfig only on Linux machines.
  • Werner
    Werner over 10 years
    @MichaelHardy: As mentioned, Xfig is available on Windows via Cygwin/X, if that is what you're after.
  • Michael Hardy
    Michael Hardy over 10 years
    I just tried using psfrag. I put \usepackage{psfrag} before \begin{document} and I have the files psfrag.sty and psfrag.pro in the same directory. I get an error message that \psfragscanon is an undefined control sequence. The figure also appears so big that it doesn't fit on the page and shows up two pages later, on a page by itself. Writing \unitlength=0.2in doesn't change that.