summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tikz-palattice
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-02-24 23:12:22 +0000
committerKarl Berry <karl@freefriends.org>2015-02-24 23:12:22 +0000
commit6393e0fa1c1b3ab125e43ddbeecbdca740f7d6ac (patch)
tree90fba8c6dfe27fdf2da8a732c92a9bfc1202f60f /Master/texmf-dist/tex/latex/tikz-palattice
parent1c213966cd11f3051008400dd35517dc22c1e600 (diff)
tikz-palattice (24feb15)
git-svn-id: svn://tug.org/texlive/trunk@36373 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikz-palattice')
-rw-r--r--Master/texmf-dist/tex/latex/tikz-palattice/tikz-palattice.sty647
1 files changed, 647 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tikz-palattice/tikz-palattice.sty b/Master/texmf-dist/tex/latex/tikz-palattice/tikz-palattice.sty
new file mode 100644
index 00000000000..2084ee12501
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tikz-palattice/tikz-palattice.sty
@@ -0,0 +1,647 @@
+%% tikz-palattice.sty
+%% Copyright 2015 J. Schmidt
+%% tikz-palattice LaTeX package
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is J. Schmidt.
+%
+% This work consists of the files tikz-palattice.sty and tikz-palattice_documentation.tex
+% and the 5 example files example1_linear.tex, example2_circular.tex,
+% example3_coordinates.tex, example4_labels.tex and elsa.tex
+
+\ProvidesPackage{tikz-palattice}[2015/02/23 v2.1]
+\RequirePackage{tikz}
+\RequirePackage{ifthen}
+\RequirePackage{siunitx}
+\RequirePackage{xargs}
+\RequirePackage{etoolbox}
+\usetikzlibrary{calc,positioning,fit}
+\usetikzlibrary{scopes}
+\pgfdeclarelayer{background}
+\pgfsetlayers{background,main}
+
+
+
+
+%---lattice environment---
+\newenvironmentx{lattice}[2][1=1, 2=]{%
+%begin
+\tikzpicture[node distance=0mm, remember picture, #2]
+\newdimen\labeldist
+\newdimen\savelabeldist
+\newdimen\corners;
+\newdimen\elementheight;
+\newdimen\elementwidth;
+\newdimen\markerlen;
+\pgfmathsetmacro{\scal}{#1*0.1};
+\def\labelfont{\normalsize};
+\def\labelcolor{black};
+\def\labelang{-90};
+\def\marklabelang{+90};
+\def\labelrot{0};
+\providetoggle{userlabelanchor}
+\settoggle{userlabelanchor}{false}
+\pgfmathsetlength{\labeldist}{\scal*20cm*0.35};
+\pgfmathsetlength{\savelabeldist}{\scal*20cm*0.35};
+\pgfmathtruncatemacro{\i}{0};
+\pgfmathtruncatemacro{\j}{0};
+\global\def\angle{0}
+\node (nodeeast0) [start] at (0,0) {};
+\coordinate (east\j) at (nodeeast\j.center); %\declarecoords ("east" only
+\global\providetoggle{dip} \global\settoggle{dip}{false}
+\global\providetoggle{quad} \global\settoggle{quad}{false}
+\global\providetoggle{sext} \global\settoggle{sext}{false}
+\global\providetoggle{kick} \global\settoggle{kick}{false}
+\global\providetoggle{correct} \global\settoggle{correct}{false}
+\global\providetoggle{sol} \global\settoggle{sol}{false}
+\global\providetoggle{cav} \global\settoggle{cav}{false}
+\global\providetoggle{sourc} \global\settoggle{sourc}{false}
+\global\providetoggle{scree} \global\settoggle{scree}{false}
+\global\providetoggle{valv} \global\settoggle{valv}{false}
+}{%
+%end
+\endtikzpicture
+}
+
+
+
+%---general settings---
+\newcommand{\rotate}[1]{\pgfmathparse{\angle+#1} \global\let\angle\pgfmathresult}
+\newcommand{\setangle}[1]{\pgfmathparse{#1} \global\let\angle\pgfmathresult}
+\newcommand{\start}[1]{%
+ \tikzset{x=2cm,y=2cm}
+ \node (nodeeast0) [start] at #1 {};
+ \coordinate (east\j) at (nodeeast\j.center);
+ \tikzset{x=1cm,y=1cm}
+}
+
+\newcommandx{\savecoordinate}[2][2=east]{%
+\global\csedef{angle#1}{\angle}
+\coordinate (#1) at (#2\i);
+}
+
+\newcommand{\goto}[1]{%
+\coordinate (east\j) at (#1);
+%\node[fill=yellow] at (Septum) {\csuse{angle#1}};
+\pgfmathparse{\csuse{angle#1}} \global\let\angle\pgfmathresult
+%\expandafter\global\csname angle#1\endcsname{\angle}
+}
+
+
+
+%---color settings---
+\newcommandx{\setelementcolor}[3][3=white]{%
+\tikzset{#1/.append style={bottom color=#2, top color=#3, fadeElement}}}
+\newcommand{\resetelementcolor}[1]{\tikzset{#1/.style={default_#1}}}
+\newcommand{\setlinecolor}[2]{\tikzset{#1/.append style={#2, fade}}}
+\newcommand{\resetlinecolor}[1]{\tikzset{#1/.style={default_#1}}}
+
+\newenvironmentx{fade}[1][1=0.25]{%
+\tikzset{fade/.style={opacity=#1, color=gray}}
+\tikzset{fadeElement/.style={fade, color=gray,bottom color=gray,top color=white}}
+}{%
+\tikzset{fade/.style={opacity=1.0}} % color not set
+\tikzset{fadeElement/.style={fade}}
+}
+
+
+%---label settings---
+\newenvironment{labeldistance}[1]{%
+ \pgfmathsetlength{\savelabeldist}{\labeldist}
+ \pgfmathsetlength{\labeldist}{\scal*20cm*#1};
+}{%
+ \pgfmathsetlength{\labeldist}{\savelabeldist};
+}
+
+\newcommand{\setlabeldistance}[1]{%
+\pgfmathsetlength{\savelabeldist}{\labeldist}
+\pgfmathsetlength{\labeldist}{\scal*20cm*#1};}
+\newcommand{\resetlabeldistance}{\pgfmathsetlength{\labeldist}{\savelabeldist};}
+\newcommand{\setlabelfont}[1]{\def\labelfont{#1}}
+\newcommand{\setlabelcolor}[1]{\def\labelcolor{#1}}
+
+\newcommand{\turnlabels}{%
+\ifthenelse{\labelang = -90}{%
+\def\labelang{+90} \def\marklabelang{-90}}{%
+\def\labelang{-90} \def\marklabelang{+90}}}
+
+\newcommandx{\rotatelabels}[2][2=notset]{%
+ \def\labelrot{#1}
+ \ifthenelse{\equal{#2}{notset}}{%
+ \settoggle{userlabelanchor}{false}
+ }{%
+ \settoggle{userlabelanchor}{true}
+ \def\labelanchor{#2}}
+}
+
+
+
+% rule (maßstab)
+\newcommandx{\drawrule}[4][2=1, 3=1, 4=0.06]{%
+ \coordinate (rule0) at ($(0,0)!\scal*20!#1$);
+ \tikzset{rule/.append style={line width=20pt*#4*10*\scal}}
+ \draw[rule] (rule0) --++(#2*20cm*\scal,0) coordinate (rule1) --++(0,#4*20cm*\scal)
+ --++(-#2*20cm*\scal,0) --++(0,-#4*20cm*\scal);
+ \draw[rule,fill=white] (rule1) --++(#2*20cm*\scal,0) coordinate (rule2) --++(0,#4*20cm*\scal)
+ --++(-#2*20cm*\scal,0) --++(0,-#4*20cm*\scal);
+ \draw[rule] (rule2) --++(#2*20cm*\scal,0) coordinate (rule3) --++(0,#4*20cm*\scal)
+ --++(-#2*20cm*\scal,0) --++(0,-#4*20cm*\scal);
+ \foreach \x in {0,1,2,3} {%
+ \pgfmathsetmacro{\len}{#2*\x}
+ \path [draw=none] (rule\x) --+ (-90:0.06*\labeldist/\scal) node[label, black, scale=#3, anchor=north]
+ {\SI[zero-decimal-to-integer, round-mode=places, round-precision=1]{\len}{\meter}};
+ \draw [black,line width=30pt*#4*10*\scal] (rule\x) --+ (-90:1mm);
+ \draw [black,line width=30pt*#4*10*\scal] (rule\x) --+ (90:#4*20cm*\scal+1mm);
+ }
+}
+
+%legend (types that occured in the lattice before this command)
+\newcommandx{\legend}[2][2=1]{%
+\coordinate (legendstart) at ($(0,0)!\scal*20!#1$);
+\pgfmathsetmacro{\savescal}{\scal}
+\pgfmathsetmacro{\saveang}{\angle}
+\pgfmathsetmacro{\scal}{0.05}
+\pgfmathsetmacro{\angle}{-90}
+\def\h{0.4}
+\def\l{0.3}
+\def\dist{0.18}
+\turnlabels
+\tikzset{drift/.append style={draw=none}}
+\savecoordinate{_here_}
+\coordinate (east\j) at (legendstart);
+\coordinate (legendstart') at ($(legendstart) + (-\h*\scal*15*#2,\dist*\scal*15*#2)$);
+\coordinate (legendstart'') at ($(legendstart) + (\h*\scal*15*#2,\dist*\scal*15*#2)$);
+\edef\points{(legendstart') (legendstart'')}
+\begin{scope}[scale=#2, every node/.style={scale=#2}]
+\setlabelcolor{black}
+ \iftoggle{dip}{\dipole{Dipole}{\l}{0}[s][\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{quad}{\quadrupole{Quadrupole}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{sext}{\sextupole{Sextupole}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{correct}{\corrector{Corrector}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{kick}{\kicker{Kicker}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{cav}{\cavity{Cavity}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{sol}{\solenoid{Solenoid}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{sourc}{\source{Source}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{scree}{\screen{Screen}[\l]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{valv}{\drift{\dist}\valve{Valve}\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+\end{scope}
+\node[draw=black, rounded corners, fit=\points] {};
+\pgfmathsetmacro{\scal}{\savescal}
+\pgfmathsetmacro{\angle}{\saveang}
+\tikzset{drift/.append style={draw=black}}
+\turnlabels
+\coordinate (east\j) at (_here_);
+}
+
+%complete legend (all types)
+\newcommandx{\completelegend}[2][2=1]{%
+ \settoggle{dip}{true}
+ \settoggle{quad}{true}
+ \settoggle{sext}{true}
+ \settoggle{kick}{true}
+ \settoggle{correct}{true}
+ \settoggle{sol}{true}
+ \settoggle{cav}{true}
+ \settoggle{sourc}{true}
+ \settoggle{scree}{true}
+ \settoggle{valv}{true}
+ \legend{#1}[#2]
+}
+
+
+%---commands for internal use---
+\newcommand{\updatelabelanchor}{%
+ \pgfmathtruncatemacro\iang{\angle}
+ % handle angle not in [0,360] ([-720,+1080] handled)
+ \ifthenelse{\iang<0}{\pgfmathtruncatemacro\iang{\iang+360}}{}
+ \ifthenelse{\iang<0}{\pgfmathtruncatemacro\iang{\iang+360}}{}
+ \ifthenelse{\iang>360}{\pgfmathtruncatemacro\iang{\iang-360}}{}
+ \ifthenelse{\iang>360}{\pgfmathtruncatemacro\iang{\iang-360}}{}
+ % set label anchor according to angle
+ \iftoggle{userlabelanchor}{}{% %if labelanchor is set by user just use the set value
+ \ifthenelse{\labelang = -90}{%
+ \def\labelanchor{north};
+ \ifthenelse{\iang > 30}{\def\labelanchor{west}}{}
+ \ifthenelse{\iang > 150}{\def\labelanchor{south}}{}
+ \ifthenelse{\iang > 210}{\def\labelanchor{east}}{}
+ \ifthenelse{\iang > 330}{\def\labelanchor{north}}{}
+ }{%
+ \def\labelanchor{south};
+ \ifthenelse{\iang > 30}{\def\labelanchor{east}}{}
+ \ifthenelse{\iang > 150}{\def\labelanchor{north}}{}
+ \ifthenelse{\iang > 210}{\def\labelanchor{west}}{}
+ \ifthenelse{\iang > 330}{\def\labelanchor{south}}{}
+ }
+ }
+}
+
+\newcommand{\updatemarkerlabelanchor}{%
+ \pgfmathtruncatemacro\iang{\angle}
+ % handle angle not in [0,360] ([-720,+1080] handled)
+ \ifthenelse{\iang<0}{\pgfmathtruncatemacro\iang{\iang+360}}{}
+ \ifthenelse{\iang<0}{\pgfmathtruncatemacro\iang{\iang+360}}{}
+ \ifthenelse{\iang>360}{\pgfmathtruncatemacro\iang{\iang-360}}{}
+ \ifthenelse{\iang>360}{\pgfmathtruncatemacro\iang{\iang-360}}{}
+ % set label anchor according to angle
+ \ifthenelse{\marklabelang = +90}{%
+ \def\labelanchor{south};
+ \ifthenelse{\iang > 30}{\def\labelanchor{east}}{}
+ \ifthenelse{\iang > 150}{\def\labelanchor{north}}{}
+ \ifthenelse{\iang > 210}{\def\labelanchor{west}}{}
+ \ifthenelse{\iang > 330}{\def\labelanchor{south}}{}
+ }{%
+ \def\labelanchor{north};
+ \ifthenelse{\iang > 30}{\def\labelanchor{west}}{}
+ \ifthenelse{\iang > 150}{\def\labelanchor{south}}{}
+ \ifthenelse{\iang > 210}{\def\labelanchor{east}}{}
+ \ifthenelse{\iang > 330}{\def\labelanchor{north}}{}
+ }
+}
+
+
+\newcommand{\elementlabel}[1]{%
+ \updatelabelanchor
+ \path [draw=none] (center\j) --+ (\angle\labelang:\labeldist) node[label] (elementlabel\j) {#1};
+}
+
+\newcommand{\jinc}{\pgfmathparse{int(\i+1)} \global\let\j\pgfmathresult}
+\newcommand{\iinc}{\global\let\i\j}
+\newcommand{\angleinc}[1]{\pgfmathparse{\angle+#1} \global\let\angle\pgfmathresult}
+\newcommand{\declarecoords}{\coordinate (east\j) at (nodeeast\j.center); \coordinate (center\j) at (nodecenter\j.center);}
+
+
+
+
+
+% ----- element commands -----
+% drift
+\newcommandx{\drift}[2][2=]{%
+\jinc
+\begin{pgfonlayer}{background}
+ \draw[drift] (east\i) --++ (\angle:#1*10cm*\scal) node[] (nodecenter\j) {} --++
+ (\angle:#1*10cm*\scal) node[] (nodeeast\j) {};
+\end{pgfonlayer}{background}
+\declarecoords
+\elementlabel{#2};
+\iinc;
+}
+
+%rectangle-element (used for quad,sext,kicker,cavity,...)
+\newcommandx{\rectangleelement}[4]{%
+\pgfmathsetlength{\corners}{(#2)>=0.4 ? (1mm*10*\scal) : 0mm};
+\pgfmathsetlength{\elementheight}{#3*20cm*\scal};
+\draw[drift] (east\i) --++ (\angle:#2*10cm*\scal) node[] (nodecenter\j) {} --++
+(\angle:#2*10cm*\scal) node[] (nodeeast\j) {};
+\draw[#4] (east\i) --++ (0,\elementheight/2) --++ (#2*20cm*\scal,0) --++
+(0,-\elementheight) --++ (-#2*20cm*\scal,0) --++ (0,\elementheight/2);
+}
+
+
+%dipole (br,r,s)
+\newcommandx{\dipole}[5][4=s, 5=0.6]{%
+\jinc
+\pgfmathsetlength{\corners}{(#2)>=0.4 ? (1mm*10*\scal) : 0mm};
+\pgfmathsetlength{\elementheight}{#5*20cm*\scal};
+\def\winkel{#3}
+\ifthenelse{\equal{#3}{0}}{
+ \rectangleelement{#1}{#2}{#5}{dipole}
+}{
+ \newdimen\radius
+ \newdimen\ri
+ \newdimen\ra
+ \pgfmathsetlength{\radius}{(#2*20cm*\scal)/rad(\winkel)}; % bogenlänge
+ \pgfmathsetlength{\ri}{\radius-0.5*\elementheight}
+ \pgfmathsetlength{\ra}{\radius+0.5*\elementheight}
+
+ % draw bend beampipe
+ \draw[drift,rotate=\angle] (east\i) arc (-90:(-90+\winkel/2):\radius) node[] (nodecenter\j) {};
+ \draw[drift,rotate=\angle] (nodecenter\j) arc ((-90+\winkel/2):(-90+\winkel):\radius) node[] (nodeeast\j) {};
+
+ % [r]ectangle
+ \ifthenelse{\equal{#4}{r}}{
+ \angleinc{0.5*#3}
+ \newdimen\straightlength
+ \pgfmathsetlength{\straightlength}{sin(\winkel/2)*2*\radius} % sekante des kreisbogens
+ \draw[dipole] (east\i) --++ (0,-\elementheight/2) --++ (\straightlength,0) --++
+ (0,\elementheight) --++ (-\straightlength,0) --++ (0,-\elementheight/2);
+ }{
+ % [s]ector
+ \ifthenelse{\equal{#4}{s}}{%
+ \draw[dipole] (east\i) -- ++
+ (0,-\elementheight/2) arc (-90:(-90+\winkel):\ra) -- ++(\winkel+90:\elementheight) arc
+ ((-90+\winkel):-90:\ri) --++ (0,-\elementheight);
+ \angleinc{0.5*\winkel}
+ }{
+ % [b]end[r]ectangle
+ \angleinc{0.5*#3}
+ \draw[dipole] (east\i) -- ++
+ (0,-\elementheight/2) arc (-90-\winkel/2:-90+\winkel/2:\radius) -- ++(0,\elementheight) arc
+ (-90+\winkel/2:-90-\winkel/2:\radius) -- cycle;
+ }
+ }
+}
+
+\declarecoords
+\elementlabel{#1};
+\iinc
+\global\settoggle{dip}{true}
+\angleinc{0.5*\winkel}
+}
+
+
+%quadrupole
+\newcommandx{\quadrupole}[3][3=0.5]{%
+\jinc
+\rectangleelement{#1}{#2}{#3}{quadrupole}
+\declarecoords
+\elementlabel{#1}
+\iinc
+\global\settoggle{quad}{true}
+}
+
+%sextupole
+\newcommandx{\sextupole}[3][3=0.3]{%
+\jinc
+\rectangleelement{#1}{#2}{#3}{sextupole}
+\declarecoords
+\elementlabel{#1}
+\iinc
+\global\settoggle{sext}{true}
+}
+
+%kicker
+\newcommandx{\kicker}[3][3=0.25]{%
+\jinc
+\rectangleelement{#1}{#2}{#3}{kicker}
+\declarecoords
+\elementlabel{#1}
+\iinc
+\global\settoggle{kick}{true}
+}
+
+% corrector
+\newcommandx{\corrector}[3][3=0.25]{%
+\jinc
+\rectangleelement{#1}{#2}{#3}{corrector}
+\declarecoords
+\elementlabel{#1}
+\iinc
+\global\settoggle{correct}{true}
+}
+
+%cavity
+\newcommandx{\cavity}[3][3=0.45]{%
+\jinc
+\rectangleelement{#1}{#2}{#3}{cavity}
+\declarecoords
+\elementlabel{#1}
+\iinc
+\global\settoggle{cav}{true}
+}
+
+%solenoid
+\newcommandx{\solenoid}[3][3=0.2]{%
+\jinc
+\rectangleelement{#1}{#2}{#3}{solenoid}
+\declarecoords
+\elementlabel{#1}
+\iinc
+\global\settoggle{sol}{true}
+}
+
+%beamdump
+\newcommandx{\beamdump}[3][3=0.5]{%
+\jinc
+\rectangleelement{#1}{#2}{#3}{beamdump}
+\declarecoords
+\elementlabel{#1}
+\iinc
+%\global\settoggle{}{true} no legend for beamdump
+}
+
+%source
+\newcommandx{\source}[3][3=0.5]{%
+\jinc
+\pgfmathsetlength{\corners}{(#2)>=0.4 ? (1mm*10*\scal) : 0mm};
+\pgfmathsetlength{\elementheight}{#3*20cm*\scal};
+\draw[drift] (east\i) --++ (\angle:#2*10cm*\scal) node[] (nodecenter\j) {} --++
+(\angle:#2*10cm*\scal) node[] (nodeeast\j) {};
+\draw[source] (east\i) --++ (0,\elementheight/2) --++ (#2*20cm*\scal,-\elementheight/2)
+--++ (-#2*20cm*\scal,-\elementheight/2) --++ (0,\elementheight/2);
+\declarecoords
+\elementlabel{#1}
+\iinc
+\global\settoggle{sourc}{true}
+}
+
+%screen
+\newcommandx{\screen}[2][2=0.2]{%
+\jinc
+\pgfmathsetlength{\corners}{(#2)>=0.4 ? (1mm*10*\scal) : 0mm};
+\newdimen\radius
+\pgfmathsetlength{\radius}{#2*20cm*\scal/2};
+\draw[drift] (east\i) --++ (\angle:#2*10cm*\scal) node[] (nodecenter\j) {} --++
+(\angle:#2*10cm*\scal) node[] (nodeeast\j) {};
+\draw[screen] (nodecenter\j.center) circle (\radius);
+\draw[screen] (nodecenter\j.center) --++ (45:\radius);
+\draw[screen] (nodecenter\j.center) --++ (45+180:\radius);
+\declarecoords
+\elementlabel{#1}
+\iinc
+\global\settoggle{scree}{true}
+}
+
+%valve
+\newcommandx{\valve}[2][2=0.01]{%
+\jinc
+\rectangleelement{#1}{#2}{0.15}{valve}
+\declarecoords
+\elementlabel{#1}
+\iinc
+\global\settoggle{valv}{true}
+}
+
+
+%marker
+\newcommandx{\marker}[2][2=0.35]{%
+\pgfmathsetlength{\markerlen}{#2*20cm*\scal};
+\updatemarkerlabelanchor
+\draw [marker] (east\i) --+ (\angle-90:\markerlen); % half length (=> 10cm)
+\draw [marker] (east\i) --+ (\angle+90:\markerlen);
+\draw [draw=none] (east\i) --+ (\angle\marklabelang:\markerlen+0.5*\labeldist) node[label] {#1};
+}
+
+
+
+
+
+% ----- styles -----
+%fade (for global fade setting)
+\tikzset{fade/.style={
+opacity=1
+}}
+\tikzset{fadeElement/.style={
+fade
+}}
+
+%element (for all, except drift)
+\tikzset{element/.style={
+rounded corners=\corners,
+line width=0.8pt*10*\scal, draw=black,
+top color=white,
+anchor=west,
+rotate=\angle,
+fadeElement %must be last to overwrite other settings
+}}
+
+%dipole
+\tikzset{default_dipole/.style={
+bottom color=blue,
+element,
+},
+dipole/.style={default_dipole}
+}
+
+
+%quadrupole
+\tikzset{default_quadrupole/.style={
+bottom color=yellow,
+element
+},
+quadrupole/.style={default_quadrupole}
+}
+
+%sextupole
+\tikzset{default_sextupole/.style={
+bottom color=violet!70!black,
+element
+},
+sextupole/.style={default_sextupole}
+}
+
+%kicker
+\tikzset{default_kicker/.style={
+bottom color=red!90!black,
+element
+},
+kicker/.style={default_kicker}
+}
+
+%corrector
+\tikzset{default_corrector/.style={
+bottom color=orange!90!black,
+element
+},
+corrector/.style={default_corrector}
+}
+
+%cavity
+\tikzset{default_cavity/.style={
+bottom color=brown!80!black,
+element
+},
+cavity/.style={default_cavity}
+}
+
+%solenoid
+\tikzset{default_solenoid/.style={
+bottom color=green!70!black,
+element
+},
+solenoid/.style={default_solenoid}
+}
+
+%beamdump
+\tikzset{default_beamdump/.style={
+bottom color=gray,
+element
+},
+beamdump/.style={default_beamdump}
+}
+
+%source
+\tikzset{default_source/.style={
+bottom color=gray,
+element
+},
+source/.style={default_source}
+}
+
+%screen
+\tikzset{default_screen/.style={
+bottom color=white,
+element
+},
+screen/.style={default_screen}
+}
+
+%valve
+\tikzset{default_valve/.style={
+bottom color=gray,
+element,
+top color=gray,
+draw=none
+},
+valve/.style={default_valve}
+}
+
+
+
+%drift
+\tikzset{default_drift/.style={
+line width=0.8pt*10*\scal, draw=black,
+fade %must be last to overwrite other settings
+},
+drift/.style={default_drift}
+}
+
+%text label
+\tikzset{label/.style={
+text=\labelcolor,
+font=\labelfont,
+rotate=\labelrot,
+anchor=\labelanchor,
+fade %must be last to overwrite other settings
+}}
+
+%marker (line)
+\tikzset{default_marker/.style={
+red, densely dashed,
+fade %must be last to overwrite other settings
+},
+marker/.style={default_marker}
+}
+
+%rule
+\tikzset{rule/.style={
+draw=black,
+fill=black,
+fade %must be last to overwrite other settings
+}}
+
+%start
+\tikzset{start/.style={%
+draw=none,
+anchor=center,
+scale=0.1,
+fade %must be last to overwrite other settings
+}}