I want to use bottom bracket ⎵ in a title:
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{titling}
\usepackage[lf]{venturis}
\usepackage[T1]{fontenc}
\title{Foo⎵Bar} % this has the offensive character
\author{Myself}
\date{}
\begin{document}
\maketitle
\end{document}
All I get is
! Package inputenc Error: Unicode char ⎵ (U+23B5)
(inputenc) not set up for use with LaTeX.
Best Answer
Short answer: You can use
\DeclareUnicodeCharacter{23B5}{\textvisiblespace}
. Or you can use␣
(U+2423 OPEN BOX) , which is already defined as\textvisiblespace
, instead of using⎵
(U+23B5 BOTTOM SQUARE BRACKET).Long answer: When you type
⎵
in your input file and save it with UTF-8 encoding (which is probably the default in your editor), this character U+23B5 BOTTOM SQUARE BRACKET gets stored as the sequence of bytesE2 8E B5
. Then when TeX reads the file, because of the\usepackage[utf8]{inputenc}
in the preamble, it knows that when it sees those bytes, it should understand it as the characterU+23B5
. This is great, but quite separately TeX needs to know what to do with that character.You can in fact give any instruction for any character. In your case it's as simple as simply picking up a symbol and typesetting it. You can look up The Comprehensive LaTeX Symbol List (probably available on your computer with
texdoc symbols-a4
) and see that the symbol is available (in fact under “Frequently Requested Symbols”) as\textvisiblespace
. So you can use that:produces
(Instead of
\DeclareUnicodeCharacter{23B5}{\textvisiblespace}
you can also use\newunicodechar{⎵}{{\textvisiblespace}}
from the newunicodechar package.)In fact, some common definitions come with a typical TeX distribution: specifically, on my computer
/usr/local/texlive/2017/texmf-dist/tex/latex/base/utf8.def
contains definitions for ©, ®, º, ˆ, ˜, ZWNJ, …, ™, ␣:but defining
⎵
as\textvisiblespace
is not one of them.Alternative: If you use a Unicode-aware TeX engine like XeTeX or LuaTeX (compile your file with
xelatex
orlualatex
rather thanpdflatex
), then you can simply use the ⎵ character from a system font that contains it. For example:or
Watch out that TeX has a rather serious (IMO) usability/design flaw here: if the character is missing in the font, then it doesn't cause an error but simply shows a missing character warning in the
.log
file. You can use\tracinglostchars=2
to have the message shown in the terminal, but you still need to watch out for it.