\centering
\begin{tikzpicture}
\node (image)
{\includegraphics[width=.9\textwidth]{imag/pic1.png}
};
\node
[
fill=teal,
align=r north west,
text=white,
font={}
] at (pic1.r north west) {Sum is here};
\end{tikzpicture}
\end{frame}
我正在将文本(Sum is here)移动到图像的左侧。我尝试过右西,左北。但文本没有移动。我该怎么做?
答案1
以下是一种方法:
- 请注意所有节点位置均参考其中心
- 第一:双锚
- 第 2 + 第 3:在极坐标中指定锚点
\documentclass[10pt,border=3mm,tikz]{standalone}
\usepackage{graphicx}
\begin{document}
\begin{tikzpicture}
\node (A) at (0,0) {\includegraphics{example-image-a}};
\node[anchor=east,draw=blue!30] at (A.north west) {Sum is here};
\node[anchor=east,draw=blue!30] at (A.160) {Sum is here};
\node[anchor=east,draw=blue!30] at (A.180) {Sum is here};
\end{tikzpicture}
\end{document}