5

Below is a minimal working example which recreates the problem I'm facing.

\documentclass{article}
\usepackage{algorithmic}
\usepackage{arabtex}
\begin{document}
\section{Introduction}
\RL{d}
\begin{algorithmic}
\STATE problem
\end{algorithmic}
\end{document}

I get the following error:

 LaTeX Error: 

Command \AND already defined.
               Or name \end... illegal, see p.192 of the manual.
  1. I tried to use algorithmicx instead, and the same problem occur.
  2. If I comment out the algorithmic section, the document compiles successfully
  3. Tried to use savesym as follows but i am still getting the same error.

    \usepackage{algorithmic}
    \usepackage{savesym}
    \savesymbol{AND}
    \usepackage{arabtex}
    

Any help will be appreciated!

  • 2
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – jub0bs Aug 5 '13 at 20:35
  • It looks like there is no workaround for this issue. I have received the following answer from Prof. Klaus Lagally: "Sorry, ArabTeX and Algorithmic are just incompatible. They both define (internally) the commands \AND, \OR, and \NOT, which collide. This cannot be patched, and unfortunately there is no workaround." – Goek Aug 12 '13 at 7:11
1

I don't really know what I'm doing, but if that you stated in your comment is true, the following example seems to work. (info about the reason is in the comments)

\documentclass{article}

\usepackage{algorithmic}
\usepackage{arabtex}

\begin{document}

\section{Introduction}

Some text.

\RL{d}

\let\AND\relax
\let\OR\relax
\let\NOT\relax
\begin{algorithmic}
\STATE problem
\end{algorithmic}

\RL{d}

\let\AND\relax
\let\OR\relax
\let\NOT\relax
\begin{algorithmic}
\STATE problem
\end{algorithmic}

Some text.

\end{document}

You can also define this to be automatic (as egreg noted) using the xpatch package by including this in the preamble:

\usepackage{xpatch}
\xpretocmd{\algorithmic}{\let\AND\relax\let\OR\relax\let\NOT\relax}{}{}
  • 1
    Yes, algorithmic says \newcommand\AND{...}, which is wrong, in my opinion, since these commands are specific for the environment and undefined outside it, under normal circumstances. You can patch the environment to do the \let: load xpatch and say \xpretocmd{\algorithmic}{\let\AND\relax\let\OR\relax\let\NOT\relax}{}{} – egreg Oct 10 '13 at 20:40

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.