\usepackage{makeidx}         % allows index generation
\usepackage{graphicx}        % standard LaTeX graphics tool
                             % when including figure files
\usepackage{multicol}        % used for the two-column index
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{alltt}

\usepackage[T1]{fontenc}
\usepackage[boldsans]{ccfonts}
\DeclareFontSeriesDefault[rm]{bf}{bx}%bf default for rm: bold extended
\DeclareFontSeriesDefault[sf]{bf}{sbc}%bf default for sf: semibold
\usepackage[euler-digits]{eulervm}

\usepackage{isabelle,isabellesym}
\usepackage{mathpartir}
\usepackage{amssymb}

\renewcommand*\descriptionlabel[1]{\hspace\labelsep \textbf{#1}\hfil}

% this should be the last package used
\usepackage{xcolor}
\definecolor{linkcolor}{rgb}{0,0,0.4}
\usepackage[colorlinks=true,linkcolor=linkcolor,citecolor=linkcolor,
            filecolor=linkcolor,pagecolor=linkcolor,
            urlcolor=linkcolor]{hyperref}

% urls in roman style, theory text in math-similar italics
\urlstyle{tt}
\isabellestyle{it}

\renewcommand{\isadigit}[1]{\ensuremath{#1}}

% font size
\renewcommand{\isastyle}{\isastyleminor}

% indexing
\usepackage{ifthen}
\newcommand{\indexdef}[3]%
{\ifthenelse{\equal{}{#1}}{\index{#3 (#2)|bold}}{\index{#3 (#1\ #2)|bold}}}

% section commands
\renewcommand{\chapterautorefname}{Chapter}
\renewcommand{\sectionautorefname}{Section}
\renewcommand{\subsectionautorefname}{Section}

\renewcommand{\isamarkupsection}[1]{{\rmfamily\subsection{#1}}}
\renewcommand{\isamarkupsubsection}[1]{{\rmfamily\subsubsection{#1}}}
% isabelle in-text command font
\newcommand{\isacom}[1]{\isa{\isacommand{#1}}}

\protected\def\isacharunderscore{\raisebox{2pt}{\_\kern-1.7pt}}
\protected\def\isacharunderscorekeyword{\raisebox{2pt}{\_}}
% isabelle keyword, adapted from isabelle.sty
\renewcommand{\isakeyword}[1]
{\emph{\sffamily\bfseries%
\def\isachardot{.}\def\isacharunderscore{\isacharunderscorekeyword}%
\def\isacharbraceleft{\{}\def\isacharbraceright{\}}#1}}

% add \noindent to text blocks automatically
\renewenvironment{isamarkuptext}{\par\isastyletext\begin{isapar}\noindent}{\end{isapar}}
\renewenvironment{isamarkuptxt}{\par\isastyletext\begin{isapar}\noindent}{\end{isapar}}

\newcommand{\noquotes}[1]{{\renewcommand{\isachardoublequote}{}\renewcommand{\isachardoublequoteopen}{}\renewcommand{\isachardoublequoteclose}{}#1}}
\newcommand{\xsymbol}[1]{\texttt{\char`\\\char`<#1>}}

%index
\newcommand{\conceptnoidx}[1]{\textbf{#1}}
\newcommand{\concept}[1]{\conceptnoidx{#1}\index{#1}}
\newcommand{\conceptidx}[2]{\conceptnoidx{#1}\index{#2}}
\newcommand{\indexed}[2]{#1\index{#2@\protect#1}}

\newcommand{\isabox}{\fbox}
\newcommand{\bigisabox}[1]
{\isabox{\renewcommand{\isanewline}{\\}%
 \begin{tabular}{l}#1\end{tabular}}}

%%%% ``WARNING'' environment: 2 ! characters separated by negative thin space
%\def\warnbang{\vtop to 0pt{\vss\hbox{\let\bfdefault=\bfdefaultold\Huge\textbf{!$\!$!}}\vss}}

\def\warnbang{\vtop to 0pt{\vss\hbox{\includegraphics[width=3ex, height=5.5ex]{bang}}\vss}}

\newenvironment{warn}{\begin{trivlist}\small\item[]\noindent%
    \begingroup\hangindent=\parindent\hangafter=-2%\clubpenalty=10000%
    \def\par{\endgraf\endgroup}%
    \hbox to0pt{\hskip-\hangindent\warnbang\hfill}\ignorespaces}
  {\par\end{trivlist}}

\chardef\isachardoublequote=`\"%
\chardef\isachardoublequoteopen=`\"%
\chardef\isachardoublequoteclose=`\"%

\renewcommand{\isacharbackquoteopen}{\isacharbackquote}
\renewcommand{\isacharbackquoteclose}{\isacharbackquote}

\hyphenation{Isa-belle}
