
Estoy intentando escribir un artículo de IEEE Access utilizando la plantilla de su sitio web. Pero tengo problemas para escribir mis pseudocódigos ya que no hay ningún ejemplo de pseudocódigo en su plantilla. Cuando uso la plantilla ieeeaccess, recibo mensajes de error como:
"Extra \endcsname. \Estado",
"Secuencia de control no definida. \doWhile",
"Falta \endcsname insertado. \State".
Además, el resultado no es el que debería ser. Por ejemplo, todos los números de línea son ceros en el pseudocódigo. Además, en lugar de "entrada" y "salida", obtuve "requerir" y "asegurar" después de compilar el archivo .tex.
¿Me falta algún paquete de usuario? (Aunque he probado muchas combinaciones, todavía no he obtenido resultados). ¿Puede alguien darme un ejemplo de pseudocódigo de ieeeaccess junto con los paquetes de usuario necesarios?
\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}
Respuesta1
No debes cargar ambos algorithmic
y algpseudocode
. Dado que estás utilizando la sintaxis de este último, descarta el primero.
Si quieresAporteyProducción, definir la infraestructura para ellos.
Además, no entre y salga del modo matemático y no use \underbar
, pero \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}