%\iffalse
% iaria.dtx generated using makedtx version 1.2 (c) Nicola Talbot
% Command line args:
%   -macrocode ".*"
%   -setambles ".*=>\nopreamble"
%   -preamble "Copyright 2023-2026 Christoph P. Neumann    This work may be distributed and/or modified under the  conditions of the LaTeX Project Public License, either version 1.3c  of this license or any later version.  The latest version of this license is in  https://www.latex-project.org/lppl.txt  and version 1.3c or later is part of all distributions of LaTeX  version 2008 or later.    This work has the LPPL maintenance status maintained.    The Current Maintainer of this work is Christoph P. Neumann. "
%   -author "Christoph P. Neumann "
%   -src "(_cpn_copyIntoExamplesFolder_cls.cmd|iaria.cls)=>\1"
%   -date "2023-2026"
%   -dir "src"
%   -doc "doc/iaria.tex"
%   iaria
% Created on 2026/2/24 20:08
%\fi
%\iffalse
%<*package>
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%</package>
%\fi
% \iffalse
% Doc-Source file to use with LaTeX2e
% Copyright (C) 2023-2026 Christoph P. Neumann , all rights reserved.
% \fi
% \iffalse
%<*driver>
\documentclass{ltxdoc}

\CodelineNumbered
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\GetFileInfo{iaria.cls}

\parskip1.0ex
\parindent0.0ex

