texlive[43442] Master/texmf-dist: tikz-palattice (8mar17)

commits+karl at tug.org commits+karl at tug.org
Thu Mar 9 23:50:25 CET 2017


Revision: 43442
          http://tug.org/svn/texlive?view=revision&revision=43442
Author:   karl
Date:     2017-03-09 23:50:25 +0100 (Thu, 09 Mar 2017)
Log Message:
-----------
tikz-palattice (8mar17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/tikz-palattice/elsa.tex
    trunk/Master/texmf-dist/doc/latex/tikz-palattice/example3_coordinates.tex
    trunk/Master/texmf-dist/doc/latex/tikz-palattice/tikz-palattice_documentation.pdf
    trunk/Master/texmf-dist/doc/latex/tikz-palattice/tikz-palattice_documentation.tex
    trunk/Master/texmf-dist/tex/latex/tikz-palattice/tikz-palattice.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/tikz-palattice/example5_legend.tex

Modified: trunk/Master/texmf-dist/doc/latex/tikz-palattice/elsa.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikz-palattice/elsa.tex	2017-03-09 22:50:07 UTC (rev 43441)
+++ trunk/Master/texmf-dist/doc/latex/tikz-palattice/elsa.tex	2017-03-09 22:50:25 UTC (rev 43442)
@@ -1,5 +1,5 @@
 %% elsa.tex
-%% Copyright 2015 J. Schmidt
+%% Copyright 2017 J. Schmidt
 %% tikz-palattice LaTeX package
 % 
 % This work may be distributed and/or modified under the
@@ -36,6 +36,7 @@
 \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}}
 
 
 
@@ -99,7 +100,7 @@
 %title
 \node[mediumlabel, anchor=north, yshift=-1cm] at (L2label)
 {LINAC 2\\{\Large \SI{26}{\MeV}}};
-\node[smalllabel, anchor=west, xshift=4mm] at (PolQ)
+\node[mediumlabel, anchor=west, xshift=4mm] at (PolQ)
 {\IfLanguageName{ngerman}{Quelle}{Source of} pol.
   $e^-$};
 
@@ -181,6 +182,8 @@
 %-----------------------------
 %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}
@@ -285,20 +288,31 @@
 \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.30115}
+\drift{0.02115}
+%\marker{IC31}
+\drift{0.28}
 \dipole{M31}{2.875}{15}
-\drift{0.307}
-\corrector{KV31}{0.1}
-\drift{1.05465}
+\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.13665}
+\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.5031}
-\corrector{KV32}{0.1}
-\drift{0.41025}
+\drift{0.5296}
+\corrector{KV32}{0.13}
+\drift{0.35375}
 \quadrupole{SQ32}{0.45}
 \drift{1.382}
 \quadrupole{TJQ32}{0.5515}[0.2]
@@ -306,129 +320,195 @@
 
 % usual start
 %\marker{start}[0.5]
-\drift{0.03415}
+\drift{0.013}
+%\marker{IC01}
+\drift{0.02115}
 \quadrupole{QD1}{0.4997}
-\drift{0.19515}
-\corrector{KV01}{0.1}
-\drift{1.79875}
-\quadrupole{SQ1}{0.45}[0.2]
+\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.13665}
+\drift{0.0825}
+%\marker{IC02}
+\drift{0.05415}
 \quadrupole{QF2}{0.4997}
-\drift{1.05365}
-\corrector{KV02}{0.1}
-\drift{0.3077}
+\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.30145}
-\quadrupole{QD3}{0.4997}
-\drift{0.13665}
-\sextupole{SD3}{0.287}
-\drift{0.4305}
-\corrector{KV03}{0.1}
-\drift{1.84183}
-\drift{1.84183}
-
-\rotatelabels{60}[west]
-\quadrupole{QF4}{0.4997}
-\drift{0.13665}
-\sextupole{SF4}{0.287}
-\drift{0.214}
-\corrector{KV04}{0.1}
-\drift{0.7237}
-\rotatelabels{0}
-
+\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.30145}
-
-\rotatelabels{77}[west]
-\quadrupole{QD5}{0.4997}
-\drift{0.09715}
-\corrector{KV05}{0.1}
-\rotatelabels{0}
-
-\drift{1.2642}
+\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.30145}
-\quadrupole{QF6}{0.4997}
-\drift{0.94465}
-\corrector{KV06}{0.1}
-\drift{0.4167}
+\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.30145}
-
-\rotatelabels{-72}[east]
+\drift{0.2803}
+%\marker{IC07}
+\drift{0.02115}
 \quadrupole{QD7}{0.4997}
