Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I use auto-pst-pdf to convert an EPS (using \includegraphics) inside a TikZ picture, I get a picture with zero size (as near as I can tell) and no picture at all of I try to draw a bounding box around it.

How can I determine the dimensions of my converted EPS files? If I try to draw the bounding box, the resulting imported PDF seems not to be included at all.

\documentclass{article}

\usepackage{auto-pst-pdf}
\usepackage{psfrag}
\usepackage{tikz}

\begin{document}

Some text.\bigskip{}\bigskip{}\bigskip{}

\begin{tikzpicture}
\draw[opacity=0](0,0)rectangle(1,1); % This ends up being the full extent of the figure
% The following makes the figure vanish altogether if used without the above line
\draw[green,dotted] (current bounding box.south west) rectangle (current bounding box.north east);
\psfrag{Z}{$G^\beta\leq\Sigma_\zeta$}
\includegraphics{GraphA} % GraphA is an EPS file being processed by `auto-pst-pdf`
%\psfragfig{GraphA}; % Has same effect when above is replaced with this
\end{tikzpicture} 

\end{document}

produces

enter image description here

share|improve this question
    
As far as I can tell from the documentation, the \psfragfig command is needed. –  egreg Jun 10 '12 at 18:53
    
Try top put \includegraphics inside of a node... –  Paul Gaborit Jun 10 '12 at 20:41
    
@egreg: Switching to \psfragfig has the same result. –  raxacoricofallapatorius Jun 10 '12 at 22:32
    
@PolGab: That works. Is there any drawback to doing that? –  raxacoricofallapatorius Jun 10 '12 at 22:34
    
@raxacoricofallapatorius Please, show the code. –  egreg Jun 10 '12 at 22:51

2 Answers 2

up vote 2 down vote accepted

The only way to correctly include an external graphic into a tikzpicture is to use \includegraphics into a node.

\begin{tikzpicture}
  \node{\includegraphics{external-graphic-file}};
\end{tikzpicture}
share|improve this answer
    
Thanks. Sorry for the confusion. I ended up confusing your comments with those about using the suggestion to use psfragfig instead. –  raxacoricofallapatorius Jun 10 '12 at 23:28
1  
Technically, \includegraphics is not the only way to correctly include an external graphic into a tikzpicture, PGF has its own image inclusion mechanism (\pgfdeclareimage). However, from the manual: "To be quite frank, LATEX's \includegraphics is designed better than pgf's image mechanism. For this reason, I recommend that you use the standard image inclusion mechanism of your format. Thus, LATEX users are encouraged to use \includegraphics to include images." –  Jake Jun 11 '12 at 6:00

With testfig.eps from the documentation of psfrag, this works on my machine.

\documentclass{article}

\usepackage{auto-pst-pdf}
\usepackage{psfrag}
\usepackage{tikz}

\begin{document}

Some text.\bigskip{}\bigskip{}\bigskip{}

\psfragfig{testfig}[\psfrag{gA}{$G^\beta\leq\Sigma_\zeta$}]

\end{document}

Of course, the problem of where to put a graphic file in a tikzpicture is completely different.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.