How can I force a tikz image to go to the bottom of the page? - latex

I'm using this code to implement a "background image" on my page:
\tikz[remember picture,overlay] \node[inner sep=0pt] at (current page.center){\includegraphics{Images/picture.pdf}};
However, I'd like it to show up at the bottom of the page. I've tried changing the current page.center and played around with \vfill but I can't quite figure it out.

Something along the lines of this answer may be what you are looking for (adapted for this question):
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{graphicx}
\begin{document}
\begin{titlepage}
\begin{tikzpicture}[overlay, remember picture]
\node[anchor=south west, %anchor is bottom left corner of the graphic
xshift=5cm, %shifting around
yshift=-5cm]
at (current page.south west) %left bottom corner of the page
{\includegraphics[width=5cm]{tiger}};
\end{tikzpicture}
\end{titlepage}
\end{document}

Related

Tikz node won't apply left (nor right) alignment

I have been struggling with this issue for a while. I want to insert a title on a white box on top of a background image for a report cover, and everything is coming up great with the exception of the title alignment. It is centered and I want to make it left aligned, but so far none of the options I have tried have worked.
So far, this is what I got:
\usepackage{tikz}
\usepackage{makecell}
\begin{titlepage}
\setlength{\parindent}{0pt}
\begin{figure}
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center) {\includegraphics[scale=0.2]{example-image-10x16}};
\node[fill=white, scale=2, text=red, text width=94mm, align=left] at ([xshift=7mm,yshift=30mm]current page.center) {\makecell{\textbf{The title goes here and it is very}\\\textbf{long so it covers two lines}\\\Xhline{2\arrayrulewidth}\\[-18pt]\scalebox{.35}{\textbf{\fontfamily{phv}\selectfont DEPARTMENT OF SOME ENGINEERING DISCIPLINE $\vert$ MY UNIVERSITY}}\\[-7pt]\scalebox{.35}{\textbf{\fontfamily{phv}\selectfont MY NAME HERE $\vert$ NAME OF PROGRAM}}}};
\end{tikzpicture}
\end{figure}
\end{titlepage}
I have tried raggedright options with the \usepackage{ragged2e} and the \begin{flushleft}\end{flushleft} approach with different variations but I don't seem to make it align to the left or even to the right.
Cheers!
I would avoid all this messing with \makecell and whatnot. Instead use a simple minipage:
\documentclass{article}
\usepackage{tikz}
\usepackage{makecell}
\begin{document}
\begin{titlepage}
\setlength{\parindent}{0pt}
\begin{figure}
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center) {\includegraphics[scale=0.2]{example-image-10x16}};
\node[
fill=white,
text=red,
text width=92mm,
font=\bfseries
] at ([yshift=30mm]current page.center) {
\begin{minipage}{\linewidth}
\LARGE The title goes here and it is very
long so it covers two lines
\vskip-0.5cm
\rule{\textwidth}{1pt}
\vskip0.1cm
\scriptsize\fontfamily{phv}\selectfont DEPARTMENT OF SOME ENGINEERING DISCIPLINE $\vert$ MY UNIVERSITY
NAME HERE $\vert$ NAME OF PROGRAM
\end{minipage}};
\end{tikzpicture}
\end{figure}
\end{titlepage}
\end{document}

Caption Centered To Image Rather Than Page

There isn't exactly any code here, since I just want to centre \begin{figure} and \end{figure}'s captions to the entre of the image included rather than to the centre of the page, if i centre the image to the left, the caption still appears to the centre of the page (without using minipage as that is the only way i know to do it right now).
Here's an example:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h]
\includegraphics[width=0.5\textwidth]{image.png}
\caption{Caption}
\end{figure}
\end{document}
What I get from compiling it:
I want this be centered to the image itself, and not the page, without using minipage.
Here is the source image btw, just some image I found on google
One possible approach using the varwidth package:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{varwidth}
\begin{document}
\begin{figure}[h]
\begin{varwidth}{\linewidth}
\includegraphics[width=0.5\textwidth]{example-image-duck}
\caption{Caption}
\end{varwidth}
\end{figure}
\end{document}

Put two images with different height aligned to the top of the page LaTeX

