\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{argumentation}[2025/07/31 Argumentation]
% Author: Lars Bengel
% E-Mail:
[email protected]
% Version: 1.6
% Date: 2025/07/31
% License: LaTeX Project Public License 1.3c
%%%%%%%%%%% Package Requirements %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{amsbsy,amsmath} % Proper bold letters in math mode
\RequirePackage{pgfopts} % Managing package options
\RequirePackage{refcount} % Expandable ref-counter value
\RequirePackage{xspace} % Dynamic spaces after math commands
\RequirePackage{xcolor} % Defining colors
\RequirePackage{tikz} % Drawing the argumentation frameworks
\usetikzlibrary{positioning} % Relative node positioning
\usetikzlibrary{arrows.meta} % Directed edges / attack arrows
\usetikzlibrary{arrows} % Directed edges / attack arrows
\usetikzlibrary{decorations.markings} % Creating the support edge markings
%%%%%%%%%%% Package Style Definitions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Color definitions
\definecolor{aigyellow}{RGB}{210,149,81} % Highlight color
\definecolor{aigblue}{RGB}{0,76,151} % Node color
%%% Argument Style Definitions
\tikzset{
argument size/.style={}, % Size of argument nodes
argument/.style={}, % Base style for argument nodes
argument standard/.style={circle,draw=black,inner sep=0,outer sep=0}, % Standard argument style
argument large/.style={circle,draw=black,inner sep=0,outer sep=0, font=\large}, % Large argument style
argument thick/.style={circle,draw=black,inner sep=0,outer sep=0, line width=0.1em}, % Thick outline argument style
argument gray/.style={argument thick,fill=gray!30,draw=gray!65,text=black!80}, % Gray argument style
argument colored/.style={argument thick,fill=aigblue!40,draw=aigblue!80}, % Colored argument stlye
}
%%% Attack/Support Edge Definitions
\tikzset{
attack width/.style={}, % Width of attack arrows
attack/.style={}, % Base style for attack arrow
attack standard/.style={-{stealth'}}, % Standard attack arrow
attack large/.style={-{Stealth[scale=1.25]}}, % Larger arrow tip
attack modern/.style={-{To[sharp,length=0.65ex,line width=0.05em]}}, % Mordern rightarrow style tip
support/.style={}, % Base style for support
support standard/.style = {attack, postaction = {decorate,decoration={markings,mark=at position 0.36 with {\draw[-] (0,-0.1) -- (0.1,0.1);}}}}, % Standard support arrow
support dashed/.style={attack,densely dashed}, % Dashed Support arrow
support double/.style={-{Classical TikZ Rightarrow},double}, % double-line support arrow
}
%%% Additional Style Parameters
\tikzset{
selfattack/.style={loop,min distance=0.4em,in=0,out=60,looseness=4.5}, % Self-attack
inactive/.style={fill=none,draw=gray!50,text=gray!60}, % Inactive argument or edge (reduct)
incomplete/.style={densely dashed}, % incomplete argument or edge
accepted/.style={fill=green!40}, % Accepted argument (in)
rejected/.style={fill=red!40}, % Rejected argument (out)
undecided/.style={fill=cyan!40}, % Undecided Argument (undec)
highlight/.style={fill=aigyellow!60}, % Highlighted argument
caption/.style={draw=none}, % Caption or text
invisible/.style={draw=none,fill=none,opacity=0.0}, % Invisible argument or edge
annotation/.style={font=\small}, % Argument annotation
argin/.style={accepted},
argout/.style={rejected},
argundec/.style={undecided},
}
%%% Style-Options for af environment
\pgfkeys{/tikz/.cd,
af/.style={}, % Base style for af
standard/.style={node distance=6.6ex,argument size/.style={minimum size=4.5ex},attack width/.style={line width=0.05em}}, % Standard size style for af
small/.style={node distance=3.5ex,argument size/.style={minimum size=3.4ex},attack width/.style={line width=0.045em},caption/.append style={font=\small}}, % Small size style for af
tiny/.style={node distance=2.3ex,argument size/.style={minimum size=2.6ex,font=\small},attack width/.style={line width=0.03em},caption/.append style={font=\small}}, % Tiny size style for af
}
%%% Option for switching beamer cover type in af
\makeatletter
\newif\if@afoverlay
\pgfkeys{/tikz/.cd,
covered/.is choice,
covered/transparent/.code={\@afoverlaytrue},
covered/invisible/.code={\@afoverlayfalse},
covered/.default=transparent,
covered=transparent,
}
\makeatother
%%%%%%%%%% Internal Utility Functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\newif\ifmacros
\newif\if@numericidx
\newif\if@alphaidx
\newif\if@insideaf
%%% Defines the font style in which argument names are displayed
\newcommand{\@arg@style}[1]{#1}
% Dummy command in case the beamer documentclass is not loaded
\ProvideDocumentCommand{ \alt } {r<> m m} {#2}
\makeatother
%%%%%%%%%% Package Options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Options for style of the argument node itself
\pgfkeys{/tikz/.cd,
argumentstyle/.is choice,
argumentstyle/standard/.code={\tikzset{argument/.style={argument standard,argument size}}},
argumentstyle/large/.code={\tikzset{argument/.style={argument large,argument size}}},
argumentstyle/thick/.code={\tikzset{argument/.style={argument thick,argument size}}},
argumentstyle/gray/.code={\tikzset{argument/.style={argument gray,argument size}}},
argumentstyle/colored/.code={\tikzset{argument/.style={argument colored,argument size}}},
}
\pgfkeys{/argumentation/.cd,
.unknown/.code={},
argumentstyle/.is choice,
argumentstyle/standard/.code={\tikzset{argument/.style={argument standard,argument size}}},
argumentstyle/large/.code={\tikzset{argument/.style={argument large,argument size}}},
argumentstyle/thick/.code={\tikzset{argument/.style={argument thick,argument size}}},
argumentstyle/gray/.code={\tikzset{argument/.style={argument gray,argument size}}},
argumentstyle/colored/.code={\tikzset{argument/.style={argument colored,argument size}}},
argumentstyle=standard,
}
%%% Options for the style of the attack edges
\pgfkeys{/tikz/.cd,
attackstyle/.is choice,
attackstyle/standard/.code={\tikzset{attack/.style={attack width,attack standard}}},
attackstyle/large/.code={\tikzset{attack/.style={attack width,attack large}}},
attackstyle/modern/.code={\tikzset{attack/.style={attack width,attack modern}}},
attackstyle=standard,
}
\pgfkeys{/argumentation/.cd,
attackstyle/.is choice,
attackstyle/standard/.code={\tikzset{attack/.style={attack width,attack standard}}},
attackstyle/large/.code={\tikzset{attack/.style={attack width,attack large}}},
attackstyle/modern/.code={\tikzset{attack/.style={attack width,attack modern}}},
attackstyle=standard,
}
%%% Options for the style of the support edges
\pgfkeys{/tikz/.cd,
supportstyle/.is choice,
supportstyle/standard/.code={\tikzset{support/.style={support standard}}},
supportstyle/dashed/.code={\tikzset{support/.style={support dashed}}},
supportstyle/double/.code={\tikzset{support/.style={support double}}},
supportstyle=standard,
}
\pgfkeys{/argumentation/.cd,
supportstyle/.is choice,
supportstyle/standard/.code={\tikzset{support/.style={support standard}}},
supportstyle/dashed/.code={\tikzset{support/.style={support dashed}}},
supportstyle/double/.code={\tikzset{support/.style={support double}}},
supportstyle=standard,
}
%%% Options for the automatic text formatting for the argument names
\makeatletter
\pgfkeys{/tikz/.cd,
namestyle/.is choice,
namestyle/none/.code={\renewcommand{\@arg@style}[1]{##1}},
namestyle/math/.code={\renewcommand{\@arg@style}[1]{\ensuremath{##1}}},
namestyle/bold/.code={\renewcommand{\@arg@style}[1]{\ensuremath{\boldsymbol{##1}}}},
namestyle/monospace/.code={\renewcommand{\@arg@style}[1]{{\ttfamily##1}}},
namestyle/monoemph/.code={\renewcommand{\@arg@style}[1]{{\ttfamily\itshape##1}}},
namestyle=none,
}
\pgfkeys{/argumentation/.cd,
namestyle/.is choice,
namestyle/none/.code={\renewcommand{\@arg@style}[1]{##1}},
namestyle/math/.code={\renewcommand{\@arg@style}[1]{\ensuremath{##1}}},
namestyle/bold/.code={\renewcommand{\@arg@style}[1]{\ensuremath{\boldsymbol{##1}}}},
namestyle/monospace/.code={\renewcommand{\@arg@style}[1]{{\ttfamily##1}}},
namestyle/monoemph/.code={\renewcommand{\@arg@style}[1]{{\ttfamily\itshape##1}}},
namestyle=none,
}
%%% Option for automatic indexing of arguments
\pgfkeys{/argumentation/.cd,
indexing/.is choice,
indexing/numeric/.code={\@numericidxtrue},
indexing/alphabetic/.code={\@alphaidxtrue},
indexing/none/.code={\@numericidxfalse\@alphaidxfalse},
indexing/.default=numeric,
indexing=numeric,
}
\makeatother
%%% Option for enabling additional macros
\pgfkeys{/argumentation/.cd,
macros/.is choice,
macros/true/.code={\macrostrue},
macros/false/.code={\macrosfalse},
macros/.default=true,
macros=false,
}
\ProcessPgfPackageOptions{/argumentation}
%%%%%%%%%%%%%%% Arguments %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
% Internal counter for argument IDs
\newcounter{@argument}
%%% Command for creating arguments
% #1 beamer overlay specification (optional)
% #2 TikZ parameters (optional)
% #3 unique argument ID (optional)
% #4 argument display name
% #5 ignored
% #6 absolute positioning values (optional)
\NewDocumentCommand { \argument } {D<>{.-} O{} d() m dat d()} {%
\stepcounter{@argument}
\IfNoValueTF {#3}{%
\if@alphaidx
\edef\@argid{\alph{@argument}}
\else\if@numericidx
\edef\@argid{a\arabic{@argument}}
\else
\PackageError{argumentation}{Missing argument ID}{Must either provide argument ID inside () or activate auto-indexing}
\fi\fi
}{%
\edef\@argid{#3}
}
\@create@argument{#1}{#2}{}{\@argid}{#4}{#6}
}
%%% Auxilliary command for creating arguments
% #1 beamer overlay specification (optional)
% #2 TikZ parameters (optional)
% #3 TikZ parameters (optional)
% #4 unique argument ID (optional)
% #5 argument display name
% #6 absolute positioning value (optional)
\NewDocumentCommand { \@create@argument } {mmmmmm} {%
\alt<#1>{
\IfNoValueTF {#6}{%
\node[argument size,argument,#2,#3](#4) {\@arg@style{#5}};
}{%
\node[argument size,argument,#2,#3](#4) at (#6) {\@arg@style{#5}};
}
}{%
\if@afoverlay
\IfNoValueTF {#6}{%
\node[argument size,argument,inactive,#2,#3](#4) {\@arg@style{#5}};
}{%
\node[argument size,argument,inactive,#2,#3](#4) at (#6) {\@arg@style{#5}};
}
\else
\IfNoValueTF {#6}{%
\node[argument size,argument,invisible,#2,#3](#4) {\@arg@style{#5}};
}{%
\node[argument size,argument,invisible,#2,#3](#4) at (#6) {\@arg@style{#5}};
}
\fi
}
}
\makeatother
%%%%%%%%%%%%%%% Attacks & Support %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
%%% Command for creating attacks
% #1 beamer overlay specification (optional)
% #2 TikZ parameters (optional)
% #3 attacking argument ID
% #4 attacked argument ID
% #5 annotation text (optional)
\NewDocumentCommand { \attack } {D<>{.-} O{} m m d()} {%
\@create@attack{#1}{#2}{}{#3}{#4}{#5}
}
%%% Internal command for creating the attack in TikZ
% #1 beamer overlay specification (optional)
% #2 TikZ parameters (optional)
% #3 TikZ parameters (optional)
% #4 attacking argument ID
% #5 attacked argument ID
% #6 annotation text
\NewDocumentCommand { \@create@attack } {mmmmmm} {%
\alt<#1>{
\IfNoValueTF{#6}{%
\path(#4) edge [attack,#2,#3] (#5);
}{%
\path(#4) edge [attack,#2,#3] node[annotation](p_#4_#5){#6} (#5);
}
}{%
\if@afoverlay
\IfNoValueTF{#6}{%
\path(#4) edge [attack,inactive,#2,#3] (#5);
}{%
\path(#4) edge [attack,inactive,#2,#3] node[annotation](p_#4_#5){#6} (#5);
}
\else
\IfNoValueTF{#6}{%
\path(#4) edge [attack,invisible,#2,#3] (#5);
}{%
\path(#4) edge [attack,invisible,#2,#3] node[annotation](p_#4_#5){#6} (#5);
}
\fi
}
}
%%% Self-attack edge
% #1 TikZ parameters (optional)
% #2 argument ID
\NewDocumentCommand { \selfattack } {D<>{.-} O{} m} {%
\attack<#1>[selfattack,#2]{#3}{#3}
}
%%% Symmetric attack edges between two arguments
% #1 TikZ parameters (optional)
% #2 first argument ID
% #3 second argument ID
\NewDocumentCommand { \dualattack } {D<>{.-} O{} m m} {%
\attack<#1>[bend right,#2]{#3}{#4}
\attack<#1>[bend right,#2]{#4}{#3}
}
%%% Create attack edge with value (DEPRECATED as of v1.4)
% #1 TikZ parameters (optional)
% #2 attacking argument ID
% #3 attacked argument ID
% #4 annotation text
\NewDocumentCommand{ \annotatedattack } {D<>{.-} O{} m m m} {%
\attack<#1>[#2]{#3}{#4}(#5)
}
%%% Support edge
% #1 overlay specification (optional)
% #2 TikZ parameters (optional)
% #3 supporting argument ID
% #4 supported argument ID
\NewDocumentCommand { \support } {D<>{.-} O{} m m} {%
\alt<#1>{%
\path(#3) edge [support=0.35,#2] (#4);
}{%
\if@afoverlay
\path(#3) edge [support=0.35,inactive,#2] (#4);
\else
\path(#3) edge [support=0.35,invisible,#2] (#4);
\fi
}
}
\makeatother
%%%%%%%%%%%%%%% AF Environment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Uncounted version of the environment
\makeatletter
\NewDocumentEnvironment {af*} {O{}} {%
\setcounter{@argument}{0}
\pgfkeys{/argumentation/.cd, #1}
\tikzpicture[standard,af,#1]
}{%
\endtikzpicture
}
\NewDocumentCommand{\newafenvironment}{mm}{
\newcounter{#1}
\NewDocumentEnvironment{#1}{O{}}{
\refstepcounter{#1}
\@insideaftrue
\begin{af*}[##1]
}{
\end{af*}
\@insideaffalse
}
\ifmacros
\@ifpackageloaded{hyperref}{
\global\expandafter\def\csname #1ref\endcsname##1{\ensuremath{\hyperref[##1]{#2_{\ref*{##1}}}}\xspace}
}{
\global\expandafter\def\csname #1ref\endcsname##1{\ensuremath{#2_{\ref{##1}}}\xspace}
}
\fi
}
\newafenvironment{af}{\AF}
\makeatother
%%%%%%%%%%%%%%%% Additional Commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Definitions for referencing
\ifmacros
\providecommand{\AF}{\ensuremath{F}\xspace} % AF abbreviation
\providecommand{\arguments}{\ensuremath{A}\xspace} % Set of arguments
\providecommand{\attacks}{\ensuremath{R}\xspace} % Set of attacks
\providecommand{\AFcomplete}{\ensuremath{\AF = (\arguments, \attacks)}\xspace} % Full AF
\newcommand{\fullafref}[1]{\ensuremath{\afref{#1} = (\arguments_{\ref*{#1}}, \attacks_{\ref*{#1}})}\xspace} % Full AF with reference
\fi
%%% Creates a node displaying the name of the AF
% #1 overlay specification (optional)
% #2 TikZ-parameters (optional)
% #3 node identifier (optional)
% #4 node name
% #5 ignored
% #6 node position
\NewDocumentCommand { \afname } { D<>{.-} O{} D(){caption} m dat d()} {%
\alt<#1>{
\IfNoValueTF {#6}{%
\node[caption,#2](#3){#4};
}{%
\node[caption,#2](#3) at (#6) {#4};
}
}{%
\IfNoValueTF {#6}{%
\node[caption,invisible,#2](#3){#4};
}{%
\node[caption,invisible,#2](#3) at (#6) {#4};
}
}
}
%%% Create a text annotation next to another node
\NewDocumentCommand { \annotation } {D<>{.-} O{} m m} {%
\alt<#1>{%
\node[annotation,above of=#3,#2](an_#3){#4};
}{%
\node[annotation,above of=#3,invisible,#2](an_#3){#4};
}
}
%%% Commands for setting custom tikz-style parameters
\newcommand{\setafstyle}[1]{\tikzset{af/.style={#1}}}
\newcommand{\setargumentcolorscheme}[2]{\tikzset{argument colored/.style={argument thick,fill=#2,draw=#1}}}
\newcommand{\setargumentstyle}[1]{\tikzset{argument/.style={argument size,#1}}}
\newcommand{\setattackstyle}[1]{\tikzset{attack/.style={attack width,#1}}}
\newcommand{\setsupportstyle}[1]{\tikzset{support/.style={#1}}}
\newcommand{\setannotationstyle}[1]{\tikzset{annotation/.style={#1}}}