I must thank TeX Stack Exchange, especially for these questions:
- Creating gears in TikZ
- How can I invert a 'clip' selection within TikZ?
- How to use plot in a foreach loop into a single path?
I could come up with this:
Now the finishing touch to make the badge look like the third image would be to convert all thick lines to double lines (actually, the only thing that really annoys me is that thick circle at the center). But I need to combine the paths first. Is there an easy way to do it in TikZ or should I leave it like this?
Free bonus. I assume there is no way to reduce the letter-spacing within decorations.text
?
\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text,decorations.shapes,calc}
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Calibri}
\begin{document}
\thispagestyle{empty}
% Andrew Stacey's workaround for the foreach bug
\makeatletter
\def\tikz@clear@foreach{%
\let\pgffor@beginhook=\pgfutil@empty
\let\pgffor@endhook=\pgfutil@empty
\let\pgffor@afterhook=\pgfutil@empty
}
\def\tikz@plot@expression(#1){%
\edef\tikz@plot@data{\noexpand\tikz@clear@foreach\noexpand\pgfplotfunction{\expandafter\noexpand\tikz@plot@var}{\tikz@plot@samplesat}}%
\expandafter\def\expandafter\tikz@plot@data\expandafter{\tikz@plot@data{\tikz@scan@one@point\pgfutil@firstofone(#1)}}%
\tikz@@@plot%
}
\makeatother
% #1 number of teeths
% #2 radius intern
% #3 radius extern
% #4 angle from start to end of the first arc
% #5 angle to decale the second arc from the first
\newcommand{\gear}[5]{%
\draw[rotate=-4] (0:#2)
\foreach \i in {1,...,#1} {%
{[rotate=(\i-1)*360/#1] -- (0:#2) arc (0:#4:#2) {
-- (#4+#5:#3) arc (#4+#5:360/#1-#5:#3)}}
} -- cycle;}
\begin{tikzpicture}[remember picture,overlay]
\tikzstyle{reverseclip}=[insert path={(current page.north east) --
(current page.south east) --
(current page.south west) --
(current page.north west) --
(current page.north east)}
]
\begin{pgfinterruptboundingbox} % To make sure our clipping path does not mess up the placement of the picture
% The small disk at center will stay white (first inverse clip selection)
\path[clip] circle (0.715) -- cycle [reverseclip];
\end{pgfinterruptboundingbox}
% Both curves that cut the gear
\draw[line width=2pt] (175:1.33) .. controls +(-5:2) and +(186:0.2) .. (6:2);
\draw[line width=2pt] (185:1.33) .. controls +(-5:2) and +(186:0.2) .. (-9:2);
\begin{pgfinterruptboundingbox}
% The arrow will cover the gear (second inverse clip selection)
\path[clip] (175:1.25) arc (175:185:1.25) .. controls +(-5:2) and +(186:0.2) .. (-7.47:2.1) arc (-7.47:5.1:2.1) .. controls +(186:0.2) and +(-5:2) .. (175:1.33) -- cycle [reverseclip];
\end{pgfinterruptboundingbox}
% The gear, and the smallest circle
\gear{14}{1.05}{1.25}{10.5}{2}
\draw[line width=2pt] circle (0.75);
% Thick circles with the text
\draw[line width=2pt] circle (1.33) circle (2);
\draw[decorate,decoration={shape sep=5mm,text along path,raise=1.5mm,text={|\fontsize{16.5}{16.5}\selectfont|PROLOGIN 2013||}}] (172:1.33) arc (172:8:1.33);
% Arrow tips
\draw[line width=2pt] (10.5:2) .. controls +(-5:0.3) and +(185:0.3) .. (6:3.8) .. controls +(0,-0.2) and +(0.2,0) .. (-20:2);
% Beginning of arrow
\draw[line width=2pt] (168:2) .. controls +(190:0.36) and +(175:0.36) .. (175:2);
\draw[line width=2pt] (162:2) .. controls +(190:0.7) and +(175:0.7) .. (180:2);
\end{tikzpicture}
\end{document}
:)
double
switch actually does (I presume that's what you mean by "double the lines"). If you really want to combine them, it's certainly possible by saving each path to a macro and then concatenating the macros.