# \DeclareUnicodeCharacter and LuaTeX

Is there an equivalent command to \DeclareUnicodeCharacter for LuaTeX that allows me to define alias commands for special UTF-8/Unicode characters? I am using a custom Fraktur font that uses Unicode's private use area for the definition of ligatures.

I can enter those characters into my editor (Sublime Text 2) using copy-and-paste. LuaTeX correctly displays the ligatures in the output, but in the editor they are displayed as empty rectangles. This makes the source code hard to read.

I know that in pdfLaTeX you can define commands for Unicode characters using

\usepackage[utf8]{inputenc}

\DeclareUnicodeCharacter{hexcode}{\alias}


so you can simply write \alias instead of the Unicode character itself.

But this approuch doesn't work for LuaTeX. Is there another way to achieve this?

You can find the Fraktur font (Normalfraktur UNZ1-genormt) on this website (German).

• I had a similar question to a font with musical symbols. So maybe that answer can help you: tex.stackexchange.com/a/180355/46389 – musicman Jun 11 '14 at 14:58
• \DeclareUnicodeCharacter doesn't define \alias, it uses it. If you want to define \alias to do something, use simply \newcommand\alias{your char}. – Ulrike Fischer Jun 11 '14 at 15:04
• Looks like what you really need is the contrary of what you are asking for... Apparently you can enter directly the utf-8 chars in your editor, and they appear right in the resulting pdf, but the problem is that your editor doesn't show those glyphs. You need to set a font in the editor which has those glyps. – JLDiaz Jun 11 '14 at 15:04
• @musicman Thanks for the link. I'll have a look at it. @Ulrike Fischer: So I misunderstood \DeclareUnicodeCharacter. @JLDiaz No. Having to use a Fraktur font in my text editor would be odd. – pvorb Jun 11 '14 at 15:15

With LuaTeX or XeTeX simply use that character:

\documentclass{book}
\usepackage{unicode-math}
\setmathfont{XITS Math}
\def\alias{\symbol{"00BB}}
\begin{document}
$\char"2B33$ » \alias $\mbfscrF$
\end{document}


• It didn't work immediately for me, since I tried with \symbol{"F1BB}, which gives an error. I had to add zero, first, \symbol{"0F1BB} and now it works perfectly. – pvorb Jun 11 '14 at 15:22
• @pvorb You probably have babel shortcuts active; \symbol{\string"F1BB} should do. – egreg Jun 11 '14 at 15:34
• I thought it was more kosher to use \newcommand in LaTeX rather than \def? – Sverre Jun 11 '14 at 16:17