20

I need to enter the 🅱 sign in LaTeX for a paper I'm writing. I tried compiling my paper using XeLaTeX, but it just ignores 🅱. Is there perhaps a way to enter the 🅱's Unicode code point itself into LaTeX that I'm missing?

9
  • 2
    Does your font have this character? If not, you'll need to either create one yourself (with Tikz?) or find a font that has it.
    – Alan Munn
    Mar 18 '18 at 20:56
  • 2
    That font does not contain all of unicode, so you'll have to start by finding a font that provides this character
    – daleif
    Mar 18 '18 at 21:08
  • 8
    Just for the record, this is U+1F171: NEGATIVE SQUARED LATIN CAPITAL LETTER B. Mar 18 '18 at 22:40
  • 12
    🅱est of luck to you!
    – qwr
    Mar 19 '18 at 2:26
  • 9
    Does your paper happen to be about 🅱oneless 🅱izza?
    – MCMastery
    Mar 19 '18 at 3:10
19

The Apple Color Emoji font that contains this particular character doesn't encode its glyphs as regular characters and can't be used. See Emoji Characters. There seem to be very few fonts which contain these glyphs (the Enclosed Alphanumeric Supplement in Unicode).

On my machine (a Mac), only one font contains them: the Hiragino fonts. Here's an example that works for me (compile with LuaLaTeX, not XeLaTeX, which didn't work for me.)

\documentclass{article}
\usepackage{fontspec}
\usepackage{xcolor}
\newfontfamily\Hiragino{Hiragino Sans}[Color=red]
\begin{document}

{\Huge\Hiragino 🅱}
\end{document}

output of code

3
  • 1
    Yeah, I think it just amounts to finding a font on your computer that has 🅱. On my computer (running Ubuntu), the font "Symbola" worked for me.
    – Brian Lee
    Mar 18 '18 at 21:23
  • @BrianLee I'm glad you got it working.
    – Alan Munn
    Mar 18 '18 at 21:24
  • @AlanMunn Kind and excellent user but the color of B symbol change always? Before It war brown, after red and now magenta.
    – Sebastiano
    Mar 19 '18 at 9:59
16

This 🅱 sign in LaTeX it can work also without XeLaTeX. It is an alternative.

enter image description here

\documentclass{scrartcl}
\usepackage{xcolor}
\usepackage{tikz}
\newcommand{\Boo}[1]{
\begin{tikzpicture}[#1]
\node [fill=magenta, draw=magenta, rounded corners,minimum height = 12pt, minimum width = 12pt, inner sep = 1] at (10pt,10pt) {\textcolor{white}{\textbf B}};
\end{tikzpicture}
}
\begin{document}
We have \Boo{} a new symbol.

\end{document}
6

Maybe too classic, but ...

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[utf8]{xcolor}
\usepackage{newunicodechar}
\newunicodechar{🅱}%
{{\fboxsep1pt\colorbox{black}{\color{white}\sffamily\bfseries B}}}
\newunicodechar{🅰}%
{{\fboxsep1pt\colorbox{black}{\color{white}\sffamily\bfseries A}}}


\begin{document}

🅱l🅰ck and white

\end{document}
4

Another option with tcbox

\documentclass[11pt,a4paper]{article}

\usepackage{tcolorbox}
\usepackage{lmodern}

\newtcbox{\mychar}[1][]{nobeforeafter, tcbox raise base, colback=red, colframe=black, sharp corners, colupper=white, size=fbox, #1}

\begin{document}

How to write \mychar{B} or any other char (\mychar{A}, \mychar[colback=blue!70!black]{Z}, \mychar{!}, \mychar{\dots}) in \LaTeX

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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