[OS X TeX] Empty boxes, no chars

Bruno Voisin bvoisin at mac.com
Mon Feb 28 09:34:57 EST 2005


Le 27 févr. 05, à 16:49, Bruno Voisin a écrit :

> Le 27 févr. 05, à 15:34, Peter Dyballa a écrit :
>
>> Has someone the code to set some text as empty boxes for each  
>> character instead of using the usual glyphs that fit into them? How  
>> can around a "word" be made?
>
> The code for this is given in the TeXbook, as the answer to one  
> exercise. I don't have this book at hand right now, unfortunately,  
> will look at it tomorrow.

I had completely forgotten about this promise, and just remembered it.  
The code you're looking for is the solution to exercise 11.5 on p. 67  
of the TeXbook. The solution is given on pp. 310-311, and is extremely  
tricky (at least for me):

\def\dolist{\afterassignment\dodolist\let\next= }
\def\dodolist{\ifx\next\endlist \let\next\relax
   \else \\\let\next\dolist \fi
   \next}
\def\endlist{\endlist}
\def\hidehrule#1#2{\kern-#1%
   \hrule height#1 depth#2 \kern-#2 }
\def\hidevrule#1#2{\kern-#1{\dimen0=#1
    \advance\dimen0 by#2\vrule width\dimen0}\kern-#2 }
\def\makeblankbox#1#2{\hbox{\lower\dp0\vbox{\hidehrule{#1}{#2}%
     \kern-#1 % overlap the rules at the corners
     \hbox to \wd0{\hidevrule{#1}{#2}%
       \raise\ht0\vbox to #1{}% set the vrule height
       \lower\dp0\vtop to #1{}% set the vrule depth
       \hfil\hidevrule{#2}{#1}}%
     \kern-#1\hidehrule{#2}{#1}}}}
\def\maketypebox{\makeblankbox{0pt}{1pt}}
\def\makelightbox{\makeblankbox{.2pt}{.2pt}}
\def\\{\expandafter\if\space\next\
  \else \setbox0=\hbox{\next}\maketypebox\fi}
\def\demobox#1{\setbox0=\hbox{\dolist#1\endlist}%
   \copy0\kern-\wd0\makelightbox}

to be used as in:

\demobox{Tough exercise.}.

The same approach has been adopted later by the package tracking.sty  
<ftp://ftp.cam.ctan.org/tex-archive/macros/latex/contrib/tracking/ 
tracking.sty>, to perform a "primitive" kind of font expansion  
(expansion of interletter space to produce emphasis, as in the French  
translation of Landau's & Lifshitz's course of Theoretical Physics, for  
example). Some years ago I had reused the idea to add a specific amount  
of white space between two successive letters, namely:

% Tricky macro for increasing interletter spacing

\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\by#2{\def\\{\next\kern#2}%
   \leavevmode \hbox{\expandafter\dolist#1\endlist}}

to be used as in:

\track MYNAME \by{.2em}

though I'd have a hard time now remembering how this works.

Hope this helps,

Bruno Voisin
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list