疑似コードを IEEE Access 形式で書き込むことができませんか?

疑似コードを IEEE Access 形式で書き込むことができませんか?

IEEE Access の Web サイトのテンプレートを使用して論文を書こうとしています。しかし、テンプレートに擬似コードの例がないため、擬似コードを書くのに苦労しています。ieeeaccess テンプレートを使用すると、次のようなエラー メッセージが表示されました。

「追加の\endcsname。\State」、

"未定義の制御シーケンス。\doWhile",

「挿入された \endcsname がありません。\State」。

また、結果は期待どおりに見えません。たとえば、疑似コード内のすべての行番号がゼロです。また、.tex ファイルをコンパイルした後、「input」と「output」の代わりに、「require」と「ensure」が表示されました。

いくつかのユーザー パッケージが不足していますか? (多くの組み合わせを試しましたが、まだ結果がありません) 必要なユーザー パッケージとともに、ieeeaccess 疑似コードの例を教えていただけますか?

\documentclass{ieeeaccess}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage[section]{placeins}
\usepackage{algorithm}
 \usepackage{algpseudocode}
 \usepackage{algorithmicx}
 \algdef{SE}[DOWHILE]{Do}{doWhile}{\algorithmicdo}[1]{\algorithmicwhile\ #1}%

\begin{document}
\begin{algorithm}[H]    
    \caption{Algorithm 1}\label{Alg-Decap}
    \begin{algorithmic}[1]
        \Require{$(C,S_k)$}
        \Ensure{ HashSession$(1,\underbar r,C)$ or HashSession$(0,\rho,C))$ }
        \State $c\leftarrow$ Decode$(\underbar c)$  
        \State $c.(3f)\in\mathcal{R}/q$
        \State $e\leftarrow $ (Rounded$(c.(3f))$ mod 3) $\in \mathcal{R}/3$
        \State $e.(1/g)\in\mathcal{R}/3$
        \State $r'\leftarrow$ Lift($e.(1/g)$) $\in\mathcal{R}/q$
        \State $h.r'\in\mathcal{R}/q$
        \State $c'\leftarrow$ Round$(h.r')$
        \State  $\underbar c'\leftarrow$ Encode$(c')$
        \State $C'\leftarrow(\underbar c',$ HashConfirm$(\underbar r',\underbar h))$
        \If{$C'==C$}
        \State \textbf{return} HashSession$(1,\underbar r,C)$
        \Else
        \State \textbf{ return} HashSession$(0,\rho,C))$
        \EndIf
    \end{algorithmic}
\end{algorithm}
\end{document}

答え1

algorithmicと の両方をロードしないでくださいalgpseudocode。後者の構文を使用しているため、前者は削除してください。

あなたが望むなら入力そして出力、それらのインフラストラクチャを定義します。

また、数式モードを切り替えたり、 を使用しないで\underbarください\underline

\documentclass{ieeeaccess}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{algorithm}
\usepackage{algpseudocode}

\algdef{SE}[DOWHILE]{Do}{doWhile}{\algorithmicdo}[1]{\algorithmicwhile\ #1}%
\algnewcommand\algorithmicinput{\textbf{Input:}}
\algnewcommand\algorithmicoutput{\textbf{Output:}}
\algnewcommand\Input{\item[\algorithmicinput]}
\algnewcommand\Output{\item[\algorithmicoutput]}

% no in and out of math mode!
\newcommand{\Fun}[1]{\mathrm{#1}}

\begin{document}

\begin{algorithm}[htp]

\caption{Algorithm 1}\label{Alg-Decap}

\begin{algorithmic}[1]
  \Input{$(C,S_k)$}
  \Output{$\Fun{HashSession}(1,\underbar r,C)$ or $\Fun{HashSession}(0,\rho,C))$}
  \State $c\leftarrow \Fun{Decode}(\underbar c)$
  \State $c.(3f)\in\mathcal{R}/q$
  \State $e\leftarrow (\Fun{Rounded}(c.(3f))\bmod 3)\in \mathcal{R}/3$
  \State $e.(1/g)\in\mathcal{R}/3$
  \State $r'\leftarrow \Fun{Lift}(e.(1/g)) \in\mathcal{R}/q$
  \State $h.r'\in\mathcal{R}/q$
  \State $c'\leftarrow \Fun{Round}(h.r')$
  \State $\underline{c}'\leftarrow \Fun{Encode}(c')$
  \State $C'\leftarrow(\underline{c}', \Fun{HashConfirm}(\underline{r}',\underline{h}))$
  \If{$C'==C$}
  \State \textbf{return} $\Fun{HashSession}(1,\underline{r},C)$
  \Else
  \State \textbf{return} $\Fun{HashSession}(0,\rho,C))$
  \EndIf
\end{algorithmic}

\end{algorithm}

\EOD

\end{document}

ここに画像の説明を入力してください

関連情報