Curved waved lines with TikZ
Actually the library snakes
has been superseded by decorations
, but for your need I think you are just looking for decorations.pathmorphing
.
Thus, your code revised, is like:
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\tikzset{snake it/.style={decorate, decoration=snake}}
\begin{document}
\vspace*{2cm}
\begin{center}
\begin{tikzpicture}[thick]
\path [draw=blue,snake it]
(-4,0) -- (-2,0) -- (2,0) -- (4,0);
\draw[draw=blue, snake it] (2,0) arc (0:180:2cm);
\end{tikzpicture}
\end{center}
\end{document}
Notice that I grouped in a single style snake it
the keys that really set up the decoration decorate
and the one that sets the type of decoration decoration=snake
.
For further details, you can have a look to section 72 Decorations and more specifically to section 30.2 Path Morphing Decorations on the pgfmanual. (section 48.2 in pgfmanual 3.0)
The new TikZ-Feynman package (see also the project page) makes it easy to create Feynman diagrams.
The following is just an example to show its capabilities. The relevant key to produce the half circle is half left
. You have to compile with lualatex
in order to exploit the automatic positioning of vertices.
\documentclass[tikz]{standalone}
\usepackage{tikz-feynman}
\begin{document}
\feynmandiagram [layered layout, horizontal=a to d] {
a -- [scalar,red] b -- [fermion,blue] c -- [gluon,orange] d,
b -- [photon, half left] c, % this produces the curved photon line
};
\end{document}