# [texhax] Re: stacking letters

Uwe Lück uwe.lueck at web.de
Mon May 2 17:32:41 CEST 2005

>From: "David Aue" <texhax at aue.org>
>
>I'm creating a notation system for Indian classical percussion (tabla) and I
>am trying find a way to position small sized characters above a normal sized
>short word, essential making something like a diacritical mark for a short
>word.  For instance I would like to position a small '1' over a normal 'te'.
>Eventually I would like a macro that centers a small #2 about 1ex+1pt above
>the baseline of a normal #1.

Nice to see that, I have just been occupied with a similar
problem in transcribing umlauts in some German handwritings
in the Middle Ages + \epsilon: small e or o above a, o, or u
-- cf. oldgerm.sty by Yannis Haralambous. I planned to
discuss the problem here anyway, and I may add something
later beyond what is below. (I wonder about what \accent
exactly does, and I would like to know what *critical edition*
experts think about what to do.)

One macro solution is due to Christian Folini, you find it in the
tipa package by Fuku Rei. This one uses a variant of LaTeX's
\textsuperscript, so the "accent" letter size is the math
\scriptstyle size.

Personally, I find this too large, and Andreas Kuehne from
here (Munich, Germany) has formerly used the
\scriptscriptstyle instead, which produces half the ex height
of the normal text font. -- I see that \sk of "Message 2"
(digest) does the same.

>\def\sk#1#2{%
>   \setbox0\hbox{\strut #1}%
>   \vbox{\offinterlineskip%
>   \hbox to \the\wd0{\hfil\hbox{\fiverm #2}\hfil}%
>   \kern-1pt
>   \box0}%
>}

Actually, Andreas Kuehne and \sk just used \fiverm from
plain TeX, which works with the normal font only.
\script[script]style works with other font sizes as well.
E.g., with LaTeX you may quote something in a \small
(or even \footnotesize) size extra paragraph, or you may
quote something in a footnote (or end note) with
\footnotesize -- the "letter accent" size should be

My own favorite solution uses the \accent trick from
german.sty (so respects slant) and also is inspired by
LaTeX's \textregistered (sorry, I am using LaTeX internals
here, which could be ported to other formats somehow):

\DeclareRobustCommand*{\lacc}[2]{{% #1 accents #2.
\dimen at .1ex%% plain TeX register for temporary use.
\expandafter\let\expandafter\@tempa\the\font
%% 3 LaTeX-internal lines:
\check at mathfonts\fontsize\ssf at size\z@\math at fontsfalse
\selectfont
\@tempdima1ex%
\fontdimen5\font\dimen@
\accent#1\fontdimen5\font\@tempdima\@tempa #2%
}}

To understand the final line, see TeXbook p. 286f.

\dimen at .1ex is just a simple idea. I discuss it in a german
two-page test file which I could send to who is interested.
I also think of 1.6129ex instead, just to have the height of
the "compound symbol" be the same as the height of a
high lower-case letter (at least with roman.mf).
But it might be better to aim at a space between both letter
that is the same as with usual accents (with respect to
"where the ink goes").

Moreover, \accent disables the usual kerning.
(Note: this may hardly be relevant for tabla notation.)
polset.tex (B. Jackowski, T. Holdys, M. Rycko, 1988)
used a trick \KeepKerns to re-enable kerning with
diacritical marks -- I would like to draw this to the
attention of TeXperts bothering with diacritical marks
(babel contributors, e.g.).

So what?

Sorry, my previous proposal may be concerned with the
German transcription problem rather than with the tabla
notation. "short word" to be accented? This doesn't work
with \accent. One solution for this is exaccent.sty in
Fuku Rei's tipa distribution. Yet there I find the "accent"
too high, and you must care yourself for the size of the
upper letter. Here I rather suggest (cf. TeXbook p. 356):

\def\fakeacc#1#2{%
\vbox{\offinterlineskip\ialign{##\cr
\hidewidth$\scriptscriptstyle\mathrm{#1}$\hidewidth\cr
\noalign{\vskip.1ex}\vphantom{b}#2\cr
}}%
}

\mathrm is LaTeX -- don't know at present how to replace
it in plain TeX terms.

\sk uses \strut where I use the \vphantom.
I think \strut is too high. My proposal just aims at enough
space between a high lower-case letter and the "accent"
(assuming that no letter is higher than "b" -- for "tabla"
a different letter may be better). \vskip.1ex is again
somewhat arbitrary for that space.

My first proposal positions the "accent" dependently
from the height of what is below, the second chooses
the same height any time.

(BTW, I like the sound of the tabla, especially the
low voice.)

-- Uwe Lueck.