summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/linegoal/linegoal.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-09-27 00:38:14 +0000
committerKarl Berry <karl@freefriends.org>2010-09-27 00:38:14 +0000
commit36e4bf755052bf5d5cef33cc2ffbad8f00b22163 (patch)
tree9198be602696e907e34ac521cc4dde651abf4ea4 /Master/texmf-dist/source/latex/linegoal/linegoal.dtx
parent4e856769d757755ecc9ce4e364fd1bb75ebbf408 (diff)
linegoal 2 (26sep10)
git-svn-id: svn://tug.org/texlive/trunk@19903 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/linegoal/linegoal.dtx')
-rw-r--r--Master/texmf-dist/source/latex/linegoal/linegoal.dtx149
1 files changed, 93 insertions, 56 deletions
diff --git a/Master/texmf-dist/source/latex/linegoal/linegoal.dtx b/Master/texmf-dist/source/latex/linegoal/linegoal.dtx
index 08a6339c1eb..9304d037154 100644
--- a/Master/texmf-dist/source/latex/linegoal/linegoal.dtx
+++ b/Master/texmf-dist/source/latex/linegoal/linegoal.dtx
@@ -1,5 +1,5 @@
% \iffalse meta-comment
-% linegoal : 2010/06/06 v1.1 - linegoal : a new dimen corresponding to the remainder of the line]
+% linegoal : 2010/09/25 v2.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
@@ -37,7 +37,7 @@
\tracingall \tracingonline=0
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: 2010/06/06 v1.1 - linegoal : a new dimen corresponding to the remainder of the line}
+\Msg{* Package: 2010/09/25 v2.0 - linegoal : a new dimen corresponding to the remainder of the line}
\Msg{************************************************************************}
\keepsilent
@@ -48,7 +48,7 @@
This is a generated file.
-linegoal : 2010/06/06 v1.1 - linegoal : a new dimen corresponding to the remainder of the line
+linegoal : 2010/09/25 v2.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
@@ -100,8 +100,8 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%<*driver>
\edef\thisfile{\jobname}
\def\thisinfo{A new ``dimen'' corresponding to the remainder of the line}
-\def\thisdate{2010/06/06}
-\def\thisversion{1.1}
+\def\thisdate{2010/09/25}
+\def\thisversion{2.0}
\def\CTANbaseurl{http://www.ctan.org/tex-archive/macros/latex}
\def\CTANdisplay{CTAN:macros/latex}
\makeatletter\protected\def\CTANhref{\@ifstar\CTANhrefstar\CTANhrefnost}\makeatother
@@ -115,6 +115,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\usepackage[T1]{fontenc}
\usepackage{etex,etoolbox,geometry,lastpage,tocloft,graphicx,xspace,tabularx,fancyhdr,color,bbding,embedfile,framed,multirow,txfonts,multirow,makecell,enumitem,arydshln,atveryend,catchfile}
\usepackage[hyperindex=false,pdfusetitle,colorlinks,pdfpagelabels,pdfencoding=auto]{hyperref}
+\csname endofdump\endcsname
\usepackage{holtxdoc}
\RequirePackage{grffile,eso-pic}% to include the example
\CodelineNumbered
@@ -138,7 +139,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%</driver>
% \fi
%
-% \CheckSum{75}
+% \CheckSum{133}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -215,6 +216,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \newrobustcmd\ie{\emph{ie.}}
% \newrobustcmd\textt[2][]{\texttt{#1#2}}
% \newcommand\cellstrut{}\let\cellstrut\bottopstrut
+% \DefineVerbatimEnvironment{Verb*}{Verbatim}{gobble=1,fontfamily=txtt,fontseries=m,commandchars=$()}
%
% \fancyhf{}\fancyhead[L]{\footnotesize\color[gray]{.35} The \thispackage package -- \thisinfo}
% \fancyfoot[L]{\color[gray]{.35}\scriptsize\thispackage\quad[rev.\thisversion]\quad\copyright\oldstylenums{2010}\,\lower.3ex\hbox{\NibRight}\,Florent Chervet}
@@ -254,19 +256,29 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% \deffootnote{1em}{0pt}{\rlap{\thefootnotemark.}\kern1em}
% \vspace*{-26pt}
-% \begin{abstract}\parindent0pt\noindent\leftskip1cm\rightskip\leftskip\lastlinefit0%
+% \begin{abstract}\parskip\medskipamount\parindent0pt\noindent\lastlinefit0\relax\linewidth\dimexpr\hsize-\leftmargin-\rightmargin\relax
%
% \thispackage provides a macro \csbf{linegoal} which expands to the dimension of the remainder of the line.
% It requires pdf\TeX{} for its \cs{pdfsavepos} primitive. Two compilations (at least) are necessary to get
% the correct line goal.
-% \medskip
%
-% More precisely: \cs{setlength} is overloaded so that:§
-% \hfil\cs{setlength}\cs{mydimen}\{\cs{linegoal}\}\hfil\null§
-% sets \cs{mydimen} to be the (horizontal) length of the remainder of the current line. This can be useful for
+% Saying:\par\vskip-2\parskip
+% \begin{Verb*}
+% \somedimen=\linegoal
+% ($nnn or:)
+% \setlength\somedimen{\linegoal}
+% \end{Verb*}
+% sets \cs{somedimen} to be the (horizontal) length of the remainder of the current line. This can be useful for
% use with \xpackage{tabularx} or \xpackage{tabular*} for example (see \nameref{userinterface}).
-% \medskip
-%
+%
+% More precisely:
+%
+% \begin{tabularx}\linewidth{lX}
+% At first run: &\cs{linegoal} expands to \cs{linewidth} and writes the correct line goal into the \xext{aux} file. \\
+% Other runs: &\cs{linegoal} expands to the value read in the \xext{aux} file and (eventually) updates the
+% correct line-goal into the \xext{aux} file, it its value has changed.
+% \end{tabularx}
+%
% \thispackage requires pdf\TeX{} and uses the \xpackage{zref-savepos} module of \Xpackage[/oberdiek/]{zref} package.
%
% \end{abstract}
@@ -288,7 +300,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% \section{User interface}
% \label{userinterface}
-%
+%
% \begin{VerbLines}
% This is a tabular that fills the remainder of the line:
% \begin{tabularx}\linegoal{|l|X|}\hline
@@ -296,10 +308,10 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% Something & Something else \\\hline
% \end{tabularx}
% \end{VerbLines}
-%
+%
% \DeleteShortVerb{\+}
% \tracingtabularx
-%
+%
% This is a tabular that fills the remainder of the line:
% \ifcsname ver@linegoal.sty\endcsname
% \begin{tabularx}\linegoal{|l|X|}\hline
@@ -312,8 +324,8 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% Something & Something else \\\hline
% \end{tabularx}%
% \fi
-%
-%
+%
+%
% \StopEventually{
% }
%
@@ -333,71 +345,96 @@ 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}
+ [2010/09/25 v2.0 - A new dimen corresponding to the remainder of the line]
% \end{macrocode}
%
% \subsection{Requirements}
%
% The package requires \xpackage{zref} and its module \xpackage{zref-savepos}.
%
+% It requires \xpackage{srclfile} for a patch when using the \xpackage{calc} package.
+%
% \begin{macrocode}
\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}%
+ \PackageWarning{linegoal}
+ {This package requires pdfTeX for its \string\pdfsavepos\space primitive\MessageBreak
+ pdfTeX has not been detected and linegoal.sty will not be loaded}%
\expandafter\endinput
\fi
-\RequirePackage{etex,zref,zref-savepos}
+\RequirePackage{etex,zref,zref-savepos,scrlfile}
% \end{macrocode}
-%
+%
% \subsection{zref property : page as arabic number}
-%
-% \begin{macrocode}
-\zref@newprop*{LNGL@page}[0]{\the\c@page}
-% \end{macrocode}
%
% \subsection{The linegoal macro}
%
%\begin{macro}{\linegoal}
% \begin{macrocode}
+\newcommand*\linegoal{%
+ \zref@extract{linegoal.\the\LNGL@unique}{linegoal}\LNGL@setlinegoal
+}% \linegoal
+\zref@newprop*{linegoal}[\the\linewidth]{\the\dimexpr
+ \linewidth-\the\pdflastxpos sp
+ +\ifodd\zref@extractdefault{linegoal/page.\the\LNGL@unique}{page}\c@page
+ \oddsidemargin
+ \else\evensidemargin
+ \fi
+ +1in+\hoffset
+ \relax
+}% linegoal zref-property
\globcount\LNGL@unique
-\def\linegoal{linegoal}
-\def\set@linegoal#1#2{%
+\globdimen\LNGL@tempdim
+\let\LNGL@calc@stop=\relax
+\let\LNGL@calc@cleanup\relax
+\AfterPackage*{calc}{%
+ \let\LNGL@calc@stop=!%
+ \def\LNGL@calc@cleanup!{}%
+}
+\def\LNGL@setlinegoal{\relax\csname LNGL@set\ifdefined\calc@next!\fi\endcsname}
+\expandafter\def\csname LNGL@set!\endcsname!{!\LNGL@set}
+\protected\def\LNGL@set{%
\@bsphack
\if@filesw
+ \pdfsavepos
+ \zref@refused{linegoal.\the\LNGL@unique}%
+ \LNGL@tempdim\zref@extractdefault{linegoal.\the\LNGL@unique}{linegoal}\maxdimen
+ \zref@labelbyprops{linegoal/page.\the\LNGL@unique}{page,posx}%
+ \zref@labelbyprops{linegoal.\the\LNGL@unique}{linegoal}%
+ \ifdim\zref@extract{linegoal.\the\LNGL@unique}{linegoal}=\LNGL@tempdim
+ \else \expandafter\LNGL@warn%
+ \number\zref@extractdefault{linegoal/page.\the\LNGL@unique}{page}\c@page\relax
+ \fi
\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
+ \else\LNGL@noauxerr
\fi
- \@esphack
+ \@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
-% \end{macrocode}
-%\end{macro}
-
-% \begin{macrocode}
+\def\LNGL@warn#1\relax{\PackageWarning{linegoal}
+ {\string\linegoal\space value on page #1
+ \MessageBreak has changed since last run
+ \MessageBreak Please rerun to get correct values}%
+}% \LNGL@warn
+\def\LNGL@noauxerr{\PackageError{linegoal}
+ {\string\linegoal\space does not work if output file are disabled
+ \MessageBreak please check the value of \string\if@filesw!}\@ehd
+}% \LNGL@noauxerr
%</package>
% \end{macrocode}
+%\end{macro}
%
% \DeleteShortVerb{\+}
% \begin{History}
-%
+%
+% \begin{Version}{2010/09/25 v2.0}
+% \item New approach: \cs{setlength} is not used anymore. \\
+% \cs{linegoal} behaves more like a real dimen. \\
+% code like: \cs{hspace}\textasteriskcentered\cs{linegoal} is now possible.
+% \end{Version}
+%
+% \begin{Version}{2010/06/20 v1.2}
+% \item Modification in warning message...
+% \end{Version}
+%
% \begin{Version}{2010/06/06 v1.1}
% \item The first release required some small corrections !
% \end{Version}
@@ -417,7 +454,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \CTAN{macros/latex/contrib/oberdiek/}.
%
% \end{thebibliography}
-%
+% \clearpage
% \PrintIndex
%
% \Finale \ No newline at end of file