%% `vplref.sty' 
%% -- extended line number referencing with lineno.sty. 

\def\filedate{2005/04/25} \def\fileversion{0.2a}

%% Copyright (C) 2004, 2005 Uwe Lueck, 
%% http://contact-ednotes.sty.de.vu --author-maintained 
%% -- support of lineno.sty for varioref.sty. 

%% This file can be redistributed and/or modified under 
%% the terms of the LaTeX Project Public License; either 
%% version 1.3 of the License, or any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% We did our best to help you, but there is NO WARRANTY. 

%% USAGE: 
%
% \vpagelineref{<label>} expands to 
%
% a) \ref{<label>} 
%    -- if on same page as \linelabel{<label>}
% 
% b) \LineWithPage{<label>} -- otherwise. 
% 
% \LineWithPage{<label>} expands -- by default -- to 
% 
%   \pageref{<label>}.\ref{<label>}
% 
% This can be customized by editing 
% 
%   \renewcommand*{\LineWithPage}[1]{\pageref{#1}.\ref{#1}} 
% 
% in your document preamble, after vplref.sty has been loaded 
% (which may have happened through lineno.sty with option 
% `addpageno'). 

%% IMPLEMENTATION: 

\NeedsTeXFormat{LaTeX2e}[1994/12/01] %% \Declare...* 
\ProvidesPackage{vplref}[\filedate\space v\fileversion \space
                         page-line cross-refs] %% UL 2011/02/13

\AtBeginDocument{\RequirePackage{lineno,varioref}} 

%% Anderer Ansatz: GPNo (\FirstOnPage) 

\DeclareRobustCommand*\vpagelineref[1]{{% 
%   \def\reftextcurrent{\lineref{#1}}%% First vpageref arg. 
  \let\reftextfaraway\LineWithPage 
  \def\reftextafter{\reftextfaraway{#1}}% 
  \let\reftextbefore\reftextafter 
  \let\reftextfaceafter\reftextafter 
  \let\reftextfacebefore\reftextafter 
%% <- Looks somewhat stupid, but varioref.sty has its merits 
%%    as compared with the mechanism in ednotes.sty. 
  \vpageref[\ref{#1}][]{#1}%% The robust alternative. 
%% Here and with \LineWithPage, \lineref seems more appropriate 
%% than \ref, but it produces errors when labels have not been 
%% defined. This seems to be an incompatibility with lineno.sty. 
}} 

%% Customizable format for different page: 
\newcommand*\LineWithPage[1]{\pageref{#1}.\ref{#1}}

\endinput 

VERSION HISTORY: 
v0.1   2004/10/19  First, sent to Sergei Mariev. 
v0.11  2004/10/19  Fit to recent varioref version; 
                   sent to Sergei. 
v0.2   2005/04/25  \Require... \AtBeginDocument. 
v0.2a  2011/02/13  add. caption to \ProvidesPackage

