summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/tikz-dependency/tikz-dependency.sty89
1 files changed, 75 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/latex/tikz-dependency/tikz-dependency.sty b/Master/texmf-dist/tex/latex/tikz-dependency/tikz-dependency.sty
index 607d6c50a78..4e57109f8de 100644
--- a/Master/texmf-dist/tex/latex/tikz-dependency/tikz-dependency.sty
+++ b/Master/texmf-dist/tex/latex/tikz-dependency/tikz-dependency.sty
@@ -6,18 +6,32 @@
% 2. under the GNU Public License.
%
% See the file doc/generic/tikz-dependency/licenses/LICENSE for more details.
+%
+% Changelog
+%
+% 1.1 (Jan 17, 2012)
+% - Added the possibility to use simple arcs as edges (keys: arc edge/segmented edge)
+% - Added "edge start x offset" and "edge end x offset" to fine tune edge start/end point position
+% - Added \depstyle to define styles more easily
+% - Added "simple" theme, based on the parse on page 1 of [Nivre and McDonald, 2008 ACL-HLT]
+% - Added instructions to draw bubble parses
+% - Fixed bug that would cause groupedges not to be straight under some circumstances;
+%
+% 1.0 (Nov 26, 2011)
+% - First public release
-\ProvidesPackage{tikz-dependency}[2011/01/08 v1.0 Macros to draw dependency trees]
+\ProvidesPackage{tikz-dependency}[2011/01/08 v1.1 Macros to draw dependency trees]
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\RequirePackage{tikz,environ}
-\usetikzlibrary{matrix,arrows,backgrounds,calc,patterns,positioning,fit}
+\usetikzlibrary{matrix,arrows,backgrounds,calc,patterns,positioning,fit,shapes}
\pgfdeclarelayer{depgroups}
\pgfsetlayers{depgroups,main}
\newcounter{dt@labelid}
\newif\ifdt@linkbelow
+\newif\ifdt@arcedge
\tikzset{
/depgraph/.cd,
/depgraph/.search also = {/tikz},
@@ -39,6 +53,16 @@
edge below/.is if = dt@linkbelow,
edge below/.default=true,
edge above/.code = {\dt@linkbelowfalse},
+ % arc edge
+ arc edge/.is if = dt@arcedge,
+ segmented edge/.code = {\dt@arcedgefalse},
+ arc angle/.store in = \dt@arcangle,
+ arc angle = 60,
+ % an explicit offset to compensate the x position of the edge
+ edge start x offset/.code = {\pgfmathsetlengthmacro{\dt@EdgeStartOffsetX}{#1}},
+ edge start x offset = 0,
+ edge end x offset/.code = {\pgfmathsetlengthmacro{\dt@EdgeEndOffsetX}{#1}},
+ edge end x offset = 0,
% the layer that links should connect
% (should be set to "1" for edge above, and to the number of rows
% in the matrix for edge below)
@@ -46,7 +70,7 @@
target layer/.default = 0,
target layer = 0,
% styling options
- reserved/edge style/.style = {->, >=stealth, black, solid, rounded corners = 2, line cap = round},
+ reserved/edge style/.style = {->, >=stealth, black, solid, rounded corners = 2, line cap = round, segmented edge},
edge style/.style = {reserved/edge style/.append style = {#1}},
reserved/label style/.style = {
anchor = mid,
@@ -62,6 +86,7 @@
label style/.style = {reserved/label style/.append style = {#1}},
hide label/.style = {reserved/label style/.append style = {opacity = 0, text opacity = 0}},
show label/.style = {reserved/label style/.append style = {opacity = 1, text opacity = 1}},
+ text only label/.style = {reserved/label style/.append style = {opacity=0, text opacity=1}},
reserved/text style/.style = {
text height=1.5ex, text depth = 0.25ex, % needed to center text vertically
inner sep = .5ex},
@@ -75,29 +100,38 @@
group style/.style = {reserved/group style/.append style = {#1}},
% themes for text
text theme/.is choice,
+ text theme/default/.style = {text style={black}},
text theme/brazil/.style = {text style={blue!60!black}},
text theme/iron/.style = {text style={black!80}},
text theme/copper/.style = {text style={brown!60!black}},
text theme/night/.style = {text style={black}},
text theme/grassy/.style = {text style={green!40!black}},
+ text theme/simple/.style = {text style={black}},
% themes for labels
label theme/.is choice,
+ label theme/default/.style = {label style={fill=white, draw=black}},
label theme/night/.style = {label style={text=white, fill=black, font=\bfseries}},
label theme/brazil/.style = {label style={thick, black, fill=yellow, text=black, font=\bfseries}},
label theme/iron/.style = {label style={top color=black!60, bottom color=black!80, draw=black!80, text=white, font=\bfseries}},
label theme/copper/.style = {label style={top color=brown!80!pink, bottom color=brown!60!black, draw=brown!80, text=white, font=\bfseries}},
label theme/grassy/.style = {label style={bottom color=green!60!black, top color=green!20!black, draw=green!40!black, text=white, font=\bfseries}},
+ label theme/simple/.style = {label style={draw=none,fill=none,above,font=\scriptsize}},
% themes for edges
edge theme/.is choice,
+ edge theme/default/.style = {edge style={thin,black}},
edge theme/night/.style = {edge style={thick}},
edge theme/brazil/.style = {edge style={thick,green!60!black}},
edge theme/iron/.style = {edge style={thick, black!80}},
edge theme/copper/.style = {edge style={thick, brown!80}},
edge theme/grassy/.style = {edge style={thick, green!40!black}},
+ edge theme/simple/.style = {arc edge, arc angle=79},
% themes styles
theme/.style = {label theme = #1, edge theme = #1, text theme = #1},
}
+\newcommand{\depstyle}[2]{\tikzset{#1/.style = {/depgraph/.cd, #2}}}
+
+
\newenvironment{dependency}[1][]{%
\begin{tikzpicture}[/depgraph/.cd, #1]
\begin{scope}
@@ -208,7 +242,7 @@
\pgfextractx{\xcb}{\pgfpointanchor{#3}{\anchorpoint}}
\pgfextracty{\yca}{\pgfpointanchor{#2}{\anchorpoint}}
\pgfextracty{\ycb}{\pgfpointanchor{#3}{\anchorpoint}}
- \pgfmathsetlengthmacro{\ydiff}{abs(\yca-\ycb)}
+ \pgfmathsetlengthmacro{\ydiff}{\yca-\ycb}
\ifdim\xca>\xcb
\pgfmathsetlengthmacro{\doff}{-\dt@linkoffset}
\pgfmathsetlengthmacro{\dslant}{-\dt@linkslant}
@@ -224,19 +258,46 @@
\pgfmathsetlengthmacro{\dt@startdist}{-\dt@startdist}
\pgfmathsetlengthmacro{\dt@enddist}{-\dt@enddist}
\fi
- \node (\dt@lastlabel-edge-origin) [coordinate] at ($(#2.\anchorpoint) + (\doff,\dt@startdist)$) {};
- \node (\dt@lastlabel-edge-first-corner) [coordinate] at ($(\dt@lastlabel-edge-origin) + (\dslant,\dt@enddist)$) {};
+
+ % Calculate edge anchors. -edge-first-corner and -edge-second-corner are only
+ % meaningful for segmented edge, but we also draw the nodes for arc edge, someone
+ % may always find these anchors useful...
+ \node (\dt@lastlabel-edge-origin) [coordinate] at ($(#2.\anchorpoint) + (\doff,\dt@startdist) + (\dt@EdgeStartOffsetX,0)$) {};
+ \node (\dt@lastlabel-edge-first-corner) [coordinate] at ($(\dt@lastlabel-edge-origin) + (\dslant,\dt@enddist) + (\dt@EdgeEndOffsetX,0)$) {};
\node (\dt@lastlabel-edge-second-corner) [coordinate] at ($(#3.\anchorpoint) + (-\dslant,\dt@enddist+\dt@startdist+\ydiff)$) {};
\node (\dt@lastlabel-edge-endpoint) [coordinate] at ($(#3.\anchorpoint) + (0,\dt@startdist)$) {};
- \draw [/depgraph/.cd, reserved/edge style, rounded corners = #5/5, #1]
- (\dt@lastlabel-edge-origin) --
- (\dt@lastlabel-edge-first-corner) --
- (\dt@lastlabel-edge-second-corner) --
- (\dt@lastlabel-edge-endpoint);
- \node (\dt@lastlabel) [/depgraph/.cd, #1, reserved/label style] at
- ($ .5*(\dt@lastlabel-edge-second-corner) + .5*(\dt@lastlabel-edge-first-corner) $)
- {#4};
+ \ifdt@arcedge
+ % link above, left to right
+ \pgfmathsetmacro{\dt@arcin}{180-\dt@arcangle}
+ \pgfmathsetmacro{\dt@arcout}{\dt@arcangle}
+ \ifdt@linkbelow
+ % link below
+ \pgfmathsetmacro{\dt@arcin}{-\dt@arcin}
+ \pgfmathsetmacro{\dt@arcout}{-\dt@arcout}
+ \fi
+ \ifdim\xca>\xcb
+ % right to left
+ \pgfmathsetmacro{\dt@temp}{\dt@arcin}
+ \pgfmathsetmacro{\dt@arcin}{\dt@arcout}
+ \pgfmathsetmacro{\dt@arcout}{\dt@temp}
+ \fi
+ %\draw [/depgraph/.cd, reserved/edge style, rounded corners = #5/5, #1]
+ \draw [out=\dt@arcout, in=\dt@arcin,/depgraph/.cd, reserved/edge style, rounded corners = #5/5, #1]
+ (\dt@lastlabel-edge-origin)
+ to node (\dt@lastlabel) [/depgraph/.cd, #1, reserved/label style] {#4}
+ (\dt@lastlabel-edge-endpoint);
+
+ \else
+ \draw [/depgraph/.cd, reserved/edge style, rounded corners = #5/5, #1]
+ (\dt@lastlabel-edge-origin) --
+ (\dt@lastlabel-edge-first-corner) --
+ (\dt@lastlabel-edge-second-corner) --
+ (\dt@lastlabel-edge-endpoint);
+ \node (\dt@lastlabel) [/depgraph/.cd, #1, reserved/label style] at
+ ($ .5*(\dt@lastlabel-edge-second-corner) + .5*(\dt@lastlabel-edge-first-corner) $)
+ {#4};
+ \fi
\end{scope}
}