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}
Oli
  • 483
  • if U+270E isn' t in the font you are using can you not just include an image? – David Carlisle Feb 08 '17 at 19:53
  • 1
    Perhaps \faPencil from the fontawesome package is a bypass? –  Feb 08 '17 at 20:21
  • Thank you but It would be easier to have a "true" font without loading another package if possible. – Oli Feb 08 '17 at 21:33
  • You can always download an online graphic and use a scaled \includegraphics approach as in, for example, http://tex.stackexchange.com/questions/224357/create-latex-symbol-from-vector-graphics – Steven B. Segletes Feb 08 '17 at 21:44

2 Answers2

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

Ulrike Fischer
  • 327,261
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).

egreg
  • 1,121,712