currently improving an existing package ('ditaa', based on ditaa0_9.jar) to add support for svg (implemented in ditaa-0.11.0-standalone.jar) yet I'm facing strange macro definition/expansion.
Basically I want to control the behavior of the 'ditaa' binary by adding support of its command line arguments that way (summed up) :
\ProvidesPackage{ditaa}
\RequirePackage[patch]{kvoptions}
% Support for https://github.com/stathissideris/ditaa
\DeclareBoolOption{A} % Turns anti-aliasing off (-A or --no-antialias)
\DeclareBoolOption{noantialias}
\ProcessKeyvalOptions*
\newenvironment{ditaa}[3][\columnwidth]{
% OPTION A <-----
\def\ditaaoptA{\ifthenelse{\boolean{ditaa@A}}{-A }{\ifthenelse{\boolean{ditaa@noantialias}}{--no-antialias }{}}}
% OPTION B <-----
\ifthenelse{\boolean{ditaa@A}}{\def\ditaaoptA{-A }}{\ifthenelse{\boolean{ditaa@noantialias}}{\def\ditaaoptA{--no-antialias }}{\def\ditaaoptA{}}}
\VerbatimOut{\ditaafile}}
{\endVerbatimOut
\immediate\write18{ditaa.jar \ditaaoptA "\ditaafile" "\ditaadir/\ditaastem.png"} % <----- TITI
\begin{figure}[H]
\vdots % because I'm lazy
\end{figure}
\ditaaoptA % <----- TOTO
}
Later...
\usepackage[A]{ditaa}
Ok, so as said, when OPTION A is used, TOTO displays the right argument (-A) but TITI fails because what is executed is something of the like :
runsystem(ditaa.jar \let \begingroup \let \begingroup \NROrg@begingroup \begingroup \def \protect \let \reserved@d = *\def \catcode `\ =5 \par )...executed.
However when using OPTION B, it works in both cases, YET it requires defining the same macro 3 times (with an empty variant) which is cumbersome to maintain and error prone.
Is there a way to get OPTION A (that is more elegant) to work no matter what ?
Thanks.
kvoptions-patch
was not compatible with a current latex and will not be loaded if it detects a new latex. Using \usepackage[patch]{kvoptions} doesn't make sense anymore.-A
and--no-antialias
do the same thing or are they different@PhelypeOleinik
(for example) to ping people, otherwise we won't get notified of your reply