summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/argumentation/argumentation.sty
blob: 7cd678de3c3551b2de93c0f1838f8d8f45ec8efc (plain)
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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{argumentation}[2023/12/03 Argumentation]
% Author:   Lars Bengel
% E-Mail:   lars.bengel@fernuni-hagen.de
% Version:  1.1
% Date:     2023/12/03
% License:  LaTeX Project Public License 1.3c

%%%%%%%%%%% Package Requirements %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{pgfopts}                        % For managing package options
\RequirePackage{tikz}                           % For drawing the argumentation frameworks
\usetikzlibrary{positioning}                    % For relative node positioning
\usetikzlibrary{arrows.meta}                    % For directed edges / attack arrows
\usetikzlibrary{arrows}                         % For directed edges / attack arrows
\usetikzlibrary{decorations.markings}           % For creating the support edge markings

\newcommand{\argstyle}[1]{#1}                   % Defines the font style in which argument names are displayed

%%%%%%%%%% Package Options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pgfkeys{/argumentation/argumentstyle/.is choice,
    /argumentation/argumentstyle/standard/.code={\tikzset{argument/.style={circle,draw=black,inner sep=0,outer sep=0}}},
    /argumentation/argumentstyle/custom/.code={},
    /argumentation/argumentstyle=standard,
}

\pgfkeys{/argumentation/attackstyle/.is choice,
    /argumentation/attackstyle/standard/.code={\tikzset{attack/.style={-{stealth'}}}},
    /argumentation/attackstyle/large/.code={\tikzset{attack/.style={-{Stealth[scale=1.25]}}}},
    /argumentation/attackstyle=standard,
}

\pgfkeys{/argumentation/supportstyle/.is choice,
    /argumentation/supportstyle/standard/.code={\tikzset{support/.style = {attack,postaction = {decorate,decoration={markings,mark=at position 0.36 with {\draw[-] (0,-0.1) -- (0.1,0.1);}}}}}},
    /argumentation/supportstyle/dashed/.code={\tikzset{support/.style = {attack,densely dashed}}},
    /argumentation/supportstyle/double/.code={\tikzstyle{support}=[-{Classical TikZ Rightarrow},double]},
    /argumentation/supportstyle=standard,
}

\pgfkeys{/argumentation/namestyle/.is choice,
    /argumentation/namestyle/normal/.code={\relax},
    /argumentation/namestyle/italics/.code={\renewcommand{\argstyle}[1]{\emph{#1}}},
    /argumentation/namestyle/bold/.code={\renewcommand{\argstyle}[1]{\textbf{#1}}},
    /argumentation/namestyle/bolditalics/.code={\renewcommand{\argstyle}[1]{\emph{\textbf{#1}}}},
    /argumentation/namestyle/monospace/.code={\renewcommand{\argstyle}[1]{\texttt{#1}}},
    /argumentation/namestyle=normal,
}

\ProcessPgfPackageOptions{/argumentation}
%%%%%%%%%% Package Content %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\tikzset{ % global predefined tikz-styles
    argument size/.style={minimum size=0.7cm},                              % Standard size of argument nodes
    selfattack/.style={loop,min distance=2mm,in=0,out=60,looseness=5},      % Standard style for self-attacks
    inactive/.style={draw=black!30, text=black!40},                         % Make a node or edge inactive, i.e., greyed out
    incomplete/.style={densely dashed},                                     % Style for displaying incomplete nodes or attacks
    argin/.style={fill=green},                                              % Color an argument that is labelled in
    argout/.style={fill=red},                                               % Color an argument that is labelled out
    argundec/.style={fill=cyan},                                            % Color an argument that is labelled undecided
    caption/.style={draw=none},                                             % Style for displaying AF name in Figure
    invisible/.style={draw=none,text=black!0},                              % Make a node or edge invisible
    annotation/.style={above,font=\small},
}

% Commands for setting custom tikz-style parameters (experimental)
\newcommand{\setargumentstyle}[1]{\tikzset{argument/.style={#1}}}
\newcommand{\setattackstyle}[1]{\tikzset{attack/.style={#1}}}
\newcommand{\setsupportstyle}[1]{\tikzset{support/.style={#1}}}

%\newcommand{\setloopstyle}[1]{\tikzset{selfattack/.style={#1}}}
%\newcommand{\adjustargumentstyle}[1]{\tikzset{argument/.append style={#1}}}
%\newcommand{\adjustattackstyle}[1]{\tikzset{attack/.append style={#1}}}


%%%%%%%%%%%%%%% Environment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pgfkeys{
    /tikz/small/.style = {node distance=0.55cm,argument size/.style={minimum size=0.55cm},caption/.append style={font=\small}},
    /tikz/tiny/.style = {node distance=0.35cm,argument size/.style={font=\small, minimum size=0.4cm},caption/.append style={font=\small}},
}

\newenvironment{af}[1][]{
    \tikzpicture[#1]
}{%
    \endtikzpicture
}

%%%%%%%%%%%%%%%% Commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Creates a node displaying the name of the AF
\newcommand{\afname}[3][]{\node[caption,#1](#2){#3};}

\newcommand{\annotation}[3][]{\node[annotation,above of=#2,#1](an_#2){#3};}

% Creates an argument node
\newcommand{\argument}[3][]{\node[argument,argument size,#1](#2){\argstyle{#3}};}

% Creates an attack edge
\newcommand{\attack}[3][]{\path(#2) edge [attack,#1] (#3);}

% Creates a self-attack
\newcommand{\selfattack}[2][]{\path(#2) edge [attack,selfattack,#1] (#2);}

% Creates two symmetric attack edges between two arguments
\newcommand{\dualattack}[3][]{\path(#2) edge [attack, bend right,#1] (#3);\path(#3) edge [attack, bend right,#1] (#2);}

% Creates a weighted attack
\newcommand{\annotatedattack}[4][]{\path(#2) edge [attack,#1] node[annotation](p_#2_#3){#4} (#3);}

% Creates a support edge between two arguments
\newcommand{\support}[3][]{\path(#2) edge [support=0.35,#1] (#3);}