改变 x,y 值时节点位置不变

改变 x,y 值时节点位置不变

我正在使用带有 tikz 的文本块。

如果我改变(xcm,ycm)处 \node(点)的 x,y 值,图像位置不会改变吗?

例如:(x=12,y = 13)或(x = 2,y = 5)显示图像的相同位置

预先感谢。

我的最低限度的编码:

\documentclass{article}
\usepackage[absolute,overlay]{textpos}
\usepackage{xcolor}
\usepackage{tikz} 
\usetikzlibrary{positioning}
\begin{document}

\begin{textblock*}{5cm}(2cm,5.0cm)
\begin{center}
\tikz% image and letters are inserted in nodes
{
\node (Point) at (12cm,13cm) [font=\large, text=black] {\includegraphics[height=2.5cm]{example-image-duck}};
\node [font=\sffamily\small,below=35mm of Point.north] {\includegraphics[height=0.5cm]{example-image-a}};
}
\end{center}
\end{textblock*}

\end{document}

请帮忙

答案1

在此处输入图片描述

粗略看一下坐标系统是如何工作的 - x 和 y 会根据文本块而变化 - 无论节点如何,文本块都会移动到页面的所有 4 个角落 - 在最后一张 x=7,y=10 的图像中,示例图像 A 相对于鸭子移动 - 节点的坐标没有影响,因为它由文本块本身持有

\documentclass{article}
\usepackage[absolute,overlay]{textpos}
\usepackage{xcolor}
\usepackage{tikz} 
\usetikzlibrary{positioning}
\begin{document}

\begin{textblock*}{5cm}(2cm,5.0cm)
\begin{center}
\tikz% image and letters are inserted in nodes
{
\node (Point) at (12cm,13cm) [font=\large, text=black] {\includegraphics[height=2.5cm]{example-image-duck}};
\node [font=\sffamily\small,below=35mm of Point.north] {\includegraphics[height=0.5cm]{example-image-a}};
}
\end{center}x=2,y=5
\end{textblock*}
\begin{textblock*}{5cm}(12cm,5.0cm)
\begin{center}
\tikz% image and letters are inserted in nodes
{
\node (Point) at (12cm,13cm) [font=\large, text=black] {\includegraphics[height=2.5cm]{example-image-duck}};
\node [font=\sffamily\small,below=35mm of Point.north] {\includegraphics[height=0.5cm]{example-image-a}};
}
\end{center}x=12,y=5
\end{textblock*}
\begin{textblock*}{5cm}(12cm,15.0cm)
\begin{center}
\tikz% image and letters are inserted in nodes
{
\node (Point) at (12cm,13cm) [font=\large, text=black] {\includegraphics[height=2.5cm]{example-image-duck}};
\node [font=\sffamily\small,below=35mm of Point.north] {\includegraphics[height=0.5cm]{example-image-a}};
}
\end{center}x=12,y=15
\end{textblock*}
\begin{textblock*}{5cm}(2cm,15.0cm)
\begin{center}
\tikz% image and letters are inserted in nodes
{
\node (Point) at (12cm,13cm) [font=\large, text=black] {\includegraphics[height=2.5cm]{example-image-duck}};
\node [font=\sffamily\small,below=35mm of Point.north] {\includegraphics[height=0.5cm]{example-image-a}};
}
\end{center}x=2,y=15
\end{textblock*}
\begin{textblock*}{5cm}(7cm,10.0cm)
\begin{center}
\tikz% image and letters are inserted in nodes
{
\node (Point)  [font=\large, text=black] {\includegraphics[height=2.5cm]{example-image-duck}};
\node [font=\sffamily\small,below=12cm of Point.north] {\includegraphics[height=0.5cm]{example-image-a}};
}

\end{center}x=7,y=10 node point coord removed and example-image-a at 12cm below node point 
\end{textblock*}
\end{document}

相关内容