\begin{document}
\DocInput{iaria.dtx}
\end{document}
%</driver>
%\fi
%\title{\textsf{iaria}\\
%An Unofficial IARIA LaTeX Class}
%\author{Christoph P.\ Neumann \texttt{$<$cyberpetaneuron@gmail.com$>$}}
%\date{Version 0.9.1}
%\maketitle
%\PrintChanges
%
%\begin{abstract}
%The \texttt{iaria}--class provides a convenient environment for writing IARIA scholary publications.
%This version also implements full IARIA specifications for citation style,
%which can only be templated for a specific technological combination like latex/pdflatex in combination with biblatex using a biber backend.
%\end{abstract}
%
%\section{Installation}
%
%The \texttt{zip} or \texttt{tar.gz} file comes with a \texttt{iaria.ins}
%and a \texttt{iaria.dtx} file included which contains the \LaTeX\ stuff.
%
%To extract the class files call:
%
%\begin{verbatim}
%  $ latex iaria.ins
%\end{verbatim}
%
%This call will extract all \LaTeX\ specific files to the current
%directory. You can either use the files for a single
%cv project or you can integrate the files into your \TeX\ installation.
%
%If you just want to use \textsf{iaria} for a single curriculum vitae
%project, the simplest way is just to copy the generated files to the
%folder of the project.
%
%If you want to integrate \textsf{iaria} into  your \TeX\ installation,
%create a directory \texttt{tex/latex/iaria} beneath your \TeX\ installation
%(e.g.~beneath \texttt{/usr/share/texmf}) and copy all files from the
%current directory there. Now call:
%
%\begin{verbatim}
%  $ mktexlsr
%\end{verbatim}
%
%to update the file--cache of \LaTeX.
%
%Hint: The \textsf{iaria} distribution contains a sample docstrip configuration
%in \texttt{docstrip.cfg} via which files can be distributed
%automatically to their correct positions inside a \LaTeX\ installation.
%Feel free to adapt this file to your environment and afterwards call
%\texttt{latex iaria.ins} to install the package to its right place.
%
%\section{Templates}
%
%For a quick start the \textsf{iaria} distribution contains document
%templates.
%The templates can be found in the \texttt{iaria-example-ctan.zip} file.
%
%Especially beginners should NOT start from scatch! Use the example file!
%The iaria package assumes that the latex user has former experience with IEEEtran!
%For example, the formatting of the author block is not documented here, please refer to the IEEEtran documentantion.
%For shared affiliations, there is a formatting option called ``alternate long format'', which you can find in the well-known IEEEtran\_HOWTO.pdf;
%it is also the superior option for IARIA papers with shared affiliations.
%
%BEWARE: If you are completely new to LaTeX, then do NOT use iaria class for your first LaTeX experiment, but please use the IARIA Word template.
%The same advice is true when you have no former IEEEtran experience and when you are not willing to acquire IEEEtran knowledge on your own.
%
%DISCLAIMER: Using this package still requires that you additionally MUST read the
%IARIA formatting guide (www.iaria.org/formatting.doc)
%as well as the IARIA editorial rules (www.iaria.org/editorialrules.html).
%Simply using this package does not relieve you of your responsibility!
%This applies to all aspects: IARIA style and LaTeX/BibTeX know how (like interfering packages) as well as IEEEtran implications (like conference mode, author block, shared affiliation, or cite compression).
%In case of doubt, you are required to understand the content of the iaria.cls file, because before this community-provided package you had to make all these adjustments yourself.
%
%\section{Documentclass}
%
%\DescribeMacro{documentclass iaria}
%This package provides the documentclass \texttt{iaria}. The documentclass
%supports the following options:
%
%\begin{itemize}
%\item |conference|   Passed to IEEEtran (i.\,a., it suppresses page numbers)
%\item |a4paper|      Passed to IEEEtran
%\item |subfig|       Loads subfig package with IARIA style settings
%\item |subcaption|   Loads subcaption package with IARIA style settings
%\item |flushend|     Activate flushend package (compatible with arXiv build process)
%\item |pbalance|     Activate pbalance package (incompatible with arXiv build process)
%\end{itemize}
%
%BEWARE: Usually, you will/must provide IEEEtran option ``conference'' to the iaria package, both for IARIA conferences AND for IARIA journals! Because for IARIA, the formatting rules are the same for conferences and journals -- in contrast to IEEE. Its conference style is the base for IARIA formatting.
%The example file (see above) prominently applies this option.
%
%A Remark about two-column document balancing on the last page:
%The flushend package is recommended, because it works within the arXiv automated build process.
%However, flushend has a major incampatibility with package lineno, which is, e.\,g., transitively loaded by package mindflow.
%Thus, in case when flushend does not have any effect, check whether one of your packages loads lineno.
%Usually you are stuck with your packages and, thus, will instead be forced to switch from flushend to pbalance.
%Please be aware that pbalance works great and has high compatibility, but unfortunately it will not have any effect within the arXiv automated build process.
%In case of both, a somehow needed lineno package and an intended arXiv upload, I recommend to do without two-column balancing on the last page and just to stay away from both flushend and pbalance, in order to ensure that your paper is layouted identically in IARIA submission and arXiv upload.
%I hope this remark proves helpful, it took me some nerve to find out.
%
%There is also another important difference between flushend and pbalance: the handling of footnotes on the last page.
%Flushend provides a decent result, but the result of pbalance is incomprehensible.
%I strongly recommend avoiding footnotes on the last page.
%If you absolutely need footnotes on the last page, consider staying away from two-column balancing on the last page.
%
%About subfigures:
%Both well-known packages subfig and subcaption can be used.
%However, they are not compatible with each other and we can either load one or the other.
%Both require dedicated style settings to be compatible with IARIA formatting rules.
%Thus, the document class provides options to load them for you with correct settings.
%
%In order, to configure table/figure captions correctly for IARIA requirements, the package caption is used.
%There would be other options to achieve this, however, the babel package is disruptive to the table label -- using package caption provides stability to the label configuration against babel intervention.
%There are minor downsides of using caption package:
%it results in a warning about unknown document class that cannot be suppressed, and if you do not use any tables or figures, caption package also results in a warning about ``unused captionsetup'' that cannot be suppressed, either.
%
%There is an open issue about cite compression. Currently, numeric-comp is used instead of ieee-comp. 
%This results in ``[7-9]'' for cite compression.
%IARIA would prefer IEEE-style cite compression ``[7]-[9]'', which could be accomplished with ieee-comp, however, ieee-comp is currently not available on Overleaf.
%Due to the significance of Overleaf to many authors, this has been a hard choice.
%The cite compression is activated for biblatex with option citestyle, which must be given at package load time, and is not supported later on by command ExecuteBibliographyOptions.
%Thus, you are bound to my chosen compromise.
%In case of doubt, you might consider to use my alternative package \texttt{iaria-lite}, which allows you to adjust your bib stack.
%
%\section{Requirements}
%
%We instrument several other \LaTeX\ packages for different purposes,
%which must be available under your installation.
%
%\begin{itemize}
%\item IEEEtran
%\item biblatex
%\item biblatex-ieee
%\item extdash
%\item floatrow
%\item flushend
%\item fontenc
%\item graphicx
%\item hyperref
%\item inputenc
%\item orcidlink
%\item pbalance
%\item subcaption
%\item subfig
%\item times
%\item url
%\item xcolor
%\item xpatch
%\end{itemize}
%
%
%\StopEventually{}
%\section{The Code}
%\iffalse
%    \begin{macrocode}
%<*_cpn_copyIntoExamplesFolder_cls.cmd>
%    \end{macrocode}
%\fi
%    \begin{macrocode}
@echo off

