1

Given geometry margins like

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

what's the right way to put (as a top overlay) an image right into the margins' top right corner (but not onto the page's corner - that's too far)?

I'm currently trying

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

but that puts into the page corner. Is tikz right for this?

  • I think TikZ is not right for you so far, because you have not realised the cleaner TikZ code for your question. – Black Mild Nov 23 '19 at 13:05
4

tikzpagenodes package provides nodes like current page text area for this:

\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}
0

You can put image via node of TikZ. The option anchor can be completely ignored: \node[anchor=north east]{...} is the same as \node[below right]{...}.

enter image description here

% 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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.