% \iffalse meta-comment % 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 % 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 %<*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 % %<*install> \input docstrip.tex \tracingall \tracingonline=0 \Msg{************************************************************************} \Msg{* Installation} \Msg{* Package: 2010/09/25 v2.0 - 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/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 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 \endpreamble \let\MetaPrefix\DoubleperCent \generate{% \file{linegoal.ins}{\from{linegoal.dtx}{install}}% \file{linegoal.sty}{\from{linegoal.dtx}{package}}% \file{linegoal.tex}{\from{linegoal.dtx}{example}}% } \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 % %<*ignore> \fi % %<*driver> \edef\thisfile{\jobname} \def\thisinfo{A new ``dimen'' corresponding to the remainder of the line} \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 \newcommand*\CTANhrefstar[3][/contrib/]{\href{\CTANbaseurl#1#2}{#3}} \newcommand*\CTANhrefnost[2][/contrib/]{\href{\CTANbaseurl#1#2}{\nolinkurl{\CTANdisplay#1#2}}} \let\loadclass\LoadClass \def\LoadClass#1{\loadclass[abstracton]{scrartcl}\let\scrmaketitle\maketitle\AtEndOfClass{\let\maketitle\scrmaketitle}} \documentclass[a4paper,oneside]{ltxdoc} \usepackage[latin1]{inputenc} \usepackage[american]{babel} \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 \usepackage{fancyvrb} \lastlinefit999 \geometry{top=2cm,headheight=1cm,headsep=.3cm,bottom=1.4cm,footskip=.5cm,left=2.5cm,right=1cm} \hypersetup{% pdftitle={The linegoal package}, pdfsubject={A new dimen corresponding to the remainder of the line}, pdfauthor={Florent CHERVET}, colorlinks,linkcolor=reflink, pdfstartview={FitH}, hyperindex=true, pdfkeywords={tex, e-tex, latex, package, zref, linegoal}, bookmarksopen=true,bookmarksopenlevel=2} \usepackage{bookmark} \embedfile{\thisfile.dtx} \begin{document} \DocInput{\thisfile.dtx} \end{document} % % \fi % % \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 % 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} % \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\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} % \DoNotIndex{\KVS@CommaComma,\KVS@CommaSpace,\KVS@EqualsSpace,\KVS@Equals,\KVS@Global,\KVS@SpaceEquals,\KVS@SpaceComma,\KVS@Comma} % \DoNotIndex{\DefineShortVerb,\DeleteShortVerb,\UndefineShortVerb,\MakeShortVerb,\endinput} % \makeatletter % \newrobustcmd\ClearPage{\@ifstar\clearpage{}} % \makeatletter % \MakeShortVerb{\+}\DeleteShortVerb{\|}\DefineShortVerb{\|} % \catcode`\§ \active \def§{\@ifnextchar §{\par\nobreak\vskip-2\parskip}{\par\nobreak\vskip-\parskip}} % \def\thispackage{\xpackage{{\db\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}}} % \def\Underbrace#1_#2{$\underbrace{\vtop to2ex{}\hbox{#1}}_{\footnotesize\hbox{#2}}$} % % \parindent\z@\parskip.4\baselineskip\topsep\parskip\partopsep\z@ % \g@addto@macro\macro@font{\macrocodecolor\let\AltMacroFont\macro@font} % \g@addto@macro\@list@extra{\parsep\parskip\topsep\z@\itemsep\z@} % \DefineVerbatimEnvironment{VerbLines}{Verbatim}{gobble=1,frame=lines,framesep=6pt,fontfamily=txtt,fontseries=m} % \def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}} % \newrobustcmd\verbfont{\usefont{T1}{\ttdefault}{\f@series}{n}} \let\vb\verbfont % \newrobustcmd\vbbf{\usefont{T1}{\ttdefault}bn} % \renewrobustcmd\#[1]{{\usefont{T1}{pcr}{bx}{n}\char`\##1}} % \newrobustcmd\csred[1]{\textcolor{red}{\cs{#1}}} % \renewrobustcmd\cs[2][]{\mbox{\vb#1\expandafter\@gobble\string\\#2}} % \newrobustcmd\CSbf[1]{\textbf{\CS{#1}}} % \newrobustcmd\csbf[2][]{\textbf{\cs[{#1}]{#2}}} % \newrobustcmd\textttbf[1]{\textbf{\texttt{#1}}} % \renewrobustcmd*\bf{\bfseries}\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}} % \newrobustcmd\rrbf{\color{red}\bfseries} % \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}}\newcommand\md{\mdseries} % \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} % \fancyfoot[R]{\oldstylenums{\thepage} / \oldstylenums{\pageref{LastPage}}} % \pagestyle{fancy} % \fancypagestyle{plain}{% % \let\headrulewidth\z@ % \fancyhf{}% % \fancyfoot[R]{\oldstylenums{\thepage} / \oldstylenums{\pageref{LastPage}}}} % % \newcommand\macrocodecolor{\color{macrocode}}\definecolor{macrocode}{rgb}{0.18,0.00,0.45} % \newcommand\reflinkcolor{\color{reflink}}\definecolor{reflink}{rgb}{0.49,0.00,0.00} % \newrobustcmd\stform{\@ifnextchar*{\@stform[]\textasteriskcentered\@gobble}\@stform} % \newrobustcmd\@stform[2][\string]{\textttbf{\rred#1#2}\xspace} % % \makeatother % % \deffootnote{1em}{0pt}{\rlap{\textsuperscript{\thefootnotemark}}\kern1em} % % \title{\vspace*{-28pt}\mdseries The {\bfseries\thispackage\footnotemark}\kern.6em package} % \author{\tiny\xemail{florent.chervet at free.fr}} % \date{\thisdate~--~version \thisversion} % \subtitle{\thisinfo} % ^^A\subject{\thisinfo} % \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\= \texttt{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*{-26pt} % \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. % % 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}). % % 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} % % \DeleteShortVerb{\+}\enlargethispage{\baselineskip} % \cftbeforesecskip=4pt plus2pt minus2pt % \cftbeforesubsecskip=0pt plus2pt minus2pt % \renewcommand\contentsname{\vspace*{-12pt}Contents\quad\leaders\vrule height3.4pt depth-3pt\hfill\null\kern0pt\vskip-6pt} % ^^A\vskip-.8\baselineskip % \tableofcontents % \leavevmode\leaders\vrule height3.4pt depth-3pt\hfill\null % \ClearPage % \hypersetup{bookmarksopenlevel=2} % % ^^A\clearpage % \MakeShortVerb{\+} % % \def\B#1{\texttt{[}\meta{#1}\texttt{]}} % % \section{User interface} % \label{userinterface} % % \begin{VerbLines} % This is a tabular that fills the remainder of the line: % \begin{tabularx}\linegoal{|l|X|}\hline % Something & Something else \\ % 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 % Something & Something else \\ % Something & Something else \\\hline % \end{tabularx} % \else % \begin{tabularx}{279.6pt}{|l|X|}\hline % Something & Something else \\ % Something & Something else \\\hline % \end{tabularx}% % \fi % % % \StopEventually{ % } % % \hypersetup{bookmarksopenlevel=1} % \section{Implementation} \label{sec:implementation} % \csdef{HDorg@PrintMacroName}#1{\hbox to4em{\strut \MacroFont \string #1\ \hss}} % % \subsection{Identification} % % \begin{itemize} % \item This package is intended to use with \LaTeX{} so we don't check if it is loaded twice. % \item The package namespace is \textttbf{\db\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/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{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,scrlfile} % \end{macrocode} % % \subsection{zref property : page as arabic number} % % \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 \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 \else\LNGL@noauxerr \fi \@esphack }% \set@linegoal \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 % % \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} % % \begin{Version}{2010/05/07 v1.0} % \item First version. % \end{Version} % % \end{History} % % \begin{thebibliography}{9} % % \bibitem{zref} % Heiko Oberdiek: % \textit{The \xpackage{zref} package}; % 2010/05/01 v2.17; % \CTAN{macros/latex/contrib/oberdiek/}. % % \end{thebibliography} % \clearpage % \PrintIndex % % \Finale