How do I make LaTeX understand Unicode characters ↔︎ and ↕︎
Actually, LaTeX has a pretty good Unicode support (better yet since the October 2019 update). You just need to define the character you want to type:
\documentclass{article}
\DeclareUnicodeCharacter{2194}{\ensuremath{\leftrightarrow}}
\DeclareUnicodeCharacter{2195}{\ensuremath{\updownarrow}}
\begin{document}
How can I type ↔ and ↕ in \LaTeX?
\end{document}
Note that you have a (spurious, I think) caracter U+FE0E (VARIATION SELECTOR-15) after each ↔ and ↕ character.
I would recommend the newunicodechar
package for this:
\usepackage{newunicodechar}
\newunicodechar{↔}{\ensuremath{\leftrightarrow}}
\newunicodechar{↕︎}{\ensuremath{\updownarrow}}
You could also write ^^^^2194
for ↔
.
This package has the advantage of working in PDFLaTeX, LuaLaTeX and XeLaTeX, whereas \DeclareUnicodeCharacter
is part of inputenc
and only works with legacy 8-bit font encodings.