Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile Unicode characters in LaTex?

I'm trying to write a little piece of text with LaTex in overleaf. All works right until I use Unicode characters.
I want for example insert this Devanagri symbol: ऄ and make it visible after LaTex compiles it.
This is an example of my document:

\documentclass[a4paper,12pt,openright,notitlepage,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}
symbol: ऄ
\end{document}

Whether I compile with LaTex, the symbol doesn't appear and I get this error:
Package inputenc Error: Unicode character ऄ (U+0904) (inputenc)not set up for use with LaTeX.

Whether I compile with LuaLaTex or XeLaTex, the character still does not appear but the error message disappears.
I tried all the methods described in this post: https://tex.stackexchange.com/questions/34604/entering-unicode-characters-in-latex but no one work for me.
does anyone have a solution to figure out this problem?

like image 808
Marco Avatar asked Oct 17 '25 04:10

Marco


1 Answers

If you compile with xelatex or lualatex, you'll need to select a font which contains this glyph.

If you work locally on your computer, you can run the command albatross ऄ from the command line to find out which of your fonts has it:

        __ __           __
.---.-.|  |  |--.---.-.|  |_.----.-----.-----.-----.
|  _  ||  |  _  |  _  ||   _|   _|  _  |__ --|__ --|
|___._||__|_____|___._||____|__| |_____|_____|_____|

                     Unicode code point [904] mapping to ऄ                     
┌─────────────────────────────────────────────────────────────────────────────┐
│ Font name                                                                   │
├─────────────────────────────────────────────────────────────────────────────┤
│ .LastResort                                                                 │
├─────────────────────────────────────────────────────────────────────────────┤
│ Devanagari Sangam MN,देवनागरी संगम एम॰एन॰                                        │
├─────────────────────────────────────────────────────────────────────────────┤
│ ITF Devanagari Marathi,आई॰टी॰एफ़॰ देवनागरी मराठी                                  │
├─────────────────────────────────────────────────────────────────────────────┤
│ ITF Devanagari,आई॰टी॰एफ़॰ देवनागरी                                               │
├─────────────────────────────────────────────────────────────────────────────┤
│ Kohinoor Devanagari,कोहिनूर देवनागरी                                             │
├─────────────────────────────────────────────────────────────────────────────┤
│ Lohit Devanagari                                                            │
├─────────────────────────────────────────────────────────────────────────────┤
│ Lohit Hindi                                                                 │
├─────────────────────────────────────────────────────────────────────────────┤
│ Shobhika,Shobhika Regular                                                   │
├─────────────────────────────────────────────────────────────────────────────┤
│ Shree Devanagari 714,श्री देवनागरी ७१४                                           │
└─────────────────────────────────────────────────────────────────────────────┘

Or if you are using overleaf, consult this list of installed fonts https://www.overleaf.com/latex/examples/fontspec-all-the-fonts/hjrpnxhrrtxc

So in my case, I can take e.g. the Shobhika font:

% !TeX TS-program = xelatex

\documentclass[a4paper,12pt,openright,notitlepage,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{fontspec}
\setmainfont{Shobhika}

\begin{document}
symbol: ऄ
\end{document}

enter image description here

like image 100
samcarter_is_at_topanswers.xyz Avatar answered Oct 19 '25 07:10

samcarter_is_at_topanswers.xyz