TeX provides a simple if comparing letters. The following will work if you do not do something like \ AOrAn \ myapplecommand, which will give unexpected results.
\documentclass{article} \makeatletter \newcommand\AOrAn[1]{% a% \@for\@vowel:=a,e,i,o,u,y,A,E,I,O,U,Y\do{% \expandafter\ifx\@vowel
You cannot manually force "an" like this, but you should be able to suppress it by writing \ AOrAn {} university.
(Edited for remarkable exceptional cases.)
Ulrich schwarz
source share