-\drift{0.41215}
-\kicker{MSE23}{0.90027}
+\drift{0.00865}
+\screen{}[0.025] %BPM07
+\drift{0.185}
+\kicker{MSE7}{0.9}
 \savecoordinate{ELSA_extract_neu}
-\drift{0.04893}
-\rotatelabels{0}
 
-% deleted due to "neue Extraktion"
-%\drift{0.19415}
-%\corrector{KV07}{0.1} 
-%\drift{1.1672}
 
+\drift{0.3427}
 \dipole{M7}{2.875}{15}
 \savecoordinate{sylibeamline}[center]
-\drift{0.30145}
+
+
+\drift{0.2803}
+%\marker{IC08}
+\drift{0.02115}
 \quadrupole{QF8}{0.4997}
-\drift{1.02365}
-\corrector{KV08}{0.1}
-\drift{0.3377}
+\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.30135}
+\drift{0.00365}
+\screen{}[0.025] %BPM09
+\drift{0.2727}
 \dipole{M9}{2.875}{15}
-\drift{0.3208}
-\corrector{KV09}{0.1}
-\drift{1.04065}
+\drift{0.3473}
+\corrector{KV09}{0.13}
+\drift{0.963}
+%\marker{IC10}
+\drift{0.02115}
 \quadrupole{QF10}{0.4997}
-\drift{0.30135}
+\drift{0.00615}
+\screen{}[0.025] %BPM10
+\drift{0.2702}
 \dipole{M10}{2.875}{15}
-\drift{0.7203}
-\corrector{KV10}{0.1}
-\drift{0.2175}
+\drift{0.6963}
+\corrector{KV10}{0.13}
+\drift{0.2115}
 \sextupole{SD10}{0.287}
-\drift{0.13665}
+\drift{0.105}
+\screen{}[0.025] %BPM11
+\drift{0.00665}
 \quadrupole{QD11}{0.4997}
-\drift{0.30135}
+\drift{0.02115}
+%\marker{IC11}
+\drift{0.2802}
 \dipole{M11}{2.875}{15}
-\drift{0.7208}
-\corrector{KV11}{0.1}
-\drift{0.217}
+\drift{0.7103}
+\corrector{KV11}{0.13}
+\drift{0.1975}
 \sextupole{SF11}{0.287}
-\drift{0.13665}
+\drift{0.1075}
+\screen{}[0.025] %BPM12
+\drift{0.00415}
 \quadrupole{QF12}{0.4997}
-\drift{0.30135}
+\drift{0.02115}
+%\marker{IC12}
+\drift{0.2802}
 \dipole{M12}{2.875}{15}
-\drift{1.1743}
-\corrector{KV12}{0.1}
-\drift{0.18715}
+\drift{1.1563}
+\corrector{KV12}{0.13}
+\drift{0.154}
+%\marker{IC13}
+\drift{0.02115}
 \quadrupole{QD13}{0.4997}
-\drift{0.30135}
+\drift{0.00365}
+\screen{}[0.025] %BPM13
+\drift{0.2727}
 \dipole{M13}{2.875}{15}
-\drift{0.7398}
-\corrector{KV13}{0.1}
-\drift{0.62165}
+\drift{0.7263}
+\corrector{KV13}{0.13}
+\drift{0.584}
+%\marker{IC14}
+\drift{0.02115}
 \quadrupole{QF14}{0.4997}
 \savecoordinate{rechts}
