diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-13 00:09:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-13 00:09:48 +0000 |
commit | 517b3d3e50433f70dcc6053de460e7e75a06413e (patch) | |
tree | a07ddf68ab6f26e9c7b81d2d69404b18a751b70d /Master/texmf-dist | |
parent | 84f39344bc3854184316416511bd1abb29a69813 (diff) |
tracking
git-svn-id: svn://tug.org/texlive/trunk@1406 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/tex/latex/tracking/tracking.sty | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tracking/tracking.sty b/Master/texmf-dist/tex/latex/tracking/tracking.sty new file mode 100644 index 00000000000..af539833ece --- /dev/null +++ b/Master/texmf-dist/tex/latex/tracking/tracking.sty @@ -0,0 +1,79 @@ +% tracking.sty +% +% 17 Mar 1996 +% Glazkov D.A. +% e-mail: glazkov@sci.lpi.msk.su +% +% 117924 Moscow, Leninsky Prosp. 53 +% P.N.Lebedev Physical Institute of +% Russian Academy of Sciences +% RUSSIA +% +% This style invoke the commands for tracking, i.e. automatical adjust +% spaces between symbols in a words or phrases to fit them into needed +% length. Any chain of symbols (including spaces) in current font may +% be treated. No commands, including font switching, are allowed in the +% arguments of following macros - the result will be unpredictable. +% +% The additional spaces between words are not disappear. It's meant that +% the result of macros is placed onto one line of text, because it +% is inserted into \hbox{...}. +% +% These commands are based on the idea of the loop "\dolist" - see +% D.Knuth "The TeXbook" (the answer for Ex. 11.5). +% +% +% You may change this code freely. But please inform me if you use +% or improve these commands. +% +% +% +% Available commands: +% +% +% \track{x}{abc} +% abc - initial chain of symbols +% x - additional space which is added to the right of each +% symbol but the last (including "spaces"). May be positive, +% negative and zero. +% Ex. \track{-.3pt}{This is a probe} +% +% +% \fittrack{x}{abc} +% abc - initial chain of symbols +% x - final length for the result of this command. May be less +% or greater thah the length of the initial chain. +% Ex. \fittrack{8cm}{This is a probe} +% +% +% \ratiotrack{x}{abc} +% abc - initial chain of symbols +% x - ratio, showing how many times the result of this command +% is longer than the length of the initial chain. May be +% less, greater or equal to 1. +% Ex. \ratiotrack{1.2}{This is a probe} + + +\def\dolist{\afterassignment\dodolist\let\next= } +\def\dodolist{\ifx\next\endlist \let\next\relax + \else \\\let\next\dolist \fi + \next} +\def\endlist{\endlist} + +\def\track#1#2{% +\def\\{\expandafter\if\space\next\setbox0=\hbox{\ }% + \else \setbox0=\hbox{\next}\fi% + \box0\kern#1}% +\leavevmode\hbox{\dolist#2\endlist\unkern}} + +\def\fittrack#1#2{% +\newcount\n\n=0% +\def\\{\advance\n by1}% +\dolist#2\endlist% +\advance\n by-1% +\setbox0=\hbox{#2}% +\dimen0=#1\advance\dimen0 by-\wd0\divide\dimen0 by\n% +\track{\dimen0}{#2}} + +\def\ratiotrack#1#2{% +\setbox0=\hbox{#2}\dimen0=#1\wd0\fittrack{\dimen0}{#2}} |