summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/liftarm/liftarm.tex
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/liftarm/liftarm.tex')
-rw-r--r--graphics/pgf/contrib/liftarm/liftarm.tex142
1 files changed, 99 insertions, 43 deletions
diff --git a/graphics/pgf/contrib/liftarm/liftarm.tex b/graphics/pgf/contrib/liftarm/liftarm.tex
index 8619b58f2d..b45bb85793 100644
--- a/graphics/pgf/contrib/liftarm/liftarm.tex
+++ b/graphics/pgf/contrib/liftarm/liftarm.tex
@@ -1,7 +1,20 @@
-%Documentation for the liftarm package
-%Draw liftarms with TikZ
-%(c) Matthias Floré
-%This program can be redistributed and/or modified under the terms of the LaTeX Project Public License Distributed from CTAN archives on http://www.latex-project.org/lppl.txt.
+%% liftarm.tex
+%% Copyright 2022 Matthias Floré
+%
+% 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 Matthias Floré.
+%
+% This work consists of the files liftarm.pdf, liftarm.sty,
+% liftarm.tex and README.md.
\documentclass[a4paper,english,dvipsnames]{ltxdoc}
\usepackage[english]{babel}
\usepackage{graphicx}
@@ -32,21 +45,19 @@
\DeclareMathOperator{\atan}{atan}
\title{The \texttt{liftarm} package\\[12pt]\large Draw liftarms with \tikzname}
\author{Matthias Flor\'e}
-\date{2022-03-08}
+\date{Version 2.0 (2022/04/07)}%\\[12pt]
\begin{document}
\maketitle
\thispagestyle{fancy}
\begin{abstract}
-\noindent This package is based on the package |tikz| (see \cite{TtTaPGFp}) and can be used to draw liftarms with \tikzname. It provides several options for the appearance of the liftarms, a command which connects two liftarms and an environment to describe a construction. This is the manual for version 1.0.
+\noindent This package is based on the package |tikz| (see \cite{TtTaPGFp}) and can be used to draw liftarms with \tikzname. It provides several options for the appearance of the liftarms, a command which connects two liftarms, an environment to describe a construction and a method to animate a construction with one or more traces.% This is the manual for version .
\end{abstract}
\tableofcontents
\section{Usage}
-The package |liftarm| can be used by putting
-
-|\usepackage{liftarm}|
-
-in the preamble.
-
+The package |liftarm| can be used by putting the following in the preamble.
+\begin{codeexample}[code only]
+\usepackage{liftarm}
+\end{codeexample}
The package |liftarm| loads the packages |etoolbox|, |xcolor| with the option |dvipsnames|, |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|.
\section{Drawing liftarms}
\begin{command}{\liftarm\opt{\oarg{options}}\marg{point}\marg{length}\marg{angle}}
@@ -373,6 +384,49 @@ As an example, we describe below the construction of a regular pentagon from \ci
\end{codeexample}
\end{command}
\end{environment}
+\section{Animations}
+\begin{command}{\liftarmanimate\opt{\oarg{options}}\marg{frame rate}\marg{list}\marg{command}}
+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 |liftarm|\meta{number of the animation in the document}|.tln|. It requires two compiler runs to create and use this timeline correctly.
+\begin{key}{/liftarm/trace=\marg{number/number of frames/code}\dots}
+This key draws \meta{code} at hole \meta{number} of the liftarm on the frames of the animation determined by \meta{number of frames}.
+
+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.
+
+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 the following code is used.
+\begin{codeexample}[code only]
+\fill[Black] (0,0) circle[radius=0.66*\liftarm@holeradius];
+\end{codeexample}
+A list of multiple triples \meta{number/number of frames/code} can be given to the key |trace|.
+\begin{codeexample}[width=10cm,preamble={\usepackage{animate}}]
+\newcommand{\exampleliftarmanimate}[1]{
+ \liftarm[
+ origin=1,
+ mark holes=1,
+ trace={
+ 2/0/,
+ 3//,
+ 4/3/{\fill[Blue] (0,0)
+ circle[radius=0.15];}
+ }
+ ]{0,0}{4}{#1}
+}
+\liftarmanimate[
+ autoplay,
+ controls,
+ loop,
+ begin={
+ \begin{tikzpicture}
+ \useasboundingbox (-4,-4)
+ rectangle (4,4);
+ },
+ end={\end{tikzpicture}}
+]
+{5}
+{0,30,...,330}
+{\exampleliftarmanimate}
+\end{codeexample}
+\end{key}
+\end{command}
\section{Additional examples}
The following example shows a regular hexagon.
\begin{codeexample}[width=9cm]
@@ -430,13 +484,14 @@ The following example illustrates that $7^{2}+4^{2}=8^{2}+1^{2}$.
%\liftarm{0,0}{\b}{0}
%\liftarm{\b,0}{\a}{90}
\liftarmconnect{0,0}{\b}{\b,\a}{\a}
+\liftarm{4,0}{3}{90}
%\liftarm{\b,\a}{1}{atan(\a/\b)+atan(\c/\d)+90}
%\liftarm{0,0}{\d}{atan(\a/\b)+atan(\c/\d)}
\liftarmconnect{\b,\a}{\c}{0,0}{\d}
\end{tikzpicture}
\end{codeexample}
Below is an animation of the Peaucellier-Lipkin linkage, see e.g.~\cite{Koagmopermbl}.
-\begin{codeexample}[width=9cm]
+\begin{codeexample}[width=9cm,preamble={\usepackage{animate}}]
\newcommand{\PLlinkage}[1]{
\begin{tikzpicture}[scale=0.75]
\def\a{3}
@@ -463,19 +518,15 @@ Below is an animation of the Peaucellier-Lipkin linkage, see e.g.~\cite{Koagmope
\begin{animateinline}[
autoplay,
controls,
- loop
+ palindrome
]{30}
-\multiframe{80}{rXmax=-40+1}{
- \PLlinkage{\rXmax}
-}
-\newframe
-\multiframe{80}{rXmax=-40+1}{
- \PLlinkage{-\rXmax}
+\multiframe{80}{rAng=-40+1}{
+ \PLlinkage{\rAng}
}
\end{animateinline}
\end{codeexample}
Below is an animation of Kempe's trisector, as shown in \cite{Tmm3}.
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usepackage{animate}}]
\newcommand{\trisector}[1]{
\begin{tikzpicture}[scale=0.33]
\useasboundingbox (-27.3,-0.5) rectangle (21.2,37);
@@ -487,23 +538,15 @@ Below is an animation of Kempe's trisector, as shown in \cite{Tmm3}.
\liftarmconnect[liftarm 2={connect=8}]{A}{12}{B}{18}
\end{tikzpicture}
}
-\begin{animateinline}[autoplay,controls,loop]{5}
-\multiframe{20}{rXmax=0+1}{
-\trisector{15+\rXmax}
-}
-\newframe
-\multiframe{20}{rXmax=0+1}{
-\trisector{35-\rXmax}
+\begin{animateinline}[autoplay,controls,palindrome]{5}
+\multiframe{20}{rAng=15+1}{
+\trisector{\rAng}
}
\end{animateinline}
\end{codeexample}
Below is an animation of Chebyshev's Lambda Mechanism.
-\begin{codeexample}[width=10cm]
+\begin{codeexample}[width=10cm,preamble={\usepackage{animate}}]
\newcommand{\CL}[1]{
-\begin{tikzpicture}[scale=0.8]
-\def\r{1}
-\useasboundingbox (-2*\r-0.5,-2*\r-0.5)
- rectangle (10*\r-0.5,10*\r+0.5);
\liftarm{0,0}{4*\r}{0}
\liftarm[
mark holes={0,2*\r}
@@ -513,21 +556,34 @@ Below is an animation of Chebyshev's Lambda Mechanism.
liftarm 2={
connect=5*\r,
mark holes=10*\r,
- mark color=Red
+ mark color=Red,
+ trace={6*\r/0/,10*\r//}
}
]{4*\r,0}{5*\r}{#1:2*\r}{10*\r}
-\end{tikzpicture}
}
-\begin{animateinline}[
+\liftarmanimate[
autoplay,
controls,
- loop
-]{60}
-\multiframe{360}{rXmax=0+1}{
- \CL{\rXmax}
-}
-\end{animateinline}
+ loop,
+ begin={
+ \begin{tikzpicture}[scale=0.8]
+ \def\r{1}
+ \useasboundingbox
+ (-2*\r-0.5,-2*\r-0.5)
+ rectangle
+ (10*\r-0.5,10*\r+0.5);
+ },
+ end={\end{tikzpicture}}
+]
+{20}
+{0,5,...,355}
+{\CL}
\end{codeexample}
+\section{Version history}
+\begin{itemize}
+\item[] \textbf{Version 1.0 (2022/03/08)} First version.
+\item[] \textbf{Version 2.0 (2022/04/07)} Removed some redundant |;| in the code.\footnote{Thanks to Denis Bitouz\'e for pointing this out.} Added the command |\liftarmanimate| and the key |trace|.
+\end{itemize}
\begin{thebibliography}{9}
\bibitem{Tmm1}
Gerard 't Hooft,
@@ -552,7 +608,7 @@ Alfred Bray Kempe,
Till Tantau,
\emph{The \tikzname{} and {\upshape\pgfname} Packages},
Manual for version 3.1.9a,
-\url{https://www.ctan.org/pkg/pgf},
+\url{https://ctan.org/pkg/pgf},
2021.
\end{thebibliography}
\printindex