-\drift{1.86133}
-\drift{1.86133}
-\corrector{KV14}{0.1}
-\drift{0.81515}
+
+
+\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.30135}
+\drift{0.00865}
+\screen{}[0.025] %BPM15
+\drift{0.2677}
 \dipole{M15}{2.875}{15}
-\drift{0.9368}
-\corrector{KV15}{0.1}
-\drift{0.42465}
+\drift{1.1483}
+\corrector{KV15}{0.13}
+\drift{0.162}
+%\marker{IC16}
+\drift{0.02115}
 \quadrupole{QF16}{0.4997}
-\drift{0.13665}
+\drift{0.01115}
+\screen{}[0.025] %BPM16
+\drift{0.1005}
 \sextupole{SX16}{0.287}
 \drift{0.2065}
 \quadrupole{LQ16}{0.45}[0.2]
@@ -436,117 +516,182 @@
 \cavity{PETRA1}{1.6}
 \drift{0.93725}
 \quadrupole{TJQD16}{0.5515}[0.2]
-\drift{0.1614}
+\drift{0.12475}
+\screen{}[0.025] %BPM17
+\drift{0.01165}
 \quadrupole{QD17}{0.4997}
-\drift{0.10615}
-\corrector{KV17}{0.1}
-\drift{0.244}
+\drift{0.02115}
+%\marker{IC17}
+\drift{0.429}
 \cavity{PETRA2}{1.6}
-\drift{1.43175}
-\drift{0.07575}
+\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.13665}
+\drift{0.0825}
+%\marker{IC18}
+\drift{0.05415}
 \quadrupole{QF18}{0.4997}
-\drift{0.41665}
-\corrector{KV18}{0.1}
-\drift{0.9447}
+\drift{0.00615}
+\screen{}[0.025] %BPM18
+\drift{0.962}
+\corrector{KV18}{0.13}
+\drift{0.3382}
 \dipole{M18}{2.875}{15}
-\drift{0.30145}
-
-%labels rotated (anchor automatic)
-\rotatelabels{61}[east]
-\quadrupole{QD19}{0.4997}
-\drift{0.13665}
-\sextupole{SD19}{0.287}
-\drift{0.1965}
-\corrector{KV19}{0.1}
-\drift{1.747}
-\drift{1.747}
-\sextupole{SF19}{0.287}
-\drift{0.13665}
-\quadrupole{QF20}{0.4997}
-\drift{0.22565}
-\corrector{KV20}{0.1}
-\rotatelabels{0}
-
-\drift{1.1357}
+\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}
-\drift{0.30145}
-
-\rotatelabels{76}[east]
-\quadrupole{QD21}{0.4997}
-\drift{0.21015}
-\corrector{KV21}{0.1}
-\rotatelabels{0}
-
-\drift{1.151}
+\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}
-\drift{0.30165}
-\quadrupole{QF22}{0.4997}
-\drift{0.99865}
-\corrector{KV22}{0.1}
-\drift{0.363}
+\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.30115}
+\drift{0.28}
+%\marker{IC23}
+\drift{0.02115}
 \quadrupole{QD23}{0.4997}
-
-\drift{0.21}
+\drift{0.00865}
+\screen{}[0.025] %BPM23
+\drift{0.1765}
 \kicker{MSE23}{0.9}
 \savecoordinate{ELSA_extract}
-\drift{0.3}
 
+
+\drift{0.351}
 \dipole{M23}{2.875}{15}
-\drift{0.30165}
+\drift{0.2805}
+%\marker{IC24}
+\drift{0.02115}
 \quadrupole{QF24}{0.4997}
-\drift{0.99265}
-\corrector{KV24}{0.1}
-\drift{0.369}
+\drift{0.01115}
+\screen{}[0.025] %BPM24
+\drift{0.886}
+\corrector{KV24}{0.13}
+\drift{0.4095}
 \dipole{M24}{2.875}{15}
-\drift{0.30115}
+\drift{0.2645}
+\screen{}[0.025] %BPM25
+\drift{0.01165}
 \quadrupole{QD25}{0.4997}
 \savecoordinate{compton}[center]
-\drift{0.30115}
+
+
+\drift{0.02115}
+%\marker{IC25}
+\drift{0.28}
 \dipole{M25}{2.875}{15}