rem ***************************************************************************
rem * author: Christoph P. Neumann
rem ***************************************************************************
cd /d "%~dp0"

echo == ..\examples\* ==
for /D %%D in (..\examples\*) do (
	echo == %%D ==
	xcopy /Y ".\*.cls" "%%~D"
)

pause%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</_cpn_copyIntoExamplesFolder_cls.cmd>
%    \end{macrocode}
%\fi
%\iffalse
%    \begin{macrocode}
%<*iaria.cls>
%    \end{macrocode}
%\fi
%    \begin{macrocode}
%# Copyright (c) 2023-2026 Christoph P. Neumann

% !TeX spellcheck = en-US
% LTeX: language=en-US
% !TeX encoding = utf8
% !TeX program = pdflatex
% !BIB program = biblatex / biber

% DISCLAIMER: Only for latex/pdflatex in combination with biblatex using a
% biber backend. (And neither for XeLaTeX or LuaTeX nor for bibtex or natbib.)
% Because to set the required bibliography configuration, the biblatex
% package needs to be loaded.
% I also need to adjust formatting of ONLINE entries, thus, I have to make
% some assumptions to rely on. And inputenc must be loaded before biblatex.
% Thus, inputenc, fontenc and biblatex with backend=biber are hard coded part
% of this template.
% I could remove these from the cls and make this part of the example.tex,
% but then it would be less foolproof in my opinion.
% I apologize for this opinionated design decission to anyone who is
% jeopardised by it.
% 
% I also had to decide whether to hardcode required usage of IEEEtran
% "conference" option into my class. I decided against it.
% Thus, it is required to use IARIA class like this:
% \documentclass[conference]{iaria}.
% The iaria class passes all class options (like "conference") to IEEEtran.
% The reasoning: There might be a future use case (speculatively) to pass
% IEEEtran options like "a4paper", for IARIA purposes (?)
% For now, IARIA requires IEEE "conference" option, only.

\NeedsTeXFormat{LaTeX2e}

\ProvidesClass{iaria}[2026/02/24 IARIA template v0.9.1]

% Define marker counter for options (counter are global in latex):
\newcounter{iaria@subfigtracker}
\newcounter{iaria@subcaptiontracker}
\newcounter{iaria@pbalancetracker}
\newcounter{iaria@flushendtracker}

% Declare options:

\DeclareOption{subfig}{
  \setcounter{iaria@subfigtracker}{1}
  \typeout{iaria class: subfig option is set (use subfloat command).}
}
\DeclareOption{subcaption}{
  \setcounter{iaria@subcaptiontracker}{1}
  \typeout{iaria class: subcaption option is set (use subfigure command).}
}

% IEEE option onecolumn will be ignored
\DeclareOption{onecolumn}{\OptionNotUsed}

\DeclareOption{pbalance}{
  \setcounter{iaria@pbalancetracker}{1}
  \typeout{iaria class: pbalance option is set.}
}
\DeclareOption{flushend}{
  \setcounter{iaria@flushendtracker}{1}
  \typeout{iaria class: flushend option is set.}
}

% We'll pass any document class options along to the underlying class
% (required IEEE options: conference! For IARIA purposes.)
\DeclareOption*{%
  \PassOptionsToClass{\CurrentOption}{IEEEtran}
}

% Now we'll execute any options passed in
\ProcessOptions\relax

% Instead of defining each and every little detail
% required to create a new document class,
% you can base your class on an existing document class.
\LoadClass{IEEEtran}

% Now paste your code from the preamble here.
% Replace \usepackage with \RequirePackage.
% (The syntax for both commands is the same.)

\RequirePackage{times} % Times New Roman

