Skip to content

Commit

Permalink
Add Loop arrow and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Qrrbrbirlbel committed Apr 1, 2023
1 parent 910e89e commit d98d65d
Show file tree
Hide file tree
Showing 11 changed files with 191 additions and 36 deletions.
10 changes: 6 additions & 4 deletions doc/tikz-ext-manual-en-library-calendar-plus.tex
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ \subsection{Week numbering (ISO~8601)}
%
\begin{codeexample}[preamble={\usetikzlibrary{ext.calendar-plus}}]
\tikz
\calendar [week list, month label above centered,
dates=2022-07-01 to 2022-07-31,
week label left,
every week/.append style={gray!50!black,font=\sffamily}];
\calendar[
week list, month label above centered,
dates=2022-07-01 to 2022-07-31,
week label left,
every week/.append style={
gray!50!black, font=\sffamily}];
\end{codeexample}
%
\end{stylekey}
Expand Down
2 changes: 1 addition & 1 deletion doc/tikz-ext-manual-en-library-misc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ \subsection{\tikzname}
\begin{multicols}{2}
\begin{key}{/tikz/reverse clip=\meta{direction} (default counter clockwise)}
This key installs a very big rectangle which is either constructed
|counter clockwise| (like the \referencePathOperationandIndexO{circle}
\texttt{counter clockwise} (like the \referencePathOperationandIndexO{circle}
path operation) or |clockwise|.
\end{key}
\begin{key}{/tikz/clip rule=\meta{direction} (default even odd)}
Expand Down
15 changes: 8 additions & 7 deletions doc/tikz-ext-manual-en-library-nodes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ \subsection{Pic as a node}
for example as a label.
\begin{codeexample}[preamble=\usetikzlibrary{ext.nodes, ext.misc}]
\begin{tikzpicture}[
slsl/.pic={\draw (-2pt, 1.5pt) -- (2pt, .5pt)
(2pt, -1.5pt) -- (-2pt, -.5pt);}]
\node[draw, minimum width=3cm, minimum height=1cm,
label={[pic ] east:slsl},
label={[pic, rotate=90] north:slsl},
label={[pic ] west:slsl},
label={[pic, rotate=-90]south:slsl}]{};
slsl/.pic={\draw(-2pt, 1.5pt)--( 2pt, .5pt)
( 2pt,-1.5pt)--(-2pt,-.5pt);}]
\node[
draw, minimum width=3cm, minimum height=1cm,
label={[pic ] east:slsl},
label={[pic, rotate= 90]north:slsl},
label={[pic ] west:slsl},
label={[pic, rotate=-90]south:slsl}]{};
\end{tikzpicture}
\end{codeexample}
\end{key}
Expand Down
1 change: 1 addition & 0 deletions doc/tikz-ext-manual-en-main-body.tex
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ \section*{Changelog}\addcontentsline{toc}{section}{Changelog}
Version 0.5.1
\begin{itemize}
\item \addPGF{arrows}
\item Bugfix to |ext.pgfkeys-plus|. \cite{GH6}
\end{itemize}
Version 0.5
\begin{itemize}
Expand Down
21 changes: 4 additions & 17 deletions doc/tikz-ext-manual-en-main-preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,6 @@
\tracinglostchars=3

\input{pgfmanual-en-macros}
%\newenvironment{pgfkeyslibrary}[1]{% from pgfmanual-en-macros
% \begin{pgfmanualentry}%
% \pgfmanualentryheadline{%
% \pgfmanualpdflabel{#1}{}%
% \textbf{pgfkeys Library} \texttt{\declare{#1}}}%
% \index{#1@\protect\texttt{#1} pgfkeys library}%
% \index{pgfkeys Libraries!#1@\protect\texttt{#1}}%
% \vskip.25em
% {{\ttfamily\char`\\usepgfkeyslibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}}\\
% {{\ttfamily\char`\\usepgfkeyslibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}}\\[.5em]%
% \pgfmanualbody
%}%
%{%
% \end{pgfmanualentry}%
%}

\usepackage{unicode-math}
\setmathfont[Scale=MatchUppercase]{libertinusmath-regular.otf}
Expand Down Expand Up @@ -542,6 +527,8 @@
\tikz [baseline,>={#1[#2]}] \draw [line
width=1.6pt,->] (0,.5ex) -- (3em,.5ex); \\
}
%\def\arrowexampledup[#1]{\arrowexample[{#1] \currentarrowtype[}]}
%\def\arrowexampledupdot[#1]{\arrowexample[{#1] . \currentarrowtype[}]}
\def\manual@action@radius#1/#2/#3\relax{%
\draw [red,|<->|,semithick] ([xshift=-#1,yshift=#1]current bounding
box.north east) -- node [above, overlay] {\texttt{radius}} ++(-#1,0);
}
\makeatother
34 changes: 31 additions & 3 deletions doc/tikz-ext-manual-en-pgf-arrows.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
% 2. under the GNU Free Documentation License.
%

\section{Untipped Arrow Tips}
\section{Arrow Tips}
\label{pgflibrary:arrows}
\tikzset{external/export/.try=false}%
\begin{pgflibrary}{ext.arrows}
This library adds arrows to \pgfname/\tikzname.

\inspiration{ArrowLoop-Q,ArrowHug-Q,ArrowUntipped1-Q,ArrowUntipped2-Q}
{ArrowLoop-A,ArrowHug-A,ArrowUntipped1-A,ArrowUntipped2-A}
\end{pgflibrary}
\begin{multicols}{2}
The arrow tips of the \referenceLibraryandIndexO{arrows.meta} library always
Expand Down Expand Up @@ -174,7 +177,7 @@ \subsubsection{Special Arrow Tips}
\end{arrowtipsimple}

\subsection{Untipped}
\subsubsection{Untipped Arrow Tips}
\subsubsection{Barbed Arrow Tips}
\begin{arrowtipsimple}{Centered Arc Barb}
This is a variant of the \referenceArrowtipandIndexO{Arc Barb} tip.
The arrow tip will protrude half its line width over the original end of the path.
Expand Down Expand Up @@ -225,7 +228,9 @@ \subsection{Original Arrow Tips}
Use the \referenceKeyandIndexO[/pgf/arrow keys/]{length} key to set up the radius of that circle.

\begin{codeexample}[preamble=\usepgflibrary{ext.arrows}]
\begin{tikzpicture}[dot/.style 2 args={shape=circle, outer sep=+0pt, fill={#1}, minimum size={#2}}]
\begin{tikzpicture}[
dot/.style 2 args={
shape=circle, outer sep=+0pt, fill={#1}, minimum size={#2}}]
\node[dot={red} {2cm}] (A) {};
\node[dot={blue}{3cm}] (B) at (6,0) {};
\draw[
Expand All @@ -235,6 +240,29 @@ \subsection{Original Arrow Tips}
\end{tikzpicture}
\end{codeexample}
\end{arrowtipsimple}

\begin{arrowtip}{Loop}{
This arrow tip attaches a one-sided loop to the end of the line.
The |length| refers to the length of the whole tip while the |radius|
specifies the radius of the three rounded corners.
The width of the tip is twice the |length| (but can't specified independently).
}{length=1.5cm,radius=3.5mm}{length=1.5cm,radius=3.5mm}
\begin{arrowexamples}
\arrowexample[]
\arrowexampledup[sep]
\arrowexampledupdot[sep]
\arrowexample[open]
\arrowexample[open, swap]
\arrowexample[length=5pt,radius=0pt]
\arrowexample[reversed]
\arrowexample[slant=.3]
\arrowexample[red]
\end{arrowexamples}
%
The following options have no effect: |harpoon|, |round|, |line width|.

On |double| lines, the arrow tip will not look correct.
\end{arrowtip}
\end{multicols}
\tikzset{external/export/.try=true}%
\endinput
6 changes: 4 additions & 2 deletions doc/tikz-ext-manual-en-pgf-shapes-circlearrow.tex
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ \section{Shape: Circle Arrow}
circle arrow turn left west, shape example]
{Circle Arrow\vrule width 1pt height 2cm};
\foreach \anchor/\placement in
{north west/above left, north/above, north east/above right,
{north west/above left, north/above,
north east/above right,
west/left, center/above, east/right,
mid west/right, mid/above, mid east/left,
base west/left, base/below, base east/right,
south west/below left, south/below, south east/below right,
south west/below left, south/below,
south east/below right,
text/left, 10/right, 130/above}
\draw[shift=(s.\anchor)] plot[mark=x] coordinates{(0,0)}
node[\placement] {\scriptsize\texttt{(s.\anchor)}};
Expand Down
4 changes: 2 additions & 2 deletions doc/tikz-ext-manual-en-pgf-trans.tex
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ \subsection{Using built-in transformations}

\begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}]
\begin{tikzpicture}
\draw[help lines] (-0.25, -.25) grid (3.25, 1.25);
\draw[help lines] (-.25, -.25) grid (3.25, 1.25);
\draw[-latex] (0,0) .. controls (.5,1) .. (1,1);

\draw[dashed] (1.5, -.25) -- (1.5, 1.25);
Expand All @@ -79,7 +79,7 @@ \subsection{Using built-in transformations}

\begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}]
\begin{tikzpicture}
\draw[help lines] (-0.25, -.25) grid (3.25, 1.25);
\draw[help lines] (-.25, -.25) grid (3.25, 1.25);
\draw[-latex] (0,0) .. controls (.5,1) .. (1,1);

\draw[dashed] (1.5, -.25) -- (1.5, 1.25);
Expand Down
103 changes: 103 additions & 0 deletions doc/tikz-ext-manual.bib
Original file line number Diff line number Diff line change
Expand Up @@ -494,4 +494,107 @@ @Online{UncRectCD2-Q
year = {2022},
}

'
@Software{GH6,
abstract = {{Latest version of ext.misc on CTAN appears to have a typo}},
author = {marmotghost},
month = mar,
title = {Latest version of ext.misc on CTAN appears to have a typo},
url = {https://github.com/Qrrbrbirlbel/tikz-extensions/issues/6},
urldate = {2023-04-01},
year = {2023},
}

'
@Online{ArrowLoop-Q,
author = {{IV}, Edgar A. Bering},
file = {Snapshot:https\://tex.stackexchange.com/questions/565010/set-the-color-of-a-tikz-cd-glyph-arrow-tip-with-xelatex/681474#681474:text/html},
month = oct,
title = {Set the color of a tikz-cd Glyph arrow tip with xelatex},
titleaddon = {{TeX} - {LaTeX} Stack Exchange},
url = {https://tex.stackexchange.com/q/565010/16595},
urldate = {2023-04-01},
year = {2020},
}

@Online{ArrowLoop-A,
author = {Qrrbrbirlbel},
file = {Snapshot:https\://tex.stackexchange.com/questions/565010/set-the-color-of-a-tikz-cd-glyph-arrow-tip-with-xelatex/681474#681474:text/html},
month = apr,
title = {Answer to \enquote{Set the color of a tikz-cd Glyph arrow tip with xelatex}},
titleaddon = {{TeX} - {LaTeX} Stack Exchange},
url = {https://tex.stackexchange.com/a/681474/16595},
urldate = {2023-04-01},
year = {2023},
}

'
@Online{ArrowHug-Q,
author = {{DC}, Alejandro},
file = {Snapshot:https\://tex.stackexchange.com/questions/241074/better-fitting-line-to-node-in-tikz/241303#241303:text/html},
month = apr,
title = {Better fitting line to node in {TiKZ}},
titleaddon = {{TeX} - {LaTeX} Stack Exchange},
url = {https://tex.stackexchange.com/q/241074/16595},
urldate = {2023-04-01},
year = {2015},
}

@Online{ArrowHug-A,
author = {Qrrbrbirlbel},
file = {Snapshot:https\://tex.stackexchange.com/questions/241074/better-fitting-line-to-node-in-tikz/241303#241303:text/html},
month = apr,
title = {Answer to \enquote{Better fitting line to node in {TiKZ}}},
titleaddon = {{TeX} - {LaTeX} Stack Exchange},
url = {https://tex.stackexchange.com/a/241303/16595},
urldate = {2023-04-01},
year = {2015},
}

'
@Online{ArrowUntipped1-Q,
author = {Christian},
file = {Snapshot:https\://tex.stackexchange.com/questions/111051/tikz-arrow-tip-is-displaced?noredirect=1&lq=1:text/html},
month = apr,
title = {{TikZ} arrow tip is displaced},
titleaddon = {{TeX} - {LaTeX} Stack Exchange},
url = {https://tex.stackexchange.com/q/111051/16595},
urldate = {2023-04-02},
year = {2013},
}

@Online{ArrowUntipped1-A,
author = {Qrrbrbirlbel},
file = {Snapshot:https\://tex.stackexchange.com/questions/111051/tikz-arrow-tip-is-displaced?noredirect=1&lq=1:text/html},
month = apr,
title = {Answer to \enquote{{TikZ} arrow tip is displaced}},
titleaddon = {{TeX} - {LaTeX} Stack Exchange},
url = {https://tex.stackexchange.com/a/111053/16595},
urldate = {2023-04-02},
year = {2013},
}

'
@Online{ArrowUntipped2-Q,
author = {Hlavacek, Jan},
file = {Snapshot:https\://tex.stackexchange.com/questions/11871/modifying-and-o-style-tikz-arrows-so-that-they-are-centered-at-the-end-of?noredirect=1&lq=1:text/html},
month = feb,
title = {Modifying \texttt{*} and \texttt{o} style tikz arrows so that they are centered at the end of line},
titleaddon = {{TeX} - {LaTeX} Stack Exchange},
url = {https://tex.stackexchange.com/q/11871/16595},
urldate = {2023-04-02},
year = {2011},
}

@Online{ArrowUntipped2-A,
author = {Qrrbrbirlbel},
file = {Snapshot:https\://tex.stackexchange.com/questions/11871/modifying-and-o-style-tikz-arrows-so-that-they-are-centered-at-the-end-of?noredirect=1&lq=1:text/html},
month = sep,
title = {Answer to \enquote{Modifying \texttt{*} and \texttt{o} style tikz arrows so that they are centered at the end of line}},
titleaddon = {{TeX} - {LaTeX} Stack Exchange},
url = {https://tex.stackexchange.com/a/656241/16595},
urldate = {2023-04-02},
year = {2022},
}

@Comment{jabref-meta: databaseType:bibtex;}
Binary file modified doc/tikz-ext-manual.pdf
Binary file not shown.
31 changes: 31 additions & 0 deletions tex/generic/tikz-ext/pgflibraryext.arrows.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,35 @@
\pgfpathclose
\pgfusepathqfill
}
}

\pgfqkeys{/pgf/arrow keys}{radius/.style={/pgf/arrow keys/inset={#1}}}
\pgfdeclarearrow{
name = Loop,
parameters = {\the\pgfarrowlength,\the\pgfarrowinset,\ifpgfarrowopen o\fi},
defaults = {length = +3pt +1 +0, inset = +.75pt +1 +0},
setup code =
\ifdim\pgfarrowlength<\dimexpr2\pgfarrowinset+\pgflinewidth\relax
\pgfarrowlength\dimexpr2\pgfarrowinset+\pgflinewidth\relax
\fi
\pgfarrowssettipend{\pgfarrowlength}%
\pgfarrowssetlineend{.5\pgflinewidth}%
\pgfarrowssavethe\pgfarrowlength
\pgfarrowssavethe\pgfarrowinset,
drawing code={%
\pgfsetroundcap
\pgfpathmoveto{\pgfqpoint{.5\pgflinewidth}{0pt}}%
\pgfpathlineto{\pgfqpoint{\dimexpr\pgfarrowlength-.5\pgflinewidth-\pgfarrowinset}
{0pt}}%
\pgfpatharc{+-90}{+0}{+\pgfarrowinset}%
\pgfpathlineto{\pgfqpoint{\dimexpr\pgfarrowlength-.5\pgflinewidth}
{\dimexpr\pgfarrowlength-.5\pgflinewidth-\pgfarrowinset}}%
\pgfpatharc{+0}{+90}{+\pgfarrowinset}%
\pgfpathlineto{\pgfqpoint{\dimexpr\pgfarrowinset+.5\pgflinewidth}
{\dimexpr\pgfarrowlength-.5\pgflinewidth}}%
\pgfpatharc{+90}{+180}{+\pgfarrowinset}%
\pgfpathlineto{\pgfqpoint{\dimexpr\pgfarrowinset+.5\pgflinewidth-\pgfarrowinset}
{\dimexpr-\pgfarrowlength+.5\pgflinewidth}}%
\ifpgfarrowopen\pgfusepathqstroke\else\pgfusepathqfillstroke\fi
}
}

0 comments on commit d98d65d

Please sign in to comment.