chrmatt / algpseudocodex

LaTeX package for typesetting pseudocode.
38 stars 2 forks source link

Not compatible with new math syntax `\( \)` #19

Open thomwiggers opened 11 months ago

thomwiggers commented 11 months ago

When using the \( \) math syntax, algpseudocodex breaks. So does algpseudocode, but then I have this patch:

%%% fix for usage of \( \) in Algpseudocode
% https://tex.stackexchange.com/questions/669665/use-in-algpseudocode
\newcommand{\algparenthesize}[1]{%
  \if\relax\detokenize{#1}\relax\else(#1)\fi
}
\algdef{SE}[PROCEDURE]{Procedure}{EndProcedure}[2]
 {\algorithmicprocedure\ \textproc{#1}\algparenthesize{#2}}
 {\algorithmicend\ \algorithmicprocedure}
\algdef{SE}[FUNCTION]{Function}{EndFunction}[2]
 {\algorithmicfunction\ \textproc{#1}\algparenthesize{#2}}
 {\algorithmicend\ \algorithmicfunction}
\algrenewcommand\Call[2]{\textproc{#1}\algparenthesize{#2}}
%%% end fix