The horn accent is not available as a standalone glyph. However, as explained in the Comprehensive List of LaTeX Symbols, the four glyphs you need are available in the T5 encoding for Vietnamese.
You can access them with very easy definitions:
\documentclass{article}
\usepackage[T5,T1]{fontenc}
\usepackage[utf8]{inputenc}
\DeclareTextSymbolDefault{\OHORN}{T5}
\DeclareTextSymbolDefault{\UHORN}{T5}
\DeclareTextSymbolDefault{\ohorn}{T5}
\DeclareTextSymbolDefault{\uhorn}{T5}
\begin{document}
\OHORN \ohorn \UHORN \uhorn
ƠơƯư
\end{document}
The direct input shown in the example is possible only if the .tex
document is UTF-8 encoded. The input "by name" doesn't need it.
If you need to typeset Vietnamese words, the simplest method is to add the Babel support for it to the document and segregate the words as arguments to \textviet
:
\documentclass{article}
\usepackage[T5,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[vietnam,english]{babel}
\begin{document}
\textviet{\OHORN \ohorn \UHORN \uhorn}
\textviet{ƠơƯư}
\end{document}
However you need a main font that supports the encoding. Other than Computer Modern, support is available with Latin Modern, all TeX Gyre fonts, and also the "Standard 35 Postscript" fonts.
Some words about \DeclareTextSymbolDefault
. The definition of \OHORN
we find in t5enc.def
is
\DeclareTextSymbol{\OHORN}{T5}{204} % Ohorn
which is complemented in t5enc.dfu
(which is read by inputenc
) by
\DeclareUnicodeCharacter{01A0}{\OHORN} % LATIN CAPITAL LETTER O WITH HORN
There are similar definitions for the other three glyphs.
However, LaTeX can't do anything with \OHORN
if the current encoding is not T5. A solution would be to say
{\fontencoding{T5}\selectfont\OHORN}
but it's too complicated, so \DeclareTextSymbolDefault{\OHORN}{T5}
comes to the rescue. It acts by just doing \OHORN
if the current encoding is T5, {\fontencoding{T5}\selectfont\OHORN}
otherwise.
One always needs to load the output font encoding with fontenc
.
This loading is automatically performed if the vietnam
is passed to babel
. The command \textviet
will typeset its argument with the T5 encoding active. So what strategy is to be preferred depends on what's really needed in the document. If only the four glyphs are needed in some cases, probably the first one is more economic; if Vietnamese words are to be typeset, then the second method is preferable.
XeTeX introduced new primitives such as \Umathcode
(up to version 0.9998 called \XeTeXmathcode
, renamed for compatibility with LuaTeX) that's the Unicode analog of \mathcode
.
What does \mathcode
in traditional TeX? A declaration such as
\mathcode`+="202B
tells TeX that a +
in math mode should be treated as a binary operation symbol (leftmost byte "2
), taken from font family "0
and slot "2B
in the corresponding font. In the same vein, one can say something like
\Umathcode`∑="1 "1 "2211
or even
\Umathcode`∑="1 "1 `∑
The primitive \Umathcode
has the syntax
\Umathcode<Unicode point> = <math type> <family> <slot>
After the (optional) =
, three numbers should be given, because packing the information into a single number as done by TeX is not possible. Actually the information is still packed into a single number (in this case it's decimal 18883089, hexadecimal "1202211
), but the translation from packed number to explicit type-family-slot is not straightforward.
This will be probably accompanied by a similar declaration
\Umathchardef\sum="1 "1 "2211
so that typing $∑$
or $\sum$
will give the same result.
The unicode-math
package loads a huge list of symbols and performs assignments similar to the one for ∑
. The number corresponding to ∑
will be different, because it depends on many aspects which can't be covered in a short answer.
Actually unicode-math
does much more than this, because it sets things up so that commands such as \mathbf
or \mathrm
give the desired result.
There are other primitives corresponding to the traditional ones, namely \Umathchar
, for using a directly specified character, or \Udelimiter
for setting delimiters with normal and large variant, \Umathaccent
and finally \Uradical
for defining root symbols. See texdoc xetex
that will open “The XeTeX reference guide” by Will Robertson and Khaled Hosny.
Best Answer
I'm not sure if anyone can answer this in a concrete sense except Ross Moore. My impression is that you'll get better output with most modern fonts using the combining glyph. If you're not I'd consider that a font bug.
Regarding:
xunicode cannot reasonably do anything in this case — it only has control over the accent macros themselves.