%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SWEDISH EXTENSION OF THE algorithmicx PACKAGE
%
% Provides: Swedish notation for algorithms.
%
% Keywords: Swedish
%           Svensk
%           Algoritm
%           Svenska
%           LaTeX
%           Programmering
%           Programming
%
% LICENCE: WTF
% AUTHOR: Gustav Hartvigsson - 2016
%
% NO RIGHTS RESERVED
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%% FIX SWEDISH CAPTIONS ON ALGORITHMS
% http://tex.stackexchange.com/a/169119
\makeatletter
\renewcommand*{\ALG@name}{Algoritm}
\makeatother
\renewcommand{\listalgorithmname}{Algoritmer}
%%%%

%%%%%%%%%%%%%%%%%
% Returnera
%%%%%%%%%%%%%%%%%
\algnewcommand\Returnera{\textbf{returnera}\ }
\algnewcommand\Retur{\textbf{retur}\ }

%%%%%%%%%%%%%%%%%
% I/O
%%%%%%%%%%%%%%%%%
\algnewcommand\Inmatning{\item[\textbf{Inmatning:}\ ]}
\algnewcommand\Utmatning{\item[\textbf{Utmatning:}\ ]}

%%%%%%%%%%%%%%%%
% Krav, Kräv
%%%%%%%%%%%%%%%%
\algnewcommand\Krav{\item[\textbf{Krav:\ }]}
\algnewcommand\Kraev{\item[\textbf{Kräv:\ }]}

%%%%%%%%%%%%%%%
% Garantera
%%%%%%%%%%%%%%%
\algnewcommand\Garantera{\item[\textbf{Garantera:\ }]}%


%%%%%%%%%%%%%%%%%
% Börja - Avsluta
%%%%%%%%%%%%%%%%%
% declaration of the new block
\algblock{Boerja}{Avsluta}
% customising the new block
\algrenewtext{Boerja}[1]{\textbf{börja}\ #1}
\algrenewtext{Avsluta}{\textbf{avsluta}}

%%%%%%%%%%%%%%%%%
% Procedur - Slut Procedur
%%%%%%%%%%%%%%%%%
% declaration of the new block
\algblock{Procedur}{SlutProcedur}
% customising the new block
\algrenewtext{Procedur}[2]{\textbf{procedur}\ #1 (#2) }
\algrenewtext{SlutProcedur}{\textbf{slut\ procedur}}

%%%%%%%%%%%%%%%%%
% Procedur - Slut Procedur
%%%%%%%%%%%%%%%%%
% declaration of the new block
\algblock{Funktion}{SlutFunktion}
% customising the new block
\algrenewtext{Funktion}[2]{\textbf{funktion}\ #1(#2) }
\algrenewtext{SlutFunktion}{\textbf{slut\ funktion}}


%%%%%%%%%%%%%%%%%
% För - Slut För
%%%%%%%%%%%%%%%%%
% declaration of the new block
\algblock{Foer}{SlutFoer}
% customising the new block
\algnewcommand\algorithmicfoer{\textbf{för}}
\algnewcommand\algorithmicutfoer{\textbf{utför}}
\algnewcommand\algorithmictill{\textbf{till}}
\algnewcommand\algorithmicslutfoer{\textbf{slut\ för}}
\algrenewtext{Foer}[1]{\algorithmicfoer\ #1\ \algorithmicutfoer}
\algrenewtext{SlutFoer}{\algorithmicslutfoer}

%%%%%%%%%%%%%%%%%
% För Alla - Slut För
%%%%%%%%%%%%%%%%%
% declaration of the new block
\algblock{FoerAlla}{SlutFoerAlla}
% customising the new block
\algnewcommand\algorithmicfoeralla{\textbf{för alla}}
\algnewcommand\algorithmici{\textbf{i}}
\algrenewtext{FoerAlla}[1]{\algorithmicfoeralla\ #1\ \algorithmicutfoer}
\algrenewtext{SlutFoerAlla}{\algorithmicslutfoer}

%%%%%%%%%%%%%%
% Medans - Slut Medans
%%%%%%%%%%%%%%
\algblock{Medans}{SlutMedans}
% customising the new block
\algnewcommand\algorithmicmedans{\textbf{medans}}
\algnewcommand\algorithmicslutmedans{\textbf{slut\ medans}}
\algrenewtext{Medans}[1]{\algorithmicmedans\ #1\ \algorithmicutfoer}
\algrenewtext{SlutMedans}{\algorithmicslutmedans}

%%%%%%%%%%%%%%
% Upprepa - Tills
%%%%%%%%%%%%%%
\algblock{Upprepa}{Tills}
% customising the new block
\algnewcommand\algorithmicupprepa{\textbf{upprepa}}
\algnewcommand\algorithmictills{\textbf{tills}}
\algrenewtext{Upprepa}{\algorithmicupprepa}
\algrenewtext{Tills}[1]{\algorithmictills\ #1}


%%%%%%%%%%%%%%
% Utför - Medans
%%%%%%%%%%%%%%
\algblock{Utfoer}{UtfoerMedans}
% customising the new block
\algrenewtext{Utfoer}{\algorithmicutfoer\ }
\algrenewtext{UtfoerMedans}[1]{\algorithmicmedans\ #1}

%%%%%%%%%%%%%%
% Om - Annars Om - Annars - Slut Om
%%%%%%%%%%%%%%
% declaration of the new block
\algblock[Om]{Om}{SlutOm}
\algcblock[Om]{Om}{AnnarsOm}{SlutOm}
\algcblock[Annars]{Om}{Annars}{SlutOm}
% customising the new block
\algnewcommand\algorithmicom{\textbf{om}}
\algnewcommand\algorithmicsaa{\textbf{så}}
\algnewcommand\algorithmicannars{\textbf{annars}}
\algnewcommand\algorithmicslutom{\textbf{slut\ om}}
\algrenewtext{Om}[1]{\algorithmicom\ #1\ \algorithmicsaa}
\algrenewtext{SlutOm}{\algorithmicslutom}
\algrenewtext{Annars}{\algorithmicannars}
\algrenewtext{AnnarsOm}[1]{\algorithmicannars\ \algorithmicom\ #1\ \algorithmicsaa }
