% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
% texmf/tex/latex/bcn_koma.sty - Wrapper for commonly used packages in KOMA
%
% Copyright (C) 2014         Bijan Chokoufe Nejad         <bijan@chokoufe.com>
% Recent versions:  https://github.com/bijancn/bcn_scripts
%
% This source code is free software that comes with ABSOLUTELY NO WARRANTY; you
% can redistribute it and/or modify it under the terms of the GNU GPL Version 2:
% http://www.gnu.org/licenses/gpl-2.0-standalone.html
%
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
% Eventually you have to `sudo texhash` or click
% `MikTex Options -> Refresh FNDB, Update Formats`
%
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bcn_koma}

%============%
%  packages  %
%============%
\RequirePackage{lastpage}         % allows to use the last page number
\RequirePackage[utf8]{inputenc}
\RequirePackage{relsize}          % Allows to use relative sizes
\RequirePackage[tbtags]{amsmath}  % tbtags sets the number of split
                                  % environments at the end
\RequirePackage{amssymb,amsthm,amsfonts}
\RequirePackage{mathrsfs}         % For \mathsrc
\RequirePackage{slashed}          % The almighty slash-notation
\RequirePackage{xcolor}           % Allows every colormixture
\RequirePackage{bbm}              % $\mathbbm{N}$ -> |N, etc.
\RequirePackage{dsfont}
\RequirePackage{feynmp}           % Feynman diagrams. Compile with mp.
\RequirePackage[pdftex]{graphicx} % To include graphics. Option necessary
\DeclareGraphicsRule{*}{mps}{*}{} % for feynmp.
\RequirePackage{booktabs}         % Pretty tables. Use \toprule,
                                  % \midrule and \bottomrule
\RequirePackage{setspace}         % Provides: /onehalfspacing,..
\RequirePackage{nicefrac}         % Nice small fractions
\RequirePackage{environ}          % Allows to use \NewEnviron
\RequirePackage{listings}         % For code listings
\RequirePackage{acronym}          % Use acronyms consistently
\RequirePackage{hepnames}         % Names of particles
\RequirePackage{siunitx}          % Correct typesetting of units
\RequirePackage[font=small,labelfont=bf,format=plain,margin=1em,indention=1em,labelsep=space,skip=5em]{caption}
\RequirePackage[babel]{csquotes}  % Loading 'csquotes' recommended by biber
\RequirePackage{bcn_color}
\RequirePackage{hyperref}         % Customize with \hypersetup{}. Has to be last!
\RequirePackage[capitalise]{cleveref} % Enable \cref. Has to be laster!
%\RequirePackage{simplewick}       % Wick contractions
%\RequirePackage{subfig}            % Subcaption for several pics
%\RequirePackage{tikz}             % Provides the means for \circled

\DeclareSIUnit[number-unit-product = \;]{\permil}{\textperthousand}
\DeclareSIUnit[number-unit-product = \;]\byte{B}
\DeclareSIUnit[number-unit-product = \;]\flops{FLOPS}
\DeclareBinaryPrefix\kibi{Ki}{10}
\DeclareBinaryPrefix\mibi{Mi}{20}

\crefformat{section}{Section~#2#1#3}
\Crefformat{section}{Sections~#2#1#3}
\crefformat{figure}{Fig.~#2#1#3}
\Crefformat{figure}{Figures~#2#1#3}
\crefformat{table}{Tab.~#2#1#3}
\Crefformat{table}{Tables~#2#1#3}
\crefformat{chapter}{Chapter~#2#1#3}
\Crefformat{chapter}{Chapters~#2#1#3}
\crefformat{appendix}{Appendix~#2#1#3}

\newcommand\hypercitecolor{darkblue}
\hypersetup{%
    colorlinks,
    citecolor=\hypercitecolor,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}

%============%
%  commands  %
%============%
\RequirePackage{bcn_commands}

\NewEnviron{Balign}{
  \begin{equation}
  \begin{split}
    \BODY
  \end{split}
  \end{equation}
}

\endinput
