라텍스 알고리즘 표준

라텍스 알고리즘 표준

코드가 어떻게 생겼나요?[1]

나는 내가 작성한 일부 의사 코드에 대해 다음을 사용하는 라텍스 코드를 작성했습니다.

\usepackage{amsmath}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}

라텍스에 알고리즘에 대한 표준이 있는지, 아니면 일반적인 알고리즘에 대한 표준이 있는지 궁금합니다.

제곱근이나 sqrt(상태)를 사용해야 합니까? state[i]분수를 사용해야 합니까, 아니면 나누기 기호만 사용해야 합니까?

코드는 다음과 같습니다.

\makeatletter
    \def\BState{\State\hskip-\ALG@thistlm}
    \makeatother
    %this changes the style of the comments 

    \begin{algorithm}
        \caption{Manhattan Distance}\label{euclid}
        \begin{algorithmic}[1]
            \Procedure{ManDist}{$state$}    \Comment{The current puzzle configuration }
            \State$total\gets 0$
            \State$puzzleLength\gets sizeOf(state)$
            \State$dimensions\gets \sqrt{puzzleLength}$
            \For{$i\gets 1, puzzleLength$}  \Comment{Loops through each tile of the puzzle}
                \State $tileValue\gets state[i]$
                \State $expectedRow\gets \dfrac{(tileValue -1)}{dimensions}$
                \State $expectedCol\gets (tileValue -1)\bmod dimensions$
                \State $rowNum \gets \dfrac{i}{dimensions}$
                \State $rowNum\gets i \bmod dimensions$
                \State $total\gets total \texttt{+} \mid{expectedRow-rowNum}\mid\texttt{+}\mid{expectedCol-colNum}\mid$
            \EndFor
            \State \textbf{return} $total$\Comment{The heuristic is the total}
            \EndProcedure
        \end{algorithmic}
    \end{algorithm}

관련 정보