%%
%% 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/06/06 v1.1 - 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
\ProvidesPackage{linegoal}
         [2010/06/06 v1.1 - 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-\zref@extractdefault{linegoal.\the\LNGL@unique}{posx}0sp
            +\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'.
