summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikz-dimline
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/pgf/contrib/tikz-dimline
Initial commit
Diffstat (limited to 'graphics/pgf/contrib/tikz-dimline')
-rw-r--r--graphics/pgf/contrib/tikz-dimline/README73
-rw-r--r--graphics/pgf/contrib/tikz-dimline/dimline1.pngbin0 -> 18279 bytes
-rw-r--r--graphics/pgf/contrib/tikz-dimline/dimline2.pngbin0 -> 36794 bytes
-rw-r--r--graphics/pgf/contrib/tikz-dimline/dimline3.pngbin0 -> 36960 bytes
-rw-r--r--graphics/pgf/contrib/tikz-dimline/tikz-dimline-doc.pdfbin0 -> 83280 bytes
-rw-r--r--graphics/pgf/contrib/tikz-dimline/tikz-dimline-doc.tex422
-rw-r--r--graphics/pgf/contrib/tikz-dimline/tikz-dimline.sty189
7 files changed, 684 insertions, 0 deletions
diff --git a/graphics/pgf/contrib/tikz-dimline/README b/graphics/pgf/contrib/tikz-dimline/README
new file mode 100644
index 0000000000..65359014f4
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-dimline/README
@@ -0,0 +1,73 @@
+# Technical dimension lines in Tikz
+
+
+Dimension lines are drawn segments that indicate the measurement of a
+feature. The line has an arrow at both ends to show that the dimension
+displayed covers the entire span of that line. The direction of the line
+(vertical, horizontal or diagonal) shows the direction of the
+measurement. Dimension lines are kept outside of the object illustrated,
+typically connected to other lines that display the area where that
+measurement applies. This keeps the illustration clear.
+
+
+
+## Installation
+
+To install the `tkiz-dimline` package copy its directory to either to:
+
+- `$TEXHOME/tex/latex/`
+- `$TEXMFHOME/tex/latex/`
+- `~/texmf/tex/latex/`
+- `~/Library/texmf/tex/latex/`
+
+## Usage
+
+
+````Tex
+\begin{tikzpicture}[scale=2]
+ \draw[line width=1pt] (0,0) -- (0,4) -- (.5,4) -- (.5,5) -- (1.,5)
+ -- (1.,4) -- (1.5,4) -- (1.5,0) -- cycle;
+
+ \draw node (A) at (2.5,0) {};
+
+ \dimline[line style = {line width=0.7},
+ extension start length=-0.24,
+ extension end length=-0.24] {(A)}{($ (A) + (0,4) $)}{$4.0$};
+
+ \dimline[line style = {red, line width=0.7},
+ extension start length=0,
+ extension end length=0] {(0,2)}{(1.5, 2)}{ $\diameter 1.5$};
+
+ \dimline[label style={above=0.5ex,},
+ extension start path = {(0,6) (0,5.7) (0.5,5.4) (0.5,5.05)},
+ extension end path = {(1.5,6) (1.5,5.7) (1,5.4) (1,5.05)},]
+ {(0,6)}{(1.5,6)}{$\diameter 0.5$};
+\end{tikzpicture}
+````
+
+See [tikz-dimline-doc.pdf](tikz-dimline-doc.pdf) for further help.
+
+
+## Example
+
+Global dimension line
+
+![Dimension line example 1](dimline1.png)
+
+Normal arrow details
+
+![Dimension line example 2](dimline2.png)
+
+Reversed arrow details
+
+![Dimension line example 3](dimline3.png)
+
+
+
+## License
+
+This program is free software. It comes without any warranty, to the extent
+permitted by applicable law. You can redistribute it and/or modify it under
+the terms of the Do What The Fuck You Want To Public License, Version 2, as
+published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
+details.
diff --git a/graphics/pgf/contrib/tikz-dimline/dimline1.png b/graphics/pgf/contrib/tikz-dimline/dimline1.png
new file mode 100644
index 0000000000..e65a82dff1
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-dimline/dimline1.png
Binary files differ
diff --git a/graphics/pgf/contrib/tikz-dimline/dimline2.png b/graphics/pgf/contrib/tikz-dimline/dimline2.png
new file mode 100644
index 0000000000..af3af3b9e7
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-dimline/dimline2.png
Binary files differ
diff --git a/graphics/pgf/contrib/tikz-dimline/dimline3.png b/graphics/pgf/contrib/tikz-dimline/dimline3.png
new file mode 100644
index 0000000000..134f6f8ee8
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-dimline/dimline3.png
Binary files differ
diff --git a/graphics/pgf/contrib/tikz-dimline/tikz-dimline-doc.pdf b/graphics/pgf/contrib/tikz-dimline/tikz-dimline-doc.pdf
new file mode 100644
index 0000000000..b64b87f0d6
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-dimline/tikz-dimline-doc.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/tikz-dimline/tikz-dimline-doc.tex b/graphics/pgf/contrib/tikz-dimline/tikz-dimline-doc.tex
new file mode 100644
index 0000000000..63b3ca9b48
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-dimline/tikz-dimline-doc.tex
@@ -0,0 +1,422 @@
+
+\documentclass[a4paper]{article}
+
+\usepackage[all]{nowidow}
+\widowpenalty10000
+\clubpenalty10000
+
+
+%% See http://tex.stackexchange.com/questions/78334/print-system-information-in-latex-doc
+\RequirePackage{ifxetex}
+\ifxetex
+\RequirePackage{fontspec}
+\RequirePackage{xltxtra}
+\newcommand{\myxetex}{\XeLaTeX}
+\newcommand{\compilator}{\XeLaTeX{}}
+\newcommand{\cversion}{\the\XeTeXversion\XeTeXrevision}
+
+\else
+\RequirePackage[utf8]{inputenc}
+\newcommand{\myxetex}{\texttt{XeLaTeX}}
+\newcommand{\compilator}{\LaTeX{}}
+\makeatletter
+\newcommand{\cversion}{
+\ifnum\pdftexversion<100 %
+ \the\pdftexversion.\pdftexrevision
+ \else
+ \ifnum\pdftexversion<130 %
+ \expandafter\@car\the\pdftexversion\@empty\@nil.%
+ \expandafter\@cdr\the\pdftexversion\@empty\@nil
+ \pdftexrevision
+ \else
+ \expandafter\@car\the\pdftexversion\@empty\@nil.%
+ \expandafter\@cdr\the\pdftexversion\@empty\@nil.%
+ \pdftexrevision
+ \fi
+ \fi
+}
+\makeatother
+\fi
+
+\makeatletter
+\newcommand{\tcbversion}{\tcb@version}
+\makeatother
+
+\RequirePackage{etoolbox}
+
+\RequirePackage{minted}
+
+
+\RequirePackage{tikz}
+\usetikzlibrary{calc}
+\usetikzlibrary{fit,spy}
+\usetikzlibrary{intersections}
+
+\usepackage{pgfplots}
+
+\RequirePackage{tcolorbox}
+\tcbuselibrary{skins,listings}
+\tcbuselibrary{minted}
+\tcbuselibrary{documentation}
+
+%% Diameter
+\usepackage{ wasysym }
+
+\usepackage{tikz-dimline}
+
+
+%%\tikzset{every picture/.append style={scale=0.5}}
+%% \tikzset{global scale/.style={
+%% scale=0.5,
+%% every node/.style={scale=0.5}
+%% }
+%% }
+
+%\tcbset{listing engine=latex}
+\newminted[srcGrid]{latex}{baselinestretch=0.5,fontsize=\footnotesize}
+
+
+\newtcblisting{exampleB}[2][]{%
+ colframe=red!50!yellow!50!black,
+ colback=white,
+ coltitle=red!50!yellow!3!white,
+ bicolor,colbacklower=red!50!yellow!5!white,
+ fonttitle=\sffamily\bfseries,
+ center upper,
+ minted language=latex,
+ minted options={baselinestretch=0.5,fontsize=\scriptsize},
+ %%lefthand ratio=0.33,
+ %%sidebyside,
+ text and listing,
+ title=#2,#1}
+
+\newtcblisting{exampleA}[2][]{%
+ colframe=red!50!yellow!50!black,
+ colback=white,
+ coltitle=red!50!yellow!3!white,
+ bicolor,colbacklower=red!50!yellow!5!white,
+ fonttitle=\sffamily\bfseries,
+ center upper,
+ minted language=latex,
+ minted options={baselinestretch=0.5,fontsize=\scriptsize},
+ %%lefthand ratio=0.33,
+ %%sidebyside,
+ listing,
+ title=#2,#1}
+
+
+%% \newtcblisting{exampleA}[2][]{%
+%% colframe=red!50!yellow!50!black,
+%% colback=white,
+%% coltitle=red!50!yellow!3!white,
+%% bicolor,colbacklower=red!50!yellow!5!white,
+%% fonttitle=\sffamily\bfseries,
+%% sidebyside,text and listing,
+%% title=#2,#1}
+
+
+
+
+
+\BeforeBeginEnvironment{srcGrid}{%
+\begin{tcolorbox}[boxrule=0.5pt,left=1mm,width=\linewidth]}
+\AfterEndEnvironment{srcGrid}{\end{tcolorbox}}%
+
+
+
+
+
+%% \AtBeginEnvironment{exampleB}{}
+%% \AtEndEnvironment{exampleB}{}
+
+
+%% \BeforeBeginEnvironment{srcGrid}{%
+%% \begin{exampleB}[boxrule=0.5pt,left=1mm,width=\linewidth]{}}
+%% \AfterEndEnvironment{srcGrid}{\end{exampleB}}%
+
+
+
+%% Just to draw a help grid
+%% \helpgrid{Xa}{Ya}{Xb}{Yb}
+\makeatletter
+\newcommand{\helpgrid@do@nothing}[1]{#1}%
+\newcommand{\helpgrid}[4]{%
+ \pgfplotsifinaxis{%
+ \let\helpgrid@internal\pgfplotsextra%
+ }{%
+ \let\helpgrid@internal\helpgrid@do@nothing%
+ }%
+
+ \begin{scope}
+
+ \coordinate (a) at (#1,#2) {};
+ \coordinate (b) at (#3,#4) {};
+
+ \draw[step=1,gray!10,very thin] (a) grid (b);
+
+ \foreach \x in {#1,...,#3}
+ \node[anchor=north,gray!20] at (\x, 0) {\tiny{\x}};
+
+ \foreach \y in {#2,...,#4}
+ \node[anchor=east,gray!20] at (0, \y) {\texttt{\tiny{$\y$}}};
+ \end{scope}
+}%
+\makeatother
+
+
+\newcommand{\PGF}{\textsc{PGF}}
+\newcommand{\TikZ}{Ti\textcolor{orange}{\emph{k}}Z}
+
+
+
+\title{
+ \texttt{dimline}\\
+ Technical dimension lines using \PGF/\TikZ\\
+}
+\author{Sébastien Gross\\ \texttt{<seb•$\alpha\tau$•chezwam•$\partial\theta\tau$•org>}}
+\date{\csname ver@tikz-dimline.sty\endcsname}
+
+\begin{document}
+
+\maketitle
+
+
+\let\thefootnote\relax\footnotetext{This documentation was compiled on
+ {\platformname} using {\compilator} {\cversion}, {\PGF} {\pgfversion},
+ \texttt{tcolorbox} {\tcbversion} on {\today}.}
+
+
+Dimension lines are drawn segments that indicate the measurement of a
+feature. The line has an arrow at both ends to show that the dimension
+displayed covers the entire span of that line. The direction of the line
+(vertical, horizontal or diagonal) shows the direction of the
+measurement. Dimension lines are kept outside of the object illustrated,
+typically connected to other lines that display the area where that
+measurement applies. This keeps the illustration clear.
+
+\begin{tcolorbox}[title={Contents},fonttitle=\bfseries\Large,
+ colback=yellow!10!white,colframe=red!50!black,before=\par\bigskip\noindent]
+ \makeatletter
+ \@starttoc{toc}
+ \makeatother
+ %\tableofcontents
+\end{tcolorbox}
+
+
+\newpage
+
+
+
+\section{Overview}
+
+\begin{exampleB}{}
+
+\begin{tikzpicture}[scale=2]
+ \draw[line width=1pt] (0,0) -- (0,4) -- (.5,4) -- (.5,5) -- (1.,5)
+ -- (1.,4) -- (1.5,4) -- (1.5,0) -- cycle;
+
+ \draw node (A) at (2.5,0) {};
+
+ \dimline[line style = {line width=0.7},
+ extension start length=-0.24,
+ extension end length=-0.24] {(A)}{($ (A) + (0,4) $)}{$4.0$};
+
+ \dimline[line style = {red, line width=0.7},
+ extension start length=0,
+ extension end length=0] {(0,2)}{(1.5, 2)}{ $\diameter 1.5$};
+
+ \dimline[label style={above=0.5ex,},
+ extension start path = {(0,6) (0,5.7) (0.5,5.4) (0.5,5.05)},
+ extension end path = {(1.5,6) (1.5,5.7) (1,5.4) (1,5.05)},]
+ {(0,6)}{(1.5,6)}{$\diameter 0.5$};
+\end{tikzpicture}
+\end{exampleB}
+
+
+\let\thefootnote\relax\footnotetext{The \texttt{wasysym} package is required to have \texttt{\textbackslash diameter} command.}
+
+
+\newpage
+
+
+\section{Installation}
+
+To install the \verb"tkiz-dimline" package copy its directory to either to
+\begin{itemize}
+\item \verb"$TEXHOME/tex/latex/"
+\item \verb"$TEXMFHOME/tex/latex/"
+\item \verb"~/texmf/tex/latex/"
+\item \verb"~/Library/texmf/tex/latex/"
+\end{itemize}
+
+\section{Usage}
+
+\subsection{command}
+\begin{docCommand}{dimline}{\oarg{key path}\marg{start}\marg{end}\marg{label}}
+ Creates a new dimension line from \meta{start} to \meta{end} with
+ \meta{label}. An optional \meta{key path} can be used to customise the
+ dimension line.
+
+ This command has to be called within a \docAuxEnvironment*{tikzpicture}
+ environment.
+
+\end{docCommand}
+
+\subsection{options}
+\begin{docKey}{color}{=\meta{color}}{black}
+ Dimension line color.
+\end{docKey}
+\begin{docKey}{line style}{=\meta{style}}{not set}
+ Dimension line style, identical to {\PGF} line style.
+\end{docKey}
+\begin{docKey}{label style}{=\meta{style}}{not set}
+ Dimension label style, identical to {\PGF} label style.
+\end{docKey}
+
+\begin{docKey}{extension start length}{=\meta{size}}{1cm}
+ Length of the extention line at the start point.
+\end{docKey}
+
+\begin{docKey}{extension end length}{=\meta{size}}{1cm}
+ Identical to \refKey*{extension start length}, but for the end point.
+\end{docKey}
+
+\begin{docKey}{extension start angle}{=\meta{angle}}{-90}
+ Angle between the dimension line and the extention line at the start
+ point. You dont't want to change that value unless you really know what
+ you are doing. You would rather have a look to \refKey*{extension start
+ path} and \refKey*{extension end path}.
+\end{docKey}
+
+\begin{docKey}{extension end angle}{=\meta{angle}}{90}
+ Identical to \refKey*{extension start angle}, but for the end point.
+\end{docKey}
+
+\begin{docKey}{extension start style}{=\meta{style}}{not set}
+ Style for the extension line at the start point.
+\end{docKey}
+
+\begin{docKey}{extension end style}{=\meta{style}}{not set}
+ Identical to \refKey*{extension start style}, but for the end point.
+\end{docKey}
+
+\begin{docKey}{extension start path}{=\meta{path}}{not set}
+ Path (coordinates relative to the current
+ \docAuxEnvironment*{tkizpicture}) for the extension line at the start
+ point.
+\end{docKey}
+
+\begin{docKey}{extension end path}{=\meta{path}}{not set}
+ Identical to \refKey*{extension start path}, but for the end point.
+\end{docKey}
+
+
+\begin{docKey}{arrows}{=\meta{arrows spec}}{dimline-dimline}
+ Arrows used for the dimension line. \docAuxKey{dimline-dimline} is used
+ for standard arrows. Use \docAuxKey{dimeline reverse-dimline reverse} to
+ reverse the arrow heads.
+\end{docKey}
+
+
+
+\section{Examples}
+
+On following examples \docAuxCommand{helpgrid} is only used for a labeled
+grid. This not mandatory you can dicard this line. See source of this
+documentation to see how \docAuxCommand{helpgrid} command is defined.
+
+
+
+\subsection{Basic usage}
+
+This is a very simple usage. It just draws a dimension line (using default
+values) between 2 points with a label on it. Note that the dimension starts
+at the border of the side tick mark, not at the end of the arrow.
+
+\begin{exampleB}{}
+ \begin{tikzpicture}[spy using outlines={circle, magnification=25, size=6cm,
+ connect spies}]
+ \helpgrid{-1}{-1}{5}{4}
+ \draw[line width=0.01,color=red] plot[mark=+] coordinates{(3,3)} {};
+ \draw[line width=0.01,color=green] plot[mark=x] coordinates{(3,3)} {};
+ \dimline[line style = {line width=0.5}]{(0,0)}{(3,3)}{Label};
+ \spy [blue] on (2.975,2.975) in node [fill=white] at (6.5,1.5);
+ \end{tikzpicture}
+\end{exampleB}
+
+
+\subsection{Reverse arrows}
+
+Sometimes, shuch as for very small dimensions, you need to reverse the
+arrows. You can then use a \docAuxKey{dimeline reverse} arrow.
+
+\begin{exampleB}{}
+ \begin{tikzpicture}[spy using outlines={circle, magnification=25, size=6cm,
+ connect spies}]
+ \helpgrid{-1}{-1}{5}{4}
+ \draw[line width=0.01,color=red] plot[mark=+] coordinates{(3,3)} {};
+ \draw[line width=0.01,color=green] plot[mark=x] coordinates{(3,3)} {};
+
+ \dimline[line style = {line width=0.5,
+ arrows=dimline reverse-dimline reverse}]{(0,0)}{(3,3)}{Label};
+ \spy [blue] on (3.025,3.025) in node [fill=white] at (6.5,1.5);
+ \end{tikzpicture}
+\end{exampleB}
+
+\subsection{Styling your dimension lines}
+
+You can customize your dimension lines like any other \TikZ{} environment.
+\begin{exampleB}{}
+ \begin{tikzpicture}[scale=0.5]
+ \helpgrid{-1}{-1}{4}{7}
+ \draw (0,0) -- (0,4) -- (.5,4) -- (.5,5) -- (1.,5) -- (1.,4) -- (1.5,4) -- (1.5,0)
+ -- cycle;
+ \dimline[color=blue,
+ extension start length=-0.25, extension end length=-0.25]{(2.75,0)}{(2.75,4)}{4.0};
+ \dimline[color=red,
+ line style={arrows=dimline reverse-dimline reverse},
+ label style={above=0.8ex,font=\tiny},
+ extension start length=1,
+ extension end length=1]{(0.5,5.6)}{(1.0,5.6)}{0.5};
+ \end{tikzpicture}
+\end{exampleB}
+
+
+\subsection{Complex extension lines}
+
+This example shows you how to use both a \docAuxKey{extension start path}
+and \docAuxKey{extension end path}. This is useful if you want to enlarge a
+small dimension area.
+
+\begin{exampleB}{}
+ \begin{tikzpicture}[scale=0.5]
+ \helpgrid{-1}{-1}{4}{7}
+ \draw (0,0) -- (0,4) -- (.5,4) -- (.5,5) -- (1.,5) -- (1.,4) -- (1.5,4) -- (1.5,0)
+ -- cycle;
+
+ \draw[color=red] node (A) at (2.5,0) {} node [yshift=1ex,xshift=-1ex]
+ at (A) {\tiny{A}};
+ \dimline[color=blue,
+ line style = {line width=0.7},
+ extension start length=-0.24,
+ extension end length=-0.24] {(A)}{($ (A) + (0,4) $)}{4.0};
+ \dimline[label style={above=0.5ex, fill=blue!10,},
+ extension start path = {(0,6) (0,5.7) (0.5,5.4) (0.5,5.05)},
+ extension start style = { green },
+ extension end path = {(1.5,6) (1.5,5.7) (1,5.4) (1,5.05)},]
+ {(0,6)}{(1.5,6)}{0.5};
+ \draw[color=red,line width=0.01] plot[mark=x] coordinates{(A)} {};
+ \end{tikzpicture}
+\end{exampleB}
+
+\section{License}
+
+This program is free software. It comes without any warranty, to the extent
+permitted by applicable law. You can redistribute it and/or modify it under
+the terms of the Do What The Fuck You Want To Public License, Version 2, as
+published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
+details.
+
+
+
+\end{document}
diff --git a/graphics/pgf/contrib/tikz-dimline/tikz-dimline.sty b/graphics/pgf/contrib/tikz-dimline/tikz-dimline.sty
new file mode 100644
index 0000000000..e8d9750cec
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-dimline/tikz-dimline.sty
@@ -0,0 +1,189 @@
+%% Dimension line for LaTeX/TikZ
+%% Copyright © 2013 Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
+%%
+%% This file may be distributed and/or modified
+%%
+%% 1. under the LaTeX Project Public License and/or
+%% 2. under the WTF Public License.
+%%
+%%
+%% This simplify the creation drawing of dimension arrows.
+%%
+%%
+%% To install it copy the tango directory to either:
+%% - $TEXHOME/tex/latex/
+%% - ~/texmf/tex/latex/
+%% - ~/Library/texmf/tex/latex
+%%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{tikz-dimline}[2013/03/13 v1.0 initial version]
+
+\RequirePackage{tikz}
+\RequirePackage{pgfplots}
+\RequirePackage{ifthen}
+
+\usetikzlibrary{calc,decorations.markings,arrows}
+
+\makeatletter
+
+
+
+\pgfkeys {
+ /dimline/.cd,
+ execute style/.style = {#1},
+ execute macro/.style = {/dimline/execute style/.expand once=#1},
+}
+
+
+\newdimen\dimline@arrow@linewidth
+
+\pgfarrowsdeclare{dimline}{dimline}
+{
+ \arrowsize=1\pgflinewidth
+ \pgfarrowsleftextend{0\arrowsize}
+ \pgfarrowsrightextend{5\arrowsize}
+} {
+ \arrowsize=1\pgflinewidth
+ \pgfsetdash{}{0pt} % do not dash
+ % |
+ \pgfsetlinewidth{.5\arrowsize}
+ \pgfpathmoveto{\pgfpoint{4.75\arrowsize}{3\arrowsize}}
+ \pgfpathlineto{\pgfpoint{4.75\arrowsize}{-3\arrowsize}}
+ \pgfusepathqstroke
+ % >
+ \pgfsetlinewidth{0.01pt}
+ \pgfpathmoveto{\pgfpoint{4.5\arrowsize}{0pt}}
+ \pgfpathlineto{\pgfpoint{-3\arrowsize}{2\arrowsize}}
+ \pgfpathlineto{\pgfpoint{-3\arrowsize}{-2\arrowsize}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+
+\pgfarrowsdeclare{dimline reverse}{dimline reverse}
+{
+ \arrowsize=1\pgflinewidth
+ \pgfarrowsleftextend{-5\arrowsize}
+ \pgfarrowsrightextend{0\arrowsize}
+} {
+ \arrowsize=1\pgflinewidth
+ \pgfsetdash{}{0pt} % do not dash
+ % |
+ \pgfsetlinewidth{0.5\arrowsize}
+ \pgfpathmoveto{\pgfpoint{-0.25\arrowsize}{3\arrowsize}}
+ \pgfpathlineto{\pgfpoint{-0.25\arrowsize}{-3\arrowsize}}
+ \pgfusepathqstroke
+ % >
+ \pgfsetlinewidth{0.01pt}
+ \pgfpathmoveto{\pgfpoint{0pt}{0pt}}
+ \pgfpathlineto{\pgfpoint{7.5\arrowsize}{2\arrowsize}}
+ \pgfpathlineto{\pgfpoint{7.5\arrowsize}{-2\arrowsize}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+
+% measure lenght
+% http://tex.stackexchange.com/questions/123913
+
+
+\newcommand{\dimline@do@nothing}[1]{#1}%
+% http://tex.stackexchange.com/questions/58283/tikz-how-to-determine-the-vector-between-two-co-ordinates
+
+
+% #1: optional keys parameters
+% #2: start point
+% #3: end point
+% #4: text
+\newcommand{\dimline}[4][]{%
+
+ \pgfplotsifinaxis{%
+ \let\dimline@internal\pgfplotsextra%
+ }{%
+ \let\dimline@internal\dimline@do@nothing%
+ }%
+
+ \dimline@internal{
+ \pgfkeys{
+ dimline/.is family,
+ dimline,
+ color/.initial = black,
+ extension start length/.initial=1cm,
+ extension end length/.initial=1cm,
+ extension start angle/.initial=-90,
+ extension end angle/.initial=90,
+ line style/.initial = {},
+ label style/.initial = {},
+ extension style/.initial = {},
+ extension start style/.initial = {},
+ extension start path/.initial = {},
+ extension end style/.initial = {},
+ extension end path/.initial = {},
+ #1,
+ line style/.get = \dimline@line@style,
+ label style/.get = \dimline@label@style,
+ extension style/.get = \dimline@extension@style,
+ extension start style/.get = \dimline@extension@start@style,
+ extension start path/.get = \dimline@extension@start@path,
+ extension end style/.get = \dimline@extension@end@style,
+ extension end path/.get = \dimline@extension@end@path,
+ }
+
+ \begin{scope} [
+ line/.style = {
+ color=\pgfkeysvalueof{/dimline/color},
+ arrows=dimline-dimline,
+ /dimline/execute macro = \dimline@line@style,
+ },
+ extension/.style = {
+ color=\pgfkeysvalueof{/dimline/color}!40, line width=0.01,
+ /dimline/execute macro = \dimline@extension@style,
+ },
+ extension start/.style = {
+ extension,
+ /dimline/execute macro = \dimline@extension@start@style
+ },
+ extension end/.style = {
+ extension,
+ /dimline/execute macro = \dimline@extension@end@style,
+ },
+ label/.style = {
+ fill=white, align=center, sloped=true, pos=0.5,
+ /dimline/execute macro = \dimline@label@style
+ },
+ ]
+
+ \coordinate (a) at #2 {};
+ \coordinate (b) at #3 {};
+
+ \ifthenelse{\equal{\dimline@extension@start@path}{}}{
+ \coordinate (a to b) at ($(a)!\pgfkeysvalueof{/dimline/extension start length}!\pgfkeysvalueof{/dimline/extension start angle}:(b)$);
+ \draw [extension start] (a.center) -- (a to b);
+ } {
+ \draw [extension start] plot coordinates {\dimline@extension@start@path};
+ }
+
+ \ifthenelse{\equal{\dimline@extension@end@path}{}}{
+ \coordinate (b to a) at ($(b)!\pgfkeysvalueof{/dimline/extension end length}!\pgfkeysvalueof{/dimline/extension end angle}:(a)$);
+ \draw [extension end] (b.center) -- (b to a);
+ } {
+ \draw [extension end] plot coordinates {\dimline@extension@end@path};
+ }
+
+ \draw[line] (a.center) -- (b.center) node[label] {#4};
+ \end{scope}
+ }
+}
+
+
+
+\@ifclassloaded{beamer}{%
+ \renewcommand<>{\dimline}[4][]{\only#5{\beameroriginal{\dimline}[#1]{#2}{#3}{#4}}}
+}
+\makeatother
+
+
+\endinput
+%% tikz-dimline.sty ends here.
+