3

I use TeX Live. See my example:

\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage[english]{babel}
\begin{document}
Check ligatures: first % here I have ligature for "fi"
\end{document}

I have Unicode symbol here: . When I compile the above LaTeX file I get:

! Package ucs Error: Unknown Unicode character 64257 = U+FB01

Then I apply the LaTeX system recommendation and compile the following file:

\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage[english]{babel}
\DeclareUnicodeCharacter{FB01}{fi}% Here I defined a Unicode ligature
\begin{document}
Check ligatures: first
\end{document}

But when I compile this LaTeX file I get:

! Missing number, treated as zero.
<to be read again>
                   F
l.4 \DeclareUnicodeCharacter{FB01}{fi}

So my question is: How can I input ligatures in a LaTeX file using just the ligature's Unicode symbol?

5
  • I'm wondering what you want to achieve as it is seems you are trying to solve the wrong problem. Feb 23, 2012 at 11:13
  • Why do you think I solve wrong problem?
    – Michael Z
    Feb 23, 2012 at 11:37
  • 5
    Using Unicode ligature glyphs does not make much sense with TeX since it will naturally do the ligaturing for you. Feb 23, 2012 at 11:50
  • 1
    @KhaledHosny : you can have some Unicode ligature appearing in your TeX file through a cut'n paste operation. I remember having had some similar problems and I guess it is a legitimate possibility, even if not optimal. Feb 23, 2012 at 12:16
  • 2
    I strongly recommend to use XeLaTeX or LuaLaTeX for this. Feb 23, 2012 at 12:39

1 Answer 1

14

There are two problems with the code:

  1. Use [utf8] instead of [utf8x]
  2. The second parameter of \DeclareUnicodeCharacter is what the character will be replaced with, so it's meaningless to put the character there again. Replace it with what you reallly need (f and i will be joined in a ligature by TeX, as usual): \DeclareUnicodeCharacter{FB01}{fi}

After these changes the code will work as desired.

You must log in to answer this question.

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