summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikz-palattice
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/pgf/contrib/tikz-palattice
Initial commit
Diffstat (limited to 'graphics/pgf/contrib/tikz-palattice')
-rw-r--r--graphics/pgf/contrib/tikz-palattice/Makefile40
-rw-r--r--graphics/pgf/contrib/tikz-palattice/README13
-rw-r--r--graphics/pgf/contrib/tikz-palattice/elsa.tex952
-rw-r--r--graphics/pgf/contrib/tikz-palattice/example1_linear.tex53
-rw-r--r--graphics/pgf/contrib/tikz-palattice/example2_circular.tex60
-rw-r--r--graphics/pgf/contrib/tikz-palattice/example3_coordinates.tex242
-rw-r--r--graphics/pgf/contrib/tikz-palattice/example4_labels.tex308
-rw-r--r--graphics/pgf/contrib/tikz-palattice/example5_legend.tex112
-rw-r--r--graphics/pgf/contrib/tikz-palattice/tikz-palattice.sty713
-rw-r--r--graphics/pgf/contrib/tikz-palattice/tikz-palattice_documentation.pdfbin0 -> 510771 bytes
-rw-r--r--graphics/pgf/contrib/tikz-palattice/tikz-palattice_documentation.tex767
11 files changed, 3260 insertions, 0 deletions
diff --git a/graphics/pgf/contrib/tikz-palattice/Makefile b/graphics/pgf/contrib/tikz-palattice/Makefile
new file mode 100644
index 0000000000..b985a3967a
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-palattice/Makefile
@@ -0,0 +1,40 @@
+latex = pdflatex
+packagename = tikz-palattice
+INSTALL_PATH = /usr/local/share/texmf/tex/latex
+e1 = example1_linear
+e2 = example2_circular
+e3 = example3_coordinates
+e4 = example4_labels
+e5 = elsa
+doc = tikz-palattice_documentation
+
+all: doc allexamples
+doc: $(doc).pdf
+allexamples: $(e1).pdf $(e2).pdf $(e3).pdf $(e4).pdf $(e5).pdf
+
+
+$(e1).pdf: $(e1).tex
+ $(latex) $<
+
+$(e2).pdf: $(e2).tex
+ $(latex) $<
+
+$(e3).pdf: $(e3).tex
+ $(latex) $<
+
+$(e4).pdf: $(e4).tex
+ $(latex) $<
+
+$(e5).pdf: $(e5).tex
+ $(latex) $<
+
+$(doc).pdf: $(doc).tex $(e1).pdf $(e5).pdf
+ $(latex) $<
+
+
+install:
+ install -m 644 -p -D -v tikz-palattice.sty $(INSTALL_PATH)/$(packagename)/$(packagename).sty
+ mktexlsr
+
+clean:
+ rm $(e1).pdf $(e2).pdf $(e3).pdf $(e4).pdf $(e5).pdf
diff --git a/graphics/pgf/contrib/tikz-palattice/README b/graphics/pgf/contrib/tikz-palattice/README
new file mode 100644
index 0000000000..cefce969a9
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-palattice/README
@@ -0,0 +1,13 @@
+Package Name: tikz-palattice
+
+Author Name: Jan Schmidt
+
+License: LaTeX Project Public License 1.3
+
+Description: The tikz-palattice package allows for drawing a map of a particle accelerator just by
+giving a list of elements - similar to lattice files for simulation software. The
+package includes 12 common element types like dipoles, quadrupoles, cavities or screens,
+as well as automatic labels with element names, a legend, a rule and an environment to
+fade out parts of the accelerator. The coordinate of any element can be saved and used
+for custom tikz drawings or annotations. Thereby, lattices can be connected to draw
+injection/extraction or even a complete accelerator facility. \ No newline at end of file
diff --git a/graphics/pgf/contrib/tikz-palattice/elsa.tex b/graphics/pgf/contrib/tikz-palattice/elsa.tex
new file mode 100644
index 0000000000..859e296dee
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-palattice/elsa.tex
@@ -0,0 +1,952 @@
+%% elsa.tex
+%% Copyright 2017 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
+
+
+\documentclass[tikz]{standalone}
+%\usepackage[ngerman]{babel}
+\usepackage[english]{babel}
+\usepackage[utf8]{inputenc}
+\usepackage{iflang}
+\usepackage{tikz-palattice}
+
+\sisetup{range-units=single, range-phrase=\,-\,, detect-weight=true, detect-family=true}
+\addto\extrasngerman{\sisetup{locale = DE}}
+\addto\extrasenglish{\sisetup{locale = US}}
+
+\def\scale{0.5}
+
+\tikzset{biggestlabel/.style={font=\bfseries\Huge,scale=2.5, align=center,faded}}
+\tikzset{biglabel/.style={font=\bfseries\Huge,scale=2, align=center,faded}}
+\tikzset{mediumlabel/.style={font=\huge,scale=2, align=center,faded}}
+\tikzset{smalllabel/.style={font=\Large,scale=2.2, align=center,faded}}
+\tikzset{experimentlabel/.style={mediumlabel, fill=white, fill opacity=0.7, text opacity=1}}
+
+
+
+% ---------------------------------------------------------------------
+% The lattice data given in this file is designated for drawing a map
+% and should not be used for any calculations or simulation!
+% ---------------------------------------------------------------------
+
+\begin{document}
+\begin{lattice}[\scale]
+\def\quadl{0.2}
+\setelementcolor{dipole}{blue!55!cyan!90}[blue!55!cyan!90]
+\setelementcolor{solenoid}{cyan}
+\setlinecolor{drift}{red!70!black}
+\def\photonbeam{black}
+% "switch labels off":
+%\setlabelcolor{white}
+
+\drawrule{(58,-7)}[5][3][0.3]
+\setangle{180}
+\start{(0,0)}
+
+%-----------------------------------
+%LINAC2
+%-----------------------------------
+\northlabels
+\source{}{1}
+\savecoordinate{PolQ}[center]
+\drift{2.5}
+\drift{0.5} % wand
+\source{}{0.2}
+\drift{0.8}
+\savecoordinate{L2label}
+\cavity{}{3.85}
+\drift{0.35}
+\quadrupole{Q1}{\quadl}
+\drift{0.5}
+\quadrupole{Q2}{\quadl}
+\drift{0.35}
+\quadrupole{Q3}{\quadl}
+\drift{0.3}
+\dipole{M90}{0.5}{-90}
+\drift{0.3}
+\quadrupole{Q4}{\quadl}
+\drift{0.75}
+\quadrupole{Q5}{\quadl}
+\drift{1.9}
+\quadrupole{Q6}{\quadl}
+\drift{3.55}
+\quadrupole{Q7}{\quadl}
+\drift{2.1}
+\corrector{KD}{\quadl}
+\drift{2.1}
+\dipole{}{0.4}{0}[r][0.3] % M3
+\savecoordinate{M3}[center]
+\drift{0.4}
+\quadrupole{Q8}{\quadl}
+\drift{3}
+\savecoordinate{BoosterInj}
+
+%title
+\node[mediumlabel, anchor=north, yshift=-1cm] at (L2label)
+{LINAC 2\\{\Large \SI{26}{\MeV}}};
+\node[mediumlabel, anchor=west, xshift=4mm] at (PolQ)
+{\IfLanguageName{ngerman}{Quelle}{Source of} pol.
+ $e^-$};
+
+
+%-----------------------------------
+%LINAC1
+%lattice backwards to set start at M3
+%-----------------------------------
+\goto{M3}
+\setangle{-180}
+\northlabels
+\drift{0.44}
+\quadrupole{Q7}{\quadl}
+\drift{0.2}
+\quadrupole{Q6}{\quadl}
+\drift{0.35}
+\turnlabels
+\dipole{M2}{0.3}{45}
+\drift{1.1}
+\dipole{M1}{0.3}{45}
+\savecoordinate{M1}[center]
+\southlabels
+\drift{0.58}
+\quadrupole{Q5}{\quadl}
+\drift{0.36}
+\quadrupole{Q4}{\quadl}
+\drift{0.58}
+\quadrupole{Q3}{\quadl}
+\drift{0.38}
+\cavity{}{0.67}[0.3] %EKS
+\drift{0.1}
+\dipole{EKS}{0.2}{0}
+\rotate{60}
+\drift{0.15}
+\rotate{-60}
+\dipole{}{0.2}{0}
+\rotate{-60}
+\drift{0.15}
+\rotate{60}
+\dipole{}{0.2}{0}
+\drift{0.07}
+\quadrupole{Q2}{\quadl}
+\drift{0.13}
+\quadrupole{Q1}{\quadl}
+\drift{0.16}
+\savecoordinate{L1label}
+\cavity{}{2.73}
+\drift{0.35}
+\dipole{}{0.35}{0}
+\drift{0.17}
+\drift{1.3}
+\rotate{180}
+\source{}{0.5}
+
+%title
+\node[mediumlabel, xshift=-1cm, anchor=east] at (L1label)
+{LINAC 1\\{\Large \SI{20}{\MeV}}};
+
+
+%-----------------------------
+%LINAC1-Bestrahlungsplatz
+%-----------------------------
+\goto{M1}
+\setangle{90}
+\northlabels
+\drift{0.25}
+\drift{0.37}
+\quadrupole{QT1}{\quadl}
+\drift{0.2}
+\quadrupole{QT2}{\quadl}
+\drift{0.45}
+\savecoordinate{bestrahlung}
+\beamdump{}{0.5}
+%title
+\node[smalllabel, yshift=5mm, anchor=east, text width=3cm] at (bestrahlung)
+{\IfLanguageName{ngerman}{Bestrahlungs\-platz}{irradiation area}};
+
+
+%-----------------------------
+%Booster
+%-----------------------------
+% custom legend entry for combined function magnets
+\addlegendentry{Combined Function}{fill=green!55!black}
+\begin{scope}
+\setelementcolor{dipole}{green!55!black}[green!55!black]
+\goto{BoosterInj}
+\southlabels
+%\marker{Start}[0.5]
+\setlabeldistance{0.5}
+\kicker{INJSEPT}{0.88}
+\savecoordinate{links}
+\drift{0.44725}
+\dipole{M1}{4.0056}{-30}[s][0.6]
+\drift{1.7945}
+\dipole{M2}{4.0056}{-30}[s][0.6]
+\drift{0.35975}
+\kicker{B1}{0.3875}
+\drift{0.3}
+\kicker{K1}{0.3875}
+\drift{0.35975}
+\dipole{M3}{4.0056}{-30}[s][0.6]
+\drift{0.35975}
+\kicker{B2}{0.3875}
+\drift{0.3}
+\kicker{S1}{0.3875}
+\drift{0.35975}
+\dipole{M4}{4.0056}{-30}[s][0.6]
+\drift{0.4295}
+\corrector{VC1}{0.13}
+\drift{0.245}
+\kicker{S2}{0.63}
+\drift{0.36}
+\dipole{M5}{4.0056}{-30}[s][0.6]
+\drift{0.34225}
+\kicker{S3}{1.08}
+\savecoordinate{Booster_extract}[center]
+\drift{0.37225}
+\dipole{M6}{4.0056}{-30}[s][0.6]
+\drift{0.38725}
+\corrector{VC2}{0.13}
+\drift{0.315}
+\kicker{B3}{0.6}
+\savecoordinate{rechts}
+\drift{0.36225}
+\dipole{M7}{4.0056}{-30}[s][0.6]
+\drift{0.49225}
+\corrector{VC3}{0.13}
+\drift{0.295}
+\kicker{K2}{0.45}
+\drift{0.42725}
+\dipole{M8}{4.0056}{-30}[s][0.6]
+\drift{0.86225}
+\kicker{K3}{0.45}
+\drift{0.48225}
+\dipole{M9}{4.0056}{-30}[s][0.6]
+\drift{0.44725}
+\cavity{DORIS}{0.9}
+\drift{0.44725}
+\dipole{M10}{4.0056}{-30}[s][0.6]
+\drift{1.7945}
+\dipole{M11}{4.0056}{-30}[s][0.6]
+\drift{1.7945}
+\dipole{M12}{4.0056}{-30}[s][0.6]
+\drift{0.46725}
+\end{scope}
+
+%title
+\path (links) -- (rechts) node[midway,biggestlabel, text width=6cm] {Booster-
+ Synchrotron\\{\SIrange{0.5}{1.2}{\GeV}}}; %\\{\it\SI{120}{\GeV\per\s}}
+
+
+
+%-----------------------------
+% Transferkanal Booster->ELSA
+%-----------------------------
+\goto{Booster_extract}
+\setangle{-47}
+\northlabels
+\drift{2}
+\corrector{KV1}{0.25}
+\drift{0.16}
+\quadrupole{QA}{0.48}
+\drift{0.16}
+\corrector{KV2}{0.25}
+\turnlabels
+\drift{1.4}
+\corrector{KV3}{0.25}
+\drift{0.16}
+\quadrupole{QB}{0.48}
+\drift{3.67}
+\quadrupole{QC}{0.48}
+\drift{0.16}
+\corrector{}{0.25}
+\drift{1.9}
+\savecoordinate{ELSA_inject}
+
+
+
+%-----------------------------
+% Stretcherring
+%-----------------------------
+\goto{ELSA_inject}
+\setangle{-55}
+\setlabeldistance{0.5}
+\northlabels
+
+% "end" put at beginning to start at injection
+\drift{0.2325}
+\screen{}[0.025] %BPM31
+\drift{0.01665}
+\quadrupole{QD31}{0.4997}
+\drift{0.02115}
+%\marker{IC31}
+\drift{0.28}
+\dipole{M31}{2.875}{15}
+\drift{0.2765}
+\corrector{KV31}{0.13}
+\drift{0.1615}
+\corrector{MSI31}{0.6}
+\drift{0.2745}
+%\marker{IC32}
+\drift{0.01915}
+\quadrupole{QF32}{0.4997}
+\drift{0.01115}
+\screen{}[0.025] %BPM32
+\drift{0.1005}
+\sextupole{SX32}{0.287}
+\drift{0.2069}
+\quadrupole{LQ32}{0.45}[0.2]
+\drift{0.5296}
+\corrector{KV32}{0.13}
+\drift{0.35375}
+\quadrupole{SQ32}{0.45}
+\drift{1.382}
+\quadrupole{TJQ32}{0.5515}[0.2]
+\drift{0.12625}
+
+% usual start
+%\marker{start}[0.5]
+\drift{0.013}
+%\marker{IC01}
+\drift{0.02115}
+\quadrupole{QD1}{0.4997}
+\drift{0.00365}
+\screen{}[0.025] %BPM01
+\drift{0.6285}
+\corrector{KV01}{0.13}
+\drift{1.30675}
+\quadrupole{SQ1}{0.45}
+\drift{1.01375}
+\quadrupole{LQ1}{0.45}[0.2]
+\drift{0.2065}
+\sextupole{SX1}{0.287}
+\drift{0.0825}
+%\marker{IC02}
+\drift{0.05415}
+\quadrupole{QF2}{0.4997}
+\drift{0.00615}
+\screen{}[0.025] %BPM02
+\drift{0.2145}
+\corrector{IJK2}{0.73}
+\drift{0.0595}
+\corrector{KV02}{0.13}
+\drift{0.2962}
+\dipole{M2}{2.875}{15}
+\drift{0.2803}
+%\marker{IC03}
+\drift{0.02115}
+\begin{scope}
+ \rotatelabels{55}[west]
+ \quadrupole{QD3}{0.4997}
+ \drift{0.00865}
+ \screen{}[0.025] %BPM03
+ \drift{0.103}
+ \sextupole{SD3}{0.287}
+ \drift{0.1025}
+ \corrector{KV03}{0.13}
+ \drift{3.011}
+ \corrector{IJK3}{0.73}
+ \drift{0.2195}
+ % \marker{IC04}
+ \drift{0.02115}
+ \quadrupole{QF4}{0.4997}
+ \drift{0.01115}
+ \screen{}[0.025] %BPM04
+ \drift{0.1005}
+ \sextupole{SF4}{0.287}
+ \drift{0.1995}
+ \corrector{KV04}{0.13}
+ \drift{0.7082}
+\end{scope}
+\dipole{M4}{2.875}{15}
+\drift{0.2803}
+%\marker{IC05}
+\drift{0.02115}
+\begin{scope}
+ \rotatelabels{90}[west]
+ \quadrupole{QD5}{0.4997}
+ \drift{0.00365}
+ \screen{}[0.025] %BPM05
+ \drift{0.1545}
+ \corrector{KV05}{0.13}
+ \drift{1.1482}
+\end{scope}
+\dipole{M5}{2.875}{15}
+\drift{0.2803}
+%\marker{IC06}
+\drift{0.02115}
+\begin{scope}
+ \rotatelabels{90}[west]
+ \quadrupole{QF6}{0.4997}
+ \drift{0.00615}
+ \screen{}[0.025] %BPM06
+ \drift{0.1745}
+ \kicker{MSE6}{0.65}
+ \drift{0.139}
+ % \marker{ICMSE6}
+ \drift{0.0185}
+ \corrector{KV06}{0.13}
+ \drift{0.3182}
+\end{scope}
+\dipole{M6}{2.875}{15}
+\drift{0.2803}
+%\marker{IC07}
+\drift{0.02115}
+\quadrupole{QD7}{0.4997}
+\drift{0.00865}
+\screen{}[0.025] %BPM07
+\drift{0.185}
+\kicker{MSE7}{0.9}
+\savecoordinate{ELSA_extract_neu}
+
+
+\drift{0.3427}
+\dipole{M7}{2.875}{15}
+\savecoordinate{sylibeamline}[center]
+
+
+\drift{0.2803}
+%\marker{IC08}
+\drift{0.02115}
+\quadrupole{QF8}{0.4997}
+\drift{0.01115}
+\screen{}[0.025] %BPM08
+\drift{0.971}
+\corrector{KV08}{0.13}
+\drift{0.3242}
+\dipole{M8}{2.875}{15}
+\drift{0.30145}
+\quadrupole{QD9}{0.4997}
+\drift{0.00365}
+\screen{}[0.025] %BPM09
+\drift{0.2727}
+\dipole{M9}{2.875}{15}
+\drift{0.3473}
+\corrector{KV09}{0.13}
+\drift{0.963}
+%\marker{IC10}
+\drift{0.02115}
+\quadrupole{QF10}{0.4997}
+\drift{0.00615}
+\screen{}[0.025] %BPM10
+\drift{0.2702}
+\dipole{M10}{2.875}{15}
+\drift{0.6963}
+\corrector{KV10}{0.13}
+\drift{0.2115}
+\sextupole{SD10}{0.287}
+\drift{0.105}
+\screen{}[0.025] %BPM11
+\drift{0.00665}
+\quadrupole{QD11}{0.4997}
+\drift{0.02115}
+%\marker{IC11}
+\drift{0.2802}
+\dipole{M11}{2.875}{15}
+\drift{0.7103}
+\corrector{KV11}{0.13}
+\drift{0.1975}
+\sextupole{SF11}{0.287}
+\drift{0.1075}
+\screen{}[0.025] %BPM12
+\drift{0.00415}
+\quadrupole{QF12}{0.4997}
+\drift{0.02115}
+%\marker{IC12}
+\drift{0.2802}
+\dipole{M12}{2.875}{15}
+\drift{1.1563}
+\corrector{KV12}{0.13}
+\drift{0.154}
+%\marker{IC13}
+\drift{0.02115}
+\quadrupole{QD13}{0.4997}
+\drift{0.00365}
+\screen{}[0.025] %BPM13
+\drift{0.2727}
+\dipole{M13}{2.875}{15}
+\drift{0.7263}
+\corrector{KV13}{0.13}
+\drift{0.584}
+%\marker{IC14}
+\drift{0.02115}
+\quadrupole{QF14}{0.4997}
+\savecoordinate{rechts}
+
+
+\drift{0.00615}
+\screen{}[0.025] %BPM14
+\drift{3.6265}
+\corrector{KV14}{0.13}
+\drift{0.829}
+%\marker{IC15}
+\drift{0.02115}
+\quadrupole{QD15}{0.4997}
+\drift{0.00865}
+\screen{}[0.025] %BPM15
+\drift{0.2677}
+\dipole{M15}{2.875}{15}
+\drift{1.1483}
+\corrector{KV15}{0.13}
+\drift{0.162}
+%\marker{IC16}
+\drift{0.02115}
+\quadrupole{QF16}{0.4997}
+\drift{0.01115}
+\screen{}[0.025] %BPM16
+\drift{0.1005}
+\sextupole{SX16}{0.287}
+\drift{0.2065}
+\quadrupole{LQ16}{0.45}[0.2]
+\drift{0.3075}
+\cavity{PETRA1}{1.6}
+\drift{0.93725}
+\quadrupole{TJQD16}{0.5515}[0.2]
+\drift{0.12475}
+\screen{}[0.025] %BPM17
+\drift{0.01165}
+\quadrupole{QD17}{0.4997}
+\drift{0.02115}
+%\marker{IC17}
+\drift{0.429}
+\cavity{PETRA2}{1.6}
+\drift{0.311}
+\corrector{KV17}{0.13}
+\drift{1.0665}
+\quadrupole{LQ17}{0.45}[0.2]
+\drift{0.2065}
+\sextupole{SX17}{0.287}
+\drift{0.0825}
+%\marker{IC18}
+\drift{0.05415}
+\quadrupole{QF18}{0.4997}
+\drift{0.00615}
+\screen{}[0.025] %BPM18
+\drift{0.962}
+\corrector{KV18}{0.13}
+\drift{0.3382}
+\dipole{M18}{2.875}{15}
+\drift{0.2803}
+%\marker{IC19}
+\drift{0.02115}
+\begin{scope}
+ \rotatelabels{60}[east]
+ \quadrupole{QD19}{0.4997}
+ \drift{0.00865}
+ \screen{}[0.025] %BPM19
+ \drift{0.103}
+ \sextupole{SD19}{0.287}
+ \drift{0.2105}
+ \corrector{KV19}{0.13}
+ \drift{0.507}
+ \screen{}[0] %FMON
+ \drift{2.943}
+ \sextupole{SF19}{0.287}
+ \drift{0.1075}
+ \screen{}[0.025] %BPM20
+ \drift{0.00415}
+ \quadrupole{QF20}{0.4997}
+ \drift{0.02115}
+ % \marker{IC20}
+ \drift{0.985}
+ \corrector{KV20}{0.13}
+ \drift{0.3252}
+\end{scope}
+\dipole{M20}{2.875}{15}
+\begin{scope}
+ \rotatelabels{90}[east]
+ \drift{0.2803}
+ % \marker{IC21}
+ \drift{0.02115}
+ \quadrupole{QD21}{0.4997}
+ \drift{0.00365}
+ \screen{}[0.025] %BPM21
+ \drift{0.1765}
+ \corrector{KV21}{0.13}
+ \drift{1.126}
+\end{scope}
+\dipole{M21}{2.875}{15}
+\begin{scope}
+ \rotatelabels{90}[east]
+ \drift{0.2805}
+ % \marker{IC22}
+ \drift{0.02115}
+ \quadrupole{QF22}{0.4997}
+ \drift{0.00615}
+ \screen{}[0.025] %BPM22
+ \drift{0.1315}
+ \kicker{MSE22}{0.65}
+ \drift{0.165}
+ % \marker{ICMSE22}
+ \drift{0.0005}
+ \corrector{KV22}{0.13}
+ \drift{0.3535}
+\end{scope}
+\dipole{M22}{2.875}{15}
+\drift{0.28}
+%\marker{IC23}
+\drift{0.02115}
+\quadrupole{QD23}{0.4997}
+\drift{0.00865}
+\screen{}[0.025] %BPM23
+\drift{0.1765}
+\kicker{MSE23}{0.9}
+\savecoordinate{ELSA_extract}
+
+
+\drift{0.351}
+\dipole{M23}{2.875}{15}
+\drift{0.2805}
+%\marker{IC24}
+\drift{0.02115}
+\quadrupole{QF24}{0.4997}
+\drift{0.01115}
+\screen{}[0.025] %BPM24
+\drift{0.886}
+\corrector{KV24}{0.13}
+\drift{0.4095}
+\dipole{M24}{2.875}{15}
+\drift{0.2645}
+\screen{}[0.025] %BPM25
+\drift{0.01165}
+\quadrupole{QD25}{0.4997}
+\savecoordinate{compton}[center]
+
+
+\drift{0.02115}
+%\marker{IC25}
+\drift{0.28}
+\dipole{M25}{2.875}{15}
+\drift{0.6985}
+\corrector{KV25}{0.13}
+\drift{0.612}
+%\marker{IC26}
+\drift{0.02115}
+\quadrupole{QF26}{0.4997}
+\drift{0.00615}
+\screen{}[0.025] %BPM26
+\drift{0.2705}
+\dipole{M26}{2.875}{15}
+\drift{0.729}
+\corrector{KV26}{0.13}
+\drift{0.178}
+\sextupole{SD26}{0.287}
+\drift{0.1055}
+\screen{}[0.025] %BPM27
+\drift{0.00665}
+\quadrupole{QD27}{0.4997}
+\drift{0.02115}
+%\marker{IC27}
+\drift{0.28}
+\dipole{M27}{2.875}{15}
+\drift{0.7025}
+\corrector{KV27}{0.13}
+\drift{0.2055}
+\sextupole{SF27}{0.287}
+\drift{0.1075}
+\screen{}[0.025] %BPM28
+\drift{0.00415}
+\quadrupole{QF28}{0.4997}
+\drift{0.02115}
+%\marker{IC28}
+\drift{0.2805}
+\dipole{M28}{2.875}{15}
+\drift{1.159}
+\corrector{KV28}{0.13}
+\drift{0.151}
+%\marker{IC29}
+\drift{0.02115}
+\quadrupole{QD29}{0.4997}
+\drift{0.00365}
+\screen{}[0.025] %BPM29
+\drift{0.2725}
+\dipole{M29}{2.875}{15}
+\drift{0.3105}
+\corrector{KV29}{0.13}
+\drift{0.0455}
+\corrector{IJK29}{0.73}
+\drift{0.2245}
+%\marker{IC30}
+\drift{0.02115}
+\quadrupole{QF30}{0.4997}
+\savecoordinate{links}
+
+
+\drift{0.00615}
+\screen{}[0.025] %BPM30
+\drift{3.0545}
+\corrector{KV30}{0.13}
+\drift{0.248}
+\corrector{MSI30}{0.9}
+\resetlabeldistance
+
+%title - aligned between M29 and QF14 via \savecoordinate
+\draw[draw=none] (links) -- (rechts) node[midway, biggestlabel]
+{ELSA Stretcherring\\{\SIrange{0.5}{3.2}{\GeV}}}; %\\{\it\SI{6}{\GeV\per\s}}
+
+
+%-----------------------
+% Compton-Polarimeter
+%-----------------------
+\begin{scope}
+ \setlinecolor{drift}{\photonbeam}
+ \goto{compton}
+ \drift{13.7}
+ \savecoordinate{comptonlabel}
+ \beamdump{}{1.6}[0.7]
+ \goto{compton}
+ \rotate{180}
+ \drift{3.9}
+ \beamdump{}{0.25}[0.25]
+\end{scope}
+%title
+\node[smalllabel, anchor=east, text width=4cm] at (comptonlabel)
+{Compton-\\{Polarimeter}};
+
+%------------------------------
+% Syli-Beamline (Streak-Kamera)
+%------------------------------
+\begin{scope}
+ \setlinecolor{drift}{\photonbeam}
+ \goto{sylibeamline}
+ \rotate{-11.5}
+ \drift{12.5}
+ \savecoordinate{sylilabel}
+ \beamdump{}{1.25}[0.5]
+\end{scope}
+% title
+\node[smalllabel, anchor=west, yshift=1cm, text width=4cm] at (sylilabel)
+{\IfLanguageName{ngerman}{Synchrotronlicht}{synchrotron light}\\\IfLanguageName{ngerman}{Diagnoseplatz}{diagnostic area}};
+
+
+%-----------------------
+%Extraktion + CB
+%-----------------------
+\goto{ELSA_extract}
+\southlabels
+\rotate{-8}
+\drift{0.2}
+%----
+%\dipole{M23}{0.9}{1.60428}
+\drift{0.9}
+\rotate{1.60428}
+%----
+\drift{1.08}
+\rotatelabels{90}[west]
+\corrector{SSV1}{0.34}
+\drift{0.1}
+\corrector{SSH1}{0.34}
+\drift{0.36}
+\quadrupole{QF1}{0.4749}
+\drift{0.39}
+\solenoid{}{2}
+\drift{0.38}
+\quadrupole{QD1}{0.4749}
+\drift{0.25}
+\corrector{SSH2}{0.34}
+\drift{0.1}
+\corrector{SSV2}{0.34}
+\drift{0.6}
+\rotatelabels{0}
+\turnlabels
+\dipole{MB1}{1.08}{10.7716}[r][0.6]
+\savecoordinate{MB1}[center]
+\drift{0.41}
+\quadrupole{QN1}{0.3}[0.2]
+\drift{0.93}
+\quadrupole{QN2}{0.3}[0.2]
+\drift{0.33}
+\dipole{MB3}{1.08012}{2.92208}[r][0.6]
+\drift{0.42}
+\corrector{SSH3}{0.34}
+\drift{1.61}
+\quadrupole{QF2}{0.4749}
+\drift{2.218}
+\rotatelabels{0}[west]
+\corrector{SSV3}{0.2}
+\rotatelabels{0}
+\drift{0.242}
+\quadrupole{QD2}{0.4749}
+\drift{1.6515}
+\savecoordinate{CBphotons}
+\begin{labeldistance}{1}
+ \dipole{Tagger}{1.26}{8.99544}[r][1.2]
+ \drift{1.34}
+ \dipole{M5}{1.26}{6.1994}[r][1.2]
+\end{labeldistance}
+\drift{5.7}
+\savecoordinate{CBlabel}
+\drift{5.7}
+\beamdump{}{1}[1]
+
+%Photon-Beamline
+\goto{CBphotons}
+\begin{scope}
+\setlinecolor{drift}{\photonbeam}
+\drift{16}
+\beamdump{\IfLanguageName{ngerman}{Photonenkamera}{photon camera}}{0.4}[0.2]
+\end{scope}
+
+%title
+\node[experimentlabel, anchor=center, yshift=0.6cm] at (CBlabel) {Crystal Barrel (E1)};
+\node[biglabel, yshift=3.8cm,xshift=-3cm, text width=7cm] at (CBlabel)
+{\IfLanguageName{ngerman}{Hadronenphysik- Experimente}{hadron physics experiments}};
+
+
+%-------------------
+%BGO-OD
+%-------------------
+ \goto{MB1}
+ \rotate{-10.8-11}
+ \southlabels
+ \drift{1.03}
+ \dipole{MB2}{1.08166}{-11}[r][0.6]
+ \drift{1.06}
+ \quadrupole{QF2}{0.45}
+ \drift{1.32}
+ \rotatelabels{90}[west]
+ \corrector{SSH3}{0.34}
+ \drift{0.1}
+ \corrector{SSV3}{0.34}
+ \rotatelabels{0}
+ \drift{1.76}
+ \quadrupole{QD2}{0.45}
+ \drift{0.95}
+ \begin{scope}
+ \setlabeldistance{0.7}
+ \dipole{Tagger}{1.34}{0}[r][1]
+ \end{scope}
+
+ % photon beamline
+ \begin{scope}
+ \setlinecolor{drift}{\photonbeam}
+ \drift{6.95}
+ \dipole{}{1.61}{0}[r][3.64] %spektrometer
+ \savecoordinate{BGOlabel}
+ \drift{3.13}
+ \beamdump{\IfLanguageName{ngerman}{Photonenkamera}{photon camera}}{0.4}[0.2]
+ \end{scope}
+
+ % title
+ \node[experimentlabel, anchor=center, xshift=1cm,yshift=-0.4cm] at (BGOlabel) {BGO-OD (E2)};
+
+
+%-----------------------------
+%neue externe Strahlführung
+%-----------------------------
+\goto{ELSA_extract_neu}
+\southlabels
+\rotate{-5.44}
+\drift{2.55}
+\begin{scope}
+\setlabelfont{\footnotesize}
+\rotatelabels{-90}[west]
+\corrector{SSH1}{0.34}[0.29]
+\end{scope}
+\drift{0.225}
+\begin{scope}
+\setlabelfont{\footnotesize}
+\rotatelabels{-90}[west]
+\corrector{SSV1}{0.2}[0.162]
+\end{scope}
+\drift{0.26856}
+\quadrupole{QF1}{0.5}[0.266]
+\drift{0.1435}
+\begin{scope}
+\setlabelfont{\scriptsize}
+\northlabels
+\setlabeldistance{0.2}
+\screen{CS1}[0.2]
+\end{scope}
+\drift{5.3035}
+\begin{scope}
+\setlabelfont{\footnotesize}
+\northlabels
+\rotatelabels{-90}[east]
+\corrector{SSH2}{0.2}[0.22]
+\end{scope}
+\drift{0.16}
+\begin{scope}
+\setlabelfont{\footnotesize}
+\northlabels
+\rotatelabels{-90}[east]
+\corrector{SSV2}{0.2}[0.175]
+\end{scope}
+\drift{0.16}
+\quadrupole{QD2}{0.4997}[0.61]
+\drift{0.11309}
+\begin{scope}
+\setlabelfont{\scriptsize}
+\northlabels
+\screen{CS2}[0.2]
+\end{scope}
+\drift{0.8032}
+\begin{labeldistance}{1.2}
+ \dipole{MB}{1.50274}{-12}[r][2]
+\end{labeldistance}
+\drift{0.41180}
+\begin{scope}
+\setlabelfont{\scriptsize}
+\northlabels
+\screen{CS3}[0.2]
+\end{scope}
+\drift{0.50289}
+\quadrupole{QF3}{0.4997}[0.61]
+\drift{0.22983}
+\begin{scope}
+\setlabelfont{\footnotesize}
+\northlabels
+\rotatelabels{-90}[east]
+\corrector{SSH3}{0.2}[0.22]
+\drift{0.31732}
+\end{scope}
+\begin{scope}
+\setlabelfont{\footnotesize}
+\northlabels
+\rotatelabels{-90}[east]
+\corrector{SSV3}{0.2}[0.175]
+\end{scope}
+\drift{0.74414}
+\begin{scope}
+\setlabelfont{\scriptsize}
+\northlabels
+\cavity{IR}{0.130}[0.168]
+\end{scope}
+\drift{0.34731}
+\quadrupole{QD4}{0.4997}[0.61]
+\drift{0.113094}
+\begin{scope}
+\setlabelfont{\scriptsize}
+\northlabels
+\screen{CS4}[0.2]
+\end{scope}
+\drift{0.653}
+\savecoordinate{NEWSFlabel}
+\setlinecolor{drift}{dotted}
+\drift{6.45}
+\beamdump{}{0.5}
+ %title
+ \node[experimentlabel, fill=none,anchor=north, yshift=-4mm, text width=7cm] at (NEWSFlabel)
+ {\IfLanguageName{ngerman}{Messplatz für}{Area
+ for}\\\IfLanguageName{ngerman}{Detektortests}{Detector
+ Tests} (E3)};
+
+%---------------------------
+% legend shows all element types occuring before this commmand
+\legend{(67,46)}[3]
+\end{lattice}
+\end{document}
diff --git a/graphics/pgf/contrib/tikz-palattice/example1_linear.tex b/graphics/pgf/contrib/tikz-palattice/example1_linear.tex
new file mode 100644
index 0000000000..8dfdaafba0
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-palattice/example1_linear.tex
@@ -0,0 +1,53 @@
+%% example1_linear.tex
+%% 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
+
+\documentclass[]{standalone}
+\usepackage[ngerman]{babel}
+\usepackage[utf8]{inputenc}
+\usepackage{tikz-palattice}
+
+
+\begin{document}
+
+\begin{lattice}
+ \source{MySource}{0.4}
+ \drift{0.167}
+ \quadrupole{Q1}{0.4}
+ \drift{0.1}
+ \kicker{VC1}{0.1}
+ \drift{0.29}
+ \drift{0.2}
+ \screen{S1}
+ \drift{0.2}
+ \quadrupole{Q2}{0.4}
+ \drift{0.3}
+ \marker{marker 1}[1.2]
+ \drift{1.16}[Space left!]
+ \marker{marker 2}[1.2]
+ \drift{0.15}
+ \cavity{Acceleration?}{2}
+ \drift{0.63}
+ \dipole{M1}{0.5}{90}[r]
+ \drift{0.3}
+ \quadrupole{Q42}{0.4}
+ \drift{0.3}
+\end{lattice}
+
+\end{document}
diff --git a/graphics/pgf/contrib/tikz-palattice/example2_circular.tex b/graphics/pgf/contrib/tikz-palattice/example2_circular.tex
new file mode 100644
index 0000000000..3bf446797f
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-palattice/example2_circular.tex
@@ -0,0 +1,60 @@
+%% example2_circular.tex
+%% 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
+
+\documentclass[]{standalone}
+\usepackage[ngerman]{babel}
+\usepackage[utf8]{inputenc}
+\usepackage{tikz-palattice}
+
+
+\begin{document}
+
+\begin{lattice}
+ \setlinecolor{drift}{red}
+
+ \drift{1}
+ \dipole{M1}{2}{45}
+ \drift{1}
+ \dipole{M2}{2}{45}
+ \drift{1}
+ \setelementcolor{dipole}{green!50!black} % change color of all following dipoles
+ \dipole{M3}{2}{45}
+ \drift{1}
+ \dipole{M4}{2}{45}
+ \drift{1}
+ \begin{scope} % color change only applied within scope
+ \setelementcolor{dipole}{red}[red] % optional 3rd argument sets top color -> no (visible) color gradient
+ \dipole{M5}{2}{45}
+ \end{scope}
+ \drift{1}
+ \dipole{M6}{2}{45}
+ \drift{1}
+ \resetelementcolor{dipole} % reset color of following dipoles to default
+ \dipole{M7}{2}{45}[r] % rectangle dipole type
+ \drift{1}
+ \dipole{M8}{2}{45}[br] % bend rectangle dipole type
+
+ \drawrule{(1,-0.5)}
+\end{lattice}
+
+\end{document}
+
+
+
diff --git a/graphics/pgf/contrib/tikz-palattice/example3_coordinates.tex b/graphics/pgf/contrib/tikz-palattice/example3_coordinates.tex
new file mode 100644
index 0000000000..228e11b958
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-palattice/example3_coordinates.tex
@@ -0,0 +1,242 @@
+%% example3_coordinates.tex
+%% Copyright 2017 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
+
+\documentclass[a4paper]{scrartcl}
+\usepackage[english]{babel}
+\usepackage[utf8]{inputenc}
+\usepackage{subcaption}
+\usepackage{verbatim}
+\usepackage{tikz-palattice}
+
+
+% compile twice to connect lattices!
+
+
+\title{Two more lattices}
+\subtitle{scaling lattices and accessing coordinates}
+\date{}
+
+\begin{document}
+\maketitle
+
+\begin{figure}[h]
+\centering
+\begin{subfigure}{.45\textwidth}
+ \centering
+ % this is the ring from example 2, but plotted smaller (30%).
+ % the element sizes (in meter) are the same - as the rule indicates.
+ \begin{lattice}[0.3]
+ \setlabelfont{\tiny}
+ \begin{labeldistance}{0.3}
+ \drift{1}
+ \dipole{M1}{2}{45}
+ \drift{1}
+ \turnlabels
+ \dipole{M2}{2}{45}
+ \turnlabels
+ \drift{1}
+ \dipole{M3}{2}{45}
+ \drift{1}
+ \savecoordinate{myCoord1}[center]
+ \dipole{M4}{2}{45}
+ \drift{1}
+ \dipole{M5}{2}{45}
+ \drift{1}
+ \dipole{M6}{2}{45}
+ \drift{1}
+ \savecoordinate{myCoord2}[center]
+ \dipole{M7}{2}{45}
+ \drift{1}
+ \dipole{M8}{2}{45}
+ \drawrule{(-2.5,-1)}[2]
+ \end{labeldistance}
+ % custom drawing using saved coordinates (to center of drifts)
+ \draw[->, thick] (myCoord2) -- (myCoord1) node[midway,fill=white,rotate=20] {signal};
+ \end{lattice}
+\end{subfigure}
+%
+%
+%
+\begin{subfigure}{.45\textwidth}
+ \centering
+ \begin{lattice}
+ \setangle{70}
+ \northlabels %labels to the left
+ \drift{0.5}
+ \quadrupole{QF1}{0.3}
+ \drift{0.2}
+ \kicker{}{0.1}
+ \drift{0.07}
+ \quadrupole{QD2}{0.3}
+ \drift{0.4}
+ \setelementcolor{kicker}{cyan}
+ \kicker{Septum}{0.5}
+ \resetelementcolor{kicker}
+ \savecoordinate{Septum}[center] %save to connect other beamline
+ \drift{0.8}
+ \kicker{}{0.1}
+ \drift{0.37}
+ \quadrupole{QD3}{0.2}
+ \drift{0.17}
+ \kicker{}{0.1}
+ \drift{0.1}
+ \sextupole{SF1}{0.2}
+ \drift{0.27}
+ \dipole{MB1}{0.2}{30}[s][0.4]
+ \drift{0.2}
+
+ % now go back to saved coordinate and continue with another beamline
+ \goto{Septum}
+ \rotate{-20}
+ \southlabels %labels to the right
+ \drift{0.6}
+ \kicker{SS1}{0.2}
+ \drift{0.2}
+ \kicker{SSH1}{0.2}
+ \drift{0.3}
+ \dipole{M1}{0.2}{-30}[r][0.4]
+ \begin{fade} %fade out this part
+ \drift{0.2}
+ \dipole{M2}{0.2}{50}[r][0.4]
+ \drift{0.2}
+ \dipole{M3}{0.2}{-20}[r][0.4]
+ \drift{0.7}
+ \end{fade}
+
+ \drawrule{(-0.75,-0.2)}[0.8]
+ \end{lattice}
+\end{subfigure}
+\caption{A figure with two lattices}
+\label{fig:lattices}
+\end{figure}
+
+
+
+
+
+
+\clearpage
+\begin{figure}
+\centering
+\begin{subfigure}[b]{.45\textwidth}
+ \centering
+ \begin{lattice}
+ \rotate{90}
+ \northlabels %labels to the left
+ \drift{0.5}
+ \quadrupole{QF1}{0.3}
+ \drift{0.2}
+ \kicker{}{0.1}
+ \drift{0.07}
+ \quadrupole{QD2}{0.3}
+ \drift{0.4}
+ \setelementcolor{kicker}{cyan}
+ \kicker{Septum}{0.5}
+ \resetelementcolor{kicker}
+ \savecoordinate{Septum}[center] %save to connect other beamline
+ \drift{0.8}
+ \kicker{}{0.1}
+ \drift{0.37}
+ \quadrupole{QD3}{0.2}
+ \drift{0.17}
+ \kicker{}{0.1}
+ \drift{0.1}
+ \sextupole{SF1}{0.2}
+ \drift{0.27}
+ \dipole{MB1}{0.2}{30}[s][0.4]
+ \drift{0.2}
+
+ % now go back to saved coordinate and continue with another beamline
+ \goto{Septum}
+ \rotate{-20}
+ \southlabels %labels to the right
+ \drift{0.6}
+ \kicker{SS1}{0.2}
+ \drift{0.2}
+ \kicker{SSH1}{0.2}
+ \drift{0.3}
+ \dipole{M1}{0.2}{-30}[r][0.4]
+ \begin{fade} %fade out this part
+ \drift{0.2}
+ \dipole{M2}{0.2}{50}[r][0.4]
+ \drift{0.2}
+ \dipole{M3}{0.2}{-20}[r][0.4]
+ \drift{0.7}
+ \end{fade}
+ \legend{(0,6.5)}
+ \end{lattice}
+ \caption{one lattice environment and goto}
+\end{subfigure}
+%
+\begin{subfigure}[b]{.45\textwidth}
+\centering
+ \begin{lattice}
+ \rotate{90}
+ \northlabels %labels to the left
+ \drift{0.5}
+ \quadrupole{QF1}{0.3}
+ \drift{0.2}
+ \kicker{}{0.1}
+ \drift{0.07}
+ \quadrupole{QD2}{0.3}
+ \drift{0.4}
+ \setelementcolor{kicker}{cyan}
+ \kicker{Septum}{0.5}
+ \resetelementcolor{kicker}
+ \savecoordinate{Septum}[center] %save to connect other beamline
+ \drift{0.8}
+ \kicker{}{0.1}
+ \drift{0.37}
+ \quadrupole{QD3}{0.2}
+ \drift{0.17}
+ \kicker{}{0.1}
+ \drift{0.1}
+ \sextupole{SF1}{0.2}
+ \drift{0.27}
+ \dipole{MB1}{0.2}{30}[s][0.4]
+ \drift{0.2}
+ \end{lattice}
+ %
+ %now draw second lattice and connect them using the saved coordinate
+ \begin{lattice}[1][overlay]
+ \start{(Septum)}
+ \rotate{70}
+ \drift{0.6}
+ \kicker{SS1}{0.2}
+ \drift{0.2}
+ \kicker{SSH1}{0.2}
+ \drift{0.3}
+ \dipole{M1}{0.2}{-30}[r][0.4]
+ \begin{fade} %fade out this part
+ \drift{0.2}
+ \dipole{M2}{0.2}{50}[r][0.4]
+ \drift{0.2}
+ \dipole{M3}{0.2}{-20}[r][0.4]
+ \drift{0.7}
+ \end{fade}
+ \legend{(-1,6.5)}
+ \end{lattice}
+ \caption{two lattice environments and start}
+\end{subfigure}
+\caption{Two ways to connect lattices}
+\label{fig:twoways}
+\end{figure}
+
+\end{document}
diff --git a/graphics/pgf/contrib/tikz-palattice/example4_labels.tex b/graphics/pgf/contrib/tikz-palattice/example4_labels.tex
new file mode 100644
index 0000000000..bfd312ba24
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-palattice/example4_labels.tex
@@ -0,0 +1,308 @@
+%% example4_labels.tex
+%% 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
+
+\documentclass[]{standalone}
+\usepackage[ngerman]{babel}
+\usepackage[utf8]{inputenc}
+\usepackage{tikz-palattice}
+
+
+\begin{document}
+\begin{lattice}[0.5]
+\drawrule{(-9,-11)}[5][3][0.2]
+
+\northlabels % labels "inside" ring
+\setlabeldistance{0.5}
+\rotate{-35}
+\marker{start}[0.5]
+
+\drift{0.03415}
+\quadrupole{QD1}{0.4997}
+\drift{0.19515}
+\kicker{KV01}{0.1}
+\drift{1.79875}
+\quadrupole{SQ1}{0.45}[0.2]
+\drift{1.01375}
+\quadrupole{LQ1}{0.45}[0.2]
+\drift{0.2065}
+\sextupole{SX1}{0.287}
+\drift{0.13665}
+\quadrupole{QF2}{0.4997}
+\drift{1.05365}
+\kicker{KV02}{0.1}
+\drift{0.3077}
+\dipole{M2}{2.875}{15}
+\drift{0.30145}
+\quadrupole{QD3}{0.4997}
+\drift{0.13665}
+\sextupole{SD3}{0.287}
+\drift{0.4305}
+\kicker{KV03}{0.1}
+\drift{1.84183}
+\drift{1.84183}
+
+% labels rotated (with manually set anchor)
+\rotatelabels{65}[west]
+\quadrupole{QF4}{0.4997}
+\drift{0.13665}
+\sextupole{SF4}{0.287}
+\drift{0.214}
+\kicker{KV04}{0.1}
+\drift{0.7237}
+\rotatelabels{0}
+
+\dipole{M4}{2.875}{15}
+\drift{0.30145}
+\quadrupole{QD5}{0.4997}
+\drift{0.09715}
+
+% labels with changed fontsize
+\setlabelfont{\tiny}
+\kicker{KV05}{0.1}
+\setlabelfont{\normalsize}
+
+\drift{1.2642}
+\dipole{M5}{2.875}{15}
+\drift{0.30145}
+\quadrupole{QF6}{0.4997}
+\drift{0.94465}
+\kicker{KV06}{0.1}
+\drift{0.4167}
+\dipole{M6}{2.875}{15}
+\drift{0.30145}
+
+%labels rotated (with manually set anchor) within scope (forget changes after scope)
+\begin{scope}
+\rotatelabels{-65}[east]
+\quadrupole{QD7}{0.4997}
+\drift{0.19415}
+\kicker{KV07}{0.1}
+\end{scope}
+
+
+\drift{1.1672}
+\dipole{M7}{2.875}{15}
+\drift{0.30145}
+\quadrupole{QF8}{0.4997}
+\drift{1.02365}
+\kicker{KV08}{0.1}
+\drift{0.3377}
+\dipole{M8}{2.875}{15}
+\drift{0.30145}
+\quadrupole{QD9}{0.4997}
+\drift{0.30135}
+\dipole{M9}{2.875}{15}
+\drift{0.3208}
+\kicker{KV09}{0.1}
+\drift{1.04065}
+\quadrupole{QF10}{0.4997}
+\drift{0.30135}
+\dipole{M10}{2.875}{15}
+\drift{0.7203}
+\kicker{KV10}{0.1}
+\drift{0.2175}
+\sextupole{SD10}{0.287}
+\drift{0.13665}
+\quadrupole{QD11}{0.4997}
+\drift{0.30135}
+\dipole{M11}{2.875}{15}
+\drift{0.7208}
+\kicker{KV11}{0.1}
+\drift{0.217}
+\sextupole{SF11}{0.287}
+\drift{0.13665}
+\quadrupole{QF12}{0.4997}
+\drift{0.30135}
+\dipole{M12}{2.875}{15}
+\drift{1.1743}
+\kicker{KV12}{0.1}
+\drift{0.18715}
+\quadrupole{QD13}{0.4997}
+\drift{0.30135}
+\dipole{M13}{2.875}{15}
+\drift{0.7398}
+\kicker{KV13}{0.1}
+\drift{0.62165}
+\quadrupole{QF14}{0.4997}
+\savecoordinate{rechts}
+\drift{1.86133}
+\drift{1.86133}
+\kicker{KV14}{0.1}
+\drift{0.81515}
+\quadrupole{QD15}{0.4997}
+\drift{0.30135}
+\dipole{M15}{2.875}{15}
+\drift{0.9368}
+\kicker{KV15}{0.1}
+\drift{0.42465}
+\quadrupole{QF16}{0.4997}
+\drift{0.13665}
+\sextupole{SX16}{0.287}
+\drift{0.2065}
+\quadrupole{LQ16}{0.45}[0.2]
+\drift{0.3075}
+\cavity{PETRA1}{1.6}
+\drift{0.93725}
+\quadrupole{TJQD16}{0.5515}[0.2]
+\drift{0.1614}
+
+% turn labels to other side and back
+\turnlabels
+\quadrupole{QD17}{0.4997}
+\turnlabels
+
+\drift{0.10615}
+\kicker{KV17}{0.1}
+\drift{0.244}
+\cavity{PETRA2}{1.6}
+\drift{1.43175}
+\drift{0.07575}
+\quadrupole{LQ17}{0.45}[0.2]
+\drift{0.2065}
+\sextupole{SX17}{0.287}
+\drift{0.13665}
+\quadrupole{QF18}{0.4997}
+\drift{0.41665}
+\kicker{KV18}{0.1}
+\drift{0.9447}
+\dipole{M18}{2.875}{15}
+\drift{0.30145}
+
+%labels rotated (with manually set anchor) within scope (forget changes after scope)
+\begin{scope}
+\rotatelabels{65}[east]
+\quadrupole{QD19}{0.4997}
+\drift{0.13665}
+\sextupole{SD19}{0.287}
+\drift{0.1965}
+\kicker{KV19}{0.1}
+\end{scope}
+
+\drift{1.747}
+\drift{1.747}
+\sextupole{SF19}{0.287}
+\drift{0.13665}
+
+% turn labels to other side within scope (no second \turnlabels needed)
+\begin{scope}
+\turnlabels
+\quadrupole{QF20}{0.4997}
+\end{scope}
+
+\drift{0.22565}
+\kicker{KV20}{0.1}
+
+\drift{1.1357}
+\dipole{M20}{2.875}{15}
+\drift{0.30145}
+
+%labels in other distance to elements
+\begin{labeldistance}{0.8}
+ \quadrupole{QD21}{0.4997}
+\end{labeldistance} %back to previous label distance (same as \setlabeldistance within scope)
+
+\drift{0.21015}
+\kicker{KV21}{0.1}
+\drift{1.151}
+\dipole{M21}{2.875}{15}
+\drift{0.30165}
+\quadrupole{QF22}{0.4997}
+\drift{0.99865}
+\kicker{KV22}{0.1}
+\drift{0.363}
+\dipole{M22}{2.875}{15}
+\drift{0.30115}
+\quadrupole{QD23}{0.4997}
+\drift{1.46115}
+\dipole{M23}{2.875}{15}
+\drift{0.30165}
+\quadrupole{QF24}{0.4997}
+\drift{0.99265}
+\kicker{KV24}{0.1}
+\drift{0.369}
+\dipole{M24}{2.875}{15}
+\drift{0.30115}
+\quadrupole{QD25}{0.4997}
+\drift{0.30115}
+\dipole{M25}{2.875}{15}
+\drift{0.716}
+\kicker{KV25}{0.1}
+\drift{0.64565}
+\quadrupole{QF26}{0.4997}
+\drift{0.30165}
+\dipole{M26}{2.875}{15}
+\drift{0.723}
+\kicker{KV26}{0.1}
+\drift{0.214}
+\sextupole{SD26}{0.287}
+\drift{0.13715}
+\quadrupole{QD27}{0.4997}
+\drift{0.30115}
+\dipole{M27}{2.875}{15}
+\drift{0.728}
+\kicker{KV27}{0.1}
+\drift{0.21}
+\sextupole{SF27}{0.287}
+\drift{0.13665}
+\quadrupole{QF28}{0.4997}
+\drift{0.30165}
+\dipole{M28}{2.875}{15}
+\drift{1.168}
+\kicker{KV28}{0.1}
+\drift{0.19315}
+\quadrupole{QD29}{0.4997}
+\drift{0.30115}
+\dipole{M29}{2.875}{15}
+\savecoordinate{links}
+\drift{0.318}
+\kicker{KV29}{0.1}
+\drift{1.04365}
+\quadrupole{QF30}{0.4997}
+\drift{1.56882}
+\drift{1.56882}
+\kicker{KV30}{0.1}
+\drift{1.40015}
+\quadrupole{QD31}{0.4997}
+\drift{0.30115}
+\dipole{M31}{2.875}{15}
+\drift{0.307}
+\kicker{KV31}{0.1}
+\drift{1.05465}
+\quadrupole{QF32}{0.4997}
+\drift{0.13665}
+\sextupole{SX32}{0.287}
+\drift{0.2069}
+\quadrupole{LQ32}{0.45}[0.2]
+\drift{0.5031}
+\kicker{KV32}{0.1}
+\drift{0.41025}
+\quadrupole{SQ32}{0.45}
+\drift{1.382}
+\quadrupole{TJQ32}{0.5515}[0.2]
+\drift{0.12625}
+
+% legend shows all element types occuring before this commmand
+\legend{(35,38)}[2]
+
+%title - aligned between M29 and QF14 via \savecoordinate
+\draw[draw=none] (links) -- (rechts) node[midway, font=\bfseries\Huge,scale=2, align=center]
+{ELSA Stretcherring\\{\SIrange[range-units=single,detect-weight=true]{0.5}{3.2}{\GeV}}};
+\end{lattice}
+\end{document}
diff --git a/graphics/pgf/contrib/tikz-palattice/example5_legend.tex b/graphics/pgf/contrib/tikz-palattice/example5_legend.tex
new file mode 100644
index 0000000000..1f23d65662
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-palattice/example5_legend.tex
@@ -0,0 +1,112 @@
+%% example5_legend.tex
+%% Copyright 2017 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 6 example files example1_linear.tex, example2_circular.tex,
+% example3_coordinates.tex, example4_labels.tex example5_legend.tex and elsa.tex
+
+\documentclass[]{standalone}
+\usepackage[english]{babel}
+\usepackage[utf8]{inputenc}
+\usepackage{tikz-palattice}
+
+
+
+
+\begin{document}
+
+\begin{lattice}
+ \rotate{-90}
+ \drift{0.167}
+ \quadrupole{Q1}{0.4}
+ \drift{0.1}
+ \kicker{C1}{0.1}
+ \drift{0.29}
+ \drift{0.2}
+ \screen{S1}
+ \drift{0.2}
+ \quadrupole{Q2}{0.4}
+ \drift{0.1}
+ \kicker{C2}{0.1}
+ \drift{0.2}
+ \setlegendtext{quadrupole}{argh}
+ \addlegendentry{Vthe Quad}{}
+ \addlegendentry{Vein sextU}{cyan, bottom color=violet, top color=white}
+ \addlegendentry{VCombined Function}{fill=green!40!black}
+
+ \completelegend{(0.8,0)}
+\end{lattice}
+
+
+\end{document}
+
+
+
+
+
+
+ % \global\let\legprevi\legindex%
+ % \pgfmathsetmacro{\legindex}{\legindex+1} \global\let\legindex\pgfmathresult%
+
+
+ % \def\q{{1.2,1.5,3.1,0}}
+ % \draw (-0.5,0) -- (-0.5,-{\q[0]});
+ % \draw (-0.6,0) -- (-0.6,-{\q[1]});
+ % \draw (-0.7,0) -- (-0.7,-{\q[2]});
+
+ % \pgfkeyssetvalue{/pal/legend/dipole}{tolle Fahrt}
+ % \pgfkeyssetvalue{/pal/legend/quadrupole}{tolle Wurst}
+ % \pgfkeyssetvalue{/pal/legend/quadrupole/.style}{fill=yellow}
+ % \node[draw] at (2,-4) {\pgfkeysvalueof{/pal/legend/dipole}};
+ % \node[draw] at (2,-5) {\pgfkeysvalueof{/pal/legend/quadrupole}};
+
+% \tikzset{
+% /pal/List/.initial = {erstens},
+% /pal/List/.append = {,roms},
+% }
+% \edef\mylist{\pgfkeysvalueof{/pal/List}}
+
+% \node[align=center] at (2,-4) {%
+% \foreach \txt in \mylist {\txt, }
+% };
+
+% \pgfkeys{
+% /tikz/.cd,
+% execute style/.style = {#1},
+% execute macro/.style = {execute style/.expand once=#1},
+% /test/hallo/.store in = \hallo
+% }
+% \pgfkeys{/test/.cd, hallo = {red,font=\bf,draw}}
+% \node[execute macro=\hallo] at (2,-4) {Törö!};
+
+
+
+% \matrix [matrix, draw, ampersand replacement=\&, matrix anchor=north west, anchor=west,column sep=2mm] (legend) at (1,-2)
+% {
+ % \draw[/legimg/quadrupole] (0,-0.15) rectangle (0.5,0.15); \& \node {\pgfkeysvalueof{/legtxt/quadrupole}}; \\
+ % \draw[/legimg/sextupole] (0,-0.15) rectangle (0.5,0.15); \& \node {\pgfkeysvalueof{/legtxt/sextupole}}; \\
+%};
+
+ % \pgfmathsetmacro{\legprevi}{0}
+ % \pgfmathsetmacro{\legindex}{1}
+ % \node[draw, anchor=north west] at (1,-2) {
+ % \begin{tikzpicture}[start chain=going below,node distance=2mm]
+ % \foreach \ele in \mylist {%
+ % \node[on chain, /legimg/\ele, draw,minimum width=5mm, minimum height=3mm] (n) {};%
+ % \node[anchor=west,xshift=2mm] at (n.east) {\pgfkeysvalueof{/legtxt/\ele}};%
+ % }
+ % \end{tikzpicture}
+ %; \ No newline at end of file
diff --git a/graphics/pgf/contrib/tikz-palattice/tikz-palattice.sty b/graphics/pgf/contrib/tikz-palattice/tikz-palattice.sty
new file mode 100644
index 0000000000..242c0cd85e
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-palattice/tikz-palattice.sty
@@ -0,0 +1,713 @@
+%% tikz-palattice.sty
+%% Copyright 2017 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}[2017/03/09 v2.3]
+\RequirePackage{tikz}
+\RequirePackage{ifthen}
+\RequirePackage{siunitx}
+\RequirePackage{xargs}
+\RequirePackage{etoolbox}
+\RequirePackage{iflang}
+\usetikzlibrary{calc,positioning,fit,chains}
+\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}
+% custom legend
+\pgfkeys{/pal/customlegendkeys/.initial = {nix}}
+\def\emptycustomlegendkeys{nix}
+}{%
+%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, faded}}}
+\newcommand{\resetlinecolor}[1]{\tikzset{#1/.style={default_#1}}}
+
+\newenvironmentx{fade}[1][1=0.25]{%
+\tikzset{faded/.style={opacity=#1, color=gray}}
+\tikzset{fadeElement/.style={faded, color=gray,bottom color=gray,top color=white}}
+}{%
+\tikzset{faded/.style={opacity=1.0}} % color not set
+\tikzset{fadeElement/.style={faded}}
+}
+
+
+%---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}}}
+
+\newcommand{\southlabels}{\def\labelang{-90} \def\marklabelang{+90}}
+\newcommand{\northlabels}{\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 text defaults
+\IfLanguageName{ngerman}{%
+\pgfkeyssetvalue{/pal/legendtxt/dipole}{Dipol}
+\pgfkeyssetvalue{/pal/legendtxt/quadrupole}{Quadrupol}
+\pgfkeyssetvalue{/pal/legendtxt/sextupole}{Sextupol}
+\pgfkeyssetvalue{/pal/legendtxt/kicker}{Kicker}
+\pgfkeyssetvalue{/pal/legendtxt/corrector}{Korrektor}
+\pgfkeyssetvalue{/pal/legendtxt/solenoid}{Solenoid}
+\pgfkeyssetvalue{/pal/legendtxt/cavity}{Hochfrequenz}
+\pgfkeyssetvalue{/pal/legendtxt/source}{Quelle}
+\pgfkeyssetvalue{/pal/legendtxt/screen}{Schirm}
+\pgfkeyssetvalue{/pal/legendtxt/valve}{Ventil}
+}{%
+\pgfkeyssetvalue{/pal/legendtxt/dipole}{Dipole}
+\pgfkeyssetvalue{/pal/legendtxt/quadrupole}{Quadrupole}
+\pgfkeyssetvalue{/pal/legendtxt/sextupole}{Sextupole}
+\pgfkeyssetvalue{/pal/legendtxt/kicker}{Kicker}
+\pgfkeyssetvalue{/pal/legendtxt/corrector}{Corrector}
+\pgfkeyssetvalue{/pal/legendtxt/solenoid}{Solenoid}
+\pgfkeyssetvalue{/pal/legendtxt/cavity}{Cavity}
+\pgfkeyssetvalue{/pal/legendtxt/source}{Source}
+\pgfkeyssetvalue{/pal/legendtxt/screen}{Screen}
+\pgfkeyssetvalue{/pal/legendtxt/valve}{Valve}
+}
+
+% change legend text
+\newcommand{\setlegendtext}[2]{%
+ \pgfkeys{/pal/legendtxt/#1=#2}
+}
+
+
+% add custom legend entry
+\newcommand{\addlegendentry}[2]{%
+ \pgfkeys{/pal/customlegendkeys/.get = \lktemp}
+ \ifdefequal{\lktemp}{\emptycustomlegendkeys}{%
+ \pgfkeyssetvalue{/pal/customlegendkeys}{#1}%
+ }{%
+ \pgfkeys{/pal/customlegendkeys/.append = {,#1}}%
+ }%
+ \pgfkeys{/pal/customlegendimg/#1/.style = {#2}}%
+}
+
+
+%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}
+\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}]
+\tikzset{drift/.append style={draw=none}}
+\northlabels%
+\setlabelcolor{black}%
+\setlabeldistance{\h}%
+\setlabelfont{\normalsize}%
+ \iftoggle{dip}{\dipole{\pgfkeysvalueof{/pal/legendtxt/dipole}}{\l}{0}[r][\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{quad}{\quadrupole{\pgfkeysvalueof{/pal/legendtxt/quadrupole}}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{sext}{\sextupole{\pgfkeysvalueof{/pal/legendtxt/sextupole}}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{correct}{\corrector{\pgfkeysvalueof{/pal/legendtxt/corrector}}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{kick}{\kicker{\pgfkeysvalueof{/pal/legendtxt/kicker}}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{cav}{\cavity{\pgfkeysvalueof{/pal/legendtxt/cavity}}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{sol}{\solenoid{\pgfkeysvalueof{/pal/legendtxt/solenoid}}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{sourc}{\source{\pgfkeysvalueof{/pal/legendtxt/source}}{\l}[\h]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{scree}{\screen{\pgfkeysvalueof{/pal/legendtxt/screen}}[\l]\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}}{}%
+ \iftoggle{valv}{\drift{\dist}\valve{\pgfkeysvalueof{/pal/legendtxt/valve}}\xdef\points{(elementlabel\j)
+ \points}\drift{\dist}\drift{\dist}}{}%
+\end{scope}
+ % custom entries (addlegendentry)
+ \edef\mylist{\pgfkeysvalueof{/pal/customlegendkeys}}%
+ \ifdefequal{\mylist}{\emptycustomlegendkeys}{}{%
+ \node[anchor=north west,inner sep=0,outer sep=0,xshift=#2*-2mm] at (east\j) {
+ \begin{tikzpicture}[start chain=going below,node distance=2mm,scale=#2,transform shape]
+ \foreach \ele in \mylist {%
+ \node[on chain, draw, thin,/pal/customlegendimg/\ele, minimum width=\h*10mm, minimum height=\l*10mm] (n) {};%
+ \node[anchor=west,xshift=5.15mm] (ntxt) at (n.center) {\ele};%
+ \xdef\points{($(ntxt.south east)+#2*(2mm,-2mm)$)\points}%
+ }
+ \end{tikzpicture}
+ };
+ }
+\node[draw=black, rounded corners, fit=\points] {};
+\pgfmathsetmacro{\scal}{\savescal}
+\pgfmathsetmacro{\angle}{\saveang}
+%\tikzset{drift/.append style={draw=black}}
+\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) -- cycle;
+ \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 -----
+%faded (for global fade setting)
+\tikzset{faded/.style={
+opacity=1
+}}
+\tikzset{fadeElement/.style={
+faded
+}}
+
+%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,
+faded %must be last to overwrite other settings
+},
+drift/.style={default_drift}
+}
+
+%text label
+\tikzset{label/.style={
+text=\labelcolor,
+font=\labelfont,
+rotate=\labelrot,
+anchor=\labelanchor,
+faded %must be last to overwrite other settings
+}}
+
+%marker (line)
+\tikzset{default_marker/.style={
+red, densely dashed,
+faded %must be last to overwrite other settings
+},
+marker/.style={default_marker}
+}
+
+%rule
+\tikzset{rule/.style={
+draw=black,
+fill=black,
+faded %must be last to overwrite other settings
+}}
+
+%start
+\tikzset{start/.style={%
+draw=none,
+anchor=center,
+scale=0.1,
+faded %must be last to overwrite other settings
+}}
diff --git a/graphics/pgf/contrib/tikz-palattice/tikz-palattice_documentation.pdf b/graphics/pgf/contrib/tikz-palattice/tikz-palattice_documentation.pdf
new file mode 100644
index 0000000000..dda15d351c
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-palattice/tikz-palattice_documentation.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/tikz-palattice/tikz-palattice_documentation.tex b/graphics/pgf/contrib/tikz-palattice/tikz-palattice_documentation.tex
new file mode 100644
index 0000000000..27353ba462
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-palattice/tikz-palattice_documentation.tex
@@ -0,0 +1,767 @@
+%% tikz-palattice_documentation.tex
+%% Copyright 2017 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
+
+\documentclass[a4paper]{scrartcl}
+\usepackage[english]{babel}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{lmodern}
+\usepackage{subcaption}
+\usepackage{amsmath}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{amssymb}
+\usepackage[colorlinks]{hyperref}
+\usepackage{siunitx}
+\usepackage{listings}
+\usepackage{xcolor}
+\usepackage{tikz-palattice}
+
+\newcommand{\option}[1]{{\color{blue}$\langle$\textit{#1}$\rangle$}}
+\newcommand{\optiondef}[2]{{\color{green!50!black}$\langle$\textit{#1=#2}$\rangle$}}
+\newcommand{\tikzlabel}{Ti\textit{k}Z}
+
+\author{Jan Schmidt <janschmidt@mailbox.org>}
+\date{v2.3 (March 9, 2017)}
+\title{tikz-palattice - draw particle accelerator lattices with \tikzlabel}
+
+\hypersetup{
+ pdftitle={tikz-palattice - draw particle accelerator lattices with \tikzlabel},
+ pdfauthor={Jan Schmidt}
+}
+
+\begin{document}
+
+\definecolor{keycolor}{RGB}{172, 42, 42}
+\lstset{
+basicstyle=\small\sffamily,
+backgroundcolor=\color{gray!20},
+%numbers=left,
+numberstyle=\tiny,
+breaklines=true,
+%frame=l,
+xleftmargin=\parindent,
+columns=fullflexible,
+showstringspaces=false,
+keywordstyle=\bfseries\color{keycolor},
+commentstyle=\color{black!50},
+identifierstyle=,%\color{blue},
+stringstyle=,
+escapeinside={(*}{*)}
+}
+
+\maketitle
+
+\begin{abstract}
+ The tikz-palattice package allows for drawing a map of a particle accelerator just by
+ giving a list of elements - similar to lattice files for simulation software. The
+ package includes 12 common element types like dipoles, quadrupoles, cavities or screens,
+ as well as automatic labels with element names, a legend, a rule and an environment to
+ fade out parts of the accelerator. The coordinate of any element can be saved and used
+ for custom tikz drawings or annotations. Thereby, lattices can be connected to draw
+ injection/extraction or even a complete accelerator facility.
+\end{abstract}
+
+
+\begin{figure}[h]
+ \centering
+ \includegraphics[width=\textwidth]{elsa.pdf}
+ \caption{The Electron Stretcher Facility ELSA at Bonn University, drawn with
+ tikz-palattice}
+\label{fig:elsa}
+\end{figure}
+
+
+\clearpage
+\parindent=0pt
+Copyright 2017 Jan Schmidt
+
+\medskip
+Permission is granted to distribute and/or modify both the documentation and the code
+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
+
+\tableofcontents
+
+\section{Installation}
+\label{sec-1}
+\subsection{Copy tikz-palattice.sty}
+\label{sec-1-1}
+You just need to copy the lattice.sty file to a place where your \LaTeX{} installation can recognize it.
+This can be
+\begin{itemize}
+\item the same folder as your .tex document or
+\item in the \LaTeX{} system or user tree.
+\end{itemize}
+E.g. to add it to the system tree for texlive under ubuntu:
+\begin{lstlisting}
+sudo mkdir -p /usr/local/share/texmf/tex/latex/lattice/
+sudo cp lattice.sty /usr/local/share/texmf/tex/latex/lattice/
+sudo mktexlsr
+\end{lstlisting}
+For this path there is also a Makefile prepared, so just enter
+\begin{lstlisting}
+sudo make install
+\end{lstlisting}
+Otherwise read the documentation of your \LaTeX{} distribution.
+
+\subsection{Required packages}
+\label{sec-1-2}
+\begin{itemize}
+\item tikz
+\item siunitx
+\item ifthen
+\item xargs
+\item etoolbox
+\item iflang
+\end{itemize}
+
+\lstset{language=[LaTeX]TeX}
+
+\section{Basic Usage}
+\label{sec:remarks}
+
+Basically, an accelerator lattice is drawn by writing element commands one after the
+other. White spaces and newlines are ignored. Usually you will use one \lstinline+drift+
+and one other element alternately:
+
+\begin{minipage}[c]{0.5\textwidth}
+\begin{lstlisting}
+ \begin{lattice}
+ \source{Gun}{0.4}
+ \drift{0.267}
+ \quadrupole{Q1}{0.4}
+ \drift{0.29}
+ \dipole{M1}{0.8}{30}
+ \drift{0.29}
+ \kicker{VC1}{0.1}
+ \drift{0.2}
+ \end{lattice}
+\end{lstlisting}
+\end{minipage}
+%
+\begin{minipage}[c]{0.5\textwidth}
+ \begin{center}
+ \begin{lattice}
+ \source{Gun}{0.4}
+ \drift{0.267}
+ \quadrupole{Q1}{0.4}
+ \drift{0.29}
+ \dipole{M1}{0.8}{30}
+ \drift{0.29}
+ \kicker{VC1}{0.1}
+ \drift{0.2}
+ \end{lattice}
+ \end{center}
+\end{minipage}
+
+
+Descriptions of the commands are given in section \ref{sec-5}. There are 5 examples coming
+with this package. Some of the drawings are shown in this document. Please look at the
+separate tex-files for the source code.
+
+\paragraph{Some general remarks:}
+\begin{itemize}
+\item it is recommended to draw lattices using \lstinline+\documentclass{standalone}+
+ especially for larger beamlines.
+\item lengths are set in meter, so you write \{1.32\} for \SI{1.32}{\m}.
+\item beamline with angle \SI{0}{\degree} goes to the right, positive angles bend counter clockwise.
+\item some commands use the \tikzlabel{} \textit{north/east/south/west} terms. \textit{east}
+ of an element is always where the beam leaves the element (downstream) and \textit{west} is where the
+ beam enters the element (upstream).
+\item settings (colors, font, rotatelabel,\ldots{}) changed within a \verb+scope+ environment are set back to the previous values outside of \verb+scope+
+\item picture scale: for lattice scale=1 an element of 1m length is plotted with \SI{2}{\cm} length
+\end{itemize}
+
+Below, the arguments of commands are given in angle brackets. The values after an equal
+sign are default values of optional arguments. E.g. \optiondef{scale}{1} indicates that
+the default value of "scale" is 1.
+
+
+
+\section{The lattice Environment}
+\label{sec-4}
+
+To draw a lattice just add
+\begin{lstlisting}
+\usepackage{tikz-palattice}
+\end{lstlisting}
+to your preambel and use the lattice environment with
+\begin{lstlisting}
+ \begin{lattice}[(*\optiondef{scale}{1}*)][(*\optiondef{tikz options}{}*)]
+ ...
+ \end{lattice}
+\end{lstlisting}
+The \lstinline+lattice+ environment contains a \lstinline+tikzpicture+ environment in
+which the lattice is drawn using usual tikz commands. The \lstinline+lattice+ environment
+has 2 optional arguments:
+\begin{enumerate}
+\item \optiondef{scale}{1} scales whole picture (default is 1).
+\item \optiondef{tikz options}{} gives any options for the \lstinline+tikzpicture+ (e.g.
+ overlay, default is none).
+\end{enumerate}
+
+
+\section{Within lattice Environment}
+\label{sec-5}
+
+\subsection{Elements}
+\label{sec-5-1}
+
+ Here is a list of all implemented element types. The element names are self-explanatory:
+\begin{lstlisting}
+ \drift{(*\option{length/m}*)}[(*\optiondef{name}{}*)]
+ \dipole{(*\option{name}*)}{(*\option{arc length/m}*)}{(*\option{bending angle/deg}*)}[(*\optiondef{type}{s}*)][(*\optiondef{thickness/m}{0.6}*)]
+ \quadrupole{(*\option{name}*)}{(*\option{length/m}*)}[(*\optiondef{thickness/m}{0.5}*)]
+ \sextupole{(*\option{name}*)}{(*\option{length/m}*)}[(*\optiondef{thickness/m}{0.3}*)]
+ \corrector{(*\option{name}*)}{(*\option{length/m}*)}[(*\optiondef{thickness/m}{0.25}*)]
+ \kicker{(*\option{name}*)}{(*\option{length/m}*)}[(*\optiondef{thickness/m}{0.25}*)]
+ \cavity{(*\option{name}*)}{(*\option{length/m}*)}[(*\optiondef{thickness/m}{0.45}*)]
+ \solenoid{(*\option{name}*)}{(*\option{length/m}*)}[(*\optiondef{thickness/m}{0.2}*)]
+ \beamdump{(*\option{name}*)}{(*\option{length/m}*)}[(*\optiondef{thickness/m}{0.5}*)]
+ \source{(*\option{name}*)}{(*\option{length/m}*)}[(*\optiondef{thickness/m}{0.5}*)]
+ \screen{(*\option{name}*)}[(*\optiondef{length/m}{0.2}*)]
+ \valve{(*\option{name}*)}
+ \marker{(*\option{name}*)}[(*\optiondef{length/m}{0.35}*)] % a line perpendicular to the beamline, see Fig. (*\ref{fig:example1}*)
+\end{lstlisting}
+
+
+\subsubsection{Dipole Types}
+The \lstinline+dipole+ option \optiondef{type}{s} allows to select different dipole
+shapes. It is shown in example~2. Possible values are:
+
+\def\dipang{30}
+\def\dipl{1.5}
+\def\dipthick{0.3}
+\begin{minipage}[c]{0.33\textwidth}
+ \centering
+ \begin{lattice}
+ \setangle{-\dipang/2}
+ \drift{0.1}
+ \dipole{s: sector magnet}{\dipl}{\dipang}[s][\dipthick]
+ \drift{0.1}
+ \end{lattice}
+\end{minipage}
+\begin{minipage}[c]{0.33\textwidth}
+ \centering
+ \begin{lattice}
+ \setangle{-\dipang/2}
+ \drift{0.1}
+ \dipole{r: rectangle magnet}{\dipl}{\dipang}[r][\dipthick]
+ \drift{0.1}
+ \end{lattice}
+\end{minipage}
+\begin{minipage}[c]{0.33\textwidth}
+ \centering
+ \begin{lattice}
+ \setangle{-\dipang/2}
+ \drift{0.1}
+ \dipole{br: bend rectangle magnet}{\dipl}{\dipang}[br][\dipthick]
+ \drift{0.1}
+ \end{lattice}
+\end{minipage}
+
+If you use any other letters, also the default (s) is used.
+
+
+\begin{figure}
+ \centering
+ \includegraphics[width=10cm]{example1_linear}
+ \caption{Example 1}
+ \label{fig:example1}
+\end{figure}
+
+
+\subsection{Orientation of the lattice}
+\label{sec-5-2}
+
+\begin{lstlisting}
+ \start{(*\option{coordinate/m}*)}
+\end{lstlisting}
+sets starting point of the lattice. Use it before the first element. \option{coordinate/m}
+is of form (x,y) or any tikz label, e.g. (mylabel.east) You can use this with
+\lstinline+\savecoordinate+ (section \ref{sec:coords}) to connect lattices, but it is
+recommended to do this via \lstinline+\goto+ (see below). Both are shown in example 3.
+
+\begin{lstlisting}
+ \rotate{(*\option{angle/deg}*)}
+\end{lstlisting}
+bends the beamline by the given angle.
+
+\begin{lstlisting}
+ \setangle{(*\option{angle/deg}*)}
+\end{lstlisting}
+sets the beamline angle to the given angle. The next element is drawn with beam axis in
+this direction.
+
+\begin{lstlisting}
+ \goto{(*\option{coordinate name}*)}
+\end{lstlisting}
+sets current position and angle to values saved
+with \lstinline+\savecoordinate+ (section \ref{sec:coords}).
+Use this to connect lattices and draw injection, extraction or even a complete accelerator
+facility. This is shown in example 3.
+
+\begin{figure}[h]
+ \centering
+ % this is the ring from example 2, but plotted smaller (30%).
+ % the element sizes (in meter) are the same - as the rule indicates.
+ \begin{lattice}[0.27]
+ \setlabelfont{\tiny}
+ \begin{labeldistance}{0.3}
+ \drift{1}
+ \dipole{M1}{2}{45}
+ \drift{1}
+ \turnlabels
+ \dipole{M2}{2}{45}
+ \turnlabels
+ \drift{1}
+ \dipole{M3}{2}{45}
+ \drift{1}
+ \savecoordinate{myCoord1}[center]
+ \dipole{M4}{2}{45}
+ \drift{1}
+ \dipole{M5}{2}{45}
+ \drift{1}
+ \dipole{M6}{2}{45}
+ \drift{1}
+ \savecoordinate{myCoord2}[center]
+ \dipole{M7}{2}{45}
+ \drift{1}
+ \dipole{M8}{2}{45}
+ \drawrule{(-2.5,-1)}[2]
+ \end{labeldistance}
+ % custom drawing using saved coordinates (to center of drifts)
+ \draw[->, thick] (myCoord2) -- (myCoord1) node[midway,fill=white,rotate=20] {signal};
+ \end{lattice}
+\caption{From example 3}
+\label{fig:fromexample3}
+\end{figure}
+
+
+\newpage
+\subsection{Rule and Legend}
+\label{sec:rule-legend}
+
+\begin{lstlisting}
+ \drawrule{(*\option{position/m}*)}[(*\optiondef{tick distance/m}{1}*)][(*\optiondef{scale}{1}*)][(*\optiondef{height/m}{0.1}*)]
+\end{lstlisting}
+draws a rule to visualize the size of the lattice. Coordinate is of form (x,y) or any tikz
+label, e.g. (mylabel.east)
+
+\begin{lstlisting}
+ \legend{(*\option{position/m}*)}[(*\optiondef{scale}{1}*)]
+\end{lstlisting}
+draws a legend with all element types that occur in the lattice before this command.
+The given \option{position/m} is north west (upper left corner) of the legend box.
+The scale option scales the whole box including the text, which has the usual label
+textsize if scale=1.
+
+\begin{lstlisting}
+ \completelegend{(*\option{position/m}*)}[(*\optiondef{scale}{1}*)]
+\end{lstlisting}
+is similar to \lstinline+\legend+, but shows all element types.
+
+The legend can be customized with the following two commands.
+Here is an example for legend customizations:
+
+\begin{minipage}[c]{0.5\textwidth}
+\begin{lstlisting}
+ \begin{lattice}
+ \drift{0.2}
+ \quadrupole{Q1}{0.4}
+ \drift{0.1}
+ \kicker{C1}{0.1}
+ \drift{0.5}
+ \screen{S1}
+ \drift{0.2}
+ \setlegendtext{quadrupole}{I am focusing}
+ \addlegendentry{What's that?}{cyan, fill=violet}
+ \legend{(0.2,-1)}
+ \end{lattice}
+\end{lstlisting}
+\end{minipage}
+%
+\begin{minipage}[c]{0.5\textwidth}
+ \begin{center}
+ \begin{lattice}
+ \drift{0.2}
+ \quadrupole{Q1}{0.4}
+ \drift{0.1}
+ \kicker{C1}{0.1}
+ \drift{0.5}
+ \screen{S1}
+ \drift{0.2}
+ \setlegendtext{quadrupole}{I am focusing}
+ \addlegendentry{What's that?}{cyan, fill=violet}
+ \legend{(0.2,-1)}
+ \end{lattice}
+ \end{center}
+\end{minipage}
+
+\begin{lstlisting}
+ \setlegendtext{(*\option{type}*)}{(*\option{text}*)}
+\end{lstlisting}
+allows to change the text shown in the legend for element type \option{type}. The legend
+is automatically translated to German if \textit{ngerman} is set with the babel package.
+
+\begin{lstlisting}
+ \addlegendentry{(*\option{text}*)}{(*\option{style}*)}
+\end{lstlisting}
+adds a custom entry to the legend. The style of the legend image can set with
+\option{style}. All style options for a tikz node are allowed. All custom legend entries
+appear below the normal entries.
+
+
+
+
+
+
+\subsection{Labels}
+\label{sec:labels}
+Every element has a text label showing the given element name. The position and
+orientation of the label is set automatically according to the current angle of the
+beamline. Several commands to modify the labels manually are described below. If you want
+to disable labels, leave the element names blank or set the label color (section
+\ref{sec:colors}) to your background color.
+
+\begin{lstlisting}
+ \turnlabels
+\end{lstlisting}
+moves labels to other side of elements (swap with marker labels), while
+\begin{lstlisting}
+ \northlabels
+ \southlabels
+\end{lstlisting}
+explicitly sets the labels to north or south (see section \ref{sec:remarks}) of the
+elements. It is recommended to use these and not \lstinline+\turnlabels+, because
+otherwise the label position at a certain element is determined by the number of
+\lstinline+\turnlabels+ commands before this element.
+
+\begin{lstlisting}
+ \rotatelabels{(*\option{angle/deg}*)}[(*\optiondef{anchor}{}*)]
+\end{lstlisting}
+allows rotation of element labels.
+The \optiondef{anchor}{} sets the center of rotation (north, center, south west,
+\ldots{}). West corresponds to the labels first character. By default the anchor is set
+automatically depending on the current angle of the beamline.
+
+\begin{lstlisting}
+ \begin{labeldistance}{(*\option{distance/m}*)}
+ ...
+ \end{labeldistance}
+\end{lstlisting}
+sets the distance of text labels to the element center for all elements within this
+environment. Default is 0.35.
+
+\begin{lstlisting}
+ \setlabeldistance{(*\option{distance/m}*)}
+ \resetlabeldistance
+\end{lstlisting}
+sets the distance of text labels to the element center for all following elements. the
+reset command sets the default value. Default is 0.35.
+
+\begin{lstlisting}
+ \setlabelfont{(*\option{fontsize}*)}
+\end{lstlisting}
+sets the text label font size. Default is \lstinline+\normalsize+.
+
+
+
+\subsection{Colors}
+\label{sec:colors}
+The colors can be changed at any point of the lattice. A setting is valid until the next
+color command. The reset commands set the according default color. Use a \lstinline+scope+
+environment to change a color for a section of a lattice.
+
+\begin{lstlisting}
+ \setlinecolor{(*\option{type}*)}{(*\option{color}*)}
+ \resetlinecolor{(*\option{type}*)}
+\end{lstlisting}
+for \option{type} drift and marker.
+
+\begin{lstlisting}
+ \setelementcolor{(*\option{type}*)}{(*\option{color}*)}[(*\optiondef{gradient color}{white}*)]
+ \resetelementcolor{(*\option{type}*)}
+\end{lstlisting}
+for all element types. Set \optiondef{gradient color}{white} equal to \option{color} to
+"disable" the gradient.
+
+\begin{lstlisting}
+ \setlabelcolor{(*\option{color}*)}
+\end{lstlisting}
+for textlabels. Set to background color to hide text labels.
+
+
+
+\subsection{Fade Out}
+\label{sec:fade-out}
+
+\begin{lstlisting}
+ \begin{fade}[(*\optiondef{opacity}{0.25}*)]
+ ...
+ \end{fade}
+\end{lstlisting}
+ reduces the opacity of all elements within the environment and sets all colors to gray.
+ So you can fade out regions of the lattice - e.g. for presentations.
+ This can also be used to completely hide regions by setting \optiondef{opacity}{0.25} to
+ zero.
+
+ Custom drawings and annotations (see section \ref{sec:coords}) can also be faded out
+ automatically. The tikz style \lstinline{faded} provides the appropriate settings: Add
+ \lstinline{faded} to the style of any tikz drawing or node within the \lstinline{lattice}
+ environment. If it is drawn within a \lstinline{fade} environment, it is faded out. Else
+ its style is not changed:
+
+\begin{minipage}[c]{0.6\textwidth}
+\begin{lstlisting}
+ \begin{lattice}
+ \tikzset{mynode/.style={
+ anchor=west,xshift=7mm,font=\bf,red}}
+ \setangle{-90}
+ \drift{0.2}
+ \sextupole{S1}{0.2}
+ \drift{0.267}
+ \begin{fade}[0.4]
+ \quadrupole{Q1}{0.4}
+ \savecoordinate{Q1}[center]
+ \node[mynode,faded] at (Q1) {a quadrupole!};
+ \drift{0.29}
+ \end{fade}
+ \kicker{VC1}{0.1}
+ \savecoordinate{kick}[center]
+ \node[mynode,faded] at (kick) {a kicker!};
+ \drift{0.2}
+ \dipole{M1}{0.8}{30}
+ \drift{0.29}
+ \end{lattice}
+\end{lstlisting}
+\end{minipage}
+%
+\begin{minipage}[c]{0.4\textwidth}
+ \begin{center}
+ \begin{lattice}
+ \tikzset{mynode/.style={anchor=west,xshift=7mm,font=\bf,red}}
+ \setangle{-90}
+ \drift{0.2}
+ \sextupole{S1}{0.2}
+ \drift{0.267}
+ \begin{fade}[0.4]
+ \quadrupole{Q1}{0.4}
+ \savecoordinate{Q1}[center]
+ \node[mynode,faded] at (Q1) {a quadrupole!};
+ \drift{0.29}
+ \end{fade}
+ \kicker{VC1}{0.1}
+ \savecoordinate{kick}[center]
+ \node[mynode,faded] at (kick) {a kicker!};
+ \drift{0.2}
+ \dipole{M1}{0.8}{30}
+ \drift{0.29}
+ \end{lattice}
+ \end{center}
+\end{minipage}
+
+
+\clearpage
+\subsection{Access lattice Coordinates}
+\label{sec:coords}
+You can use element coordinates to draw anything you want using pgf/tikz.
+
+\begin{lstlisting}
+ \savecoordinate{(*\option{name}*)}[(*\optiondef{position}{east}*)]
+\end{lstlisting}
+saves the coordinate of the previous element to access it later. Position specifies the
+exact place of the element. \textit{east} and \textit{center} are available (see section
+\ref{sec:remarks}).
+
+\begin{itemize}
+\item you can use all tikz/pgf commands within the lattice environment to draw anything.
+\item You can use this to connect multiple beamlines \textbf{within a lattice environment} with
+ \lstinline+\goto{name}+ (recommended, Figure \ref{fig:twoways} (a)).
+\item You can use this to connect \textbf{multiple lattice environments} with
+ \lstinline+\start{name}+. Use the tikz overlay option. (Figure \ref{fig:twoways} (b))
+\end{itemize}
+
+
+
+
+\begin{figure}[h]
+\centering
+\begin{subfigure}[b]{.45\textwidth}
+ \centering
+ \begin{lattice}[0.8]
+ \rotate{90}
+ \turnlabels %labels to the left
+ \drift{0.5}
+ \quadrupole{QF1}{0.3}
+ \drift{0.2}
+ \kicker{}{0.1}
+ \drift{0.07}
+ \quadrupole{QD2}{0.3}
+ \drift{0.4}
+ \setelementcolor{kicker}{cyan}
+ \kicker{Septum}{0.5}
+ \resetelementcolor{kicker}
+ \savecoordinate{Septum}[center] %save to connect other beamline
+ \drift{0.8}
+ \kicker{}{0.1}
+ \drift{0.37}
+ \quadrupole{QD3}{0.2}
+ \drift{0.17}
+ \kicker{}{0.1}
+ \drift{0.1}
+ \sextupole{SF1}{0.2}
+ \drift{0.27}
+ \dipole{MB1}{0.2}{30}[s][0.4]
+ \drift{0.2}
+
+ % now go back to saved coordinate and continue with another beamline
+ \goto{Septum}
+ \rotate{-20}
+ \turnlabels %labels to the right
+ \drift{0.6}
+ \kicker{SS1}{0.2}
+ \drift{0.2}
+ \kicker{SSH1}{0.2}
+ \drift{0.3}
+ \dipole{M1}{0.2}{-30}[r][0.4]
+ \begin{fade} %fade out this part
+ \drift{0.2}
+ \dipole{M2}{0.2}{50}[r][0.4]
+ \drift{0.2}
+ \dipole{M3}{0.2}{-20}[r][0.4]
+ \drift{0.7}
+ \end{fade}
+ \legend{(0,6.5)}
+ \end{lattice}
+ \caption{one lattice environment and goto}
+\end{subfigure}
+%
+\begin{subfigure}[b]{.45\textwidth}
+\centering
+ \begin{lattice}[0.8]
+ \rotate{90}
+ \turnlabels %labels to the left
+ \drift{0.5}
+ \quadrupole{QF1}{0.3}
+ \drift{0.2}
+ \kicker{}{0.1}
+ \drift{0.07}
+ \quadrupole{QD2}{0.3}
+ \drift{0.4}
+ \setelementcolor{kicker}{cyan}
+ \kicker{Septum}{0.5}
+ \resetelementcolor{kicker}
+ \savecoordinate{Septum}[center] %save to connect other beamline
+ \drift{0.8}
+ \kicker{}{0.1}
+ \drift{0.37}
+ \quadrupole{QD3}{0.2}
+ \drift{0.17}
+ \kicker{}{0.1}
+ \drift{0.1}
+ \sextupole{SF1}{0.2}
+ \drift{0.27}
+ \dipole{MB1}{0.2}{30}[s][0.4]
+ \drift{0.2}
+ \end{lattice}
+ %
+ %now draw second lattice and connect them using the saved coordinate
+ \begin{lattice}[0.8][overlay]
+ \start{(Septum)}
+ \rotate{70}
+ \drift{0.6}
+ \kicker{SS1}{0.2}
+ \drift{0.2}
+ \kicker{SSH1}{0.2}
+ \drift{0.3}
+ \dipole{M1}{0.2}{-30}[r][0.4]
+ \begin{fade} %fade out this part
+ \drift{0.2}
+ \dipole{M2}{0.2}{50}[r][0.4]
+ \drift{0.2}
+ \dipole{M3}{0.2}{-20}[r][0.4]
+ \drift{0.7}
+ \end{fade}
+ \legend{(-1,6.5)}
+ \end{lattice}
+ \caption{two lattice environments and start}
+\end{subfigure}
+\caption{From example 3: Two ways to connect lattices}
+\label{fig:twoways}
+\end{figure}
+
+
+
+\clearpage
+\section{Changelog}
+\label{sec:changelog}
+v2.1 from 2015/02/23 is the first published version.
+
+\paragraph{v2.2 from 2015/03/01}
+\begin{itemize}
+\item added \lstinline+\northlabels+ and \lstinline+\southlabels+
+\item minor legend improvements (label position is now independent of current lattice settings)
+\item minor documentation improvements
+\end{itemize}
+
+\paragraph{v2.21 from 2015/03/18}
+\begin{itemize}
+\item added \lstinline+faded+ style (apply fade out to custom annotations)
+\item fixed sector dipole drawing
+\item documentation fixes
+\end{itemize}
+
+\paragraph{v2.3 from 2017/03/09}
+\begin{itemize}
+\item added \lstinline+\setlegendtext+ and \lstinline+\addlegendentry+
+\item German legend translation via babel (\textit{ngerman})
+\item legend fixes
+\end{itemize}
+
+
+\section{TODO}
+\label{sec:todo}
+
+\paragraph{What is missing?}
+\begin{itemize}
+\item The look of the elements can be improved
+\item More element types can be added
+\item \ldots{}
+\end{itemize}
+
+I am not an \TeX{} programmer. I basically used the \tikzlabel{} commands and wrote a
+bunch of macros. So there is:
+\begin{itemize}
+\item no error handling implemented
+\item no dedicated scoping of internal macros (use of lattice with documentclass standalone recommended)
+\end{itemize}
+
+\paragraph{Known issues:}
+\begin{itemize}
+\item A circular lattice can have a significant offset (no closed circle), if the dipole
+ bending angles are not integer. Probably, this is due to rounding or calculation
+ accuracy.
+\item Please report bugs!
+\end{itemize}
+
+\end{document} \ No newline at end of file