-\drift{0.716}
-\corrector{KV25}{0.1}
-\drift{0.64565}
+\drift{0.6985}
+\corrector{KV25}{0.13}
+\drift{0.612}
+%\marker{IC26}
+\drift{0.02115}
 \quadrupole{QF26}{0.4997}
-\drift{0.30165}
+\drift{0.00615}
+\screen{}[0.025] %BPM26
+\drift{0.2705}
 \dipole{M26}{2.875}{15}
-\drift{0.723}
-\corrector{KV26}{0.1}
-\drift{0.214}
+\drift{0.729}
+\corrector{KV26}{0.13}
+\drift{0.178}
 \sextupole{SD26}{0.287}
-\drift{0.13715}
+\drift{0.1055}
+\screen{}[0.025] %BPM27
+\drift{0.00665}
 \quadrupole{QD27}{0.4997}
-\drift{0.30115}
+\drift{0.02115}
+%\marker{IC27}
+\drift{0.28}
 \dipole{M27}{2.875}{15}
-\drift{0.728}
-\corrector{KV27}{0.1}
-\drift{0.21}
+\drift{0.7025}
+\corrector{KV27}{0.13}
+\drift{0.2055}
 \sextupole{SF27}{0.287}
-\drift{0.13665}
+\drift{0.1075}
+\screen{}[0.025] %BPM28
+\drift{0.00415}
 \quadrupole{QF28}{0.4997}
-\drift{0.30165}
+\drift{0.02115}
+%\marker{IC28}
+\drift{0.2805}
 \dipole{M28}{2.875}{15}
-\drift{1.168}
-\corrector{KV28}{0.1}
-\drift{0.19315}
+\drift{1.159}
+\corrector{KV28}{0.13}
+\drift{0.151}
+%\marker{IC29}
+\drift{0.02115}
 \quadrupole{QD29}{0.4997}
-\drift{0.30115}
+\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.318}
-\corrector{KV29}{0.1}
-\drift{1.04365}
-\quadrupole{QF30}{0.4997}
-\drift{1.56882}
-\drift{1.56882}
-\corrector{KV30}{0.1}
-\drift{1.0}
-\drift{0.40015}
+
+
+\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
@@ -657,7 +802,7 @@
 \end{scope}
 
 %title
-\node[mediumlabel, anchor=east, yshift=1.5cm] at (CBlabel) {Crystal Barrel};
+\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}};
 
@@ -697,7 +842,7 @@
   \end{scope}
 
   % title
-  \node[mediumlabel, anchor=east, yshift=-0.7cm, xshift=-0.3cm] at (BGOlabel) {BGO-OD};
+  \node[experimentlabel, anchor=center, xshift=1cm,yshift=-0.4cm] at (BGOlabel) {BGO-OD (E2)};
 
 
 %-----------------------------
@@ -705,34 +850,103 @@
 %-----------------------------
 \goto{ELSA_extract_neu}
 \southlabels
-\rotate{-4}
-\drift{1.578}
-\drift{1.578}
-\quadrupole{QF1}{0.5}[0.3]
-\drift{2.06505}
-\drift{2.06505}
-\drift{2.06505}
-\quadrupole{QD1}{0.4997}[0.3]
-\drift{0.89515}
+\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.89415}
-\quadrupole{QF2}{0.4997}[0.3]
-\drift{2.1063}
-\quadrupole{QD2}{0.4997}[0.3]
-\drift{2.77607}
+\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}
-\drift{2.77607}
-\beamdump{}{0.4}
+\setlinecolor{drift}{dotted}
+\drift{6.45}
+\beamdump{}{0.5} 
   %title
-  \node[smalllabel, anchor=north, yshift=-5mm, text width=4.5cm] at (NEWSFlabel)
-  {\IfLanguageName{ngerman}{Messplatz für}{area
-      for}\\\IfLanguageName{ngerman}{Detektortests}{detector
-      tests}\\\IfLanguageName{ngerman}{(im Aufbau)}{(under construction)}};
+  \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)}[2]
+\legend{(67,46)}[3]
 \end{lattice}
 \end{document}

