-1

Here's my code :

\usepackage{algorithmic}

\begin{algorithm} 

\caption{Calculate $A_{nxn}$} 
\label{Algorithm 1} 

\begin{algorithmic}

\begin{enumerate} \item ... \end{enumerate}

\end{algorithmic}
\end{algorithm}

What's the problem ?

1
  • A minimal working example would have helped...
    – Ivan
    Mar 5, 2021 at 23:24

1 Answer 1

1

You forgot to upload algorithm:

\documentclass{report} 
\usepackage{algorithmic}
\usepackage{algorithm}

\begin{document}
 
See Algorithm \ref{algo-1}

\begin{algorithm} 
 \caption{Calculate $A_{nxn}$}\label{algo-1} 
 \begin{algorithmic}
  \IF{$n<0$} 
  \STATE $x \leftarrow X$ 
  \ENDIF 
 \end{algorithmic}
\end{algorithm}

\end{document}

enter image description here

9
  • no, ! LaTeX Error: Command \algorithm already defined.
    – Sam
    Mar 6, 2021 at 0:26
  • The MWE above works fine with no errors (TeX Live 2020). Are you running a different file?
    – Ivan
    Mar 6, 2021 at 9:46
  • No i run THE file and i get either this error : ! LaTeX Error: Command \RETURN already defined. Or name \end... illegal, see p.192 of the manual. or ! LaTeX Error: \caption outside
    – Sam
    Mar 6, 2021 at 9:49
  • i am editing a \documentclass[12pt]{article}
    – Sam
    Mar 6, 2021 at 9:51
  • Again, the code I provided above works correctly on TeX Live 2020 (also with article in place of report). If you get an error it may mean that 1) You don't have TeX Live 2020; 2) TeX Live is out of date; 3) You are using an online service such as Overleaf. Try deleting the auxiliary files. (The code works fine also in cocalc.com.)
    – Ivan
    Mar 6, 2021 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .