\documentclass{ieeeaccess}
\IEEEoverridecommandlockouts
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithm}
\usepackage[ruled]{algorithm2e}
\begin{document}
\history{Date of publication xxxx 00, 0000, date of current version xxxx 00, 0000.}
\doi{--.----/ACCESS.2021.DOI}
\title{Securing GA based Routing in an SDN for Blockchained Internet of Things}
\author{\uppercase{xyz} \authorrefmark{1}, \uppercase{abc} \authorrefmark{1,*}, (\IEEEmembership{Senior Member, IEEE})} \address[1]{Great University World} \corresp{*Correspondence: xyz}
\titlepgskip=-15pt
\maketitle
\begin{algorithm}[h]
\caption{LRA for Forwarding Nodes}
\label{Authentication}
% \SetAlgoLined
\KwIn{$ID_{RN},~L_{RN},~Er_{RN}$}
\KwOut{Storing or Updating the Node's Credentials}
\KwResult{$ID_{RN},~L_{RN},~Er_{RN}$ }
\eIf{$ID_{RN},~L_{RN}$ Not Stored in Blockchain}{
\eIf{$Er_{RN} \ge threshold$ }
{
$ID_{RN},~L_{RN},~ En_{RN}$\;
}
{
Reject\;
}
}
{
the $Er_{RN}$ if changed\;
}
\end{algorithm}
\EOD
\end{document}
答案1
该文件ieeeaccess
写得非常糟糕,并且重新定义了一些内核宏(在本例中\textbf
),这必然会造成混乱。如果可以的话,你应该避免使用它。
algorithm
如果您使用 则不要加载algorithm2e
:后者已经提供了前者的功能。还请注意,您需要明确加载graphicx
,因为ieeeaccess
使用它的宏而不实际检查包是否已加载。
\textbf
解决办法是在加载类之前 复制一份原始文件,然后恢复这个定义。(不要脸地自我宣传:使用 ieeeaccess 的 Algorithm2e。
\RequirePackage{letltxmacro}
\LetLtxMacro{\LaTeXtextbf}{\textbf}
\documentclass{ieeeaccess}
\LetLtxMacro{\textbf}{\LaTeXtextbf}
\IEEEoverridecommandlockouts
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage[ruled]{algorithm2e}
\usepackage{graphicx}
\begin{document}
\begin{algorithm}[h]
\caption{LRA for Forwarding Nodes}
\label{Authentication}
% \SetAlgoLined
\KwIn{$ID_{RN},~L_{RN},~Er_{RN}$}
\KwOut{Storing or Updating the Node's Credentials}
\KwResult{$ID_{RN},~L_{RN},~Er_{RN}$ }
\eIf{$ID_{RN},~L_{RN}$ Not Stored in Blockchain}{
\eIf{$Er_{RN} \ge threshold$ }
{
$ID_{RN},~L_{RN},~ En_{RN}$\;
}
{
Reject\;
}
}
{
the $Er_{RN}$ if changed\;
}
\end{algorithm}
\EOD
\end{document}