[texhax] Underscoring

Matthew Leingang leingang at math.harvard.edu
Mon Nov 19 18:13:52 CET 2007

Hello Ira,

The short answer is that EVERYTHING is possible in TeX; it kind of  
just depends on how hard you want to work.

Your second question first: macro expansion is a big part of TeX, so  
you can definite use a string that indicates the name of a macro and  
tell it how much of the token stream to absorb for its argument.  The  
most common way to do this is

	\def\Fxxiii#1{formatting of the argument here}

Then you would call it by \Fxxiii{my text}.

If you wanted a custom delimiter you can do it by instead defining

	\def\Fxxiii#1){formatting of the argument here}

and then call it by \Fxxiii my text).

Braces are kind of special for TeX, and TeX expects non-numeric  
characters in control sequence (macro) names.  But you *can* coax it  
to accept the very syntax you want.

As for the first question, there are some underlining packages  
available.  The \ul macro underlines text, but doesn't adjust for  
descenders (it's just as high as possible below the text without  
overlapping any possible descenders).  The ulem package provides a  
\uline macro that makes sure the underlines are the same height  
throughout.  But that doesn't do what you want, it just makes all the  
underlines below the descent, regardless of whether a descender is  
present.  The soul package puts the underlining right below the  
baseline regardless of descenders, so it overlaps.  Also not what you  

I'm pretty sure what you want is possible, but I don't know if it's  
been implemented.  I think nowadays people would just use a different  
font shape (e.g., italic) rather than underline.

I found a lot of this discussion on the web:


Take care,

On Nov 19, 2007, at 7:56 AM, tournour wrote:

> Hello!
> I'm a retired typesetter. Use to work on a QuadX system which use a  
> lanquage call TEXT PROGRAMMING. We were able to create various  
> programs. One was an underscoring program. We could very easily  
> insert the following specs: 1) Rule weight; 2) baseline shift 3)  
> and kerning around all of the descenders (y, g, p, etc.). In other  
> words, we could tuck the underscores around the descenders for a  
> perfect look. We would be able to create very precise and pleasing  
> effects. Also, the same in creating fractions. We could also put a  
> FORMAT like: {F23} in front of a block of text. And, have it look  
> for a delimeter like:¶
>   Format 23 would then suck up all the text up to that delimeter  
> and process it according to what we had programmed in F23, etc. Can  
> TeX do such feats? Please let me know.
> Thank you in advance!
> Ira
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
> Automated subscription management: http://tug.org/mailman/listinfo/ 
> texhax
> Human mailing list managers: postmaster at tug.org

Matthew Leingang
Preceptor in Mathematics
Harvard University


More information about the texhax mailing list