TransWikia.com

Problem with repeat in writing algorithm with Latex

TeX - LaTeX Asked by Arezoo abadi on January 20, 2021

I’m confused with my errors about using Repeat in algorithm, with other commands there is no problem but I cant use Repeat.
My code:

begin{algorithm}
    begin{LTR}
        Repeat{$h=h+1$}{$h=5$}
    end{LTR}
end{algorithm}

my error is:

Missing endcsname inserted. ^^I^^IRepeat

One Answer

Remark: I don't have access to the proprietary IEEEtran-fa document class files. (The string "fa" stands for "farsi", right?) However, I think that the OP's issue can be analyzed by (a) employing the IEEEtran document class and (b) omitting the begin{LTR} and end{LTR} directives.

The algorithmic package provides a directive named REPEAT -- note the ALL-UPPERCASE lettering -- which, AFAICT, must be followed by STATE and UNTIL (again: all-uppercase) directives. For sure, the following code compiles fine.

enter image description here

documentclass[conference]{IEEEtran}
usepackage{algorithm,algorithmic}
usepackage{newtxtext,newtxmath} % optional 
begin{document}
begin{algorithmic}
  REPEAT
  STATE $h=h+1$
  UNTIL $h=5$
end{algorithmic}
end{document}

Correct answer by Mico on January 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP