2

I don't know how to produce a command wich gives me a pencil symbol with xelatex (and unicode-math).

I would like a pencil such as the U+270E unicode caracter or a similar symbol. http://www.fileformat.info/info/unicode/char/270e/index.htm

Thank you for help.

EDIT : So how to get the pencil with CMU font ?

\documentclass[a4paper,11pt]{article}

\usepackage[tuenc]{fontspec}
    \setmainfont[Ligatures=TeX]{CMU Serif} %needed for me to get small-bold caps
    \setsansfont{CMU Sans Serif}
    \setmonofont{CMU Typewriter Text}
\usepackage[a4paper]{geometry}
\usepackage[french]{babel}

\usepackage{unicode-math} %works without this

\begin{document}

%\symbol{"270E} doesnt' work ...

\end{document}
4
  • if U+270E isn' t in the font you are using can you not just include an image? Feb 8, 2017 at 19:53
  • 1
    Perhaps \faPencil from the fontawesome package is a bypass?
    – user31729
    Feb 8, 2017 at 20:21
  • Thank you but It would be easier to have a "true" font without loading another package if possible.
    – Oli
    Feb 8, 2017 at 21:33
  • You can always download an online graphic and use a scaled \includegraphics approach as in, for example, tex.stackexchange.com/questions/224357/… Feb 8, 2017 at 21:44

2 Answers 2

2

The glyph is not in CMU Serif, but it's easy to get it from another font.

\documentclass[a4paper,11pt]{article}
\usepackage[a4paper]{geometry}

\usepackage{fontspec}
\usepackage[french]{babel}
\usepackage{newunicodechar}

\setmainfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}

\newfontface{\pencilfont}{DejaVu Sans}[Scale=MatchUppercase]

\newunicodechar{✎}{{\pencilfont ✎}}

\begin{document}

Here's a pencil ✎ with text around it.

\end{document}

enter image description here

You can also input ^^^^270e instead of .

Note that tuenc is the default, with the most recent version of fontspec. Also Ligatures=TeX has long been the default (except for the monospaced font).

2
  • Thank you. It's excactly what I need. So should I remove tuenc ? and Ligatures=TeX ?
    – Oli
    Feb 9, 2017 at 18:16
  • @Oli With the current version of fontspec, yes, both.
    – egreg
    Feb 9, 2017 at 18:22
2

The fileformat site also include a list of fonts that support your character. So it is easy to get one with the symbol:

\documentclass[]{article}
\usepackage{fontspec}
\setmainfont{DejaVu Sans}

\begin{document}
a pencil \symbol{"270E}
\end{document}

enter image description here

2
  • Thank you. But how to get the pencil with CMU font ? (See EDITED first post).
    – Oli
    Feb 8, 2017 at 21:32
  • You can't. If a font doesn't have a glyph then it isn't there. You will to switch to another font temporarly. Feb 8, 2017 at 21:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .