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

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}

Related

Latex: how to align subcaptions on the top left and caption to the right of the figures

I am using LaTeX to write a report and I'm going crazy to get a result like
with subcaptions (a), (b), (c) align to the top left of the subfigures and caption on the right of the figure.
I've already tried with floatrow and subcaption, but I've never obtained the result I want.
MWE:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{floatrow}
\usepackage{subfig}
\floatsetup[figure]{style=plain,subcapbesideposition=top}
\begin{figure*}
\ffigbox[\FBwidth]
{\begin{subfloatrow}
\sidesubfloat[]{\includegraphics[width=.5\linewidth]{image1}\label{fig:a}}%
\sidesubfloat[]{\includegraphics[width=.5\linewidth]{image2}\label{fig:b}}%
\end{subfloatrow}}
{\caption{Two figures}\label{}}
\end{figure*}
\end{document}
Here some starting point with the subcaption package (the exact dimensions might need some tweaking to nicely align with the surrounding text)
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\captionsetup[subfigure]{font={bf,small}, skip=1pt, margin=-0.7cm, singlelinecheck=false}
\begin{document}
\begin{figure*}
\hfill
\begin{minipage}[b]{.63\textwidth}
\begin{subfigure}{\textwidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-duck}
\end{subfigure}\par
\begin{subfigure}{\textwidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-duck}
\end{subfigure}
\end{minipage}
\quad
\begin{minipage}[b]{.3\textwidth}
\caption{some caption with aligns at the bottom}\label{key}
\end{minipage}
\end{figure*}
\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}

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}

How to align the note with the left side of the figure?

I am trying to put notes in the pictures of my work but the notes are getting aligned with the border of the text and not the figure. How to align the note (Fonte: Elaborated by the author (2021)) of the table with the left side of the figure?
\begin{figure}[h]
\begin{center}
\includegraphics[scale=.35]{image.jpg}
\caption{Text tex text.}
\label{fig_intbus}
\end{center}
\fonte{Elaborated by the author (2021)..}
\end{figure}
I would like something similar to the threeparttable environment for tables but that can be used in figures. I thought about the minipage environment but I don't want to specify the width for each figure manually.
Here is an example of how to do it, defining a new caption.
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\newcommand{\fonte}[1]{\captionsetup{skip=0.5ex,position=b}\caption*{\textit{Fonte:} {#1}}}
\begin{document}
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{example-image-a}
\caption{Example image.}
\label{fig-img-a}
\fonte{Teste.}
\end{figure}
\end{document}
And the result is:

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

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}

Resources