7

I am trying to display some non-latin characters, such as ɩ LATIN SMALL LETTER IOTA (U+0269), ʋ LATIN SMALL LETTER V WITH HOOK (U+028B), and ɔ LATIN SMALL LETTER OPEN O (U+254).

I tried almost every way I could find but none of them work. A subset of potentially crucial things I tried which did not work:

  • all compilers available on Overleaf: pdfLatex, Latex, XeLatex, and LuaLatex

  • \usepackage[utf8]{inputenc} and \usepackage[utf8x]{inputenc} (I know utf8x should be avoided, but with utf8x some characters are able to display.)

  • \usepackage[T1]{fontenc} , \usepackage[T5]{fontenc}, \usepackage[T1,T4]{fontenc}

Minimal Example to demonstrate the issue

\documentclass[11pt]{article}
\usepackage{times}
\usepackage{tipa}
\usepackage{textcomp} 
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc} 

\begin{document}
line1: \unichar{"0111}, \unichar{"00F6} \\
line2: đ, ö \\
line3: \unichar{"0254}, \unichar{"0269}, \unichar{"028B} \\
line4: ɔ, ɩ, ʋ
\end{document}

The output

enter image description here

I have read the Unicode documentations provided by Overleaf (https://www.overleaf.com/learn/latex/Articles/Unicode%2C_UTF-8_and_multilingual_text%3A_An_introduction, https://www.overleaf.com/learn/latex/Multilingual_typesetting_on_Overleaf_using_babel_and_fontspec) and some Unicode documentation pages to obtain some basic knowledge about Unicode.

As I was looking for answers, some solutions have to do with specifying languages for the package babel. However, my paper will include scripts from many languages (can be tens of them) and they are mostly under-represented languages (could be Indigenous and/or endangered) so they are lack of academic linguistic studies, and I do not even know which scripts they are using. I was not even sure if there is anything to do with the script/language.

I went with \unichar{"xxxx} solution because the ^^^^xxxx syntax does not work. With \unichar{"xxxx} syntax, some characters disaply fine, e.g. \unichar{"0111}(đ, latin small letter d with stroke) and \unichar{"00F6}(ö, latin small letter o with diaeresis). However, some are not, e.g. \unichar{"0254} (ɔ, latin small letter open o), \unichar{"0269} (ɩ, latin small letter iota), \unichar{"028B}(ʋ, latin small letter v with hook).

I am wondering why some characters can be displayed and some can not, despite the fact that they are all specified in Unicode in hexadecimal notation in an identical LaTeX environment using the same command (\unichar{}).

Also, is there a way to display those characters which currently cannot be rendered?

4
  • 2
    You should really post the code of a minimal example showing the problem. Are you sure that the font you are using has the characters you want? It seems that you are using the default font, and a lot of Unicode chars are missing there.
    – Rmano
    Commented May 14, 2022 at 21:28
  • 1
    Thank you Rmano for the suggestion! I have added a minimal example. Could you please let me know how do I know if the font I am using include the characters I want?
    – C01
    Commented May 14, 2022 at 23:13
  • Special case of Entering Unicode characters in LaTeX - TeX - LaTeX Stack Exchange (I remark "Special case: if the font does not have the character (for example the character α in the default Latin Modern font), it will drop an empty space in." in my answer for this case)
    – user202729
    Commented May 15, 2022 at 7:40
  • 1
    Just because your are specifying a character in Unicode notation does not automatically mean that your font has the required glyphs to display it. You are using somewhat exotic characters, which are simply not supported by your font.
    – Ingmar
    Commented May 15, 2022 at 19:40

2 Answers 2

11

Use the encoding utf8 (or whatever) do not mean that any font used will have a glyph for every encoded character. In fact, there are so many, that this almost never happen (maybe except with Unifont, that look horribly pixelated). Some fonts only have the Latin alphabet in capitals or so, while others have thousands of glyphs, but not all the uft8 characters.

So, a first step to deal with bizarre characters could be to search a good font containing most-all "rare" characters that you will need. Using xelatex and lualatex you are not limited to TeX fonts, so there are many alternatives:

mwe

\documentclass{article}
\usepackage{fontspec}
\usepackage{tabto}\NumTabs{5}
\begin{document}
\obeylines
đ ö ɔ ɩ ʋ \tab ← not all printed (default) 
{\setmainfont{GFS Didot} đ ö ɔ ɩ ʋ}     \tab ← Wrong font (Missing  characters) 
{\setmainfont{FontAwesome} đ ö ɔ ɩ ʋ}   \tab ← FonAwesome is not for this ...
{\setmainfont{Unifont} đ ö ɔ ɩ ʋ}       \tab ← Unifont works, but ...
{\setmainfont{FreeSerif} đ ö ɔ ɩ ʋ}     \tab ← FreeSerif works 
{\setmainfont{DejaVu Serif}  đ ö ɔ ɩ ʋ} \tab ← DejaVu Serif works 
{\setmainfont{EB Garamond} đ ö ɔ ɩ ʋ}   \tab ← EB Garamond works 
\end{document}
4
  • Thank you very much Fran! This is an important point I missed and the solution works! Could you please explain a bit how to know if a certain font include a certain character or not, or is the only way being trial and error? FreeSerif includes all the character I need. However, hypothetically, what would you do to make a sentence look identical in font style if some characters in a sentence are only supported by font A, and the other characters in the same sentence are only supported by font B? Thank you!
    – C01
    Commented May 14, 2022 at 23:53
  • 3
    @C01 Locally, you could use the albatross command-line tool which comes with TeX Live to determine fonts with certain characters.
    – TeXnician
    Commented May 15, 2022 at 3:01
  • 1
    @C01 You can mix fonts but each will have its own style, so you should be careful to choose a similar font (i.e, in case than you want add "ɔ ɩ ʋ" in a text with the default font, EB Garamod look better tan DejaVu, for instance). On the other hand, beside albatross, you can also check a font table in file with type fonts metrics (.tfm) and see also the log for missing common characters, and check the others answers of the link.
    – Fran
    Commented May 15, 2022 at 10:45
  • In your case it might be possible to use a suitable font family. Take a look at Google's Noto fonts, which cover many glyphs, including the ones you mentioned.
    – Ingmar
    Commented May 15, 2022 at 20:10
5

Don't use utf8x.

I tried typesetting

ɩ, ʋ, and ɔ

with your preamble (removing utf8x) and I got

! LaTeX Error: Unicode character ɩ (U+0269)
               not set up for use with LaTeX.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.20 ɩ
       , ʋ, and ɔ
?

! LaTeX Error: Unicode character ʋ (U+028B)
               not set up for use with LaTeX.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.20 ɩ, ʋ
           , and ɔ
?

! LaTeX Error: Unicode character ɔ (U+0254)
               not set up for use with LaTeX.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.20 ɩ, ʋ, and ɔ

I went to the manual of tipa and found them together with the commands that produce the characters, so I was able add suitable \DeclareUnicodeCharacter instructions for them. Add the others you need with the same method.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}

%\usepackage{acl} % where is it?
\usepackage{times}
\usepackage{tipa}

%\usepackage{latexsym} % obsolete
%\usepackage{graphicx} % not needed for the example
%\usepackage{multirow} % not needed for the example
%\usepackage{textcomp} % no longer needed
%\usepackage[utf8x]{inputenc} % don't use this
%\usepackage{microtype} % not needed for the example
%\usepackage{bbm} % not needed for the example
%\usepackage{amsmath} % not needed for the example
%\usepackage{csquotes} % not needed for the example
%\usepackage{numprint} % not needed for the example

% do here the declarations you need
\DeclareUnicodeCharacter{0269}{\textiota} % ɩ
\DeclareUnicodeCharacter{0254}{\textopeno} % ɔ
\DeclareUnicodeCharacter{028B}{\textscriptv} % ʋ

\begin{document}

ɩ, ʋ, and ɔ

\end{document}

I had to comment out \usepackage{acl} because you didn't tell where to find it. I commented out other packages not specific for the problem, but please look for the comments I added.

enter image description here

4
  • 2
    Thank you very much egreg! This works! Yes, I will avoid utf8x. Could you please explain a bit for why do we have to use DeclareUnicodeCharacter command? I thought a file encoded with utf-8 should be able to display any Unicode characters. I do not even understand why do we have to provide Unicode code points when the characters themselves are included in Unicode. On the other hand, do you know if there is a more efficient way to avoid looking up tipa's documentation for each character which cannot display properly; and what to do if there is no counterpart for a certain character in tipa?
    – C01
    Commented May 14, 2022 at 23:11
  • @C01 There is no t3enc.dfu file that would provide the correspondence between Unicode and commands. Maybe there should be.
    – egreg
    Commented May 15, 2022 at 8:34
  • @C01 BabelPad is an app (free) that can show you what is in an installed font. And if you you can run lualatex, tex.stackexchange.com/questions/160091/… may be related. Another way, for a specific character, you can try the \iffontchar\font 1234 yes \else no \fi command to see if the current font has codepoint 1234 or not.
    – Cicada
    Commented May 20, 2022 at 12:41
  • @C01 Unicode is a list of defined glyphs; the codepoint is to tell the font rendering engine (e.g. HarfBuzz) which glyph in the font to print. You could also use direct input with xelatex/lualatex, instead of the codepoint. \Uchar"01FD, \Uchar509, ^^^^01fd, \symbol{"01FD}, \symbol{509} and ǽ are all equivalent.
    – Cicada
    Commented May 20, 2022 at 12:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .