Tikz:相对于主体的位置,而不是页面的位置

Tikz:相对于主体的位置,而不是页面的位置

我想将一张图片放在信件正文的左上角(但我更感兴趣的是适用于任何类别的解决方案),以便在图像和纸张末端之间有一些边距。

知道怎样做吗?

谢谢!

梅威瑟:

在此处输入图片描述

\documentclass{letter}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{tikz}
\signature{Me}
\address{This is me\\ \\ I live somewhere \\ But you won't \\Find me}
% \fancypagestyle{empty}{\includegraphics[height=0.5in, keepaspectratio=true]{logo-lip6.png}}

\begin{document}
\begin{letter}{}
\opening{To Whom It May Concern: }
\tikz[remember picture,overlay] \node[inner sep=0pt, anchor=north west] at (current page.north west){\includegraphics[width=4cm, keepaspectratio=true]{example-image-a}};

Here is my letter. I'd like to put the image on the top-left part of the body, not of the page (I'm not sure how ``body'' is defined in letter, but it would be great if the image starts at the same height as ``This is me'', and left aligned, like the ``To Whom It May Concern''.

\closing{Yours Faithfully,}

\end{letter}
\end{document}

答案1

您可以使用该tikzpagenodes包及其current page text area节点。

\documentclass{letter}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\signature{Me}
\address{This is me\\ \\ I live somewhere \\ But you won't \\Find me}
% \fancypagestyle{empty}{\includegraphics[height=0.5in, keepaspectratio=true]{logo-lip6.png}}

\begin{document}
\begin{letter}{}
\opening{To Whom It May Concern: }
\tikz[remember picture,overlay]{
  \node[inner sep=0pt, anchor=north west]
  at (current page text area.north west)
  {\includegraphics[width=4cm, keepaspectratio=true]{example-image-a}};
}

Here is my letter. I'd like to put the image on the top-left part of the
body, not of the page (I'm not sure how ``body'' is defined in letter,
but it would be great if the image starts at the same height as ``This
is me'', and left aligned, like the ``To Whom It May Concern''.

\closing{Yours Faithfully,}

\end{letter}
\end{document}

在此处输入图片描述

相关内容