Modified: trunk/Master/texmf-dist/doc/latex/tikz-palattice/example3_coordinates.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikz-palattice/example3_coordinates.tex	2017-03-09 22:50:07 UTC (rev 43441)
+++ trunk/Master/texmf-dist/doc/latex/tikz-palattice/example3_coordinates.tex	2017-03-09 22:50:25 UTC (rev 43442)
@@ -1,5 +1,5 @@
 %% example3_coordinates.tex
-%% Copyright 2015 J. Schmidt
+%% Copyright 2017 J. Schmidt
 %% tikz-palattice LaTeX package
 % 
 % This work may be distributed and/or modified under the
@@ -136,8 +136,8 @@
 \begin{figure}
 \centering
 \begin{subfigure}[b]{.45\textwidth}
-\centering
- \begin{lattice}
+  \centering
+  \begin{lattice}
     \rotate{90}
     \northlabels %labels to the left
     \drift{0.5}
@@ -162,12 +162,11 @@
     \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}
+
+    % 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}
@@ -181,14 +180,14 @@
       \dipole{M3}{0.2}{-20}[r][0.4]
       \drift{0.7}
     \end{fade}
-    \legend{(-1,6.5)}
+    \legend{(0,6.5)}
   \end{lattice}
- \caption{two lattice environments and start}
+  \caption{one lattice environment and goto}
 \end{subfigure}
 %
 \begin{subfigure}[b]{.45\textwidth}
-  \centering
-  \begin{lattice}
+\centering
+ \begin{lattice}
     \rotate{90}
     \northlabels %labels to the left
     \drift{0.5}
@@ -213,11 +212,12 @@
     \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
+  \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}
@@ -231,9 +231,9 @@
       \dipole{M3}{0.2}{-20}[r][0.4]
       \drift{0.7}
     \end{fade}
-    \legend{(0,6.5)}
+    \legend{(-1,6.5)}
   \end{lattice}
-  \caption{one lattice environment and goto}
+ \caption{two lattice environments and start}
 \end{subfigure}
 \caption{Two ways to connect lattices}
 \label{fig:twoways}

Added: trunk/Master/texmf-dist/doc/latex/tikz-palattice/example5_legend.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikz-palattice/example5_legend.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tikz-palattice/example5_legend.tex	2017-03-09 22:50:25 UTC (rev 43442)
@@ -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

Modified: trunk/Master/texmf-dist/doc/latex/tikz-palattice/tikz-palattice_documentation.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tikz-palattice/tikz-palattice_documentation.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikz-palattice/tikz-palattice_documentation.tex	2017-03-09 22:50:07 UTC (rev 43441)
+++ trunk/Master/texmf-dist/doc/latex/tikz-palattice/tikz-palattice_documentation.tex	2017-03-09 22:50:25 UTC (rev 43442)
@@ -1,5 +1,5 @@
 %% tikz-palattice_documentation.tex
-%% Copyright 2015 J. Schmidt
+%% Copyright 2017 J. Schmidt
 %% tikz-palattice LaTeX package
 % 
 % This work may be distributed and/or modified under the
@@ -23,8 +23,6 @@
 \usepackage[utf8]{inputenc}
 \usepackage[T1]{fontenc}
 \usepackage{lmodern}
-\usepackage{fixltx2e}
-\usepackage{graphicx}
 \usepackage{subcaption}
 \usepackage{amsmath}
 \usepackage{textcomp}
@@ -40,8 +38,8 @@
 \newcommand{\optiondef}[2]{{\color{green!50!black}$\langle$\textit{#1=#2}$\rangle$}}
 \newcommand{\tikzlabel}{Ti\textit{k}Z}
 
-\author{Jan Schmidt <schmidt at physik.uni-bonn.de>}
-\date{v2.21 (March 18, 2015)}
+\author{Jan Schmidt <janschmidt at mailbox.org>}
+\date{v2.3 (March 9, 2017)}
 \title{tikz-palattice - draw particle accelerator lattices with \tikzlabel}
 
 \hypersetup{
@@ -93,7 +91,7 @@
 
 \clearpage
 \parindent=0pt
-Copyright 2015 Jan Schmidt
+Copyright 2017 Jan Schmidt
 
 \medskip
 Permission is granted to distribute and/or modify both the documentation and the code
@@ -133,6 +131,7 @@
 \item ifthen
 \item xargs
 \item etoolbox
+\item iflang
 \end{itemize}
 
 \lstset{language=[LaTeX]TeX}
@@ -244,17 +243,46 @@
   \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:
-\begin{itemize}
-\item s for a sector magnet (entrance/exit surface 90 degree to beampipe)
-\item br for a bend rectangle magnet (parallel entrance/exit surfaces)
-\item r for a rectangle magnet
-\end{itemize}
+
+\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}[ht]
+\begin{figure}
   \centering
   \includegraphics[width=10cm]{example1_linear}
   \caption{Example 1}
@@ -292,36 +320,11 @@
 Use this to connect lattices and draw injection, extraction or even a complete accelerator
 facility. This is shown in example 3.
 
-
-
-\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.
-
-
 \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.3]
+  \begin{lattice}[0.27]
     \setlabelfont{\tiny}
     \begin{labeldistance}{0.3}
       \drift{1}
@@ -354,6 +357,84 @@
 \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
@@ -500,7 +581,7 @@
 \end{minipage}
 
 
-
+\clearpage
 \subsection{Access lattice Coordinates}
 \label{sec:coords}
 You can use element coordinates to draw anything you want using pgf/tikz. 
@@ -515,9 +596,9 @@
 \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} (b)).
+  \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} (a))
+  \lstinline+\start{name}+. Use the tikz overlay option. (Figure \ref{fig:twoways} (b))
 \end{itemize}
 
 
@@ -526,8 +607,8 @@
 \begin{figure}[h]
 \centering
 \begin{subfigure}[b]{.45\textwidth}
-\centering
- \begin{lattice}[0.8]
+  \centering
+  \begin{lattice}[0.8]
     \rotate{90}
     \turnlabels %labels to the left
     \drift{0.5}
@@ -552,12 +633,11 @@
     \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}
+
+    % 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}
@@ -571,14 +651,14 @@
       \dipole{M3}{0.2}{-20}[r][0.4]
       \drift{0.7}
     \end{fade}
-    \legend{(-1,6.5)}
+    \legend{(0,6.5)}
   \end{lattice}
- \caption{two lattice environments and start}
+  \caption{one lattice environment and goto}
 \end{subfigure}
 %
 \begin{subfigure}[b]{.45\textwidth}
-  \centering
-  \begin{lattice}[0.8]
+\centering
+ \begin{lattice}[0.8]
     \rotate{90}
     \turnlabels %labels to the left
     \drift{0.5}
@@ -603,11 +683,12 @@
     \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
+  \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}
@@ -621,9 +702,9 @@
       \dipole{M3}{0.2}{-20}[r][0.4]
       \drift{0.7}
     \end{fade}
-    \legend{(0,6.5)}
+    \legend{(-1,6.5)}
   \end{lattice}
-  \caption{one lattice environment and goto}
+ \caption{two lattice environments and start}
 \end{subfigure}
 \caption{From example 3: Two ways to connect lattices}
 \label{fig:twoways}
@@ -650,13 +731,19 @@
 \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 manually adding and editing legend entries
 \item The look of the elements can be improved
 \item More element types can be added
 \item \ldots{}

Modified: trunk/Master/texmf-dist/tex/latex/tikz-palattice/tikz-palattice.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tikz-palattice/tikz-palattice.sty	2017-03-09 22:50:07 UTC (rev 43441)
+++ trunk/Master/texmf-dist/tex/latex/tikz-palattice/tikz-palattice.sty	2017-03-09 22:50:25 UTC (rev 43442)
@@ -1,5 +1,5 @@
 %% tikz-palattice.sty
-%% Copyright 2015 J. Schmidt
+%% Copyright 2017 J. Schmidt
 %% tikz-palattice LaTeX package
 % 
 % This work may be distributed and/or modified under the
