LaTeX forum ⇒ Graphics, Figures & Tables.pdf/.pdf_t resize problem with font size

Information and discussion about graphics, figures & tables in LaTeX documents.
silentboom
Posts: 11
Joined: Thu Sep 03, 2009 11:02 am

.pdf/.pdf_t resize problem with font size

Postby silentboom » Thu Sep 03, 2009 11:10 am

Hello everybody.

I have created some combined .pdf/.pdf_t graphics and then included them into my document.
Now it is necessary to resize those figures.

I know that one can do this with \resizebox, which also works fine.

But how can I achive that unless I resize the figure, the font size remains the same, as in the document?

Thanks for your help!

Tags:

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

Postby php1ic » Thu Sep 03, 2009 12:40 pm

Have you marked/flagged all of the text so it isn't included in the .pdf? \resizebox should then take care of font size and placement.

I output pstex/pstex_t from xfig, but assume the method used is the same. The idea of the combined output is that one file contains the lines and drawings and the other is a latex file that includes the 'line and drawing' file then places the text on top.

To check, open the .pdf file of the figure. There should be no text.

silentboom
Posts: 11
Joined: Thu Sep 03, 2009 11:02 am

Postby silentboom » Thu Sep 03, 2009 1:35 pm

I have just checked the pdf-file, and there is no text included in it.
In the document itself I used the following code to include it:
  1. \begin{figure}[h]
  2. \resizebox{\textwidth}{!}{\input{foo.pdf_t}
  3. }
  4. \end{figure}


The file foo.pdf_t looks like this (which is a simple example, with the text $P_10$ only):

  1. \begin{picture}(0,0)%
  2. \includegraphics{foo.pdf}%
  3. \end{picture}%
  4. \setlength{\unitlength}{4144sp}%
  5. %
  6. \begingroup\makeatletter\ifx\SetFigFontNFSS\undefined%
  7. \gdef\SetFigFontNFSS#1#2#3#4#5{%
  8. \reset@font\fontsize{#1}{#2pt}%
  9. \fontfamily{#3}\fontseries{#4}\fontshape{#5}%
  10. \selectfont}%
  11. \fi\endgroup%
  12. \begin{picture}(3413,2812)(2142,-4175)
  13. \put(2521,-1546){\makebox(0,0)[lb]{\smash{{\SetFigFontNFSS{12}{14.4}{\familydefault}{\mddefault}{\updefault}{\color[rgb]{0,0,0}$P_1$}%
  14. }}}}
  15. \end{picture}%


In xfig I have set the fonttype to latex default.
Maybee I have to set the fontsize to default size too, but I couldn't find an option in xfig to do that.
I guess the problem is that I surround the entire foo.pdf_t with the \resizebox.
Any hint to do it better?
(To be honest, I am not a LATEX-Pro.)

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

Postby php1ic » Thu Sep 03, 2009 7:59 pm

I include my figures the same way and your pdf_t file has the same things as mine. I assume as you create two files that you have given the text the special flag?

What actually happens to the text when you use the \resizebox?
Do you compile with pdftex or latex?

silentboom
Posts: 11
Joined: Thu Sep 03, 2009 11:02 am

Postby silentboom » Fri Sep 04, 2009 3:39 am

I compiled it with pdfLatex. Assuming that I enlarge the figure, the text will be enlarged too.
I did set the special flag for the text.

In the image I have displayed the results I get when scaling it to 0.3\textwidth or 0.7\textwidth.
tt.jpg
tt.jpg (13.03 KiB) Viewed 5194 times


Thanks for your help.

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Postby phi » Fri Sep 04, 2009 9:55 am

Don't scale these figures with \resizebox, but create them with the desired size in the first place instead.

silentboom
Posts: 11
Joined: Thu Sep 03, 2009 11:02 am

Postby silentboom » Fri Sep 04, 2009 11:17 am

I have considered this as well. But often one doesn't know what size they will have when creating the figures. And to be honest: I thought that this is an advantage of using .pdf/pdf_t figures.

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Postby phi » Fri Sep 04, 2009 12:01 pm

The advantage is that you get no quality loss and smaller files when using vector graphics, but still they are treated like a unit by \resizebox and the fonts cannot be scaled independently, no matter what the actual graphics format is. You'd get similar results when applying \resizebox to simple LaTeX text.
Apart from the text scaling problem, the line widths will probably get scaled, too. So I see no alternative than creating all graphics with the final dimensions. In fact, most graphics packages should allow to specify a custom coordinate system that doesn't depend on the physical dimensions of the image.

ekenny
Posts: 1
Joined: Tue Sep 15, 2015 3:12 pm

Postby ekenny » Tue Sep 15, 2015 3:27 pm

I've collected all objects together in xfig using COMPOUND object, then resized to less than 8cm width for 2 column papers and it worked perfectly for some images but doesn't work for others. I'm using evince to view the PDFs under Linux. It turns out that it seemed to cache some of the locations somehow and the images were not generated correctly. After some time the caching disappeared and the images are now the correct sizes. Now I get perfectly sized images. It also affects the appearance of the first page when using IEEEtrans document class. When you have all images corrected the first page viewing problem goes away.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 5 guests