1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
%%
%% This is file `codeanatomy.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% codeanatomy.dtx (with options: `package')
%%
\NeedsTeXFormat{LaTeX2e}[2018/12/01]
\ProvidesPackage{codeanatomy}[2019/07/12 v0.4-Alpha draw Code Anatomy]
\RequirePackage{expl3}
\RequirePackage{xparse}
\RequirePackage{tikz}
\usetikzlibrary{
tikzmark
,fit
,arrows.meta
,bending
,shapes
,chains
,backgrounds
,scopes
,decorations
,decorations.pathmorphing
}
\definecolor{annotationcolor}
{rgb}{0,0.50002,1} % Blue
\colorlet{bgcmdcolor}{gray} % Grey
\tikzset{anatomy/.style={%
anchor=south west,%
inner sep=0,%
align=left,%
font=\ttfamily
}
}
\tikzset{code part/.style={%
rectangle,%
draw=annotationcolor,%
align=left,%
minimum height=1.175em,%
inner sep=1.75pt,%
outer sep=0.1pt,%
font=\ttfamily
}
}
\tikzset{fit extrem/.style={%
rectangle,%
draw=annotationcolor,%
align=left,%
minimum height=1.175em,%
inner sep=1.75pt,%
outer sep=0.1pt,%
font=\ttfamily
}
}
\tikzset{annotation/.style={%
preaction={
draw=white,%
line width=3.5pt,%
arrows={-Triangle Cap[]},%
},%
draw=annotationcolor,%
arrows={-Latex[%
round,%
color=annotationcolor,
fill=annotationcolor
]
},
shorten >=0.25pt
}
}
\tikzset{code annotation/.style={%
inner sep=2pt,%
text=annotationcolor,%
align=center,%
font=\sffamily\small
}
}
\tikzset{code grid debug/.style={%
step=1.0,%
draw=gray!20,%
very thin,%
on background layer
}
}
\NewDocumentCommand{\codeBlock}{m}%
{\node(code) [anatomy] at (0,0) {#1};}
\NewDocumentCommand{\cPart}{mm} %
{\tikzmarknode[code part]{#1}{#2}}
\NewDocumentCommand{\iPart}{mm} %
{\tikzmarknode[code part,draw=none,inner sep=0.75pt]{#1}{#2}}
\NewDocumentCommand{\mtPoint}{m}
{\tikzmarknode{#1}{\phantom{\rule[1.8ex]{0.1ex}{0.1ex}}}}
\NewDocumentCommand{\hmtPoint}{m}
{\tikzmarknode{#1}{\phantom{\rule[2.5ex]{0.1ex}{0.1ex}}}}
\NewDocumentCommand{\mbPoint}{m}
{\tikzmarknode{#1}{\phantom{\rule[-0.55ex]{0.1ex}{0.1ex}}}}
\NewDocumentCommand{\dmbPoint}{m}
{\tikzmarknode{#1}{\phantom{\rule[-2ex]{0.1ex}{0.1ex}}}}
\NewDocumentCommand{\extremPoint}{m O{0ex} O{0.1ex} O{} }
{\tikzmarknode[#4]{#1}{\phantom{\rule[#2]{#3}{0.1ex}}}}
\NewDocumentCommand{\fitExtrem}{mm}
{\node(#1)[fit extrem,fit={#2}]{};}
\NewDocumentCommand{\bgcode}{m}{\textcolor{bgcmdcolor}{#1}}
\NewDocumentCommand{\ptab}{}{\phantom{hhhh}}
\NewDocumentCommand{\phspace}{}{\phantom{h}}
\NewDocumentCommand{\codeAnnotation}{m r() m } %
{ \node(#1)[code annotation] at (#2) {#3}; }
%% Copyright (C) 2008-2019 by
%% ME
%%
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version. The latest
%% version of this license is in the file:
%%
%% https://www.latex-project.org/lppl.txt
%%
%%
%% This work consists of the files codeanatomy.dtx,
%% codeanatomy.ins,
%% and the derived files codeanatomy.pdf,
%% codeanatomy.sty.
%%
%%
%% End of file `codeanatomy.sty'.
|