LaTeX noob here.
I am trying to position images (no fixed height) in the upper right corner of a page. To achieve this I am using tikz with the overlay and remember picture options as suggested elsewhere. However this obviously means that any text I want to include gets overlayed on top of the picture, while I would like the text to appear below as if it was a normal figure.
The following is a minimal working example
\RequirePackage{tikz}
\RequirePackage{geometry}
%Used to make calculations with coordinates for positioning
\RequirePackage{calc}
%Width of border on the left with section title
\newlength{\titleborderwidth}
%Set border width
\setlength{\titleborderwidth}{0.16\paperwidth}
%Set page geometry
\geometry{inner=\titleborderwidth}
\begin{document}
\begin{tikzpicture}[remember picture, overlay]
\node[anchor=north east] at (current page.north east){
\includegraphics[width=\paperwidth-\titleborderwidth]{example-image-a}
};
\end{tikzpicture}
\\
I would like this text to appear below the picture
\end{document}
This produces:
Additionally:
The reason I need the border width is since the document I am planning has a border on which the title lies vertically on the left side.
Currently with this MWE the image does not appear to fit perfectly in the upper right corner, but appears to have some white margins and I am not sure why.
I was not able to figure out whether there is a way to obtain the size of the picture (which is not preset and may be changing) to use it as an argument for \vspace.
I would prefer to use tikz since in the final document I am using other tikz objects with the shadows library, and I would like to be able to use that same library for this image as well.
I spent already a lot of time trying to figure this out on my own, but did not come to any solution that is not hacky or tacky. I would be really glad if you could bestow some LaTeX knowledge on me. Thanks!
{\dimexpr 1in+\oddsidemargin}
or{\dimexpr 1in+\evensidemargin}
for even pages with a two sided document class. The 1in is hard coded into the TeX engine.