summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/lineno/vplref.sty
blob: d3b0697f131f45134f8460720e6102bd5cf494df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
%% `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