Debian Codegraph @

texmf-dist/tex/latex/tikz-nfold/tikzlibrarynfold.code.tex

raw
1 %% tikzlibrarynfold.code.tex
2 %% Copyright 2023 Jonathan Schulz
3 %
4 % This work may be distributed and/or modified under the
5 % conditions of the LaTeX Project Public License, either version 1.3c
6 % of this license or (at your option) any later version.
7 % The latest version of this license is in
8 % http://www.latex-project.org/lppl.txt
9 % and version 1.3c or later is part of all distributions of LaTeX
10 % version 2008-05-04 or later.
11 %
12 % This work has the LPPL maintenance status 'maintained'.
13 %
14 % The Current Maintainer of this work is Jonathan Schulz.
15 %
16 % This work consists of the files
17 % pgflibrarybezieroffset.code.tex, pgflibrarynfold.code.tex, pgflibraryoffsetpath.code.tex, tikz-nfold-doc.tex, tikzlibrarynfold.code.tex, tikz-nfold-doc.tex, and tikz-nfold-doc.pdf.
18 %
19 %
20 % A commented version of this file can be found on https://github.com/jonschz/tikz-nfold .
21 %
22
23
24 \usepgflibrary{nfold}
25 \usetikzlibrary{arrows.meta}
26
27 \tikzset{
28 nfold/.code={
29 \edef\pgf@tmp{\noexpand\pgfkeys{/pgf/nfold=#1}}
30 \expandafter\expandafter\expandafter\def%
31 \expandafter\expandafter\expandafter\tikz@double@setup%
32 \expandafter\expandafter\expandafter{\expandafter\tikz@double@setup\pgf@tmp}
33 },
34 nfold/.default=2,
35 scaling nfold/.code={%
36 \pgfscope%
37 \tikz@double@setup
38 \pgf@nfold@compute@widths@from@double
39 \pgf@y=2\pgf@y
40 \c@pgf@counta=#1
41 \advance\c@pgf@counta by -1\relax
42 \global\pgf@y=\c@pgf@counta\pgf@y
43 \endpgfscope
44 \tikzset{
45 double distance between line centers=\pgf@y,
46 nfold=#1
47 }
48 },
49 scaling nfold/.default=2,
50 commutative diagrams/scaling nfold/.code={
51 \pgfscope%
52 \tikz@double@setup
53 \pgf@nfold@compute@widths@from@double
54 \c@pgf@counta=#1
55 \advance\c@pgf@counta by -1\relax
56 \pgf@ya=\c@pgf@counta\pgf@y
57 \advance\c@pgf@counta by -1\relax
58 \pgf@xa=\c@pgf@counta\pgf@y
59 \advance\pgf@xa by .5\pgf@x
60 \global\pgf@x=\pgf@xa
61 \global\pgf@y=2\pgf@ya
62 \endpgfscope
63 \tikzset{
64 commutative diagrams/every label/.append style/.expanded={outer sep=\the\pgf@x},
65 double distance between line centers=\pgf@y,
66 nfold=#1
67 }
68 },
69 commutative diagrams/scaling nfold/.default=2
70 }
71
72 \endinput