# [OS X TeX] underlined variable, how to make it line break.

Bruno Voisin bvoisin at mac.com
Sat Apr 5 13:18:31 EDT 2008

On 5 avr. 08, at 17:34, Joseph C. Slater PE, PhD wrote:

> On Apr 5, 2008, at 8:28 AM, Bruno Voisin wrote:
>>
>
>> In WSU.sty, replace
>>
>>   ENTITLED \uline{\thesistitle}
>>
>> by
>>
>>   ENTITLED \expandafter\expandafter\expandafter\uline
>> \expandafter{\thesistitle}
>>
>> Works here.
>>
>
> Thanks! I have to admit not knowing why that's necessary, but glad
> that it works. How you figured it out... I don't know.

Hi Joe,

That's because of the sentence in the doc from ulem.sty:

ALL THE TEXT IN BRACES OR COMING FROM A MACRO IS TYPESET IN A BOX.

Meaning that, because \thesistitle is a macro, \uline will put it in a
box before underlining it. Hence I decided to try \expandafter, so as
to tell TeX to expand the macro \thesistitle *before* applying \uline
to it. And because \thesistitle is preceded by "{" in
\uline{\thesistitle}, with "{" itself expandable, you need one
\expandafter before "{" and several others before \uline.

The result is the construct

\expandafter\expandafter\expandafter\uline\expandafter{\thesistitle}

which tells TeX to expand (i.e. interpret) \thesistitle first, then
"{", then \uline.

In case you're not familiar with it, \expandafter is a plain TeX macro
(maybe it's one of the primitives defined in the TeX program itself,
I'm not sure) to be used as \expandafter\a\b to tell TeX to expand \b
first then \a. It's defined in one chapter of the TeXbook (I don't
have it at hand right now), probably the one on macros, and there are
plenty of examples of \expandafter trickery in appendix D.

Bruno