[Tex/LaTex] Horn accent in LaTeX

accentsfont-encodings

Sorry if the question is so trivial. I've just started using LaTeX couple of weeks ago and till now it's so new to me. I was trying to finish my name in a report where it's required to type a diacritic mark Horn in the document (something such as ư Ư or ơ Ơ). However, it seems not to be supported in LaTeX as I can find nearly all other accents such as grave, acute, circumflex here in Wiki but not this horn ư or Ơ, isn't it?

I've also refer to some methods that support Unicode characters but it seems a way too far. I just need a horn on a character u and o and that's all.

I'm using MiKTex 2.9 and Texmaker.

Best Answer

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.

enter image description here


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.

Related Question