21

I am using Minion Pro as mainfont and it does not have in its glyph table the character U+1E47 Latin small letter with dot below which I need only once in my document. Rather than change to another font, I thought that I would generate it using \d{n}.

I give below a minimal file illustrating the problem:

\documentclass{minimal}
\usepackage{fontspec}
    \defaultfontfeatures{Ligatures=TeX}
    \setmainfont{Minion Pro} % Comment out optionally
\begin{document}
U+1E47 Latin small letter with dot below: \d{n}

U+0101 Latin small letter a with macron: \={a}
\end{document}

I do not get the desired letter n with dot below although the a with macron exists in the font and is available. Commenting out \usepackage{fontspec} gives the desired output with CMR as default font.

The behaviour is the same with xelatex and lualatex although the former indicates the missing letter with a crossed box.

I believe that with the Ligatures=TeX setting, I should be able to get missing letters using TeX accents. I do not think I need to load the xunicode package as it is already loaded by fontspec.

Can someone tell me what a I am doing wrong, please?

Thank you.

chandra
  • 3,084

1 Answers1

25

The "standard way" would be to say

\UndeclareUTFcomposite[\UTFencname]{x1E47}{\d}{n}

in order to use the combining character instead of the missing character at U+1E47, but unfortunately Minion Pro has nothing in slot U+0323 (COMBINING DOT BELOW). We need to go the hard way: write the following in the preamble

\UndeclareUTFcomposite[\UTFencname]{x1E47}{\d}{n}
\makeatletter
\renewcommand{\d}[1]
   {\hmode@bgroup
    \o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-1ex}.\hidewidth}\egroup}
\makeatother

so that you'll use the standard definition for \d. If other characters of that sort are needed, look in xunicode.sty for their definition; it starts with \DeclareUTFcomposite, it's sufficient to copy the line in your preamble and to change \Declare... into \Undeclare....

Let's look also at the "line below", which is again missing in Minion Pro. Here's a similar way to cope with the case, using the macron (U+00AF) for emulating the line below:

\documentclass{article}
\usepackage{fontspec,newunicodechar}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Minion Pro} % Comment out optionally

\UndeclareUTFcomposite[\UTFencname]{x1E47}{\d}{n}
\UndeclareUTFcomposite[\UTFencname]{x1E49}{\b}{n}
\makeatletter
\let\d\relax
\DeclareRobustCommand{\d}[1]
   {\hmode@bgroup
    \o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-1ex}.\hidewidth}\egroup}
\let\b\relax
\DeclareRobustCommand{\b}[1]
   {\hmode@bgroup\o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-3ex}%
     \vbox to.2ex{\hbox{\char"AF}\vss}\hidewidth}\egroup}
\makeatother
\newunicodechar{ṇ}{\d{n}}
\newunicodechar{ṉ}{\b{n}}

\begin{document}
U+1E47 Latin small letter n with dot below: \d{n}ṇ

U+1E49 Latin small letter n with line below: \b{n}ṉ

U+0101 Latin small letter a with macron: \={a}ā

\end{document}

It's perhaps better to declare \b and \d as robust commands. Moreover, with newunicodechar we can also input the characters directly.

enter image description here

egreg
  • 1,121,712
  • Thank you for solving and also explaining so that I can cope with future cases as well. – chandra Jun 15 '11 at 09:16
  • I am having a similar problem like @chandra. I am trying to get the letter "k" with a dot below with fontspec. It does not work, regardless of the font I choose. In LaTeX, I was able to do this with many fonts. Is there another simpler workaround to this? The solution proposed by @egreg is unfortunately beyond my level in LaTeX.This is my preamble: \usepackage{fontspec} \defaultfontfeatures{Mapping=tex-text} \usepackage{xunicode} \usepackage{xlxtra} – mustail Aug 17 '11 at 23:16
  • 1
    @mustail With the code above, \d{k} should give a dot below the "k". – egreg Aug 18 '11 at 08:51
  • @egreg Thanks a lot, the code worked flawlessly for me. I was not able to get \d{k} work with Latin Modern and many other fonts before, when using \fontenc. Now I get the dot below the letter. – mustail Aug 18 '11 at 18:56
  • @egreg: A supplementary question if I may, please: The above workaround does not seem to work within a \textit{} argument i.e., for the italic version of Minion Pro, when I thought it should. Any help here is most appreciated. Thanks. – chandra Oct 04 '11 at 07:39
  • @chandra It works for me – egreg Oct 04 '11 at 07:47
  • @egreg: I am sorry for the noise. I mistyped it originally. It works for me too now! My apologies. – chandra Oct 04 '11 at 08:29
  • @greg: Supplementary question: I tried replacing . in the code above with \_ to simulate \b{r} but the line below seems a bit long. What character should I use instead of \_ to get a smaller line as in [4ed p 27] of the Kopka and Daly book Guide to LaTeX? – chandra Sep 12 '12 at 09:32
  • @chandra I've added also \b{n} – egreg Sep 12 '12 at 10:39
  • @egreg: Thank you very much: it works exactly! Thank you also for introducing me to the newunicodechar package. From my little knowledge, I think you have used the macron and moved its position from the top to the bottom to achieve the desired effect. Again, many thanks :-) – chandra Sep 13 '12 at 12:20
  • @egreg: Where do you get the definitions for \d and \b above? I need to re-define ā, ī, and ś because these characters do not work right with small caps on the font I am using. I need to adapt your definitions re-define \= and \' without modifying the lower-case definitions for these characters already in the font. Thanks. – chandra Oct 05 '12 at 18:10
  • @chandra It's better to start a fresh question with some details about the new problem. – egreg Oct 05 '12 at 19:14
  • @egreg: Thanks. I have found out that un-defining already defined characters for whatever reason is not that wise. If I re-define ā but not ū when both are already defined in the font, the macron placement seems different for the two. So, I need to investigate further before posting a fresh question. – chandra Oct 07 '12 at 00:52
  • @egreg First solution is working in document's body text, but not in bibliography.bib file, where I've tried to plug it in with this {\d{s}}? – omtamal Mar 16 '16 at 13:34
  • @omtamal Please, ask a new question with the details. – egreg Mar 16 '16 at 13:54