\usepackage{algorithm}
% more compact enumerate and itemize
\usepackage{mdwlist}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage[lofdepth,lotdepth]{subfig}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{colortbl}
\usepackage{mathtools}
\usepackage{listings}
\usepackage{placeins}
\usepackage{framed}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{hyperref}
\newsubfloat{figure}
\usepackage{paralist}
\usepackage{float}
\usepackage{epstopdf}
\usepackage{enumitem}
\usepackage{breakurl}
\usepackage{bm}
\usepackage{fancyhdr}
\usepackage{wrapfig}
\fancypagestyle{fancybook}{%
    \fancyhf{}%
    % Note the ## here. It's required because \fancypagestyle is making a macro (\ps@fancybook).
    % If we just wrote #1, TeX would think that it's the argument to \ps@fancybook, but
    % \ps@fancybook doesn't take any arguments, so TeX would complain with an error message.
    % You are not expected to understand this.
    \renewcommand*{\sectionmark}[1]{ \markright{\thesection\ ##1} }%
    \renewcommand*{\chaptermark}[1]{ \markboth{\chaptername\ \thechapter: ##1}{} }%
    % Increase the length of the header such that the folios
    % (typography jargon for page numbers) move into the margin
    \fancyhfoffset[LE]{6mm}% slightly less than 0.25in
    \fancyhfoffset[RO]{6mm}%
    % Put some space and a vertical par between the folio and the rest of the header
    \fancyhead[LE]{\thepage\hskip3mm\vrule\hskip3mm\leftmark}%
    \fancyhead[RO]{\rightmark\hskip3mm\vrule\hskip3mm\thepage}%
}
\pagestyle{fancybook}
%\pagestyle{myheadings}

% \newcommand{tuplestatus}{}
\usepackage{tikz}

\newenvironment{elaboration}{%
    \par
    \begin{tikzpicture}
    \node[rectangle,minimum width=1.0\textwidth] (m)
    \bgroup\begin{minipage}{0.95\textwidth}%
}{%
    \end{minipage}\egroup;
    \draw[dashed] (m.south west) rectangle (m.north east);
    \end{tikzpicture}
}

\newcommand{\phase}[1]{\textbf{#1}}
\newcommand{\flag}[1]{\emph{\texttt{#1}}}
\newcommand{\class}[1]{\texttt{#1}}
\newcommand{\method}[1]{\textsf{#1}}
\newcommand{\keyword}[1]{\emph{#1}}

\usepackage{setspace}
\onehalfspacing

\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}
\definecolor{javared}{rgb}{0.6,0,0} % for strings
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
% for code listings
\lstset{
	language=Java,
	basicstyle=\footnotesize,
	tabsize=2,
	breaklines=true,
% 	frame=single,
	numbers=left,
	numberstyle=\tiny,
	frame=tb,
	columns=fullflexible,
	showstringspaces=false,
	keywordstyle=\color{javapurple}\bfseries,
	stringstyle=\color{javared},
	commentstyle=\color{javagreen},
	morecomment=[s][\color{javadocblue}]{/**}{*/}
}
\lstset{
	% JStar keywords
	morekeywords={foreach, val, table, orderby, inv, seq, order, unsafe, put, get, uniq, String,
	benchmark, threads, group, estimated, gamma, PUT, GET, java, dot, eps, txt, jar}
}


