2

I would like to write the japanese zip code symbol 〒 (unicode U+3012) in xelatex. However, when I put it in my source, it simply gets omitted in the final document, without raising any error. I guess I need to add a font containing that symbol, but do not know how to and which font to add. Any help is appreciated.

EDIT: As David Carlisle correctly pointed out, there is a message about a missing character, hidden deep inside the output.log. But nothing which would make xelatex crash like a missing package.

laolux
  • 595

1 Answers1

3

Find a font on your system that has the glyph.

\documentclass{article}
\usepackage{fontspec}
\usepackage{newunicodechar}

% use a font that has U+3012; ipag.ttf is in TeX Live \newfontface{\postalmarkfont}{ipag.ttf}

\newunicodechar{〒}{{\normalfont\postalmarkfont 〒}}

\begin{document}

This is the postal mark 〒

\end{document}

enter image description here

Here's a “more generic” way, where you state the path where the font is located at. Use the actual path for your system.

\documentclass{article}
\usepackage{fontspec}
\usepackage{newunicodechar}

% use a font that has U+3012; ipag.ttf is in TeX Live \newfontface{\postalmarkfont}{ipag}[ Extension=.ttf, Path=/usr/local/texlive/2021/texmf-dist/fonts/truetype/public/ipaex/, Scale=MatchUppercase, ]

\newunicodechar{〒}{{\normalfont\postalmarkfont 〒}}

\begin{document}

This is the postal mark 〒

\end{document}

I also added the Scale option.

enter image description here

egreg
  • 1,121,712
  • Thanks, that's quick! Now I just need to find out how to make xelatex find the font which is installed on my system in /usr/share/fonts/ipa-gothic/ipag.ttf – laolux Oct 06 '21 at 08:54
  • @laolux Doesn't the code I provided find it? – egreg Oct 06 '21 at 08:56
  • No, I tried your code and get ! Package fontspec Error: The font "ipag" cannot be found. – laolux Oct 06 '21 at 08:59
  • Try with \newfontface{\postalmarkfont}{ipag}[Extension=.ttf,Path=/usr/share/fonts/ipa-gothic/] – egreg Oct 06 '21 at 09:02
  • Great, the new version works when I change the path to suit my system. – laolux Oct 06 '21 at 09:21