[Tex/LaTex] Replacing fonts in EPS/PDF files

fontsgraphics

I would like to have a vector graphic with the font I'm using for my captions in my PDF file.

I normally create my graphics in DIA and save them as .eps files. In my .tex file I use following

\usepackage{ifpdf}
\usepackage{graphicx, epstopdf}
\ifpdf
  \DeclareGraphicsExtensions{.pdf,.jpg,.png}
\else
  \DeclareGraphicsExtensions{.eps}
\fi

and

\includegraphics[width=\linewidth]{my_image.eps}

to include images (and auto generate PDF files).

I'm using Windows 7 (64-bit), miktex 2.9 and pdflatex

Best Answer

Normally, it won't be possible to have the font changed if you create your diagram outside of TeX (not an issue for inline-generated diagrams using TikZ, for example).

That being said, you have a few options, in no particular order:

  • Check whether the font you use have an OTF version that you can install at the OS-level (for example, Computer Modern has here). Then, just pick that when you create your figure, and you are good to go.

    Pros: Minimal change in your current workflow.

    Cons: If your favourite font does not have OS-compatible version, this doesn't help at all.

  • Recreate your diagrams inline, using a package such as TikZ or PStricks (they should be easily installed as part of your TeX distribution).

    Pros: Your diagrams will be rendered perfectly and you'll have all the flexibility you need typesetting the text in them. In the long term, learning a diagramming package like these will serve you well later on.

    Cons: The steeping curve learning can be quite steep, and for one-off diagrams it's not worth it.

  • Mixed approach: Create your diagrams in Inkscape, and export them as EPS+TeX, or PDF+TeX (see here for more information). Your diagram is created in the WYSIWYG interface (and Inkscape is pretty powerful vector graphics package), and on export a .tex file is created that you include in your document directly instead of doing \includegraphics on the EPS/PDF. The TeX file that is created bootstraps the inclusion of the graphics, and ensures that the text appears in the right place.

    Pros: Minimal disruption to your workflow, no dependence on what font you use in your document.

    Cons: As of this writing, the exporting procedure is somewhat of a hit-and-miss. Your diagram might not appear exactly in the way you want it. Be sure to perform some tests to see whether this works for you.