# Special characters stopped appearing in text

I have a unicode text (XeLaTeX) in which I use vowels with umlaut, like ü and ö, which worked but suddenly stoped working. These give an error message:

! Package inputenc Error: Keyboard character used is undefined (inputenc) in inputencoding utf8'.

Removed inputenc and babel and changed \setromanfont to \setmainfont from the .sty file and the ü and ö appear again.

But the command \d{h} to create ḥ no longer works as it did previously, the text simply produces h. The font does not have the desired glyph of its own. I am using XeLaTeX; most of the information below (and more) is in a .sty file.

\documentclass[12pt,twoside,a4paper,openright]{book}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{overpic}
\usepackage{lettrine}
\usepackage{makeidx}
\usepackage{fontspec}
\usepackage[normalem]{ulem}
\usepackage[paperwidth=6.3in,paperheight=9.45in]{geometry}
\setromanfont[BoldFont={SeriaPro-Bold},ItalicFont={SeriaPro-Italic},BoldItalicFont={SeriaPro-BoldItalic}]{SeriaPro}
\begin{document}


The suggestion below to redefine \d works :

\renewcommand*\d[1]{\makebox[\widthof{#1}][c]{\raisebox{-.45ex-\depthof{#1}}{.}}\llap{#1}}


Even better is a solution I found elsewhere:

\usepackage{xunicode}


Note: when used together with the xlxtra package it resulted in errors, so don't Note: you cannot use this last solution at the same time as \renewcommand*\d

-
You don't have to load inputenc if you qre using xelatex; xelatex already expects input in unicode encoding. –  Gonzalo Medina Oct 5 '12 at 2:26
Also, don't use babel with xelatex; use polyglossia instead. –  Gonzalo Medina Oct 5 '12 at 2:42
Welcome to TeX.SE! You may also want to (i) rename \setromanfont to \setmainfont (the \setromanfont command is deprecated), (ii) replace the => after BoldItalicFont with a simple =, and (iii) check whether your paperwidth and paperheight specifications are consistent with the documentclass option a4paper. Finally, the documentclass options openright and twoside are enabled by default for the book class and are thus redundant. –  Mico Oct 5 '12 at 2:43

FF Seria Pro [Is this the correct font?] seems to not have the glyph ḥ:

Neither the online preview shows it, nor does it appear on one of the three pages of the “complete character set”.

Possible solutions:

1. You take ḥ from another font that is as close to Seria Pro as possible. (Bad)
2. You mimick it (build it yourself).
With the help of the calc you could do:

\makebox[\widthof{h}][c]{\raisebox{-.45ex}{.}}\llap{h}


Or, of course, make it your own macro:

\newcommand*\doth{\makebox[\widthof{h}][c]{\raisebox{-.45ex}{.}}\llap{h}}


Or, if you want to use the original char ḥ (it's XeLaTeX after all), make it active:

\catcode\ḥ=\active
\newcommand*{ḥ}{\makebox[\widthof{h}][c]{\raisebox{-.45ex}{.}}\llap{h}}


You may adjust the dimension -.45ex so that it looks good.

3. You use another font.
This may be the best choice if you need to typeset a lot of those “funny” characters that don't exist in the chosen font!

If you need a lot of “under-dotted” characters you might even want to redefine the existing \d macro to

\renewcommand*\d[1]{\makebox[\widthof{#1}][c]{\raisebox{-.45ex-\depthof{#1}}{.}}\llap{#1}}

-
That last command indeed works out of the box! Very helpful. –  user19544 Oct 5 '12 at 10:44
@Willem You might find this answer of mine useful for your problem. –  egreg Oct 5 '12 at 11:44