16

How can I produce the codes to get the symbols of pencil, ruler and compass in LATEX? I'm gonna write a sentence I can draw this figure by using simple tools in my presentation. So I prefer to include symbols pencil, ruler and compass instead of the words simple tools. Is it possible?

user53541
  • 163

3 Answers3

27

First a pencil:

\documentclass[tikz,border=1cm]{standalone}
\usepackage{tikz}

\begin{document}
        \begin{tikzpicture}[rotate=30]
            \fill[gray!50] (0,4) -- (0.4,4) -- (0.4,0) --(0.3,-0.15) -- (0.2,0) -- (0.1,-0.14) -- (0,0) -- cycle;
            \draw[color=white] (0.2,4) -- (0.2,0);
            \fill[black] (0,3.5) -- (0.2,3.47) -- (0.4,3.5) -- (0.4,4) arc(30:150:0.23cm);
            \fill[brown!40] (0,0) -- (0.2,-0.8)node[coordinate,pos=0.75](a){} -- (0.4,0)node[coordinate,pos=0.25](b){} -- (0.3,-0.15) -- (0.2,0) -- (0.1,-0.14) -- cycle;
            \fill[gray] (a) -- (0.2,-0.8) -- (b) -- cycle;
        \end{tikzpicture}
\end{document}

enter image description here


And a scale (ruler):

\documentclass[tikz,border=1cm]{standalone}
\usepackage{tikz}

\begin{document}
        \begin{tikzpicture}[rotate=-30,transform shape]
            \draw (-0.2,0) rectangle (15.5,1);
            %% lower divisions
            \foreach \x in {0,1,...,15}{
            \draw (\x,0) -- (\x,0.2)node[above,scale=0.4]{\x};
            }
            \foreach \x in {0.1,0.2,...,14.9}{
            \draw (\x,0) -- (\x,0.075);
            }
            \foreach \x in {0.5,1,...,14.5}{
            \draw (\x,0) -- (\x,0.15);
            }
            % Upper divisions
            \foreach \x in {0,1,...,6}{
            \draw (\x in,1) -- (\x in,0.8)node[below,scale=0.4]{\x};
            }
            \foreach \x in {0.1,0.2,...,5.9}{
            \draw (\x in,1) -- (\x in,0.925);
            }
            \foreach \x in {0.5,1,...,5.5}{
            \draw (\x in,1) -- (\x in,0.85);
            }
        \end{tikzpicture}
\end{document}

enter image description here


And a compass:

\documentclass[tikz,border=1cm]{standalone}
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}[rotate=0,transform shape]
    %\draw[help lines] (0,0) grid (5,5);
       \draw (2.95,3.7) rectangle (3,3.95);
       \draw (2.92,3.68) -- (2.5,2.5) -- (2.5,2.3) -- (2.99,3.68);
       \draw (3.5,2.5) -- (3.43,2.48);
       \draw (3.04,3.68) -- (3.5,2.5) -- (3.5,2.3) -- (2.975,3.68);
       \draw (2.5,2.5) -- (2.56,2.48);
       \draw[fill=white] (2.975,3.75) circle (0.1cm);
       \draw (2.975,3.75) circle (0.04cm);
       \draw (2.5,3.2) -- (3.5,3.2);
       \draw[line width = 0.5pt,line cap=round] (2.975,3.15) -- (2.975,3.25);
\end{tikzpicture}
\end{document}

enter image description here

  • exellent examples of tikz! thank you for sharing that! –  Nov 29 '13 at 07:04
  • You should package this for CTAN so you don't forget about it ;). Seriously, I think this would make a good TikZ library. Symbols are just the kinds of things which lend themselves to being reused in multiple contexts. Especially if they were pics. – cfr Oct 01 '15 at 19:45
  • Excellent ! Can I use these forms in my next tkz-euclide documentation? – Alain Matthes Mar 17 '16 at 15:41
  • @AlainMatthes: By all means please. It is my pleasure. :) –  Mar 27 '16 at 03:08
  • @cfr A package was created, using some of this code: https://ctan.org/pkg/outilsgeomtikz (see the footnote 1 of the documentation). The name of the package is from "Tools geometry TikZ" in french. It features pens, compass, rules, ... – quark67 Mar 07 '23 at 09:56
4

The new package outilsgeomtikz features some of these objets. The name outilsgeomtikz is for the French words Outils géométrie TikZ (Tools geometry TikZ). I'm not the author.

enter image description here

(image taken from the cover page of the documentation)

quark67
  • 4,166
3

It's an old question but maybe it's helpful some people (like me): there is a package pst-geometrictools: "draw­ing of pro­trac­tors, rulers, com­passes and pen­cils."

uzsolt
  • 1,431