# How to remove a small vertical gap below picture?

I'm trying to put a picture at bottom of a title page, and I'm getting a very small vertical gap that I would like to remove. Here's a MWE to show my issue:

\documentclass[letterpaper]{book}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{libertine}
\renewcommand*\familydefault{\sfdefault}
\usepackage{anysize}
\marginsize{1.5in}{1in}{0.5in}{0.5in}
\usepackage[x11names]{xcolor}
\definecolor{backgroundcolor}{RGB}{150, 170, 190}
\usepackage{graphicx}
\usepackage{here}
\usepackage{afterpage}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand*{\maintitle}{\begingroup
\pagecolor{backgroundcolor}
\vfill

\raggedleft {\huge Name}

\begin{figure}[H]
\center
\includegraphics[width=1\textwidth]{example-image}
\end{figure}
\endgroup}

\begin{document}

\begin{titlepage}

\begin{tikzpicture}[remember picture, overlay]
\draw[line width = 1in,color = white] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$);
\draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$);
\draw[line width = 1pt,color = white] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$);
\end{tikzpicture}

\maintitle

\end{titlepage}

\end{document}


Preview, with the issue shown in red:

At first sight, the spacing v is equal to h, which is what I want. But a closer inspection shows that v is actually slightly larger than h. How can I make v exactly the same as h ? What is wrong with my code?

EDIT: After zooming and measuring, the difference is v - h = 1pt. This is the same as the white line thickness drawn at the bottom, but I suspect this is just a coincidence. I could solve my issue by adding \vspace{-1pt} just under my figure environment, but I would like to understand (and properly fix) the issue.

• Why do you use remember picture and why do you use a figure environment? If you don't want a float, then don't use a floating environment. Aug 13 '20 at 2:41
• Henri, I need these options else the white frame isn’t drawn correctly. The picture environment appears to be necessary too, else the picture falls down way too low.
– Cham
Aug 13 '20 at 2:48

It's maybe a bit easier to use eso-pic to draw on the page background. This also only requires compiling once. The dimensions are not the same as yours but I'm sure you can figure it out.

\documentclass[letterpaper]{book}
\usepackage{eso-pic}
\usepackage{tikz}
\usepackage{xcolor}
\definecolor{backgroundcolor}{RGB}{150,170,190}

\begin{document}

\AtTextLowerLeft{%
\begin{tikzpicture}[overlay]
\coordinate (ll) at (0,0);
\coordinate (ur) at (\textwidth,\textheight);
\draw[black,fill=backgroundcolor] ([shift={(-1in,-1in)}]ll) rectangle ([shift={(1in,1in)}]ur);
\draw[white] ([shift={(-.25in,-.25in)}]ll) rectangle ([shift={(.25in,.25in)}]ur);
\useasboundingbox (ll) rectangle (ur);
\end{tikzpicture}%
}%
}

\begin{titlepage}
\raggedleft
\leavevmode
\vfill
\huge Name\par
\includegraphics[width=1\textwidth]{example-image}
\end{titlepage}

\end{document}


• Henri, please read my edit. Why there’s an offset of 1 point from my code ? Desactivating my tikz background doesn’t change that so I dont think it is the culprit.
– Cham
Aug 13 '20 at 15:16

IMHO that the picture/image can be directly placed as a node in tikz rather than a separate begingroup

If I know the precise position of the page corner (red circle)

\node[inner sep=0pt, circle,red,fill,draw, minimum size=6pt] at
(%
$(current page text area.south west)+ (-0.75in,-0.6in)$
){};


then I can calculate precisely any other position-- in your case V and h by incrementing equal amount from the x and y side

\node[inner sep=0pt, circle,red,fill,draw, minimum size=6pt] at (%
$(current page text area.south west)+ % (-0.75in,-0.6in)+<------------------increment v=.2in h=.2in from each side (-0.55in,-0.4in)$){};


\documentclass[letterpaper]{book}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{libertine}
\renewcommand*\familydefault{\sfdefault}
\usepackage{anysize}
\marginsize{1.5in}{1in}{0.5in}{0.5in}
\usepackage[x11names]{xcolor}
\definecolor{backgroundcolor}{RGB}{150, 170, 190}
\usepackage{graphicx}
\usepackage{here}
\usepackage{afterpage}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{tikzpagenodes}

\newcommand*{\maintitle}{\begingroup%
\pagecolor{backgroundcolor}
\vfill
\raggedleft {\huge Name}
\begin{figure}[H]
\center
\includegraphics[width=1\textwidth]{example-image}
\end{figure}
\endgroup}%

\begin{document}

\begin{titlepage}

\begin{tikzpicture}[remember picture, overlay]
\draw[line width = 1in,color = white] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$);
\draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$);
\draw[line width = 1pt,color = white] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$);
\end{tikzpicture}

\maintitle
\begin{tikzpicture}[remember picture,overlay]
\node[inner sep=0pt, circle,red,fill,draw, minimum size=6pt] at
(%
$(current page text area.south west)+ (-0.75in,-0.6in)$
){};
\node[inner sep=0pt, circle,red,fill,draw, minimum size=6pt] at (%
$(current page text area.south west)+ % (-0.75in,-0.6in)+ (-0.55in,-0.4in)$){};

%\node at (0,0) {\includegraphics[width=4cm]{example-image}};
\end{tikzpicture}
\end{titlepage}

\end{document}


edit

I forgot to include the image

\node[inner sep=0pt] at (%
$(current page text area.south west)+ % (-0.75in,-0.6in)+ (-0.55in,-0.4in)$){\includegraphics[scale=0.2]{example-image}};


MWE

\documentclass[letterpaper]{book}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{libertine}
\renewcommand*\familydefault{\sfdefault}
\usepackage{anysize}
\marginsize{1.5in}{1in}{0.5in}{0.5in}
\usepackage[x11names]{xcolor}
\definecolor{backgroundcolor}{RGB}{150, 170, 190}
\usepackage{graphicx}
\usepackage{here}
\usepackage{afterpage}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{tikzpagenodes}

\newcommand*{\maintitle}{\begingroup%
\pagecolor{backgroundcolor}
\vfill
\raggedleft {\huge Name}
\begin{figure}[H]
\center
\includegraphics[width=1\textwidth]{example-image}
\end{figure}
\endgroup}%

\begin{document}

\begin{titlepage}

\begin{tikzpicture}[remember picture, overlay]
\draw[line width = 1in,color = blue] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$);
\draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$);
\draw[line width = 1pt,color = green] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$);
\end{tikzpicture}

%    \maintitle
\begin{tikzpicture}[remember picture,overlay]
\node[inner sep=0pt, circle,red,fill,draw, minimum size=6pt] at
(%
$(current page text area.south west)+ (-0.75in,-0.6in)$
){};
\node[inner sep=0pt, circle,red,fill,draw, minimum size=6pt] at (%
$(current page text area.south west)+ % (-0.75in,-0.6in)+ (-0.55in,-0.4in)$){};

\node[inner sep=0pt] at (%
$(current page text area.south west)+ % (-0.75in,-0.6in)+ (-0.55in,-0.4in)$){\includegraphics[scale=0.2]{example-image}};

%\node at (0,0) {\includegraphics[width=4cm]{example-image}};
\end{tikzpicture}
\end{titlepage}

\end{document}


If you see now you get better precision with tikz and removing the maketitle as also similarly commented by @HenriMenke

EDIT2

\documentclass[letterpaper]{book}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{libertine}
\renewcommand*\familydefault{\sfdefault}
\usepackage{anysize}
\marginsize{1.5in}{1in}{0.5in}{0.5in}
\usepackage[x11names]{xcolor}
\definecolor{backgroundcolor}{RGB}{150, 170, 190}
\usepackage{graphicx}
\usepackage{here}
\usepackage{afterpage}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\usepackage{tikzpagenodes}

%\newcommand*{\maintitle}{\begingroup%
%   \pagecolor{backgroundcolor}
%   \vfill
%   \raggedleft {\huge Name}
%   \begin{figure}[H]
%       \center
%       \includegraphics[width=1\textwidth]{example-image}
%   \end{figure}
%   \endgroup}%

\begin{document}
\pagecolor{backgroundcolor}
\begin{titlepage}

\begin{tikzpicture}[remember picture, overlay]
\draw[line width = 1in,color = blue!30] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$);
\draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$);
\draw[line width = 1pt,color = green] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$);
\end{tikzpicture}

\begin{tikzpicture}[remember picture,overlay, every label/.style=left,]
\node[name=temp1, inner sep=0pt, circle,red,fill,draw, minimum size=6pt,anchor=center, label=a] at
(%
$(current page text area.south west)+ (-0.75in,-0.6in)$
){} ;

\node[name=temp2,inner sep=0pt, circle,red,fill,draw, minimum size=6pt,anchor=center, label=b] at (%
$(current page text area.south west)+ % (-0.75in,-0.6in)+ (-0.05in,0.1in)$){};

\node[name=temp3,inner sep=0pt, circle,red,fill,draw, minimum size=6pt, label=c] at (%
$(current page text area.south west)+ % (-0.75in,-0.6in)+ (-0.05in,-0.6in)$){};

\node[name=temp4,inner sep=0pt, circle,red,fill,draw, minimum size=6pt, label=d] at (%
$(current page text area.south west)+ % (-0.75in,-0.6in)+ (-0.75in,0.1in)$){};

\node[name=temp5,inner sep=0pt, anchor=south west] at (%
$(current page text area.south west)+ % (-0.75in,-0.6in)+ (-0.05in,0.1in)$)(b){\includegraphics[scale=1,width=\linewidth]{example-image}} node[above=of b.north, yshift=-1cm, xshift=7cm ](){\Large Name};

\draw(temp2)--node[midway, fill=white]{0.7in}(temp4);
\draw(temp2)--node[midway, fill=white]{0.7in}(temp3);

\end{tikzpicture}
\end{titlepage}

\end{document}

• I don’t see a solution here. The v spacing isn’t the same as the h spacing.
– Cham
Aug 13 '20 at 2:52
• sorry forgot to include image -- please see the edit -- you can specify the scale of the image which will keep aspect ratio Aug 13 '20 at 3:03
• This isn’t a proper solution. You changed everything (even the colors), and the picture is now in the bottom left corner. Sorry -1.
– Cham
Aug 13 '20 at 3:10
• From your edit : Your image isn’t centered anymore, the spacing is larger at the right side, while it should be the same as the left and bottom sides. Why are you changing everything? This isn’t helpfull.
– Cham
Aug 13 '20 at 12:44