アルゴリズムのインデックスと行を削除する

アルゴリズムのインデックスと行を削除する

以下のことが可能かどうかお尋ねします:

(1)左側のインデックスと最後の行のインデックス(すべて0、黄色で強調表示)を削除しますか?

(2)アルゴリズム内の行(緑色で強調表示)をすべて削除しますか?

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

コードは次のとおりです:

\documentclass[journal]{IEEEtran}
\usepackage[commentColor=black]{algpseudocodex}

\floatplacement{algorithm}{tbp}
\makeatletter
\newcommand{\algorithmname}{\ALG@name}
\renewcommand{\floatc@ruled}[2]{{\@fs@cfont #1} #2\par}
\makeatother
\tikzset{algpxIndentLine/.style={draw=black}}
\algrenewcommand{\alglinenumber}[1]{\bfseries\footnotesize #1}
\algrenewcommand{\textproc}{\bfseries}

\begin{algorithm}[h]
\caption{Sequence}
\begin{algorithmic}[1]
\Statex \textbf{Step I}
\State Do $U_{LL}$
\If{$n$ is odd number}
\State Do $U_n$
\Else
\State Do $L_n$
\EndIf
\Statex \textbf{Step II}
\For{$i=1,\ldots,n$}
\If{$i\bmod{2}==1$}
\State Do $L_i$
\Else
\State Do $U_i$
\EndIf
\EndFor
\Statex \textbf{Step III}
\For{$i=1,\ldots,n-1$}
\If{$i\bmod{2}==1$}
\State Do $U_i$
\Else
\State Do $L_i$
\EndIf
\EndFor
\State Do $L_{LL}$
\end{algorithmic}
\end{algorithm} 

よろしくお願いします。

答え1

\documentclass[journal]{IEEEtran}

\usepackage{algorithm}
\floatplacement{algorithm}{tbp}
\makeatletter
\renewcommand{\floatc@ruled}[2]{{\@fs@cfont #1} #2\par}
\makeatother

\usepackage[commentColor=black,noEnd=false,indLines=false]{algpseudocodex}

\begin{document}

\begin{algorithm}
\caption{Sequence}
\begin{algorithmic}
\Statex \textbf{Step I}
\State Do $U_{LL}$
\If{$n$ is odd number}
\State Do $U_n$
\Else
\State Do $L_n$
\EndIf
\Statex \textbf{Step II}
\For{$i=1,\ldots,n$}
\If{$i\bmod{2}==1$}
\State Do $L_i$
\Else
\State Do $U_i$
\EndIf
\EndFor
\Statex \textbf{Step III}
\For{$i=1,\ldots,n-1$}
\If{$i\bmod{2}==1$}
\State Do $U_i$
\Else
\State Do $L_i$
\EndIf
\EndFor
\State Do $L_{LL}$
\end{algorithmic}
\end{algorithm}

\end{document}

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

答え2

本質的にデフォルトを繰り返す無駄な再定義を削除します。

インデント ガイドが必要ない場合は、関連するオプションを指定します。

ただし、ゼロは表示されず、行番号が表示されます。そのため、ドキュメント内に間違った番号付けの原因となる何か他のものがある可能性があります。

行番号が必要ない場合は、2 番目の例に示すように[1]after を指定しないでください。\begin{algorithmic}

\documentclass[journal]{IEEEtran}

\usepackage{algorithm}
\usepackage[
  commentColor=black,
  indLines=false,
]{algpseudocodex}

\algrenewcommand{\alglinenumber}[1]{\bfseries\footnotesize #1}
\algrenewcommand{\textproc}{\bfseries}

\begin{document}

\begin{algorithm}
\caption{Sequence (with line numbers)}
\begin{algorithmic}[1]
\Statex \textbf{Step I}
\State Do $U_{LL}$
\If{$n$ is odd number}
\State Do $U_n$
\Else
\State Do $L_n$
\EndIf
\Statex \textbf{Step II}
\For{$i=1,\ldots,n$}
\If{$i\bmod{2}==1$}
\State Do $L_i$
\Else
\State Do $U_i$
\EndIf
\EndFor
\Statex \textbf{Step III}
\For{$i=1,\ldots,n-1$}
\If{$i\bmod 2==1$}
\State Do $U_i$
\Else
\State Do $L_i$
\EndIf
\EndFor
\State Do $L_{LL}$
\end{algorithmic}
\end{algorithm}

\newpage

\begin{algorithm}
\caption{Sequence (without line numbers)}
\begin{algorithmic}
\Statex \textbf{Step I}
\State Do $U_{LL}$
\If{$n$ is odd number}
\State Do $U_n$
\Else
\State Do $L_n$
\EndIf
\Statex \textbf{Step II}
\For{$i=1,\ldots,n$}
\If{$i\bmod 2==1$}
\State Do $L_i$
\Else
\State Do $U_i$
\EndIf
\EndFor
\Statex \textbf{Step III}
\For{$i=1,\ldots,n-1$}
\If{$i\bmod{2}==1$}
\State Do $U_i$
\Else
\State Do $L_i$
\EndIf
\EndFor
\State Do $L_{LL}$
\end{algorithmic}
\end{algorithm} 

\end{document}

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

関連情報