How do I center the title?
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{setspace}
\usepackage[colorlinks,citecolor=blue,urlcolor=blue,linkcolor=black]{hyperref}
\usepackage{hypernat}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{xcolor}
\usepackage{verbatim}
\usepackage[margin=2.5cm]{geometry}
\usepackage{url}
\usepackage{booktabs,caption,fixltx2e}
\usepackage[flushleft]{threeparttable}
\usepackage{setspace}
\usepackage[capposition=top]{floatrow}
\usepackage{float}
\usepackage{rotating}
\usepackage{bm}
\usepackage{tabularx}
\onehalfspacing
\usepackage{graphicx}
\usepackage{subfig}
\renewcommand{\familydefault}{\sfdefault}
\font\titlefont=cmr12 at 40pt
\begin{document}
\pagenumbering{gobble}% Remove page numbers (and reset to 1)
\begin{center}
\color{white}{
\titlefont
{\fontfamily{cmss}\selectfont
\scalebox{5}{Big Title}
}
\titlefont \\
\vspace{2cm}
{\fontfamily{cmss}\selectfont
\scalebox{2}{Small title}
}
}
\end{center}
\pagecolor{purple}\afterpage{\nopagecolor}
\newpage
\tableofcontents
\end{document}
Best Answer
To center the titles vertically, place the instruction
\vspace*{\fill}
before\begin{center}
and the instruction\vspace*{\fill}
after\end{center}
.I think you'd be well advised to simplify and declutter the LaTeX code you employ, as it's currently quite opaque, needlessly complicated, and full of redundancies. Don't load packages more than once, and be sure to load
hyperref
last. Oh, and as you've probably already discovered, you mustn't load bothsubcaption
andsubfig
.I've tried to do a preliminary cleanup in the following version of your code. Do try to go through the preamble carefully and eliminate all packages you don't use at all throughout the document.