summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/linegoal/linegoal.dtx
blob: baeae66608b98bb72ccd84bb8490cd6eaca770c6 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
% \iffalse meta-comment
% linegoal : 2010/12/07 v2.7 - 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
%
% Unpacking:
%    (a) If linegoal.ins is present:
%           etex linegoal.ins
%    (b) Without linegoal.ins:
%           etex linegoal.dtx
%    (c) If you insist on using LaTeX
%           latex \let\install=y\input{linegoal.dtx}
%        (quote the arguments according to the demands of your shell)
%
% Documentation:
%           (pdf)latex linegoal.dtx
% Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%<*ignore>
\begingroup
  \def\x{LaTeX2e}%
\expandafter\endgroup
\ifcase 0\ifx\install y1\fi\expandafter
         \ifx\csname processbatchFile\endcsname\relax\else1\fi
         \ifx\fmtname\x\else 1\fi\relax
\else\csname fi\endcsname
%</ignore>
%<*install>
\input docstrip.tex
\tracingall \tracingonline=0
\Msg{************************************************************************}
\Msg{* Installation}
\Msg{* Package: 2010/12/07 v2.7 - linegoal : a new dimen corresponding to the remainder of the line}
\Msg{************************************************************************}

\keepsilent
\askforoverwritefalse

\let\MetaPrefix\relax
\preamble

This is a generated file.

linegoal : 2010/12/07 v2.7 - 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>

\endpreamble
\let\MetaPrefix\DoubleperCent

\generate{%
   \file{linegoal.ins}{\from{linegoal.dtx}{install}}%
   \file{linegoal.sty}{\from{linegoal.dtx}{package}}%
}

\askforoverwritefalse
\generate{%
   \file{linegoal.drv}{\from{linegoal.dtx}{driver}}%
}

