8

Is there any way I can get the pin icon / symbol (that us usually used on maps)? Any icon similar to the attached one would do. I am trying to use this symbol instead of stating 'Address' in one of my documents. Any input, suggestions or advice will be greatly appreciated.

enter image description here

Werner
  • 603,163
Harry
  • 187
  • 2
    related: http://tex.stackexchange.com/questions/147017/map-marker-symbol-in-tikz-symbol-with-em-and-ex-units-doesn-t-scale-properly – d-cmst Nov 30 '14 at 15:55
  • 2
    Welcome to TeX.SX! Actually, this does not mean address but location. For an address, I would take a house symbol. – LaRiFaRi Nov 30 '14 at 15:56
  • @Harry +1 for your promise below to contribute here in time. – Ethan Bolker Nov 30 '14 at 19:08

2 Answers2

22

You can use the command \faMapMarker from the package fontawesome. Like this:

\documentclass{scrartcl}
\usepackage{fontawesome}

\begin{document}
Map Symbol: \faMapMarker
\end{document}

Output:

simple map marker from fontawesome

This symbol is available in pdflatex now as well, since the fontawesome-package added support for pdflatex recently.

JBantje
  • 2,271
12

A tikz solution (as standalone image):

\documentclass{standalone}

\usepackage{xcolor}
\usepackage{tikz}

\newdimen\pinA
\newdimen\pinB
\newdimen\pinC

\setlength{\pinA}{10mm}
\setlength{\pinB}{20mm}
\setlength{\pinC}{40mm}

\definecolor{pin}{gray}{0}

\begin{document}
  \begin{tikzpicture}
    \useasboundingbox (-\pinB, -\pinC) (\pinB, \pinB);
    \pgfmathsetmacro{\pinAngle}{acos(\pinB/\pinC)}%
    \pgfmathsetmacro{\pinAngleRight}{270+\pinAngle}%
    \path[fill=pin, even odd rule]
      (\pinAngleRight:\pinB)
      arc[
        at={(0,0)},
        start angle=\pinAngleRight,
        delta angle=360-2*\pinAngle,
        radius=\pinB,
      ]
      -- (0, -\pinC) -- cycle
      circle[
        at={(0,0)},
        radius=\pinA,
      ]
    ;  
  \end{tikzpicture}
\end{document}

Result

The both radii and the length of the tip can be configured using the dimen registers \pinA, \pinB, \pinC, all three measured from the origin in the middle of the circles. The color can be set via color name pin.

Usage

The file can be stored as pin.tex, then run pdflatex pin to get pin.pdf. The following example automatically scales the image to the size of uppercase letters, when included as image:

\documentclass{article}
\usepackage{graphicx}
\usepackage{calc}

\newcommand*{\pin}{%
  \includegraphics[height=\heightof{M}]{pin}%
}

\begin{document}
{\Huge \pin~Hello World}
{\normalsize \pin~Hello World}
{\tiny \pin~Hello World}
\end{document}

Result usage

Heiko Oberdiek
  • 271,626
  • Wow! This is very helpful. Thank you so much. – Harry Nov 30 '14 at 17:00
  • Is there anyway, I can shrink the size of this symbol? Its huge on the document. I am sorry, but I am very new to Latex. – Harry Nov 30 '14 at 17:05
  • @Harry It can be scaled, when included, e.g, \includegraphics[scale=.25]{pin.pdf} or \includegraphics[height=\heightof{M}]{pin.pdf} (the latter requires \usepackage{calc}. Or you can change the length settings of \pinA, \pinB, \pinC. – Heiko Oberdiek Nov 30 '14 at 17:08
  • Hello. Changing the length settings helped. Thanks a bunch. Cheers - Harry – Harry Nov 30 '14 at 17:10
  • 2
    Everybody here in the TeX community is very helpful and friendly. Keep up the good work guys!!! I hope to be able to help other newbies with their questions in the near future. :-) – Harry Nov 30 '14 at 18:03