Special LaTeX symbols

February 11, 2020 — January 4, 2023

computers are awful
faster pussycat
LaTeX
typography
Figure 1

Hunting particular characters/dingbats/emoji/etc for latex?

90% of code-questions to this theme can be answered by the full-length Not so short introduction to LaTeX.

There is an offline package, The Comprehensive LaTeX Symbol List which might be handy for people writing LaTeX on the go (Pakin 2021).

This document lists 18150 symbols and the corresponding LATEX commands that produce them.

Notionally one can compile it using the command

texdoc symbols-a4

However AFAICT it has exceptionally heavy dependencies and requires a more-than-comprehensive LaTeX install, and thus does not work for me. This is not enough:

tlmgr install texdoc comprehensive

Instead, I download the PDF from CTAN.

Sometimes we need to use special fonts and character encodings to get the desired effect. Life is much easier in Unicode for new projects (but beware wacky problems with legacy projects.) One of the great things about unicode maths is that some of the special symbols problems go away, because if you can find a special symbol in the unicode symbol list, or whatever they call it, you can use it in your document. The process to do that in class LaTeX is much more onerous — It would probably be better to import a single glyph via pifont or yagusylo.

0.1 Emoji

There are several ways to insert emoji into LaTeX.

Elegant, LuaLaTeX and XeTeX have native monochrome emoji via standard unicode fonts. The DejaVu one is fine.

\documentclass{article}
\usepackage{fontspec}

% these lines must come after fontspec
\newfontfamily\DejaSans{DejaVu Sans}
\newcommand\todo{{\color{red}\DejaSans 🚧}}

\begin{document}
  \todo mention {\DejaSans 😁😂😃😇😉😈😋😍😱}
\end{document}

Want color? The dirty-yet-shiny hack to include color emoji as images works This needs a Mac computer lying around to raid for the images, as a one-off. One could probably also try the joypixels emoji, although their license prohibits free commercial use, so be careful with where they are deployed.

\documentclass{article}
\usepackage{coloremoji}
\begin{document}
Hello, 🌎.
\end{document}

Or, use a public font, such as Google Noto to display native color emoji via the emoji package which uses Google’s Noto font. (requires LuaLaTeX). Overleaf’s explanation is good.

0.2 Tilde and backslash

How can I write these special TeX characters? Two answers

Classic, text mode.

\textasciitilde{}
\textbackslash{}

Classic, math mode. Backslash and setminus are potentially different.

\setminus
\backslash

XeTeX/LuaTeX:

\char`~

1 Mathematical symbols

See LaTeX Mathematics.

2 References

Oetiker, Serwin, Partl, et al. 2022. The Not So Short Introduction to LaTeX.”
Pakin. 2021. The Comprehensive LaTeX Symbol List.”