breve under letter is not in italics when using \textit

Because the beginning of the letter is moved a bit to the left when in italics mode, the breve also needs to move to the left,otherwise it is no longer under the letter.

\documentclass{article}
\usepackage{semtrans}
\begin{document}
Right position: \U{h}

Wrong position: \textit{\U{h}}
\end{document}


Any ideas how to correctly use a breve with italics?

• Do you really want to use that package? It dates back to 1998. – TeXnician May 26 '17 at 8:38
• I am open to suggestions for better ways to create a breve under a letter. – arved May 26 '17 at 8:46

The package is old and the definition is missing a \ltx@sh@ft that helps correct such positioning. A more modern definition for the \U macro is

\newcommand*\U[1]{\oalign{#1\crcr\hidewidth\ltx@sh@ft{-3ex}%
\vbox to .2ex{\hbox{\u{}}\vss}\hidewidth}}


In your own file you will need to enclose this in a \makeatletter...\makeatother pair. If you are loading the semtrans package you will need to use \renewcommand* instead.

\documentclass{article}
\usepackage{semtrans}

\makeatletter
\renewcommand*\U[1]{\oalign{#1\crcr\hidewidth\ltx@sh@ft{-3ex}%
\vbox to .2ex{\hbox{\u{}}\vss}\hidewidth}}
\makeatother

\begin{document}
Upright position: \U{h}

Italic position: \textit{\U{h}}
\end{document}


The above is modelled on the definition of the \b accent defined in the LaTeX kernel, namely:

\DeclareTextCommand{\b}{OT1}[1]
{\hmode@bgroup\o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-3ex}%
\vbox to.2ex{\hbox{\char22}\vss}\hidewidth}\egroup}


You could thus mimic this completely and use

\makeatletter
\DeclareTextCommand{\U}{OT1}[1]
{\hmode@bgroup\o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-3ex}%
\vbox to.2ex{\hbox{\u{}}\vss}\hidewidth}\egroup}
\makeatother


The simplest way these days is probably to use xelatex (used for the image here) or lualatex.

\documentclass{article}

\usepackage{fontspec}

\begin{document}

zzz ḫ

\textit{zzz ḫ}

\end{document}