blob: 2c7116f05b102cd3efd58c43ee603406ce28667b (
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
|
%%
%% This is file `linegoal.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% linegoal.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% linegoal : 2010/05/07 v1.0 - linegoal : a new dimen corresponding to the remainder of the line
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version. The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%%
%% This work consists of the main source file linegoal.dtx
%% and the derived files
%% linegoal.sty, linegoal.pdf, linegoal.ins,
%%
%% linegoal : linegoal : a new dimen corresponding to the remainder of the line
%% Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%%
\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX)
[2005/12/01]% LaTeX must be 2005/12/01 or younger (see kvsetkeys.dtx).
\ProvidesPackage{linegoal}
[2010/05/07 v1.0 - A new dimen corresponding to the remainder of the line]
\def\LNGL@pkg@name{linegoal}
\ifdefined\pdfsavepos\else
\PackageWarning\LNGL@pkg@name
{This package requires pdfTeX for its \string\pdfsavepos primitive\MessageBreak
pdfTeX has not been detected and \LNGL@pkg@name\space will not be loaded}%
\expandafter\endinput
\fi
\RequirePackage{etex,zref,zref-savepos}
\zref@newprop*{LNGL@page}[0]{\the\c@page}
\globcount\LNGL@unique
\def\linegoal{linegoal}
\def\set@linegoal#1#2{%
\@bsphack
\if@filesw
\global\advance\LNGL@unique\@ne
\pdfsavepos
\zref@labelbyprops{linegoal.\the\LNGL@unique}{posx,LNGL@page}%
#1=\dimexpr\linewidth-\zposx{linegoal.\the\LNGL@unique}sp%
+\ifodd\zref@extractdefault{linegoal.\the\LNGL@unique}{LNGL@page}{0}
\oddsidemargin
\else \evensidemargin
\fi
+1in+\hoffset
\relax
\fi
\@esphack
}% \set@linegoal
\AtBeginDocument\LNGL@AtBeginDocument@hook
\def\LNGL@AtBeginDocument@hook{%
\let\LNGL@ORI@setlength\setlength
\protected\def\setlength##1##2{%
\ifx\linegoal##2 \expandafter\set@linegoal
\else \expandafter\LNGL@ORI@setlength
\fi{##1}{##2}%
}% \setlength
}% \LNGL@AtBeginDocument@hook
\endinput
%%
%% End of file `linegoal.sty'.
|