\documentclass{article}
\begin{document}
${x_i}^j$ works as expected but not with an hat as in ${\hat{x}_i}^j$.
The way I found to make it work is $\mbox{$\hat{x}_i$}^j$. Is there
an nicer solution?
\end{document}
答案1
如果您希望帽子位于“x”和“j”的中心,且距离不太近,最简单的代码就是 \hat{x}_i{}^{j}
。这样,符号的高度就不会被考虑在内,因此不是完全相同的结果,但{{}\hat{x}_i}^{j}
会获得完全相同的结果。一些比较:
\documentclass[a5paper,12pt,twocolumn]{article}
\begin{document}
$\widehat{x_i}^j$ \dotfill{\tiny \verb|$\widehat{x_i}^j$|}\par
$\hat{x}_i{}^{j}$ \dotfill{\tiny \verb|$\hat{x}_i{}^{j}$|}\par
${{}\hat{x}_i}^{j}$ \dotfill{\tiny \verb|${{}\hat{x}_i}^{j}$|}\par
${\strut\hat{x}_i}^{j}$ \dotfill{\tiny \verb|$\strut\hat{x}_i{}^{j}$|}\par
$\mbox{$\hat{x}_i$}^j$ \dotfill{\tiny \verb|$\mbox{$\hat{x}_i$}^j$|}\par
$\hat{x_i}^j$ \dotfill{\tiny \verb|$\hat{x_i}^j$|}\par
${\hat{x}_i}^j$ \dotfill{\tiny \verb|${\hat{x}_i}^j$|}\par
\end{document}