Symbol for encoding error: black diamond with white question mark �

I would like to add this symbol: � to a beamer presentation. It is shown when something went wrong with the encoding.

Sadly, I can't simply include this symol:

[53]
! Package inputenc Error: Unicode char \u8:� not set up for use with LaTeX.
See the inputenc package documentation for explanation.


and I don't have any idea how to get it in LaTeX

(An image is not the solution I would like to use!)

Detexify didn't help either.

Description of the symbol (to make it easier to find):

• a black diamond with a white question mark within or
• a black sexagon with a white question mark
• seems to be "\xa0" in sed

How is this symbol � called? How can I print it with LaTeX?

Following David Carlisle's suggestion here's a TikZ solution:

\documentclass{standalone}

\usepackage{tikz}
% w/o following space!
\newcommand{\quem}{\tikz[baseline=(wi.base)]{\node[fill=black,rotate=45,inner sep=.1ex, text height=1.8ex, text width=1.8ex] {};%
\node[ font=\color{white}] (wi) {?};}}

\begin{document}

Some  \quem Text

\end{document}


You may alter the size of the black triangle by playing with inner sep and keep in mind that there is no space an the end of the macro.

The symbol you actually pasted into this question is U+FFFD Thus is the Unicode replacement character that applications use as a substitute when they are otherwise confused. It doesn't have a default presentation as it is essentially a kind of control character. The font here is showing it in that form.

If you don't specifically need it as a single text character you could of course produce it in latex by including an image or by over-printing a white question mark over a black diamond.

So in pdflatex this works:

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{FFFD}{\colorbox{black}{\color{white}?}}

\usepackage{array}

\begin{document}

% Methode 1
\begin{frame}

This is U+FFFD (�)

\end{frame}
\end{document}


Obviously you can put more design into the white on black ? if needed, this just shows the basic idea.

• +1. I was so free as to use your suggestion (over-printing) for another answer. Now there are three solutions: \DeclareUnicodeCharacter, TikZ, over-printing. Nice! – Stephen Nov 11 '12 at 11:35
• @Stephen the \DeclareUnicodeCharacter is an input side declaration independent of the way the character is rendered, you could use it with either of the other two solutions posted so that the input character (�) produce the tikz code \DeclareUnicodeCharacter{FFFD}{\quem} or the overprint \DeclareUnicodeCharacter{FFFD}{\encodingerror} – David Carlisle Nov 11 '12 at 11:47

\documentclass{standalone}
\usepackage{graphicx,color}
\makeatletter
\newsavebox\Diam@nd \newlength\x@D\newlength\y@D
\newcommand\Quem{%
\sbox\Diam@nd{\raisebox{-1ex}{\scalebox{1}[1.2]{\rotatebox{45}{\rule{1em}{1em}}}}}%
\makebox[\wd\Diam@nd]{\makebox[0pt]{\usebox\Diam@nd}\makebox[0pt]{\textcolor{white}{?}}}}
\makeatother

\begin{document}

Some  \Quem\ Text \huge \Quem\ Text

\end{document}


It also takes the fontsize into account

• Doesn't beamer anyway load tikz? – gerrit Nov 11 '12 at 12:47
• as far as I know, only pgf – user2478 Nov 11 '12 at 13:09
• FWIW, see tex.stackexchange.com/a/123532/170846 (generic \listfiles example) – Saphar Koshet Oct 5 '18 at 16:01

Over-printing a white question mark over a black diamond, as suggested by David Carlisle, could be accomplished by

\documentclass{article}

\usepackage{amssymb}
\usepackage{xcolor}
\usepackage{relsize}
\usepackage{xspace}

\newlength{\encerr}

\newcommand{\encodingerror}{%
\hbox{%
$\blacklozenge$%
\settowidth{\encerr}{$\blacklozenge$}%
\hspace{-0.77\encerr}%
{\color{white}\textsmaller[2]{?}}%
}%
\xspace%
}

\begin{document}

An \encodingerror occurred.

\end{document}


The xspace could also be used for bloodworks' answer, of course.