% inputenc must be loaded before biblatex
\RequirePackage[utf8]{inputenc}

% https://tex.stackexchange.com/questions/664
% /why-should-i-use-RequirePackaget1fontenc
% Has to be loaded AFTER any font packages.
% See https://tex.stackexchange.com/a/2869/9075.
\RequirePackage[T1]{fontenc}

\RequirePackage{graphicx}
\RequirePackage{xcolor}

\RequirePackage{url}
\RequirePackage{orcidlink}
\RequirePackage{hyperref}
\hypersetup{hidelinks,unicode}

% For cite compression: activated by citestyle, which
% must be given at package load time, and is NOT supported
% later on by \ExecuteBibliographyOptions
\RequirePackage[
  style=ieee,
  citestyle=ieee-comp, % by default, activate cite compression
  backend=biber
]{biblatex}
% TODO: numeric-comp results in "[7-9]" and ieee-comp in "[7]-[9]". IARIA requires IEEE-style cite compression, i.e., ieee-comp!
% However, ieee-comp is relatively new! From the perspective of Overleaf, it is only available with Overlead TeXlive 2025 as compiler setting. If you need a lower texlive version, for whichever reason, downgrade to numeric-comp, and usually you will still get it accepted (but then, also use \multiciterangedelim, below)

% Diferring from IEEE, IARIA requires 
%   in bibliography: 6+ authors as first author et al.
%   in \citeauthor: any case of et al. with just first author et al.
% as preamble options of biblatex that may be given after load-time:
\ExecuteBibliographyOptions{
  defernumbers=true,
  hyperref,
  maxnames=5,
  minnames=1,
  maxcitenames=2,
  mincitenames=1,
  %%% IARIA requires format for "Accessed: " dates in YYYY-MM-DD
  %urldate=iso8601, % DEPRECATED, use iso
  urldate=iso, % iso requires also seconds=true
  seconds=true
}

% Due to applied option defernumbers=true:
% Prevent citations in the references are being numbered as '0' in ArXiv
% https://tex.stackexchange.com/questions/463556
% /all-the-citations-in-the-references-are-being-numbered-as-0-in-arxiv-while-upl
\makeatletter
\let\blx@rerun@biber\relax
\makeatother

% When using multiple citation keys in the same \cite command,
% change IEEEtran "[1], [5], [7]" to IARIA-required "[1][5][7]":
%\renewcommand*{\multicitedelim}{][} % for numeric-comp
\renewcommand*{\multicitedelim}{}    % for ieee-comp
%\renewcommand*{\multiciterangedelim}{]--[} % only required for numeric-comp, not for ieee-comp

\renewcommand*{\bibfont}{\small}

% Zotero generates wrong language fields with wrong "en"
% instead of correct "english" option, thus, despite
% default biblatex clearlang, the "en" will incorrectly
% be printed out, even in english papers.
% Make "en" equivalent to "english" and/or its derivatives:
\DeclareRedundantLanguages{en}{english,american,british,
  canadian,australian,newzealand,USenglish,UKenglish}

% Diferring from IEEE, IARIA requires, for ONLINE entries,
% no point but a comma between author and title:
% For style=ieee
\DeclareBibliographyDriver{online}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit
  \printfield{note}%
  \newunit\newblock
  \printlist{organization}
  \newunit\newblock
  \usebibmacro{date}%
  \newunit\newblock
  \iftoggle{bbx:eprint}
  {\usebibmacro{eprint}}
  {}%
  \newunit\newblock
  \usebibmacro{url+urldate}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\makeatletter
