diff options
Diffstat (limited to 'graphics/pgf/contrib/argumentation/argumentation.sty')
-rw-r--r-- | graphics/pgf/contrib/argumentation/argumentation.sty | 147 |
1 files changed, 76 insertions, 71 deletions
diff --git a/graphics/pgf/contrib/argumentation/argumentation.sty b/graphics/pgf/contrib/argumentation/argumentation.sty index 80dd5f4c83..7cd678de3c 100644 --- a/graphics/pgf/contrib/argumentation/argumentation.sty +++ b/graphics/pgf/contrib/argumentation/argumentation.sty @@ -1,104 +1,109 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{argumentation}[2023/11/05 Argumentation] -% Author: Lars Bengel -% E-Mail: lars.bengel@fernuni-hagen.de -% Version: 1.0 -% License: LaTeX Project Public License 1.3c - -%%%%%%%%%%% Package Requirements %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\RequirePackage{options} % For managing package options +\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]{\textbf{\emph{#1}}} % Defines the font style in which argument names are displayed +\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, +} -%%%%%%%%%% Package Options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\options{ - /argumentation/.new family, - /argumentation/argumentstyle/.new choice = {standard, retro}, - /argumentation/namestyle/.new choice = {normal, italics, bold, bolditalics}, - /argumentation/attackstyle/.new choice = {standard, retro}, - /argumentation/@unknown/.new cmd 2 = \PackageWarning{argumentation}{Unknown option `#1'} +\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, } -\options@ProcessOptions{/argumentation} - -%%%%%%%%%% Preprocessing options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\ifcase\option{/argumentation/namestyle/@ord}\relax -\or\renewcommand{\argstyle}[1]{\emph{#1}} -\or\renewcommand{\argstyle}[1]{\textbf{#1}} -\or\renewcommand{\argstyle}[1]{\textbf{\emph{#1}}} -\fi - -\ifcase\option{/argumentation/argumentstyle/@ord} -\tikzset{arg/.style={circle, minimum size=0.75cm,draw=black,thick,fill=white,font=\large, text centered, inner sep=0}} -\or\tikzset{arg/.style={circle, minimum size=0.7cm,draw=black,thick,fill=white}} -\fi - -\ifcase\option{/argumentation/attackstyle/@ord} -\tikzset{att/.style={-{Stealth[scale=1.25]}}} -\or\tikzset{att/.style={->}} -\fi - -%%%%%%%%%% Package Content %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\tikzset{ % Basic predefined tikz-styles - % Self-Loop style - every loop/.style={min distance=2mm,in=0,out=60,looseness=5}, - % Color shortcuts for labelled arguments and reduced arguments - inactive/.style={draw=black!30, text=black!40,densely dashed}, - argin/.style={fill=green}, - argout/.style={fill=red}, - argundec/.style={fill=cyan}, - % Style for displaying AF name in Figure - caption/.style={draw=none}, - % Style for support mark - support mark/.style = {postaction = {decorate,decoration={markings,mark=at position #1 with {\draw[-] (0,-0.1) -- (0.1,0.1);}}}}, + +\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, } -\newcommand{\setargumentstyle}[1]{\tikzset{arg/.style={#1}}} -\newcommand{\setattackstyle}[1]{\tikzset{att/.style={#1}}} -\newcommand{\setloopstyle}[1]{\tikzset{every loop/.style={#1}}} +\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, +} -\newcommand{\adjustargumentstyle}[1]{\tikzset{arg/.append style={#1}}} -\newcommand{\adjustattackstyle}[1]{\tikzset{att/.append style={#1}}} +\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}, +} -\newcommand{\resetargumentstyle}{\setargumentstyle{circle, minimum size=0.75cm,draw=black,thick,fill=white,font=\large, text centered, inner sep=0}} -\newcommand{\resetattackstyle}{\setattackstyle{-{Stealth[scale=1.25]}}} -\newcommand{\resetloopstyle}{\setloopstyle{min distance=2mm,in=0,out=60,looseness=5}} +% 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}}} -\newenvironment{af}{ - \tikzpicture -}{% - \endtikzpicture + +%%%%%%%%%%%%%%% 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{miniaf}[1][]{ - \tikzset{arg/.append style={font=\small, minimum size=0.5cm}, - att/.append style={-{Stealth[scale=0.9]}}, - } - \tikzpicture[node distance=0.5cm,#1] +\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[arg,#1](#2){\argstyle{#3}};} +\newcommand{\argument}[3][]{\node[argument,argument size,#1](#2){\argstyle{#3}};} % Creates an attack edge -\newcommand{\attack}[3][]{\path(#2) edge [att,#1] (#3);} +\newcommand{\attack}[3][]{\path(#2) edge [attack,#1] (#3);} % Creates a self-attack -\newcommand{\selfattack}[2][]{\path(#2) edge [att,loop,#1] (#2);} +\newcommand{\selfattack}[2][]{\path(#2) edge [attack,selfattack,#1] (#2);} % Creates two symmetric attack edges between two arguments -\newcommand{\dualattack}[3][]{\path(#2) edge [att, bend right,#1] (#3);\path(#3) edge [att, bend right,#1] (#2);} +\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 [att,support mark=0.3,#1] (#3);} +\newcommand{\support}[3][]{\path(#2) edge [support=0.35,#1] (#3);} |