Debian Codegraph @

texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryquotes.code.tex

raw
1 % Copyright 2018 by Till Tantau
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Public License.
7 %
8 % See the file doc/generic/pgf/licenses/LICENSE for more details.
9
10 \ProvidesFileRCS{tikzlibraryquotes.code.tex}
11
12 \def\tikz@quote@parser#1{\tikz@quote@@parser#1\pgf@stop}%
13 \def\tikz@quote@@parser"#1"{%
14 \pgfutil@ifnextchar\bgroup{%
15 \tikz@quote@@parser@group{#1}}{%
16 \pgfutil@ifnextchar'{%
17 \tikz@quote@@parser@apo{#1}}{%
18 \tikz@quote@@parser@normal{#1}}}}%
19 \def\tikz@quote@@parser@apo#1'{%
20 \pgfutil@ifnextchar\bgroup{\tikz@quote@@parser@apo@group{#1}}{\tikz@quote@@parser@apo@normal{#1}}}%
21 \def\tikz@quote@@parser@group#1#2#3\pgf@stop{%
22 \expandafter\def\expandafter\tikz@temp\expandafter{\tikz@quotes@as{#1}{#2}}%
23 \expandafter\pgfkeysalso\expandafter{\tikz@temp}%
24 }%
25 \def\tikz@quote@@parser@normal#1#2\pgf@stop{%
26 \expandafter\def\expandafter\tikz@temp\expandafter{\tikz@quotes@as{#1}{#2}}%
27 \expandafter\pgfkeysalso\expandafter{\tikz@temp}%
28 }%
29 \def\tikz@quote@@parser@apo@group#1#2#3\pgf@stop{%
30 \expandafter\def\expandafter\tikz@temp\expandafter{\tikz@quotes@as{#1}{',#2}}%
31 \expandafter\pgfkeysalso\expandafter{\tikz@temp}%
32 }%
33 \def\tikz@quote@@parser@apo@normal#1#2\pgf@stop{%
34 \expandafter\def\expandafter\tikz@temp\expandafter{\tikz@quotes@as{#1}{',#2}}%
35 \expandafter\pgfkeysalso\expandafter{\tikz@temp}%
36 }%
37
38 \pgfkeys{/handlers/first char syntax=true}%
39
40 \def\tikz@enable@node@quotes{%
41 \pgfkeyssetvalue{/handlers/first char syntax/\expandafter\meaning\string"}{\tikz@quote@parser}%
42 \let\tikz@quotes@as\tikz@node@quotes@as%
43 }%
44 \def\tikz@enable@edge@quotes{%
45 \pgfkeyssetvalue{/handlers/first char syntax/\expandafter\meaning\string"}{\tikz@quote@parser}%
46 \let\tikz@quotes@as\tikz@edge@quotes@as%
47 }%
48 \def\tikz@enable@pic@quotes{%
49 \pgfkeyssetvalue{/handlers/first char syntax/\expandafter\meaning\string"}{\tikz@quote@parser}%
50 \let\tikz@quotes@as\tikz@pic@quotes@as%
51 }%
52
53 \tikzset{
54 node quotes mean/.code={\def\tikz@node@quotes@as##1##2{#1}},
55 edge quotes mean/.code={\def\tikz@edge@quotes@as##1##2{#1}},
56 pic quotes mean/.code={\def\tikz@pic@quotes@as##1##2{#1}},
57 quotes mean pin/.style={node quotes mean={
58 pin={[direction shorthands,every pin quotes/.try,##2]##1}}},
59 quotes mean label/.style={node quotes mean={
60 label={[direction shorthands,every label quotes/.try,##2]##1}}},
61 quotes mean label,
62 edge quotes mean={edge node={node [every edge quotes,#2]{#1}}},
63 pic quotes mean={pic text={#1},pic text options={every pic quotes/.try,#2}},
64 every edge quotes/.style={auto},
65 direction shorthands/.code={%
66 \pgfkeyslet{/tikz/centered/.@cmd}\tikz@label@@centered
67 \pgfkeyslet{/tikz/above/.@cmd}\tikz@label@@above
68 \pgfkeyslet{/tikz/below/.@cmd}\tikz@label@@below
69 \pgfkeyslet{/tikz/left/.@cmd}\tikz@label@@left
70 \pgfkeyslet{/tikz/right/.@cmd}\tikz@label@@right
71 \pgfkeyslet{/tikz/above left/.@cmd}\tikz@label@@above@left
72 \pgfkeyslet{/tikz/above right/.@cmd}\tikz@label@@above@right
73 \pgfkeyslet{/tikz/below left/.@cmd}\tikz@label@@below@left
74 \pgfkeyslet{/tikz/below right/.@cmd}\tikz@label@@below@right
75 }
76 }%
77
78 \def\tikz@label@@centered#1\pgfeov{\pgfkeysalso{label position=center,pin position=center}}%
79 \def\tikz@label@@above#1\pgfeov{\pgfkeysalso{label position=90,pin position=90}}%
80 \def\tikz@label@@below#1\pgfeov{\pgfkeysalso{label position=-90,pin position=-90}}%
81 \def\tikz@label@@left#1\pgfeov{\pgfkeysalso{label position=180,pin position=180}}%
82 \def\tikz@label@@right#1\pgfeov{\pgfkeysalso{label position=0,pin position=0}}%
83 \def\tikz@label@@above@left#1\pgfeov{\pgfkeysalso{label position=135,pin position=135}}%
84 \def\tikz@label@@below@left#1\pgfeov{\pgfkeysalso{label position=-135,pin position=-135}}%
85 \def\tikz@label@@above@right#1\pgfeov{\pgfkeysalso{label position=45,pin position=45}}%
86 \def\tikz@label@@below@right#1\pgfeov{\pgfkeysalso{label position=-45,pin position=-45}}%
87
88
89
90 \endinput