5

For a music analysis paper I'm working on, I need to enter an arabic numeral with a circumflex over it to represent a musical scale degree. Normally, I can just use \^3, but as soon as I load the fontspec package, even if I don't change the default font, the circumflex collides with the glyph for the number. (I am using LuaLaTeX.) Here is a minimal example that illustrates the problem:

\documentclass{article}
\usepackage{fontspec}
\begin{document}
\^5 causes a collision!
\end{document}
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Symbol 1 Jul 15 '15 at 5:38
  • It seems like LuaLaTeX+fontspec cannot handle \^ well. On the other hand XeLaTeX+fontspec produce good result with Times, Helvetica, and Courier. (bad with Times New Roman and Arial). If you try to copy the result string you will find they are all character 5 following a U+0302, a combining character. The problem might be some PDF/Unicode-wise setting. – Symbol 1 Jul 15 '15 at 5:46
  • If possible, I'd really like to use the Linux Libertine O font, and with XeLaTex this still results in the same collision. – musicanalyst Jul 15 '15 at 5:54
  • Could you use math mode, i.e., type $\hat{5}$? – Mico Jul 15 '15 at 6:01
  • 1
    What about $\hat{\text{5}}$ or $\hat{\mathrm{5}}$?. – Bernard Jul 15 '15 at 6:43
5

It seems a bug somewhere. A temporary workaround:

\documentclass{article}
\usepackage{fontspec}
%\setmainfont{Linux Libertine O}

\newcommand{\hdigit}[1]{%
  \accent\string"02C6 #1%
}

\begin{document}

\^5 causes a collision! And 5^^^^0302 too.

But \hdigit{5} doesn't.

\end{document}

enter image description here

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.