| 1 |
%% `vplref.sty' |
| 2 |
%% -- extended line number referencing with lineno.sty. |
| 3 |
|
| 4 |
\def\filedate{2005/04/25} \def\fileversion{0.2a} |
| 5 |
|
| 6 |
%% Copyright (C) 2004, 2005 Uwe Lück |
| 7 |
%% -- support of lineno.sty for varioref.sty. |
| 8 |
|
| 9 |
%% This file can be redistributed and/or modified under |
| 10 |
%% the terms of the LaTeX Project Public License; either |
| 11 |
%% version 1.3 of the License, or any later version. |
| 12 |
%% The latest version of this license is in |
| 13 |
%% http://www.latex-project.org/lppl.txt |
| 14 |
%% We did our best to help you, but there is NO WARRANTY. |
| 15 |
|
| 16 |
%% USAGE: |
| 17 |
% |
| 18 |
% \vpagelineref{<label>} expands to |
| 19 |
% |
| 20 |
% a) \ref{<label>} |
| 21 |
% -- if on same page as \linelabel{<label>} |
| 22 |
% |
| 23 |
% b) \LineWithPage{<label>} -- otherwise. |
| 24 |
% |
| 25 |
% \LineWithPage{<label>} expands -- by default -- to |
| 26 |
% |
| 27 |
% \pageref{<label>}.\ref{<label>} |
| 28 |
% |
| 29 |
% This can be customized by editing |
| 30 |
% |
| 31 |
% \renewcommand*{\LineWithPage}[1]{\pageref{#1}.\ref{#1}} |
| 32 |
% |
| 33 |
% in your document preamble, after vplref.sty has been loaded |
| 34 |
% (which may have happened through lineno.sty with option |
| 35 |
% `addpageno'). |
| 36 |
|
| 37 |
%% IMPLEMENTATION: |
| 38 |
|
| 39 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] %% \Declare...* |
| 40 |
\ProvidesPackage{vplref}[\filedate\space v\fileversion \space |
| 41 |
page-line cross-refs] %% UL 2011/02/13 |
| 42 |
|
| 43 |
\AtBeginDocument{\RequirePackage{lineno,varioref}} |
| 44 |
|
| 45 |
%% Anderer Ansatz: GPNo (\FirstOnPage) |
| 46 |
|
| 47 |
\DeclareRobustCommand*\vpagelineref[1]{{% |
| 48 |
% \def\reftextcurrent{\lineref{#1}}%% First vpageref arg. |
| 49 |
\let\reftextfaraway\LineWithPage |
| 50 |
\def\reftextafter{\reftextfaraway{#1}}% |
| 51 |
\let\reftextbefore\reftextafter |
| 52 |
\let\reftextfaceafter\reftextafter |
| 53 |
\let\reftextfacebefore\reftextafter |
| 54 |
%% <- Looks somewhat stupid, but varioref.sty has its merits |
| 55 |
%% as compared with the mechanism in ednotes.sty. |
| 56 |
\vpageref[\ref{#1}][]{#1}%% The robust alternative. |
| 57 |
%% Here and with \LineWithPage, \lineref seems more appropriate |
| 58 |
%% than \ref, but it produces errors when labels have not been |
| 59 |
%% defined. This seems to be an incompatibility with lineno.sty. |
| 60 |
}} |
| 61 |
|
| 62 |
%% Customizable format for different page: |
| 63 |
\newcommand*\LineWithPage[1]{\pageref{#1}.\ref{#1}} |
| 64 |
|
| 65 |
\endinput |
| 66 |
|
| 67 |
VERSION HISTORY: |
| 68 |
v0.1 2004/10/19 First, sent to Sergei Mariev. |
| 69 |
v0.11 2004/10/19 Fit to recent varioref version; |
| 70 |
sent to Sergei. |
| 71 |
v0.2 2005/04/25 \Require... \AtBeginDocument. |
| 72 |
v0.2a 2011/02/13 add. caption to \ProvidesPackage |