[Tex/LaTex] Custom text instead of line numbers in algorithmic

algorithms

In an algorithm using the algorithmic package, I would like to display for some lines a special symbol (e.g. a +), instead of their line number. Is this possible?

Edit:
Here's a minimal working example.

\documentclass{article}

\usepackage{algorithm}
\usepackage{algorithmic}

\begin{document}

\begin{algorithm}[tb]
  \caption{My algorithm}
\begin{algorithmic}[1]
  \STATE{foo}
  \STATE{bar}
\end{algorithmic}
\end{algorithm}

\end{document}

Best Answer

The following seems to work:

\documentclass{article}

\usepackage{algorithm}
\usepackage{algorithmic}

\makeatletter
\newcommand{\plusline}{%
  \let\old@ALC@lno=\ALC@lno%
  \renewcommand{\ALC@lno} {+%
    \global\let\ALC@lno=\old@ALC@lno}%
}
\makeatother

\begin{document}

\begin{algorithm}[tb]
  \caption{My algorithm}
\begin{algorithmic}[1]
  \STATE{foo}
  \STATE{bar}
  \plusline
  \STATE{foo}
  \STATE{bar}
  \STATE{foo}
  \STATE{bar}
  \STATE{foo}
  \STATE{bar}
\end{algorithmic}
\end{algorithm}

\end{document}

In algorithmic.sty, the command \ALC@lno is responsible to print the line number. The above code changes the command temporarily to just output + and then to reset itself.

output