# Inserting symbols with fontspec => Missing number, treated as zero

I'm attempting to insert the arrow and thick hyphen symbols ‣ and ⁃, U+2023 and U+2043 respectively, into my document. I tried compiling the following with lualatex:

\documentclass{article}

\usepackage{fontspec}

\begin{document}
\symbol{^^^^2023}
\symbol{^^^^2043}
\end{document}


However, I get the compilation errors

Missing number, treated as zero.
<to be read again>
‣
\symbol{^^^^2023}


and

Missing number, treated as zero.
<to be read again>
⁃
\symbol{^^^^2043}


What does the error mean in this case, and how could I insert the symbols into my document? Changing compilers from lualatex to something else is not an option.

• the ^^^^^-notation inserts a char not a number, use \symbol{"2023} (but you need a font with this symbols).. – Ulrike Fischer May 10 at 12:23
• or simply use the character so use ^^^^2043 (no \symbol) or just use ⁃ – David Carlisle May 10 at 12:34
• @DavidCarlisle The symbols alone produce only whitespace, but that is most likely because I'm using Latin Modern as my main font. – SeSodesa May 10 at 14:12
• @SeSodesa sure but \symbol{some number} just inserts the \char with that number it doesn't change font so if ⁃ doesn't work, \symbol will not either (the log file will tell you if there is a missing character in the font) – David Carlisle May 10 at 15:04

## 2 Answers

The special syntax ^^^^2023 means insert the character with Unicode code point U+2023 at the input level.

As an example, typing ^^^^0061^^^^0062^^^^0063 is exactly the same as typing abc (and the same as ^^61^^62^^63, by the way).

The command \symbol{<number>} means *typeset the glyph at slot <number> in the current font.

Thus the two ways are at different levels: input for the former, output for the latter.

You can use the hexadecimal representation with \symbol, but with the required markup: \symbol{"2023}. You can as well input \symbol{8227} or even, for what it's worth,

\symbol{^^^^2023}


using the alphabetical constant representation. But it would be a waste of resources, because ^^^^2023 would give the same result.

Important remark. The ^^^^ notation requires lowercase digits abcdef, whereas the " notation requires uppercase ABCDEF.

Use \char without enclosing its argument in curly braces, or use \symbol with curly braces.

I used Noto Sans and Noto Serif, as LuaTeX's default font family (Latin Modern) does not feature glyphs for either \symbol{"2023} or \symbol{"2043}.

\documentclass{article}
\usepackage{fontspec}
\begin{document}
%% 'Noto Sans' and 'Noto Serif' happen to feature the required glyphs
\setmainfont{Noto Sans}
\symbol{"2023}a\symbol{"2043} \quad \char"2023 a\char"2043

\setmainfont{Noto Serif}
\symbol{"2023}a\symbol{"2043} \quad \char"2023 a\char"2043
\end{document}

• \symbol should be preferred. Something like \char"2043A would be very puzzling for the user. Or even \char"2043 A, where the space is “mysteriously” disappearing. – egreg May 10 at 13:57
• Also, I get the following in my log file Missing character: There is no ‣ (U+2023) in font [lmmono12-regular]:! Missing character: There is no ⁃ (U+2043) in font [lmmono12-regular]:! So the characters seem to be missing for some reason. – SeSodesa May 10 at 15:37
• I meant to say that even after loading the fonts you mentioned, the fonts didn't get loaded properly. The appearance of my text changed, but the missing symbols still didn't show. I'm not sure why this is. – SeSodesa May 10 at 16:32
• @SeSodesa - Please clarify what you mean by "the fonts didn't get loaded properly". Was it maybe because they aren't installed (yet) on your system? That would explain why LuaLaTeX had to fall back on the default font, which is from the Latin Modern family. I used these fonts precisely because they do feature the glyphs you expressed some interest in. I certainly made no claim whatsoever -- either explicitly or implicitly -- that Noto Sans and Noto Serif are installed on everybody's TeX system. For what it's worth, they can be downloaded for free from google.com/get/noto. – Mico May 10 at 16:36
• @SeSodesa - You commented, "So the characters seem to be missing for some reason." The glyphs are definitely not missing in either Noto Sans or Noto Serif. Of couse, the glyphs are indeed missing -- as I had already noted explicitly in my answer and as you then rediscovered -- in the fallback font (from the Latin Modern font family) that LuaLaTeX loads in case the argument of \setmainfont/\setsansfont/\setmonofont` cannot be loaded successfully. Not being the designer of the Latin Modern fonts, I possess no information as to why the two glyphs aren't present in the LM family. – Mico May 10 at 17:00