Generalrenewcommand\algorithmicendfor and renewcommand\algorithmicendif does not work

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
KK12
Posts: 1
Joined: Fri Jan 12, 2018 9:36 am

renewcommand\algorithmicendfor and renewcommand\algorithmicendif does not work

Post by KK12 »

Hello,
I'm trying to write a program for a pseudocode with while-loops, for-loops and if-else instructions in Latex.
I would like to remove the "do" of the while-loop, the "end for" of the for-loop, the "then" and the "end if" of the if-else statement.

I have the following package installed
\usepackage{algorithm}
\usepackage{algorithmic}
and created the following commands
\newcommand\NoDo{\renewcommand\algorithmicdo{}}
\newcommand\NoThen{\renewcommand\algorithmicthen{}}
\newcommand\NoEndfor{\renewcommand\algorithmicendfor{}}
\newcommand\NoEndif{\renewcommand\algorithmicendif{}}
The first two work, but the last two are not.
No error meassage is generated, but nothing happens. Do I have to write the last two commands differently?

Thanks in advance

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

renewcommand\algorithmicendfor and renewcommand\algorithmicendif does not work

Post by Johannes_B »

Crosspost in goLaTeX
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

renewcommand\algorithmicendfor and renewcommand\algorithmicendif does not work

Post by Stefan Kottwitz »

Solved there on goLaTeX.de (link) by a guest's post, solution was: insert \NoEndWhile before the corresponding \WHILE and not later, not right before \ENDWHILE.

Stefan
LaTeX.org admin
Post Reply