@@ -18,13 +18,14 @@
 % and the 5 example files example1_linear.tex, example2_circular.tex,
 % example3_coordinates.tex, example4_labels.tex and elsa.tex
 
-\ProvidesPackage{tikz-palattice}[2015/03/18 v2.21]
+\ProvidesPackage{tikz-palattice}[2017/03/09 v2.3]
 \RequirePackage{tikz}
 \RequirePackage{ifthen}
 \RequirePackage{siunitx}
 \RequirePackage{xargs}
 \RequirePackage{etoolbox}
-\usetikzlibrary{calc,positioning,fit}
+\RequirePackage{iflang}
+\usetikzlibrary{calc,positioning,fit,chains}
 \usetikzlibrary{scopes}
 \pgfdeclarelayer{background}
 \pgfsetlayers{background,main}
@@ -67,6 +68,9 @@
 \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
@@ -167,6 +171,51 @@
   }
 }
 
+
+
+% 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$);
@@ -186,27 +235,42 @@
 \tikzset{drift/.append style={draw=none}}
 \northlabels%
 \setlabelcolor{black}%
-  \iftoggle{dip}{\dipole{Dipole}{\l}{0}[s][\h]\xdef\points{(elementlabel\j)
+\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{Quadrupole}{\l}[\h]\xdef\points{(elementlabel\j)
+  \iftoggle{quad}{\quadrupole{\pgfkeysvalueof{/pal/legendtxt/quadrupole}}{\l}[\h]\xdef\points{(elementlabel\j)
       \points}\drift{\dist}}{}%
-  \iftoggle{sext}{\sextupole{Sextupole}{\l}[\h]\xdef\points{(elementlabel\j)
+  \iftoggle{sext}{\sextupole{\pgfkeysvalueof{/pal/legendtxt/sextupole}}{\l}[\h]\xdef\points{(elementlabel\j)
       \points}\drift{\dist}}{}%
-  \iftoggle{correct}{\corrector{Corrector}{\l}[\h]\xdef\points{(elementlabel\j)
+  \iftoggle{correct}{\corrector{\pgfkeysvalueof{/pal/legendtxt/corrector}}{\l}[\h]\xdef\points{(elementlabel\j)
       \points}\drift{\dist}}{}%
-  \iftoggle{kick}{\kicker{Kicker}{\l}[\h]\xdef\points{(elementlabel\j)
+  \iftoggle{kick}{\kicker{\pgfkeysvalueof{/pal/legendtxt/kicker}}{\l}[\h]\xdef\points{(elementlabel\j)
       \points}\drift{\dist}}{}%
-  \iftoggle{cav}{\cavity{Cavity}{\l}[\h]\xdef\points{(elementlabel\j)
+  \iftoggle{cav}{\cavity{\pgfkeysvalueof{/pal/legendtxt/cavity}}{\l}[\h]\xdef\points{(elementlabel\j)
       \points}\drift{\dist}}{}%
-  \iftoggle{sol}{\solenoid{Solenoid}{\l}[\h]\xdef\points{(elementlabel\j)
+  \iftoggle{sol}{\solenoid{\pgfkeysvalueof{/pal/legendtxt/solenoid}}{\l}[\h]\xdef\points{(elementlabel\j)
       \points}\drift{\dist}}{}%
-  \iftoggle{sourc}{\source{Source}{\l}[\h]\xdef\points{(elementlabel\j)
+  \iftoggle{sourc}{\source{\pgfkeysvalueof{/pal/legendtxt/source}}{\l}[\h]\xdef\points{(elementlabel\j)
       \points}\drift{\dist}}{}%
-  \iftoggle{scree}{\screen{Screen}[\l]\xdef\points{(elementlabel\j)
+  \iftoggle{scree}{\screen{\pgfkeysvalueof{/pal/legendtxt/screen}}[\l]\xdef\points{(elementlabel\j)
       \points}\drift{\dist}}{}%
-  \iftoggle{valv}{\drift{\dist}\valve{Valve}\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}



More information about the tex-live-commits mailing list