如何将图像放入边距角落?

如何将图像放入边距角落?

鉴于geometry利润率

\geometry{left=20mm, right=20mm, top=20mm, bottom=20mm}

将图像(作为顶部覆盖)放置在页边距的右上角(但不要放置在页面的角落 - 那太远了)的正确方法是什么?

我目前正在尝试

\begin{tikzpicture}[remember picture,overlay]
   \node[anchor=north east,inner sep=0pt] at (current page.north east)
              {\includegraphics{IMAGE.jpg}};
\end{tikzpicture}

但那会放到页角。tikz这样合适吗?

答案1

tikzpagenodes软件包提供了如下节点current page text area

\documentclass{article}

\usepackage[left=20mm, right=20mm, top=20mm, bottom=20mm,showframe]{geometry}

\usepackage{tikz}
\usepackage{tikzpagenodes}

\begin{document}

\begin{tikzpicture}[remember picture,overlay]
   \node[anchor=north east,inner sep=0pt] at (current page text area.north east)
              {\includegraphics{example-image}};
\end{tikzpicture}

\end{document}

答案2

您可以通过nodeTikZ 放置图像。anchor可以完全忽略该选项:\node[anchor=north east]{...}与 相同\node[below right]{...}

在此处输入图片描述

% image from https://lichngaytot.com/phong-thuy/hoa-tra-loai-hoa-phong-thuy-xinh-dep-vuong-tai-284-185665.html
\documentclass{article}
\usepackage[margin=2cm,showframe]{geometry}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[remember picture,overlay]
\path (current page.north west) 
node[scale=.5,below right]    
{\includegraphics{hoatra}};
\end{tikzpicture}

\begin{tikzpicture}[remember picture,overlay]
\path (current page.center) 
node[xscale=.6,yscale=.4,rotate=25]    
{\includegraphics{hoatra}};
\end{tikzpicture}

\end{document}

相关内容