%% LaTeX2e file `vertbars.sty'
%% generated by the `filecontents' environment
%% from source `vertbars' on 2010/11/27.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{vertbars}[2010/11/27 v1.0b vertical bars in the margin]

\newcommand{\LNenv}{runninglinenumbers}
\DeclareOption{switch}{%
  \renewcommand{\LNenv}{runningpagewiselinenumbers}
  \PassOptionsToPackage{\CurrentOption}{lineno}
}

\DeclareOption{switch*}{%
  \renewcommand{\LNenv}{runningpagewiselinenumbers}
  \PassOptionsToPackage{\CurrentOption}{lineno}
}

\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{lineno}}
\ProcessOptions\relax
\RequirePackage{lineno}

% Code to add stuff at start and end of a pre-existing zero argument macro:
\newcommand{\addtodef}[3]{\begingroup
  \@temptokena{#2}%
  \toks@\expandafter{#1#3}%
  \edef\x{\endgroup
    \def\noexpand#1{\the\@temptokena \the\toks@}}%
  \x
}

% It's useful to preserve \cmd\baselineskip:
\newlength{\pwvbbl}
\setlength{\pwvbbl}{\baselineskip}

% Width of bars:
\newlength{\barwidth}
\setlength{\barwidth}{0.4pt}

% Horizontal space between bars:
\newlength{\barspace}
\setlength{\barspace}{0.5\linenumbersep}

\newcommand{\addtomakeLNL}{{\rule[-0.25\pwvbbl]{\barwidth}{1.1\pwvbbl}\hskip\barspace\relax}}
\newcommand{\pwvbLNL}{}

\newenvironment{vertbar}{%
  \pagewiselinenumbers % <= added v1.0b
  \begin{\LNenv}%
    \addtodef{\pwvbLNL}{}{\addtomakeLNL}%
    \let\LineNumber\pwvbLNL
}{%
  \end{\LNenv}%
}

