I am trying to put together a title page with a graphic taking up the upper portion, and a block of colour immediately below it. The code in question currently looks as follows:
\newgeometry{margin=0in}
\begin{titlingpage}
\begin{figure}[t]
\makebox[\linewidth]{\includegraphics[width=1.0\linewidth]{./latex-addtl/laptop-open}}
\textcolor{MyRed}{\rule[0mm]{\linewidth}{16mm}} % this makes the block of red below the image
\end{figure}
\maketitle
\end{titlingpage}
\restoregeometry
The problem is that I am getting stuck with a thin gap between the graphic and the rule. I have tried adding a negative vspace and altering the raise of the rule but neither seemed to actually do anything. I have also tried adding a % on the end of the line after the makebox command, which seemed to just make the rule disappear somewhere, presumably behind the image.
At present, what I am getting looks like this, with the slight gap before the rule:
EDIT: A full working example follows, with the gap fixed thanks to comments. It has been suggested that I remove the float, but if I do that the title moves to a new page, so I'd appreciate input on what's wrong there. The code is quite long because it's intended to be an rmarkdown template and I don't want to remove things that impact layout but that I have to leave in for the template's sake:
\documentclass[12pt,a4paper]{article}
\usepackage{titling}
\usepackage[margin=1in]{geometry}
% Image scaling stuff from original Rmarkdown template:
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
% Create subtitle command for use in maketitle
\newcommand{\subtitle}[1]{
\posttitle{
\end{flushleft}
\par
\mdseries
\begin{flushleft}
\hspace{\titlemargin}
\Huge#1
\end{flushleft}
}
}
\newlength{\titlemargin}
\setlength{\titlemargin}{1in}
\setlength{\droptitle}{-2em}
\title{My silly document}
\pretitle{\begin{flushleft}\vspace{\droptitle}\hspace{\titlemargin}
\Huge\bfseries}
\posttitle{\par\mdseries\end{flushleft}}
\subtitle{A subtitle}
\predate{\large\vspace{2em}
\hspace{\titlemargin}
}
\postdate{\par}
\date{16 July 2018}
\author{}
\usepackage{sectsty}
\usepackage{xcolor}
\usepackage[T1]{fontenc}
\usepackage[scaled]{helvet}
\renewcommand*\familydefault{\sfdefault}
\definecolor{Myred}{cmyk}{0,1,0.99,0.04}
\begin{document}
\newgeometry{margin=0in}
\begin{titlingpage}
\begin{figure}[t]
\lineskip=0pt
\includegraphics[width=1.0\linewidth]{./latex-addtl/laptop-open}
\textcolor{Myred}{\rule[0mm]{\linewidth}{16mm}} % this makes the block of red below the image
\end{figure}
\maketitle
\vfill
\hspace{\titlemargin}\includegraphics[width=0.6\linewidth]{./latex-addtl/logotagline}
\vspace{0.8\titlemargin}
\end{titlingpage}
\restoregeometry
\section{Executive Summary}\label{executive-summary}
Hello this is the document in question.
This is another line.
\end{document}

\documentclass{...}and ending with\end{document}. – samcarter_is_at_topanswers.xyz Jul 23 '18 at 14:20\lineskip=0ptafter\begin{figure}[t]to make the white space disappear. Apart from that I'm pretty sure that thetitlingpageenvironment with thefigurein it is not really what you want. But this is a question for a different post. – gernot Jul 23 '18 at 14:26\setlength\fboxsep{0pt}and then wrapping the image in\fbox{...}, thus will show where latex thinks the image boundaries are, thus reveling a bad crop. Also there is no need to use the figure env to get an image on your title page. – daleif Jul 23 '18 at 14:26figureon a titlepage. see https://en.wikibooks.org/wiki/LaTeX/Title_Creation – Johannes_B Jul 23 '18 at 14:29\maketitleon a new page... Nonetheless\lineskip=0ptseems to work. I have updated the post with a MWE for interest's sake – mbza Jul 24 '18 at 09:04\maketitlewithin atitlepageortitlingpage. If the wikibook page isn't very helpful, you can also have a look at http://tex.stackexchange.com/questions/209993/how-to-customize-my-titlepage/210280#210280 – Johannes_B Jul 24 '18 at 16:28