%%
%% This is file `chscite.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% chscite.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2012 by Simon Sigurdhsson <ssimon@student.chalmers.se>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Simon Sigurdhsson.
%% 
%% This work consists of the files chscite.dtx and chscite.ins
%% and the derived filebase chscite.sty.
%% 
%%
%% Copyright (C) 2012 by Simon Sigurdhsson <ssimon@student.chalmers.se>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Simon Sigurdhsson.
%%
%% This work consists of the files chscite.dtx and chscite.ins
%% and the derived filebase chscite.sty.
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{chscite}
    [2012/05/13 v2.999 Chalmers bibliography style]
\RequirePackage{ifthen}
\@ifundefined{url}{\RequirePackage{url}}{}
\newcommand{\chsurl}[1]{\url{#1}}
%% Kristoffer H. Rose <kris@diku.dk> 1995/03/01:
%%   do not expand macros in citations: put definitions on .aux file instead.
{\catcode`\:=12 \catcode`\-=12 \catcode`\>=12 \catcode`\<=12 %
 \gdef\codeof#1{\expandafter\codeof@\meaning#1<-:}%
 \gdef\codeof@#1:->#2<-:{#2}}
\def\chspreambletext{\catcode`\#=12 \chspreambletext@}
\def\chspreambletext@#1{\def\next{#1}\catcode`\#=6 %
  \immediate\write\@auxout{\string\chspreambledefs{%
      \string\AtBeginDocument{\codeof\next}}}}
