%%
%% This is file `mnotes.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% mnotes.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2013 by S Luz <luzs@acm.org>
%% 
%% 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
%% 2003/12/01 or later.
%% 
\ProvidesPackage{mnotes}[%
  2013/20/04 v0.7 margin notes for collaborative document editing]
\expandafter\ifx\csname mnotespaperwidth\endcsname\relax
    \newdimen\mnotespaperwidth
    \mnotespaperwidth1.05\paperwidth
\fi
\newlength{\MNOTEWIDTH}
\setlength{\MNOTEWIDTH}{2.2cm}
\newcommand{\MNCOLOUR}{red}
\newcommand{\MNFONT}{\tiny}
\newif\if@mnotes@hide
\@mnotes@hidefalse
\newif\if@mnotes@basic
\@mnotes@basicfalse
\newif\if@mnotes@sidenotes
\@mnotes@sidenotesfalse
\newif\if@mnotes@scale
\@mnotes@scalefalse
\newif\if@mnotes@reverseconnect
\@mnotes@reverseconnectfalse
\RequirePackage{kvoptions}
\DeclareVoidOption{basic}{\@mnotes@basictrue}
\DeclareVoidOption{sidenotes}{\@mnotes@sidenotestrue}
\DeclareVoidOption{hide}{\@mnotes@hidetrue \AtEndOfPackage{\HideMNOTES{}}}
\DeclareVoidOption{reverseconnect}{\@mnotes@reverseconnecttrue}
\SetupKeyvalOptions{family=mnotes, prefix=mnotes@}
\DeclareStringOption{scale}[1.05]
\define@key{mnotes}{scale}{\if@mnotes@hide\else%
\pdfpagewidth#1\paperwidth\@mnotes@scaletrue\fi}
\DeclareVoidOption{centre}{\if@mnotes@scale\hoffset\pdfpagewidth
    \advance\hoffset-\paperwidth
    \hoffset.5\hoffset\fi}
\DeclareStringOption{mnwidth}[\MNOTEWIDTH]
\define@key{mnotes}{mnwidth}{\setlength{\MNOTEWIDTH}{#1}}
\DeclareStringOption{boxcolour}
\define@key{mnotes}{boxcolour}{\renewcommand{\MNCOLOUR}{#1}}
\DeclareStringOption{fontsize}[6]
\define@key{mnotes}{fontsize}{%
\count1=#1 \multiply \count1 by 116 \divide \count1 by 100%
\def\MNFONT{\fontsize{#1}{\count1}\selectfont}}
 %\ExecuteOptions{}
\ProcessKeyvalOptions{mnotes}
\if@twocolumn\if@mnotes@scale\hoffset\pdfpagewidth
    \advance\hoffset-\paperwidth
    \hoffset.5\hoffset\fi\fi
\if@mnotes@basic
  \RequirePackage{color}
  \newif\ifoddpage %% define \ifoddpage even though it's not used to
\else              %% avoid  extra bracket error
  \if@mnotes@sidenotes
    \RequirePackage{sidenotes}
  \else
    \RequirePackage{marginnote}
    \renewcommand\marginpar\marginnote
  \fi
  \RequirePackage{tikz}
  \RequirePackage{ifoddpage}
\fi
\if@mnotes@basic
\setlength{\marginparsep}{6pt}\setlength{\marginparwidth}{\MNOTEWIDTH}
\newcommand{\MNOTEon}[2][\MNCOLOUR]{%
\marginpar%
[{\MNFONT\raggedleft\color{#1}\em #2}]%
{\MNFONT\raggedright\color{#1}\em #2}}%
\else% not basic
\newcommand{\MNOTEon}[2][\MNCOLOUR]{
\setlength{\marginparsep}{6pt}\setlength{\marginparwidth}{\MNOTEWIDTH}
\begin{tikzpicture}[remember picture, baseline=-0.75ex]%
\node [coordinate] (textPOS) {};%
\end{tikzpicture}%
\if@mnotes@sidenotes
\sidenotetext[\tiny.]%
{\MNFONT\raggedright\em%
\begin{tikzpicture}[remember picture]%
\draw node [draw=#1,text width=\MNOTEWIDTH-1pt] (notePOS) {#2};%
\end{tikzpicture}
}%
\else
\marginpar%
[{\MNFONT\raggedleft\em\begin{tikzpicture}[remember picture]%
\draw node [draw=#1,text width=\MNOTEWIDTH-1pt] (notePOS) {#2};%
\end{tikzpicture}}]%
{{\MNFONT\raggedright\em%
\begin{tikzpicture}[remember picture]%
\draw node [draw=#1,text width=\MNOTEWIDTH-1pt] (notePOS) {#2};%
\end{tikzpicture}%
}}%
\fi%
\if@twocolumn%
  \if@firstcolumn%
    \if@mnotes@reverseconnect
      \mnoteswestlink{#1}%
    \else
      \mnoteseastlink{#1}%
    \fi
  \else%
    \if@mnotes@reverseconnect
      \mnoteseastlink{#1}%
    \else
      \mnoteswestlink{#1}%
    \fi
  \fi%
\else%
  \if@twoside%
    \checkoddpage%
    \ifoddpage%\ifodd\value{mn@abspage}%
      \mnoteswestlink{#1}%
    \else%
      \mnoteseastlink{#1}%
    \fi%
  \else%
    \mnoteswestlink{#1}%
  \fi%
\fi%
}%
\newcommand{\mnoteseastlink}[1]{%
\begin{tikzpicture}[remember picture, overlay]%
 \draw[#1,-]%
 ([yshift=-0.2cm] textPOS)%
  -|([xshift=-0.1pt] notePOS.east);%
    \end{tikzpicture}%
}
\newcommand{\mnoteswestlink}[1]{%
\begin{tikzpicture}[remember picture, overlay]%
\draw[#1,-]%
([yshift=-0.2cm] textPOS)%
-|([xshift=-0.1pt] notePOS.west);%
  \end{tikzpicture}%
}
\fi
\newcommand{\MNOTE}{\MNOTEon}
\newcommand{\HideMNOTES}{\renewcommand{\MNOTE}[2][red]{}}
\newcommand{\ShowMNOTES}{\renewcommand{\MNOTE}{\MNOTEon}}
\newcommand{\ReverseMNConnect}{%
\if@mnotes@reverseconnect\@mnotes@reverseconnectfalse
\else\@mnotes@reverseconnecttrue\fi}
\endinput
%%
%% End of file `mnotes.sty'.