7

I'm creating a series of icons for a book with TikZ. I'm having trouble with one, however. The code below is how the icons appear: they are shadowed circles with a letter or number. However, I need one that looks like the picture below. Could anyone kindly tell me how to adapt my code below to reproduce this? Thank you!

Squiggly line icon

\documentclass[11pt]{article}

%---Tikz Icons Section

\usepackage{pstricks}
\usepackage[framemethod=tikz]{mdframed}

\usetikzlibrary{shadows}
\usepackage{rotating}
\usepackage{etoolbox}
\newrobustcmd{\icon}[1]{\includegraphics[height=12pt]{#1}}


\begin{document}

\begin{center}
\resizebox{3cm}{3cm}{%
\begin{tikzpicture}[scale=4, transform shape]
\tikzstyle{every node} = [circle, circular drop shadow, fill=orange!80]
\node (a) at (0, 0) {!};

\end{tikzpicture}
}
\end{center}

\end{document}
  • 1
    Band limited noise would do a reasonable job, but would have a hard time with the sharp v bottoms. You could just use an image, unless you need to make each one slightly different. – John Kormylo Mar 1 '16 at 15:07
12

For instance like this. Control the width of the line using line width, control the number of samples using samples and control the envelope function of the noise using the constant before rand.

\begin{document}

\begin{center}
\begin{tikzpicture}
\draw[fill=black!80, circular drop shadow] (0,0) circle (1.5cm);

\draw[line width=1pt, color=white] plot [domain=-1.45:1.45, samples=64, smooth] (\x,{0.1*rand});
\end{tikzpicture}
\end{center}

\end{document}

Result: enter image description here

  • However! For some reason this messes up my drop shadow that I had. Why is that? – Linter Mar 1 '16 at 18:02
  • 1
    Hi, I updated the code to include the shadow. I also changed the scale parameter to 1, which caused the wiggly line to break, so I had to change its parameters slightly as well. Now the shadow works as expected. – Augustin Mar 1 '16 at 20:15
  • Thanks, I tried to reproduce this myself but failed. This is great work. Thanks so much for your assistance, @Augustin. – Linter Mar 1 '16 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.