Uniform Font Formatting for Included Graphics as in the Rest of the Text

This question is not about vector or raster imagery, but about the application of uniform font in the entire file including axis labels of graphics! Has anyone experience with types of graphics files which do that?




I search for one which to which LaTeX can apply correct font formatting (e.g. for legends, axis, ...) at including it in the LaTeX document? Then I do not have to convert my MATLAB plots etc. to tikz at first.

  • 3
    Welcome to TeX.sx! – Xavier Feb 17 '13 at 23:49
  • Please edit your question: As it is it's hard to understand what you want exactly. Please take a look at the How to Ask-page and try to improve your question according to the guidance found there. This may require you to show some effort on your part in terms of attempting a solution. If you have questions about what to do or if you don't quite understand what this means, please ask for clarification using the add comment function. – Martin Schröder Feb 17 '13 at 23:49
  • As Martin wrote, please try te be more specific regarding what you want/need. Also, if you're only concern with matlab2tikz is speed, I would be very surprised it is really that a showstopper unless you are creating a document with 1000+ figures that needs recompilation every 10 seconds... – Xavier Feb 17 '13 at 23:52
  • 1
    Nothing specific, just welcoming you to TeX.sx. I would only encourage you to make your question more specific, as this is truly a Q&A site, not a discussion forum. The broader / less specific your question, the harder it is for others to answer and help you. – Xavier Feb 18 '13 at 5:10
  • 2
    Specifically for Postscript images (not rasterized or PDF), you can use psfrag to provide uniform fonts with the document and image. – Werner Jul 10 '13 at 18:51

Specifically for (encapsulated) Postscript images you can use psfrag to substitute "tags" within the image with your own LaTeX constructions (equations, picture environments, etc.). The advantage with such an approach is that you can even scale the included graphics and psfrag will still be able to keep a consistent font size. As an example, see Consistent font size in EPS image that are scaled? The requirement in such a use case would be to specify a LaTeX equivalent construction for each tag in your image (for each image).

There exists no equivalent "pdffrag", unfortunately, since PDFs could be considered a pre-compiled (and therefore also usually smaller/faster) version of Postscript. See Why is there no pdffrag package?

Rasterized image formats like PNG and JPG are stripped of any knowledge of text elements - all components are considered graphics, in a pixelated and non-scalable form.

  • For oblivious people like me, the usage of the psfrag package only makes sense if you use the latex compiler and not pdflatex. See en.wikibooks.org/wiki/LaTeX/… for further details. – strpeter Jul 17 '13 at 8:54

Seems you are asking for a graph package, which uses LaTeX' fonts for labels, If so, check out asymptote. It has a nice package for graphs (and you can create almost any figure with it). Can write PDF directly, and that works very well with pdflatex.

  • That is okay that there are nice packages for producing graphs. But I want to know which graphics file type support reading in text such that LaTeX formats this text for me to the correct shape. – strpeter Feb 18 '13 at 14:19
  • 3
    @strpeter: None. LaTeX does not modify the graphics before including them. So it is up to you to generate the graphics with the right fonts. – Aditya Jul 10 '13 at 20:54

As far as the font shape is concerned an option would be to provide access to the type1 and/or otf fonts to your graphing program.

On Windows, I did this for more than 10 years, by installing the fonts in the regular Fonts directory.

I used this mostly for the Mayura Draw drawing program, in order to customize gnuplot plots, requiring to slightly edit its config files, and to provide ghostview and/or eps2pdf with the path to type1 fonts files.

This works for Inkscape two, and I guess for Matlab, by using the otf version of the latin modern fonts (that I use for text).

But this does not solve the size problem: a psfrag is provided in this post.

As I definitely use pdflatex, I switched to tikz for a few months.

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.