[Tex/LaTex] Missing number, treated as zero, when attempting figure insertion

numbering

for some reason, of all my figures, this does not appear to want to be inserted. It keeps giving:

"Missing number, treated as zero." <to be read again>
}
\begin{figure}{h}{\textwidth}

Where did I go wrong?

Thanks for the help guys!

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[11pt]{article} % Default font size is 12pt, it can be changed here

\usepackage{geometry} % Required to change the page size to A4
\geometry{a4paper} % Set the page size to be A4 as opposed to the default US Letter

\usepackage{graphicx} % Required for including pictures

\usepackage{float} % Allows putting an [H] in \begin{figure} to specify the exact location of the figure
\usepackage{wrapfig} % Allows in-line images such as the example fish picture

\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template

\linespread{1.2} % Line spacing

%\setlength\parindent{0pt} % Uncomment to remove all indentation from paragraphs
\usepackage{enumitem}
\graphicspath{{Pictures/}} % Specifies the directory where pictures are stored
\usepackage{textgreek}
\usepackage{sidecap}
\usepackage[font=small]{caption}
\begin{document}

%----------------------------------------------------------------------------------------
%   TITLE PAGE
%----------------------------------------------------------------------------------------

\begin{titlepage}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Defines a new command for the horizontal lines, change thickness here

\center % Center everything on the page

\textsc{\School}\\[1.5cm] % Name of your university/college
\textsc{\Large Virology}\\[0.5cm] % Major heading such as course name
\textsc{\large Encephalophitides}\\[0.5cm] % Minor heading such as course title

\HRule \\[0.4cm]
{ \huge \bfseries Rabies Virus}\\[0.4cm] % Title of your document
\HRule \\[1.5cm]

\begin{minipage}{0.4\textwidth}
\begin{flushleft} \large
\emph{Author:}\\
Name \textsc{Name} % Your name
\end{flushleft}
\end{minipage}
~
\begin{minipage}{0.4\textwidth}
\begin{flushright} \large
\emph{Supervisor:} \\
Dr. Hi \textsc{Hilles} % Supervisor's Name
\end{flushright}
\end{minipage}\\[4cm]

{\large December 4, 2015}\\[3cm] % Date, change the \today to a set date if you want to be precise

%\includegraphics{Logo}\\[1cm] % Include a department/university logo - this will require the graphicx package

\vfill % Fill the rest of the page with whitespace

\end{titlepage}

%----------------------------------------------------------------------------------------
%   TABLE OF CONTENTS
%----------------------------------------------------------------------------------------

\tableofcontents % Include a table of contents

\newpage % Begins the essay on a new page instead of on the same page as the table of contents 



\begin{figure}{h}{\textwidth} 
  \begin{center}
    \includegraphics[width=0.4\textwidth]{rabiespathology}
  \end{center}
  \caption{Rabies pathogenesis. \cite{Rabiesdiagnosis}}
\end{figure}

Best Answer

(Not an independent answer, but an elaboration on @ChristianHupfer's answer.)

Here are some of the "doubtful settings" alluded to in Christian Hupfer's answer, listed in no particular order:

  • Excessive use of \\[<length>]] throughout the titlepage environment to generate line breaks and extra vertical spacing. Get rid of these instructions and use, on a separate line, \vspace{<length>}. Among other things, using \vspace you will succeed in placing the horizontal rules symmetrically about the title. (Currently, the lines are placed rather asymmetrically.)

  • The command \center in the titlepage environment should be replaced with \centering.

  • The macro \School isn't defined in your code.

  • Don't use the low-level command \linespread. It's better to load the setspace package and to execute \setstretch{1.2} in the preamble.

  • When changing font sizes for a single line, be sure to end the line with \par in order to get the fontsize-appropriate amount of vertical whitespace below the line.

  • If the minipage environments don't have equal numbers of rows, be sure to specify the [t] alignment specifier so that they will be aligned properly relative to each other.

  • In case your document will have a List of Figures, provide a "short version" of the caption that omits the citation call-out.

  • Already mentioned by Christian: The figure environment does not take a width argument; and, you should use \centering instead of \begin{center} and \end{center} inside the figure environment.

  • The default font size in the article document class is 10pt, not 12pt.


\documentclass[11pt,a4paper]{article} %% Default font size is 10pt (*not* 12pt)

\usepackage{geometry} 

\usepackage[demo]{graphicx} %% Omit "demo" option in real document
\graphicspath{{Pictures/}}

\usepackage{float} 
\usepackage{wrapfig}

%%\linespread{1.2} % Line spacing
\usepackage{setspace}
\setstretch{1.2}

%\setlength\parindent{0pt}
\usepackage{enumitem}
\usepackage{textgreek}
\usepackage{sidecap}
\usepackage[font=small]{caption}
\begin{document}

%----------------------------------------------------------------------------------------
%   TITLE PAGE
%----------------------------------------------------------------------------------------

\begin{titlepage}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

%\center % Center everything on the pagen
\centering

%%\textsc{\School} % Name of your university/college
{\Huge\scshape School Name Here}

\vspace{1.5cm}

{\Large\scshape Virology\par} % Major heading, such as course name

\vspace{0.5cm} 

{\large\scshape Encephalophitides\par} % Minor heading, such as course title

\vspace{0.5cm} 

\HRule 

\vspace{0.4cm}

{\huge \bfseries Rabies Virus\par} % Title of document

\vspace{0.4cm} 

\HRule 

\vspace{1.5cm}

\begin{minipage}[t]{0.4\textwidth}
\begin{flushleft} \large
\emph{Author:}\\
Name {\scshape Name} % Your name
\end{flushleft}
\end{minipage}
~
\begin{minipage}[t]{0.4\textwidth}
\large
\begin{flushright} 
\emph{Supervisor:} \\
Dr.\ Hi \textsc{Hilles} % Supervisor's Name
\end{flushright}
\end{minipage}

\vspace{4cm}

{\large December 4, 2015} % Date, change "\today" to a set hard-coded date

\vspace{3cm}

%\includegraphics{Logo}\\[1cm] % Include a department/university logo

%%\vfill % Fill the rest of the page with whitespace

\end{titlepage}

%----------------------------------------------------------------------------------------
%   TABLE OF CONTENTS
%----------------------------------------------------------------------------------------

\tableofcontents % Include a table of contents

\listoffigures %% Provide a list of figures

\newpage % Begins the essay on a new page instead of on the same page as the table of contents 



\begin{figure}[h!]%{h} %%%{\textwidth} 
  %%\begin{center}
  \centering
    \includegraphics[width=0.4\textwidth]{rabiespathology}
  %%\end{center}
  \caption[Rabies pathogenesis]{Rabies pathogenesis. \cite{Rabiesdiagnosis}}
\end{figure}
\end{document}