This question provides several good answers on creating custom algpseudocode blocks with no ending tag.

Based on that, I was wondering if such custom blocks can be redefined in order to detect the noend option, which for the standard blocks and loops makes their final indicator disappear.

Should it be done with a custom command tracking the existence of noend? Is there an internal flag inside algorithmicx that can be used?

I think it can have the following structure (not an actual solution, but a rough sketch):


\ifthenelse{\undefined{\noEndDetector}}{ % A command "sensing" the *noend* option
    \algdef[SE]{...} % Definition considering ending keywords
    \algdef[SxNE]{...} % Definition without ending keywords

Any help is appreciated.

| improve this question | | | | |

Well, after a bit of research it seems this question effectively answers my query.

As it turns out, there is a flag \ALG@noend that can be checked in order to determine if the option noend has been passed to the package.

Code snippet (taken from the question)

% Defines custom \On ... \EndOn block
  {\algorithmicon\ #1\ \algorithmicfrom\ #2\ \algorithmicdo}
  {\algorithmicend\ \algorithmicon}

% Tells algorithmicx not to print an empty line if `noend' is set 
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.