%%
%% This is file `proofread.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% proofread.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from proofread.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file proofread.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\NeedsTeXFormat{LaTeX2e}[2021/11/15]
\ProvidesPackage{proofread}
    [2022/03/17 v1.00 Commands for inserting annotations]

\RequirePackage{marginnote}
\ifx\undefined\DoubleSpacing
  \RequirePackage{setspace}
\else
  \let\setstretch\setSpacing
  \let\onehalfspacing\OnehalfSpacing
  \let\doublespacing\DoubleSpacing
\fi
\newif\ifPR@spaced\PR@spacedfalse
\newdimen\PR@unit\PR@unit.6\baselineskip
\DeclareOption{onehalfspacing}{\onehalfspacing\PR@spacedtrue\PR@unit.525\baselineskip}
\DeclareOption{doublespacing}{\doublespacing\PR@spacedtrue\PR@unit.35\baselineskip}
\newif\ifPR@corrected\PR@correctedfalse
\newif\ifPR@uncorrected\PR@uncorrectedfalse
\DeclareOption{corrected}{\PR@correctedtrue}
\DeclareOption{uncorrected}{\PR@uncorrectedtrue}
\newif\ifPR@frame\PR@framefalse
\newdimen\PR@lw\PR@lw=0pt
\DeclareOption{frame}{\PR@lw=.5pt\PR@frametrue}
\ProcessOptions
\RequirePackage{soul}
\RequirePackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathmorphing}

\newcommand{\PR@defhiliter}[3][]{%
  \tikzset{every hiliter/.style={fill=#2,fill opacity=#3, #1}}%
}

\PR@defhiliter{yellow}{.25}

\newcommand{\PR@hilite@Dohilite}{
  \fill [ decoration = {random steps, amplitude=1pt, segment length=15pt}
        , outer sep = -15pt, inner sep = 0pt, decorate
        , every hiliter, this hiliter ]
        ($(begin hilite)+(0,8pt)$) rectangle ($(end hilite)+(0,-3pt)$) ;
}

\newcommand{\PR@hilite@Beginhilite}{
  \coordinate (begin hilite) at (0,0) ;
}

\newcommand{\PR@hilite@Endhilite}{
  \coordinate (end hilite) at (0,0) ;
}

\newdimen\PR@hilite@previous
\newdimen\PR@hilite@current

\DeclareRobustCommand*\hilite[1][]{%
  \ifPR@frame%
    \tikzset{this hiliter/.style={#1,draw=black,line width=\PR@lw}}%
  \else%
    \tikzset{this hiliter/.style={#1}}%
  \fi
  \SOUL@setup
  %
  \def\SOUL@preamble{%
    \begin{tikzpicture}[overlay, remember picture]
      \PR@hilite@Beginhilite
      \PR@hilite@Endhilite
    \end{tikzpicture}%
  }%
  %
  \def\SOUL@postamble{%
    \begin{tikzpicture}[overlay, remember picture]
      \PR@hilite@Endhilite
      \PR@hilite@Dohilite
    \end{tikzpicture}%
  }%
  %
  \def\SOUL@everyhyphen{%
    \discretionary{%
      \SOUL@setkern\SOUL@hyphkern
      \SOUL@sethyphenchar
      \tikz[overlay, remember picture] \PR@hilite@Endhilite ;%
    }{%
    }{%
      \SOUL@setkern\SOUL@charkern
    }%
  }%
  %
  \def\SOUL@everyexhyphen##1{%
    \SOUL@setkern\SOUL@hyphkern
    \hbox{##1}%
    \discretionary{%
      \tikz[overlay, remember picture] \PR@hilite@Endhilite ;%
    }{%
    }{%
      \SOUL@setkern\SOUL@charkern
    }%
  }%
  %
  \def\SOUL@everysyllable{%
    \begin{tikzpicture}[overlay, remember picture]
      \path let \p0 = (begin hilite), \p1 = (0,0) in \pgfextra
        \global\PR@hilite@previous=\y0
        \global\PR@hilite@current =\y1
      \endpgfextra (0,0) ;
      \ifdim\PR@hilite@current < \PR@hilite@previous
        \PR@hilite@Dohilite
        \PR@hilite@Beginhilite
      \fi
    \end{tikzpicture}%
    \the\SOUL@syllable
    \tikz[overlay, remember picture] \PR@hilite@Endhilite ;%
  }%
  \SOUL@
}
\AtBeginDocument{\marginparpush2pt}
\ifx\undefined\marginparmargin\else\marginparmargin{outer}\fi
\newcount\PR@markerno\PR@markerno=1
\newcommand{\com}[1]{%
  \marginnote{%
    \setstretch{1}%
    \raggedright%
    \footnotesize%
    \the\PR@markerno: #1%
  }[\PR@skip]%
  \global\PR@skip0pt
  \global\advance\PR@markerno1%
}
\newdimen\PR@skip\PR@skip0\PR@unit
\newcommand{\skp}[1][1]{%
 \PR@skip#1\PR@unit%
}
\newcommand{\del}[1]{%
  \com{delete}%
  \hilite[red]{#1}%
}
\newcommand{\yel}[2][]{%
  \com{#1}%
  \hilite{#2}%
}
\newcommand{\add}[1]{%
  \com{add}%
  \hilite[green]{#1}%
}
\newcommand{\rep}[2]{%
  \com{was: #1}%
  \hilite[blue]{#2}%
}
\ifPR@uncorrected
  \ifPR@corrected
    \PackageError{proofread}
      {corrected and uncorrected options are mutually exclusive}
      {You may not use both the corrected and uncorrected options}
  \fi
  \def\com#1{} \def\add#1{} \def\del#1{#1} \def\rep#1#2{#1}
  \renewcommand{\yel}[2][]{#2}\renewcommand{\hilite}[2][]{#2}
\else
  \ifPR@corrected
    \def\com#1{} \def\add#1{#1} \def\del#1{} \def\rep#1#2{#2}
    \renewcommand{\yel}[2][]{#2}\renewcommand{\hilite}[2][]{#2}
  \fi
\fi
\endinput
%%
%% End of file `proofread.sty'.
