\documentclass[twoside]{article}

% https://en.wikibooks.org/wiki/LaTeX/Page_Layout#More_size_options_with_geometry
% https://en.wikibooks.org/wiki/LaTeX/Page_Layout#Margins
\usepackage[paperwidth=99mm, paperheight=148mm,
            top=10mm, bottom=10mm, inner=9mm, outer=5mm]{geometry}

% We need to fit inside w 126, h 58, l 203 (mm), so 126 x 203 mm.
% Inner box size is 100 x 180 mm.
% A6 portrait is    105 x 148 mm.

% https://en.wikibooks.org/wiki/LaTeX/Fonts#Using_TTF_and_OTF_fonts
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Cantarell}

% To make the regular text smaller without changing the headings, etc.
%
% https://tex.stackexchange.com/a/141695
%\makeatletter
%\renewcommand\normalsize{%
%\@setfontsize\normalsize{9pt}{10.8pt}%
%\abovedisplayskip 9\p@ \@plus2\p@ \@minus5\p@%
%\abovedisplayshortskip \z@ \@plus2\p@%
%\belowdisplayshortskip 4.5\p@ \@plus2\p@ \@minus3\p@%
%\belowdisplayskip \abovedisplayskip%
%\let\@listi\@listI%
%}
%\normalsize
%\makeatother

% https://en.wikibooks.org/wiki/LaTeX/List_Structures#Customizing_lists
\usepackage{enumitem}

% https://tex.stackexchange.com/questions/108684/spacing-before-and-after-section-titles
\usepackage{titlesec}
% <command> <left> <before> <after>
% <before> := <fixed> plus <stretch> minus <shrink>
\titlespacing*{\section}{0pt}{10pt plus 0pt minus 5pt}{5pt plus 0pt minus 0pt}
\titlespacing*{\subsection}{0pt}{10pt plus 0pt minus 5pt}{5pt plus 0pt minus 0pt}
\titlespacing*{\subsubsection}{0pt}{10pt plus 0pt minus 5pt}{5pt plus 0pt minus 0pt}

% https://en.wikibooks.org/wiki/LaTeX/Hyperlinks#Hyperref
\usepackage{hyperref}
\hypersetup{
    pdftitle={Librem 5 Quick Start Guide},
    pdfauthor={Purism SPC}
}

% https://tex.stackexchange.com/questions/215279/how-can-i-include-a-png-image-using-xetex#215284
\usepackage[xetex]{graphicx}

\usepackage{xcolor}

% Fine-tune the layout
\setlength{\textheight}{13cm}
\setlength{\footskip}{20pt}
\setlength{\parindent}{0pt}
\setlength{\parskip}{4pt}

% Effectively disable hyphenation
%\hyphenpenalty=100000

\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}

\newcommand{\gui}{\textbf}
\newcommand{\link}[1]{\href{#1}{\fontsize{7.5pt}{7.5pt}\selectfont\textrm{\textcolor[rgb]{0,0,0.5}{#1}}}}
\newcommand{\namedlink}[2]{\href{#1}{\fontsize{7.5pt}{7.5pt}\selectfont\textrm{\textcolor[rgb]{0,0,0.5}{#2}}}}

% https://tex.stackexchange.com/questions/23845/is-there-a-vertical-equivalent-for-rlap
\newcommand{\tlap}[1]{\vbox to 0pt{\vss\hbox{#1}}}
\newcommand{\blap}[1]{\vbox to 0pt{\hbox{#1}\vss}}

%\usepackage{showframe}

% --- Document body ---

\begin{document}

% https://en.wikibooks.org/wiki/LaTeX/Customizing_Page_Headers_and_Footers
\thispagestyle{empty}
\newgeometry{top=10mm, bottom=10mm, inner=6mm, outer=6mm}

% Create a custom title instead of using a section.
\begin{center}
\vspace*{4.925cm}
\includegraphics[width=1.85in]{images/librem5-brand.pdf}\\
\vspace*{0.39cm}
\hspace*{-0.5mm}{\fontsize{17pt}{17pt}\selectfont Quick Start Guide}\\
\vspace*{4.95cm}
\includegraphics[width=0.85in]{images/purism-logo-h.pdf}
\end{center}

\restoregeometry

% ---

\pagestyle{plain}
\setlength{\headsep}{15pt}

\include{sections/disclaimer}

{\raggedright
\include{sections/requirements}
\include{sections/hardware-setup}
\include{sections/software-setup}
}
\include{sections/resources}

% ---
\newpage
\thispagestyle{fancy}
\newgeometry{paperwidth=99mm, paperheight=148mm,
             top=10mm, bottom=10mm, inner=7mm, outer=7mm}
\setlength{\headsep}{15pt}

\cfoot[\tiny\input{commit}]{\tiny\input{commit}}

\subsubsection*{Support and compliance}

\small

The latest warranty details and policies related to hardware and services can be
found at \link{https://puri.sm/policies/}

% Work around the inability to break "pre-installed" after "pre-" onto the next
% line:
Should \hfill you \hfill encounter \hfill any \hfill software \hfill defects \hfill with \hfill the \hfill pre-\\installed PureOS, please report them at \link{https://tracker.pureos.net}

You can also ask questions and discuss with other users at
\link{https://forums.puri.sm} or through \namedlink{mailto:support@puri.sm}{support@puri.sm}

Your Librem 5 ships with Free software where the source code is openly available
under various freedom-respecting licenses. You are allowed (and encouraged!) to
inspect, improve and redistribute it. You can obtain the source code for all the
freed components of the system at \link{https://source.puri.sm/Librem5}

A summary of the software components which includes names, versions and descriptions, links to descriptions of corresponding source code, copyright and license information is part of the user guide, available at \link{https://docs.puri.sm/Librem\_5.html}

\vspace*{\fill} % https://tex.stackexchange.com/questions/131885/vfill-and-vertical-space

\includegraphics[width=0.75in]{images/by-sa.pdf}\\
\textcopyright 2019 Purism SPC\\
Quick Start Guide for the Librem 5 is licensed under a Creative Commons Attribution-ShareAlike 4.0 Unported License.\\
See \link{http://creativecommons.org/licenses/by-sa/4.0/}

\vspace*{0.5em}
\includegraphics[width=0.75in]{images/purism-logo-h.pdf}\\
1 Market Street\\
Spear Tower, 36\textsuperscript{th} Floor\\
San Francisco, CA 94105\\
USA\\
\link{https://puri.sm}

\end{document}