\def\chspreambledefs#1{#1\gdef\chspreambledefs##1{}}
\newcommand{\chsitem}[4][\null]{\item[]%
\if@filesw{ \def\protect##1{\string ##1\space}%
\ifthenelse{\equal{#1}{\null}}
  {\def\next{{#4}{#2}{#2}{#3}}}
  {\def\next{{#4}{#2}{#1}{#3}}}
\immediate\write\@auxout{\string\chscite\codeof\next}%
}\fi%
\protect\hspace*{-\labelwidth}\protect\hspace*{-\labelsep}\ignorespaces%
}
\newcommand{\chscite}[4]{
  \global\@namedef{CHS@fn@#1}{#2}
  \global\@namedef{CHS@an@#1}{#3}
  \global\@namedef{CHS@yr@#1}{#4}
  \global\@namedef{CHS@df@#1}{\csname CHS@fn@#1\endcsname}
}
\newcommand{\CHS@citetoaux}[1]{%
  \if@filesw\immediate\write\@auxout{\string\citation{#1}}\fi%
}
\newcommand{\CHS@checkdef}[2]{\@ifundefined{CHS@df@#1}%
  {\textbf{?}\@warning{Citation '#1' on page \thepage \space undefined}}%
  {#2}%
}
\newcommand{\CHS@dolist}[2]{\def\@citea{\null}\@for\@citeb:=#1\do%
{\@citea\def\@citea{,\penalty\@m\ }\CHS@checkdef{\@citeb}%
{#2{\@citeb}\null\penalty\@m\ %
\CHS@year{\@citeb}\CHS@setd{\@citeb}}}%
}
\def\@enamedef#1{\expandafter\def\csname #1\expandafter\endcsname\expandafter}
\newcommand{\CHS@name}[1]{\csname CHS@df@#1\endcsname}
\newcommand{\CHS@fname}[1]{\csname CHS@fn@#1\endcsname}
\newcommand{\CHS@aname}[1]{\csname CHS@an@#1\endcsname}
\newcommand{\CHS@year}[1]{\csname CHS@yr@#1\endcsname}
\newcommand{\CHS@setd}[1]{%
\global\@enamedef{CHS@df@#1}{\csname CHS@an@#1\endcsname}%
}
%% Berwin A. Turlach <berwin@alphasun.anu.edu.au>
\global\@namedef{CHS@df@*}{\csname CHS@fn@*\endcsname}
\renewcommand{\nocite}[1]{\CHS@citetoaux{#1}%
\@for\@citeb:=#1\do%
{\CHS@checkdef{\@citeb}{}}}%
\renewcommand{\cite}{\@ifstar{\@ifstar{\CHS@acite}{\CHS@fcite}}{\CHS@dcite}}
\newcommand{\CHS@dcite}[2][\null]{\CHS@citetoaux{#2}%
{(\CHS@dolist{#2}{\CHS@name}\ifthenelse{\equal{#1}{\null}}%
  {}{, #1})}%
}
\newcommand{\CHS@acite}[2][\null]{\CHS@citetoaux{#2}%
{(\CHS@dolist{#2}{\CHS@aname}\ifthenelse{\equal{#1}{\null}}%
  {}{, #1})}%
}
\newcommand{\CHS@fcite}[2][\null]{\CHS@citetoaux{#2}%
{(\CHS@dolist{#2}{\CHS@fname}\ifthenelse{\equal{#1}{\null}}%
  {}{, #1})}%
}
\newcommand{\citeaffixed}{\@ifstar{\@ifstar{\CHS@aciteaff}{\CHS@fciteaff}}%
{\CHS@dciteaff}%
}
\newcommand{\CHS@fciteaff}[3][\null]{\CHS@citetoaux{#2}%
{(#3\ \CHS@dolist{#2}{\CHS@fname}\ifthenelse{\equal{#1}{\null}}%
    {}{, #1})}%
}
\newcommand{\CHS@aciteaff}[3][\null]{\CHS@citetoaux{#2}%
{(#3\ \CHS@dolist{#2}{\CHS@aname}\ifthenelse{\equal{#1}{\null}}%
    {}{, #1})}%
}
\newcommand{\CHS@dciteaff}[3][\null]{\CHS@citetoaux{#2}%
{(#3\ \CHS@dolist{#2}{\CHS@name}\ifthenelse{\equal{#1}{\null}}%
    {}{, #1})}%
}
\newcommand{\citeasnoun}{\@ifstar{\@ifstar{\CHS@aciteasn}{\CHS@fciteasn}}%
{\CHS@dciteasn}%
}
\newcommand{\CHS@fciteasn}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
{\CHS@fname{#2}\ (\CHS@year{#2}\ifthenelse{\equal{#1}{\null}}
    {}{, #1})}\CHS@setd{#2}}%
}
\newcommand{\CHS@aciteasn}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
{\CHS@aname{#2}\ (\CHS@year{#2}\ifthenelse{\equal{#1}{\null}}
    {}{, #1})}\CHS@setd{#2}}%
}
\newcommand{\CHS@dciteasn}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
{\CHS@name{#2}\ (\CHS@year{#2}\ifthenelse{\equal{#1}{\null}}
    {}{, #1})}\CHS@setd{#2}}%
}
\newcommand{\possessivecite}{\@ifstar{\@ifstar{\CHS@acitepos}{\CHS@fcitepos}}%
{\CHS@dcitepos}%
}
\newcommand{\CHS@fcitepos}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
{\CHS@fname{#2}s (\CHS@year{#2}\ifthenelse{\equal{#1}{\null}}
    {}{, #1})}\CHS@setd{#2}}%
}
\newcommand{\CHS@acitepos}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
{\CHS@aname{#2}s (\CHS@year{#2}\ifthenelse{\equal{#1}{\null}}
    {}{, #1})}\CHS@setd{#2}}%
}
\newcommand{\CHS@dcitepos}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
{\CHS@name{#2}s (\CHS@year{#2}\ifthenelse{\equal{#1}{\null}}
    {}{, #1})}\CHS@setd{#2}}%
}
\newcommand{\citename}{\@ifstar{\@ifstar{\CHS@acitenam}\CHS@fcitenam}%
{\CHS@dcitenam}%
}
\newcommand{\CHS@fcitenam}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
{\CHS@fname{#2}\ifthenelse{\equal{#1}{\null}}
    {}{\ (#1)}}}%
}
\newcommand{\CHS@acitenam}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
{\CHS@aname{#2}\ifthenelse{\equal{#1}{\null}}
    {}{\ (#1)}}}%
}
\newcommand{\CHS@dcitenam}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
{\CHS@name{#2}\ifthenelse{\equal{#1}{\null}}
    {}{\ (#1)}}}%
}
\newcommand{\citeyear}{\@ifstar{\CHS@citeyrnb}{\CHS@citeyr}}
\newcommand{\CHS@citeyrnb}[2][\null]{\CHS@citetoaux{#2}%
{\def\@citea{\null}\@for\@citeb:=#2\do%
{\@citea\def\@citea{,\penalty\@m\ }\CHS@checkdef{\@citeb}%
{\CHS@year{\@citeb}}}\ifthenelse{\equal{#1}{\null}}%
{}{, #1}}%
}
\newcommand{\CHS@citeyr}[2][\null]{\CHS@citetoaux{#2}%
{(\def\@citea{\null}\@for\@citeb:=#2\do%
{\@citea\def\@citea{,\penalty\@m\ }\CHS@checkdef{\@citeb}%
{\CHS@year{\@citeb}}}\ifthenelse{\equal{#1}{\null}}%
{}{, #1})}%
}
\newcommand{\chsWand}{}%
\newcommand{\chsWjanuary}{}%
\newcommand{\chsWfebruary}{}%
\newcommand{\chsWmarch}{}%
\newcommand{\chsWapril}{}%
\newcommand{\chsWmay}{}%
\newcommand{\chsWjune}{}%
\newcommand{\chsWjuly}{}%
\newcommand{\chsWaugust}{}%
\newcommand{\chsWseptember}{}%
\newcommand{\chsWoctober}{}%
\newcommand{\chsWnovember}{}%
\newcommand{\chsWdecember}{}%
\newcommand{\chsWprinting}{}%
\newcommand{\chsWphdthesis}{}%
\newcommand{\chsWmscthesis}{}%
\newcommand{\chsWinstitution}{}%
\newcommand{\chsWin}{}%
\newcommand{\chsPage}{}%
\newcommand{\chsPages}{}%
\newcommand{\chsEdition}{}%
\newcommand{\chsNumero}{}%
\newcommand{\chsVolume}{}%
\newcommand{\chsWst}{}%
\newcommand{\chsWnd}{}%
\newcommand{\chsWrd}{}%
\newcommand{\chsWth}{}%
\newcommand{\chsWeditor}{}%
\newcommand{\chsWelectronic}{}%
\DeclareOption{swedish}{%
\renewcommand{\chsWand}{och}%
\renewcommand{\chsWjanuary}{januari}%
\renewcommand{\chsWfebruary}{februari}%
\renewcommand{\chsWmarch}{mars}%
\renewcommand{\chsWapril}{april}%
\renewcommand{\chsWmay}{maj}%
\renewcommand{\chsWjune}{juni}%
\renewcommand{\chsWjuly}{juli}%
\renewcommand{\chsWaugust}{augusti}%
\renewcommand{\chsWseptember}{september}%
\renewcommand{\chsWoctober}{oktober}%
\renewcommand{\chsWnovember}{november}%
\renewcommand{\chsWdecember}{december}%
\renewcommand{\chsWprinting}{Under tryckning}%
\renewcommand{\chsWphdthesis}{Doktorsavhandling}%
\renewcommand{\chsWmscthesis}{Examensarbete}%
\renewcommand{\chsWinstitution}{inom}%
\renewcommand{\chsWin}{I}%
\renewcommand{\chsPage}{s.}%
\renewcommand{\chsPages}{ss.}%
\renewcommand{\chsEdition}{upplagan}%
\renewcommand{\chsNumero}{nr}%
\renewcommand{\chsVolume}{vol.}%
\renewcommand{\chsWst}{:a}%
\renewcommand{\chsWnd}{:a}%
\renewcommand{\chsWrd}{:e}%
\renewcommand{\chsWth}{:e}%
\renewcommand{\chsWeditor}{red.}%
\renewcommand{\chsWelectronic}{Elektronisk}%
}
\DeclareOption{english}{%
\renewcommand{\chsWand}{and}%
\renewcommand{\chsWjanuary}{January}%
\renewcommand{\chsWfebruary}{February}%
\renewcommand{\chsWmarch}{March}%
\renewcommand{\chsWapril}{April}%
\renewcommand{\chsWmay}{May}%
\renewcommand{\chsWjune}{June}%
\renewcommand{\chsWjuly}{July}%
\renewcommand{\chsWaugust}{August}%
\renewcommand{\chsWseptember}{September}%
\renewcommand{\chsWoctober}{October}%
\renewcommand{\chsWnovember}{November}%
\renewcommand{\chsWdecember}{December}%
\renewcommand{\chsWprinting}{Unpublished}%
\renewcommand{\chsWphdthesis}{Ph.D.~thesis}%
\renewcommand{\chsWmscthesis}{Master's~thesis}%
\renewcommand{\chsWinstitution}{at}%
\renewcommand{\chsWin}{In}%
\renewcommand{\chsPage}{p.}%
\renewcommand{\chsPages}{pp.}%
\renewcommand{\chsEdition}{edition}%
\renewcommand{\chsNumero}{no.}%
\renewcommand{\chsVolume}{vol.}%
\renewcommand{\chsWst}{st}%
\renewcommand{\chsWnd}{nd}%
\renewcommand{\chsWrd}{rd}%
\renewcommand{\chsWth}{th}%
\renewcommand{\chsWeditor}{ed.}%
\renewcommand{\chsWelectronic}{Electronic}%
}
\ExecuteOptions{english}
\ProcessOptions*
\bibliographystyle{chscite}
\endinput
%%
%% End of file `chscite.sty'.
