[Tex/LaTex] Special characters stopped appearing in text

charactersinput-encodingsunicode

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

Best Answer

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}}
Related Question