74.5 Accents through ‘accents’ Configurations

When \hat{foo} is encountered, a search is made for an ‘??-i’ that equals ‘foo’ in the given accent table. If found, do-found is executed; otherwise, do-not-found is executed. The do-found can reference the ??-out through ‘#1’. The do-not-found can reference the old definition of ‘\hat’ through ‘#1’ and the foo through ‘#2’.

<..accents..>
 \NewConfigure{accents}[2]{\def\a:accents##1##2{#1}%
    \def\b:accents##1##2##3{#2}}
 -_-_-

The space in the definition of ‘\check:sc’ is to deal with caese like ‘cmcsc10 at 14.4pt’.

<..temp patch for accents on small capsPRE-CSS..>
 \def\check:sc#1 #2<.par del.>{\Check:sc#1}
 \def\Check:sc#1#2#3#4#5#6#7#8#9*{%
   \gdef\Check:sc##1##2##3##4##5##6##7##8##9*{%
    {\if #1##1\if #2##2\if ##3#3\if ##4#4\if ##5#5\if ##6#6\if ##7#7%
     \if ##8#8\aftergroup\sc:reg:ac\else \sc:digits#8##8<.par del.>\fi
     \else \sc:digits#7##7#8##8<.par del.>\fi
     \else \sc:digits#6##6#7##7#8##8<.par del.>\fi
     \fi\fi\fi\fi\fi}}}
 {\scshape\expandafter\expandafter\expandafter\check:sc
      \expandafter\fontname\expandafter\font \space <.par del.>xxxxxxxx*}
 \def\get:sc{\expandafter\expandafter\expandafter\check:sc
      \expandafter\fontname\expandafter\font \space <.par del.>xxxxxxxx*}
 \def\sc:reg:ac#1#2#3{\nxt:srch
    {#3}aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVxXyYzZ\i I\j J%
    {}{}//{#1}{#2}}
 \def\nxt:srch#1#2{\if #1#2\expandafter\:found
    \else\expandafter\not:found\fi{#1}}
 \def\:found#1#2#3//#4#5{\a:textscaccent#4{#5}{#2}\b:textscaccent}
 \def\not:found#1#2#3{\if !#3!\expandafter\endnot:found
   \else\expandafter\nxt:srch\fi{#1}{#3}}
 \def\endnot:found#1#2//#3#4{#3{#4}{#1}}
 <.sc digits.>
 \let\acp:csv=\acp:c
 \def\acp:c#1#2{\get:sc\acp:csv{#1}{#2}}
 \NewConfigure{textscaccent}{2}
 -_-_-

The checking for digits is needed for cases like ‘eccc1000’ vesrus ‘eccc1200’. Eg.g,

\documentclass{article} 
  \usepackage[T1]{fontenc} 
\begin{document} 
  \textsc{Po\’e}  \Large \textsc{Po\’e} 
\end{document} 

<..sc digits..>
 \def\sc:digits#1#2<.par del.>{%
    \sc:dig{0}{#1}{#2}%
    \sc:dig{1}{#1}{#2}%
    \sc:dig{2}{#1}{#2}%
    \sc:dig{3}{#1}{#2}%
    \sc:dig{4}{#1}{#2}%
    \sc:dig{5}{#1}{#2}%
    \sc:dig{6}{#1}{#2}%
    \sc:dig{7}{#1}{#2}%
    \sc:dig{8}{#1}{#2}%
    \sc:dig{9}{#1}{#2}}
 \def\sc:dig#1#2#3{%
    \if #1#2\if !#3!\aftergroup\sc:reg:ac \expandafter\no:sc
            \else                     \expandafter\sc:digits\fi
            #3<.par del.>%
    \fi }
 \def\no:sc#1<.par del.>{}
 -_-_-

The second operands must be a single parameter macro. The previous to the last field must be empty, and the last one is not used.

The following put characters over each other and indirectly takes care of \b, \d, and ‘\ooalign’.

<..plain,ltplain obeylines,oalign..>+
 \def\:temp#1{\leavevmode\a:oalign\o:oalign:{#1}\b:oalign}
 \HLet\oalign=\:temp
 \NewConfigure{oalign}{2}
 -_-_-