简体   繁体   中英

Overlaying off-margin figure over another on Latex using Tikz

I was hoping anyone could help me with this. I am working with Latex and the Tikz package (I'm a new user on both) on a document cover using 2 figures so it looks like this:

目标配置

That is, the background image leaves a thin margin on all sides, and the logo falls off-margin to the right and bottom. So, I enter the code overlaying the the logo over the background using Tikz, and as soon as I edit the coordinates to get the logo to go off-margin either on the right or bottom, the background image starts moving to the left and top until it sticks to the opposing borders of the page, like this:

我得到了什么

My question is, is there a way to have the superimposing image to fall off the margins while keeping the background image properly centered?

Here is the code I'm using:

\usepackage{mwe,tikz}

\begin{figure}
\begin{tikzpicture}[      
        every node/.style={anchor=south west,inner sep=20pt},
        x=1mm, y=1mm,
      ]   
     \node (fig1) at (0,0)
       {\includegraphics[scale=0.2]{Images/Background.jpg}};
     \node (fig2) at (124,-23)
       {\includegraphics[scale=1.5]{Images/Logo.png}};  
\end{tikzpicture}
\end{figure}

I first tried using the Overpic package instead, but I found it to be rather limited (or I couldn't figure it out well enough probably). I then tried using \centering and other horizontal and vertical centering techniques in combination with Tikz, but to no avail.

  • A figure environment is a floating objects, which allows latex to find a good location within the text flow. If you want an image at a very specific position, like a title page, you shouldn't use a figure environment

  • using the overlay option will make sure that the actual size of the tikzpicture does not influence the positioning and thus a cutoff logo won't influence the rest of the page

  • I also suggest the remember picture option which allows you to position your nodes with respect to the page. This way you can place the big picture in the centre of the page and the smaller picture at the lower right corner (shift it around with the xshift and yshift keys)


\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[remember picture,overlay]
     \node at (current page.center)      {\includegraphics[width=.9\paperwidth,height=.9\paperheight]{example-image-10x16}};
     \node at ([xshift=-2cm,yshift=1cm]current page.south east)       {\includegraphics[width=15cm]{example-image-duck}};  
\end{tikzpicture}

\end{document}

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM