Debian Codegraph @

texmf-dist/doc/latex/liftarm/liftarm.tex

raw
1 %% liftarm.tex
2 %% Copyright 2022-2024 Matthias Floré
3 %
4 % This work may be distributed and/or modified under the
5 % conditions of the LaTeX Project Public License, either version 1.3c
6 % of this license or (at your option) any later version.
7 % The latest version of this license is in
8 % http://www.latex-project.org/lppl.txt
9 % and version 1.3c or later is part of all distributions of LaTeX
10 % version 2005/12/01 or later.
11 %
12 % This work has the LPPL maintenance status `maintained'.
13 %
14 % The Current Maintainer of this work is Matthias Floré.
15 %
16 % This work consists of the files liftarm.pdf, liftarm.sty,
17 % liftarm.tex and README.md.
18 \documentclass[a4paper,english,dvipsnames]{ltxdoc}
19 \usepackage[english]{babel}
20 \usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry}
21 \usepackage{parskip}
22 \usepackage{mathtools}
23 \usepackage{amssymb}
24 \allowdisplaybreaks
25 \usepackage{pdflscape}
26 \usepackage{animate}
27 \usepackage{liftarm}
28 \input{pgfmanual-en-macros.tex}
29 \usepackage{codehigh}
30 \usepackage{fancyhdr}
31 \pagestyle{fancy}
32 \renewcommand{\headrulewidth}{0pt}
33 \fancyhead{}
34 \fancyfoot[C]{\IfRefUndefinedExpandable{Thesourcecode}{}{\begin{tikzpicture}\liftarm[mark holes=\thepage -1]{0,0}{\getpagerefnumber{Thesourcecode}-2}{0}\end{tikzpicture}}}%\liftarm{0,0}{\thepage}{0}
35 \usepackage[nottoc]{tocbibind}
36 \usepackage{imakeidx}
37 \makeindex[program=makeindex,columns=2,intoc=true]
38 \indexsetup{othercode={\thispagestyle{fancy}}}
39 \AtEndPreamble{\hypersetup{%
40 linktoc=all,
41 pdfstartview=FitH,
42 colorlinks=true,
43 linkcolor=Mahogany,
44 citecolor=ForestGreen,
45 urlcolor=MidnightBlue,
46 bookmarksnumbered=true,
47 pdftitle=The liftarm package,
48 pdfauthor=Matthias Floré,
49 pdfsubject=Manual,
50 pdfkeywords={liftarm,LU decomposition,Newton-Raphson method}}}
51 \setcounter{tocdepth}{2}
52 \setcounter{secnumdepth}{2}
53 \DeclareMathOperator{\atan}{atan}
54 \title{The \texttt{liftarm} package\\[12pt]\large Geometric constructions with liftarms using \tikzname{} and \LaTeX3}
55 \author{Matthias FlorĂ©\\\href{mailto:[email protected]}{\texttt{[email protected]}}}
56 \date{Version 4.0 (2025/07/24)}%\\[12pt]
57 \begin{document}
58 \maketitle
59 \thispagestyle{fancy}
60 \begin{abstract}
61 \noindent This package is based on the package |tikz| (see \cite{TtTaPGFp}) and can be used to draw geometric constructions with liftarms using \tikzname. There are several options for the appearance of the liftarms. It provides an environment to connect multiple liftarms using the Newton-Raphson method and LU decomposition. It also provides a command to describe a construction and a method to animate a construction with one or more traces.% This is the manual for version .
62 \end{abstract}
63 \tableofcontents
64 \section{Usage}
65 The package |liftarm| can be used by putting the following in the preamble.
66 \begin{codeexample}[code only]
67 \usepackage{liftarm}
68 \end{codeexample}
69 The package |liftarm| loads the package |xcolor| with the option |dvipsnames|, the package |tikz| and the \tikzname{} library |calc|. Since |xcolor| is loaded with the option |dvipsnames|, packages such as |pgfplots| and |tcolorbox| must be loaded \emph{after} |liftarm|.
70 \section{Drawing liftarms}
71 \begin{command}{\liftarm\opt{\oarg{options}}\marg{point}\marg{length}\marg{angle}}
72 This command can be placed inside a |tikzpicture| environment. It draws a liftarm of \meta{length} starting at \meta{point}. The angle between the liftarm and the $x$-axis can be specified by \meta{angle} in degrees. The distance between the holes is $1$.
73 \begin{codeexample}[width=10cm]
74 \begin{tikzpicture}
75 \liftarm{1,2}{3}{20}
76 \end{tikzpicture}
77 \end{codeexample}
78 Note that the number of holes is $\meta{length}+1$. The \meta{options} can be given with the following keys.
79 \begin{key}{/liftarm/axle holes=\marg{values}}
80 This key defines the holes in the liftarm where axle holes will be drawn.
81 \begin{codeexample}[width=10cm]
82 \begin{tikzpicture}
83 \liftarm[axle holes={0,4}]{0,1}{4}{0}
84 \end{tikzpicture}
85 \end{codeexample}
86 \end{key}
87 \begin{key}{/liftarm/brick=\opt{\meta{boolean}} (default true, initially false)}
88 If true, a brick will be drawn instead of a liftarm.
89 \begin{codeexample}[width=10cm]
90 \begin{tikzpicture}
91 \liftarm[brick]{0,1}{2}{0}
92 \end{tikzpicture}
93 \end{codeexample}
94 \end{key}
95 \begin{key}{/liftarm/color=\marg{number}\marg{color}}
96 This key defines the color of liftarms of length \meta{number}.
97
98 Initially, the colors |Gray|, |darkgray|, |Yellow|, |Orange|, |Red|, |Green|, |Blue| and |Brown| are defined for respectively the lengths |0| till |7|.
99 \end{key}
100 \begin{key}{/liftarm/color modulo=\marg{number} (initially 8)}
101 The default colors of the liftarms are determined by computing the length of the liftarm modulo the value of this key and selecting the color defined by the key |color|.
102 \begin{codeexample}[width=10cm]
103 \begin{tikzpicture}[scale=0.5]
104 \pgfkeys{
105 /liftarm,
106 color={0}{Yellow},
107 color={1}{Red},
108 color={2}{Green},
109 color={3}{Blue},
110 color modulo=4
111 }
112 \foreach\n in {0,...,8}{
113 \liftarm{0,-\n}{\n}{0}
114 }
115 \end{tikzpicture}
116 \end{codeexample}
117 \end{key}
118 \begin{key}{/liftarm/contour=\opt{\meta{boolean}} (default true, initially false)}
119 If true, a contour will be drawn around the liftarm.
120 \begin{codeexample}[width=10cm]
121 \begin{tikzpicture}
122 \liftarm[contour]{0,1}{4}{0}
123 \liftarm[brick,contour]{1,2}{2}{0}
124 \end{tikzpicture}
125 \end{codeexample}
126 \end{key}
127 \begin{stylekey}{/liftarm/contour style=\marg{options} (initially \normalfont empty)}
128 The style of the contour is determined as follows. First, the color is defined as \meta{initial color of the liftarm}|!75!black|. Then the option |ultra thick| is added. Thereafter, the style of the key |contour style| is added.
129
130 The style |contour style| only applies to the border of the liftarm. The style |liftarm style| also applies to the holes of the liftarm.
131 \begin{codeexample}[width=10cm]
132 \begin{tikzpicture}
133 \liftarm[
134 contour,
135 contour style={dashed,black}
136 ]{0,1}{4}{0}
137 \liftarm[
138 liftarm style={draw=black,thick}
139 ]{0,2}{4}{0}
140 \end{tikzpicture}
141 \end{codeexample}
142 \end{stylekey}
143 \begin{key}{/liftarm/coordinate=\marg{number 1/name 1,\dots}}
144 This key defines coordinates with name \meta{name i} at hole \meta{number i} of the liftarm.
145 \begin{codeexample}[width=10cm]
146 \begin{tikzpicture}
147 \liftarm[
148 coordinate={1/A,3/B}
149 ]{0,1}{6}{40}
150 \liftarm{A}{3}{0}
151 \liftarm{B}{2}{180}
152 \end{tikzpicture}
153 \end{codeexample}
154 \end{key}
155 \begin{key}{/liftarm/hole radius=\marg{value} (initially 0.3)}
156 The \meta{value} of this key, multiplied with the \meta{value} of the key |scalefactor| defines the radius of the holes.
157 \begin{codeexample}[width=10cm]
158 \begin{tikzpicture}
159 \liftarm[hole radius=0.1]{0,0}{5}{0}
160 \end{tikzpicture}
161 \end{codeexample}
162 \end{key}
163 \begin{stylekey}{/liftarm/liftarm style=\marg{options} (initially \normalfont empty)}
164 The style of the liftarm is determined as follows. First, the color is defined by the keys |color| and |color modulo|. Thereafter, the style of the key |liftarm style| is added.
165 \end{stylekey}
166 \begin{key}{/liftarm/liftarm thickness=\marg{value} (initially 0.92)}
167 The \meta{value} of this key, multiplied with the \meta{value} of the key |scalefactor| defines the thickness of the liftarm.
168 \begin{codeexample}[width=10cm]
169 \begin{tikzpicture}
170 \liftarm[
171 hole radius=0.1,
172 liftarm thickness=0.3
173 ]{0,0}{5}{0}
174 \end{tikzpicture}
175 \end{codeexample}
176 \end{key}
177 \begin{key}{/liftarm/mark holes=\marg{values}}
178 \end{key}
179 \begin{key}{/liftarm/mark radius=\marg{factor} (initially 1)}
180 \end{key}
181 \begin{stylekey}{/liftarm/mark style=\marg{options} (initially \normalfont empty)}
182 The key |mark holes| defines the holes in the liftarm which will be marked. The radius is the product of the \meta{factor} given to the key |mark radius| and the value of the key |hole radius|. The style of these marks is determined as follows. First, the color is set to |black|. Thereafter, the style of the key |mark style| is added.
183 \begin{codeexample}[width=10cm]
184 \begin{tikzpicture}
185 \liftarm[
186 mark holes={0,1,3}
187 ]{0,0}{5}{0}
188 \liftarm[
189 mark holes={1,2,4},
190 mark radius=2/3,
191 mark style=Blue
192 ]{0,1}{4}{0}
193 \end{tikzpicture}
194 \end{codeexample}
195 \end{stylekey}
196 \begin{key}{/liftarm/origin=\marg{number} (initially 0)}
197 This key defines the number of the hole which will be placed at the coordinate given as argument to the liftarm.
198 \begin{codeexample}[width=10cm]
199 \begin{tikzpicture}
200 \liftarm{-2,0}{4}{0}
201 \liftarm[origin=1]{0,0}{3}{30}
202 \liftarm[origin=2]{0,0}{5}{-20}
203 \end{tikzpicture}
204 \end{codeexample}
205 \end{key}
206 \begin{key}{/liftarm/scalefactor=\marg{value} (initially 0.5)}
207 The \meta{value} of this key defines the factor which scales the thickness of the liftarm and the radius of the holes.
208 \begin{codeexample}[width=10cm]
209 \begin{tikzpicture}
210 \liftarm[scalefactor=1]{0,0}{4}{0}
211 \liftarm[brick,scalefactor=1]{1,2}{2}{0}
212 \end{tikzpicture}
213 \end{codeexample}
214 \end{key}
215 \begin{key}{/liftarm/screw angle=\marg{angle} (initially 10)}
216 \end{key}
217 \begin{key}{/liftarm/screw holes=\marg{values}}
218 \end{key}
219 \begin{key}{/liftarm/screw radius=\marg{factor} (initially 0.8)}
220 \end{key}
221 \begin{stylekey}{/liftarm/screw style=\marg{options} (initially \normalfont empty)}
222 The key |screw holes| defines the holes in the liftarm where a screw will be drawn. The angle of these screws is determined by the key |screw angle| which is an angle in degrees. The radius is the product of the \meta{factor} given to the key |screw radius| and the value of the key |hole radius|. The style of these screws is determined as follows. First, the color is set to |black|. Then the option |rotate=45| is added. Thereafter, the style of the key |screw style| is added.
223 \begin{codeexample}[width=10cm]
224 \begin{tikzpicture}
225 \liftarm[
226 screw holes={0,1,3}
227 ]{0,0}{5}{0}
228 \liftarm[
229 screw angle=15,
230 screw holes={1,2,4},
231 screw radius=0.7,
232 screw style={Blue,rotate=-45}
233 ]{0,1}{4}{0}
234 \end{tikzpicture}
235 \end{codeexample}
236 \end{stylekey}
237 \begin{key}{/liftarm/type=\mchoice{liftarm,line segment} (initially liftarm)}
238 \begin{description}
239 \item[\texttt{liftarm}] In this case, the command |\liftarm| draws a liftarm.
240 \item[\texttt{line segment}] In this case, the command |\liftarm| draws a line segment.
241 \end{description}
242 \end{key}
243 \end{command}
244 \section{Connecting liftarms}
245 \begin{environment}{{liftarmconnect}\opt{\oarg{options}}}
246 This environment can be placed inside a |tikzpicture| environment. It can be used to connect liftarms where the angles are computed automatically. The \meta{options} can be a list of keys from the liftarm key family.
247
248 The contents should consist only of commands |\liftarm| and spaces.
249
250 The conditions to connect the liftarms are specified by the key |coordinate|. The resulting equations are determined automatically by the environment |liftarmconnect|. The number of liftarms needs to be equal to the number of equations. In the example below, there are 2 liftarms and 1 condition specified with the coordinate |A| resulting in 2 equations.
251 \begin{codeexample}[width=10cm]
252 \begin{tikzpicture}
253 \coordinate (X) at (5,0);
254 \begin{liftarmconnect}
255 \liftarm[coordinate=4/A]{0,0}{4}{60}
256 \liftarm[coordinate=4/A]{X}{4}{120}
257 \end{liftarmconnect}
258 \end{tikzpicture}
259 \end{codeexample}
260 The similar code below does not work because the coordinate |A| is used as the starting point of the second liftarm but is unknown since it is used in a condition for the first liftarm and furthermore, there is no liftarm to complement the condition involving |A| in the first liftarm.
261 \begin{codeexample}[code only]
262 \begin{tikzpicture}
263 \coordinate (X) at (5,0);
264 \begin{liftarmconnect}
265 \liftarm[coordinate=4/A]{0,0}{4}{60}
266 \liftarm[coordinate=4/X]{A}{4}{-60}
267 \end{liftarmconnect}
268 \end{tikzpicture}
269 \end{codeexample}
270 If the environment |liftarmconnect| consists of 2 liftarms then the law of cosines is used to compute the angles.
271
272 If there are more than 2 liftarms then the set of equations is solved with the Newton-Raphson method. The initial values for the angles are given by the last arguments of the commands |\liftarm|. The Jacobian matrix is defined by the environment |liftarmconnect|. The resulting set of linear equations is solved with LU decomposition. The iteration stops if the condition determined by the key |connect stop| is satisfied.
273
274 Since the \emph{let operation} from the \tikzname{} library |calc| is used, it is not possible to use the variable names |\n|, |\p|, |\x| and |\y| inside the starting point of a command |\liftarm| which is used in the environment |liftarmconnect|.
275 \begin{key}{/liftarm/connect stop=\mchoice{1-norm,2-norm,iterations} (initially 1-norm)}
276 \begin{description}
277 \item[\texttt{1-norm}] In this case, the iteration stops if the 1-norm is smaller than the value given to this key. Its default value is $0.001$.
278 \item[\texttt{2-norm}] In this case, the iteration stops if the 2-norm is smaller than the value given to this key. Its default value is $0.001$.
279 \item[\texttt{iterations}] In this case, a number of iterations is executed where the number is the one given to this key. Its default value is $10$.
280 \end{description}
281 \end{key}
282 \begin{codeexample}[width=10cm]
283 \begin{tikzpicture}
284 \begin{liftarmconnect}
285 \liftarm[coordinate=2/A]{0,0}{2}{70}
286 \liftarm[coordinate=3/A]{4,0}{3}{120}
287 \end{liftarmconnect}
288 \begin{liftarmconnect}
289 \liftarm[coordinate=4/B]{4,0}{4}{200}
290 \liftarm[coordinate=1/B]{0,0}{1}{-90}
291 \end{liftarmconnect}
292 \node at (A) {\small $A$};
293 \node at (B) {\small $B$};
294 \end{tikzpicture}
295 \end{codeexample}
296 The example below shows the regular pentagon from \cite{Tmm1}. In the first environment |liftarmconnect| there are $4$ liftarms and $2$ conditions resulting in $4$ equations. Hence the Jacobian matrix has size $4\times 4$.
297 \begin{codeexample}[width=7cm]
298 \begin{tikzpicture}[scale=0.5]
299 \pgfkeys{/liftarm,liftarm style={draw=black},scalefactor=1}
300 \liftarm{0,0}{3}{0}
301 \begin{liftarmconnect}
302 \liftarm[coordinate={3/A,4/B,12/C}]{0,0}{12}{100}
303 \liftarm[coordinate={3/D,4/E,12/F}]{3,0}{12}{80}
304 \liftarm[coordinate=11/F]{B}{11}{60}
305 \liftarm[coordinate=11/C]{E}{11}{120}
306 \end{liftarmconnect}
307 \begin{liftarmconnect}
308 \liftarm[coordinate=3/G]{A}{3}{30}
309 \liftarm[coordinate=3/G]{D}{3}{150}
310 \end{liftarmconnect}
311 \end{tikzpicture}
312 \end{codeexample}
313 The example below shows iterations $0$ till $3$ of a construction with $6$ liftarms and $3$ conditions resulting in $6$ equations. Hence the Jacobian matrix has size $6\times 6$.
314 \begin{codeexample}[]
315 \begin{tikzpicture}
316 \liftarm{0,0}{15}{0}
317 \liftarm{0,5}{15}{0}
318 \foreach\k in {0,...,3}{
319 \begin{scope}[shift={(\k*4,0)}]
320 \begin{liftarmconnect}[connect stop={iterations=\k},liftarm style=ultra thick,type=line segment]
321 \liftarm[coordinate=3/A]{1,0}{3}{90}
322 \liftarm[coordinate=3/B]{3,0}{3}{90}
323 \liftarm[coordinate=1/B]{A}{1}{0}
324 \liftarm[coordinate=1/C]{A}{1}{70}
325 \liftarm[coordinate=1/C]{B}{1}{110}
326 \liftarm[coordinate=2/C]{0,5}{2}{0}
327 \end{liftarmconnect}
328 \node at (1.5,-1) {\texttt{iterations=\k}};
329 \end{scope}
330 }
331 \end{tikzpicture}
332 \end{codeexample}
333 The example below shows the regular heptagon from \cite{Tmm1}. In the first environment |liftarmconnect| there are $8$ liftarms and $4$ conditions resulting in $8$ equations. Hence the Jacobian matrix has size $8\times 8$.
334 \begin{codeexample}[width=8cm]
335 \begin{tikzpicture}[scale=0.4]
336 \pgfkeys{/liftarm,scalefactor=1}
337 \liftarm{-4,0}{8}{0}
338 \begin{liftarmconnect}
339 \liftarm[coordinate={1/A,7/B,8/G}]{-4,0}{8}{135}
340 \liftarm[coordinate=11/F]{A}{11}{50}
341 \liftarm[coordinate=11/F]{B}{11}{20}
342 \liftarm[coordinate={1/C,7/D,8/H}]{4,0}{8}{45}
343 \liftarm[coordinate=11/E]{C}{11}{130}
344 \liftarm[coordinate=11/E]{D}{11}{160}
345 \liftarm[coordinate=8/E]{G}{8}{30}
346 \liftarm[coordinate=8/F]{H}{8}{150}
347 \end{liftarmconnect}
348 \begin{liftarmconnect}
349 \liftarm[coordinate=8/I]{E}{8}{70}
350 \liftarm[coordinate=8/I]{F}{8}{110}
351 \end{liftarmconnect}
352 \begin{liftarmconnect}
353 \liftarm[coordinate=8/J]{G}{8}{70}
354 \liftarm[coordinate=8/J]{I}{8}{210}
355 \end{liftarmconnect}
356 \begin{liftarmconnect}
357 \liftarm[coordinate=8/K]{H}{8}{110}
358 \liftarm[coordinate=8/K]{I}{8}{-30}
359 \end{liftarmconnect}
360 \end{tikzpicture}
361 \end{codeexample}
362 \end{environment}
363 \section{Describing a construction}
364 If a construction involves many liftarms then it is convenient to describe this construction in separate steps. Then the content of previous steps would need to be copied in each new step. This process can be automated by using the command |\liftarmconstruct| below.
365 \begin{command}{\liftarmconstruct\marg{commands}}
366 This command appends \meta{commands} to an internal token list. Then it uses this token list.
367 \end{command}
368 \begin{command}{\liftarmconstructclear}
369 This command clears the token list which is used by the command |\liftarmconstruct|.
370
371 As an example, we describe below the construction of a regular pentagon from \cite{Tmm1}.
372 \begin{codeexample}[width=7cm]
373 \begin{minipage}{5.5cm}%only for usage in this manual
374 \liftarmconstructclear
375 \begin{enumerate}
376 \item First we form a rectangular triangle with 3 liftarms.
377 \begin{center}
378 \begin{tikzpicture}[scale=0.7]
379 \liftarmconstruct{
380 \liftarm[mark holes=3]{-3,0}{4}{0}
381 \begin{liftarmconnect}
382 \liftarm[coordinate=6/A,origin=2]{0,0}{6}{90}
383 \liftarm[coordinate=5/A,mark holes={0,5}]{-3,0}{5}{60}
384 \end{liftarmconnect}
385 }
386 \end{tikzpicture}
387 \end{center}
388 \item Then we add 2 liftarms of length $3$.
389 \begin{center}
390 \begin{tikzpicture}[scale=0.7]
391 \liftarmconstruct{
392 \begin{liftarmconnect}
393 \liftarm[coordinate=3/B,mark holes={0,3}]{0,-2}{3}{45}
394 \liftarm[coordinate=3/B,mark holes=0]{0,2}{3}{-45}
395 \end{liftarmconnect}
396 }
397 \end{tikzpicture}
398 \end{center}
399 \item Here appears the first side of the regular pentagon.
400 \begin{center}
401 \begin{tikzpicture}[scale=0.7]
402 \liftarmconstruct{
403 \begin{liftarmconnect}
404 \liftarm[coordinate=2/C]{B}{2}{100}
405 \liftarm[coordinate=2/C,mark holes={0,2}]{1,0}{2}{80}
406 \end{liftarmconnect}
407 }
408 \end{tikzpicture}
409 \end{center}
410 \item Now we end the construction of the regular pentagon.
411 \begin{center}
412 \begin{tikzpicture}[scale=0.7]
413 \liftarmconstruct{
414 \begin{liftarmconnect}
415 \liftarm[coordinate=2/D]{C}{2}{180}
416 \liftarm[coordinate=2/D,mark holes={0,2}]{-1,0}{2}{80}
417 \end{liftarmconnect}
418 \begin{liftarmconnect}
419 \liftarm[coordinate=2/E,mark holes=2]{-1,0}{2}{-80}
420 \liftarm[coordinate=2/E]{B}{2}{210}
421 \end{liftarmconnect}
422 }
423 \end{tikzpicture}
424 \end{center}
425 \end{enumerate}
426 \end{minipage}
427 \end{codeexample}
428 \end{command}
429 \section{Animations}
430 \begin{command}{\liftarmanimate\opt{\oarg{options}}\marg{frame rate}\marg{list}\marg{command}}
431 This command shows an animation using the |animateinline| environment of the package |animate|. The package |animate| is \emph{not} loaded by default and needs to be loaded to use the command |\liftarmanimate|. The \meta{options} are passed to the |animateinline| environment. The \meta{frame rate} of the animation is described in the documentation of the package |animate|. The \meta{command} must be a previously defined command with one mandatory argument. The \meta{list} is passed to a |\foreach| loop. The frames of the animation consist of the \meta{command} evaluated one by one in the result of the |\foreach| loop. The command |\liftarmanimate| creates a timeline which is used in the |animateinline| environment. This timeline is stored in the file \meta{job name}\meta{number of the animation in the document}|.tln|. It requires two compiler runs to create and use this timeline correctly.
432 \begin{key}{/liftarm/trace=\marg{number/number of frames/code}\dots}
433 This key draws \meta{code} at hole \meta{number} of the liftarm on the frames of the animation determined by \meta{number of frames}.
434
435 If \meta{number of frames} is 0 then the \meta{code} is drawn starting at the current frame until the end of the animation. If \meta{number of frames} is an integer greater than or equal to 1 then the \meta{code} is drawn starting at the current frame and remaining during the next frames determined by \meta{number of frames}. If \meta{number of frames} is left empty then the \meta{code} is drawn starting at the beginning of the animation until the end of the animation.
436
437 The \meta{code} can be some \tikzname{} code. In this \meta{code}, $(0,0)$ is positioned at hole \meta{number} of the liftarm. If \meta{code} is left empty then a black circle with radius $\frac{2}{3}$ times the |hole radius| is used.
438
439 A list of multiple triples \meta{number/number of frames/code} can be given to the key |trace|.
440 \begin{codeexample}[width=10cm,preamble={\usepackage{animate}}]
441 \newcommand{\exampleliftarmanimate}[1]{
442 \liftarm[
443 origin=1,
444 mark holes=1,
445 trace={
446 2/0/,
447 3//,
448 4/3/{\fill[Blue] (0,0)
449 circle[radius=0.15];}
450 }
451 ]{0,0}{4}{#1}
452 }
453 \liftarmanimate[
454 autoplay,
455 controls,
456 loop,
457 begin={
458 \begin{tikzpicture}
459 \useasboundingbox (-4,-4)
460 rectangle (4,4);
461 },
462 end={\end{tikzpicture}}
463 ]
464 {5}
465 {0,30,...,330}
466 {\exampleliftarmanimate}
467 \end{codeexample}
468 \end{key}
469 \end{command}
470 \section{Additional examples}
471 The following example shows a regular hexagon.
472 \begin{codeexample}[width=8cm]
473 \begin{tikzpicture}
474 \def\r{3}
475 \foreach\m in {1,...,6}{
476 \begin{liftarmconnect}
477 \liftarm[coordinate=\r/A]{0,0}{\r}{(\m+1)*60}
478 \liftarm[coordinate=\r/A]{\m*60:\r}{\r}{(\m+2)*60}
479 \end{liftarmconnect}
480 }
481 \end{tikzpicture}
482 \end{codeexample}
483 The following example illustrates that $2\atan(\frac{1}{2})=\atan(\frac{4}{3})$.
484 \begin{codeexample}[width=9cm]
485 \begin{tikzpicture}
486 \liftarm{0,0}{3}{0}
487 \liftarm{0,0}{5}{atan(4/3)}
488 \liftarm{3,0}{4}{90}
489 \liftarm{2,0}{1}{90}
490 \liftarm{2,1}{1}{0}
491 \liftarm{2,1}{1}{90+atan(4/3)}
492 \end{tikzpicture}
493 \end{codeexample}
494 The following example illustrates an angle bisection.
495 \begin{codeexample}[width=9cm]
496 \begin{tikzpicture}
497 \def\ang{40}
498 \def\r{3}
499 \liftarm[mark holes={0,\r}]{0,0}{2*\r}{0}
500 \liftarm[mark holes=\r]{0,0}{2*\r}{\ang}
501 \liftarm[
502 mark holes=\r,
503 mark style=Red
504 ]{\r,0}{\r}{\ang}
505 \liftarm{\ang:\r}{\r}{0}
506 \end{tikzpicture}
507 \end{codeexample}
508 The following example illustrates that $7^{2}=3^{2}+8^{2}-2\cdot 3\cdot 8\cos(\frac{\pi}{3})$.
509 \begin{codeexample}[width=9cm]
510 \begin{tikzpicture}
511 \begin{liftarmconnect}
512 \liftarm[coordinate=3/A]{0,0}{3}{80}
513 \liftarm[coordinate=3/A]{3,0}{3}{100}
514 \end{liftarmconnect}
515 \begin{liftarmconnect}
516 \liftarm[coordinate=8/B]{0,0}{8}{0}
517 \liftarm[coordinate=7/B]{A}{7}{0}
518 \end{liftarmconnect}
519 \end{tikzpicture}
520 \end{codeexample}
521 The following example illustrates that $7^{2}+4^{2}=8^{2}+1^{2}$.
522 \begin{codeexample}[width=9cm]
523 \begin{tikzpicture}
524 \def\a{4}
525 \def\b{7}
526 \def\c{1}
527 \def\d{8}
528 %\liftarm{0,0}{\b}{0}
529 %\liftarm{\b,0}{\a}{90}
530 \begin{liftarmconnect}
531 \liftarm[coordinate=\b/A]{0,0}{\b}{0}
532 \liftarm[coordinate=\a/A]{\b,\a}{\a}{-90}
533 \end{liftarmconnect}
534 \liftarm{4,0}{3}{90}
535 %\liftarm{\b,\a}{1}{atan(\a/\b)+atan(\c/\d)+90}
536 %\liftarm{0,0}{\d}{atan(\a/\b)+atan(\c/\d)}
537 \begin{liftarmconnect}
538 \liftarm[coordinate=\d/B]{0,0}{\d}{45}
539 \liftarm[coordinate=\c/B]{\b,\a}{\c}{135}
540 \end{liftarmconnect}
541 \end{tikzpicture}
542 \end{codeexample}
543 Below is an animation of the Peaucellier-Lipkin linkage, see e.g.~\cite{Koagmopermbl}.
544 \begin{codeexample}[width=9cm,preamble={\usepackage{animate}}]
545 \newcommand{\PLlinkage}[1]{
546 \begin{tikzpicture}[scale=0.75]
547 \def\a{3}
548 \def\b{4}
549 \def\c{9}
550 \edef\l{
551 \fpeval{2*\a+(\c^2-\b^2-(2*\a)^2)/(2*\a)}
552 }
553 \useasboundingbox (-0.23,-6) rectangle
554 (\l+0.23,6);
555 \draw (\l,-5)--(\l,5);
556 \liftarm{0,0}{\a}{0}
557 \liftarm[coordinate=\a/A]{\a,0}{\a}{#1}
558 \begin{liftarmconnect}
559 \liftarm[coordinate=\c/B]{0,0}{\c}{0}
560 \liftarm[coordinate=\b/B]{A}{\b}{90}
561 \end{liftarmconnect}
562 \begin{liftarmconnect}
563 \liftarm[coordinate=\c/C]{0,0}{\c}{0}
564 \liftarm[coordinate=\b/C]{A}{\b}{-90}
565 \end{liftarmconnect}
566 \begin{liftarmconnect}
567 \liftarm[coordinate=\b/D]{C}{\b}{0}
568 \liftarm[coordinate=\b/D]{B}{\b}{0}
569 \end{liftarmconnect}
570 \end{tikzpicture}
571 }
572 \begin{animateinline}[
573 autoplay,
574 controls,
575 palindrome
576 ]{30}
577 \multiframe{80}{rAng=-40+1}{
578 \PLlinkage{\rAng}
579 }
580 \end{animateinline}
581 \end{codeexample}
582 Below is an animation of Kempe's trisector, as shown in \cite{Tmm3}.
583 \begin{codeexample}[preamble={\usepackage{animate}}]
584 \newcommand{\trisector}[1]{
585 \begin{tikzpicture}[scale=0.33]
586 \useasboundingbox (-27.3,-0.5) rectangle (21.2,37);
587 \liftarm[coordinate=8/A]{0,0}{27}{180}
588 \liftarm[coordinate=12/B]{0,0}{27}{180-(#1)}
589 \liftarm[coordinate=18/C]{0,0}{27}{180-2*(#1)}
590 \liftarm[coordinate=27/D]{0,0}{27}{180-3*(#1)}
591 \begin{liftarmconnect}
592 \liftarm[coordinate=27/E]{C}{27}{0}
593 \liftarm[coordinate=18/E]{D}{18}{0}
594 \end{liftarmconnect}
595 \begin{liftarmconnect}
596 \liftarm[coordinate=12/F]{A}{12}{0}
597 \liftarm[coordinate=8/F]{B}{18}{0}
598 \end{liftarmconnect}
599 \end{tikzpicture}
600 }
601 \begin{animateinline}[autoplay,controls,palindrome]{5}
602 \multiframe{20}{rAng=15+1}{
603 \trisector{\rAng}
604 }
605 \end{animateinline}
606 \end{codeexample}
607 Below is an animation of Chebyshev's Lambda Mechanism.
608 \begin{codeexample}[width=10cm,preamble={\usepackage{animate}}]
609 \newcommand{\CL}[1]{
610 \liftarm{0,0}{4*\r}{0}
611 \liftarm[
612 mark holes={0,2*\r}
613 ]{0,0}{2*\r}{#1}
614 \begin{liftarmconnect}
615 \liftarm[
616 coordinate=5*\r/A,
617 mark holes={0,5*\r}
618 ]{4*\r,0}{5*\r}{90}
619 \liftarm[
620 coordinate=5*\r/A,
621 mark holes=10*\r,
622 mark style=Red,
623 trace={6*\r/0/,10*\r//}
624 ]{#1:2*\r}{10*\r}{90}
625 \end{liftarmconnect}
626 }
627 \liftarmanimate[
628 autoplay,
629 controls,
630 loop,
631 begin={
632 \begin{tikzpicture}[scale=0.8]
633 \def\r{1}
634 \useasboundingbox
635 (-2*\r-0.5,-2*\r-0.5)
636 rectangle
637 (10*\r-0.5,10*\r+0.5);
638 },
639 end={\end{tikzpicture}}
640 ]
641 {20}
642 {0,5,...,355}
643 {\CL}
644 \end{codeexample}
645 Below is an animation of a multilink steering mechanism.
646 \begin{codeexample}[preamble={\usepackage{animate}}]
647 \newcommand{\multilink}[1]{
648 \begin{tikzpicture}[scale=0.9]
649 \useasboundingbox (-8.5,-0.5) rectangle (8.5,5.7);
650 \liftarm[brick,screw holes={0,6}]{-3,0}{6}{0}
651 \liftarm[brick,screw holes={0,6}]{-3,3}{6}{0}
652 \liftarm[coordinate={0/X,6/Y},screw holes={0,6}]{{-3+(#1)*0.1},4}{6}{0}
653 \begin{liftarmconnect}
654 \liftarm[coordinate=3/A]{-3,0}{3}{160}
655 \liftarm[coordinate=3/B]{-3,3}{3}{200}
656 \liftarm[coordinate={1/B,4/C},screw holes={0,1,4}]{A}{4}{90}
657 \liftarm[coordinate=3/C]{X}{3}{180}
658 \end{liftarmconnect}
659 \begin{liftarmconnect}
660 \liftarm[coordinate=3/D]{3,0}{3}{20}
661 \liftarm[coordinate=3/E]{3,3}{3}{-20}
662 \liftarm[coordinate={1/E,4/F},screw holes={0,1,4}]{D}{4}{90}
663 \liftarm[coordinate=3/F]{Y}{3}{0}
664 \end{liftarmconnect}
665 \end{tikzpicture}
666 }
667 \begin{animateinline}[autoplay,controls,palindrome]{10}
668 \multiframe{41}{rAng=-20+1}{
669 \multilink{\rAng}
670 }
671 \end{animateinline}
672 \end{codeexample}
673 \section{Version history}
674 \begin{itemize}
675 \item[] \textbf{Version 1.0 (2022/03/08)} First version.
676 \item[] \textbf{Version 2.0 (2022/04/07)} Removed some redundant |;| in the code.\footnote{Thanks to Denis Bitouzé for pointing this out.} Added the command |\liftarmanimate| and the key |trace|.
677 \item[] \textbf{Version 3.0 (2024/05/20)}
678 \begin{itemize}
679 \item The package now mainly uses \LaTeX3 syntax. The package |etoolbox| is not loaded anymore.
680 \item Improved the code for the key |axle holes|. In particular, the combinations with the keys |contour| and |hole radius| are fixed.
681 \item Improved the path for the shape of a liftarm if the key |brick| is used.
682 \item Changed the key |color| to accept two arguments. The color can no longer be specified without a key.
683 \item Removed the keys |color 0|, |color 1|, |color 2|, |color 3|, |color 4|, |color 5|, |color 6| and |color 7|.
684 \item In v2.0, the colors could only be defined up to length $7$. In v3.0, this is not a restriction anymore.
685 \item Changed some initial colors from |Black| to |black|.
686 \item Added the keys |contour style| and |liftarm style|.
687 \item Removed the keys |mark color|, |screw color| and |screw holes angle|. Added the keys |mark radius|, |mark style|, |screw angle|, |screw radius| and |screw style|.
688 \item Improved the algorithm to connect liftarms in multiple ways. In v2.0, transformations such as |x={(0.8,0.5)},y={(-0.6,1.2)}| were not taken into account correctly. This is fixed in v3.0. In v2.0, only 2 liftarms could be connected automatically. In v3.0, this is not a restriction anymore. Therefore the command |\liftarmconnect| and the keys |connect|, |connect coordinate|, |connect reverse|, |liftarm 1| and |liftarm 2| are removed. Instead, the environment |liftarmconnect| and the key |connect stop| were added in v3.0.
689 \item Changed the command |\liftarmconstruct| to allow more customization. Removed the environment |liftarmconstruction| and added the command |\liftarmconstructclear|.
690 \end{itemize}
691 \item[] \textbf{Version 4.0 (2025/07/24)} Updated the documentation.
692 \end{itemize}
693 \begin{thebibliography}{9}
694 \bibitem{Tmm1}
695 Gerard 't Hooft,
696 \emph{Meccano Math I},\\
697 \url{https://webspace.science.uu.nl/~hooft101/lectures/meccano.pdf},
698 2006.
699 \bibitem{Tmm2}
700 Gerard 't Hooft,
701 \emph{Meccano Math II},\\
702 \url{https://webspace.science.uu.nl/~hooft101/lectures/meccano2.pdf},
703 2008.
704 \bibitem{Tmm3}
705 Gerard 't Hooft,
706 \emph{Meccano Math III},\\
707 \url{https://webspace.science.uu.nl/~hooft101/lectures/meccano3.pdf},
708 2014.
709 \bibitem{Koagmopermbl}
710 Alfred Bray Kempe,
711 \emph{On a general method of producing exact rectilinear motion by linkwork},
712 1875.
713 \bibitem{TtTaPGFp}
714 Till Tantau,
715 \emph{The \tikzname{} and {\upshape\pgfname} Packages},
716 Manual for version 3.1.10,
717 \url{https://ctan.org/pkg/pgf},
718 2023.
719 \end{thebibliography}
720 \clearpage
721 \currentpdfbookmark{\indexname}{\indexname}
722 \printindex
723 \newgeometry{left=2.25cm,right=2.25cm,top=2.25cm,bottom=2.25cm}
724 \pagestyle{plain}
725 \appendix
726 \begin{landscape}
727 \section{The source code}\label{Thesourcecode}
728 \dochighinput[language=latex/latex3]{liftarm.sty}
729 \end{landscape}
730 \end{document}