summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-12-12 22:54:58 +0000
committerKarl Berry <karl@freefriends.org>2013-12-12 22:54:58 +0000
commitb2e97cd1b691e067fe3a30311a099576cf31257e (patch)
tree9f2149e7a37b9811e3913367573b4292c9fa26a4 /Master
parent7991cab643e93ba549e06207a24036d4cd8d598a (diff)
rulercompass (12dec13)
git-svn-id: svn://tug.org/texlive/trunk@32392 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/rulercompass/README.txt10
-rw-r--r--Master/texmf-dist/doc/latex/rulercompass/rulercompass.pdfbin0 -> 213768 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rulercompass/rulercompass_doc.pdfbin0 -> 262114 bytes
-rw-r--r--Master/texmf-dist/doc/latex/rulercompass/rulercompass_doc.tex479
-rw-r--r--Master/texmf-dist/source/latex/rulercompass/rulercompass.dtx811
-rw-r--r--Master/texmf-dist/source/latex/rulercompass/rulercompass.ins84
-rw-r--r--Master/texmf-dist/tex/latex/rulercompass/tikzlibraryrulercompass.code.tex495
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check3
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/rulercompass.tlpsrc0
10 files changed, 1882 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/rulercompass/README.txt b/Master/texmf-dist/doc/latex/rulercompass/README.txt
new file mode 100644
index 00000000000..4d25b984d20
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rulercompass/README.txt
@@ -0,0 +1,10 @@
+---------------------------------------------------------------
+rulercompass --- a TikZ/PGF library for drawing straight-edge
+ and compass diagrams
+E-mail: stacey@math.ntnu.no
+Released under the LaTeX Project Public Licence v1.3c or later
+See http://www.latex-project.org/lppl.txt
+---------------------------------------------------------------
+
+This package defines some commands and styles intended for
+drawing straight-edge and compass diagrams.
diff --git a/Master/texmf-dist/doc/latex/rulercompass/rulercompass.pdf b/Master/texmf-dist/doc/latex/rulercompass/rulercompass.pdf
new file mode 100644
index 00000000000..3e6d56f47fd
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rulercompass/rulercompass.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rulercompass/rulercompass_doc.pdf b/Master/texmf-dist/doc/latex/rulercompass/rulercompass_doc.pdf
new file mode 100644
index 00000000000..651eb86b0b3
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rulercompass/rulercompass_doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/rulercompass/rulercompass_doc.tex b/Master/texmf-dist/doc/latex/rulercompass/rulercompass_doc.tex
new file mode 100644
index 00000000000..dbc696b8458
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rulercompass/rulercompass_doc.tex
@@ -0,0 +1,479 @@
+\immediate\write18{tex rulercompass.dtx}
+\documentclass{ltxdoc}
+\usepackage{alphalph}
+\usepackage{fancyvrb}
+\usepackage{listings}
+\usepackage{tikz}
+\usepackage{hyperref}
+\usetikzlibrary{rulercompass}
+
+\pgfmathsetmacro\ptra{2}%{.5 + .25*rand}
+\pgfmathsetmacro\ptrb{2.7}%{.5 + .25*rand}
+\pgfmathsetmacro\ptaa{30}%180*rand}
+\pgfmathsetmacro\ptab{70}%180*rand}
+
+\lstloadlanguages{[LaTeX]TeX}
+\lstset{breakatwhitespace=true,breaklines=true,language=TeX}
+
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+
+
+\def\figurename{Example}
+
+\newenvironment{example}
+ {\VerbatimEnvironment
+ \begin{VerbatimOut}{example.out}}
+ {\end{VerbatimOut}
+ \begin{center}
+ \setlength{\parindent}{0pt}
+ \fbox{\begin{minipage}{.9\linewidth}
+ \lstset{breakatwhitespace=true,breaklines=true,language=TeX,basicstyle=\small}
+ \lstinputlisting[]{example.out}
+ \end{minipage}}
+ \fbox{\begin{minipage}{.9\linewidth}
+ \centering
+ \input{example.out}
+ \end{minipage}}
+\end{center}
+}
+
+\newcommand\tikzname{\textsf{Ti\textit{k}Z}}
+
+\title{The \textsf{rulercompass} \tikzname\ Library}
+\author{Andrew Stacey}
+\date{10th December 2013}
+
+\begin{document}
+\maketitle
+
+\section{Introduction}
+
+The \textsf{rulercompass} \tikzname\ library provides some commands and styles for drawing straight-{}edge\footnote{The name \textsf{straightedgecompass} was just a bit too long.} and compass diagrams in \tikzname.
+With this, one can draw diagrams such as that in Example~\ref{fig:bisect}.
+
+\begin{figure}
+\centering
+\begin{example}
+\begin{tikzpicture}[
+ stop jumping,
+ constrain
+]
+\path (0,0) node[name=0,ruler compass/point=red,label={0}];
+\path (0) ++(30:2) node[ruler compass/point=red,label={a}];
+\ruler{0}{a}
+\compass{0}{a}
+\compass{a}{0}
+\point{c0a}{ca0}{1}
+\point{c0a}{ca0}{2}
+\ruler{b}{c}
+\end{tikzpicture}
+\end{example}
+\caption{Constructing the perpendicular bisector between two points}
+\label{fig:bisect}
+\end{figure}
+
+\section{Straight-{}Edge and Compass Diagrams}
+
+To understand the commands of this package, it is necessary to know a bit about the type of diagram involved.
+A straight-{}edge and compass diagram consists of a family of points in the plane, a family of straight lines, and a family of circles.
+The usual rules for constructing these families is to start with a given set of points and apply the following rules:
+
+\begin{enumerate}
+\item Construct a straight line passing through any two points.
+\item Construct a circle centred at one point which passes through another point.
+\item Place a point at an intersection of two lines, two circles, or a circle and a line.
+\end{enumerate}
+
+The usual goal of a straight-{}edge and compass diagram is to place a point at a particular position given a certain family of initial points.
+Some examples are:
+%
+\begin{enumerate}
+\item Given three points in the plane, say \(0, a, b\), view \(a\) and \(b\) as vectors from \(0\) and construct their sum, \(a + b\).
+\item Given four points in the plane, say \(0, 1, a, b\), view \(a\) and \(b\) as complex numbers with \(0\) and \(1\) interpreted in the obvious way, and construct their product, \(a b\).
+\item Given two points in the plane, say \(0\) and \(1\), construct a regular hexagon with \(0\) and \(1\) as adjacent vertices.
+\item Given two points in the plane, say \(0\) and \(1\), construct a regular \(17\)--{}sided polygon with \(0\) and \(1\) as adjacent vertices.
+\end{enumerate}
+%
+Often, a diagram is completed by ``inking in'' some segments of the lines and circles.
+
+When drawing a straight-{}edge and compass diagram we need to be able to carry out the three constructions.
+Whilst none correspond to basic \tikzname\ path operations, they are all possible with the use of some additional libraries, namely the \Verb+intersections+ and \Verb+calc+ libraries.
+These are therefore loaded automatically.
+
+
+\section{Usage}
+
+This package comes as a \tikzname\ library so can be loaded in the same way as other \tikzname\ libraries:
+%
+\begin{verbatim}
+\usetikzlibrary{rulercompass}
+\end{verbatim}
+%
+This loads in a family of commands and \tikzname\ styles for drawing these diagrams.
+
+\subsection{Naming Schemes}
+
+The various constructions refer to points or paths already constructed (or given at the start).
+Therefore, it is necessary to have a naming scheme.
+
+Points are labelled automatically using an internal \LaTeX\ counter, \Verb+pointlabels+.
+The format name can be changed in the same way as the format of any \LaTeX\ counter, by redefining \Verb+\thepointlabels+.
+However, because it is sometimes needed to be able to go back from the label to the value of the counter, it is better to change it by one of the \tikzname\ styles provided.
+As a default, \Verb+rulercompass+ uses lowercase letters.
+Thus the first point will be \Verb+a+, the second \Verb+b+, and so on.
+Points are actually coordinates so these can be used as such within the \Verb+tikzpicture+.
+
+Since paths are defined in terms of points, the naming scheme for paths is a triplet of tokens or token lists where the first distinguishes between lines and circles and the other two are the two points used to construct the path.
+
+\begin{itemize}
+\item \Verb+rab+ is a line (\Verb+r+ for ``ruler'') through the points \Verb+a+ and \Verb+b+.
+
+Note that although \Verb+rab+ and \Verb+rba+ are the same line, the two names cannot be used interchangeably.
+The order of points must be the same as that used in the construction of the line.
+
+\item \Verb+c{ab}v+ is a circle (\Verb+c+ for ``compass'') with centre \Verb+ab+ passing through \Verb+v+.
+
+Here there is no risk of confusion since \Verb+cab+ and \Verb+cba+ are distinct circles.
+\end{itemize}
+
+\subsection{Primary Commands}
+
+There are three primary commands available:
+
+\begin{itemize}
+\item \Verb+\point[style]{<path>}{<path>}{<intersection>}+
+
+This marks an intersection with a point, using the next label.
+Some pairs of paths have two intersection points and the \Verb+<intersection>+ argument is used to choose which one to mark.
+
+\item \Verb+\ruler[style]{<point>}{<point>}+
+
+This constructs the line through the two points.
+
+\item \Verb+\compass[style]{<point>}{<point>}+
+
+This constructs the circle centred at the first point which passes through the second point.
+\end{itemize}
+
+If the \Verb+rulercompass+ library detects that \Verb+beamer+ has been loaded, then all of the above are made overlay-{}aware.
+In addition, the \Verb+\point+ command does a little optimisation: as intersections can be expensive to compute (if there are a lot of them), then it tries to figure out if this particular intersection has already been computed in a previous version of this diagram.
+
+Example~\ref{fig:bisect} contains an example of each of these commands.
+
+\subsection{Styles}
+
+The primary commands all take an optional argument to which arbitrary \tikzname\ styles can be passed.
+Each command internally expands to a \Verb+\draw+ (for \Verb+\ruler+ and \Verb+\compass+) or a \Verb+node+ on a \Verb+\path+ (for \Verb+\point+) with the optional argument inserted in a suitable place.
+If this does not provide enough opportunity for control, there are style equivalents of the commands that can be used directly:
+
+\begin{itemize}
+\item \Verb+ruler compass/point=<colour>+
+
+This marks the current point.
+Inside the \Verb+\point+ command, this is invoked inside a \Verb+node+ after the appropriate intersection has been computed.
+The \Verb+<colour>+ is optional.
+If the node has not already been named (via \Verb+name=<name>+) then this gives it the next name as determined by the \Verb+pointlabels+ counter.
+
+\item \Verb+ruler compass/ruler={<point>}{<point>}+
+
+This inserts the line through the points into the current path.
+
+\item \Verb+ruler compass/compass={<point>}{<point>}+
+
+This inserts the compass with centre the first point which passes through the second point into the current path.
+\end{itemize}
+
+The initial two commands in Example~\ref{fig:bisect} use the style format for greater flexibility.
+In the first, the \Verb+name=0+ key overrides the automatic naming of the point meaning that this point is known as \Verb+0+ instead of \Verb+a+.
+In both the first and the second, a colour is specified.
+
+There are a variety of styles that can be used to change how the various constructions are rendered:
+
+\begin{itemize}
+\item \Verb+ruler compass/every point+
+\item \Verb+ruler compass/every construction path+
+
+Encompasses both \Verb+ruler+ and \Verb+compass+.
+
+\item \Verb+ruler compass/every ruler+
+\item \Verb+ruler compass/every compass+
+\item \Verb+ruler compass/construction in use+ and
+ \Verb+ruler compass/construction not in use+
+
+When \Verb+beamer+ is detected, every time a path is used to compute a point then the current frame is noted.
+This means that on the second (and subsequent) runs, it is possible to style paths differently depending on whether or not they are still in use.
+
+\item \Verb+ruler compass/every aux point+
+
+When a path is computed, then the two points that are used in its construction are designated as ``auxiliary points'' and are given an extra style.
+This is mainly of use when stepping through a construction in \Verb+beamer+.
+
+\item \Verb+ruler compass/draft label+
+
+If in draft mode (determined by the key \Verb+ruler compass/draft mode+), then constructed points are labelled.
+This can be used to style the label.
+\end{itemize}
+
+Some other miscellaneous keys are the following.
+
+\begin{itemize}
+\item \Verb+ruler compass/draft mode=<true|false>+
+
+This controls a switch to display the labels above the constructed points.
+
+\item \Verb+ruler compass/ruler length=<length>+
+
+The default line extends \(20\mathrm{cm}\) beyond each point.
+This changes that.
+
+\item \Verb+ruler compass/point labels=<arabic|alph|Alph|alphalph|AlphAlph>+
+
+This changes the style of the point labels.
+For the last two, the \Verb+alphalph+ package must be loaded.
+
+If this library detects that the \Verb+alphalph+ package has already been loaded then the default is \Verb+alphalph+, otherwise the default is \Verb+alph+.
+
+It is better to use this than to redefine \Verb+\thepointlabels+.
+\end{itemize}
+
+\section{Relative Labels}
+
+The system for labelling points has rudimentary support for arithmetic.
+For this, it is important that \TeX\ know how to reverse the labelling system to get a number back from a label and this is why the key \Verb+ruler compass/point labels+ should be used to change the labelling format.
+The operations allowed are addition and subtraction of a number from a label, together with the use of a period to designate the last marked point.
+This makes it easier to work on a drawing in parts without having to know exactly how many points are constructed in each part, or to define auxiliary macros to construct some number of extra points.
+
+\begin{figure}
+\begin{example}
+\begin{tikzpicture}[
+ stop jumping,
+ constrain
+]
+\path (0,0) node[name=0,ruler compass/point=red,label={0}];
+\path (0) ++(30:2) node[ruler compass/point=red,label={a}];
+\path (0) ++(70:2.7) node[ruler compass/point=red,label={b}];
+\ruler{0}{.}
+\ruler{0}{a}
+\compass{0}{.-1}
+\point{r0b}{c0a}{1}
+\compass{0}{a+1}
+\point{r0a}{c0{a+1}}{1}
+\end{tikzpicture}
+\end{example}
+\caption{Demonstrating relative point labels.}
+\label{fig:ptlabel}
+\end{figure}
+
+In Example~\ref{fig:ptlabel}, in the line \Verb+\ruler{0}{.}+ then the second point is \Verb+b+.
+In the line \Verb+\compass{0}{.-1}+ then the second point is \Verb+a+.
+In the last line, the second path is the circle with centre \Verb+0+ which goes through \Verb+b+.
+
+\section{Bounding Boxes}
+
+There are two considerations here relating to bounding boxes.
+The first is the ``infinite'' lines.
+Even though these are not actually infinite, they are constructed to be very long (so that any intersection is almost certain to actually exist).
+This usually means that they dwarf the actual region of interest.
+To ensure that the diagram does not get too big, the lines are actually drawn without affecting the bounding box (via the \Verb+overlay+ key), but that simply means that they can bleed into the surrounding text.
+Clearly a \Verb+\clip+ would be useful here, but it would also be nice not to have to compute it by hand.
+
+The second consideration comes when using \Verb+beamer+ and doing a step-{}by-{}step construction.
+Each piece of the construction adds a new element and thus, potentially, changes the bounding box.
+This could lead to the picture jumping around on the page.
+Inserting a \Verb+\path+ of a suitable size would solve this, but again it would be nice not to have to compute this by hand.
+
+Both of these have the same solution: compute the effective bounding box at the end of the construction and use that information at the start.
+This involves saving information to the \Verb+aux+ file and so requires at least two runs.
+
+In the first situation, we clip the picture to its eventual bounding box (possibly slightly enlarged).
+In the second, we add a rectangle of the eventual bounding box at the end (adding it at the end means that we can first compute the bounding box without it to ensure that our saved bounding box is always up to date).
+
+Once we give ourselves the technology to save the bounding box, we can also think of other ways to use it.
+One more is given here: the ability to automatically resize a \Verb+tikzpicture+ to fit inside a given rectangle (preserving the aspect ratio).
+
+In addition, a pseudo-{}node \Verb+enclosing box+ is defined which can be used like the \Verb+current bounding box+ pseudo-{}node.
+
+The original code for saving and reusing the bounding box comes from the \href{http://tex.stackexchange.com}{TeX-SX} site question \href{http://tex.stackexchange.com/q/18704/86}{How can I fix jumping TikZ pictures in beamer?}.
+
+
+
+This code provides the following new keys which are designed to be used in the optional argument to the \Verb+tikzpicture+ environment:
+
+\begin{itemize}
+\item \Verb+stop jumping+
+
+This installs the code to save the bounding box and also to insert the rectangle at the end of the picture.
+
+
+
+\item \Verb+max size={<width>}{<height>}+
+
+This compares the (saved) bounding box to the given rectangle and then scales down (only down) to ensure that it fits inside the given rectangle.
+
+\item \Verb+enclosing box/offset=<length>+
+
+This adds a little extra room around the bounding box.
+This has an effect in two places: on the computation in the \Verb+max size+ it ensures that the extra room fits inside the given rectangle, and on the size of the \Verb+enclosing box+ pseudo-{}node.
+
+\item \Verb+constrain+
+
+If the \Verb+enclosing box+ pseudo-{}node is used directly, it should almost always be used with the \Verb+overlay+ key because otherwise there is potential for the bounding box size to explode.
+
+This makes it somewhat tricky to use with the \Verb+\clip+ path constructor as that does its own stuff with the computation of the bounding box.
+For this reason, the key \Verb+constrain+ is provided which does a ``safe'' clip to the enclosing box.
+
+If this is to be used somewhere other than at the start of the picture, there is the command \Verb+\constrain+.
+\end{itemize}
+
+\section{Drawing Segments}
+
+Drawing a line segment between two points is already adequately provided for by \tikzname.
+Drawing an arc is not, so this library provides a key \Verb+centred arc to={<point>}{<point>}+ which draws an arc from the current point to the second specified point which is centred at the first specified point.
+The key \Verb+arc flip+ can be used to switch which part of the circle is drawn.
+These keys are for the \Verb+arc+ path constructor, as in Example~\ref{ex:arcs}.
+
+\begin{figure}
+\begin{example}
+\begin{tikzpicture}
+\path (0,0) node[name=0,ruler compass/point=red,label={0}];
+\path (0) ++(30:2) node[ruler compass/point=red,label={a}];
+\path (0) ++(70:2.7) node[ruler compass/point=red,label={b}];
+\compass{0}{a}
+\compass{a}{b}
+\point{c0a}{cab}{1}
+\point{c0a}{cab}{2}
+\draw[ultra thick,red] (c) arc[centred arc to={a}{d}] arc[arc flip,centred arc to={0}{c}];
+\end{tikzpicture}
+\end{example}
+\caption{Drawing an arc.}
+\label{ex:arcs}
+\end{figure}
+
+
+\section{Miscellaneous Extras}
+
+As a little extra (because I found them useful when using this library), this library also provides the code used in the answers to \href{http://tex.stackexchange.com/a/20426/86}{``Z-level in \tikzname''} and \href{http://tex.stackexchange.com/a/43946/86}{How can I force \tikzname\ pin angle?}.
+The first provides a per-{}path and per-{}node layering system, the second helps with label positioning.
+The extra keys are:
+
+\begin{itemize}
+\item \Verb+on layer=<layer>+
+
+This puts the current path on a particular layer.
+
+\item \Verb+node on layer=<layer>+
+
+This is the same, but for nodes.
+
+\item \Verb+reset label anchor=<anchor>+
+
+This turns off \tikzname's automatic label anchoring to make it possible to specify a particular anchor to use.
+\end{itemize}
+
+\section{Beamer Examples}
+
+The following show some examples using \Verb+beamer+ to step through.
+As these are ``full screen'', the page is used as the bounding box and so the \Verb+constrain+ key is not needed.
+
+\subsection{Addition of Points}
+
+\lstinputlisting{rc_example_add.tex}
+
+The final picture looks something like the following.
+
+\begin{center}
+\begin{tikzpicture}[
+ stop jumping,
+ constrain
+% max size={\textwidth}{\textheight},
+ ]
+% Mark two points: one at the centre of the page and one a random offset. These define our unit of length for constructions
+\path (0,0) node[name=0,ruler compass/point=red,label={0}];
+\path (0) ++(\ptaa:\ptra) node[ruler compass/point=red,label={a}];
+\path (0) ++(\ptab:\ptrb) node[ruler compass/point=red,label={b}];
+\ruler{0}{b}
+\ruler{0}{a}
+\compass{0}{a}
+\point{r0b}{c0a}{2}
+\compass{0}{b}
+\point{r0a}{c0b}{2}
+\compass{a}{0}
+\point{ca0}{c0a}{1}
+\point{ca0}{c0a}{2}
+\ruler{e}{f}
+\point[label={[above]\(a/2\)}]{r0a}{ref}{1}
+\compass{g}{d}
+\point{r0a}{cgd}{1}
+\compass{a}{h}
+\compass{b}{0}
+\point{cb0}{c0b}{1}
+\point{cb0}{c0b}{2}
+\ruler{i}{j}
+\point[label={[above]\(b/2\)}]{r0b}{rij}{1}
+\compass{k}{c}
+\point{r0b}{ckc}{1}
+\compass{b}{l}
+\point[fill=red,label={[above]\(a+b\)}]{cbl}{cah}{1}
+\end{tikzpicture}%
+\end{center}
+
+\subsection{Multiplication of Points}
+
+\lstinputlisting{rc_example_mult.tex}
+
+A comparison of the \Verb+beamer+ version with the following picture will show the wisdom of a step-{}by-{}step approach to these drawings.
+
+\begin{center}
+\begin{tikzpicture}[
+ stop jumping,
+ constrain
+ ]
+% Mark two points: one at the centre of the page and one a random offset. These define our unit of length for constructions
+\path (0,0) node[name=0,ruler compass/point=red,label={0}];
+\path (1,0) node[name=1,ruler compass/point=red,label={1}];
+\path (0) ++(\ptaa:\ptra) node[ruler compass/point=red,label={a}];
+\path (0) ++(\ptab:\ptrb) node[ruler compass/point=red,label={b}];
+\ruler{0}{1}
+\ruler{0}{b}
+\compass{0}{1}
+\point{c01}{r0b}{1}
+\compass{1}{a}
+\point{c1a}{r01}{1}
+\compass{0}{d}
+\point{c0d}{r0b}{1}
+\point{c0d}{r0b}{2}
+\compass{0}{a}
+\compass{c}{e}
+\point{c0a}{cce}{2}
+\point{c0a}{r0b}{2}
+\ruler{0}{g}
+\compass{0}{b}
+\compass{b}{0}
+\point{c0b}{cb0}{1}
+\point{c0b}{cb0}{2}
+\ruler{i}{j}
+\point{r0b}{rij}{1}
+\compass{k}{c}
+\point{r0b}{ckc}{1}
+\compass{0}{l}
+\compass{l}{0}
+\point{c0l}{cl0}{1}
+\point{c0l}{cl0}{2}
+\ruler{m}{n}
+\point{r0b}{rmn}{1}
+\compass{o}{f}
+\point{cof}{r0b}{1}
+\compass{o}{h}
+\point{coh}{r0b}{1}
+\compass{l}{q}
+\compass{b}{p}
+\point{clq}{cbp}{2}
+\ruler{b}{r}
+\point[fill=red,label={[above]\(ab\)}]{rbr}{r0g}{1}
+\end{tikzpicture}%
+\end{center}
+
+
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/rulercompass/rulercompass.dtx b/Master/texmf-dist/source/latex/rulercompass/rulercompass.dtx
new file mode 100644
index 00000000000..58034995083
--- /dev/null
+++ b/Master/texmf-dist/source/latex/rulercompass/rulercompass.dtx
@@ -0,0 +1,811 @@
+% \iffalse meta-comment
+%<*internal>
+\iffalse
+%</internal>
+%<*readme>
+---------------------------------------------------------------
+rulercompass --- a TikZ/PGF library for drawing straight-edge
+ and compass diagrams
+E-mail: stacey@math.ntnu.no
+Released under the LaTeX Project Public Licence v1.3c or later
+See http://www.latex-project.org/lppl.txt
+---------------------------------------------------------------
+
+This package defines some commands and styles intended for
+drawing straight-edge and compass diagrams.
+%</readme>
+%<*internal>
+\fi
+\def\nameofplainTeX{plain}
+\ifx\fmtname\nameofplainTeX\else
+\expandafter\begingroup
+\fi
+%</internal>
+%<*install>
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+\preamble
+---------------------------------------------------------------
+rulercompass --- a TikZ/PGF library for drawing straight-edge
+ and compass diagrams
+E-mail: stacey@math.ntnu.no
+Released under the LaTeX Project Public Licence v1.3c or later
+See http://www.latex-project.org/lppl.txt
+---------------------------------------------------------------
+
+\endpreamble
+\postamble
+
+Copyright (C) 2013 by Andrew Stacey <stacey@math.ntnu.no>
+
+This file 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 is "maintained" (as per LPPL maintenance status) by
+Andrew Stacey.
+
+This work consists of the files rulercompass.dtx
+ rulercompass_doc.tex
+and the derived files tikzlibraryrulercompass.code.tex
+ rulercompass.ins
+ rulercompass.pdf
+ rulercompass_doc.pdf
+ README.txt
+
+
+\endpostamble
+\usedir{tex/latex/rulercompass}
+\generate{\file{tikzlibraryrulercompass.code.tex}{\from{rulercompass.dtx}{tikzlibrary}}}
+%</install>
+%<install>\endbatchfile
+%<*internal>
+\usedir{source/latex/rulercompass}
+\generate{
+ \file{\jobname.ins}{\from{\jobname.dtx}{install}}
+}
+\nopreamble\nopostamble
+\generate{
+ \file{README.txt}{\from{\jobname.dtx}{readme}}
+}
+\ifx\fmtname\nameofplainTeX
+ \expandafter\endbatchfile
+\else
+ \expandafter\endgroup
+\fi
+%</internal>
+%<*driver>
+\documentclass[full]{l3doc}
+\usepackage[T1]{fontenc}
+\usepackage{csquotes}
+\usepackage{lmodern}
+\usepackage{alphalph}
+\usepackage{tikz}
+\usetikzlibrary{rulercompass}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+\DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{785}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%
+%
+%
+% \DoNotIndex{\newcommand,\newenvironment}
+%
+% \providecommand*{\url}{\texttt}
+% \title{The \textsf{rulercompass} package: code}
+% \author{Andrew Stacey \\ \url{stacey@math.ntnu.no}}
+% \maketitle
+%
+%
+% \StopEventually{\PrintChanges}
+% \section{Implementation}
+%
+% \iffalse
+%<*tikzlibrary>
+% \fi
+%
+% Load in useful tikzlibraries.
+% \begin{macrocode}
+\usetikzlibrary{intersections,calc}
+% \end{macrocode}
+%^^A
+% Are we in draft mode (so display point labels)?
+% \begin{macrocode}
+\newif\ifrc@draft
+% \end{macrocode}
+%^^A
+% Is beamer loaded?
+% \begin{macrocode}
+\newif\ifrc@beamer
+% \end{macrocode}
+%^^A
+% When drawing arc segments, do we flip the segment?
+% \begin{macrocode}
+\newif\ifrc@fliparc
+% \end{macrocode}
+%^^A
+% A picture id that stays the same on beamer frames to make it easier to compare bounding boxes and other information of the ``same'' tikzpicture.
+% \begin{macrocode}
+\newcount\rc@picture@id
+% \end{macrocode}
+%^^A
+% Counter for our point labels.
+% \begin{macrocode}
+\newcounter{pointlabels}
+% \end{macrocode}
+%^^A
+% Set the beamer boolean.
+% \begin{macrocode}
+\@ifclassloaded{beamer}{%
+ \rc@beamertrue
+}{}
+% \end{macrocode}
+%^^A
+% Internal separator for the path-naming scheme
+% \begin{macrocode}
+\def\rc@pathsep{@}
+% \end{macrocode}
+%^^A
+% Are we running under beamer?
+% \begin{macrocode}
+\ifrc@beamer
+% \end{macrocode}
+% Make our counters reset on frames
+% \begin{macrocode}
+\resetcounteronoverlays{pointlabels}
+\resetcountonoverlays{rc@picture@id}
+% \end{macrocode}
+%^^A
+% Define an overlay-aware style
+% \begin{macrocode}
+\tikzset{
+ alt if exist/.code args={#1#2#3}{%
+ \@ifundefined{path@\the\rc@picture@id @#1}{%
+ \pgfkeysalso{#2}%
+ }{
+ \alt<.-\csname path@\the\rc@picture@id @#1\endcsname>{%
+ \pgfkeysalso{#2}%
+ }{
+ \pgfkeysalso{#3}%
+ }%
+ }%
+ },
+% \end{macrocode}
+% Save a path when it is used to compute a point
+% \begin{macrocode}
+ intersection/save/.code={%
+ \only<.>{%
+ \begingroup
+ \tikz@intersect@path@names@parse#1\tikz@stop
+ \protected@write\pgfutil@auxout{}{%
+ \string\global\string\@namedef{path@\the\rc@picture@id @\tikz@intersect@path@a}{\the\beamer@slideinframe}%
+ \string\global\string\@namedef{path@\the\rc@picture@id @\tikz@intersect@path@b}{\the\beamer@slideinframe}%
+ }%
+ \endgroup
+ }%
+ }
+}
+% \end{macrocode}
+%^^A
+% Define overlay-aware versions of the main macros.
+% \begin{macrocode}
+\newcommand<>\compass[3][]{%
+ \draw#4[#1,ruler compass/compass={#2}{#3}];
+}
+
+\newcommand<>\ruler[3][]{%
+ \draw#4[#1,ruler compass/ruler={#2}{#3}];
+}
+% \end{macrocode}
+%^^A
+% The \verb+\point+ macro is doubly overlay aware.
+% If the intersection has already been computed (say, on another slide of the same picture), reuse it.
+% \begin{macrocode}
+\newcommand<>\point[4][]{%
+ {%
+ \advance\c@pointlabels by 1\relax
+ \xdef\rc@temp{\thepointlabels}%
+ }%
+ \edef\rc@tempa{\the\rc@picture@id}%
+ \expandafter\ifx\csname rc@id@\rc@temp\endcsname\rc@tempa
+ \path#5 (\rc@temp) node[ruler compass/point,#1] {};
+ \else
+ \path#5 [name intersections={use=#2 and #3}] (intersection-#4) node[ruler compass/point,#1] {};
+ \fi
+}
+% \end{macrocode}
+%^^A
+% Now for the non-beamer versions
+% \begin{macrocode}
+\else
+% \end{macrocode}
+%^^A
+% The overlay-aware style defaults to the first option.
+% \begin{macrocode}
+\tikzset{
+ alt if exist/.code args={#1#2#3}{%
+ \pgfkeysalso{#2}%
+ },
+% \end{macrocode}
+% Saving this means we don't have to have two versions of a more complicated bit of code.
+% \begin{macrocode}
+ intersection/save/.code={%
+ \begingroup
+ \tikz@intersect@path@names@parse#1\tikz@stop
+ \protected@write\pgfutil@auxout{}{%
+ \string\global\string\@namedef{path@\the\rc@picture@id @\tikz@intersect@path@a}{\thepage}%
+ \string\global\string\@namedef{path@\the\rc@picture@id @\tikz@intersect@path@b}{\thepage}%
+ }%
+ \endgroup
+ }
+}
+% \end{macrocode}
+%^^A
+% Non-overlay aware versions of the primary commands.
+% \begin{macrocode}
+\newcommand\compass[3][]{%
+ \draw [#1,ruler compass/compass={#2}{#3}];
+}
+
+\newcommand\ruler[3][]{%
+ \draw [#1,ruler compass/ruler={#2}{#3}];
+}
+
+\newcommand\point[4][]{%
+ \path [name intersections={use=#2 and #3}] (intersection-#4) node[ruler compass/point,#1] {};
+}
+% \end{macrocode}
+%^^A
+% End of non-beamer specific section
+% \begin{macrocode}
+\fi
+% \end{macrocode}
+%^^A
+% The following macros process the path/point specifications.
+% The first looks to see if the first character is a period.
+% \begin{macrocode}
+\def\rc@processpt#1{%
+ \pgfutil@ifnextchar.{\rc@processpt@@#1}{\rc@processpt@#1}}
+% \end{macrocode}
+% Nope, so now look for a plus or a minus.
+% \begin{macrocode}
+\def\rc@processpt@#1#2\pgf@stop{%
+ \pgfutil@in@+{#2}%
+ \ifpgfutil@in@
+ \let\@next=\rc@processpt@plus
+ \else
+ \pgfutil@in@-{#2}%
+ \ifpgfutil@in@
+ \let\@next=\rc@processpt@minus
+ \else
+ \let\@next=\rc@processpt@bare
+ \fi
+ \fi
+ \@next#1#2\pgf@stop
+}
+% \end{macrocode}
+%^^A
+% Okay, we got a period.
+% That means the current point, possibly with an offset.
+% \begin{macrocode}
+\def\rc@processpt@@#1.#2\pgf@stop{%
+ \def\rc@temp{#2}%
+ \ifx\rc@temp\pgfutil@empty
+ \edef\rc@temp{\thepointlabels}%
+ \else
+ \pgfmathparse{int(\the\c@pointlabels + #2)}%
+ \begingroup
+ \c@pointlabels=\pgfmathresult\relax
+ \xdef\rc@temp{\thepointlabels}%
+ \endgroup
+ \fi
+ \let#1\rc@temp
+}
+% \end{macrocode}
+%^^A
+% We need to add an offset to the given label, so need to compute the index of the label.
+% \begin{macrocode}
+\def\rc@processpt@plus#1#2+#3\pgf@stop{%
+ \pgfmathsetmacro\rc@temp{0}%
+ \rc@reverse#2\pgf@stop%
+ \pgfmathparse{int(\rc@temp + #3)}%
+ \begingroup
+ \c@pointlabels=\pgfmathresult\relax
+ \xdef\rc@temp{\thepointlabels}%
+ \endgroup
+ \let#1\rc@temp
+}
+% \end{macrocode}
+%^^A
+% Same, but with a minus.
+% \begin{macrocode}
+\def\rc@processpt@minus#1#2-#3\pgf@stop{%
+ \pgfmathsetmacro\rc@temp{0}%
+ \rc@reverse#2\pgf@stop%
+ \pgfmathparse{int(\rc@temp - #3)}%
+ \begingroup
+ \c@pointlabels=\pgfmathresult\relax
+ \xdef\rc@temp{\thepointlabels}%
+ \endgroup
+ \let#1\rc@temp
+}
+% \end{macrocode}
+%^^A
+% Simplest case.
+% \begin{macrocode}
+\def\rc@processpt@bare#1#2\pgf@stop{%
+ \def#1{#2}}
+% \end{macrocode}
+%^^A
+% Reverse lookup the counter value from its displayed format.
+% \begin{macrocode}
+\def\rc@reverse#1{%
+ \ifx#1\pgf@stop
+ \let\@next=\pgfutil@empty
+ \else
+ \let\@next=\rc@reverse
+ \pgfutil@tempcnta=`#1\relax
+ \pgfmathsetmacro\rc@temp{\rc@temp * \rc@factor + \the\pgfutil@tempcnta - \rc@initial}%
+ \fi
+ \@next}
+% \end{macrocode}
+%^^A
+% Compute the actual path name from the three token (lists).
+% \begin{macrocode}
+\def\rc@parsepath#1#2#3#4\pgf@stop{%
+ \rc@processpt\rc@tempa#3\pgf@stop
+ \rc@processpt\rc@tempb#4\pgf@stop
+ \xdef#1{#2\rc@pathsep\rc@tempa\rc@pathsep\rc@tempb}%
+}
+% \end{macrocode}
+%^^A
+% Now we install all our styles
+% \begin{macrocode}
+\tikzset{
+% \end{macrocode}
+%^^A
+% Code which initialises our counters at the start of a picture.
+% \begin{macrocode}
+ every picture/.append style={
+ ruler compass/at begin picture
+ },
+% \end{macrocode}
+%^^A
+% Passes the paths to the intersection but also takes note of their use.
+% \begin{macrocode}
+ intersection/use/.code args={#1 and #2}{%
+ \rc@parsepath\rc@pta#1\pgf@stop
+ \rc@parsepath\rc@ptb#2\pgf@stop
+ \pgfkeysalso{
+ of={\rc@pta} and \rc@ptb,
+ save={\rc@pta} and \rc@ptb,
+ }
+ },
+% \end{macrocode}
+%^^A
+% \verb+to path+ for a circle through a given point.
+% \begin{macrocode}
+ circle through/.style={
+ to path={
+ \pgfextra{
+ \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax
+ \pgfmathsetmacro\rc@radius{veclen(\pgf@x - \pgf@xa,\pgf@y - \pgf@ya)}%
+ }
+ circle[radius=\rc@radius pt] (\tikztotarget)
+ }
+ },
+% \end{macrocode}
+%^^A
+% Flip an arc when drawing a segment.
+% \begin{macrocode}
+ arc flip/.is if=rc@fliparc,
+% \end{macrocode}
+%^^A
+% Arc from one point to another centred on specified point.
+% \begin{macrocode}
+ centred arc to/.code 2 args={%
+ \tikz@scan@one@point\pgfutil@firstofone(#1)\relax
+ \pgfmathsetmacro\rc@radius{veclen(\tikz@lastx-\pgf@x,\tikz@lasty-\pgf@y)}%
+ \pgfmathsetmacro\rc@sangle{atan2(\tikz@lasty - \pgf@y,\tikz@lastx - \pgf@x)}%
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \tikz@scan@one@point\pgfutil@firstofone(#2)\relax
+ \pgfmathsetmacro\rc@eangle{atan2(\pgf@y - \pgf@ya,\pgf@x - \pgf@xa)}%
+ \pgfmathsetmacro\rc@eangle{\rc@eangle < \rc@sangle ? \rc@eangle + 360 : \rc@eangle}%
+ \ifrc@fliparc
+ \pgfmathsetmacro\rc@eangle{\rc@eangle - 360}%
+ \fi
+ \pgfkeysalso{start angle=\rc@sangle, end angle=\rc@eangle, radius=\rc@radius pt}
+ },
+% \end{macrocode}
+%^^A
+% Most of our keys are in this family.
+% \begin{macrocode}
+ ruler compass/.is family,
+ ruler compass/.cd,
+% \end{macrocode}
+%^^A
+% Draft mode displays the labels.
+% \begin{macrocode}
+ draft mode/.is if=rc@draft,
+% beamer mode/.is if=rc@beamer,
+% \end{macrocode}
+%^^A
+% This is the actual code for resetting the counters.
+% \begin{macrocode}
+ at begin picture/.style={
+ execute at begin picture={
+ \global\advance\rc@picture@id by 1\relax
+ \setcounter{pointlabels}{0}%
+ },
+ },
+% \end{macrocode}
+%^^A
+% Styling the point labels.
+% \begin{macrocode}
+ point labels/.is choice,
+ point labels/arabic/.code={%
+ \renewcommand\thepointlabels{\@arabic \c@pointlabels}%
+ \def\rc@initial{48}%
+ \def\rc@factor{10}%
+ },
+ point labels/alph/.code={%
+ \renewcommand\thepointlabels{\@alph \c@pointlabels}%
+ \def\rc@initial{96}%
+ \def\rc@factor{26}%
+ },
+ point labels/Alph/.code={%
+ \renewcommand\thepointlabels{\@Alph \c@pointlabels}%
+ \def\rc@initial{64}%
+ \def\rc@factor{26}%
+ },
+% \end{macrocode}
+%^^A
+% Styling the point labels with the \verb+alphalph+ package.
+% \begin{macrocode}
+ point labels/alphalph/.code={%
+ \@ifundefined{alphalph}{%
+ \message{The "alphalph" option only works if the 'alphalph' package has been loaded (using "alph" instead).}%
+ \renewcommand\thepointlabels{\@alph \c@pointlabels}%
+ \def\rc@initial{96}%
+ \def\rc@factor{26}%
+ }{%
+ \renewcommand\thepointlabels{\alphalph \c@pointlabels}%
+ \def\rc@initial{96}%
+ \def\rc@factor{26}%
+ }%
+ },
+ point labels/AlphAlph/.code={%
+ \@ifundefined{alphalph}{%
+ \message{The "AlphAlph" option only works if the 'alphalph' package has been loaded (using "Alph" instead).}%
+ \renewcommand\thepointlabels{\@Alph \c@pointlabels}%
+ \def\rc@initial{64}%
+ \def\rc@factor{26}%
+ }{%
+ \renewcommand\thepointlabels{\AlphAlph \c@pointlabels}%
+ \def\rc@initial{64}%
+ \def\rc@factor{26}%
+ }%
+ },
+% \end{macrocode}
+%^^A
+% Styles for if the path is still in use or not.
+% \begin{macrocode}
+ construction in use/.style={
+ draw=blue
+ },
+ construction not in use/.style={
+ draw=gray!75,
+ },
+% \end{macrocode}
+%^^A
+% Code for drawing a circle.
+% \begin{macrocode}
+ compass/.code 2 args={%
+ \rc@processpt\rc@pta#1\pgf@stop
+ \rc@processpt\rc@ptb#2\pgf@stop
+ \pgfkeysalso{ruler compass/compass aux={\rc@pta}{\rc@ptb}}%
+ },
+ compass aux/.style 2 args={
+ alt if exist={c\rc@pathsep#1\rc@pathsep#2}{
+ ruler compass/construction in use/.try,
+ }{
+ ruler compass/construction not in use/.try
+ },
+ name path=c\rc@pathsep#1\rc@pathsep#2,
+ ruler compass/every construction path/.try,
+ ruler compass/every compass/.try,
+ insert path={
+ (#1) to[circle through] (#2)
+ node[name=c\rc@pathsep#1\rc@pathsep#2\rc@pathsep centre,ruler compass/aux point={#1}] {}
+ node[name=c\rc@pathsep#1\rc@pathsep#2\rc@pathsep rim,ruler compass/aux point={#2}] {}
+ },
+ },
+% \end{macrocode}
+%^^A
+% Code for drawing a straight line.
+% \begin{macrocode}
+ ruler/.code 2 args={%
+ \rc@processpt\rc@pta#1\pgf@stop
+ \rc@processpt\rc@ptb#2\pgf@stop
+ \pgfkeysalso{ruler compass/ruler aux={\rc@pta}{\rc@ptb}}%
+ },
+ ruler aux/.style 2 args={
+ overlay,
+ alt if exist={r\rc@pathsep#1\rc@pathsep#2}{
+ ruler compass/construction in use/.try
+ }{
+ ruler compass/construction not in use/.try
+ },
+ name path=r\rc@pathsep#1\rc@pathsep#2,
+ ruler compass/every construction path/.try,
+ ruler compass/every ruler/.try,
+ insert path={
+ ($(#1)!\pgfkeysvalueof{/tikz/ruler compass/ruler length}!(#2)$) -- ($(#2)!\pgfkeysvalueof{/tikz/ruler compass/ruler length}!(#1)$)
+ node[name=r\rc@pathsep#1\rc@pathsep#2\rc@pathsep start,ruler compass/aux point={#1}] {}
+ node[name=r\rc@pathsep#1\rc@pathsep#2\rc@pathsep end,ruler compass/aux point={#2}] {}
+ },
+ },
+% \end{macrocode}
+%^^A
+% Sets the ruler length.
+% \begin{macrocode}
+ ruler length/.initial=20,
+% \end{macrocode}
+%^^A
+% Auxiliary point style.
+% \begin{macrocode}
+ aux point/.style={
+ node contents/.try={},
+ at={(#1)},
+ ruler compass/every aux point/.try
+ },
+% \end{macrocode}
+%^^A
+% Draws a point as a coordinate with another node for styling.
+% \begin{macrocode}
+ point/.style={
+ ruler compass/name it,
+ coordinate,
+ node contents/.try={},
+ insert path={
+ node[
+ fill=#1,
+ circle,
+ minimum width=1mm,
+ inner sep=0mm,
+ reset label anchor,
+ anchor=center,
+ node contents/.try={},
+ ruler compass/every point/.try,
+ ] {}
+ }
+ },
+% \end{macrocode}
+%^^A
+% Forces a point to be named.
+% \begin{macrocode}
+ name it/.code={%
+ \ifx\tikz@fig@name\pgfutil@empty
+ \stepcounter{pointlabels}%
+ \pgfkeysalso{name=\thepointlabels}%
+ \expandafter\xdef\csname rc@id@\thepointlabels\endcsname{\the\rc@picture@id}%
+ \ifrc@draft
+ \pgfkeysalso{label={[ruler compass/draft label/.try]\thepointlabels}}%
+ \fi
+ \fi
+ },
+ point/.default=black,
+}
+% \end{macrocode}
+%^^A
+% Sets the initial scale and offset of the enclosing box.
+% \begin{macrocode}
+\def\rc@scale{1}
+\def\rc@offset{0pt}
+% \end{macrocode}
+%^^A
+% Sets the bounding box from the auxiliary file.
+% \begin{macrocode}
+\def\jump@setbb#1#2#3{%
+ \@ifundefined{jump@#1@maxbb}{%
+ \expandafter\gdef\csname jump@#1@maxbb\endcsname{#3}%
+ }{%
+ \csname jump@#1@maxbb\endcsname
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ #3
+ \pgfmathsetlength\pgf@x{max(\pgf@x,\pgf@xa)}%
+ \pgfmathsetlength\pgf@y{max(\pgf@y,\pgf@ya)}%
+ \expandafter\xdef\csname jump@#1@maxbb\endcsname{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
+ }
+ \@ifundefined{jump@#1@minbb}{%
+ \expandafter\gdef\csname jump@#1@minbb\endcsname{#2}%
+ }{%
+ \csname jump@#1@minbb\endcsname
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ #2
+ \pgfmathsetlength\pgf@x{min(\pgf@x,\pgf@xa)}%
+ \pgfmathsetlength\pgf@y{min(\pgf@y,\pgf@ya)}%
+ \expandafter\xdef\csname jump@#1@minbb\endcsname{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
+ }
+}
+% \end{macrocode}
+%^^A
+% Installs the code to save the bounding box.
+% \begin{macrocode}
+\tikzset{
+ stop jumping/.style={
+ execute at end picture={%
+ \pgfmathsetlength\pgf@xa{\pgf@picminx/\rc@scale}%
+ \pgfmathsetlength\pgf@ya{\pgf@picminy/\rc@scale}%
+ \pgfmathsetlength\pgf@xb{\pgf@picmaxx/\rc@scale}%
+ \pgfmathsetlength\pgf@yb{\pgf@picmaxy/\rc@scale}%
+ \immediate\write\pgfutil@auxout{%
+ \noexpand\jump@setbb{\the\rc@picture@id}{\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}{\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}}%
+ },
+ \pgf@x=\pgf@picminx
+ \pgf@y=\pgf@picminy
+ \csname jump@\the\rc@picture@id @minbb\endcsname
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \pgf@x=\pgf@picmaxx
+ \pgf@y=\pgf@picmaxy
+ \csname jump@\the\rc@picture@id @maxbb\endcsname
+ \edef\rc@temp{\noexpand\path (\the\pgf@xa - \rc@offset,\the\pgf@ya - \rc@offset) -- (\the\pgf@x + \rc@offset,\the\pgf@y + \rc@offset);}%
+ \rc@temp
+ },
+ },
+% \end{macrocode}
+%^^A
+% Scales the picture to fit inside a given rectangle.
+% \begin{macrocode}
+ max size/.code 2 args={%
+ \pgfutil@ifundefined{jump@\the\rc@picture@id @maxbb}{}{%
+ \csname jump@\the\rc@picture@id @maxbb\endcsname
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \csname jump@\the\rc@picture@id @minbb\endcsname
+ \advance\pgf@xa by -\pgf@x
+ \advance\pgf@ya by -\pgf@y
+ \advance\pgf@xa by \rc@offset
+ \advance\pgf@xa by \rc@offset
+ \advance\pgf@ya by \rc@offset
+ \advance\pgf@ya by \rc@offset
+ \pgfmathsetmacro\rc@xratio{\pgf@xa > #1 ? \pgf@xa/#1 : 1}%
+ \pgfmathsetmacro\rc@yratio{\pgf@ya > #2 ? \pgf@ya/#2 : 1}%
+ \pgfmathsetmacro\rc@scale{1/max(\rc@xratio,\rc@yratio)}%
+ \pgfkeysalso{scale=\rc@scale}%
+ }
+ },
+% \end{macrocode}
+%^^A
+%^^A
+% \begin{macrocode}
+ enclosing box/offset/.store in=\rc@offset,
+ constrain/.style={
+ execute at begin picture=\constrain
+ }
+}
+% \end{macrocode}
+%^^A
+% Defines a clip to the enclosing box.
+% \begin{macrocode}
+\newcommand\constrain{%
+ \pgfutil@ifundefined{jump@\the\rc@picture@id @minbb}{}{%
+ \csname jump@\the\rc@picture@id @minbb\endcsname
+ \pgfmathsetlength\pgf@xa{\pgf@x-\rc@offset}%
+ \pgfmathsetlength\pgf@ya{\pgf@y-\rc@offset}%
+ \csname jump@\the\rc@picture@id @maxbb\endcsname
+ \pgfmathsetlength\pgf@xb{\pgf@x+\rc@offset}%
+ \pgfmathsetlength\pgf@yb{\pgf@y+\rc@offset}%
+ \edef\rc@temp{\noexpand\clip (\the\pgf@xa,\the\pgf@ya) rectangle (\the\pgf@xb,\the\pgf@yb);}
+ \ifpgf@relevantforpicturesize
+ \pgf@relevantforpicturesizefalse
+ \rc@temp
+ \pgf@relevantforpicturesizetrue
+ \else
+ \rc@temp
+ \fi
+ }%
+}
+
+% \end{macrocode}
+%^^A
+% Defines the enclosing box node.
+% \begin{macrocode}
+\expandafter\def\csname pgf@sh@ns@enclosing box\endcsname{rectangle}
+\expandafter\def\csname pgf@sh@np@enclosing box\endcsname{%
+ \pgfutil@ifundefined{jump@\the\rc@picture@id @minbb}{%
+ \def\southwest{\pgfqpoint{\pgf@picminx}{\pgf@picminy}}%
+ \def\northeast{\pgfqpoint{\pgf@picmaxx}{\pgf@picmaxy}}%
+}{%
+ \csname jump@\the\rc@picture@id @minbb\endcsname
+ \pgfmathsetlength\pgf@xa{\pgf@x-\rc@offset}%
+ \pgfmathsetlength\pgf@ya{\pgf@y-\rc@offset}%
+ \edef\southwest{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
+ \csname jump@\the\rc@picture@id @maxbb\endcsname
+ \pgfmathsetlength\pgf@xb{\pgf@x+\rc@offset}%
+ \pgfmathsetlength\pgf@yb{\pgf@y+\rc@offset}%
+ \edef\northeast{\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}%
+ }%
+}
+\expandafter\def\csname pgf@sh@nt@enclosing box\endcsname{{1}{0}{0}{1}{0pt}{0pt}}
+\expandafter\def\csname pgf@sh@pi@enclosing box\endcsname{\pgfpictureid}
+
+
+% \end{macrocode}
+%^^A
+% Defines the layer code for individual paths and nodes.
+% \begin{macrocode}
+\tikzset{
+ on layer/.code={
+ \pgfonlayer{#1}\begingroup
+ \aftergroup\endpgfonlayer
+ \aftergroup\endgroup
+ },
+ node on layer/.code={
+ \gdef\node@@on@layer{%
+ \setbox\tikz@tempbox=\hbox\bgroup\pgfonlayer{#1}\unhbox\tikz@tempbox\endpgfonlayer\egroup}
+ \aftergroup\node@on@layer
+ },
+ reset label anchor/.code={%
+ \let\tikz@auto@anchor=\pgfutil@empty
+ \def\tikz@anchor{#1}
+ },
+ reset label anchor/.default=center
+}
+\def\node@on@layer{\aftergroup\node@@on@layer}
+% \end{macrocode}
+%^^A
+% Sets the point label style.
+% \begin{macrocode}
+\@ifpackageloaded{alphalph}%
+{
+ \tikzset{ruler compass/point labels=alphalph}
+}
+{
+ \tikzset{ruler compass/point labels=alph}
+}
+
+\endinput
+% \end{macrocode}
+% \iffalse
+%</tikzlibrary>
+% \fi
+%
+%\Finale \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/rulercompass/rulercompass.ins b/Master/texmf-dist/source/latex/rulercompass/rulercompass.ins
new file mode 100644
index 00000000000..b370b06876c
--- /dev/null
+++ b/Master/texmf-dist/source/latex/rulercompass/rulercompass.ins
@@ -0,0 +1,84 @@
+%%
+%% This is file `rulercompass.ins',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% rulercompass.dtx (with options: `install')
+%% ---------------------------------------------------------------
+%% rulercompass --- a TikZ/PGF library for drawing straight-edge
+%% and compass diagrams
+%% E-mail: stacey@math.ntnu.no
+%% Released under the LaTeX Project Public Licence v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ---------------------------------------------------------------
+%%
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+\preamble
+---------------------------------------------------------------
+rulercompass --- a TikZ/PGF library for drawing straight-edge
+ and compass diagrams
+E-mail: stacey@math.ntnu.no
+Released under the LaTeX Project Public Licence v1.3c or later
+See http://www.latex-project.org/lppl.txt
+---------------------------------------------------------------
+
+\endpreamble
+\postamble
+
+Copyright (C) 2013 by Andrew Stacey <stacey@math.ntnu.no>
+
+This file 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 is "maintained" (as per LPPL maintenance status) by
+Andrew Stacey.
+
+This work consists of the files rulercompass.dtx
+ rulercompass_doc.tex
+and the derived files tikzlibraryrulercompass.code.tex
+ rulercompass.ins
+ rulercompass.pdf
+ rulercompass_doc.pdf
+ README.txt
+
+\endpostamble
+\usedir{tex/latex/rulercompass}
+\generate{\file{tikzlibraryrulercompass.code.tex}{\from{rulercompass.dtx}{tikzlibrary}}}
+\endbatchfile
+%%
+%% Copyright (C) 2013 by Andrew Stacey <stacey@math.ntnu.no>
+%%
+%% This file 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 is "maintained" (as per LPPL maintenance status) by
+%% Andrew Stacey.
+%%
+%% This work consists of the files rulercompass.dtx
+%% rulercompass_doc.tex
+%% and the derived files tikzlibraryrulercompass.code.tex
+%% rulercompass.ins
+%% rulercompass.pdf
+%% rulercompass_doc.pdf
+%% README.txt
+%%
+%%
+%%
+%% End of file `rulercompass.ins'.
diff --git a/Master/texmf-dist/tex/latex/rulercompass/tikzlibraryrulercompass.code.tex b/Master/texmf-dist/tex/latex/rulercompass/tikzlibraryrulercompass.code.tex
new file mode 100644
index 00000000000..76cda67eb09
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/rulercompass/tikzlibraryrulercompass.code.tex
@@ -0,0 +1,495 @@
+%%
+%% This is file `tikzlibraryrulercompass.code.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% rulercompass.dtx (with options: `tikzlibrary')
+%% ---------------------------------------------------------------
+%% rulercompass --- a TikZ/PGF library for drawing straight-edge
+%% and compass diagrams
+%% E-mail: stacey@math.ntnu.no
+%% Released under the LaTeX Project Public Licence v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ---------------------------------------------------------------
+%%
+\usetikzlibrary{intersections,calc}
+\newif\ifrc@draft
+\newif\ifrc@beamer
+\newif\ifrc@fliparc
+\newcount\rc@picture@id
+\newcounter{pointlabels}
+\@ifclassloaded{beamer}{%
+ \rc@beamertrue
+}{}
+\def\rc@pathsep{@}
+\ifrc@beamer
+\resetcounteronoverlays{pointlabels}
+\resetcountonoverlays{rc@picture@id}
+\tikzset{
+ alt if exist/.code args={#1#2#3}{%
+ \@ifundefined{path@\the\rc@picture@id @#1}{%
+ \pgfkeysalso{#2}%
+ }{
+ \alt<.-\csname path@\the\rc@picture@id @#1\endcsname>{%
+ \pgfkeysalso{#2}%
+ }{
+ \pgfkeysalso{#3}%
+ }%
+ }%
+ },
+ intersection/save/.code={%
+ \only<.>{%
+ \begingroup
+ \tikz@intersect@path@names@parse#1\tikz@stop
+ \protected@write\pgfutil@auxout{}{%
+ \string\global\string\@namedef{path@\the\rc@picture@id @\tikz@intersect@path@a}{\the\beamer@slideinframe}%
+ \string\global\string\@namedef{path@\the\rc@picture@id @\tikz@intersect@path@b}{\the\beamer@slideinframe}%
+ }%
+ \endgroup
+ }%
+ }
+}
+\newcommand<>\compass[3][]{%
+ \draw#4[#1,ruler compass/compass={#2}{#3}];
+}
+
+\newcommand<>\ruler[3][]{%
+ \draw#4[#1,ruler compass/ruler={#2}{#3}];
+}
+\newcommand<>\point[4][]{%
+ {%
+ \advance\c@pointlabels by 1\relax
+ \xdef\rc@temp{\thepointlabels}%
+ }%
+ \edef\rc@tempa{\the\rc@picture@id}%
+ \expandafter\ifx\csname rc@id@\rc@temp\endcsname\rc@tempa
+ \path#5 (\rc@temp) node[ruler compass/point,#1] {};
+ \else
+ \path#5 [name intersections={use=#2 and #3}] (intersection-#4) node[ruler compass/point,#1] {};
+ \fi
+}
+\else
+\tikzset{
+ alt if exist/.code args={#1#2#3}{%
+ \pgfkeysalso{#2}%
+ },
+ intersection/save/.code={%
+ \begingroup
+ \tikz@intersect@path@names@parse#1\tikz@stop
+ \protected@write\pgfutil@auxout{}{%
+ \string\global\string\@namedef{path@\the\rc@picture@id @\tikz@intersect@path@a}{\thepage}%
+ \string\global\string\@namedef{path@\the\rc@picture@id @\tikz@intersect@path@b}{\thepage}%
+ }%
+ \endgroup
+ }
+}
+\newcommand\compass[3][]{%
+ \draw [#1,ruler compass/compass={#2}{#3}];
+}
+
+\newcommand\ruler[3][]{%
+ \draw [#1,ruler compass/ruler={#2}{#3}];
+}
+
+\newcommand\point[4][]{%
+ \path [name intersections={use=#2 and #3}] (intersection-#4) node[ruler compass/point,#1] {};
+}
+\fi
+\def\rc@processpt#1{%
+ \pgfutil@ifnextchar.{\rc@processpt@@#1}{\rc@processpt@#1}}
+\def\rc@processpt@#1#2\pgf@stop{%
+ \pgfutil@in@+{#2}%
+ \ifpgfutil@in@
+ \let\@next=\rc@processpt@plus
+ \else
+ \pgfutil@in@-{#2}%
+ \ifpgfutil@in@
+ \let\@next=\rc@processpt@minus
+ \else
+ \let\@next=\rc@processpt@bare
+ \fi
+ \fi
+ \@next#1#2\pgf@stop
+}
+\def\rc@processpt@@#1.#2\pgf@stop{%
+ \def\rc@temp{#2}%
+ \ifx\rc@temp\pgfutil@empty
+ \edef\rc@temp{\thepointlabels}%
+ \else
+ \pgfmathparse{int(\the\c@pointlabels + #2)}%
+ \begingroup
+ \c@pointlabels=\pgfmathresult\relax
+ \xdef\rc@temp{\thepointlabels}%
+ \endgroup
+ \fi
+ \let#1\rc@temp
+}
+\def\rc@processpt@plus#1#2+#3\pgf@stop{%
+ \pgfmathsetmacro\rc@temp{0}%
+ \rc@reverse#2\pgf@stop%
+ \pgfmathparse{int(\rc@temp + #3)}%
+ \begingroup
+ \c@pointlabels=\pgfmathresult\relax
+ \xdef\rc@temp{\thepointlabels}%
+ \endgroup
+ \let#1\rc@temp
+}
+\def\rc@processpt@minus#1#2-#3\pgf@stop{%
+ \pgfmathsetmacro\rc@temp{0}%
+ \rc@reverse#2\pgf@stop%
+ \pgfmathparse{int(\rc@temp - #3)}%
+ \begingroup
+ \c@pointlabels=\pgfmathresult\relax
+ \xdef\rc@temp{\thepointlabels}%
+ \endgroup
+ \let#1\rc@temp
+}
+\def\rc@processpt@bare#1#2\pgf@stop{%
+ \def#1{#2}}
+\def\rc@reverse#1{%
+ \ifx#1\pgf@stop
+ \let\@next=\pgfutil@empty
+ \else
+ \let\@next=\rc@reverse
+ \pgfutil@tempcnta=`#1\relax
+ \pgfmathsetmacro\rc@temp{\rc@temp * \rc@factor + \the\pgfutil@tempcnta - \rc@initial}%
+ \fi
+ \@next}
+\def\rc@parsepath#1#2#3#4\pgf@stop{%
+ \rc@processpt\rc@tempa#3\pgf@stop
+ \rc@processpt\rc@tempb#4\pgf@stop
+ \xdef#1{#2\rc@pathsep\rc@tempa\rc@pathsep\rc@tempb}%
+}
+\tikzset{
+ every picture/.append style={
+ ruler compass/at begin picture
+ },
+ intersection/use/.code args={#1 and #2}{%
+ \rc@parsepath\rc@pta#1\pgf@stop
+ \rc@parsepath\rc@ptb#2\pgf@stop
+ \pgfkeysalso{
+ of={\rc@pta} and \rc@ptb,
+ save={\rc@pta} and \rc@ptb,
+ }
+ },
+ circle through/.style={
+ to path={
+ \pgfextra{
+ \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax
+ \pgfmathsetmacro\rc@radius{veclen(\pgf@x - \pgf@xa,\pgf@y - \pgf@ya)}%
+ }
+ circle[radius=\rc@radius pt] (\tikztotarget)
+ }
+ },
+ arc flip/.is if=rc@fliparc,
+ centred arc to/.code 2 args={%
+ \tikz@scan@one@point\pgfutil@firstofone(#1)\relax
+ \pgfmathsetmacro\rc@radius{veclen(\tikz@lastx-\pgf@x,\tikz@lasty-\pgf@y)}%
+ \pgfmathsetmacro\rc@sangle{atan2(\tikz@lasty - \pgf@y,\tikz@lastx - \pgf@x)}%
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \tikz@scan@one@point\pgfutil@firstofone(#2)\relax
+ \pgfmathsetmacro\rc@eangle{atan2(\pgf@y - \pgf@ya,\pgf@x - \pgf@xa)}%
+ \pgfmathsetmacro\rc@eangle{\rc@eangle < \rc@sangle ? \rc@eangle + 360 : \rc@eangle}%
+ \ifrc@fliparc
+ \pgfmathsetmacro\rc@eangle{\rc@eangle - 360}%
+ \fi
+ \pgfkeysalso{start angle=\rc@sangle, end angle=\rc@eangle, radius=\rc@radius pt}
+ },
+ ruler compass/.is family,
+ ruler compass/.cd,
+ draft mode/.is if=rc@draft,
+ at begin picture/.style={
+ execute at begin picture={
+ \global\advance\rc@picture@id by 1\relax
+ \setcounter{pointlabels}{0}%
+ },
+ },
+ point labels/.is choice,
+ point labels/arabic/.code={%
+ \renewcommand\thepointlabels{\@arabic \c@pointlabels}%
+ \def\rc@initial{48}%
+ \def\rc@factor{10}%
+ },
+ point labels/alph/.code={%
+ \renewcommand\thepointlabels{\@alph \c@pointlabels}%
+ \def\rc@initial{96}%
+ \def\rc@factor{26}%
+ },
+ point labels/Alph/.code={%
+ \renewcommand\thepointlabels{\@Alph \c@pointlabels}%
+ \def\rc@initial{64}%
+ \def\rc@factor{26}%
+ },
+ point labels/alphalph/.code={%
+ \@ifundefined{alphalph}{%
+ \message{The "alphalph" option only works if the 'alphalph' package has been loaded (using "alph" instead).}%
+ \renewcommand\thepointlabels{\@alph \c@pointlabels}%
+ \def\rc@initial{96}%
+ \def\rc@factor{26}%
+ }{%
+ \renewcommand\thepointlabels{\alphalph \c@pointlabels}%
+ \def\rc@initial{96}%
+ \def\rc@factor{26}%
+ }%
+ },
+ point labels/AlphAlph/.code={%
+ \@ifundefined{alphalph}{%
+ \message{The "AlphAlph" option only works if the 'alphalph' package has been loaded (using "Alph" instead).}%
+ \renewcommand\thepointlabels{\@Alph \c@pointlabels}%
+ \def\rc@initial{64}%
+ \def\rc@factor{26}%
+ }{%
+ \renewcommand\thepointlabels{\AlphAlph \c@pointlabels}%
+ \def\rc@initial{64}%
+ \def\rc@factor{26}%
+ }%
+ },
+ construction in use/.style={
+ draw=blue
+ },
+ construction not in use/.style={
+ draw=gray!75,
+ },
+ compass/.code 2 args={%
+ \rc@processpt\rc@pta#1\pgf@stop
+ \rc@processpt\rc@ptb#2\pgf@stop
+ \pgfkeysalso{ruler compass/compass aux={\rc@pta}{\rc@ptb}}%
+ },
+ compass aux/.style 2 args={
+ alt if exist={c\rc@pathsep#1\rc@pathsep#2}{
+ ruler compass/construction in use/.try,
+ }{
+ ruler compass/construction not in use/.try
+ },
+ name path=c\rc@pathsep#1\rc@pathsep#2,
+ ruler compass/every construction path/.try,
+ ruler compass/every compass/.try,
+ insert path={
+ (#1) to[circle through] (#2)
+ node[name=c\rc@pathsep#1\rc@pathsep#2\rc@pathsep centre,ruler compass/aux point={#1}] {}
+ node[name=c\rc@pathsep#1\rc@pathsep#2\rc@pathsep rim,ruler compass/aux point={#2}] {}
+ },
+ },
+ ruler/.code 2 args={%
+ \rc@processpt\rc@pta#1\pgf@stop
+ \rc@processpt\rc@ptb#2\pgf@stop
+ \pgfkeysalso{ruler compass/ruler aux={\rc@pta}{\rc@ptb}}%
+ },
+ ruler aux/.style 2 args={
+ overlay,
+ alt if exist={r\rc@pathsep#1\rc@pathsep#2}{
+ ruler compass/construction in use/.try
+ }{
+ ruler compass/construction not in use/.try
+ },
+ name path=r\rc@pathsep#1\rc@pathsep#2,
+ ruler compass/every construction path/.try,
+ ruler compass/every ruler/.try,
+ insert path={
+ ($(#1)!\pgfkeysvalueof{/tikz/ruler compass/ruler length}!(#2)$) -- ($(#2)!\pgfkeysvalueof{/tikz/ruler compass/ruler length}!(#1)$)
+ node[name=r\rc@pathsep#1\rc@pathsep#2\rc@pathsep start,ruler compass/aux point={#1}] {}
+ node[name=r\rc@pathsep#1\rc@pathsep#2\rc@pathsep end,ruler compass/aux point={#2}] {}
+ },
+ },
+ ruler length/.initial=20,
+ aux point/.style={
+ node contents/.try={},
+ at={(#1)},
+ ruler compass/every aux point/.try
+ },
+ point/.style={
+ ruler compass/name it,
+ coordinate,
+ node contents/.try={},
+ insert path={
+ node[
+ fill=#1,
+ circle,
+ minimum width=1mm,
+ inner sep=0mm,
+ reset label anchor,
+ anchor=center,
+ node contents/.try={},
+ ruler compass/every point/.try,
+ ] {}
+ }
+ },
+ name it/.code={%
+ \ifx\tikz@fig@name\pgfutil@empty
+ \stepcounter{pointlabels}%
+ \pgfkeysalso{name=\thepointlabels}%
+ \expandafter\xdef\csname rc@id@\thepointlabels\endcsname{\the\rc@picture@id}%
+ \ifrc@draft
+ \pgfkeysalso{label={[ruler compass/draft label/.try]\thepointlabels}}%
+ \fi
+ \fi
+ },
+ point/.default=black,
+}
+\def\rc@scale{1}
+\def\rc@offset{0pt}
+\def\jump@setbb#1#2#3{%
+ \@ifundefined{jump@#1@maxbb}{%
+ \expandafter\gdef\csname jump@#1@maxbb\endcsname{#3}%
+ }{%
+ \csname jump@#1@maxbb\endcsname
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ #3
+ \pgfmathsetlength\pgf@x{max(\pgf@x,\pgf@xa)}%
+ \pgfmathsetlength\pgf@y{max(\pgf@y,\pgf@ya)}%
+ \expandafter\xdef\csname jump@#1@maxbb\endcsname{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
+ }
+ \@ifundefined{jump@#1@minbb}{%
+ \expandafter\gdef\csname jump@#1@minbb\endcsname{#2}%
+ }{%
+ \csname jump@#1@minbb\endcsname
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ #2
+ \pgfmathsetlength\pgf@x{min(\pgf@x,\pgf@xa)}%
+ \pgfmathsetlength\pgf@y{min(\pgf@y,\pgf@ya)}%
+ \expandafter\xdef\csname jump@#1@minbb\endcsname{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
+ }
+}
+\tikzset{
+ stop jumping/.style={
+ execute at end picture={%
+ \pgfmathsetlength\pgf@xa{\pgf@picminx/\rc@scale}%
+ \pgfmathsetlength\pgf@ya{\pgf@picminy/\rc@scale}%
+ \pgfmathsetlength\pgf@xb{\pgf@picmaxx/\rc@scale}%
+ \pgfmathsetlength\pgf@yb{\pgf@picmaxy/\rc@scale}%
+ \immediate\write\pgfutil@auxout{%
+ \noexpand\jump@setbb{\the\rc@picture@id}{\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}{\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}}%
+ },
+ \pgf@x=\pgf@picminx
+ \pgf@y=\pgf@picminy
+ \csname jump@\the\rc@picture@id @minbb\endcsname
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \pgf@x=\pgf@picmaxx
+ \pgf@y=\pgf@picmaxy
+ \csname jump@\the\rc@picture@id @maxbb\endcsname
+ \edef\rc@temp{\noexpand\path (\the\pgf@xa - \rc@offset,\the\pgf@ya - \rc@offset) -- (\the\pgf@x + \rc@offset,\the\pgf@y + \rc@offset);}%
+ \rc@temp
+ },
+ },
+ max size/.code 2 args={%
+ \pgfutil@ifundefined{jump@\the\rc@picture@id @maxbb}{}{%
+ \csname jump@\the\rc@picture@id @maxbb\endcsname
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \csname jump@\the\rc@picture@id @minbb\endcsname
+ \advance\pgf@xa by -\pgf@x
+ \advance\pgf@ya by -\pgf@y
+ \advance\pgf@xa by \rc@offset
+ \advance\pgf@xa by \rc@offset
+ \advance\pgf@ya by \rc@offset
+ \advance\pgf@ya by \rc@offset
+ \pgfmathsetmacro\rc@xratio{\pgf@xa > #1 ? \pgf@xa/#1 : 1}%
+ \pgfmathsetmacro\rc@yratio{\pgf@ya > #2 ? \pgf@ya/#2 : 1}%
+ \pgfmathsetmacro\rc@scale{1/max(\rc@xratio,\rc@yratio)}%
+ \pgfkeysalso{scale=\rc@scale}%
+ }
+ },
+ enclosing box/offset/.store in=\rc@offset,
+ constrain/.style={
+ execute at begin picture=\constrain
+ }
+}
+\newcommand\constrain{%
+ \pgfutil@ifundefined{jump@\the\rc@picture@id @minbb}{}{%
+ \csname jump@\the\rc@picture@id @minbb\endcsname
+ \pgfmathsetlength\pgf@xa{\pgf@x-\rc@offset}%
+ \pgfmathsetlength\pgf@ya{\pgf@y-\rc@offset}%
+ \csname jump@\the\rc@picture@id @maxbb\endcsname
+ \pgfmathsetlength\pgf@xb{\pgf@x+\rc@offset}%
+ \pgfmathsetlength\pgf@yb{\pgf@y+\rc@offset}%
+ \edef\rc@temp{\noexpand\clip (\the\pgf@xa,\the\pgf@ya) rectangle (\the\pgf@xb,\the\pgf@yb);}
+ \ifpgf@relevantforpicturesize
+ \pgf@relevantforpicturesizefalse
+ \rc@temp
+ \pgf@relevantforpicturesizetrue
+ \else
+ \rc@temp
+ \fi
+ }%
+}
+
+\expandafter\def\csname pgf@sh@ns@enclosing box\endcsname{rectangle}
+\expandafter\def\csname pgf@sh@np@enclosing box\endcsname{%
+ \pgfutil@ifundefined{jump@\the\rc@picture@id @minbb}{%
+ \def\southwest{\pgfqpoint{\pgf@picminx}{\pgf@picminy}}%
+ \def\northeast{\pgfqpoint{\pgf@picmaxx}{\pgf@picmaxy}}%
+}{%
+ \csname jump@\the\rc@picture@id @minbb\endcsname
+ \pgfmathsetlength\pgf@xa{\pgf@x-\rc@offset}%
+ \pgfmathsetlength\pgf@ya{\pgf@y-\rc@offset}%
+ \edef\southwest{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
+ \csname jump@\the\rc@picture@id @maxbb\endcsname
+ \pgfmathsetlength\pgf@xb{\pgf@x+\rc@offset}%
+ \pgfmathsetlength\pgf@yb{\pgf@y+\rc@offset}%
+ \edef\northeast{\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}%
+ }%
+}
+\expandafter\def\csname pgf@sh@nt@enclosing box\endcsname{{1}{0}{0}{1}{0pt}{0pt}}
+\expandafter\def\csname pgf@sh@pi@enclosing box\endcsname{\pgfpictureid}
+
+\tikzset{
+ on layer/.code={
+ \pgfonlayer{#1}\begingroup
+ \aftergroup\endpgfonlayer
+ \aftergroup\endgroup
+ },
+ node on layer/.code={
+ \gdef\node@@on@layer{%
+ \setbox\tikz@tempbox=\hbox\bgroup\pgfonlayer{#1}\unhbox\tikz@tempbox\endpgfonlayer\egroup}
+ \aftergroup\node@on@layer
+ },
+ reset label anchor/.code={%
+ \let\tikz@auto@anchor=\pgfutil@empty
+ \def\tikz@anchor{#1}
+ },
+ reset label anchor/.default=center
+}
+\def\node@on@layer{\aftergroup\node@@on@layer}
+\@ifpackageloaded{alphalph}%
+{
+ \tikzset{ruler compass/point labels=alphalph}
+}
+{
+ \tikzset{ruler compass/point labels=alph}
+}
+
+%%
+%% Copyright (C) 2013 by Andrew Stacey <stacey@math.ntnu.no>
+%%
+%% This file 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 is "maintained" (as per LPPL maintenance status) by
+%% Andrew Stacey.
+%%
+%% This work consists of the files rulercompass.dtx
+%% rulercompass_doc.tex
+%% and the derived files tikzlibraryrulercompass.code.tex
+%% rulercompass.ins
+%% rulercompass.pdf
+%% rulercompass_doc.pdf
+%% README.txt
+%%
+%%
+%%
+%% End of file `tikzlibraryrulercompass.code.tex'.
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 8da015fcedd..e00d5a90d0a 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -404,7 +404,8 @@ my @TLP_working = qw(
robustcommand robustindex romanbar romande romanneg romannum
rotating rotfloat rotpages roundbox
rrgtrees rsc rsfs rsfso
- rterface rtkinenc rtklage ruhyphen russ rviewport rvwrite ryethesis
+ rterface rtkinenc rtklage ruhyphen rulercompass russ
+ rviewport rvwrite ryethesis
sa-tikz sageep sansmath sansmathaccent sansmathfonts
sapthesis sasnrdisplay sauerj
sauterfonts savefnmark savesym savetrees
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index 23fcc21f4da..6161463dcde 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -695,6 +695,7 @@ depend rotpages
depend roundbox
depend rterface
depend rtkinenc
+depend rulercompass
depend rvwrite
depend sauerj
depend savefnmark
diff --git a/Master/tlpkg/tlpsrc/rulercompass.tlpsrc b/Master/tlpkg/tlpsrc/rulercompass.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/rulercompass.tlpsrc