Graphics, Figures & TablesChanging font size within graphic (eps) possible?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
drgz
Posts: 44
Joined: Sat Apr 18, 2009 8:40 pm

Changing font size within graphic (eps) possible?

Post by drgz »

Hello,

I was just wondering if it is possible to use a different font size for the text labels in the graphics than in the rest of the document?

In example; I have made several plots from my work in Gnuplot, exporting the figures as epslatex (meaning that i get the drawing itself in an *.eps file, while all the text labels are saved in an separate *.tex file, placed on the correct places in the figure).

However, I would like to include these figures and use a fontsize of 10pt instead of 12pt, which I use in the rest of my thesis. I know this can be done the hard way; compiling dvi of each figure with text size 10pt, converting the dvi to ps/eps/pdf with the text included, and then include it again in the thesis. As mentioend this is a lot of work, so hopefully it is possible to include the original eps files directly in my thesis, but tell the LaTeX compiler that the figures should be included with a different font size.

Example

Code: Select all

*preamble
font size = 12pt
*document begins
blablabla
want to include figure, but with font size of 10 instead of 12 as in the rest of the document
blablabla
*document ends
To include the epslatex figures I just use the graphics environment;

Code: Select all

\begin{figure}
\centering
\input{figurename.tex}
\caption{blabla.}
\label{blabla}
\end{figure}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Changing font size within graphic (eps) possible?

Post by php1ic »

I was going to suggest selecting a smaller font when you change the terminal in gnuplot, but I've just tested that and it doesn't seem to effect anything. I'm using an old version (4.0 patchlevel 0) so it may work in newer versions, but I think the point of the epslatex terminal is that the writing is done by latex so the fonts are consistent throughout the entire document.

Anyway, you can use the \fontsize{}{} command to change the font in the figure. The first argument is the size and I think the second is how much space is given for a single character. I don't really understand the second argument but the example below works for me.

Code: Select all

\begin{figure}
\fontsize{10}{12}\selectfont   %set to 10pt
\centering
\input{./file.tex}
\caption{10 point example}
\normalsize                    %return tp previous font size
\end{figure}
drgz
Posts: 44
Joined: Sat Apr 18, 2009 8:40 pm

Changing font size within graphic (eps) possible?

Post by drgz »

php1ic wrote:I was going to suggest selecting a smaller font when you change the terminal in gnuplot, but I've just tested that and it doesn't seem to effect anything. I'm using an old version (4.0 patchlevel 0) so it may work in newer versions, but I think the point of the epslatex terminal is that the writing is done by latex so the fonts are consistent throughout the entire document.
I tried that too with no luck. I might be strange, but I just thought that some of my plots looked better with a smaller font than the rest of the text (also with respect to the key box size in the plots. When I use 12pt font in the entire document, the letters kinda "crash" into the line wrapping the box. Of course I could increase the height of the key box, but then i feel it takes too much space in the plot, so that's the main reason for the 10pt font desire).
php1ic wrote: Anyway, you can use the \fontsize{}{} command to change the font in the figure. The first argument is the size and I think the second is how much space is given for a single character. I don't really understand the second argument but the example below works for me.

Code: Select all

\begin{figure}
\fontsize{10}{12}\selectfont   %set to 10pt
\centering
\input{./file.tex}
\caption{10 point example}
\normalsize                    %return tp previous font size
\end{figure}
Thanks! That's exactly what I needed. Save me a lot of time converting from one format to another, etc. And for some reason I like to think that all the converting reduces the quality, even though I know it doesn't with the correct configuration. :)

But again, thanks for the help! 8-)
Post Reply