最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

latex - Algorithm Package became problematic - Stack Overflow

programmeradmin5浏览0评论

It was smoothly running 6 months ago. But now, it gives a large number of errors. I tried all the solution given on Stack Overflow but in vain. Here is the min. code.

P.S. I tried various combination of "algorithmicx", "algorithmic", "algorithm2e", but none of them worked.

\documentclass[lettersize,journal]{IEEEtran} \usepackage{algpseudocode} \usepackage{algorithm}
\begin{document}
\begin{algorithm}[t]
    \small
    \caption{Optimal Resource Allocation for (14)}
    \begin{algorithmic}
        \State  Initialize $\Lambda^*_{i,j}$ and $(P_i^{h^*}, P_j^{l^*})$ from Algorithm 1.
         $\textbf{G}$.
        \While{$(b-1)> 1$};
        \For{$i = 1 : I$};
        \If{$\Lambda^*_{i,j} < \textbf{G}_l$};
        \State $\textbf{L}_{i,j} = 1$;
        \Else
        \State $\textbf{L}_{i,j} = 0$;
        \EndIf
        \EndFor
        \EndWhile
    \end{algorithmic}
\end{algorithm}
\end{document}

It was smoothly running 6 months ago. But now, it gives a large number of errors. I tried all the solution given on Stack Overflow but in vain. Here is the min. code.

P.S. I tried various combination of "algorithmicx", "algorithmic", "algorithm2e", but none of them worked.

\documentclass[lettersize,journal]{IEEEtran} \usepackage{algpseudocode} \usepackage{algorithm}
\begin{document}
\begin{algorithm}[t]
    \small
    \caption{Optimal Resource Allocation for (14)}
    \begin{algorithmic}
        \State  Initialize $\Lambda^*_{i,j}$ and $(P_i^{h^*}, P_j^{l^*})$ from Algorithm 1.
         $\textbf{G}$.
        \While{$(b-1)> 1$};
        \For{$i = 1 : I$};
        \If{$\Lambda^*_{i,j} < \textbf{G}_l$};
        \State $\textbf{L}_{i,j} = 1$;
        \Else
        \State $\textbf{L}_{i,j} = 0$;
        \EndIf
        \EndFor
        \EndWhile
    \end{algorithmic}
\end{algorithm}
\end{document}

Share Improve this question edited 22 hours ago samcarter_is_at_topanswers.xyz 38.9k5 gold badges57 silver badges76 bronze badges asked yesterday Abdullah1Abdullah1 555 bronze badges 1
  • 1 I don't get any error with an up-to-date texlive installation. Can you show your .log file? – samcarter_is_at_topanswers.xyz Commented 22 hours ago
Add a comment  | 

1 Answer 1

Reset to default 0

Solved. The problem is with: (1) The use of lower case with the control statements like Statement, If, Else (Use capital letters for these reserved words), (2) The use of semicolon (don't use semicolon).

发布评论

评论列表(0)

  1. 暂无评论