9

I know that I can type unicode characters by number in LuaTeX with ^^^^00a9 for example. Works for the copyright symbol.

I can't get it to work though for arbitrary symbols like ^^^^2764 (heart) or ^^^^260e (phone).

How can I make LuaTeX support these characters and why doesn't it work in the first place?

  • you will have a warning in the log that tells you the font you are using does not have that character. – David Carlisle Feb 18 '17 at 10:44
  • @DavidCarlisle This is not really a warning. Just a message saying: Missing character: There is no ❤ (U+2764) in font [lmroman10-regular]:+tlig;! – Paul Gaborit Feb 18 '17 at 16:21
  • 1
    @PaulGaborit yes a behaviour inherited from classical tex, it's not clear why it's not styled more as a Warning or at least sent to the terminal, but it's not changeable in the macro layer it's a low level feature of the engines. – David Carlisle Feb 18 '17 at 16:26
  • tex.stackexchange.com/a/119945 is related, but the answer given there seems to need some adjustment for the current version of TeX Live. – Thérèse Feb 18 '17 at 19:40
17

LuaTeX supports all UTF-8 characters (directly or via ^^^^XXXX). Most fonts, however, do not have all the corresponding glyphs.

For each missing character, in the log file, you will find a message as:

Missing character: There is no ❤ (U+2764) in font [lmroman10-regular]:+tlig;!
\RequirePackage{luatex85}
\documentclass[varwidth=8cm,border=3mm]{standalone}
\usepackage{fontspec}

\newcommand\tryfont[1]{
  \setmainfont{#1}
  #1:\par
  COPYRIGHT SIGN: © ^^^^00a9\par
  HEAVY BLACK HEART: ❤ ^^^^2764\par
  BLACK TELEPHONE: ☎ ^^^^260e\par
  \vspace{1em}
}

\begin{document}
\tryfont{Latin Modern Roman}
\tryfont{Source Code Pro}
\tryfont{DejaVu Sans}
\end{document}

enter image description here

  • +1 Many fonts have a lot of glyphs, but usually is to support different languages and styles, not icon-like symbols as a phone. Among serious fonts (by "serious" I mean professional look, full set of styles,etc.), DejaVu should be one of the best at this respect, but it would be nice of know of others good with similar or more complete set of utf8 icons, specially among serif fonts. – Fran Feb 21 '17 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.