Debian Codegraph @

texmf-dist/doc/latex/tikz-palattice/example3_coordinates.tex

raw
1 %% example3_coordinates.tex
2 %% Copyright 2017 J. Schmidt
3 %% tikz-palattice LaTeX package
4 %
5 % This work may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either version 1.3
7 % of this license or (at your option) any later version.
8 % The latest version of this license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3 or later is part of all distributions of LaTeX
11 % version 2005/12/01 or later.
12 %
13 % This work has the LPPL maintenance status `maintained'.
14 %
15 % The Current Maintainer of this work is J. Schmidt.
16 %
17 % This work consists of the files tikz-palattice.sty and tikz-palattice_documentation.tex
18 % and the 5 example files example1_linear.tex, example2_circular.tex,
19 % example3_coordinates.tex, example4_labels.tex and elsa.tex
20
21 \documentclass[a4paper]{scrartcl}
22 \usepackage[english]{babel}
23 \usepackage[utf8]{inputenc}
24 \usepackage{subcaption}
25 \usepackage{verbatim}
26 \usepackage{tikz-palattice}
27
28
29 % compile twice to connect lattices!
30
31
32 \title{Two more lattices}
33 \subtitle{scaling lattices and accessing coordinates}
34 \date{}
35
36 \begin{document}
37 \maketitle
38
39 \begin{figure}[h]
40 \centering
41 \begin{subfigure}{.45\textwidth}
42 \centering
43 % this is the ring from example 2, but plotted smaller (30%).
44 % the element sizes (in meter) are the same - as the rule indicates.
45 \begin{lattice}[0.3]
46 \setlabelfont{\tiny}
47 \begin{labeldistance}{0.3}
48 \drift{1}
49 \dipole{M1}{2}{45}
50 \drift{1}
51 \turnlabels
52 \dipole{M2}{2}{45}
53 \turnlabels
54 \drift{1}
55 \dipole{M3}{2}{45}
56 \drift{1}
57 \savecoordinate{myCoord1}[center]
58 \dipole{M4}{2}{45}
59 \drift{1}
60 \dipole{M5}{2}{45}
61 \drift{1}
62 \dipole{M6}{2}{45}
63 \drift{1}
64 \savecoordinate{myCoord2}[center]
65 \dipole{M7}{2}{45}
66 \drift{1}
67 \dipole{M8}{2}{45}
68 \drawrule{(-2.5,-1)}[2]
69 \end{labeldistance}
70 % custom drawing using saved coordinates (to center of drifts)
71 \draw[->, thick] (myCoord2) -- (myCoord1) node[midway,fill=white,rotate=20] {signal};
72 \end{lattice}
73 \end{subfigure}
74 %
75 %
76 %
77 \begin{subfigure}{.45\textwidth}
78 \centering
79 \begin{lattice}
80 \setangle{70}
81 \northlabels %labels to the left
82 \drift{0.5}
83 \quadrupole{QF1}{0.3}
84 \drift{0.2}
85 \kicker{}{0.1}
86 \drift{0.07}
87 \quadrupole{QD2}{0.3}
88 \drift{0.4}
89 \setelementcolor{kicker}{cyan}
90 \kicker{Septum}{0.5}
91 \resetelementcolor{kicker}
92 \savecoordinate{Septum}[center] %save to connect other beamline
93 \drift{0.8}
94 \kicker{}{0.1}
95 \drift{0.37}
96 \quadrupole{QD3}{0.2}
97 \drift{0.17}
98 \kicker{}{0.1}
99 \drift{0.1}
100 \sextupole{SF1}{0.2}
101 \drift{0.27}
102 \dipole{MB1}{0.2}{30}[s][0.4]
103 \drift{0.2}
104
105 % now go back to saved coordinate and continue with another beamline
106 \goto{Septum}
107 \rotate{-20}
108 \southlabels %labels to the right
109 \drift{0.6}
110 \kicker{SS1}{0.2}
111 \drift{0.2}
112 \kicker{SSH1}{0.2}
113 \drift{0.3}
114 \dipole{M1}{0.2}{-30}[r][0.4]
115 \begin{fade} %fade out this part
116 \drift{0.2}
117 \dipole{M2}{0.2}{50}[r][0.4]
118 \drift{0.2}
119 \dipole{M3}{0.2}{-20}[r][0.4]
120 \drift{0.7}
121 \end{fade}
122
123 \drawrule{(-0.75,-0.2)}[0.8]
124 \end{lattice}
125 \end{subfigure}
126 \caption{A figure with two lattices}
127 \label{fig:lattices}
128 \end{figure}
129
130
131
132
133
134
135 \clearpage
136 \begin{figure}
137 \centering
138 \begin{subfigure}[b]{.45\textwidth}
139 \centering
140 \begin{lattice}
141 \rotate{90}
142 \northlabels %labels to the left
143 \drift{0.5}
144 \quadrupole{QF1}{0.3}
145 \drift{0.2}
146 \kicker{}{0.1}
147 \drift{0.07}
148 \quadrupole{QD2}{0.3}
149 \drift{0.4}
150 \setelementcolor{kicker}{cyan}
151 \kicker{Septum}{0.5}
152 \resetelementcolor{kicker}
153 \savecoordinate{Septum}[center] %save to connect other beamline
154 \drift{0.8}
155 \kicker{}{0.1}
156 \drift{0.37}
157 \quadrupole{QD3}{0.2}
158 \drift{0.17}
159 \kicker{}{0.1}
160 \drift{0.1}
161 \sextupole{SF1}{0.2}
162 \drift{0.27}
163 \dipole{MB1}{0.2}{30}[s][0.4]
164 \drift{0.2}
165
166 % now go back to saved coordinate and continue with another beamline
167 \goto{Septum}
168 \rotate{-20}
169 \southlabels %labels to the right
170 \drift{0.6}
171 \kicker{SS1}{0.2}
172 \drift{0.2}
173 \kicker{SSH1}{0.2}
174 \drift{0.3}
175 \dipole{M1}{0.2}{-30}[r][0.4]
176 \begin{fade} %fade out this part
177 \drift{0.2}
178 \dipole{M2}{0.2}{50}[r][0.4]
179 \drift{0.2}
180 \dipole{M3}{0.2}{-20}[r][0.4]
181 \drift{0.7}
182 \end{fade}
183 \legend{(0,6.5)}
184 \end{lattice}
185 \caption{one lattice environment and goto}
186 \end{subfigure}
187 %
188 \begin{subfigure}[b]{.45\textwidth}
189 \centering
190 \begin{lattice}
191 \rotate{90}
192 \northlabels %labels to the left
193 \drift{0.5}
194 \quadrupole{QF1}{0.3}
195 \drift{0.2}
196 \kicker{}{0.1}
197 \drift{0.07}
198 \quadrupole{QD2}{0.3}
199 \drift{0.4}
200 \setelementcolor{kicker}{cyan}
201 \kicker{Septum}{0.5}
202 \resetelementcolor{kicker}
203 \savecoordinate{Septum}[center] %save to connect other beamline
204 \drift{0.8}
205 \kicker{}{0.1}
206 \drift{0.37}
207 \quadrupole{QD3}{0.2}
208 \drift{0.17}
209 \kicker{}{0.1}
210 \drift{0.1}
211 \sextupole{SF1}{0.2}
212 \drift{0.27}
213 \dipole{MB1}{0.2}{30}[s][0.4]
214 \drift{0.2}
215 \end{lattice}
216 %
217 %now draw second lattice and connect them using the saved coordinate
218 \begin{lattice}[1][overlay]
219 \start{(Septum)}
220 \rotate{70}
221 \drift{0.6}
222 \kicker{SS1}{0.2}
223 \drift{0.2}
224 \kicker{SSH1}{0.2}
225 \drift{0.3}
226 \dipole{M1}{0.2}{-30}[r][0.4]
227 \begin{fade} %fade out this part
228 \drift{0.2}
229 \dipole{M2}{0.2}{50}[r][0.4]
230 \drift{0.2}
231 \dipole{M3}{0.2}{-20}[r][0.4]
232 \drift{0.7}
233 \end{fade}
234 \legend{(-1,6.5)}
235 \end{lattice}
236 \caption{two lattice environments and start}
237 \end{subfigure}
238 \caption{Two ways to connect lattices}
239 \label{fig:twoways}
240 \end{figure}
241
242 \end{document}