\RequirePackage{xspace}

% label and ref pairs
\newcommand{\qlabel}[1]{\label{eq:#1}}
\newcommand{\qref}[1]{\eqref{eq:#1}}
\newcommand{\Equationref}[1]{Equation~\qref{#1}}
\newcommand{\equationref}[1]{\qref{#1}}
\newcommand{\Equationsref}[1]{Equations~\qref{#1}}
\newcommand{\equationsref}[1]{\qref{#1}}

\newcommand{\fglabel}[1]{\label{fig:#1}}
\newcommand{\fgref}[1]{\ref{fig:#1}}
\newcommand{\Figureref}[1]{Figure~\fgref{#1}}
\newcommand{\figureref}[1]{figure~\fgref{#1}}
\newcommand{\Figuresref}[1]{Figures~\fgref{#1}}
\newcommand{\figuresref}[1]{figures~\fgref{#1}}

\newcommand{\tblabel}[1]{\label{fig:#1}}
\newcommand{\tbref}[1]{\ref{fig:#1}}
\newcommand{\Tableref}[1]{Table~\tbref{#1}}
\newcommand{\tableref}[1]{table~\tbref{#1}}
\newcommand{\Tablesref}[1]{Tables~\tbref{#1}}
\newcommand{\tablesref}[1]{tables~\tbref{#1}}

\newcommand{\alglabel}[1]{\label{fig:#1}}
\newcommand{\algref}[1]{\ref{fig:#1}}
\newcommand{\Algorithmref}[1]{Algorithm~\algref{#1}}
\newcommand{\algorithmref}[1]{algorithm~\algref{#1}}
\newcommand{\Algorithmsref}[1]{Algorithms~\algref{#1}}
\newcommand{\algorithmsref}[1]{algorithms~\algref{#1}}

\newcommand{\chalabel}[1]{\label{fig:#1}}
\newcommand{\charef}[1]{\ref{fig:#1}}
\newcommand{\Chapterref}[1]{Chapter~\charef{#1}}
\newcommand{\chapterref}[1]{chapter~\charef{#1}}
\newcommand{\Chaptersref}[1]{Chapters~\charef{#1}}
\newcommand{\chaptersref}[1]{chapters~\charef{#1}}

\newcommand{\seclabel}[1]{\label{fig:#1}}
\newcommand{\secref}[1]{\ref{fig:#1}}
\newcommand{\Sectionref}[1]{Section~\secref{#1}}
\newcommand{\sectionref}[1]{section~\secref{#1}}
\newcommand{\Sectionsref}[1]{Sections~\secref{#1}}
\newcommand{\sectionsref}[1]{sections~\secref{#1}}

\newcommand{\applabel}[1]{\label{fig:#1}}
\newcommand{\appref}[1]{\ref{fig:#1}}
\newcommand{\Appendixref}[1]{Appendix~\appref{#1}}
\newcommand{\appendixref}[1]{appendix~\appref{#1}}
\newcommand{\Appendicesref}[1]{Appendices~\appref{#1}}
\newcommand{\appendicesref}[1]{appendices~\appref{#1}}

\newcommand{\ost}[1]{\ensuremath{{#1}^{\textrm{st}}}}
\newcommand{\ond}[1]{\ensuremath{{#1}^{\textrm{nd}}}}
\newcommand{\ord}[1]{\ensuremath{{#1}^{\textrm{rd}}}}
\newcommand{\oth}[1]{\ensuremath{{#1}^{\textrm{th}}}}

\newcommand{\abbetc}{etc\xspace}
\newcommand{\abbie}{i~e\xspace}
\newcommand{\Matlab}{\textsc{Matlab}\xspace}
\newcommand{\Mathematica}{\textit{Mathematica}\xspace}

\newenvironment{codeverbatim}%
  {\hspace{0.05\textwidth}\begin{minipage}[c]{0.95\textwidth}}%
  {\end{minipage}}
\newcommand{\inline}[1]{\textnormal{\texttt{#1}}}

\newcommand{\funname}[1]{\textnormal{\texttt{#1}}}
\newcommand{\typename}[1]{\textnormal{\textbf{\textit{#1}}}}
\newcommand{\varname}[1]{\textnormal{\textit{#1}}}
\newcommand{\filename}[1]{\emph{#1}}
