summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/linegoal/linegoal.dtx
blob: f9245b32d945e95a5db9b8289fae92da03618091 (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
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
% \iffalse meta-comment
% linegoal : 2011/02/25 v2.9 - 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
\Msg{************************************************************************}
\Msg{* Installation}
\Msg{* Package: 2011/02/25 v2.9 - linegoal : a new dimen corresponding to the remainder of the line}
\Msg{************************************************************************}

\keepsilent
\askforoverwritefalse

\let\MetaPrefix\relax
\preamble

This is a generated file.

linegoal : 2011/02/25 v2.9 - 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>
\let\microtypeYN=y
\edef\thisfile{\jobname}
\def\thisinfo{Measuring the remaining width of the line}
\def\thisdate{2011/02/25}
\def\thisversion{2.9}
\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}
{\makeatletter{\endlinechar`\^^J\obeyspaces
 \gdef\ErrorUpdate#1=#2,{\@ifpackagelater{#1}{#2}{}{\let\CheckDate\errmessage\toks@\expandafter{\the\toks@
        \thisfile-documentation: updates required !
              package #1 must be later than #2
              to compile this documentation.}}}}%
 \gdef\CheckDate#1{{\let\CheckDate\relax\toks@{}\@for\x:=\thisfile=\thisdate,#1\do{\expandafter\ErrorUpdate\x,}\CheckDate\expandafter{\the\toks@}}}}
\AtBeginDocument{\CheckDate{interfaces=2011/02/12,tabu=2011/02/25}}
\documentclass[a4paper,oneside,american,latin1,T1]{ltxdoc}
\AtBeginDocument{\DeleteShortVerb{\|}}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hologo} % bug: must be loaded before graphicx...
\usepackage{ltxnew,etoolbox,geometry,graphicx,xcolor,needspace,ragged2e}   % general tools
\usepackage{lmodern,bbding,hologo,relsize,moresize,manfnt,pifont,upgreek}  % fonts
\usepackage[official]{eurosym}                                             % font
\ifx y\microtypeYN                                                         %
   \usepackage[expansion=all,stretch=20,shrink=60]{microtype}\fi           % font (microtype)
\usepackage{xspace,tocloft,titlesec,fancyhdr,lastpage,enumitem,marginnote} % paragraphs & pages management
\usepackage{holtxdoc,bookmark,hypbmsec,enumitem-zref}                      % hyper-links
\usepackage{array,delarray,longtable,colortbl,multirow,makecell,booktabs}  % tabulars
\usepackage{tabularx}\tracingtabularx                                      % tabularx
\usepackage{txfonts,framed}
\usepackage{interfaces}
\usepackage{nccfoots}
\usepackage[linegoal,delarray]{tabu}
\CodelineNumbered\lastlinefit999
\usepackage{embedfile}
\usepackage{fancyvrb}\fvset{gobble=1,listparameters={\topsep=0pt}}
\usepackage{listings}
\lstset{
    gobble=1,
    language=[LaTeX]TeX,
    basicstyle=\ttfamily,
    breaklines=true,
    upquote=true,
%    prebreak={\%\,\ding{229}},
    backgroundcolor=\color[gray]{0.90},
    keywordstyle=\color{blue}\bfseries,
    keywordstyle=[2]{\color{ForestGreen}},
    commentstyle=\ttfamily\color{violet},
    keywordstyle=[3]{\color{black}\bfseries},
    keywordstyle=[4]{\color{red}\bfseries},
    keywordstyle=[5]{\color{blue}\bfseries},
    keywordstyle=[6]{\color{green}\bfseries},
    keywordstyle=[7]{\color{yellow}\bfseries},
    %extendedchars={true},
    alsoletter={&},
morekeywords=[1]{
    \lstdefinestyle,
    \lstinputlisting,\lstset,
    \color,
    \geometry,\lasthline,\firsthline,
    \cmidrule,\toprule,\bottomrule,
    \everyrow,\tabulinestyle,\tabureset,\savetabu,\usetabu,\preamble,
    \taburulecolor,\taburowcolors},
morekeywords=[2]{
    tabular,
    caption,
    table,
    tabu},
morekeywords=[3]{
  &},
morekeywords=[4]{\linegoal},
morekeywords=[5]{blue},
morekeywords=[6]{green},
morekeywords=[7]{yellow},
}
\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{153}
%
% \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,\globcount,\globdimen}
% \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{}}
% \newrobustcmd*\CTANentry[1]{\href{http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/#1.html}{\xpackage{#1}}}
% \def\M{\@ifstar{\M@i\@firstofone}{\M@i\meta}}
% \def\M@i#1{\@ifnextchar[\M@square
%   {\ifx (\@let@token^^A)
%          \expandafter\M@paren
%    \else\ifx |\@let@token
%           \expandafter\expandafter\expandafter\M@bar
%    \else  \expandafter\expandafter\expandafter\M@brace
%    \fi\fi#1}}
% \def\M@square #1[#2]{\M@Bracket[{#1{#2}}]}
% \def\M@paren  #1(#2){\M@Bracket({#1{#2}})}
% \def\M@bar    #1|#2|{\M@Bracket\textbar{#1{#2}}\textbar}
% \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{\ifnum##1=2010\else 2010\,\textendash\,\fi ##1}^^A
%    }\expandafter\thisyear\thisdate\@nil
% }
% \newrobustcmd*\TabU[1][\pkgcolor]{\quitvmode\hbox{{#1{\larger[3]\usefont{U}{eur}mn\char"1C}$_\aleph \mkern.1666mu b\,$\rotatebox[origin=c]{-90}{\sf\smaller U}}}\xspaceverb}
% \newrobustcmd*\TABU[1][\pkgcolor]{\quitvmode\hbox{{#1{\larger[8]\usefont{U}{eur}mn\char"1C}$_\aleph \mkern.1666mu b\,$\rotatebox[origin=c]{-90}{\sf\smaller U}}}\xspaceverb}
% \newcommand\macrocodecolor{\color{macrocode}}\definecolor{macrocode}{rgb}{0.08,0.00,0.15}
% \newcommand\reflinkcolor{\color{reflink}}\colorlet{reflink}{DarkSlateBlue}
% \newrobustcmd*\stform{\ifincsname\else\expandafter\@stform\fi}
% \newrobustcmd*\@stform{\@ifnextchar*{\@@stform[]\textasteriskcentered\@gobble}\@@stform}
% \newrobustcmd*\@@stform[2][\string]{\texttbf{#1#2}\xspaceverb}
% \newrobustcmd*\xspaceverb{\ifnum\catcode`\ =\active\else\expandafter\xspace\fi}
% \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*\grabcs{\leavevmode\hbox\bgroup\bgroup\makeatletter\aftergroup\endgrabcs}
% \def\endgrabcs{\egroup\xspaceverb}
% \renewrobustcmd*\cs{\grabcs\cs@}
% \newrobustcmd*\cs@[2][]{\begingroup\escapechar\m@ne\def\x ##1{\endgroup\@maybehyperlink{##1}{\texttt{#1{\@backslashchar##1}}}}\expandafter\x\expandafter{\string#2}\egroup}
% \newrobustcmd*\@maybehyperlink [2]{\ifcsname @declcs.\detokenize{#1}\endcsname \hyperref{}{declcs}{#1}{#2}\else #2\fi}
% \newcommand*\cs@pdf[1]{\@backslashchar\if\@backslashchar\string#1 \else\string#1\fi}
% \newrobustcmd*\csbf{\cs[\textbf]}
% \newrobustcmd*\csref[2][]{{\escapechar\m@ne\edef\my@tempa{\string#2}\edef\x ##1{\noexpand\hyperref{}{declcs}{\my@tempa}{\noexpand\cs[{##1}]{\my@tempa}}}\expandafter}\x{#1}}
% \newcommand\env{\texorpdfstring \env@ \env@pdf}
% \newcommand*\env@pdf[1]{#1}
% \newrobustcmd*\env@{\@ifstar {\env@starsw[environment]}{\env@starsw[]}}
% \new\def\env@starsw[#1]#2{\textt{#2}\ifblank{#1}{}{ #1}\xspaceverb}
% \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
% \newrobustcmd*\csanchor[2][]{^^A
%   \immediate\write\@mainaux{\csgdef{@declcs.\string\detokenize{#2}}{}}^^A
%   \raisedhyperdef[14pt]{declcs}{#2}{\cs[{#1}]{#2}}^^A
% }
% \renewrobustcmd\declcs[2][]{^^A
%   \if@nobreak \par\nobreak
%   \else \par\addvspace\parskip
%         \Needspace{.08\textheight}\fi
%   \changefont{size+=2.5pt,spread=1,fam=\ttdefault}^^A
%   \def\*{\unskip\,\texttt{*}}\noindent
%   \hskip-\leftmargini
%   \begin{tabu}{|l|}\hline
%     \expandafter\SpecialUsageIndex\csname #2\endcsname
%     \csanchor[{#1}]{#2}}
% \renewcommand\enddeclcs{%
%     \crcr \hline \end{tabu}\nobreak
%     \par  \nobreak \noindent
%     \ignorespacesafterend
%  }
%
% \let\plainllap\llap
% \newrobustcmd\macro@llap[1]{{\global\let\llap\plainllap
%  \setbox0=\hbox\bgroup \raisedhyperdef{macro}{\saved@macroname}{#1}\egroup
%  \ifdim\wd0>20mm
%     \hbox to\z@ \bgroup\hss \hbox to20mm{\unhcopy0\hss}\egroup
%     \edef\@tempa{\hskip\dimexpr\the\wd0-20mm}\global\everypar\expandafter{\the\expandafter\everypar
%                                                                            \@tempa \global\everypar{}}^^A
%  \else \llap{\unhbox0}\fi}}
%  \AtBeginEnvironment{macro}{\if@nobreak\else\Needspace{2\baselineskip}\fi
%     \MacrocodeTopsep\z@skip \MacroTopsep\z@skip \parsep\z@ \topsep\z@ \itemsep\z@ \partopsep\z@
%     \let\llap\macro@llap}
%  \AtEndEnvironment{macro}{\goodbreak\vskip.3\parskip}
%
%  \sectionformat\section[hang]{
%     bookmark={color=MidnightBlue},
%     bottom=\smallskipamount,top=\medskipamount,
%  }
%  \sectionformat\subsection{
%       bookmark={color=MidnightBlue},
%   }
% \pagesetup{%
%  norules,
%  font=\scriptsize\color[gray]{.55},
%  head/font+=\sffamily,
%  head/left=\moveleft1cm\vbox to\z@{\vss\setbox0=\null\ht0=\z@\wd0=\paperwidth\dp0=\headheight\rlap{\colorbox{Ivory}{\box0}}}\vskip-\headheight{\color{pkgcolor!60}\bfseries l\,i\,n\,e\,g\,o\,a\,l},
%  head/right/font+=\color{pkgcolor!40}\mdseries,
%  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}
%
% \title{\vspace*{-28pt}\href{http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/linegoal.html}{\HUGE\bfseries\sffamily\color{CornflowerBlue}\@backslashchar\,l\,i\,n\,e\,g\,o\,a\,l}\Footnotemark{*}\vspace*{6pt}}
% \author{\small\thisdate~--~\hyperref[\thisversion]{version \thisversion}}
% \date{}
% \subtitle{\begin{tabu}{X[c]}\LARGE A ``dimen'' measuring the remainder of the line\\[1ex] requires \hologo{pdfTeX} or \hologo{XeTeX}\\ \small\FC \end{tabu}\vspace*{-12pt}}
% \makeatother
% \maketitle
%
% \makeatletter\begingroup
% \Footnotetext{\rlap{*}\kern1em}{\noindent
% This documentation is produced with the \textt{DocStrip} utility.\par
% \begin{tabu}{X[-3]X[-1]X}
% \smex To get the package,                   &run:          &\texttt{etex \thisfile.dtx}                  \\
% \smex To get the documentation              &run (thrice): &\textt{pdflatex \thisfile.dtx}               \\
% \leavevmode\hphantom\smex To get the index, &run:          &\texttt{makeindex -s gind.ist \thisfile.idx}
% \end{tabu}§
% 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}\setcounter{footnote}{0}
% {\vspace*{-12mm}\let\quotation \relax \let\endquotation \relax
% \begin{abstract}\parskip\medskipamount\parindent0pt\lastlinefit0\relax\rightskip1.5cm\leftskip\rightskip\advance\linewidth by-2\leftskip
%
% \thispackage provides a single macro: \cs\linegoal \, which expands to the dimension of the remainder of the line.
% It requires \hologo{pdfTeX} (or \hologo{XeTeX}) 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\extrarowsep=.3\parskip
% \begin{tabu*}{ll}
% Saying:       &\cs\somedimen = \cs\linegoal    \quad\footnote{Note that only this syntax allows the \cs\global preffix in case the \XPackage{calc} package is loaded.}      \\
% or:           &\cs\setlength \cs\somedimen \M*{\cs\linegoal}
% \end{tabu*}
% \par
% }
%
% sets \cs\somedimen to be the (horizontal) length from the current position to the right margin. 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}
%
% Limitation when using \cs\linegoal inside \xpackage{calc} of \hologo{eTeX} expressions:
%
% If \cs\linegoal is used inside an expression with \cs\dimexpr, \cs\glueexpr or
% inside \cs\setlength (package \xpackage{calc}), then \cs\linegoal \textbf{must appear at the very last position in the expression}:
%
% \begin{tabu*}spread0pt .{X}\}
% \begin{Verbatim}
%   \begin{tabu} to\dimexpr-2in + .5\linegoal{XX} ....
%   \setlength \dimen@ {-2in + .5\linegoal}
%   \end{tabu}
% \end{Verbatim}
%\end{tabu*}
%\,  are admissible.
%
% \thispackage requires \hologo{pdfTeX} (in \textt{pdf} or \textt{dvi} mode)
% or \hologo{XeTeX} and the module \xpackage{zref-savepos} of \XPackage{zref}.
%
% \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={\pkgcolor\leaders\vrule height3.4pt depth-3pt\hfill\null}\quad Contents of \thisfile\quad{\pkgcolor\leaders\vrule height3.4pt depth-3pt\hfill\null},
%  title/bottom=6pt,
%  after=\leavevmode{\pkgcolor\hrule},
%  columns=2,
%  }
%
% \tableofcontents
%
% \clearpage \bookmarksetup{bold*}
%
% \section{User interface}
% \label{userinterface}
%
% \subsection{\cs{linegoal}: a macro which behaves mostly like a \textt{dimen}}
%
% \begin{declcs}{linegoal}
% \end{declcs}
%
% 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 (which is supplied by \hologo{XeTeX} as well).
% For convenience, \thispackage loads and uses the \xpackage{zref-savepos} package from H. Oberdiek.
%
% \cs\pdfsavepos is supplied by \hologo{pdfTeX} (and \hologo{XeTeX}) in both \textt{pdf} and \textt{dvi} modes.
% If the document is not compiled with \hologo{pdfTeX} or \hologo{XeTeX} then \cs\linegoal will expand to \cs\linewidth
% in any case.
%
% {\fontname\font \hologo{XeTeX} {\changefont{fam=cmr}\hologo{XeTeX}}}
%
% \begin{VerbLines}[commandchars=£()]
% This is a tabularx that fills the remainder of the line:
%     \begin{tabularx}(£rred(\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 \CTANentry{tabularx} or \CTANentry{tabu}.
% Package \TabU has a \textt{linegoal} option to use \cs\linegoal as the 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}
%
% {\smaller
% \begin{lstlisting}[caption={This is a \env{tabu} that fills the half of the remainder of the line}]
% \tabulinestyle{red}
% $\begin{tabu} to .5\linegoal {|X[$c]|X[2$c]|} \tabucline-
% \alpha & \beta \\  \tabucline[on2pt red]-
% \gamma & \delta \\ \tabucline-
% \end{tabu}$
% \end{lstlisting}
% }
%
% This is a \textt{tabu} that fills the half of the remainder of the line:
% {\tabulinestyle{red}
%     $\begin{tabu}to .5\linegoal{|X[$c]|X[2$c]|} \tabucline-
%        \alpha & \beta    \\ \tabucline[on 2pt,red]-
%        \gamma & \delta   \\ \tabucline-
%     \end{tabu}$
% }
%
% Please, refer to \CTANentry{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 the \xext{log} file.
%
% \StopEventually{
% }
%
% \bookmarksetup{bold*}
%  \sectionformat\subsection{
%       bookmark={color=gray},
%   }
% \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 \cs\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}
         [2011/02/25 v2.9 - Measuring the remaining width of the line]
%    \end{macrocode}
%
% \subsection{Requirements}
%
% The package requires \xpackage{zref} and its module \xpackage{zref-savepos}.
%
%    \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}
%
%   \cs\linegoal first expands to the current value (\cs\linewidth or the line goal stored
%   in the \xext{aux} file as a \xpackage{zref} property).
%
%   Thereafter, \cs\LNGL@setlinegoal is expanded in order to set the new value of the \xpackage{zref} property,
%   to be used for the next compilation. The case is slightly different when using the \xpackage{calc} package,
%   for \cs\setlength is modified by the \xpackage{calc} package.
%
%    \begin{macrocode}
\newcommand*\linegoal{%
   \zref@extract{linegoal.\the\LNGL@unique}{linegoal}\LNGL@setlinegoal
}% \linegoal
\globcount \LNGL@unique
\globdimen \LNGL@tempdim
\def\LNGL@setlinegoal {\relax \LNGL@set@linegoal}
\protected\def\LNGL@set@linegoal{\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{\+}
%
% \addtocontents{toc}{\tocsetup{subsection/font+=\smaller}}
% \begin{History}
%   \sectionformat\subsection{font=\normalsize\pkgcolor,bottom=0pt,top=\smallskipamount}
%
%   \begin{Version}{2011/02/25 v2.9}\HistLabel{2.9}
%   \item Modification of \cs\LNGL@setlinegoal in order to be able to use \cs\linegoal inside the argument of tabulars (or \cs\multicolumn)
%         \texttbf p (or \texttbf m or \texttbf b) columns when the \xpackage{calc} package is loaded.\\
%         \xfile{array.sty} unfortunately expands the argument of \texttbf p, \texttbf m of \texttbf b columns during the rewritting process... \\ \par\vskip-\baselineskip
%         {\centering
%         \begin{tabu} .{>\small l}\}
%         \cs\edef\cs\x\M*{\cs\linegoal} \\
%         \cs\setlength\cs\somedimen \M*{\cs\x}
%         \end{tabu}
%         now works...\par}
%   \end{Version}
%
%   \begin{Version}{2011/01/15 v2.8}\HistLabel{2.8}
%   \item Banner modification.
%   \end{Version}
%
%   \begin{Version}{2010/12/07 v2.7}\HistLabel{2.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}\HistLabel{2.6}
%   \item Added the \textt{verbose} package option.
%   \end{Version}
%
%   \begin{Version}{2010/11/19 v2.2}\HistLabel{2.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}\HistLabel{2.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}\HistLabel{2.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}\HistLabel{1.2}
%   \item Modification in warning message...
%   \end{Version}
%
%   \begin{Version}{2010/06/06 v1.1}\HistLabel{1.1}
%   \item The first release required some small corrections  !
%   \end{Version}
%
%   \begin{Version}{2010/05/07 v1.0}\HistLabel{1.0}
%   \item First version.
%   \end{Version}
%
% \end{History}
%
% \begin{thebibliography}{9}
%
% \bibitem{zref}
%     \textit{The \CTANentry{zref} package} by Heiko Oberdiek \\
%     2010/05/01 v2.17 New reference scheme for LaTeX2e \\
%
% \bibitem{tabu}
%     \textit{The \CTANentry{tabu} package} by \FC \\
%     2011/02/24 v2.6 - flexible LaTeX tabulars \\
%
% \end{thebibliography}
%
% \bookmarksetup{openlevel=1}
% \PrintIndex
%
% \Finale