2

Is there a way to emulate the behaviour of \widehat in text mode in Plain (Xe)TeX? That is, take a single accent1 and “stretch” it over two or more letters. I need it in text mode, because it's not for a mathematical formula.

I tried doing the same thing that \t does, but that didn't work, because (as I realized in the process) the tie-after is a character of its own, and it doesn't really stretch.

1 a circumflex for my current task, but I would be thankful to know if there is a more general mechanism.

1
  • 1
    The simplest would be \def\twidehat#1{$\widehat{\hbox{#1}}$} (you lose kerning information, but this always happens also with \accent).
    – egreg
    Jun 13, 2022 at 6:39

1 Answer 1

4

You can use \widehat. This would work without problems with upright fonts, but some tweaking based on the font slant should be needed for slanted ones.

\catcode`@=11
\def\twidehat#1{$\m@th\widehat{\hbox{#1}}$}
\catcode`@=12

A\twidehat{c}cent

A\twidehat{cc}ent

A\twidehat{cce}nt

A\twidehat{ccen}t

{\it A\twidehat{cc}ent}

\bye

enter image description here

1
  • Depending on the purpose of the macro, it could make sense to \smash it or at least do something in order not to create uneven line spacing.
    – Gaussler
    Jun 13, 2022 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.