3

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).

4
  • 1
    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
    Commented Jun 11, 2014 at 14:58
  • 3
    \DeclareUnicodeCharacter doesn't define \alias, it uses it. If you want to define \alias to do something, use simply \newcommand\alias{your char}. Commented Jun 11, 2014 at 15:04
  • 1
    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
    Commented Jun 11, 2014 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
    Commented Jun 11, 2014 at 15:15

1 Answer 1

6

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}

enter image description here

3
  • 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
    Commented Jun 11, 2014 at 15:22
  • 1
    @pvorb You probably have babel shortcuts active; \symbol{\string"F1BB} should do.
    – egreg
    Commented Jun 11, 2014 at 15:34
  • 1
    I thought it was more kosher to use \newcommand in LaTeX rather than \def?
    – Sverre
    Commented Jun 11, 2014 at 16:17

You must log in to answer this question.

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