Overlaying off-margin figure over another on Latex using Tikz - latex

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}

Related

Add logo in very bottom right corner

I have been trying to insert a (transparent) logo in the bottom right corner in the background of my title page without affecting the text in Overleaf. Unfortunately, I haven't found a similar use case and have tried many different options for quite some time, but it doesn't work the way I need it to. Can someone please help me in this regard?
I would like it to look like this. As you can see, there is a logo inserted in the lower right corner.
You can add an image to the page background via the shipout/background hook. To make positioning easier, I'm using tikz in the following example:
\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz}
\AddToHookNext{shipout/background}{
\begin{tikzpicture}[remember picture, overlay,inner sep=0pt,outer sep=0pt,opacity=0.5]
\node[anchor=south east] at ([xshift=3cm,yshift=-3cm]current page.south east) {
\includegraphics[width=16cm]{example-image-duck}
};
\end{tikzpicture}
}
\begin{document}
\lipsum
\end{document}

Improving outputs in tikz package

$F_1(g)=\left\{
\begin{tikzpicture}
\node[shape=circle,draw=black] (A) {$b^1_0$};
\end{tikzpicture} \right\}$
Doing this code, I have an output like this Output
And I'd like something more centered into the brackets, like if I'm still writing instead of drawing.
You have to change the baseline of the picture to be at its center, then align that baseline to the vertical center of the text. This can be done with the option [baseline={([yshift=-.8ex]current bounding box.center)}]. I added it to the example code you gave, and also changed the inner sep of the circle to 0pt. Let me know if that works for you.
$F_1(g)=\left\{
\begin{tikzpicture}[baseline={([yshift=-.8ex]current bounding box.center)}]
\node[shape=circle,draw=black, inner sep=0pt] (A) {$b^1_0$};
\end{tikzpicture} \right\}$
\end{document}

Add an image in background and a text zone

Well I'm a newbie in latex and I want to make a latex Curriculum Vitae.
I want to create a page with two parts
First part: an image from TOP to Bottom, and from left to the middle of the page
Second part: a text zone from from TOP to Bottom, and from middle of the page to the right
I have tried to create two columns but every time one of the columnes are put on the next pages :(
Do you have any advice or tips or answer to give me?
Thank you very much for your help.
For a single-page split-view display, you can set the content in a tabularx structure. The left-hand side contains an image with no height/depth. This allows you put anything in the right-hand side.
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx,tabularx}
\usepackage{lipsum}
\setlength{\parindent}{0pt}
\pagestyle{empty}
\begin{document}
\begin{tabularx}{\textwidth}{#{} X X #{}}
\raisebox{\dimexpr-\height+.7\normalbaselineskip}[0pt][0pt]{%
\includegraphics[width=\linewidth,height=\textheight]{example-image}} &
\lipsum[1-3]
\end{tabularx}
\end{document}
There are multiple ways of doing this. It all depends on whether you're stuck with a single page, or want to move to a bigger canvas.

Center background image on page within margins using eso-pic

In my thesis I'm including already published papers. I've extracted pages as individual EPS files and I'm shrinking them so they fit on one page within the margins (\pageScale).
\hfill{}\includegraphics[scale=\pageScale]{Integrative-Theory-Associative/eps-pages/page-1}\hfill{}
While this works ok, the pages appear extremely small to fit in the margins. I'd like to increase the size of the graphics beyond the margins such that header and page number information would overlap with margins of the inserted pages.
eso-pic allows me to fill the whole page with my inserted pages, but the header and page number overlap with the text in the inserted pages:
\mbox{}
\AddToShipoutPictureBG*{
\includegraphics{Integrative-Theory-Associative/pdf-pages/page-1.pdf}
}
\newpage
I's like to scale down and centre the graphics on the page so they are as big as possible while text within the graphics is not behind the header and is within the margins.
I don't mind manually figuring out the right scale for graphics, but I can't figure how to place the centre of a smaller graphic in the centre of the margins. \AtPageCenter
does not do what I expected, centre the centre of the graphic, not centre the lower left of the graphic.
In the example below I've used some of adjustbox's prowess to adjust included content:
\documentclass{article}
\usepackage{fancyhdr,lipsum}% Just for this example
\fancyhf{}
\fancyhead[C]{This is some random header text}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{.4pt}
\renewcommand{\footrulewidth}{.4pt}
\pagestyle{fancy}
\usepackage[export]{adjustbox}
\usepackage{eso-pic}
\newcommand{\pictureincenteroftextblock}[2][]{%
\AddToShipoutPictureBG*{%
\AtTextLowerLeft{%
\raisebox{.5\textheight}{%
\hspace*{.5\textwidth}%
\makebox[0pt]{\includegraphics[max width=\textwidth,max height=\textheight,valign=c,#1]{#2}}%
}%
}%
}%
}
\begin{document}
\lipsum[1-5]
\clearpage
\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-a}
\clearpage
\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-10x16}
\clearpage
\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-1x1}
\clearpage
\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-a4}
\end{document}
With the [export] option, adjustbox adds its key-values to graphicx's \includegraphics options. Those I've used are max width and max height which will shrink the included image (or page from a PDF) if the width or height exceeds these maxima while still maintaining the included image/page aspect ratio. Additionally, valign=c will align the content in a vertically centred fashion.
eso-pic is used to place the image in the background, starting at the lower-left part of the text block. Then, through standard spacing commands, it's raised into position (\raisebox) and shoved over (\hspace) to the centre of the text block. Finally the image is horizontally centred (\makebox[0pt]).

How to have a fixed size number that depends on the slide in latex beamer / tikz?

I have a tikz picture with a circle node which has a number inside.
I want this number to change with the slides but to be of fixed size. (-> not mess up the circle).
This one isn't working, the circle gets as big as if it has to hold all 3 numbers.
\tikz[baseline]
\node [fill=blue!20,draw,circle,anchor=base] (node1)
{
\only<1-3>{3} \only<4-6>{8} \only<7->{11.5}
};
Here the values are 3 on slides 1-3, 8 on slides 4-6 and else 7.
I observed the following:
The spaces between \only{} are always rendered (\only, when not active, is a "zero-width character"; TeX does not discard spaces between characters)
Set the width of the text explicitly using "text width=...". This implicitly puts the content into a minipage.
Note that the "baseline" property does not work anymore as expected.
"text centered" ensures the alignment for the case that the content is not exactly "text-width"
The "overprint" environment only automatically determines the height of the content, not the width.
To conclude, this works for me (I tried it):
\tikz[baseline]
\node [fill=blue!20,draw,circle,anchor=base,text width=4ex,text centered,inner sep=0] (node1)
{
\only<1-3>{3}\only<4-6>{8}\only<7->{11.5}
};
EDIT: This works with the correct baseline:
\tikz[baseline=(node1.base)]
\node [fill=blue!20,draw,circle] (node1)
{
\begin{minipage}{4ex}
\centering
\only<1-3>{3}\only<4-6>{8}\only<7->{11.5}
\end{minipage}
};
There are a couple of ways to do this:
You could use a 'overlay' environment which calculates the maximum size needed.
You could use \makebox[width]{ }.
Or simply use the 'minimum width' and 'minimum height' options on the node.
...

Resources