Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I can't figure out why LaTeX won't let me use the 𝔽 symbol (U+1D53D, mathematical double-stuck capital F). When I try, I get the error Package inputenc Error: Unicode char \u8:𝔽 not set up for use with LaTeX.

The input file is UTF-8 encoded. Here is a minimal working (or rather, non-working) example to demonstrate the issue.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\begin{document}
% \newcommand{\eff}[1]{F\text{#1}}
\newcommand{\eff}[1]{𝔽\text{#1}}
$ \eff{some} $
\end{document}

When using the first variant of \eff, everything works (the output is rendered as "Fsome" with an italic F, just as expected). However, if I comment that one out and instead uncomment the second variant, I get the error on line 8 (where I actually use the freshly defined command).

I'm using pdfLaTeX 3.1415926-1.40.10-2.2 from and on Debian Squeeze (package texlive-latex-base version 2009-11+squeeze1) with no special options at all (just pdflatex mwe.tex) to try to render the document.

I find it hard to believe that nobody would have wanted to use this particular symbol in a LaTeX document, so surely it can be done. What am I missing?

share|improve this question
5  
You can use \mathbb{F} from the package amssymb, see texblog.org/2007/08/27/… –  N.N. Sep 29 '12 at 8:02
1  
I would assume that not every symbol defined in Unicode is actually mapped to a glyph that is available in the fonts you are using. This is also going to create portability problems for your source code. –  Christian Lindig Sep 29 '12 at 8:03
    
@N.N. \mathbb{F} worked perfectly, thank you! If you make that an answer, I'll accept it. –  Michael Kjörling Sep 29 '12 at 8:06
1  
@ChristianLindig As for source code portability, this is a personal document so portability is not a great concern for me. (And on that note it's worth noting that the particular symbol happens to be mapped to a glyph in the window title bar font I use, but not the font Firefox uses for active only tab title text. Go figure. :)) –  Michael Kjörling Sep 29 '12 at 8:06
    
@MichaelKjörling The fonts used for window decoration by your operating system are not necessarily the ones used by LaTeX to render your document to PDF or PostScript. –  Christian Lindig Sep 29 '12 at 9:06

2 Answers 2

up vote 8 down vote accepted

As explained at LaTeX Matters you can use the package amssymb or amsfonts together with the macro \mathbb and F as an argument. Note that you have to use \mathbb in math mode.

\documentclass{article}

\usepackage{amssymb}            % or \usepackage{amsfonts}

\begin{document}

\(\mathbb{F}\)

\end{document}

If you want to define your own macro like you do in your example this is possible with \mathbb{F} too.

share|improve this answer
    
This worked perfectly. Now, in my actual document it's claiming that I'm not in math mode, but that's a completely separate issue. Thank you! –  Michael Kjörling Sep 29 '12 at 8:12
1  
@MichaelKjörling You have to use \mathbb inside math mode, e.g. as \(\mathbb{F}\). –  N.N. Sep 29 '12 at 8:13
    
Yes, I had a mix of math mode and text mode, and had got the ordering wrong. That was a trivial fix once I saw the error (which was easy to spot from the differences between my actual document and the MWE). –  Michael Kjörling Sep 29 '12 at 8:17

If you want to use 𝔽 inside your document you can use:

Edit:

As egreg pointed out you can use the package newunicodechar which makes it easier:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb}
\usepackage{newunicodechar}
\newunicodechar{𝔽}{\ensuremath{\mathbb{F}}}
\begin{document}
𝔽
\end{document}

Original:

% !TEX program = pdflatex
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb}

\expandafter\def\csname u8:\detokenize{𝔽}\endcsname{\ensuremath{\mathbb{F}}}
\begin{document}
𝔽
\end{document}

The command \ensuremath is testing whether you are in math mode or not and sets the argument in math mode.

Frank Mittelbach wrote a great explanation about inputenc:

How can I get utf8 character

share|improve this answer
    
That's a neat trick. Thank you! –  Michael Kjörling Sep 29 '12 at 8:18
4  
\usepackage{newunicodechar} and then \newunicodechar{𝔽}{\mathbb{F}} is simpler. :) –  egreg Sep 29 '12 at 8:46
    
@egreg: Oh a new package ;-) -- However I use \ensuremath ;-) –  Marco Daniel Sep 29 '12 at 8:47
    
It's not new (2011/02/18); don't use \ensuremath: that's a math symbol and ought to be used only in math. I added an answer to Frank's. –  egreg Sep 29 '12 at 8:57
1  
Package selinput v1.3 (requires rempreamblecmds v1.0) provides \DeclareInputUnicodeChar and \DeclareInputChar that also support utf8x.def from package ucs that has a different syntax for \DeclareUnicodeCharacter. Also these commands can be used after \begin{document}. (The PDF files above also contain the DTX files as attachments that are unpacked using plain TeX, release to CTAN later.) –  Heiko Oberdiek Sep 29 '12 at 12:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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