# Hammer and Sickle in LaTeX

I'd like to include the Hammer and Sickle unicode U+262D (☭) symbol in a computer science report in LaTeX. I'm using ShareLaTeX. I tried to use

\DeclareUnicodeCharacter{2014}{\dash}


but I get

Undefined control sequence.

l.35     \hamsic

• Make sure you're using a font that supports Unicode. Can you show us your code? – Richard May 17 '16 at 16:43
• “The font designers have only interpreted the glyphs, in various ways. The point, however, is to change it." apologies to K. Marx. – Steven B. Segletes May 17 '16 at 17:14

# Symbol from Unicode font (LuaTeX or XeTeX)

If LuaTeX or XeTeX is used with Unicode fonts, then the symbol can be used directly if the font supports this code point. Example for some fonts:

\documentclass{article}
\usepackage{fontspec}
\begin{document}
\newcommand*{\test}[1]{%
#1:&\fontspec{#1}\symbol{"262D}\\%
}
\begin{tabular}{ll}
\test{DejaVu Sans}
\test{FreeSans}
\test{Segoe UI Symbol}
\end{tabular}
\end{document}


# Symbol as vector image (all TeX engines)

An SVG version (and PNG) is available at Wikimedia Commons: File:U+262D.svg

The SVG path can directly be used in TikZ. The SVG file can be opened in a text viewer/editor. The SVG path is in the attribute value for attribute d of element path.

\usepackage{tikz}
\usetikzlibrary{svg.path}

% SVG path from Sarang:
\tikz\fill svg[yscale=-1]{%
M67,80l13,19L130,65L108,52z%
M54,103A60,60 0 1,0 55,23A50,50 0 1,1 55,101z%
m0,0L14,160l19,10L64,110z%
M95,87l46,79l17,-12L108,79z%
};%


The following example scales the symbol to the height of an uppercase letter and wraps it in the macro \hamsic. And the Unicode code point U+262D is mapped to this macro:

\documentclass{article}

% Symbol
\usepackage{tikz}
\usetikzlibrary{svg.path}

% SVG path from Sarang:
\newcommand*{\hamsic}{%
\begingroup
\settoheight{\dimen0 }{H}%
\resizebox{!}{\dimen0 }{%
\tikz\fill svg[yscale=-1]{%
M67,80l13,19L130,65L108,52z%
M54,103A60,60 0 1,0 55,23A50,50 0 1,1 55,101z%
m0,0L14,160l19,10L64,110z%
M95,87l46,79l17,-12L108,79z%
};%
}%
\endgroup
}

\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{262D}{\hamsic}

\begin{document}
Symbol: ☭
\end{document}


• This looks like magic. Particularly M67,80l13,19L130,65L108,52z M54,103A60,60 0 1,0 55,23A50,50 0 1,1 55,101z m0,0L14,160l19,10L64,110zM95,87l46,79l17,-12L108,79z What is that for? – A Feldman May 17 '16 at 17:24
• @AFeldman One would presume its the svg path to be used to create the font with height dimension of H. Download the svg file and open it in notepad. There you will find <?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg" width="180" height="180"> <path fill="#000" d="M67,80l13,19L130,65L108,52z M54,103A60,60 0 1,0 55,23A50,50 0 1,1 55,101z m0,0L14,160l19,10L64,110zM95,87l46,79l17,-12L108,79z"/> </svg> – azetina May 17 '16 at 17:36
• @azetina thank you for explaining that to me. So basically the answer shows how to take a svg graphic and "re-create" it using tikz for use as a character? – A Feldman May 17 '16 at 17:58
• @AFeldman Yes, the SVG path is reused in the TikZ image. An alternative would be to create a PDF file from the SVG image and to use the PDF file via \includegraphics. – Heiko Oberdiek May 17 '16 at 18:18