I would like to create landscape document with two-column pages.
On the left side of each page is located a bigger image (covering more less the left part of page and aligned to the top of the page), on the right side is located smaller image covering about 1/3 on the right side of the page, aligned to the top and with some description below
\documentclass{book}
\usepackage[landscape]{geometry}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\noindent
\begin{minipage}{0.49\linewidth}
\centering
\includegraphics[width=\linewidth]{image-3x4}
\captionof{figure}{Example picture proportion 3:4}
\end{minipage}
\hspace{0.01\textwidth}
\begin{minipage}{0.49\linewidth}
\centering
\includegraphics[width=\linewidth]{image-3x1}
\captionof{figure}{Example picture proportion 3:1}
Some extra description on the right side
\end{minipage}
\end{document}
Actual output:
Desired output:
How to create two images side-by-side aligned to the top of the page as desired?
You can use the valign key (needs the adjutsbox package):
\documentclass{book}
\usepackage[landscape]{geometry}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[export]{adjustbox}
\begin{document}
\noindent
\begin{minipage}[t]{0.49\linewidth}
\centering
\includegraphics[width=\linewidth,valign=t]{example-image-duck}
\captionof{figure}{Example picture proportion 3:4}
\end{minipage}
\hspace{0.01\textwidth}
\begin{minipage}[t]{0.49\linewidth}
\centering
\includegraphics[width=\linewidth,height=1cm,valign=t]{example-image-duck}
\captionof{figure}{Example picture proportion 3:1}
Some extra description on the right side
\end{minipage}
\end{document}

Ignore margins and wrap text when adding pictures in Latex

I would like to add images in the top left/right or bottom left/right in a two-column page while ignoring the margins and having the text wrap around the picture. How can I also extend the solution to include half page images while ignoring the margins and with text wrapping.
I tried tikz package, but the text doesn't wrap around even when I use the wrapfig package.
For example, this is the code I used to insert image on the top left side of the page:
\documentclass[twocolumn, 12pt]{book}
\usepackage{lipsum}
\usepackage{tikz}
\begin{document}
\lipsum[1-3]
\begin{tikzpicture} [remember picture, overlay]
\node[anchor=north west,yshift=-1.5pt,xshift=1pt]%
at (current page.north west)
{\includegraphics[width=0.5\paperwidth,height=0.5\paperheight]{example.jpg}};
\end{tikzpicture}
\lipsum[1-3]
\end{document}
This results in the picture at the desired position, but the text is obscured behind the image. Thank you!
Not very pretty, but does the job I think (using geometry package only to get the correct values for top margin):
\documentclass[twocolumn, 12pt]{book}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{geometry}
\begin{document}
\begin{tikzpicture} [remember picture, overlay]
\node[anchor=north west]%
at (current page.north west)
{\includegraphics[width=0.46\paperwidth,height=0.5\paperheight]{example.png}};
\end{tikzpicture}
\vspace*{\dimexpr(0.5\paperheight-\voffset-1in-\headsep-\headheight)}
\lipsum[1-3]
\lipsum[1-3]
\end{document}

Defining a header with background color in Latex

For a small project I'm trying something that feels as if it should be peanut, but au contraire (Hey, that's french, never thought I'd remember some parts of that. anyway...).
The thing is, I want a latex layout where the header and footer span the entire pagewidth and have a background color, and also can have some elements on the left, center, or right (like with fancyhdr). The thing is, I simply cannot get this to work without screwing up the rest of the layout.
edit: added example.
Here's an example of what I have tried. The header is shown incorrectly since the background doesn't span the whole width of the page. The footer is not shown at all.
\documentclass[10pt,a4paper,notitlepage]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{color}
\usepackage{fancyhdr}
\usepackage{calc}
\usepackage{tikz}
\usepackage[landscape, top=0cm, bottom=3cm]{geometry}
\definecolor{logoGreen}{RGB}{218,226,87}
\newcommand{\HBG}{
\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-2cm] at (current page.north west)
{
\begin{tikzpicture}[remember picture, overlay]
\draw[fill=logoGreen] (0,0) rectangle (\paperwidth,2cm);
\end{tikzpicture}
};
\end{tikzpicture}
}
\fancyhead{}
\fancyhead[L]{\HBG}
\fancyhead[C]{\includegraphics[height=1.2cm]{"img/headerimg"}}
\fancyfoot[C]{\includegraphics[height=1.2cm]{"img/footerimg"}}
\fancyhfoffset[]{1in+\hoffset+\oddsidemargin}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\headheight 3cm
\footskip -2cm
\pagestyle{fancy}
\begin{document}
\section{first section}
content
\end{document}
You can use TikZ to position coloured boxes absolutely on the page. See an example here.
This example includes usage of \thechapter, so you can probably go on from there.

Resources