\obeyspaces
\Msg{************************************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the following}
\Msg{* file into a directory searched by TeX:}
\Msg{*}
\Msg{*     linegoal.sty}
\Msg{*}
\Msg{* To produce the documentation run the file `linegoal.dtx'}
\Msg{* through LaTeX.}
\Msg{*}
\Msg{* Happy TeXing!}
\Msg{*}
\Msg{************************************************************************}

\endbatchfile
%</install>
%<*ignore>
\fi
%</ignore>
%<*driver>
\edef\thisfile{\jobname}
\def\thisinfo{A new ``dimen'' corresponding to the remainder of the line}
\def\thisdate{2010/12/07}
\def\thisversion{2.7}
\def\CTANbaseurl{http://www.ctan.org/tex-archive/}
\def\CTANhref#1#2{\href{\CTANbaseurl/help/Catalogue/entries/#1.html}{\nolinkurl{CTAN:help/Catalogue/entries/#1.html}}}
\let\loadclass\LoadClass
\def\LoadClass#1{\loadclass[abstracton]{scrartcl}\let\scrmaketitle\maketitle\AtEndOfClass{\let\maketitle\scrmaketitle}}
\PassOptionsToPackage{svgnames}{xcolor}
\documentclass[a4paper,oneside,american,latin1,T1]{ltxdoc}
\AtBeginDocument{\DeleteShortVerb{\|}}
\usepackage{inputenc,babel}
\usepackage[T1]{fontenc}
\usepackage{etoolbox,geometry,xcolor,bbding,txfonts,xspace,hologo,graphicx}
\usepackage{lastpage,fancyhdr,titlesec,enumitem,framed,tocloft,multirow,makecell}
\usepackage[linegoal,delarray]{tabu}
\usepackage{embedfile}
\usepackage{interfaces}
\CodelineNumbered\lastlinefit999
\usepackage{holtxdoc,bookmark}
\usepackage{linegoal}
\usepackage{fancyvrb}\fvset{gobble=1,listparameters={\topsep=0pt}}
\usepackage{tabularx}
\csname endofdump\endcsname
\hypersetup{%
  pdftitle={The linegoal package},
  pdfsubject={A new dimen corresponding to the remainder of the line},
  pdfauthor={Florent CHERVET},
  colorlinks,linkcolor=reflink,
  pdfstartview=FitH,
  pdfkeywords={TeX, LaTeX, e-TeX, pdfTeX, package, zref, linegoal}}
\embedfile{\thisfile.dtx}
\geometry{top=0pt,headheight=.6cm,includehead,headsep=.6cm,bottom=1.4cm,footskip=.5cm,left=2.5cm,right=1cm}
\begin{document}
   \DocInput{\thisfile.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{149}
%
% \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
%   Lower-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
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs,\~,\@ifpackagelater,\z@,\@ne,\end,\endinput}
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\GetFileInfo}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\filename,\fileversion,\filedate,\let}
% \DoNotIndex{\@listctr,\@nameuse,\csname,\else,\endcsname,\expandafter}
% \DoNotIndex{\gdef,\global,\if,\item,\newcommand,\nobibliography}
% \DoNotIndex{\par,\providecommand,\relax,\renewcommand,\renewenvironment}
% \DoNotIndex{\stepcounter,\usecounter,\nocite,\fi}
% \DoNotIndex{\@fileswfalse,\@gobble,\@ifstar,\@unexpandable@protect}
% \DoNotIndex{\AtBeginDocument,\AtEndDocument,\begingroup,\endgroup}
% \DoNotIndex{\frenchspacing,\MessageBreak,\newif,\PackageWarningNoLine}
% \DoNotIndex{\protect,\string,\xdef,\ifx,\texttt,\@biblabel,\bibitem}
% \DoNotIndex{\z@,\wd,\wheremsg,\vrule,\voidb@x,\verb,\bibitem}
% \DoNotIndex{\FrameCommand,\MakeFramed,\FrameRestore,\hskip,\hfil,\hfill,\hsize,\hspace,\hss,\hbox,\hb@xt@,\endMakeFramed,\escapechar}
% \DoNotIndex{\do,\date,\if@tempswa,\@tempdima,\@tempboxa,\@tempswatrue,\@tempswafalse,\ifdefined,\ifhmode,\ifmmode,\cr}
% \DoNotIndex{\box,\author,\advance,\multiply,\Command,\outer,\next,\leavevmode,\kern,\title,\toks@,\trcg@where,\tt}
% \DoNotIndex{\the,\width,\star,\space,\section,\subsection,\textasteriskcentered,\textwidth}
% \DoNotIndex{\",\:,\@empty,\@for,\@gtempa,\@latex@error,\@namedef,\@nameuse,\@tempa,\@testopt,\@width,\\,\m@ne,\makeatletter,\makeatother}
% \DoNotIndex{\maketitle,\parindent,\setbox,\x,\kernel@ifnextchar}
% \makeatletter
% \parindent\z@\parskip.4\baselineskip\topsep\parskip\partopsep\z@
% \newrobustcmd*\FC{{\color{copper}\usefont{T1}{fts}xn FC}}
% \newrobustcmd\ClearPage{\@ifstar\clearpage{}}
% \def\M{\@ifstar{\M@i\@firstofone}{\M@i\meta}}
% \def\M@i#1{\@ifnextchar[^^A]
%   {\M@square#1}
%   {\@ifnextchar(^^A)
%     {\M@paren#1}
%     {\M@brace#1}}^^A
% }
% \def\M@square#1[#2]{\M@Bracket[{#1{#2}}]}
% \def\M@paren#1(#2){\M@Bracket({#1{#2}})}
% \def\M@brace#1#2{\M@Bracket\{{#1{#2}}\}}
% \def\M@Bracket#1#2#3{{\ttfamily#1#2#3}}
% \def\pkgcolor{\color{pkgcolor}}\colorlet{pkgcolor}{teal}
% \catcode`\§ \active   \def§{\@ifnextchar §{\par\nobreak\vskip-2\parskip}{\par\nobreak\vskip-\parskip}}
% \def\thispackage{\xpackage{{\pkgcolor\thisfile}}\xspace}
% \def\ThisPackage{\Xpackage{\thisfile}\xspace}
% \def\Xpackage{\@dblarg\X@package}
% \def\X@package[#1]#2{\@testopt{\X@@package{#1}{#2}}{}}
% \def\X@@package#1#2[#3]{\xpackage{#2\footnote{\noindent\xpackage{#2}: \CTANhref{#1}#3}}\xspace}
% \def\XPackage#1{\href{\CTANbaseurl/help/Catalogue/entries/#1.html}{\xpackage{#1}}}
% \newrobustcmd*\thisyear{\begingroup
%    \def\thisyear##1/##2\@nil{\endgroup
%       \oldstylenums{##1\ifnum##1=\year\else\,\textendash\,\the\year\fi}%
%    }\expandafter\thisyear\thisdate\@nil
% }
% \newcommand\macrocodecolor{\color{macrocode}}\definecolor{macrocode}{rgb}{0.08,0.00,0.15}
% \newcommand\reflinkcolor{\color{reflink}}\colorlet{reflink}{DarkSlateBlue}
% \newrobustcmd\stform{\@ifnextchar*{\@stform[]\textasteriskcentered\@gobble}\@stform}
% \newrobustcmd\@stform[2][\string]{\texttbf{#1#2}\xspace}
% \DefineVerbatimEnvironment{VerbLines}{Verbatim}{gobble=1,frame=lines,framesep=6pt,fontfamily=\ttdefault,fontseries=m}
% \DefineVerbatimEnvironment{Verb*}{Verbatim}{gobble=1,fontfamily=\ttdefault,fontseries=m,commandchars=$()}
% \def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}}
% \newcommand\texorpdf[2]{\texorpdfstring{#1{#2}}{#2}}
% \renewrobustcmd\#[1]{{\usefont{T1}{pcr}{bx}{n}\char`\##1}}
% \newrobustcmd\csred[1]{\textcolor{red}{\cs{#1}}}
% \renewrobustcmd\cs[2][]{\mbox{\ttfamily#1\expandafter\@gobble\string\\#2}}
% \newrobustcmd\csbf[2][]{\textbf{\cs[{#1}]{#2}}}
% \newcommand\textt[1]{\texorpdf\texttt{#1}}
% \newcommand\texttbf[1]{\textt{\bfseries#1}}
% \newcommand\nnn{\normalfont\mdseries\upshape}\newcommand\nbf{\normalfont\bfseries\upshape}
% \newrobustcmd*\blue{\color{blue}}\newcommand*\red{\color{dr}}\newcommand*\green{\color{green}}\newcommand\rred{\color{red}}
% \definecolor{copper}{rgb}{0.67,0.33,0.00}  \newcommand\copper{\color{copper}}
% \definecolor{dg}{rgb}{0.02,0.29,0.00}      \newcommand\dg{\color{dg}}
% \definecolor{db}{rgb}{0,0,0.502}           \newcommand\db{\color{db}}
% \definecolor{dr}{rgb}{0.49,0.00,0.00}      \let\dr\red
% \definecolor{lk}{rgb}{0.2,0.2,0.2}         \newrobustcmd\lk{\color{lk}}
% \newrobustcmd\bk{\color{black}}
% \newrobustcmd\ie{\emph{ie.}}
% \let\cellstrut\bottopstrut
% \let\plainllap\llap
% \newrobustcmd\macro@llap[1]{\global\let\llap\plainllap\setbox0\hbox{#1}^^A
%  \ifdim\wd0>2cm\hbox to\z@{\hss\hbox to2cm{#1\hss}}^^A
%        \edef\@tempa{\the\everypar\hskip\dimexpr\the\wd0-2cm\relax\global\everypar{}}%
%            \global\everypar\expandafter{\@tempa}^^A
%  \else\hbox to\z@{\hss#1}\fi
%  \setbox\z@\box\voidb@x}
% \pretocmd\macro{\MacrocodeTopsep=\z@skip\MacroTopsep\z@skip\let\llap\macro@llap\parsep=\z@\topsep=\z@\itemsep=\z@\partopsep\z@}{}{}
% \apptocmd\endmacro{\goodbreak\vskip.3\parskip}{}{}
%  \sectionformat\section[hang]{
%     bookmark={color=MidnightBlue},
%     bottom=\smallskipamount,top=\medskipamount,
%  }
% \pagesetup{%
%  norules,
%  font=\scriptsize\color[gray]{.55},
%  head/color=pkgcolor,
%  head/left=\moveleft1cm\vbox to\z@{\vss\setbox0=\null\ht0=\z@\wd0=\paperwidth\dp0=\headheight\rlap{\colorbox{Ivory}{\box0}}}\vskip-\headheight\thispackage,
%  head/right=\thisinfo,
%  foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\copyright\,\thisyear\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC}}}},
%  left/offset=1.5cm,
%  right/offset=.5cm,
%  foot/right=\oldstylenums{\arabic{page}}/\oldstylenums{\pageref{LastPage}},
%  }
% \pagestyle{fancy}
% \pagesetup[plain]{%
%     norules,font=\scriptsize,
%     left/offset=1.5cm,
%     foot/right/font=\scriptsize\color[gray]{.55},
%     foot/right=\oldstylenums{\arabic{page}}/\oldstylenums{\pageref{LastPage}},
%     foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\copyright\,\thisyear\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC\quad \xemail{florent.chervet at free.fr}}}}},
% }
% \bookmarksetup{openlevel=3}
% \makeatother
%
% \deffootnote{1em}{0pt}{\rlap{\textsuperscript{\thefootnotemark}}\kern1em}
% \title{\vspace*{-28pt}\mdseries The {\bfseries\thispackage\footnotemark}\kern.6em package}
% \author{\small\thisdate~--~version \thisversion}
% \date{}
% \subtitle{\LARGE A new ``dimen'' corresponding to the remainder of the line\endgraf{\small\FC}}
% \maketitle
%
% \makeatletter\begingroup\let\@thefnmark\@empty\let\@makefntext\@firstofone
% \footnotetext{\noindent
% This documentation is produced with the +DocStrip+ utility.
% \begin{tabbing}
% \qquad\=\smex\=To get the documentation, \= run (thrice):\quad\= \textt{pdflatex \thisfile.dtx} \\
% \qquad\>\>To get the index, \> run:\>\texttt{makeindex -s gind.ist \thisfile.idx} \\
% \>\smex\>To get the package, \> run:\>        \texttt{etex \thisfile.dtx}
% \end{tabbing}§
% The \xext{dtx} file is embedded into this pdf file thank to \xpackage{embedfile} by H. Oberdiek.}
% \endgroup\makeatother
%
% \deffootnote{1em}{0pt}{\rlap{\thefootnotemark.}\kern1em}
% {\vspace*{-16pt}\let\quotation\relax
% \begin{abstract}\parskip\medskipamount\parindent0pt\lastlinefit0\relax\rightskip1.5cm\leftskip\rightskip\advance\linewidth by-2\leftskip
%
% \thispackage provides a macro \csbf{linegoal} which expands to the dimension of the remainder of the line.
% It requires \hologo{pdfTeX} for its \cs{pdfsavepos} primitive. With \hologo{pdfTeX}, \cs{pdfsavepos} works
% in \textt{pdf} mode (\cs{pdfoutput}>0) \textbf{and also in} \textt{dvi} mode (\cs{pdfoutput}=0).
% Two compilations (at least) are necessary to get the correct line goal.§
% {\centering\extrarowheight\parskip
% \begin{tabular}{ll}
% Saying:       &\Verb+\somedimen = \linegoal+            \\
% or:           &\Verb+\setlength \somedimen {\linegoal}+
% \end{tabular}\par}
%
% sets \cs{somedimen} to be the (horizontal) length of the remainder of the current line. This can be useful for
% use with \XPackage{tabu},\, \XPackage{tabularx},\, or\, \textt{tabular\stform*}\, for example.§
% {\centering\extrarowheight\parskip
% \begin{tabu} to\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, if the value has changed.
% \end{tabu}\par}
%
% \textbf{Limitation:} if \cs{linegoal} is used inside an expression with \cs{dimexpr}, \cs{glueexpr} or
% inside \cs{setlength} (package \xpackage{calc}), then \cs{linegoal} must be at the very last position in the expression:
%
%
% \begin{tabu}to\linewidth{XX[-1m]}
% \begin{tabu}[c].{X}\}
% \verbatim{^^A
%  \begin{tabu} to\dimexpr-2in + .5\linegoal{XX} ....^^@
%  \setlength \dimen@ {-2in + .5\linegoal}}
% \end{tabu}
%  &
%  are admissible
% \end{tabu}
%
%
% \thispackage requires pdf\TeX{} (in \textt{pdf} or \textt{dvi} mode)
% and the module \xpackage{zref-savepos} of \XPackage{zref} package.
%
% \end{abstract}}
%
% \tocsetup{%
%  section/skip=4pt plus2pt minus2pt,
%  subsection/skip=0pt plus2pt minus2pt,
%  section/dotsep,subsection/dotsep=,subsection/pagenumbers=off,
%  dotsep=1.5mu,
%  dot=\hbox{\scriptsize.},
%  title=Contents\quad\leaders\vrule height3.4pt depth-3pt\hfill\null,
%  title/bottom=6pt,
%  after=\leavevmode\hrule,
%  columns=2,
%  }
%
% \tableofcontents
%
% \clearpage \bookmarksetup{bold*}
%
% \section{User interface}
% \label{userinterface}
%
% \subsection{\cs{linegoal}: a macro which behaves mostly like a \textt{dimen}}
%
% The first aim of \cs{linegoal} is to give a facility to get the length of the remainder of the line.
% This is possible with \hologo{pdfTeX} and its \cs{pdfsavepos} primitive. For convenience, \thispackage loads
% and uses the \xpackage{zref-savepos} package from H. Oberdiek.
%
% \cs{pdfsavepos} is supplied by \hologo{pdfTeX} in both \textt{pdf} and \textt{dvi} modes. If the document
% is not compiled with \hologo{pdfTeX} then \cs{linegoal} will expand to \cs{linewidth} in any case.
%
% \begin{VerbLines}
% This is a tabularx that fills the remainder of the line:
%     \begin{tabularx}\linegoal{|l|X|}\hline
%        Something & Something else \\
%        Something & Something else \\\hline
%     \end{tabularx}
% \end{VerbLines}
%
% \textbf{Typical application is for tabulars of variable width} like \xpackage{tabularx} or \xpackage{tabu}.
% Package \xpackage{tabu} has a \textt{linegoal} option to use \cs{linegoal} as default target for the whole
% tabular.
%
%
% This is a \textt{tabularx} that fills the remainder of the line:
% \begin{tabularx}\linegoal{|l|X|}\hline
%  Something & Something else \\
%  Something & Something else \\\hline
% \end{tabularx}
%
% \begin{VerbLines}
% This is a tabu that fills the half of the remainder of the line:
%     $\begin{tabu}to .5\linegoal{|[red]X[$c]|[red]X[2$c]|[red]}  \tabucline[red]-
%        \alpha & \beta    \\ \tabucline[on 2pt,red]-
%        \gamma & \delta   \\ \tabucline[red]-
%     \end{tabu}$
% \end{VerbLines}
%
% This is a \textt{tabu} that fills the half of the remainder of the line:
%     $\begin{tabu}to .5\linegoal{|[red]X[$c]|[red]X[2$c]|[red]} \tabucline[red]-
%        \alpha & \beta    \\ \tabucline[on 2pt,red]-
%        \gamma & \delta   \\ \tabucline[red]-
%     \end{tabu}$ 
%
% Please, refer to \xpackage{tabu} documentation for more information on the preamble and
% the command \cs{tabucline} used here as an example.
%
% \subsection{The \textt{verbose} package option}
%
% You can load \thispackage with the \M*[verbose] option to get the line-goals
% as information in your \xext{log} file.
%
%
% \StopEventually{
% }
%
% \bookmarksetup{bold=false}
% \section{Implementation} \label{sec:implementation}
% \csdef{HDorg@PrintMacroName}#1{\hbox to4em{\strut \MacroFont \string #1\ \hss}}
%
% \subsection{Identification}
%
% \begin{itemize}
% \item The package namespace is \texttbf{\macrocodecolor\string\LNGL@}
% \end{itemize}
%
%    \begin{macrocode}
%<*package>
\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/12/07 v2.7 - 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 % works also in dvi mode
   \PackageWarning{linegoal}
      {This package requires pdfTeX for its \string\pdfsavepos\space primitive\MessageBreak
      pdfTeX has not been detected and \string\linegoal\space will expand\MessageBreak
      to \string\linewidth\space in any case}
   \gdef\linegoal{\linewidth}%
   \expandafter\endinput
\fi
\RequirePackage{etex,zref,zref-savepos}
%    \end{macrocode}
%
% \subsection{zref properties}
%
%    \begin{macrocode}
\zref@newprop*{linegoal}[\linewidth]{\dimexpr
   \linewidth-\the\pdflastxpos sp
   +\ifodd\zref@extractdefault{linegoal/posx.\the\LNGL@unique}{page}\c@page
      \oddsidemargin
   \else\evensidemargin
   \fi
   +1in+\hoffset
   \relax
}% linegoal zref-property
%    \end{macrocode}
%
%
% \subsection{The linegoal macro}
%
%    \begin{macro}{\linegoal}
%    \begin{macrocode}
\newcommand*\linegoal{%
   \zref@extract{linegoal.\the\LNGL@unique}{linegoal}\LNGL@setlinegoal
}% \linegoal
\globcount\LNGL@unique
\globdimen\LNGL@tempdim
\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/posx.\the\LNGL@unique}{page,posx}%
         \zref@labelbyprops{linegoal.\the\LNGL@unique}{linegoal}%
         \ifdim\zref@extract{linegoal.\the\LNGL@unique}{linegoal}=\LNGL@tempdim
               \LNGL@info
         \else \expandafter\LNGL@warn%
                  \number\zref@extractdefault{linegoal/posx.\the\LNGL@unique}{page}\c@page\relax
         \fi
         \global\advance\LNGL@unique\@ne
      \else\LNGL@noauxerr
      \fi
   \@esphack
}% \LNGL@set
%    \end{macrocode}
%    \end{macro}
%
%    \subsection{Error, Warning and Info}
%
%    \begin{macrocode}
\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
\def\LNGL@warn#1\relax{\PackageWarning{linegoal}
   {\string\linegoal\space value on page #1 has changed
   \MessageBreak since last run. Please rerun to get
   \MessageBreak the correct value}%
}% \LNGL@warn
\def\LNGL@@info{\message{Package linegoal Info:
   \string\linegoal=\the\LNGL@tempdim\on@line, page \the\c@page}}
\let\LNGL@info\@empty
%    \end{macrocode}
%
% \subsection{The \textt{verbose} package option}
%
%    \begin{macro}{\verbose (package option)}
%    \begin{macrocode}
\DeclareOption{verbose}{\let\LNGL@info \LNGL@@info}
\ProcessOptions
%    \end{macrocode}
%    \end{macro}
%
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \DeleteShortVerb{\+}
%
% \begin{thebibliography}{9}
%
% \bibitem{zref}
%     \textit{The \xpackage{zref} package} by Heiko Oberdiek \\
%     2010/05/01 v2.17 New reference scheme for LaTeX2e \\
%     \href{http://www.ctan.org/tex-archive/help/Catalogue/entries/zref.html}{\nolinkurl{CTAN:help/Catalogue/entries/zref.html}}
%
% \bibitem{tabu}
%     \textit{The \xpackage{tabu} package} by \FC \\
%     2010/12/07 v1.5 - flexible LaTeX tabulars \\
%     \href{http://www.ctan.org/tex-archive/help/Catalogue/entries/tabu.html}{\nolinkurl{CTAN:help/Catalogue/entries/tabu.html}}
%
% \end{thebibliography}
% 
% \begin{History}
%   \sectionformat\subsection{font=,bottom=\smallskipamount,top=\medskipamount}
%
%   \begin{Version}{2010/12/07 v2.7}
%   \item Updated documentation. Compatibility with \xpackage{tabu} package (version \textt{1.5 -- 2010/12/07}).
%   \end{Version}
%
%   \begin{Version}{2010/11/30 v2.6}
%   \item Added the \textt{verbose} package option.
%   \end{Version}
%
%   \begin{Version}{2010/11/19 v2.2}
%   \item Fix a bug when using a syntax like \textt{.5\cs{linegoal}}. \\
%         Hence a better fitting with \xpackage{tabu} package (version \textt{1.4 -- 2010/11/20}).
%   \end{Version}
%
%   \begin{Version}{2010/10/31 v2.1}
%   \item \thispackage works also without \hologo{pdfTeX}, but \cs{linegoal}
%         is replaced by \cs{linewidth} in any case. \\
%         A warning is displayed.
%   \end{Version}
%
%   \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}
%
%   \begin{Version}{2010/05/07 v1.0}
%   \item First version.
%   \end{Version}
%
% \end{History}
%
% 
% \bookmarksetup{openlevel=1}
% \PrintIndex
%
% \Finale