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.

I am using the following LaTeX code to get a TikZ picture that includes a PDF and then draws two nodes:

\begin{figure}
    \begin{tikzpicture}
      \node (label) at (0,0)[draw=black]{
        \includegraphics[width=\textwidth]{my.pdf}
      };
      \node [draw=red] (A) at (0,0) {1};
      \node [draw=red] (B) at (2,0) {2};
    \end{tikzpicture}
    \caption{Simplest picture.}
\end{figure}

The result looks like this:

+---------------+
|               |
|      1 2      |
|               |
+---------------+
    Figure 1

So, the included PDF is centered, and coordinate (0,0), where "1" is drawn, is now in the center of the picture, instead of on the bottom left of the TikZ picture as usual. How can I change it so that (0,0) is still at the bottom left?

It should look like this:

+---------------+
|               |
|               |
|1 2            |
+---------------+
    Figure 1

I don't want to have to use negative x coordinates to place my points on the picture.

UPDATE: Here is a screenshot of what it actually looks like. As you can see, the two red boxes are centered and not at the lower-left. (The chain with the arrows is the PDF.) enter image description here

If I replace the \includegraphics just with an "X" I get the following picture, where the "X" and the "1" are drawn on top of each other (since they are both at coordinate (0,0)).

enter image description here

share|improve this question
    
I don't see the behavior your describe. In fact, 1 and 2 show up in the lower-left as expected. Maybe it has to do with the size of the PDF? What if you just put the text 'X' in your "label" node? –  Justin Bailey Jun 16 '11 at 19:40
1  
I added a screenshot that shows the result I'm getting with my PDF. –  Frank Jun 16 '11 at 20:14
    
What happens when you replace \includegraphics[width=\textwidth]{my.pdf} with X (i.e., get the PDF out of the picture). –  Justin Bailey Jun 16 '11 at 20:23
2  
Then everything is as expected, see the 2nd screenshot I just added. –  Frank Jun 16 '11 at 20:28

1 Answer 1

up vote 8 down vote accepted

Okay, I figured it out. I had to add anchor=south west to the node that includes the picture:

\node [draw=black, anchor=south west] (label) at (0,0) {\includegraphics{my.pdf}};

It looks like this: enter image description here

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.