Caron Accent \v{a} doesn't render without \usepackage{xeCJK}

I am encountering an odd problem. I want to create composite characters such as ǎ using the newunicodechar package. However, it only yields a result in combination with the xeCJK package.

This code produces missing characters:

\documentclass[a4paper,12pt,article,oneside]{memoir}
\usepackage{fontspec}
\usepackage{xunicode}

\usepackage[british]{babel}

\setmainfont[Ligatures=TeX]{Minion Pro}

\usepackage{newunicodechar}
\newunicodechar{ǚ}{\v{ü}}
\newunicodechar{Ǚ}{\v{Ü}}
\newunicodechar{ǎ}{\v{a}}
\newunicodechar{Ǎ}{\v{A}}
\newunicodechar{ǒ}{\v{o}}
\newunicodechar{Ǒ}{\v{O}}

\begin{document}

ǚ Ǚ ǎ

\end{document}


If I load the xeCJK package then the characters render just fine. Why is that? And how to generate composite characters without the named package?

Note:

• this is reproducible with other fonts that do not contain the unicode characters (e.g. Adobe Garamond Pro)
• Minion Pro does contain a caron character (unicode 02C7, index 136)

The default setup doesn't use unicode U+02C7, but the combining accent U+030C which is missing in your font. xecjk contains some code to use U+02C7 instead, but seems to use this code only if xunicode is loaded too - which is a bit of a pain, as normally one shouldn't use it anymore.

You can clone the xeCJK code by using \add@accent. If more fonts are involved where some have the combining accent, some additional checks for glyph existence are probably needed.

\documentclass[a4paper,12pt,article,oneside]{memoir}

\usepackage{fontspec}
\usepackage[british]{babel}

\setmainfont[Ligatures=TeX]{MinionPro-Regular.otf}

\usepackage{newunicodechar}
\makeatletter

\newunicodechar{ǚ}{\add@accent{^^^^02c7}{ü}}
\newunicodechar{ǎ}{\add@accent{^^^^02c7}{a}}
\makeatother
%\newunicodechar{Ǎ}{\v{A}}
%\newunicodechar{ǒ}{\v{o}}
%\newunicodechar{Ǒ}{\v{O}}
%
\begin{document}
abc

ǚ Ǚ ǎ

\end{document}


• Thanks! As always you're answering my questions :) Could this be a potential feature request for newunicodechar: Substitute combining characters automatically?
– Paul
Feb 25, 2019 at 11:06
• No, newunicodechar doesn't care about the code you use, you could also input a picture. But you make a feature request for latex, the kernel could perhaps add a fall back to 02c7 to the definition of \v. Feb 25, 2019 at 11:11
• Are you sure I can just submit it to the Latex2e github?
– Paul
Feb 25, 2019 at 11:34

Based on a trick by Egreg, this uses the \accent primitive. I chose to simply redefine \v.

\documentclass{standalone}
\usepackage{fontspec, newunicodechar}

\usepackage[british]{babel}

\setmainfont[Ligatures=TeX]{Cardo}

\renewcommand\v[1]{\accent\string"02C7 #1}

\newunicodechar{ǚ}{\v{ü}}
\newunicodechar{Ǚ}{\v{Ü}}
\newunicodechar{ǎ}{\v{a}}
\newunicodechar{Ǎ}{\v{A}}
\newunicodechar{ǒ}{\v{o}}
\newunicodechar{Ǒ}{\v{O}}

\begin{document}

ǚ Ǚ ǎ Ǎ ǒ Ǒ

\end{document}


I picked Cardo as a common font that contains the caron accent, but not the precomposed ǚ.

• I can reproduce the MWE of this solution with Minion Pro. However, for some reason it doesn't work in my actual main file. There is some clash with another package, and I cannot identify (yet) which one it is.
– Paul
Feb 25, 2019 at 11:23
• You might to change the \documentclass back, if you didn’t. I switched to standalone for the convenience of creating a cropped image. Anyway, just adding the line \renewcommand\v[1]{\accent\string"02C7 #1} ought to work. Feb 25, 2019 at 11:32
• I already checked and your solution definitely works with \documentclass[a4paper,12pt,article,oneside]{memoir} Must be something else...
– Paul
Feb 25, 2019 at 11:34
• I also removed xunicode? Or maybe it’s related to \setmainfont versus \babelfont? Feb 25, 2019 at 11:42
• I identified the conflicting package: it's hyperref` But I have no idea what causes it
– Paul
Feb 25, 2019 at 12:27