# Consistent font size in EPS image that are scaled?

Assume that at creation time (of an EPS image) the final 'size' of the image is not known. However, this one EPS is used multiple times in different sizes within different documents. But the font size of text (e.g., axes labels) should be consistent.

Example: In one .tex use

\includegraphics[width=0.5\textwidth]{my_plotted_function.eps}


and in another use

\includegraphics[width=0.3\textwidth]{my_plotted_function.eps}


but ensure, that the axes labels are shown with 12pt in both figures.

Is there another way/vector graphics format to reach this functionality? (pstricks, tikz is not a solution, since it's not a supported export format.)

-

## migrated from stackoverflow.comFeb 7 '12 at 17:20

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Feb 7 '12 at 17:23

psfrag allows for this by default since it inserts the <replacement> of <tag> at compile-time:

\psfrag{<tag>}{<replacement>}


So you have to create the document with appropriate tags that can be replaced within your document. Here is a minimal example, taken from the auto-pst-pdf package on CTAN. The example image is example.eps:

\documentclass{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{psfrag}% http://ctan.org/pkg/psfrag
\begin{document}

% psfrag setup
\psfrag{[Mp]}{$M_p$}%
\psfrag{[hb]}{$\mathbf h$}%
\psfrag{[epb]}{$\mathbf{e}_p(n)$}%
\psfrag{[evh]}{$\hat{e}_v(n)$}%
\psfrag{[epsv]}{$\varepsilon_v(n)$}%
\psfrag{[ev]}{$e_v(n)$}%

Original image: \par
\includegraphics{example} \par\bigskip\bigskip%

Scaled 50\%: \par
\includegraphics[scale=.5]{example} \par\bigskip\bigskip

Scaled 150\%: \par
\includegraphics[scale=1.5]{example}
\end{document}​


It is obvious that the <replacement> text maintains a consistent font size, based on the document default. You may have to adjust the placement of the <replacement> based on the image size.

-

psfrag might be your friend if the text in the eps is not too obscured by whatever wrote the EPS, it should allow you to replace the text in the EPS file by LaTeX-typeset text over the top, which of course can be any size you wish.

-