TeX - LaTeX Asked by esra on January 31, 2021
When I wrote the following pseudocode in documentclass{article} format, I get "Input" and "Output" phrases after the compilation but when I write the same latex code in the IEEE Access template I get "Require" and "Ensure" statements as it is, after the compilation. I think in the first case the article format somehow converts the "Require" and "Ensure" phrases into "Input" and "Output" but in IEEE Access format this conversion is not done.
Can someone please explain to me how can I fix this problem? I would like to see "Input" and "Output" instead of "Require" and "Ensure" after the compilation.
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 $cleftarrow$ Decode$(underbar c)$
State $c.(3f)inmathcal{R}/q$
State $eleftarrow $ (Rounded$(c.(3f))$ mod 3) $in mathcal{R}/3$
State $e.(1/g)inmathcal{R}/3$
State $r'leftarrow$ Lift($e.(1/g)$) $inmathcal{R}/q$
State $h.r'inmathcal{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}
You can map "Require" to "Input" and "Ensure" to "Output" using following settings:
algrenewcommandalgorithmicrequire{textbf{Input:}}
algrenewcommandalgorithmicensure{textbf{Output:}}
So in your case, the complete code would be:
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}%
algrenewcommandalgorithmicrequire{textbf{Input:}}
algrenewcommandalgorithmicensure{textbf{Output:}}
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 $cleftarrow$ Decode$(underbar c)$
State $c.(3f)inmathcal{R}/q$
State $eleftarrow $ (Rounded$(c.(3f))$ mod 3) $in mathcal{R}/3$
State $e.(1/g)inmathcal{R}/3$
State $r'leftarrow$ Lift($e.(1/g)$) $inmathcal{R}/q$
State $h.r'inmathcal{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}
Answered by Sam on January 31, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP