tikzpicture 节点位置位于页面左上角?

tikzpicture 节点位置位于页面左上角?

我想将徽标放置在顶部 1 厘米、左侧 1 厘米处。但是,如果我使用,(1, -1)则要考虑几何边距。使用(current page.north west),我没有偏移。

\documentclass[11pt]{article}
\usepackage[a4paper,left=3.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}

\begin{document}
\begin{tikzpicture}[remember picture, overlay, anchor=west]
    \node[anchor=north west, inner sep=0pt] (logo) at (current page.north west) {%
    \includegraphics[height=2cm]{logo.pdf} \\
    Foobar
    };
\end{tikzpicture}

我如何从绝对位置定位我的节点?

答案1

另一种可能性:使用\path ... node

\documentclass[11pt]{article}
\usepackage[a4paper,left=3.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[remember picture, overlay]
    \path (current page.north west) +(1,-1) node[anchor=north west, inner sep=0pt, align=center] (logo) {% \includegraphics[height=2cm]{example-image} \\
    Foobar
    };
\end{tikzpicture}
\end{document}

答案2

将应用于shift参数at

\documentclass[11pt]{article}
\usepackage[a4paper,left=3.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[remember picture, overlay, anchor=west]
    \node[anchor=north west, inner sep=0pt, align=center] (logo) at ([shift={(1cm,-1cm)}]current page.north west) {%
    \includegraphics[height=2cm]{example-image} \\
    Foobar
    };
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容