Skip to content

Instantly share code, notes, and snippets.

@seungwonpark
Created November 12, 2017 16:07
Show Gist options
  • Select an option

  • Save seungwonpark/adfdcd7b138989b63246dd7e01cf9a9b to your computer and use it in GitHub Desktop.

Select an option

Save seungwonpark/adfdcd7b138989b63246dd7e01cf9a9b to your computer and use it in GitHub Desktop.
TikZ - protractor drawing
\documentclass{standalone}
\usepackage{tikz}
\usepackage{ifthen}
\usepackage{intcalc}
\begin{document}
\begin{tikzpicture}
\draw (6,0) arc [radius=6, start angle=0, end angle=180] -- (-6,-0.5) -- (6,-0.5) -- cycle;
\foreach \i in {0,10,...,180}{
\draw[red] (\i:5.2) -- (\i:6);
\node[red, rotate=-90+\i] at (\i:5) {\i};
\node[rotate=90-\i] at (180-\i:4.5) {\i};
\draw (\i:1) -- (\i:3);
}
\foreach \i in {0,1,...,180}{
\ifthenelse{\intcalcMod{\i}{10}=0}{
}{
\ifthenelse{\intcalcMod{\i}{10}=5}{
\draw[blue] (\i:5.4) -- (\i:6);
}{
\draw (\i:5.6) -- (\i:6);
}
}
}
\draw[->, line width=1] (0,0) -- (4,0);
\draw[->, line width=1] (0,0) -- (0,4);
\draw[->, line width=1] (0,0) -- (-4,0);
\filldraw[fill=white] (0,0) circle [radius=0.2] node {+};
\end{tikzpicture}
\end{document}
@seungwonpark
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment