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.)
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)
).
Best Answer
Okay, I figured it out. I had to add
anchor=south west
to the node that includes the picture:It looks like this: