Debian Codegraph @

texmf-dist/tex/latex/pgfornament/tikzrput.sty

raw
1 % pgflibraryam.code.tex (utf8 encoding)
2 % Copyright 2020 Alain Matthes
3 % This work may be distributed and/or modified under the
4 % conditions of the LaTeX Project Public License, either version 1.3
5 % of this license or (at your option) any later version.
6 % The latest version of this license is in
7 % http://www.latex-project.org/lppl.txt
8 % and version 1.3 or later is part of all distributions of LaTeX
9 % version 2005/12/01 or later.
10 %
11 % This work has the LPPL maintenance status “maintained”.
12 %
13 % The Current Maintainer of this work is Alain Matthes.
14
15 \typeout{2020/04/06 1.1 pgflibraryam.code.tex}
16 \NeedsTeXFormat{LaTeX2e}%
17 \RequirePackage{tikz,iftex}%
18 \ProvidesPackage{tikzrput}[2020/04/04 v1.1 rput for tikz]%
19 \edef\tikzrputPtVirCode{\the\catcode`\;}
20 \edef\tikzrputAtCode{\the\catcode`\@}
21 \edef\tikzrputTwoPtCode{\the\catcode`\:}
22 \catcode`\;=12\relax
23 \catcode`\:=12\relax
24 \catcode`\@=11\relax
25
26 \newif\ifrput@polar\rput@polarfalse
27 \def\rput@empty{}
28
29 \def\rput@parsecoordinate#1{%
30 \rput@getseparator#1,\@nil
31 \ifrput@polar
32 \rput@getfrompolar#1\@nil
33 \fi
34 }%
35 \def\rput@getseparator#1,#2\@nil{%
36 \ifx\rput@empty#2\rput@empty%
37 \rput@polartrue
38 \else
39 \rput@polarfalse
40 \fi
41 }%
42 \def\rput@getfrompolar#1;#2\@nil{%
43 \def\pos@rput{#1:#2}%
44 }%
45
46 \def\rput@pos@ {\def\rput@anchor{center}}
47 \def\rput@pos@B {\def\rput@anchor{base}}
48 \def\rput@pos@Br {\def\rput@anchor{base east}}
49 \def\rput@pos@Bl {\def\rput@anchor{base west}}
50 \def\rput@pos@tr {\def\rput@anchor{north east}}
51 \def\rput@pos@tl {\def\rput@anchor{north west}}
52 \def\rput@pos@br {\def\rput@anchor{south east}}
53 \def\rput@pos@bl {\def\rput@anchor{south west}}
54 \def\rput@pos@t {\def\rput@anchor{north}}
55 \def\rput@pos@b {\def\rput@anchor{south}}
56 \def\rput@pos@r {\def\rput@anchor{east}}
57 \def\rput@pos@l {\def\rput@anchor{west}}
58 \let\rput@pos@mc\rput@pos@
59 \let\rput@pos@rB\rput@pos@Br
60 \let\rput@pos@lB\rput@pos@Bl
61 \let\rput@pos@rt\rput@pos@tr
62 \let\rput@pos@lt\rput@pos@tl
63 \let\rput@pos@rb\rput@pos@br
64 \let\rput@pos@lb\rput@pos@bl
65 \newbox\mybox
66 \ifpdf% Pablo 04/2020
67 \pgfutil@ifundefined{rput}{%
68 \tikzset{rput style/.style={}}
69 \def\rput{\pgfutil@ifnextchar[{\rput@i}{%
70 \global\edef\opt@rput{}\rput@ii}}%
71 \def\rput@i[#1]{\global\edef\opt@rput{#1}\rput@ii}%
72 \def\rput@ii{\pgfutil@ifnextchar({%
73 \def\angle@rput{0}\rput@iv}{\rput@iii}}%
74 \def\rput@iii#1{%
75 \ifx\rput@empty#1\rput@empty\def\angle@rput{0}\else%
76 \def\angle@rput{#1}\fi%
77 \pgfutil@ifnextchar({\rput@iv}{\rput@iv(0,0)}}%,
78 \def\rput@iv(#1){\def\pos@rput{#1}%
79 \rput@parsecoordinate{#1}%
80 \rput@v}%
81 \def\rput@v#1{%
82 \sbox\mybox{%
83 \pgfinterruptpicture#1\endpgfinterruptpicture}%
84 \begingroup
85 \tikzifinpicture{%
86 \let\begin@my@tikz@env\scope
87 \let\end@my@tikz@env\endscope
88 }{%
89 \let\begin@my@tikz@env\tikzpicture
90 \let\end@my@tikz@env\endtikzpicture
91 }%
92 \@nameuse{rput@pos@\opt@rput}%
93 \begin{pgfinterruptboundingbox}%
94 \begin@my@tikz@env[overlay]
95 \path (0,0)--(\pos@rput);
96 \protected@edef\rput@temp{%
97 \noexpand\node[inner sep = 0pt,
98 anchor = \rput@anchor,
99 rotate = \angle@rput,
100 rput style]}%
101 \rput@temp at (\pos@rput){\box\mybox};
102 \end@my@tikz@env
103 \end{pgfinterruptboundingbox}%
104 \endgroup
105 \ignorespaces
106 }%
107 }{%
108 }%
109 \fi
110 \catcode`\;=\tikzrputPtVirCode\relax
111 \catcode`\@=\tikzrputAtCode\relax
112 \catcode`\:=\tikzrputTwoPtCode\relax
113 \endinput