\newcommand{\txcache}[0]{T\kern-0.5pt xCache\xspace}
\newcommand{\memcached}[0]{memcached\xspace}
\newcommand{\postgres}[0]{PostgreSQL\xspace}
\newcommand{\postgresql}[0]{\postgres}
\newcommand{\rubis}[0]{RUBiS\xspace}
\newcommand{\mediawiki}[0]{MediaWiki\xspace}
\newcommand{\command}[1]{\textsc{#1}}
\newcommand{\sql}[1]{\textsc{#1}}
\newcommand{\invtag}[1]{\textsc{#1}}
\newcommand{\eg}[0]{\emph{e.g.},\ }
\newcommand{\ie}[0]{\emph{i.e.},\ }
\newcommand{\cmdarg}[1]{\textit{#1}}

\newcommand{\pinstar}[0]{\ensuremath{\star}\xspace}
\newtheorem{invariant}{Invariant}

\newcommand{\XXX}[0]{\todo{XXX}{\color{red}\bf XXX}\xspace}
\newcommand{\drkp}[1]{\todo{#1}}
\newenvironment{outline}{\it \begin{itemize}\color{red}}{\end{itemize}}

\lstdefinelanguage[example]{sql}[]{sql}{%
  emph={test,x},%
  morekeywords={BEGIN,PIN,SNAPSHOTID,VALIDITY,INCREMENT},%
  columns=spaceflexible,%
  tabsize=3,%
  mathescape,%
  basicstyle=\footnotesize,keywordstyle=\textbf,emphstyle=\textsf%
}

\newcommand{\llangle}[0]{ $\langle\!\langle$ }
\newcommand{\rrangle}[0]{$\rangle\!\rangle$}

\newenvironment{definition}[1]{%
  \begin{itemize}%
  \item \textbf{#1}:%
  }{\end{itemize}%
}

% Tuple typesetting
% Adds triangle brackets and spaces commas.  ie $\tup{1,2,3}$
% Arguments can be enclosed in braces or angle brackets
\makeatletter
\def\tup{%
  \def\tupInside\tupStart##1,##2\tupEnd{%
    ##1
    \def\tempa{}\def\tempb{##2}
    \ifx\tempa\tempb\else
    ,\;\tupInside\tupStart##2\tupEnd
    \fi}
  \def\tupBraces##1{\left\langle\tupInside\tupStart##1,\tupEnd\right\rangle}
  \def\tupBrackets<##1>{\tupBraces{##1}}
  \@ifnextchar<\tupBrackets\tupBraces}
\makeatother