% Diferring from IEEE, IARIA requires non-abbreviated references:
\renewcommand{\fnum@figure}{Figure~\thefigure}
% Diferring from IEEE, IARIA requires 14 point bold Times for the title
\renewcommand{\title}[1]{\renewcommand{\@title}{\bfseries\Large #1}}
% Diferring from IEEE, IARIA requires "Keywords" instead of "Index Terms":
\renewcommand\IEEEkeywordsname{Keywords}
\makeatother

\RequirePackage{xpatch}
% Diferring from IEEE, IARIA requires a hyphen after "Keywords"
% instead of an  emdash:
\xpatchcmd\IEEEkeywords{---}{-}{}{}

% Diferring from IEEE, IARIA requires also the keywords in Italic
% (and Bold)(and lower case!):
\let\oldIEEEkeywords\IEEEkeywords
\def\IEEEkeywords{\oldIEEEkeywords\itshape\ignorespaces}

\makeatletter
\renewcommand{\IEEEauthorblockN}[1]{%
% copied from IEEEtran.cls:
    \relax\@IEEEauthorblockNstyle% set the default text style
    \gdef\@IEEEauthorblockXinterlinespace{0pt}% disable strut for spacer row
    \if@IEEEprevauthorblockincol\expandafter\@IEEEauthorblockNtopspaceline\fi
    \global\@IEEEprevauthorblockincoltrue% we now have a block in this column
    \gdef\@IEEEauthorblockXinterlinespace{\@IEEEauthorblockNinterlinespace}%
    \large
    #1%
    \crcr}
\makeatother

% IARIA requires to bring the table caption
% in the same line as label "TABLE I"
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makecaption}
  {\\}
  {.\ }
  {}
  {}
\makeatother

% caption is compatible with babel that intervenes with tablename
\RequirePackage{caption}
% IARIA requires table caption to be
% above, centered, with upper case label ('TABLE'), and small caps text.
% (note that the caption package is only controlling the look & feel of the captions,
%  it does not control the placement of the captions.)
\captionsetup[table]{
  style=base,
  name=TABLE,
  position=auto, % position option is NOT about forcing the label above/below, but ONLY about spacing!
  justification=centering,
  labelsep=period,
  textfont={footnotesize, sc},
  labelfont=footnotesize}
% IARIA requires figure caption to be
% below and centered 
\captionsetup[figure]{
  style=base,
  position=auto, % position option is NOT about forcing the label above/below, but ONLY about spacing!
  justification=centering,
  labelsep=period,
  font={footnotesize,rm}}
% For controlling the placement of the captions
% (table: top | figure: bottom), the package caption
% recommends to use package floatrow:
% (Without foatrom, the positioning is determined by
%  the textual (!) position of command \label in relation to
%  includegraphics/begin-tabular; a well-known latex aspect.)
\RequirePackage{floatrow}
\floatsetup[table]{capposition=top,captionskip=5pt}
\floatsetup[figure]{capposition=bottom,captionskip=8pt}

% IARIA subfigure captions require parentheses and footnotesize:
\ifnum\value{iaria@subfigtracker}=1
  \typeout{iaria class: load subfig package (use subfloat command).}
  \RequirePackage[caption=false,font=footnotesize]{subfig}
\fi
\ifnum\value{iaria@subcaptiontracker}=1
  \typeout{iaria class: load subcaption package (use subfigure command).}
  \RequirePackage{subcaption}
  % IARIA requires subfigure caption to number them with
  % parentheses around latin chars (like "(a)" and "(b)")
  \captionsetup[subfigure]{labelformat=parens,font=footnotesize}
\fi

% Balance/level columns at the last page / in bibliography
% DISCLAIMER: No solution is a 100%/perfect one!
% Mainstream option: pbalance (see https://ctan.org/pkg/pbalance)
% BUT: incompatible with arxiv automated process (!)
\ifnum\value{iaria@pbalancetracker}=1
  \typeout{iaria class: load pbalance package.}
  \RequirePackage{pbalance}
\fi
% Flushend => works with arxiv, but major incampatibility with lineno
% (and, thus, also with mindflow et al.)
\ifnum\value{iaria@flushendtracker}=1
  \typeout{iaria class: load flushend package.}
  \RequirePackage{flushend}
\fi

% ========================================================
% Packages with recommendation to load them last:

% Allows to hyphenate a word that contains a dash:
% https://stackoverflow.com/questions/2193307
% /how-do-i-get-latex-to-hyphenate-a-word-that-contains-a-dash
% Use \-/ for a breakable dash that does not prevent the
% remainer of the word to be hyphenated.
\RequirePackage[shortcuts]{extdash}
% ========================================================

% Finally, we'll use \endinput to indicate that LaTeX can stop reading
% this file. LaTeX will ignore anything after this line.
\endinput
%    \end{macrocode}
%\iffalse
%    \begin{macrocode}
%</iaria.cls>
%    \end{macrocode}
%\fi
%\Finale
\endinput
