-
Notifications
You must be signed in to change notification settings - Fork 47
/
highlight_box.tex
84 lines (84 loc) · 3.88 KB
/
highlight_box.tex
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
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{enumitem}
\xdef\Colored{0}
\ifnum\Colored > 0
\xdef\LWS{0.6mm}
\xdef\ColorYO{yellow!30!orange}
\xdef\ColorYR{yellow!70!red}
\xdef\ColorRY{red!90!yellow}
\xdef\ColorYB{yellow!90!brown}
\xdef\ColorYRB{yellow!90!red}
\xdef\ColorR{red}
\xdef\ColorO{orange}
\else
\xdef\LWS{0.4mm}
\xdef\ColorYO{gray!80!black}
\xdef\ColorYR{gray!70}
\xdef\ColorRY{gray!60!black}
\xdef\ColorYB{gray!90}
\xdef\ColorYRB{gray!50}
\xdef\ColorR{black}
\xdef\ColorO{gray!95!black}
\fi
\newenvironment{enuma}{\begin{enumerate}[label={\alph{enumi})}, itemsep=-1mm]}{\end{enumerate}}
\newlength\tipWidth
\newlength\tipSeparator
\newlength\tipTextWidth
\newlength\addedWidth
\newlength\addedHeight
\newlength\RectHeight
\newlength\testL
\newlength\lengthA
\newlength\lengthB
\newlength\lengthC
\setlength\addedHeight{3mm}
\setlength\addedWidth{4mm}
\setlength\tipSeparator{6mm}
\newsavebox{\lambBox}
\newsavebox{\lambVBox}
\newsavebox{\tipBox}
\newsavebox{\tipVBox}
\newcommand{\myTip}[4][\tipWidth]{%
\def\alig{#2}%
\def\aligm{m}%
\def\aligt{t}%
\savebox{\lambBox}{\hbox{\begin{tikzpicture}[inner sep=0,outer sep=0]
\fill[rounded corners=0.35mm,rotate=-15,gray!90!black] (0.05,-0.15)rectangle(-0.1,-0.02);
\draw[line width=0.9mm] (0.2,0.01) to[in=330 , out=170] (-0.2,0.11);
\draw[line width=1mm] (0.3,0.15) to[in=330 , out=170] (-0.25,0.25);
\draw[line width=1.1mm] (0.35,0.3) to[in=350 , out=180] (-0.27,0.36);
\draw[line width=\LWS, color=\ColorYO] (-0.15,0.42) to[in=310,out=80] (-0.3,0.8)to[in=215,out=130](-0.37,1.15) to[out=45,in=150] (0.2,1.35)to[in=110,out=-30](0.56,0.99)to[in=45,out=290](0.41,0.69)to[in=80,out=215](0.2,0.37);
\draw[line width=0.2mm] (0.,0.33)--(-0.02,0.72);
\fill[\ColorYR] (-0.02,0.72)--(0.0,0.93)--(0.055,0.79)--(0.07,0.9)--(0.13,0.79)--(0.28,0.8)--(0.16,0.61)--(0.09,0.65)--(0.07,0.5)--(0.046,0.54)--cycle;
\fill[\ColorRY] (-0.02,0.72)--(0.008,0.78)--(0.05,0.68)--(0.07,0.84)--(0.15,0.74)--(0.28,0.8)--(0.165,0.69)--(0.10,0.74)--(0.07,0.63)--(0.045,0.63)--(0.015,0.72)--cycle;
\draw[line width=0.2mm] (0.02,0.3)--(0.28,0.8);
\draw[line width=0.7mm,\ColorYB](0.25,1.46)--(0.32,1.69) (0.41,1.33)--(.61,1.57) (0.54,1.19)--(.7,1.33) (0.03,1.5)--(-0.0,1.8) (-0.18,1.42)--(-0.3,1.62) (-0.4,1.3)--(-0.58,1.49);
\draw[line width=0.3mm,\ColorYRB] (-0.3,1.05)to[in=120,out=20](0.5,0.96);
\end{tikzpicture}}}%
\savebox\lambVBox{\vbox{\usebox{\lambBox}}}%
\setlength\tipTextWidth{0 pt}%
\addtolength\tipTextWidth{#1}%
\addtolength\tipTextWidth{-\wd\lambBox}%
\addtolength\tipTextWidth{-\tipSeparator}%
\addtolength\tipTextWidth{-\addedWidth}%
\addtolength\tipTextWidth{-\addedWidth}%
\savebox{\tipBox}{\hbox{\begin{minipage}[inner sep=0,outer sep=0]{\tipTextWidth}{\noindent\bfseries WP#3 $\vert$} #4\end{minipage}}}%
\savebox{\tipVBox}{\vbox{\usebox{\tipBox}}}%
\setlength\testL{\ht\tipVBox}%
\addtolength\testL{\dp\tipVBox}%
\addtolength\testL{-\ht\lambBox}%
\addtolength\testL{-\dp\lambBox}%
\setlength\lengthA{\ht\tipVBox}%
\addtolength\lengthA{-0.5\ht\lambBox}%
\setlength\lengthB{0.5\ht\lambBox}%
\addtolength\lengthB{-\ht\tipVBox}%
\setlength\lengthC{0.5\ht\tipVBox}%
\addtolength\lengthC{0.5\dp\tipVBox}%
\begin{tikzpicture}[inner sep=0, outer sep =0]%
\node[inner sep=0,outer sep=0] at ({-0.5\wd\lambBox-0.5\tipSeparator},{\ifx\alig\aligm 0\else \ifdim\testL > 0pt \lengthA\else 0\fi\fi}) {\usebox{\lambBox}};
\node[inner sep=0,outer sep =0] at ({0.5\tipTextWidth+0.5\tipSeparator},{\ifx\alig\aligm 0\else \ifdim\testL > 0pt 0\else \lengthB\fi\fi}) {\usebox{\tipBox}};
\draw[\ColorO,line width=0.5mm] (0,\ifdim\testL> 0pt -\ht\tipVBox \else -0.5\ht\lambBox\fi)--(0,\ifdim\testL> 0pt \lengthC \else 0.5\ht\lambBox\fi);
\draw[\ColorR,line width=0.5mm,rounded corners=1mm] ({-\wd\lambBox-\addedWidth-\tipSeparator/2},{\ifdim\testL >0pt -\ht\tipVBox\else -0.5\ht\lambBox\fi-\addedHeight})rectangle({\addedWidth+\tipSeparator/2+\tipTextWidth},{\ifdim\testL > 0pt \lengthC\else 0.5\ht\lambBox\fi+\addedHeight});
\end{tikzpicture}%
}