%%%%%%%%%%%%%%%
% utils / commands


\usepackage{graphicx} % support the \includegraphics command and options

\usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)
%\usepackage[T1]{fontenc}

\usepackage{color}

\usepackage{pgf}					
\usepackage{tikz}					% tikz graphics
\usetikzlibrary{arrows,automata}

\usepackage{epstopdf}

\usepackage{float}
\usepackage{framed}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{tabu}
	
\usepackage[singlelinecheck=off]{caption}

%%% PACKAGES
\usepackage{booktabs} % for much better looking tables
\usepackage{array} % for better arrays (eg matrices) in maths
\usepackage{paralist} % very flexible & customisable lists (eg. enumerate/itemize, etc.)
\usepackage{verbatim} % adds environment for commenting out blocks of text & for better verbatim
%\usepackage{subfig} % make it possible to include more than one captioned figure/table in a single float
% These packages are all incorporated in the memoir class to one degree or another...



 % disable
\usepackage[textsize=footnotesize, textwidth=1in, colorinlistoftodos=1, 		bordercolor=todoborder, linecolor=todoborder, backgroundcolor=todobg]{todonotes}

\newcommand{\todoin}[1]{\todo[inline]{#1}}
\newcommand{\todocite}[1]{\todo[inline,backgroundcolor=cite]{#1}}
\newcommand{\todoask}[1]{\todo[inline,backgroundcolor=ask]{#1}}
\newcommand{\todocode}[1]{\todo[inline,backgroundcolor=code]{#1}} % anything that runs: installing, implementing, data transform 
\newcommand{\concept}[1]{\textsf{#1}}
\newcommand{\code}[1]{\texttt{#1}}
\newcommand{\var}[1]{\textrm{\textit{#1}}}
\newcommand{\xne}[1]{\textsf{#1}}  % named entity (?)
\newcommand{\furl}[1]{\footnote{\url{#1}}}
\newcommand{\ftodo}[1]{\footnote{\todoin{#1}}}

\newenvironment{note}
{\footnotesize \color{grey} \begin{textit}}
{ \end{textit} \normalsize}

\floatstyle{plain}
\newfloat{definitionx}{htp}{lod}[chapter]
\floatname{definitionx}{Definition}


\DeclareCaptionType{defcap}[Definition][List of definitions]
\captionsetup[defcap]{labelformat=simple}

\newenvironment{definition}[1]
{\begin{defcap}[!ht]\caption{#1}\equation\notag}
% \begin{definitionx} 
{\endequation\end{defcap}}
% \end{definitionx}


% environments for examples
% with different number of columns (1,2,3)

% \vspace{0.5\baselineskip}
\newenvironment{example1}
{
 \begin{ttfamily}\footnotesize \begin{shaded*} \noindent
\begin{tabular}{l}   }
{ \end{tabular} \end{shaded*} \end{ttfamily}  }


%@{\hspace{-2mm}} 
\newenvironment{example2}
{ \footnotesize
\begin{ttfamily} \begin{shaded*} \noindent
 \begin{tabular}{p{0.4\textwidth}  p{0.6\textwidth} } }
{\end{tabular} \end{shaded*} \end{ttfamily} }


\newenvironment{example3}
{ \footnotesize
 \begin{ttfamily} \begin{shaded*} \noindent
 \begin{tabular}{@{\hspace{-1mm}} p{0.25\textwidth}  p{0.25\textwidth}  p{0.45\textwidth}} 
}
{  \end{tabular} \end{shaded*} \end{ttfamily} }

% xml syntax highlighting
% source http://snipt.org/vngf3
\usepackage{listings}
 
\definecolor{grey}{rgb}{0.4,0.4,0.4}
\definecolor{darkblue}{rgb}{0.0,0.0,0.6}
\definecolor{cyan}{rgb}{0.0,0.6,0.6}

\definecolor{todobg}{rgb}{0.8,0.8,1}
\definecolor{cite}{rgb}{0.8,1,0.8}
\definecolor{ask}{rgb}{1,1,0.8}
\definecolor{code}{rgb}{1,0.8,0.8}
\definecolor{todoborder}{rgb}{0.8,0.4,0.4}
\definecolor{shadecolor}{rgb}{0.9,0.9,1.0}

 
\lstset{
  basicstyle=\ttfamily\footnotesize,
  columns=fullflexible,
  showstringspaces=false,
  commentstyle=\color{grey}\upshape
}
 
\lstdefinelanguage{XML}
{
  basicstyle=\ttfamily\color{darkblue}\bfseries\footnotesize,
  morestring=[b]",
  morestring=[s]{>}{<},
  morecomment=[s]{<?}{?>},
  stringstyle=\color{black},
  identifierstyle=\color{darkblue},
  keywordstyle=\color{cyan},
  morekeywords={xmlns,version,type}% list your attributes here
}


%%% Fallback definitions for Docutils-specific commands

% legend environment
\ifthenelse{\isundefined{\DUlegend}}{
  \newenvironment{DUlegend}{\small}{}
}{}

% titlereference role
\providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
