I was wondering what would be a good way to make this in LaTeX. Basically, what I want to do with this is use it as a chapter heading. So basically it will be something like this:
cog chapter # Chapter name
What would be the best way to achieve this? Am I better off using the image or making it myself?
Thanks a lot for you time!
EDIT: I have done what the comments have recommended but I am having difficult implementing the gear into the chapter heading using titlesec
. Here is the MWE:
\documentclass[12pt]{memoir}
\usepackage{tikz}
\usepackage{titlesec}
% #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]{%
\foreach \i in {1,...,#1} {%
[rotate=(\i-1)*360/#1] (0:#2) arc (0:#4:#2) {[rounded corners=1.5pt]
-- (#4+#5:#3) arc (#4+#5:360/#1-#5:#3)} -- (360/#1:#2)
}}
\titleformat{\chapter}{\Huge\bfseries}{\usebox{\gear{18}{0.5}{0.4}{10}{2}}\thechapter}{20pt}{\Huge\bfseries}
\begin{document}
\begin{tikzpicture}
\draw[thick] \gear{18}{0.5}{0.4}{10}{2};
\end{tikzpicture}
\chapter{Whatever}
\end{document}
EDIT 2: With the help of @Qrrbrbirlbel and @StefanKottwitz I have gotten the following:
\documentclass[12pt]{memoir}
\usepackage{tikz}
\usepackage{titlesec}
\newsavebox\gearbox
\newcommand{\gear}[5]{%
\begin{tikzpicture}
\draw[ultra thick]
\foreach \i in {1,...,#1} {%
[rotate=(\i-1)*360/#1] (0:#2) arc (0:#4:#2) {[rounded corners=1.5pt]
-- (#4+#5:#3) arc (#4+#5:360/#1-#5:#3)} -- (360/#1:#2)
};\end{tikzpicture}}
\sbox\gearbox{\resizebox{!}{2em}{\gear{18}{2}{1.6}{10}{2}}}
\titleformat{\chapter}{\Huge\bfseries}{\usebox{\gearbox}\thechapter}{20pt}{\Huge\bfseries}
\begin{document}
\chapter{Whatever}
\end{document}
But I would like to have the gear look more like this and have the gear behind the chapter number. How can this be done?
titlesec
package. Take a look at Book layout Contents, Chapter, Section,. What class are you using? – Qrrbrbirlbel Mar 4 '13 at 22:15memoir
package – Jeel Shah Mar 5 '13 at 0:32tikz
is beyond me), stick the picture in a\newsavebox{\gear}
and use\titleformat{\chapter}{\Huge\bfseries}{\usebox{\gear}\thechapter}{20pt}{\Huge\bfseries}
in your preamble. (usingtitlesec
, of course.) (20pt
here is arbitrary, but a value is required.) – Sean Allred Mar 6 '13 at 19:54