%%
%% This is file `sidenotes.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% sidenotes.dtx  (with options: `package')
%% 
%% IMPORTANT NOTE:
%% 
%% This is a generated file and you are not allowed to distribute it
%% without the source of the work.  See below about more informations
%% about the files the work consists of.
%% 
\ProvidesPackage{sidenotes}[%
  2011/11/10 v0.80 rich text in the margin for LaTeX]
\RequirePackage{marginnote} % puts the stuff in the margin and provides an offset option instead of a float
\RequirePackage{caption} % handles the figure caption (in the margin)
\RequirePackage{xifthen} % provide an if command
\newboolean{@sidenotes@bibtex}%
\setboolean{@sidenotes@bibtex}{false}%
\DeclareOption{bibtex}{\setboolean{@sidenotes@bibtex}{true}}%
\ProcessOptions
\ifthenelse{\boolean{@sidenotes@bibtex}}{\RequirePackage{bibentry}}{}
\newcommand*{\sidestyle}{\footnotesize}
\newcounter{sidenote} % make counter
\newcounter{@sidenotes@buffer}
\setcounter{sidenote}{1} % init counter

\newcommand{\sidenote}[2][]{%
\ifthenelse{\isempty{#1}}%
{\sidenotemark%
\sidenotetext{#2}}%
{\sidenotemark[#1]%
\sidenotetext[#1]{#2}}%
}
\newcommand{\sidenotemark}[1][]{%
\nobreak\hspace{0.1pt}\nobreak%
\ifthenelse{\isempty{#1}}%
{\textsuperscript{\thesidenote}%
\refstepcounter{sidenote}}% if no argument is given use sidenote counter%
{\setcounter{@sidenotes@buffer}{\value{sidenote}}%
\setcounter{sidenote}{#1}%
\textsuperscript{\thesidenote}% print out the argument otherwise
\setcounter{sidenote}{\value{@sidenotes@buffer}}}%
\ignorespaces%
}%
\newcommand{\sidenotetext}[2][]{%
\ifthenelse{\isempty{#1}}{% sitenotemark given?
\addtocounter{sidenote}{-1}%
\marginpar{\textsuperscript{\thesidenote}{} \sidestyle#2}%
\addtocounter{sidenote}{1}}%
{\marginpar{\textsuperscript{#1} \sidestyle#2}%
}% fi
}%
\ifthenelse{\boolean{@sidenotes@bibtex}}
{\newcommand{\sidecite}[1]{%
\sidenote{\bibentry{#1}}%
}}
{\newcommand{\sidecite}[1][]{%
  \@ifnextchar[{%
    \expandafter\@sidenotes@sidecitedo\@sidenotes@getnextopt{#1}%
  }{%
    \@sidenotes@sidecitedo{#1}{}%
  }%
}
\newcommand{\@sidenotes@getnextopt}{}
\long\def\@sidenotes@getnextopt#1[#2]{{#1}{#2}}
\newcommand{\@sidenotes@sidecitedo}[3]{%
\sidenote{\fullcite[#1][#2]{#3}}%
}}%
\newcommand{\sidecaption}[2][]{%
\ifthenelse{\isempty{#1}}%
{\marginnote{\caption{#2}}}%
{\marginnote{\caption[#1]{#2}}}%
}%
\newsavebox{\@sidenotes@sidefigurebox}
\newenvironment{sidefigure}[1][]%
{\begin{lrbox}{\@sidenotes@sidefigurebox}%
\begin{minipage}{\marginparwidth}%
\captionsetup{type=figure}}%
{\end{minipage}%
\end{lrbox}%
\marginpar{\usebox{\@sidenotes@sidefigurebox}}
}
\newsavebox{\@sidenotes@sidetablebox}
\newenvironment{sidetable}[1][]%
{\begin{lrbox}{\@sidenotes@sidetablebox}%
\begin{minipage}{\marginparwidth}%
\captionsetup{type=table}%
\sidestyle}%
{\end{minipage}%
\end{lrbox}%
\marginpar{\usebox{\@sidenotes@sidetablebox}}
}%    \end{macrocode}
\endinput
%%
%% End of file `sidenotes.sty'.
